@itzenata/efact-node 1.0.1

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.
Files changed (117) hide show
  1. package/LICENSE +21 -0
  2. package/README.md +154 -0
  3. package/dist/_generated/api/invoices-api.d.ts +367 -0
  4. package/dist/_generated/api/invoices-api.d.ts.map +1 -0
  5. package/dist/_generated/api/invoices-api.js +485 -0
  6. package/dist/_generated/api/invoices-api.js.map +1 -0
  7. package/dist/_generated/api.d.ts +13 -0
  8. package/dist/_generated/api.d.ts.map +1 -0
  9. package/dist/_generated/api.js +16 -0
  10. package/dist/_generated/api.js.map +1 -0
  11. package/dist/_generated/base.d.ts +67 -0
  12. package/dist/_generated/base.d.ts.map +1 -0
  13. package/dist/_generated/base.js +65 -0
  14. package/dist/_generated/base.js.map +1 -0
  15. package/dist/_generated/common.d.ts +66 -0
  16. package/dist/_generated/common.d.ts.map +1 -0
  17. package/dist/_generated/common.js +135 -0
  18. package/dist/_generated/common.js.map +1 -0
  19. package/dist/_generated/configuration.d.ts +92 -0
  20. package/dist/_generated/configuration.d.ts.map +1 -0
  21. package/dist/_generated/configuration.js +97 -0
  22. package/dist/_generated/configuration.js.map +1 -0
  23. package/dist/_generated/index.d.ts +15 -0
  24. package/dist/_generated/index.d.ts.map +1 -0
  25. package/dist/_generated/index.js +18 -0
  26. package/dist/_generated/index.js.map +1 -0
  27. package/dist/_generated/models/api-response-invoice-response.d.ts +45 -0
  28. package/dist/_generated/models/api-response-invoice-response.d.ts.map +1 -0
  29. package/dist/_generated/models/api-response-invoice-response.js +16 -0
  30. package/dist/_generated/models/api-response-invoice-response.js.map +1 -0
  31. package/dist/_generated/models/api-response-invoice-status-response.d.ts +45 -0
  32. package/dist/_generated/models/api-response-invoice-status-response.d.ts.map +1 -0
  33. package/dist/_generated/models/api-response-invoice-status-response.js +16 -0
  34. package/dist/_generated/models/api-response-invoice-status-response.js.map +1 -0
  35. package/dist/_generated/models/api-response-page-response-invoice-response.d.ts +45 -0
  36. package/dist/_generated/models/api-response-page-response-invoice-response.d.ts.map +1 -0
  37. package/dist/_generated/models/api-response-page-response-invoice-response.js +16 -0
  38. package/dist/_generated/models/api-response-page-response-invoice-response.js.map +1 -0
  39. package/dist/_generated/models/create-invoice-line-request.d.ts +55 -0
  40. package/dist/_generated/models/create-invoice-line-request.d.ts.map +1 -0
  41. package/dist/_generated/models/create-invoice-line-request.js +16 -0
  42. package/dist/_generated/models/create-invoice-line-request.js.map +1 -0
  43. package/dist/_generated/models/create-invoice-request.d.ts +82 -0
  44. package/dist/_generated/models/create-invoice-request.d.ts.map +1 -0
  45. package/dist/_generated/models/create-invoice-request.js +22 -0
  46. package/dist/_generated/models/create-invoice-request.js.map +1 -0
  47. package/dist/_generated/models/field-error.d.ts +31 -0
  48. package/dist/_generated/models/field-error.d.ts.map +1 -0
  49. package/dist/_generated/models/field-error.js +16 -0
  50. package/dist/_generated/models/field-error.js.map +1 -0
  51. package/dist/_generated/models/index.d.ts +11 -0
  52. package/dist/_generated/models/index.d.ts.map +1 -0
  53. package/dist/_generated/models/index.js +12 -0
  54. package/dist/_generated/models/index.js.map +1 -0
  55. package/dist/_generated/models/invoice-response.d.ts +221 -0
  56. package/dist/_generated/models/invoice-response.d.ts.map +1 -0
  57. package/dist/_generated/models/invoice-response.js +24 -0
  58. package/dist/_generated/models/invoice-response.js.map +1 -0
  59. package/dist/_generated/models/invoice-status-response.d.ts +83 -0
  60. package/dist/_generated/models/invoice-status-response.d.ts.map +1 -0
  61. package/dist/_generated/models/invoice-status-response.js +24 -0
  62. package/dist/_generated/models/invoice-status-response.js.map +1 -0
  63. package/dist/_generated/models/page-response-invoice-response.d.ts +62 -0
  64. package/dist/_generated/models/page-response-invoice-response.d.ts.map +1 -0
  65. package/dist/_generated/models/page-response-invoice-response.js +16 -0
  66. package/dist/_generated/models/page-response-invoice-response.js.map +1 -0
  67. package/dist/_generated/models/update-invoice-request.d.ts +121 -0
  68. package/dist/_generated/models/update-invoice-request.d.ts.map +1 -0
  69. package/dist/_generated/models/update-invoice-request.js +31 -0
  70. package/dist/_generated/models/update-invoice-request.js.map +1 -0
  71. package/dist/client.d.ts +73 -0
  72. package/dist/client.d.ts.map +1 -0
  73. package/dist/client.js +155 -0
  74. package/dist/client.js.map +1 -0
  75. package/dist/errors.d.ts +100 -0
  76. package/dist/errors.d.ts.map +1 -0
  77. package/dist/errors.js +129 -0
  78. package/dist/errors.js.map +1 -0
  79. package/dist/index.d.ts +7 -0
  80. package/dist/index.d.ts.map +1 -0
  81. package/dist/index.js +9 -0
  82. package/dist/index.js.map +1 -0
  83. package/dist/invoices.d.ts +36 -0
  84. package/dist/invoices.d.ts.map +1 -0
  85. package/dist/invoices.js +53 -0
  86. package/dist/invoices.js.map +1 -0
  87. package/dist/runtime.d.ts +34 -0
  88. package/dist/runtime.d.ts.map +1 -0
  89. package/dist/runtime.js +105 -0
  90. package/dist/runtime.js.map +1 -0
  91. package/package.json +66 -0
  92. package/src/_generated/.openapi-generator/FILES +21 -0
  93. package/src/_generated/.openapi-generator/VERSION +1 -0
  94. package/src/_generated/.openapi-generator-ignore +23 -0
  95. package/src/_generated/api/invoices-api.ts +662 -0
  96. package/src/_generated/api.ts +19 -0
  97. package/src/_generated/base.ts +87 -0
  98. package/src/_generated/common.ts +151 -0
  99. package/src/_generated/configuration.ts +111 -0
  100. package/src/_generated/git_push.sh +57 -0
  101. package/src/_generated/index.ts +19 -0
  102. package/src/_generated/models/api-response-invoice-response.ts +55 -0
  103. package/src/_generated/models/api-response-invoice-status-response.ts +55 -0
  104. package/src/_generated/models/api-response-page-response-invoice-response.ts +55 -0
  105. package/src/_generated/models/create-invoice-line-request.ts +61 -0
  106. package/src/_generated/models/create-invoice-request.ts +93 -0
  107. package/src/_generated/models/field-error.ts +37 -0
  108. package/src/_generated/models/index.ts +11 -0
  109. package/src/_generated/models/invoice-response.ts +230 -0
  110. package/src/_generated/models/invoice-status-response.ts +92 -0
  111. package/src/_generated/models/page-response-invoice-response.ts +70 -0
  112. package/src/_generated/models/update-invoice-request.ts +131 -0
  113. package/src/client.ts +215 -0
  114. package/src/errors.ts +166 -0
  115. package/src/index.ts +35 -0
  116. package/src/invoices.ts +80 -0
  117. package/src/runtime.ts +179 -0
