Skip to content

volumenetwork/VolumeSDK

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

14 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

VolumeSDK

Collection of Tools to deals with the Volume API

How to use

yarn add volumesdk

import VolumeSDK from 'volumesdk';

const url = 'https://myapi.volumenetwork.com';
const email = 'bilbo.baggins@theshire.com';
const password = 'myPrecious';

const vsdk = new VolumeSDK({
  url,
});

vsdk.authenticate(email, password)
  .then(() => {
    vsdk.fetchChannels()
      .then((result) => {
        console.log(result);
      });
  });

Methods

Authenticate

import VolumeSDK from 'volumesdk';

const url = 'https://myapi.volumenetwork.com';
const email = 'bilbo.baggins@theshire.com';
const password = 'myPrecious';

const vsdk = new VolumeSDK({
  url,
});

vsdk.authenticate(email, password)
  .then((userinfo) => {
    console.log(userinfo);
  });

Check is session is active (i.e. not expired)

import VolumeSDK from 'volumesdk';

const url = 'https://myapi.volumenetwork.com';
const email = 'bilbo.baggins@theshire.com';
const password = 'myPrecious';

const vsdk = new VolumeSDK({
  url,
});

vsdk.sessionIsActive()
  .then((result) => {
    console.log(result); // true / false
  });

Get Channels

N.B. Must have authenticated first.

vsdk.fetchChannels()
  .then((channels) => {
    console.log(channels);
  });

Channels

Get All

import Channel from 'volumesdk/dist/channel';

const url = 'https://myapi.volumenetwork.com';
const email = 'bilbo.baggins@theshire.com';
const password = 'myPrecious';

const c = new Channel({
  url,
});


c.authenticate(email, password)
  .then(() => c.fetchAll()
    .then((result) => {
      console.log(result);
    }));

Media

Get All

import Storyboard from 'volumesdk/dist/medias';

const url = 'https://myapi.volumenetwork.com';
const email = 'bilbo.baggins@theshire.com';
const password = 'myPrecious';

const m = new Media({
  url,
});


m.authenticate(email, password)
  .then(() => s.fetchAll()
    .then((result) => {
      console.log(result);
    }));

Storyboards

Get All

import Storyboard from 'volumesdk/dist/storyboard';

const url = 'https://myapi.volumenetwork.com';
const email = 'bilbo.baggins@theshire.com';
const password = 'myPrecious';

const s = new Storyboard({
  url,
});


s.authenticate(email, password)
  .then(() => s.fetchAll()
    .then((result) => {
      console.log(result);
    }));

Get By Id

import Storyboard from 'volumesdk/dist/storyboard';

const url = 'https://myapi.volumenetwork.com';
const email = 'bilbo.baggins@theshire.com';
const password = 'myPrecious';
const id = 1;

const s = new Storyboard({
  url,
});


s.authenticate(email, password)
  .then(() => s.fetch(id)
    .then((result) => {
      console.log(result);
    }));

Save

import Storyboard from 'volumesdk/dist/storyboard';

const url = 'https://myapi.volumenetwork.com';
const email = 'bilbo.baggins@theshire.com';
const password = 'myPrecious';
const id = 1;

const s = new Storyboard({
  url,
});


s.authenticate(email, password)
  .then(() => s.save({
      id: 3, // if no id is set, will create new storyboard
      storyboard: {
        foo: 'bar',
        items: [{}, {}],
      },
    })
    .then((result) => {
      console.log(result);
    }));

About

No description, website, or topics provided.

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published