synq-media v1.4.1
synq-media-nodejs
synq-media
is an NPM package for interacting with the SYNQmedia API layer.
Installation
To install this package with npm
, run npm install --save synq-media
. If you prefer to use yarn
then run yarn add synq-media
.
Dependencies
axios
= This is used for the API requests.
regenerator-runtime
= This is used when converting to ES5 syntax via npm run build
. If you switch this to something like babel-polyfill
then it will not work with multiple installations such as including in synq-ui and doppelganger.
Production API
Akka's production API documentation can be found on Stoplight. This package is just a layer to make interacting with Akka easier for NodeJS users.
Contributing
- Follow all of the guides outlined by SYNQ's getting_started
Module Documentation
There are currently 3 different API Sections implemented. They can all be accessed through the Synq
object.
Synq
Synq has several variables that can be accessed in order to update data. If you change the token or baseUrl then you will need to re-authenticate via the /v2/login
method to ensure the videos
and accounts
objects are updated accordingly.
Variables | Type | Purpose |
---|---|---|
token | String | The JWT Token from authenticating against Akka's /v2/login endpoint |
baseUrl | String | The URL to use for the API |
videos | Video | The API that handles the Video Akka APIs |
accounts | Account | The API that handles the Account Akka APIs |
users | User | The API that handles the User Akka APIs |
There are 2 main functions that Synq has. These are for creating a Synq object (the constructor) and for authenticating against the Akka system. For more information please see below.
Function | Parameters | Purpose |
---|---|---|
constructor() | params - { url: string (optional), token: string (optional) } | This builds the Synq object.If no token is provided then you will need to use hte login() function to get a token.If no URL is provided then the default URL will be used. |
login() | email - Stringpassword - Stringendpoint - String, optional | This logs you in via the Akka /v2/login endpoint. A token will be returned. |
Video
All functions for the Video class are asynchronous (they will return a promise). You will normally want to go through the Synq object to perform any actions on the Video class. For example:
async function getVideos() {
var synq = new Synq();
var token = await synq.login("test", "test");
var videos = await synq.videos.all();
}
The full list of functions you can call on the Video class are listed below.
Function | Parameters | Purpose |
---|---|---|
constructor() | api - Stringurl - String | This builds the Account object so that it can interact with the Akka APIs. |
all() | endpoint - String, optional | This returns all the videos listed in Akka that you have access to. |
info() | id - Stringendpoint - String, optional | This returns all the information about a single video within Akka if you have access. |
create() | userdata - Objectmetadata - Objectaccounts - Objectendpoint - String, optional | This creates a new video within Akka |
update() | id - Stringuserdata - Objectmetadata - Objectendpoint - String, optional | This updates a video in Akka with the provided information based on the videos's id. |
delete() | id - Stringendpoint - String, optional | This deletes a video if you have permissions to do so. |
Account
All functions for the Account class are asynchronous (they will return a promise). You will normally want to go through the Synq object to perform any actions on the Account class. For example:
async function getAccounts() {
var synq = new Synq();
var token = await synq.login("test", "test");
var accounts = await synq.accounts.all();
}
The full list of functions you can call on the Account class are listed below.
Function | Parameters | Purpose |
---|---|---|
constructor() | api - Stringurl - String | This builds the Account object so that it can interact with the Akka APIs. |
all() | endpoint - String, optional | This returns all the accounts listed in Akka that you have access to. |
scope() | domain - String, optionalendpoint - String, optional | This returns all the accounts listed in Akka under a domain if you have access. |
info() | id - Stringendpoint - String, optional | This returns all the information about a single account within Akka if you have access. |
create() | type - Stringname - Stringendpoint - String, optional | This creates a new account within Akka |
update() | id - Stringtype - Stringname - Stringendpoint - String, optional | This updates an account in Akka with the provided information based on the account's id. |
delete() | id - Stringendpoint - String, optional | This deletes an account if you have permissions to do so. |
User
All functions for the User class are asynchronous (they will return a promise). You will normally want to go through the Synq object to perform any actions on the User class. For example:
async function getAccounts() {
var synq = new Synq();
var token = await synq.login("test", "test");
var users = await synq.users.all();
}
The full list of functions you can call on the User class are listed below.
Function | Parameters | Purpose |
---|---|---|
constructor() | api - Stringurl - String | This builds the User object so that it can interact with the Akka APIs. |
all() | endpoint - String, optional | This returns all the users listed in Akka that you have access to. |
info() | id - Stringendpoint - String, optional | This returns all the information about a single user within Akka if you have access. |
create() | email - Stringpassword - Stringpassword_confirmation - Stringaccount_d - String, optionalendpoint - String, optional | This creates a new user within Akka |
update() | id - Stringemail - Stringpassword - Stringpassword_confirmation - Stringendpoint - String, optional | This updates a user in Akka with the provided information based on the users's id. |
delete() | id - Stringendpoint - String, optional | This deletes a user if you have permissions to do so. |
Development
To download and run this package locally:
- Clone this repo
- Run
npm install
oryarn install
- Run
npm link
to add the repo to your local NPM - Change to the directory you want to run this from and run
npm link synq-media
to link the local version
To run the tests you will need to:
- Clone this repo
- Run
npm install
oryarn install
- Run
npm test
and verify output
7 years ago
7 years ago
8 years ago
8 years ago
8 years ago
8 years ago
8 years ago
8 years ago
8 years ago
8 years ago
8 years ago
8 years ago
8 years ago
8 years ago
8 years ago
8 years ago
8 years ago
8 years ago
8 years ago
8 years ago
8 years ago
8 years ago
8 years ago
8 years ago
8 years ago
8 years ago
8 years ago
8 years ago
8 years ago
8 years ago
8 years ago
8 years ago
8 years ago
8 years ago
8 years ago
8 years ago