0.0.14 • Published 5 years ago

usignxibo v0.0.14

Weekly downloads
4
License
MIT
Repository
github
Last release
5 years ago

XIBO API

Node module to consume the Xibo CMS API

Installation

npm add usignxibo

Usage

On your Xibo CMS server, navigate to the Application page and click the 'Add Application' button to get the Client ID and Client Secret needed to authenticate in the API

With this information you can start consuming the api making the first connection to the server:

const xibo = new Xibo({
  url,
  client_id: conn.client_id,
  client_secret: conn.client_secret,
  grant_type: "client_credentials",
});
if (await xibo.authenticate()) {
  return xibo;
}

Managing Xibo Tags

Follow the documentation on Xibo CMS API to know all the available resources (https://xibo.org.uk/manual-tempel/api/#/tags)

To list/search tags

const allTags = await xibo.tags.list();

To search using any tag search criteria (see the TagCriteria interface)

const tags = await xibo.tags.list({ tagId: 5 });

To add a new tag

const newTag = await xibo.tags.insert({
  name: "TagName",
});

To update a existing tag (using the newTag created above)

const updatedTag = await newTag.save({
  ...newTag,
  name: "TagNameChanged",
});

To delete a tag (using the updatedTag created above)

const removed = await updatedTag.delete();

Managing Xibo DisplayGroups

Follow the documentation on Xibo CMS API to know all the available resources (https://xibo.org.uk/manual-tempel/api/#/displayGroup)

To list/search tags

const allDisplayGroups = await xibo.displaygroups.list();

To search using any displayGroup search criteria (see the DisplayGroupCriteria interface)

const displaygroups = await xibo.displaygroups.list({ tagId: 5 });

To add a new displayGroup

const newDG = await xibo.displaygroups.insert({
  displayGroup: `DG_Name`,
  isDynamic: 0,
});

To update a existing displayGroup (using the newDG created above)

const updDG = await newDG.save({
  ...newDG,
  name: "DG_NameChanged",
});

To insert an existing display to the displayGroup

const displayID = 1;
await updDG.addDisplays(displayID);

To remove a display from the displayGroup

const displayID = 1;
await updDG.removeDisplays(displayID);

To insert another displayGroup as a member of the displayGroup

const anotherDisplayGroup = 1;
await updDG.addDisplayGroups(anotherDisplayGroup);

To remove a displayGroup as member of the displayGroup

const anotherDisplayGroup = 1;
await updDG.removeDisplayGroups(anotherDisplayGroup);

To delete a displayGroup (using the updDG created above)

const removed = await updDG.delete();
0.0.14

5 years ago

0.0.12

5 years ago

0.0.11

5 years ago

0.0.8

5 years ago