-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathBaseClient.d.ts
More file actions
60 lines (60 loc) · 3.16 KB
/
Copy pathBaseClient.d.ts
File metadata and controls
60 lines (60 loc) · 3.16 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
import { HeaderAuthProvider } from "./auth/HeaderAuthProvider";
import * as core from "./core";
import type * as environments from "./environments";
export type AuthOption = false | core.AuthProvider["getAuthRequest"] | core.AuthProvider | HeaderAuthProvider.AuthOptions;
export type BaseClientOptions = {
environment?: core.Supplier<environments.TrophyApiEnvironment | environments.TrophyApiEnvironmentUrls>;
/** Specify a custom URL to connect the client to. */
baseUrl?: core.Supplier<string>;
/** Override the X-SDK-VERSION header */
sdkVersion?: core.Supplier<string>;
/** Override the Tenant-ID header */
tenantId?: core.Supplier<string | undefined>;
/** Additional headers to include in requests. */
headers?: Record<string, string | core.Supplier<string | null | undefined> | null | undefined>;
/** The default maximum time to wait for a response in seconds. */
timeoutInSeconds?: number;
/** The default number of times to retry the request. Defaults to 2. */
maxRetries?: number;
/** Provide a custom fetch implementation. Useful for platforms that don't have a built-in fetch or need a custom implementation. */
fetch?: typeof fetch;
/** Configure logging for the client. */
logging?: core.logging.LogConfig | core.logging.Logger;
/** Default options for SSE stream reconnection behavior. Has no effect on non-resumable endpoints. */
stream?: {
reconnectionEnabled?: boolean;
maxReconnectionAttempts?: number;
};
/** Override auth. Pass false to disable, a function returning auth headers, an AuthProvider, or auth options. */
auth?: AuthOption;
} & HeaderAuthProvider.AuthOptions;
export interface BaseRequestOptions {
/** The maximum time to wait for a response in seconds. */
timeoutInSeconds?: number;
/** The number of times to retry the request. Defaults to 2. */
maxRetries?: number;
/** A hook to abort the request. */
abortSignal?: AbortSignal;
/** Override the X-SDK-VERSION header */
sdkVersion?: string;
/** Override the Tenant-ID header */
tenantId?: string | undefined;
/** Additional query string parameters to include in the request. */
queryParams?: Record<string, unknown>;
/** Additional headers to include in the request. */
headers?: Record<string, string | core.Supplier<string | null | undefined> | null | undefined>;
/** Options for SSE stream reconnection behavior. Has no effect on non-resumable endpoints. */
stream?: {
reconnectionEnabled?: boolean;
maxReconnectionAttempts?: number;
};
}
export type NormalizedClientOptions<T extends BaseClientOptions = BaseClientOptions> = T & {
logging: core.logging.Logger;
authProvider?: core.AuthProvider;
};
export type NormalizedClientOptionsWithAuth<T extends BaseClientOptions = BaseClientOptions> = NormalizedClientOptions<T> & {
authProvider: core.AuthProvider;
};
export declare function normalizeClientOptions<T extends BaseClientOptions = BaseClientOptions>(options: T): NormalizedClientOptions<T>;
export declare function normalizeClientOptionsWithAuth<T extends BaseClientOptions = BaseClientOptions>(options: T): NormalizedClientOptionsWithAuth<T>;