@swishapp/api-client 0.3.0 → 0.4.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.
@@ -1,5 +1,5 @@
1
1
  import type { Options as ClientOptions, TDataShape, Client } from '@hey-api/client-fetch';
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';
2
+ import type { ListControllerFindData, ListControllerFindError, ListControllerCreateData, ListControllerCreateError, ListControllerDeleteByIdData, ListControllerDeleteByIdError, ListControllerFindByIdData, ListControllerFindByIdError, ListControllerUpdateByIdData, ListControllerUpdateByIdError, ItemControllerDeleteData, ItemControllerDeleteError, ItemControllerFindData, ItemControllerFindError, ItemControllerCreateData, ItemControllerCreateError, ItemControllerDeleteByIdData, ItemControllerDeleteByIdError, ItemControllerUpdateByIdData, ItemControllerUpdateByIdError, ProfileControllerIdentifyProfileData, ProfileControllerIdentifyProfileError, ProfileControllerCreateTokenData, ProfileControllerCreateTokenError } 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
@@ -13,30 +13,33 @@ export type Options<TData extends TDataShape = TDataShape, ThrowOnError extends
13
13
  */
14
14
  meta?: Record<string, unknown>;
15
15
  };
16
- export declare const listControllerFindAll: <ThrowOnError extends boolean = false>(options: Options<ListControllerFindAllData, ThrowOnError>) => import("@hey-api/client-fetch").RequestResult<import("./types.gen").PaginatedResponseDto & {
16
+ export declare const listControllerFind: <ThrowOnError extends boolean = false>(options?: Options<ListControllerFindData, ThrowOnError>) => import("@hey-api/client-fetch").RequestResult<import("./types.gen").PaginatedResponse & {
17
17
  data?: Array<import("./types.gen").List>;
18
- }, ListControllerFindAllError, ThrowOnError>;
19
- export declare const listControllerCreateOne: <ThrowOnError extends boolean = false>(options: Options<ListControllerCreateOneData, ThrowOnError>) => import("@hey-api/client-fetch").RequestResult<import("./types.gen").ResponseDto & {
18
+ }, ListControllerFindError, ThrowOnError>;
19
+ export declare const listControllerCreate: <ThrowOnError extends boolean = false>(options: Options<ListControllerCreateData, ThrowOnError>) => import("@hey-api/client-fetch").RequestResult<import("./types.gen").Response & {
20
20
  data?: import("./types.gen").List;
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
- export declare const listControllerFindOne: <ThrowOnError extends boolean = false>(options: Options<ListControllerFindOneData, ThrowOnError>) => import("@hey-api/client-fetch").RequestResult<import("./types.gen").ResponseDto & {
21
+ }, ListControllerCreateError, ThrowOnError>;
22
+ export declare const listControllerDeleteById: <ThrowOnError extends boolean = false>(options: Options<ListControllerDeleteByIdData, ThrowOnError>) => import("@hey-api/client-fetch").RequestResult<void, ListControllerDeleteByIdError, ThrowOnError>;
23
+ export declare const listControllerFindById: <ThrowOnError extends boolean = false>(options: Options<ListControllerFindByIdData, ThrowOnError>) => import("@hey-api/client-fetch").RequestResult<import("./types.gen").Response & {
24
24
  data?: import("./types.gen").List;
25
- }, ListControllerFindOneError, ThrowOnError>;
26
- export declare const listControllerUpdateOne: <ThrowOnError extends boolean = false>(options: Options<ListControllerUpdateOneData, ThrowOnError>) => import("@hey-api/client-fetch").RequestResult<import("./types.gen").ResponseDto & {
25
+ }, ListControllerFindByIdError, ThrowOnError>;
26
+ export declare const listControllerUpdateById: <ThrowOnError extends boolean = false>(options: Options<ListControllerUpdateByIdData, ThrowOnError>) => import("@hey-api/client-fetch").RequestResult<import("./types.gen").Response & {
27
27
  data?: import("./types.gen").List;
28
- }, ListControllerUpdateOneError, ThrowOnError>;
28
+ }, ListControllerUpdateByIdError, ThrowOnError>;
29
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 & {
30
+ export declare const itemControllerFind: <ThrowOnError extends boolean = false>(options?: Options<ItemControllerFindData, ThrowOnError>) => import("@hey-api/client-fetch").RequestResult<import("./types.gen").PaginatedResponse & {
31
31
  data?: Array<import("./types.gen").Item>;
32
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 & {
33
+ export declare const itemControllerCreate: <ThrowOnError extends boolean = false>(options: Options<ItemControllerCreateData, ThrowOnError>) => import("@hey-api/client-fetch").RequestResult<import("./types.gen").Response & {
34
34
  data?: import("./types.gen").Item;
35
35
  }, ItemControllerCreateError, ThrowOnError>;
36
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 & {
37
+ export declare const itemControllerUpdateById: <ThrowOnError extends boolean = false>(options: Options<ItemControllerUpdateByIdData, ThrowOnError>) => import("@hey-api/client-fetch").RequestResult<import("./types.gen").Response & {
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>;
40
+ export declare const profileControllerIdentifyProfile: <ThrowOnError extends boolean = false>(options: Options<ProfileControllerIdentifyProfileData, ThrowOnError>) => import("@hey-api/client-fetch").RequestResult<import("./types.gen").Response & {
41
+ data?: import("./types.gen").IdentifyProfileResponse;
42
+ }, ProfileControllerIdentifyProfileError, ThrowOnError>;
43
+ export declare const profileControllerCreateToken: <ThrowOnError extends boolean = false>(options: Options<ProfileControllerCreateTokenData, ThrowOnError>) => import("@hey-api/client-fetch").RequestResult<import("./types.gen").Response & {
44
+ data?: import("./types.gen").CreateProfileTokenResponse;
45
+ }, ProfileControllerCreateTokenError, ThrowOnError>;
@@ -1,12 +1,12 @@
1
1
  // This file is auto-generated by @hey-api/openapi-ts
2
2
  import { client as _heyApiClient } from './client.gen';
3
- export const listControllerFindAll = (options) => {
4
- return (options.client ?? _heyApiClient).get({
3
+ export const listControllerFind = (options) => {
4
+ return (options?.client ?? _heyApiClient).get({
5
5
  url: '/lists',
6
6
  ...options
7
7
  });
8
8
  };
9
- export const listControllerCreateOne = (options) => {
9
+ export const listControllerCreate = (options) => {
10
10
  return (options.client ?? _heyApiClient).post({
11
11
  url: '/lists',
12
12
  ...options,
@@ -16,19 +16,19 @@ export const listControllerCreateOne = (options) => {
16
16
  }
17
17
  });
18
18
  };
19
- export const listControllerDeleteOne = (options) => {
19
+ export const listControllerDeleteById = (options) => {
20
20
  return (options.client ?? _heyApiClient).delete({
21
21
  url: '/lists/{listId}',
22
22
  ...options
23
23
  });
24
24
  };
25
- export const listControllerFindOne = (options) => {
25
+ export const listControllerFindById = (options) => {
26
26
  return (options.client ?? _heyApiClient).get({
27
27
  url: '/lists/{listId}',
28
28
  ...options
29
29
  });
30
30
  };
31
- export const listControllerUpdateOne = (options) => {
31
+ export const listControllerUpdateById = (options) => {
32
32
  return (options.client ?? _heyApiClient).patch({
33
33
  url: '/lists/{listId}',
34
34
  ...options,
@@ -49,7 +49,7 @@ export const itemControllerDelete = (options) => {
49
49
  });
50
50
  };
51
51
  export const itemControllerFind = (options) => {
52
- return (options.client ?? _heyApiClient).get({
52
+ return (options?.client ?? _heyApiClient).get({
53
53
  url: '/items',
54
54
  ...options
55
55
  });
@@ -80,7 +80,7 @@ export const itemControllerUpdateById = (options) => {
80
80
  }
81
81
  });
82
82
  };
83
- export const profileControllerIdentify = (options) => {
83
+ export const profileControllerIdentifyProfile = (options) => {
84
84
  return (options.client ?? _heyApiClient).post({
85
85
  url: '/profiles/identify',
86
86
  ...options,
@@ -90,3 +90,13 @@ export const profileControllerIdentify = (options) => {
90
90
  }
91
91
  });
92
92
  };
93
+ export const profileControllerCreateToken = (options) => {
94
+ return (options.client ?? _heyApiClient).post({
95
+ url: '/profiles/token',
96
+ ...options,
97
+ headers: {
98
+ 'Content-Type': 'application/json',
99
+ ...options?.headers
100
+ }
101
+ });
102
+ };
@@ -1,31 +1,3 @@
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
- };
29
1
  export type List = {
30
2
  /**
31
3
  * The ID of the list
@@ -35,10 +7,6 @@ export type List = {
35
7
  * The name of the list
36
8
  */
37
9
  name: string;
38
- /**
39
- * Whether the list is readonly
40
- */
41
- readonly: boolean;
42
10
  /**
43
11
  * The date and time the list was created
44
12
  */
@@ -47,12 +15,8 @@ export type List = {
47
15
  * The date and time the list was updated
48
16
  */
49
17
  updatedAt: string;
50
- /**
51
- * The items in the list
52
- */
53
- items: Array<Item>;
54
18
  };
55
- export type ErrorDto = {
19
+ export type _Error = {
56
20
  /**
57
21
  * The error message
58
22
  */
@@ -70,13 +34,13 @@ export type ErrorDto = {
70
34
  */
71
35
  requestId: string;
72
36
  };
73
- export type ErrorResponseDto = {
37
+ export type ErrorResponse = {
74
38
  /**
75
39
  * Error details
76
40
  */
77
- error: ErrorDto;
41
+ error: _Error;
78
42
  };
79
- export type PageInfoDto = {
43
+ export type PageInfo = {
80
44
  /**
81
45
  * The cursor for the next page
82
46
  */
@@ -90,25 +54,29 @@ export type PageInfoDto = {
90
54
  [key: string]: unknown;
91
55
  } | null;
92
56
  };
93
- export type PaginatedResponseDto = {
94
- pageInfo: PageInfoDto;
57
+ export type PaginatedResponse = {
58
+ pageInfo: PageInfo;
95
59
  };
96
- export type ResponseDto = {
60
+ export type Response = {
97
61
  [key: string]: unknown;
98
62
  };
99
- export type CreateListDto = {
63
+ export type CreateListInput = {
100
64
  /**
101
65
  * The name of the list
102
66
  */
103
67
  name: string;
104
68
  };
105
- export type UpdateListDto = {
69
+ export type UpdateListInput = {
106
70
  /**
107
71
  * The name of the list
108
72
  */
109
73
  name: string;
110
74
  };
111
- export type CreateItemDto = {
75
+ export type Item = {
76
+ /**
77
+ * The ID of the item
78
+ */
79
+ id: string;
112
80
  /**
113
81
  * The Shopify ID of the product
114
82
  */
@@ -116,63 +84,93 @@ export type CreateItemDto = {
116
84
  /**
117
85
  * The Shopify ID of the variant
118
86
  */
119
- variantId: number;
87
+ variantId: {
88
+ [key: string]: unknown;
89
+ } | null;
120
90
  /**
121
- * The quantity of the item
91
+ * The quantity of the item in the list
122
92
  */
123
93
  quantity: number;
94
+ /**
95
+ * The date and time the item was created
96
+ */
97
+ createdAt: string;
98
+ /**
99
+ * The date and time the item was updated
100
+ */
101
+ updatedAt: string;
102
+ };
103
+ export type CreateItemInput = {
104
+ /**
105
+ * The Shopify ID of the product
106
+ */
107
+ productId: number;
108
+ /**
109
+ * The Shopify ID of the variant
110
+ */
111
+ variantId?: number;
112
+ /**
113
+ * The quantity of the item
114
+ */
115
+ quantity?: number;
124
116
  };
125
- export type ItemDto = {
117
+ export type ItemReference = {
126
118
  /**
127
119
  * The ID of the item
128
120
  */
129
121
  id: string;
130
122
  };
131
- export type DeleteItemsDto = {
132
- items: Array<ItemDto>;
123
+ export type DeleteItemsInput = {
124
+ items: Array<ItemReference>;
133
125
  };
134
- export type UpdateItemDto = {
126
+ export type UpdateItemInput = {
135
127
  /**
136
128
  * The Shopify ID of the product
137
129
  */
138
- productId: number;
130
+ productId?: number;
139
131
  /**
140
132
  * The Shopify ID of the variant
141
133
  */
142
- variantId: number;
134
+ variantId?: number;
143
135
  /**
144
136
  * The quantity of the item
145
137
  */
146
- quantity: number;
138
+ quantity?: number;
139
+ };
140
+ export type CreateProfileTokenResponse = {
141
+ /**
142
+ * A Swish API token for the profile
143
+ */
144
+ token: string;
145
+ /**
146
+ * The profile associated with the token
147
+ */
148
+ profile: string;
147
149
  };
148
- export type IdentifyProfileResponseDto = {
150
+ export type IdentifyProfileResponse = {
149
151
  /**
150
152
  * The auth flow to use
151
153
  */
152
154
  authFlow: string;
153
155
  };
154
- export type IdentifyProfileDto = {
156
+ export type IdentifyProfileInput = {
155
157
  /**
156
158
  * The email of the profile to identify
157
159
  */
158
160
  email: string;
159
161
  };
160
- export type ListControllerFindAllData = {
162
+ export type CreateProfileTokenInput = {
163
+ /**
164
+ * A customer GID to create a token for.
165
+ */
166
+ customer?: string;
167
+ /**
168
+ * A session GID to link to the customer.
169
+ */
170
+ session?: string;
171
+ };
172
+ export type ListControllerFindData = {
161
173
  body?: never;
162
- headers: {
163
- /**
164
- * Your Swish API key
165
- */
166
- Authorization: string;
167
- /**
168
- * The shop domain
169
- */
170
- Shop: string;
171
- /**
172
- * The profile key
173
- */
174
- Key: string;
175
- };
176
174
  path?: never;
177
175
  query?: {
178
176
  /**
@@ -182,11 +180,11 @@ export type ListControllerFindAllData = {
182
180
  };
183
181
  url: '/lists';
184
182
  };
185
- export type ListControllerFindAllErrors = {
183
+ export type ListControllerFindErrors = {
186
184
  /**
187
185
  * Bad Request
188
186
  */
189
- 400: ErrorResponseDto & {
187
+ 400: ErrorResponse & {
190
188
  error?: {
191
189
  statusCode?: number;
192
190
  error?: string;
@@ -195,7 +193,7 @@ export type ListControllerFindAllErrors = {
195
193
  /**
196
194
  * Unauthorized
197
195
  */
198
- 401: ErrorResponseDto & {
196
+ 401: ErrorResponse & {
199
197
  error?: {
200
198
  statusCode?: number;
201
199
  error?: string;
@@ -204,7 +202,7 @@ export type ListControllerFindAllErrors = {
204
202
  /**
205
203
  * Forbidden
206
204
  */
207
- 403: ErrorResponseDto & {
205
+ 403: ErrorResponse & {
208
206
  error?: {
209
207
  statusCode?: number;
210
208
  error?: string;
@@ -213,48 +211,34 @@ export type ListControllerFindAllErrors = {
213
211
  /**
214
212
  * Not Found
215
213
  */
216
- 404: ErrorResponseDto & {
214
+ 404: ErrorResponse & {
217
215
  error?: {
218
216
  statusCode?: number;
219
217
  error?: string;
220
218
  };
221
219
  };
222
220
  };
223
- export type ListControllerFindAllError = ListControllerFindAllErrors[keyof ListControllerFindAllErrors];
224
- export type ListControllerFindAllResponses = {
221
+ export type ListControllerFindError = ListControllerFindErrors[keyof ListControllerFindErrors];
222
+ export type ListControllerFindResponses = {
225
223
  /**
226
224
  * Returns all lists as paginated response
227
225
  */
228
- 200: PaginatedResponseDto & {
226
+ 200: PaginatedResponse & {
229
227
  data?: Array<List>;
230
228
  };
231
229
  };
232
- export type ListControllerFindAllResponse = ListControllerFindAllResponses[keyof ListControllerFindAllResponses];
233
- export type ListControllerCreateOneData = {
234
- body: CreateListDto;
235
- headers: {
236
- /**
237
- * Your Swish API key
238
- */
239
- Authorization: string;
240
- /**
241
- * The shop domain
242
- */
243
- Shop: string;
244
- /**
245
- * The profile key
246
- */
247
- Key: string;
248
- };
230
+ export type ListControllerFindResponse = ListControllerFindResponses[keyof ListControllerFindResponses];
231
+ export type ListControllerCreateData = {
232
+ body: CreateListInput;
249
233
  path?: never;
250
234
  query?: never;
251
235
  url: '/lists';
252
236
  };
253
- export type ListControllerCreateOneErrors = {
237
+ export type ListControllerCreateErrors = {
254
238
  /**
255
239
  * Bad Request
256
240
  */
257
- 400: ErrorResponseDto & {
241
+ 400: ErrorResponse & {
258
242
  error?: {
259
243
  statusCode?: number;
260
244
  error?: string;
@@ -263,7 +247,7 @@ export type ListControllerCreateOneErrors = {
263
247
  /**
264
248
  * Unauthorized
265
249
  */
266
- 401: ErrorResponseDto & {
250
+ 401: ErrorResponse & {
267
251
  error?: {
268
252
  statusCode?: number;
269
253
  error?: string;
@@ -272,7 +256,7 @@ export type ListControllerCreateOneErrors = {
272
256
  /**
273
257
  * Forbidden
274
258
  */
275
- 403: ErrorResponseDto & {
259
+ 403: ErrorResponse & {
276
260
  error?: {
277
261
  statusCode?: number;
278
262
  error?: string;
@@ -281,39 +265,25 @@ export type ListControllerCreateOneErrors = {
281
265
  /**
282
266
  * Not Found
283
267
  */
284
- 404: ErrorResponseDto & {
268
+ 404: ErrorResponse & {
285
269
  error?: {
286
270
  statusCode?: number;
287
271
  error?: string;
288
272
  };
289
273
  };
290
274
  };
291
- export type ListControllerCreateOneError = ListControllerCreateOneErrors[keyof ListControllerCreateOneErrors];
292
- export type ListControllerCreateOneResponses = {
275
+ export type ListControllerCreateError = ListControllerCreateErrors[keyof ListControllerCreateErrors];
276
+ export type ListControllerCreateResponses = {
293
277
  /**
294
278
  * The list has been successfully created.
295
279
  */
296
- 201: ResponseDto & {
280
+ 201: Response & {
297
281
  data?: List;
298
282
  };
299
283
  };
300
- export type ListControllerCreateOneResponse = ListControllerCreateOneResponses[keyof ListControllerCreateOneResponses];
301
- export type ListControllerDeleteOneData = {
284
+ export type ListControllerCreateResponse = ListControllerCreateResponses[keyof ListControllerCreateResponses];
285
+ export type ListControllerDeleteByIdData = {
302
286
  body?: never;
303
- headers: {
304
- /**
305
- * Your Swish API key
306
- */
307
- Authorization: string;
308
- /**
309
- * The shop domain
310
- */
311
- Shop: string;
312
- /**
313
- * The profile key
314
- */
315
- Key: string;
316
- };
317
287
  path: {
318
288
  /**
319
289
  * The ID of the list
@@ -323,11 +293,11 @@ export type ListControllerDeleteOneData = {
323
293
  query?: never;
324
294
  url: '/lists/{listId}';
325
295
  };
326
- export type ListControllerDeleteOneErrors = {
296
+ export type ListControllerDeleteByIdErrors = {
327
297
  /**
328
298
  * Bad Request
329
299
  */
330
- 400: ErrorResponseDto & {
300
+ 400: ErrorResponse & {
331
301
  error?: {
332
302
  statusCode?: number;
333
303
  error?: string;
@@ -336,7 +306,7 @@ export type ListControllerDeleteOneErrors = {
336
306
  /**
337
307
  * Unauthorized
338
308
  */
339
- 401: ErrorResponseDto & {
309
+ 401: ErrorResponse & {
340
310
  error?: {
341
311
  statusCode?: number;
342
312
  error?: string;
@@ -345,7 +315,7 @@ export type ListControllerDeleteOneErrors = {
345
315
  /**
346
316
  * Forbidden
347
317
  */
348
- 403: ErrorResponseDto & {
318
+ 403: ErrorResponse & {
349
319
  error?: {
350
320
  statusCode?: number;
351
321
  error?: string;
@@ -354,37 +324,23 @@ export type ListControllerDeleteOneErrors = {
354
324
  /**
355
325
  * Not Found
356
326
  */
357
- 404: ErrorResponseDto & {
327
+ 404: ErrorResponse & {
358
328
  error?: {
359
329
  statusCode?: number;
360
330
  error?: string;
361
331
  };
362
332
  };
363
333
  };
364
- export type ListControllerDeleteOneError = ListControllerDeleteOneErrors[keyof ListControllerDeleteOneErrors];
365
- export type ListControllerDeleteOneResponses = {
334
+ export type ListControllerDeleteByIdError = ListControllerDeleteByIdErrors[keyof ListControllerDeleteByIdErrors];
335
+ export type ListControllerDeleteByIdResponses = {
366
336
  /**
367
337
  * The list has been successfully deleted.
368
338
  */
369
339
  204: void;
370
340
  };
371
- export type ListControllerDeleteOneResponse = ListControllerDeleteOneResponses[keyof ListControllerDeleteOneResponses];
372
- export type ListControllerFindOneData = {
341
+ export type ListControllerDeleteByIdResponse = ListControllerDeleteByIdResponses[keyof ListControllerDeleteByIdResponses];
342
+ export type ListControllerFindByIdData = {
373
343
  body?: never;
374
- headers: {
375
- /**
376
- * Your Swish API key
377
- */
378
- Authorization: string;
379
- /**
380
- * The shop domain
381
- */
382
- Shop: string;
383
- /**
384
- * The profile key
385
- */
386
- Key: string;
387
- };
388
344
  path: {
389
345
  /**
390
346
  * The ID of the list
@@ -394,11 +350,11 @@ export type ListControllerFindOneData = {
394
350
  query?: never;
395
351
  url: '/lists/{listId}';
396
352
  };
397
- export type ListControllerFindOneErrors = {
353
+ export type ListControllerFindByIdErrors = {
398
354
  /**
399
355
  * Bad Request
400
356
  */
401
- 400: ErrorResponseDto & {
357
+ 400: ErrorResponse & {
402
358
  error?: {
403
359
  statusCode?: number;
404
360
  error?: string;
@@ -407,7 +363,7 @@ export type ListControllerFindOneErrors = {
407
363
  /**
408
364
  * Unauthorized
409
365
  */
410
- 401: ErrorResponseDto & {
366
+ 401: ErrorResponse & {
411
367
  error?: {
412
368
  statusCode?: number;
413
369
  error?: string;
@@ -416,7 +372,7 @@ export type ListControllerFindOneErrors = {
416
372
  /**
417
373
  * Forbidden
418
374
  */
419
- 403: ErrorResponseDto & {
375
+ 403: ErrorResponse & {
420
376
  error?: {
421
377
  statusCode?: number;
422
378
  error?: string;
@@ -425,39 +381,25 @@ export type ListControllerFindOneErrors = {
425
381
  /**
426
382
  * Not Found
427
383
  */
428
- 404: ErrorResponseDto & {
384
+ 404: ErrorResponse & {
429
385
  error?: {
430
386
  statusCode?: number;
431
387
  error?: string;
432
388
  };
433
389
  };
434
390
  };
435
- export type ListControllerFindOneError = ListControllerFindOneErrors[keyof ListControllerFindOneErrors];
436
- export type ListControllerFindOneResponses = {
391
+ export type ListControllerFindByIdError = ListControllerFindByIdErrors[keyof ListControllerFindByIdErrors];
392
+ export type ListControllerFindByIdResponses = {
437
393
  /**
438
394
  * The list has been successfully retrieved.
439
395
  */
440
- 200: ResponseDto & {
396
+ 200: Response & {
441
397
  data?: List;
442
398
  };
443
399
  };
444
- export type ListControllerFindOneResponse = ListControllerFindOneResponses[keyof ListControllerFindOneResponses];
445
- export type ListControllerUpdateOneData = {
446
- body: UpdateListDto;
447
- headers: {
448
- /**
449
- * Your Swish API key
450
- */
451
- Authorization: string;
452
- /**
453
- * The shop domain
454
- */
455
- Shop: string;
456
- /**
457
- * The profile key
458
- */
459
- Key: string;
460
- };
400
+ export type ListControllerFindByIdResponse = ListControllerFindByIdResponses[keyof ListControllerFindByIdResponses];
401
+ export type ListControllerUpdateByIdData = {
402
+ body: UpdateListInput;
461
403
  path: {
462
404
  /**
463
405
  * The ID of the list
@@ -467,11 +409,11 @@ export type ListControllerUpdateOneData = {
467
409
  query?: never;
468
410
  url: '/lists/{listId}';
469
411
  };
470
- export type ListControllerUpdateOneErrors = {
412
+ export type ListControllerUpdateByIdErrors = {
471
413
  /**
472
414
  * Bad Request
473
415
  */
474
- 400: ErrorResponseDto & {
416
+ 400: ErrorResponse & {
475
417
  error?: {
476
418
  statusCode?: number;
477
419
  error?: string;
@@ -480,7 +422,7 @@ export type ListControllerUpdateOneErrors = {
480
422
  /**
481
423
  * Unauthorized
482
424
  */
483
- 401: ErrorResponseDto & {
425
+ 401: ErrorResponse & {
484
426
  error?: {
485
427
  statusCode?: number;
486
428
  error?: string;
@@ -489,7 +431,7 @@ export type ListControllerUpdateOneErrors = {
489
431
  /**
490
432
  * Forbidden
491
433
  */
492
- 403: ErrorResponseDto & {
434
+ 403: ErrorResponse & {
493
435
  error?: {
494
436
  statusCode?: number;
495
437
  error?: string;
@@ -498,39 +440,25 @@ export type ListControllerUpdateOneErrors = {
498
440
  /**
499
441
  * Not Found
500
442
  */
501
- 404: ErrorResponseDto & {
443
+ 404: ErrorResponse & {
502
444
  error?: {
503
445
  statusCode?: number;
504
446
  error?: string;
505
447
  };
506
448
  };
507
449
  };
508
- export type ListControllerUpdateOneError = ListControllerUpdateOneErrors[keyof ListControllerUpdateOneErrors];
509
- export type ListControllerUpdateOneResponses = {
450
+ export type ListControllerUpdateByIdError = ListControllerUpdateByIdErrors[keyof ListControllerUpdateByIdErrors];
451
+ export type ListControllerUpdateByIdResponses = {
510
452
  /**
511
453
  * The list has been successfully updated.
512
454
  */
513
- 200: ResponseDto & {
455
+ 200: Response & {
514
456
  data?: List;
515
457
  };
516
458
  };
517
- export type ListControllerUpdateOneResponse = ListControllerUpdateOneResponses[keyof ListControllerUpdateOneResponses];
459
+ export type ListControllerUpdateByIdResponse = ListControllerUpdateByIdResponses[keyof ListControllerUpdateByIdResponses];
518
460
  export type ItemControllerDeleteData = {
519
- body: DeleteItemsDto;
520
- headers: {
521
- /**
522
- * Your Swish API key
523
- */
524
- Authorization: string;
525
- /**
526
- * The shop domain
527
- */
528
- Shop: string;
529
- /**
530
- * The profile key
531
- */
532
- Key: string;
533
- };
461
+ body: DeleteItemsInput;
534
462
  path?: never;
535
463
  query?: never;
536
464
  url: '/items';
@@ -539,7 +467,7 @@ export type ItemControllerDeleteErrors = {
539
467
  /**
540
468
  * Bad Request
541
469
  */
542
- 400: ErrorResponseDto & {
470
+ 400: ErrorResponse & {
543
471
  error?: {
544
472
  statusCode?: number;
545
473
  error?: string;
@@ -548,7 +476,7 @@ export type ItemControllerDeleteErrors = {
548
476
  /**
549
477
  * Unauthorized
550
478
  */
551
- 401: ErrorResponseDto & {
479
+ 401: ErrorResponse & {
552
480
  error?: {
553
481
  statusCode?: number;
554
482
  error?: string;
@@ -557,7 +485,7 @@ export type ItemControllerDeleteErrors = {
557
485
  /**
558
486
  * Forbidden
559
487
  */
560
- 403: ErrorResponseDto & {
488
+ 403: ErrorResponse & {
561
489
  error?: {
562
490
  statusCode?: number;
563
491
  error?: string;
@@ -566,7 +494,7 @@ export type ItemControllerDeleteErrors = {
566
494
  /**
567
495
  * Not Found
568
496
  */
569
- 404: ErrorResponseDto & {
497
+ 404: ErrorResponse & {
570
498
  error?: {
571
499
  statusCode?: number;
572
500
  error?: string;
@@ -583,20 +511,6 @@ export type ItemControllerDeleteResponses = {
583
511
  export type ItemControllerDeleteResponse = ItemControllerDeleteResponses[keyof ItemControllerDeleteResponses];
584
512
  export type ItemControllerFindData = {
585
513
  body?: never;
586
- headers: {
587
- /**
588
- * Your Swish API key
589
- */
590
- Authorization: string;
591
- /**
592
- * The shop domain
593
- */
594
- Shop: string;
595
- /**
596
- * The profile key
597
- */
598
- Key: string;
599
- };
600
514
  path?: never;
601
515
  query?: {
602
516
  /**
@@ -610,7 +524,7 @@ export type ItemControllerFindErrors = {
610
524
  /**
611
525
  * Bad Request
612
526
  */
613
- 400: ErrorResponseDto & {
527
+ 400: ErrorResponse & {
614
528
  error?: {
615
529
  statusCode?: number;
616
530
  error?: string;
@@ -619,7 +533,7 @@ export type ItemControllerFindErrors = {
619
533
  /**
620
534
  * Unauthorized
621
535
  */
622
- 401: ErrorResponseDto & {
536
+ 401: ErrorResponse & {
623
537
  error?: {
624
538
  statusCode?: number;
625
539
  error?: string;
@@ -628,7 +542,7 @@ export type ItemControllerFindErrors = {
628
542
  /**
629
543
  * Forbidden
630
544
  */
631
- 403: ErrorResponseDto & {
545
+ 403: ErrorResponse & {
632
546
  error?: {
633
547
  statusCode?: number;
634
548
  error?: string;
@@ -637,7 +551,7 @@ export type ItemControllerFindErrors = {
637
551
  /**
638
552
  * Not Found
639
553
  */
640
- 404: ErrorResponseDto & {
554
+ 404: ErrorResponse & {
641
555
  error?: {
642
556
  statusCode?: number;
643
557
  error?: string;
@@ -649,27 +563,13 @@ export type ItemControllerFindResponses = {
649
563
  /**
650
564
  * Returns all items as paginated response
651
565
  */
652
- 200: PaginatedResponseDto & {
566
+ 200: PaginatedResponse & {
653
567
  data?: Array<Item>;
654
568
  };
655
569
  };
656
570
  export type ItemControllerFindResponse = ItemControllerFindResponses[keyof ItemControllerFindResponses];
657
571
  export type ItemControllerCreateData = {
658
- body: CreateItemDto;
659
- headers: {
660
- /**
661
- * Your Swish API key
662
- */
663
- Authorization: string;
664
- /**
665
- * The shop domain
666
- */
667
- Shop: string;
668
- /**
669
- * The profile key
670
- */
671
- Key: string;
672
- };
572
+ body: CreateItemInput;
673
573
  path?: never;
674
574
  query?: never;
675
575
  url: '/items';
@@ -678,7 +578,7 @@ export type ItemControllerCreateErrors = {
678
578
  /**
679
579
  * Bad Request
680
580
  */
681
- 400: ErrorResponseDto & {
581
+ 400: ErrorResponse & {
682
582
  error?: {
683
583
  statusCode?: number;
684
584
  error?: string;
@@ -687,7 +587,7 @@ export type ItemControllerCreateErrors = {
687
587
  /**
688
588
  * Unauthorized
689
589
  */
690
- 401: ErrorResponseDto & {
590
+ 401: ErrorResponse & {
691
591
  error?: {
692
592
  statusCode?: number;
693
593
  error?: string;
@@ -696,7 +596,7 @@ export type ItemControllerCreateErrors = {
696
596
  /**
697
597
  * Forbidden
698
598
  */
699
- 403: ErrorResponseDto & {
599
+ 403: ErrorResponse & {
700
600
  error?: {
701
601
  statusCode?: number;
702
602
  error?: string;
@@ -705,7 +605,7 @@ export type ItemControllerCreateErrors = {
705
605
  /**
706
606
  * Not Found
707
607
  */
708
- 404: ErrorResponseDto & {
608
+ 404: ErrorResponse & {
709
609
  error?: {
710
610
  statusCode?: number;
711
611
  error?: string;
@@ -717,27 +617,13 @@ export type ItemControllerCreateResponses = {
717
617
  /**
718
618
  * The item has been successfully created.
719
619
  */
720
- 201: ResponseDto & {
620
+ 201: Response & {
721
621
  data?: Item;
722
622
  };
723
623
  };
724
624
  export type ItemControllerCreateResponse = ItemControllerCreateResponses[keyof ItemControllerCreateResponses];
725
625
  export type ItemControllerDeleteByIdData = {
726
626
  body?: never;
727
- headers: {
728
- /**
729
- * Your Swish API key
730
- */
731
- Authorization: string;
732
- /**
733
- * The shop domain
734
- */
735
- Shop: string;
736
- /**
737
- * The profile key
738
- */
739
- Key: string;
740
- };
741
627
  path: {
742
628
  /**
743
629
  * The ID of the item
@@ -751,7 +637,7 @@ export type ItemControllerDeleteByIdErrors = {
751
637
  /**
752
638
  * Bad Request
753
639
  */
754
- 400: ErrorResponseDto & {
640
+ 400: ErrorResponse & {
755
641
  error?: {
756
642
  statusCode?: number;
757
643
  error?: string;
@@ -760,7 +646,7 @@ export type ItemControllerDeleteByIdErrors = {
760
646
  /**
761
647
  * Unauthorized
762
648
  */
763
- 401: ErrorResponseDto & {
649
+ 401: ErrorResponse & {
764
650
  error?: {
765
651
  statusCode?: number;
766
652
  error?: string;
@@ -769,7 +655,7 @@ export type ItemControllerDeleteByIdErrors = {
769
655
  /**
770
656
  * Forbidden
771
657
  */
772
- 403: ErrorResponseDto & {
658
+ 403: ErrorResponse & {
773
659
  error?: {
774
660
  statusCode?: number;
775
661
  error?: string;
@@ -778,7 +664,7 @@ export type ItemControllerDeleteByIdErrors = {
778
664
  /**
779
665
  * Not Found
780
666
  */
781
- 404: ErrorResponseDto & {
667
+ 404: ErrorResponse & {
782
668
  error?: {
783
669
  statusCode?: number;
784
670
  error?: string;
@@ -794,21 +680,7 @@ export type ItemControllerDeleteByIdResponses = {
794
680
  };
795
681
  export type ItemControllerDeleteByIdResponse = ItemControllerDeleteByIdResponses[keyof ItemControllerDeleteByIdResponses];
796
682
  export type ItemControllerUpdateByIdData = {
797
- body: UpdateItemDto;
798
- headers: {
799
- /**
800
- * Your Swish API key
801
- */
802
- Authorization: string;
803
- /**
804
- * The shop domain
805
- */
806
- Shop: string;
807
- /**
808
- * The profile key
809
- */
810
- Key: string;
811
- };
683
+ body: UpdateItemInput;
812
684
  path: {
813
685
  /**
814
686
  * The ID of the item
@@ -822,7 +694,7 @@ export type ItemControllerUpdateByIdErrors = {
822
694
  /**
823
695
  * Bad Request
824
696
  */
825
- 400: ErrorResponseDto & {
697
+ 400: ErrorResponse & {
826
698
  error?: {
827
699
  statusCode?: number;
828
700
  error?: string;
@@ -831,7 +703,7 @@ export type ItemControllerUpdateByIdErrors = {
831
703
  /**
832
704
  * Unauthorized
833
705
  */
834
- 401: ErrorResponseDto & {
706
+ 401: ErrorResponse & {
835
707
  error?: {
836
708
  statusCode?: number;
837
709
  error?: string;
@@ -840,7 +712,7 @@ export type ItemControllerUpdateByIdErrors = {
840
712
  /**
841
713
  * Forbidden
842
714
  */
843
- 403: ErrorResponseDto & {
715
+ 403: ErrorResponse & {
844
716
  error?: {
845
717
  statusCode?: number;
846
718
  error?: string;
@@ -849,7 +721,7 @@ export type ItemControllerUpdateByIdErrors = {
849
721
  /**
850
722
  * Not Found
851
723
  */
852
- 404: ErrorResponseDto & {
724
+ 404: ErrorResponse & {
853
725
  error?: {
854
726
  statusCode?: number;
855
727
  error?: string;
@@ -861,36 +733,76 @@ export type ItemControllerUpdateByIdResponses = {
861
733
  /**
862
734
  * The item has been successfully updated.
863
735
  */
864
- 200: ResponseDto & {
736
+ 200: Response & {
865
737
  data?: Item;
866
738
  };
867
739
  };
868
740
  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
- };
741
+ export type ProfileControllerIdentifyProfileData = {
742
+ body: IdentifyProfileInput;
885
743
  path?: never;
886
744
  query?: never;
887
745
  url: '/profiles/identify';
888
746
  };
889
- export type ProfileControllerIdentifyErrors = {
747
+ export type ProfileControllerIdentifyProfileErrors = {
748
+ /**
749
+ * Bad Request
750
+ */
751
+ 400: ErrorResponse & {
752
+ error?: {
753
+ statusCode?: number;
754
+ error?: string;
755
+ };
756
+ };
757
+ /**
758
+ * Unauthorized
759
+ */
760
+ 401: ErrorResponse & {
761
+ error?: {
762
+ statusCode?: number;
763
+ error?: string;
764
+ };
765
+ };
766
+ /**
767
+ * Forbidden
768
+ */
769
+ 403: ErrorResponse & {
770
+ error?: {
771
+ statusCode?: number;
772
+ error?: string;
773
+ };
774
+ };
775
+ /**
776
+ * Not Found
777
+ */
778
+ 404: ErrorResponse & {
779
+ error?: {
780
+ statusCode?: number;
781
+ error?: string;
782
+ };
783
+ };
784
+ };
785
+ export type ProfileControllerIdentifyProfileError = ProfileControllerIdentifyProfileErrors[keyof ProfileControllerIdentifyProfileErrors];
786
+ export type ProfileControllerIdentifyProfileResponses = {
787
+ /**
788
+ * The profile has been identified
789
+ */
790
+ 200: Response & {
791
+ data?: IdentifyProfileResponse;
792
+ };
793
+ };
794
+ export type ProfileControllerIdentifyProfileResponse = ProfileControllerIdentifyProfileResponses[keyof ProfileControllerIdentifyProfileResponses];
795
+ export type ProfileControllerCreateTokenData = {
796
+ body: CreateProfileTokenInput;
797
+ path?: never;
798
+ query?: never;
799
+ url: '/profiles/token';
800
+ };
801
+ export type ProfileControllerCreateTokenErrors = {
890
802
  /**
891
803
  * Bad Request
892
804
  */
893
- 400: ErrorResponseDto & {
805
+ 400: ErrorResponse & {
894
806
  error?: {
895
807
  statusCode?: number;
896
808
  error?: string;
@@ -899,7 +811,7 @@ export type ProfileControllerIdentifyErrors = {
899
811
  /**
900
812
  * Unauthorized
901
813
  */
902
- 401: ErrorResponseDto & {
814
+ 401: ErrorResponse & {
903
815
  error?: {
904
816
  statusCode?: number;
905
817
  error?: string;
@@ -908,7 +820,7 @@ export type ProfileControllerIdentifyErrors = {
908
820
  /**
909
821
  * Forbidden
910
822
  */
911
- 403: ErrorResponseDto & {
823
+ 403: ErrorResponse & {
912
824
  error?: {
913
825
  statusCode?: number;
914
826
  error?: string;
@@ -917,23 +829,23 @@ export type ProfileControllerIdentifyErrors = {
917
829
  /**
918
830
  * Not Found
919
831
  */
920
- 404: ErrorResponseDto & {
832
+ 404: ErrorResponse & {
921
833
  error?: {
922
834
  statusCode?: number;
923
835
  error?: string;
924
836
  };
925
837
  };
926
838
  };
927
- export type ProfileControllerIdentifyError = ProfileControllerIdentifyErrors[keyof ProfileControllerIdentifyErrors];
928
- export type ProfileControllerIdentifyResponses = {
839
+ export type ProfileControllerCreateTokenError = ProfileControllerCreateTokenErrors[keyof ProfileControllerCreateTokenErrors];
840
+ export type ProfileControllerCreateTokenResponses = {
929
841
  /**
930
- * Identifies the user profile by email
842
+ * The token has been created
931
843
  */
932
- 200: ResponseDto & {
933
- data?: IdentifyProfileResponseDto;
844
+ 201: Response & {
845
+ data?: CreateProfileTokenResponse;
934
846
  };
935
847
  };
936
- export type ProfileControllerIdentifyResponse = ProfileControllerIdentifyResponses[keyof ProfileControllerIdentifyResponses];
848
+ export type ProfileControllerCreateTokenResponse = ProfileControllerCreateTokenResponses[keyof ProfileControllerCreateTokenResponses];
937
849
  export type ClientOptions = {
938
850
  baseUrl: 'https://swish.app/api/unstable' | (string & {});
939
851
  };
package/dist/index.d.ts CHANGED
@@ -1,42 +1,47 @@
1
- import { CreateItemDto, CreateListDto, DeleteItemsDto, ItemControllerFindData, ListControllerFindAllData, UpdateItemDto, UpdateListDto } from "./client/types.gen";
1
+ import { CreateItemInput, CreateListInput, DeleteItemsInput, ItemControllerFindData, ListControllerFindData, UpdateItemInput, UpdateListInput, CreateProfileTokenInput, IdentifyProfileInput } from "./client/types.gen";
2
2
  export interface SwishClientOptions {
3
3
  authToken: string;
4
- shop: string;
5
- key: string;
4
+ profile?: string;
6
5
  }
7
6
  export declare class SwishClient {
8
- private readonly authToken;
9
- private readonly shop;
10
- private readonly key;
7
+ private readonly options;
11
8
  constructor(options: SwishClientOptions);
12
9
  readonly items: {
13
- list: (query?: ItemControllerFindData["query"]) => Promise<(import("./client").PaginatedResponseDto & {
10
+ list: (query?: ItemControllerFindData["query"]) => Promise<(import("./client").PaginatedResponse & {
14
11
  data?: Array<import("./client").Item>;
15
12
  }) | undefined>;
16
- create: (items: CreateItemDto) => Promise<(import("./client").ResponseDto & {
13
+ create: (items: CreateItemInput) => Promise<(import("./client").Response & {
17
14
  data?: import("./client").Item;
18
15
  }) | undefined>;
19
- delete: (items: DeleteItemsDto["items"]) => Promise<void | undefined>;
16
+ delete: (items: DeleteItemsInput["items"]) => Promise<void | undefined>;
20
17
  deleteById: (itemId: string) => Promise<void | undefined>;
21
- updateById: (itemId: string, body: UpdateItemDto) => Promise<(import("./client").ResponseDto & {
18
+ updateById: (itemId: string, body: UpdateItemInput) => Promise<(import("./client").Response & {
22
19
  data?: import("./client").Item;
23
20
  }) | undefined>;
24
21
  };
25
22
  readonly lists: {
26
- list: (query?: ListControllerFindAllData["query"]) => Promise<(import("./client").PaginatedResponseDto & {
23
+ list: (query?: ListControllerFindData["query"]) => Promise<(import("./client").PaginatedResponse & {
27
24
  data?: Array<import("./client").List>;
28
25
  }) | undefined>;
29
- getById: (listId: string) => Promise<(import("./client").ResponseDto & {
26
+ findById: (listId: string) => Promise<(import("./client").Response & {
30
27
  data?: import("./client").List;
31
28
  }) | undefined>;
32
- create: (list: CreateListDto) => Promise<(import("./client").ResponseDto & {
29
+ create: (list: CreateListInput) => Promise<(import("./client").Response & {
33
30
  data?: import("./client").List;
34
31
  }) | undefined>;
35
32
  deleteById: (listId: string) => Promise<void | undefined>;
36
- updateById: (listId: string, body: UpdateListDto) => Promise<(import("./client").ResponseDto & {
33
+ updateById: (listId: string, body: UpdateListInput) => Promise<(import("./client").Response & {
37
34
  data?: import("./client").List;
38
35
  }) | undefined>;
39
36
  };
37
+ readonly profile: {
38
+ createToken: (body: CreateProfileTokenInput) => Promise<(import("./client").Response & {
39
+ data?: import("./client").CreateProfileTokenResponse;
40
+ }) | undefined>;
41
+ identifyProfile: (body: IdentifyProfileInput) => Promise<(import("./client").Response & {
42
+ data?: import("./client").IdentifyProfileResponse;
43
+ }) | undefined>;
44
+ };
40
45
  private readonly addHeaders;
41
46
  private readonly handleRequest;
42
47
  }
package/dist/index.js CHANGED
@@ -1,4 +1,4 @@
1
- import { itemControllerFind, itemControllerCreate, itemControllerDelete, listControllerFindAll, listControllerCreateOne, listControllerDeleteOne, listControllerFindOne, listControllerUpdateOne, itemControllerDeleteById, itemControllerUpdateById, } from "./client/sdk.gen";
1
+ import { itemControllerFind, itemControllerCreate, itemControllerDelete, itemControllerDeleteById, itemControllerUpdateById, listControllerFind, listControllerCreate, listControllerDeleteById, listControllerUpdateById, listControllerFindById, profileControllerCreateToken, profileControllerIdentifyProfile, } from "./client/sdk.gen";
2
2
  export class SwishClient {
3
3
  constructor(options) {
4
4
  this.items = {
@@ -12,17 +12,20 @@ export class SwishClient {
12
12
  }))),
13
13
  };
14
14
  this.lists = {
15
- list: (query) => this.handleRequest(listControllerFindAll(this.addHeaders({ query }))),
16
- getById: (listId) => this.handleRequest(listControllerFindOne(this.addHeaders({ path: { listId } }))),
17
- create: (list) => this.handleRequest(listControllerCreateOne(this.addHeaders({ body: list }))),
18
- deleteById: (listId) => this.handleRequest(listControllerDeleteOne(this.addHeaders({ path: { listId } }))),
19
- updateById: (listId, body) => this.handleRequest(listControllerUpdateOne(this.addHeaders({ body, path: { listId } }))),
15
+ list: (query) => this.handleRequest(listControllerFind(this.addHeaders({ query }))),
16
+ findById: (listId) => this.handleRequest(listControllerFindById(this.addHeaders({ path: { listId } }))),
17
+ create: (list) => this.handleRequest(listControllerCreate(this.addHeaders({ body: list }))),
18
+ deleteById: (listId) => this.handleRequest(listControllerDeleteById(this.addHeaders({ path: { listId } }))),
19
+ updateById: (listId, body) => this.handleRequest(listControllerUpdateById(this.addHeaders({ body, path: { listId } }))),
20
+ };
21
+ this.profile = {
22
+ createToken: (body) => this.handleRequest(profileControllerCreateToken(this.addHeaders({ body }))),
23
+ identifyProfile: (body) => this.handleRequest(profileControllerIdentifyProfile(this.addHeaders({ body }))),
20
24
  };
21
25
  this.addHeaders = (options) => ({
22
26
  headers: {
23
- Authorization: this.authToken,
24
- Shop: this.shop,
25
- Key: this.key,
27
+ Authorization: `Bearer ${this.options.authToken}`,
28
+ ...(this.options.profile && { Profile: this.options.profile }),
26
29
  },
27
30
  ...options,
28
31
  });
@@ -35,8 +38,6 @@ export class SwishClient {
35
38
  }
36
39
  return data;
37
40
  };
38
- this.authToken = options.authToken;
39
- this.shop = options.shop;
40
- this.key = options.key;
41
+ this.options = options;
41
42
  }
42
43
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@swishapp/api-client",
3
- "version": "0.3.0",
3
+ "version": "0.4.0",
4
4
  "description": "API client for the Swish API",
5
5
  "website": "https://swish.app",
6
6
  "type": "module",