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.
TheOneApi SDK can be installed using npm:
npm install joshvermaire-sdk
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()
Retrieves a list of movies.
Retrieves a single movie by ID.
Retrieves a list of quotes for a specific movie.
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.
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' }
).
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
}
}
To test the SDK, simply run npm test
.