Skip to content

Latest commit

 

History

History
77 lines (56 loc) · 2.11 KB

File metadata and controls

77 lines (56 loc) · 2.11 KB

Dependency Status devDependency Status

Installation

npm i --save drequest-maxdome

Initialisation

const maxdome = require('drequest-maxdome').getRequestBuilder();

Attention: drequest-maxdome will use several information from the package.json and add them to the headers. This makes it easier to identify the source of the request in the logs of maxdome if there are issues. The information which will be used:

  • from:
    • If the author is an object: ${author.name} <${author.email}> (${author.url})
    • If not, the string will be used
  • user-agent: ${app.name} v${app.version} via ${lib.name} v${lib.version}

Examples

Get information for a specific asset by ID

const AssetsQueryOptions = require('drequest-maxdome').AssetsQueryOptions;

const assetId = <assetId>;
const assetsQueryOptions = new AssetsQueryOptions(assetId);

const assets =
  await maxdome.request('assets')
    .addOptions(assetsQueryOptions)
    .send();

Search assets by title and get the first 3 results

const AssetsQueryOptions = require('drequest-maxdome').AssetsQueryOptions;

const title = '<title>';
const assetsQueryOptions = 
  new AssetsQueryOptions()
    .addFilter('contentTypeSeriesOrMovies')
    .addFilter('search', title)
    .addQuery('pageSize', 3);
    
const assets =
  await maxdome.request('assets')
    .addOptions(assetsQueryOptions)
    .send();

Get the 50 newest store movies

const AssetsQueryOptions = require('drequest-maxdome').AssetsQueryOptions;

const title = '<title>';
const assetsQueryOptions = 
  new AssetsQueryOptions()
    .addFilter('availableWithoutPackage')
    .addFilter('movies')
    .addFilter('new')
    .addFilter('notUnlisted')
    .addQuery('pageSize', 50)
    .addSort('activeLicenseStart', 'desc');
    
const assets =
  await maxdome.request('assets')
    .addOptions(assetsQueryOptions)
    .send();