@beel_es/sdk 2.5.0 → 2.6.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/dist/index.js CHANGED
@@ -46,6 +46,7 @@ __export(index_exports, {
46
46
  BeeLValidationError: () => BeeLValidationError,
47
47
  CatalogsResource: () => CatalogsResource,
48
48
  CompanyCustomersResource: () => CompanyCustomersResource,
49
+ CompanyInvoiceRepliesResource: () => CompanyInvoiceRepliesResource,
49
50
  CompanyInvoiceScheduleResource: () => CompanyInvoiceScheduleResource,
50
51
  CompanyInvoicesResource: () => CompanyInvoicesResource,
51
52
  CompanyPaymentConnectionsResource: () => CompanyPaymentConnectionsResource,
@@ -1568,6 +1569,117 @@ var CompanyPaymentEventsResource = class {
1568
1569
  }
1569
1570
  };
1570
1571
 
1572
+ // src/resources/invoice-replies.ts
1573
+ var CompanyInvoiceRepliesResource = class {
1574
+ constructor(client, companyId) {
1575
+ this.client = client;
1576
+ this.companyId = companyId;
1577
+ }
1578
+ path(rest) {
1579
+ return { company_id: this.companyId, ...rest };
1580
+ }
1581
+ /**
1582
+ * List the replies of the company, most recent first, with masked `excerpt`, `subject`
1583
+ * and sender.
1584
+ *
1585
+ * @param params - Filters (`invoice_id`, `customer_id`, `channel`, `from`, `to`…) and pagination.
1586
+ * @param options - Per-call `idempotencyKey`, `signal` and `timeoutMs`.
1587
+ * @returns The page of `replies` and its `pagination`.
1588
+ *
1589
+ * @example
1590
+ * ```typescript
1591
+ * const { replies } = await company.invoiceReplies.list({ invoice_id: 'invoice-uuid' });
1592
+ * ```
1593
+ */
1594
+ async list(params, options) {
1595
+ const { data } = await this.client.GET("/v1/companies/{company_id}/invoice-replies", {
1596
+ ...toRequestInit(options),
1597
+ params: { path: this.path(), query: params }
1598
+ });
1599
+ return data.data;
1600
+ }
1601
+ /**
1602
+ * Register a message that a customer sent you on a channel of your own about an invoice.
1603
+ *
1604
+ * @param body - The invoice, `channel`, `external_id`, sender and the text or attachments.
1605
+ * @param options - Per-call `idempotencyKey`, `signal` and `timeoutMs`.
1606
+ * @returns The registered reply.
1607
+ *
1608
+ * @example
1609
+ * ```typescript
1610
+ * await company.invoiceReplies.create({
1611
+ * invoice_id: 'invoice-uuid',
1612
+ * channel: 'WHATSAPP',
1613
+ * external_id: 'wamid.EXAMPLE0001',
1614
+ * sender: { address: '+34600123456' },
1615
+ * text: 'Can you send it to Distribuciones Ejemplo S.L.?',
1616
+ * });
1617
+ * ```
1618
+ */
1619
+ async create(body, options) {
1620
+ const { data } = await this.client.POST("/v1/companies/{company_id}/invoice-replies", {
1621
+ ...toRequestInit(options),
1622
+ params: { path: this.path() },
1623
+ body
1624
+ });
1625
+ return data.data;
1626
+ }
1627
+ /**
1628
+ * Get one reply with its full text and the file names of its attachments.
1629
+ *
1630
+ * @param replyId - Reply UUID, from {@link list}.
1631
+ * @param options - Per-call `idempotencyKey`, `signal` and `timeoutMs`.
1632
+ * @returns The reply.
1633
+ */
1634
+ async get(replyId, options) {
1635
+ const { data } = await this.client.GET("/v1/companies/{company_id}/invoice-replies/{reply_id}", {
1636
+ ...toRequestInit(options),
1637
+ params: { path: this.path({ reply_id: replyId }) }
1638
+ });
1639
+ return data.data;
1640
+ }
1641
+ /**
1642
+ * Delete a reply: its content is erased. Deleting it again also succeeds.
1643
+ *
1644
+ * @param replyId - Reply UUID.
1645
+ * @param options - Per-call `idempotencyKey`, `signal` and `timeoutMs`.
1646
+ */
1647
+ async delete(replyId, options) {
1648
+ await this.client.DELETE("/v1/companies/{company_id}/invoice-replies/{reply_id}", {
1649
+ ...toRequestInit(options),
1650
+ params: { path: this.path({ reply_id: replyId }) }
1651
+ });
1652
+ }
1653
+ /**
1654
+ * Get an attachment of a reply with a temporary `download_url` for its file. The link is
1655
+ * requested on each call and expires at `download_url_expires_at`: call again for a fresh
1656
+ * one rather than storing it. Both are `null` when there is no file to download.
1657
+ *
1658
+ * @param replyId - Reply UUID.
1659
+ * @param attachmentId - Attachment UUID, from the `attachments` of the reply.
1660
+ * @param options - Per-call `idempotencyKey`, `signal` and `timeoutMs`.
1661
+ * @returns The attachment, with `download_url` and `download_url_expires_at`.
1662
+ *
1663
+ * @example
1664
+ * ```typescript
1665
+ * const attachment = await company.invoiceReplies.getAttachment(replyId, attachmentId);
1666
+ * if (attachment.download_url) {
1667
+ * const file = await fetch(attachment.download_url);
1668
+ * }
1669
+ * ```
1670
+ */
1671
+ async getAttachment(replyId, attachmentId, options) {
1672
+ const { data } = await this.client.GET(
1673
+ "/v1/companies/{company_id}/invoice-replies/{reply_id}/attachments/{attachment_id}",
1674
+ {
1675
+ ...toRequestInit(options),
1676
+ params: { path: this.path({ reply_id: replyId, attachment_id: attachmentId }) }
1677
+ }
1678
+ );
1679
+ return data.data;
1680
+ }
1681
+ };
1682
+
1571
1683
  // src/resources/invoice-create-once.ts
1572
1684
  var EXTERNAL_REF_UNIQUE_INVOICE_TYPES = ["STANDARD", "SIMPLIFIED"];
1573
1685
  var MISSING_EXTERNAL_REF_MESSAGE = "invoices.createOnce requires a non-empty `external_ref`: it is the key that makes the call safe to repeat.";
@@ -1617,6 +1729,7 @@ var CompanyScope = class {
1617
1729
  this.series = new CompanySeriesResource(client, companyId);
1618
1730
  this.recurringInvoices = new CompanyRecurringInvoicesResource(client, companyId);
1619
1731
  this.paymentConnections = new CompanyPaymentConnectionsResource(client, companyId);
1732
+ this.invoiceReplies = new CompanyInvoiceRepliesResource(client, companyId);
1620
1733
  this.taxConfiguration = new CompanyTaxConfigurationResource(client, companyId);
1621
1734
  this.verifactuConfiguration = new CompanyVeriFactuConfigurationResource(client, companyId);
1622
1735
  }
@@ -2699,6 +2812,60 @@ var CompanyCreatedEvent;
2699
2812
  })(type = CompanyCreatedEvent2.type || (CompanyCreatedEvent2.type = {}));
