This SDK provides an easy programmatic layer over The One API. To use it you will need to obtain an access key for The One API.
git clone git@github.com:ArturMoczulski/artur-moczulski-SDK.git
cd artur-moczulski-SDK/docs/example-project
npm install
cp .env.example .env
Change the access key in .env to your The One API access key in the example project.
node index.js
cd
into your project and type:
npm install artur-moczulski-SDK
const theOneSDK = require('artur-moczulski-SDK')()
const theOneSDK = require('artur-moczulski-SDK')({
accessKey: "yourAccessKey"
})
Note: The book/ endpoint is the only endpoint which will not require a prior authentication.
let books = await theOneSDK.books()
console.log(books)
let book = await theOneSDK.book(id)
console.log(book)
let book = await theOneSDK.book(id)
await book.fetchChapters()
console.log(book.chapters)
Note: The quote/ endpoint will require an access key to be configured
let quotes = await theOneSDK.quotes()
console.log(quotes)
To run all the tests:
npm test
This repo contains an example project in ./docs/example-project which utilizes the SDK through the npm registry. Some exapmles of real world library usage can be found there. The purpose of the example project is to be a simple The One API browser.