@facturino/node 1.0.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/LICENSE +21 -0
- package/README.md +204 -0
- package/dist/cjs/client.d.ts +24 -0
- package/dist/cjs/client.js +203 -0
- package/dist/cjs/errors.d.ts +76 -0
- package/dist/cjs/errors.js +128 -0
- package/dist/cjs/index.d.ts +59 -0
- package/dist/cjs/index.js +77 -0
- package/dist/cjs/package.json +3 -0
- package/dist/cjs/pagination.d.ts +24 -0
- package/dist/cjs/pagination.js +68 -0
- package/dist/cjs/resources/account.d.ts +58 -0
- package/dist/cjs/resources/account.js +48 -0
- package/dist/cjs/resources/archives.d.ts +16 -0
- package/dist/cjs/resources/archives.js +17 -0
- package/dist/cjs/resources/billing.d.ts +30 -0
- package/dist/cjs/resources/billing.js +45 -0
- package/dist/cjs/resources/companies.d.ts +47 -0
- package/dist/cjs/resources/companies.js +45 -0
- package/dist/cjs/resources/creditNotes.d.ts +64 -0
- package/dist/cjs/resources/creditNotes.js +62 -0
- package/dist/cjs/resources/customers.d.ts +17 -0
- package/dist/cjs/resources/customers.js +36 -0
- package/dist/cjs/resources/ereporting.d.ts +12 -0
- package/dist/cjs/resources/ereporting.js +23 -0
- package/dist/cjs/resources/events.d.ts +11 -0
- package/dist/cjs/resources/events.js +20 -0
- package/dist/cjs/resources/exports.d.ts +20 -0
- package/dist/cjs/resources/exports.js +31 -0
- package/dist/cjs/resources/health.d.ts +13 -0
- package/dist/cjs/resources/health.js +18 -0
- package/dist/cjs/resources/invoices.d.ts +112 -0
- package/dist/cjs/resources/invoices.js +141 -0
- package/dist/cjs/resources/jobs.d.ts +10 -0
- package/dist/cjs/resources/jobs.js +24 -0
- package/dist/cjs/resources/payments.d.ts +16 -0
- package/dist/cjs/resources/payments.js +25 -0
- package/dist/cjs/resources/products.d.ts +15 -0
- package/dist/cjs/resources/products.js +32 -0
- package/dist/cjs/resources/quotes.d.ts +44 -0
- package/dist/cjs/resources/quotes.js +58 -0
- package/dist/cjs/resources/received-invoices.d.ts +14 -0
- package/dist/cjs/resources/received-invoices.js +29 -0
- package/dist/cjs/resources/recurringInvoices.d.ts +15 -0
- package/dist/cjs/resources/recurringInvoices.js +32 -0
- package/dist/cjs/resources/reference.d.ts +45 -0
- package/dist/cjs/resources/reference.js +57 -0
- package/dist/cjs/resources/reporting.d.ts +11 -0
- package/dist/cjs/resources/reporting.js +30 -0
- package/dist/cjs/resources/sandbox.d.ts +12 -0
- package/dist/cjs/resources/sandbox.js +21 -0
- package/dist/cjs/resources/usage.d.ts +20 -0
- package/dist/cjs/resources/usage.js +25 -0
- package/dist/cjs/resources/validate.d.ts +18 -0
- package/dist/cjs/resources/validate.js +23 -0
- package/dist/cjs/resources/webhookEndpoints.d.ts +20 -0
- package/dist/cjs/resources/webhookEndpoints.js +31 -0
- package/dist/cjs/types.d.ts +1178 -0
- package/dist/cjs/types.js +5 -0
- package/dist/cjs/webhooks.d.ts +14 -0
- package/dist/cjs/webhooks.js +63 -0
- package/dist/esm/client.d.ts +25 -0
- package/dist/esm/client.d.ts.map +1 -0
- package/dist/esm/client.js +200 -0
- package/dist/esm/client.js.map +1 -0
- package/dist/esm/errors.d.ts +77 -0
- package/dist/esm/errors.d.ts.map +1 -0
- package/dist/esm/errors.js +114 -0
- package/dist/esm/errors.js.map +1 -0
- package/dist/esm/index.d.ts +60 -0
- package/dist/esm/index.d.ts.map +1 -0
- package/dist/esm/index.js +61 -0
- package/dist/esm/index.js.map +1 -0
- package/dist/esm/pagination.d.ts +25 -0
- package/dist/esm/pagination.d.ts.map +1 -0
- package/dist/esm/pagination.js +65 -0
- package/dist/esm/pagination.js.map +1 -0
- package/dist/esm/resources/account.d.ts +59 -0
- package/dist/esm/resources/account.d.ts.map +1 -0
- package/dist/esm/resources/account.js +45 -0
- package/dist/esm/resources/account.js.map +1 -0
- package/dist/esm/resources/archives.d.ts +17 -0
- package/dist/esm/resources/archives.d.ts.map +1 -0
- package/dist/esm/resources/archives.js +14 -0
- package/dist/esm/resources/archives.js.map +1 -0
- package/dist/esm/resources/billing.d.ts +31 -0
- package/dist/esm/resources/billing.d.ts.map +1 -0
- package/dist/esm/resources/billing.js +42 -0
- package/dist/esm/resources/billing.js.map +1 -0
- package/dist/esm/resources/companies.d.ts +48 -0
- package/dist/esm/resources/companies.d.ts.map +1 -0
- package/dist/esm/resources/companies.js +42 -0
- package/dist/esm/resources/companies.js.map +1 -0
- package/dist/esm/resources/creditNotes.d.ts +65 -0
- package/dist/esm/resources/creditNotes.d.ts.map +1 -0
- package/dist/esm/resources/creditNotes.js +59 -0
- package/dist/esm/resources/creditNotes.js.map +1 -0
- package/dist/esm/resources/customers.d.ts +18 -0
- package/dist/esm/resources/customers.d.ts.map +1 -0
- package/dist/esm/resources/customers.js +33 -0
- package/dist/esm/resources/customers.js.map +1 -0
- package/dist/esm/resources/ereporting.d.ts +13 -0
- package/dist/esm/resources/ereporting.d.ts.map +1 -0
- package/dist/esm/resources/ereporting.js +20 -0
- package/dist/esm/resources/ereporting.js.map +1 -0
- package/dist/esm/resources/events.d.ts +12 -0
- package/dist/esm/resources/events.d.ts.map +1 -0
- package/dist/esm/resources/events.js +17 -0
- package/dist/esm/resources/events.js.map +1 -0
- package/dist/esm/resources/exports.d.ts +21 -0
- package/dist/esm/resources/exports.d.ts.map +1 -0
- package/dist/esm/resources/exports.js +28 -0
- package/dist/esm/resources/exports.js.map +1 -0
- package/dist/esm/resources/health.d.ts +14 -0
- package/dist/esm/resources/health.d.ts.map +1 -0
- package/dist/esm/resources/health.js +15 -0
- package/dist/esm/resources/health.js.map +1 -0
- package/dist/esm/resources/invoices.d.ts +113 -0
- package/dist/esm/resources/invoices.d.ts.map +1 -0
- package/dist/esm/resources/invoices.js +138 -0
- package/dist/esm/resources/invoices.js.map +1 -0
- package/dist/esm/resources/jobs.d.ts +11 -0
- package/dist/esm/resources/jobs.d.ts.map +1 -0
- package/dist/esm/resources/jobs.js +21 -0
- package/dist/esm/resources/jobs.js.map +1 -0
- package/dist/esm/resources/payments.d.ts +17 -0
- package/dist/esm/resources/payments.d.ts.map +1 -0
- package/dist/esm/resources/payments.js +22 -0
- package/dist/esm/resources/payments.js.map +1 -0
- package/dist/esm/resources/products.d.ts +16 -0
- package/dist/esm/resources/products.d.ts.map +1 -0
- package/dist/esm/resources/products.js +29 -0
- package/dist/esm/resources/products.js.map +1 -0
- package/dist/esm/resources/quotes.d.ts +45 -0
- package/dist/esm/resources/quotes.d.ts.map +1 -0
- package/dist/esm/resources/quotes.js +55 -0
- package/dist/esm/resources/quotes.js.map +1 -0
- package/dist/esm/resources/received-invoices.d.ts +15 -0
- package/dist/esm/resources/received-invoices.d.ts.map +1 -0
- package/dist/esm/resources/received-invoices.js +26 -0
- package/dist/esm/resources/received-invoices.js.map +1 -0
- package/dist/esm/resources/recurringInvoices.d.ts +16 -0
- package/dist/esm/resources/recurringInvoices.d.ts.map +1 -0
- package/dist/esm/resources/recurringInvoices.js +29 -0
- package/dist/esm/resources/recurringInvoices.js.map +1 -0
- package/dist/esm/resources/reference.d.ts +46 -0
- package/dist/esm/resources/reference.d.ts.map +1 -0
- package/dist/esm/resources/reference.js +54 -0
- package/dist/esm/resources/reference.js.map +1 -0
- package/dist/esm/resources/reporting.d.ts +12 -0
- package/dist/esm/resources/reporting.d.ts.map +1 -0
- package/dist/esm/resources/reporting.js +27 -0
- package/dist/esm/resources/reporting.js.map +1 -0
- package/dist/esm/resources/sandbox.d.ts +13 -0
- package/dist/esm/resources/sandbox.d.ts.map +1 -0
- package/dist/esm/resources/sandbox.js +18 -0
- package/dist/esm/resources/sandbox.js.map +1 -0
- package/dist/esm/resources/usage.d.ts +21 -0
- package/dist/esm/resources/usage.d.ts.map +1 -0
- package/dist/esm/resources/usage.js +22 -0
- package/dist/esm/resources/usage.js.map +1 -0
- package/dist/esm/resources/validate.d.ts +19 -0
- package/dist/esm/resources/validate.d.ts.map +1 -0
- package/dist/esm/resources/validate.js +20 -0
- package/dist/esm/resources/validate.js.map +1 -0
- package/dist/esm/resources/webhookEndpoints.d.ts +21 -0
- package/dist/esm/resources/webhookEndpoints.d.ts.map +1 -0
- package/dist/esm/resources/webhookEndpoints.js +28 -0
- package/dist/esm/resources/webhookEndpoints.js.map +1 -0
- package/dist/esm/types.d.ts +1179 -0
- package/dist/esm/types.d.ts.map +1 -0
- package/dist/esm/types.js +5 -0
- package/dist/esm/types.js.map +1 -0
- package/dist/esm/webhooks.d.ts +15 -0
- package/dist/esm/webhooks.d.ts.map +1 -0
- package/dist/esm/webhooks.js +60 -0
- package/dist/esm/webhooks.js.map +1 -0
- package/package.json +66 -0
|
@@ -0,0 +1,62 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.CreditNotes = void 0;
|
|
4
|
+
const pagination_js_1 = require("../pagination.js");
|
|
5
|
+
/** Credit note operations — the legal way to correct or cancel a finalized invoice. */
|
|
6
|
+
class CreditNotes {
|
|
7
|
+
constructor(client) {
|
|
8
|
+
this.client = client;
|
|
9
|
+
}
|
|
10
|
+
async create(params, options) {
|
|
11
|
+
return this.client.post('/v1/credit-notes', params, options);
|
|
12
|
+
}
|
|
13
|
+
list(params) {
|
|
14
|
+
return new pagination_js_1.AutoPaginatingList(this.client, '/v1/credit-notes', params);
|
|
15
|
+
}
|
|
16
|
+
async get(id) {
|
|
17
|
+
return this.client.get(`/v1/credit-notes/${id}`);
|
|
18
|
+
}
|
|
19
|
+
async update(id, params) {
|
|
20
|
+
return this.client.patch(`/v1/credit-notes/${id}`, params);
|
|
21
|
+
}
|
|
22
|
+
async del(id) {
|
|
23
|
+
await this.client.del(`/v1/credit-notes/${id}`);
|
|
24
|
+
}
|
|
25
|
+
/** Assign number and lock. Irreversible. */
|
|
26
|
+
async finalize(id, options) {
|
|
27
|
+
return this.client.post(`/v1/credit-notes/${id}/finalize`, undefined, options);
|
|
28
|
+
}
|
|
29
|
+
/** Submit to PA. */
|
|
30
|
+
async send(id, options) {
|
|
31
|
+
return this.client.post(`/v1/credit-notes/${id}/send`, undefined, options);
|
|
32
|
+
}
|
|
33
|
+
/**
|
|
34
|
+
* Send the credit note to its customer by email with the PDF (and optional
|
|
35
|
+
* Factur-X XML) attached. Returns `{status: 'sent'}` on success or
|
|
36
|
+
* `{status: 'pending'}` if the PDF is still being generated.
|
|
37
|
+
*/
|
|
38
|
+
async email(id, params, options) {
|
|
39
|
+
return this.client.post(`/v1/credit-notes/${id}/email`, params, options);
|
|
40
|
+
}
|
|
41
|
+
/**
|
|
42
|
+
* Record the disbursement of a finalized credit note back to the customer.
|
|
43
|
+
* Writes a negative `refund` payment on the linked invoice (mirrors the app).
|
|
44
|
+
* `amount` is in integer centimes and defaults to the full credit-note total.
|
|
45
|
+
*/
|
|
46
|
+
async refund(id, params, options) {
|
|
47
|
+
return this.client.post(`/v1/credit-notes/${id}/refund`, params, options);
|
|
48
|
+
}
|
|
49
|
+
async getPdf(id) {
|
|
50
|
+
return this.client.get(`/v1/credit-notes/${id}/pdf`);
|
|
51
|
+
}
|
|
52
|
+
/** Factur-X PDF/A-3 with embedded XML. URL or async job. */
|
|
53
|
+
async getFacturx(id) {
|
|
54
|
+
return this.client.get(`/v1/credit-notes/${id}/facturx`);
|
|
55
|
+
}
|
|
56
|
+
/** Raw CII or UBL XML. */
|
|
57
|
+
async getXml(id, format) {
|
|
58
|
+
const query = format ? `?format=${format}` : '';
|
|
59
|
+
return this.client.get(`/v1/credit-notes/${id}/xml${query}`);
|
|
60
|
+
}
|
|
61
|
+
}
|
|
62
|
+
exports.CreditNotes = CreditNotes;
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
import type { HttpClient } from '../client.js';
|
|
2
|
+
import { AutoPaginatingList } from '../pagination.js';
|
|
3
|
+
import type { Customer, CustomerCreateParams, CustomerUpdateParams, CustomerListParams, CustomerLookupParams, SireneLookupResponse, JobResponse, RequestOptions } from '../types.js';
|
|
4
|
+
/** CRUD operations on customers, with SIRENE lookup and CSV import/export. */
|
|
5
|
+
export declare class Customers {
|
|
6
|
+
private readonly client;
|
|
7
|
+
constructor(client: HttpClient);
|
|
8
|
+
create(params: CustomerCreateParams, options?: RequestOptions): Promise<Customer>;
|
|
9
|
+
list(params?: CustomerListParams): AutoPaginatingList<Customer>;
|
|
10
|
+
get(id: string): Promise<Customer>;
|
|
11
|
+
update(id: string, params: CustomerUpdateParams): Promise<Customer>;
|
|
12
|
+
del(id: string): Promise<void>;
|
|
13
|
+
/** Sirene lookup by SIRET or name. */
|
|
14
|
+
lookup(params: CustomerLookupParams): Promise<SireneLookupResponse>;
|
|
15
|
+
importCsv(csv: string, options?: RequestOptions): Promise<JobResponse>;
|
|
16
|
+
exportCsv(): Promise<JobResponse>;
|
|
17
|
+
}
|
|
@@ -0,0 +1,36 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.Customers = void 0;
|
|
4
|
+
const pagination_js_1 = require("../pagination.js");
|
|
5
|
+
/** CRUD operations on customers, with SIRENE lookup and CSV import/export. */
|
|
6
|
+
class Customers {
|
|
7
|
+
constructor(client) {
|
|
8
|
+
this.client = client;
|
|
9
|
+
}
|
|
10
|
+
async create(params, options) {
|
|
11
|
+
return this.client.post('/v1/customers', params, options);
|
|
12
|
+
}
|
|
13
|
+
list(params) {
|
|
14
|
+
return new pagination_js_1.AutoPaginatingList(this.client, '/v1/customers', params);
|
|
15
|
+
}
|
|
16
|
+
async get(id) {
|
|
17
|
+
return this.client.get(`/v1/customers/${id}`);
|
|
18
|
+
}
|
|
19
|
+
async update(id, params) {
|
|
20
|
+
return this.client.patch(`/v1/customers/${id}`, params);
|
|
21
|
+
}
|
|
22
|
+
async del(id) {
|
|
23
|
+
await this.client.del(`/v1/customers/${id}`);
|
|
24
|
+
}
|
|
25
|
+
/** Sirene lookup by SIRET or name. */
|
|
26
|
+
async lookup(params) {
|
|
27
|
+
return this.client.post('/v1/customers/lookup', params);
|
|
28
|
+
}
|
|
29
|
+
async importCsv(csv, options) {
|
|
30
|
+
return this.client.post('/v1/customers/import', { csv }, options);
|
|
31
|
+
}
|
|
32
|
+
async exportCsv() {
|
|
33
|
+
return this.client.get('/v1/customers/export');
|
|
34
|
+
}
|
|
35
|
+
}
|
|
36
|
+
exports.Customers = Customers;
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
import type { HttpClient } from '../client.js';
|
|
2
|
+
import { AutoPaginatingList } from '../pagination.js';
|
|
3
|
+
import type { EReporting, EReportingCreateParams, EReportingListParams, RequestOptions } from '../types.js';
|
|
4
|
+
/** E-reporting declarations for B2C and international transactions (art. 290 CGI). */
|
|
5
|
+
export declare class EReportingResource {
|
|
6
|
+
private readonly client;
|
|
7
|
+
constructor(client: HttpClient);
|
|
8
|
+
createDeclaration(params: EReportingCreateParams, options?: RequestOptions): Promise<EReporting>;
|
|
9
|
+
list(params?: EReportingListParams): AutoPaginatingList<EReporting>;
|
|
10
|
+
get(id: string): Promise<EReporting>;
|
|
11
|
+
submitDeclaration(id: string, options?: RequestOptions): Promise<EReporting>;
|
|
12
|
+
}
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.EReportingResource = void 0;
|
|
4
|
+
const pagination_js_1 = require("../pagination.js");
|
|
5
|
+
/** E-reporting declarations for B2C and international transactions (art. 290 CGI). */
|
|
6
|
+
class EReportingResource {
|
|
7
|
+
constructor(client) {
|
|
8
|
+
this.client = client;
|
|
9
|
+
}
|
|
10
|
+
async createDeclaration(params, options) {
|
|
11
|
+
return this.client.post('/v1/ereporting/declarations', params, options);
|
|
12
|
+
}
|
|
13
|
+
list(params) {
|
|
14
|
+
return new pagination_js_1.AutoPaginatingList(this.client, '/v1/ereporting/declarations', params);
|
|
15
|
+
}
|
|
16
|
+
async get(id) {
|
|
17
|
+
return this.client.get(`/v1/ereporting/declarations/${id}`);
|
|
18
|
+
}
|
|
19
|
+
async submitDeclaration(id, options) {
|
|
20
|
+
return this.client.post(`/v1/ereporting/declarations/${id}/submit`, undefined, options);
|
|
21
|
+
}
|
|
22
|
+
}
|
|
23
|
+
exports.EReportingResource = EReportingResource;
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
import type { HttpClient } from '../client.js';
|
|
2
|
+
import { AutoPaginatingList } from '../pagination.js';
|
|
3
|
+
import type { WebhookEvent, EventListParams } from '../types.js';
|
|
4
|
+
/** Webhook event log — list, inspect, and retry delivery of past events. */
|
|
5
|
+
export declare class Events {
|
|
6
|
+
private readonly client;
|
|
7
|
+
constructor(client: HttpClient);
|
|
8
|
+
list(params?: EventListParams): AutoPaginatingList<WebhookEvent>;
|
|
9
|
+
get(id: string): Promise<WebhookEvent>;
|
|
10
|
+
retry(id: string): Promise<WebhookEvent>;
|
|
11
|
+
}
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.Events = void 0;
|
|
4
|
+
const pagination_js_1 = require("../pagination.js");
|
|
5
|
+
/** Webhook event log — list, inspect, and retry delivery of past events. */
|
|
6
|
+
class Events {
|
|
7
|
+
constructor(client) {
|
|
8
|
+
this.client = client;
|
|
9
|
+
}
|
|
10
|
+
list(params) {
|
|
11
|
+
return new pagination_js_1.AutoPaginatingList(this.client, '/v1/events', params);
|
|
12
|
+
}
|
|
13
|
+
async get(id) {
|
|
14
|
+
return this.client.get(`/v1/events/${id}`);
|
|
15
|
+
}
|
|
16
|
+
async retry(id) {
|
|
17
|
+
return this.client.post(`/v1/events/${id}/retry`);
|
|
18
|
+
}
|
|
19
|
+
}
|
|
20
|
+
exports.Events = Events;
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
import type { HttpClient } from '../client.js';
|
|
2
|
+
import type { FecExportParams, InvoiceExportParams, JobResponse, RequestOptions } from '../types.js';
|
|
3
|
+
/**
|
|
4
|
+
* Data exports — FEC accounting files and the invoices ZIP. For RGPD data
|
|
5
|
+
* portability (art. 20), use `account.requestExport`.
|
|
6
|
+
*/
|
|
7
|
+
export declare class Exports {
|
|
8
|
+
private readonly client;
|
|
9
|
+
constructor(client: HttpClient);
|
|
10
|
+
/** Async FEC generation (art. A.47 A-1 LPF). Pro/Cabinet plan. */
|
|
11
|
+
generateFec(params?: FecExportParams, options?: RequestOptions): Promise<JobResponse>;
|
|
12
|
+
getFecStatus(jobId: string): Promise<JobResponse>;
|
|
13
|
+
getExportStatus(jobId: string): Promise<JobResponse>;
|
|
14
|
+
/**
|
|
15
|
+
* Bulk export finalized invoices as a ZIP (Factur-X PDF + CII XML per invoice).
|
|
16
|
+
* Available on all plans. Optionally filter by issue-date period and/or
|
|
17
|
+
* lifecycle statuses; with no params, every non-draft invoice is exported.
|
|
18
|
+
*/
|
|
19
|
+
exportInvoices(params?: InvoiceExportParams, options?: RequestOptions): Promise<JobResponse>;
|
|
20
|
+
}
|
|
@@ -0,0 +1,31 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.Exports = void 0;
|
|
4
|
+
/**
|
|
5
|
+
* Data exports — FEC accounting files and the invoices ZIP. For RGPD data
|
|
6
|
+
* portability (art. 20), use `account.requestExport`.
|
|
7
|
+
*/
|
|
8
|
+
class Exports {
|
|
9
|
+
constructor(client) {
|
|
10
|
+
this.client = client;
|
|
11
|
+
}
|
|
12
|
+
/** Async FEC generation (art. A.47 A-1 LPF). Pro/Cabinet plan. */
|
|
13
|
+
async generateFec(params, options) {
|
|
14
|
+
return this.client.post('/v1/exports/fec', params ?? {}, options);
|
|
15
|
+
}
|
|
16
|
+
async getFecStatus(jobId) {
|
|
17
|
+
return this.client.get(`/v1/exports/fec/${jobId}`);
|
|
18
|
+
}
|
|
19
|
+
async getExportStatus(jobId) {
|
|
20
|
+
return this.client.get(`/v1/exports/${jobId}`);
|
|
21
|
+
}
|
|
22
|
+
/**
|
|
23
|
+
* Bulk export finalized invoices as a ZIP (Factur-X PDF + CII XML per invoice).
|
|
24
|
+
* Available on all plans. Optionally filter by issue-date period and/or
|
|
25
|
+
* lifecycle statuses; with no params, every non-draft invoice is exported.
|
|
26
|
+
*/
|
|
27
|
+
async exportInvoices(params, options) {
|
|
28
|
+
return this.client.post('/v1/exports/invoices', params ?? {}, options);
|
|
29
|
+
}
|
|
30
|
+
}
|
|
31
|
+
exports.Exports = Exports;
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
import type { HttpClient } from '../client.js';
|
|
2
|
+
import type { HealthStatus } from '../types.js';
|
|
3
|
+
/**
|
|
4
|
+
* Health — lightweight liveness probe for the Facturino API. Returns the
|
|
5
|
+
* service status and the API version; handy for uptime checks and to confirm
|
|
6
|
+
* an API key reaches the platform before running real traffic.
|
|
7
|
+
*/
|
|
8
|
+
export declare class Health {
|
|
9
|
+
private readonly client;
|
|
10
|
+
constructor(client: HttpClient);
|
|
11
|
+
/** Return the current service health snapshot (`GET /v1/health`). */
|
|
12
|
+
check(): Promise<HealthStatus>;
|
|
13
|
+
}
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.Health = void 0;
|
|
4
|
+
/**
|
|
5
|
+
* Health — lightweight liveness probe for the Facturino API. Returns the
|
|
6
|
+
* service status and the API version; handy for uptime checks and to confirm
|
|
7
|
+
* an API key reaches the platform before running real traffic.
|
|
8
|
+
*/
|
|
9
|
+
class Health {
|
|
10
|
+
constructor(client) {
|
|
11
|
+
this.client = client;
|
|
12
|
+
}
|
|
13
|
+
/** Return the current service health snapshot (`GET /v1/health`). */
|
|
14
|
+
async check() {
|
|
15
|
+
return this.client.get('/v1/health');
|
|
16
|
+
}
|
|
17
|
+
}
|
|
18
|
+
exports.Health = Health;
|
|
@@ -0,0 +1,112 @@
|
|
|
1
|
+
import type { HttpClient } from '../client.js';
|
|
2
|
+
import { AutoPaginatingList } from '../pagination.js';
|
|
3
|
+
import { Payments } from './payments.js';
|
|
4
|
+
import type { Invoice, InvoiceCreateParams, InvoiceUpdateParams, InvoiceListParams, InvoiceRetrieveParams, InvoiceStatusResponse, InvoiceVerifyResponse, DocumentUrlResponse, JobResponse, PaymentLinkResponse, PaymentLinkCreateParams, PaymentTokenResponse, PaginatedResponse, LifecycleEntry, IncomingInvoiceCreateParams, ReceivedInvoice, RequestOptions } from '../types.js';
|
|
5
|
+
/** Manages invoice lifecycle — creation, finalization, sending, and document retrieval. */
|
|
6
|
+
export declare class Invoices {
|
|
7
|
+
private readonly client;
|
|
8
|
+
readonly payments: Payments;
|
|
9
|
+
constructor(client: HttpClient);
|
|
10
|
+
create(params: InvoiceCreateParams, options?: RequestOptions): Promise<Invoice>;
|
|
11
|
+
list(params?: InvoiceListParams): AutoPaginatingList<Invoice>;
|
|
12
|
+
/**
|
|
13
|
+
* Retrieve an invoice. Pass `expand` to inline related objects in the
|
|
14
|
+
* response under `invoice.expanded` — `customer`, `items.product`, and
|
|
15
|
+
* `credit_notes`. With `credit_notes`, the response also carries
|
|
16
|
+
* `expanded.net_balance` (TTC minus credited amounts, in integer cents).
|
|
17
|
+
*/
|
|
18
|
+
get(id: string, params?: InvoiceRetrieveParams): Promise<Invoice>;
|
|
19
|
+
update(id: string, params: InvoiceUpdateParams): Promise<Invoice>;
|
|
20
|
+
/** Soft-delete (draft only). */
|
|
21
|
+
del(id: string): Promise<void>;
|
|
22
|
+
/** Assign number and lock. Irreversible. */
|
|
23
|
+
finalize(id: string, options?: RequestOptions): Promise<Invoice>;
|
|
24
|
+
/** Submit to PA. Returns 202 (async). */
|
|
25
|
+
send(id: string, options?: RequestOptions): Promise<{
|
|
26
|
+
id: string;
|
|
27
|
+
object: 'invoice';
|
|
28
|
+
status: string;
|
|
29
|
+
}>;
|
|
30
|
+
/**
|
|
31
|
+
* Send a finalized invoice by email with PDF (and optionally XML) attached.
|
|
32
|
+
* Returns `{status: 'sent'}` on success or `{status: 'pending'}` if the PDF
|
|
33
|
+
* is still being generated (caller should poll the returned `jobId`).
|
|
34
|
+
*/
|
|
35
|
+
email(id: string, params?: {
|
|
36
|
+
recipientEmail?: string;
|
|
37
|
+
customMessage?: string;
|
|
38
|
+
includeXml?: boolean;
|
|
39
|
+
customSubject?: string;
|
|
40
|
+
}, options?: RequestOptions): Promise<{
|
|
41
|
+
status: 'sent';
|
|
42
|
+
invoiceId: string;
|
|
43
|
+
recipient: string;
|
|
44
|
+
sentAt: string;
|
|
45
|
+
} | {
|
|
46
|
+
status: 'pending';
|
|
47
|
+
invoiceId: string;
|
|
48
|
+
jobId: string;
|
|
49
|
+
pollUrl: string;
|
|
50
|
+
reason: string;
|
|
51
|
+
}>;
|
|
52
|
+
/**
|
|
53
|
+
* Cancel a DRAFT invoice (status `draft` only). This soft-deletes the
|
|
54
|
+
* draft and returns `{ id, object: 'invoice', deleted: true }`. Finalized
|
|
55
|
+
* invoices are immutable under French law (CGI art. 289) — use
|
|
56
|
+
* `creditNotes.create()` to refund or correct a finalized invoice.
|
|
57
|
+
*
|
|
58
|
+
* @throws {FacturinoError} when called on a non-draft invoice (API returns 400)
|
|
59
|
+
*/
|
|
60
|
+
cancel(id: string, options?: RequestOptions): Promise<{
|
|
61
|
+
id: string;
|
|
62
|
+
object: 'invoice';
|
|
63
|
+
deleted: true;
|
|
64
|
+
}>;
|
|
65
|
+
remind(id: string, options?: RequestOptions): Promise<{
|
|
66
|
+
id: string;
|
|
67
|
+
object: 'invoice';
|
|
68
|
+
reminder_sent: boolean;
|
|
69
|
+
}>;
|
|
70
|
+
/** Clone as new draft. */
|
|
71
|
+
clone(id: string, options?: RequestOptions): Promise<Invoice>;
|
|
72
|
+
/** Signed download URL, or async job if generation needed. */
|
|
73
|
+
getPdf(id: string, template?: string): Promise<DocumentUrlResponse | JobResponse>;
|
|
74
|
+
/** Factur-X PDF/A-3 with embedded XML. URL or async job. */
|
|
75
|
+
getFacturx(id: string, template?: string): Promise<DocumentUrlResponse | JobResponse>;
|
|
76
|
+
/** Raw CII or UBL XML. */
|
|
77
|
+
getXml(id: string, format?: 'cii' | 'ubl'): Promise<string>;
|
|
78
|
+
getStatus(id: string): Promise<InvoiceStatusResponse>;
|
|
79
|
+
/** Verify archive hash chain integrity. */
|
|
80
|
+
verify(id: string): Promise<InvoiceVerifyResponse>;
|
|
81
|
+
listEvents(id: string): Promise<PaginatedResponse<LifecycleEntry>>;
|
|
82
|
+
getAuditTrail(id: string, params?: {
|
|
83
|
+
limit?: number;
|
|
84
|
+
starting_after?: string;
|
|
85
|
+
action?: string;
|
|
86
|
+
}): Promise<PaginatedResponse<Record<string, unknown>>>;
|
|
87
|
+
/** Async audit trail PDF generation. */
|
|
88
|
+
generateAuditTrailPdf(id: string, options?: RequestOptions): Promise<JobResponse>;
|
|
89
|
+
/** Stripe payment link (Pro plan). */
|
|
90
|
+
createPaymentLink(id: string, params?: PaymentLinkCreateParams, options?: RequestOptions): Promise<PaymentLinkResponse>;
|
|
91
|
+
/** Token for client-facing payment portal. */
|
|
92
|
+
createPaymentToken(id: string, options?: RequestOptions): Promise<PaymentTokenResponse>;
|
|
93
|
+
/**
|
|
94
|
+
* Generate a signed client-portal link for a finalized invoice. The
|
|
95
|
+
* URL points to a public, branded portal where the customer can view
|
|
96
|
+
* the invoice, download the PDF and trigger the payment flow. The
|
|
97
|
+
* token embedded in the URL grants read-only access to a single
|
|
98
|
+
* invoice and expires after the configured lifetime.
|
|
99
|
+
*
|
|
100
|
+
* Rejects with `invalid_status_transition` if the invoice is still
|
|
101
|
+
* in draft.
|
|
102
|
+
*/
|
|
103
|
+
createPortalLink(id: string, options?: RequestOptions): Promise<{
|
|
104
|
+
url: string;
|
|
105
|
+
token: string;
|
|
106
|
+
expires_at: string;
|
|
107
|
+
}>;
|
|
108
|
+
/** Record a supplier invoice received outside the platform (manual entry). */
|
|
109
|
+
createIncoming(params: IncomingInvoiceCreateParams, options?: RequestOptions): Promise<ReceivedInvoice>;
|
|
110
|
+
/** List inbound supplier invoices (manual entries + e-invoices received via the PA). */
|
|
111
|
+
listIncoming(params?: InvoiceListParams): AutoPaginatingList<ReceivedInvoice>;
|
|
112
|
+
}
|
|
@@ -0,0 +1,141 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.Invoices = void 0;
|
|
4
|
+
const pagination_js_1 = require("../pagination.js");
|
|
5
|
+
const payments_js_1 = require("./payments.js");
|
|
6
|
+
/** Manages invoice lifecycle — creation, finalization, sending, and document retrieval. */
|
|
7
|
+
class Invoices {
|
|
8
|
+
constructor(client) {
|
|
9
|
+
this.client = client;
|
|
10
|
+
this.payments = new payments_js_1.Payments(client);
|
|
11
|
+
}
|
|
12
|
+
async create(params, options) {
|
|
13
|
+
return this.client.post('/v1/invoices', params, options);
|
|
14
|
+
}
|
|
15
|
+
list(params) {
|
|
16
|
+
return new pagination_js_1.AutoPaginatingList(this.client, '/v1/invoices', params);
|
|
17
|
+
}
|
|
18
|
+
/**
|
|
19
|
+
* Retrieve an invoice. Pass `expand` to inline related objects in the
|
|
20
|
+
* response under `invoice.expanded` — `customer`, `items.product`, and
|
|
21
|
+
* `credit_notes`. With `credit_notes`, the response also carries
|
|
22
|
+
* `expanded.net_balance` (TTC minus credited amounts, in integer cents).
|
|
23
|
+
*/
|
|
24
|
+
async get(id, params) {
|
|
25
|
+
const expand = params?.expand;
|
|
26
|
+
const query = expand && expand.length ? `?expand=${expand.map(encodeURIComponent).join(',')}` : '';
|
|
27
|
+
return this.client.get(`/v1/invoices/${id}${query}`);
|
|
28
|
+
}
|
|
29
|
+
async update(id, params) {
|
|
30
|
+
return this.client.patch(`/v1/invoices/${id}`, params);
|
|
31
|
+
}
|
|
32
|
+
/** Soft-delete (draft only). */
|
|
33
|
+
async del(id) {
|
|
34
|
+
await this.client.del(`/v1/invoices/${id}`);
|
|
35
|
+
}
|
|
36
|
+
/** Assign number and lock. Irreversible. */
|
|
37
|
+
async finalize(id, options) {
|
|
38
|
+
return this.client.post(`/v1/invoices/${id}/finalize`, undefined, options);
|
|
39
|
+
}
|
|
40
|
+
/** Submit to PA. Returns 202 (async). */
|
|
41
|
+
async send(id, options) {
|
|
42
|
+
return this.client.post(`/v1/invoices/${id}/send`, undefined, options);
|
|
43
|
+
}
|
|
44
|
+
/**
|
|
45
|
+
* Send a finalized invoice by email with PDF (and optionally XML) attached.
|
|
46
|
+
* Returns `{status: 'sent'}` on success or `{status: 'pending'}` if the PDF
|
|
47
|
+
* is still being generated (caller should poll the returned `jobId`).
|
|
48
|
+
*/
|
|
49
|
+
async email(id, params, options) {
|
|
50
|
+
return this.client.post(`/v1/invoices/${id}/email`, params, options);
|
|
51
|
+
}
|
|
52
|
+
/**
|
|
53
|
+
* Cancel a DRAFT invoice (status `draft` only). This soft-deletes the
|
|
54
|
+
* draft and returns `{ id, object: 'invoice', deleted: true }`. Finalized
|
|
55
|
+
* invoices are immutable under French law (CGI art. 289) — use
|
|
56
|
+
* `creditNotes.create()` to refund or correct a finalized invoice.
|
|
57
|
+
*
|
|
58
|
+
* @throws {FacturinoError} when called on a non-draft invoice (API returns 400)
|
|
59
|
+
*/
|
|
60
|
+
async cancel(id, options) {
|
|
61
|
+
return this.client.post(`/v1/invoices/${id}/cancel`, undefined, options);
|
|
62
|
+
}
|
|
63
|
+
async remind(id, options) {
|
|
64
|
+
return this.client.post(`/v1/invoices/${id}/remind`, undefined, options);
|
|
65
|
+
}
|
|
66
|
+
/** Clone as new draft. */
|
|
67
|
+
async clone(id, options) {
|
|
68
|
+
return this.client.post(`/v1/invoices/${id}/clone`, undefined, options);
|
|
69
|
+
}
|
|
70
|
+
/** Signed download URL, or async job if generation needed. */
|
|
71
|
+
async getPdf(id, template) {
|
|
72
|
+
const query = template ? `?template=${encodeURIComponent(template)}` : '';
|
|
73
|
+
return this.client.get(`/v1/invoices/${id}/pdf${query}`);
|
|
74
|
+
}
|
|
75
|
+
/** Factur-X PDF/A-3 with embedded XML. URL or async job. */
|
|
76
|
+
async getFacturx(id, template) {
|
|
77
|
+
const query = template ? `?template=${encodeURIComponent(template)}` : '';
|
|
78
|
+
return this.client.get(`/v1/invoices/${id}/facturx${query}`);
|
|
79
|
+
}
|
|
80
|
+
/** Raw CII or UBL XML. */
|
|
81
|
+
async getXml(id, format) {
|
|
82
|
+
const query = format ? `?format=${format}` : '';
|
|
83
|
+
return this.client.get(`/v1/invoices/${id}/xml${query}`);
|
|
84
|
+
}
|
|
85
|
+
async getStatus(id) {
|
|
86
|
+
return this.client.get(`/v1/invoices/${id}/status`);
|
|
87
|
+
}
|
|
88
|
+
/** Verify archive hash chain integrity. */
|
|
89
|
+
async verify(id) {
|
|
90
|
+
return this.client.get(`/v1/invoices/${id}/verify`);
|
|
91
|
+
}
|
|
92
|
+
async listEvents(id) {
|
|
93
|
+
return this.client.get(`/v1/invoices/${id}/events`);
|
|
94
|
+
}
|
|
95
|
+
async getAuditTrail(id, params) {
|
|
96
|
+
const queryParams = {};
|
|
97
|
+
if (params?.limit)
|
|
98
|
+
queryParams.limit = String(params.limit);
|
|
99
|
+
if (params?.starting_after)
|
|
100
|
+
queryParams.starting_after = params.starting_after;
|
|
101
|
+
if (params?.action)
|
|
102
|
+
queryParams.action = params.action;
|
|
103
|
+
const qs = new URLSearchParams(queryParams).toString();
|
|
104
|
+
const url = qs ? `/v1/invoices/${id}/audit-trail?${qs}` : `/v1/invoices/${id}/audit-trail`;
|
|
105
|
+
return this.client.get(url);
|
|
106
|
+
}
|
|
107
|
+
/** Async audit trail PDF generation. */
|
|
108
|
+
async generateAuditTrailPdf(id, options) {
|
|
109
|
+
return this.client.post(`/v1/invoices/${id}/audit-trail/pdf`, undefined, options);
|
|
110
|
+
}
|
|
111
|
+
/** Stripe payment link (Pro plan). */
|
|
112
|
+
async createPaymentLink(id, params, options) {
|
|
113
|
+
return this.client.post(`/v1/invoices/${id}/payment-link`, params, options);
|
|
114
|
+
}
|
|
115
|
+
/** Token for client-facing payment portal. */
|
|
116
|
+
async createPaymentToken(id, options) {
|
|
117
|
+
return this.client.post(`/v1/invoices/${id}/payment-token`, undefined, options);
|
|
118
|
+
}
|
|
119
|
+
/**
|
|
120
|
+
* Generate a signed client-portal link for a finalized invoice. The
|
|
121
|
+
* URL points to a public, branded portal where the customer can view
|
|
122
|
+
* the invoice, download the PDF and trigger the payment flow. The
|
|
123
|
+
* token embedded in the URL grants read-only access to a single
|
|
124
|
+
* invoice and expires after the configured lifetime.
|
|
125
|
+
*
|
|
126
|
+
* Rejects with `invalid_status_transition` if the invoice is still
|
|
127
|
+
* in draft.
|
|
128
|
+
*/
|
|
129
|
+
async createPortalLink(id, options) {
|
|
130
|
+
return this.client.post(`/v1/invoices/${id}/portal-link`, undefined, options);
|
|
131
|
+
}
|
|
132
|
+
/** Record a supplier invoice received outside the platform (manual entry). */
|
|
133
|
+
async createIncoming(params, options) {
|
|
134
|
+
return this.client.post('/v1/invoices/incoming', params, options);
|
|
135
|
+
}
|
|
136
|
+
/** List inbound supplier invoices (manual entries + e-invoices received via the PA). */
|
|
137
|
+
listIncoming(params) {
|
|
138
|
+
return new pagination_js_1.AutoPaginatingList(this.client, '/v1/invoices/incoming', params);
|
|
139
|
+
}
|
|
140
|
+
}
|
|
141
|
+
exports.Invoices = Invoices;
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
import type { HttpClient } from '../client.js';
|
|
2
|
+
import type { Job } from '../types.js';
|
|
3
|
+
/** Track and poll async background jobs such as PDF generation or PA submission. */
|
|
4
|
+
export declare class Jobs {
|
|
5
|
+
private readonly client;
|
|
6
|
+
constructor(client: HttpClient);
|
|
7
|
+
get(id: string): Promise<Job>;
|
|
8
|
+
/** Poll until completed or failed. */
|
|
9
|
+
poll(id: string, intervalMs?: number, maxAttempts?: number): Promise<Job>;
|
|
10
|
+
}
|
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.Jobs = void 0;
|
|
4
|
+
/** Track and poll async background jobs such as PDF generation or PA submission. */
|
|
5
|
+
class Jobs {
|
|
6
|
+
constructor(client) {
|
|
7
|
+
this.client = client;
|
|
8
|
+
}
|
|
9
|
+
async get(id) {
|
|
10
|
+
return this.client.get(`/v1/jobs/${id}`);
|
|
11
|
+
}
|
|
12
|
+
/** Poll until completed or failed. */
|
|
13
|
+
async poll(id, intervalMs = 2000, maxAttempts = 30) {
|
|
14
|
+
for (let i = 0; i < maxAttempts; i++) {
|
|
15
|
+
const job = await this.get(id);
|
|
16
|
+
if (job.status === 'completed' || job.status === 'failed') {
|
|
17
|
+
return job;
|
|
18
|
+
}
|
|
19
|
+
await new Promise((resolve) => setTimeout(resolve, intervalMs));
|
|
20
|
+
}
|
|
21
|
+
throw new Error(`Job ${id} did not complete within ${maxAttempts} polling attempts`);
|
|
22
|
+
}
|
|
23
|
+
}
|
|
24
|
+
exports.Jobs = Jobs;
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
import type { HttpClient } from '../client.js';
|
|
2
|
+
import { AutoPaginatingList } from '../pagination.js';
|
|
3
|
+
import type { Payment, PaymentCreateParams, PaymentCancelResult, PaginationParams, RequestOptions } from '../types.js';
|
|
4
|
+
/** Records payments against an invoice — accessed via `facturino.invoices.payments`. */
|
|
5
|
+
export declare class Payments {
|
|
6
|
+
private readonly client;
|
|
7
|
+
constructor(client: HttpClient);
|
|
8
|
+
create(invoiceId: string, params: PaymentCreateParams, options?: RequestOptions): Promise<Payment>;
|
|
9
|
+
list(invoiceId: string, params?: PaginationParams): AutoPaginatingList<Payment>;
|
|
10
|
+
/**
|
|
11
|
+
* Cancel a recorded payment. The payment is kept for the audit trail
|
|
12
|
+
* (status `cancelled`) and the invoice is re-settled from the reversal.
|
|
13
|
+
* Rejected once the payment has been reported to the tax authority.
|
|
14
|
+
*/
|
|
15
|
+
cancel(invoiceId: string, paymentId: string, options?: RequestOptions): Promise<PaymentCancelResult>;
|
|
16
|
+
}
|
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.Payments = void 0;
|
|
4
|
+
const pagination_js_1 = require("../pagination.js");
|
|
5
|
+
/** Records payments against an invoice — accessed via `facturino.invoices.payments`. */
|
|
6
|
+
class Payments {
|
|
7
|
+
constructor(client) {
|
|
8
|
+
this.client = client;
|
|
9
|
+
}
|
|
10
|
+
async create(invoiceId, params, options) {
|
|
11
|
+
return this.client.post(`/v1/invoices/${invoiceId}/payments`, params, options);
|
|
12
|
+
}
|
|
13
|
+
list(invoiceId, params) {
|
|
14
|
+
return new pagination_js_1.AutoPaginatingList(this.client, `/v1/invoices/${invoiceId}/payments`, params);
|
|
15
|
+
}
|
|
16
|
+
/**
|
|
17
|
+
* Cancel a recorded payment. The payment is kept for the audit trail
|
|
18
|
+
* (status `cancelled`) and the invoice is re-settled from the reversal.
|
|
19
|
+
* Rejected once the payment has been reported to the tax authority.
|
|
20
|
+
*/
|
|
21
|
+
async cancel(invoiceId, paymentId, options) {
|
|
22
|
+
return this.client.post(`/v1/invoices/${invoiceId}/payments/${paymentId}/cancel`, undefined, options);
|
|
23
|
+
}
|
|
24
|
+
}
|
|
25
|
+
exports.Payments = Payments;
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
import type { HttpClient } from '../client.js';
|
|
2
|
+
import { AutoPaginatingList } from '../pagination.js';
|
|
3
|
+
import type { Product, ProductCreateParams, ProductUpdateParams, ProductListParams, JobResponse, RequestOptions } from '../types.js';
|
|
4
|
+
/** Product catalog management with CSV import/export support. */
|
|
5
|
+
export declare class Products {
|
|
6
|
+
private readonly client;
|
|
7
|
+
constructor(client: HttpClient);
|
|
8
|
+
create(params: ProductCreateParams, options?: RequestOptions): Promise<Product>;
|
|
9
|
+
list(params?: ProductListParams): AutoPaginatingList<Product>;
|
|
10
|
+
get(id: string): Promise<Product>;
|
|
11
|
+
update(id: string, params: ProductUpdateParams): Promise<Product>;
|
|
12
|
+
del(id: string): Promise<void>;
|
|
13
|
+
importCsv(csv: string, options?: RequestOptions): Promise<JobResponse>;
|
|
14
|
+
exportCsv(): Promise<JobResponse>;
|
|
15
|
+
}
|
|
@@ -0,0 +1,32 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.Products = void 0;
|
|
4
|
+
const pagination_js_1 = require("../pagination.js");
|
|
5
|
+
/** Product catalog management with CSV import/export support. */
|
|
6
|
+
class Products {
|
|
7
|
+
constructor(client) {
|
|
8
|
+
this.client = client;
|
|
9
|
+
}
|
|
10
|
+
async create(params, options) {
|
|
11
|
+
return this.client.post('/v1/products', params, options);
|
|
12
|
+
}
|
|
13
|
+
list(params) {
|
|
14
|
+
return new pagination_js_1.AutoPaginatingList(this.client, '/v1/products', params);
|
|
15
|
+
}
|
|
16
|
+
async get(id) {
|
|
17
|
+
return this.client.get(`/v1/products/${id}`);
|
|
18
|
+
}
|
|
19
|
+
async update(id, params) {
|
|
20
|
+
return this.client.patch(`/v1/products/${id}`, params);
|
|
21
|
+
}
|
|
22
|
+
async del(id) {
|
|
23
|
+
await this.client.del(`/v1/products/${id}`);
|
|
24
|
+
}
|
|
25
|
+
async importCsv(csv, options) {
|
|
26
|
+
return this.client.post('/v1/products/import', { csv }, options);
|
|
27
|
+
}
|
|
28
|
+
async exportCsv() {
|
|
29
|
+
return this.client.get('/v1/products/export');
|
|
30
|
+
}
|
|
31
|
+
}
|
|
32
|
+
exports.Products = Products;
|