2700
2813
  })(CompanyCreatedEvent || (CompanyCreatedEvent = {}));
2701
2814
 
2815
+ // src/generated-webhooks/models/ConnectionConnectedEvent.ts
2816
+ var ConnectionConnectedEvent;
2817
+ ((ConnectionConnectedEvent2) => {
2818
+ let type;
2819
+ ((type2) => {
2820
+ type2["CONNECTION_CONNECTED"] = "connection.connected";
2821
+ })(type = ConnectionConnectedEvent2.type || (ConnectionConnectedEvent2.type = {}));
2822
+ })(ConnectionConnectedEvent || (ConnectionConnectedEvent = {}));
2823
+
2824
+ // src/generated-webhooks/models/ConnectionDisconnectedEvent.ts
2825
+ var ConnectionDisconnectedEvent;
2826
+ ((ConnectionDisconnectedEvent2) => {
2827
+ let type;
2828
+ ((type2) => {
2829
+ type2["CONNECTION_DISCONNECTED"] = "connection.disconnected";
2830
+ })(type = ConnectionDisconnectedEvent2.type || (ConnectionDisconnectedEvent2.type = {}));
2831
+ })(ConnectionDisconnectedEvent || (ConnectionDisconnectedEvent = {}));
2832
+
2833
+ // src/generated-webhooks/models/EmailDomainFailedEvent.ts
2834
+ var EmailDomainFailedEvent;
2835
+ ((EmailDomainFailedEvent2) => {
2836
+ let type;
2837
+ ((type2) => {
2838
+ type2["EMAIL_DOMAIN_FAILED"] = "email_domain.failed";
2839
+ })(type = EmailDomainFailedEvent2.type || (EmailDomainFailedEvent2.type = {}));
2840
+ })(EmailDomainFailedEvent || (EmailDomainFailedEvent = {}));
2841
+
2842
+ // src/generated-webhooks/models/EmailDomainRemovedEvent.ts
2843
+ var EmailDomainRemovedEvent;
2844
+ ((EmailDomainRemovedEvent2) => {
2845
+ let type;
2846
+ ((type2) => {
2847
+ type2["EMAIL_DOMAIN_REMOVED"] = "email_domain.removed";
2848
+ })(type = EmailDomainRemovedEvent2.type || (EmailDomainRemovedEvent2.type = {}));
2849
+ })(EmailDomainRemovedEvent || (EmailDomainRemovedEvent = {}));
2850
+
2851
+ // src/generated-webhooks/models/EmailDomainVerifiedEvent.ts
2852
+ var EmailDomainVerifiedEvent;
2853
+ ((EmailDomainVerifiedEvent2) => {
2854
+ let type;
2855
+ ((type2) => {
2856
+ type2["EMAIL_DOMAIN_VERIFIED"] = "email_domain.verified";
2857
+ })(type = EmailDomainVerifiedEvent2.type || (EmailDomainVerifiedEvent2.type = {}));
2858
+ })(EmailDomainVerifiedEvent || (EmailDomainVerifiedEvent = {}));
2859
+
2860
+ // src/generated-webhooks/models/InvoiceEmailBouncedEvent.ts
2861
+ var InvoiceEmailBouncedEvent;
2862
+ ((InvoiceEmailBouncedEvent2) => {
2863
+ let type;
2864
+ ((type2) => {
2865
+ type2["INVOICE_EMAIL_BOUNCED"] = "invoice.email.bounced";
2866
+ })(type = InvoiceEmailBouncedEvent2.type || (InvoiceEmailBouncedEvent2.type = {}));
2867
+ })(InvoiceEmailBouncedEvent || (InvoiceEmailBouncedEvent = {}));
2868
+
2702
2869
  // src/generated-webhooks/models/InvoiceEmailSentEvent.ts
