@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.mjs CHANGED
@@ -1499,6 +1499,117 @@ var CompanyPaymentEventsResource = class {
1499
1499
  }
1500
1500
  };
1501
1501
 
1502
+ // src/resources/invoice-replies.ts
1503
+ var CompanyInvoiceRepliesResource = class {
1504
+ constructor(client, companyId) {
1505
+ this.client = client;
1506
+ this.companyId = companyId;
1507
+ }
1508
+ path(rest) {
1509
+ return { company_id: this.companyId, ...rest };
1510
+ }
1511
+ /**
1512
+ * List the replies of the company, most recent first, with masked `excerpt`, `subject`
1513
+ * and sender.
1514
+ *
1515
+ * @param params - Filters (`invoice_id`, `customer_id`, `channel`, `from`, `to`…) and pagination.
1516
+ * @param options - Per-call `idempotencyKey`, `signal` and `timeoutMs`.
1517
+ * @returns The page of `replies` and its `pagination`.
1518
+ *
1519
+ * @example
1520
+ * ```typescript
1521
+ * const { replies } = await company.invoiceReplies.list({ invoice_id: 'invoice-uuid' });
1522
+ * ```
1523
+ */
1524
+ async list(params, options) {
1525
+ const { data } = await this.client.GET("/v1/companies/{company_id}/invoice-replies", {
1526
+ ...toRequestInit(options),
1527
+ params: { path: this.path(), query: params }
1528
+ });
1529
+ return data.data;
1530
+ }
1531
+ /**
1532
+ * Register a message that a customer sent you on a channel of your own about an invoice.
1533
+ *
1534
+ * @param body - The invoice, `channel`, `external_id`, sender and the text or attachments.
1535
+ * @param options - Per-call `idempotencyKey`, `signal` and `timeoutMs`.
1536
+ * @returns The registered reply.
1537
+ *
1538
+ * @example
1539
+ * ```typescript
1540
+ * await company.invoiceReplies.create({
1541
+ * invoice_id: 'invoice-uuid',
1542
+ * channel: 'WHATSAPP',
1543
+ * external_id: 'wamid.EXAMPLE0001',
1544
+ * sender: { address: '+34600123456' },
1545
+ * text: 'Can you send it to Distribuciones Ejemplo S.L.?',
1546
+ * });
1547
+ * ```
1548
+ */
1549
+ async create(body, options) {
1550
+ const { data } = await this.client.POST("/v1/companies/{company_id}/invoice-replies", {
1551
+ ...toRequestInit(options),
1552
+ params: { path: this.path() },
1553
+ body
1554
+ });
1555
+ return data.data;
1556
+ }
1557
+ /**
1558
+ * Get one reply with its full text and the file names of its attachments.
1559
+ *
1560
+ * @param replyId - Reply UUID, from {@link list}.
1561
+ * @param options - Per-call `idempotencyKey`, `signal` and `timeoutMs`.
1562
+ * @returns The reply.
1563
+ */
1564
+ async get(replyId, options) {
1565
+ const { data } = await this.client.GET("/v1/companies/{company_id}/invoice-replies/{reply_id}", {
1566
+ ...toRequestInit(options),
1567
+ params: { path: this.path({ reply_id: replyId }) }
1568
+ });
1569
+ return data.data;
1570
+ }
1571
+ /**
1572
+ * Delete a reply: its content is erased. Deleting it again also succeeds.
1573
+ *
1574
+ * @param replyId - Reply UUID.
1575
+ * @param options - Per-call `idempotencyKey`, `signal` and `timeoutMs`.
1576
+ */
1577
+ async delete(replyId, options) {
1578
+ await this.client.DELETE("/v1/companies/{company_id}/invoice-replies/{reply_id}", {
1579
+ ...toRequestInit(options),
1580
+ params: { path: this.path({ reply_id: replyId }) }
1581
+ });
1582
+ }
1583
+ /**
1584
+ * Get an attachment of a reply with a temporary `download_url` for its file. The link is
1585
+ * requested on each call and expires at `download_url_expires_at`: call again for a fresh
1586
+ * one rather than storing it. Both are `null` when there is no file to download.
1587
+ *
1588
+ * @param replyId - Reply UUID.
1589
+ * @param attachmentId - Attachment UUID, from the `attachments` of the reply.
1590
+ * @param options - Per-call `idempotencyKey`, `signal` and `timeoutMs`.
1591
+ * @returns The attachment, with `download_url` and `download_url_expires_at`.
1592
+ *
1593
+ * @example
1594
+ * ```typescript
1595
+ * const attachment = await company.invoiceReplies.getAttachment(replyId, attachmentId);
1596
+ * if (attachment.download_url) {
1597
+ * const file = await fetch(attachment.download_url);
1598
+ * }
1599
+ * ```
1600
+ */
1601
+ async getAttachment(replyId, attachmentId, options) {
1602
+ const { data } = await this.client.GET(
1603
+ "/v1/companies/{company_id}/invoice-replies/{reply_id}/attachments/{attachment_id}",
1604
+ {
1605
+ ...toRequestInit(options),
1606
+ params: { path: this.path({ reply_id: replyId, attachment_id: attachmentId }) }
1607
+ }
1608
+ );
1609
+ return data.data;
1610
+ }
1611
+ };
1612
+
1502
1613
  // src/resources/invoice-create-once.ts
