0.0.24 • Published 3 years ago

@transentis/bptk-connector v0.0.24

Weekly downloads
-
License
MIT
Repository
-
Last release
3 years ago

A small Rest Client to connect to a BPTK Backend

NPM

Simple example using promises and callbacks

import bptkConnector from('bptkConnector')

const bptkApi = new bptkConnector(process.env.API_KEY)

TODO

Same example (as the above) using async/await, destructuring, and template strings

TODO

More Examples

Table of Contents:

Features

Rate Limiting

TODO

All Endpoints Covered

Caching

Currently supports a basic JS cache (for simple scripts), node-lru-cache.

Compatible with Callbacks, Promises, Async / Await

TypeScript Support

Works immediately upon installation.

Methods

Check out ENDPOINTS.md to see bptk's methods, as well as the endpoints, covered.

Documentation

TODO

Installation and Usage

The minimum required Node.js version is v7.6.0 for native async/await support (there's only a mere line in the codebase, though).

npm

npm i --save @transentis/bptk-connector

yarn

yarn add @transentis/bptk-connector

Quick Setup with Default Config

TODO SINCE NO

Note: Any config passed in is deeply merged with the default config.

Environment Variables

const bptkApi = new bptkAPi(process.env.API_KEY)

Although it is possible to manually pass in the API key, it is preferable to store the key in a secret file (which should not be committed).

This allows bptk-connector to be constructed like in the above code.

# filename: .env
API_KEY=RGAPI-my-api-key

Callbacks

TODO

Promises

bptkApi
	.requestModel(myModel)
	.then((data) => doSomething(data))
	.then(console.log)
	.catch((error) => console.error(error))

Async / Await

const main = async () => {
	const requestedModel = await bptkApi.requestModel(myModel)
}

Request Errors

Errors as of v1.0.0 return the following error object:

{
    statusCode: 42, // some random number
    url: '', // the debug URL that is used in logging as well
    error: {} // the rest of the error object
}

Bugs

TODO

FAQ

TODO

0.0.22

3 years ago

0.0.23

3 years ago

0.0.24

3 years ago

0.0.20

3 years ago

0.0.21

3 years ago

0.0.10

3 years ago

0.0.11

3 years ago

0.0.12

3 years ago

0.0.13

3 years ago

0.0.14

3 years ago

0.0.15

3 years ago

0.0.9

3 years ago

0.0.16

3 years ago

0.0.8

3 years ago

0.0.17

3 years ago

0.0.18

3 years ago

0.0.19

3 years ago

0.0.5

3 years ago

0.0.4

3 years ago

0.0.7

3 years ago

0.0.6

3 years ago

0.0.3

3 years ago

0.0.2

3 years ago

0.0.1

3 years ago

1.0.1

3 years ago

1.0.0

3 years ago