@vrplatform/api 1.3.1 → 2.0.0-experimental.1
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.
- package/build/main/cache.d.ts +2 -5
- package/build/main/cache.js.map +1 -1
- package/build/main/client-v2.d.ts +15 -0
- package/build/main/client-v2.js +96 -0
- package/build/main/client-v2.js.map +1 -0
- package/build/main/client.js +0 -6
- package/build/main/client.js.map +1 -1
- package/build/main/error.d.ts +2 -1
- package/build/main/error.js +1 -3
- package/build/main/error.js.map +1 -1
- package/build/main/generated/v1.d.ts +18460 -14526
- package/build/main/generated/v1.js.map +1 -1
- package/build/main/generated/v2.d.ts +20289 -0
- package/build/main/generated/v2.js +7 -0
- package/build/main/generated/v2.js.map +1 -0
- package/build/main/index.d.ts +5 -3
- package/build/main/index.js +26 -1
- package/build/main/index.js.map +1 -1
- package/build/main/ingest-compat/index.d.ts +13 -0
- package/build/main/ingest-compat/index.js +92 -0
- package/build/main/ingest-compat/index.js.map +1 -0
- package/build/main/ingest-compat/map.d.ts +6 -0
- package/build/main/ingest-compat/map.js +67 -0
- package/build/main/ingest-compat/map.js.map +1 -0
- package/build/main/ingest-compat/types.d.ts +7 -0
- package/build/main/ingest-compat/types.js +3 -0
- package/build/main/ingest-compat/types.js.map +1 -0
- package/build/main/tsconfig.main.tsbuildinfo +1 -1
- package/build/main/types-v2.d.ts +60 -0
- package/build/main/types-v2.js +3 -0
- package/build/main/types-v2.js.map +1 -0
- package/build/module/cache.d.ts +2 -5
- package/build/module/cache.js.map +1 -1
- package/build/module/client-v2.d.ts +15 -0
- package/build/module/client-v2.js +57 -0
- package/build/module/client-v2.js.map +1 -0
- package/build/module/client.js +0 -6
- package/build/module/client.js.map +1 -1
- package/build/module/error.d.ts +2 -1
- package/build/module/error.js +1 -3
- package/build/module/error.js.map +1 -1
- package/build/module/generated/v1.d.ts +18460 -14526
- package/build/module/generated/v1.js.map +1 -1
- package/build/module/generated/v2.d.ts +20289 -0
- package/build/module/generated/v2.js +6 -0
- package/build/module/generated/v2.js.map +1 -0
- package/build/module/index.d.ts +5 -3
- package/build/module/index.js +3 -1
- package/build/module/index.js.map +1 -1
- package/build/module/ingest-compat/index.d.ts +13 -0
- package/build/module/ingest-compat/index.js +75 -0
- package/build/module/ingest-compat/index.js.map +1 -0
- package/build/module/ingest-compat/map.d.ts +6 -0
- package/build/module/ingest-compat/map.js +64 -0
- package/build/module/ingest-compat/map.js.map +1 -0
- package/build/module/ingest-compat/types.d.ts +7 -0
- package/build/module/ingest-compat/types.js +2 -0
- package/build/module/ingest-compat/types.js.map +1 -0
- package/build/module/tsconfig.esm.tsbuildinfo +1 -1
- package/build/module/types-v2.d.ts +60 -0
- package/build/module/types-v2.js +2 -0
- package/build/module/types-v2.js.map +1 -0
- package/package.json +28 -21
- package/src/cache.ts +2 -2
- package/src/client-v2.ts +92 -0
- package/src/client.ts +2 -8
- package/src/error.ts +3 -4
- package/src/generated/v1.ts +18460 -14526
- package/src/generated/v2.ts +20290 -0
- package/src/index.ts +5 -3
- package/src/types-v2.ts +93 -0
- package/src/generated/openapi-fetch.ts +0 -433
- package/src/ingest/index.ts +0 -227
- package/src/ingest/types.ts +0 -91
package/src/index.ts
CHANGED
|
@@ -1,11 +1,13 @@
|
|
|
1
|
-
import type { useIngest } from './ingest';
|
|
2
1
|
import type { ApiClient } from './types';
|
|
2
|
+
import type { ApiClientV2 } from './types-v2';
|
|
3
3
|
|
|
4
4
|
export * from './client';
|
|
5
|
+
export * from './client-v2';
|
|
5
6
|
export * from './error';
|
|
6
7
|
export * from './generated/v1';
|
|
7
|
-
export * from './
|
|
8
|
+
export * as v2 from './generated/v2';
|
|
8
9
|
export * from './types';
|
|
10
|
+
export * from './types-v2';
|
|
9
11
|
|
|
10
|
-
export type ApiIngest = ReturnType<typeof useIngest>;
|
|
11
12
|
export type VRPlatformApi = ApiClient;
|
|
13
|
+
export type VRPlatformApiV2 = ApiClientV2;
|
package/src/types-v2.ts
ADDED
|
@@ -0,0 +1,93 @@
|
|
|
1
|
+
import type createClient from 'openapi-fetch';
|
|
2
|
+
import type { paths as pathsV2 } from './generated/v2';
|
|
3
|
+
|
|
4
|
+
export type ApiClientV2 = ReturnType<typeof createClient<pathsV2>> & {
|
|
5
|
+
sessionId: string;
|
|
6
|
+
};
|
|
7
|
+
|
|
8
|
+
type ResponseCombinationsV2 = {
|
|
9
|
+
[Path in keyof pathsV2]: {
|
|
10
|
+
[Method in keyof pathsV2[Path]]: pathsV2[Path][Method] extends never
|
|
11
|
+
? never
|
|
12
|
+
: pathsV2[Path][Method] extends {
|
|
13
|
+
responses: {
|
|
14
|
+
200: { content: { 'application/json': unknown } };
|
|
15
|
+
};
|
|
16
|
+
}
|
|
17
|
+
? `${Method & string}:${Path}`
|
|
18
|
+
: never;
|
|
19
|
+
}[keyof pathsV2[Path]];
|
|
20
|
+
}[keyof pathsV2];
|
|
21
|
+
|
|
22
|
+
export type ResponseDataV2<T extends ResponseCombinationsV2> =
|
|
23
|
+
T extends `${infer Method}:${infer Path}`
|
|
24
|
+
? Path extends keyof pathsV2
|
|
25
|
+
? Method extends keyof pathsV2[Path]
|
|
26
|
+
? pathsV2[Path][Method] extends {
|
|
27
|
+
responses: {
|
|
28
|
+
200: { content: { 'application/json': infer Data } };
|
|
29
|
+
};
|
|
30
|
+
}
|
|
31
|
+
? Data
|
|
32
|
+
: never
|
|
33
|
+
: never
|
|
34
|
+
: never
|
|
35
|
+
: never;
|
|
36
|
+
|
|
37
|
+
type RequestBodyCombinationsV2 = {
|
|
38
|
+
[Path in keyof pathsV2]: {
|
|
39
|
+
[Method in keyof pathsV2[Path]]: pathsV2[Path][Method] extends never
|
|
40
|
+
? never
|
|
41
|
+
: pathsV2[Path][Method] extends {
|
|
42
|
+
requestBody: {
|
|
43
|
+
content: { 'application/json': unknown };
|
|
44
|
+
};
|
|
45
|
+
}
|
|
46
|
+
? `${Method & string}:${Path}`
|
|
47
|
+
: never;
|
|
48
|
+
}[keyof pathsV2[Path]];
|
|
49
|
+
}[keyof pathsV2];
|
|
50
|
+
|
|
51
|
+
export type RequestBodyV2<T extends RequestBodyCombinationsV2> =
|
|
52
|
+
T extends `${infer Method}:${infer Path}`
|
|
53
|
+
? Path extends keyof pathsV2
|
|
54
|
+
? Method extends keyof pathsV2[Path]
|
|
55
|
+
? pathsV2[Path][Method] extends {
|
|
56
|
+
requestBody: {
|
|
57
|
+
content: { 'application/json': infer Data };
|
|
58
|
+
};
|
|
59
|
+
}
|
|
60
|
+
? Data
|
|
61
|
+
: never
|
|
62
|
+
: never
|
|
63
|
+
: never
|
|
64
|
+
: never;
|
|
65
|
+
|
|
66
|
+
type RequestParamCombinationsV2 = {
|
|
67
|
+
[Path in keyof pathsV2]: {
|
|
68
|
+
[Method in keyof pathsV2[Path]]: pathsV2[Path][Method] extends never
|
|
69
|
+
? never
|
|
70
|
+
: pathsV2[Path][Method] extends {
|
|
71
|
+
parameters: {
|
|
72
|
+
query?: Record<string, unknown>;
|
|
73
|
+
};
|
|
74
|
+
}
|
|
75
|
+
? `${Method & string}:${Path}`
|
|
76
|
+
: never;
|
|
77
|
+
}[keyof pathsV2[Path]];
|
|
78
|
+
}[keyof pathsV2];
|
|
79
|
+
|
|
80
|
+
export type RequestQueryV2<T extends RequestParamCombinationsV2> =
|
|
81
|
+
T extends `${infer Method}:${infer Path}`
|
|
82
|
+
? Path extends keyof pathsV2
|
|
83
|
+
? Method extends keyof pathsV2[Path]
|
|
84
|
+
? pathsV2[Path][Method] extends {
|
|
85
|
+
parameters: {
|
|
86
|
+
query?: infer Data;
|
|
87
|
+
};
|
|
88
|
+
}
|
|
89
|
+
? Data
|
|
90
|
+
: never
|
|
91
|
+
: never
|
|
92
|
+
: never
|
|
93
|
+
: never;
|
|
@@ -1,433 +0,0 @@
|
|
|
1
|
-
import type {
|
|
2
|
-
ErrorResponse,
|
|
3
|
-
FilterKeys,
|
|
4
|
-
HttpMethod,
|
|
5
|
-
IsOperationRequestBodyOptional,
|
|
6
|
-
MediaType,
|
|
7
|
-
OperationRequestBodyContent,
|
|
8
|
-
PathsWithMethod,
|
|
9
|
-
RequiredKeysOf,
|
|
10
|
-
ResponseObjectMap,
|
|
11
|
-
SuccessResponse,
|
|
12
|
-
} from 'openapi-typescript-helpers';
|
|
13
|
-
|
|
14
|
-
/** Options for each client instance */
|
|
15
|
-
interface ClientOptions extends Omit<RequestInit, 'headers'> {
|
|
16
|
-
/** set the common root URL for all API requests */
|
|
17
|
-
baseUrl?: string;
|
|
18
|
-
/** custom fetch (defaults to globalThis.fetch) */
|
|
19
|
-
fetch?: (input: Request) => Promise<Response>;
|
|
20
|
-
/** custom Request (defaults to globalThis.Request) */
|
|
21
|
-
Request?: typeof Request;
|
|
22
|
-
/** global querySerializer */
|
|
23
|
-
querySerializer?: QuerySerializer<unknown> | QuerySerializerOptions;
|
|
24
|
-
/** global bodySerializer */
|
|
25
|
-
bodySerializer?: BodySerializer<unknown>;
|
|
26
|
-
headers?: HeadersOptions;
|
|
27
|
-
/** RequestInit extension object to pass as 2nd argument to fetch when supported (defaults to undefined) */
|
|
28
|
-
requestInitExt?: Record<string, unknown>;
|
|
29
|
-
}
|
|
30
|
-
|
|
31
|
-
type HeadersOptions =
|
|
32
|
-
| Required<RequestInit>['headers']
|
|
33
|
-
| Record<
|
|
34
|
-
string,
|
|
35
|
-
| string
|
|
36
|
-
| number
|
|
37
|
-
| boolean
|
|
38
|
-
| (string | number | boolean)[]
|
|
39
|
-
| null
|
|
40
|
-
| undefined
|
|
41
|
-
>;
|
|
42
|
-
|
|
43
|
-
type QuerySerializer<T> = (
|
|
44
|
-
query: T extends { parameters: any }
|
|
45
|
-
? NonNullable<T['parameters']['query']>
|
|
46
|
-
: Record<string, unknown>
|
|
47
|
-
) => string;
|
|
48
|
-
|
|
49
|
-
/** @see https://swagger.io/docs/specification/serialization/#query */
|
|
50
|
-
type QuerySerializerOptions = {
|
|
51
|
-
/** Set serialization for arrays. @see https://swagger.io/docs/specification/serialization/#query */
|
|
52
|
-
array?: {
|
|
53
|
-
/** default: "form" */
|
|
54
|
-
style: 'form' | 'spaceDelimited' | 'pipeDelimited';
|
|
55
|
-
/** default: true */
|
|
56
|
-
explode: boolean;
|
|
57
|
-
};
|
|
58
|
-
/** Set serialization for objects. @see https://swagger.io/docs/specification/serialization/#query */
|
|
59
|
-
object?: {
|
|
60
|
-
/** default: "deepObject" */
|
|
61
|
-
style: 'form' | 'deepObject';
|
|
62
|
-
/** default: true */
|
|
63
|
-
explode: boolean;
|
|
64
|
-
};
|
|
65
|
-
/**
|
|
66
|
-
* The `allowReserved` keyword specifies whether the reserved characters
|
|
67
|
-
* `:/?#[]@!$&'()*+,;=` in parameter values are allowed to be sent as they
|
|
68
|
-
* are, or should be percent-encoded. By default, allowReserved is `false`,
|
|
69
|
-
* and reserved characters are percent-encoded.
|
|
70
|
-
* @see https://swagger.io/docs/specification/serialization/#query
|
|
71
|
-
*/
|
|
72
|
-
allowReserved?: boolean;
|
|
73
|
-
};
|
|
74
|
-
|
|
75
|
-
type BodySerializer<T> = (body: OperationRequestBodyContent<T>) => any;
|
|
76
|
-
|
|
77
|
-
type BodyType<T = unknown> = {
|
|
78
|
-
json: T;
|
|
79
|
-
text: Awaited<ReturnType<Response['text']>>;
|
|
80
|
-
blob: Awaited<ReturnType<Response['blob']>>;
|
|
81
|
-
arrayBuffer: Awaited<ReturnType<Response['arrayBuffer']>>;
|
|
82
|
-
stream: Response['body'];
|
|
83
|
-
};
|
|
84
|
-
type ParseAs = keyof BodyType;
|
|
85
|
-
type ParseAsResponse<T, Options> = Options extends {
|
|
86
|
-
parseAs: ParseAs;
|
|
87
|
-
}
|
|
88
|
-
? BodyType<T>[Options['parseAs']]
|
|
89
|
-
: T;
|
|
90
|
-
|
|
91
|
-
interface DefaultParamsOption {
|
|
92
|
-
params?: {
|
|
93
|
-
query?: Record<string, unknown>;
|
|
94
|
-
};
|
|
95
|
-
}
|
|
96
|
-
|
|
97
|
-
type ParamsOption<T> = T extends {
|
|
98
|
-
parameters: any;
|
|
99
|
-
}
|
|
100
|
-
? RequiredKeysOf<T['parameters']> extends never
|
|
101
|
-
? { params?: T['parameters'] }
|
|
102
|
-
: { params: T['parameters'] }
|
|
103
|
-
: DefaultParamsOption;
|
|
104
|
-
|
|
105
|
-
type RequestBodyOption<T> = OperationRequestBodyContent<T> extends never
|
|
106
|
-
? { body?: never }
|
|
107
|
-
: IsOperationRequestBodyOptional<T> extends true
|
|
108
|
-
? { body?: OperationRequestBodyContent<T> }
|
|
109
|
-
: { body: OperationRequestBodyContent<T> };
|
|
110
|
-
|
|
111
|
-
type FetchOptions<T> = RequestOptions<T> &
|
|
112
|
-
Omit<RequestInit, 'body' | 'headers'>;
|
|
113
|
-
|
|
114
|
-
type FetchResponse<
|
|
115
|
-
T extends Record<string | number, any>,
|
|
116
|
-
Options,
|
|
117
|
-
Media extends MediaType,
|
|
118
|
-
> =
|
|
119
|
-
| {
|
|
120
|
-
data: ParseAsResponse<
|
|
121
|
-
SuccessResponse<ResponseObjectMap<T>, Media>,
|
|
122
|
-
Options
|
|
123
|
-
>;
|
|
124
|
-
error?: never;
|
|
125
|
-
response: Response;
|
|
126
|
-
}
|
|
127
|
-
| {
|
|
128
|
-
data?: never;
|
|
129
|
-
error: ErrorResponse<ResponseObjectMap<T>, Media>;
|
|
130
|
-
response: Response;
|
|
131
|
-
};
|
|
132
|
-
|
|
133
|
-
type RequestOptions<T> = ParamsOption<T> &
|
|
134
|
-
RequestBodyOption<T> & {
|
|
135
|
-
baseUrl?: string;
|
|
136
|
-
querySerializer?: QuerySerializer<T> | QuerySerializerOptions;
|
|
137
|
-
bodySerializer?: BodySerializer<T>;
|
|
138
|
-
parseAs?: ParseAs;
|
|
139
|
-
fetch?: ClientOptions['fetch'];
|
|
140
|
-
headers?: HeadersOptions;
|
|
141
|
-
};
|
|
142
|
-
|
|
143
|
-
type MergedOptions<T = unknown> = {
|
|
144
|
-
baseUrl: string;
|
|
145
|
-
parseAs: ParseAs;
|
|
146
|
-
querySerializer: QuerySerializer<T>;
|
|
147
|
-
bodySerializer: BodySerializer<T>;
|
|
148
|
-
fetch: typeof globalThis.fetch;
|
|
149
|
-
};
|
|
150
|
-
|
|
151
|
-
interface MiddlewareCallbackParams {
|
|
152
|
-
/** Current Request object */
|
|
153
|
-
request: Request;
|
|
154
|
-
/** The original OpenAPI schema path (including curly braces) */
|
|
155
|
-
readonly schemaPath: string;
|
|
156
|
-
/** OpenAPI parameters as provided from openapi-fetch */
|
|
157
|
-
readonly params: {
|
|
158
|
-
query?: Record<string, unknown>;
|
|
159
|
-
header?: Record<string, unknown>;
|
|
160
|
-
path?: Record<string, unknown>;
|
|
161
|
-
cookie?: Record<string, unknown>;
|
|
162
|
-
};
|
|
163
|
-
/** Unique ID for this request */
|
|
164
|
-
readonly id: string;
|
|
165
|
-
/** createClient options (read-only) */
|
|
166
|
-
readonly options: MergedOptions;
|
|
167
|
-
}
|
|
168
|
-
|
|
169
|
-
type MiddlewareOnRequest = (options: MiddlewareCallbackParams) =>
|
|
170
|
-
| void
|
|
171
|
-
| Request
|
|
172
|
-
| Response
|
|
173
|
-
| undefined
|
|
174
|
-
// biome-ignore lint/suspicious/noConfusingVoidType: N
|
|
175
|
-
| Promise<Request | Response | undefined | void>;
|
|
176
|
-
type MiddlewareOnResponse = (
|
|
177
|
-
options: MiddlewareCallbackParams & { response: Response }
|
|
178
|
-
// biome-ignore lint/suspicious/noConfusingVoidType: N
|
|
179
|
-
) => void | Response | undefined | Promise<Response | undefined | void>;
|
|
180
|
-
type MiddlewareOnError = (
|
|
181
|
-
options: MiddlewareCallbackParams & { error: unknown }
|
|
182
|
-
// biome-ignore lint/suspicious/noConfusingVoidType: N
|
|
183
|
-
) => void | Response | Error | Promise<void | Response | Error>;
|
|
184
|
-
|
|
185
|
-
type Middleware =
|
|
186
|
-
| {
|
|
187
|
-
onRequest: MiddlewareOnRequest;
|
|
188
|
-
onResponse?: MiddlewareOnResponse;
|
|
189
|
-
onError?: MiddlewareOnError;
|
|
190
|
-
}
|
|
191
|
-
| {
|
|
192
|
-
onRequest?: MiddlewareOnRequest;
|
|
193
|
-
onResponse: MiddlewareOnResponse;
|
|
194
|
-
onError?: MiddlewareOnError;
|
|
195
|
-
}
|
|
196
|
-
| {
|
|
197
|
-
onRequest?: MiddlewareOnRequest;
|
|
198
|
-
onResponse?: MiddlewareOnResponse;
|
|
199
|
-
onError: MiddlewareOnError;
|
|
200
|
-
};
|
|
201
|
-
|
|
202
|
-
/** This type helper makes the 2nd function param required if params/requestBody are required; otherwise, optional */
|
|
203
|
-
type MaybeOptionalInit<Params, Location extends keyof Params> = RequiredKeysOf<
|
|
204
|
-
FetchOptions<FilterKeys<Params, Location>>
|
|
205
|
-
> extends never
|
|
206
|
-
? FetchOptions<FilterKeys<Params, Location>> | undefined
|
|
207
|
-
: FetchOptions<FilterKeys<Params, Location>>;
|
|
208
|
-
|
|
209
|
-
// The final init param to accept.
|
|
210
|
-
// - Determines if the param is optional or not.
|
|
211
|
-
// - Performs arbitrary [key: string] addition.
|
|
212
|
-
// Note: the addition MUST happen after all the inference happens (otherwise TS can’t infer if init is required or not).
|
|
213
|
-
type InitParam<Init> = RequiredKeysOf<Init> extends never
|
|
214
|
-
? [(Init & { [key: string]: unknown })?]
|
|
215
|
-
: [Init & { [key: string]: unknown }];
|
|
216
|
-
|
|
217
|
-
type ClientMethod<
|
|
218
|
-
// biome-ignore lint/complexity/noBannedTypes: N
|
|
219
|
-
Paths extends Record<string, Record<HttpMethod, {}>>,
|
|
220
|
-
Method extends HttpMethod,
|
|
221
|
-
Media extends MediaType,
|
|
222
|
-
> = <
|
|
223
|
-
Path extends PathsWithMethod<Paths, Method>,
|
|
224
|
-
Init extends MaybeOptionalInit<Paths[Path], Method>,
|
|
225
|
-
>(
|
|
226
|
-
url: Path,
|
|
227
|
-
...init: InitParam<Init>
|
|
228
|
-
) => Promise<FetchResponse<Paths[Path][Method], Init, Media>>;
|
|
229
|
-
|
|
230
|
-
type ClientRequestMethod<
|
|
231
|
-
// biome-ignore lint/complexity/noBannedTypes: N
|
|
232
|
-
Paths extends Record<string, Record<HttpMethod, {}>>,
|
|
233
|
-
Media extends MediaType,
|
|
234
|
-
> = <
|
|
235
|
-
Method extends HttpMethod,
|
|
236
|
-
Path extends PathsWithMethod<Paths, Method>,
|
|
237
|
-
Init extends MaybeOptionalInit<Paths[Path], Method>,
|
|
238
|
-
>(
|
|
239
|
-
method: Method,
|
|
240
|
-
url: Path,
|
|
241
|
-
...init: InitParam<Init>
|
|
242
|
-
) => Promise<FetchResponse<Paths[Path][Method], Init, Media>>;
|
|
243
|
-
|
|
244
|
-
type ClientForPath<
|
|
245
|
-
PathInfo extends Record<string | number, any>,
|
|
246
|
-
Media extends MediaType,
|
|
247
|
-
> = {
|
|
248
|
-
[Method in keyof PathInfo as Uppercase<string & Method>]: <
|
|
249
|
-
Init extends MaybeOptionalInit<PathInfo, Method>,
|
|
250
|
-
>(
|
|
251
|
-
...init: InitParam<Init>
|
|
252
|
-
) => Promise<FetchResponse<PathInfo[Method], Init, Media>>;
|
|
253
|
-
};
|
|
254
|
-
|
|
255
|
-
interface Client<Paths extends {}, Media extends MediaType = MediaType> {
|
|
256
|
-
request: ClientRequestMethod<Paths, Media>;
|
|
257
|
-
/** Call a GET endpoint */
|
|
258
|
-
GET: ClientMethod<Paths, 'get', Media>;
|
|
259
|
-
/** Call a PUT endpoint */
|
|
260
|
-
PUT: ClientMethod<Paths, 'put', Media>;
|
|
261
|
-
/** Call a POST endpoint */
|
|
262
|
-
POST: ClientMethod<Paths, 'post', Media>;
|
|
263
|
-
/** Call a DELETE endpoint */
|
|
264
|
-
DELETE: ClientMethod<Paths, 'delete', Media>;
|
|
265
|
-
/** Call a OPTIONS endpoint */
|
|
266
|
-
OPTIONS: ClientMethod<Paths, 'options', Media>;
|
|
267
|
-
/** Call a HEAD endpoint */
|
|
268
|
-
HEAD: ClientMethod<Paths, 'head', Media>;
|
|
269
|
-
/** Call a PATCH endpoint */
|
|
270
|
-
PATCH: ClientMethod<Paths, 'patch', Media>;
|
|
271
|
-
/** Call a TRACE endpoint */
|
|
272
|
-
TRACE: ClientMethod<Paths, 'trace', Media>;
|
|
273
|
-
/** Register middleware */
|
|
274
|
-
use(...middleware: Middleware[]): void;
|
|
275
|
-
/** Unregister middleware */
|
|
276
|
-
eject(...middleware: Middleware[]): void;
|
|
277
|
-
}
|
|
278
|
-
|
|
279
|
-
type ClientPathsWithMethod<
|
|
280
|
-
CreatedClient extends Client<any, any>,
|
|
281
|
-
Method extends HttpMethod,
|
|
282
|
-
> = CreatedClient extends Client<infer Paths, infer _Media>
|
|
283
|
-
? PathsWithMethod<Paths, Method>
|
|
284
|
-
: never;
|
|
285
|
-
|
|
286
|
-
type MethodResponse<
|
|
287
|
-
CreatedClient extends Client<any, any>,
|
|
288
|
-
Method extends HttpMethod,
|
|
289
|
-
Path extends ClientPathsWithMethod<CreatedClient, Method>,
|
|
290
|
-
// biome-ignore lint/complexity/noBannedTypes: Bla
|
|
291
|
-
Options = {},
|
|
292
|
-
> = CreatedClient extends Client<
|
|
293
|
-
infer Paths extends { [key: string]: any },
|
|
294
|
-
infer Media extends MediaType
|
|
295
|
-
>
|
|
296
|
-
? NonNullable<FetchResponse<Paths[Path][Method], Options, Media>['data']>
|
|
297
|
-
: never;
|
|
298
|
-
|
|
299
|
-
declare function createClient<
|
|
300
|
-
Paths extends {},
|
|
301
|
-
Media extends MediaType = MediaType,
|
|
302
|
-
>(clientOptions?: ClientOptions): Client<Paths, Media>;
|
|
303
|
-
|
|
304
|
-
type PathBasedClient<
|
|
305
|
-
Paths extends Record<string | number, any>,
|
|
306
|
-
Media extends MediaType = MediaType,
|
|
307
|
-
> = {
|
|
308
|
-
[Path in keyof Paths]: ClientForPath<Paths[Path], Media>;
|
|
309
|
-
};
|
|
310
|
-
|
|
311
|
-
declare function wrapAsPathBasedClient<
|
|
312
|
-
Paths extends {},
|
|
313
|
-
Media extends MediaType = MediaType,
|
|
314
|
-
>(client: Client<Paths, Media>): PathBasedClient<Paths, Media>;
|
|
315
|
-
|
|
316
|
-
declare function createPathBasedClient<
|
|
317
|
-
Paths extends {},
|
|
318
|
-
Media extends MediaType = MediaType,
|
|
319
|
-
>(clientOptions?: ClientOptions): PathBasedClient<Paths, Media>;
|
|
320
|
-
|
|
321
|
-
/** Serialize primitive params to string */
|
|
322
|
-
declare function serializePrimitiveParam(
|
|
323
|
-
name: string,
|
|
324
|
-
value: string,
|
|
325
|
-
options?: { allowReserved?: boolean }
|
|
326
|
-
): string;
|
|
327
|
-
|
|
328
|
-
/** Serialize object param to string */
|
|
329
|
-
declare function serializeObjectParam(
|
|
330
|
-
name: string,
|
|
331
|
-
value: Record<string, unknown>,
|
|
332
|
-
options: {
|
|
333
|
-
style: 'simple' | 'label' | 'matrix' | 'form' | 'deepObject';
|
|
334
|
-
explode: boolean;
|
|
335
|
-
allowReserved?: boolean;
|
|
336
|
-
}
|
|
337
|
-
): string;
|
|
338
|
-
|
|
339
|
-
/** Serialize array param to string */
|
|
340
|
-
declare function serializeArrayParam(
|
|
341
|
-
name: string,
|
|
342
|
-
value: unknown[],
|
|
343
|
-
options: {
|
|
344
|
-
style:
|
|
345
|
-
| 'simple'
|
|
346
|
-
| 'label'
|
|
347
|
-
| 'matrix'
|
|
348
|
-
| 'form'
|
|
349
|
-
| 'spaceDelimited'
|
|
350
|
-
| 'pipeDelimited';
|
|
351
|
-
explode: boolean;
|
|
352
|
-
allowReserved?: boolean;
|
|
353
|
-
}
|
|
354
|
-
): string;
|
|
355
|
-
|
|
356
|
-
/** Serialize query params to string */
|
|
357
|
-
declare function createQuerySerializer<T = unknown>(
|
|
358
|
-
options?: QuerySerializerOptions
|
|
359
|
-
): (queryParams: T) => string;
|
|
360
|
-
|
|
361
|
-
/**
|
|
362
|
-
* Handle different OpenAPI 3.x serialization styles
|
|
363
|
-
* @type {import("openapi-fetch").defaultPathSerializer}
|
|
364
|
-
* @see https://swagger.io/docs/specification/serialization/#path
|
|
365
|
-
*/
|
|
366
|
-
declare function defaultPathSerializer(
|
|
367
|
-
pathname: string,
|
|
368
|
-
pathParams: Record<string, unknown>
|
|
369
|
-
): string;
|
|
370
|
-
|
|
371
|
-
/** Serialize body object to string */
|
|
372
|
-
declare function defaultBodySerializer<T>(body: T): string;
|
|
373
|
-
|
|
374
|
-
/** Construct URL string from baseUrl and handle path and query params */
|
|
375
|
-
declare function createFinalURL<O>(
|
|
376
|
-
pathname: string,
|
|
377
|
-
options: {
|
|
378
|
-
baseUrl: string;
|
|
379
|
-
params: {
|
|
380
|
-
query?: Record<string, unknown>;
|
|
381
|
-
path?: Record<string, unknown>;
|
|
382
|
-
};
|
|
383
|
-
querySerializer: QuerySerializer<O>;
|
|
384
|
-
}
|
|
385
|
-
): string;
|
|
386
|
-
|
|
387
|
-
/** Merge headers a and b, with b taking priority */
|
|
388
|
-
declare function mergeHeaders(
|
|
389
|
-
...allHeaders: (HeadersOptions | undefined)[]
|
|
390
|
-
): Headers;
|
|
391
|
-
|
|
392
|
-
/** Remove trailing slash from url */
|
|
393
|
-
declare function removeTrailingSlash(url: string): string;
|
|
394
|
-
|
|
395
|
-
export {
|
|
396
|
-
createFinalURL,
|
|
397
|
-
createPathBasedClient,
|
|
398
|
-
createQuerySerializer,
|
|
399
|
-
defaultBodySerializer,
|
|
400
|
-
defaultPathSerializer,
|
|
401
|
-
mergeHeaders,
|
|
402
|
-
removeTrailingSlash,
|
|
403
|
-
serializeArrayParam,
|
|
404
|
-
serializeObjectParam,
|
|
405
|
-
serializePrimitiveParam,
|
|
406
|
-
wrapAsPathBasedClient,
|
|
407
|
-
};
|
|
408
|
-
export type {
|
|
409
|
-
BodySerializer,
|
|
410
|
-
Client,
|
|
411
|
-
ClientForPath,
|
|
412
|
-
ClientMethod,
|
|
413
|
-
ClientOptions,
|
|
414
|
-
ClientPathsWithMethod,
|
|
415
|
-
ClientRequestMethod,
|
|
416
|
-
DefaultParamsOption,
|
|
417
|
-
FetchOptions,
|
|
418
|
-
FetchResponse,
|
|
419
|
-
HeadersOptions,
|
|
420
|
-
MaybeOptionalInit,
|
|
421
|
-
MergedOptions,
|
|
422
|
-
MethodResponse,
|
|
423
|
-
Middleware,
|
|
424
|
-
MiddlewareCallbackParams,
|
|
425
|
-
ParamsOption,
|
|
426
|
-
ParseAs,
|
|
427
|
-
ParseAsResponse,
|
|
428
|
-
PathBasedClient,
|
|
429
|
-
QuerySerializer,
|
|
430
|
-
QuerySerializerOptions,
|
|
431
|
-
RequestBodyOption,
|
|
432
|
-
RequestOptions,
|
|
433
|
-
};
|