@izak0s/spacebring-api 1.7.0 → 1.9.0
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/README.md +32 -21
- package/dist/index.cjs +17 -1
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +372 -31
- package/dist/index.d.ts +372 -31
- package/dist/index.js +17 -1
- package/dist/index.js.map +1 -1
- package/package.json +13 -4
package/dist/index.d.ts
CHANGED
|
@@ -1,4 +1,290 @@
|
|
|
1
|
-
|
|
1
|
+
type HttpMethod = "get" | "put" | "post" | "delete" | "options" | "head" | "patch" | "trace";
|
|
2
|
+
type OkStatus = 200 | 201 | 202 | 203 | 204 | 206 | 207 | "2XX";
|
|
3
|
+
type ErrorStatus = 500 | 501 | 502 | 503 | 504 | 505 | 506 | 507 | 508 | 510 | 511 | '5XX' | 400 | 401 | 402 | 403 | 404 | 405 | 406 | 407 | 408 | 409 | 410 | 411 | 412 | 413 | 414 | 415 | 416 | 417 | 418 | 420 | 421 | 422 | 423 | 424 | 425 | 426 | 427 | 428 | 429 | 430 | 431 | 444 | 450 | 451 | 497 | 498 | 499 | '4XX' | "default";
|
|
4
|
+
type PathsWithMethod<Paths extends {}, PathnameMethod extends HttpMethod> = {
|
|
5
|
+
[Pathname in keyof Paths]: Paths[Pathname] extends {
|
|
6
|
+
[K in PathnameMethod]: any;
|
|
7
|
+
} ? Pathname : never;
|
|
8
|
+
}[keyof Paths];
|
|
9
|
+
type ResponseObjectMap<T> = T extends {
|
|
10
|
+
responses: any;
|
|
11
|
+
} ? T["responses"] : unknown;
|
|
12
|
+
type ResponseContent<T> = T extends {
|
|
13
|
+
content: any;
|
|
14
|
+
} ? T["content"] : unknown;
|
|
15
|
+
type OperationRequestBody<T> = "requestBody" extends keyof T ? T["requestBody"] : never;
|
|
16
|
+
type PickRequestBody<T> = "requestBody" extends keyof T ? Pick<T, "requestBody"> : never;
|
|
17
|
+
type IsOperationRequestBodyOptional<T> = RequiredKeysOf<PickRequestBody<T>> extends never ? true : false;
|
|
18
|
+
type OperationRequestBodyMediaContent<T> = IsOperationRequestBodyOptional<T> extends true ? ResponseContent<NonNullable<OperationRequestBody<T>>> | undefined : ResponseContent<OperationRequestBody<T>>;
|
|
19
|
+
type OperationRequestBodyContent<T> = FilterKeys<OperationRequestBodyMediaContent<T>, MediaType> extends never ? FilterKeys<NonNullable<OperationRequestBodyMediaContent<T>>, MediaType> | undefined : FilterKeys<OperationRequestBodyMediaContent<T>, MediaType>;
|
|
20
|
+
type SuccessResponse<T extends Record<string | number, any>, Media extends MediaType = MediaType> = GetResponseContent<T, Media, OkStatus>;
|
|
21
|
+
type GetResponseContent<T extends Record<string | number, any>, Media extends MediaType = MediaType, ResponseCode extends keyof T = keyof T> = ResponseCode extends keyof T ? {
|
|
22
|
+
[K in ResponseCode]: T[K]["content"] extends Record<string, any> ? FilterKeys<T[K]["content"], Media> extends never ? T[K]["content"] : FilterKeys<T[K]["content"], Media> : K extends keyof T ? T[K]["content"] : never;
|
|
23
|
+
}[ResponseCode] : never;
|
|
24
|
+
type ErrorResponse<T extends Record<string | number, any>, Media extends MediaType = MediaType> = GetResponseContent<T, Media, ErrorStatus>;
|
|
25
|
+
type FilterKeys<Obj, Matchers> = Obj[keyof Obj & Matchers];
|
|
26
|
+
type MediaType = `${string}/${string}`;
|
|
27
|
+
type RequiredKeysOfHelper<T> = {
|
|
28
|
+
[K in keyof T]: {} extends Pick<T, K> ? never : K;
|
|
29
|
+
}[keyof T];
|
|
30
|
+
type RequiredKeysOf<T> = RequiredKeysOfHelper<T> extends undefined ? never : RequiredKeysOfHelper<T>;
|
|
31
|
+
type $Read<T> = {
|
|
32
|
+
readonly $read: T;
|
|
33
|
+
};
|
|
34
|
+
type $Write<T> = {
|
|
35
|
+
readonly $write: T;
|
|
36
|
+
};
|
|
37
|
+
type Readable<T> = T extends $Write<any> ? never : T extends $Read<infer U> ? Readable<U> : T extends (infer E)[] ? Readable<E>[] : T extends object ? {
|
|
38
|
+
[K in keyof T as NonNullable<T[K]> extends $Write<any> ? never : K]: Readable<T[K]>;
|
|
39
|
+
} : T;
|
|
40
|
+
type Writable<T> = T extends $Read<any> ? never : T extends $Write<infer U> ? Writable<U> : T extends (infer E)[] ? Writable<E>[] : T extends object ? {
|
|
41
|
+
[K in keyof T as NonNullable<T[K]> extends $Read<any> ? never : K]: Writable<T[K]>;
|
|
42
|
+
} & {
|
|
43
|
+
[K in keyof T as NonNullable<T[K]> extends $Read<any> ? K : never]?: never;
|
|
44
|
+
} : T;
|
|
45
|
+
|
|
46
|
+
/** Options for each client instance */
|
|
47
|
+
interface ClientOptions extends Omit<RequestInit, "headers"> {
|
|
48
|
+
/** set the common root URL for all API requests */
|
|
49
|
+
baseUrl?: string;
|
|
50
|
+
/** custom fetch (defaults to globalThis.fetch) */
|
|
51
|
+
fetch?: (input: Request) => Promise<Response>;
|
|
52
|
+
/** custom Request (defaults to globalThis.Request) */
|
|
53
|
+
Request?: typeof Request;
|
|
54
|
+
/** global querySerializer */
|
|
55
|
+
querySerializer?: QuerySerializer<unknown> | QuerySerializerOptions;
|
|
56
|
+
/** global bodySerializer */
|
|
57
|
+
bodySerializer?: BodySerializer<unknown>;
|
|
58
|
+
/** global pathSerializer */
|
|
59
|
+
pathSerializer?: PathSerializer;
|
|
60
|
+
headers?: HeadersOptions;
|
|
61
|
+
/** RequestInit extension object to pass as 2nd argument to fetch when supported (defaults to undefined) */
|
|
62
|
+
requestInitExt?: Record<string, unknown>;
|
|
63
|
+
}
|
|
64
|
+
|
|
65
|
+
type HeadersOptions =
|
|
66
|
+
| Required<RequestInit>["headers"]
|
|
67
|
+
| Record<string, string | number | boolean | (string | number | boolean)[] | null | undefined>;
|
|
68
|
+
|
|
69
|
+
type QuerySerializer<T> = (
|
|
70
|
+
query: T extends { parameters: any } ? NonNullable<T["parameters"]["query"]> : Record<string, unknown>,
|
|
71
|
+
) => string;
|
|
72
|
+
|
|
73
|
+
/** @see https://swagger.io/docs/specification/serialization/#query */
|
|
74
|
+
type QuerySerializerOptions = {
|
|
75
|
+
/** Set serialization for arrays. @see https://swagger.io/docs/specification/serialization/#query */
|
|
76
|
+
array?: {
|
|
77
|
+
/** default: "form" */
|
|
78
|
+
style: "form" | "spaceDelimited" | "pipeDelimited";
|
|
79
|
+
/** default: true */
|
|
80
|
+
explode: boolean;
|
|
81
|
+
};
|
|
82
|
+
/** Set serialization for objects. @see https://swagger.io/docs/specification/serialization/#query */
|
|
83
|
+
object?: {
|
|
84
|
+
/** default: "deepObject" */
|
|
85
|
+
style: "form" | "deepObject";
|
|
86
|
+
/** default: true */
|
|
87
|
+
explode: boolean;
|
|
88
|
+
};
|
|
89
|
+
/**
|
|
90
|
+
* The `allowReserved` keyword specifies whether the reserved characters
|
|
91
|
+
* `:/?#[]@!$&'()*+,;=` in parameter values are allowed to be sent as they
|
|
92
|
+
* are, or should be percent-encoded. By default, allowReserved is `false`,
|
|
93
|
+
* and reserved characters are percent-encoded.
|
|
94
|
+
* @see https://swagger.io/docs/specification/serialization/#query
|
|
95
|
+
*/
|
|
96
|
+
allowReserved?: boolean;
|
|
97
|
+
};
|
|
98
|
+
|
|
99
|
+
type BodySerializer<T> = (body: OperationRequestBodyContent<T>) => any;
|
|
100
|
+
|
|
101
|
+
type PathSerializer = (pathname: string, pathParams: Record<string, unknown>) => string;
|
|
102
|
+
|
|
103
|
+
type BodyType<T = unknown> = {
|
|
104
|
+
json: T;
|
|
105
|
+
text: Awaited<ReturnType<Response["text"]>>;
|
|
106
|
+
blob: Awaited<ReturnType<Response["blob"]>>;
|
|
107
|
+
arrayBuffer: Awaited<ReturnType<Response["arrayBuffer"]>>;
|
|
108
|
+
stream: Response["body"];
|
|
109
|
+
};
|
|
110
|
+
type ParseAs = keyof BodyType;
|
|
111
|
+
type ParseAsResponse<T, Options> = Options extends {
|
|
112
|
+
parseAs: ParseAs;
|
|
113
|
+
}
|
|
114
|
+
? BodyType<T>[Options["parseAs"]]
|
|
115
|
+
: T;
|
|
116
|
+
|
|
117
|
+
interface DefaultParamsOption {
|
|
118
|
+
params?: {
|
|
119
|
+
query?: Record<string, unknown>;
|
|
120
|
+
};
|
|
121
|
+
}
|
|
122
|
+
|
|
123
|
+
type ParamsOption<T> = T extends {
|
|
124
|
+
parameters: any;
|
|
125
|
+
}
|
|
126
|
+
? RequiredKeysOf<T["parameters"]> extends never
|
|
127
|
+
? { params?: T["parameters"] }
|
|
128
|
+
: { params: T["parameters"] }
|
|
129
|
+
: DefaultParamsOption;
|
|
130
|
+
|
|
131
|
+
// Writable<T> strips $Read markers (readOnly properties excluded from request body)
|
|
132
|
+
type RequestBodyOption<T> =
|
|
133
|
+
Writable<OperationRequestBodyContent<T>> extends never
|
|
134
|
+
? { body?: never }
|
|
135
|
+
: IsOperationRequestBodyOptional<T> extends true
|
|
136
|
+
? { body?: Writable<OperationRequestBodyContent<T>> }
|
|
137
|
+
: { body: Writable<OperationRequestBodyContent<T>> };
|
|
138
|
+
|
|
139
|
+
type FetchOptions<T> = RequestOptions<T> & Omit<RequestInit, "body" | "headers">;
|
|
140
|
+
|
|
141
|
+
// Readable<T> strips $Write markers (writeOnly properties excluded from response)
|
|
142
|
+
type FetchResponse<T extends Record<string | number, any>, Options, Media extends MediaType> =
|
|
143
|
+
| {
|
|
144
|
+
data: ParseAsResponse<Readable<SuccessResponse<ResponseObjectMap<T>, Media>>, Options>;
|
|
145
|
+
error?: never;
|
|
146
|
+
response: Response;
|
|
147
|
+
}
|
|
148
|
+
| {
|
|
149
|
+
data?: never;
|
|
150
|
+
error: Readable<ErrorResponse<ResponseObjectMap<T>, Media>>;
|
|
151
|
+
response: Response;
|
|
152
|
+
};
|
|
153
|
+
|
|
154
|
+
type RequestOptions<T> = ParamsOption<T> &
|
|
155
|
+
RequestBodyOption<T> & {
|
|
156
|
+
baseUrl?: string;
|
|
157
|
+
querySerializer?: QuerySerializer<T> | QuerySerializerOptions;
|
|
158
|
+
bodySerializer?: BodySerializer<T>;
|
|
159
|
+
pathSerializer?: PathSerializer;
|
|
160
|
+
parseAs?: ParseAs;
|
|
161
|
+
fetch?: ClientOptions["fetch"];
|
|
162
|
+
headers?: HeadersOptions;
|
|
163
|
+
middleware?: Middleware[];
|
|
164
|
+
};
|
|
165
|
+
|
|
166
|
+
type MergedOptions<T = unknown> = {
|
|
167
|
+
baseUrl: string;
|
|
168
|
+
parseAs: ParseAs;
|
|
169
|
+
querySerializer: QuerySerializer<T>;
|
|
170
|
+
bodySerializer: BodySerializer<T>;
|
|
171
|
+
pathSerializer: PathSerializer;
|
|
172
|
+
fetch: typeof globalThis.fetch;
|
|
173
|
+
};
|
|
174
|
+
|
|
175
|
+
interface MiddlewareRequestParams {
|
|
176
|
+
query?: Record<string, unknown>;
|
|
177
|
+
header?: Record<string, unknown>;
|
|
178
|
+
path?: Record<string, unknown>;
|
|
179
|
+
cookie?: Record<string, unknown>;
|
|
180
|
+
}
|
|
181
|
+
|
|
182
|
+
interface MiddlewareCallbackParams {
|
|
183
|
+
/** Current Request object */
|
|
184
|
+
request: Request;
|
|
185
|
+
/** The original OpenAPI schema path (including curly braces) */
|
|
186
|
+
readonly schemaPath: string;
|
|
187
|
+
/** OpenAPI parameters as provided from openapi-fetch */
|
|
188
|
+
readonly params: MiddlewareRequestParams;
|
|
189
|
+
/** Unique ID for this request */
|
|
190
|
+
readonly id: string;
|
|
191
|
+
/** createClient options (read-only) */
|
|
192
|
+
readonly options: MergedOptions;
|
|
193
|
+
}
|
|
194
|
+
|
|
195
|
+
type MiddlewareOnRequest = (
|
|
196
|
+
options: MiddlewareCallbackParams,
|
|
197
|
+
) => void | Request | Response | undefined | Promise<Request | Response | undefined | void>;
|
|
198
|
+
type MiddlewareOnResponse = (
|
|
199
|
+
options: MiddlewareCallbackParams & { response: Response },
|
|
200
|
+
) => void | Response | undefined | Promise<Response | undefined | void>;
|
|
201
|
+
type MiddlewareOnError = (
|
|
202
|
+
options: MiddlewareCallbackParams & { error: unknown },
|
|
203
|
+
) => void | Response | Error | Promise<void | Response | Error>;
|
|
204
|
+
|
|
205
|
+
type Middleware =
|
|
206
|
+
| {
|
|
207
|
+
onRequest: MiddlewareOnRequest;
|
|
208
|
+
onResponse?: MiddlewareOnResponse;
|
|
209
|
+
onError?: MiddlewareOnError;
|
|
210
|
+
}
|
|
211
|
+
| {
|
|
212
|
+
onRequest?: MiddlewareOnRequest;
|
|
213
|
+
onResponse: MiddlewareOnResponse;
|
|
214
|
+
onError?: MiddlewareOnError;
|
|
215
|
+
}
|
|
216
|
+
| {
|
|
217
|
+
onRequest?: MiddlewareOnRequest;
|
|
218
|
+
onResponse?: MiddlewareOnResponse;
|
|
219
|
+
onError: MiddlewareOnError;
|
|
220
|
+
};
|
|
221
|
+
|
|
222
|
+
/** This type helper makes the 2nd function param required if params/requestBody are required; otherwise, optional */
|
|
223
|
+
type MaybeOptionalInit<Params, Location extends keyof Params> =
|
|
224
|
+
RequiredKeysOf<FetchOptions<FilterKeys<Params, Location>>> extends never
|
|
225
|
+
? FetchOptions<FilterKeys<Params, Location>> | undefined
|
|
226
|
+
: FetchOptions<FilterKeys<Params, Location>>;
|
|
227
|
+
|
|
228
|
+
// The final init param to accept.
|
|
229
|
+
// - Determines if the param is optional or not.
|
|
230
|
+
// - Performs arbitrary [key: string] addition.
|
|
231
|
+
// Note: the addition MUST happen after all the inference happens (otherwise TS can’t infer if init is required or not).
|
|
232
|
+
type InitParam<Init> =
|
|
233
|
+
RequiredKeysOf<Init> extends never ? [(Init & { [key: string]: unknown })?] : [Init & { [key: string]: unknown }];
|
|
234
|
+
|
|
235
|
+
type ClientMethod<
|
|
236
|
+
Paths extends Record<string, Record<HttpMethod, {}>>,
|
|
237
|
+
Method extends HttpMethod,
|
|
238
|
+
Media extends MediaType,
|
|
239
|
+
> = <Path extends PathsWithMethod<Paths, Method>, Init extends MaybeOptionalInit<Paths[Path], Method>>(
|
|
240
|
+
url: Path,
|
|
241
|
+
...init: InitParam<Init>
|
|
242
|
+
) => Promise<FetchResponse<Paths[Path][Method], Init, Media>>;
|
|
243
|
+
|
|
244
|
+
type ClientRequestMethod<Paths extends Record<string, Record<HttpMethod, {}>>, Media extends MediaType> = <
|
|
245
|
+
Method extends HttpMethod,
|
|
246
|
+
Path extends PathsWithMethod<Paths, Method>,
|
|
247
|
+
Init extends MaybeOptionalInit<Paths[Path], Method>,
|
|
248
|
+
>(
|
|
249
|
+
method: Method,
|
|
250
|
+
url: Path,
|
|
251
|
+
...init: InitParam<Init>
|
|
252
|
+
) => Promise<FetchResponse<Paths[Path][Method], Init, Media>>;
|
|
253
|
+
|
|
254
|
+
interface Client<Paths extends {}, Media extends MediaType = MediaType> {
|
|
255
|
+
request: ClientRequestMethod<Paths, Media>;
|
|
256
|
+
/** Call a GET endpoint */
|
|
257
|
+
GET: ClientMethod<Paths, "get", Media>;
|
|
258
|
+
/** Call a PUT endpoint */
|
|
259
|
+
PUT: ClientMethod<Paths, "put", Media>;
|
|
260
|
+
/** Call a POST endpoint */
|
|
261
|
+
POST: ClientMethod<Paths, "post", Media>;
|
|
262
|
+
/** Call a DELETE endpoint */
|
|
263
|
+
DELETE: ClientMethod<Paths, "delete", Media>;
|
|
264
|
+
/** Call a OPTIONS endpoint */
|
|
265
|
+
OPTIONS: ClientMethod<Paths, "options", Media>;
|
|
266
|
+
/** Call a HEAD endpoint */
|
|
267
|
+
HEAD: ClientMethod<Paths, "head", Media>;
|
|
268
|
+
/** Call a PATCH endpoint */
|
|
269
|
+
PATCH: ClientMethod<Paths, "patch", Media>;
|
|
270
|
+
/** Call a TRACE endpoint */
|
|
271
|
+
TRACE: ClientMethod<Paths, "trace", Media>;
|
|
272
|
+
/** Register middleware */
|
|
273
|
+
use(...middleware: Middleware[]): void;
|
|
274
|
+
/** Unregister middleware */
|
|
275
|
+
eject(...middleware: Middleware[]): void;
|
|
276
|
+
}
|
|
277
|
+
|
|
278
|
+
/** Client-level defaults threaded into the generated facade. */
|
|
279
|
+
interface SpacebringDefaults {
|
|
280
|
+
/** Sent as the `spacebring-network-id` header where the API requires it. */
|
|
281
|
+
networkId?: string;
|
|
282
|
+
}
|
|
283
|
+
/** Per-request options accepted by every generated facade method. */
|
|
284
|
+
interface SpacebringRequestOptions {
|
|
285
|
+
/** Aborts the request — including any pending retry wait — when triggered. */
|
|
286
|
+
signal?: AbortSignal;
|
|
287
|
+
}
|
|
2
288
|
|
|
3
289
|
/**
|
|
4
290
|
* This file was auto-generated by openapi-typescript.
|
|
@@ -2266,7 +2552,7 @@ interface components {
|
|
|
2266
2552
|
* @description Exchange rate provider when auto-update is enabled.
|
|
2267
2553
|
* @enum {string}
|
|
2268
2554
|
*/
|
|
2269
|
-
provider?: "fastForex" | "nbu" | "bcra" | "nbg" | "bcch";
|
|
2555
|
+
provider?: "fastForex" | "nbu" | "bcra" | "nbg" | "bcch" | "ecb";
|
|
2270
2556
|
};
|
|
2271
2557
|
/** @description Pre-built query string for the next page of results. Contains all active filter parameters combined with the next page token, ready to append to the endpoint URL. */
|
|
2272
2558
|
searchQueryNext: string;
|
|
@@ -6521,7 +6807,7 @@ interface components {
|
|
|
6521
6807
|
/** @description Images extracted from the guide description. */
|
|
6522
6808
|
media: {
|
|
6523
6809
|
/** @description Image height in pixels. */
|
|
6524
|
-
height
|
|
6810
|
+
height?: number;
|
|
6525
6811
|
/** @description Storage key of the image. */
|
|
6526
6812
|
key: string;
|
|
6527
6813
|
/** @description MIME type of the image. */
|
|
@@ -6529,7 +6815,7 @@ interface components {
|
|
|
6529
6815
|
/** @description Public URL of the image. */
|
|
6530
6816
|
url: string;
|
|
6531
6817
|
/** @description Image width in pixels. */
|
|
6532
|
-
width
|
|
6818
|
+
width?: number;
|
|
6533
6819
|
}[];
|
|
6534
6820
|
/** @description Display name of the guide. */
|
|
6535
6821
|
title: string;
|
|
@@ -6567,7 +6853,7 @@ interface components {
|
|
|
6567
6853
|
/** @description Images extracted from the guide description. */
|
|
6568
6854
|
media: {
|
|
6569
6855
|
/** @description Image height in pixels. */
|
|
6570
|
-
height
|
|
6856
|
+
height?: number;
|
|
6571
6857
|
/** @description Storage key of the image. */
|
|
6572
6858
|
key: string;
|
|
6573
6859
|
/** @description MIME type of the image. */
|
|
@@ -6575,7 +6861,7 @@ interface components {
|
|
|
6575
6861
|
/** @description Public URL of the image. */
|
|
6576
6862
|
url: string;
|
|
6577
6863
|
/** @description Image width in pixels. */
|
|
6578
|
-
width
|
|
6864
|
+
width?: number;
|
|
6579
6865
|
}[];
|
|
6580
6866
|
/** @description Display name of the guide. */
|
|
6581
6867
|
title: string;
|
|
@@ -6610,7 +6896,7 @@ interface components {
|
|
|
6610
6896
|
/** @description Images extracted from the guide description. */
|
|
6611
6897
|
media: {
|
|
6612
6898
|
/** @description Image height in pixels. */
|
|
6613
|
-
height
|
|
6899
|
+
height?: number;
|
|
6614
6900
|
/** @description Storage key of the image. */
|
|
6615
6901
|
key: string;
|
|
6616
6902
|
/** @description MIME type of the image. */
|
|
@@ -6618,7 +6904,7 @@ interface components {
|
|
|
6618
6904
|
/** @description Public URL of the image. */
|
|
6619
6905
|
url: string;
|
|
6620
6906
|
/** @description Image width in pixels. */
|
|
6621
|
-
width
|
|
6907
|
+
width?: number;
|
|
6622
6908
|
}[];
|
|
6623
6909
|
/** @description Display name of the guide. */
|
|
6624
6910
|
title: string;
|
|
@@ -8754,9 +9040,9 @@ interface components {
|
|
|
8754
9040
|
*/
|
|
8755
9041
|
id: string;
|
|
8756
9042
|
/** @description First name of the user who deleted the order. */
|
|
8757
|
-
name
|
|
9043
|
+
name?: string | null;
|
|
8758
9044
|
/** @description Last name of the user who deleted the order. */
|
|
8759
|
-
surname
|
|
9045
|
+
surname?: string | null;
|
|
8760
9046
|
};
|
|
8761
9047
|
}[];
|
|
8762
9048
|
/** @description Search query parameters for the next page of results. Includes all filters used to fetch the current page. */
|
|
@@ -9222,9 +9508,9 @@ interface components {
|
|
|
9222
9508
|
*/
|
|
9223
9509
|
id: string;
|
|
9224
9510
|
/** @description First name of the user who deleted the order. */
|
|
9225
|
-
name
|
|
9511
|
+
name?: string | null;
|
|
9226
9512
|
/** @description Last name of the user who deleted the order. */
|
|
9227
|
-
surname
|
|
9513
|
+
surname?: string | null;
|
|
9228
9514
|
};
|
|
9229
9515
|
};
|
|
9230
9516
|
};
|
|
@@ -12047,7 +12333,7 @@ interface components {
|
|
|
12047
12333
|
* @description Exchange rate provider when auto-update is enabled.
|
|
12048
12334
|
* @enum {string}
|
|
12049
12335
|
*/
|
|
12050
|
-
provider: "fastForex" | "nbu" | "bcra" | "nbg" | "bcch";
|
|
12336
|
+
provider: "fastForex" | "nbu" | "bcra" | "nbg" | "bcch" | "ecb";
|
|
12051
12337
|
} | {
|
|
12052
12338
|
/** @description Exchange rate relative to the location main currency. */
|
|
12053
12339
|
exchangeRate: number;
|
|
@@ -12064,7 +12350,7 @@ interface components {
|
|
|
12064
12350
|
* @description Exchange rate provider when auto-update is enabled.
|
|
12065
12351
|
* @enum {string}
|
|
12066
12352
|
*/
|
|
12067
|
-
provider: "fastForex" | "nbu" | "bcra" | "nbg" | "bcch";
|
|
12353
|
+
provider: "fastForex" | "nbu" | "bcra" | "nbg" | "bcch" | "ecb";
|
|
12068
12354
|
} | {
|
|
12069
12355
|
/** @description Exchange rate relative to the location main currency. */
|
|
12070
12356
|
exchangeRate: number;
|
|
@@ -20252,6 +20538,10 @@ interface operations {
|
|
|
20252
20538
|
getSubscriptions: {
|
|
20253
20539
|
parameters: {
|
|
20254
20540
|
query?: {
|
|
20541
|
+
/** @description Filter subscriptions created on or after this date (ISO 8601). Use with createDate[lte] for a range. */
|
|
20542
|
+
"createDate[gte]"?: string;
|
|
20543
|
+
/** @description Filter subscriptions created on or before this date (ISO 8601). Use with createDate[gte] for a range. */
|
|
20544
|
+
"createDate[lte]"?: string;
|
|
20255
20545
|
/** @description UUID of the customer whose subscriptions to list. */
|
|
20256
20546
|
customerRef?: string;
|
|
20257
20547
|
/** @description Maximum number of subscriptions per page. Defaults to 25 when omitted or invalid; values above 100 are capped at 100. */
|
|
@@ -20262,6 +20552,8 @@ interface operations {
|
|
|
20262
20552
|
nextPageToken?: string;
|
|
20263
20553
|
/** @description Sort order for results. */
|
|
20264
20554
|
order?: string;
|
|
20555
|
+
/** @description UUID of the plan to filter subscriptions by. */
|
|
20556
|
+
planRef?: string;
|
|
20265
20557
|
/**
|
|
20266
20558
|
* @description Filter by subscription status. Comma-separated values, e.g. `active,scheduled`. Defaults to `active`, `scheduled`, and `incomplete` when omitted.
|
|
20267
20559
|
*
|
|
@@ -21186,6 +21478,19 @@ interface operations {
|
|
|
21186
21478
|
nextPageToken?: components["schemas"]["nextPageToken"];
|
|
21187
21479
|
/** @description The id of the location. */
|
|
21188
21480
|
locationRef: string;
|
|
21481
|
+
/** @description The create date filter of items. */
|
|
21482
|
+
createDate?: {
|
|
21483
|
+
/**
|
|
21484
|
+
* Format: date-time
|
|
21485
|
+
* @description Get contacts with less or equal create date. Example: createDate[lte]=2021-05-21T10:00:00Z
|
|
21486
|
+
*/
|
|
21487
|
+
lte?: string;
|
|
21488
|
+
/**
|
|
21489
|
+
* Format: date-time
|
|
21490
|
+
* @description Get contacts with greater or equal create date. Example: createDate[gte]=2021-05-21T10:00:00Z
|
|
21491
|
+
*/
|
|
21492
|
+
gte?: string;
|
|
21493
|
+
};
|
|
21189
21494
|
};
|
|
21190
21495
|
header?: {
|
|
21191
21496
|
/** @description The id of the network. Required when using bearer token authentication */
|
|
@@ -21300,6 +21605,19 @@ interface operations {
|
|
|
21300
21605
|
nextPageToken?: components["schemas"]["nextPageToken"];
|
|
21301
21606
|
/** @description The number of items to return. */
|
|
21302
21607
|
limit?: number;
|
|
21608
|
+
/** @description The create date filter of items. */
|
|
21609
|
+
createDate?: {
|
|
21610
|
+
/**
|
|
21611
|
+
* Format: date-time
|
|
21612
|
+
* @description Get requests with less or equal create date. Example: createDate[lte]=2021-05-21T10:00:00Z
|
|
21613
|
+
*/
|
|
21614
|
+
lte?: string;
|
|
21615
|
+
/**
|
|
21616
|
+
* Format: date-time
|
|
21617
|
+
* @description Get requests with greater or equal create date. Example: createDate[gte]=2021-05-21T10:00:00Z
|
|
21618
|
+
*/
|
|
21619
|
+
gte?: string;
|
|
21620
|
+
};
|
|
21303
21621
|
};
|
|
21304
21622
|
header?: {
|
|
21305
21623
|
/** @description The id of the network. Required when using bearer token authentication */
|
|
@@ -21495,6 +21813,19 @@ interface operations {
|
|
|
21495
21813
|
*/
|
|
21496
21814
|
gte?: string;
|
|
21497
21815
|
};
|
|
21816
|
+
/** @description The visit date filter of items. */
|
|
21817
|
+
date?: {
|
|
21818
|
+
/**
|
|
21819
|
+
* Format: date-time
|
|
21820
|
+
* @description Get visits with less or equal visit date. Example: date[lte]=2021-05-21T10:00:00Z
|
|
21821
|
+
*/
|
|
21822
|
+
lte?: string;
|
|
21823
|
+
/**
|
|
21824
|
+
* Format: date-time
|
|
21825
|
+
* @description Get visits with greater or equal visit date. Example: date[gte]=2021-05-21T10:00:00Z
|
|
21826
|
+
*/
|
|
21827
|
+
gte?: string;
|
|
21828
|
+
};
|
|
21498
21829
|
/** @description The number of items to return */
|
|
21499
21830
|
limit?: number;
|
|
21500
21831
|
/** @description Token to retrieve the next page of results. */
|
|
@@ -21738,21 +22069,10 @@ interface operations {
|
|
|
21738
22069
|
};
|
|
21739
22070
|
}
|
|
21740
22071
|
|
|
21741
|
-
/** Client-level defaults threaded into the generated facade. */
|
|
21742
|
-
interface SpacebringDefaults {
|
|
21743
|
-
/** Sent as the `spacebring-network-id` header where the API requires it. */
|
|
21744
|
-
networkId?: string;
|
|
21745
|
-
}
|
|
21746
|
-
/** Per-request options accepted by every generated facade method. */
|
|
21747
|
-
interface SpacebringRequestOptions {
|
|
21748
|
-
/** Aborts the request — including any pending retry wait — when triggered. */
|
|
21749
|
-
signal?: AbortSignal;
|
|
21750
|
-
}
|
|
21751
|
-
|
|
21752
22072
|
/** A Contact entity as returned by the Spacebring API. */
|
|
21753
22073
|
type Contact = NonNullable<operations["getContact"]["responses"][200]["content"]["application/json"]["contact"]>;
|
|
21754
22074
|
/** A Request entity as returned by the Spacebring API. */
|
|
21755
|
-
type Request = NonNullable<operations["getRequest"]["responses"][200]["content"]["application/json"]["request"]>;
|
|
22075
|
+
type Request$1 = NonNullable<operations["getRequest"]["responses"][200]["content"]["application/json"]["request"]>;
|
|
21756
22076
|
/** A RequestVisit entity as returned by the Spacebring API. */
|
|
21757
22077
|
type RequestVisit = NonNullable<operations["approveRequest"]["responses"][201]["content"]["application/json"]["visit"]>;
|
|
21758
22078
|
/** A VisitorVisit entity as returned by the Spacebring API. */
|
|
@@ -21765,6 +22085,11 @@ interface GetContactsQuery {
|
|
|
21765
22085
|
nextPageToken?: string;
|
|
21766
22086
|
/** The id of the location. */
|
|
21767
22087
|
locationRef: string;
|
|
22088
|
+
/** The create date filter of items. */
|
|
22089
|
+
createDate?: {
|
|
22090
|
+
lte?: string;
|
|
22091
|
+
gte?: string;
|
|
22092
|
+
};
|
|
21768
22093
|
}
|
|
21769
22094
|
/** Query parameters for `sb.visitors.requests.list()`. */
|
|
21770
22095
|
interface GetRequestsQuery {
|
|
@@ -21774,6 +22099,11 @@ interface GetRequestsQuery {
|
|
|
21774
22099
|
nextPageToken?: string;
|
|
21775
22100
|
/** The number of items to return. */
|
|
21776
22101
|
limit?: number;
|
|
22102
|
+
/** The create date filter of items. */
|
|
22103
|
+
createDate?: {
|
|
22104
|
+
lte?: string;
|
|
22105
|
+
gte?: string;
|
|
22106
|
+
};
|
|
21777
22107
|
}
|
|
21778
22108
|
/** Query parameters for `sb.visitors.visits.list()`. */
|
|
21779
22109
|
interface GetVisitsQuery {
|
|
@@ -21786,6 +22116,11 @@ interface GetVisitsQuery {
|
|
|
21786
22116
|
lte?: string;
|
|
21787
22117
|
gte?: string;
|
|
21788
22118
|
};
|
|
22119
|
+
/** The visit date filter of items. */
|
|
22120
|
+
date?: {
|
|
22121
|
+
lte?: string;
|
|
22122
|
+
gte?: string;
|
|
22123
|
+
};
|
|
21789
22124
|
/** The number of items to return */
|
|
21790
22125
|
limit?: number;
|
|
21791
22126
|
/** Token to retrieve the next page of results. */
|
|
@@ -21876,6 +22211,10 @@ interface GetSupportTicketsQuery {
|
|
|
21876
22211
|
type Subscription = NonNullable<operations["getSubscription"]["responses"][200]["content"]["application/json"]["subscription"]>;
|
|
21877
22212
|
/** Query parameters for `sb.subscriptions.list()`. */
|
|
21878
22213
|
interface GetSubscriptionsQuery {
|
|
22214
|
+
/** Filter subscriptions created on or after this date (ISO 8601). Use with createDate[lte] for a range. */
|
|
22215
|
+
"createDate[gte]"?: string;
|
|
22216
|
+
/** Filter subscriptions created on or before this date (ISO 8601). Use with createDate[gte] for a range. */
|
|
22217
|
+
"createDate[lte]"?: string;
|
|
21879
22218
|
/** UUID of the customer whose subscriptions to list. */
|
|
21880
22219
|
customerRef?: string;
|
|
21881
22220
|
/** Maximum number of subscriptions per page. Defaults to 25 when omitted or invalid; values above 100 are capped at 100. */
|
|
@@ -21886,6 +22225,8 @@ interface GetSubscriptionsQuery {
|
|
|
21886
22225
|
nextPageToken?: string;
|
|
21887
22226
|
/** Sort order for results. */
|
|
21888
22227
|
order?: string;
|
|
22228
|
+
/** UUID of the plan to filter subscriptions by. */
|
|
22229
|
+
planRef?: string;
|
|
21889
22230
|
/** Filter by subscription status. Comma-separated values, e.g. `active,scheduled`. Defaults to `active`, `scheduled`, and `incomplete` when omitted.
|
|
21890
22231
|
|
|
21891
22232
|
Supported values:
|
|
@@ -22703,12 +23044,12 @@ declare function createResources(client: Client<paths>, defaults: SpacebringDefa
|
|
|
22703
23044
|
requests: {
|
|
22704
23045
|
list(query: GetRequestsQuery, options?: SpacebringRequestOptions): Promise<{
|
|
22705
23046
|
nextPageToken?: string;
|
|
22706
|
-
requests?: Request[];
|
|
23047
|
+
requests?: Request$1[];
|
|
22707
23048
|
searchQueryNext?: string;
|
|
22708
23049
|
}>;
|
|
22709
|
-
iterate(query: Omit<GetRequestsQuery, "nextPageToken">, options?: SpacebringRequestOptions): AsyncGenerator<Request, void, undefined>;
|
|
22710
|
-
get(id: string, options?: SpacebringRequestOptions): Promise<Request>;
|
|
22711
|
-
create(body: NonNullable<operations["createRequest"]["requestBody"]>["content"]["application/json"], options?: SpacebringRequestOptions): Promise<Request>;
|
|
23050
|
+
iterate(query: Omit<GetRequestsQuery, "nextPageToken">, options?: SpacebringRequestOptions): AsyncGenerator<Request$1, void, undefined>;
|
|
23051
|
+
get(id: string, options?: SpacebringRequestOptions): Promise<Request$1>;
|
|
23052
|
+
create(body: NonNullable<operations["createRequest"]["requestBody"]>["content"]["application/json"], options?: SpacebringRequestOptions): Promise<Request$1>;
|
|
22712
23053
|
approve(id: string, options?: SpacebringRequestOptions): Promise<RequestVisit>;
|
|
22713
23054
|
reject(id: string, options?: SpacebringRequestOptions): Promise<undefined>;
|
|
22714
23055
|
};
|
|
@@ -22787,4 +23128,4 @@ declare class SpacebringError extends Error {
|
|
|
22787
23128
|
});
|
|
22788
23129
|
}
|
|
22789
23130
|
|
|
22790
|
-
export { type Activity, type AltCurrency, type Application, type Balance, type Benefit, type BenefitCategory, type Booking, type CommentLike, type Company, type Contact, type Contract, type Coupon, type CreditNote, type CreditTransaction, type DayPassTransaction, type Event, type EventTicket, type FeedComment, type GetAltCurrenciesQuery, type GetBenefitApplicationsQuery, type GetBenefitCategoriesQuery, type GetBenefitsQuery, type GetBookingsQuery, type GetCompaniesQuery, type GetContactsQuery, type GetContractsQuery, type GetCouponsQuery, type GetCreditNotesQuery, type GetCreditsTransactionsQuery, type GetDayPassesTransactionsQuery, type GetDiscountRedemptionsQuery, type GetEventTicketsQuery, type GetEventsByOrganizationQuery, type GetFeedPostsQuery, type GetFloorsQuery, type GetGuidesQuery, type GetInvoicesQuery, type GetMembershipsDeletedQuery, type GetMembershipsQuery, type GetMoneyTransactionsQuery, type GetOrdersQuery, type GetPlansQuery, type GetProductsQuery, type GetPromocodesQuery, type GetRegistrationsQuery, type GetRequestsQuery, type GetResourcesQuery, type GetShopCategoriesQuery, type GetSubscriptionsQuery, type GetSupportTicketsQuery, type GetUpcomingInvoiceItemsQuery, type GetUpcomingInvoiceQuery, type GetVisitsQuery, type Guide, type Invoice, type InvoiceItem, type Location, type Membership, type MoneyTransaction, type Network, type Order, type Plan, type Post, type PostComment, type PostLike, type Product, type Promocode, type Redemption, type Registration, type Request, type RequestVisit, type Resource, type ShopCategory, Spacebring, type SpacebringConfig, SpacebringError, type SpacebringErrorBody, type SpacebringRequestOptions, type SpacebringResources, type Subscription, type SupportTicket, type VisitorVisit, type components, type operations, type paths };
|
|
23131
|
+
export { type Activity, type AltCurrency, type Application, type Balance, type Benefit, type BenefitCategory, type Booking, type CommentLike, type Company, type Contact, type Contract, type Coupon, type CreditNote, type CreditTransaction, type DayPassTransaction, type Event, type EventTicket, type FeedComment, type GetAltCurrenciesQuery, type GetBenefitApplicationsQuery, type GetBenefitCategoriesQuery, type GetBenefitsQuery, type GetBookingsQuery, type GetCompaniesQuery, type GetContactsQuery, type GetContractsQuery, type GetCouponsQuery, type GetCreditNotesQuery, type GetCreditsTransactionsQuery, type GetDayPassesTransactionsQuery, type GetDiscountRedemptionsQuery, type GetEventTicketsQuery, type GetEventsByOrganizationQuery, type GetFeedPostsQuery, type GetFloorsQuery, type GetGuidesQuery, type GetInvoicesQuery, type GetMembershipsDeletedQuery, type GetMembershipsQuery, type GetMoneyTransactionsQuery, type GetOrdersQuery, type GetPlansQuery, type GetProductsQuery, type GetPromocodesQuery, type GetRegistrationsQuery, type GetRequestsQuery, type GetResourcesQuery, type GetShopCategoriesQuery, type GetSubscriptionsQuery, type GetSupportTicketsQuery, type GetUpcomingInvoiceItemsQuery, type GetUpcomingInvoiceQuery, type GetVisitsQuery, type Guide, type Invoice, type InvoiceItem, type Location, type Membership, type MoneyTransaction, type Network, type Order, type Plan, type Post, type PostComment, type PostLike, type Product, type Promocode, type Redemption, type Registration, type Request$1 as Request, type RequestVisit, type Resource, type ShopCategory, Spacebring, type SpacebringConfig, SpacebringError, type SpacebringErrorBody, type SpacebringRequestOptions, type SpacebringResources, type Subscription, type SupportTicket, type VisitorVisit, type components, type operations, type paths };
|
package/dist/index.js
CHANGED
|
@@ -2080,6 +2080,8 @@ var Spacebring = class {
|
|
|
2080
2080
|
/** Typed openapi-fetch client — escape hatch for endpoints or options the facade does not cover. */
|
|
2081
2081
|
raw;
|
|
2082
2082
|
constructor(config) {
|
|
2083
|
+
const baseUrl = config.baseUrl ?? "https://api.spacebring.com";
|
|
2084
|
+
assertSecureBaseUrl(baseUrl);
|
|
2083
2085
|
const headers = {
|
|
2084
2086
|
Authorization: `Basic ${toBase64(`${config.clientId}:${config.clientSecret}`)}`
|
|
2085
2087
|
};
|
|
@@ -2087,7 +2089,7 @@ var Spacebring = class {
|
|
|
2087
2089
|
headers["spacebring-network-id"] = config.networkId;
|
|
2088
2090
|
}
|
|
2089
2091
|
this.raw = createClient({
|
|
2090
|
-
baseUrl
|
|
2092
|
+
baseUrl,
|
|
2091
2093
|
headers,
|
|
2092
2094
|
fetch: withRetry(config.fetch ?? globalThis.fetch, config.maxRetries ?? 3, config.timeoutMs)
|
|
2093
2095
|
});
|
|
@@ -2156,6 +2158,20 @@ function sleep(ms, signal) {
|
|
|
2156
2158
|
signal.addEventListener("abort", onAbort, { once: true });
|
|
2157
2159
|
});
|
|
2158
2160
|
}
|
|
2161
|
+
function assertSecureBaseUrl(baseUrl) {
|
|
2162
|
+
let url;
|
|
2163
|
+
try {
|
|
2164
|
+
url = new URL(baseUrl);
|
|
2165
|
+
} catch {
|
|
2166
|
+
throw new Error(`Spacebring baseUrl is not a valid URL: ${baseUrl}`);
|
|
2167
|
+
}
|
|
2168
|
+
if (url.protocol === "https:") return;
|
|
2169
|
+
const isLoopback = url.hostname === "localhost" || url.hostname === "127.0.0.1" || url.hostname === "[::1]" || url.hostname === "::1";
|
|
2170
|
+
if (url.protocol === "http:" && isLoopback) return;
|
|
2171
|
+
throw new Error(
|
|
2172
|
+
`Spacebring baseUrl must use https (got "${url.protocol}//"): Basic-auth credentials would otherwise be sent in cleartext. Use https, or http only for a loopback host.`
|
|
2173
|
+
);
|
|
2174
|
+
}
|
|
2159
2175
|
function toBase64(value) {
|
|
2160
2176
|
if (typeof Buffer !== "undefined") {
|
|
2161
2177
|
return Buffer.from(value, "utf8").toString("base64");
|