@beel_es/sdk 2.0.0 → 2.2.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 (41) hide show
  1. package/CHANGELOG.md +244 -0
  2. package/README.md +216 -25
  3. package/dist/index.d.mts +1480 -185
  4. package/dist/index.d.ts +1480 -185
  5. package/dist/index.js +1419 -187
  6. package/dist/index.js.map +1 -1
  7. package/dist/index.mjs +1416 -187
  8. package/dist/index.mjs.map +1 -1
  9. package/docs/reference/README.md +233 -0
  10. package/docs/reference/account-companies.md +55 -0
  11. package/docs/reference/account-invitations.md +57 -0
  12. package/docs/reference/account-members.md +97 -0
  13. package/docs/reference/account-webhooks.md +123 -0
  14. package/docs/reference/account.md +94 -0
  15. package/docs/reference/accounts.md +72 -0
  16. package/docs/reference/catalogs.md +68 -0
  17. package/docs/reference/client.md +113 -0
  18. package/docs/reference/company-customers.md +85 -0
  19. package/docs/reference/company-invoices-schedule.md +52 -0
  20. package/docs/reference/company-invoices.md +316 -0
  21. package/docs/reference/company-payment-connections-events.md +103 -0
  22. package/docs/reference/company-payment-connections.md +87 -0
  23. package/docs/reference/company-products.md +72 -0
  24. package/docs/reference/company-recurring-invoices.md +136 -0
  25. package/docs/reference/company-series.md +94 -0
  26. package/docs/reference/company-tax-configuration.md +36 -0
  27. package/docs/reference/company-verifactu-configuration.md +41 -0
  28. package/docs/reference/company.md +94 -0
  29. package/docs/reference/configuration.md +90 -0
  30. package/docs/reference/customer-builder.md +107 -0
  31. package/docs/reference/customers.md +91 -0
  32. package/docs/reference/errors.md +72 -0
  33. package/docs/reference/invoice-builder.md +149 -0
  34. package/docs/reference/invoices.md +250 -0
  35. package/docs/reference/nif.md +31 -0
  36. package/docs/reference/products.md +111 -0
  37. package/docs/reference/series.md +81 -0
  38. package/docs/reference/types.md +222 -0
  39. package/docs/reference/webhook-verifier.md +95 -0
  40. package/llms.txt +52 -0
  41. package/package.json +10 -4
