@swishapp/api-client 0.1.2 → 0.3.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 +2 -2
- package/dist/client/sdk.gen.d.ts +18 -15
- package/dist/client/sdk.gen.js +15 -5
- package/dist/client/types.gen.d.ts +553 -54
- package/dist/index.d.ts +5 -9
- package/dist/index.js +6 -6
- package/package.json +3 -2
package/README.md
CHANGED
|
@@ -13,13 +13,13 @@ npm install @swishapp/api-client
|
|
|
13
13
|
```ts
|
|
14
14
|
import { SwishClient } from "@swishapp/api-client";
|
|
15
15
|
|
|
16
|
-
const
|
|
16
|
+
const swish = new SwishClient({
|
|
17
17
|
apiKey: "your-api-key",
|
|
18
18
|
shop: "your-shopify-shop-name.myshopify.com",
|
|
19
19
|
key: "gid://shopify/Customer/123456789",
|
|
20
20
|
});
|
|
21
21
|
|
|
22
|
-
const { data } = await
|
|
22
|
+
const { data } = await swish.items.list();
|
|
23
23
|
```
|
|
24
24
|
|
|
25
25
|
## Documentation
|
package/dist/client/sdk.gen.d.ts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import type { Options as ClientOptions, TDataShape, Client } from '@hey-api/client-fetch';
|
|
2
|
-
import type { ListControllerFindAllData, ListControllerCreateOneData, ListControllerDeleteOneData, ListControllerFindOneData, ListControllerUpdateOneData,
|
|
2
|
+
import type { ListControllerFindAllData, ListControllerFindAllError, ListControllerCreateOneData, ListControllerCreateOneError, ListControllerDeleteOneData, ListControllerDeleteOneError, ListControllerFindOneData, ListControllerFindOneError, ListControllerUpdateOneData, ListControllerUpdateOneError, ItemControllerDeleteData, ItemControllerDeleteError, ItemControllerFindData, ItemControllerFindError, ItemControllerCreateData, ItemControllerCreateError, ItemControllerDeleteByIdData, ItemControllerDeleteByIdError, ItemControllerUpdateByIdData, ItemControllerUpdateByIdError, ProfileControllerIdentifyData, ProfileControllerIdentifyError } from './types.gen';
|
|
3
3
|
export type Options<TData extends TDataShape = TDataShape, ThrowOnError extends boolean = boolean> = ClientOptions<TData, ThrowOnError> & {
|
|
4
4
|
/**
|
|
5
5
|
* You can provide a client instance returned by `createClient()` instead of
|
|
@@ -15,25 +15,28 @@ export type Options<TData extends TDataShape = TDataShape, ThrowOnError extends
|
|
|
15
15
|
};
|
|
16
16
|
export declare const listControllerFindAll: <ThrowOnError extends boolean = false>(options: Options<ListControllerFindAllData, ThrowOnError>) => import("@hey-api/client-fetch").RequestResult<import("./types.gen").PaginatedResponseDto & {
|
|
17
17
|
data?: Array<import("./types.gen").List>;
|
|
18
|
-
},
|
|
18
|
+
}, ListControllerFindAllError, ThrowOnError>;
|
|
19
19
|
export declare const listControllerCreateOne: <ThrowOnError extends boolean = false>(options: Options<ListControllerCreateOneData, ThrowOnError>) => import("@hey-api/client-fetch").RequestResult<import("./types.gen").ResponseDto & {
|
|
20
20
|
data?: import("./types.gen").List;
|
|
21
|
-
},
|
|
22
|
-
export declare const listControllerDeleteOne: <ThrowOnError extends boolean = false>(options: Options<ListControllerDeleteOneData, ThrowOnError>) => import("@hey-api/client-fetch").RequestResult<void,
|
|
21
|
+
}, ListControllerCreateOneError, ThrowOnError>;
|
|
22
|
+
export declare const listControllerDeleteOne: <ThrowOnError extends boolean = false>(options: Options<ListControllerDeleteOneData, ThrowOnError>) => import("@hey-api/client-fetch").RequestResult<void, ListControllerDeleteOneError, ThrowOnError>;
|
|
23
23
|
export declare const listControllerFindOne: <ThrowOnError extends boolean = false>(options: Options<ListControllerFindOneData, ThrowOnError>) => import("@hey-api/client-fetch").RequestResult<import("./types.gen").ResponseDto & {
|
|
24
24
|
data?: import("./types.gen").List;
|
|
25
|
-
},
|
|
25
|
+
}, ListControllerFindOneError, ThrowOnError>;
|
|
26
26
|
export declare const listControllerUpdateOne: <ThrowOnError extends boolean = false>(options: Options<ListControllerUpdateOneData, ThrowOnError>) => import("@hey-api/client-fetch").RequestResult<import("./types.gen").ResponseDto & {
|
|
27
27
|
data?: import("./types.gen").List;
|
|
28
|
-
},
|
|
29
|
-
export declare const
|
|
30
|
-
export declare const
|
|
28
|
+
}, ListControllerUpdateOneError, ThrowOnError>;
|
|
29
|
+
export declare const itemControllerDelete: <ThrowOnError extends boolean = false>(options: Options<ItemControllerDeleteData, ThrowOnError>) => import("@hey-api/client-fetch").RequestResult<void, ItemControllerDeleteError, ThrowOnError>;
|
|
30
|
+
export declare const itemControllerFind: <ThrowOnError extends boolean = false>(options: Options<ItemControllerFindData, ThrowOnError>) => import("@hey-api/client-fetch").RequestResult<import("./types.gen").PaginatedResponseDto & {
|
|
31
31
|
data?: Array<import("./types.gen").Item>;
|
|
32
|
-
},
|
|
33
|
-
export declare const
|
|
34
|
-
data?:
|
|
35
|
-
},
|
|
36
|
-
export declare const
|
|
37
|
-
export declare const
|
|
32
|
+
}, ItemControllerFindError, ThrowOnError>;
|
|
33
|
+
export declare const itemControllerCreate: <ThrowOnError extends boolean = false>(options: Options<ItemControllerCreateData, ThrowOnError>) => import("@hey-api/client-fetch").RequestResult<import("./types.gen").ResponseDto & {
|
|
34
|
+
data?: import("./types.gen").Item;
|
|
35
|
+
}, ItemControllerCreateError, ThrowOnError>;
|
|
36
|
+
export declare const itemControllerDeleteById: <ThrowOnError extends boolean = false>(options: Options<ItemControllerDeleteByIdData, ThrowOnError>) => import("@hey-api/client-fetch").RequestResult<void, ItemControllerDeleteByIdError, ThrowOnError>;
|
|
37
|
+
export declare const itemControllerUpdateById: <ThrowOnError extends boolean = false>(options: Options<ItemControllerUpdateByIdData, ThrowOnError>) => import("@hey-api/client-fetch").RequestResult<import("./types.gen").ResponseDto & {
|
|
38
38
|
data?: import("./types.gen").Item;
|
|
39
|
-
},
|
|
39
|
+
}, ItemControllerUpdateByIdError, ThrowOnError>;
|
|
40
|
+
export declare const profileControllerIdentify: <ThrowOnError extends boolean = false>(options: Options<ProfileControllerIdentifyData, ThrowOnError>) => import("@hey-api/client-fetch").RequestResult<import("./types.gen").ResponseDto & {
|
|
41
|
+
data?: import("./types.gen").IdentifyProfileResponseDto;
|
|
42
|
+
}, ProfileControllerIdentifyError, ThrowOnError>;
|
package/dist/client/sdk.gen.js
CHANGED
|
@@ -38,7 +38,7 @@ export const listControllerUpdateOne = (options) => {
|
|
|
38
38
|
}
|
|
39
39
|
});
|
|
40
40
|
};
|
|
41
|
-
export const
|
|
41
|
+
export const itemControllerDelete = (options) => {
|
|
42
42
|
return (options.client ?? _heyApiClient).delete({
|
|
43
43
|
url: '/items',
|
|
44
44
|
...options,
|
|
@@ -48,13 +48,13 @@ export const itemControllerDeleteMany = (options) => {
|
|
|
48
48
|
}
|
|
49
49
|
});
|
|
50
50
|
};
|
|
51
|
-
export const
|
|
51
|
+
export const itemControllerFind = (options) => {
|
|
52
52
|
return (options.client ?? _heyApiClient).get({
|
|
53
53
|
url: '/items',
|
|
54
54
|
...options
|
|
55
55
|
});
|
|
56
56
|
};
|
|
57
|
-
export const
|
|
57
|
+
export const itemControllerCreate = (options) => {
|
|
58
58
|
return (options.client ?? _heyApiClient).post({
|
|
59
59
|
url: '/items',
|
|
60
60
|
...options,
|
|
@@ -64,13 +64,13 @@ export const itemControllerCreateMany = (options) => {
|
|
|
64
64
|
}
|
|
65
65
|
});
|
|
66
66
|
};
|
|
67
|
-
export const
|
|
67
|
+
export const itemControllerDeleteById = (options) => {
|
|
68
68
|
return (options.client ?? _heyApiClient).delete({
|
|
69
69
|
url: '/items/{itemId}',
|
|
70
70
|
...options
|
|
71
71
|
});
|
|
72
72
|
};
|
|
73
|
-
export const
|
|
73
|
+
export const itemControllerUpdateById = (options) => {
|
|
74
74
|
return (options.client ?? _heyApiClient).patch({
|
|
75
75
|
url: '/items/{itemId}',
|
|
76
76
|
...options,
|
|
@@ -80,3 +80,13 @@ export const itemControllerUpdateOne = (options) => {
|
|
|
80
80
|
}
|
|
81
81
|
});
|
|
82
82
|
};
|
|
83
|
+
export const profileControllerIdentify = (options) => {
|
|
84
|
+
return (options.client ?? _heyApiClient).post({
|
|
85
|
+
url: '/profiles/identify',
|
|
86
|
+
...options,
|
|
87
|
+
headers: {
|
|
88
|
+
'Content-Type': 'application/json',
|
|
89
|
+
...options?.headers
|
|
90
|
+
}
|
|
91
|
+
});
|
|
92
|
+
};
|
|
@@ -1,3 +1,31 @@
|
|
|
1
|
+
export type Item = {
|
|
2
|
+
/**
|
|
3
|
+
* The ID of the item
|
|
4
|
+
*/
|
|
5
|
+
id: string;
|
|
6
|
+
/**
|
|
7
|
+
* The Shopify ID of the product
|
|
8
|
+
*/
|
|
9
|
+
productId: number;
|
|
10
|
+
/**
|
|
11
|
+
* The Shopify ID of the variant
|
|
12
|
+
*/
|
|
13
|
+
variantId: {
|
|
14
|
+
[key: string]: unknown;
|
|
15
|
+
};
|
|
16
|
+
/**
|
|
17
|
+
* The quantity of the item in the list
|
|
18
|
+
*/
|
|
19
|
+
quantity: number;
|
|
20
|
+
/**
|
|
21
|
+
* The date and time the item was created
|
|
22
|
+
*/
|
|
23
|
+
createdAt: string;
|
|
24
|
+
/**
|
|
25
|
+
* The date and time the item was updated
|
|
26
|
+
*/
|
|
27
|
+
updatedAt: string;
|
|
28
|
+
};
|
|
1
29
|
export type List = {
|
|
2
30
|
/**
|
|
3
31
|
* The ID of the list
|
|
@@ -19,6 +47,34 @@ export type List = {
|
|
|
19
47
|
* The date and time the list was updated
|
|
20
48
|
*/
|
|
21
49
|
updatedAt: string;
|
|
50
|
+
/**
|
|
51
|
+
* The items in the list
|
|
52
|
+
*/
|
|
53
|
+
items: Array<Item>;
|
|
54
|
+
};
|
|
55
|
+
export type ErrorDto = {
|
|
56
|
+
/**
|
|
57
|
+
* The error message
|
|
58
|
+
*/
|
|
59
|
+
message: string;
|
|
60
|
+
/**
|
|
61
|
+
* The error type
|
|
62
|
+
*/
|
|
63
|
+
error: string;
|
|
64
|
+
/**
|
|
65
|
+
* The HTTP status code of the error
|
|
66
|
+
*/
|
|
67
|
+
statusCode: number;
|
|
68
|
+
/**
|
|
69
|
+
* The ID of the request that caused the error
|
|
70
|
+
*/
|
|
71
|
+
requestId: string;
|
|
72
|
+
};
|
|
73
|
+
export type ErrorResponseDto = {
|
|
74
|
+
/**
|
|
75
|
+
* Error details
|
|
76
|
+
*/
|
|
77
|
+
error: ErrorDto;
|
|
22
78
|
};
|
|
23
79
|
export type PageInfoDto = {
|
|
24
80
|
/**
|
|
@@ -52,35 +108,7 @@ export type UpdateListDto = {
|
|
|
52
108
|
*/
|
|
53
109
|
name: string;
|
|
54
110
|
};
|
|
55
|
-
export type
|
|
56
|
-
/**
|
|
57
|
-
* The ID of the item
|
|
58
|
-
*/
|
|
59
|
-
id: string;
|
|
60
|
-
/**
|
|
61
|
-
* The Shopify ID of the product
|
|
62
|
-
*/
|
|
63
|
-
productId: number;
|
|
64
|
-
/**
|
|
65
|
-
* The Shopify ID of the variant
|
|
66
|
-
*/
|
|
67
|
-
variantId: {
|
|
68
|
-
[key: string]: unknown;
|
|
69
|
-
};
|
|
70
|
-
/**
|
|
71
|
-
* The quantity of the item in the list
|
|
72
|
-
*/
|
|
73
|
-
quantity: number;
|
|
74
|
-
/**
|
|
75
|
-
* The date and time the item was created
|
|
76
|
-
*/
|
|
77
|
-
createdAt: string;
|
|
78
|
-
/**
|
|
79
|
-
* The date and time the item was updated
|
|
80
|
-
*/
|
|
81
|
-
updatedAt: string;
|
|
82
|
-
};
|
|
83
|
-
export type NewItemDto = {
|
|
111
|
+
export type CreateItemDto = {
|
|
84
112
|
/**
|
|
85
113
|
* The Shopify ID of the product
|
|
86
114
|
*/
|
|
@@ -94,9 +122,6 @@ export type NewItemDto = {
|
|
|
94
122
|
*/
|
|
95
123
|
quantity: number;
|
|
96
124
|
};
|
|
97
|
-
export type CreateItemsDto = {
|
|
98
|
-
items: Array<NewItemDto>;
|
|
99
|
-
};
|
|
100
125
|
export type ItemDto = {
|
|
101
126
|
/**
|
|
102
127
|
* The ID of the item
|
|
@@ -115,6 +140,22 @@ export type UpdateItemDto = {
|
|
|
115
140
|
* The Shopify ID of the variant
|
|
116
141
|
*/
|
|
117
142
|
variantId: number;
|
|
143
|
+
/**
|
|
144
|
+
* The quantity of the item
|
|
145
|
+
*/
|
|
146
|
+
quantity: number;
|
|
147
|
+
};
|
|
148
|
+
export type IdentifyProfileResponseDto = {
|
|
149
|
+
/**
|
|
150
|
+
* The auth flow to use
|
|
151
|
+
*/
|
|
152
|
+
authFlow: string;
|
|
153
|
+
};
|
|
154
|
+
export type IdentifyProfileDto = {
|
|
155
|
+
/**
|
|
156
|
+
* The email of the profile to identify
|
|
157
|
+
*/
|
|
158
|
+
email: string;
|
|
118
159
|
};
|
|
119
160
|
export type ListControllerFindAllData = {
|
|
120
161
|
body?: never;
|
|
@@ -135,12 +176,51 @@ export type ListControllerFindAllData = {
|
|
|
135
176
|
path?: never;
|
|
136
177
|
query?: {
|
|
137
178
|
/**
|
|
138
|
-
* The
|
|
179
|
+
* The page cursor
|
|
139
180
|
*/
|
|
140
|
-
|
|
181
|
+
page?: string;
|
|
141
182
|
};
|
|
142
183
|
url: '/lists';
|
|
143
184
|
};
|
|
185
|
+
export type ListControllerFindAllErrors = {
|
|
186
|
+
/**
|
|
187
|
+
* Bad Request
|
|
188
|
+
*/
|
|
189
|
+
400: ErrorResponseDto & {
|
|
190
|
+
error?: {
|
|
191
|
+
statusCode?: number;
|
|
192
|
+
error?: string;
|
|
193
|
+
};
|
|
194
|
+
};
|
|
195
|
+
/**
|
|
196
|
+
* Unauthorized
|
|
197
|
+
*/
|
|
198
|
+
401: ErrorResponseDto & {
|
|
199
|
+
error?: {
|
|
200
|
+
statusCode?: number;
|
|
201
|
+
error?: string;
|
|
202
|
+
};
|
|
203
|
+
};
|
|
204
|
+
/**
|
|
205
|
+
* Forbidden
|
|
206
|
+
*/
|
|
207
|
+
403: ErrorResponseDto & {
|
|
208
|
+
error?: {
|
|
209
|
+
statusCode?: number;
|
|
210
|
+
error?: string;
|
|
211
|
+
};
|
|
212
|
+
};
|
|
213
|
+
/**
|
|
214
|
+
* Not Found
|
|
215
|
+
*/
|
|
216
|
+
404: ErrorResponseDto & {
|
|
217
|
+
error?: {
|
|
218
|
+
statusCode?: number;
|
|
219
|
+
error?: string;
|
|
220
|
+
};
|
|
221
|
+
};
|
|
222
|
+
};
|
|
223
|
+
export type ListControllerFindAllError = ListControllerFindAllErrors[keyof ListControllerFindAllErrors];
|
|
144
224
|
export type ListControllerFindAllResponses = {
|
|
145
225
|
/**
|
|
146
226
|
* Returns all lists as paginated response
|
|
@@ -170,6 +250,45 @@ export type ListControllerCreateOneData = {
|
|
|
170
250
|
query?: never;
|
|
171
251
|
url: '/lists';
|
|
172
252
|
};
|
|
253
|
+
export type ListControllerCreateOneErrors = {
|
|
254
|
+
/**
|
|
255
|
+
* Bad Request
|
|
256
|
+
*/
|
|
257
|
+
400: ErrorResponseDto & {
|
|
258
|
+
error?: {
|
|
259
|
+
statusCode?: number;
|
|
260
|
+
error?: string;
|
|
261
|
+
};
|
|
262
|
+
};
|
|
263
|
+
/**
|
|
264
|
+
* Unauthorized
|
|
265
|
+
*/
|
|
266
|
+
401: ErrorResponseDto & {
|
|
267
|
+
error?: {
|
|
268
|
+
statusCode?: number;
|
|
269
|
+
error?: string;
|
|
270
|
+
};
|
|
271
|
+
};
|
|
272
|
+
/**
|
|
273
|
+
* Forbidden
|
|
274
|
+
*/
|
|
275
|
+
403: ErrorResponseDto & {
|
|
276
|
+
error?: {
|
|
277
|
+
statusCode?: number;
|
|
278
|
+
error?: string;
|
|
279
|
+
};
|
|
280
|
+
};
|
|
281
|
+
/**
|
|
282
|
+
* Not Found
|
|
283
|
+
*/
|
|
284
|
+
404: ErrorResponseDto & {
|
|
285
|
+
error?: {
|
|
286
|
+
statusCode?: number;
|
|
287
|
+
error?: string;
|
|
288
|
+
};
|
|
289
|
+
};
|
|
290
|
+
};
|
|
291
|
+
export type ListControllerCreateOneError = ListControllerCreateOneErrors[keyof ListControllerCreateOneErrors];
|
|
173
292
|
export type ListControllerCreateOneResponses = {
|
|
174
293
|
/**
|
|
175
294
|
* The list has been successfully created.
|
|
@@ -204,6 +323,45 @@ export type ListControllerDeleteOneData = {
|
|
|
204
323
|
query?: never;
|
|
205
324
|
url: '/lists/{listId}';
|
|
206
325
|
};
|
|
326
|
+
export type ListControllerDeleteOneErrors = {
|
|
327
|
+
/**
|
|
328
|
+
* Bad Request
|
|
329
|
+
*/
|
|
330
|
+
400: ErrorResponseDto & {
|
|
331
|
+
error?: {
|
|
332
|
+
statusCode?: number;
|
|
333
|
+
error?: string;
|
|
334
|
+
};
|
|
335
|
+
};
|
|
336
|
+
/**
|
|
337
|
+
* Unauthorized
|
|
338
|
+
*/
|
|
339
|
+
401: ErrorResponseDto & {
|
|
340
|
+
error?: {
|
|
341
|
+
statusCode?: number;
|
|
342
|
+
error?: string;
|
|
343
|
+
};
|
|
344
|
+
};
|
|
345
|
+
/**
|
|
346
|
+
* Forbidden
|
|
347
|
+
*/
|
|
348
|
+
403: ErrorResponseDto & {
|
|
349
|
+
error?: {
|
|
350
|
+
statusCode?: number;
|
|
351
|
+
error?: string;
|
|
352
|
+
};
|
|
353
|
+
};
|
|
354
|
+
/**
|
|
355
|
+
* Not Found
|
|
356
|
+
*/
|
|
357
|
+
404: ErrorResponseDto & {
|
|
358
|
+
error?: {
|
|
359
|
+
statusCode?: number;
|
|
360
|
+
error?: string;
|
|
361
|
+
};
|
|
362
|
+
};
|
|
363
|
+
};
|
|
364
|
+
export type ListControllerDeleteOneError = ListControllerDeleteOneErrors[keyof ListControllerDeleteOneErrors];
|
|
207
365
|
export type ListControllerDeleteOneResponses = {
|
|
208
366
|
/**
|
|
209
367
|
* The list has been successfully deleted.
|
|
@@ -236,6 +394,45 @@ export type ListControllerFindOneData = {
|
|
|
236
394
|
query?: never;
|
|
237
395
|
url: '/lists/{listId}';
|
|
238
396
|
};
|
|
397
|
+
export type ListControllerFindOneErrors = {
|
|
398
|
+
/**
|
|
399
|
+
* Bad Request
|
|
400
|
+
*/
|
|
401
|
+
400: ErrorResponseDto & {
|
|
402
|
+
error?: {
|
|
403
|
+
statusCode?: number;
|
|
404
|
+
error?: string;
|
|
405
|
+
};
|
|
406
|
+
};
|
|
407
|
+
/**
|
|
408
|
+
* Unauthorized
|
|
409
|
+
*/
|
|
410
|
+
401: ErrorResponseDto & {
|
|
411
|
+
error?: {
|
|
412
|
+
statusCode?: number;
|
|
413
|
+
error?: string;
|
|
414
|
+
};
|
|
415
|
+
};
|
|
416
|
+
/**
|
|
417
|
+
* Forbidden
|
|
418
|
+
*/
|
|
419
|
+
403: ErrorResponseDto & {
|
|
420
|
+
error?: {
|
|
421
|
+
statusCode?: number;
|
|
422
|
+
error?: string;
|
|
423
|
+
};
|
|
424
|
+
};
|
|
425
|
+
/**
|
|
426
|
+
* Not Found
|
|
427
|
+
*/
|
|
428
|
+
404: ErrorResponseDto & {
|
|
429
|
+
error?: {
|
|
430
|
+
statusCode?: number;
|
|
431
|
+
error?: string;
|
|
432
|
+
};
|
|
433
|
+
};
|
|
434
|
+
};
|
|
435
|
+
export type ListControllerFindOneError = ListControllerFindOneErrors[keyof ListControllerFindOneErrors];
|
|
239
436
|
export type ListControllerFindOneResponses = {
|
|
240
437
|
/**
|
|
241
438
|
* The list has been successfully retrieved.
|
|
@@ -270,6 +467,45 @@ export type ListControllerUpdateOneData = {
|
|
|
270
467
|
query?: never;
|
|
271
468
|
url: '/lists/{listId}';
|
|
272
469
|
};
|
|
470
|
+
export type ListControllerUpdateOneErrors = {
|
|
471
|
+
/**
|
|
472
|
+
* Bad Request
|
|
473
|
+
*/
|
|
474
|
+
400: ErrorResponseDto & {
|
|
475
|
+
error?: {
|
|
476
|
+
statusCode?: number;
|
|
477
|
+
error?: string;
|
|
478
|
+
};
|
|
479
|
+
};
|
|
480
|
+
/**
|
|
481
|
+
* Unauthorized
|
|
482
|
+
*/
|
|
483
|
+
401: ErrorResponseDto & {
|
|
484
|
+
error?: {
|
|
485
|
+
statusCode?: number;
|
|
486
|
+
error?: string;
|
|
487
|
+
};
|
|
488
|
+
};
|
|
489
|
+
/**
|
|
490
|
+
* Forbidden
|
|
491
|
+
*/
|
|
492
|
+
403: ErrorResponseDto & {
|
|
493
|
+
error?: {
|
|
494
|
+
statusCode?: number;
|
|
495
|
+
error?: string;
|
|
496
|
+
};
|
|
497
|
+
};
|
|
498
|
+
/**
|
|
499
|
+
* Not Found
|
|
500
|
+
*/
|
|
501
|
+
404: ErrorResponseDto & {
|
|
502
|
+
error?: {
|
|
503
|
+
statusCode?: number;
|
|
504
|
+
error?: string;
|
|
505
|
+
};
|
|
506
|
+
};
|
|
507
|
+
};
|
|
508
|
+
export type ListControllerUpdateOneError = ListControllerUpdateOneErrors[keyof ListControllerUpdateOneErrors];
|
|
273
509
|
export type ListControllerUpdateOneResponses = {
|
|
274
510
|
/**
|
|
275
511
|
* The list has been successfully updated.
|
|
@@ -279,7 +515,7 @@ export type ListControllerUpdateOneResponses = {
|
|
|
279
515
|
};
|
|
280
516
|
};
|
|
281
517
|
export type ListControllerUpdateOneResponse = ListControllerUpdateOneResponses[keyof ListControllerUpdateOneResponses];
|
|
282
|
-
export type
|
|
518
|
+
export type ItemControllerDeleteData = {
|
|
283
519
|
body: DeleteItemsDto;
|
|
284
520
|
headers: {
|
|
285
521
|
/**
|
|
@@ -299,14 +535,53 @@ export type ItemControllerDeleteManyData = {
|
|
|
299
535
|
query?: never;
|
|
300
536
|
url: '/items';
|
|
301
537
|
};
|
|
302
|
-
export type
|
|
538
|
+
export type ItemControllerDeleteErrors = {
|
|
539
|
+
/**
|
|
540
|
+
* Bad Request
|
|
541
|
+
*/
|
|
542
|
+
400: ErrorResponseDto & {
|
|
543
|
+
error?: {
|
|
544
|
+
statusCode?: number;
|
|
545
|
+
error?: string;
|
|
546
|
+
};
|
|
547
|
+
};
|
|
548
|
+
/**
|
|
549
|
+
* Unauthorized
|
|
550
|
+
*/
|
|
551
|
+
401: ErrorResponseDto & {
|
|
552
|
+
error?: {
|
|
553
|
+
statusCode?: number;
|
|
554
|
+
error?: string;
|
|
555
|
+
};
|
|
556
|
+
};
|
|
557
|
+
/**
|
|
558
|
+
* Forbidden
|
|
559
|
+
*/
|
|
560
|
+
403: ErrorResponseDto & {
|
|
561
|
+
error?: {
|
|
562
|
+
statusCode?: number;
|
|
563
|
+
error?: string;
|
|
564
|
+
};
|
|
565
|
+
};
|
|
566
|
+
/**
|
|
567
|
+
* Not Found
|
|
568
|
+
*/
|
|
569
|
+
404: ErrorResponseDto & {
|
|
570
|
+
error?: {
|
|
571
|
+
statusCode?: number;
|
|
572
|
+
error?: string;
|
|
573
|
+
};
|
|
574
|
+
};
|
|
575
|
+
};
|
|
576
|
+
export type ItemControllerDeleteError = ItemControllerDeleteErrors[keyof ItemControllerDeleteErrors];
|
|
577
|
+
export type ItemControllerDeleteResponses = {
|
|
303
578
|
/**
|
|
304
579
|
* The items have been successfully deleted.
|
|
305
580
|
*/
|
|
306
581
|
204: void;
|
|
307
582
|
};
|
|
308
|
-
export type
|
|
309
|
-
export type
|
|
583
|
+
export type ItemControllerDeleteResponse = ItemControllerDeleteResponses[keyof ItemControllerDeleteResponses];
|
|
584
|
+
export type ItemControllerFindData = {
|
|
310
585
|
body?: never;
|
|
311
586
|
headers: {
|
|
312
587
|
/**
|
|
@@ -325,13 +600,52 @@ export type ItemControllerFindAllData = {
|
|
|
325
600
|
path?: never;
|
|
326
601
|
query?: {
|
|
327
602
|
/**
|
|
328
|
-
* The
|
|
603
|
+
* The page cursor
|
|
329
604
|
*/
|
|
330
|
-
|
|
605
|
+
page?: string;
|
|
331
606
|
};
|
|
332
607
|
url: '/items';
|
|
333
608
|
};
|
|
334
|
-
export type
|
|
609
|
+
export type ItemControllerFindErrors = {
|
|
610
|
+
/**
|
|
611
|
+
* Bad Request
|
|
612
|
+
*/
|
|
613
|
+
400: ErrorResponseDto & {
|
|
614
|
+
error?: {
|
|
615
|
+
statusCode?: number;
|
|
616
|
+
error?: string;
|
|
617
|
+
};
|
|
618
|
+
};
|
|
619
|
+
/**
|
|
620
|
+
* Unauthorized
|
|
621
|
+
*/
|
|
622
|
+
401: ErrorResponseDto & {
|
|
623
|
+
error?: {
|
|
624
|
+
statusCode?: number;
|
|
625
|
+
error?: string;
|
|
626
|
+
};
|
|
627
|
+
};
|
|
628
|
+
/**
|
|
629
|
+
* Forbidden
|
|
630
|
+
*/
|
|
631
|
+
403: ErrorResponseDto & {
|
|
632
|
+
error?: {
|
|
633
|
+
statusCode?: number;
|
|
634
|
+
error?: string;
|
|
635
|
+
};
|
|
636
|
+
};
|
|
637
|
+
/**
|
|
638
|
+
* Not Found
|
|
639
|
+
*/
|
|
640
|
+
404: ErrorResponseDto & {
|
|
641
|
+
error?: {
|
|
642
|
+
statusCode?: number;
|
|
643
|
+
error?: string;
|
|
644
|
+
};
|
|
645
|
+
};
|
|
646
|
+
};
|
|
647
|
+
export type ItemControllerFindError = ItemControllerFindErrors[keyof ItemControllerFindErrors];
|
|
648
|
+
export type ItemControllerFindResponses = {
|
|
335
649
|
/**
|
|
336
650
|
* Returns all items as paginated response
|
|
337
651
|
*/
|
|
@@ -339,9 +653,9 @@ export type ItemControllerFindAllResponses = {
|
|
|
339
653
|
data?: Array<Item>;
|
|
340
654
|
};
|
|
341
655
|
};
|
|
342
|
-
export type
|
|
343
|
-
export type
|
|
344
|
-
body:
|
|
656
|
+
export type ItemControllerFindResponse = ItemControllerFindResponses[keyof ItemControllerFindResponses];
|
|
657
|
+
export type ItemControllerCreateData = {
|
|
658
|
+
body: CreateItemDto;
|
|
345
659
|
headers: {
|
|
346
660
|
/**
|
|
347
661
|
* Your Swish API key
|
|
@@ -360,16 +674,55 @@ export type ItemControllerCreateManyData = {
|
|
|
360
674
|
query?: never;
|
|
361
675
|
url: '/items';
|
|
362
676
|
};
|
|
363
|
-
export type
|
|
677
|
+
export type ItemControllerCreateErrors = {
|
|
678
|
+
/**
|
|
679
|
+
* Bad Request
|
|
680
|
+
*/
|
|
681
|
+
400: ErrorResponseDto & {
|
|
682
|
+
error?: {
|
|
683
|
+
statusCode?: number;
|
|
684
|
+
error?: string;
|
|
685
|
+
};
|
|
686
|
+
};
|
|
364
687
|
/**
|
|
365
|
-
*
|
|
688
|
+
* Unauthorized
|
|
689
|
+
*/
|
|
690
|
+
401: ErrorResponseDto & {
|
|
691
|
+
error?: {
|
|
692
|
+
statusCode?: number;
|
|
693
|
+
error?: string;
|
|
694
|
+
};
|
|
695
|
+
};
|
|
696
|
+
/**
|
|
697
|
+
* Forbidden
|
|
698
|
+
*/
|
|
699
|
+
403: ErrorResponseDto & {
|
|
700
|
+
error?: {
|
|
701
|
+
statusCode?: number;
|
|
702
|
+
error?: string;
|
|
703
|
+
};
|
|
704
|
+
};
|
|
705
|
+
/**
|
|
706
|
+
* Not Found
|
|
707
|
+
*/
|
|
708
|
+
404: ErrorResponseDto & {
|
|
709
|
+
error?: {
|
|
710
|
+
statusCode?: number;
|
|
711
|
+
error?: string;
|
|
712
|
+
};
|
|
713
|
+
};
|
|
714
|
+
};
|
|
715
|
+
export type ItemControllerCreateError = ItemControllerCreateErrors[keyof ItemControllerCreateErrors];
|
|
716
|
+
export type ItemControllerCreateResponses = {
|
|
717
|
+
/**
|
|
718
|
+
* The item has been successfully created.
|
|
366
719
|
*/
|
|
367
720
|
201: ResponseDto & {
|
|
368
|
-
data?:
|
|
721
|
+
data?: Item;
|
|
369
722
|
};
|
|
370
723
|
};
|
|
371
|
-
export type
|
|
372
|
-
export type
|
|
724
|
+
export type ItemControllerCreateResponse = ItemControllerCreateResponses[keyof ItemControllerCreateResponses];
|
|
725
|
+
export type ItemControllerDeleteByIdData = {
|
|
373
726
|
body?: never;
|
|
374
727
|
headers: {
|
|
375
728
|
/**
|
|
@@ -394,14 +747,53 @@ export type ItemControllerDeleteOneData = {
|
|
|
394
747
|
query?: never;
|
|
395
748
|
url: '/items/{itemId}';
|
|
396
749
|
};
|
|
397
|
-
export type
|
|
750
|
+
export type ItemControllerDeleteByIdErrors = {
|
|
751
|
+
/**
|
|
752
|
+
* Bad Request
|
|
753
|
+
*/
|
|
754
|
+
400: ErrorResponseDto & {
|
|
755
|
+
error?: {
|
|
756
|
+
statusCode?: number;
|
|
757
|
+
error?: string;
|
|
758
|
+
};
|
|
759
|
+
};
|
|
760
|
+
/**
|
|
761
|
+
* Unauthorized
|
|
762
|
+
*/
|
|
763
|
+
401: ErrorResponseDto & {
|
|
764
|
+
error?: {
|
|
765
|
+
statusCode?: number;
|
|
766
|
+
error?: string;
|
|
767
|
+
};
|
|
768
|
+
};
|
|
769
|
+
/**
|
|
770
|
+
* Forbidden
|
|
771
|
+
*/
|
|
772
|
+
403: ErrorResponseDto & {
|
|
773
|
+
error?: {
|
|
774
|
+
statusCode?: number;
|
|
775
|
+
error?: string;
|
|
776
|
+
};
|
|
777
|
+
};
|
|
778
|
+
/**
|
|
779
|
+
* Not Found
|
|
780
|
+
*/
|
|
781
|
+
404: ErrorResponseDto & {
|
|
782
|
+
error?: {
|
|
783
|
+
statusCode?: number;
|
|
784
|
+
error?: string;
|
|
785
|
+
};
|
|
786
|
+
};
|
|
787
|
+
};
|
|
788
|
+
export type ItemControllerDeleteByIdError = ItemControllerDeleteByIdErrors[keyof ItemControllerDeleteByIdErrors];
|
|
789
|
+
export type ItemControllerDeleteByIdResponses = {
|
|
398
790
|
/**
|
|
399
791
|
* The item has been successfully deleted.
|
|
400
792
|
*/
|
|
401
793
|
204: void;
|
|
402
794
|
};
|
|
403
|
-
export type
|
|
404
|
-
export type
|
|
795
|
+
export type ItemControllerDeleteByIdResponse = ItemControllerDeleteByIdResponses[keyof ItemControllerDeleteByIdResponses];
|
|
796
|
+
export type ItemControllerUpdateByIdData = {
|
|
405
797
|
body: UpdateItemDto;
|
|
406
798
|
headers: {
|
|
407
799
|
/**
|
|
@@ -426,7 +818,46 @@ export type ItemControllerUpdateOneData = {
|
|
|
426
818
|
query?: never;
|
|
427
819
|
url: '/items/{itemId}';
|
|
428
820
|
};
|
|
429
|
-
export type
|
|
821
|
+
export type ItemControllerUpdateByIdErrors = {
|
|
822
|
+
/**
|
|
823
|
+
* Bad Request
|
|
824
|
+
*/
|
|
825
|
+
400: ErrorResponseDto & {
|
|
826
|
+
error?: {
|
|
827
|
+
statusCode?: number;
|
|
828
|
+
error?: string;
|
|
829
|
+
};
|
|
830
|
+
};
|
|
831
|
+
/**
|
|
832
|
+
* Unauthorized
|
|
833
|
+
*/
|
|
834
|
+
401: ErrorResponseDto & {
|
|
835
|
+
error?: {
|
|
836
|
+
statusCode?: number;
|
|
837
|
+
error?: string;
|
|
838
|
+
};
|
|
839
|
+
};
|
|
840
|
+
/**
|
|
841
|
+
* Forbidden
|
|
842
|
+
*/
|
|
843
|
+
403: ErrorResponseDto & {
|
|
844
|
+
error?: {
|
|
845
|
+
statusCode?: number;
|
|
846
|
+
error?: string;
|
|
847
|
+
};
|
|
848
|
+
};
|
|
849
|
+
/**
|
|
850
|
+
* Not Found
|
|
851
|
+
*/
|
|
852
|
+
404: ErrorResponseDto & {
|
|
853
|
+
error?: {
|
|
854
|
+
statusCode?: number;
|
|
855
|
+
error?: string;
|
|
856
|
+
};
|
|
857
|
+
};
|
|
858
|
+
};
|
|
859
|
+
export type ItemControllerUpdateByIdError = ItemControllerUpdateByIdErrors[keyof ItemControllerUpdateByIdErrors];
|
|
860
|
+
export type ItemControllerUpdateByIdResponses = {
|
|
430
861
|
/**
|
|
431
862
|
* The item has been successfully updated.
|
|
432
863
|
*/
|
|
@@ -434,7 +865,75 @@ export type ItemControllerUpdateOneResponses = {
|
|
|
434
865
|
data?: Item;
|
|
435
866
|
};
|
|
436
867
|
};
|
|
437
|
-
export type
|
|
868
|
+
export type ItemControllerUpdateByIdResponse = ItemControllerUpdateByIdResponses[keyof ItemControllerUpdateByIdResponses];
|
|
869
|
+
export type ProfileControllerIdentifyData = {
|
|
870
|
+
body: IdentifyProfileDto;
|
|
871
|
+
headers: {
|
|
872
|
+
/**
|
|
873
|
+
* Your Swish API key
|
|
874
|
+
*/
|
|
875
|
+
Authorization: string;
|
|
876
|
+
/**
|
|
877
|
+
* The shop domain
|
|
878
|
+
*/
|
|
879
|
+
Shop: string;
|
|
880
|
+
/**
|
|
881
|
+
* The profile key
|
|
882
|
+
*/
|
|
883
|
+
Key: string;
|
|
884
|
+
};
|
|
885
|
+
path?: never;
|
|
886
|
+
query?: never;
|
|
887
|
+
url: '/profiles/identify';
|
|
888
|
+
};
|
|
889
|
+
export type ProfileControllerIdentifyErrors = {
|
|
890
|
+
/**
|
|
891
|
+
* Bad Request
|
|
892
|
+
*/
|
|
893
|
+
400: ErrorResponseDto & {
|
|
894
|
+
error?: {
|
|
895
|
+
statusCode?: number;
|
|
896
|
+
error?: string;
|
|
897
|
+
};
|
|
898
|
+
};
|
|
899
|
+
/**
|
|
900
|
+
* Unauthorized
|
|
901
|
+
*/
|
|
902
|
+
401: ErrorResponseDto & {
|
|
903
|
+
error?: {
|
|
904
|
+
statusCode?: number;
|
|
905
|
+
error?: string;
|
|
906
|
+
};
|
|
907
|
+
};
|
|
908
|
+
/**
|
|
909
|
+
* Forbidden
|
|
910
|
+
*/
|
|
911
|
+
403: ErrorResponseDto & {
|
|
912
|
+
error?: {
|
|
913
|
+
statusCode?: number;
|
|
914
|
+
error?: string;
|
|
915
|
+
};
|
|
916
|
+
};
|
|
917
|
+
/**
|
|
918
|
+
* Not Found
|
|
919
|
+
*/
|
|
920
|
+
404: ErrorResponseDto & {
|
|
921
|
+
error?: {
|
|
922
|
+
statusCode?: number;
|
|
923
|
+
error?: string;
|
|
924
|
+
};
|
|
925
|
+
};
|
|
926
|
+
};
|
|
927
|
+
export type ProfileControllerIdentifyError = ProfileControllerIdentifyErrors[keyof ProfileControllerIdentifyErrors];
|
|
928
|
+
export type ProfileControllerIdentifyResponses = {
|
|
929
|
+
/**
|
|
930
|
+
* Identifies the user profile by email
|
|
931
|
+
*/
|
|
932
|
+
200: ResponseDto & {
|
|
933
|
+
data?: IdentifyProfileResponseDto;
|
|
934
|
+
};
|
|
935
|
+
};
|
|
936
|
+
export type ProfileControllerIdentifyResponse = ProfileControllerIdentifyResponses[keyof ProfileControllerIdentifyResponses];
|
|
438
937
|
export type ClientOptions = {
|
|
439
938
|
baseUrl: 'https://swish.app/api/unstable' | (string & {});
|
|
440
939
|
};
|
package/dist/index.d.ts
CHANGED
|
@@ -1,23 +1,20 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { CreateItemDto, CreateListDto, DeleteItemsDto, ItemControllerFindData, ListControllerFindAllData, UpdateItemDto, UpdateListDto } from "./client/types.gen";
|
|
2
2
|
export interface SwishClientOptions {
|
|
3
3
|
authToken: string;
|
|
4
4
|
shop: string;
|
|
5
5
|
key: string;
|
|
6
6
|
}
|
|
7
|
-
type CursorQuery = {
|
|
8
|
-
cursor?: string;
|
|
9
|
-
};
|
|
10
7
|
export declare class SwishClient {
|
|
11
8
|
private readonly authToken;
|
|
12
9
|
private readonly shop;
|
|
13
10
|
private readonly key;
|
|
14
11
|
constructor(options: SwishClientOptions);
|
|
15
12
|
readonly items: {
|
|
16
|
-
list: (query?:
|
|
13
|
+
list: (query?: ItemControllerFindData["query"]) => Promise<(import("./client").PaginatedResponseDto & {
|
|
17
14
|
data?: Array<import("./client").Item>;
|
|
18
15
|
}) | undefined>;
|
|
19
|
-
create: (items:
|
|
20
|
-
data?:
|
|
16
|
+
create: (items: CreateItemDto) => Promise<(import("./client").ResponseDto & {
|
|
17
|
+
data?: import("./client").Item;
|
|
21
18
|
}) | undefined>;
|
|
22
19
|
delete: (items: DeleteItemsDto["items"]) => Promise<void | undefined>;
|
|
23
20
|
deleteById: (itemId: string) => Promise<void | undefined>;
|
|
@@ -26,7 +23,7 @@ export declare class SwishClient {
|
|
|
26
23
|
}) | undefined>;
|
|
27
24
|
};
|
|
28
25
|
readonly lists: {
|
|
29
|
-
list: (query?:
|
|
26
|
+
list: (query?: ListControllerFindAllData["query"]) => Promise<(import("./client").PaginatedResponseDto & {
|
|
30
27
|
data?: Array<import("./client").List>;
|
|
31
28
|
}) | undefined>;
|
|
32
29
|
getById: (listId: string) => Promise<(import("./client").ResponseDto & {
|
|
@@ -43,4 +40,3 @@ export declare class SwishClient {
|
|
|
43
40
|
private readonly addHeaders;
|
|
44
41
|
private readonly handleRequest;
|
|
45
42
|
}
|
|
46
|
-
export {};
|
package/dist/index.js
CHANGED
|
@@ -1,12 +1,12 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { itemControllerFind, itemControllerCreate, itemControllerDelete, listControllerFindAll, listControllerCreateOne, listControllerDeleteOne, listControllerFindOne, listControllerUpdateOne, itemControllerDeleteById, itemControllerUpdateById, } from "./client/sdk.gen";
|
|
2
2
|
export class SwishClient {
|
|
3
3
|
constructor(options) {
|
|
4
4
|
this.items = {
|
|
5
|
-
list: (query) => this.handleRequest(
|
|
6
|
-
create: (items) => this.handleRequest(
|
|
7
|
-
delete: (items) => this.handleRequest(
|
|
8
|
-
deleteById: (itemId) => this.handleRequest(
|
|
9
|
-
updateById: (itemId, body) => this.handleRequest(
|
|
5
|
+
list: (query) => this.handleRequest(itemControllerFind(this.addHeaders({ query }))),
|
|
6
|
+
create: (items) => this.handleRequest(itemControllerCreate(this.addHeaders({ body: items }))),
|
|
7
|
+
delete: (items) => this.handleRequest(itemControllerDelete(this.addHeaders({ body: { items } }))),
|
|
8
|
+
deleteById: (itemId) => this.handleRequest(itemControllerDeleteById(this.addHeaders({ path: { itemId } }))),
|
|
9
|
+
updateById: (itemId, body) => this.handleRequest(itemControllerUpdateById(this.addHeaders({
|
|
10
10
|
body,
|
|
11
11
|
path: { itemId },
|
|
12
12
|
}))),
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@swishapp/api-client",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.3.0",
|
|
4
4
|
"description": "API client for the Swish API",
|
|
5
5
|
"website": "https://swish.app",
|
|
6
6
|
"type": "module",
|
|
@@ -33,7 +33,8 @@
|
|
|
33
33
|
"@hey-api/openapi-ts": "0.64.10",
|
|
34
34
|
"@types/jest": "29.5.14",
|
|
35
35
|
"jest": "29.7.0",
|
|
36
|
+
"rimraf": "5.0.1",
|
|
36
37
|
"ts-jest": "29.1.1",
|
|
37
|
-
"
|
|
38
|
+
"ts-node": "10.9.2"
|
|
38
39
|
}
|
|
39
40
|
}
|