0.0.5 • Published 6 years ago

qa-api-client v0.0.5

Weekly downloads
2
License
ISC
Repository
github
Last release
6 years ago

javascript-qa-client

Javascript client library for using the QuestionAnswer Middleware API (https://documenter.getpostman.com/view/958448/RVg56mab).

API

For using that API client library you need to install it as package

npm i -s git+ssh://git@github.com/DigitalGenius/javascript-qa-client.git#develop

Note: your server should contain ssh key for that module or you can change type of authorization for download it

After that you can import APIClient module and initialize it with options you need, then share it to your modules for using

api-client.js

import APIClient from 'qa-api-client';


const host = 'some API host';
const authTokenProvider = 'some auth token';
const apiClient = new APIClient(host, authTokenProvider);

export default apiClient;

some-module.js

import APIClient from './api-client.js';

APIClient.auth0.login('some', 'credentials').then(...);
import APIClient from './api-client.js';

// Initialise after creation of client
const host = 'some API host';
const authTokenProvider = 'some auth token';
APIClient.init(host, authTokenProvider);

Options

namedescriptionis required?default
hoststring Host of the API which you want to calltrueundefined
authTokenProviderstring | function For calling some API methods which require an authorization token you should provide that option as string which should be a token (e.g. 'Barear 123asd') or function which should returning a string with token (it's usefull for getting your token from localStorage or whereever you want to store your token). That token will be added as Authorization header value for every API method which need an authorizationtrueundefined

Publishing

For create new production-ready bundle in root of project run command

npm run publish
0.0.5

6 years ago

0.0.4

6 years ago

0.0.3

6 years ago

0.0.2

6 years ago

0.0.1

6 years ago