### Install signageOS SDK via npm Source: https://github.com/signageos/sdk/blob/master/README.md Provides instructions on how to install the signageOS SDK library using the npm package manager. This is the foundational step to integrate the SDK into any JavaScript project, making its functionalities available for use. ```shell npm install @signageos/sdk ``` -------------------------------- ### Generate Local SDK Documentation with TypeDoc Source: https://github.com/signageos/sdk/blob/master/README.md Provides instructions on how to generate comprehensive local documentation for the signageOS SDK using TypeDoc. This process involves installing dependencies and running a script, resulting in a `docs` directory containing HTML documentation for the SDK's classes and methods. ```shell $ npm i && npm run docs ``` -------------------------------- ### Prepare Test Environment for signageOS SDK Source: https://github.com/signageos/sdk/blob/master/README.md Outlines the steps to set up the testing environment for the signageOS SDK. This involves copying a template environment file and filling in specific values, which are necessary for running automated tests and validating SDK functionality. ```shell cp .env.automated.test ``` -------------------------------- ### Initialize signageOS SDK API from Environment Variables Source: https://github.com/signageos/sdk/blob/master/README.md Illustrates how to initialize the signageOS SDK's API clients (V1 and V2) by automatically loading authentication parameters from environment variables. This approach simplifies configuration management, allowing the application to pick up credentials from the execution environment or a `~/.sosrc` file. ```javascript import { createApiV1 } from "@signageos/sdk"; // takes parameters from env vars const api = createApiV1(); // retrieves the list of all devices const devices = await api.device.list(); // ... ``` ```javascript import { createApiV2 } from "@signageos/sdk"; // takes parameters from env vars const api = createApiV2(); // retrieves the list of all devices const devices = await api.device.list(); // ... ``` -------------------------------- ### Run Tests for signageOS SDK Source: https://github.com/signageos/sdk/blob/master/README.md Describes the command to execute the test suite for the signageOS SDK. After preparing the environment variables, this command initiates the automated tests to ensure the SDK's functionality and stability. ```shell npm run test ``` -------------------------------- ### Initialize signageOS SDK API with Direct Credentials Source: https://github.com/signageos/sdk/blob/master/README.md Demonstrates how to initialize the signageOS SDK's API clients (V1 and V2) by directly providing authentication credentials within the code. This method allows explicit control over the API endpoint and authentication tokens, useful for scenarios where environment variables are not preferred or available. ```javascript import { createApiV1 } from "@signageos/sdk"; const api = createApiV1( { url: 'https://api.signageos.io', // Optional organizationAuth: { clientId: '...OAuthClientID...', secret: '...OAuthSecret...', }, accountAuth: { tokenId: '...apiSecurityTokenID...', token: '...apiSecurityToken...', }, }, ); // retrieves the list of all devices const devices = await api.device.list(); // ... ``` ```javascript import { createApiV2 } from "@signageos/sdk"; const api = createApiV2( { url: 'https://api.signageos.io', // Optional organizationAuth: { clientId: '...OAuthClientID...', secret: '...OAuthSecret...', }, accountAuth: { tokenId: '...apiSecurityTokenID...', token: '...apiSecurityToken...', }, }, ); // retrieves the list of all devices const devices = await api.device.list(); // ... ``` -------------------------------- ### Configure Optional signageOS API Environment Variables Source: https://github.com/signageos/sdk/blob/master/README.md Specifies optional environment variables for customizing the signageOS SDK's behavior, such as the REST API URL, request retry attempts, and the profile to use from the `~/.sosrc` file. These settings allow fine-tuning of the SDK's network interactions and configuration loading. ```shell # REST API URL (default to the production server) SOS_API_URL="https://api.signageos.io" # How many times to retry request until it fails SOS_REQUEST_MAX_ATTEMPTS="3" # You can setup which profile to use when loading from `~/.sosrc` file (see details in https://github.com/signageos/cli#run-control-file) SOS_PROFILE= ``` -------------------------------- ### Configure Mandatory signageOS API Environment Variables Source: https://github.com/signageos/sdk/blob/master/README.md Defines the essential environment variables required for authenticating with the signageOS Organization and Account APIs. These tokens (client ID, secret, identification, and security token) are crucial for the SDK to interact with the signageOS platform, especially when using the deprecated singleton API. ```shell # Organization API SECURITY TOKENS SOS_AUTH_CLIENT_ID="...OAuthClientID..." SOS_AUTH_SECRET="...OAuthSecret..." # Account API SECURITY TOKENS SOS_API_IDENTIFICATION="...apiSecurityTokenID..." SOS_API_SECURITY_TOKEN="...apiSecurityToken..." ``` === COMPLETE CONTENT === This response contains all available snippets from this library. No additional content exists. Do not make further requests.