0.1.0 • Published 1 year ago

joshvermaire-sdk v0.1.0

Weekly downloads
-
License
MIT
Repository
github
Last release
1 year ago

TheOneApi SDK

TheOneApi SDK is a JavaScript library for interacting with the TheOneAPI REST API. It simplifies the process of making requests to the API by providing a higher-level interface.

Installation

TheOneApi SDK can be installed using npm:

npm install joshvermaire-sdk

Usage

To use TheOneApi SDK, you must first obtain an API key from the TheOneAPI website. Once you have an API key, you can create a new instance of the TheOneApiSDK class and use its methods to interact with the API.

const TheOneApiSDK = require('joshvermaire-sdk');
const client = new TheOneApiSDK('YOUR_API_KEY');

// Example: Get movies
let movies = await client.movie.getMovies()

Methods

Movie Endpoints

movie.getMovies(params)

Retrieves a list of movies.

movie.getMovie(movieId, params)

Retrieves a single movie by ID.

movie.getMovieQuotes(movieId, params)

Retrieves a list of quotes for a specific movie.

Optional Parameters

Each method accepts an optional params object. If you want to pass any additional query parameters to your API request, you can add them as key-value pairs. For example, you could add { limit: 1 }, { page: 2 }, { offset: 3 }, or a combination of these to modify your query.

Sorting

You can use the params object to specify sorting and filtering options. To sort your API response, you can pass a sort object with a value property:

{ 
  sort: {
    value: 'name',
    direction: 'asc'
  }
}

Alternatively, you can use a string to specify sorting (e.g. { sort: 'name:asc' }).

Filtering

To filter your API response, you can pass a filter object with a key, operator, and value properties. For example:

{
  filter: {
    key: 'budgetInMillions',
    operator: '<',
    value: 100
  }
}

Testing

To test the SDK, simply run npm test.

0.1.0

1 year ago