e-invoice-api
Version:
The official TypeScript library for the e-invoice API
50 lines • 1.98 kB
JavaScript
// File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details.
Object.defineProperty(exports, "__esModule", { value: true });
exports.Documents = void 0;
const tslib_1 = require("../../internal/tslib.js");
const resource_1 = require("../../core/resource.js");
const AttachmentsAPI = tslib_1.__importStar(require("./attachments.js"));
const attachments_1 = require("./attachments.js");
const UblAPI = tslib_1.__importStar(require("./ubl.js"));
const ubl_1 = require("./ubl.js");
const path_1 = require("../../internal/utils/path.js");
class Documents extends resource_1.APIResource {
constructor() {
super(...arguments);
this.attachments = new AttachmentsAPI.Attachments(this._client);
this.ubl = new UblAPI.Ubl(this._client);
}
/**
* Create a new invoice or credit note
*/
create(body, options) {
return this._client.post('/api/documents/', { body, ...options });
}
/**
* Get an invoice or credit note by ID
*/
retrieve(documentID, options) {
return this._client.get((0, path_1.path) `/api/documents/${documentID}`, options);
}
/**
* Delete an invoice or credit note
*/
delete(documentID, options) {
return this._client.delete((0, path_1.path) `/api/documents/${documentID}`, options);
}
/**
* Send an invoice or credit note via Peppol
*/
send(documentID, params = {}, options) {
const { email, receiver_peppol_id, receiver_peppol_scheme, sender_peppol_id, sender_peppol_scheme } = params ?? {};
return this._client.post((0, path_1.path) `/api/documents/${documentID}/send`, {
query: { email, receiver_peppol_id, receiver_peppol_scheme, sender_peppol_id, sender_peppol_scheme },
...options,
});
}
}
exports.Documents = Documents;
Documents.Attachments = attachments_1.Attachments;
Documents.Ubl = ubl_1.Ubl;
//# sourceMappingURL=documents.js.map
;