1503
1614
  var EXTERNAL_REF_UNIQUE_INVOICE_TYPES = ["STANDARD", "SIMPLIFIED"];
1504
1615
  var MISSING_EXTERNAL_REF_MESSAGE = "invoices.createOnce requires a non-empty `external_ref`: it is the key that makes the call safe to repeat.";
@@ -1548,6 +1659,7 @@ var CompanyScope = class {
1548
1659
  this.series = new CompanySeriesResource(client, companyId);
1549
1660
  this.recurringInvoices = new CompanyRecurringInvoicesResource(client, companyId);
1550
1661
  this.paymentConnections = new CompanyPaymentConnectionsResource(client, companyId);
1662
+ this.invoiceReplies = new CompanyInvoiceRepliesResource(client, companyId);
1551
1663
  this.taxConfiguration = new CompanyTaxConfigurationResource(client, companyId);
1552
1664
  this.verifactuConfiguration = new CompanyVeriFactuConfigurationResource(client, companyId);
1553
1665
  }
@@ -2630,6 +2742,60 @@ var CompanyCreatedEvent;
2630
2742
  })(type = CompanyCreatedEvent2.type || (CompanyCreatedEvent2.type = {}));
2631
2743
  })(CompanyCreatedEvent || (CompanyCreatedEvent = {}));
2632
2744
 
2745
+ // src/generated-webhooks/models/ConnectionConnectedEvent.ts
2746
+ var ConnectionConnectedEvent;
2747
+ ((ConnectionConnectedEvent2) => {
2748
+ let type;
2749
+ ((type2) => {
2750
+ type2["CONNECTION_CONNECTED"] = "connection.connected";
2751
+ })(type = ConnectionConnectedEvent2.type || (ConnectionConnectedEvent2.type = {}));
2752
+ })(ConnectionConnectedEvent || (ConnectionConnectedEvent = {}));
2753
+
2754
+ // src/generated-webhooks/models/ConnectionDisconnectedEvent.ts
2755
+ var ConnectionDisconnectedEvent;
2756
+ ((ConnectionDisconnectedEvent2) => {
2757
+ let type;
2758
+ ((type2) => {
2759
+ type2["CONNECTION_DISCONNECTED"] = "connection.disconnected";
2760
+ })(type = ConnectionDisconnectedEvent2.type || (ConnectionDisconnectedEvent2.type = {}));
2761
+ })(ConnectionDisconnectedEvent || (ConnectionDisconnectedEvent = {}));
2762
+
2763
+ // src/generated-webhooks/models/EmailDomainFailedEvent.ts
2764
+ var EmailDomainFailedEvent;
2765
+ ((EmailDomainFailedEvent2) => {
2766
+ let type;
2767
+ ((type2) => {
2768
+ type2["EMAIL_DOMAIN_FAILED"] = "email_domain.failed";
2769
+ })(type = EmailDomainFailedEvent2.type || (EmailDomainFailedEvent2.type = {}));
2770
+ })(EmailDomainFailedEvent || (EmailDomainFailedEvent = {}));
2771
+
2772
+ // src/generated-webhooks/models/EmailDomainRemovedEvent.ts
2773
+ var EmailDomainRemovedEvent;
2774
+ ((EmailDomainRemovedEvent2) => {
2775
+ let type;
2776
+ ((type2) => {
2777
+ type2["EMAIL_DOMAIN_REMOVED"] = "email_domain.removed";
2778
+ })(type = EmailDomainRemovedEvent2.type || (EmailDomainRemovedEvent2.type = {}));
2779
+ })(EmailDomainRemovedEvent || (EmailDomainRemovedEvent = {}));
2780
+
2781
+ // src/generated-webhooks/models/EmailDomainVerifiedEvent.ts
2782
+ var EmailDomainVerifiedEvent;
2783
+ ((EmailDomainVerifiedEvent2) => {
2784
+ let type;
2785
+ ((type2) => {
2786
+ type2["EMAIL_DOMAIN_VERIFIED"] = "email_domain.verified";
2787
+ })(type = EmailDomainVerifiedEvent2.type || (EmailDomainVerifiedEvent2.type = {}));
2788
+ })(EmailDomainVerifiedEvent || (EmailDomainVerifiedEvent = {}));
2789
+
2790
+ // src/generated-webhooks/models/InvoiceEmailBouncedEvent.ts
2791
+ var InvoiceEmailBouncedEvent;
2792
+ ((InvoiceEmailBouncedEvent2) => {
2793
+ let type;
2794
+ ((type2) => {
2795
+ type2["INVOICE_EMAIL_BOUNCED"] = "invoice.email.bounced";
2796
+ })(type = InvoiceEmailBouncedEvent2.type || (InvoiceEmailBouncedEvent2.type = {}));
2797
+ })(InvoiceEmailBouncedEvent || (InvoiceEmailBouncedEvent = {}));
2798
+
2633
2799
  // src/generated-webhooks/models/InvoiceEmailSentEvent.ts
