@chift/chift-nodejs 1.0.10 → 1.0.13

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.
@@ -0,0 +1,6 @@
1
+ "use strict";
2
+ /**
3
+ * This file was auto-generated by openapi-typescript.
4
+ * Do not make direct changes to the file.
5
+ */
6
+ Object.defineProperty(exports, "__esModule", { value: true });
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@chift/chift-nodejs",
3
- "version": "1.0.10",
3
+ "version": "1.0.13",
4
4
  "description": "The Chift NodeJS library provides convenient access to the Chift API from applications written in the NodeJS language (Javascript/Typescript).",
5
5
  "main": "dist/src/index.js",
6
6
  "types": "dist/src/index.d.ts",
@@ -1,44 +1,77 @@
1
1
  import { operations, components } from '../types/public-api/schema';
2
- import { RequestData } from '../types/api';
2
+ import { AutoPaginatedParams, RequestData } from '../types/api';
3
3
 
4
- type getChartOfAccountsParams = Omit<
5
- operations['accounting_get_chart_of_accounts']['parameters']['query'],
6
- 'page' | 'size'
4
+ type GetChartOfAccountsParams = AutoPaginatedParams<
5
+ operations['accounting_get_chart_of_accounts']['parameters']['query']
7
6
  >;
8
7
 
9
- type getMiscOperationsParams = Omit<
10
- operations['accounting_get_miscellaneous_operations']['parameters']['query'],
11
- 'page' | 'size'
8
+ type GetMiscOperationsParams = AutoPaginatedParams<
9
+ operations['accounting_get_miscellaneous_operations']['parameters']['query']
12
10
  >;
13
11
 
14
- type getJournalEntriesWithMultiplePlansParams = Omit<
15
- operations['accounting_get_journal_entries_mutli_plan']['parameters']['query'],
16
- 'page' | 'size'
12
+ type GetInvoicesByTypeWithMultiplePlansParams = AutoPaginatedParams<
13
+ operations['accounting_get_invoices_by_type_multi_analytic_plans']['parameters']['query']
17
14
  >;
18
15
 
19
- type getJournalEntriesParams = Omit<
20
- operations['accounting_get_journal_entries']['parameters']['query'],
21
- 'page' | 'size'
16
+ type GetInvoicesByTypeParams = AutoPaginatedParams<
17
+ operations['accounting_get_invoices_by_type']['parameters']['query']
22
18
  >;
23
19
 
24
- type getInvoicesByTypeWithMultiplePlansParams = Omit<
25
- operations['accounting_get_invoices_by_type_multi_analytic_plans']['parameters']['query'],
26
- 'page' | 'size'
20
+ type GetOutstandingsParams = AutoPaginatedParams<
21
+ operations['accounting_get_outstandings']['parameters']['query']
27
22
  >;
28
23
 
29
- type getInvoicesByTypeParams = Omit<
30
- operations['accounting_get_invoices_by_type']['parameters']['query'],
31
- 'page' | 'size'
24
+ type GetAnalyticPlansParams = AutoPaginatedParams<
25
+ operations['accounting_get_analytic_plans']['parameters']['query']
32
26
  >;
33
27
 
