1.0.0 • Published 11 months ago
@jkeene32/the-one-api-sdk v1.0.0
# OneAPISDK
The OneAPISDK is a JavaScript library that provides a convenient way to interact with the One API. It simplifies the process of making API calls and handling the responses.
## Installation
You can install the OneAPISDK package via npm. Run the following command:
npm install @jkeene32/the-one-api-sdk
## Usage
To use the OneAPISDK in your project, follow these steps:
1. Import the OneAPISDK class into your JavaScript file:
```javascript
const OneAPISDK = require('@jkeene32/the-one-api-sdk');
Create an instance of the OneAPISDK class by providing the API URL and bearer token:
const apiUrl = 'https://the-one-api.dev/v2'; // Replace with the appropriate api url/version const bearerToken = 'your-bearer-token'; // Replace with the actual bearer token const apiSDK = new OneAPISDK(apiUrl, bearerToken);
Use the methods provided by the OneAPISDK instance to interact with the API. Here are some examples:
apiSDK.getMovies() .then((movies) => { console.log(movies); }) .catch((error) => { console.error(error); });
apiSDK.getMovie('id') .then((movie) => { console.log(movie); }) .catch((error) => { console.error(error); });
apiSDK.getMovieQuotes('id') .then((quotes) => { console.log(quotes); }) .catch((error) => { console.error(error); });
Replace
'https://api.example.com'
with the actual API URL and'your-bearer-token'
with the valid bearer token required to access the API.
API Reference
getMovies()
Returns an array of movies.
apiSDK.getMovies()
.then((movies) => {
console.log(movies);
})
.catch((error) => {
console.error(error);
});
getMovie(id)
Returns a single movie object based on the provided ID.
apiSDK.getMovie('5cd95395de30eff6ebccde5c')
.then((movie) => {
console.log(movie);
})
.catch((error) => {
console.error(error);
});
getMovieQuotes(id)
Returns an array of quotes for a specific movie based on the provided ID.
apiSDK.getMovieQuotes('5cd95395de30eff6ebccde5c')
.then((quotes) => {
console.log(quotes);
})
.catch((error) => {
console.error(error);
});
getQuotes()
Returns an array of all quotes.
apiSDK.getQuotes()
.then((quotes) => {
console.log(quotes);
})
.catch((error) => {
console.error(error);
});
getQuoteByID(id)
Returns a single quote object based on the provided ID.
apiSDK.getQuoteByID('5cd96e05de30eff6ebcce7ff')
.then((quote) => {
console.log(quote);
})
.catch((error) => {
console.error(error);
});
License
This project is licensed under the MIT License.
1.0.0
11 months ago