2634
2800
  var InvoiceEmailSentEvent;
2635
2801
  ((InvoiceEmailSentEvent2) => {
@@ -2657,6 +2823,24 @@ var InvoicePdfGeneratedEvent;
2657
2823
  })(type = InvoicePdfGeneratedEvent2.type || (InvoicePdfGeneratedEvent2.type = {}));
2658
2824
  })(InvoicePdfGeneratedEvent || (InvoicePdfGeneratedEvent = {}));
2659
2825
 
2826
+ // src/generated-webhooks/models/InvoiceReplyDeletedEvent.ts
2827
+ var InvoiceReplyDeletedEvent;
2828
+ ((InvoiceReplyDeletedEvent2) => {
2829
+ let type;
2830
+ ((type2) => {
2831
+ type2["INVOICE_REPLY_DELETED"] = "invoice.reply.deleted";
2832
+ })(type = InvoiceReplyDeletedEvent2.type || (InvoiceReplyDeletedEvent2.type = {}));
2833
+ })(InvoiceReplyDeletedEvent || (InvoiceReplyDeletedEvent = {}));
2834
+
2835
+ // src/generated-webhooks/models/InvoiceReplyReceivedEvent.ts
2836
+ var InvoiceReplyReceivedEvent;
2837
+ ((InvoiceReplyReceivedEvent2) => {
2838
+ let type;
2839
+ ((type2) => {
2840
+ type2["INVOICE_REPLY_RECEIVED"] = "invoice.reply.received";
2841
+ })(type = InvoiceReplyReceivedEvent2.type || (InvoiceReplyReceivedEvent2.type = {}));
2842
+ })(InvoiceReplyReceivedEvent || (InvoiceReplyReceivedEvent = {}));
2843
+
2660
2844
  // src/generated-webhooks/models/InvoiceScheduleFailedEvent.ts
2661
2845
  var InvoiceScheduleFailedEvent;
2662
2846
  ((InvoiceScheduleFailedEvent2) => {
@@ -2731,6 +2915,14 @@ var WebhookEventType = /* @__PURE__ */ ((WebhookEventType2) => {
2731
2915
  WebhookEventType2["ACCOUNT_CLAIMED"] = "account.claimed";
2732
2916
  WebhookEventType2["COMPANY_CREATED"] = "company.created";
2733
2917
  WebhookEventType2["REPRESENTATION_SIGNED"] = "representation.signed";
2918
+ WebhookEventType2["EMAIL_DOMAIN_VERIFIED"] = "email_domain.verified";
2919
+ WebhookEventType2["EMAIL_DOMAIN_FAILED"] = "email_domain.failed";
2920
+ WebhookEventType2["EMAIL_DOMAIN_REMOVED"] = "email_domain.removed";
2921
+ WebhookEventType2["CONNECTION_CONNECTED"] = "connection.connected";
2922
+ WebhookEventType2["CONNECTION_DISCONNECTED"] = "connection.disconnected";
2923
+ WebhookEventType2["INVOICE_REPLY_RECEIVED"] = "invoice.reply.received";
2924
+ WebhookEventType2["INVOICE_REPLY_DELETED"] = "invoice.reply.deleted";
2925
+ WebhookEventType2["INVOICE_EMAIL_BOUNCED"] = "invoice.email.bounced";
2734
2926
  return WebhookEventType2;
2735
2927
  })(WebhookEventType || {});
2736
2928
 
@@ -3005,6 +3197,7 @@ export {
3005
3197
  BeeLValidationError,
3006
3198
  CatalogsResource,
3007
3199
  CompanyCustomersResource,
3200
+ CompanyInvoiceRepliesResource,
3008
3201
  CompanyInvoiceScheduleResource,
3009
3202
  CompanyInvoicesResource,
3010
3203
  CompanyPaymentConnectionsResource,