Package Exports
- @ffflorian/api-client
This package does not declare an exports field, so the exports above have been automatically detected and optimized by JSPM instead. If any package subpath is missing, it is recommended to post an issue to the original package (@ffflorian/api-client) to support the "exports" field. If that is not possible, create a JSPM override to customize the exports field for this package.
Readme
api-client 
A generic API client.
Installation
Run yarn add @ffflorian/api-client
or npm install @ffflorian/api-client
.
Usage
A complete documentation is available at https://ffflorian.github.io/api-clients/packages/api-client/.
Examples
import {APIClient} from '@ffflorian/api-client';
const apiClient = new APIClient('https://example.com/api/v1');
apiClient.requestService
.get('/endpoint', {
headers: {
Authorization: 'my-api-key',
},
})
.then(data => {
// ...
});
import {APIClient} from '@ffflorian/api-client';
const apiClient = new APIClient({
apiUrl: 'https://example.com/api/v1',
requestInjector: config => {
const hawkHeader = hawk.client.header(config.url, config.method, {credentials});
return {
...config,
headers: {
Authorization: hawkHeader.header,
},
};
},
});
apiClient.requestService.get('/endpoint').then(data => {
// ...
});
Build
yarn
yarn dist