@swishapp/api-client 0.1.1 → 0.2.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 +3 -3
- package/dist/client/sdk.gen.d.ts +18 -15
- package/dist/client/sdk.gen.js +15 -5
- package/dist/client/types.gen.d.ts +411 -22
- package/dist/index.d.ts +3 -3
- package/dist/index.js +6 -6
- package/package.json +3 -2
package/README.md
CHANGED
|
@@ -5,7 +5,7 @@ A JavaScript client for the Swish API with TypeScript support.
|
|
|
5
5
|
## Installation
|
|
6
6
|
|
|
7
7
|
```bash
|
|
8
|
-
npm install @
|
|
8
|
+
npm install @swishapp/api-client
|
|
9
9
|
```
|
|
10
10
|
|
|
11
11
|
## Usage
|
|
@@ -13,13 +13,13 @@ npm install @swish/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
|
+
};
|
|
@@ -20,6 +20,12 @@ export type List = {
|
|
|
20
20
|
*/
|
|
21
21
|
updatedAt: string;
|
|
22
22
|
};
|
|
23
|
+
export type ErrorResponseDto = {
|
|
24
|
+
message: string;
|
|
25
|
+
error: string;
|
|
26
|
+
statusCode: number;
|
|
27
|
+
requestId: string;
|
|
28
|
+
};
|
|
23
29
|
export type PageInfoDto = {
|
|
24
30
|
/**
|
|
25
31
|
* The cursor for the next page
|
|
@@ -80,7 +86,7 @@ export type Item = {
|
|
|
80
86
|
*/
|
|
81
87
|
updatedAt: string;
|
|
82
88
|
};
|
|
83
|
-
export type
|
|
89
|
+
export type CreateItemDto = {
|
|
84
90
|
/**
|
|
85
91
|
* The Shopify ID of the product
|
|
86
92
|
*/
|
|
@@ -94,9 +100,6 @@ export type NewItemDto = {
|
|
|
94
100
|
*/
|
|
95
101
|
quantity: number;
|
|
96
102
|
};
|
|
97
|
-
export type CreateItemsDto = {
|
|
98
|
-
items: Array<NewItemDto>;
|
|
99
|
-
};
|
|
100
103
|
export type ItemDto = {
|
|
101
104
|
/**
|
|
102
105
|
* The ID of the item
|
|
@@ -115,6 +118,22 @@ export type UpdateItemDto = {
|
|
|
115
118
|
* The Shopify ID of the variant
|
|
116
119
|
*/
|
|
117
120
|
variantId: number;
|
|
121
|
+
/**
|
|
122
|
+
* The quantity of the item
|
|
123
|
+
*/
|
|
124
|
+
quantity: number;
|
|
125
|
+
};
|
|
126
|
+
export type IdentifyProfileResponseDto = {
|
|
127
|
+
/**
|
|
128
|
+
* The auth flow to use
|
|
129
|
+
*/
|
|
130
|
+
authFlow: string;
|
|
131
|
+
};
|
|
132
|
+
export type IdentifyProfileDto = {
|
|
133
|
+
/**
|
|
134
|
+
* The email of the profile to identify
|
|
135
|
+
*/
|
|
136
|
+
email: string;
|
|
118
137
|
};
|
|
119
138
|
export type ListControllerFindAllData = {
|
|
120
139
|
body?: never;
|
|
@@ -141,6 +160,37 @@ export type ListControllerFindAllData = {
|
|
|
141
160
|
};
|
|
142
161
|
url: '/lists';
|
|
143
162
|
};
|
|
163
|
+
export type ListControllerFindAllErrors = {
|
|
164
|
+
/**
|
|
165
|
+
* Bad Request
|
|
166
|
+
*/
|
|
167
|
+
400: ErrorResponseDto & {
|
|
168
|
+
statusCode?: number;
|
|
169
|
+
error?: string;
|
|
170
|
+
};
|
|
171
|
+
/**
|
|
172
|
+
* Unauthorized
|
|
173
|
+
*/
|
|
174
|
+
401: ErrorResponseDto & {
|
|
175
|
+
statusCode?: number;
|
|
176
|
+
error?: string;
|
|
177
|
+
};
|
|
178
|
+
/**
|
|
179
|
+
* Forbidden
|
|
180
|
+
*/
|
|
181
|
+
403: ErrorResponseDto & {
|
|
182
|
+
statusCode?: number;
|
|
183
|
+
error?: string;
|
|
184
|
+
};
|
|
185
|
+
/**
|
|
186
|
+
* Not Found
|
|
187
|
+
*/
|
|
188
|
+
404: ErrorResponseDto & {
|
|
189
|
+
statusCode?: number;
|
|
190
|
+
error?: string;
|
|
191
|
+
};
|
|
192
|
+
};
|
|
193
|
+
export type ListControllerFindAllError = ListControllerFindAllErrors[keyof ListControllerFindAllErrors];
|
|
144
194
|
export type ListControllerFindAllResponses = {
|
|
145
195
|
/**
|
|
146
196
|
* Returns all lists as paginated response
|
|
@@ -170,6 +220,37 @@ export type ListControllerCreateOneData = {
|
|
|
170
220
|
query?: never;
|
|
171
221
|
url: '/lists';
|
|
172
222
|
};
|
|
223
|
+
export type ListControllerCreateOneErrors = {
|
|
224
|
+
/**
|
|
225
|
+
* Bad Request
|
|
226
|
+
*/
|
|
227
|
+
400: ErrorResponseDto & {
|
|
228
|
+
statusCode?: number;
|
|
229
|
+
error?: string;
|
|
230
|
+
};
|
|
231
|
+
/**
|
|
232
|
+
* Unauthorized
|
|
233
|
+
*/
|
|
234
|
+
401: ErrorResponseDto & {
|
|
235
|
+
statusCode?: number;
|
|
236
|
+
error?: string;
|
|
237
|
+
};
|
|
238
|
+
/**
|
|
239
|
+
* Forbidden
|
|
240
|
+
*/
|
|
241
|
+
403: ErrorResponseDto & {
|
|
242
|
+
statusCode?: number;
|
|
243
|
+
error?: string;
|
|
244
|
+
};
|
|
245
|
+
/**
|
|
246
|
+
* Not Found
|
|
247
|
+
*/
|
|
248
|
+
404: ErrorResponseDto & {
|
|
249
|
+
statusCode?: number;
|
|
250
|
+
error?: string;
|
|
251
|
+
};
|
|
252
|
+
};
|
|
253
|
+
export type ListControllerCreateOneError = ListControllerCreateOneErrors[keyof ListControllerCreateOneErrors];
|
|
173
254
|
export type ListControllerCreateOneResponses = {
|
|
174
255
|
/**
|
|
175
256
|
* The list has been successfully created.
|
|
@@ -204,6 +285,37 @@ export type ListControllerDeleteOneData = {
|
|
|
204
285
|
query?: never;
|
|
205
286
|
url: '/lists/{listId}';
|
|
206
287
|
};
|
|
288
|
+
export type ListControllerDeleteOneErrors = {
|
|
289
|
+
/**
|
|
290
|
+
* Bad Request
|
|
291
|
+
*/
|
|
292
|
+
400: ErrorResponseDto & {
|
|
293
|
+
statusCode?: number;
|
|
294
|
+
error?: string;
|
|
295
|
+
};
|
|
296
|
+
/**
|
|
297
|
+
* Unauthorized
|
|
298
|
+
*/
|
|
299
|
+
401: ErrorResponseDto & {
|
|
300
|
+
statusCode?: number;
|
|
301
|
+
error?: string;
|
|
302
|
+
};
|
|
303
|
+
/**
|
|
304
|
+
* Forbidden
|
|
305
|
+
*/
|
|
306
|
+
403: ErrorResponseDto & {
|
|
307
|
+
statusCode?: number;
|
|
308
|
+
error?: string;
|
|
309
|
+
};
|
|
310
|
+
/**
|
|
311
|
+
* Not Found
|
|
312
|
+
*/
|
|
313
|
+
404: ErrorResponseDto & {
|
|
314
|
+
statusCode?: number;
|
|
315
|
+
error?: string;
|
|
316
|
+
};
|
|
317
|
+
};
|
|
318
|
+
export type ListControllerDeleteOneError = ListControllerDeleteOneErrors[keyof ListControllerDeleteOneErrors];
|
|
207
319
|
export type ListControllerDeleteOneResponses = {
|
|
208
320
|
/**
|
|
209
321
|
* The list has been successfully deleted.
|
|
@@ -236,6 +348,37 @@ export type ListControllerFindOneData = {
|
|
|
236
348
|
query?: never;
|
|
237
349
|
url: '/lists/{listId}';
|
|
238
350
|
};
|
|
351
|
+
export type ListControllerFindOneErrors = {
|
|
352
|
+
/**
|
|
353
|
+
* Bad Request
|
|
354
|
+
*/
|
|
355
|
+
400: ErrorResponseDto & {
|
|
356
|
+
statusCode?: number;
|
|
357
|
+
error?: string;
|
|
358
|
+
};
|
|
359
|
+
/**
|
|
360
|
+
* Unauthorized
|
|
361
|
+
*/
|
|
362
|
+
401: ErrorResponseDto & {
|
|
363
|
+
statusCode?: number;
|
|
364
|
+
error?: string;
|
|
365
|
+
};
|
|
366
|
+
/**
|
|
367
|
+
* Forbidden
|
|
368
|
+
*/
|
|
369
|
+
403: ErrorResponseDto & {
|
|
370
|
+
statusCode?: number;
|
|
371
|
+
error?: string;
|
|
372
|
+
};
|
|
373
|
+
/**
|
|
374
|
+
* Not Found
|
|
375
|
+
*/
|
|
376
|
+
404: ErrorResponseDto & {
|
|
377
|
+
statusCode?: number;
|
|
378
|
+
error?: string;
|
|
379
|
+
};
|
|
380
|
+
};
|
|
381
|
+
export type ListControllerFindOneError = ListControllerFindOneErrors[keyof ListControllerFindOneErrors];
|
|
239
382
|
export type ListControllerFindOneResponses = {
|
|
240
383
|
/**
|
|
241
384
|
* The list has been successfully retrieved.
|
|
@@ -270,6 +413,37 @@ export type ListControllerUpdateOneData = {
|
|
|
270
413
|
query?: never;
|
|
271
414
|
url: '/lists/{listId}';
|
|
272
415
|
};
|
|
416
|
+
export type ListControllerUpdateOneErrors = {
|
|
417
|
+
/**
|
|
418
|
+
* Bad Request
|
|
419
|
+
*/
|
|
420
|
+
400: ErrorResponseDto & {
|
|
421
|
+
statusCode?: number;
|
|
422
|
+
error?: string;
|
|
423
|
+
};
|
|
424
|
+
/**
|
|
425
|
+
* Unauthorized
|
|
426
|
+
*/
|
|
427
|
+
401: ErrorResponseDto & {
|
|
428
|
+
statusCode?: number;
|
|
429
|
+
error?: string;
|
|
430
|
+
};
|
|
431
|
+
/**
|
|
432
|
+
* Forbidden
|
|
433
|
+
*/
|
|
434
|
+
403: ErrorResponseDto & {
|
|
435
|
+
statusCode?: number;
|
|
436
|
+
error?: string;
|
|
437
|
+
};
|
|
438
|
+
/**
|
|
439
|
+
* Not Found
|
|
440
|
+
*/
|
|
441
|
+
404: ErrorResponseDto & {
|
|
442
|
+
statusCode?: number;
|
|
443
|
+
error?: string;
|
|
444
|
+
};
|
|
445
|
+
};
|
|
446
|
+
export type ListControllerUpdateOneError = ListControllerUpdateOneErrors[keyof ListControllerUpdateOneErrors];
|
|
273
447
|
export type ListControllerUpdateOneResponses = {
|
|
274
448
|
/**
|
|
275
449
|
* The list has been successfully updated.
|
|
@@ -279,7 +453,7 @@ export type ListControllerUpdateOneResponses = {
|
|
|
279
453
|
};
|
|
280
454
|
};
|
|
281
455
|
export type ListControllerUpdateOneResponse = ListControllerUpdateOneResponses[keyof ListControllerUpdateOneResponses];
|
|
282
|
-
export type
|
|
456
|
+
export type ItemControllerDeleteData = {
|
|
283
457
|
body: DeleteItemsDto;
|
|
284
458
|
headers: {
|
|
285
459
|
/**
|
|
@@ -299,14 +473,45 @@ export type ItemControllerDeleteManyData = {
|
|
|
299
473
|
query?: never;
|
|
300
474
|
url: '/items';
|
|
301
475
|
};
|
|
302
|
-
export type
|
|
476
|
+
export type ItemControllerDeleteErrors = {
|
|
477
|
+
/**
|
|
478
|
+
* Bad Request
|
|
479
|
+
*/
|
|
480
|
+
400: ErrorResponseDto & {
|
|
481
|
+
statusCode?: number;
|
|
482
|
+
error?: string;
|
|
483
|
+
};
|
|
484
|
+
/**
|
|
485
|
+
* Unauthorized
|
|
486
|
+
*/
|
|
487
|
+
401: ErrorResponseDto & {
|
|
488
|
+
statusCode?: number;
|
|
489
|
+
error?: string;
|
|
490
|
+
};
|
|
491
|
+
/**
|
|
492
|
+
* Forbidden
|
|
493
|
+
*/
|
|
494
|
+
403: ErrorResponseDto & {
|
|
495
|
+
statusCode?: number;
|
|
496
|
+
error?: string;
|
|
497
|
+
};
|
|
498
|
+
/**
|
|
499
|
+
* Not Found
|
|
500
|
+
*/
|
|
501
|
+
404: ErrorResponseDto & {
|
|
502
|
+
statusCode?: number;
|
|
503
|
+
error?: string;
|
|
504
|
+
};
|
|
505
|
+
};
|
|
506
|
+
export type ItemControllerDeleteError = ItemControllerDeleteErrors[keyof ItemControllerDeleteErrors];
|
|
507
|
+
export type ItemControllerDeleteResponses = {
|
|
303
508
|
/**
|
|
304
509
|
* The items have been successfully deleted.
|
|
305
510
|
*/
|
|
306
511
|
204: void;
|
|
307
512
|
};
|
|
308
|
-
export type
|
|
309
|
-
export type
|
|
513
|
+
export type ItemControllerDeleteResponse = ItemControllerDeleteResponses[keyof ItemControllerDeleteResponses];
|
|
514
|
+
export type ItemControllerFindData = {
|
|
310
515
|
body?: never;
|
|
311
516
|
headers: {
|
|
312
517
|
/**
|
|
@@ -331,7 +536,38 @@ export type ItemControllerFindAllData = {
|
|
|
331
536
|
};
|
|
332
537
|
url: '/items';
|
|
333
538
|
};
|
|
334
|
-
export type
|
|
539
|
+
export type ItemControllerFindErrors = {
|
|
540
|
+
/**
|
|
541
|
+
* Bad Request
|
|
542
|
+
*/
|
|
543
|
+
400: ErrorResponseDto & {
|
|
544
|
+
statusCode?: number;
|
|
545
|
+
error?: string;
|
|
546
|
+
};
|
|
547
|
+
/**
|
|
548
|
+
* Unauthorized
|
|
549
|
+
*/
|
|
550
|
+
401: ErrorResponseDto & {
|
|
551
|
+
statusCode?: number;
|
|
552
|
+
error?: string;
|
|
553
|
+
};
|
|
554
|
+
/**
|
|
555
|
+
* Forbidden
|
|
556
|
+
*/
|
|
557
|
+
403: ErrorResponseDto & {
|
|
558
|
+
statusCode?: number;
|
|
559
|
+
error?: string;
|
|
560
|
+
};
|
|
561
|
+
/**
|
|
562
|
+
* Not Found
|
|
563
|
+
*/
|
|
564
|
+
404: ErrorResponseDto & {
|
|
565
|
+
statusCode?: number;
|
|
566
|
+
error?: string;
|
|
567
|
+
};
|
|
568
|
+
};
|
|
569
|
+
export type ItemControllerFindError = ItemControllerFindErrors[keyof ItemControllerFindErrors];
|
|
570
|
+
export type ItemControllerFindResponses = {
|
|
335
571
|
/**
|
|
336
572
|
* Returns all items as paginated response
|
|
337
573
|
*/
|
|
@@ -339,9 +575,9 @@ export type ItemControllerFindAllResponses = {
|
|
|
339
575
|
data?: Array<Item>;
|
|
340
576
|
};
|
|
341
577
|
};
|
|
342
|
-
export type
|
|
343
|
-
export type
|
|
344
|
-
body:
|
|
578
|
+
export type ItemControllerFindResponse = ItemControllerFindResponses[keyof ItemControllerFindResponses];
|
|
579
|
+
export type ItemControllerCreateData = {
|
|
580
|
+
body: CreateItemDto;
|
|
345
581
|
headers: {
|
|
346
582
|
/**
|
|
347
583
|
* Your Swish API key
|
|
@@ -360,16 +596,47 @@ export type ItemControllerCreateManyData = {
|
|
|
360
596
|
query?: never;
|
|
361
597
|
url: '/items';
|
|
362
598
|
};
|
|
363
|
-
export type
|
|
599
|
+
export type ItemControllerCreateErrors = {
|
|
600
|
+
/**
|
|
601
|
+
* Bad Request
|
|
602
|
+
*/
|
|
603
|
+
400: ErrorResponseDto & {
|
|
604
|
+
statusCode?: number;
|
|
605
|
+
error?: string;
|
|
606
|
+
};
|
|
364
607
|
/**
|
|
365
|
-
*
|
|
608
|
+
* Unauthorized
|
|
609
|
+
*/
|
|
610
|
+
401: ErrorResponseDto & {
|
|
611
|
+
statusCode?: number;
|
|
612
|
+
error?: string;
|
|
613
|
+
};
|
|
614
|
+
/**
|
|
615
|
+
* Forbidden
|
|
616
|
+
*/
|
|
617
|
+
403: ErrorResponseDto & {
|
|
618
|
+
statusCode?: number;
|
|
619
|
+
error?: string;
|
|
620
|
+
};
|
|
621
|
+
/**
|
|
622
|
+
* Not Found
|
|
623
|
+
*/
|
|
624
|
+
404: ErrorResponseDto & {
|
|
625
|
+
statusCode?: number;
|
|
626
|
+
error?: string;
|
|
627
|
+
};
|
|
628
|
+
};
|
|
629
|
+
export type ItemControllerCreateError = ItemControllerCreateErrors[keyof ItemControllerCreateErrors];
|
|
630
|
+
export type ItemControllerCreateResponses = {
|
|
631
|
+
/**
|
|
632
|
+
* The item has been successfully created.
|
|
366
633
|
*/
|
|
367
634
|
201: ResponseDto & {
|
|
368
|
-
data?:
|
|
635
|
+
data?: Item;
|
|
369
636
|
};
|
|
370
637
|
};
|
|
371
|
-
export type
|
|
372
|
-
export type
|
|
638
|
+
export type ItemControllerCreateResponse = ItemControllerCreateResponses[keyof ItemControllerCreateResponses];
|
|
639
|
+
export type ItemControllerDeleteByIdData = {
|
|
373
640
|
body?: never;
|
|
374
641
|
headers: {
|
|
375
642
|
/**
|
|
@@ -394,14 +661,45 @@ export type ItemControllerDeleteOneData = {
|
|
|
394
661
|
query?: never;
|
|
395
662
|
url: '/items/{itemId}';
|
|
396
663
|
};
|
|
397
|
-
export type
|
|
664
|
+
export type ItemControllerDeleteByIdErrors = {
|
|
665
|
+
/**
|
|
666
|
+
* Bad Request
|
|
667
|
+
*/
|
|
668
|
+
400: ErrorResponseDto & {
|
|
669
|
+
statusCode?: number;
|
|
670
|
+
error?: string;
|
|
671
|
+
};
|
|
672
|
+
/**
|
|
673
|
+
* Unauthorized
|
|
674
|
+
*/
|
|
675
|
+
401: ErrorResponseDto & {
|
|
676
|
+
statusCode?: number;
|
|
677
|
+
error?: string;
|
|
678
|
+
};
|
|
679
|
+
/**
|
|
680
|
+
* Forbidden
|
|
681
|
+
*/
|
|
682
|
+
403: ErrorResponseDto & {
|
|
683
|
+
statusCode?: number;
|
|
684
|
+
error?: string;
|
|
685
|
+
};
|
|
686
|
+
/**
|
|
687
|
+
* Not Found
|
|
688
|
+
*/
|
|
689
|
+
404: ErrorResponseDto & {
|
|
690
|
+
statusCode?: number;
|
|
691
|
+
error?: string;
|
|
692
|
+
};
|
|
693
|
+
};
|
|
694
|
+
export type ItemControllerDeleteByIdError = ItemControllerDeleteByIdErrors[keyof ItemControllerDeleteByIdErrors];
|
|
695
|
+
export type ItemControllerDeleteByIdResponses = {
|
|
398
696
|
/**
|
|
399
697
|
* The item has been successfully deleted.
|
|
400
698
|
*/
|
|
401
699
|
204: void;
|
|
402
700
|
};
|
|
403
|
-
export type
|
|
404
|
-
export type
|
|
701
|
+
export type ItemControllerDeleteByIdResponse = ItemControllerDeleteByIdResponses[keyof ItemControllerDeleteByIdResponses];
|
|
702
|
+
export type ItemControllerUpdateByIdData = {
|
|
405
703
|
body: UpdateItemDto;
|
|
406
704
|
headers: {
|
|
407
705
|
/**
|
|
@@ -426,7 +724,38 @@ export type ItemControllerUpdateOneData = {
|
|
|
426
724
|
query?: never;
|
|
427
725
|
url: '/items/{itemId}';
|
|
428
726
|
};
|
|
429
|
-
export type
|
|
727
|
+
export type ItemControllerUpdateByIdErrors = {
|
|
728
|
+
/**
|
|
729
|
+
* Bad Request
|
|
730
|
+
*/
|
|
731
|
+
400: ErrorResponseDto & {
|
|
732
|
+
statusCode?: number;
|
|
733
|
+
error?: string;
|
|
734
|
+
};
|
|
735
|
+
/**
|
|
736
|
+
* Unauthorized
|
|
737
|
+
*/
|
|
738
|
+
401: ErrorResponseDto & {
|
|
739
|
+
statusCode?: number;
|
|
740
|
+
error?: string;
|
|
741
|
+
};
|
|
742
|
+
/**
|
|
743
|
+
* Forbidden
|
|
744
|
+
*/
|
|
745
|
+
403: ErrorResponseDto & {
|
|
746
|
+
statusCode?: number;
|
|
747
|
+
error?: string;
|
|
748
|
+
};
|
|
749
|
+
/**
|
|
750
|
+
* Not Found
|
|
751
|
+
*/
|
|
752
|
+
404: ErrorResponseDto & {
|
|
753
|
+
statusCode?: number;
|
|
754
|
+
error?: string;
|
|
755
|
+
};
|
|
756
|
+
};
|
|
757
|
+
export type ItemControllerUpdateByIdError = ItemControllerUpdateByIdErrors[keyof ItemControllerUpdateByIdErrors];
|
|
758
|
+
export type ItemControllerUpdateByIdResponses = {
|
|
430
759
|
/**
|
|
431
760
|
* The item has been successfully updated.
|
|
432
761
|
*/
|
|
@@ -434,7 +763,67 @@ export type ItemControllerUpdateOneResponses = {
|
|
|
434
763
|
data?: Item;
|
|
435
764
|
};
|
|
436
765
|
};
|
|
437
|
-
export type
|
|
766
|
+
export type ItemControllerUpdateByIdResponse = ItemControllerUpdateByIdResponses[keyof ItemControllerUpdateByIdResponses];
|
|
767
|
+
export type ProfileControllerIdentifyData = {
|
|
768
|
+
body: IdentifyProfileDto;
|
|
769
|
+
headers: {
|
|
770
|
+
/**
|
|
771
|
+
* Your Swish API key
|
|
772
|
+
*/
|
|
773
|
+
Authorization: string;
|
|
774
|
+
/**
|
|
775
|
+
* The shop domain
|
|
776
|
+
*/
|
|
777
|
+
Shop: string;
|
|
778
|
+
/**
|
|
779
|
+
* The profile key
|
|
780
|
+
*/
|
|
781
|
+
Key: string;
|
|
782
|
+
};
|
|
783
|
+
path?: never;
|
|
784
|
+
query?: never;
|
|
785
|
+
url: '/profiles/identify';
|
|
786
|
+
};
|
|
787
|
+
export type ProfileControllerIdentifyErrors = {
|
|
788
|
+
/**
|
|
789
|
+
* Bad Request
|
|
790
|
+
*/
|
|
791
|
+
400: ErrorResponseDto & {
|
|
792
|
+
statusCode?: number;
|
|
793
|
+
error?: string;
|
|
794
|
+
};
|
|
795
|
+
/**
|
|
796
|
+
* Unauthorized
|
|
797
|
+
*/
|
|
798
|
+
401: ErrorResponseDto & {
|
|
799
|
+
statusCode?: number;
|
|
800
|
+
error?: string;
|
|
801
|
+
};
|
|
802
|
+
/**
|
|
803
|
+
* Forbidden
|
|
804
|
+
*/
|
|
805
|
+
403: ErrorResponseDto & {
|
|
806
|
+
statusCode?: number;
|
|
807
|
+
error?: string;
|
|
808
|
+
};
|
|
809
|
+
/**
|
|
810
|
+
* Not Found
|
|
811
|
+
*/
|
|
812
|
+
404: ErrorResponseDto & {
|
|
813
|
+
statusCode?: number;
|
|
814
|
+
error?: string;
|
|
815
|
+
};
|
|
816
|
+
};
|
|
817
|
+
export type ProfileControllerIdentifyError = ProfileControllerIdentifyErrors[keyof ProfileControllerIdentifyErrors];
|
|
818
|
+
export type ProfileControllerIdentifyResponses = {
|
|
819
|
+
/**
|
|
820
|
+
* Identifies the user profile by email
|
|
821
|
+
*/
|
|
822
|
+
200: ResponseDto & {
|
|
823
|
+
data?: IdentifyProfileResponseDto;
|
|
824
|
+
};
|
|
825
|
+
};
|
|
826
|
+
export type ProfileControllerIdentifyResponse = ProfileControllerIdentifyResponses[keyof ProfileControllerIdentifyResponses];
|
|
438
827
|
export type ClientOptions = {
|
|
439
828
|
baseUrl: 'https://swish.app/api/unstable' | (string & {});
|
|
440
829
|
};
|
package/dist/index.d.ts
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { CreateItemDto, CreateListDto, DeleteItemsDto, UpdateItemDto, UpdateListDto } from "./client/types.gen";
|
|
2
2
|
export interface SwishClientOptions {
|
|
3
3
|
authToken: string;
|
|
4
4
|
shop: string;
|
|
@@ -16,8 +16,8 @@ export declare class SwishClient {
|
|
|
16
16
|
list: (query?: CursorQuery) => Promise<(import("./client").PaginatedResponseDto & {
|
|
17
17
|
data?: Array<import("./client").Item>;
|
|
18
18
|
}) | undefined>;
|
|
19
|
-
create: (items:
|
|
20
|
-
data?:
|
|
19
|
+
create: (items: CreateItemDto) => Promise<(import("./client").ResponseDto & {
|
|
20
|
+
data?: import("./client").Item;
|
|
21
21
|
}) | undefined>;
|
|
22
22
|
delete: (items: DeleteItemsDto["items"]) => Promise<void | undefined>;
|
|
23
23
|
deleteById: (itemId: string) => Promise<void | undefined>;
|
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.2.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
|
}
|