2703
2870
  var InvoiceEmailSentEvent;
2704
2871
  ((InvoiceEmailSentEvent2) => {
@@ -2726,6 +2893,24 @@ var InvoicePdfGeneratedEvent;
2726
2893
  })(type = InvoicePdfGeneratedEvent2.type || (InvoicePdfGeneratedEvent2.type = {}));
2727
2894
  })(InvoicePdfGeneratedEvent || (InvoicePdfGeneratedEvent = {}));
2728
2895
 
2896
+ // src/generated-webhooks/models/InvoiceReplyDeletedEvent.ts
2897
+ var InvoiceReplyDeletedEvent;
2898
+ ((InvoiceReplyDeletedEvent2) => {
2899
+ let type;
2900
+ ((type2) => {
2901
+ type2["INVOICE_REPLY_DELETED"] = "invoice.reply.deleted";
2902
+ })(type = InvoiceReplyDeletedEvent2.type || (InvoiceReplyDeletedEvent2.type = {}));
2903
+ })(InvoiceReplyDeletedEvent || (InvoiceReplyDeletedEvent = {}));
2904
+
2905
+ // src/generated-webhooks/models/InvoiceReplyReceivedEvent.ts
2906
+ var InvoiceReplyReceivedEvent;
2907
+ ((InvoiceReplyReceivedEvent2) => {
2908
+ let type;
2909
+ ((type2) => {
2910
+ type2["INVOICE_REPLY_RECEIVED"] = "invoice.reply.received";
2911
+ })(type = InvoiceReplyReceivedEvent2.type || (InvoiceReplyReceivedEvent2.type = {}));
2912
+ })(InvoiceReplyReceivedEvent || (InvoiceReplyReceivedEvent = {}));
2913
+
2729
2914
  // src/generated-webhooks/models/InvoiceScheduleFailedEvent.ts
2730
2915
  var InvoiceScheduleFailedEvent;
2731
2916
  ((InvoiceScheduleFailedEvent2) => {
@@ -2800,6 +2985,14 @@ var WebhookEventType = /* @__PURE__ */ ((WebhookEventType2) => {
2800
2985
  WebhookEventType2["ACCOUNT_CLAIMED"] = "account.claimed";
2801
2986
  WebhookEventType2["COMPANY_CREATED"] = "company.created";
2802
2987
  WebhookEventType2["REPRESENTATION_SIGNED"] = "representation.signed";
2988
+ WebhookEventType2["EMAIL_DOMAIN_VERIFIED"] = "email_domain.verified";
2989
+ WebhookEventType2["EMAIL_DOMAIN_FAILED"] = "email_domain.failed";
2990
+ WebhookEventType2["EMAIL_DOMAIN_REMOVED"] = "email_domain.removed";
2991
+ WebhookEventType2["CONNECTION_CONNECTED"] = "connection.connected";
2992
+ WebhookEventType2["CONNECTION_DISCONNECTED"] = "connection.disconnected";
2993
+ WebhookEventType2["INVOICE_REPLY_RECEIVED"] = "invoice.reply.received";
2994
+ WebhookEventType2["INVOICE_REPLY_DELETED"] = "invoice.reply.deleted";
2995
+ WebhookEventType2["INVOICE_EMAIL_BOUNCED"] = "invoice.email.bounced";
2803
2996
  return WebhookEventType2;
2804
2997
  })(WebhookEventType || {});
2805
2998
 
@@ -3075,6 +3268,7 @@ var InvoiceBuilder = class _InvoiceBuilder {
3075
3268
  BeeLValidationError,
3076
3269
  CatalogsResource,
3077
3270
  CompanyCustomersResource,
3271
+ CompanyInvoiceRepliesResource,
3078
3272
  CompanyInvoiceScheduleResource,
3079
3273
  CompanyInvoicesResource,
3080
3274
  CompanyPaymentConnectionsResource,