1.4.1 • Published 7 years ago

synq-media v1.4.1

Weekly downloads
3
License
MIT
Repository
github
Last release
7 years ago

CircleCI Coverage Status

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

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.

VariablesTypePurpose
tokenStringThe JWT Token from authenticating against Akka's /v2/login endpoint
baseUrlStringThe URL to use for the API
videosVideoThe API that handles the Video Akka APIs
accountsAccountThe API that handles the Account Akka APIs
usersUserThe 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.

FunctionParametersPurpose
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, optionalThis 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.

FunctionParametersPurpose
constructor()api - Stringurl - StringThis builds the Account object so that it can interact with the Akka APIs.
all()endpoint - String, optionalThis returns all the videos listed in Akka that you have access to.
info()id - Stringendpoint - String, optionalThis returns all the information about a single video within Akka if you have access.
create()userdata - Objectmetadata - Objectaccounts - Objectendpoint - String, optionalThis creates a new video within Akka
update()id - Stringuserdata - Objectmetadata - Objectendpoint - String, optionalThis updates a video in Akka with the provided information based on the videos's id.
delete()id - Stringendpoint - String, optionalThis 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.

FunctionParametersPurpose
constructor()api - Stringurl - StringThis builds the Account object so that it can interact with the Akka APIs.
all()endpoint - String, optionalThis returns all the accounts listed in Akka that you have access to.
scope()domain - String, optionalendpoint - String, optionalThis returns all the accounts listed in Akka under a domain if you have access.
info()id - Stringendpoint - String, optionalThis returns all the information about a single account within Akka if you have access.
create()type - Stringname - Stringendpoint - String, optionalThis creates a new account within Akka
update()id - Stringtype - Stringname - Stringendpoint - String, optionalThis updates an account in Akka with the provided information based on the account's id.
delete()id - Stringendpoint - String, optionalThis 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.

FunctionParametersPurpose
constructor()api - Stringurl - StringThis builds the User object so that it can interact with the Akka APIs.
all()endpoint - String, optionalThis returns all the users listed in Akka that you have access to.
info()id - Stringendpoint - String, optionalThis returns all the information about a single user within Akka if you have access.
create()email - Stringpassword - Stringpassword_confirmation - Stringaccount_d - String, optionalendpoint - String, optionalThis creates a new user within Akka
update()id - Stringemail - Stringpassword - Stringpassword_confirmation - Stringendpoint - String, optionalThis updates a user in Akka with the provided information based on the users's id.
delete()id - Stringendpoint - String, optionalThis deletes a user if you have permissions to do so.

Development

To download and run this package locally:

  • Clone this repo
  • Run npm install or yarn 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 or yarn install
  • Run npm test and verify output
1.4.1

7 years ago

1.4.0

7 years ago

1.3.5

8 years ago

1.3.4

8 years ago

1.3.3

8 years ago

1.3.2

8 years ago

1.3.1

8 years ago

1.3.0

8 years ago

1.2.6

8 years ago

1.2.5

8 years ago

1.2.4

8 years ago

1.2.3

8 years ago

1.2.2

8 years ago

1.2.1

8 years ago

1.2.0

8 years ago

1.1.12

8 years ago

1.1.11

8 years ago

1.1.10

8 years ago

1.1.9

8 years ago

1.1.8

8 years ago

1.1.7

8 years ago

1.1.6

8 years ago

1.1.5

8 years ago

1.1.4

8 years ago

1.1.3

8 years ago

1.1.2

8 years ago

1.1.1

8 years ago

1.1.0

8 years ago

1.0.7

8 years ago

1.0.6

8 years ago

1.0.5

8 years ago

1.0.4

8 years ago

1.0.3

8 years ago

1.0.2

8 years ago

1.0.1

8 years ago

1.0.0

8 years ago