UNPKG

@dotglitch/ngx-common

Version:

Angular components and utilities that are commonly used.

29 lines (28 loc) 1.26 kB
import { HttpClient, HttpContext, HttpHeaders, HttpParams } from "@angular/common/http"; import * as i0 from "@angular/core"; export type FetchOptions = { headers?: HttpHeaders | { [header: string]: string | string[]; }; context?: HttpContext; params?: HttpParams | { [param: string]: string | number | boolean | ReadonlyArray<string | number | boolean>; }; body?: any; observe?: 'body' | 'events' | 'response'; reportProgress?: boolean; responseType?: 'arraybuffer' | 'blob' | 'json' | 'text'; withCredentials?: boolean; }; export declare class Fetch { private http; constructor(http: HttpClient); get<T>(url: string, options?: FetchOptions, returnError?: boolean): Promise<T>; put<T>(url: string, body: any, options?: FetchOptions, returnError?: boolean): Promise<T>; post<T>(url: string, body: any, options?: FetchOptions, returnError?: boolean): Promise<T>; patch<T>(url: string, body: any, options?: FetchOptions, returnError?: boolean): Promise<T>; delete<T>(url: string, options?: FetchOptions, returnError?: boolean): Promise<T>; private request; static ɵfac: i0.ɵɵFactoryDeclaration<Fetch, never>; static ɵprov: i0.ɵɵInjectableDeclaration<Fetch>; }