import { HttpClient, HttpHeaders, HttpParams, HttpResponse } from '@angular/common/http'; import { Observable } from 'rxjs'; import { AlainThemeConfig } from '../../theme.config'; import * as i0 from "@angular/core"; /** * 封装HttpClient,主要解决: * + 优化HttpClient在参数上便利性 * + 统一实现 loading * + 统一处理时间格式问题 */ export declare class _HttpClient { private http; private cog; constructor(http: HttpClient, cog: AlainThemeConfig); private _loading; /** 是否正在加载中 */ get loading(): boolean; parseParams(params: any): HttpParams; appliedUrl(url: string, params?: any): string; begin(): void; end(): void; /** * GET:返回一个 `T` 类型 */ get(url: string, params?: any, options?: { headers?: HttpHeaders | { [header: string]: string | string[]; }; observe?: 'body'; reportProgress?: boolean; responseType: 'json'; withCredentials?: boolean; }): Observable; /** * GET:返回一个 `string` 类型 */ get(url: string, params: any, options: { headers?: HttpHeaders | { [header: string]: string | string[]; }; observe?: 'body'; reportProgress?: boolean; responseType: 'text'; withCredentials?: boolean; }): Observable; /** * GET:返回一个 `JSON` 类型 */ get(url: string, params: any, options: { headers?: HttpHeaders | { [header: string]: string | string[]; }; observe: 'response'; reportProgress?: boolean; responseType?: 'json'; withCredentials?: boolean; }): Observable>; /** * GET:返回一个 `JSON` 类型 */ get(url: string, params: any, options: { headers?: HttpHeaders | { [header: string]: string | string[]; }; observe: 'response'; reportProgress?: boolean; responseType?: 'json'; withCredentials?: boolean; }): Observable>; /** * GET:返回一个 `any` 类型 */ get(url: string, params?: any, options?: { headers?: HttpHeaders | { [header: string]: string | string[]; }; observe?: 'body' | 'events' | 'response'; reportProgress?: boolean; responseType?: 'arraybuffer' | 'blob' | 'json' | 'text'; withCredentials?: boolean; }): Observable; /** * POST:返回一个 `string` 类型 */ post(url: string, body: any, params: any, options: { headers?: HttpHeaders | { [header: string]: string | string[]; }; observe?: 'body'; reportProgress?: boolean; responseType: 'text'; withCredentials?: boolean; }): Observable; /** * POST:返回一个 `HttpResponse` 类型 */ post(url: string, body: any, params: any, options: { headers?: HttpHeaders | { [header: string]: string | string[]; }; observe: 'response'; reportProgress?: boolean; responseType?: 'json'; withCredentials?: boolean; }): Observable>; /** * POST:返回一个 `JSON` 类型 */ post(url: string, body?: any, params?: any, options?: { headers?: HttpHeaders | { [header: string]: string | string[]; }; observe: 'response'; reportProgress?: boolean; responseType?: 'json'; withCredentials?: boolean; }): Observable; /** * POST:返回一个 `any` 类型 */ post(url: string, body?: any, params?: any, options?: { headers?: HttpHeaders | { [header: string]: string | string[]; }; observe?: 'body' | 'events' | 'response'; reportProgress?: boolean; responseType?: 'arraybuffer' | 'blob' | 'json' | 'text'; withCredentials?: boolean; }): Observable; /** * DELETE:返回一个 `string` 类型 */ delete(url: string, params: any, options: { headers?: HttpHeaders | { [header: string]: string | string[]; }; observe?: 'body'; reportProgress?: boolean; responseType: 'text'; withCredentials?: boolean; }): Observable; /** * DELETE:返回一个 `JSON` 类型 */ delete(url: string, params: any, options: { headers?: HttpHeaders | { [header: string]: string | string[]; }; observe: 'response'; reportProgress?: boolean; responseType?: 'json'; withCredentials?: boolean; }): Observable>; /** * DELETE:返回一个 `any` 类型 */ delete(url: string, params?: any, options?: { headers?: HttpHeaders | { [header: string]: string | string[]; }; observe?: 'body' | 'events' | 'response'; reportProgress?: boolean; responseType?: 'arraybuffer' | 'blob' | 'json' | 'text'; withCredentials?: boolean; }): Observable; /** * `jsonp` 请求 * * @param url URL地址 * @param params 请求参数 * @param callbackParam CALLBACK值,默认:JSONP_CALLBACK */ jsonp(url: string, params?: any, callbackParam?: string): Observable; /** * PATCH:返回一个 `string` 类型 */ patch(url: string, body: any, params: any, options: { headers?: HttpHeaders | { [header: string]: string | string[]; }; observe?: 'body'; reportProgress?: boolean; responseType: 'text'; withCredentials?: boolean; }): Observable; /** * PATCH:返回一个 `HttpResponse` 类型 */ patch(url: string, body: any, params: any, options: { headers?: HttpHeaders | { [header: string]: string | string[]; }; observe: 'response'; reportProgress?: boolean; responseType?: 'json'; withCredentials?: boolean; }): Observable>; /** * PATCH:返回一个 `JSON` 类型 */ patch(url: string, body?: any, params?: any, options?: { headers?: HttpHeaders | { [header: string]: string | string[]; }; observe: 'response'; reportProgress?: boolean; responseType?: 'json'; withCredentials?: boolean; }): Observable; /** * PATCH:返回一个 `any` 类型 */ patch(url: string, body?: any, params?: any, options?: { headers?: HttpHeaders | { [header: string]: string | string[]; }; observe?: 'body' | 'events' | 'response'; reportProgress?: boolean; responseType?: 'arraybuffer' | 'blob' | 'json' | 'text'; withCredentials?: boolean; }): Observable; /** * PUT:返回一个 `string` 类型 */ put(url: string, body: any, params: any, options: { headers?: HttpHeaders | { [header: string]: string | string[]; }; observe?: 'body'; reportProgress?: boolean; responseType: 'text'; withCredentials?: boolean; }): Observable; /** * PUT:返回一个 `HttpResponse` 类型 */ put(url: string, body: any, params: any, options: { headers?: HttpHeaders | { [header: string]: string | string[]; }; observe: 'response'; reportProgress?: boolean; responseType?: 'json'; withCredentials?: boolean; }): Observable>; /** * PUT:返回一个 `JSON` 类型 */ put(url: string, body?: any, params?: any, options?: { headers?: HttpHeaders | { [header: string]: string | string[]; }; observe: 'response'; reportProgress?: boolean; responseType?: 'json'; withCredentials?: boolean; }): Observable; /** * PUT:返回一个 `any` 类型 */ put(url: string, body?: any, params?: any, options?: { headers?: HttpHeaders | { [header: string]: string | string[]; }; observe?: 'body' | 'events' | 'response'; reportProgress?: boolean; responseType?: 'arraybuffer' | 'blob' | 'json' | 'text'; withCredentials?: boolean; }): Observable; /** * `request` 请求 * * @param method 请求方法类型 * @param url URL地址 * @param options 参数 */ request(method: string, url: string, options?: { body?: any; headers?: HttpHeaders | { [header: string]: string | string[]; }; observe?: 'body' | 'events' | 'response'; params?: HttpParams | { [param: string]: string | string[]; }; responseType?: 'arraybuffer' | 'blob' | 'json' | 'text'; reportProgress?: boolean; withCredentials?: boolean; }): Observable; static ɵfac: i0.ɵɵFactoryDeclaration<_HttpClient, never>; static ɵprov: i0.ɵɵInjectableDeclaration<_HttpClient>; } //# sourceMappingURL=http.client.d.ts.map