1.0.13 • Published 4 years ago

@ffflorian/api-client v1.0.13

Weekly downloads
28
License
GPL-3.0
Repository
github
Last release
4 years ago

api-client npm version

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
1.0.13

4 years ago

1.0.12

4 years ago

1.0.11

4 years ago

1.0.10

4 years ago

1.0.9

4 years ago

1.0.8

4 years ago

1.0.7

4 years ago

1.0.6

4 years ago

1.0.5

4 years ago

1.0.4

4 years ago

1.0.3

4 years ago

1.0.1

5 years ago

1.0.0

5 years ago

0.5.1

5 years ago

0.5.0

5 years ago

0.4.4

5 years ago

0.4.3

5 years ago

0.4.2

5 years ago

0.4.1

5 years ago

0.4.0

5 years ago

0.3.4

5 years ago

0.3.3

5 years ago

0.3.2

5 years ago

0.3.1

5 years ago

0.3.0

5 years ago

0.2.0

5 years ago

0.1.0

5 years ago

0.0.1

5 years ago