# opentok-rest

> Unofficial OpenTok REST API

Latest version **0.1.1** (published 2017-05-16) · MIT license · 0 weekly downloads

## Install

```sh
npm install opentok-rest
pnpm add opentok-rest
yarn add opentok-rest
bun add opentok-rest
```

## Health

**Score 15/100 (F)** — status: abandoned.

Positive: no vulnerabilities.

Warnings: low downloads; no types; no esm support; pre 1.0.

Negative: abandoned; low maintenance score.

## Facts

| | |
|---|---|
| Version | 0.1.1 |
| Published | 2017-05-16 |
| First published | 2017-05-16 |
| Weekly downloads | 0 |
| License | MIT |
| TypeScript types | none |
| Module format | CommonJS |
| Dependencies | 3 |
| Known vulnerabilities | 0 (+5 in 3 direct dependencies) |
| Install scripts | no |
| Author | Mathieu Cassagnes |
| Maintainers | mcassagnes |

## Links

- npm: https://www.npmjs.com/package/opentok-rest
- npm.io page: https://npm.io/package/opentok-rest

## Dependencies (3)

- [uuid](https://npm.io/package/uuid.md) ^3.0.1
- [request](https://npm.io/package/request.md) ^2.81.0
- [jsonwebtoken](https://npm.io/package/jsonwebtoken.md) ^7.4.0

## Recent versions

- 0.1.1 (latest) — 2017-05-16

## README

# opentok-rest
Unofficial OpenTok REST API for Node. Not all features are available in the official Node client (most BETA features), this is why we made this module.

[![Build Status](https://travis-ci.org/mcassagnes/opentok-rest.svg?branch=master)](https://travis-ci.org/mcassagnes/opentok-rest)

## Getting started
```
npm install opentok-rest
// or
yarn install opentok-rest
```

```
const OpenTokRest = require('opentok-rest')
const opentok = new OpenTokRest('opentok-key', 'opentok-secret')
```

## Broadcast

#### Start a broadcast
```
opentok.broadcast.start(sessionId, outputs)
  .then(broadcast => {
    // resolves an opentok broadcast object.
  })
```
See doc for an example object: https://tokbox.com/developer/rest/#start_broadcast

#### Start a broadcast
```
opentok.broadcast.stop(broadcastId)
  .then(broadcast => {
    // resolves an opentok broadcast object.
    // example response: https://tokbox.com/developer/rest/#stop_broadcast
  })
  .catch(...)
```

#### Set the layout
See https://tokbox.com/developer/rest/#change_live_streaming_layout for layout options
```
opentok.broadcast.setLayout(broadcastId, layout)
  .then(...)
  .catch(...)
```

## Archive

#### Set the layout
See https://tokbox.com/developer/beta/archive-custom-layout/#dynamically-changing-the-layout-type-while-the-session-is-being-archived for layout options
```
opentok.archive.setLayout(archiveId, layout)
  .then(...)
  .catch(...)
```

---
_Source: https://npm.io/package/opentok-rest · Machine-readable twin of the npm.io package page. Health data is recomputed on every publish._
