import 'rxjs/add/observable/defer'; import 'rxjs/add/observable/throw'; import 'rxjs/add/operator/catch'; import 'rxjs/add/operator/map'; import 'rxjs/add/operator/shareReplay'; import 'rxjs/add/operator/finally'; import { Observable } from 'rxjs/Observable'; import { Http, HttpResponseWithHeaders } from './Net/Http'; import { UserMe } from './schemas/UserMe'; export declare type SDKFetchOptions = { apiHost?: string; token?: string; headers?: { [header: string]: any; /** * 指定 headers 字段的数据是否以 merge 模式设置到 * 最终要生成的 headers 上。若为 true,使用 merge * 模式,将 headers 字段的键值对以类似于 Object.assign * 的方式“添加”到 SDKFetch 对象当前的 headers 上; * 若为 false,使用 headers 字段替代 SDKFetch 对象 * 当前的 headers 作为请求使用的 headers。 * 默认为 false。 */ merge?: boolean; }; disableRequestId?: boolean; [fetchOption: string]: any; /** * 当需要使用某些高级功能(如不能通过 Observable 实现的中间件), * 设置为 true,会令 get/post/put/delete 请求返回 SDK Http * 对象,提供额外功能。默认为 false。 */ wrapped?: boolean; /** * 当设置为 true,get/post/put/delete 返回的值中会包含 * response headers。默认为 false,仅返回 response body。 */ includeHeaders?: boolean; }; export declare namespace HttpHeaders { enum Key { RequestId = "x-request-id" } function create(headers: {}, options?: { customHeaders?: {}; disableRequestId?: boolean; }): Record; } export declare const defaultSDKFetchHeaders: () => { 'accept': string; 'content-type': string; 'x-timezone': string; }; export declare class SDKFetch { private apiHost; private token; private headers; private options; constructor(apiHost?: string, token?: string, headers?: {}, options?: {}); static FetchStack: Map>; static fetchTail: string | undefined | 0; get(path: string, query: any, options: SDKFetchOptions & { wrapped: true; includeHeaders: true; }): Http>; get(path: string, query: any, options: SDKFetchOptions & { wrapped: true; }): Http; get(path: string, query: any, options: SDKFetchOptions & { includeHeaders: true; }): Observable>; get(path: string, query?: any, options?: SDKFetchOptions): Observable; private urlWithPath; post(path: string, body: any, options: SDKFetchOptions & { wrapped: true; includeHeaders: true; }): Http>; post(path: string, body: any, options: SDKFetchOptions & { wrapped: true; }): Http; post(path: string, body: any, options: SDKFetchOptions & { includeHeaders: true; }): Observable>; post(path: string, body?: any, options?: SDKFetchOptions): Observable; put(path: string, body: any, options: SDKFetchOptions & { wrapped: true; includeHeaders: true; }): Http>; put(path: string, body: any, options: SDKFetchOptions & { wrapped: true; }): Http; put(path: string, body: any, options: SDKFetchOptions & { includeHeaders: true; }): Observable>; put(path: string, body?: any, options?: SDKFetchOptions): Observable; delete(path: string, body: any, options: SDKFetchOptions & { wrapped: true; includeHeaders: true; }): Http>; delete(path: string, body: any, options: SDKFetchOptions & { wrapped: true; }): Http; delete(path: string, body: any, options: SDKFetchOptions & { includeHeaders: true; }): Observable>; delete(path: string, body?: any, options?: SDKFetchOptions): Observable; setAPIHost(host: string): this; getAPIHost(): string; setHeaders(headers: {}, merge?: boolean): this; getHeaders(): {}; setToken(token: string): this; getToken(): string; setOptions(options: {}): this; getOptions(): {}; private setOptionsPerRequest; static buildQuery(url: string, query: any): string; getUserMe(): Observable; }