1.0.0 • Published 12 months ago

paulo-henrique-sdk v1.0.0

Weekly downloads
-
License
ISC
Repository
-
Last release
12 months ago

paulo-henrique-SDK

An SDK to access The Lord of the Rings API

Installation

npm install paulo-henrique-sdk

Usage

// ESM
import { makeRepositories,  makeRemoteMovieRepository, makeRemoteQuoteRepository } from 'paulo-henrique-sdk';

// CJS
const { makeRepositories, makeRemoteMovieRepository, makeRemoteQuoteRepository  } = require('paulo-henrique-sdk');


const { movieRepository, quoteRepository } = makeRepositories("<token>")

const movieRepository = makeRemoteMovieRepository("<token>")
const quoteRepository = makeRemoteQuoteRepository("<token>")

The above code indicates a basic usage of the sdk. The point of interest is the import statements at the top. It indicates that it's possible to import 3 factory functions. The makeRepositories factory creates all the sdk repositories returns them in an object. The makeRemoteMovieRepository and makeRemoteQuoteRepository functions create the movieRepository and the quoteRepository respectively. Each factory requires an access token to be provided. This token can be obtained signing up in the API website:

https://the-one-api.dev/account

Methods

MovieRepository

find
movieRepository.find(): Promise<Movie[]>

Returns an Array of Movies

findById
movieRepository.findById(movieId: string): Promise<Movie>

Returns a Movie based on the id provided

findQuotesByMovieId
movieRepository.findQuotesByMovieId(movieId: string): Promise<Quote[]>

Returns an Array of Quotes from a Movie

QuoteRepository

find
quoteRepository.find(): Promise<Quote[]>

Returns an Array of Quotes

findById
quoteRepository.findById(quoteId: string): Promise<Quote>

Returns a Quote based on the id provided

1.0.0

12 months ago

0.0.6

12 months ago

0.0.5

12 months ago

0.0.4

12 months ago

0.0.3

12 months ago

0.0.2

12 months ago

0.0.1

12 months ago