All API interactions are wrapped up in the RevClient class.

import {RevClient} from '/path/to/rev-client.js';

// create client object
const rev = new RevClient({
url: 'https://my.rev.url',
apiKey: 'my.user.apikey',
secret: 'my.user.secret',
// or can login via username + password
// username: 'my.username',
// password: 'my.password',
logEnabled: true, // turn on debug logging
keepAlive: true // automatically extend session
rateLimits: true // automatically enforce rate limiting (avoid 429 error responses)
});

(async () => {
// call login api and start session. will throw error if invalid login
await rev.connect();

// get details of current user
const currentUser = await rev.user.details('me');
console.log(currentUser);
});

Constructors

Properties

instance properties

APIs

Methods to call the Rev APIs are broken up into namespaces. They roughly match up to the categories in the Rev API Docs Documentation for the individual api namespaces are broken out into separate pages:

Internal

for internal use

Request

Methods to directly make (authenticated) HTTP requests

Session

Methods to maintain the authentication session (accessToken)

Constructors

Properties

url: string

The Rev tenant url (i.e. https://my.rev.url)

  • get isConnected(): boolean
  • Returns true if session is connected and token's expiration date is in the future

    Returns boolean

  • get sessionExpires(): Date
  • Date value when current accessToken will expire

    Returns Date

  • get sessionState(): IRevSessionState
  • get/set serialized session state (accessToken, expiration, and userId/apiKey) Useful if you need to create a new RevClient instance with the same accessToken

    Returns IRevSessionState

  • set sessionState(state: IRevSessionState): void
  • get/set serialized session state (accessToken, expiration, and userId/apiKey) Useful if you need to create a new RevClient instance with the same accessToken

    Parameters

    Returns void

  • get token(): undefined | string
  • the current session's accessToken

    Returns undefined | string

APIs

admin: AdminAPI
audit: AuditAPI
auth: AuthAPI
category: CategoryAPI
channel: ChannelAPI
device: DeviceAPI
environment: EnvironmentAPI
group: GroupAPI
playlist: PlaylistAPI
recording: RecordingAPI
upload: UploadAPI
user: UserAPI
video: VideoAPI
webcast: WebcastAPI
zones: ZoneAPI

Internal

logEnabled: boolean

turns on/off debug logging to console

session: IRevSession
  • This is an internal class that handles authentication and maintaining the session. It should not be used directly.
  • used internally to write debug log entries. Does nothing if logEnabled is false

    Parameters

    Returns void

Request

  • Make a DELETE Request

    Parameters

    • endpoint: string

      API path

    • Optionaldata: {}

      query parameters as JSON object

    • Optionaloptions: RequestOptions

      Additional request options

    Returns Promise<void>

  • Make a GET Request

    Type Parameters

    • T = any

    Parameters

    • endpoint: string

      API path

    • Optionaldata: {}

      Query parameters as json object

    • Optionaloptions: RequestOptions

      Additional request options

    Returns Promise<T>

    Depends on options.responseType/API response - usually JSON object except for binary download endpoints

  • Make a PATCH Request

    Parameters

    • endpoint: string

      API path

    • Optionaldata: {}

      Request body

    • Optionaloptions: RequestOptions

      Additional request options

    Returns Promise<void>

  • Make a POST Request

    Type Parameters

    • T = any

    Parameters

    • endpoint: string

      API path

    • Optionaldata: {}

      Request body

    • Optionaloptions: RequestOptions

      Additional request options

    Returns Promise<T>

    Depends on options.responseType/API response - usually JSON object

  • Make a GET Request

    Type Parameters

    • T = any

    Parameters

    • endpoint: string

      API path

    • Optionaldata: {}

      Request body

    • Optionaloptions: RequestOptions

      Additional request options

    Returns Promise<T>

    Depends on options.responseType/API response - usually JSON object or void

  • make a REST request. The Authorization http header for the current session will automatically be added.

    Type Parameters

    • T = any

    Parameters

    • method: HTTPMethod

      HTTP Method

    • endpoint: string

      API endpoint path

    • data: any = undefined

      Request body if PUT/POST/PATCH or query parameters object if GET/DELETE/HEAD. objects/arrays are automatically stringified

    • options: RequestOptions = {}

      additional request options, including additional HTTP Headers if necessary.

    Returns Promise<Rev.Response<T>>

    the decoded response body as well as statuscode/headers/and raw response

Session

  • Call the Extend Session API to maintain the current session's expiration time Note that this API call is automatically handled unless keepAlive: false was specified in configuring the client.

    Returns Promise<void>

  • Returns true/false based on if the session is currently valid

    Returns Promise<boolean>

    Promise