insper-service-base
v1.1.2
Published
Biblioteca para para auxiliar nas requisições http.
Downloads
2
Readme
Insper Service Base
Biblioteca para auxiliar nas requisições http.
##Instalando:
npm install insper-service-base
##Importando:
import { ... } from 'insper-service-base'
##Models:
- PaginationResponseModel
import { PaginationResponseModel } from 'insper-service-base'
##PaginationResponseModel
pageNumber: number;
pageSize: number;
totalPages: number;
totalRows: number;
##Services:
- HttpBaseService
import { HttpBaseService } from 'insper-service-base'
##HttpBaseService
constructor(injector: Injector)
init(gatewayClientId: string): void;
get(url: string, headers?: HttpHeaders, useToken?: boolean, jsonRequest?: boolean): Observable<any>;
post(url: string, body: any, headers?: HttpHeaders, useToken?: boolean, jsonRequest?: boolean): Observable<any>;
put(url: string, body: any, headers?: HttpHeaders, useToken?: boolean, jsonRequest?: boolean): Observable<any>;
patch(url: string, body: any, headers?: HttpHeaders, useToken?: boolean, jsonRequest?: boolean): Observable<any>;
delete(url: string, headers?: HttpHeaders, useToken?: boolean, jsonRequest?: boolean): Observable<any>;
Exemplo de uso:
constructor(injector: Injector) {
this.httpBase = injector.get(HttpBaseService);
this.httpBase.init(
'access_token',
'clientId'
);
this.httpBase.get('url', header);
this.httpBase.post('url', data);
this.httpBase.delete('url/Id');
}