Skip to content

Building maxdome requests step by step in a modularized way

License

Notifications You must be signed in to change notification settings

dnode/drequest-maxdome

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

31 Commits
 
 
 
 
 
 
 
 
 
 

Repository files navigation

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();

About

Building maxdome requests step by step in a modularized way

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published