1.0.1 • Published 3 years ago

danil_tverdohleb-sdk v1.0.1

Weekly downloads
-
License
ISC
Repository
gitlab
Last release
3 years ago

Test-task SDK Lord of Rings

Installation

npm i danil_tverdohleb-sdk yarn add danil_tverdohleb-sdk

Usage

SDK gives you access to service which can be used in development.

export LordOfRingsService from 'danil_tverdohleb-sdk';

const lordOfRingsService = new LordOfRingsService('accessToken');

async function doSomething() {
  const movies = await lordOfRingsService.getAllMovies(); // array of movies
  const movies = await lordOfRingsService.getAllMovies({ option, params}); // detailed information you can see below
  
  // some operations
};

*token can be recieved here -> https://the-one-api.dev/sign-up

Methods

MethodDescription
getAllBooksreturns array of all saved books
getBookByIdreturns book by specified id
getBookChaptersByIdreturns chapters of specified book
getAllMoviesreturns array of all saved movies
getMovieByIdreturns movie by specified id
getMovieQuotesByIdreturns quotes of specified movie
getAllCharactersreturns array of all saved characters
getCharacterByIdreturns character by specified id
getCharacterQuotesByIdreturns quotes of specified character
getAllMovieQuotesreturns array of all saved movie quotes
getQuoteByIdreturns movie quote by specified id
getAllBookChaptersreturns array of all saved chapters
getChapterByIdreturns book chapter by specified id

Additional options (for method which get all item category)

Pagination

ParamData typeDescription
limitnumberspecifies how much items will be received
pagenumberspecifies which page will be returned
offsetnumberspecifies how much items will be skiped

Sort

ParamData typeDescription
fieldstringspecifies field by which it will be sorted
ascbooleanspecifies order of sotring - ascending/descending

Filter

ParamData typeDescription
fieldstringspecifies field by which filter will work, if only it specified, only items with this field will be returned, if opposite true, only items without it
valueString array, string, number or undefinedif only field and one value - returns items which math for it, several values - items with this values
operationstingspecifies math operation which will be used (less than, greater than or equal to)
regexRegExpspecifies pattern which will be used with field
oppositebooleanspecifies opposite action for params - regexp, field, field with value/values

Testing

This SDK has neccessary test for methods, you can see test/add your own only if you have access in repository.

1.0.1

3 years ago

1.0.0

3 years ago