0.3.0 • Published 4 years ago

api_interaction_services v0.3.0

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

Api interaction services

All services use fp-ts library, http methods wrapper return fp-ts either.

Simple api interaction class

import { ApiInteractionService } from 'api_interaction_services';

So you can use it like this:

0.2x:

const fetcher = new ApiInteractionService("http://localhost:3300");
fetcher.get('/');

0.3x:

const fetcher = new ApiInteractionService("http://localhost:3300");
fetcher.get('/')();

Indendity interaction service

A more powerful tool that allows you to communicate with a closed API that requires access and refresh tokens.

import { BearerApiInteractionService } from 'api_interaction_services';

Inversify

Or you can use this classes with inverisify in a few steps:

  1. Declare SERVICE_IDENTIFIER name for service
export const SERVICE_IDENTIFIER = {
    ApiInteractionService: Symbol.for("ApiInteractionService"),
};
  1. Bind this name to class with url to your API
container.bind<ApiInteractionService>(SERVICE_IDENTIFIER.ApiInteractionService).toConstantValue(new ApiInteractionService(API_URL));
  1. And now you can inject this service to your class
constructor(@inject(SERVICE_IDENTIFIER.ApiInteractionService) protected _apiService: ApiInteractionService) {}
0.3.0

4 years ago

0.2.15

4 years ago

0.2.14

4 years ago

0.2.12

4 years ago

0.2.11

4 years ago

0.2.10

4 years ago

0.2.9

4 years ago

0.2.8

4 years ago

0.2.7

4 years ago

0.2.5

4 years ago

0.2.4

4 years ago

0.2.1

4 years ago

0.2.0

4 years ago

0.2.3

4 years ago

0.1.4

4 years ago

0.2.2

4 years ago

0.1.5

4 years ago

0.1.3

4 years ago

0.1.2

4 years ago

0.1.1

4 years ago

0.1.0

4 years ago