UNPKG

@deejayy/api-caller

Version:

Simple Api Caller library for Angular

34 lines (33 loc) 992 B
import { HttpHeaders, HttpParams, HttpResponseBase } from '@angular/common/http'; export type MilliSeconds = number; export type FieldName = string; export interface ApiCallItem { path: string; api?: string; payload?: any; payloadType?: 'formData' | 'urlEncoded' | undefined; needsAuth?: boolean; useCache?: boolean; cacheTimeout?: MilliSeconds; binaryUpload?: FieldName; binaryResponse?: boolean; method?: string; localErrorHandling?: boolean; sendCookies?: boolean; idOverride?: string; extraHeaders?: Record<string, string>; } export interface ApiInterface { request: ApiCallItem; response: HttpResponseBase; headers: Record<string, string>; } export type SimplifiedHttpOptions = { body?: any; headers?: HttpHeaders; observe?: 'body' | 'events' | 'response'; params?: HttpParams; reportProgress?: boolean; responseType?: 'arraybuffer' | 'blob' | 'json' | 'text'; withCredentials?: boolean; };