e-invoice-api
Version:
The official TypeScript library for the e-invoice API
45 lines • 1.68 kB
JavaScript
// File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details.
import { APIResource } from "../../core/resource.mjs";
import * as AttachmentsAPI from "./attachments.mjs";
import { Attachments, } from "./attachments.mjs";
import * as UblAPI from "./ubl.mjs";
import { Ubl } from "./ubl.mjs";
import { path } from "../../internal/utils/path.mjs";
export class Documents extends 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(path `/api/documents/${documentID}`, options);
}
/**
* Delete an invoice or credit note
*/
delete(documentID, options) {
return this._client.delete(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(path `/api/documents/${documentID}/send`, {
query: { email, receiver_peppol_id, receiver_peppol_scheme, sender_peppol_id, sender_peppol_scheme },
...options,
});
}
}
Documents.Attachments = Attachments;
Documents.Ubl = Ubl;
//# sourceMappingURL=documents.mjs.map