reshuffle-moviesanywhere-connector
v0.0.4
Published
Reshuffle connectors for Movies Anywhere
Downloads
17
Readme
reshuffle-moviesanywhere-connector
Code | npm | Code sample
npm install reshuffle-moviesanywhere-connector
Reshuffle Movies Anywhere Connector
This package contains a Reshuffle connector to Movies Anywhere, providing access to movie data per the Movies Anywhere API.
The following actions return title information in the TitleData
structure,
as defined by the Movies Anywhere API. If the connector is configured with an
API token, the returned data will include trailer information.
The following example creates an API endpoint for retrieving movie data using its EIDR ID. You can try 10.5240/DF48-AB62-4486-C185-9E1B-4 or find EIDR IDs using the Reshuffle EIDR Connector:
const { Reshuffle, HttpConnector } = require('reshuffle')
const { MoviesAnywhereConnector } = require('reshuffle-moviesanywhere-connector')
const app = new Reshuffle()
const ma = new MoviesAnywhereConnector(app)
const http = new HttpConnector(app)
http.on({ method: 'GET', path: '/' }, async (event) => {
const eidr = event.req.query.eidr
if (!/^10\.5240\/([0-9A-F]{4}-){5}[0-9A-Z]$/.test(eidr)) {
return event.res.status(400).send(`Invalid EIDR ID: ${eidr}`)
}
const data = await ma.getTitleByEIDR(eidr)
return event.res.json(data)
})
app.start(8000)
Table of Contents
Configuration Configuration options
Connector actions:
getAllTitles Get all titles data
getTitleById Get title data by Movies Anywhere ID
getTitleByEIDR Get title data by EIDR ID
getTitlesByStudio Get titles data for a specific studio
getTransactionsByUser Get transaction history for user
Configuration options
const app = new Reshuffle()
const moviesAnywhereConnector = new MoviesAnywhereConnector(app)
Connector actions
Get all titles action
Definition:
() => {
count: number,
results: TitleData[],
}
Usage:
const { count, results } = await moviesAnywhereConnector.getAllTitles()
Retrieve all title information stored by Movies Anywhere.
Get title by ID action
Definition:
(
id: string
) => TitleData
Usage:
const id = '7c1d0438-a71d-40a7-8567-6a4f714355cd'
const titleData = await moviesAnywhereConnector.getTitleById(id)
Get the title information associated with a given Movies Anywhere ID.
Get title by EIDR action
Definition:
(
eidr: string
) => TitleData
Usage:
const eidr = '10.5240/CEFE-FECA-CBD0-F72A-E650-H'
const titleData = await moviesAnywhereConnector.getTitleByEIDR(eidr)
Get the title information associated with a given EIDR ID, as specified by the EIDR API.
Get titles by studio action
Definition:
(
studio: 'Disney' | 'Fox' | 'Lionsgate' | 'Sony' | 'Universal' | 'WB'
) => {
count: number,
results: TitleData[],
}
Usage:
const studio = 'Universal'
const { count, results } =
await moviesAnywhereConnector.getTitlesByStudio(studio)
Retrieve all title information for movies released by the specified studio.
Get transactions by user action
Definition:
(userId: string) => tranasactions: Object[]
Usage:
const transactions =
await moviesAnywhereConnector.getTransactionsByUser('myid')
Retrieve the transaction (purchase) history for the specified user. The
specified userId
must be pre-registered with Movies Anywhere.