34
- type getOutstandingsParams = Omit<
35
- operations['accounting_get_outstandings']['parameters']['query'],
36
- 'page' | 'size'
28
+ type GetVatCodesParams = AutoPaginatedParams<
29
+ operations['accounting_get_vat_codes']['parameters']['query']
30
+ >;
31
+
32
+ type GetJournalsParams = AutoPaginatedParams<
33
+ operations['accounting_get_journals']['parameters']['query']
34
+ >;
35
+
36
+ type GetJournalEntriesParams = AutoPaginatedParams<
37
+ operations['accounting_get_journal_entries']['parameters']['query']
38
+ >;
39
+
40
+ type GetJournalEntriesWithMultiplePlansParams = AutoPaginatedParams<
41
+ operations['accounting_get_journal_entries_mutli_plan']['parameters']['query']
42
+ >;
43
+
44
+ type GetEmployeesParams = AutoPaginatedParams<
45
+ operations['accounting_get_employees']['parameters']['query']
46
+ >;
47
+
48
+ type GetAttachmentsParams = AutoPaginatedParams<
49
+ operations['accounting_get_attachments']['parameters']['query']
50
+ >;
51
+
52
+ type GetBalanceOfAccountsParams = AutoPaginatedParams<
53
+ operations['accounting_get_accounts_balances']['parameters']['query']
54
+ >;
55
+
56
+ type GetClientsParams = AutoPaginatedParams<
57
+ operations['accounting_get_clients']['parameters']['query']
58
+ >;
59
+
60
+ type GetSuppliersParams = AutoPaginatedParams<
61
+ operations['accounting_get_suppliers']['parameters']['query']
62
+ >;
63
+
64
+ type GetAnalyticAccountsParams = AutoPaginatedParams<
65
+ operations['accounting_get_analytic_accounts']['parameters']['query']
66
+ >;
67
+
68
+ type GetAnalyticAccountsWithMultiplePlansParams = AutoPaginatedParams<
69
+ operations['accounting_get_analytic_accounts_multi_plans']['parameters']['query']
37
70
  >;
38
71
 
