@temps-sdk/api 0.0.0-stage → 0.1.0-beta.64

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (82) hide show
  1. package/dist/client/client.gen.d.ts +3 -0
  2. package/dist/client/client.gen.d.ts.map +1 -0
  3. package/dist/client/client.gen.js +220 -0
  4. package/dist/client/client.gen.js.map +1 -0
  5. package/dist/client/index.d.ts +11 -0
  6. package/dist/client/index.d.ts.map +1 -0
  7. package/dist/client/index.js +1012 -0
  8. package/dist/client/index.js.map +1 -0
  9. package/dist/client/types.gen.d.ts +121 -0
  10. package/dist/client/types.gen.d.ts.map +1 -0
  11. package/dist/client/types.gen.js +4 -0
  12. package/dist/client/types.gen.js.map +1 -0
  13. package/dist/client/utils.gen.d.ts +38 -0
  14. package/dist/client/utils.gen.d.ts.map +1 -0
  15. package/dist/client/utils.gen.js +234 -0
  16. package/dist/client/utils.gen.js.map +1 -0
  17. package/dist/client.gen.d.ts +13 -0
  18. package/dist/client.gen.d.ts.map +1 -0
  19. package/dist/client.gen.js +6 -0
  20. package/dist/client.gen.js.map +1 -0
  21. package/dist/core/auth.gen.d.ts +26 -0
  22. package/dist/core/auth.gen.d.ts.map +1 -0
  23. package/dist/core/auth.gen.js +16 -0
  24. package/dist/core/auth.gen.js.map +1 -0
  25. package/dist/core/bodySerializer.gen.d.ts +26 -0
  26. package/dist/core/bodySerializer.gen.d.ts.map +1 -0
  27. package/dist/core/bodySerializer.gen.js +59 -0
  28. package/dist/core/bodySerializer.gen.js.map +1 -0
  29. package/dist/core/params.gen.d.ts +44 -0
  30. package/dist/core/params.gen.d.ts.map +1 -0
  31. package/dist/core/params.gen.js +114 -0
  32. package/dist/core/params.gen.js.map +1 -0
  33. package/dist/core/pathSerializer.gen.d.ts +34 -0
  34. package/dist/core/pathSerializer.gen.d.ts.map +1 -0
  35. package/dist/core/pathSerializer.gen.js +116 -0
  36. package/dist/core/pathSerializer.gen.js.map +1 -0
  37. package/dist/core/queryKeySerializer.gen.d.ts +19 -0
  38. package/dist/core/queryKeySerializer.gen.d.ts.map +1 -0
  39. package/dist/core/queryKeySerializer.gen.js +101 -0
  40. package/dist/core/queryKeySerializer.gen.js.map +1 -0
  41. package/dist/core/serverSentEvents.gen.d.ts +72 -0
  42. package/dist/core/serverSentEvents.gen.d.ts.map +1 -0
  43. package/dist/core/serverSentEvents.gen.js +138 -0
  44. package/dist/core/serverSentEvents.gen.js.map +1 -0
  45. package/dist/core/types.gen.d.ts +84 -0
  46. package/dist/core/types.gen.d.ts.map +1 -0
  47. package/dist/core/types.gen.js +4 -0
  48. package/dist/core/types.gen.js.map +1 -0
  49. package/dist/core/utils.gen.d.ts +20 -0
  50. package/dist/core/utils.gen.d.ts.map +1 -0
  51. package/dist/core/utils.gen.js +89 -0
  52. package/dist/core/utils.gen.js.map +1 -0
  53. package/dist/index.d.ts +3 -0
  54. package/dist/index.d.ts.map +1 -0
  55. package/dist/index.js +12650 -0
  56. package/dist/index.js.map +1 -0
  57. package/dist/sdk.gen.d.ts +7088 -0
  58. package/dist/sdk.gen.d.ts.map +1 -0
  59. package/dist/sdk.gen.js +15436 -0
  60. package/dist/sdk.gen.js.map +1 -0
  61. package/dist/types.gen.d.ts +101972 -0
  62. package/dist/types.gen.d.ts.map +1 -0
  63. package/dist/types.gen.js +4 -0
  64. package/dist/types.gen.js.map +1 -0
  65. package/package.json +53 -4
  66. package/src/client/client.gen.ts +303 -0
  67. package/src/client/index.ts +30 -0
  68. package/src/client/types.gen.ts +241 -0
  69. package/src/client/utils.gen.ts +340 -0
  70. package/src/client.gen.ts +29 -0
  71. package/src/core/auth.gen.ts +52 -0
  72. package/src/core/bodySerializer.gen.ts +99 -0
  73. package/src/core/params.gen.ts +191 -0
  74. package/src/core/pathSerializer.gen.ts +189 -0
  75. package/src/core/queryKeySerializer.gen.ts +137 -0
  76. package/src/core/serverSentEvents.gen.ts +268 -0
  77. package/src/core/types.gen.ts +129 -0
  78. package/src/core/utils.gen.ts +149 -0
  79. package/src/index.ts +11110 -0
  80. package/src/sdk.gen.ts +38498 -0
  81. package/src/types.gen.ts +114147 -0
  82. package/README.md +0 -3
