1 | export declare function handlePolling(url: string, settings: any, sendRequest: (url: string, settings: any) => any): Promise<ApiResponse>;
|
2 | export interface IPackageHeaders {
|
3 | name: string;
|
4 | version: string;
|
5 | }
|
6 | export declare function originPackageHeaders({ name, version }: IPackageHeaders): {
|
7 | "X-GDC-JS-PKG": string;
|
8 | "X-GDC-JS-PKG-VERSION": string;
|
9 | };
|
10 | export declare class ApiError extends Error {
|
11 | cause: any;
|
12 | constructor(message: string, cause: any);
|
13 | }
|
14 | export declare class ApiResponseError extends ApiError {
|
15 | response: any;
|
16 | responseBody: any;
|
17 | constructor(message: string, response: any, responseBody: any);
|
18 | }
|
19 | export declare class ApiNetworkError extends ApiError {
|
20 | }
|
21 | export declare class ApiResponse {
|
22 | response: Response;
|
23 | responseBody: string;
|
24 | constructor(response: Response, responseBody: string);
|
25 | readonly data: any;
|
26 | getData(): any;
|
27 | getHeaders(): Response;
|
28 | }
|
29 | export declare class XhrModule {
|
30 | private fetch;
|
31 | private configStorage;
|
32 | private tokenRequest?;
|
33 | constructor(fetch: any, configStorage: any);
|
34 | /**
|
35 | * Back compatible method for setting common XHR settings
|
36 | *
|
37 | * Usually in our apps we used beforeSend ajax callback to set the X-GDC-REQUEST header with unique ID.
|
38 | *
|
39 | * @param settings object XHR settings as
|
40 | */
|
41 | ajaxSetup(settings: any): void;
|
42 | ajax(originalUrl: string, customSettings?: {}): Promise<ApiResponse>;
|
43 | /**
|
44 | * Wrapper for xhr.ajax method GET
|
45 | */
|
46 | get(url: string, settings?: any): Promise<ApiResponse>;
|
47 | /**
|
48 | * Wrapper for xhr.ajax method HEAD
|
49 | */
|
50 | head(url: string, settings?: any): Promise<ApiResponse>;
|
51 | /**
|
52 | * Wrapper for xhr.ajax method POST
|
53 | */
|
54 | post(url: string, settings?: any): Promise<ApiResponse>;
|
55 | /**
|
56 | * Wrapper for xhr.ajax method PUT
|
57 | */
|
58 | put(url: string, settings: any): Promise<ApiResponse>;
|
59 | /**
|
60 | * Wrapper for xhr.ajax method DELETE
|
61 | */
|
62 | del(url: string, settings?: any): Promise<ApiResponse>;
|
63 | private createRequestSettings;
|
64 | private continueAfterTokenRequest;
|
65 | private handleUnauthorized;
|
66 | private logDeprecatedRestApiCall;
|
67 | private isRestApiDeprecated;
|
68 | private verifyRestApiDeprecationStatus;
|
69 | }
|