39
72
  const accountingFactory = {
40
73
  getAnalyticPlans(
41
- params: operations['accounting_get_analytic_plans']['parameters']['query']
74
+ params?: GetAnalyticPlansParams
42
75
  ): RequestData<components['schemas']['AnalyticPlanItem'][]> {
43
76
  return {
44
77
  params,
@@ -46,9 +79,7 @@ const accountingFactory = {
46
79
  url: '/consumers/{consumer_id}/accounting/analytic-plans',
47
80
  };
48
81
  },
49
- getClients(
50
- params: operations['accounting_get_clients']['parameters']['query']
51
- ): RequestData<components['schemas']['ClientItemOut'][]> {
82
+ getClients(params?: GetClientsParams): RequestData<components['schemas']['ClientItemOut'][]> {
52
83
  return {
53
84
  params,
54
85
  method: 'get',
@@ -57,7 +88,7 @@ const accountingFactory = {
57
88
  },
58
89
  createClient(
59
90
  client: components['schemas']['ClientItemIn'],
60
- params: operations['accounting_create_client']['parameters']['query']
91
+ params?: operations['accounting_create_client']['parameters']['query']
61
92
  ): RequestData<components['schemas']['ClientItemOut']> {
62
93
  return {
63
94
  params,
@@ -68,7 +99,7 @@ const accountingFactory = {
68
99
  },
69
100
  getClient(
70
101
  clientId: string,
71
- params: operations['accounting_get_client']['parameters']['query']
102
+ params?: operations['accounting_get_client']['parameters']['query']
72
103
  ): RequestData<components['schemas']['ClientItemOut']> {
73
104
  return {
74
105
  params,
@@ -79,7 +110,7 @@ const accountingFactory = {
79
110
  updateClient(
80
111
  clientId: string,
81
112
  client: components['schemas']['ClientItemUpdate'],
82
- params: operations['accounting_update_client']['parameters']['query']
113
+ params?: operations['accounting_update_client']['parameters']['query']
83
114
  ): RequestData<components['schemas']['ClientItemOut']> {
84
115
  return {
85
116
  params,
@@ -89,7 +120,7 @@ const accountingFactory = {
89
120
  };
90
121
  },
91
122
  getSuppliers(
92
- params: operations['accounting_get_suppliers']['parameters']['query']
123
+ params?: GetSuppliersParams
93
124
  ): RequestData<components['schemas']['SupplierItemOut'][]> {
94
125
  return {
95
126
  params,
@@ -99,7 +130,7 @@ const accountingFactory = {
99
130
  },
100
131
  createSupplier(
101
132
  supplier: components['schemas']['SupplierItemIn'],
102
- params: operations['accounting_create_supplier']['parameters']['query']
133
+ params?: operations['accounting_create_supplier']['parameters']['query']
103
134
  ): RequestData<components['schemas']['SupplierItemOut']> {
104
135
  return {
105
136
  params,
@@ -110,7 +141,7 @@ const accountingFactory = {
110
141
  },
111
142
  getSupplier(
112
143
  supplierId: string,
113
- params: operations['accounting_get_supplier']['parameters']['query']
144
+ params?: operations['accounting_get_supplier']['parameters']['query']
114
145
  ): RequestData<components['schemas']['SupplierItemOut']> {
115
146
  return {
116
147
  params,
@@ -121,7 +152,7 @@ const accountingFactory = {
121
152
  updateSupplier(
122
153
  supplierId: string,
123
154
  supplier: components['schemas']['SupplierItemUpdate'],
124
- params: operations['accounting_update_supplier']['parameters']['query']
155
+ params?: operations['accounting_update_supplier']['parameters']['query']
125
156
  ): RequestData<components['schemas']['SupplierItemOut']> {
126
157
  return {
127
158
  params,
@@ -132,7 +163,7 @@ const accountingFactory = {
132
163
  },
133
164
  createInvoice(
134
165
  invoice: components['schemas']['InvoiceItemInMonoAnalyticPlan'],
135
- params: operations['accounting_create_invoice']['parameters']['query']
166
+ params?: operations['accounting_create_invoice']['parameters']['query']
136
167
  ): RequestData<components['schemas']['InvoiceItemOutMonoAnalyticPlan']> {
137
168
  return {
138
169
  params,
@@ -143,7 +174,7 @@ const accountingFactory = {
143
174
  },
144
175
  createInvoiceWithMultiplePlans(
145
176
  invoice: components['schemas']['InvoiceItemInMultiAnalyticPlans'],
146
- params: operations['accounting_create_invoice_multiple_plans']['parameters']['query']
177
+ params?: operations['accounting_create_invoice_multiple_plans']['parameters']['query']
147
178
  ): RequestData<components['schemas']['InvoiceItemOutMultiAnalyticPlans']> {
148
179
  return {
149
180
  params,
@@ -154,7 +185,7 @@ const accountingFactory = {
154
185
  },
155
186
  getInvoicesByType(
156
187
  invoice_type: components['schemas']['app__routers__accounting__InvoiceType'],
157
- params: getInvoicesByTypeParams
188
+ params?: GetInvoicesByTypeParams
158
189
  ): RequestData<components['schemas']['InvoiceItemOutMonoAnalyticPlan'][]> {
159
190
  return {
160
191
  params,
@@ -164,7 +195,7 @@ const accountingFactory = {
164
195
  },
165
196
  getInvoice(
166
197
  invoiceId: string,
167
- params: operations['accounting_get_invoice']['parameters']['query']
198
+ params?: operations['accounting_get_invoice']['parameters']['query']
168
199
  ): RequestData<components['schemas']['InvoiceItemOutMonoAnalyticPlan']> {
169
200
  return {
170
201
  params,
@@ -174,7 +205,7 @@ const accountingFactory = {
174
205
  },
175
206
  getInvoiceWithMultiplePlans(
176
207
  invoiceId: string,
177
- params: operations['accounting_get_invoice_multi_analytic_plans']['parameters']['query']
208
+ params?: operations['accounting_get_invoice_multi_analytic_plans']['parameters']['query']
178
209
  ): RequestData<components['schemas']['InvoiceItemOutMultiAnalyticPlans']> {
179
210
  return {
180
211
  params,
@@ -184,7 +215,7 @@ const accountingFactory = {
184
215
  },
185
216
  getInvoicesByTypeWithMultiplePlans(
186
217
  invoice_type: components['schemas']['app__routers__accounting__InvoiceType'],
187
- params: getInvoicesByTypeWithMultiplePlansParams
218
+ params?: GetInvoicesByTypeWithMultiplePlansParams
188
219
  ): RequestData<components['schemas']['InvoiceItemOutMultiAnalyticPlans'][]> {
189
220
  return {
190
221
  params,
@@ -194,7 +225,7 @@ const accountingFactory = {
194
225
  },
195
226
  createAnalyticAccount(
196
227
  analyticAccount: components['schemas']['AnalyticAccountItemIn'],
197
- params: operations['accounting_create_analytic_account']['parameters']['query']
228
+ params?: operations['accounting_create_analytic_account']['parameters']['query']
198
229
  ): RequestData<components['schemas']['AnalyticAccountItemOut']> {
199
230
  return {
200
231
  params,
@@ -204,7 +235,7 @@ const accountingFactory = {
204
235
  };
205
236
  },
206
237
  getAnalyticAccounts(
207
- params: operations['accounting_get_analytic_accounts']['parameters']['query']
238
+ params?: GetAnalyticAccountsParams
208
239
  ): RequestData<components['schemas']['AnalyticAccountItemOut'][]> {
209
240
  return {
210
241
  params,
@@ -215,7 +246,7 @@ const accountingFactory = {
215
246
  createAnalyticAccountWithMultiplePlans(
216
247
  analytic_plan: string,
217
248
  analyticAccount: components['schemas']['AnalyticAccountItemIn'],
218
- params: operations['accounting_create_analytic_account_multi_plans']['parameters']['query']
249
+ params?: operations['accounting_create_analytic_account_multi_plans']['parameters']['query']
219
250
  ): RequestData<components['schemas']['AnalyticAccountItemOutMultiAnalyticPlans']> {
220
251
  return {
221
252
  params,
@@ -226,7 +257,7 @@ const accountingFactory = {
226
257
  },
227
258
  getAnalyticAccount(
228
259
  analytic_account_id: string,
229
- params: operations['accounting_get_analytic_account']['parameters']['query']
260
+ params?: operations['accounting_get_analytic_account']['parameters']['query']
230
261
  ): RequestData<components['schemas']['AnalyticAccountItemOut']> {
231
262
  return {
232
263
  params,
@@ -237,7 +268,7 @@ const accountingFactory = {
237
268
  updateAnalyticAccount(
238
269
  analytic_account_id: string,
239
270
  analyticAccount: components['schemas']['AnalyticAccountItemUpdate'],
240
- params: operations['accounting_update_analytic_account']['parameters']['query']
271
+ params?: operations['accounting_update_analytic_account']['parameters']['query']
241
272
  ): RequestData<components['schemas']['AnalyticAccountItemOut']> {
242
273
  return {
243
274
  params,
@@ -249,7 +280,7 @@ const accountingFactory = {
249
280
  getAnalyticAccountWithMultiplePlans(
250
281
  analytic_account_id: string,
251
282
  analytic_plan: string,
252
- params: operations['accounting_get_analytic_account_multi_plans']['parameters']['query']
283
+ params?: operations['accounting_get_analytic_account_multi_plans']['parameters']['query']
253
284
  ): RequestData<components['schemas']['AnalyticAccountItemOutMultiAnalyticPlans']> {
254
285
  return {
255
286
  params,
@@ -261,7 +292,7 @@ const accountingFactory = {
261
292
  analytic_account_id: string,
262
293
  analytic_plan: string,
263
294
  analyticAccount: components['schemas']['AnalyticAccountItemUpdate'],
264
- params: operations['accounting_update_analytic_account_multi_plans']['parameters']['query']
295
+ params?: operations['accounting_update_analytic_account_multi_plans']['parameters']['query']
265
296
  ): RequestData<components['schemas']['AnalyticAccountItemOutMultiAnalyticPlans']> {
266
297
  return {
267
298
  params,
@@ -271,7 +302,7 @@ const accountingFactory = {
271
302
  };
272
303
  },
273
304
  getAnalyticAccountsWithMultiplePlans(
274
- params: operations['accounting_get_analytic_accounts_multi_plans']['parameters']['query']
305
+ params?: GetAnalyticAccountsWithMultiplePlansParams
275
306
  ): RequestData<components['schemas']['AnalyticAccountItemOutMultiAnalyticPlans'][]> {
276
307
  return {
277
308
  params,
@@ -280,7 +311,7 @@ const accountingFactory = {
280
311
  };
281
312
  },
282
313
  getJournalEntries(
283
- params: getJournalEntriesParams
314
+ params: GetJournalEntriesParams
284
315
  ): RequestData<components['schemas']['JournalEntryMonoAnalyticPlan'][]> {
285
316
  return {
286
317
  params,
@@ -289,7 +320,7 @@ const accountingFactory = {
289
320
  };
290
321
  },
291
322
  getJournalEntriesWithMultiplePlans(
292
- params: getJournalEntriesWithMultiplePlansParams
323
+ params: GetJournalEntriesWithMultiplePlansParams
293
324
  ): RequestData<components['schemas']['JournalEntryMultiAnalyticPlan'][]> {
294
325
  return {
295
326
  params,
@@ -299,7 +330,7 @@ const accountingFactory = {
299
330
  },
300
331
  getPaymentsByInvoiceId(
301
332
  invoice_id: string,
302
- params: operations['accounting_get_payments_by_invoice']['parameters']['query']
333
+ params?: operations['accounting_get_payments_by_invoice']['parameters']['query']
303
334
  ): RequestData<components['schemas']['Payment'][]> {
304
335
  return {
305
336
  params,
@@ -307,9 +338,7 @@ const accountingFactory = {
307
338
  url: `/consumers/{consumer_id}/accounting/invoices/id/${invoice_id}/payments`,
308
339
  };
309
340
  },
310
- getJournals(
311
- params: operations['accounting_get_journals']['parameters']['query']
312
- ): RequestData<components['schemas']['Journal'][]> {
341
+ getJournals(params?: GetJournalsParams): RequestData<components['schemas']['Journal'][]> {
313
342
  return {
314
343
  params,
315
344
  method: 'get',
@@ -317,7 +346,7 @@ const accountingFactory = {
317
346
  };
318
347
  },
319
348
  getVatCodes(
320
- params: operations['accounting_get_vat_codes']['parameters']['query']
349
+ params?: GetVatCodesParams
321
350
  ): RequestData<components['schemas']['app__routers__accounting__VatCode'][]> {
322
351
  return {
323
352
  params,
@@ -326,7 +355,7 @@ const accountingFactory = {
326
355
  };
327
356
  },
328
357
  getMiscOperations(
329
- params: getMiscOperationsParams
358
+ params?: GetMiscOperationsParams
330
359
  ): RequestData<components['schemas']['MiscellaneousOperationOut'][]> {
331
360
  return {
332
361
  params,
@@ -336,7 +365,7 @@ const accountingFactory = {
336
365
  },
337
366
  createMiscOperation(
338
367
  operation: components['schemas']['MiscellaneousOperationIn'],
339
- params: operations['accounting_create_miscellaneous_operation']['parameters']['query']
368
+ params?: operations['accounting_create_miscellaneous_operation']['parameters']['query']
340
369
  ): RequestData<components['schemas']['MiscellaneousOperationOut']> {
341
370
  return {
342
371
  params,
@@ -347,7 +376,7 @@ const accountingFactory = {
347
376
  },
348
377
  getMiscOperation(
349
378
  operation_id: string,
350
- params: operations['accounting_get_miscellaneous_operation']['parameters']['query']
379
+ params?: operations['accounting_get_miscellaneous_operation']['parameters']['query']
351
380
  ): RequestData<components['schemas']['MiscellaneousOperationOut']> {
352
381
  return {
353
382
  params,
@@ -358,7 +387,7 @@ const accountingFactory = {
358
387
  attachPDF(
359
388
  invoice_id: string,
360
389
  attachment: components['schemas']['AttachmentItem'],
361
- params: operations['accounting_add_attachment']['parameters']['query']
390
+ params?: operations['accounting_add_attachment']['parameters']['query']
362
391
  ): RequestData<operations['accounting_add_attachment']['responses'][201]> {
363
392
  return {
364
393
  params,
@@ -368,7 +397,7 @@ const accountingFactory = {
368
397
  };
369
398
  },
370
399
  getAttachments(
371
- params: operations['accounting_get_attachments']['parameters']['query']
400
+ params: GetAttachmentsParams
372
401
  ): RequestData<components['schemas']['AttachmentItem'][]> {
373
402
  return {
374
403
  params,
@@ -377,7 +406,7 @@ const accountingFactory = {
377
406
  };
378
407
  },
379
408
  getChartOfAccounts(
380
- params: getChartOfAccountsParams
409
+ params?: GetChartOfAccountsParams
381
410
  ): RequestData<components['schemas']['AccountItem'][]> {
382
411
  return {
383
412
  params,
@@ -387,7 +416,7 @@ const accountingFactory = {
387
416
  },
388
417
  getBalanceOfAccounts(
389
418
  filter: components['schemas']['AccountBalanceFilter'],
390
- params: operations['accounting_get_accounts_balances']['parameters']['query']
419
+ params?: GetBalanceOfAccountsParams
391
420
  ): RequestData<components['schemas']['AccountBalance'][]> {
392
421
  return {
393
422
  params,
@@ -397,7 +426,7 @@ const accountingFactory = {
397
426
  };
398
427
  },
399
428
  getEmployees(
400
- params: operations['accounting_get_employees']['parameters']['query']
429
+ params?: GetEmployeesParams
401
430
  ): RequestData<components['schemas']['EmployeeItem'][]> {
402
431
  return {
403
432
  params,
@@ -406,7 +435,7 @@ const accountingFactory = {
406
435
  };
407
436
  },
408
437
  getOutstandings(
409
- params: getOutstandingsParams
438
+ params: GetOutstandingsParams
410
439
  ): RequestData<components['schemas']['OutstandingItem'][]> {
411
440
  return {
412
441
  params,
@@ -419,7 +448,7 @@ const accountingFactory = {
419
448
  */
420
449
  createFinancialEntryOld(
421
450
  financial_entry: components['schemas']['FinancialEntryItemInOld'],
422
- params: operations['accounting_create_financial_entry']['parameters']['query']
451
+ params?: operations['accounting_create_financial_entry']['parameters']['query']
423
452
  ): RequestData<components['schemas']['FinancialEntryItemOutOld']> {
424
453
  return {
425
454
  params,
@@ -430,7 +459,7 @@ const accountingFactory = {
430
459
  },
431
460
  createFinancialEntry(
432
461
  financial_entry: components['schemas']['FinancialEntryItemIn'],
433
- params: operations['accounting_create_financial_entries']['parameters']['query']
462
+ params?: operations['accounting_create_financial_entries']['parameters']['query']
434
463
  ): RequestData<components['schemas']['FinancialEntryItemOut'][]> {
435
464
  return {
436
465
  params,
@@ -450,7 +479,7 @@ const accountingFactory = {
450
479
  },
451
480
  createJournalEntry(
452
481
  journal_entry: components['schemas']['GenericJournalEntry'],
453
- params: operations['accounting_create_generic_journal_entry']['parameters']['query']
482
+ params?: operations['accounting_create_generic_journal_entry']['parameters']['query']
454
483
  ): RequestData<components['schemas']['JournalEntryMultiAnalyticPlan']> {
455
484
  return {
456
485
  params,
@@ -461,7 +490,7 @@ const accountingFactory = {
461
490
  },
462
491
  matchEntries(
463
492
  body: components['schemas']['MatchingIn'],
464
- params: operations['accounting_match_entries']['parameters']['query']
493
+ params?: operations['accounting_match_entries']['parameters']['query']
465
494
  ): RequestData<components['schemas']['MatchingOut']> {
466
495
  return {
467
496
  params,
@@ -26,6 +26,14 @@ const Consumer = (
26
26
  const ecommerce = createApiFor(ecommerceFactory, _internalApi, data.name, consumerId);
27
27
  const custom = createApiFor(customFactory, _internalApi, data.name, consumerId);
28
28
 
29
+ const setConnectionId = async (connectionId: string) => {
30
+ _internalApi.connectionId = connectionId;
31
+ };
32
+
33
+ const setIntegrationId = async (integrationId: string) => {
34
+ _internalApi.integrationId = integrationId;
35
+ };
36
+
29
37
  const getConnections = async () => {
30
38
  const {
31
39
  data,
@@ -192,6 +200,8 @@ const Consumer = (
192
200
  updateDataStoreData,
193
201
  deleteDataStoreData,
194
202
  logData,
203
+ setConnectionId,
204
+ setIntegrationId,
195
205
  };
196
206
  };
197
207
 
@@ -1,29 +1,22 @@
1
1
  import { operations, components } from '../types/public-api/schema';
2
- import { RequestData } from '../types/api';
2
+ import { AutoPaginatedParams, RequestData } from '../types/api';
3
3
 
4
- type getOrdersParams = Omit<
5
- operations['ecommerce_get_orders']['parameters']['query'],
6
- 'page' | 'size'
4
+ type GetOrdersParams = AutoPaginatedParams<
5
+ operations['ecommerce_get_orders']['parameters']['query']
7
6
  >;
8
7
 
9
- type getPaymentMethodsParams = Omit<
10
- operations['ecommerce_get_payments_methods']['parameters']['query'],
11
- 'page' | 'size'
8
+ type GetPaymentMethodsParams = AutoPaginatedParams<
9
+ operations['ecommerce_get_payments_methods']['parameters']['query']
12
10
  >;
13
11
 
14
- type getProductCategoriesParams = Omit<
15
- operations['ecommerce_get_product_categories']['parameters']['query'],
16
- 'page' | 'size'
12
+ type GetProductCategoriesParams = AutoPaginatedParams<
13
+ operations['ecommerce_get_product_categories']['parameters']['query']
17
14
  >;
18
15
 
19
- type getTaxesParams = Omit<
20
- operations['ecommerce_get_taxes']['parameters']['query'],
21
- 'page' | 'size'
22
- >;
16
+ type GetTaxesParams = AutoPaginatedParams<operations['ecommerce_get_taxes']['parameters']['query']>;
23
17
 
24
- type getCountriesParams = Omit<
25
- operations['ecommerce_get_countries']['parameters']['query'],
26
- 'page' | 'size'
18
+ type GetCountriesParams = AutoPaginatedParams<
19
+ operations['ecommerce_get_countries']['parameters']['query']
27
20
  >;
28
21
 
29
22
  const ecommerceFactory = {
@@ -75,7 +68,7 @@ const ecommerceFactory = {
75
68
  url: '/consumers/{consumer_id}/commerce/locations',
76
69
  };
77
70
  },
78
- getOrders(params: getOrdersParams): RequestData<components['schemas']['OrderItemOut'][]> {
71
+ getOrders(params?: GetOrdersParams): RequestData<components['schemas']['OrderItemOut'][]> {
79
72
  return {
80
73
  method: 'get',
81
74
  url: '/consumers/{consumer_id}/commerce/orders',
@@ -98,7 +91,7 @@ const ecommerceFactory = {
98
91
  };
99
92
  },
100
93
  getPaymentMethods(
101
- params: getPaymentMethodsParams
94
+ params?: GetPaymentMethodsParams
102
95
  ): RequestData<components['schemas']['PaymentMethodItem'][]> {
103
96
  return {
104
97
  params,
@@ -107,7 +100,7 @@ const ecommerceFactory = {
107
100
  };
108
101
  },
109
102
  getProductCategories(
110
- params: getProductCategoriesParams
103
+ params?: GetProductCategoriesParams
111
104
  ): RequestData<components['schemas']['CategoryItem'][]> {
112
105
  return {
113
106
  params,
@@ -115,14 +108,14 @@ const ecommerceFactory = {
115
108
  url: `/consumers/{consumer_id}/commerce/product-categories`,
116
109
  };
117
110
  },
118
- getTaxes(params: getTaxesParams): RequestData<components['schemas']['TaxRateItem'][]> {
111
+ getTaxes(params?: GetTaxesParams): RequestData<components['schemas']['TaxRateItem'][]> {
119
112
  return {
120
113
  params,
121
114
  method: 'get',
122
115
  url: `/consumers/{consumer_id}/commerce/taxes`,
123
116
  };
124
117
  },
125
- getCountries(params: getCountriesParams): RequestData<components['schemas']['CountryItem'][]> {
118
+ getCountries(params?: GetCountriesParams): RequestData<components['schemas']['CountryItem'][]> {
126
119
  return {
127
120
  params,
128
121
  method: 'get',
@@ -8,6 +8,8 @@ class InternalAPI {
8
8
  token?: TokenType;
9
9
  debug = false;
10
10
  relatedChainExecutionId?: string;
11
+ connectionId?: string;
12
+ integrationId?: string;
11
13
  get;
12
14
  post;
13
15
  patch;
@@ -27,10 +29,19 @@ class InternalAPI {
27
29
  this.instance.interceptors.request.use(
28
30
  (config) => {
29
31
  return new Promise((resolve, reject) => {
32
+ if (this.connectionId) {
33
+ config.headers['X-Chift-ConnectionId'] = this.connectionId;
34
+ }
35
+
36
+ if (this.integrationId) {
37
+ config.headers['X-Chift-IntegrationId'] = this.integrationId;
38
+ }
39
+
30
40
  if (this.relatedChainExecutionId) {
31
41
  config.headers['X-Chift-RelatedChainExecutionId'] =
32
42
  this.relatedChainExecutionId;
33
43
  }
44
+
34
45
  if (this.token) {
35
46
  if (this.token?.expires_on < new Date().getTime()) {
36
47
  return this.getToken()
@@ -1,9 +1,17 @@
1
1
  import { components, operations } from '../types/public-api/schema';
2
- import { RequestData } from '../types/api';
2
+ import { AutoPaginatedParams, RequestData } from '../types/api';
3
+
4
+ type GetInvoicesParams = AutoPaginatedParams<
5
+ operations['invoicing_get_invoices']['parameters']['query']
6
+ >;
7
+
8
+ type GetContactsParams = AutoPaginatedParams<
9
+ operations['invoicing_get_contacts']['parameters']['query']
10
+ >;
3
11
 
4
12
  const invoicingFactory = {
5
13
  getInvoices(
6
- params: operations['invoicing_get_invoices']['parameters']['query']
14
+ params?: GetInvoicesParams
7
15
  ): RequestData<components['schemas']['InvoiceItemOut'][]> {
8
16
  return {
9
17
  method: 'get',
@@ -13,7 +21,7 @@ const invoicingFactory = {
13
21
  },
14
22
  getInvoiceById(
15
23
  invoiceId: string,
16
- params: operations['invoicing_get_invoice']['parameters']['query']
24
+ params?: operations['invoicing_get_invoice']['parameters']['query']
17
25
  ): RequestData<components['schemas']['InvoiceItemOut']> {
18
26
  return {
19
27
  method: 'get',
@@ -78,7 +86,7 @@ const invoicingFactory = {
78
86
  };
79
87
  },
80
88
  getContacts(
81
- params?: operations['invoicing_get_contacts']['parameters']['query']
89
+ params?: GetContactsParams
82
90
  ): RequestData<components['schemas']['ContactItemOut'][]> {
83
91
  return {
84
92
  method: 'get',