1.0.2 • Published 1 year ago
liblab-kolberszymon v1.0.2
The One API SDK
The One API SDK is a simple TypeScript library that provides an interface to interact with The One API. The SDK currently supports the /movie
, /movie/{id}
, and /movie/{id}/quote
endpoints.
Table of Contents
Requirements
- Node.js 12.x or later
- A valid API key from The One API
Installation
- Clone the repository:
git clone https://github.com/yourusername/the-one-api-sdk.git
- Navigate to the project directory and install the dependencies:
cd the-one-api-sdk
yarn
Usage
- Import the TheOneAPISDK class:
import { TheOneAPISDK } from "./the-one-api-sdk";
- Initialize the SDK with your API key:
const apiKey = "your-api-key-here";
const sdk = new TheOneAPISDK();
await sdk.init(apiKey);
- Use the SDK to make requests to the API:
// Get all movies
const movies = await sdk.getMovies();
console.log(movies);
// Get a specific movie by ID
const movieId = "5cd95395de30eff6ebccde5c"; // Example movie ID
const movie = await sdk.getMovie(movieId);
console.log(movie);
// Get quotes for a specific movie
const quotes = await sdk.getMovieQuotes(movieId);
console.log(quotes);
Testing
To run the tests, use the following command:
yarn test