Giter Club home page Giter Club logo

elemental-live-client's Introduction

elemental-live-client

Build Status codecov

JS library to communicate with Elemental live API.

Usage

The client provides standard methods for resources, so calls will use be structured in the format <client-instance>.<resource>().<operation>().

First, initialize the client. Optionally, provide any extra headers to add to requests. Note, adding a version string is optional but instructs the client to use that version in requests to the API.

const client = new ElementalClient('https://elemental-server.example.com');

or

const client = new ElementalClient('https://elemental-server.example.com', { 'X-API-Key': 'anApiKey' },'v2.15.3.0');

API operations always return promises that resolve with the response data and fail with details about the failure. An example, listing presets:

client.presets().list()
  .then((data) => console.log(`Got presets: ${data}`))
  .catch((err) => console.log(`Something went wrong: ${err}`));

Available resources

The following resources are currently available:

  • schedules
  • liveEvents
  • liveEventProfiles
  • presets
  • presetCategories
  • devices

Available operations

Common operations are:

  • create
  • retrieve
  • update
  • delete
  • list

Some resources might include more specific operations (for example, resetting a live event).

Contributing

Contributions are welcome! In order to run this project locally, you have to have node.js 6+ installed locally.

Just make sure your contributions pass the test suite and eslint validation. Travis CI will help you in ensuring that :)

Setting up local environment

Setting up the local environment is a simple task: just ensure that you have node.js and npm installed, clone this repo and then run:

% npm install

This will install all dependencies.

Running tests and eslint

After installing all dependencies, you can run the tests with the command:

% npm run test

linting is also available, provided by eslint. The command to lint the source is very intuitive:

% npm run lint

Integration tests/Examples

You can integration tests in the file test/integration-test.js file. It contains integration tests that can also serve as examples on how to use the client.

To run integration tests locally, you need to provide the address of an actual Elemental server through the environment variable ELEMENTAL_CLIENT_INTEGRATION_TESTS_HOST and run npm run test. For example:

% ELEMENTAL_CLIENT_INTEGRATION_TESTS_HOST=http://elemental-live.example.com npm run test

elemental-live-client's People

Contributors

dependabot-preview[bot] avatar dependabot[bot] avatar esonderegger avatar flavioribeiro avatar fsouza avatar jfwhitehead avatar scentless-apprentice avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

elemental-live-client's Issues

support REST authentication on the client

some extra headers needed to be passed if the api endpoint is not entirely open:

Authentication and REST
When authentication is enabled on the Elemental Live system, additional information must be sent with the REST command in order to properly authenticate the request. The following additional headers must be set: X-Auth-User, X-Auth-Expires, X-Auth-Key.

The X-Auth-User header contains the login of the user to authenticate.

The X-Auth-Expires header contains the Unix timestamp (in UTC) that indicates the time after which the server will no longer accept the request as valid. For security purposes, Elemental recommends that this value should be ~30 seconds in the future.

The X-Auth-Key header should be constructed using the following algorithm:

md5(api_key + md5(url + X-Auth-User + api_key + X-Auth-Expires))

input preview request is not hitting the right api endpoint

we should use the /generate_preview for preview inputs, the same way the UI does. This way we'll receive errors when trying to generate preview of inputs being used in transmissions. I don't know if the /generate_preview endpoint is documented but I could see some interesting stuff on their routes.rb file.

I'll try to work on this and submit a PR.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.