@@ -0,0 +1,94 @@
1
+ <!-- Generated by `npm run docs:reference` from the SDK source and openapi/public-api.yaml. Do not edit. -->
2
+
3
+ # `beel.account(accountId)` — `AccountScope`
4
+
5
+ [Reference index](README.md)
6
+
7
+ Operations scoped to one account: its companies (NIFs), members, invitations, webhooks
8
+ and usage. Reach it as `beel.account(accountId)`.
9
+
10
+ **Example**
11
+
12
+ ```typescript
13
+ const { companies } = await beel.account('account-uuid').companies.list();
14
+ const company = beel.company(companies[0].id!);
15
+ ```
16
+
17
+ ## Properties
18
+
19
+ | Property | Type | Description |
20
+ |---|---|---|
21
+ | `members` | [`AccountMembersResource`](account-members.md) | Members of the account and their per-company grants. |
22
+ | `invitations` | [`AccountInvitationsResource`](account-invitations.md) | Invitations to join the account. |
23
+ | `webhooks` | [`AccountWebhooksResource`](account-webhooks.md) | Webhook subscriptions of the account. |
24
+ | `companies` | [`AccountCompaniesResource`](account-companies.md) | Companies (NIFs) of the account — where company ids come from. |
25
+
26
+ ## Methods
27
+
28
+ | Method | HTTP | Summary |
29
+ |---|---|---|
30
+ | [`beel.account(accountId).get()`](#account-get) | `GET /v1/accounts/{account_id}` | Get the account summary. |
31
+ | [`beel.account(accountId).usage()`](#account-usage) | `GET /v1/accounts/{account_id}/usage` | Provisioning usage counters for billing: provisioned accounts and NIFs. |
32
+ | [`beel.account(accountId).changeAccessLevel(body)`](#account-change-access-level) | `PATCH /v1/accounts/{account_id}/access-level` | Change the access level you keep over this account. |
33
+ | [`beel.account(accountId).endManagement()`](#account-end-management) | `DELETE /v1/accounts/{account_id}/management` | End your management of this account: you lose access, and the holder keeps the account, its NIFs and its invoices. |
34
+ | [`beel.account(accountId).createClaimToken(body?)`](#account-create-claim-token) | `POST /v1/accounts/{account_id}/claim-tokens` | Issue a single-use claim token so the account's holder can take ownership. |
35
+ | [`beel.account(accountId).setOwner(body)`](#account-set-owner) | `PUT /v1/accounts/{account_id}/owner` | Make an existing member the account's owner. |
36
+
37
+ <a id="account-get"></a>
38
+ ### `get()`
39
+
40
+ Get the account summary.
41
+
42
+ - **HTTP:** `GET /v1/accounts/{account_id}` · operation `getAccount` · scopes `accounts:read`
43
+ - **Returns:** The account summary. Response `200` `data`: `ManagedAccountSummary`.
44
+ - **Throws:** `401`/`403` `BeeLAuthError` · `429` `BeeLRateLimitError` · `500` `BeeLApiError`
45
+
46
+ <a id="account-usage"></a>
47
+ ### `usage()`
48
+
49
+ Provisioning usage counters for billing: provisioned accounts and NIFs.
50
+
51
+ - **HTTP:** `GET /v1/accounts/{account_id}/usage` · operation `getAccountUsage` · scopes `accounts:read`
52
+ - **Returns:** `provisioned_accounts` and `nifs`. Response `200` `data`: `ProvisioningUsage`.
53
+ - **Throws:** `401`/`403` `BeeLAuthError` · `404` `BeeLNotFoundError` · `429` `BeeLRateLimitError` · `500` `BeeLApiError`
54
+
55
+ <a id="account-change-access-level"></a>
56
+ ### `changeAccessLevel(body)`
57
+
58
+ Change the access level you keep over this account. Raising it is only possible while
59
+ the account is unclaimed.
60
+
61
+ - **HTTP:** `PATCH /v1/accounts/{account_id}/access-level` · operation `changeManagedAccountAccessLevel` · scopes `accounts:write`
62
+ - **Parameters:**
63
+ - `body: NonNullable<operations['changeManagedAccountAccessLevel']['requestBody']>['content']['application/json']` — The new `access_level`.
64
+ - **Throws:** `400`/`500` `BeeLApiError` · `401`/`403` `BeeLAuthError` · `429` `BeeLRateLimitError`
65
+
66
+ <a id="account-end-management"></a>
67
+ ### `endManagement()`
68
+
69
+ End your management of this account: you lose access, and the holder keeps the
70
+ account, its NIFs and its invoices.
71
+
72
+ - **HTTP:** `DELETE /v1/accounts/{account_id}/management` · operation `endAccountManagement` · scopes `accounts:write`
73
+ - **Throws:** `401`/`403` `BeeLAuthError` · `429` `BeeLRateLimitError` · `500` `BeeLApiError`
74
+
75
+ <a id="account-create-claim-token"></a>
76
+ ### `createClaimToken(body?)`
77
+
78
+ Issue a single-use claim token so the account's holder can take ownership.
79
+
80
+ - **HTTP:** `POST /v1/accounts/{account_id}/claim-tokens` · operation `createAccountClaimToken` · scopes `accounts:write` · accepts `Idempotency-Key`
81
+ - **Parameters:**
82
+ - `body?: NonNullable<operations['createAccountClaimToken']['requestBody']>['content']['application/json']` — `email` when the account has no holder yet; omit to re-issue.
83
+ - **Returns:** `claim_token`, `claim_url` and `expires_at`. Response `201` `data`: `ClaimTokenResult`.
84
+ - **Throws:** `401`/`403` `BeeLAuthError` · `404` `BeeLNotFoundError` · `409` `BeeLConflictError` · `422` `BeeLValidationError` · `429` `BeeLRateLimitError` · `500` `BeeLApiError`
85
+
86
+ <a id="account-set-owner"></a>
87
+ ### `setOwner(body)`
88
+
89
+ Make an existing member the account's owner. Repeatable: it states the desired owner.
90
+
91
+ - **HTTP:** `PUT /v1/accounts/{account_id}/owner` · operation `putAccountOwner` · accepts `Idempotency-Key`
92
+ - **Parameters:**
93
+ - `body: operations['putAccountOwner']['requestBody']['content']['application/json']` — The member that becomes owner.
94
+ - **Throws:** `400`/`500` `BeeLApiError` · `401`/`403` `BeeLAuthError` · `404` `BeeLNotFoundError` · `429` `BeeLRateLimitError`
@@ -0,0 +1,72 @@
1
+ <!-- Generated by `npm run docs:reference` from the SDK source and openapi/public-api.yaml. Do not edit. -->
2
+
3
+ # `beel.accounts` — `AccountsResource`
4
+
5
+ [Reference index](README.md)
6
+
7
+ Accounts you provisioned and manage (multi-account provisioning for platforms and
8
+ advisory firms). Reach it as `beel.accounts`; scope one with `beel.account(accountId)`.
9
+
10
+ Every method rejects with a `BeeLApiError` subclass when the API answers non-2xx.
11
+
12
+ **Example**
13
+
14
+ ```typescript
15
+ const { accounts } = await beel.accounts.list();
16
+ const account = beel.accounts.scope(accounts[0].account_id);
17
+ const members = await account.members.list();
18
+ ```
19
+
20
+ ## Methods
21
+
22
+ | Method | HTTP | Summary |
23
+ |---|---|---|
24
+ | [`beel.accounts.list(params?)`](#accounts-list) | `GET /v1/accounts` | List the accounts you provisioned, newest first. |
25
+ | [`beel.accounts.provision(body)`](#accounts-provision) | `POST /v1/accounts` | Provision a new managed account. |
26
+ | [`beel.accounts.get(accountId)`](#accounts-get) | `GET /v1/accounts/{account_id}` | Get a managed account. |
27
+ | [`beel.accounts.scope(accountId)`](#accounts-scope) | — | Alias of `beel.account(accountId)`: the operations scoped to one account. |
28
+
29
+ <a id="accounts-list"></a>
30
+ ### `list(params?)`
31
+
32
+ List the accounts you provisioned, newest first. Cursor-paginated: pass the
33
+ `next_cursor` of one page as `cursor` of the next until it is `null`.
34
+
35
+ - **HTTP:** `GET /v1/accounts` · operation `listAccounts` · scopes `accounts:read`
36
+ - **Parameters:**
37
+ - `params?: operations['listAccounts']['parameters']['query']` — `status`, `external_ref` (exact), `limit`, `cursor`.
38
+ - **Returns:** The `accounts` of the page and `next_cursor`. Response `200` `data`: `{ accounts: ManagedAccountSummary[]; next_cursor?: string | null }`.
39
+ - **Throws:** `400`/`500` `BeeLApiError` · `401`/`403` `BeeLAuthError` · `422` `BeeLValidationError` · `429` `BeeLRateLimitError`
40
+
41
+ <a id="accounts-provision"></a>
42
+ ### `provision(body)`
43
+
44
+ Provision a new managed account. Idempotent by `external_ref`: sending the same one
45
+ again returns the same account. Answers with the provisioning result — the account id,
46
+ its status and, when one is issued, the claim link — not with the account summary.
47
+
48
+ - **HTTP:** `POST /v1/accounts` · operation `provisionAccount` · scopes `accounts:write` · accepts `Idempotency-Key`
49
+ - **Parameters:**
50
+ - `body: operations['provisionAccount']['requestBody']['content']['application/json']` — `external_ref` and the holder's details.
51
+ - **Returns:** `account_id`, `status` and the claim link state. Response `201` `data`: `ProvisionAccountResult`.
52
+ - **Throws:** `400`/`500`/`502` `BeeLApiError` · `401`/`403` `BeeLAuthError` · `409` `BeeLConflictError` · `422` `BeeLValidationError` · `429` `BeeLRateLimitError`
53
+
54
+ <a id="accounts-get"></a>
55
+ ### `get(accountId)`
56
+
57
+ Get a managed account.
58
+
59
+ - **HTTP:** `GET /v1/accounts/{account_id}` · operation `getAccount` · scopes `accounts:read`
60
+ - **Parameters:**
61
+ - `accountId: string` — Account UUID.
62
+ - **Returns:** The account summary. Response `200` `data`: `ManagedAccountSummary`.
63
+ - **Throws:** `401`/`403` `BeeLAuthError` · `429` `BeeLRateLimitError` · `500` `BeeLApiError`
64
+
65
+ <a id="accounts-scope"></a>
66
+ ### `scope(accountId)`
67
+
68
+ Alias of `beel.account(accountId)`: the operations scoped to one account.
69
+
70
+ - **Parameters:**
71
+ - `accountId: string` — Account UUID.
72
+ - **Returns:** The account scope. No request is made.
@@ -0,0 +1,68 @@
1
+ <!-- Generated by `npm run docs:reference` from the SDK source and openapi/public-api.yaml. Do not edit. -->
2
+
3
+ # `beel.catalogs` — `CatalogsResource`
4
+
5
+ [Reference index](README.md)
6
+
7
+ Account-wide catalogs, the credential's identity and personal preferences, on their
8
+ canonical paths. Reach it as `beel.catalogs`.
9
+
10
+ These replace the `/v1/configuration/*` reads on `ConfigurationResource`,
11
+ whose flat routes are deprecated.
12
+
13
+ ## Methods
14
+
15
+ | Method | HTTP | Summary |
16
+ |---|---|---|
17
+ | [`beel.catalogs.identity()`](#catalogs-identity) | `GET /v1/me/identity` | Who the API key belongs to: its `account_id` — the starting point to list the account's companies — plus the person's email, name and language, and the credential. |
18
+ | [`beel.catalogs.taxTypes()`](#catalogs-tax-types) | `GET /v1/tax-types` | Tax types the API accepts. |
19
+ | [`beel.catalogs.invoiceCustomizationOptions()`](#catalogs-invoice-customization-options) | `GET /v1/invoice-customization-options` | Invoice PDF templates and customization options. |
20
+ | [`beel.catalogs.updateMe(body)`](#catalogs-update-me) | `PATCH /v1/me` | Update the signed-in person's preferences. |
21
+
22
+ <a id="catalogs-identity"></a>
23
+ ### `identity()`
24
+
25
+ Who the API key belongs to: its `account_id` — the starting point to list the
26
+ account's companies — plus the person's email, name and language, and the credential.
27
+ Needs no scope, so it also confirms that a key works.
28
+
29
+ - **HTTP:** `GET /v1/me/identity` · operation `getMyIdentity`
30
+ - **Returns:** The identity of the credential. Response `200` `data`: `MyIdentity`.
31
+ - **Throws:** `401`/`403` `BeeLAuthError` · `429` `BeeLRateLimitError` · `500` `BeeLApiError`
32
+
33
+ **Example**
34
+
35
+ ```typescript
36
+ const { account_id } = await beel.catalogs.identity();
37
+ const { companies } = await beel.account(account_id).companies.list();
38
+ ```
39
+
40
+ <a id="catalogs-tax-types"></a>
41
+ ### `taxTypes()`
42
+
43
+ Tax types the API accepts. Canonical form of `configuration/tax-types`.
44
+
45
+ - **HTTP:** `GET /v1/tax-types` · operation `listTaxTypes` · scopes `configuration:read`
46
+ - **Returns:** The tax types catalog. Response `200` `data`: `TaxTypesCatalog`.
47
+ - **Throws:** `400`/`500` `BeeLApiError` · `401`/`403` `BeeLAuthError` · `429` `BeeLRateLimitError`
48
+
49
+ <a id="catalogs-invoice-customization-options"></a>
50
+ ### `invoiceCustomizationOptions()`
51
+
52
+ Invoice PDF templates and customization options. Canonical form of the `configuration` read.
53
+
54
+ - **HTTP:** `GET /v1/invoice-customization-options` · operation `listInvoiceCustomizationOptions` · scopes `configuration:read`
55
+ - **Returns:** The customization options. Response `200` `data`: `InvoiceCustomizationOptionsResponse`.
56
+ - **Throws:** `401`/`403` `BeeLAuthError` · `429` `BeeLRateLimitError` · `500` `BeeLApiError`
57
+
58
+ <a id="catalogs-update-me"></a>
59
+ ### `updateMe(body)`
60
+
61
+ Update the signed-in person's preferences. Canonical form of
62
+ `PUT /v1/configuration/language`: the language belongs to the person, not to a company.
63
+
64
+ - **HTTP:** `PATCH /v1/me` · operation `updateMe` · scopes `configuration:write`
65
+ - **Parameters:**
66
+ - `body: components['schemas']['UpdateMeRequest']` — Preferences to change, e.g. `{ language: 'es' }`.
67
+ - **Returns:** The updated preferences. Response `200` `data`: `MyPreferences`.
68
+ - **Throws:** `400`/`500` `BeeLApiError` · `401`/`403` `BeeLAuthError` · `422` `BeeLValidationError` · `429` `BeeLRateLimitError`
@@ -0,0 +1,113 @@
1
+ <!-- Generated by `npm run docs:reference` from the SDK source and openapi/public-api.yaml. Do not edit. -->
2
+
3
+ # `beel` — `BeeL`
4
+
5
+ [Reference index](README.md)
6
+
7
+ The BeeL API client. Create one per API key and reuse it; it holds no global state.
8
+ Address a company with `company` and an account with `account`.
9
+
10
+ Requests are retried automatically when it is safe — see `BeeLConfig` — and every `POST`
11
+ carries an `Idempotency-Key` that those retries reuse.
12
+
13
+ **Example**
14
+
15
+ ```typescript
16
+ import { BeeL } from '@beel_es/sdk';
17
+
18
+ const beel = new BeeL({ apiKey: process.env.BEEL_API_KEY! });
19
+
20
+ const invoice = await beel.company('company-uuid').invoices.create({
21
+ type: 'STANDARD',
22
+ recipient: { customer_id: 'customer-uuid' },
23
+ lines: [{
24
+ description: 'Service', quantity: 1, unit_price: 100,
25
+ main_tax: { type: 'IVA', percentage: 21, regime_key: '01' },
26
+ }],
27
+ });
28
+ ```
29
+
30
+ ## Constructor
31
+
32
+ ```typescript
33
+ new BeeL(config: BeeLConfig)
34
+ ```
35
+
36
+ `config` is a [`BeeLConfig`](types.md#beelconfig).
37
+
38
+ ## Properties
39
+
40
+ | Property | Type | Description |
41
+ |---|---|---|
42
+ | `invoices` | [`InvoicesResource`](invoices.md) | **Deprecated.** Session-focus endpoints are deprecated in the API contract. |
43
+ | `customers` | [`CustomersResource`](customers.md) | **Deprecated.** Session-focus endpoints are deprecated in the API contract. |
44
+ | `products` | [`ProductsResource`](products.md) | **Deprecated.** Session-focus endpoints are deprecated in the API contract. |
45
+ | `configuration` | [`ConfigurationResource`](configuration.md) | **Deprecated.** Session-focus configuration endpoints are deprecated in the API contract. |
46
+ | `series` | [`SeriesResource`](series.md) | **Deprecated.** Session-focus endpoints are deprecated in the API contract. |
47
+ | `catalogs` | [`CatalogsResource`](catalogs.md) | Account-wide catalogs, the credential's identity and personal preferences. |
48
+ | `nif` | [`NifResource`](nif.md) | NIF validation against the AEAT register. |
49
+ | `accounts` | [`AccountsResource`](accounts.md) | Accounts you manage (multi-account provisioning: members, invitations, webhooks, companies). |
50
+ | `raw` | `ReturnType<typeof createBeeLClient>` | The typed client underneath, for any endpoint this SDK does not wrap yet. |
51
+
52
+ ## Methods
53
+
54
+ | Method | HTTP | Summary |
55
+ |---|---|---|
56
+ | [`beel.company(companyId)`](#client-company) | — | Returns a facade scoped to one company (NIF) — the explicit multi-NIF surface. |
57
+ | [`beel.account(accountId)`](#client-account) | — | Returns a facade scoped to one account — companies, members, invitations, account webhooks, usage. |
58
+ | [`beel.downloadPdf(invoiceId)`](#client-download-pdf) | — | **Deprecated.** Download an invoice PDF as a Buffer. |
59
+
60
+ <a id="client-company"></a>
61
+ ### `company(companyId)`
62
+
63
+ Returns a facade scoped to one company (NIF) — the explicit multi-NIF surface.
64
+ All operations address the company in the path, no session focus needed. No request
65
+ is made; get the ids from `beel.account(accountId).companies.list()`.
66
+
67
+ - **Parameters:**
68
+ - `companyId: string` — Company UUID (not its NIF).
69
+ - **Returns:** The company scope.
70
+
71
+ **Example**
72
+
73
+ ```typescript
74
+ const company = beel.company('company-uuid');
75
+ const { invoices } = await company.invoices.list({ status: 'ISSUED' });
76
+ ```
77
+
78
+ <a id="client-account"></a>
79
+ ### `account(accountId)`
80
+
81
+ Returns a facade scoped to one account — companies, members, invitations, account
82
+ webhooks, usage. Symmetric with `company`. No request is made; your own account
83
+ id is `(await beel.catalogs.identity()).account_id`.
84
+
85
+ - **Parameters:**
86
+ - `accountId: string` — Account UUID.
87
+ - **Returns:** The account scope.
88
+
89
+ **Example**
90
+
91
+ ```typescript
92
+ const account = beel.account('account-uuid');
93
+ const members = await account.members.list();
94
+ ```
95
+
96
+ <a id="client-download-pdf"></a>
97
+ ### `downloadPdf(invoiceId)`
98
+
99
+ > **Deprecated.** Relies on the deprecated session-focus PDF endpoint. Use `beel.company(companyId).invoices.getPdf(invoiceId)` and fetch `download_url` instead.
100
+
101
+ Download an invoice PDF as a Buffer.
102
+
103
+ - **Parameters:**
104
+ - `invoiceId: string` — Invoice UUID.
105
+ - **Returns:** The PDF bytes and its file name.
106
+ - **Throws:** `Error` When downloading the file fails.
107
+
108
+ **Example**
109
+
110
+ ```typescript
111
+ const { buffer, fileName } = await beel.downloadPdf('invoice-uuid');
112
+ fs.writeFileSync(fileName, buffer);
113
+ ```
@@ -0,0 +1,85 @@
1
+ <!-- Generated by `npm run docs:reference` from the SDK source and openapi/public-api.yaml. Do not edit. -->
2
+
3
+ # `beel.company(companyId).customers` — `CompanyCustomersResource`
4
+
5
+ [Reference index](README.md)
6
+
7
+ Customers of one company. Reach it as `beel.company(companyId).customers`.
8
+
9
+ ## Methods
10
+
11
+ | Method | HTTP | Summary |
12
+ |---|---|---|
13
+ | [`beel.company(companyId).customers.list(params?)`](#company-customers-list) | `GET /v1/companies/{company_id}/customers` | List the company's customers, paginated and searchable. |
14
+ | [`beel.company(companyId).customers.create(body)`](#company-customers-create) | `POST /v1/companies/{company_id}/customers` | Create a customer. |
15
+ | [`beel.company(companyId).customers.createBulk(body)`](#company-customers-create-bulk) | `POST /v1/companies/{company_id}/customers/bulk` | Create several customers in one call. |
16
+ | [`beel.company(companyId).customers.get(customerId)`](#company-customers-get) | `GET /v1/companies/{company_id}/customers/{customer_id}` | Get one customer. |
17
+ | [`beel.company(companyId).customers.update(customerId, body)`](#company-customers-update) | `PATCH /v1/companies/{company_id}/customers/{customer_id}` | Update a customer. |
18
+ | [`beel.company(companyId).customers.delete(customerId)`](#company-customers-delete) | `DELETE /v1/companies/{company_id}/customers/{customer_id}` | Delete a customer that has no invoices. |
19
+
20
+ <a id="company-customers-list"></a>
21
+ ### `list(params?)`
22
+
23
+ List the company's customers, paginated and searchable.
24
+
25
+ - **HTTP:** `GET /v1/companies/{company_id}/customers` · operation `listCompanyCustomers` · scopes `customers:read`
26
+ - **Parameters:**
27
+ - `params?: operations['listCompanyCustomers']['parameters']['query']` — Filters and pagination.
28
+ - **Returns:** The page of `customers` and its `pagination`. Response `200` `data`: `{ customers: Customer[]; pagination: Pagination }`.
29
+ - **Throws:** `400`/`500` `BeeLApiError` · `401`/`403` `BeeLAuthError` · `422` `BeeLValidationError` · `429` `BeeLRateLimitError`
30
+
31
+ <a id="company-customers-create"></a>
32
+ ### `create(body)`
33
+
34
+ Create a customer.
35
+
36
+ - **HTTP:** `POST /v1/companies/{company_id}/customers` · operation `createCompanyCustomer` · scopes `customers:write` · accepts `Idempotency-Key`
37
+ - **Parameters:**
38
+ - `body: components['schemas']['CreateCustomerRequest']` — Legal name, NIF (or alternative id) and address.
39
+ - **Returns:** The created customer. Response `201` `data`: `Customer`.
40
+ - **Throws:** `400`/`500` `BeeLApiError` · `401`/`403` `BeeLAuthError` · `409` `BeeLConflictError` · `422` `BeeLValidationError` · `429` `BeeLRateLimitError`
41
+
42
+ <a id="company-customers-create-bulk"></a>
43
+ ### `createBulk(body)`
44
+
45
+ Create several customers in one call.
46
+
47
+ - **HTTP:** `POST /v1/companies/{company_id}/customers/bulk` · operation `createCompanyCustomersBulk` · scopes `customers:write` · accepts `Idempotency-Key`
48
+ - **Parameters:**
49
+ - `body: operations['createCompanyCustomersBulk']['requestBody']['content']['application/json']` — The customers, and whether it is a dry run.
50
+ - **Returns:** Per-customer results and totals. Response `200` `data`: `CustomerValidationUnifiedResult`.
51
+ - **Throws:** `400`/`500` `BeeLApiError` · `401`/`403` `BeeLAuthError` · `409` `BeeLConflictError` · `422` `BeeLValidationError` · `429` `BeeLRateLimitError`
52
+
53
+ <a id="company-customers-get"></a>
54
+ ### `get(customerId)`
55
+
56
+ Get one customer.
57
+
58
+ - **HTTP:** `GET /v1/companies/{company_id}/customers/{customer_id}` · operation `getCompanyCustomer` · scopes `customers:read`
59
+ - **Parameters:**
60
+ - `customerId: string` — Customer UUID.
61
+ - **Returns:** The customer. Response `200` `data`: `Customer`.
62
+ - **Throws:** `400`/`500` `BeeLApiError` · `401`/`403` `BeeLAuthError` · `404` `BeeLNotFoundError` · `429` `BeeLRateLimitError`
63
+
64
+ <a id="company-customers-update"></a>
65
+ ### `update(customerId, body)`
66
+
67
+ Update a customer. Only the fields present in `body` change.
68
+
69
+ - **HTTP:** `PATCH /v1/companies/{company_id}/customers/{customer_id}` · operation `patchCompanyCustomer` · scopes `customers:write`
70
+ - **Parameters:**
71
+ - `customerId: string` — Customer UUID.
72
+ - `body: operations['patchCompanyCustomer']['requestBody']['content']['application/json']` — Fields to change.
73
+ - **Returns:** The updated customer. Response `200` `data`: `Customer`.
74
+ - **Throws:** `400`/`500` `BeeLApiError` · `401`/`403` `BeeLAuthError` · `404` `BeeLNotFoundError` · `409` `BeeLConflictError` · `422` `BeeLValidationError` · `429` `BeeLRateLimitError`
75
+
76
+ <a id="company-customers-delete"></a>
77
+ ### `delete(customerId)`
78
+
79
+ Delete a customer that has no invoices. Its NIF (or alternative id) is released for a
80
+ new customer.
81
+
82
+ - **HTTP:** `DELETE /v1/companies/{company_id}/customers/{customer_id}` · operation `deleteCompanyCustomer` · scopes `customers:write`
83
+ - **Parameters:**
84
+ - `customerId: string` — Customer UUID.
85
+ - **Throws:** `400`/`500` `BeeLApiError` · `401`/`403` `BeeLAuthError` · `404` `BeeLNotFoundError` · `409` `BeeLConflictError` · `429` `BeeLRateLimitError`
@@ -0,0 +1,52 @@
1
+ <!-- Generated by `npm run docs:reference` from the SDK source and openapi/public-api.yaml. Do not edit. -->
2
+
3
+ # `beel.company(companyId).invoices.schedule` — `CompanyInvoiceScheduleResource`
4
+
5
+ [Reference index](README.md)
6
+
7
+ Scheduled issuing of one invoice: read it, set it, clear it. Reach it as
8
+ `beel.company(companyId).invoices.schedule`.
9
+
10
+ ## Methods
11
+
12
+ | Method | HTTP | Summary |
13
+ |---|---|---|
14
+ | [`beel.company(companyId).invoices.schedule.get(invoiceId)`](#company-invoices-schedule-get) | `GET /v1/companies/{company_id}/invoices/{invoice_id}/schedule` | Get the schedule of an invoice. |
15
+ | [`beel.company(companyId).invoices.schedule.set(invoiceId, body)`](#company-invoices-schedule-set) | `PUT /v1/companies/{company_id}/invoices/{invoice_id}/schedule` | Set or move the schedule. |
16
+ | [`beel.company(companyId).invoices.schedule.clear(invoiceId)`](#company-invoices-schedule-clear) | `DELETE /v1/companies/{company_id}/invoices/{invoice_id}/schedule` | Clear the schedule, returning the invoice to a plain draft — the canonical form of `unschedule`. |
17
+
18
+ <a id="company-invoices-schedule-get"></a>
19
+ ### `get(invoiceId)`
20
+
21
+ Get the schedule of an invoice.
22
+
23
+ - **HTTP:** `GET /v1/companies/{company_id}/invoices/{invoice_id}/schedule` · operation `getCompanyInvoiceSchedule` · scopes `invoices:read`
24
+ - **Parameters:**
25
+ - `invoiceId: string` — Invoice UUID.
26
+ - **Returns:** `scheduled_for` and `generation_mode`. Response `200` `data`: `InvoiceSchedule`.
27
+ - **Throws:** `401`/`403` `BeeLAuthError` · `404` `BeeLNotFoundError` · `429` `BeeLRateLimitError` · `500` `BeeLApiError`
28
+
29
+ <a id="company-invoices-schedule-set"></a>
30
+ ### `set(invoiceId, body)`
31
+
32
+ Set or move the schedule. One `PUT` replaces the three legacy calls
33
+ (`schedule`, `reschedule`, `unschedule`): setting it again moves it.
34
+
35
+ - **HTTP:** `PUT /v1/companies/{company_id}/invoices/{invoice_id}/schedule` · operation `setCompanyInvoiceSchedule` · scopes `invoices:write` · accepts `Idempotency-Key`
36
+ - **Parameters:**
37
+ - `invoiceId: string` — UUID of a draft invoice.
38
+ - `body: components['schemas']['SetInvoiceScheduleRequest']` — `scheduled_for` date and what to do then.
39
+ - **Returns:** The scheduled invoice. Response `200` `data`: `Invoice`.
40
+ - **Throws:** `400`/`500` `BeeLApiError` · `401`/`403` `BeeLAuthError` · `404` `BeeLNotFoundError` · `409` `BeeLConflictError` · `422` `BeeLValidationError` · `429` `BeeLRateLimitError`
41
+
42
+ <a id="company-invoices-schedule-clear"></a>
43
+ ### `clear(invoiceId)`
44
+
45
+ Clear the schedule, returning the invoice to a plain draft — the canonical form of
46
+ `unschedule`. Idempotent.
47
+
48
+ - **HTTP:** `DELETE /v1/companies/{company_id}/invoices/{invoice_id}/schedule` · operation `deleteCompanyInvoiceSchedule` · scopes `invoices:write` · accepts `Idempotency-Key`
49
+ - **Parameters:**
50
+ - `invoiceId: string` — Invoice UUID.
51
+ - **Returns:** `Promise<void>`
52
+ - **Throws:** `400`/`500` `BeeLApiError` · `401`/`403` `BeeLAuthError` · `404` `BeeLNotFoundError` · `429` `BeeLRateLimitError`