@@ -0,0 +1,662 @@
1
+ // @ts-nocheck
2
+ /* tslint:disable */
3
+ /* eslint-disable */
4
+ /**
5
+ * EFact API
6
+ * Compliance-as-a-service backend for Moroccan DGI electronic invoicing
7
+ *
8
+ * The version of the OpenAPI document: v0.0.1-SNAPSHOT
9
+ * Contact: contact@itzenata.com
10
+ *
11
+ * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech).
12
+ * https://openapi-generator.tech
13
+ * Do not edit the class manually.
14
+ */
15
+
16
+
17
+ import type { Configuration } from '../configuration.js';
18
+ import type { AxiosPromise, AxiosInstance, RawAxiosRequestConfig } from 'axios';
19
+ import globalAxios from 'axios';
20
+ // Some imports not used depending on template conditions
21
+ // @ts-ignore
22
+ import { DUMMY_BASE_URL, assertParamExists, setApiKeyToObject, setBasicAuthToObject, setBearerAuthToObject, setOAuthToObject, setSearchParams, serializeDataIfNeeded, toPathString, createRequestFunction } from '../common.js';
23
+ // @ts-ignore
24
+ import { BASE_PATH, COLLECTION_FORMATS, type RequestArgs, BaseAPI, RequiredError, operationServerMap } from '../base.js';
25
+ // @ts-ignore
26
+ import type { ApiResponseInvoiceResponse } from '../models/index.js';
27
+ // @ts-ignore
28
+ import type { ApiResponseInvoiceStatusResponse } from '../models/index.js';
29
+ // @ts-ignore
30
+ import type { ApiResponsePageResponseInvoiceResponse } from '../models/index.js';
31
+ // @ts-ignore
32
+ import type { CreateInvoiceRequest } from '../models/index.js';
33
+ // @ts-ignore
34
+ import type { UpdateInvoiceRequest } from '../models/index.js';
35
+ /**
36
+ * InvoicesApi - axios parameter creator
37
+ * @export
38
+ */
39
+ export const InvoicesApiAxiosParamCreator = function (configuration?: Configuration) {
40
+ return {
41
+ /**
42
+ * Cancels a DRAFT invoice. Submitted or accepted invoices cannot be cancelled.
43
+ * @summary Cancel an invoice
44
+ * @param {string} id Invoice UUID
45
+ * @param {*} [options] Override http request option.
46
+ * @throws {RequiredError}
47
+ */
48
+ cancel: async (id: string, options: RawAxiosRequestConfig = {}): Promise<RequestArgs> => {
49
+ // verify required parameter 'id' is not null or undefined
50
+ assertParamExists('cancel', 'id', id)
51
+ const localVarPath = `/v1/invoices/{id}`
52
+ .replace(`{${"id"}}`, encodeURIComponent(String(id)));
53
+ // use dummy base URL string because the URL constructor only accepts absolute URLs.
54
+ const localVarUrlObj = new URL(localVarPath, DUMMY_BASE_URL);
55
+ let baseOptions;
56
+ if (configuration) {
57
+ baseOptions = configuration.baseOptions;
58
+ }
59
+
60
+ const localVarRequestOptions = { method: 'DELETE', ...baseOptions, ...options};
61
+ const localVarHeaderParameter = {} as any;
62
+ const localVarQueryParameter = {} as any;
63
+
64
+ // authentication ApiKeyAuth required
65
+ // http bearer authentication required
66
+ await setBearerAuthToObject(localVarHeaderParameter, configuration)
67
+
68
+
69
+
70
+ setSearchParams(localVarUrlObj, localVarQueryParameter);
71
+ let headersFromBaseOptions = baseOptions && baseOptions.headers ? baseOptions.headers : {};
72
+ localVarRequestOptions.headers = {...localVarHeaderParameter, ...headersFromBaseOptions, ...options.headers};
73
+
74
+ return {
75
+ url: toPathString(localVarUrlObj),
76
+ options: localVarRequestOptions,
77
+ };
78
+ },
79
+ /**
80
+ * Creates a new invoice in DRAFT status for the organization associated with the API key. The invoice is queued for UBL 2.1 generation, XAdES-B-B signing, and DGI clearance.
81
+ * @summary Create an invoice
82
+ * @param {CreateInvoiceRequest} createInvoiceRequest
83
+ * @param {*} [options] Override http request option.
84
+ * @throws {RequiredError}
85
+ */
86
+ create: async (createInvoiceRequest: CreateInvoiceRequest, options: RawAxiosRequestConfig = {}): Promise<RequestArgs> => {
87
+ // verify required parameter 'createInvoiceRequest' is not null or undefined
88
+ assertParamExists('create', 'createInvoiceRequest', createInvoiceRequest)
89
+ const localVarPath = `/v1/invoices`;
90
+ // use dummy base URL string because the URL constructor only accepts absolute URLs.
91
+ const localVarUrlObj = new URL(localVarPath, DUMMY_BASE_URL);
92
+ let baseOptions;
93
+ if (configuration) {
94
+ baseOptions = configuration.baseOptions;
95
+ }
96
+
97
+ const localVarRequestOptions = { method: 'POST', ...baseOptions, ...options};
98
+ const localVarHeaderParameter = {} as any;
99
+ const localVarQueryParameter = {} as any;
100
+
101
+ // authentication ApiKeyAuth required
102
+ // http bearer authentication required
103
+ await setBearerAuthToObject(localVarHeaderParameter, configuration)
104
+
105
+
106
+
107
+ localVarHeaderParameter['Content-Type'] = 'application/json';
108
+
109
+ setSearchParams(localVarUrlObj, localVarQueryParameter);
110
+ let headersFromBaseOptions = baseOptions && baseOptions.headers ? baseOptions.headers : {};
111
+ localVarRequestOptions.headers = {...localVarHeaderParameter, ...headersFromBaseOptions, ...options.headers};
112
+ localVarRequestOptions.data = serializeDataIfNeeded(createInvoiceRequest, localVarRequestOptions, configuration)
113
+
114
+ return {
115
+ url: toPathString(localVarUrlObj),
116
+ options: localVarRequestOptions,
117
+ };
118
+ },
119
+ /**
120
+ * Returns the full invoice by ID. Returns 404 if the invoice does not exist or belongs to a different organization.
121
+ * @summary Get an invoice
122
+ * @param {string} id Invoice UUID
123
+ * @param {*} [options] Override http request option.
124
+ * @throws {RequiredError}
125
+ */
126
+ getById: async (id: string, options: RawAxiosRequestConfig = {}): Promise<RequestArgs> => {
127
+ // verify required parameter 'id' is not null or undefined
128
+ assertParamExists('getById', 'id', id)
129
+ const localVarPath = `/v1/invoices/{id}`
130
+ .replace(`{${"id"}}`, encodeURIComponent(String(id)));
131
+ // use dummy base URL string because the URL constructor only accepts absolute URLs.
132
+ const localVarUrlObj = new URL(localVarPath, DUMMY_BASE_URL);
133
+ let baseOptions;
134
+ if (configuration) {
135
+ baseOptions = configuration.baseOptions;
136
+ }
137
+
138
+ const localVarRequestOptions = { method: 'GET', ...baseOptions, ...options};
139
+ const localVarHeaderParameter = {} as any;
140
+ const localVarQueryParameter = {} as any;
141
+
142
+ // authentication ApiKeyAuth required
143
+ // http bearer authentication required
144
+ await setBearerAuthToObject(localVarHeaderParameter, configuration)
145
+
146
+
147
+
148
+ setSearchParams(localVarUrlObj, localVarQueryParameter);
149
+ let headersFromBaseOptions = baseOptions && baseOptions.headers ? baseOptions.headers : {};
150
+ localVarRequestOptions.headers = {...localVarHeaderParameter, ...headersFromBaseOptions, ...options.headers};
151
+
152
+ return {
153
+ url: toPathString(localVarUrlObj),
154
+ options: localVarRequestOptions,
155
+ };
156
+ },
157
+ /**
158
+ * Returns a lightweight status object for polling DGI clearance progress. Includes DGI reference, QR payload, and any error details.
159
+ * @summary Get invoice status
160
+ * @param {string} id Invoice UUID
161
+ * @param {*} [options] Override http request option.
162
+ * @throws {RequiredError}
163
+ */
164
+ getStatus: async (id: string, options: RawAxiosRequestConfig = {}): Promise<RequestArgs> => {
165
+ // verify required parameter 'id' is not null or undefined
166
+ assertParamExists('getStatus', 'id', id)
167
+ const localVarPath = `/v1/invoices/{id}/status`
168
+ .replace(`{${"id"}}`, encodeURIComponent(String(id)));
169
+ // use dummy base URL string because the URL constructor only accepts absolute URLs.
170
+ const localVarUrlObj = new URL(localVarPath, DUMMY_BASE_URL);
171
+ let baseOptions;
172
+ if (configuration) {
173
+ baseOptions = configuration.baseOptions;
174
+ }
175
+
176
+ const localVarRequestOptions = { method: 'GET', ...baseOptions, ...options};
177
+ const localVarHeaderParameter = {} as any;
178
+ const localVarQueryParameter = {} as any;
179
+
180
+ // authentication ApiKeyAuth required
181
+ // http bearer authentication required
182
+ await setBearerAuthToObject(localVarHeaderParameter, configuration)
183
+
184
+
185
+
186
+ setSearchParams(localVarUrlObj, localVarQueryParameter);
187
+ let headersFromBaseOptions = baseOptions && baseOptions.headers ? baseOptions.headers : {};
188
+ localVarRequestOptions.headers = {...localVarHeaderParameter, ...headersFromBaseOptions, ...options.headers};
189
+
190
+ return {
191
+ url: toPathString(localVarUrlObj),
192
+ options: localVarRequestOptions,
193
+ };
194
+ },
195
+ /**
196
+ * Returns a paginated list of invoices belonging to the organization associated with the API key. Optionally filter by status.
197
+ * @summary List invoices
198
+ * @param {ListStatusEnum} [status] Filter by invoice status
199
+ * @param {number} [page] Zero-based page index (0..N)
200
+ * @param {number} [size] The size of the page to be returned
201
+ * @param {Array<string>} [sort] Sorting criteria in the format: property,(asc|desc). Default sort order is ascending. Multiple sort criteria are supported.
202
+ * @param {*} [options] Override http request option.
203
+ * @throws {RequiredError}
204
+ */
205
+ list: async (status?: ListStatusEnum, page?: number, size?: number, sort?: Array<string>, options: RawAxiosRequestConfig = {}): Promise<RequestArgs> => {
206
+ const localVarPath = `/v1/invoices`;
207
+ // use dummy base URL string because the URL constructor only accepts absolute URLs.
208
+ const localVarUrlObj = new URL(localVarPath, DUMMY_BASE_URL);
209
+ let baseOptions;
210
+ if (configuration) {
211
+ baseOptions = configuration.baseOptions;
212
+ }
213
+
214
+ const localVarRequestOptions = { method: 'GET', ...baseOptions, ...options};
215
+ const localVarHeaderParameter = {} as any;
216
+ const localVarQueryParameter = {} as any;
217
+
218
+ // authentication ApiKeyAuth required
219
+ // http bearer authentication required
220
+ await setBearerAuthToObject(localVarHeaderParameter, configuration)
221
+
222
+ if (status !== undefined) {
223
+ localVarQueryParameter['status'] = status;
224
+ }
225
+
226
+ if (page !== undefined) {
227
+ localVarQueryParameter['page'] = page;
228
+ }
229
+
230
+ if (size !== undefined) {
231
+ localVarQueryParameter['size'] = size;
232
+ }
233
+
234
+ if (sort) {
235
+ localVarQueryParameter['sort'] = sort;
236
+ }
237
+
238
+
239
+
240
+ setSearchParams(localVarUrlObj, localVarQueryParameter);
241
+ let headersFromBaseOptions = baseOptions && baseOptions.headers ? baseOptions.headers : {};
242
+ localVarRequestOptions.headers = {...localVarHeaderParameter, ...headersFromBaseOptions, ...options.headers};
243
+
244
+ return {
245
+ url: toPathString(localVarUrlObj),
246
+ options: localVarRequestOptions,
247
+ };
248
+ },
249
+ /**
250
+ * Updates a DRAFT invoice. Once an invoice has been submitted to DGI it is immutable — update attempts on non-DRAFT invoices return 409.
251
+ * @summary Update an invoice
252
+ * @param {string} id Invoice UUID
253
+ * @param {UpdateInvoiceRequest} updateInvoiceRequest
254
+ * @param {*} [options] Override http request option.
255
+ * @throws {RequiredError}
256
+ */
257
+ update: async (id: string, updateInvoiceRequest: UpdateInvoiceRequest, options: RawAxiosRequestConfig = {}): Promise<RequestArgs> => {
258
+ // verify required parameter 'id' is not null or undefined
259
+ assertParamExists('update', 'id', id)
260
+ // verify required parameter 'updateInvoiceRequest' is not null or undefined
261
+ assertParamExists('update', 'updateInvoiceRequest', updateInvoiceRequest)
262
+ const localVarPath = `/v1/invoices/{id}`
263
+ .replace(`{${"id"}}`, encodeURIComponent(String(id)));
264
+ // use dummy base URL string because the URL constructor only accepts absolute URLs.
265
+ const localVarUrlObj = new URL(localVarPath, DUMMY_BASE_URL);
266
+ let baseOptions;
267
+ if (configuration) {
268
+ baseOptions = configuration.baseOptions;
269
+ }
270
+
271
+ const localVarRequestOptions = { method: 'PUT', ...baseOptions, ...options};
272
+ const localVarHeaderParameter = {} as any;
273
+ const localVarQueryParameter = {} as any;
274
+
275
+ // authentication ApiKeyAuth required
276
+ // http bearer authentication required
277
+ await setBearerAuthToObject(localVarHeaderParameter, configuration)
278
+
279
+
280
+
281
+ localVarHeaderParameter['Content-Type'] = 'application/json';
282
+
283
+ setSearchParams(localVarUrlObj, localVarQueryParameter);
284
+ let headersFromBaseOptions = baseOptions && baseOptions.headers ? baseOptions.headers : {};
285
+ localVarRequestOptions.headers = {...localVarHeaderParameter, ...headersFromBaseOptions, ...options.headers};
286
+ localVarRequestOptions.data = serializeDataIfNeeded(updateInvoiceRequest, localVarRequestOptions, configuration)
287
+
288
+ return {
289
+ url: toPathString(localVarUrlObj),
290
+ options: localVarRequestOptions,
291
+ };
292
+ },
293
+ }
294
+ };
295
+
296
+ /**
297
+ * InvoicesApi - functional programming interface
298
+ * @export
299
+ */
300
+ export const InvoicesApiFp = function(configuration?: Configuration) {
301
+ const localVarAxiosParamCreator = InvoicesApiAxiosParamCreator(configuration)
302
+ return {
303
+ /**
304
+ * Cancels a DRAFT invoice. Submitted or accepted invoices cannot be cancelled.
305
+ * @summary Cancel an invoice
306
+ * @param {string} id Invoice UUID
307
+ * @param {*} [options] Override http request option.
308
+ * @throws {RequiredError}
309
+ */
310
+ async cancel(id: string, options?: RawAxiosRequestConfig): Promise<(axios?: AxiosInstance, basePath?: string) => AxiosPromise<ApiResponseInvoiceResponse>> {
311
+ const localVarAxiosArgs = await localVarAxiosParamCreator.cancel(id, options);
312
+ const localVarOperationServerIndex = configuration?.serverIndex ?? 0;
313
+ const localVarOperationServerBasePath = operationServerMap['InvoicesApi.cancel']?.[localVarOperationServerIndex]?.url;
314
+ return (axios, basePath) => createRequestFunction(localVarAxiosArgs, globalAxios, BASE_PATH, configuration)(axios, localVarOperationServerBasePath || basePath);
315
+ },
316
+ /**
317
+ * Creates a new invoice in DRAFT status for the organization associated with the API key. The invoice is queued for UBL 2.1 generation, XAdES-B-B signing, and DGI clearance.
318
+ * @summary Create an invoice
319
+ * @param {CreateInvoiceRequest} createInvoiceRequest
320
+ * @param {*} [options] Override http request option.
321
+ * @throws {RequiredError}
322
+ */
323
+ async create(createInvoiceRequest: CreateInvoiceRequest, options?: RawAxiosRequestConfig): Promise<(axios?: AxiosInstance, basePath?: string) => AxiosPromise<ApiResponseInvoiceResponse>> {
324
+ const localVarAxiosArgs = await localVarAxiosParamCreator.create(createInvoiceRequest, options);
325
+ const localVarOperationServerIndex = configuration?.serverIndex ?? 0;
326
+ const localVarOperationServerBasePath = operationServerMap['InvoicesApi.create']?.[localVarOperationServerIndex]?.url;
327
+ return (axios, basePath) => createRequestFunction(localVarAxiosArgs, globalAxios, BASE_PATH, configuration)(axios, localVarOperationServerBasePath || basePath);
328
+ },
329
+ /**
330
+ * Returns the full invoice by ID. Returns 404 if the invoice does not exist or belongs to a different organization.
331
+ * @summary Get an invoice
332
+ * @param {string} id Invoice UUID
333
+ * @param {*} [options] Override http request option.
334
+ * @throws {RequiredError}
335
+ */
336
+ async getById(id: string, options?: RawAxiosRequestConfig): Promise<(axios?: AxiosInstance, basePath?: string) => AxiosPromise<ApiResponseInvoiceResponse>> {
337
+ const localVarAxiosArgs = await localVarAxiosParamCreator.getById(id, options);
338
+ const localVarOperationServerIndex = configuration?.serverIndex ?? 0;
339
+ const localVarOperationServerBasePath = operationServerMap['InvoicesApi.getById']?.[localVarOperationServerIndex]?.url;
340
+ return (axios, basePath) => createRequestFunction(localVarAxiosArgs, globalAxios, BASE_PATH, configuration)(axios, localVarOperationServerBasePath || basePath);
341
+ },
342
+ /**
343
+ * Returns a lightweight status object for polling DGI clearance progress. Includes DGI reference, QR payload, and any error details.
344
+ * @summary Get invoice status
345
+ * @param {string} id Invoice UUID
346
+ * @param {*} [options] Override http request option.
347
+ * @throws {RequiredError}
348
+ */
349
+ async getStatus(id: string, options?: RawAxiosRequestConfig): Promise<(axios?: AxiosInstance, basePath?: string) => AxiosPromise<ApiResponseInvoiceStatusResponse>> {
350
+ const localVarAxiosArgs = await localVarAxiosParamCreator.getStatus(id, options);
351
+ const localVarOperationServerIndex = configuration?.serverIndex ?? 0;
352
+ const localVarOperationServerBasePath = operationServerMap['InvoicesApi.getStatus']?.[localVarOperationServerIndex]?.url;
353
+ return (axios, basePath) => createRequestFunction(localVarAxiosArgs, globalAxios, BASE_PATH, configuration)(axios, localVarOperationServerBasePath || basePath);
354
+ },
355
+ /**
356
+ * Returns a paginated list of invoices belonging to the organization associated with the API key. Optionally filter by status.
357
+ * @summary List invoices
358
+ * @param {ListStatusEnum} [status] Filter by invoice status
359
+ * @param {number} [page] Zero-based page index (0..N)
360
+ * @param {number} [size] The size of the page to be returned
361
+ * @param {Array<string>} [sort] Sorting criteria in the format: property,(asc|desc). Default sort order is ascending. Multiple sort criteria are supported.
362
+ * @param {*} [options] Override http request option.
363
+ * @throws {RequiredError}
364
+ */
365
+ async list(status?: ListStatusEnum, page?: number, size?: number, sort?: Array<string>, options?: RawAxiosRequestConfig): Promise<(axios?: AxiosInstance, basePath?: string) => AxiosPromise<ApiResponsePageResponseInvoiceResponse>> {
366
+ const localVarAxiosArgs = await localVarAxiosParamCreator.list(status, page, size, sort, options);
367
+ const localVarOperationServerIndex = configuration?.serverIndex ?? 0;
368
+ const localVarOperationServerBasePath = operationServerMap['InvoicesApi.list']?.[localVarOperationServerIndex]?.url;
369
+ return (axios, basePath) => createRequestFunction(localVarAxiosArgs, globalAxios, BASE_PATH, configuration)(axios, localVarOperationServerBasePath || basePath);
370
+ },
371
+ /**
372
+ * Updates a DRAFT invoice. Once an invoice has been submitted to DGI it is immutable — update attempts on non-DRAFT invoices return 409.
373
+ * @summary Update an invoice
374
+ * @param {string} id Invoice UUID
375
+ * @param {UpdateInvoiceRequest} updateInvoiceRequest
376
+ * @param {*} [options] Override http request option.
377
+ * @throws {RequiredError}
378
+ */
379
+ async update(id: string, updateInvoiceRequest: UpdateInvoiceRequest, options?: RawAxiosRequestConfig): Promise<(axios?: AxiosInstance, basePath?: string) => AxiosPromise<ApiResponseInvoiceResponse>> {
380
+ const localVarAxiosArgs = await localVarAxiosParamCreator.update(id, updateInvoiceRequest, options);
381
+ const localVarOperationServerIndex = configuration?.serverIndex ?? 0;
382
+ const localVarOperationServerBasePath = operationServerMap['InvoicesApi.update']?.[localVarOperationServerIndex]?.url;
383
+ return (axios, basePath) => createRequestFunction(localVarAxiosArgs, globalAxios, BASE_PATH, configuration)(axios, localVarOperationServerBasePath || basePath);
384
+ },
385
+ }
386
+ };
387
+
388
+ /**
389
+ * InvoicesApi - factory interface
390
+ * @export
391
+ */
392
+ export const InvoicesApiFactory = function (configuration?: Configuration, basePath?: string, axios?: AxiosInstance) {
393
+ const localVarFp = InvoicesApiFp(configuration)
394
+ return {
395
+ /**
396
+ * Cancels a DRAFT invoice. Submitted or accepted invoices cannot be cancelled.
397
+ * @summary Cancel an invoice
398
+ * @param {InvoicesApiCancelRequest} requestParameters Request parameters.
399
+ * @param {*} [options] Override http request option.
400
+ * @throws {RequiredError}
401
+ */
402
+ cancel(requestParameters: InvoicesApiCancelRequest, options?: RawAxiosRequestConfig): AxiosPromise<ApiResponseInvoiceResponse> {
403
+ return localVarFp.cancel(requestParameters.id, options).then((request) => request(axios, basePath));
404
+ },
405
+ /**
406
+ * Creates a new invoice in DRAFT status for the organization associated with the API key. The invoice is queued for UBL 2.1 generation, XAdES-B-B signing, and DGI clearance.
407
+ * @summary Create an invoice
408
+ * @param {InvoicesApiCreateRequest} requestParameters Request parameters.
409
+ * @param {*} [options] Override http request option.
410
+ * @throws {RequiredError}
411
+ */
412
+ create(requestParameters: InvoicesApiCreateRequest, options?: RawAxiosRequestConfig): AxiosPromise<ApiResponseInvoiceResponse> {
413
+ return localVarFp.create(requestParameters.createInvoiceRequest, options).then((request) => request(axios, basePath));
414
+ },
415
+ /**
416
+ * Returns the full invoice by ID. Returns 404 if the invoice does not exist or belongs to a different organization.
417
+ * @summary Get an invoice
418
+ * @param {InvoicesApiGetByIdRequest} requestParameters Request parameters.
419
+ * @param {*} [options] Override http request option.
420
+ * @throws {RequiredError}
421
+ */
422
+ getById(requestParameters: InvoicesApiGetByIdRequest, options?: RawAxiosRequestConfig): AxiosPromise<ApiResponseInvoiceResponse> {
423
+ return localVarFp.getById(requestParameters.id, options).then((request) => request(axios, basePath));
424
+ },
425
+ /**
426
+ * Returns a lightweight status object for polling DGI clearance progress. Includes DGI reference, QR payload, and any error details.
427
+ * @summary Get invoice status
428
+ * @param {InvoicesApiGetStatusRequest} requestParameters Request parameters.
429
+ * @param {*} [options] Override http request option.
430
+ * @throws {RequiredError}
431
+ */
432
+ getStatus(requestParameters: InvoicesApiGetStatusRequest, options?: RawAxiosRequestConfig): AxiosPromise<ApiResponseInvoiceStatusResponse> {
433
+ return localVarFp.getStatus(requestParameters.id, options).then((request) => request(axios, basePath));
434
+ },
435
+ /**
436
+ * Returns a paginated list of invoices belonging to the organization associated with the API key. Optionally filter by status.
437
+ * @summary List invoices
438
+ * @param {InvoicesApiListRequest} requestParameters Request parameters.
439
+ * @param {*} [options] Override http request option.
440
+ * @throws {RequiredError}
441
+ */
442
+ list(requestParameters: InvoicesApiListRequest = {}, options?: RawAxiosRequestConfig): AxiosPromise<ApiResponsePageResponseInvoiceResponse> {
443
+ return localVarFp.list(requestParameters.status, requestParameters.page, requestParameters.size, requestParameters.sort, options).then((request) => request(axios, basePath));
444
+ },
445
+ /**
446
+ * Updates a DRAFT invoice. Once an invoice has been submitted to DGI it is immutable — update attempts on non-DRAFT invoices return 409.
447
+ * @summary Update an invoice
448
+ * @param {InvoicesApiUpdateRequest} requestParameters Request parameters.
449
+ * @param {*} [options] Override http request option.
450
+ * @throws {RequiredError}
451
+ */
452
+ update(requestParameters: InvoicesApiUpdateRequest, options?: RawAxiosRequestConfig): AxiosPromise<ApiResponseInvoiceResponse> {
453
+ return localVarFp.update(requestParameters.id, requestParameters.updateInvoiceRequest, options).then((request) => request(axios, basePath));
454
+ },
455
+ };
456
+ };
457
+
458
+ /**
459
+ * Request parameters for cancel operation in InvoicesApi.
460
+ * @export
461
+ * @interface InvoicesApiCancelRequest
462
+ */
463
+ export interface InvoicesApiCancelRequest {
464
+ /**
465
+ * Invoice UUID
466
+ * @type {string}
467
+ * @memberof InvoicesApiCancel
468
+ */
469
+ readonly id: string
470
+ }
471
+
472
+ /**
473
+ * Request parameters for create operation in InvoicesApi.
474
+ * @export
475
+ * @interface InvoicesApiCreateRequest
476
+ */
477
+ export interface InvoicesApiCreateRequest {
478
+ /**
479
+ *
480
+ * @type {CreateInvoiceRequest}
481
+ * @memberof InvoicesApiCreate
482
+ */
483
+ readonly createInvoiceRequest: CreateInvoiceRequest
484
+ }
485
+
486
+ /**
487
+ * Request parameters for getById operation in InvoicesApi.
488
+ * @export
489
+ * @interface InvoicesApiGetByIdRequest
490
+ */
491
+ export interface InvoicesApiGetByIdRequest {
492
+ /**
493
+ * Invoice UUID
494
+ * @type {string}
495
+ * @memberof InvoicesApiGetById
496
+ */
497
+ readonly id: string
498
+ }
499
+
500
+ /**
501
+ * Request parameters for getStatus operation in InvoicesApi.
502
+ * @export
503
+ * @interface InvoicesApiGetStatusRequest
504
+ */
505
+ export interface InvoicesApiGetStatusRequest {
506
+ /**
507
+ * Invoice UUID
508
+ * @type {string}
509
+ * @memberof InvoicesApiGetStatus
510
+ */
511
+ readonly id: string
512
+ }
513
+
514
+ /**
515
+ * Request parameters for list operation in InvoicesApi.
516
+ * @export
517
+ * @interface InvoicesApiListRequest
518
+ */
519
+ export interface InvoicesApiListRequest {
520
+ /**
521
+ * Filter by invoice status
522
+ * @type {'PENDING' | 'SIGNED' | 'TRANSMITTED' | 'ACCEPTED' | 'REJECTED' | 'FAILED' | 'CANCELLED'}
523
+ * @memberof InvoicesApiList
524
+ */
525
+ readonly status?: ListStatusEnum
526
+
527
+ /**
528
+ * Zero-based page index (0..N)
529
+ * @type {number}
530
+ * @memberof InvoicesApiList
531
+ */
532
+ readonly page?: number
533
+
534
+ /**
535
+ * The size of the page to be returned
536
+ * @type {number}
537
+ * @memberof InvoicesApiList
538
+ */
539
+ readonly size?: number
540
+
541
+ /**
542
+ * Sorting criteria in the format: property,(asc|desc). Default sort order is ascending. Multiple sort criteria are supported.
543
+ * @type {Array<string>}
544
+ * @memberof InvoicesApiList
545
+ */
546
+ readonly sort?: Array<string>
547
+ }
548
+
549
+ /**
550
+ * Request parameters for update operation in InvoicesApi.
551
+ * @export
552
+ * @interface InvoicesApiUpdateRequest
553
+ */
554
+ export interface InvoicesApiUpdateRequest {
555
+ /**
556
+ * Invoice UUID
557
+ * @type {string}
558
+ * @memberof InvoicesApiUpdate
559
+ */
560
+ readonly id: string
561
+
562
+ /**
563
+ *
564
+ * @type {UpdateInvoiceRequest}
565
+ * @memberof InvoicesApiUpdate
566
+ */
567
+ readonly updateInvoiceRequest: UpdateInvoiceRequest
568
+ }
569
+
570
+ /**
571
+ * InvoicesApi - object-oriented interface
572
+ * @export
573
+ * @class InvoicesApi
574
+ * @extends {BaseAPI}
575
+ */
576
+ export class InvoicesApi extends BaseAPI {
577
+ /**
578
+ * Cancels a DRAFT invoice. Submitted or accepted invoices cannot be cancelled.
579
+ * @summary Cancel an invoice
580
+ * @param {InvoicesApiCancelRequest} requestParameters Request parameters.
581
+ * @param {*} [options] Override http request option.
582
+ * @throws {RequiredError}
583
+ * @memberof InvoicesApi
584
+ */
585
+ public cancel(requestParameters: InvoicesApiCancelRequest, options?: RawAxiosRequestConfig) {
586
+ return InvoicesApiFp(this.configuration).cancel(requestParameters.id, options).then((request) => request(this.axios, this.basePath));
587
+ }
588
+
589
+ /**
590
+ * Creates a new invoice in DRAFT status for the organization associated with the API key. The invoice is queued for UBL 2.1 generation, XAdES-B-B signing, and DGI clearance.
591
+ * @summary Create an invoice
592
+ * @param {InvoicesApiCreateRequest} requestParameters Request parameters.
593
+ * @param {*} [options] Override http request option.
594
+ * @throws {RequiredError}
595
+ * @memberof InvoicesApi
596
+ */
597
+ public create(requestParameters: InvoicesApiCreateRequest, options?: RawAxiosRequestConfig) {
598
+ return InvoicesApiFp(this.configuration).create(requestParameters.createInvoiceRequest, options).then((request) => request(this.axios, this.basePath));
599
+ }
600
+
601
+ /**
602
+ * Returns the full invoice by ID. Returns 404 if the invoice does not exist or belongs to a different organization.
603
+ * @summary Get an invoice
604
+ * @param {InvoicesApiGetByIdRequest} requestParameters Request parameters.
605
+ * @param {*} [options] Override http request option.
606
+ * @throws {RequiredError}
607
+ * @memberof InvoicesApi
608
+ */
609
+ public getById(requestParameters: InvoicesApiGetByIdRequest, options?: RawAxiosRequestConfig) {
610
+ return InvoicesApiFp(this.configuration).getById(requestParameters.id, options).then((request) => request(this.axios, this.basePath));
611
+ }
612
+
613
+ /**
614
+ * Returns a lightweight status object for polling DGI clearance progress. Includes DGI reference, QR payload, and any error details.
615
+ * @summary Get invoice status
616
+ * @param {InvoicesApiGetStatusRequest} requestParameters Request parameters.
617
+ * @param {*} [options] Override http request option.
618
+ * @throws {RequiredError}
619
+ * @memberof InvoicesApi
620
+ */
621
+ public getStatus(requestParameters: InvoicesApiGetStatusRequest, options?: RawAxiosRequestConfig) {
622
+ return InvoicesApiFp(this.configuration).getStatus(requestParameters.id, options).then((request) => request(this.axios, this.basePath));
623
+ }
624
+
625
+ /**
626
+ * Returns a paginated list of invoices belonging to the organization associated with the API key. Optionally filter by status.
627
+ * @summary List invoices
628
+ * @param {InvoicesApiListRequest} requestParameters Request parameters.
629
+ * @param {*} [options] Override http request option.
630
+ * @throws {RequiredError}
631
+ * @memberof InvoicesApi
632
+ */
633
+ public list(requestParameters: InvoicesApiListRequest = {}, options?: RawAxiosRequestConfig) {
634
+ return InvoicesApiFp(this.configuration).list(requestParameters.status, requestParameters.page, requestParameters.size, requestParameters.sort, options).then((request) => request(this.axios, this.basePath));
635
+ }
636
+
637
+ /**
638
+ * Updates a DRAFT invoice. Once an invoice has been submitted to DGI it is immutable — update attempts on non-DRAFT invoices return 409.
639
+ * @summary Update an invoice
640
+ * @param {InvoicesApiUpdateRequest} requestParameters Request parameters.
641
+ * @param {*} [options] Override http request option.
642
+ * @throws {RequiredError}
643
+ * @memberof InvoicesApi
644
+ */
645
+ public update(requestParameters: InvoicesApiUpdateRequest, options?: RawAxiosRequestConfig) {
646
+ return InvoicesApiFp(this.configuration).update(requestParameters.id, requestParameters.updateInvoiceRequest, options).then((request) => request(this.axios, this.basePath));
647
+ }
648
+ }
649
+
650
+ /**
651
+ * @export
652
+ */
653
+ export const ListStatusEnum = {
654
+ Pending: 'PENDING',
655
+ Signed: 'SIGNED',
656
+ Transmitted: 'TRANSMITTED',
657
+ Accepted: 'ACCEPTED',
658
+ Rejected: 'REJECTED',
659
+ Failed: 'FAILED',
660
+ Cancelled: 'CANCELLED'
661
+ } as const;
662
+ export type ListStatusEnum = typeof ListStatusEnum[keyof typeof ListStatusEnum];
@@ -0,0 +1,19 @@
1
+ // @ts-nocheck
2
+ /* tslint:disable */
3
+ /* eslint-disable */
4
+ /**
5
+ * EFact API
6
+ * Compliance-as-a-service backend for Moroccan DGI electronic invoicing
7
+ *
8
+ * The version of the OpenAPI document: v0.0.1-SNAPSHOT
9
+ * Contact: contact@itzenata.com
10
+ *
11
+ * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech).
12
+ * https://openapi-generator.tech
13
+ * Do not edit the class manually.
14
+ */
15
+
16
+
17
+
18
+ export * from './api/invoices-api.js';
19
+