@arbol-ai/sdk 5.67.0 → 5.68.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.
Files changed (53) hide show
  1. package/dist/account/billing/client.d.ts +13 -2
  2. package/dist/account/billing/client.js +8 -0
  3. package/dist/account/billing/index.d.ts +2 -2
  4. package/dist/account/billing/models.d.ts +107 -3
  5. package/dist/account/billing/models.js +2 -0
  6. package/dist/account/billingPortalSessions/client.d.ts +2 -2
  7. package/dist/account/billingPortalSessions/models.d.ts +1 -1
  8. package/dist/account/client.d.ts +4 -0
  9. package/dist/account/client.js +10 -0
  10. package/dist/account/index.d.ts +1 -1
  11. package/dist/account/invitations/client.d.ts +3 -1
  12. package/dist/account/invitations/client.js +1 -1
  13. package/dist/account/invoices/client.d.ts +36 -0
  14. package/dist/account/invoices/client.js +19 -0
  15. package/dist/account/invoices/index.d.ts +5 -0
  16. package/dist/account/invoices/index.js +4 -0
  17. package/dist/account/invoices/models.d.ts +75 -0
  18. package/dist/account/invoices/models.js +14 -0
  19. package/dist/account/members/client.d.ts +6 -2
  20. package/dist/account/members/client.js +2 -2
  21. package/dist/account/models.d.ts +38 -0
  22. package/dist/account/paymentMethodSetups/client.d.ts +25 -0
  23. package/dist/account/paymentMethodSetups/client.js +18 -0
  24. package/dist/account/paymentMethodSetups/index.d.ts +5 -0
  25. package/dist/account/paymentMethodSetups/index.js +4 -0
  26. package/dist/account/paymentMethodSetups/models.d.ts +33 -0
  27. package/dist/account/paymentMethodSetups/models.js +3 -0
  28. package/dist/account/usageSummary/client.d.ts +12 -5
  29. package/dist/account/usageSummary/client.js +1 -1
  30. package/dist/account/usageSummary/models.d.ts +16 -3
  31. package/dist/account/usageSummary/models.js +2 -1
  32. package/dist/account/walletTopUps/client.d.ts +3 -2
  33. package/dist/account/walletTopUps/models.d.ts +1 -1
  34. package/dist/account/walletTransactions/client.d.ts +4 -3
  35. package/dist/account/walletTransactions/models.d.ts +21 -6
  36. package/dist/raiz/campaigns/client.d.ts +12 -6
  37. package/dist/raiz/campaigns/client.js +1 -1
  38. package/dist/raiz/campaigns/index.d.ts +1 -1
  39. package/dist/raiz/campaigns/models.d.ts +39 -3
  40. package/dist/raiz/channels/client.js +3 -3
  41. package/dist/raiz/conversations/index.d.ts +1 -1
  42. package/dist/raiz/conversations/models.d.ts +33 -0
  43. package/dist/raiz/index.d.ts +1 -1
  44. package/dist/raiz/models.d.ts +38 -0
  45. package/dist/raiz/organization/models.d.ts +2 -2
  46. package/dist/raiz/reports/client.d.ts +5 -2
  47. package/dist/raiz/reports/models.d.ts +21 -0
  48. package/dist/raiz/reports/models.js +1 -1
  49. package/dist/sanitas/affiliations/models.d.ts +2 -2
  50. package/dist/sanitas/connections/models.d.ts +2 -2
  51. package/dist/sanitas/index.d.ts +1 -1
  52. package/dist/sanitas/models.d.ts +21 -0
  53. package/package.json +3 -3
@@ -1,5 +1,5 @@
1
1
  import { type BaseClientOptions, type RequestOptions, Transport } from "../../_/index.js";
2
- import { type AccountBillingResponse } from "./models.js";
2
+ import { type AccountBillingResponse, type AccountUpdateBillingBody } from "./models.js";
3
3
  export interface ClientOptions extends BaseClientOptions {
4
4
  /**
5
5
  * The URL the paths of the API are relative to.
@@ -12,12 +12,23 @@ export interface Client {
12
12
  *
13
13
  * The organization's wallet in credits (one credit is one US dollar): credits
14
14
  * left, granted and spent in the current period, whether running out stops
15
- * service, its plans and the card a top-up charges.
15
+ * service, its plans, the card a top-up charges, how much it has topped up,
16
+ * the credits Arbol gave that are still in force, and its plan's allowances.
16
17
  */
17
18
  get(request?: GetRequest, options?: RequestOptions): Promise<GetResponse>;
19
+ /**
20
+ * Change the automatic top-up and the low-balance alert
21
+ *
22
+ * Turns the automatic top-up on or off (the balance that triggers it, the
23
+ * credits it buys with the saved card, the most times a month) and sets the
24
+ * balance at which the organization's administrators are emailed.
25
+ */
26
+ update(request?: UpdateRequest, options?: RequestOptions): Promise<UpdateResponse>;
18
27
  }
