0.3.0 • Published 3 years ago
api_interaction_services v0.3.0
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:
- Declare SERVICE_IDENTIFIER name for service
export const SERVICE_IDENTIFIER = {
ApiInteractionService: Symbol.for("ApiInteractionService"),
};
- Bind this name to class with url to your API
container.bind<ApiInteractionService>(SERVICE_IDENTIFIER.ApiInteractionService).toConstantValue(new ApiInteractionService(API_URL));
- And now you can inject this service to your class
constructor(@inject(SERVICE_IDENTIFIER.ApiInteractionService) protected _apiService: ApiInteractionService) {}
0.3.0
3 years ago
0.2.15
3 years ago
0.2.14
3 years ago
0.2.12
3 years ago
0.2.11
3 years ago
0.2.10
3 years ago
0.2.9
3 years ago
0.2.8
3 years ago
0.2.7
3 years ago
0.2.5
3 years ago
0.2.4
3 years ago
0.2.1
3 years ago
0.2.0
3 years ago
0.2.3
3 years ago
0.1.4
3 years ago
0.2.2
3 years ago
0.1.5
3 years ago
0.1.3
3 years ago
0.1.2
3 years ago
0.1.1
3 years ago
0.1.0
3 years ago