@chift/chift-nodejs 1.0.17 → 1.0.19
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/dist/src/types/public-api/schema.d.ts +15294 -0
- package/package.json +6 -2
- package/.eslintignore +0 -1
- package/.eslintrc.json +0 -25
- package/.github/workflows/ci.yml +0 -75
- package/.husky/pre-commit +0 -4
- package/.prettierignore +0 -1
- package/.prettierrc.json +0 -7
- package/CHANGELOG.md +0 -108
- package/jest.config.ts +0 -195
- package/src/helpers/openapi.ts +0 -22
- package/src/helpers/settings.ts +0 -3
- package/src/index.ts +0 -1
- package/src/modules/accounting.ts +0 -510
- package/src/modules/api.ts +0 -35
- package/src/modules/consumer.ts +0 -216
- package/src/modules/consumers.ts +0 -82
- package/src/modules/custom.ts +0 -36
- package/src/modules/datastores.ts +0 -19
- package/src/modules/ecommerce.ts +0 -129
- package/src/modules/flow.ts +0 -168
- package/src/modules/integrations.ts +0 -24
- package/src/modules/internalApi.ts +0 -182
- package/src/modules/invoicing.ts +0 -118
- package/src/modules/payment.ts +0 -59
- package/src/modules/pms.ts +0 -67
- package/src/modules/pos.ts +0 -144
- package/src/modules/sync.ts +0 -77
- package/src/modules/syncs.ts +0 -59
- package/src/modules/webhooks.ts +0 -86
- package/src/types/api.ts +0 -37
- package/src/types/consumers.ts +0 -9
- package/src/types/public-api/mappings.ts +0 -21
- package/src/types/sync.ts +0 -38
- package/test/data/accounting_invoice.pdf +0 -0
- package/test/modules/accounting.test.ts +0 -647
- package/test/modules/consumer.test.ts +0 -68
- package/test/modules/consumers.test.ts +0 -85
- package/test/modules/ecommerce.test.ts +0 -213
- package/test/modules/integrations.test.ts +0 -22
- package/test/modules/invoicing.test.ts +0 -98
- package/test/modules/payment.test.ts +0 -65
- package/test/modules/pms.test.ts +0 -69
- package/test/modules/pos.test.ts +0 -164
- package/test/modules/sync.test.ts +0 -74
- package/test/modules/syncs.test.ts +0 -23
- package/test/modules/webhooks.test.ts +0 -92
- package/tsconfig.json +0 -107
|
@@ -1,510 +0,0 @@
|
|
|
1
|
-
import { operations, components } from '../types/public-api/schema';
|
|
2
|
-
import { AutoPaginatedParams, RequestData } from '../types/api';
|
|
3
|
-
|
|
4
|
-
type GetChartOfAccountsParams = AutoPaginatedParams<
|
|
5
|
-
operations['accounting_get_chart_of_accounts']['parameters']['query']
|
|
6
|
-
>;
|
|
7
|
-
|
|
8
|
-
type GetMiscOperationsParams = AutoPaginatedParams<
|
|
9
|
-
operations['accounting_get_miscellaneous_operations']['parameters']['query']
|
|
10
|
-
>;
|
|
11
|
-
|
|
12
|
-
type GetInvoicesByTypeWithMultiplePlansParams = AutoPaginatedParams<
|
|
13
|
-
operations['accounting_get_invoices_by_type_multi_analytic_plans']['parameters']['query']
|
|
14
|
-
>;
|
|
15
|
-
|
|
16
|
-
type GetInvoicesByTypeParams = AutoPaginatedParams<
|
|
17
|
-
operations['accounting_get_invoices_by_type']['parameters']['query']
|
|
18
|
-
>;
|
|
19
|
-
|
|
20
|
-
type GetOutstandingsParams = AutoPaginatedParams<
|
|
21
|
-
operations['accounting_get_outstandings']['parameters']['query']
|
|
22
|
-
>;
|
|
23
|
-
|
|
24
|
-
type GetAnalyticPlansParams = AutoPaginatedParams<
|
|
25
|
-
operations['accounting_get_analytic_plans']['parameters']['query']
|
|
26
|
-
>;
|
|
27
|
-
|
|
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']
|
|
70
|
-
>;
|
|
71
|
-
|
|
72
|
-
const accountingFactory = {
|
|
73
|
-
getAnalyticPlans(
|
|
74
|
-
params?: GetAnalyticPlansParams
|
|
75
|
-
): RequestData<components['schemas']['AnalyticPlanItem'][]> {
|
|
76
|
-
return {
|
|
77
|
-
params,
|
|
78
|
-
method: 'get',
|
|
79
|
-
url: '/consumers/{consumer_id}/accounting/analytic-plans',
|
|
80
|
-
};
|
|
81
|
-
},
|
|
82
|
-
getClients(params?: GetClientsParams): RequestData<components['schemas']['ClientItemOut'][]> {
|
|
83
|
-
return {
|
|
84
|
-
params,
|
|
85
|
-
method: 'get',
|
|
86
|
-
url: '/consumers/{consumer_id}/accounting/clients',
|
|
87
|
-
};
|
|
88
|
-
},
|
|
89
|
-
createClient(
|
|
90
|
-
client: components['schemas']['ClientItemIn'],
|
|
91
|
-
params?: operations['accounting_create_client']['parameters']['query']
|
|
92
|
-
): RequestData<components['schemas']['ClientItemOut']> {
|
|
93
|
-
return {
|
|
94
|
-
params,
|
|
95
|
-
method: 'post',
|
|
96
|
-
url: '/consumers/{consumer_id}/accounting/clients',
|
|
97
|
-
body: client,
|
|
98
|
-
};
|
|
99
|
-
},
|
|
100
|
-
getClient(
|
|
101
|
-
clientId: string,
|
|
102
|
-
params?: operations['accounting_get_client']['parameters']['query']
|
|
103
|
-
): RequestData<components['schemas']['ClientItemOut']> {
|
|
104
|
-
return {
|
|
105
|
-
params,
|
|
106
|
-
method: 'get',
|
|
107
|
-
url: `/consumers/{consumer_id}/accounting/clients/${clientId}`,
|
|
108
|
-
};
|
|
109
|
-
},
|
|
110
|
-
updateClient(
|
|
111
|
-
clientId: string,
|
|
112
|
-
client: components['schemas']['ClientItemUpdate'],
|
|
113
|
-
params?: operations['accounting_update_client']['parameters']['query']
|
|
114
|
-
): RequestData<components['schemas']['ClientItemOut']> {
|
|
115
|
-
return {
|
|
116
|
-
params,
|
|
117
|
-
method: 'patch',
|
|
118
|
-
url: `/consumers/{consumer_id}/accounting/clients/${clientId}`,
|
|
119
|
-
body: client,
|
|
120
|
-
};
|
|
121
|
-
},
|
|
122
|
-
getSuppliers(
|
|
123
|
-
params?: GetSuppliersParams
|
|
124
|
-
): RequestData<components['schemas']['SupplierItemOut'][]> {
|
|
125
|
-
return {
|
|
126
|
-
params,
|
|
127
|
-
method: 'get',
|
|
128
|
-
url: '/consumers/{consumer_id}/accounting/suppliers',
|
|
129
|
-
};
|
|
130
|
-
},
|
|
131
|
-
createSupplier(
|
|
132
|
-
supplier: components['schemas']['SupplierItemIn'],
|
|
133
|
-
params?: operations['accounting_create_supplier']['parameters']['query']
|
|
134
|
-
): RequestData<components['schemas']['SupplierItemOut']> {
|
|
135
|
-
return {
|
|
136
|
-
params,
|
|
137
|
-
method: 'post',
|
|
138
|
-
url: '/consumers/{consumer_id}/accounting/suppliers',
|
|
139
|
-
body: supplier,
|
|
140
|
-
};
|
|
141
|
-
},
|
|
142
|
-
getSupplier(
|
|
143
|
-
supplierId: string,
|
|
144
|
-
params?: operations['accounting_get_supplier']['parameters']['query']
|
|
145
|
-
): RequestData<components['schemas']['SupplierItemOut']> {
|
|
146
|
-
return {
|
|
147
|
-
params,
|
|
148
|
-
method: 'get',
|
|
149
|
-
url: `/consumers/{consumer_id}/accounting/suppliers/${supplierId}`,
|
|
150
|
-
};
|
|
151
|
-
},
|
|
152
|
-
updateSupplier(
|
|
153
|
-
supplierId: string,
|
|
154
|
-
supplier: components['schemas']['SupplierItemUpdate'],
|
|
155
|
-
params?: operations['accounting_update_supplier']['parameters']['query']
|
|
156
|
-
): RequestData<components['schemas']['SupplierItemOut']> {
|
|
157
|
-
return {
|
|
158
|
-
params,
|
|
159
|
-
method: 'patch',
|
|
160
|
-
url: `/consumers/{consumer_id}/accounting/suppliers/${supplierId}`,
|
|
161
|
-
body: supplier,
|
|
162
|
-
};
|
|
163
|
-
},
|
|
164
|
-
createInvoice(
|
|
165
|
-
invoice: components['schemas']['InvoiceItemInMonoAnalyticPlan'],
|
|
166
|
-
params?: operations['accounting_create_invoice']['parameters']['query']
|
|
167
|
-
): RequestData<components['schemas']['InvoiceItemOutMonoAnalyticPlan']> {
|
|
168
|
-
return {
|
|
169
|
-
params,
|
|
170
|
-
method: 'post',
|
|
171
|
-
url: '/consumers/{consumer_id}/accounting/invoices',
|
|
172
|
-
body: invoice,
|
|
173
|
-
};
|
|
174
|
-
},
|
|
175
|
-
createInvoiceWithMultiplePlans(
|
|
176
|
-
invoice: components['schemas']['InvoiceItemInMultiAnalyticPlans'],
|
|
177
|
-
params?: operations['accounting_create_invoice_multiple_plans']['parameters']['query']
|
|
178
|
-
): RequestData<components['schemas']['InvoiceItemOutMultiAnalyticPlans']> {
|
|
179
|
-
return {
|
|
180
|
-
params,
|
|
181
|
-
method: 'post',
|
|
182
|
-
url: '/consumers/{consumer_id}/accounting/invoices/multi-analytic-plans',
|
|
183
|
-
body: invoice,
|
|
184
|
-
};
|
|
185
|
-
},
|
|
186
|
-
getInvoicesByType(
|
|
187
|
-
invoice_type: components['schemas']['backbone_api__app__routers__accounting__InvoiceType'],
|
|
188
|
-
params?: GetInvoicesByTypeParams
|
|
189
|
-
): RequestData<components['schemas']['InvoiceItemOutMonoAnalyticPlan'][]> {
|
|
190
|
-
return {
|
|
191
|
-
params,
|
|
192
|
-
method: 'get',
|
|
193
|
-
url: `/consumers/{consumer_id}/accounting/invoices/type/${invoice_type}`,
|
|
194
|
-
};
|
|
195
|
-
},
|
|
196
|
-
getInvoice(
|
|
197
|
-
invoiceId: string,
|
|
198
|
-
params?: operations['accounting_get_invoice']['parameters']['query']
|
|
199
|
-
): RequestData<components['schemas']['InvoiceItemOutMonoAnalyticPlan']> {
|
|
200
|
-
return {
|
|
201
|
-
params,
|
|
202
|
-
method: 'get',
|
|
203
|
-
url: `/consumers/{consumer_id}/accounting/invoices/${invoiceId}`,
|
|
204
|
-
};
|
|
205
|
-
},
|
|
206
|
-
getInvoiceWithMultiplePlans(
|
|
207
|
-
invoiceId: string,
|
|
208
|
-
params?: operations['accounting_get_invoice_multi_analytic_plans']['parameters']['query']
|
|
209
|
-
): RequestData<components['schemas']['InvoiceItemOutMultiAnalyticPlans']> {
|
|
210
|
-
return {
|
|
211
|
-
params,
|
|
212
|
-
method: 'get',
|
|
213
|
-
url: `/consumers/{consumer_id}/accounting/invoices/multi-analytic-plans/${invoiceId}`,
|
|
214
|
-
};
|
|
215
|
-
},
|
|
216
|
-
getInvoicesByTypeWithMultiplePlans(
|
|
217
|
-
invoice_type: components['schemas']['backbone_api__app__routers__accounting__InvoiceType'],
|
|
218
|
-
params?: GetInvoicesByTypeWithMultiplePlansParams
|
|
219
|
-
): RequestData<components['schemas']['InvoiceItemOutMultiAnalyticPlans'][]> {
|
|
220
|
-
return {
|
|
221
|
-
params,
|
|
222
|
-
method: 'get',
|
|
223
|
-
url: `/consumers/{consumer_id}/accounting/invoices/multi-analytic-plans/type/${invoice_type}`,
|
|
224
|
-
};
|
|
225
|
-
},
|
|
226
|
-
createAnalyticAccount(
|
|
227
|
-
analyticAccount: components['schemas']['AnalyticAccountItemIn'],
|
|
228
|
-
params?: operations['accounting_create_analytic_account']['parameters']['query']
|
|
229
|
-
): RequestData<components['schemas']['AnalyticAccountItemOut']> {
|
|
230
|
-
return {
|
|
231
|
-
params,
|
|
232
|
-
method: 'post',
|
|
233
|
-
url: '/consumers/{consumer_id}/accounting/analytic-accounts',
|
|
234
|
-
body: analyticAccount,
|
|
235
|
-
};
|
|
236
|
-
},
|
|
237
|
-
getAnalyticAccounts(
|
|
238
|
-
params?: GetAnalyticAccountsParams
|
|
239
|
-
): RequestData<components['schemas']['AnalyticAccountItemOut'][]> {
|
|
240
|
-
return {
|
|
241
|
-
params,
|
|
242
|
-
method: 'get',
|
|
243
|
-
url: '/consumers/{consumer_id}/accounting/analytic-accounts',
|
|
244
|
-
};
|
|
245
|
-
},
|
|
246
|
-
createAnalyticAccountWithMultiplePlans(
|
|
247
|
-
analytic_plan: string,
|
|
248
|
-
analyticAccount: components['schemas']['AnalyticAccountItemIn'],
|
|
249
|
-
params?: operations['accounting_create_analytic_account_multi_plans']['parameters']['query']
|
|
250
|
-
): RequestData<components['schemas']['AnalyticAccountItemOutMultiAnalyticPlans']> {
|
|
251
|
-
return {
|
|
252
|
-
params,
|
|
253
|
-
method: 'post',
|
|
254
|
-
url: `/consumers/{consumer_id}/accounting/analytic-accounts/multi-analytic-plans/${analytic_plan}`,
|
|
255
|
-
body: analyticAccount,
|
|
256
|
-
};
|
|
257
|
-
},
|
|
258
|
-
getAnalyticAccount(
|
|
259
|
-
analytic_account_id: string,
|
|
260
|
-
params?: operations['accounting_get_analytic_account']['parameters']['query']
|
|
261
|
-
): RequestData<components['schemas']['AnalyticAccountItemOut']> {
|
|
262
|
-
return {
|
|
263
|
-
params,
|
|
264
|
-
method: 'get',
|
|
265
|
-
url: `/consumers/{consumer_id}/accounting/analytic-accounts/${analytic_account_id}`,
|
|
266
|
-
};
|
|
267
|
-
},
|
|
268
|
-
updateAnalyticAccount(
|
|
269
|
-
analytic_account_id: string,
|
|
270
|
-
analyticAccount: components['schemas']['AnalyticAccountItemUpdate'],
|
|
271
|
-
params?: operations['accounting_update_analytic_account']['parameters']['query']
|
|
272
|
-
): RequestData<components['schemas']['AnalyticAccountItemOut']> {
|
|
273
|
-
return {
|
|
274
|
-
params,
|
|
275
|
-
method: 'patch',
|
|
276
|
-
url: `/consumers/{consumer_id}/accounting/analytic-accounts/${analytic_account_id}`,
|
|
277
|
-
body: analyticAccount,
|
|
278
|
-
};
|
|
279
|
-
},
|
|
280
|
-
getAnalyticAccountWithMultiplePlans(
|
|
281
|
-
analytic_account_id: string,
|
|
282
|
-
analytic_plan: string,
|
|
283
|
-
params?: operations['accounting_get_analytic_account_multi_plans']['parameters']['query']
|
|
284
|
-
): RequestData<components['schemas']['AnalyticAccountItemOutMultiAnalyticPlans']> {
|
|
285
|
-
return {
|
|
286
|
-
params,
|
|
287
|
-
method: 'get',
|
|
288
|
-
url: `/consumers/{consumer_id}/accounting/analytic-accounts/${analytic_account_id}/multi-analytic-plans/${analytic_plan}`,
|
|
289
|
-
};
|
|
290
|
-
},
|
|
291
|
-
updateAnalyticAccountWithMultiplePlans(
|
|
292
|
-
analytic_account_id: string,
|
|
293
|
-
analytic_plan: string,
|
|
294
|
-
analyticAccount: components['schemas']['AnalyticAccountItemUpdate'],
|
|
295
|
-
params?: operations['accounting_update_analytic_account_multi_plans']['parameters']['query']
|
|
296
|
-
): RequestData<components['schemas']['AnalyticAccountItemOutMultiAnalyticPlans']> {
|
|
297
|
-
return {
|
|
298
|
-
params,
|
|
299
|
-
method: 'patch',
|
|
300
|
-
url: `/consumers/{consumer_id}/accounting/analytic-accounts/${analytic_account_id}/multi-analytic-plans/${analytic_plan}`,
|
|
301
|
-
body: analyticAccount,
|
|
302
|
-
};
|
|
303
|
-
},
|
|
304
|
-
getAnalyticAccountsWithMultiplePlans(
|
|
305
|
-
params?: GetAnalyticAccountsWithMultiplePlansParams
|
|
306
|
-
): RequestData<components['schemas']['AnalyticAccountItemOutMultiAnalyticPlans'][]> {
|
|
307
|
-
return {
|
|
308
|
-
params,
|
|
309
|
-
method: 'get',
|
|
310
|
-
url: '/consumers/{consumer_id}/accounting/analytic-accounts/multi-analytic-plans',
|
|
311
|
-
};
|
|
312
|
-
},
|
|
313
|
-
getJournalEntries(
|
|
314
|
-
params: GetJournalEntriesParams
|
|
315
|
-
): RequestData<components['schemas']['JournalEntryMonoAnalyticPlan'][]> {
|
|
316
|
-
return {
|
|
317
|
-
params,
|
|
318
|
-
method: 'get',
|
|
319
|
-
url: `/consumers/{consumer_id}/accounting/journal/entries`,
|
|
320
|
-
};
|
|
321
|
-
},
|
|
322
|
-
getJournalEntriesWithMultiplePlans(
|
|
323
|
-
params: GetJournalEntriesWithMultiplePlansParams
|
|
324
|
-
): RequestData<components['schemas']['JournalEntryMultiAnalyticPlan'][]> {
|
|
325
|
-
return {
|
|
326
|
-
params,
|
|
327
|
-
method: 'get',
|
|
328
|
-
url: `/consumers/{consumer_id}/accounting/journal/entries/multi-analytic-plans`,
|
|
329
|
-
};
|
|
330
|
-
},
|
|
331
|
-
getPaymentsByInvoiceId(
|
|
332
|
-
invoice_id: string,
|
|
333
|
-
params?: operations['accounting_get_payments_by_invoice']['parameters']['query']
|
|
334
|
-
): RequestData<components['schemas']['Payment'][]> {
|
|
335
|
-
return {
|
|
336
|
-
params,
|
|
337
|
-
method: 'get',
|
|
338
|
-
url: `/consumers/{consumer_id}/accounting/invoices/id/${invoice_id}/payments`,
|
|
339
|
-
};
|
|
340
|
-
},
|
|
341
|
-
getJournals(params?: GetJournalsParams): RequestData<components['schemas']['Journal'][]> {
|
|
342
|
-
return {
|
|
343
|
-
params,
|
|
344
|
-
method: 'get',
|
|
345
|
-
url: `/consumers/{consumer_id}/accounting/journals`,
|
|
346
|
-
};
|
|
347
|
-
},
|
|
348
|
-
getVatCodes(
|
|
349
|
-
params?: GetVatCodesParams
|
|
350
|
-
): RequestData<components['schemas']['backbone_api__app__routers__accounting__VatCode'][]> {
|
|
351
|
-
return {
|
|
352
|
-
params,
|
|
353
|
-
method: 'get',
|
|
354
|
-
url: `/consumers/{consumer_id}/accounting/vat-codes`,
|
|
355
|
-
};
|
|
356
|
-
},
|
|
357
|
-
getMiscOperations(
|
|
358
|
-
params?: GetMiscOperationsParams
|
|
359
|
-
): RequestData<components['schemas']['MiscellaneousOperationOut'][]> {
|
|
360
|
-
return {
|
|
361
|
-
params,
|
|
362
|
-
method: 'get',
|
|
363
|
-
url: '/consumers/{consumer_id}/accounting/miscellaneous-operation',
|
|
364
|
-
};
|
|
365
|
-
},
|
|
366
|
-
createMiscOperation(
|
|
367
|
-
operation: components['schemas']['MiscellaneousOperationIn'],
|
|
368
|
-
params?: operations['accounting_create_miscellaneous_operation']['parameters']['query']
|
|
369
|
-
): RequestData<components['schemas']['MiscellaneousOperationOut']> {
|
|
370
|
-
return {
|
|
371
|
-
params,
|
|
372
|
-
method: 'post',
|
|
373
|
-
url: '/consumers/{consumer_id}/accounting/miscellaneous-operation',
|
|
374
|
-
body: operation,
|
|
375
|
-
};
|
|
376
|
-
},
|
|
377
|
-
getMiscOperation(
|
|
378
|
-
operation_id: string,
|
|
379
|
-
params?: operations['accounting_get_miscellaneous_operation']['parameters']['query']
|
|
380
|
-
): RequestData<components['schemas']['MiscellaneousOperationOut']> {
|
|
381
|
-
return {
|
|
382
|
-
params,
|
|
383
|
-
method: 'get',
|
|
384
|
-
url: `/consumers/{consumer_id}/accounting/miscellaneous-operation/${operation_id}`,
|
|
385
|
-
};
|
|
386
|
-
},
|
|
387
|
-
attachPDF(
|
|
388
|
-
invoice_id: string,
|
|
389
|
-
attachment: components['schemas']['AttachmentItem'],
|
|
390
|
-
params?: operations['accounting_add_attachment']['parameters']['query']
|
|
391
|
-
): RequestData<operations['accounting_add_attachment']['responses'][201]> {
|
|
392
|
-
return {
|
|
393
|
-
params,
|
|
394
|
-
method: 'post',
|
|
395
|
-
url: `/consumers/{consumer_id}/accounting/invoices/pdf/${invoice_id}`,
|
|
396
|
-
body: attachment,
|
|
397
|
-
};
|
|
398
|
-
},
|
|
399
|
-
getAttachments(
|
|
400
|
-
params: GetAttachmentsParams
|
|
401
|
-
): RequestData<components['schemas']['AttachmentItem'][]> {
|
|
402
|
-
return {
|
|
403
|
-
params,
|
|
404
|
-
method: 'get',
|
|
405
|
-
url: `/consumers/{consumer_id}/accounting/attachments`,
|
|
406
|
-
};
|
|
407
|
-
},
|
|
408
|
-
getChartOfAccounts(
|
|
409
|
-
params?: GetChartOfAccountsParams
|
|
410
|
-
): RequestData<components['schemas']['AccountItem'][]> {
|
|
411
|
-
return {
|
|
412
|
-
params,
|
|
413
|
-
method: 'get',
|
|
414
|
-
url: '/consumers/{consumer_id}/accounting/chart-of-accounts',
|
|
415
|
-
};
|
|
416
|
-
},
|
|
417
|
-
getBalanceOfAccounts(
|
|
418
|
-
filter: components['schemas']['AccountBalanceFilter'],
|
|
419
|
-
params?: GetBalanceOfAccountsParams
|
|
420
|
-
): RequestData<components['schemas']['AccountBalance'][]> {
|
|
421
|
-
return {
|
|
422
|
-
params,
|
|
423
|
-
method: 'post',
|
|
424
|
-
url: '/consumers/{consumer_id}/accounting/chart-of-accounts/balance',
|
|
425
|
-
body: filter,
|
|
426
|
-
};
|
|
427
|
-
},
|
|
428
|
-
getEmployees(
|
|
429
|
-
params?: GetEmployeesParams
|
|
430
|
-
): RequestData<components['schemas']['EmployeeItem'][]> {
|
|
431
|
-
return {
|
|
432
|
-
params,
|
|
433
|
-
method: 'get',
|
|
434
|
-
url: '/consumers/{consumer_id}/accounting/employees',
|
|
435
|
-
};
|
|
436
|
-
},
|
|
437
|
-
getOutstandings(
|
|
438
|
-
params: GetOutstandingsParams
|
|
439
|
-
): RequestData<components['schemas']['OutstandingItem'][]> {
|
|
440
|
-
return {
|
|
441
|
-
params,
|
|
442
|
-
method: 'get',
|
|
443
|
-
url: '/consumers/{consumer_id}/accounting/outstandings',
|
|
444
|
-
};
|
|
445
|
-
},
|
|
446
|
-
/**
|
|
447
|
-
* @deprecated replaced by createFinancialEntry
|
|
448
|
-
*/
|
|
449
|
-
createFinancialEntryOld(
|
|
450
|
-
financial_entry: components['schemas']['FinancialEntryItemInOld'],
|
|
451
|
-
params?: operations['accounting_create_financial_entry']['parameters']['query']
|
|
452
|
-
): RequestData<components['schemas']['FinancialEntryItemOutOld']> {
|
|
453
|
-
return {
|
|
454
|
-
params,
|
|
455
|
-
method: 'post',
|
|
456
|
-
url: '/consumers/{consumer_id}/accounting/financial-entry',
|
|
457
|
-
body: financial_entry,
|
|
458
|
-
};
|
|
459
|
-
},
|
|
460
|
-
createFinancialEntry(
|
|
461
|
-
financial_entry: components['schemas']['FinancialEntryItemIn'],
|
|
462
|
-
params?: operations['accounting_create_financial_entries']['parameters']['query']
|
|
463
|
-
): RequestData<components['schemas']['FinancialEntryItemOut'][]> {
|
|
464
|
-
return {
|
|
465
|
-
params,
|
|
466
|
-
method: 'post',
|
|
467
|
-
url: '/consumers/{consumer_id}/accounting/financial-entries',
|
|
468
|
-
body: financial_entry,
|
|
469
|
-
};
|
|
470
|
-
},
|
|
471
|
-
createJournalEntryOld(
|
|
472
|
-
journal_entry: components['schemas']['JournalEntryIn']
|
|
473
|
-
): RequestData<components['schemas']['JournalEntryMultiAnalyticPlan']> {
|
|
474
|
-
return {
|
|
475
|
-
method: 'post',
|
|
476
|
-
url: '/consumers/{consumer_id}/accounting/journal/entries',
|
|
477
|
-
body: journal_entry,
|
|
478
|
-
};
|
|
479
|
-
},
|
|
480
|
-
createJournalEntry(
|
|
481
|
-
journal_entry: components['schemas']['GenericJournalEntry'],
|
|
482
|
-
params?: operations['accounting_create_generic_journal_entry']['parameters']['query']
|
|
483
|
-
): RequestData<components['schemas']['JournalEntryMultiAnalyticPlan']> {
|
|
484
|
-
return {
|
|
485
|
-
params,
|
|
486
|
-
method: 'post',
|
|
487
|
-
url: '/consumers/{consumer_id}/accounting/journal-entries',
|
|
488
|
-
body: journal_entry,
|
|
489
|
-
};
|
|
490
|
-
},
|
|
491
|
-
matchEntries(
|
|
492
|
-
body: components['schemas']['MatchingIn'],
|
|
493
|
-
params?: operations['accounting_match_entries']['parameters']['query']
|
|
494
|
-
): RequestData<components['schemas']['MatchingOut']> {
|
|
495
|
-
return {
|
|
496
|
-
params,
|
|
497
|
-
body,
|
|
498
|
-
method: 'post',
|
|
499
|
-
url: '/consumers/{consumer_id}/accounting/matching',
|
|
500
|
-
};
|
|
501
|
-
},
|
|
502
|
-
getFolders(): RequestData<components['schemas']['FolderItem'][]> {
|
|
503
|
-
return {
|
|
504
|
-
method: 'get',
|
|
505
|
-
url: '/consumers/{consumer_id}/accounting/folders',
|
|
506
|
-
};
|
|
507
|
-
},
|
|
508
|
-
};
|
|
509
|
-
|
|
510
|
-
export { accountingFactory };
|
package/src/modules/api.ts
DELETED
|
@@ -1,35 +0,0 @@
|
|
|
1
|
-
import { AuthType } from '../types/api';
|
|
2
|
-
import { InternalAPI } from './internalApi';
|
|
3
|
-
import { Consumers } from './consumers';
|
|
4
|
-
import { Syncs, SyncsAPI } from './syncs';
|
|
5
|
-
import { Integrations } from './integrations';
|
|
6
|
-
import { Webhooks } from './webhooks';
|
|
7
|
-
import { DataStores } from './datastores';
|
|
8
|
-
|
|
9
|
-
export class API {
|
|
10
|
-
auth: AuthType;
|
|
11
|
-
token?: string;
|
|
12
|
-
internalApi?: any;
|
|
13
|
-
Consumers;
|
|
14
|
-
Syncs: SyncsAPI;
|
|
15
|
-
Integrations;
|
|
16
|
-
Webhooks;
|
|
17
|
-
DataStores;
|
|
18
|
-
|
|
19
|
-
constructor(auth: AuthType) {
|
|
20
|
-
this.auth = auth;
|
|
21
|
-
this._setup();
|
|
22
|
-
this.Consumers = Consumers(this.internalApi);
|
|
23
|
-
this.Syncs = Syncs(this.internalApi);
|
|
24
|
-
this.Integrations = Integrations(this.internalApi);
|
|
25
|
-
this.Webhooks = Webhooks(this.internalApi);
|
|
26
|
-
this.DataStores = DataStores(this.internalApi);
|
|
27
|
-
}
|
|
28
|
-
|
|
29
|
-
private _setup = async () => {
|
|
30
|
-
if (!this.auth.clientId || !this.auth.clientSecret || !this.auth.accountId) {
|
|
31
|
-
throw new Error('Missing mandatory auth parameters');
|
|
32
|
-
}
|
|
33
|
-
this.internalApi = new InternalAPI(this.auth);
|
|
34
|
-
};
|
|
35
|
-
}
|