19
28
  export declare function createClient(options: ClientOptions): Client;
20
29
  export declare function bind(transport: Transport): Client;
21
30
  export interface GetRequest {
22
31
  }
23
32
  export type GetResponse = AccountBillingResponse;
33
+ export type UpdateRequest = AccountUpdateBillingBody;
34
+ export type UpdateResponse = AccountBillingResponse;
@@ -8,6 +8,7 @@ export function createClient(options) {
8
8
  export function bind(transport) {
9
9
  return {
10
10
  get: (request, options) => transport.send(GetOperation, request, options),
11
+ update: (request, options) => transport.send(UpdateOperation, request, options),
11
12
  };
12
13
  }
13
14
  const GetOperation = {
@@ -16,3 +17,10 @@ const GetOperation = {
16
17
  response: AccountBillingResponseCodec,
17
18
  errors: { "400": true, "401": true, "403": true, "429": true, "500": true, "502": true, "503": true, "504": true },
18
19
  };
20
+ const UpdateOperation = {
21
+ method: "PATCH",
22
+ route: "/v1/account/billing",
23
+ body: "flat",
24
+ response: AccountBillingResponseCodec,
25
+ errors: { "400": true, "401": true, "403": true, "409": true, "413": true, "415": true, "429": true, "500": true, "502": true, "503": true, "504": true },
26
+ };
@@ -1,5 +1,5 @@
1
1
  export { ApiError } from "../../_/index.js";
2
2
  export type { RequestOptions } from "../../_/index.js";
3
3
  export { createClient } from "./client.js";
4
- export type { Client, ClientOptions, GetRequest, GetResponse, } from "./client.js";
5
- export type { AccountBilling, AccountBillingPlan, AccountBillingResponse, AccountGetBillingServiceUnavailableError, AccountGetBillingServiceUnavailableFailure, } from "./models.js";
4
+ export type { Client, ClientOptions, GetRequest, GetResponse, UpdateRequest, UpdateResponse, } from "./client.js";
5
+ export type { AccountBilling, AccountBillingPlan, AccountBillingRefusedError, AccountBillingRefusedFailure, AccountBillingResponse, AccountGetBillingServiceUnavailableError, AccountGetBillingServiceUnavailableFailure, AccountUpdateBillingBody, AccountUpdateBillingServiceUnavailableError, AccountUpdateBillingServiceUnavailableFailure, } from "./models.js";
@@ -1,10 +1,29 @@
1
- import type { ResponseMetadata, UpstreamUnavailableFailure } from "../../models.js";
1
+ import type { Empty, ResponseMetadata, UpstreamUnavailableFailure } from "../../models.js";
2
2
  import type { AccountBillingNotConfiguredFailure, AccountBillingUnavailableFailure } from "../models.js";
3
3
  export interface AccountBilling {
4
+ /**
5
+ * The automatic top-up; null when it was never set.
6
+ */
7
+ autoTopUp: {
8
+ credits: number;
9
+ enabled: boolean;
10
+ perMonth: number | null;
11
+ threshold: number;
12
+ } | null;
4
13
  /**
5
14
  * Credits left in the wallet; one credit is one US dollar.
6
15
  */
7
16
  balance: number;
17
+ /**
18
+ * Allowances of one fact on the plan (600 minutes a month), spent before
19
+ * credits.
20
+ */
21
+ bundles: {
22
+ feature: "voice_minutes" | "telephony_minutes" | "telephony_cost" | "whatsapp_conversations" | "whatsapp_messages" | "whatsapp_templates" | "tool_calls" | "ai_cost" | "phone_numbers" | "sisben_lookups" | "adres_lookups" | "policia_colombia_lookups" | "postconsultations" | "agenda_users" | "sms_messages" | "agenda_plan" | "support_fee";
23
+ included: number;
24
+ remaining: number;
25
+ resetsAt: Temporal.Instant | null;
26
+ }[];
8
27
  /**
9
28
  * The card a top-up charges without asking for one.
10
29
  */
@@ -21,6 +40,23 @@ export interface AccountBilling {
21
40
  * Credits the wallet received in the current period, top-ups included.
22
41
  */
23
42
  granted: number;
43
+ /**
44
+ * Credits Arbol gave that are still in force, spent before paid credits when
45
+ * they end sooner.
46
+ */
47
+ grants: {
48
+ credits: number;
49
+ expiresAt: Temporal.Instant | null;
50
+ id: string;
51
+ kind: "trial" | "promo" | "subsidy" | "courtesy" | "correction" | "other";
52
+ label: string | null;
53
+ remaining: number;
54
+ }[];
55
+ /**
56
+ * The balance at which the organization's administrators are emailed; null
57
+ * when off.
58
+ */
59
+ lowBalanceAlert: number | null;
24
60
  /**
25
61
  * When the plan's included credits renew.
26
62
  */
@@ -42,6 +78,13 @@ export interface AccountBilling {
42
78
  maximum: number;
43
79
  minimum: number;
44
80
  };
81
+ /**
82
+ * How much the organization has topped up; null when it could not be read.
83
+ */
84
+ toppedUp: {
85
+ allTime: number | null;
86
+ thisMonth: number | null;
87
+ };
45
88
  /**
46
89
  * The plan never stops usage for lack of credits.
47
90
  */
@@ -57,7 +100,7 @@ export interface AccountBillingPlan {
57
100
  */
58
101
  currentPeriodEndsAt: Temporal.Instant | null;
59
102
  /**
60
- * The plan's id in Autumn, such as `arbol_prepaid` or a customer's own plan.
103
+ * The plan's id, such as `arbol_prepaid` or a customer's own plan.
61
104
  */
62
105
  id: string;
63
106
  name: string;
@@ -79,10 +122,46 @@ export interface AccountBillingPlan {
79
122
  [key: string]: unknown;
80
123
  };
81
124
  creditsPerUnit: number;
82
- feature: "voice_minutes" | "telephony_minutes" | "whatsapp_conversations" | "whatsapp_messages" | "whatsapp_templates" | "tool_calls" | "ai_cost" | "phone_numbers" | "sisben_lookups" | "postconsultations" | "agenda_plan" | "agenda_users" | "support_fee";
125
+ feature: "voice_minutes" | "telephony_minutes" | "telephony_cost" | "whatsapp_conversations" | "whatsapp_messages" | "whatsapp_templates" | "tool_calls" | "ai_cost" | "phone_numbers" | "sisben_lookups" | "adres_lookups" | "policia_colombia_lookups" | "postconsultations" | "agenda_users" | "sms_messages" | "agenda_plan" | "support_fee";
83
126
  }[];
84
127
  status: "active" | "scheduled";
85
128
  }
129
+ /**
130
+ * A failed answer.
131
+ */
132
+ export interface AccountBillingRefusedError {
133
+ data: null;
134
+ /**
135
+ * The billing service refused the change; nothing was changed.
136
+ */
137
+ error: AccountBillingRefusedFailure;
138
+ /**
139
+ * What every answer carries besides its data or error.
140
+ */
141
+ metadata: ResponseMetadata;
142
+ success: false;
143
+ }
144
+ /**
145
+ * The billing service refused the change; nothing was changed.
146
+ */
147
+ export interface AccountBillingRefusedFailure {
148
+ /**
149
+ * The failure code, stable across releases.
150
+ */
151
+ code: "BILLING_REFUSED";
152
+ /**
153
+ * No fields.
154
+ */
155
+ data: Empty;
156
+ /**
157
+ * What went wrong, for people; it never contains input values.
158
+ */
159
+ message: string;
160
+ /**
161
+ * Whether repeating the same request may succeed.
162
+ */
163
+ retryable: false;
164
+ }
86
165
  /**
87
166
  * A successful answer.
88
167
  */
@@ -108,6 +187,31 @@ export interface AccountGetBillingServiceUnavailableError {
108
187
  success: false;
109
188
  }
110
189
  export type AccountGetBillingServiceUnavailableFailure = UpstreamUnavailableFailure | AccountBillingNotConfiguredFailure | AccountBillingUnavailableFailure;
190
+ export interface AccountUpdateBillingBody {
191
+ autoTopUp?: {
192
+ credits: number;
193
+ enabled: boolean;
194
+ perMonth: number;
195
+ threshold: number;
196
+ };
197
+ /**
198
+ * The balance at which administrators are emailed; null turns it off.
199
+ */
200
+ lowBalanceAlert?: number | null;
201
+ }
202
+ /**
203
+ * A failed answer.
204
+ */
205
+ export interface AccountUpdateBillingServiceUnavailableError {
206
+ data: null;
207
+ error: AccountUpdateBillingServiceUnavailableFailure;
208
+ /**
209
+ * What every answer carries besides its data or error.
210
+ */
211
+ metadata: ResponseMetadata;
212
+ success: false;
213
+ }
214
+ export type AccountUpdateBillingServiceUnavailableFailure = UpstreamUnavailableFailure | AccountBillingNotConfiguredFailure | AccountBillingUnavailableFailure;
111
215
  export declare const AccountBillingCodec: import("../../_/codec.js").Codec;
112
216
  export declare const AccountBillingPlanCodec: import("../../_/codec.js").Codec;
113
217
  export declare const AccountBillingResponseCodec: import("../../_/codec.js").Codec;
@@ -2,6 +2,8 @@
2
2
  /* eslint-disable */
3
3
  import { array, instant, object } from "../../_/index.js";
4
4
  export const AccountBillingCodec = object([
5
+ ["bundles", null, array(object([["resetsAt", null, instant]]))],
6
+ ["grants", null, array(object([["expiresAt", null, instant]]))],
5
7
  ["nextResetAt", null, instant],
6
8
  ["plans", null, array(() => AccountBillingPlanCodec)],
7
9
  ]);
@@ -11,8 +11,8 @@ export interface Client {
11
11
  /**
12
12
  * Open the card portal
13
13
  *
14
- * A session of Stripe's portal, where the organization's people change its
15
- * saved card and download its card receipts.
14
+ * A session of the payment processor's portal, where the organization's
15
+ * people change its saved card and download its card receipts.
16
16
  */
17
17
  create(request: CreateRequest, options?: RequestOptions): Promise<CreateResponse>;
18
18
  }
@@ -2,7 +2,7 @@ import type { Empty, ResponseMetadata, UpstreamUnavailableFailure } from "../../
2
2
  import type { AccountBillingNotConfiguredFailure, AccountBillingUnavailableFailure } from "../models.js";
3
3
  export interface AccountBillingPortalSession {
4
4
  /**
5
- * Stripe's portal, for the organization's cards and receipts.
5
+ * The payment processor's portal, for the organization's cards and receipts.
6
6
  */
7
7
  url: string;
8
8
  }
@@ -5,9 +5,11 @@ import { type Client as BillingPortalSessionsClient } from "./billingPortalSessi
5
5
  import { type Client as ColombianRecordsClient } from "./colombianRecords/client.js";
6
6
  import { type Client as ConnectionsClient } from "./connections/client.js";
7
7
  import { type Client as InvitationsClient } from "./invitations/client.js";
8
+ import { type Client as InvoicesClient } from "./invoices/client.js";
8
9
  import { type Client as MembersClient } from "./members/client.js";
9
10
  import { type Client as OrganizationClient } from "./organization/client.js";
10
11
  import { type Client as OrganizationsClient } from "./organizations/client.js";
12
+ import { type Client as PaymentMethodSetupsClient } from "./paymentMethodSetups/client.js";
11
13
  import { type Client as PermissionsClient } from "./permissions/client.js";
12
14
  import { type Client as RegistryInstallationsClient } from "./registryInstallations/client.js";
13
15
  import { type Client as RolesClient } from "./roles/client.js";
@@ -28,9 +30,11 @@ export interface Client {
28
30
  readonly colombianRecords: ColombianRecordsClient;
29
31
  readonly connections: ConnectionsClient;
30
32
  readonly invitations: InvitationsClient;
33
+ readonly invoices: InvoicesClient;
31
34
  readonly members: MembersClient;
32
35
  readonly organization: OrganizationClient;
33
36
  readonly organizations: OrganizationsClient;
37
+ readonly paymentMethodSetups: PaymentMethodSetupsClient;
34
38
  readonly permissions: PermissionsClient;
35
39
  readonly registryInstallations: RegistryInstallationsClient;
36
40
  readonly roles: RolesClient;
@@ -7,9 +7,11 @@ import { bind as bindBillingPortalSessions, } from "./billingPortalSessions/clie
7
7
  import { bind as bindColombianRecords, } from "./colombianRecords/client.js";
8
8
  import { bind as bindConnections, } from "./connections/client.js";
9
9
  import { bind as bindInvitations, } from "./invitations/client.js";
10
+ import { bind as bindInvoices, } from "./invoices/client.js";
10
11
  import { bind as bindMembers, } from "./members/client.js";
11
12
  import { bind as bindOrganization, } from "./organization/client.js";
12
13
  import { bind as bindOrganizations, } from "./organizations/client.js";
14
+ import { bind as bindPaymentMethodSetups, } from "./paymentMethodSetups/client.js";
13
15
  import { bind as bindPermissions, } from "./permissions/client.js";
14
16
  import { bind as bindRegistryInstallations, } from "./registryInstallations/client.js";
15
17
  import { bind as bindRoles, } from "./roles/client.js";
@@ -27,9 +29,11 @@ export function bind(transport) {
27
29
  let colombianRecordsClient;
28
30
  let connectionsClient;
29
31
  let invitationsClient;
32
+ let invoicesClient;
30
33
  let membersClient;
31
34
  let organizationClient;
32
35
  let organizationsClient;
36
+ let paymentMethodSetupsClient;
33
37
  let permissionsClient;
34
38
  let registryInstallationsClient;
35
39
  let rolesClient;
@@ -56,6 +60,9 @@ export function bind(transport) {
56
60
  get invitations() {
57
61
  return (invitationsClient ??= bindInvitations(transport));
58
62
  },
63
+ get invoices() {
64
+ return (invoicesClient ??= bindInvoices(transport));
65
+ },
59
66
  get members() {
60
67
  return (membersClient ??= bindMembers(transport));
61
68
  },
@@ -65,6 +72,9 @@ export function bind(transport) {
65
72
  get organizations() {
66
73
  return (organizationsClient ??= bindOrganizations(transport));
67
74
  },
75
+ get paymentMethodSetups() {
76
+ return (paymentMethodSetupsClient ??= bindPaymentMethodSetups(transport));
77
+ },
68
78
  get permissions() {
69
79
  return (permissionsClient ??= bindPermissions(transport));
70
80
  },
@@ -2,4 +2,4 @@ export { ApiError } from "../_/index.js";
2
2
  export type { RequestOptions } from "../_/index.js";
3
3
  export { createClient } from "./client.js";
4
4
  export type { Client, ClientOptions, } from "./client.js";
5
- export type { AccountAccountNotConfiguredFailure, AccountBillingNotConfiguredFailure, AccountBillingUnavailableFailure, AccountConnection, AccountCustomServerUnreachableError, AccountCustomServerUnreachableFailure, AccountCustomServerUnreachableFailureData, AccountIdentityRejectedError, AccountIdentityRejectedFailure, AccountIdentityUnavailableFailure, AccountMemberProtectedFailure, AccountProductRole, AccountRoleNotAssignableFailure, } from "./models.js";
5
+ export type { AccountAccountNotConfiguredFailure, AccountBillingNotConfiguredFailure, AccountBillingUnavailableFailure, AccountConnection, AccountCustomServerUnreachableError, AccountCustomServerUnreachableFailure, AccountCustomServerUnreachableFailureData, AccountIdentityRejectedError, AccountIdentityRejectedFailure, AccountIdentityUnavailableFailure, AccountInsufficientCreditsError, AccountInsufficientCreditsFailure, AccountMemberProtectedFailure, AccountProductRole, AccountRoleNotAssignableFailure, } from "./models.js";
@@ -14,7 +14,9 @@ export interface Client {
14
14
  * Invites someone without an Arbol account by email with a role in Raíz,
15
15
  * Agenda, Ámbar or Account. The invitation email comes from the product's own
16
16
  * application. Existing accounts receive access with `members.create` and
17
- * sign in with their current password.
17
+ * sign in with their current password. A new Agenda seat the organization's
18
+ * wallet cannot pay is refused with INSUFFICIENT_CREDITS once billing stops
19
+ * service at zero.
18
20
  */
19
21
  create(request: CreateRequest, options?: RequestOptions): Promise<CreateResponse>;
20
22
  /**
@@ -17,7 +17,7 @@ const CreateOperation = {
17
17
  route: "/v1/account/invitations",
18
18
  body: "flat",
19
19
  response: AccountInvitationResponseCodec,
20
- errors: { "400": true, "401": true, "403": true, "409": true, "413": true, "415": true, "429": true, "500": true, "502": true, "503": true, "504": true },
20
+ errors: { "400": true, "401": true, "402": true, "403": true, "409": true, "413": true, "415": true, "429": true, "500": true, "502": true, "503": true, "504": true },
21
21
  };
22
22
  const DeleteOperation = {
23
23
  method: "DELETE",
@@ -0,0 +1,36 @@
1
+ import { type BaseClientOptions, type RequestOptions, Transport } from "../../_/index.js";
2
+ import { type AccountInvoicePageResponse } from "./models.js";
3
+ export interface ClientOptions extends BaseClientOptions {
4
+ /**
5
+ * The URL the paths of the API are relative to.
6
+ */
7
+ baseUrl: string;
8
+ }
9
+ export interface Client {
10
+ /**
11
+ * List invoices
12
+ *
13
+ * The organization's invoices in one list, newest first: those the payment
14
+ * processor generated, each with its own page, and those Arbol issued and
15
+ * uploaded, each with its files. One page: the most recent `limit`.
16
+ */
17
+ list(request?: ListRequest, options?: RequestOptions): Promise<ListResponse>;
18
+ }
19
+ export declare function createClient(options: ClientOptions): Client;
20
+ export declare function bind(transport: Transport): Client;
21
+ export interface ListRequest {
22
+ /**
23
+ * Opaque cursor returned by pageInfo; omit it to request the first page.
24
+ */
25
+ cursor?: string;
26
+ /**
27
+ * Direction to traverse the stable keyset ordering from the supplied cursor.
28
+ */
29
+ direction?: "forward" | "backward";
30
+ /**
31
+ * Maximum items returned in one page. Defaults to 25; larger reads require
32
+ * another cursor.
33
+ */
34
+ limit?: number;
35
+ }
36
+ export type ListResponse = AccountInvoicePageResponse;
@@ -0,0 +1,19 @@
1
+ // Code generated by forge. DO NOT EDIT.
2
+ /* eslint-disable */
3
+ import { Transport, } from "../../_/index.js";
4
+ import { AccountInvoicePageResponseCodec, } from "./models.js";
5
+ export function createClient(options) {
6
+ return bind(new Transport(options));
7
+ }
8
+ export function bind(transport) {
9
+ return {
10
+ list: (request, options) => transport.send(ListOperation, request, options),
11
+ };
12
+ }
13
+ const ListOperation = {
14
+ method: "GET",
15
+ route: "/v1/account/invoices",
16
+ query: { cursor: "cursor", direction: "direction", limit: "limit" },
17
+ response: AccountInvoicePageResponseCodec,
18
+ errors: { "400": true, "401": true, "403": true, "429": true, "500": true, "502": true, "503": true, "504": true },
19
+ };
@@ -0,0 +1,5 @@
1
+ export { ApiError } from "../../_/index.js";
2
+ export type { RequestOptions } from "../../_/index.js";
3
+ export { createClient } from "./client.js";
4
+ export type { Client, ClientOptions, ListRequest, ListResponse, } from "./client.js";
5
+ export type { AccountInvoice, AccountInvoicePage, AccountInvoicePageResponse, AccountListInvoicesServiceUnavailableError, AccountListInvoicesServiceUnavailableFailure, } from "./models.js";
@@ -0,0 +1,4 @@
1
+ // Code generated by forge. DO NOT EDIT.
2
+ /* eslint-disable */
3
+ export { ApiError } from "../../_/index.js";
4
+ export { createClient } from "./client.js";
@@ -0,0 +1,75 @@
1
+ import type { PageInfo, ResponseMetadata, UpstreamUnavailableFailure } from "../../models.js";
2
+ import type { AccountBillingNotConfiguredFailure, AccountBillingUnavailableFailure } from "../models.js";
3
+ export interface AccountInvoice {
4
+ /**
5
+ * ISO 4217, such as USD.
6
+ */
7
+ currency: string;
8
+ /**
9
+ * The files of an uploaded invoice, served by GET
10
+ * /v1/invoice-files/{invoiceId}.
11
+ */
12
+ files: ("pdf" | "xml")[];
13
+ /**
14
+ * The generated invoice's own page.
15
+ */
16
+ hostedUrl: string | null;
17
+ id: string;
18
+ issuedAt: Temporal.Instant | null;
19
+ number: string | null;
20
+ periodEndsAt: Temporal.Instant | null;
21
+ periodStartsAt: Temporal.Instant | null;
22
+ /**
23
+ * `generated`: issued by the payment processor, opened on `hostedUrl`;
24
+ * `uploaded`: issued by Arbol, downloaded as a file.
25
+ */
26
+ source: "generated" | "uploaded";
27
+ status: "open" | "paid" | "void" | "uncollectible";
28
+ /**
29
+ * An electronic invoice's number at the tax authority (Colombia's CUFE).
30
+ */
31
+ taxAuthorityNumber: string | null;
32
+ total: number | null;
33
+ }
34
+ export interface AccountInvoicePage {
35
+ /**
36
+ * Items admitted by this resource contract within the verified organization.
37
+ */
38
+ data: AccountInvoice[];
39
+ /**
40
+ * Discriminator for a resource list response.
41
+ */
42
+ object: "list";
43
+ /**
44
+ * Opaque navigation cursors for this page’s stable keyset order.
45
+ */
46
+ pageInfo: PageInfo;
47
+ }
48
+ /**
49
+ * A successful answer.
50
+ */
51
+ export interface AccountInvoicePageResponse {
52
+ data: AccountInvoicePage;
53
+ error: null;
54
+ /**
55
+ * What every answer carries besides its data or error.
56
+ */
57
+ metadata: ResponseMetadata;
58
+ success: true;
59
+ }
60
+ /**
61
+ * A failed answer.
62
+ */
63
+ export interface AccountListInvoicesServiceUnavailableError {
64
+ data: null;
65
+ error: AccountListInvoicesServiceUnavailableFailure;
66
+ /**
67
+ * What every answer carries besides its data or error.
68
+ */
69
+ metadata: ResponseMetadata;
70
+ success: false;
71
+ }
72
+ export type AccountListInvoicesServiceUnavailableFailure = UpstreamUnavailableFailure | AccountBillingNotConfiguredFailure | AccountBillingUnavailableFailure;
73
+ export declare const AccountInvoiceCodec: import("../../_/codec.js").Codec;
74
+ export declare const AccountInvoicePageCodec: import("../../_/codec.js").Codec;
75
+ export declare const AccountInvoicePageResponseCodec: import("../../_/codec.js").Codec;
@@ -0,0 +1,14 @@
1
+ // Code generated by forge. DO NOT EDIT.
2
+ /* eslint-disable */
3
+ import { array, instant, object } from "../../_/index.js";
4
+ export const AccountInvoiceCodec = object([
5
+ ["issuedAt", null, instant],
6
+ ["periodEndsAt", null, instant],
7
+ ["periodStartsAt", null, instant],
8
+ ]);
9
+ export const AccountInvoicePageCodec = object([
10
+ ["data", null, array(() => AccountInvoiceCodec)],
11
+ ]);
12
+ export const AccountInvoicePageResponseCodec = object([
13
+ ["data", null, () => AccountInvoicePageCodec],
14
+ ]);
@@ -14,7 +14,9 @@ export interface Client {
14
14
  * Gives someone with an existing Arbol account a role in Raíz, Agenda, Ámbar
15
15
  * or Account, joining them to this organization when needed. They sign in
16
16
  * with their current password. Someone without an account is invited with
17
- * `invitations.create`.
17
+ * `invitations.create`. A new Agenda seat the organization's wallet cannot
18
+ * pay is refused with INSUFFICIENT_CREDITS once billing stops service at
19
+ * zero.
18
20
  */
19
21
  create(request: CreateRequest, options?: RequestOptions): Promise<CreateResponse>;
20
22
  /**
@@ -35,7 +37,9 @@ export interface Client {
35
37
  * Change someone's role in a product
36
38
  *
37
39
  * Sets a member's role in Raíz, Agenda, Ámbar or Account, or removes their
38
- * access to that product with null. Their other roles stay.
40
+ * access to that product with null. Their other roles stay. A new Agenda seat
41
+ * the organization's wallet cannot pay is refused with INSUFFICIENT_CREDITS
42
+ * once billing stops service at zero.
39
43
  */
40
44
  update(request: UpdateRequest, options?: RequestOptions): Promise<UpdateResponse>;
41
45
  }
@@ -17,7 +17,7 @@ const CreateOperation = {
17
17
  route: "/v1/account/members",
18
18
  body: "flat",
19
19
  response: null,
20
- errors: { "400": true, "401": true, "403": true, "404": true, "409": true, "413": true, "415": true, "429": true, "500": true, "502": true, "503": true, "504": true },
20
+ errors: { "400": true, "401": true, "402": true, "403": true, "404": true, "409": true, "413": true, "415": true, "429": true, "500": true, "502": true, "503": true, "504": true },
21
21
  };
22
22
  const DeleteOperation = {
23
23
  method: "DELETE",
@@ -37,5 +37,5 @@ const UpdateOperation = {
37
37
  route: "/v1/account/members/{memberId}",
38
38
  body: "flat",
39
39
  response: null,
40
- errors: { "400": true, "401": true, "403": true, "404": true, "409": true, "413": true, "415": true, "429": true, "500": true, "502": true, "503": true, "504": true },
40
+ errors: { "400": true, "401": true, "402": true, "403": true, "404": true, "409": true, "413": true, "415": true, "429": true, "500": true, "502": true, "503": true, "504": true },
41
41
  };
@@ -291,6 +291,44 @@ export interface AccountIdentityUnavailableFailure {
291
291
  */
292
292
  retryable: true;
293
293
  }
294
+ /**
295
+ * A failed answer.
296
+ */
297
+ export interface AccountInsufficientCreditsError {
298
+ data: null;
299
+ /**
300
+ * The organization's wallet has no credits for this; nothing was changed. Top
301
+ * up, then try again.
302
+ */
303
+ error: AccountInsufficientCreditsFailure;
304
+ /**
305
+ * What every answer carries besides its data or error.
306
+ */
307
+ metadata: ResponseMetadata;
308
+ success: false;
309
+ }
310
+ /**
311
+ * The organization's wallet has no credits for this; nothing was changed. Top
312
+ * up, then try again.
313
+ */
314
+ export interface AccountInsufficientCreditsFailure {
315
+ /**
316
+ * The failure code, stable across releases.
317
+ */
318
+ code: "INSUFFICIENT_CREDITS";
319
+ /**
320
+ * No fields.
321
+ */
322
+ data: Empty;
323
+ /**
324
+ * What went wrong, for people; it never contains input values.
325
+ */
326
+ message: string;
327
+ /**
328
+ * Whether repeating the same request may succeed.
329
+ */
330
+ retryable: false;
331
+ }
294
332
  /**
295
333
  * This person holds access that only Arbol changes.
296
334
  */
@@ -0,0 +1,25 @@
1
+ import { type BaseClientOptions, type RequestOptions, Transport } from "../../_/index.js";
2
+ import type { Empty } from "../../models.js";
3
+ import type { AccountPaymentMethodSetupResponse } from "./models.js";
4
+ export interface ClientOptions extends BaseClientOptions {
5
+ /**
6
+ * The URL the paths of the API are relative to.
7
+ */
8
+ baseUrl: string;
9
+ }
10
+ export interface Client {
11
+ /**
12
+ * Add or change the card
13
+ *
14
+ * A page of the payment processor to add or change the organization's card
15
+ * without buying anything; the card becomes the one top-ups charge, and the
16
+ * person comes back to the Payment page.
17
+ */
18
+ create(request: CreateRequest, options?: RequestOptions): Promise<CreateResponse>;
19
+ }
20
+ export declare function createClient(options: ClientOptions): Client;
21
+ export declare function bind(transport: Transport): Client;
22
+ export interface CreateRequest {
23
+ body: Empty;
24
+ }
25
+ export type CreateResponse = AccountPaymentMethodSetupResponse;
@@ -0,0 +1,18 @@
1
+ // Code generated by forge. DO NOT EDIT.
2
+ /* eslint-disable */
3
+ import { Transport, } from "../../_/index.js";
4
+ export function createClient(options) {
5
+ return bind(new Transport(options));
6
+ }
7
+ export function bind(transport) {
8
+ return {
9
+ create: (request, options) => transport.send(CreateOperation, request, options),
10
+ };
11
+ }
12
+ const CreateOperation = {
13
+ method: "POST",
14
+ route: "/v1/account/payment-method-setups",
15
+ body: "nested",
16
+ response: null,
17
+ errors: { "400": true, "401": true, "403": true, "413": true, "415": true, "429": true, "500": true, "502": true, "503": true, "504": true },
18
+ };
@@ -0,0 +1,5 @@
1
+ export { ApiError } from "../../_/index.js";
2
+ export type { RequestOptions } from "../../_/index.js";
3
+ export { createClient } from "./client.js";
4
+ export type { Client, ClientOptions, CreateRequest, CreateResponse, } from "./client.js";
5
+ export type { AccountCreatePaymentMethodSetupServiceUnavailableError, AccountCreatePaymentMethodSetupServiceUnavailableFailure, AccountPaymentMethodSetup, AccountPaymentMethodSetupResponse, } from "./models.js";
@@ -0,0 +1,4 @@
1
+ // Code generated by forge. DO NOT EDIT.
2
+ /* eslint-disable */
3
+ export { ApiError } from "../../_/index.js";
4
+ export { createClient } from "./client.js";