npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2024 – Pkg Stats / Ryan Hefner

ooyala-api

v0.14.1

Published

Ooyala API client for Node.js

Downloads

15

Readme

NPM version Build Status Coverage Status Dependency Status

ooyala-api

Ooyala API client library and CLI for Node.js

Install

NPM

API

const OoyalaApi = require('ooyala-api');

const api = new OoyalaApi('Your Ooyala API Key', 'Your Ooyala API Secret', {concurrency: 6});
const embedCode = 'Content ID';

// GET
api.get(`/v2/assets/${embedCode}`)
.then((body) => {
  // JSON object
})
.catch((err) => {
  // Error response
});

// GET (with params + pagination)
api.get('/v2/assets', {where: `labels+INCLUDES+'Music'`}, {recursive: true})
.then((items) => {
  // All items in an array (recursive calls will be done internally)
})
.catch((err) => {
  // Error response
});

// POST
api.post('/v2/assets', {}, {
  name: `test ${Date()}`,
  asset_type: 'remote_asset',
  is_live_stream: true,
  stream_urls: {
    'flash': FLASH_URL,
    'iphone': IPHONE_URL
  }
}).then((body) => {});

// DELETE
api.delete(`/v2/assets/${embedCode}`).then((body) => {});

options

| API | Option Name | Type | Default | Meaning | | ----------- | -------------- |:-------:|:-------:| :----------------------------------------| | constructor | subdomain | String | "api" | Will be used to construct the destination server's host name. (default=api.ooyala.com) | | constructor | secure | Boolean | false | If true, the library sends https request | | constructor | expirationTime | Integer | 86400 | TTL of the API call in seconds | | constructor | concurrency | Integer | 5 | Limits the number of concurrent API calls. The valid range is 1~10 | | constructor | accountSecret | String | "" | Account Token API's secret key | | get | recursive | Boolean | false | If true, the library calls API recursively as long as next_page is specified in the response | | get, post, put, delete, patch | headers | Object | undefined | If the object contains HTTP headers, the key-value pairs are used for the request. | | get, post, put, delete, patch | requestURL | String | undefined | If defined, the url is just used. No params are added internally. | | get, post, put, delete, patch | accountId | String | undefined | If defined, Account Token API will be called with the specified accountId before the main API call. And then its return value (account_token) will be used for the main API call. | | get, post, put, delete, patch | subdomain | String | (the value specified at constructor) | Overrides the value specified at constructor. | | get, post, put, delete, patch | secure | Boolean | (the value specified at constructor) | Overrides the value specified at constructor. |

CLI

Please put config file(s) in your work directory.

 $ mkdir config
 $ vi config/default.json
 {
   "api": {
     "key":        "Your Ooyala API Key",
     "secret":     "Your Ooyala API Secret"
   }
 }
Usage:
    oo [options] command [parameters]

Options:
  -h, --help    Print help
  -v, --version Print version

Commands:
  token           Generates Ooyala player token (OPT) request URL.
  sign            Generates a signature based on given params.
  upload          Uploads file(s).
  remote          Creates a remote asset
  source          Downloads source file to stdout

Syntax:
  oo token embed-code(s) [accountId]
  oo sign url [method body]
  oo upload local-file-path(s) [title chunkSize profile]
  oo remote asset-name [dash hls hds]
  oo source embed-code [info]

Example:
  oo -v
  oo token embed_code
  oo token embed_code1 embed_code2
  oo token embed_code --expiration 604800
  oo token embed_code --accountId david1203
  oo sign /hoge?foo=bar
  oo sign /hoge?foo=bar --body '{"data": {"comment": "This is JSON"}}'
  oo sign /hoge?foo=bar --body '{"data": {"comment": "This is JSON"}}' --method PATCH
  oo upload ./path/to/file --title "My video"
  oo upload ./path/to/files/*.mp4 --title "My videos" --chunkSize 1024 --profile abc
  oo upload ./path/to/files --title "My VR 360 videos" --profile xyz --vrType monoscopic
  oo remote "My remote asset" --dash http://x.jp/a.mpd --hls http://x.jp/a.m3u8 --hds http://x.jp/a.f4m
  oo source embed_code1 --info
  oo source embed_code1 > ./path/to/file
  oo source embed_code1 --resume ./path/to/file

Parameters:
  expiration    TTL of the signature in seconds (this param works with every command that requires signing)
  accountId     Viewer's login id (default = undefined)
  method        (GET | POST | PUT | DELETE | PATCH) default = GET
  body          Body string (default = '')
  title         Title of the video (default = {file name} if multiple files are specified, the title is suffixed by '- part n')
  chunkSize     Byte size of each chunk (default = 204800)
  profile       Profile id used for encoding
  vrType        monoscopic or stereoscopic(side-by-side)
  dash          Remote asset URL for MPEG-DASH
  hls           Remote asset URL for HTTP Live Streaming
  hds           Remote asset URL for HTTP Dynamic Streaming
  info          If specified the output will be source_file_info
  resume        An existing file to which the data will be appended