-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathconfig.ts
More file actions
70 lines (61 loc) · 1.83 KB
/
config.ts
File metadata and controls
70 lines (61 loc) · 1.83 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
61
62
63
64
65
66
67
68
69
70
/*
* Code originally generated by Speakeasy (https://speakeasy.com).
* 03-11-2026 - Modified by Galileo to add a new source for API URL path.
*/
import { Params, pathToFunc } from "./url.js";
import { HTTPClient } from "./http.js";
import { Logger } from "./logger.js";
import { RetryConfig } from "./retries.js";
import { GalileoConfig } from "./galileo-config.js";
/**
* Contains the list of servers available to the SDK
*/
export const ServerList = [
/**
* Galileo Client APIs - galileo-v2
*/
"https://api.galileo.ai",
] as const;
export type SDKOptions = {
apiKeyHeader?: string | (() => Promise<string>) | undefined;
httpClient?: HTTPClient;
/**
* Allows overriding the default server used by the SDK
*/
serverIdx?: number | undefined;
/**
* Allows overriding the default server URL used by the SDK
*/
serverURL?: string | undefined;
/**
* Allows overriding the default user agent used by the SDK
*/
userAgent?: string | undefined;
/**
* Allows overriding the default retry config used by the SDK
*/
retryConfig?: RetryConfig;
timeoutMs?: number;
debugLogger?: Logger;
};
export function serverURLFromOptions(options: SDKOptions): URL | null {
const config = GalileoConfig.get();
let serverURL = options.serverURL ?? config.apiUrl;
const params: Params = {};
if (!serverURL) {
const serverIdx = options.serverIdx ?? 0;
if (serverIdx < 0 || serverIdx >= ServerList.length) {
throw new Error(`Invalid server index ${serverIdx}`);
}
serverURL = ServerList[serverIdx] || "";
}
const u = pathToFunc(serverURL)(params);
return new URL(u);
}
export const SDK_METADATA = {
language: "typescript",
openapiDocVersion: "0.1.0",
sdkVersion: "0.2.9",
genVersion: "2.850.10",
userAgent: "speakeasy-sdk/typescript 0.2.9 2.850.10 0.1.0 galileo-generated",
} as const;