@@ -0,0 +1,189 @@
1
+ // SPDX-FileCopyrightText: 2024-2026 Temps Contributors
2
+ // SPDX-License-Identifier: MIT OR Apache-2.0
3
+
4
+ // This file is auto-generated by @hey-api/openapi-ts
5
+
6
+ interface SerializeOptions<T>
7
+ extends SerializePrimitiveOptions, SerializerOptions<T> {}
8
+
9
+ interface SerializePrimitiveOptions {
10
+ allowReserved?: boolean;
11
+ name: string;
12
+ }
13
+
14
+ export interface SerializerOptions<T> {
15
+ /**
16
+ * @default true
17
+ */
18
+ explode: boolean;
19
+ style: T;
20
+ }
21
+
22
+ export type ArrayStyle = "form" | "spaceDelimited" | "pipeDelimited";
23
+ export type ArraySeparatorStyle = ArrayStyle | MatrixStyle;
24
+ type MatrixStyle = "label" | "matrix" | "simple";
25
+ export type ObjectStyle = "form" | "deepObject";
26
+ type ObjectSeparatorStyle = ObjectStyle | MatrixStyle;
27
+
28
+ interface SerializePrimitiveParam extends SerializePrimitiveOptions {
29
+ value: string;
30
+ }
31
+
32
+ export const separatorArrayExplode = (
33
+ style: ArraySeparatorStyle,
34
+ ): "." | ";" | "," | "&" => {
35
+ switch (style) {
36
+ case "label":
37
+ return ".";
38
+ case "matrix":
39
+ return ";";
40
+ case "simple":
41
+ return ",";
42
+ default:
43
+ return "&";
44
+ }
45
+ };
46
+
47
+ export const separatorArrayNoExplode = (
48
+ style: ArraySeparatorStyle,
49
+ ): "," | "|" | "%20" => {
50
+ switch (style) {
51
+ case "form":
52
+ return ",";
53
+ case "pipeDelimited":
54
+ return "|";
55
+ case "spaceDelimited":
56
+ return "%20";
57
+ default:
58
+ return ",";
59
+ }
60
+ };
61
+
62
+ export const separatorObjectExplode = (
63
+ style: ObjectSeparatorStyle,
64
+ ): "." | ";" | "," | "&" => {
65
+ switch (style) {
66
+ case "label":
67
+ return ".";
68
+ case "matrix":
69
+ return ";";
70
+ case "simple":
71
+ return ",";
72
+ default:
73
+ return "&";
74
+ }
75
+ };
76
+
77
+ export const serializeArrayParam = ({
78
+ allowReserved,
79
+ explode,
80
+ name,
81
+ style,
82
+ value,
83
+ }: SerializeOptions<ArraySeparatorStyle> & {
84
+ value: unknown[];
85
+ }): string => {
86
+ if (!explode) {
87
+ const joinedValues = (
88
+ allowReserved ? value : value.map((v) => encodeURIComponent(v as string))
89
+ ).join(separatorArrayNoExplode(style));
90
+ switch (style) {
91
+ case "label":
92
+ return `.${joinedValues}`;
93
+ case "matrix":
94
+ return `;${name}=${joinedValues}`;
95
+ case "simple":
96
+ return joinedValues;
97
+ default:
98
+ return `${name}=${joinedValues}`;
99
+ }
100
+ }
101
+
102
+ const separator = separatorArrayExplode(style);
103
+ const joinedValues = value
104
+ .map((v) => {
105
+ if (style === "label" || style === "simple") {
106
+ return allowReserved ? v : encodeURIComponent(v as string);
107
+ }
108
+
109
+ return serializePrimitiveParam({
110
+ allowReserved,
111
+ name,
112
+ value: v as string,
113
+ });
114
+ })
115
+ .join(separator);
116
+ return style === "label" || style === "matrix"
117
+ ? separator + joinedValues
118
+ : joinedValues;
119
+ };
120
+
121
+ export const serializePrimitiveParam = ({
122
+ allowReserved,
123
+ name,
124
+ value,
125
+ }: SerializePrimitiveParam): string => {
126
+ if (value === undefined || value === null) {
127
+ return "";
128
+ }
129
+
130
+ if (typeof value === "object") {
131
+ throw new Error(
132
+ "Deeply-nested arrays/objects aren’t supported. Provide your own `querySerializer()` to handle these.",
133
+ );
134
+ }
135
+
136
+ return `${name}=${allowReserved ? value : encodeURIComponent(value)}`;
137
+ };
138
+
139
+ export const serializeObjectParam = ({
140
+ allowReserved,
141
+ explode,
142
+ name,
143
+ style,
144
+ value,
145
+ valueOnly,
146
+ }: SerializeOptions<ObjectSeparatorStyle> & {
147
+ value: Record<string, unknown> | Date;
148
+ valueOnly?: boolean;
149
+ }): string => {
150
+ if (value instanceof Date) {
151
+ return valueOnly ? value.toISOString() : `${name}=${value.toISOString()}`;
152
+ }
153
+
154
+ if (style !== "deepObject" && !explode) {
155
+ let values: string[] = [];
156
+ Object.entries(value).forEach(([key, v]) => {
157
+ values = [
158
+ ...values,
159
+ key,
160
+ allowReserved ? (v as string) : encodeURIComponent(v as string),
161
+ ];
162
+ });
163
+ const joinedValues = values.join(",");
164
+ switch (style) {
165
+ case "form":
166
+ return `${name}=${joinedValues}`;
167
+ case "label":
168
+ return `.${joinedValues}`;
169
+ case "matrix":
170
+ return `;${name}=${joinedValues}`;
171
+ default:
172
+ return joinedValues;
173
+ }
174
+ }
175
+
176
+ const separator = separatorObjectExplode(style);
177
+ const joinedValues = Object.entries(value)
178
+ .map(([key, v]) =>
179
+ serializePrimitiveParam({
180
+ allowReserved,
181
+ name: style === "deepObject" ? `${name}[${key}]` : key,
182
+ value: v as string,
183
+ }),
184
+ )
185
+ .join(separator);
186
+ return style === "label" || style === "matrix"
187
+ ? separator + joinedValues
188
+ : joinedValues;
189
+ };
@@ -0,0 +1,137 @@
1
+ // SPDX-FileCopyrightText: 2024-2026 Temps Contributors
2
+ // SPDX-License-Identifier: MIT OR Apache-2.0
3
+
4
+ // This file is auto-generated by @hey-api/openapi-ts
5
+
6
+ /**
7
+ * JSON-friendly union that mirrors what Pinia Colada can hash.
8
+ */
9
+ export type JsonValue =
10
+ null | string | number | boolean | JsonValue[] | { [key: string]: JsonValue };
11
+
12
+ /**
13
+ * Replacer that converts non-JSON values (bigint, Date, etc.) to safe substitutes.
14
+ */
15
+ export const queryKeyJsonReplacer = (
16
+ _key: string,
17
+ value: unknown,
18
+ ): unknown | undefined => {
19
+ if (
20
+ value === undefined ||
21
+ typeof value === "function" ||
22
+ typeof value === "symbol"
23
+ ) {
24
+ return undefined;
25
+ }
26
+ if (typeof value === "bigint") {
27
+ return value.toString();
28
+ }
29
+ if (value instanceof Date) {
30
+ return value.toISOString();
31
+ }
32
+ return value;
33
+ };
34
+
35
+ /**
36
+ * Safely stringifies a value and parses it back into a JsonValue.
37
+ */
38
+ export const stringifyToJsonValue = (input: unknown): JsonValue | undefined => {
39
+ try {
40
+ const json = JSON.stringify(input, queryKeyJsonReplacer);
41
+ if (json === undefined) {
42
+ return undefined;
43
+ }
44
+ return JSON.parse(json) as JsonValue;
45
+ } catch {
46
+ return undefined;
47
+ }
48
+ };
49
+
50
+ /**
51
+ * Detects plain objects (including objects with a null prototype).
52
+ */
53
+ const isPlainObject = (value: unknown): value is Record<string, unknown> => {
54
+ if (value === null || typeof value !== "object") {
55
+ return false;
56
+ }
57
+ const prototype = Object.getPrototypeOf(value as object);
58
+ return prototype === Object.prototype || prototype === null;
59
+ };
60
+
61
+ /**
62
+ * Turns URLSearchParams into a sorted JSON object for deterministic keys.
63
+ */
64
+ const serializeSearchParams = (params: URLSearchParams): JsonValue => {
65
+ const entries = Array.from(params.entries()).sort(([a], [b]) =>
66
+ a.localeCompare(b),
67
+ );
68
+ const result: Record<string, JsonValue> = {};
69
+
70
+ for (const [key, value] of entries) {
71
+ const existing = result[key];
72
+ if (existing === undefined) {
73
+ result[key] = value;
74
+ continue;
75
+ }
76
+
77
+ if (Array.isArray(existing)) {
78
+ (existing as string[]).push(value);
79
+ } else {
80
+ result[key] = [existing, value];
81
+ }
82
+ }
83
+
84
+ return result;
85
+ };
86
+
87
+ /**
88
+ * Normalizes any accepted value into a JSON-friendly shape for query keys.
89
+ */
90
+ export const serializeQueryKeyValue = (
91
+ value: unknown,
92
+ ): JsonValue | undefined => {
93
+ if (value === null) {
94
+ return null;
95
+ }
96
+
97
+ if (
98
+ typeof value === "string" ||
99
+ typeof value === "number" ||
100
+ typeof value === "boolean"
101
+ ) {
102
+ return value;
103
+ }
104
+
105
+ if (
106
+ value === undefined ||
107
+ typeof value === "function" ||
108
+ typeof value === "symbol"
109
+ ) {
110
+ return undefined;
111
+ }
112
+
113
+ if (typeof value === "bigint") {
114
+ return value.toString();
115
+ }
116
+
117
+ if (value instanceof Date) {
118
+ return value.toISOString();
119
+ }
120
+
121
+ if (Array.isArray(value)) {
122
+ return stringifyToJsonValue(value);
123
+ }
124
+
125
+ if (
126
+ typeof URLSearchParams !== "undefined" &&
127
+ value instanceof URLSearchParams
128
+ ) {
129
+ return serializeSearchParams(value);
130
+ }
131
+
132
+ if (isPlainObject(value)) {
133
+ return stringifyToJsonValue(value);
134
+ }
135
+
136
+ return undefined;
137
+ };
@@ -0,0 +1,268 @@
1
+ // SPDX-FileCopyrightText: 2024-2026 Temps Contributors
2
+ // SPDX-License-Identifier: MIT OR Apache-2.0
3
+
4
+ // This file is auto-generated by @hey-api/openapi-ts
5
+
6
+ import type { Config } from "./types.gen";
7
+
8
+ export type ServerSentEventsOptions<TData = unknown> = Omit<
9
+ RequestInit,
10
+ "method"
11
+ > &
12
+ Pick<Config, "method" | "responseTransformer" | "responseValidator"> & {
13
+ /**
14
+ * Fetch API implementation. You can use this option to provide a custom
15
+ * fetch instance.
16
+ *
17
+ * @default globalThis.fetch
18
+ */
19
+ fetch?: typeof fetch;
20
+ /**
21
+ * Implementing clients can call request interceptors inside this hook.
22
+ */
23
+ onRequest?: (url: string, init: RequestInit) => Promise<Request>;
24
+ /**
25
+ * Callback invoked when a network or parsing error occurs during streaming.
26
+ *
27
+ * This option applies only if the endpoint returns a stream of events.
28
+ *
29
+ * @param error The error that occurred.
30
+ */
31
+ onSseError?: (error: unknown) => void;
32
+ /**
33
+ * Callback invoked when an event is streamed from the server.
34
+ *
35
+ * This option applies only if the endpoint returns a stream of events.
36
+ *
37
+ * @param event Event streamed from the server.
38
+ * @returns Nothing (void).
39
+ */
40
+ onSseEvent?: (event: StreamEvent<TData>) => void;
41
+ serializedBody?: RequestInit["body"];
42
+ /**
43
+ * Default retry delay in milliseconds.
44
+ *
45
+ * This option applies only if the endpoint returns a stream of events.
46
+ *
47
+ * @default 3000
48
+ */
49
+ sseDefaultRetryDelay?: number;
50
+ /**
51
+ * Maximum number of retry attempts before giving up.
52
+ */
53
+ sseMaxRetryAttempts?: number;
54
+ /**
55
+ * Maximum retry delay in milliseconds.
56
+ *
57
+ * Applies only when exponential backoff is used.
58
+ *
59
+ * This option applies only if the endpoint returns a stream of events.
60
+ *
61
+ * @default 30000
62
+ */
63
+ sseMaxRetryDelay?: number;
64
+ /**
65
+ * Optional sleep function for retry backoff.
66
+ *
67
+ * Defaults to using `setTimeout`.
68
+ */
69
+ sseSleepFn?: (ms: number) => Promise<void>;
70
+ url: string;
71
+ };
72
+
73
+ export interface StreamEvent<TData = unknown> {
74
+ data: TData;
75
+ event?: string;
76
+ id?: string;
77
+ retry?: number;
78
+ }
79
+
80
+ export type ServerSentEventsResult<
81
+ TData = unknown,
82
+ TReturn = void,
83
+ TNext = unknown,
84
+ > = {
85
+ stream: AsyncGenerator<
86
+ TData extends Record<string, unknown> ? TData[keyof TData] : TData,
87
+ TReturn,
88
+ TNext
89
+ >;
90
+ };
91
+
92
+ export function createSseClient<TData = unknown>({
93
+ onRequest,
94
+ onSseError,
95
+ onSseEvent,
96
+ responseTransformer,
97
+ responseValidator,
98
+ sseDefaultRetryDelay,
99
+ sseMaxRetryAttempts,
100
+ sseMaxRetryDelay,
101
+ sseSleepFn,
102
+ url,
103
+ ...options
104
+ }: ServerSentEventsOptions): ServerSentEventsResult<TData> {
105
+ let lastEventId: string | undefined;
106
+
107
+ const sleep =
108
+ sseSleepFn ??
109
+ ((ms: number) => new Promise((resolve) => setTimeout(resolve, ms)));
110
+
111
+ const createStream = async function* () {
112
+ let retryDelay: number = sseDefaultRetryDelay ?? 3000;
113
+ let attempt = 0;
114
+ const signal = options.signal ?? new AbortController().signal;
115
+
116
+ while (true) {
117
+ if (signal.aborted) break;
118
+
119
+ attempt++;
120
+
121
+ const headers =
122
+ options.headers instanceof Headers
123
+ ? options.headers
124
+ : new Headers(options.headers as Record<string, string> | undefined);
125
+
126
+ if (lastEventId !== undefined) {
127
+ headers.set("Last-Event-ID", lastEventId);
128
+ }
129
+
130
+ try {
131
+ const requestInit: RequestInit = {
132
+ redirect: "follow",
133
+ ...options,
134
+ body: options.serializedBody,
135
+ headers,
136
+ signal,
137
+ };
138
+ let request = new Request(url, requestInit);
139
+ if (onRequest) {
140
+ request = await onRequest(url, requestInit);
141
+ }
142
+ // fetch must be assigned here, otherwise it would throw the error:
143
+ // TypeError: Failed to execute 'fetch' on 'Window': Illegal invocation
144
+ const _fetch = options.fetch ?? globalThis.fetch;
145
+ const response = await _fetch(request);
146
+
147
+ if (!response.ok)
148
+ throw new Error(
149
+ `SSE failed: ${response.status} ${response.statusText}`,
150
+ );
151
+
152
+ if (!response.body) throw new Error("No body in SSE response");
153
+
154
+ const reader = response.body
155
+ .pipeThrough(new TextDecoderStream())
156
+ .getReader();
157
+
158
+ let buffer = "";
159
+
160
+ const abortHandler = () => {
161
+ try {
162
+ reader.cancel();
163
+ } catch {
164
+ // noop
165
+ }
166
+ };
167
+
168
+ signal.addEventListener("abort", abortHandler);
169
+
170
+ try {
171
+ while (true) {
172
+ const { done, value } = await reader.read();
173
+ if (done) break;
174
+ buffer += value;
175
+ buffer = buffer.replace(/\r\n?/g, "\n"); // normalize line endings
176
+
177
+ const chunks = buffer.split("\n\n");
178
+ buffer = chunks.pop() ?? "";
179
+
180
+ for (const chunk of chunks) {
181
+ const lines = chunk.split("\n");
182
+ const dataLines: Array<string> = [];
183
+ let eventName: string | undefined;
184
+
185
+ for (const line of lines) {
186
+ if (line.startsWith("data:")) {
187
+ dataLines.push(line.replace(/^data:\s*/, ""));
188
+ } else if (line.startsWith("event:")) {
189
+ eventName = line.replace(/^event:\s*/, "");
190
+ } else if (line.startsWith("id:")) {
191
+ lastEventId = line.replace(/^id:\s*/, "");
192
+ } else if (line.startsWith("retry:")) {
193
+ const parsed = Number.parseInt(
194
+ line.replace(/^retry:\s*/, ""),
195
+ 10,
196
+ );
197
+ if (!Number.isNaN(parsed)) {
198
+ retryDelay = parsed;
199
+ }
200
+ }
201
+ }
202
+
203
+ let data: unknown;
204
+ let parsedJson = false;
205
+
206
+ if (dataLines.length) {
207
+ const rawData = dataLines.join("\n");
208
+ try {
209
+ data = JSON.parse(rawData);
210
+ parsedJson = true;
211
+ } catch {
212
+ data = rawData;
213
+ }
214
+ }
215
+
216
+ if (parsedJson) {
217
+ if (responseValidator) {
218
+ await responseValidator(data);
219
+ }
220
+
221
+ if (responseTransformer) {
222
+ data = await responseTransformer(data);
223
+ }
224
+ }
225
+
226
+ onSseEvent?.({
227
+ data,
228
+ event: eventName,
229
+ id: lastEventId,
230
+ retry: retryDelay,
231
+ });
232
+
233
+ if (dataLines.length) {
234
+ yield data as any;
235
+ }
236
+ }
237
+ }
238
+ } finally {
239
+ signal.removeEventListener("abort", abortHandler);
240
+ reader.releaseLock();
241
+ }
242
+
243
+ break; // exit loop on normal completion
244
+ } catch (error) {
245
+ // connection failed or aborted; retry after delay
246
+ onSseError?.(error);
247
+
248
+ if (
249
+ sseMaxRetryAttempts !== undefined &&
250
+ attempt >= sseMaxRetryAttempts
251
+ ) {
252
+ break; // stop after firing error
253
+ }
254
+
255
+ // exponential backoff: double retry each attempt, cap at 30s
256
+ const backoff = Math.min(
257
+ retryDelay * 2 ** (attempt - 1),
258
+ sseMaxRetryDelay ?? 30000,
259
+ );
260
+ await sleep(backoff);
261
+ }
262
+ }
263
+ };
264
+
265
+ const stream = createStream();
266
+
267
+ return { stream };
268
+ }
@@ -0,0 +1,129 @@
1
+ // SPDX-FileCopyrightText: 2024-2026 Temps Contributors
2
+ // SPDX-License-Identifier: MIT OR Apache-2.0
3
+
4
+ // This file is auto-generated by @hey-api/openapi-ts
5
+
6
+ import type { Auth, AuthToken } from "./auth.gen";
7
+ import type {
8
+ BodySerializer,
9
+ QuerySerializer,
10
+ QuerySerializerOptions,
11
+ } from "./bodySerializer.gen";
12
+
13
+ export type HttpMethod =
14
+ | "connect"
15
+ | "delete"
16
+ | "get"
17
+ | "head"
18
+ | "options"
19
+ | "patch"
20
+ | "post"
21
+ | "put"
22
+ | "trace";
23
+
24
+ export type Client<
25
+ RequestFn = never,
26
+ Config = unknown,
27
+ MethodFn = never,
28
+ BuildUrlFn = never,
29
+ SseFn = never,
30
+ > = {
31
+ /**
32
+ * Returns the final request URL.
33
+ */
34
+ buildUrl: BuildUrlFn;
35
+ getConfig: () => Config;
36
+ request: RequestFn;
37
+ setConfig: (config: Config) => Config;
38
+ } & {
39
+ [K in HttpMethod]: MethodFn;
40
+ } & ([SseFn] extends [never]
41
+ ? { sse?: never }
42
+ : { sse: { [K in HttpMethod]: SseFn } });
43
+
44
+ export interface Config {
45
+ /**
46
+ * Auth token or a function returning auth token. The resolved value will be
47
+ * added to the request payload as defined by its `security` array.
48
+ */
49
+ auth?: ((auth: Auth) => Promise<AuthToken> | AuthToken) | AuthToken;
50
+ /**
51
+ * A function for serializing request body parameter. By default,
52
+ * {@link JSON.stringify()} will be used.
53
+ */
54
+ bodySerializer?: BodySerializer | null;
55
+ /**
56
+ * An object containing any HTTP headers that you want to pre-populate your
57
+ * `Headers` object with.
58
+ *
59
+ * {@link https://developer.mozilla.org/docs/Web/API/Headers/Headers#init See more}
60
+ */
61
+ headers?:
62
+ | RequestInit["headers"]
63
+ | Record<
64
+ string,
65
+ | string
66
+ | number
67
+ | boolean
68
+ | (string | number | boolean)[]
69
+ | null
70
+ | undefined
71
+ | unknown
72
+ >;
73
+ /**
74
+ * The request method.
75
+ *
76
+ * {@link https://developer.mozilla.org/docs/Web/API/fetch#method See more}
77
+ */
78
+ method?: Uppercase<HttpMethod>;
79
+ /**
80
+ * A function for serializing request query parameters. By default, arrays
81
+ * will be exploded in form style, objects will be exploded in deepObject
82
+ * style, and reserved characters are percent-encoded.
83
+ *
84
+ * This method will have no effect if the native `paramsSerializer()` Axios
85
+ * API function is used.
86
+ *
87
+ * {@link https://swagger.io/docs/specification/serialization/#query View examples}
88
+ */
89
+ querySerializer?: QuerySerializer | QuerySerializerOptions;
90
+ /**
91
+ * A function validating request data. This is useful if you want to ensure
92
+ * the request conforms to the desired shape, so it can be safely sent to
93
+ * the server.
94
+ */
95
+ requestValidator?: (data: unknown) => Promise<unknown>;
96
+ /**
97
+ * A function transforming response data before it's returned. This is useful
98
+ * for post-processing data, e.g., converting ISO strings into Date objects.
99
+ */
100
+ responseTransformer?: (data: unknown) => Promise<unknown>;
101
+ /**
102
+ * A function validating response data. This is useful if you want to ensure
103
+ * the response conforms to the desired shape, so it can be safely passed to
104
+ * the transformers and returned to the user.
105
+ */
106
+ responseValidator?: (data: unknown) => Promise<unknown>;
107
+ }
108
+
109
+ /**
110
+ * Arbitrary metadata passed through the `meta` request option.
111
+ */
112
+ // eslint-disable-next-line @typescript-eslint/no-empty-object-type
113
+ export interface ClientMeta {}
114
+
115
+ type IsExactlyNeverOrNeverUndefined<T> = [T] extends [never]
116
+ ? true
117
+ : [T] extends [never | undefined]
118
+ ? [undefined] extends [T]
119
+ ? false
120
+ : true
121
+ : false;
122
+
123
+ export type OmitNever<T extends Record<string, unknown>> = {
124
+ [
125
+ K in keyof T as IsExactlyNeverOrNeverUndefined<T[K]> extends true
126
+ ? never
127
+ : K
128
+ ]: T[K];
129
+ };