diff --git a/.fernignore b/.fernignore
new file mode 100644
index 0000000..084a8eb
--- /dev/null
+++ b/.fernignore
@@ -0,0 +1 @@
+# Specify files that shouldn't be modified by Fern
diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml
new file mode 100644
index 0000000..cf13c1c
--- /dev/null
+++ b/.github/workflows/ci.yml
@@ -0,0 +1,30 @@
+name: ci
+
+on: [push]
+
+jobs:
+ compile:
+ runs-on: ubuntu-latest
+
+ steps:
+ - name: Checkout repo
+ uses: actions/checkout@v3
+
+ - name: Set up node
+ uses: actions/setup-node@v3
+
+ - name: Compile
+ run: yarn && yarn build
+
+ test:
+ runs-on: ubuntu-latest
+
+ steps:
+ - name: Checkout repo
+ uses: actions/checkout@v3
+
+ - name: Set up node
+ uses: actions/setup-node@v3
+
+ - name: Compile
+ run: yarn && yarn test
diff --git a/.gitignore b/.gitignore
new file mode 100644
index 0000000..72271e0
--- /dev/null
+++ b/.gitignore
@@ -0,0 +1,3 @@
+node_modules
+.DS_Store
+/dist
\ No newline at end of file
diff --git a/.npmignore b/.npmignore
new file mode 100644
index 0000000..6db0876
--- /dev/null
+++ b/.npmignore
@@ -0,0 +1,9 @@
+node_modules
+src
+tests
+.gitignore
+.github
+.fernignore
+.prettierrc.yml
+tsconfig.json
+yarn.lock
\ No newline at end of file
diff --git a/.prettierrc.yml b/.prettierrc.yml
new file mode 100644
index 0000000..0c06786
--- /dev/null
+++ b/.prettierrc.yml
@@ -0,0 +1,2 @@
+tabWidth: 4
+printWidth: 120
diff --git a/LICENSE b/LICENSE
deleted file mode 100644
index 76d0774..0000000
--- a/LICENSE
+++ /dev/null
@@ -1,21 +0,0 @@
-MIT License
-
-Copyright (c) 2024 Monite
-
-Permission is hereby granted, free of charge, to any person obtaining a copy
-of this software and associated documentation files (the "Software"), to deal
-in the Software without restriction, including without limitation the rights
-to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
-copies of the Software, and to permit persons to whom the Software is
-furnished to do so, subject to the following conditions:
-
-The above copyright notice and this permission notice shall be included in all
-copies or substantial portions of the Software.
-
-THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
-IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
-FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
-AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
-LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
-OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
-SOFTWARE.
diff --git a/README.md b/README.md
index 91e4447..05e720d 100644
--- a/README.md
+++ b/README.md
@@ -1 +1,149 @@
-# monite-node-client
\ No newline at end of file
+# Monite TypeScript Library
+
+[![fern shield](https://img.shields.io/badge/%F0%9F%8C%BF-Built%20with%20Fern-brightgreen)](https://buildwithfern.com?utm_source=github&utm_medium=github&utm_campaign=readme&utm_source=https%3A%2F%2Fgithub.com%2Fteam-monite%2Fmonite-node-client)
+[![npm shield](https://img.shields.io/npm/v/)](https://www.npmjs.com/package/)
+
+The Monite TypeScript library provides convenient access to the Monite API from TypeScript.
+
+## Documentation
+
+API reference documentation is available [here](https://docs.monite.com/api).
+
+## Installation
+
+```sh
+npm i -s
+```
+
+## Reference
+
+A full reference for this library is available [here](./reference.md).
+
+## Usage
+
+Instantiate and use the client with the following:
+
+```typescript
+import { MoniteClient } from "";
+
+const client = new MoniteClient({
+ token: "YOUR_TOKEN",
+ moniteVersion: "YOUR_MONITE_VERSION",
+ moniteEntityId: "YOUR_MONITE_ENTITY_ID",
+});
+await client.products.create({
+ name: "name",
+});
+```
+
+## Request And Response Types
+
+The SDK exports all request and response types as TypeScript interfaces. Simply import them with the
+following namespace:
+
+```typescript
+import { Monite } from "Monite";
+
+const request: Monite.ApprovalPoliciesGetRequest = {
+ ...
+};
+```
+
+## Exception Handling
+
+When the API returns a non-success status code (4xx or 5xx response), a subclass of the following error
+will be thrown.
+
+```typescript
+import { MoniteError } from "Monite";
+
+try {
+ await client.products.create(...);
+} catch (err) {
+ if (err instanceof MoniteError) {
+ console.log(err.statusCode);
+ console.log(err.message);
+ console.log(err.body);
+ }
+}
+```
+
+## Advanced
+
+### Retries
+
+The SDK is instrumented with automatic retries with exponential backoff. A request will be retried as long
+as the request is deemed retriable and the number of retry attempts has not grown larger than the configured
+retry limit (default: 2).
+
+A request is deemed retriable when any of the following HTTP status codes is returned:
+
+- [408](https://developer.mozilla.org/en-US/docs/Web/HTTP/Status/408) (Timeout)
+- [429](https://developer.mozilla.org/en-US/docs/Web/HTTP/Status/429) (Too Many Requests)
+- [5XX](https://developer.mozilla.org/en-US/docs/Web/HTTP/Status/500) (Internal Server Errors)
+
+Use the `maxRetries` request option to configure this behavior.
+
+```typescript
+const response = await client.products.create(..., {
+ maxRetries: 0 // override maxRetries at the request level
+});
+```
+
+### Timeouts
+
+The SDK defaults to a 60 second timeout. Use the `timeoutInSeconds` option to configure this behavior.
+
+```typescript
+const response = await client.products.create(..., {
+ timeoutInSeconds: 30 // override timeout to 30s
+});
+```
+
+### Aborting Requests
+
+The SDK allows users to abort requests at any point by passing in an abort signal.
+
+```typescript
+const controller = new AbortController();
+const response = await client.products.create(..., {
+ abortSignal: controller.signal
+});
+controller.abort(); // aborts the request
+```
+
+### Runtime Compatibility
+
+The SDK defaults to `node-fetch` but will use the global fetch client if present. The SDK works in the following
+runtimes:
+
+- Node.js 18+
+- Vercel
+- Cloudflare Workers
+- Deno v1.25+
+- Bun 1.0+
+- React Native
+
+### Customizing Fetch Client
+
+The SDK provides a way for your to customize the underlying HTTP client / Fetch function. If you're running in an
+unsupported environment, this provides a way for you to break glass and ensure the SDK works.
+
+```typescript
+import { MoniteClient } from "Monite";
+
+const client = new MoniteClient({
+ ...
+ fetcher: // provide your implementation here
+});
+```
+
+## Contributing
+
+While we value open-source contributions to this SDK, this library is generated programmatically.
+Additions made directly to this library would have to be moved over to our generation code,
+otherwise they would be overwritten upon the next generated release. Feel free to open a PR as
+a proof of concept, but know that we will not be able to merge it as-is. We suggest opening
+an issue first to discuss with us!
+
+On the other hand, contributions to the README are always very welcome!
diff --git a/jest.config.js b/jest.config.js
new file mode 100644
index 0000000..35d6e65
--- /dev/null
+++ b/jest.config.js
@@ -0,0 +1,5 @@
+/** @type {import('jest').Config} */
+module.exports = {
+ preset: "ts-jest",
+ testEnvironment: "node",
+};
diff --git a/package.json b/package.json
new file mode 100644
index 0000000..ae0acf9
--- /dev/null
+++ b/package.json
@@ -0,0 +1,45 @@
+{
+ "name": "",
+ "version": "0.1.0",
+ "private": false,
+ "repository": "https://github.com/team-monite/monite-node-client",
+ "main": "./index.js",
+ "types": "./index.d.ts",
+ "scripts": {
+ "format": "prettier . --write --ignore-unknown",
+ "build": "tsc",
+ "prepack": "cp -rv dist/. .",
+ "test": "jest"
+ },
+ "dependencies": {
+ "url-join": "4.0.1",
+ "form-data": "^4.0.0",
+ "formdata-node": "^6.0.3",
+ "node-fetch": "2.7.0",
+ "qs": "6.11.2",
+ "readable-stream": "^4.5.2",
+ "js-base64": "3.7.2",
+ "form-data-encoder": "^4.0.2"
+ },
+ "devDependencies": {
+ "@types/url-join": "4.0.1",
+ "@types/qs": "6.9.8",
+ "@types/node-fetch": "2.6.9",
+ "@types/readable-stream": "^4.0.15",
+ "fetch-mock-jest": "^1.5.1",
+ "webpack": "^5.94.0",
+ "ts-loader": "^9.3.1",
+ "jest": "29.7.0",
+ "@types/jest": "29.5.5",
+ "ts-jest": "29.1.1",
+ "jest-environment-jsdom": "29.7.0",
+ "@types/node": "17.0.33",
+ "prettier": "2.7.1",
+ "typescript": "4.6.4"
+ },
+ "browser": {
+ "fs": false,
+ "os": false,
+ "path": false
+ }
+}
diff --git a/reference.md b/reference.md
new file mode 100644
index 0000000..9b3515f
--- /dev/null
+++ b/reference.md
@@ -0,0 +1,16997 @@
+# Reference
+
+## Approval policies
+
+client.approvalPolicies.get({ ...params }) -> Monite.ApprovalPolicyResourceList
+
+-
+
+#### 📝 Description
+
+
+-
+
+
+-
+
+Retrieve a list of all approval policies with pagination.
+
+
+
+
+
+
+#### 🔌 Usage
+
+
+-
+
+
+-
+
+```typescript
+await client.approvalPolicies.get();
+```
+
+
+
+
+
+
+#### ⚙️ Parameters
+
+
+-
+
+
+-
+
+**request:** `Monite.ApprovalPoliciesGetRequest`
+
+
+
+
+
+-
+
+**requestOptions:** `ApprovalPolicies.RequestOptions`
+
+
+
+
+
+
+
+
+
+
+client.approvalPolicies.create({ ...params }) -> Monite.ApprovalPolicyResource
+
+-
+
+#### 📝 Description
+
+
+-
+
+
+-
+
+Create a new approval policy.
+
+
+
+
+
+
+#### 🔌 Usage
+
+
+-
+
+
+-
+
+```typescript
+await client.approvalPolicies.create({
+ name: "name",
+ description: "description",
+ script: [true],
+});
+```
+
+
+
+
+
+
+#### ⚙️ Parameters
+
+
+-
+
+
+-
+
+**request:** `Monite.ApprovalPolicyCreate`
+
+
+
+
+
+-
+
+**requestOptions:** `ApprovalPolicies.RequestOptions`
+
+
+
+
+
+
+
+
+
+
+client.approvalPolicies.getById(approvalPolicyId) -> Monite.ApprovalPolicyResource
+
+-
+
+#### 📝 Description
+
+
+-
+
+
+-
+
+Retrieve a specific approval policy.
+
+
+
+
+
+
+#### 🔌 Usage
+
+
+-
+
+
+-
+
+```typescript
+await client.approvalPolicies.getById("approval_policy_id");
+```
+
+
+
+
+
+
+#### ⚙️ Parameters
+
+
+-
+
+
+-
+
+**approvalPolicyId:** `string`
+
+
+
+
+
+-
+
+**requestOptions:** `ApprovalPolicies.RequestOptions`
+
+
+
+
+
+
+
+
+
+
+client.approvalPolicies.deleteById(approvalPolicyId) -> void
+
+-
+
+#### 📝 Description
+
+
+-
+
+
+-
+
+Delete an existing approval policy.
+
+
+
+
+
+
+#### 🔌 Usage
+
+
+-
+
+
+-
+
+```typescript
+await client.approvalPolicies.deleteById("approval_policy_id");
+```
+
+
+
+
+
+
+#### ⚙️ Parameters
+
+
+-
+
+
+-
+
+**approvalPolicyId:** `string`
+
+
+
+
+
+-
+
+**requestOptions:** `ApprovalPolicies.RequestOptions`
+
+
+
+
+
+
+
+
+
+
+client.approvalPolicies.updateById(approvalPolicyId, { ...params }) -> Monite.ApprovalPolicyResource
+
+-
+
+#### 📝 Description
+
+
+-
+
+
+-
+
+Update an existing approval policy.
+
+
+
+
+
+
+#### 🔌 Usage
+
+
+-
+
+
+-
+
+```typescript
+await client.approvalPolicies.updateById("approval_policy_id");
+```
+
+
+
+
+
+
+#### ⚙️ Parameters
+
+
+-
+
+
+-
+
+**approvalPolicyId:** `string`
+
+
+
+
+
+-
+
+**request:** `Monite.ApprovalPolicyUpdate`
+
+
+
+
+
+-
+
+**requestOptions:** `ApprovalPolicies.RequestOptions`
+
+
+
+
+
+
+
+
+
+
+## Approval requests
+
+client.approvalRequests.get({ ...params }) -> Monite.ApprovalRequestResourceList
+
+-
+
+#### 🔌 Usage
+
+
+-
+
+
+-
+
+```typescript
+await client.approvalRequests.get();
+```
+
+
+
+
+
+
+#### ⚙️ Parameters
+
+
+-
+
+
+-
+
+**request:** `Monite.ApprovalRequestsGetRequest`
+
+
+
+
+
+-
+
+**requestOptions:** `ApprovalRequests.RequestOptions`
+
+
+
+
+
+
+
+
+
+
+client.approvalRequests.create({ ...params }) -> Monite.ApprovalRequestResourceWithMetadata
+
+-
+
+#### 🔌 Usage
+
+
+-
+
+
+-
+
+```typescript
+await client.approvalRequests.create({
+ object_id: "object_id",
+ object_type: "account",
+ required_approval_count: 1,
+ role_ids: ["role_ids"],
+});
+```
+
+
+
+
+
+
+#### ⚙️ Parameters
+
+
+-
+
+
+-
+
+**request:** `Monite.ApprovalRequestCreateRequest`
+
+
+
+
+
+-
+
+**requestOptions:** `ApprovalRequests.RequestOptions`
+
+
+
+
+
+
+
+
+
+
+client.approvalRequests.getById(approvalRequestId) -> Monite.ApprovalRequestResourceWithMetadata
+
+-
+
+#### 🔌 Usage
+
+
+-
+
+
+-
+
+```typescript
+await client.approvalRequests.getById("approval_request_id");
+```
+
+
+
+
+
+
+#### ⚙️ Parameters
+
+
+-
+
+
+-
+
+**approvalRequestId:** `string`
+
+
+
+
+
+-
+
+**requestOptions:** `ApprovalRequests.RequestOptions`
+
+
+
+
+
+
+
+
+
+
+client.approvalRequests.approveById(approvalRequestId) -> Monite.ApprovalRequestResourceWithMetadata
+
+-
+
+#### 🔌 Usage
+
+
+-
+
+
+-
+
+```typescript
+await client.approvalRequests.approveById("approval_request_id");
+```
+
+
+
+
+
+
+#### ⚙️ Parameters
+
+
+-
+
+
+-
+
+**approvalRequestId:** `string`
+
+
+
+
+
+-
+
+**requestOptions:** `ApprovalRequests.RequestOptions`
+
+
+
+
+
+
+
+
+
+
+client.approvalRequests.cancelById(approvalRequestId) -> Monite.ApprovalRequestResourceWithMetadata
+
+-
+
+#### 🔌 Usage
+
+
+-
+
+
+-
+
+```typescript
+await client.approvalRequests.cancelById("approval_request_id");
+```
+
+
+
+
+
+
+#### ⚙️ Parameters
+
+
+-
+
+
+-
+
+**approvalRequestId:** `string`
+
+
+
+
+
+-
+
+**requestOptions:** `ApprovalRequests.RequestOptions`
+
+
+
+
+
+
+
+
+
+
+client.approvalRequests.rejectById(approvalRequestId) -> Monite.ApprovalRequestResourceWithMetadata
+
+-
+
+#### 🔌 Usage
+
+
+-
+
+
+-
+
+```typescript
+await client.approvalRequests.rejectById("approval_request_id");
+```
+
+
+
+
+
+
+#### ⚙️ Parameters
+
+
+-
+
+
+-
+
+**approvalRequestId:** `string`
+
+
+
+
+
+-
+
+**requestOptions:** `ApprovalRequests.RequestOptions`
+
+
+
+
+
+
+
+
+
+
+## Audit logs
+
+client.auditLogs.get({ ...params }) -> Monite.LogsResponse
+
+-
+
+#### 🔌 Usage
+
+
+-
+
+
+-
+
+```typescript
+await client.auditLogs.get();
+```
+
+
+
+
+
+
+#### ⚙️ Parameters
+
+
+-
+
+
+-
+
+**request:** `Monite.AuditLogsGetRequest`
+
+
+
+
+
+-
+
+**requestOptions:** `AuditLogs.RequestOptions`
+
+
+
+
+
+
+
+
+
+
+client.auditLogs.getById(logId) -> Monite.LogResponse
+
+-
+
+#### 🔌 Usage
+
+
+-
+
+
+-
+
+```typescript
+await client.auditLogs.getById("log_id");
+```
+
+
+
+
+
+
+#### ⚙️ Parameters
+
+
+-
+
+
+-
+
+**logId:** `string`
+
+
+
+
+
+-
+
+**requestOptions:** `AuditLogs.RequestOptions`
+
+
+
+
+
+
+
+
+
+
+## Access tokens
+
+client.accessTokens.revoke({ ...params }) -> Monite.MessageResponse
+
+-
+
+#### 📝 Description
+
+
+-
+
+
+-
+
+Revoke an existing token immediately.
+
+
+
+
+
+
+#### 🔌 Usage
+
+
+-
+
+
+-
+
+```typescript
+await client.accessTokens.revoke({
+ client_id: "client_id",
+ client_secret: "client_secret",
+ token: "token",
+});
+```
+
+
+
+
+
+
+#### ⚙️ Parameters
+
+
+-
+
+
+-
+
+**request:** `Monite.RevokeTokenPayload`
+
+
+
+
+
+-
+
+**requestOptions:** `AccessTokens.RequestOptions`
+
+
+
+
+
+
+
+
+
+
+client.accessTokens.create({ ...params }) -> Monite.AccessTokenResponse
+
+-
+
+#### 📝 Description
+
+
+-
+
+
+-
+
+Create a new access token based on client ID and client secret.
+
+
+
+
+
+
+#### 🔌 Usage
+
+
+-
+
+
+-
+
+```typescript
+await client.accessTokens.create({
+ client_id: "client_id",
+ client_secret: "client_secret",
+ grant_type: "client_credentials",
+});
+```
+
+
+
+
+
+
+#### ⚙️ Parameters
+
+
+-
+
+
+-
+
+**request:** `Monite.ObtainTokenPayload`
+
+
+
+
+
+-
+
+**requestOptions:** `AccessTokens.RequestOptions`
+
+
+
+
+
+
+
+
+
+
+## Batch payments
+
+client.batchPayments.create({ ...params }) -> Monite.PaymentsBatchPaymentResponse
+
+-
+
+#### 🔌 Usage
+
+
+-
+
+
+-
+
+```typescript
+await client.batchPayments.create({
+ payer_bank_account_id: "payer_bank_account_id",
+ payment_intents: [
+ {
+ object: {
+ id: "id",
+ type: "payable",
+ },
+ recipient: {
+ id: "id",
+ type: "counterpart",
+ },
+ },
+ ],
+});
+```
+
+
+
+
+
+
+#### ⚙️ Parameters
+
+
+-
+
+
+-
+
+**request:** `Monite.PaymentsBatchPaymentRequest`
+
+
+
+
+
+-
+
+**requestOptions:** `BatchPayments.RequestOptions`
+
+
+
+
+
+
+
+
+
+
+client.batchPayments.getById(batchPaymentId) -> Monite.PaymentsBatchPaymentResponse
+
+-
+
+#### 🔌 Usage
+
+
+-
+
+
+-
+
+```typescript
+await client.batchPayments.getById("batch_payment_id");
+```
+
+
+
+
+
+
+#### ⚙️ Parameters
+
+
+-
+
+
+-
+
+**batchPaymentId:** `string`
+
+
+
+
+
+-
+
+**requestOptions:** `BatchPayments.RequestOptions`
+
+
+
+
+
+
+
+
+
+
+## Comments
+
+client.comments.get({ ...params }) -> Monite.CommentResourceList
+
+-
+
+#### 📝 Description
+
+
+-
+
+
+-
+
+Get comments
+
+
+
+
+
+
+#### 🔌 Usage
+
+
+-
+
+
+-
+
+```typescript
+await client.comments.get({
+ object_type: "payable",
+ object_id: "object_id",
+});
+```
+
+
+
+
+
+
+#### ⚙️ Parameters
+
+
+-
+
+
+-
+
+**request:** `Monite.CommentsGetRequest`
+
+
+
+
+
+-
+
+**requestOptions:** `Comments.RequestOptions`
+
+
+
+
+
+
+
+
+
+
+client.comments.create({ ...params }) -> Monite.CommentResource
+
+-
+
+#### 📝 Description
+
+
+-
+
+
+-
+
+Create new comment
+
+
+
+
+
+
+#### 🔌 Usage
+
+
+-
+
+
+-
+
+```typescript
+await client.comments.create({
+ object_id: "object_id",
+ object_type: "object_type",
+ text: "text",
+});
+```
+
+
+
+
+
+
+#### ⚙️ Parameters
+
+
+-
+
+
+-
+
+**request:** `Monite.CommentCreateRequest`
+
+
+
+
+
+-
+
+**requestOptions:** `Comments.RequestOptions`
+
+
+
+
+
+
+
+
+
+
+client.comments.getById(commentId) -> Monite.CommentResource
+
+-
+
+#### 📝 Description
+
+
+-
+
+
+-
+
+Get comment
+
+
+
+
+
+
+#### 🔌 Usage
+
+
+-
+
+
+-
+
+```typescript
+await client.comments.getById("comment_id");
+```
+
+
+
+
+
+
+#### ⚙️ Parameters
+
+
+-
+
+
+-
+
+**commentId:** `string`
+
+
+
+
+
+-
+
+**requestOptions:** `Comments.RequestOptions`
+
+
+
+
+
+
+
+
+
+
+client.comments.deleteById(commentId) -> void
+
+-
+
+#### 📝 Description
+
+
+-
+
+
+-
+
+Delete comment
+
+
+
+
+
+
+#### 🔌 Usage
+
+
+-
+
+
+-
+
+```typescript
+await client.comments.deleteById("comment_id");
+```
+
+
+
+
+
+
+#### ⚙️ Parameters
+
+
+-
+
+
+-
+
+**commentId:** `string`
+
+
+
+
+
+-
+
+**requestOptions:** `Comments.RequestOptions`
+
+
+
+
+
+
+
+
+
+
+client.comments.updateById(commentId, { ...params }) -> Monite.CommentResource
+
+-
+
+#### 📝 Description
+
+
+-
+
+
+-
+
+Update comment
+
+
+
+
+
+
+#### 🔌 Usage
+
+
+-
+
+
+-
+
+```typescript
+await client.comments.updateById("comment_id");
+```
+
+
+
+
+
+
+#### ⚙️ Parameters
+
+
+-
+
+
+-
+
+**commentId:** `string`
+
+
+
+
+
+-
+
+**request:** `Monite.CommentUpdateRequest`
+
+
+
+
+
+-
+
+**requestOptions:** `Comments.RequestOptions`
+
+
+
+
+
+
+
+
+
+
+## Counterparts
+
+client.counterparts.get({ ...params }) -> Monite.CounterpartPaginationResponse
+
+-
+
+#### 🔌 Usage
+
+
+-
+
+
+-
+
+```typescript
+await client.counterparts.get({
+ sort_code: "123456",
+});
+```
+
+
+
+
+
+
+#### ⚙️ Parameters
+
+
+-
+
+
+-
+
+**request:** `Monite.CounterpartsGetRequest`
+
+
+
+
+
+-
+
+**requestOptions:** `Counterparts.RequestOptions`
+
+
+
+
+
+
+
+
+
+
+client.counterparts.create({ ...params }) -> Monite.CounterpartResponse
+
+-
+
+#### 🔌 Usage
+
+
+-
+
+
+-
+
+```typescript
+await client.counterparts.create({
+ type: "individual",
+ individual: {
+ address: {
+ city: "Berlin",
+ country: "AF",
+ line1: "Flughafenstrasse 52",
+ postal_code: "10115",
+ },
+ first_name: "Adnan",
+ is_customer: true,
+ is_vendor: true,
+ last_name: "Singh",
+ },
+});
+```
+
+
+
+
+
+
+#### ⚙️ Parameters
+
+
+-
+
+
+-
+
+**request:** `Monite.CounterpartCreatePayload`
+
+
+
+
+
+-
+
+**requestOptions:** `Counterparts.RequestOptions`
+
+
+
+
+
+
+
+
+
+
+client.counterparts.getById(counterpartId) -> Monite.CounterpartResponse
+
+-
+
+#### 🔌 Usage
+
+
+-
+
+
+-
+
+```typescript
+await client.counterparts.getById("counterpart_id");
+```
+
+
+
+
+
+
+#### ⚙️ Parameters
+
+
+-
+
+
+-
+
+**counterpartId:** `string`
+
+
+
+
+
+-
+
+**requestOptions:** `Counterparts.RequestOptions`
+
+
+
+
+
+
+
+
+
+
+client.counterparts.deleteById(counterpartId) -> void
+
+-
+
+#### 🔌 Usage
+
+
+-
+
+
+-
+
+```typescript
+await client.counterparts.deleteById("counterpart_id");
+```
+
+
+
+
+
+
+#### ⚙️ Parameters
+
+
+-
+
+
+-
+
+**counterpartId:** `string`
+
+
+
+
+
+-
+
+**requestOptions:** `Counterparts.RequestOptions`
+
+
+
+
+
+
+
+
+
+
+client.counterparts.updateById(counterpartId, { ...params }) -> Monite.CounterpartResponse
+
+-
+
+#### 🔌 Usage
+
+
+-
+
+
+-
+
+```typescript
+await client.counterparts.updateById("counterpart_id", {
+ individual: {},
+});
+```
+
+
+
+
+
+
+#### ⚙️ Parameters
+
+
+-
+
+
+-
+
+**counterpartId:** `string`
+
+
+
+
+
+-
+
+**request:** `Monite.CounterpartUpdatePayload`
+
+
+
+
+
+-
+
+**requestOptions:** `Counterparts.RequestOptions`
+
+
+
+
+
+
+
+
+
+
+client.counterparts.getPartnerMetadataById(counterpartId) -> Monite.PartnerMetadataResponse
+
+-
+
+#### 🔌 Usage
+
+
+-
+
+
+-
+
+```typescript
+await client.counterparts.getPartnerMetadataById("counterpart_id");
+```
+
+
+
+
+
+
+#### ⚙️ Parameters
+
+
+-
+
+
+-
+
+**counterpartId:** `string`
+
+
+
+
+
+-
+
+**requestOptions:** `Counterparts.RequestOptions`
+
+
+
+
+
+
+
+
+
+
+client.counterparts.updatePartnerMetadataById(counterpartId, { ...params }) -> Monite.PartnerMetadataResponse
+
+-
+
+#### 🔌 Usage
+
+
+-
+
+
+-
+
+```typescript
+await client.counterparts.updatePartnerMetadataById("counterpart_id", {
+ metadata: {
+ key: "value",
+ },
+});
+```
+
+
+
+
+
+
+#### ⚙️ Parameters
+
+
+-
+
+
+-
+
+**counterpartId:** `string`
+
+
+
+
+
+-
+
+**request:** `Monite.PartnerMetadata`
+
+
+
+
+
+-
+
+**requestOptions:** `Counterparts.RequestOptions`
+
+
+
+
+
+
+
+
+
+
+## DataExports
+
+client.dataExports.get({ ...params }) -> Monite.AllDocumentExportResponseSchema
+
+-
+
+#### 🔌 Usage
+
+
+-
+
+
+-
+
+```typescript
+await client.dataExports.get();
+```
+
+
+
+
+
+
+#### ⚙️ Parameters
+
+
+-
+
+
+-
+
+**request:** `Monite.DataExportsGetRequest`
+
+
+
+
+
+-
+
+**requestOptions:** `DataExports.RequestOptions`
+
+
+
+
+
+
+
+
+
+
+client.dataExports.create({ ...params }) -> Monite.CreateExportTaskResponseSchema
+
+-
+
+#### 🔌 Usage
+
+
+-
+
+
+-
+
+```typescript
+await client.dataExports.create({
+ date_from: "date_from",
+ date_to: "date_to",
+ format: "csv",
+ objects: [
+ {
+ name: "receivable",
+ statuses: ["draft"],
+ },
+ ],
+});
+```
+
+
+
+
+
+
+#### ⚙️ Parameters
+
+
+-
+
+
+-
+
+**request:** `Monite.ExportPayloadSchema`
+
+
+
+
+
+-
+
+**requestOptions:** `DataExports.RequestOptions`
+
+
+
+
+
+
+
+
+
+
+client.dataExports.getSupportedFormats() -> Monite.SupportedFormatSchema[]
+
+-
+
+#### 🔌 Usage
+
+
+-
+
+
+-
+
+```typescript
+await client.dataExports.getSupportedFormats();
+```
+
+
+
+
+
+
+#### ⚙️ Parameters
+
+
+-
+
+
+-
+
+**requestOptions:** `DataExports.RequestOptions`
+
+
+
+
+
+
+
+
+
+
+client.dataExports.getById(documentExportId) -> Monite.DocumentExportResponseSchema
+
+-
+
+#### 🔌 Usage
+
+
+-
+
+
+-
+
+```typescript
+await client.dataExports.getById("document_export_id");
+```
+
+
+
+
+
+
+#### ⚙️ Parameters
+
+
+-
+
+
+-
+
+**documentExportId:** `string`
+
+
+
+
+
+-
+
+**requestOptions:** `DataExports.RequestOptions`
+
+
+
+
+
+
+
+
+
+
+## PDF templates
+
+client.pdfTemplates.get() -> Monite.TemplateListResponse
+
+-
+
+#### 📝 Description
+
+
+-
+
+
+-
+
+This API call returns all supported templates with language codes.
+
+
+
+
+
+
+#### 🔌 Usage
+
+
+-
+
+
+-
+
+```typescript
+await client.pdfTemplates.get();
+```
+
+
+
+
+
+
+#### ⚙️ Parameters
+
+
+-
+
+
+-
+
+**requestOptions:** `PdfTemplates.RequestOptions`
+
+
+
+
+
+
+
+
+
+
+client.pdfTemplates.getSystem() -> Monite.TemplateListResponse
+
+-
+
+#### 📝 Description
+
+
+-
+
+
+-
+
+This API call returns all supported system templates with language codes.
+
+
+
+
+
+
+#### 🔌 Usage
+
+
+-
+
+
+-
+
+```typescript
+await client.pdfTemplates.getSystem();
+```
+
+
+
+
+
+
+#### ⚙️ Parameters
+
+
+-
+
+
+-
+
+**requestOptions:** `PdfTemplates.RequestOptions`
+
+
+
+
+
+
+
+
+
+
+client.pdfTemplates.getById(documentTemplateId) -> Monite.TemplateReceivableResponse
+
+-
+
+#### 🔌 Usage
+
+
+-
+
+
+-
+
+```typescript
+await client.pdfTemplates.getById("document_template_id");
+```
+
+
+
+
+
+
+#### ⚙️ Parameters
+
+
+-
+
+
+-
+
+**documentTemplateId:** `string`
+
+
+
+
+
+-
+
+**requestOptions:** `PdfTemplates.RequestOptions`
+
+
+
+
+
+
+
+
+
+
+client.pdfTemplates.makeDefaultById(documentTemplateId) -> Monite.TemplateReceivableResponse
+
+-
+
+#### 🔌 Usage
+
+
+-
+
+
+-
+
+```typescript
+await client.pdfTemplates.makeDefaultById("document_template_id");
+```
+
+
+
+
+
+
+#### ⚙️ Parameters
+
+
+-
+
+
+-
+
+**documentTemplateId:** `string`
+
+
+
+
+
+-
+
+**requestOptions:** `PdfTemplates.RequestOptions`
+
+
+
+
+
+
+
+
+
+
+client.pdfTemplates.previewById(documentTemplateId) -> stream.Readable
+
+-
+
+#### 📝 Description
+
+
+-
+
+
+-
+
+Returns a sample PDF invoice generated using the specified template.
+
+
+
+
+
+
+#### 🔌 Usage
+
+
+-
+
+
+-
+
+```typescript
+await client.pdfTemplates.previewById("string");
+```
+
+
+
+
+
+
+#### ⚙️ Parameters
+
+
+-
+
+
+-
+
+**documentTemplateId:** `string`
+
+
+
+
+
+-
+
+**requestOptions:** `PdfTemplates.RequestOptions`
+
+
+
+
+
+
+
+
+
+
+## Entities
+
+client.entities.get({ ...params }) -> Monite.EntityPaginationResponse
+
+-
+
+#### 📝 Description
+
+
+-
+
+
+-
+
+Retrieve a list of all entities.
+
+
+
+
+
+
+#### 🔌 Usage
+
+
+-
+
+
+-
+
+```typescript
+await client.entities.get();
+```
+
+
+
+
+
+
+#### ⚙️ Parameters
+
+
+-
+
+
+-
+
+**request:** `Monite.EntitiesGetRequest`
+
+
+
+
+
+-
+
+**requestOptions:** `Entities.RequestOptions`
+
+
+
+
+
+
+
+
+
+
+client.entities.create({ ...params }) -> Monite.EntityResponse
+
+-
+
+#### 📝 Description
+
+
+-
+
+
+-
+
+Create a new entity from the specified values.
+
+
+
+
+
+
+#### 🔌 Usage
+
+
+-
+
+
+-
+
+```typescript
+await client.entities.create({
+ address: {
+ city: "city",
+ country: "AF",
+ line1: "line1",
+ postal_code: "postal_code",
+ },
+ email: "email",
+ type: "individual",
+});
+```
+
+
+
+
+
+
+#### ⚙️ Parameters
+
+
+-
+
+
+-
+
+**request:** `Monite.CreateEntityRequest`
+
+
+
+
+
+-
+
+**requestOptions:** `Entities.RequestOptions`
+
+
+
+
+
+
+
+
+
+
+client.entities.getEntitiesMe() -> Monite.EntityResponse
+
+-
+
+#### 📝 Description
+
+
+-
+
+
+-
+
+Deprecated. Use `GET /entity_users/my_entity` instead.
+
+
+
+
+
+
+#### 🔌 Usage
+
+
+-
+
+
+-
+
+```typescript
+await client.entities.getEntitiesMe();
+```
+
+
+
+
+
+
+#### ⚙️ Parameters
+
+
+-
+
+
+-
+
+**requestOptions:** `Entities.RequestOptions`
+
+
+
+
+
+
+
+
+
+
+client.entities.patchEntitiesMe({ ...params }) -> Monite.EntityResponse
+
+-
+
+#### 📝 Description
+
+
+-
+
+
+-
+
+Deprecated. Use `PATCH /entity_users/my_entity` instead.
+
+
+
+
+
+
+#### 🔌 Usage
+
+
+-
+
+
+-
+
+```typescript
+await client.entities.patchEntitiesMe({});
+```
+
+
+
+
+
+
+#### ⚙️ Parameters
+
+
+-
+
+
+-
+
+**request:** `Monite.UpdateEntityRequest`
+
+
+
+
+
+-
+
+**requestOptions:** `Entities.RequestOptions`
+
+
+
+
+
+
+
+
+
+
+client.entities.getById(entityId) -> Monite.EntityResponse
+
+-
+
+#### 📝 Description
+
+
+-
+
+
+-
+
+Retrieve an entity by its ID.
+
+
+
+
+
+
+#### 🔌 Usage
+
+
+-
+
+
+-
+
+```typescript
+await client.entities.getById("ea837e28-509b-4b6a-a600-d54b6aa0b1f5");
+```
+
+
+
+
+
+
+#### ⚙️ Parameters
+
+
+-
+
+
+-
+
+**entityId:** `string` — A unique ID to specify the entity.
+
+
+
+
+
+-
+
+**requestOptions:** `Entities.RequestOptions`
+
+
+
+
+
+
+
+
+
+
+client.entities.updateById(entityId, { ...params }) -> Monite.EntityResponse
+
+-
+
+#### 📝 Description
+
+
+-
+
+
+-
+
+Change the specified fields with the provided values.
+
+
+
+
+
+
+#### 🔌 Usage
+
+
+-
+
+
+-
+
+```typescript
+await client.entities.updateById("ea837e28-509b-4b6a-a600-d54b6aa0b1f5", {});
+```
+
+
+
+
+
+
+#### ⚙️ Parameters
+
+
+-
+
+
+-
+
+**entityId:** `string` — A unique ID to specify the entity.
+
+
+
+
+
+-
+
+**request:** `Monite.UpdateEntityRequest`
+
+
+
+
+
+-
+
+**requestOptions:** `Entities.RequestOptions`
+
+
+
+
+
+
+
+
+
+
+client.entities.uploadLogoById(file, entityId) -> Monite.FileSchema3
+
+-
+
+#### 📝 Description
+
+
+-
+
+
+-
+
+Entity logo can be PNG, JPG, or GIF, up to 10 MB in size. The logo is used, for example, in PDF documents created by this entity.
+
+
+
+
+
+
+#### 🔌 Usage
+
+
+-
+
+
+-
+
+```typescript
+await client.entities.uploadLogoById(fs.createReadStream("/path/to/your/file"), "ea837e28-509b-4b6a-a600-d54b6aa0b1f5");
+```
+
+
+
+
+
+
+#### ⚙️ Parameters
+
+
+-
+
+
+-
+
+**file:** `File | fs.ReadStream | Blob`
+
+
+
+
+
+-
+
+**entityId:** `string`
+
+
+
+
+
+-
+
+**requestOptions:** `Entities.RequestOptions`
+
+
+
+
+
+
+
+
+
+
+client.entities.deleteLogoById(entityId) -> void
+
+-
+
+#### 🔌 Usage
+
+
+-
+
+
+-
+
+```typescript
+await client.entities.deleteLogoById("ea837e28-509b-4b6a-a600-d54b6aa0b1f5");
+```
+
+
+
+
+
+
+#### ⚙️ Parameters
+
+
+-
+
+
+-
+
+**entityId:** `string` — A unique ID to specify the entity.
+
+
+
+
+
+-
+
+**requestOptions:** `Entities.RequestOptions`
+
+
+
+
+
+
+
+
+
+
+client.entities.getPartnerMetadataById(entityId) -> Monite.PartnerMetadataResponse
+
+-
+
+#### 📝 Description
+
+
+-
+
+
+-
+
+Retrieve a metadata object associated with this entity, usually in a JSON format.
+
+
+
+
+
+
+#### 🔌 Usage
+
+
+-
+
+
+-
+
+```typescript
+await client.entities.getPartnerMetadataById("entity_id");
+```
+
+
+
+
+
+
+#### ⚙️ Parameters
+
+
+-
+
+
+-
+
+**entityId:** `string`
+
+
+
+
+
+-
+
+**requestOptions:** `Entities.RequestOptions`
+
+
+
+
+
+
+
+
+
+
+client.entities.updatePartnerMetadataById(entityId, { ...params }) -> Monite.PartnerMetadataResponse
+
+-
+
+#### 📝 Description
+
+
+-
+
+
+-
+
+Fully replace the current metadata object with the specified instance.
+
+
+
+
+
+
+#### 🔌 Usage
+
+
+-
+
+
+-
+
+```typescript
+await client.entities.updatePartnerMetadataById("entity_id", {
+ metadata: {
+ key: "value",
+ },
+});
+```
+
+
+
+
+
+
+#### ⚙️ Parameters
+
+
+-
+
+
+-
+
+**entityId:** `string`
+
+
+
+
+
+-
+
+**request:** `Monite.PartnerMetadata`
+
+
+
+
+
+-
+
+**requestOptions:** `Entities.RequestOptions`
+
+
+
+
+
+
+
+
+
+
+client.entities.getSettingsById(entityId) -> Monite.MergedSettingsResponse
+
+-
+
+#### 📝 Description
+
+
+-
+
+
+-
+
+Retrieve all settings for this entity.
+
+
+
+
+
+
+#### 🔌 Usage
+
+
+-
+
+
+-
+
+```typescript
+await client.entities.getSettingsById("ea837e28-509b-4b6a-a600-d54b6aa0b1f5");
+```
+
+
+
+
+
+
+#### ⚙️ Parameters
+
+
+-
+
+
+-
+
+**entityId:** `string` — A unique ID to specify the entity.
+
+
+
+
+
+-
+
+**requestOptions:** `Entities.RequestOptions`
+
+
+
+
+
+
+
+
+
+
+client.entities.updateSettingsById(entityId, { ...params }) -> Monite.MergedSettingsResponse
+
+-
+
+#### 📝 Description
+
+
+-
+
+
+-
+
+Change the specified fields with the provided values.
+
+
+
+
+
+
+#### 🔌 Usage
+
+
+-
+
+
+-
+
+```typescript
+await client.entities.updateSettingsById("ea837e28-509b-4b6a-a600-d54b6aa0b1f5");
+```
+
+
+
+
+
+
+#### ⚙️ Parameters
+
+
+-
+
+
+-
+
+**entityId:** `string` — A unique ID to specify the entity.
+
+
+
+
+
+-
+
+**request:** `Monite.PatchSettingsPayload`
+
+
+
+
+
+-
+
+**requestOptions:** `Entities.RequestOptions`
+
+
+
+
+
+
+
+
+
+
+client.entities.uploadOnboardingDocuments({ ...params }) -> void
+
+-
+
+#### 📝 Description
+
+
+-
+
+
+-
+
+Provide files for entity onboarding verification
+
+
+
+
+
+
+#### 🔌 Usage
+
+
+-
+
+
+-
+
+```typescript
+await client.entities.uploadOnboardingDocuments();
+```
+
+
+
+
+
+
+#### ⚙️ Parameters
+
+
+-
+
+
+-
+
+**request:** `Monite.EntityOnboardingDocumentsPayload`
+
+
+
+
+
+-
+
+**requestOptions:** `Entities.RequestOptions`
+
+
+
+
+
+
+
+
+
+
+client.entities.getOnboardingRequirements() -> Monite.GetOnboardingRequirementsResponse
+
+-
+
+#### 📝 Description
+
+
+-
+
+
+-
+
+Get onboarding requirements for the entity
+
+
+
+
+
+
+#### 🔌 Usage
+
+
+-
+
+
+-
+
+```typescript
+await client.entities.getOnboardingRequirements();
+```
+
+
+
+
+
+
+#### ⚙️ Parameters
+
+
+-
+
+
+-
+
+**requestOptions:** `Entities.RequestOptions`
+
+
+
+
+
+
+
+
+
+
+## Entity users
+
+client.entityUsers.get({ ...params }) -> Monite.EntityUserPaginationResponse
+
+-
+
+#### 📝 Description
+
+
+-
+
+
+-
+
+Retrieve a list of all entity users.
+
+
+
+
+
+
+#### 🔌 Usage
+
+
+-
+
+
+-
+
+```typescript
+await client.entityUsers.get();
+```
+
+
+
+
+
+
+#### ⚙️ Parameters
+
+
+-
+
+
+-
+
+**request:** `Monite.EntityUsersGetRequest`
+
+
+
+
+
+-
+
+**requestOptions:** `EntityUsers.RequestOptions`
+
+
+
+
+
+
+
+
+
+
+client.entityUsers.create({ ...params }) -> Monite.EntityUserResponse
+
+-
+
+#### 📝 Description
+
+
+-
+
+
+-
+
+Create a new entity user from the specified values.
+
+
+
+
+
+
+#### 🔌 Usage
+
+
+-
+
+
+-
+
+```typescript
+await client.entityUsers.create({
+ first_name: "Andrey",
+ login: "login",
+});
+```
+
+
+
+
+
+
+#### ⚙️ Parameters
+
+
+-
+
+
+-
+
+**request:** `Monite.CreateEntityUserRequest`
+
+
+
+
+
+-
+
+**requestOptions:** `EntityUsers.RequestOptions`
+
+
+
+
+
+
+
+
+
+
+client.entityUsers.getCurrent() -> Monite.EntityUserResponse
+
+-
+
+#### 📝 Description
+
+
+-
+
+
+-
+
+Retrieve an entity user by its ID.
+
+
+
+
+
+
+#### 🔌 Usage
+
+
+-
+
+
+-
+
+```typescript
+await client.entityUsers.getCurrent();
+```
+
+
+
+
+
+
+#### ⚙️ Parameters
+
+
+-
+
+
+-
+
+**requestOptions:** `EntityUsers.RequestOptions`
+
+
+
+
+
+
+
+
+
+
+client.entityUsers.updateCurrent({ ...params }) -> Monite.EntityUserResponse
+
+-
+
+#### 📝 Description
+
+
+-
+
+
+-
+
+Change the specified fields with provided values.
+
+
+
+
+
+
+#### 🔌 Usage
+
+
+-
+
+
+-
+
+```typescript
+await client.entityUsers.updateCurrent();
+```
+
+
+
+
+
+
+#### ⚙️ Parameters
+
+
+-
+
+
+-
+
+**request:** `Monite.UpdateMeEntityUserRequest`
+
+
+
+
+
+-
+
+**requestOptions:** `EntityUsers.RequestOptions`
+
+
+
+
+
+
+
+
+
+
+client.entityUsers.getCurrentEntity() -> Monite.EntityResponse
+
+-
+
+#### 📝 Description
+
+
+-
+
+
+-
+
+Retrieves information of an entity, which this entity user belongs to.
+
+
+
+
+
+
+#### 🔌 Usage
+
+
+-
+
+
+-
+
+```typescript
+await client.entityUsers.getCurrentEntity();
+```
+
+
+
+
+
+
+#### ⚙️ Parameters
+
+
+-
+
+
+-
+
+**requestOptions:** `EntityUsers.RequestOptions`
+
+
+
+
+
+
+
+
+
+
+client.entityUsers.updateCurrentEntity({ ...params }) -> Monite.EntityResponse
+
+-
+
+#### 📝 Description
+
+
+-
+
+
+-
+
+Update information of an entity, which this entity user belongs to.
+
+
+
+
+
+
+#### 🔌 Usage
+
+
+-
+
+
+-
+
+```typescript
+await client.entityUsers.updateCurrentEntity({});
+```
+
+
+
+
+
+
+#### ⚙️ Parameters
+
+
+-
+
+
+-
+
+**request:** `Monite.UpdateEntityRequest`
+
+
+
+
+
+-
+
+**requestOptions:** `EntityUsers.RequestOptions`
+
+
+
+
+
+
+
+
+
+
+client.entityUsers.getCurrentRole() -> Monite.RoleResponse
+
+-
+
+#### 📝 Description
+
+
+-
+
+
+-
+
+Retrieves information of a role assigned to this entity user.
+
+
+
+
+
+
+#### 🔌 Usage
+
+
+-
+
+
+-
+
+```typescript
+await client.entityUsers.getCurrentRole();
+```
+
+
+
+
+
+
+#### ⚙️ Parameters
+
+
+-
+
+
+-
+
+**requestOptions:** `EntityUsers.RequestOptions`
+
+
+
+
+
+
+
+
+
+
+client.entityUsers.getById(entityUserId) -> Monite.EntityUserResponse
+
+-
+
+#### 📝 Description
+
+
+-
+
+
+-
+
+Retrieve an entity user by its ID.
+
+
+
+
+
+
+#### 🔌 Usage
+
+
+-
+
+
+-
+
+```typescript
+await client.entityUsers.getById("entity_user_id");
+```
+
+
+
+
+
+
+#### ⚙️ Parameters
+
+
+-
+
+
+-
+
+**entityUserId:** `string`
+
+
+
+
+
+-
+
+**requestOptions:** `EntityUsers.RequestOptions`
+
+
+
+
+
+
+
+
+
+
+client.entityUsers.deleteById(entityUserId) -> void
+
+-
+
+#### 🔌 Usage
+
+
+-
+
+
+-
+
+```typescript
+await client.entityUsers.deleteById("entity_user_id");
+```
+
+
+
+
+
+
+#### ⚙️ Parameters
+
+
+-
+
+
+-
+
+**entityUserId:** `string`
+
+
+
+
+
+-
+
+**requestOptions:** `EntityUsers.RequestOptions`
+
+
+
+
+
+
+
+
+
+
+client.entityUsers.updateById(entityUserId, { ...params }) -> Monite.EntityUserResponse
+
+-
+
+#### 📝 Description
+
+
+-
+
+
+-
+
+Change the specified fields with provided values.
+
+
+
+
+
+
+#### 🔌 Usage
+
+
+-
+
+
+-
+
+```typescript
+await client.entityUsers.updateById("entity_user_id");
+```
+
+
+
+
+
+
+#### ⚙️ Parameters
+
+
+-
+
+
+-
+
+**entityUserId:** `string`
+
+
+
+
+
+-
+
+**request:** `Monite.UpdateEntityUserRequest`
+
+
+
+
+
+-
+
+**requestOptions:** `EntityUsers.RequestOptions`
+
+
+
+
+
+
+
+
+
+
+## Events
+
+client.events.get({ ...params }) -> Monite.EventPaginationResource
+
+-
+
+#### 📝 Description
+
+
+-
+
+
+-
+
+Get events for a given entity.
+
+
+
+
+
+
+#### 🔌 Usage
+
+
+-
+
+
+-
+
+```typescript
+await client.events.get();
+```
+
+
+
+
+
+
+#### ⚙️ Parameters
+
+
+-
+
+
+-
+
+**request:** `Monite.EventsGetRequest`
+
+
+
+
+
+-
+
+**requestOptions:** `Events.RequestOptions`
+
+
+
+
+
+
+
+
+
+
+client.events.getById(eventId) -> Monite.EventResource
+
+-
+
+#### 📝 Description
+
+
+-
+
+
+-
+
+Get event by ID.
+
+
+
+
+
+
+#### 🔌 Usage
+
+
+-
+
+
+-
+
+```typescript
+await client.events.getById("event_id");
+```
+
+
+
+
+
+
+#### ⚙️ Parameters
+
+
+-
+
+
+-
+
+**eventId:** `string`
+
+
+
+
+
+-
+
+**requestOptions:** `Events.RequestOptions`
+
+
+
+
+
+
+
+
+
+
+## Files
+
+client.files.get({ ...params }) -> Monite.FilesResponse
+
+-
+
+#### 🔌 Usage
+
+
+-
+
+
+-
+
+```typescript
+await client.files.get({
+ id__in: "string",
+});
+```
+
+
+
+
+
+
+#### ⚙️ Parameters
+
+
+-
+
+
+-
+
+**request:** `Monite.FilesGetRequest`
+
+
+
+
+
+-
+
+**requestOptions:** `Files.RequestOptions`
+
+
+
+
+
+
+
+
+
+
+client.files.upload(file, { ...params }) -> Monite.FileResponse
+
+-
+
+#### 🔌 Usage
+
+
+-
+
+
+-
+
+```typescript
+await client.files.upload(fs.createReadStream("/path/to/your/file"), {
+ file_type: "ocr_results",
+});
+```
+
+
+
+
+
+
+#### ⚙️ Parameters
+
+
+-
+
+
+-
+
+**file:** `File | fs.ReadStream | Blob`
+
+
+
+
+
+-
+
+**request:** `Monite.UploadFile`
+
+
+
+
+
+-
+
+**requestOptions:** `Files.RequestOptions`
+
+
+
+
+
+
+
+
+
+
+client.files.getById(fileId) -> Monite.FileResponse
+
+-
+
+#### 🔌 Usage
+
+
+-
+
+
+-
+
+```typescript
+await client.files.getById("file_id");
+```
+
+
+
+
+
+
+#### ⚙️ Parameters
+
+
+-
+
+
+-
+
+**fileId:** `string`
+
+
+
+
+
+-
+
+**requestOptions:** `Files.RequestOptions`
+
+
+
+
+
+
+
+
+
+
+client.files.delete(fileId) -> void
+
+-
+
+#### 🔌 Usage
+
+
+-
+
+
+-
+
+```typescript
+await client.files.delete("file_id");
+```
+
+
+
+
+
+
+#### ⚙️ Parameters
+
+
+-
+
+
+-
+
+**fileId:** `string`
+
+
+
+
+
+-
+
+**requestOptions:** `Files.RequestOptions`
+
+
+
+
+
+
+
+
+
+
+## Mail templates
+
+client.mailTemplates.get({ ...params }) -> Monite.CustomTemplatesPaginationResponse
+
+-
+
+#### 📝 Description
+
+
+-
+
+
+-
+
+Get all custom templates
+
+
+
+
+
+
+#### 🔌 Usage
+
+
+-
+
+
+-
+
+```typescript
+await client.mailTemplates.get();
+```
+
+
+
+
+
+
+#### ⚙️ Parameters
+
+
+-
+
+
+-
+
+**request:** `Monite.MailTemplatesGetRequest`
+
+
+
+
+
+-
+
+**requestOptions:** `MailTemplates.RequestOptions`
+
+
+
+
+
+
+
+
+
+
+client.mailTemplates.create({ ...params }) -> Monite.CustomTemplateDataSchema
+
+-
+
+#### 📝 Description
+
+
+-
+
+
+-
+
+Create custom template
+
+
+
+
+
+
+#### 🔌 Usage
+
+
+-
+
+
+-
+
+```typescript
+await client.mailTemplates.create({
+ body_template: "body_template",
+ name: "name",
+ subject_template: "subject_template",
+ type: "receivables_quote",
+});
+```
+
+
+
+
+
+
+#### ⚙️ Parameters
+
+
+-
+
+
+-
+
+**request:** `Monite.AddCustomTemplateSchema`
+
+
+
+
+
+-
+
+**requestOptions:** `MailTemplates.RequestOptions`
+
+
+
+
+
+
+
+
+
+
+client.mailTemplates.preview({ ...params }) -> Monite.PreviewTemplateResponse
+
+-
+
+#### 📝 Description
+
+
+-
+
+
+-
+
+Preview rendered template
+
+
+
+
+
+
+#### 🔌 Usage
+
+
+-
+
+
+-
+
+```typescript
+await client.mailTemplates.preview({
+ body: "body",
+ document_type: "receivables_quote",
+ language_code: "ab",
+ subject: "subject",
+});
+```
+
+
+
+
+
+
+#### ⚙️ Parameters
+
+
+-
+
+
+-
+
+**request:** `Monite.PreviewTemplateRequest`
+
+
+
+
+
+-
+
+**requestOptions:** `MailTemplates.RequestOptions`
+
+
+
+
+
+
+
+
+
+
+client.mailTemplates.getSystem() -> Monite.SystemTemplates
+
+-
+
+#### 📝 Description
+
+
+-
+
+
+-
+
+Get all system templates
+
+
+
+
+
+
+#### 🔌 Usage
+
+
+-
+
+
+-
+
+```typescript
+await client.mailTemplates.getSystem();
+```
+
+
+
+
+
+
+#### ⚙️ Parameters
+
+
+-
+
+
+-
+
+**requestOptions:** `MailTemplates.RequestOptions`
+
+
+
+
+
+
+
+
+
+
+client.mailTemplates.getById(templateId) -> Monite.CustomTemplateDataSchema
+
+-
+
+#### 📝 Description
+
+
+-
+
+
+-
+
+Get custom template by ID
+
+
+
+
+
+
+#### 🔌 Usage
+
+
+-
+
+
+-
+
+```typescript
+await client.mailTemplates.getById("template_id");
+```
+
+
+
+
+
+
+#### ⚙️ Parameters
+
+
+-
+
+
+-
+
+**templateId:** `string`
+
+
+
+
+
+-
+
+**requestOptions:** `MailTemplates.RequestOptions`
+
+
+
+
+
+
+
+
+
+
+client.mailTemplates.deleteById(templateId) -> void
+
+-
+
+#### 📝 Description
+
+
+-
+
+
+-
+
+Delete custom template bt ID
+
+
+
+
+
+
+#### 🔌 Usage
+
+
+-
+
+
+-
+
+```typescript
+await client.mailTemplates.deleteById("template_id");
+```
+
+
+
+
+
+
+#### ⚙️ Parameters
+
+
+-
+
+
+-
+
+**templateId:** `string`
+
+
+
+
+
+-
+
+**requestOptions:** `MailTemplates.RequestOptions`
+
+
+
+
+
+
+
+
+
+
+client.mailTemplates.updateById(templateId, { ...params }) -> Monite.CustomTemplateDataSchema
+
+-
+
+#### 📝 Description
+
+
+-
+
+
+-
+
+Update custom template by ID
+
+
+
+
+
+
+#### 🔌 Usage
+
+
+-
+
+
+-
+
+```typescript
+await client.mailTemplates.updateById("template_id");
+```
+
+
+
+
+
+
+#### ⚙️ Parameters
+
+
+-
+
+
+-
+
+**templateId:** `string`
+
+
+
+
+
+-
+
+**request:** `Monite.UpdateCustomTemplateSchemaRequest`
+
+
+
+
+
+-
+
+**requestOptions:** `MailTemplates.RequestOptions`
+
+
+
+
+
+
+
+
+
+
+client.mailTemplates.makeDefaultById(templateId) -> Monite.CustomTemplateDataSchema
+
+-
+
+#### 📝 Description
+
+
+-
+
+
+-
+
+Make template default
+
+
+
+
+
+
+#### 🔌 Usage
+
+
+-
+
+
+-
+
+```typescript
+await client.mailTemplates.makeDefaultById("template_id");
+```
+
+
+
+
+
+
+#### ⚙️ Parameters
+
+
+-
+
+
+-
+
+**templateId:** `string`
+
+
+
+
+
+-
+
+**requestOptions:** `MailTemplates.RequestOptions`
+
+
+
+
+
+
+
+
+
+
+## Mailbox domains
+
+client.mailboxDomains.get() -> Monite.DomainListResponse
+
+-
+
+#### 📝 Description
+
+
+-
+
+
+-
+
+Get all domains owned by partner_id
+
+
+
+
+
+
+#### 🔌 Usage
+
+
+-
+
+
+-
+
+```typescript
+await client.mailboxDomains.get();
+```
+
+
+
+
+
+
+#### ⚙️ Parameters
+
+
+-
+
+
+-
+
+**requestOptions:** `MailboxDomains.RequestOptions`
+
+
+
+
+
+
+
+
+
+
+client.mailboxDomains.create({ ...params }) -> Monite.DomainResponse
+
+-
+
+#### 📝 Description
+
+
+-
+
+
+-
+
+Create domain for the partner_id
+
+
+
+
+
+
+#### 🔌 Usage
+
+
+-
+
+
+-
+
+```typescript
+await client.mailboxDomains.create({
+ domain: "domain",
+});
+```
+
+
+
+
+
+
+#### ⚙️ Parameters
+
+
+-
+
+
+-
+
+**request:** `Monite.DomainRequest`
+
+
+
+
+
+-
+
+**requestOptions:** `MailboxDomains.RequestOptions`
+
+
+
+
+
+
+
+
+
+
+client.mailboxDomains.deleteById(domainId) -> void
+
+-
+
+#### 📝 Description
+
+
+-
+
+
+-
+
+Delete domain for the partner_id
+
+
+
+
+
+
+#### 🔌 Usage
+
+
+-
+
+
+-
+
+```typescript
+await client.mailboxDomains.deleteById("domain_id");
+```
+
+
+
+
+
+
+#### ⚙️ Parameters
+
+
+-
+
+
+-
+
+**domainId:** `string`
+
+
+
+
+
+-
+
+**requestOptions:** `MailboxDomains.RequestOptions`
+
+
+
+
+
+
+
+
+
+
+client.mailboxDomains.verifyById(domainId) -> Monite.VerifyResponse
+
+-
+
+#### 📝 Description
+
+
+-
+
+
+-
+
+Verify domain for the partner_id
+
+
+
+
+
+
+#### 🔌 Usage
+
+
+-
+
+
+-
+
+```typescript
+await client.mailboxDomains.verifyById("domain_id");
+```
+
+
+
+
+
+
+#### ⚙️ Parameters
+
+
+-
+
+
+-
+
+**domainId:** `string`
+
+
+
+
+
+-
+
+**requestOptions:** `MailboxDomains.RequestOptions`
+
+
+
+
+
+
+
+
+
+
+## Mailboxes
+
+client.mailboxes.get() -> Monite.MailboxDataResponse
+
+-
+
+#### 📝 Description
+
+
+-
+
+
+-
+
+Get all mailboxes owned by Entity
+
+
+
+
+
+
+#### 🔌 Usage
+
+
+-
+
+
+-
+
+```typescript
+await client.mailboxes.get();
+```
+
+
+
+
+
+
+#### ⚙️ Parameters
+
+
+-
+
+
+-
+
+**requestOptions:** `Mailboxes.RequestOptions`
+
+
+
+
+
+
+
+
+
+
+client.mailboxes.create({ ...params }) -> Monite.MailboxResponse
+
+-
+
+#### 📝 Description
+
+
+-
+
+
+-
+
+Create a new mailbox
+
+
+
+
+
+
+#### 🔌 Usage
+
+
+-
+
+
+-
+
+```typescript
+await client.mailboxes.create({
+ mailbox_domain_id: "mailbox_domain_id",
+ mailbox_name: "mailbox_name",
+ related_object_type: "payable",
+});
+```
+
+
+
+
+
+
+#### ⚙️ Parameters
+
+
+-
+
+
+-
+
+**request:** `Monite.MailboxDomainRequest`
+
+
+
+
+
+-
+
+**requestOptions:** `Mailboxes.RequestOptions`
+
+
+
+
+
+
+
+
+
+
+client.mailboxes.search({ ...params }) -> Monite.MailboxDataResponse
+
+-
+
+#### 📝 Description
+
+
+-
+
+
+-
+
+Get all mailboxes owned by Entity
+
+
+
+
+
+
+#### 🔌 Usage
+
+
+-
+
+
+-
+
+```typescript
+await client.mailboxes.search({
+ entity_ids: ["entity_ids"],
+});
+```
+
+
+
+
+
+
+#### ⚙️ Parameters
+
+
+-
+
+
+-
+
+**request:** `Monite.MailboxMultipleEntitiesRequest`
+
+
+
+
+
+-
+
+**requestOptions:** `Mailboxes.RequestOptions`
+
+
+
+
+
+
+
+
+
+
+client.mailboxes.deleteById(mailboxId) -> void
+
+-
+
+#### 📝 Description
+
+
+-
+
+
+-
+
+Delete mailbox
+
+
+
+
+
+
+#### 🔌 Usage
+
+
+-
+
+
+-
+
+```typescript
+await client.mailboxes.deleteById("mailbox_id");
+```
+
+
+
+
+
+
+#### ⚙️ Parameters
+
+
+-
+
+
+-
+
+**mailboxId:** `string`
+
+
+
+
+
+-
+
+**requestOptions:** `Mailboxes.RequestOptions`
+
+
+
+
+
+
+
+
+
+
+## Measure units
+
+client.measureUnits.get() -> Monite.UnitListResponse
+
+-
+
+#### 🔌 Usage
+
+
+-
+
+
+-
+
+```typescript
+await client.measureUnits.get();
+```
+
+
+
+
+
+
+#### ⚙️ Parameters
+
+
+-
+
+
+-
+
+**requestOptions:** `MeasureUnits.RequestOptions`
+
+
+
+
+
+
+
+
+
+
+client.measureUnits.create({ ...params }) -> Monite.UnitResponse
+
+-
+
+#### 🔌 Usage
+
+
+-
+
+
+-
+
+```typescript
+await client.measureUnits.create({
+ name: "name",
+});
+```
+
+
+
+
+
+
+#### ⚙️ Parameters
+
+
+-
+
+
+-
+
+**request:** `Monite.UnitRequest`
+
+
+
+
+
+-
+
+**requestOptions:** `MeasureUnits.RequestOptions`
+
+
+
+
+
+
+
+
+
+
+client.measureUnits.getById(unitId) -> Monite.UnitResponse
+
+-
+
+#### 🔌 Usage
+
+
+-
+
+
+-
+
+```typescript
+await client.measureUnits.getById("unit_id");
+```
+
+
+
+
+
+
+#### ⚙️ Parameters
+
+
+-
+
+
+-
+
+**unitId:** `string`
+
+
+
+
+
+-
+
+**requestOptions:** `MeasureUnits.RequestOptions`
+
+
+
+
+
+
+
+
+
+
+client.measureUnits.deleteById(unitId) -> void
+
+-
+
+#### 🔌 Usage
+
+
+-
+
+
+-
+
+```typescript
+await client.measureUnits.deleteById("unit_id");
+```
+
+
+
+
+
+
+#### ⚙️ Parameters
+
+
+-
+
+
+-
+
+**unitId:** `string`
+
+
+
+
+
+-
+
+**requestOptions:** `MeasureUnits.RequestOptions`
+
+
+
+
+
+
+
+
+
+
+client.measureUnits.updateById(unitId, { ...params }) -> Monite.UnitResponse
+
+-
+
+#### 🔌 Usage
+
+
+-
+
+
+-
+
+```typescript
+await client.measureUnits.updateById("unit_id");
+```
+
+
+
+
+
+
+#### ⚙️ Parameters
+
+
+-
+
+
+-
+
+**unitId:** `string`
+
+
+
+
+
+-
+
+**request:** `Monite.UnitUpdate`
+
+
+
+
+
+-
+
+**requestOptions:** `MeasureUnits.RequestOptions`
+
+
+
+
+
+
+
+
+
+
+## Onboarding links
+
+client.onboardingLinks.create({ ...params }) -> Monite.OnboardingLinkPublicResponse
+
+-
+
+#### 🔌 Usage
+
+
+-
+
+
+-
+
+```typescript
+await client.onboardingLinks.create({
+ expires_at: "2024-01-15T09:30:00Z",
+ refresh_url: "refresh_url",
+ return_url: "return_url",
+});
+```
+
+
+
+
+
+
+#### ⚙️ Parameters
+
+
+-
+
+
+-
+
+**request:** `Monite.OnboardingLinkRequest`
+
+
+
+
+
+-
+
+**requestOptions:** `OnboardingLinks.RequestOptions`
+
+
+
+
+
+
+
+
+
+
+## Overdue reminders
+
+client.overdueReminders.get() -> Monite.AllOverdueRemindersResponse
+
+-
+
+#### 🔌 Usage
+
+
+-
+
+
+-
+
+```typescript
+await client.overdueReminders.get();
+```
+
+
+
+
+
+
+#### ⚙️ Parameters
+
+
+-
+
+
+-
+
+**requestOptions:** `OverdueReminders.RequestOptions`
+
+
+
+
+
+
+
+
+
+
+client.overdueReminders.create({ ...params }) -> Monite.OverdueReminderResponse
+
+-
+
+#### 🔌 Usage
+
+
+-
+
+
+-
+
+```typescript
+await client.overdueReminders.create({
+ name: "name",
+});
+```
+
+
+
+
+
+
+#### ⚙️ Parameters
+
+
+-
+
+
+-
+
+**request:** `Monite.OverdueReminderRequest`
+
+
+
+
+
+-
+
+**requestOptions:** `OverdueReminders.RequestOptions`
+
+
+
+
+
+
+
+
+
+
+client.overdueReminders.getById(overdueReminderId) -> Monite.OverdueReminderResponse
+
+-
+
+#### 🔌 Usage
+
+
+-
+
+
+-
+
+```typescript
+await client.overdueReminders.getById("overdue_reminder_id");
+```
+
+
+
+
+
+
+#### ⚙️ Parameters
+
+
+-
+
+
+-
+
+**overdueReminderId:** `string`
+
+
+
+
+
+-
+
+**requestOptions:** `OverdueReminders.RequestOptions`
+
+
+
+
+
+
+
+
+
+
+client.overdueReminders.deleteById(overdueReminderId) -> void
+
+-
+
+#### 🔌 Usage
+
+
+-
+
+
+-
+
+```typescript
+await client.overdueReminders.deleteById("overdue_reminder_id");
+```
+
+
+
+
+
+
+#### ⚙️ Parameters
+
+
+-
+
+
+-
+
+**overdueReminderId:** `string`
+
+
+
+
+
+-
+
+**requestOptions:** `OverdueReminders.RequestOptions`
+
+
+
+
+
+
+
+
+
+
+client.overdueReminders.updateById(overdueReminderId, { ...params }) -> Monite.OverdueReminderResponse
+
+-
+
+#### 🔌 Usage
+
+
+-
+
+
+-
+
+```typescript
+await client.overdueReminders.updateById("overdue_reminder_id");
+```
+
+
+
+
+
+
+#### ⚙️ Parameters
+
+
+-
+
+
+-
+
+**overdueReminderId:** `string`
+
+
+
+
+
+-
+
+**request:** `Monite.OverdueReminderUpdateRequest`
+
+
+
+
+
+-
+
+**requestOptions:** `OverdueReminders.RequestOptions`
+
+
+
+
+
+
+
+
+
+
+## Purchase orders
+
+client.purchaseOrders.get({ ...params }) -> Monite.PurchaseOrderPaginationResponse
+
+-
+
+#### 🔌 Usage
+
+
+-
+
+
+-
+
+```typescript
+await client.purchaseOrders.get();
+```
+
+
+
+
+
+
+#### ⚙️ Parameters
+
+
+-
+
+
+-
+
+**request:** `Monite.PurchaseOrdersGetRequest`
+
+
+
+
+
+-
+
+**requestOptions:** `PurchaseOrders.RequestOptions`
+
+
+
+
+
+
+
+
+
+
+client.purchaseOrders.create({ ...params }) -> Monite.PurchaseOrderResponseSchema
+
+-
+
+#### 🔌 Usage
+
+
+-
+
+
+-
+
+```typescript
+await client.purchaseOrders.create({
+ counterpart_id: "counterpart_id",
+ currency: "AED",
+ items: [
+ {
+ currency: "AED",
+ name: "name",
+ price: 1,
+ quantity: 1,
+ unit: "unit",
+ vat_rate: 1,
+ },
+ ],
+ message: "message",
+ valid_for_days: 1,
+});
+```
+
+
+
+
+
+
+#### ⚙️ Parameters
+
+
+-
+
+
+-
+
+**request:** `Monite.PurchaseOrderPayloadSchema`
+
+
+
+
+
+-
+
+**requestOptions:** `PurchaseOrders.RequestOptions`
+
+
+
+
+
+
+
+
+
+
+client.purchaseOrders.getVariables() -> Monite.VariablesObjectList
+
+-
+
+#### 📝 Description
+
+
+-
+
+
+-
+
+Get a list of placeholders allowed to insert into an email template for customization
+
+
+
+
+
+
+#### 🔌 Usage
+
+
+-
+
+
+-
+
+```typescript
+await client.purchaseOrders.getVariables();
+```
+
+
+
+
+
+
+#### ⚙️ Parameters
+
+
+-
+
+
+-
+
+**requestOptions:** `PurchaseOrders.RequestOptions`
+
+
+
+
+
+
+
+
+
+
+client.purchaseOrders.getById(purchaseOrderId) -> Monite.PurchaseOrderResponseSchema
+
+-
+
+#### 🔌 Usage
+
+
+-
+
+
+-
+
+```typescript
+await client.purchaseOrders.getById("purchase_order_id");
+```
+
+
+
+
+
+
+#### ⚙️ Parameters
+
+
+-
+
+
+-
+
+**purchaseOrderId:** `string`
+
+
+
+
+
+-
+
+**requestOptions:** `PurchaseOrders.RequestOptions`
+
+
+
+
+
+
+
+
+
+
+client.purchaseOrders.deleteById(purchaseOrderId) -> void
+
+-
+
+#### 🔌 Usage
+
+
+-
+
+
+-
+
+```typescript
+await client.purchaseOrders.deleteById("purchase_order_id");
+```
+
+
+
+
+
+
+#### ⚙️ Parameters
+
+
+-
+
+
+-
+
+**purchaseOrderId:** `string`
+
+
+
+
+
+-
+
+**requestOptions:** `PurchaseOrders.RequestOptions`
+
+
+
+
+
+
+
+
+
+
+client.purchaseOrders.updateById(purchaseOrderId, { ...params }) -> Monite.PurchaseOrderResponseSchema
+
+-
+
+#### 🔌 Usage
+
+
+-
+
+
+-
+
+```typescript
+await client.purchaseOrders.updateById("purchase_order_id");
+```
+
+
+
+
+
+
+#### ⚙️ Parameters
+
+
+-
+
+
+-
+
+**purchaseOrderId:** `string`
+
+
+
+
+
+-
+
+**request:** `Monite.UpdatePurchaseOrderPayloadSchema`
+
+
+
+
+
+-
+
+**requestOptions:** `PurchaseOrders.RequestOptions`
+
+
+
+
+
+
+
+
+
+
+client.purchaseOrders.previewById(purchaseOrderId, { ...params }) -> Monite.PurchaseOrderEmailPreviewResponse
+
+-
+
+#### 🔌 Usage
+
+
+-
+
+
+-
+
+```typescript
+await client.purchaseOrders.previewById("purchase_order_id", {
+ body_text: "body_text",
+ subject_text: "subject_text",
+});
+```
+
+
+
+
+
+
+#### ⚙️ Parameters
+
+
+-
+
+
+-
+
+**purchaseOrderId:** `string`
+
+
+
+
+
+-
+
+**request:** `Monite.PurchaseOrderEmailPreviewRequest`
+
+
+
+
+
+-
+
+**requestOptions:** `PurchaseOrders.RequestOptions`
+
+
+
+
+
+
+
+
+
+
+client.purchaseOrders.sendById(purchaseOrderId, { ...params }) -> Monite.PurchaseOrderEmailSentResponse
+
+-
+
+#### 🔌 Usage
+
+
+-
+
+
+-
+
+```typescript
+await client.purchaseOrders.sendById("purchase_order_id", {
+ body_text: "body_text",
+ subject_text: "subject_text",
+});
+```
+
+
+
+
+
+
+#### ⚙️ Parameters
+
+
+-
+
+
+-
+
+**purchaseOrderId:** `string`
+
+
+
+
+
+-
+
+**request:** `Monite.SendPurchaseOrderViaEmailRequest`
+
+
+
+
+
+-
+
+**requestOptions:** `PurchaseOrders.RequestOptions`
+
+
+
+
+
+
+
+
+
+
+## Payables
+
+client.payables.get({ ...params }) -> Monite.PayablePaginationResponse
+
+-
+
+#### 📝 Description
+
+
+-
+
+
+-
+
+Lists all payables from the connected entity.
+
+If you already have the data of the payable (amount in [minor units](https://docs.monite.com/docs/currencies#minor-units), currency, vendor information, and other details)
+stored somewhere as individual attributes, you can create a payable with these attributes by calling [POST
+/payables](https://docs.monite.com/reference/post_payables) and providing the [base64-encoded](https://en.wikipedia.org/wiki/Base64) contents of the original invoice file in the field `base64_encoded_file`.
+
+A payable is a financial document given by an entity`s supplier itemizing the purchase of a good or a service and
+demanding payment.
+
+The `file_name` field is optional. If omitted, it defaults to “default_file_name”. If the settings are configured
+to automatically set `suggested_payment_term`, this object can be omitted from the request body.
+
+The `id` generated for this payable can be used in other API calls to update the data of this payable or trigger [
+status transitions](https://docs.monite.com/docs/payable-status-transitions), for example. essential data
+fields to move from `draft` to `new`
+
+Related guide: [Create a payable from data](https://docs.monite.com/docs/collect-payables#create-a-payable-from-data)
+
+See also:
+
+[Automatic calculation of due date](https://docs.monite.com/docs/collect-payables#automatic-calculation-of-due-date)
+
+[Suggested payment date](https://docs.monite.com/docs/collect-payables#suggested-payment-date)
+
+[Attach file](https://docs.monite.com/docs/collect-payables#attach-file)
+
+[Collect payables by email](https://docs.monite.com/docs/collect-payables#send-payables-by-email)
+
+[Manage line items](https://docs.monite.com/docs/manage-line-items)
+
+
+
+
+
+
+#### 🔌 Usage
+
+
+-
+
+
+-
+
+```typescript
+await client.payables.get();
+```
+
+
+
+
+
+
+#### ⚙️ Parameters
+
+
+-
+
+
+-
+
+**request:** `Monite.PayablesGetRequest`
+
+
+
+
+
+-
+
+**requestOptions:** `Payables.RequestOptions`
+
+
+
+
+
+
+
+
+
+
+client.payables.create({ ...params }) -> Monite.PayableResponseSchema
+
+-
+
+#### 📝 Description
+
+
+-
+
+
+-
+
+Add a new payable by providing the amount, currency, vendor name, and other details.
+You can provide the base64_encoded contents of the original invoice file in the field `base64_encoded_file`.
+
+You can use this endpoint to bypass the Monite OCR service and provide the data directly
+(for example, if you already have the data in place).
+
+A newly created payable has the the `draft` [status](https://docs.monite.com/docs/payables-lifecycle).
+
+
+
+
+
+
+#### 🔌 Usage
+
+
+-
+
+
+-
+
+```typescript
+await client.payables.create();
+```
+
+
+
+
+
+
+#### ⚙️ Parameters
+
+
+-
+
+
+-
+
+**request:** `Monite.PayableUploadWithDataSchema`
+
+
+
+
+
+-
+
+**requestOptions:** `Payables.RequestOptions`
+
+
+
+
+
+
+
+
+
+
+client.payables.getAnalytics({ ...params }) -> Monite.PayableAggregatedDataResponse
+
+-
+
+#### 📝 Description
+
+
+-
+
+
+-
+
+Retrieve aggregated statistics for payables, including total amount and count, both overall and by status.
+
+
+
+
+
+
+#### 🔌 Usage
+
+
+-
+
+
+-
+
+```typescript
+await client.payables.getAnalytics();
+```
+
+
+
+
+
+
+#### ⚙️ Parameters
+
+
+-
+
+
+-
+
+**request:** `Monite.PayablesGetAnalyticsRequest`
+
+
+
+
+
+-
+
+**requestOptions:** `Payables.RequestOptions`
+
+
+
+
+
+
+
+
+
+
+client.payables.uploadFromFile(file) -> Monite.PayableResponseSchema
+
+-
+
+#### 📝 Description
+
+
+-
+
+
+-
+
+Upload an incoming invoice (payable) in PDF, PNG, JPEG, or TIFF format and scan its contents. The maximum file size is 10MB.
+
+
+
+
+
+
+#### 🔌 Usage
+
+
+-
+
+
+-
+
+```typescript
+await client.payables.uploadFromFile(fs.createReadStream("/path/to/your/file"));
+```
+
+
+
+
+
+
+#### ⚙️ Parameters
+
+
+-
+
+
+-
+
+**file:** `File | fs.ReadStream | Blob`
+
+
+
+
+
+-
+
+**requestOptions:** `Payables.RequestOptions`
+
+
+
+
+
+
+
+
+
+
+client.payables.getValidations() -> Monite.PayableValidationsResource
+
+-
+
+#### 📝 Description
+
+
+-
+
+
+-
+
+Get payable validations.
+
+
+
+
+
+
+#### 🔌 Usage
+
+
+-
+
+
+-
+
+```typescript
+await client.payables.getValidations();
+```
+
+
+
+
+
+
+#### ⚙️ Parameters
+
+
+-
+
+
+-
+
+**requestOptions:** `Payables.RequestOptions`
+
+
+
+
+
+
+
+
+
+
+client.payables.updateValidations({ ...params }) -> Monite.PayableValidationsResource
+
+-
+
+#### 📝 Description
+
+
+-
+
+
+-
+
+Update payable validations.
+
+
+
+
+
+
+#### 🔌 Usage
+
+
+-
+
+
+-
+
+```typescript
+await client.payables.updateValidations({
+ required_fields: ["currency"],
+});
+```
+
+
+
+
+
+
+#### ⚙️ Parameters
+
+
+-
+
+
+-
+
+**request:** `Monite.PayableValidationsUpdateRequest`
+
+
+
+
+
+-
+
+**requestOptions:** `Payables.RequestOptions`
+
+
+
+
+
+
+
+
+
+
+client.payables.resetValidations() -> Monite.PayableValidationsResource
+
+-
+
+#### 📝 Description
+
+
+-
+
+
+-
+
+Reset payable validations to default ones.
+
+
+
+
+
+
+#### 🔌 Usage
+
+
+-
+
+
+-
+
+```typescript
+await client.payables.resetValidations();
+```
+
+
+
+
+
+
+#### ⚙️ Parameters
+
+
+-
+
+
+-
+
+**requestOptions:** `Payables.RequestOptions`
+
+
+
+
+
+
+
+
+
+
+client.payables.getVariables() -> Monite.PayableTemplatesVariablesObjectList
+
+-
+
+#### 📝 Description
+
+
+-
+
+
+-
+
+Get a list of placeholders allowed to insert into an email template for customization
+
+
+
+
+
+
+#### 🔌 Usage
+
+
+-
+
+
+-
+
+```typescript
+await client.payables.getVariables();
+```
+
+
+
+
+
+
+#### ⚙️ Parameters
+
+
+-
+
+
+-
+
+**requestOptions:** `Payables.RequestOptions`
+
+
+
+
+
+
+
+
+
+
+client.payables.getById(payableId) -> Monite.PayableResponseSchema
+
+-
+
+#### 📝 Description
+
+
+-
+
+
+-
+
+Retrieves information about a specific payable with the given ID.
+
+
+
+
+
+
+#### 🔌 Usage
+
+
+-
+
+
+-
+
+```typescript
+await client.payables.getById("payable_id");
+```
+
+
+
+
+
+
+#### ⚙️ Parameters
+
+
+-
+
+
+-
+
+**payableId:** `string`
+
+
+
+
+
+-
+
+**requestOptions:** `Payables.RequestOptions`
+
+
+
+
+
+
+
+
+
+
+client.payables.deleteById(payableId) -> void
+
+-
+
+#### 📝 Description
+
+
+-
+
+
+-
+
+Deletes a specific payable.
+
+
+
+
+
+
+#### 🔌 Usage
+
+
+-
+
+
+-
+
+```typescript
+await client.payables.deleteById("payable_id");
+```
+
+
+
+
+
+
+#### ⚙️ Parameters
+
+
+-
+
+
+-
+
+**payableId:** `string`
+
+
+
+
+
+-
+
+**requestOptions:** `Payables.RequestOptions`
+
+
+
+
+
+
+
+
+
+
+client.payables.updateById(payableId, { ...params }) -> Monite.PayableResponseSchema
+
+-
+
+#### 📝 Description
+
+
+-
+
+
+-
+
+Updates the information about a specific payable.
+
+
+
+
+
+
+#### 🔌 Usage
+
+
+-
+
+
+-
+
+```typescript
+await client.payables.updateById("payable_id");
+```
+
+
+
+
+
+
+#### ⚙️ Parameters
+
+
+-
+
+
+-
+
+**payableId:** `string`
+
+
+
+
+
+-
+
+**request:** `Monite.PayableUpdateSchema`
+
+
+
+
+
+-
+
+**requestOptions:** `Payables.RequestOptions`
+
+
+
+
+
+
+
+
+
+
+client.payables.approvePaymentById(payableId) -> Monite.PayableResponseSchema
+
+-
+
+#### 📝 Description
+
+
+-
+
+
+-
+
+Confirms that the payable is ready to be paid.
+
+
+
+
+
+
+#### 🔌 Usage
+
+
+-
+
+
+-
+
+```typescript
+await client.payables.approvePaymentById("payable_id");
+```
+
+
+
+
+
+
+#### ⚙️ Parameters
+
+
+-
+
+
+-
+
+**payableId:** `string`
+
+
+
+
+
+-
+
+**requestOptions:** `Payables.RequestOptions`
+
+
+
+
+
+
+
+
+
+
+client.payables.attachFileById(file, payableId) -> Monite.PayableResponseSchema
+
+-
+
+#### 📝 Description
+
+
+-
+
+
+-
+
+Attach file to payable without existing attachment.
+
+
+
+
+
+
+#### 🔌 Usage
+
+
+-
+
+
+-
+
+```typescript
+await client.payables.attachFileById(fs.createReadStream("/path/to/your/file"), "payable_id");
+```
+
+
+
+
+
+
+#### ⚙️ Parameters
+
+
+-
+
+
+-
+
+**file:** `File | fs.ReadStream | Blob`
+
+
+
+
+
+-
+
+**payableId:** `string`
+
+
+
+
+
+-
+
+**requestOptions:** `Payables.RequestOptions`
+
+
+
+
+
+
+
+
+
+
+client.payables.cancelById(payableId) -> Monite.PayableResponseSchema
+
+-
+
+#### 📝 Description
+
+
+-
+
+
+-
+
+Cancels the payable that was not confirmed during the review.
+
+
+
+
+
+
+#### 🔌 Usage
+
+
+-
+
+
+-
+
+```typescript
+await client.payables.cancelById("payable_id");
+```
+
+
+
+
+
+
+#### ⚙️ Parameters
+
+
+-
+
+
+-
+
+**payableId:** `string`
+
+
+
+
+
+-
+
+**requestOptions:** `Payables.RequestOptions`
+
+
+
+
+
+
+
+
+
+
+client.payables.markAsPaidById(payableId, { ...params }) -> Monite.PayableResponseSchema
+
+-
+
+#### 📝 Description
+
+
+-
+
+
+-
+
+Mark a payable as paid.
+
+Payables can be paid using the payment channels offered by Monite or through external payment channels. In the latter
+case, the invoice is not automatically marked as paid in the system and needs to be converted to the paid status
+manually.
+
+Optionally, it is possible to pass the `comment` field in the request body, to describe how and when the invoice was
+paid.
+
+Notes:
+
+- To use this endpoint with an entity user token, this entity user must have a role that includes the `pay` permission
+ for payables.
+- The `amount_to_pay` field is automatically calculated based on the `amount_due` less the percentage described
+ in the `payment_terms.discount` value.
+
+Related guide: [Mark a payable as paid](https://docs.monite.com/docs/payable-status-transitions#mark-as-paid)
+
+See also:
+
+[Payables lifecycle](https://docs.monite.com/docs/payables-lifecycle)
+
+[Payables status transitions](https://docs.monite.com/docs/collect-payables#suggested-payment-date)
+
+
+
+
+
+
+#### 🔌 Usage
+
+
+-
+
+
+-
+
+```typescript
+await client.payables.markAsPaidById("payable_id");
+```
+
+
+
+
+
+
+#### ⚙️ Parameters
+
+
+-
+
+
+-
+
+**payableId:** `string`
+
+
+
+
+
+-
+
+**request:** `Monite.CommentPayload`
+
+
+
+
+
+-
+
+**requestOptions:** `Payables.RequestOptions`
+
+
+
+
+
+
+
+
+
+
+client.payables.markAsPartiallyPaidById(payableId, { ...params }) -> Monite.PayableResponseSchema
+
+-
+
+#### 📝 Description
+
+
+-
+
+
+-
+
+Mark a payable as partially paid.
+
+If the payable is partially paid, its status is moved to `partially_paid`. The value of the `amount_paid` field must be
+the sum of all payments made, not only the last one.
+
+Notes:
+
+- This endpoint can be used for payables in the `waiting_to_be_paid` status.
+- The `amount_paid` must be greater than 0 and less than the total payable amount specified by the `amount` field.
+- You can use this endpoint multiple times for the same payable to reflect multiple partial payments, always setting the
+ sum of all payments made.
+- To use this endpoint with an entity user token, this entity user must have a role that includes the `pay`
+ permission for payables.
+- The `amount_to_pay` field is automatically calculated based on the `amount_due` less the percentage described
+ in the `payment_terms.discount` value.
+
+Related guide: [Mark a payable as partially paid](https://docs.monite.com/docs/payable-status-transitions#mark-as-partially-paid)
+
+See also:
+
+[Payables lifecycle](https://docs.monite.com/docs/payables-lifecycle)
+
+[Payables status transitions](https://docs.monite.com/docs/collect-payables#suggested-payment-date)
+
+[Mark a payable as paid](https://docs.monite.com/docs/payable-status-transitions#mark-as-paid)
+
+
+
+
+
+
+#### 🔌 Usage
+
+
+-
+
+
+-
+
+```typescript
+await client.payables.markAsPartiallyPaidById("payable_id", {
+ amount_paid: 1,
+});
+```
+
+
+
+
+
+
+#### ⚙️ Parameters
+
+
+-
+
+
+-
+
+**payableId:** `string`
+
+
+
+
+
+-
+
+**request:** `Monite.PartiallyPaidPayload`
+
+
+
+
+
+-
+
+**requestOptions:** `Payables.RequestOptions`
+
+
+
+
+
+
+
+
+
+
+client.payables.rejectById(payableId) -> Monite.PayableResponseSchema
+
+-
+
+#### 📝 Description
+
+
+-
+
+
+-
+
+Declines the payable when an approver finds any mismatch or discrepancies.
+
+
+
+
+
+
+#### 🔌 Usage
+
+
+-
+
+
+-
+
+```typescript
+await client.payables.rejectById("payable_id");
+```
+
+
+
+
+
+
+#### ⚙️ Parameters
+
+
+-
+
+
+-
+
+**payableId:** `string`
+
+
+
+
+
+-
+
+**requestOptions:** `Payables.RequestOptions`
+
+
+
+
+
+
+
+
+
+
+client.payables.reopenById(payableId) -> Monite.PayableResponseSchema
+
+-
+
+#### 📝 Description
+
+
+-
+
+
+-
+
+Reset payable state from rejected to new.
+
+
+
+
+
+
+#### 🔌 Usage
+
+
+-
+
+
+-
+
+```typescript
+await client.payables.reopenById("payable_id");
+```
+
+
+
+
+
+
+#### ⚙️ Parameters
+
+
+-
+
+
+-
+
+**payableId:** `string`
+
+
+
+
+
+-
+
+**requestOptions:** `Payables.RequestOptions`
+
+
+
+
+
+
+
+
+
+
+client.payables.submitForApprovalById(payableId) -> Monite.PayableResponseSchema
+
+-
+
+#### 📝 Description
+
+
+-
+
+
+-
+
+Starts the approval process once the uploaded payable is validated.
+
+
+
+
+
+
+#### 🔌 Usage
+
+
+-
+
+
+-
+
+```typescript
+await client.payables.submitForApprovalById("payable_id");
+```
+
+
+
+
+
+
+#### ⚙️ Parameters
+
+
+-
+
+
+-
+
+**payableId:** `string`
+
+
+
+
+
+-
+
+**requestOptions:** `Payables.RequestOptions`
+
+
+
+
+
+
+
+
+
+
+client.payables.validateById(payableId) -> Monite.PayableValidationResponse
+
+-
+
+#### 📝 Description
+
+
+-
+
+
+-
+
+Check the invoice for compliance with the requirements for movement from draft to new status.
+
+
+
+
+
+
+#### 🔌 Usage
+
+
+-
+
+
+-
+
+```typescript
+await client.payables.validateById("payable_id");
+```
+
+
+
+
+
+
+#### ⚙️ Parameters
+
+
+-
+
+
+-
+
+**payableId:** `string`
+
+
+
+
+
+-
+
+**requestOptions:** `Payables.RequestOptions`
+
+
+
+
+
+
+
+
+
+
+## Payment intents
+
+client.paymentIntents.get({ ...params }) -> Monite.PaymentIntentsListResponse
+
+-
+
+#### 🔌 Usage
+
+
+-
+
+
+-
+
+```typescript
+await client.paymentIntents.get();
+```
+
+
+
+
+
+
+#### ⚙️ Parameters
+
+
+-
+
+
+-
+
+**request:** `Monite.PaymentIntentsGetRequest`
+
+
+
+
+
+-
+
+**requestOptions:** `PaymentIntents.RequestOptions`
+
+
+
+
+
+
+
+
+
+
+client.paymentIntents.getById(paymentIntentId) -> Monite.PaymentIntentResponse
+
+-
+
+#### 🔌 Usage
+
+
+-
+
+
+-
+
+```typescript
+await client.paymentIntents.getById("payment_intent_id");
+```
+
+
+
+
+
+
+#### ⚙️ Parameters
+
+
+-
+
+
+-
+
+**paymentIntentId:** `string`
+
+
+
+
+
+-
+
+**requestOptions:** `PaymentIntents.RequestOptions`
+
+
+
+
+
+
+
+
+
+
+client.paymentIntents.updateById(paymentIntentId, { ...params }) -> Monite.PaymentIntentResponse
+
+-
+
+#### 🔌 Usage
+
+
+-
+
+
+-
+
+```typescript
+await client.paymentIntents.updateById("payment_intent_id", {
+ amount: 1,
+});
+```
+
+
+
+
+
+
+#### ⚙️ Parameters
+
+
+-
+
+
+-
+
+**paymentIntentId:** `string`
+
+
+
+
+
+-
+
+**request:** `Monite.UpdatePaymentIntentPayload`
+
+
+
+
+
+-
+
+**requestOptions:** `PaymentIntents.RequestOptions`
+
+
+
+
+
+
+
+
+
+
+client.paymentIntents.getHistoryById(paymentIntentId) -> Monite.PaymentIntentHistoryResponse
+
+-
+
+#### 🔌 Usage
+
+
+-
+
+
+-
+
+```typescript
+await client.paymentIntents.getHistoryById("payment_intent_id");
+```
+
+
+
+
+
+
+#### ⚙️ Parameters
+
+
+-
+
+
+-
+
+**paymentIntentId:** `string`
+
+
+
+
+
+-
+
+**requestOptions:** `PaymentIntents.RequestOptions`
+
+
+
+
+
+
+
+
+
+
+## Payment links
+
+client.paymentLinks.create({ ...params }) -> Monite.PublicPaymentLinkResponse
+
+-
+
+#### 🔌 Usage
+
+
+-
+
+
+-
+
+```typescript
+await client.paymentLinks.create({
+ payment_methods: ["sepa_credit"],
+ recipient: {
+ id: "id",
+ type: "entity",
+ },
+});
+```
+
+
+
+
+
+
+#### ⚙️ Parameters
+
+
+-
+
+
+-
+
+**request:** `Monite.CreatePaymentLinkRequest`
+
+
+
+
+
+-
+
+**requestOptions:** `PaymentLinks.RequestOptions`
+
+
+
+
+
+
+
+
+
+
+client.paymentLinks.getById(paymentLinkId) -> Monite.PublicPaymentLinkResponse
+
+-
+
+#### 🔌 Usage
+
+
+-
+
+
+-
+
+```typescript
+await client.paymentLinks.getById("payment_link_id");
+```
+
+
+
+
+
+
+#### ⚙️ Parameters
+
+
+-
+
+
+-
+
+**paymentLinkId:** `string`
+
+
+
+
+
+-
+
+**requestOptions:** `PaymentLinks.RequestOptions`
+
+
+
+
+
+
+
+
+
+
+client.paymentLinks.expireById(paymentLinkId) -> Monite.PublicPaymentLinkResponse
+
+-
+
+#### 🔌 Usage
+
+
+-
+
+
+-
+
+```typescript
+await client.paymentLinks.expireById("payment_link_id");
+```
+
+
+
+
+
+
+#### ⚙️ Parameters
+
+
+-
+
+
+-
+
+**paymentLinkId:** `string`
+
+
+
+
+
+-
+
+**requestOptions:** `PaymentLinks.RequestOptions`
+
+
+
+
+
+
+
+
+
+
+## Payment records
+
+client.paymentRecords.get({ ...params }) -> Monite.PaymentRecordResponseList
+
+-
+
+#### 🔌 Usage
+
+
+-
+
+
+-
+
+```typescript
+await client.paymentRecords.get();
+```
+
+
+
+
+
+
+#### ⚙️ Parameters
+
+
+-
+
+
+-
+
+**request:** `Monite.PaymentRecordsGetRequest`
+
+
+
+
+
+-
+
+**requestOptions:** `PaymentRecords.RequestOptions`
+
+
+
+
+
+
+
+
+
+
+client.paymentRecords.create({ ...params }) -> Monite.PaymentRecordResponse
+
+-
+
+#### 🔌 Usage
+
+
+-
+
+
+-
+
+```typescript
+await client.paymentRecords.create({
+ amount: 1,
+ currency: "AED",
+ object: {
+ id: "id",
+ type: "receivable",
+ },
+ paid_at: "2024-01-15T09:30:00Z",
+ payment_intent_id: "payment_intent_id",
+});
+```
+
+
+
+
+
+
+#### ⚙️ Parameters
+
+
+-
+
+
+-
+
+**request:** `Monite.PaymentRecordRequest`
+
+
+
+
+
+-
+
+**requestOptions:** `PaymentRecords.RequestOptions`
+
+
+
+
+
+
+
+
+
+
+client.paymentRecords.getById(paymentRecordId) -> Monite.PaymentRecordResponse
+
+-
+
+#### 🔌 Usage
+
+
+-
+
+
+-
+
+```typescript
+await client.paymentRecords.getById("payment_record_id");
+```
+
+
+
+
+
+
+#### ⚙️ Parameters
+
+
+-
+
+
+-
+
+**paymentRecordId:** `string`
+
+
+
+
+
+-
+
+**requestOptions:** `PaymentRecords.RequestOptions`
+
+
+
+
+
+
+
+
+
+
+## Payment reminders
+
+client.paymentReminders.get() -> Monite.GetAllPaymentReminders
+
+-
+
+#### 🔌 Usage
+
+
+-
+
+
+-
+
+```typescript
+await client.paymentReminders.get();
+```
+
+
+
+
+
+
+#### ⚙️ Parameters
+
+
+-
+
+
+-
+
+**requestOptions:** `PaymentReminders.RequestOptions`
+
+
+
+
+
+
+
+
+
+
+client.paymentReminders.create({ ...params }) -> Monite.PaymentReminderResponse
+
+-
+
+#### 🔌 Usage
+
+
+-
+
+
+-
+
+```typescript
+await client.paymentReminders.create({
+ name: "name",
+});
+```
+
+
+
+
+
+
+#### ⚙️ Parameters
+
+
+-
+
+
+-
+
+**request:** `Monite.PaymentReminder`
+
+
+
+
+
+-
+
+**requestOptions:** `PaymentReminders.RequestOptions`
+
+
+
+
+
+
+
+
+
+
+client.paymentReminders.getById(paymentReminderId) -> Monite.PaymentReminderResponse
+
+-
+
+#### 🔌 Usage
+
+
+-
+
+
+-
+
+```typescript
+await client.paymentReminders.getById("payment_reminder_id");
+```
+
+
+
+
+
+
+#### ⚙️ Parameters
+
+
+-
+
+
+-
+
+**paymentReminderId:** `string`
+
+
+
+
+
+-
+
+**requestOptions:** `PaymentReminders.RequestOptions`
+
+
+
+
+
+
+
+
+
+
+client.paymentReminders.deleteById(paymentReminderId) -> void
+
+-
+
+#### 🔌 Usage
+
+
+-
+
+
+-
+
+```typescript
+await client.paymentReminders.deleteById("payment_reminder_id");
+```
+
+
+
+
+
+
+#### ⚙️ Parameters
+
+
+-
+
+
+-
+
+**paymentReminderId:** `string`
+
+
+
+
+
+-
+
+**requestOptions:** `PaymentReminders.RequestOptions`
+
+
+
+
+
+
+
+
+
+
+client.paymentReminders.updateById(paymentReminderId, { ...params }) -> Monite.PaymentReminderResponse
+
+-
+
+#### 🔌 Usage
+
+
+-
+
+
+-
+
+```typescript
+await client.paymentReminders.updateById("payment_reminder_id");
+```
+
+
+
+
+
+
+#### ⚙️ Parameters
+
+
+-
+
+
+-
+
+**paymentReminderId:** `string`
+
+
+
+
+
+-
+
+**request:** `Monite.PaymentReminderUpdateRequest`
+
+
+
+
+
+-
+
+**requestOptions:** `PaymentReminders.RequestOptions`
+
+
+
+
+
+
+
+
+
+
+## Payment terms
+
+client.paymentTerms.get() -> Monite.PaymentTermsListResponse
+
+-
+
+#### 🔌 Usage
+
+
+-
+
+
+-
+
+```typescript
+await client.paymentTerms.get();
+```
+
+
+
+
+
+
+#### ⚙️ Parameters
+
+
+-
+
+
+-
+
+**requestOptions:** `PaymentTerms.RequestOptions`
+
+
+
+
+
+
+
+
+
+
+client.paymentTerms.create({ ...params }) -> Monite.PaymentTermsResponse
+
+-
+
+#### 🔌 Usage
+
+
+-
+
+
+-
+
+```typescript
+await client.paymentTerms.create({
+ name: "name",
+ term_final: {
+ number_of_days: 1,
+ },
+});
+```
+
+
+
+
+
+
+#### ⚙️ Parameters
+
+
+-
+
+
+-
+
+**request:** `Monite.PaymentTermsCreatePayload`
+
+
+
+
+
+-
+
+**requestOptions:** `PaymentTerms.RequestOptions`
+
+
+
+
+
+
+
+
+
+
+client.paymentTerms.getById(paymentTermsId) -> Monite.PaymentTermsResponse
+
+-
+
+#### 🔌 Usage
+
+
+-
+
+
+-
+
+```typescript
+await client.paymentTerms.getById("payment_terms_id");
+```
+
+
+
+
+
+
+#### ⚙️ Parameters
+
+
+-
+
+
+-
+
+**paymentTermsId:** `string`
+
+
+
+
+
+-
+
+**requestOptions:** `PaymentTerms.RequestOptions`
+
+
+
+
+
+
+
+
+
+
+client.paymentTerms.deleteById(paymentTermsId) -> void
+
+-
+
+#### 🔌 Usage
+
+
+-
+
+
+-
+
+```typescript
+await client.paymentTerms.deleteById("payment_terms_id");
+```
+
+
+
+
+
+
+#### ⚙️ Parameters
+
+
+-
+
+
+-
+
+**paymentTermsId:** `string`
+
+
+
+
+
+-
+
+**requestOptions:** `PaymentTerms.RequestOptions`
+
+
+
+
+
+
+
+
+
+
+client.paymentTerms.updateById(paymentTermsId, { ...params }) -> Monite.PaymentTermsResponse
+
+-
+
+#### 🔌 Usage
+
+
+-
+
+
+-
+
+```typescript
+await client.paymentTerms.updateById("payment_terms_id");
+```
+
+
+
+
+
+
+#### ⚙️ Parameters
+
+
+-
+
+
+-
+
+**paymentTermsId:** `string`
+
+
+
+
+
+-
+
+**request:** `Monite.PaymentTermsUpdatePayload`
+
+
+
+
+
+-
+
+**requestOptions:** `PaymentTerms.RequestOptions`
+
+
+
+
+
+
+
+
+
+
+## Products
+
+client.products.get({ ...params }) -> Monite.ProductServicePaginationResponse
+
+-
+
+#### 🔌 Usage
+
+
+-
+
+
+-
+
+```typescript
+await client.products.get();
+```
+
+
+
+
+
+
+#### ⚙️ Parameters
+
+
+-
+
+
+-
+
+**request:** `Monite.ProductsGetRequest`
+
+
+
+
+
+-
+
+**requestOptions:** `Products.RequestOptions`
+
+
+
+
+
+
+
+
+
+
+client.products.create({ ...params }) -> Monite.ProductServiceResponse
+
+-
+
+#### 🔌 Usage
+
+
+-
+
+
+-
+
+```typescript
+await client.products.create({
+ name: "name",
+});
+```
+
+
+
+
+
+
+#### ⚙️ Parameters
+
+
+-
+
+
+-
+
+**request:** `Monite.ProductServiceRequest`
+
+
+
+
+
+-
+
+**requestOptions:** `Products.RequestOptions`
+
+
+
+
+
+
+
+
+
+
+client.products.getById(productId) -> Monite.ProductServiceResponse
+
+-
+
+#### 🔌 Usage
+
+
+-
+
+
+-
+
+```typescript
+await client.products.getById("product_id");
+```
+
+
+
+
+
+
+#### ⚙️ Parameters
+
+
+-
+
+
+-
+
+**productId:** `string`
+
+
+
+
+
+-
+
+**requestOptions:** `Products.RequestOptions`
+
+
+
+
+
+
+
+
+
+
+client.products.deleteById(productId) -> void
+
+-
+
+#### 🔌 Usage
+
+
+-
+
+
+-
+
+```typescript
+await client.products.deleteById("product_id");
+```
+
+
+
+
+
+
+#### ⚙️ Parameters
+
+
+-
+
+
+-
+
+**productId:** `string`
+
+
+
+
+
+-
+
+**requestOptions:** `Products.RequestOptions`
+
+
+
+
+
+
+
+
+
+
+client.products.updateById(productId, { ...params }) -> Monite.ProductServiceResponse
+
+-
+
+#### 🔌 Usage
+
+
+-
+
+
+-
+
+```typescript
+await client.products.updateById("product_id");
+```
+
+
+
+
+
+
+#### ⚙️ Parameters
+
+
+-
+
+
+-
+
+**productId:** `string`
+
+
+
+
+
+-
+
+**request:** `Monite.ProductServiceUpdate`
+
+
+
+
+
+-
+
+**requestOptions:** `Products.RequestOptions`
+
+
+
+
+
+
+
+
+
+
+## Projects
+
+client.projects.get({ ...params }) -> Monite.ProjectPaginationResponse
+
+-
+
+#### 📝 Description
+
+
+-
+
+
+-
+
+Get all projects for an entity
+
+
+
+
+
+
+#### 🔌 Usage
+
+
+-
+
+
+-
+
+```typescript
+await client.projects.get();
+```
+
+
+
+
+
+
+#### ⚙️ Parameters
+
+
+-
+
+
+-
+
+**request:** `Monite.ProjectsGetRequest`
+
+
+
+
+
+-
+
+**requestOptions:** `Projects.RequestOptions`
+
+
+
+
+
+
+
+
+
+
+client.projects.create({ ...params }) -> Monite.ProjectResource
+
+-
+
+#### 📝 Description
+
+
+-
+
+
+-
+
+Create a new project.
+
+
+
+
+
+
+#### 🔌 Usage
+
+
+-
+
+
+-
+
+```typescript
+await client.projects.create({
+ name: "Marketing",
+});
+```
+
+
+
+
+
+
+#### ⚙️ Parameters
+
+
+-
+
+
+-
+
+**request:** `Monite.ProjectCreateRequest`
+
+
+
+
+
+-
+
+**requestOptions:** `Projects.RequestOptions`
+
+
+
+
+
+
+
+
+
+
+client.projects.getById(projectId) -> Monite.ProjectResource
+
+-
+
+#### 📝 Description
+
+
+-
+
+
+-
+
+Get a project with the given ID.
+
+
+
+
+
+
+#### 🔌 Usage
+
+
+-
+
+
+-
+
+```typescript
+await client.projects.getById("project_id");
+```
+
+
+
+
+
+
+#### ⚙️ Parameters
+
+
+-
+
+
+-
+
+**projectId:** `string`
+
+
+
+
+
+-
+
+**requestOptions:** `Projects.RequestOptions`
+
+
+
+
+
+
+
+
+
+
+client.projects.deleteById(projectId) -> void
+
+-
+
+#### 📝 Description
+
+
+-
+
+
+-
+
+Delete a project.
+
+
+
+
+
+
+#### 🔌 Usage
+
+
+-
+
+
+-
+
+```typescript
+await client.projects.deleteById("project_id");
+```
+
+
+
+
+
+
+#### ⚙️ Parameters
+
+
+-
+
+
+-
+
+**projectId:** `string`
+
+
+
+
+
+-
+
+**requestOptions:** `Projects.RequestOptions`
+
+
+
+
+
+
+
+
+
+
+client.projects.updateById(projectId, { ...params }) -> Monite.ProjectResource
+
+-
+
+#### 📝 Description
+
+
+-
+
+
+-
+
+Update a project.
+
+
+
+
+
+
+#### 🔌 Usage
+
+
+-
+
+
+-
+
+```typescript
+await client.projects.updateById("project_id");
+```
+
+
+
+
+
+
+#### ⚙️ Parameters
+
+
+-
+
+
+-
+
+**projectId:** `string`
+
+
+
+
+
+-
+
+**request:** `Monite.ProjectUpdateRequest`
+
+
+
+
+
+-
+
+**requestOptions:** `Projects.RequestOptions`
+
+
+
+
+
+
+
+
+
+
+## Receivables
+
+client.receivables.get({ ...params }) -> Monite.ReceivablePaginationResponse
+
+-
+
+#### 📝 Description
+
+
+-
+
+
+-
+
+Returns a list of [accounts receivable](https://docs.monite.com/accounts-receivable/index) documents - invoices, quotes, and credit notes - of the specified entity.
+
+Results can be filtered by amount, counterpart, due date, and other criteria. Multiple filters are combined using logical AND unless specified otherwise. If no documents matching the search criteria are found, the endpoint returns a successful response with an empty `data` array.
+
+This endpoint supports [pagination](https://docs.monite.com/api/concepts/pagination-sorting-filtering) and sorting. By default, results are sorted by the creation date in ascending order (from oldest to newest).
+
+#### Examples
+
+##### Invoices
+
+- Get all overdue invoices:
+
+ ```
+ GET /receivables?type=invoice&status=overdue
+ ```
+
+- Get all invoices created for the counterpart named "Solarwind" (case-insensitive):
+
+ ```
+ GET /receivables?type=invoice?counterpart_name__icontains=Solarwind
+ ```
+
+- Get invoices whose total amount starts from 500 EUR:
+
+ ```
+ GET /receivables?type=invoice&total_amount__gte=50000
+ ```
+
+- Get invoices that are due for payment in September 2024:
+
+ ```
+ GET /receivables?type=invoice&due_date__gte=2024-09-01T00:00:00Z&due_date__lt=2024-10-01T00:00:00Z
+ ```
+
+- Get invoices created on or after September 1, 2024:
+
+ ```
+ GET /receivables?type=invoice&created_at__gte=2024-09-01T00:00:00Z
+ ```
+
+- Find an invoice created from a specific quote:
+
+ ```
+ GET /receivables?type=invoice?based_on=QUOTE_ID
+ ```
+
+##### Quotes
+
+- Get the latest created quote:
+
+ ```
+ GET /receivables?type=quote&sort=created_at&order=desc&limit=1
+ ```
+
+- Get the latest issued quote:
+
+ ```
+ GET /receivables?type=quote&sort=issue_date&order=desc&limit=1
+ ```
+
+##### Credit notes
+
+- Find all credit notes created for a specific invoice:
+
+ ```
+ GET /receivables?type=credit_note?based_on=INVOICE_ID
+ ```
+
+
+
+
+
+
+#### 🔌 Usage
+
+
+-
+
+
+-
+
+```typescript
+await client.receivables.get();
+```
+
+
+
+
+
+
+#### ⚙️ Parameters
+
+
+-
+
+
+-
+
+**request:** `Monite.ReceivablesGetRequest`
+
+
+
+
+
+-
+
+**requestOptions:** `Receivables.RequestOptions`
+
+
+
+
+
+
+
+
+
+
+client.receivables.create({ ...params }) -> Monite.ReceivableResponse
+
+-
+
+#### 🔌 Usage
+
+
+-
+
+
+-
+
+```typescript
+await client.receivables.create({
+ counterpart_billing_address_id: "counterpart_billing_address_id",
+ counterpart_id: "counterpart_id",
+ currency: "AED",
+ line_items: [
+ {
+ quantity: 1.1,
+ },
+ ],
+ type: "quote",
+});
+```
+
+
+
+
+
+
+#### ⚙️ Parameters
+
+
+-
+
+
+-
+
+**request:** `Monite.ReceivableFacadeCreatePayload`
+
+
+
+
+
+-
+
+**requestOptions:** `Receivables.RequestOptions`
+
+
+
+
+
+
+
+
+
+
+client.receivables.getVariables() -> Monite.ReceivableTemplatesVariablesObjectList
+
+-
+
+#### 📝 Description
+
+
+-
+
+
+-
+
+Get a list of placeholders that can be used in email templates for customization.
+
+
+
+
+
+
+#### 🔌 Usage
+
+
+-
+
+
+-
+
+```typescript
+await client.receivables.getVariables();
+```
+
+
+
+
+
+
+#### ⚙️ Parameters
+
+
+-
+
+
+-
+
+**requestOptions:** `Receivables.RequestOptions`
+
+
+
+
+
+
+
+
+
+
+client.receivables.getById(receivableId) -> Monite.ReceivableResponse
+
+-
+
+#### 🔌 Usage
+
+
+-
+
+
+-
+
+```typescript
+await client.receivables.getById("receivable_id");
+```
+
+
+
+
+
+
+#### ⚙️ Parameters
+
+
+-
+
+
+-
+
+**receivableId:** `string`
+
+
+
+
+
+-
+
+**requestOptions:** `Receivables.RequestOptions`
+
+
+
+
+
+
+
+
+
+
+client.receivables.deleteById(receivableId) -> void
+
+-
+
+#### 🔌 Usage
+
+
+-
+
+
+-
+
+```typescript
+await client.receivables.deleteById("receivable_id");
+```
+
+
+
+
+
+
+#### ⚙️ Parameters
+
+
+-
+
+
+-
+
+**receivableId:** `string`
+
+
+
+
+
+-
+
+**requestOptions:** `Receivables.RequestOptions`
+
+
+
+
+
+
+
+
+
+
+client.receivables.updateById(receivableId, { ...params }) -> Monite.ReceivableResponse
+
+-
+
+#### 🔌 Usage
+
+
+-
+
+
+-
+
+```typescript
+await client.receivables.updateById("receivable_id", {
+ quote: {},
+});
+```
+
+
+
+
+
+
+#### ⚙️ Parameters
+
+
+-
+
+
+-
+
+**receivableId:** `string`
+
+
+
+
+
+-
+
+**request:** `Monite.ReceivableUpdatePayload`
+
+
+
+
+
+-
+
+**requestOptions:** `Receivables.RequestOptions`
+
+
+
+
+
+
+
+
+
+
+client.receivables.acceptById(receivableId, { ...params }) -> Monite.SuccessResult
+
+-
+
+#### 🔌 Usage
+
+
+-
+
+
+-
+
+```typescript
+await client.receivables.acceptById("receivable_id");
+```
+
+
+
+
+
+
+#### ⚙️ Parameters
+
+
+-
+
+
+-
+
+**receivableId:** `string`
+
+
+
+
+
+-
+
+**request:** `Monite.QuoteAcceptRequest`
+
+
+
+
+
+-
+
+**requestOptions:** `Receivables.RequestOptions`
+
+
+
+
+
+
+
+
+
+
+client.receivables.cancelById(receivableId) -> void
+
+-
+
+#### 🔌 Usage
+
+
+-
+
+
+-
+
+```typescript
+await client.receivables.cancelById("receivable_id");
+```
+
+
+
+
+
+
+#### ⚙️ Parameters
+
+
+-
+
+
+-
+
+**receivableId:** `string`
+
+
+
+
+
+-
+
+**requestOptions:** `Receivables.RequestOptions`
+
+
+
+
+
+
+
+
+
+
+client.receivables.cloneById(receivableId) -> Monite.ReceivableResponse
+
+-
+
+#### 🔌 Usage
+
+
+-
+
+
+-
+
+```typescript
+await client.receivables.cloneById("receivable_id");
+```
+
+
+
+
+
+
+#### ⚙️ Parameters
+
+
+-
+
+
+-
+
+**receivableId:** `string`
+
+
+
+
+
+-
+
+**requestOptions:** `Receivables.RequestOptions`
+
+
+
+
+
+
+
+
+
+
+client.receivables.declineById(receivableId, { ...params }) -> Monite.SuccessResult
+
+-
+
+#### 🔌 Usage
+
+
+-
+
+
+-
+
+```typescript
+await client.receivables.declineById("receivable_id");
+```
+
+
+
+
+
+
+#### ⚙️ Parameters
+
+
+-
+
+
+-
+
+**receivableId:** `string`
+
+
+
+
+
+-
+
+**request:** `Monite.ReceivableDeclinePayload`
+
+
+
+
+
+-
+
+**requestOptions:** `Receivables.RequestOptions`
+
+
+
+
+
+
+
+
+
+
+client.receivables.getHistory(receivableId, { ...params }) -> Monite.ReceivableHistoryPaginationResponse
+
+-
+
+#### 🔌 Usage
+
+
+-
+
+
+-
+
+```typescript
+await client.receivables.getHistory("receivable_id");
+```
+
+
+
+
+
+
+#### ⚙️ Parameters
+
+
+-
+
+
+-
+
+**receivableId:** `string`
+
+
+
+
+
+-
+
+**request:** `Monite.ReceivablesGetHistoryRequest`
+
+
+
+
+
+-
+
+**requestOptions:** `Receivables.RequestOptions`
+
+
+
+
+
+
+
+
+
+
+client.receivables.getHistoryById(receivableHistoryId, receivableId) -> Monite.ReceivableHistoryResponse
+
+-
+
+#### 🔌 Usage
+
+
+-
+
+
+-
+
+```typescript
+await client.receivables.getHistoryById("receivable_history_id", "receivable_id");
+```
+
+
+
+
+
+
+#### ⚙️ Parameters
+
+
+-
+
+
+-
+
+**receivableHistoryId:** `string`
+
+
+
+
+
+-
+
+**receivableId:** `string`
+
+
+
+
+
+-
+
+**requestOptions:** `Receivables.RequestOptions`
+
+
+
+
+
+
+
+
+
+
+client.receivables.issueById(receivableId) -> Monite.ReceivableResponse
+
+-
+
+#### 🔌 Usage
+
+
+-
+
+
+-
+
+```typescript
+await client.receivables.issueById("receivable_id");
+```
+
+
+
+
+
+
+#### ⚙️ Parameters
+
+
+-
+
+
+-
+
+**receivableId:** `string`
+
+
+
+
+
+-
+
+**requestOptions:** `Receivables.RequestOptions`
+
+
+
+
+
+
+
+
+
+
+client.receivables.updateLineItemsById(receivableId, { ...params }) -> Monite.LineItemsResponse
+
+-
+
+#### 📝 Description
+
+
+-
+
+
+-
+
+Replace all line items of an existing invoice or quote with a new list of line items.
+
+
+
+
+
+
+#### 🔌 Usage
+
+
+-
+
+
+-
+
+```typescript
+await client.receivables.updateLineItemsById("receivable_id", {
+ data: [
+ {
+ quantity: 1.1,
+ },
+ ],
+});
+```
+
+
+
+
+
+
+#### ⚙️ Parameters
+
+
+-
+
+
+-
+
+**receivableId:** `string`
+
+
+
+
+
+-
+
+**request:** `Monite.UpdateLineItems`
+
+
+
+
+
+-
+
+**requestOptions:** `Receivables.RequestOptions`
+
+
+
+
+
+
+
+
+
+
+client.receivables.getMails(receivableId, { ...params }) -> Monite.ReceivableMailPaginationResponse
+
+-
+
+#### 🔌 Usage
+
+
+-
+
+
+-
+
+```typescript
+await client.receivables.getMails("receivable_id");
+```
+
+
+
+
+
+
+#### ⚙️ Parameters
+
+
+-
+
+
+-
+
+**receivableId:** `string`
+
+
+
+
+
+-
+
+**request:** `Monite.ReceivablesGetMailsRequest`
+
+
+
+
+
+-
+
+**requestOptions:** `Receivables.RequestOptions`
+
+
+
+
+
+
+
+
+
+
+client.receivables.getMailById(receivableId, mailId) -> Monite.ReceivableMailResponse
+
+-
+
+#### 🔌 Usage
+
+
+-
+
+
+-
+
+```typescript
+await client.receivables.getMailById("receivable_id", "mail_id");
+```
+
+
+
+
+
+
+#### ⚙️ Parameters
+
+
+-
+
+
+-
+
+**receivableId:** `string`
+
+
+
+
+
+-
+
+**mailId:** `string`
+
+
+
+
+
+-
+
+**requestOptions:** `Receivables.RequestOptions`
+
+
+
+
+
+
+
+
+
+
+client.receivables.markAsPaidById(receivableId, { ...params }) -> Monite.ReceivableResponse
+
+-
+
+#### 🔌 Usage
+
+
+-
+
+
+-
+
+```typescript
+await client.receivables.markAsPaidById("receivable_id");
+```
+
+
+
+
+
+
+#### ⚙️ Parameters
+
+
+-
+
+
+-
+
+**receivableId:** `string`
+
+
+
+
+
+-
+
+**request:** `Monite.ReceivablePaidPayload`
+
+
+
+
+
+-
+
+**requestOptions:** `Receivables.RequestOptions`
+
+
+
+
+
+
+
+
+
+
+client.receivables.markAsPartiallyPaidById(receivableId, { ...params }) -> Monite.ReceivableResponse
+
+-
+
+#### 📝 Description
+
+
+-
+
+
+-
+
+Deprecated. Use `POST /payment_records` to record an invoice payment.
+
+
+
+
+
+
+#### 🔌 Usage
+
+
+-
+
+
+-
+
+```typescript
+await client.receivables.markAsPartiallyPaidById("receivable_id", {
+ amount_paid: 1,
+});
+```
+
+
+
+
+
+
+#### ⚙️ Parameters
+
+
+-
+
+
+-
+
+**receivableId:** `string`
+
+
+
+
+
+-
+
+**request:** `Monite.ReceivablePartiallyPaidPayload`
+
+
+
+
+
+-
+
+**requestOptions:** `Receivables.RequestOptions`
+
+
+
+
+
+
+
+
+
+
+client.receivables.markAsUncollectibleById(receivableId, { ...params }) -> Monite.ReceivableResponse
+
+-
+
+#### 🔌 Usage
+
+
+-
+
+
+-
+
+```typescript
+await client.receivables.markAsUncollectibleById("receivable_id");
+```
+
+
+
+
+
+
+#### ⚙️ Parameters
+
+
+-
+
+
+-
+
+**receivableId:** `string`
+
+
+
+
+
+-
+
+**request:** `Monite.ReceivableUncollectiblePayload`
+
+
+
+
+
+-
+
+**requestOptions:** `Receivables.RequestOptions`
+
+
+
+
+
+
+
+
+
+
+client.receivables.getPdfLinkById(receivableId) -> Monite.ReceivableFileUrl
+
+-
+
+#### 🔌 Usage
+
+
+-
+
+
+-
+
+```typescript
+await client.receivables.getPdfLinkById("receivable_id");
+```
+
+
+
+
+
+
+#### ⚙️ Parameters
+
+
+-
+
+
+-
+
+**receivableId:** `string`
+
+
+
+
+
+-
+
+**requestOptions:** `Receivables.RequestOptions`
+
+
+
+
+
+
+
+
+
+
+client.receivables.previewById(receivableId, { ...params }) -> Monite.ReceivablePreviewResponse
+
+-
+
+#### 🔌 Usage
+
+
+-
+
+
+-
+
+```typescript
+await client.receivables.previewById("receivable_id", {
+ body_text: "body_text",
+ subject_text: "subject_text",
+});
+```
+
+
+
+
+
+
+#### ⚙️ Parameters
+
+
+-
+
+
+-
+
+**receivableId:** `string`
+
+
+
+
+
+-
+
+**request:** `Monite.ReceivablePreviewRequest`
+
+
+
+
+
+-
+
+**requestOptions:** `Receivables.RequestOptions`
+
+
+
+
+
+
+
+
+
+
+client.receivables.sendById(receivableId, { ...params }) -> Monite.ReceivableSendResponse
+
+-
+
+#### 🔌 Usage
+
+
+-
+
+
+-
+
+```typescript
+await client.receivables.sendById("receivable_id", {
+ body_text: "body_text",
+ subject_text: "subject_text",
+});
+```
+
+
+
+
+
+
+#### ⚙️ Parameters
+
+
+-
+
+
+-
+
+**receivableId:** `string`
+
+
+
+
+
+-
+
+**request:** `Monite.ReceivableSendRequest`
+
+
+
+
+
+-
+
+**requestOptions:** `Receivables.RequestOptions`
+
+
+
+
+
+
+
+
+
+
+client.receivables.sendTestReminderById(receivableId, { ...params }) -> Monite.ReceivablesSendResponse
+
+-
+
+#### 🔌 Usage
+
+
+-
+
+
+-
+
+```typescript
+await client.receivables.sendTestReminderById("receivable_id", {
+ reminder_type: "term_1",
+});
+```
+
+
+
+
+
+
+#### ⚙️ Parameters
+
+
+-
+
+
+-
+
+**receivableId:** `string`
+
+
+
+
+
+-
+
+**request:** `Monite.ReceivableSendTestReminderPayload`
+
+
+
+
+
+-
+
+**requestOptions:** `Receivables.RequestOptions`
+
+
+
+
+
+
+
+
+
+
+client.receivables.verifyById(receivableId) -> Monite.ReceivablesVerifyResponse
+
+-
+
+#### 🔌 Usage
+
+
+-
+
+
+-
+
+```typescript
+await client.receivables.verifyById("receivable_id");
+```
+
+
+
+
+
+
+#### ⚙️ Parameters
+
+
+-
+
+
+-
+
+**receivableId:** `string`
+
+
+
+
+
+-
+
+**requestOptions:** `Receivables.RequestOptions`
+
+
+
+
+
+
+
+
+
+
+## Recurrences
+
+client.recurrences.get() -> Monite.GetAllRecurrences
+
+-
+
+#### 🔌 Usage
+
+
+-
+
+
+-
+
+```typescript
+await client.recurrences.get();
+```
+
+
+
+
+
+
+#### ⚙️ Parameters
+
+
+-
+
+
+-
+
+**requestOptions:** `Recurrences.RequestOptions`
+
+
+
+
+
+
+
+
+
+
+client.recurrences.create({ ...params }) -> Monite.Recurrence
+
+-
+
+#### 🔌 Usage
+
+
+-
+
+
+-
+
+```typescript
+await client.recurrences.create({
+ day_of_month: "first_day",
+ end_month: 1,
+ end_year: 1,
+ invoice_id: "invoice_id",
+ start_month: 1,
+ start_year: 1,
+});
+```
+
+
+
+
+
+
+#### ⚙️ Parameters
+
+
+-
+
+
+-
+
+**request:** `Monite.CreateRecurrencePayload`
+
+
+
+
+
+-
+
+**requestOptions:** `Recurrences.RequestOptions`
+
+
+
+
+
+
+
+
+
+
+client.recurrences.getById(recurrenceId) -> Monite.Recurrence
+
+-
+
+#### 🔌 Usage
+
+
+-
+
+
+-
+
+```typescript
+await client.recurrences.getById("recurrence_id");
+```
+
+
+
+
+
+
+#### ⚙️ Parameters
+
+
+-
+
+
+-
+
+**recurrenceId:** `string`
+
+
+
+
+
+-
+
+**requestOptions:** `Recurrences.RequestOptions`
+
+
+
+
+
+
+
+
+
+
+client.recurrences.updateById(recurrenceId, { ...params }) -> Monite.Recurrence
+
+-
+
+#### 🔌 Usage
+
+
+-
+
+
+-
+
+```typescript
+await client.recurrences.updateById("recurrence_id");
+```
+
+
+
+
+
+
+#### ⚙️ Parameters
+
+
+-
+
+
+-
+
+**recurrenceId:** `string`
+
+
+
+
+
+-
+
+**request:** `Monite.UpdateRecurrencePayload`
+
+
+
+
+
+-
+
+**requestOptions:** `Recurrences.RequestOptions`
+
+
+
+
+
+
+
+
+
+
+client.recurrences.cancelById(recurrenceId) -> void
+
+-
+
+#### 🔌 Usage
+
+
+-
+
+
+-
+
+```typescript
+await client.recurrences.cancelById("recurrence_id");
+```
+
+
+
+
+
+
+#### ⚙️ Parameters
+
+
+-
+
+
+-
+
+**recurrenceId:** `string`
+
+
+
+
+
+-
+
+**requestOptions:** `Recurrences.RequestOptions`
+
+
+
+
+
+
+
+
+
+
+## Roles
+
+client.roles.get({ ...params }) -> Monite.RolePaginationResponse
+
+-
+
+#### 📝 Description
+
+
+-
+
+
+-
+
+Find all roles that match the search criteria.
+
+
+
+
+
+
+#### 🔌 Usage
+
+
+-
+
+
+-
+
+```typescript
+await client.roles.get();
+```
+
+
+
+
+
+
+#### ⚙️ Parameters
+
+
+-
+
+
+-
+
+**request:** `Monite.RolesGetRequest`
+
+
+
+
+
+-
+
+**requestOptions:** `Roles.RequestOptions`
+
+
+
+
+
+
+
+
+
+
+client.roles.create({ ...params }) -> Monite.RoleResponse
+
+-
+
+#### 📝 Description
+
+
+-
+
+
+-
+
+Create a new role from the specified values.
+
+
+
+
+
+
+#### 🔌 Usage
+
+
+-
+
+
+-
+
+```typescript
+await client.roles.create({
+ name: "name",
+ permissions: {},
+});
+```
+
+
+
+
+
+
+#### ⚙️ Parameters
+
+
+-
+
+
+-
+
+**request:** `Monite.CreateRoleRequest`
+
+
+
+
+
+-
+
+**requestOptions:** `Roles.RequestOptions`
+
+
+
+
+
+
+
+
+
+
+client.roles.getById(roleId) -> Monite.RoleResponse
+
+-
+
+#### 🔌 Usage
+
+
+-
+
+
+-
+
+```typescript
+await client.roles.getById("role_id");
+```
+
+
+
+
+
+
+#### ⚙️ Parameters
+
+
+-
+
+
+-
+
+**roleId:** `string`
+
+
+
+
+
+-
+
+**requestOptions:** `Roles.RequestOptions`
+
+
+
+
+
+
+
+
+
+
+client.roles.updateById(roleId, { ...params }) -> Monite.RoleResponse
+
+-
+
+#### 📝 Description
+
+
+-
+
+
+-
+
+Change the specified fields with the provided values.
+
+
+
+
+
+
+#### 🔌 Usage
+
+
+-
+
+
+-
+
+```typescript
+await client.roles.updateById("role_id");
+```
+
+
+
+
+
+
+#### ⚙️ Parameters
+
+
+-
+
+
+-
+
+**roleId:** `string`
+
+
+
+
+
+-
+
+**request:** `Monite.UpdateRoleRequest`
+
+
+
+
+
+-
+
+**requestOptions:** `Roles.RequestOptions`
+
+
+
+
+
+
+
+
+
+
+## Partner settings
+
+client.partnerSettings.get() -> Monite.PartnerProjectSettingsResponse
+
+-
+
+#### 📝 Description
+
+
+-
+
+
+-
+
+Retrieve all settings for this partner.
+
+
+
+
+
+
+#### 🔌 Usage
+
+
+-
+
+
+-
+
+```typescript
+await client.partnerSettings.get();
+```
+
+
+
+
+
+
+#### ⚙️ Parameters
+
+
+-
+
+
+-
+
+**requestOptions:** `PartnerSettings.RequestOptions`
+
+
+
+
+
+
+
+
+
+
+client.partnerSettings.update({ ...params }) -> Monite.PartnerProjectSettingsResponse
+
+-
+
+#### 📝 Description
+
+
+-
+
+
+-
+
+Change the specified fields with the provided values.
+
+
+
+
+
+
+#### 🔌 Usage
+
+
+-
+
+
+-
+
+```typescript
+await client.partnerSettings.update();
+```
+
+
+
+
+
+
+#### ⚙️ Parameters
+
+
+-
+
+
+-
+
+**request:** `Monite.PartnerProjectSettingsPayload`
+
+
+
+
+
+-
+
+**requestOptions:** `PartnerSettings.RequestOptions`
+
+
+
+
+
+
+
+
+
+
+## Tags
+
+client.tags.get({ ...params }) -> Monite.TagsPaginationResponse
+
+-
+
+#### 📝 Description
+
+
+-
+
+
+-
+
+Get a list of all tags. Tags can be assigned to resources to assist with searching and filtering.
+Tags can also be used as trigger conditions in payable approval policies.
+
+
+
+
+
+
+#### 🔌 Usage
+
+
+-
+
+
+-
+
+```typescript
+await client.tags.get();
+```
+
+
+
+
+
+
+#### ⚙️ Parameters
+
+
+-
+
+
+-
+
+**request:** `Monite.TagsGetRequest`
+
+
+
+
+
+-
+
+**requestOptions:** `Tags.RequestOptions`
+
+
+
+
+
+
+
+
+
+
+client.tags.create({ ...params }) -> Monite.TagReadSchema
+
+-
+
+#### 📝 Description
+
+
+-
+
+
+-
+
+Create a new tag. The tag name must be unique.
+Tag names are case-sensitive, that is `Marketing` and `marketing` are two different tags.
+
+The response returns an auto-generated ID assigned to this tag.
+To assign this tag to a resource, send the tag ID in the `tag_ids` list when creating or updating a resource.
+
+
+
+
+
+
+#### 🔌 Usage
+
+
+-
+
+
+-
+
+```typescript
+await client.tags.create({
+ name: "Marketing",
+});
+```
+
+
+
+
+
+
+#### ⚙️ Parameters
+
+
+-
+
+
+-
+
+**request:** `Monite.TagCreateSchema`
+
+
+
+
+
+-
+
+**requestOptions:** `Tags.RequestOptions`
+
+
+
+
+
+
+
+
+
+
+client.tags.getById(tagId) -> Monite.TagReadSchema
+
+-
+
+#### 📝 Description
+
+
+-
+
+
+-
+
+Get information about a tag with the given ID.
+
+
+
+
+
+
+#### 🔌 Usage
+
+
+-
+
+
+-
+
+```typescript
+await client.tags.getById("tag_id");
+```
+
+
+
+
+
+
+#### ⚙️ Parameters
+
+
+-
+
+
+-
+
+**tagId:** `string`
+
+
+
+
+
+-
+
+**requestOptions:** `Tags.RequestOptions`
+
+
+
+
+
+
+
+
+
+
+client.tags.deleteById(tagId) -> void
+
+-
+
+#### 📝 Description
+
+
+-
+
+
+-
+
+Delete a tag with the given ID. This tag will be automatically deleted from all resources where it was used.
+
+
+
+
+
+
+#### 🔌 Usage
+
+
+-
+
+
+-
+
+```typescript
+await client.tags.deleteById("tag_id");
+```
+
+
+
+
+
+
+#### ⚙️ Parameters
+
+
+-
+
+
+-
+
+**tagId:** `string`
+
+
+
+
+
+-
+
+**requestOptions:** `Tags.RequestOptions`
+
+
+
+
+
+
+
+
+
+
+client.tags.updateById(tagId, { ...params }) -> Monite.TagReadSchema
+
+-
+
+#### 📝 Description
+
+
+-
+
+
+-
+
+Change the tag name. The new name must be unique among existing tags.
+Tag names are case-sensitive, that is `Marketing` and `marketing` are two different tags.
+
+
+
+
+
+
+#### 🔌 Usage
+
+
+-
+
+
+-
+
+```typescript
+await client.tags.updateById("tag_id");
+```
+
+
+
+
+
+
+#### ⚙️ Parameters
+
+
+-
+
+
+-
+
+**tagId:** `string`
+
+
+
+
+
+-
+
+**request:** `Monite.TagUpdateSchema`
+
+
+
+
+
+-
+
+**requestOptions:** `Tags.RequestOptions`
+
+
+
+
+
+
+
+
+
+
+## Text templates
+
+client.textTemplates.get({ ...params }) -> Monite.TextTemplateResponseList
+
+-
+
+#### 📝 Description
+
+
+-
+
+
+-
+
+Get text templates
+
+
+
+
+
+
+#### 🔌 Usage
+
+
+-
+
+
+-
+
+```typescript
+await client.textTemplates.get();
+```
+
+
+
+
+
+
+#### ⚙️ Parameters
+
+
+-
+
+
+-
+
+**request:** `Monite.TextTemplatesGetRequest`
+
+
+
+
+
+-
+
+**requestOptions:** `TextTemplates.RequestOptions`
+
+
+
+
+
+
+
+
+
+
+client.textTemplates.create({ ...params }) -> Monite.TextTemplateResponse
+
+-
+
+#### 📝 Description
+
+
+-
+
+
+-
+
+Create a text template
+
+
+
+
+
+
+#### 🔌 Usage
+
+
+-
+
+
+-
+
+```typescript
+await client.textTemplates.create({
+ document_type: "quote",
+ name: "name",
+ template: "template",
+ type: "email_header",
+});
+```
+
+
+
+
+
+
+#### ⚙️ Parameters
+
+
+-
+
+
+-
+
+**request:** `Monite.CreateTextTemplatePayload`
+
+
+
+
+
+-
+
+**requestOptions:** `TextTemplates.RequestOptions`
+
+
+
+
+
+
+
+
+
+
+client.textTemplates.getById(textTemplateId) -> Monite.TextTemplateResponse
+
+-
+
+#### 📝 Description
+
+
+-
+
+
+-
+
+Get all custom contents
+
+
+
+
+
+
+#### 🔌 Usage
+
+
+-
+
+
+-
+
+```typescript
+await client.textTemplates.getById("text_template_id");
+```
+
+
+
+
+
+
+#### ⚙️ Parameters
+
+
+-
+
+
+-
+
+**textTemplateId:** `string`
+
+
+
+
+
+-
+
+**requestOptions:** `TextTemplates.RequestOptions`
+
+
+
+
+
+
+
+
+
+
+client.textTemplates.deleteById(textTemplateId) -> void
+
+-
+
+#### 📝 Description
+
+
+-
+
+
+-
+
+Delete custom content by ID
+
+
+
+
+
+
+#### 🔌 Usage
+
+
+-
+
+
+-
+
+```typescript
+await client.textTemplates.deleteById("text_template_id");
+```
+
+
+
+
+
+
+#### ⚙️ Parameters
+
+
+-
+
+
+-
+
+**textTemplateId:** `string` — UUID text_template ID
+
+
+
+
+
+-
+
+**requestOptions:** `TextTemplates.RequestOptions`
+
+
+
+
+
+
+
+
+
+
+client.textTemplates.updateById(textTemplateId, { ...params }) -> Monite.TextTemplateResponse
+
+-
+
+#### 📝 Description
+
+
+-
+
+
+-
+
+Update custom content by ID
+
+
+
+
+
+
+#### 🔌 Usage
+
+
+-
+
+
+-
+
+```typescript
+await client.textTemplates.updateById("text_template_id");
+```
+
+
+
+
+
+
+#### ⚙️ Parameters
+
+
+-
+
+
+-
+
+**textTemplateId:** `string` — UUID text_template ID
+
+
+
+
+
+-
+
+**request:** `Monite.UpdateTextTemplatePayload`
+
+
+
+
+
+-
+
+**requestOptions:** `TextTemplates.RequestOptions`
+
+
+
+
+
+
+
+
+
+
+client.textTemplates.makeDefaultById(textTemplateId) -> Monite.TextTemplateResponse
+
+-
+
+#### 📝 Description
+
+
+-
+
+
+-
+
+Make text template default
+
+
+
+
+
+
+#### 🔌 Usage
+
+
+-
+
+
+-
+
+```typescript
+await client.textTemplates.makeDefaultById("text_template_id");
+```
+
+
+
+
+
+
+#### ⚙️ Parameters
+
+
+-
+
+
+-
+
+**textTemplateId:** `string` — UUID text_template ID
+
+
+
+
+
+-
+
+**requestOptions:** `TextTemplates.RequestOptions`
+
+
+
+
+
+
+
+
+
+
+## VAT rates
+
+client.vatRates.get({ ...params }) -> Monite.VatRateListResponse
+
+-
+
+#### 🔌 Usage
+
+
+-
+
+
+-
+
+```typescript
+await client.vatRates.get();
+```
+
+
+
+
+
+
+#### ⚙️ Parameters
+
+
+-
+
+
+-
+
+**request:** `Monite.VatRatesGetRequest`
+
+
+
+
+
+-
+
+**requestOptions:** `VatRates.RequestOptions`
+
+
+
+
+
+
+
+
+
+
+## Webhook deliveries
+
+client.webhookDeliveries.get({ ...params }) -> Monite.WebhookDeliveryPaginationResource
+
+-
+
+#### 🔌 Usage
+
+
+-
+
+
+-
+
+```typescript
+await client.webhookDeliveries.get();
+```
+
+
+
+
+
+
+#### ⚙️ Parameters
+
+
+-
+
+
+-
+
+**request:** `Monite.WebhookDeliveriesGetRequest`
+
+
+
+
+
+-
+
+**requestOptions:** `WebhookDeliveries.RequestOptions`
+
+
+
+
+
+
+
+
+
+
+## Webhook subscriptions
+
+client.webhookSubscriptions.get({ ...params }) -> Monite.WebhookSubscriptionPaginationResource
+
+-
+
+#### 🔌 Usage
+
+
+-
+
+
+-
+
+```typescript
+await client.webhookSubscriptions.get();
+```
+
+
+
+
+
+
+#### ⚙️ Parameters
+
+
+-
+
+
+-
+
+**request:** `Monite.WebhookSubscriptionsGetRequest`
+
+
+
+
+
+-
+
+**requestOptions:** `WebhookSubscriptions.RequestOptions`
+
+
+
+
+
+
+
+
+
+
+client.webhookSubscriptions.create({ ...params }) -> Monite.WebhookSubscriptionResourceWithSecret
+
+-
+
+#### 🔌 Usage
+
+
+-
+
+
+-
+
+```typescript
+await client.webhookSubscriptions.create({
+ object_type: "account",
+ url: "url",
+});
+```
+
+
+
+
+
+
+#### ⚙️ Parameters
+
+
+-
+
+
+-
+
+**request:** `Monite.CreateWebhookSubscriptionRequest`
+
+
+
+
+
+-
+
+**requestOptions:** `WebhookSubscriptions.RequestOptions`
+
+
+
+
+
+
+
+
+
+
+client.webhookSubscriptions.getById(webhookSubscriptionId) -> Monite.WebhookSubscriptionResource
+
+-
+
+#### 🔌 Usage
+
+
+-
+
+
+-
+
+```typescript
+await client.webhookSubscriptions.getById("webhook_subscription_id");
+```
+
+
+
+
+
+
+#### ⚙️ Parameters
+
+
+-
+
+
+-
+
+**webhookSubscriptionId:** `string`
+
+
+
+
+
+-
+
+**requestOptions:** `WebhookSubscriptions.RequestOptions`
+
+
+
+
+
+
+
+
+
+
+client.webhookSubscriptions.deleteById(webhookSubscriptionId) -> void
+
+-
+
+#### 🔌 Usage
+
+
+-
+
+
+-
+
+```typescript
+await client.webhookSubscriptions.deleteById("webhook_subscription_id");
+```
+
+
+
+
+
+
+#### ⚙️ Parameters
+
+
+-
+
+
+-
+
+**webhookSubscriptionId:** `string`
+
+
+
+
+
+-
+
+**requestOptions:** `WebhookSubscriptions.RequestOptions`
+
+
+
+
+
+
+
+
+
+
+client.webhookSubscriptions.updateById(webhookSubscriptionId, { ...params }) -> Monite.WebhookSubscriptionResource
+
+-
+
+#### 🔌 Usage
+
+
+-
+
+
+-
+
+```typescript
+await client.webhookSubscriptions.updateById("webhook_subscription_id");
+```
+
+
+
+
+
+
+#### ⚙️ Parameters
+
+
+-
+
+
+-
+
+**webhookSubscriptionId:** `string`
+
+
+
+
+
+-
+
+**request:** `Monite.UpdateWebhookSubscriptionRequest`
+
+
+
+
+
+-
+
+**requestOptions:** `WebhookSubscriptions.RequestOptions`
+
+
+
+
+
+
+
+
+
+
+client.webhookSubscriptions.disableById(webhookSubscriptionId) -> Monite.WebhookSubscriptionResource
+
+-
+
+#### 🔌 Usage
+
+
+-
+
+
+-
+
+```typescript
+await client.webhookSubscriptions.disableById("webhook_subscription_id");
+```
+
+
+
+
+
+
+#### ⚙️ Parameters
+
+
+-
+
+
+-
+
+**webhookSubscriptionId:** `string`
+
+
+
+
+
+-
+
+**requestOptions:** `WebhookSubscriptions.RequestOptions`
+
+
+
+
+
+
+
+
+
+
+client.webhookSubscriptions.enableById(webhookSubscriptionId) -> Monite.WebhookSubscriptionResource
+
+-
+
+#### 🔌 Usage
+
+
+-
+
+
+-
+
+```typescript
+await client.webhookSubscriptions.enableById("webhook_subscription_id");
+```
+
+
+
+
+
+
+#### ⚙️ Parameters
+
+
+-
+
+
+-
+
+**webhookSubscriptionId:** `string`
+
+
+
+
+
+-
+
+**requestOptions:** `WebhookSubscriptions.RequestOptions`
+
+
+
+
+
+
+
+
+
+
+client.webhookSubscriptions.regenerateSecretById(webhookSubscriptionId) -> Monite.WebhookSubscriptionResourceWithSecret
+
+-
+
+#### 🔌 Usage
+
+
+-
+
+
+-
+
+```typescript
+await client.webhookSubscriptions.regenerateSecretById("webhook_subscription_id");
+```
+
+
+
+
+
+
+#### ⚙️ Parameters
+
+
+-
+
+
+-
+
+**webhookSubscriptionId:** `string`
+
+
+
+
+
+-
+
+**requestOptions:** `WebhookSubscriptions.RequestOptions`
+
+
+
+
+
+
+
+
+
+
+## Accounting Payables
+
+client.accounting.payables.get({ ...params }) -> Monite.AccountingPayableList
+
+-
+
+#### 📝 Description
+
+
+-
+
+
+-
+
+Returns a list of accounts payable invoices (bills) that exist in the entity's accounting system. This requires that an accounting connection has been previously established. Refer to the [Accounting integration guide](https://docs.monite.com/accounting/integration/index) for details.
+
+This endpoint only provides read-only access to the accounting system's data but does not pull those payables into Monite. You can use it to review the data in the accounting system and find out which of those payables already exist or do not exist in Monite.
+
+Data is actual as of the date and time of the last accounting synchronization, which is specified by the `last_pull` value in the response from `GET /accounting_connections/{connection_id}`. To make sure you are accessing the most up-to-date accounting data, you can use `POST /accounting_connections/{connection_id}/sync` to trigger on-demand synchronization before getting the list of payables.
+
+
+
+
+
+
+#### 🔌 Usage
+
+
+-
+
+
+-
+
+```typescript
+await client.accounting.payables.get();
+```
+
+
+
+
+
+
+#### ⚙️ Parameters
+
+
+-
+
+
+-
+
+**request:** `Monite.accounting.PayablesGetRequest`
+
+
+
+
+
+-
+
+**requestOptions:** `Payables.RequestOptions`
+
+
+
+
+
+
+
+
+
+
+client.accounting.payables.getById(payableId) -> Monite.AccountingPayable
+
+-
+
+#### 📝 Description
+
+
+-
+
+
+-
+
+Returns information about an individual payable invoice (bill) that exists in the entity's accounting system. This payable may or may not also exist in Monite.
+
+
+
+
+
+
+#### 🔌 Usage
+
+
+-
+
+
+-
+
+```typescript
+await client.accounting.payables.getById("payable_id");
+```
+
+
+
+
+
+
+#### ⚙️ Parameters
+
+
+-
+
+
+-
+
+**payableId:** `string` — An internal ID of the payable invoice (bill) in the accounting system. You can get these IDs from `GET /accounting/payables`.
+
+
+
+
+
+-
+
+**requestOptions:** `Payables.RequestOptions`
+
+
+
+
+
+
+
+
+
+
+## Accounting Receivables
+
+client.accounting.receivables.get({ ...params }) -> Monite.AccountingReceivableList
+
+-
+
+#### 📝 Description
+
+
+-
+
+
+-
+
+Returns a list of invoices that exist in the entity's accounting system. This requires that an accounting connection has been previously established. Refer to the [Accounting integration guide](https://docs.monite.com/accounting/integration/index) for details.
+
+This endpoint only provides read-only access to the accounting system's data but does not pull those invoices into Monite. You can use it to review the data in the accounting system and find out which of those invoices already exist or do not exist in Monite.
+
+Data is actual as of the date and time of the last accounting synchronization, which is specified by the `last_pull` value in the response from `GET /accounting_connections/{connection_id}`. To make sure you are accessing the most up-to-date accounting data, you can use `POST /accounting_connections/{connection_id}/sync` to trigger on-demand synchronization before getting the invoice list.
+
+
+
+
+
+
+#### 🔌 Usage
+
+
+-
+
+
+-
+
+```typescript
+await client.accounting.receivables.get();
+```
+
+
+
+
+
+
+#### ⚙️ Parameters
+
+
+-
+
+
+-
+
+**request:** `Monite.accounting.ReceivablesGetRequest`
+
+
+
+
+
+-
+
+**requestOptions:** `Receivables.RequestOptions`
+
+
+
+
+
+
+
+
+
+
+client.accounting.receivables.getById(invoiceId) -> Monite.AccountingReceivable
+
+-
+
+#### 📝 Description
+
+
+-
+
+
+-
+
+Returns information about an individual invoice that exists in the entity's accounting system. This invoice may or may not also exist in Monite.
+
+
+
+
+
+
+#### 🔌 Usage
+
+
+-
+
+
+-
+
+```typescript
+await client.accounting.receivables.getById("invoice_id");
+```
+
+
+
+
+
+
+#### ⚙️ Parameters
+
+
+-
+
+
+-
+
+**invoiceId:** `string` — An internal ID of the invoice in the accounting system. You can get these IDs from `GET /accounting/receivables`.
+
+
+
+
+
+-
+
+**requestOptions:** `Receivables.RequestOptions`
+
+
+
+
+
+
+
+
+
+
+## Accounting Connections
+
+client.accounting.connections.get() -> Monite.AccountingConnectionList
+
+-
+
+#### 📝 Description
+
+
+-
+
+
+-
+
+Get all connections
+
+
+
+
+
+
+#### 🔌 Usage
+
+
+-
+
+
+-
+
+```typescript
+await client.accounting.connections.get();
+```
+
+
+
+
+
+
+#### ⚙️ Parameters
+
+
+-
+
+
+-
+
+**requestOptions:** `Connections.RequestOptions`
+
+
+
+
+
+
+
+
+
+
+client.accounting.connections.create({ ...params }) -> Monite.AccountingConnectionResponse
+
+-
+
+#### 📝 Description
+
+
+-
+
+
+-
+
+Create new connection
+
+
+
+
+
+
+#### 🔌 Usage
+
+
+-
+
+
+-
+
+```typescript
+await client.accounting.connections.create();
+```
+
+
+
+
+
+
+#### ⚙️ Parameters
+
+
+-
+
+
+-
+
+**request:** `Monite.accounting.AccountingConnectionRequest`
+
+
+
+
+
+-
+
+**requestOptions:** `Connections.RequestOptions`
+
+
+
+
+
+
+
+
+
+
+client.accounting.connections.getById(connectionId) -> Monite.AccountingConnectionResponse
+
+-
+
+#### 📝 Description
+
+
+-
+
+
+-
+
+Get connection by id
+
+
+
+
+
+
+#### 🔌 Usage
+
+
+-
+
+
+-
+
+```typescript
+await client.accounting.connections.getById("connection_id");
+```
+
+
+
+
+
+
+#### ⚙️ Parameters
+
+
+-
+
+
+-
+
+**connectionId:** `string`
+
+
+
+
+
+-
+
+**requestOptions:** `Connections.RequestOptions`
+
+
+
+
+
+
+
+
+
+
+client.accounting.connections.disconnectById(connectionId) -> Monite.AccountingConnectionResponse
+
+-
+
+#### 📝 Description
+
+
+-
+
+
+-
+
+Disconnect
+
+
+
+
+
+
+#### 🔌 Usage
+
+
+-
+
+
+-
+
+```typescript
+await client.accounting.connections.disconnectById("connection_id");
+```
+
+
+
+
+
+
+#### ⚙️ Parameters
+
+
+-
+
+
+-
+
+**connectionId:** `string`
+
+
+
+
+
+-
+
+**requestOptions:** `Connections.RequestOptions`
+
+
+
+
+
+
+
+
+
+
+client.accounting.connections.syncById(connectionId) -> Monite.AccountingMessageResponse
+
+-
+
+#### 🔌 Usage
+
+
+-
+
+
+-
+
+```typescript
+await client.accounting.connections.syncById("connection_id");
+```
+
+
+
+
+
+
+#### ⚙️ Parameters
+
+
+-
+
+
+-
+
+**connectionId:** `string`
+
+
+
+
+
+-
+
+**requestOptions:** `Connections.RequestOptions`
+
+
+
+
+
+
+
+
+
+
+## Accounting SyncedRecords
+
+client.accounting.syncedRecords.get({ ...params }) -> Monite.SyncRecordResourceList
+
+-
+
+#### 📝 Description
+
+
+-
+
+
+-
+
+Get synchronized records
+
+
+
+
+
+
+#### 🔌 Usage
+
+
+-
+
+
+-
+
+```typescript
+await client.accounting.syncedRecords.get({
+ object_type: "product",
+});
+```
+
+
+
+
+
+
+#### ⚙️ Parameters
+
+
+-
+
+
+-
+
+**request:** `Monite.accounting.SyncedRecordsGetRequest`
+
+
+
+
+
+-
+
+**requestOptions:** `SyncedRecords.RequestOptions`
+
+
+
+
+
+
+
+
+
+
+client.accounting.syncedRecords.getById(syncedRecordId) -> Monite.SyncRecordResource
+
+-
+
+#### 📝 Description
+
+
+-
+
+
+-
+
+Get synchronized record by id
+
+
+
+
+
+
+#### 🔌 Usage
+
+
+-
+
+
+-
+
+```typescript
+await client.accounting.syncedRecords.getById("synced_record_id");
+```
+
+
+
+
+
+
+#### ⚙️ Parameters
+
+
+-
+
+
+-
+
+**syncedRecordId:** `string`
+
+
+
+
+
+-
+
+**requestOptions:** `SyncedRecords.RequestOptions`
+
+
+
+
+
+
+
+
+
+
+client.accounting.syncedRecords.pushById(syncedRecordId) -> Monite.SyncRecordResource
+
+-
+
+#### 📝 Description
+
+
+-
+
+
+-
+
+Push object to the accounting system manually
+
+
+
+
+
+
+#### 🔌 Usage
+
+
+-
+
+
+-
+
+```typescript
+await client.accounting.syncedRecords.pushById("synced_record_id");
+```
+
+
+
+
+
+
+#### ⚙️ Parameters
+
+
+-
+
+
+-
+
+**syncedRecordId:** `string`
+
+
+
+
+
+-
+
+**requestOptions:** `SyncedRecords.RequestOptions`
+
+
+
+
+
+
+
+
+
+
+## Accounting TaxRates
+
+client.accounting.taxRates.get({ ...params }) -> Monite.AccountingTaxRateListResponse
+
+-
+
+#### 📝 Description
+
+
+-
+
+
+-
+
+Get all tax rate accounts
+
+
+
+
+
+
+#### 🔌 Usage
+
+
+-
+
+
+-
+
+```typescript
+await client.accounting.taxRates.get();
+```
+
+
+
+
+
+
+#### ⚙️ Parameters
+
+
+-
+
+
+-
+
+**request:** `Monite.accounting.TaxRatesGetRequest`
+
+
+
+
+
+-
+
+**requestOptions:** `TaxRates.RequestOptions`
+
+
+
+
+
+
+
+
+
+
+client.accounting.taxRates.getById(taxRateId) -> Monite.AccountingTaxRateResponse
+
+-
+
+#### 📝 Description
+
+
+-
+
+
+-
+
+Get tax rate account by id
+
+
+
+
+
+
+#### 🔌 Usage
+
+
+-
+
+
+-
+
+```typescript
+await client.accounting.taxRates.getById("tax_rate_id");
+```
+
+
+
+
+
+
+#### ⚙️ Parameters
+
+
+-
+
+
+-
+
+**taxRateId:** `string`
+
+
+
+
+
+-
+
+**requestOptions:** `TaxRates.RequestOptions`
+
+
+
+
+
+
+
+
+
+
+## Accounting LedgerAccounts
+
+client.accounting.ledgerAccounts.get({ ...params }) -> Monite.LedgerAccountListResponse
+
+-
+
+#### 📝 Description
+
+
+-
+
+
+-
+
+Get all ledger accounts
+
+
+
+
+
+
+#### 🔌 Usage
+
+
+-
+
+
+-
+
+```typescript
+await client.accounting.ledgerAccounts.get();
+```
+
+
+
+
+
+
+#### ⚙️ Parameters
+
+
+-
+
+
+-
+
+**request:** `Monite.accounting.LedgerAccountsGetRequest`
+
+
+
+
+
+-
+
+**requestOptions:** `LedgerAccounts.RequestOptions`
+
+
+
+
+
+
+
+
+
+
+client.accounting.ledgerAccounts.getById(ledgerAccountId) -> Monite.LedgerAccountResponse
+
+-
+
+#### 📝 Description
+
+
+-
+
+
+-
+
+Get ledger account by id
+
+
+
+
+
+
+#### 🔌 Usage
+
+
+-
+
+
+-
+
+```typescript
+await client.accounting.ledgerAccounts.getById("ledger_account_id");
+```
+
+
+
+
+
+
+#### ⚙️ Parameters
+
+
+-
+
+
+-
+
+**ledgerAccountId:** `string`
+
+
+
+
+
+-
+
+**requestOptions:** `LedgerAccounts.RequestOptions`
+
+
+
+
+
+
+
+
+
+
+## ApprovalPolicies Processes
+
+client.approvalPolicies.processes.get(approvalPolicyId) -> Monite.ApprovalProcessResourceList
+
+-
+
+#### 📝 Description
+
+
+-
+
+
+-
+
+Retrieve a list of all approval policy processes.
+
+
+
+
+
+
+#### 🔌 Usage
+
+
+-
+
+
+-
+
+```typescript
+await client.approvalPolicies.processes.get("approval_policy_id");
+```
+
+
+
+
+
+
+#### ⚙️ Parameters
+
+
+-
+
+
+-
+
+**approvalPolicyId:** `string`
+
+
+
+
+
+-
+
+**requestOptions:** `Processes.RequestOptions`
+
+
+
+
+
+
+
+
+
+
+client.approvalPolicies.processes.getById(approvalPolicyId, processId) -> Monite.ProcessResource
+
+-
+
+#### 📝 Description
+
+
+-
+
+
+-
+
+Retrieve a specific approval policy process.
+
+
+
+
+
+
+#### 🔌 Usage
+
+
+-
+
+
+-
+
+```typescript
+await client.approvalPolicies.processes.getById("approval_policy_id", "process_id");
+```
+
+
+
+
+
+
+#### ⚙️ Parameters
+
+
+-
+
+
+-
+
+**approvalPolicyId:** `string`
+
+
+
+
+
+-
+
+**processId:** `string`
+
+
+
+
+
+-
+
+**requestOptions:** `Processes.RequestOptions`
+
+
+
+
+
+
+
+
+
+
+client.approvalPolicies.processes.cancelById(approvalPolicyId, processId) -> Monite.ProcessResource
+
+-
+
+#### 📝 Description
+
+
+-
+
+
+-
+
+Cancel an ongoing approval process for a specific approval policy.
+
+
+
+
+
+
+#### 🔌 Usage
+
+
+-
+
+
+-
+
+```typescript
+await client.approvalPolicies.processes.cancelById("approval_policy_id", "process_id");
+```
+
+
+
+
+
+
+#### ⚙️ Parameters
+
+
+-
+
+
+-
+
+**approvalPolicyId:** `string`
+
+
+
+
+
+-
+
+**processId:** `string`
+
+
+
+
+
+-
+
+**requestOptions:** `Processes.RequestOptions`
+
+
+
+
+
+
+
+
+
+
+client.approvalPolicies.processes.getSteps(approvalPolicyId, processId) -> Monite.ApprovalProcessStepResourceList
+
+-
+
+#### 📝 Description
+
+
+-
+
+
+-
+
+Retrieve a list of approval policy process steps.
+
+
+
+
+
+
+#### 🔌 Usage
+
+
+-
+
+
+-
+
+```typescript
+await client.approvalPolicies.processes.getSteps("approval_policy_id", "process_id");
+```
+
+
+
+
+
+
+#### ⚙️ Parameters
+
+
+-
+
+
+-
+
+**approvalPolicyId:** `string`
+
+
+
+
+
+-
+
+**processId:** `string`
+
+
+
+
+
+-
+
+**requestOptions:** `Processes.RequestOptions`
+
+
+
+
+
+
+
+
+
+
+## Counterparts Addresses
+
+client.counterparts.addresses.get(counterpartId) -> Monite.CounterpartAddressResourceList
+
+-
+
+#### 🔌 Usage
+
+
+-
+
+
+-
+
+```typescript
+await client.counterparts.addresses.get("counterpart_id");
+```
+
+
+
+
+
+
+#### ⚙️ Parameters
+
+
+-
+
+
+-
+
+**counterpartId:** `string`
+
+
+
+
+
+-
+
+**requestOptions:** `Addresses.RequestOptions`
+
+
+
+
+
+
+
+
+
+
+client.counterparts.addresses.create(counterpartId, { ...params }) -> Monite.CounterpartAddressResponseWithCounterpartId
+
+-
+
+#### 🔌 Usage
+
+
+-
+
+
+-
+
+```typescript
+await client.counterparts.addresses.create("counterpart_id", {
+ city: "Berlin",
+ country: "AF",
+ line1: "Flughafenstrasse 52",
+ postal_code: "10115",
+});
+```
+
+
+
+
+
+
+#### ⚙️ Parameters
+
+
+-
+
+
+-
+
+**counterpartId:** `string`
+
+
+
+
+
+-
+
+**request:** `Monite.CounterpartAddress`
+
+
+
+
+
+-
+
+**requestOptions:** `Addresses.RequestOptions`
+
+
+
+
+
+
+
+
+
+
+client.counterparts.addresses.getById(addressId, counterpartId) -> Monite.CounterpartAddressResponseWithCounterpartId
+
+-
+
+#### 🔌 Usage
+
+
+-
+
+
+-
+
+```typescript
+await client.counterparts.addresses.getById("address_id", "counterpart_id");
+```
+
+
+
+
+
+
+#### ⚙️ Parameters
+
+
+-
+
+
+-
+
+**addressId:** `string`
+
+
+
+
+
+-
+
+**counterpartId:** `string`
+
+
+
+
+
+-
+
+**requestOptions:** `Addresses.RequestOptions`
+
+
+
+
+
+
+
+
+
+
+client.counterparts.addresses.deleteById(addressId, counterpartId) -> void
+
+-
+
+#### 🔌 Usage
+
+
+-
+
+
+-
+
+```typescript
+await client.counterparts.addresses.deleteById("address_id", "counterpart_id");
+```
+
+
+
+
+
+
+#### ⚙️ Parameters
+
+
+-
+
+
+-
+
+**addressId:** `string`
+
+
+
+
+
+-
+
+**counterpartId:** `string`
+
+
+
+
+
+-
+
+**requestOptions:** `Addresses.RequestOptions`
+
+
+
+
+
+
+
+
+
+
+client.counterparts.addresses.updateById(addressId, counterpartId, { ...params }) -> Monite.CounterpartAddressResponseWithCounterpartId
+
+-
+
+#### 🔌 Usage
+
+
+-
+
+
+-
+
+```typescript
+await client.counterparts.addresses.updateById("address_id", "counterpart_id");
+```
+
+
+
+
+
+
+#### ⚙️ Parameters
+
+
+-
+
+
+-
+
+**addressId:** `string`
+
+
+
+
+
+-
+
+**counterpartId:** `string`
+
+
+
+
+
+-
+
+**request:** `Monite.counterparts.CounterpartUpdateAddress`
+
+
+
+
+
+-
+
+**requestOptions:** `Addresses.RequestOptions`
+
+
+
+
+
+
+
+
+
+
+## Counterparts BankAccounts
+
+client.counterparts.bankAccounts.get(counterpartId) -> Monite.CounterpartBankAccountResourceList
+
+-
+
+#### 🔌 Usage
+
+
+-
+
+
+-
+
+```typescript
+await client.counterparts.bankAccounts.get("counterpart_id");
+```
+
+
+
+
+
+
+#### ⚙️ Parameters
+
+
+-
+
+
+-
+
+**counterpartId:** `string`
+
+
+
+
+
+-
+
+**requestOptions:** `BankAccounts.RequestOptions`
+
+
+
+
+
+
+
+
+
+
+client.counterparts.bankAccounts.create(counterpartId, { ...params }) -> Monite.CounterpartBankAccountResponse
+
+-
+
+#### 🔌 Usage
+
+
+-
+
+
+-
+
+```typescript
+await client.counterparts.bankAccounts.create("counterpart_id", {
+ country: "AF",
+ currency: "AED",
+});
+```
+
+
+
+
+
+
+#### ⚙️ Parameters
+
+
+-
+
+
+-
+
+**counterpartId:** `string`
+
+
+
+
+
+-
+
+**request:** `Monite.counterparts.CreateCounterpartBankAccount`
+
+
+
+
+
+-
+
+**requestOptions:** `BankAccounts.RequestOptions`
+
+
+
+
+
+
+
+
+
+
+client.counterparts.bankAccounts.getById(bankAccountId, counterpartId) -> Monite.CounterpartBankAccountResponse
+
+-
+
+#### 🔌 Usage
+
+
+-
+
+
+-
+
+```typescript
+await client.counterparts.bankAccounts.getById("bank_account_id", "counterpart_id");
+```
+
+
+
+
+
+
+#### ⚙️ Parameters
+
+
+-
+
+
+-
+
+**bankAccountId:** `string`
+
+
+
+
+
+-
+
+**counterpartId:** `string`
+
+
+
+
+
+-
+
+**requestOptions:** `BankAccounts.RequestOptions`
+
+
+
+
+
+
+
+
+
+
+client.counterparts.bankAccounts.deleteById(bankAccountId, counterpartId) -> void
+
+-
+
+#### 🔌 Usage
+
+
+-
+
+
+-
+
+```typescript
+await client.counterparts.bankAccounts.deleteById("bank_account_id", "counterpart_id");
+```
+
+
+
+
+
+
+#### ⚙️ Parameters
+
+
+-
+
+
+-
+
+**bankAccountId:** `string`
+
+
+
+
+
+-
+
+**counterpartId:** `string`
+
+
+
+
+
+-
+
+**requestOptions:** `BankAccounts.RequestOptions`
+
+
+
+
+
+
+
+
+
+
+client.counterparts.bankAccounts.updateById(bankAccountId, counterpartId, { ...params }) -> Monite.CounterpartBankAccountResponse
+
+-
+
+#### 🔌 Usage
+
+
+-
+
+
+-
+
+```typescript
+await client.counterparts.bankAccounts.updateById("bank_account_id", "counterpart_id");
+```
+
+
+
+
+
+
+#### ⚙️ Parameters
+
+
+-
+
+
+-
+
+**bankAccountId:** `string`
+
+
+
+
+
+-
+
+**counterpartId:** `string`
+
+
+
+
+
+-
+
+**request:** `Monite.counterparts.UpdateCounterpartBankAccount`
+
+
+
+
+
+-
+
+**requestOptions:** `BankAccounts.RequestOptions`
+
+
+
+
+
+
+
+
+
+
+client.counterparts.bankAccounts.makeDefaultById(bankAccountId, counterpartId) -> unknown
+
+-
+
+#### 🔌 Usage
+
+
+-
+
+
+-
+
+```typescript
+await client.counterparts.bankAccounts.makeDefaultById("bank_account_id", "counterpart_id");
+```
+
+
+
+
+
+
+#### ⚙️ Parameters
+
+
+-
+
+
+-
+
+**bankAccountId:** `string`
+
+
+
+
+
+-
+
+**counterpartId:** `string`
+
+
+
+
+
+-
+
+**requestOptions:** `BankAccounts.RequestOptions`
+
+
+
+
+
+
+
+
+
+
+## Counterparts Contacts
+
+client.counterparts.contacts.get(counterpartId) -> Monite.CounterpartContactsResourceList
+
+-
+
+#### 🔌 Usage
+
+
+-
+
+
+-
+
+```typescript
+await client.counterparts.contacts.get("counterpart_id");
+```
+
+
+
+
+
+
+#### ⚙️ Parameters
+
+
+-
+
+
+-
+
+**counterpartId:** `string`
+
+
+
+
+
+-
+
+**requestOptions:** `Contacts.RequestOptions`
+
+
+
+
+
+
+
+
+
+
+client.counterparts.contacts.create(counterpartId, { ...params }) -> Monite.CounterpartContactResponse
+
+-
+
+#### 🔌 Usage
+
+
+-
+
+
+-
+
+```typescript
+await client.counterparts.contacts.create("counterpart_id", {
+ address: {
+ city: "Berlin",
+ country: "AF",
+ line1: "Flughafenstrasse 52",
+ postal_code: "10115",
+ },
+ first_name: "Mary",
+ last_name: "O'Brien",
+});
+```
+
+
+
+
+
+
+#### ⚙️ Parameters
+
+
+-
+
+
+-
+
+**counterpartId:** `string`
+
+
+
+
+
+-
+
+**request:** `Monite.counterparts.CreateCounterpartContactPayload`
+
+
+
+
+
+-
+
+**requestOptions:** `Contacts.RequestOptions`
+
+
+
+
+
+
+
+
+
+
+client.counterparts.contacts.getById(contactId, counterpartId) -> Monite.CounterpartContactResponse
+
+-
+
+#### 🔌 Usage
+
+
+-
+
+
+-
+
+```typescript
+await client.counterparts.contacts.getById("contact_id", "counterpart_id");
+```
+
+
+
+
+
+
+#### ⚙️ Parameters
+
+
+-
+
+
+-
+
+**contactId:** `string`
+
+
+
+
+
+-
+
+**counterpartId:** `string`
+
+
+
+
+
+-
+
+**requestOptions:** `Contacts.RequestOptions`
+
+
+
+
+
+
+
+
+
+
+client.counterparts.contacts.deleteById(contactId, counterpartId) -> void
+
+-
+
+#### 🔌 Usage
+
+
+-
+
+
+-
+
+```typescript
+await client.counterparts.contacts.deleteById("contact_id", "counterpart_id");
+```
+
+
+
+
+
+
+#### ⚙️ Parameters
+
+
+-
+
+
+-
+
+**contactId:** `string`
+
+
+
+
+
+-
+
+**counterpartId:** `string`
+
+
+
+
+
+-
+
+**requestOptions:** `Contacts.RequestOptions`
+
+
+
+
+
+
+
+
+
+
+client.counterparts.contacts.updateById(contactId, counterpartId, { ...params }) -> Monite.CounterpartContactResponse
+
+-
+
+#### 🔌 Usage
+
+
+-
+
+
+-
+
+```typescript
+await client.counterparts.contacts.updateById("contact_id", "counterpart_id");
+```
+
+
+
+
+
+
+#### ⚙️ Parameters
+
+
+-
+
+
+-
+
+**contactId:** `string`
+
+
+
+
+
+-
+
+**counterpartId:** `string`
+
+
+
+
+
+-
+
+**request:** `Monite.counterparts.UpdateCounterpartContactPayload`
+
+
+
+
+
+-
+
+**requestOptions:** `Contacts.RequestOptions`
+
+
+
+
+
+
+
+
+
+
+client.counterparts.contacts.makeDefaultById(contactId, counterpartId) -> Monite.CounterpartContactResponse
+
+-
+
+#### 🔌 Usage
+
+
+-
+
+
+-
+
+```typescript
+await client.counterparts.contacts.makeDefaultById("contact_id", "counterpart_id");
+```
+
+
+
+
+
+
+#### ⚙️ Parameters
+
+
+-
+
+
+-
+
+**contactId:** `string`
+
+
+
+
+
+-
+
+**counterpartId:** `string`
+
+
+
+
+
+-
+
+**requestOptions:** `Contacts.RequestOptions`
+
+
+
+
+
+
+
+
+
+
+## Counterparts VatIds
+
+client.counterparts.vatIds.get(counterpartId) -> Monite.CounterpartVatIdResourceList
+
+-
+
+#### 🔌 Usage
+
+
+-
+
+
+-
+
+```typescript
+await client.counterparts.vatIds.get("counterpart_id");
+```
+
+
+
+
+
+
+#### ⚙️ Parameters
+
+
+-
+
+
+-
+
+**counterpartId:** `string`
+
+
+
+
+
+-
+
+**requestOptions:** `VatIds.RequestOptions`
+
+
+
+
+
+
+
+
+
+
+client.counterparts.vatIds.create(counterpartId, { ...params }) -> Monite.CounterpartVatIdResponse
+
+-
+
+#### 🔌 Usage
+
+
+-
+
+
+-
+
+```typescript
+await client.counterparts.vatIds.create("counterpart_id", {
+ value: "123456789",
+});
+```
+
+
+
+
+
+
+#### ⚙️ Parameters
+
+
+-
+
+
+-
+
+**counterpartId:** `string`
+
+
+
+
+
+-
+
+**request:** `Monite.counterparts.CounterpartVatId`
+
+
+
+
+
+-
+
+**requestOptions:** `VatIds.RequestOptions`
+
+
+
+
+
+
+
+
+
+
+client.counterparts.vatIds.getById(vatId, counterpartId) -> Monite.CounterpartVatIdResponse
+
+-
+
+#### 🔌 Usage
+
+
+-
+
+
+-
+
+```typescript
+await client.counterparts.vatIds.getById("vat_id", "counterpart_id");
+```
+
+
+
+
+
+
+#### ⚙️ Parameters
+
+
+-
+
+
+-
+
+**vatId:** `string`
+
+
+
+
+
+-
+
+**counterpartId:** `string`
+
+
+
+
+
+-
+
+**requestOptions:** `VatIds.RequestOptions`
+
+
+
+
+
+
+
+
+
+
+client.counterparts.vatIds.deleteById(vatId, counterpartId) -> void
+
+-
+
+#### 🔌 Usage
+
+
+-
+
+
+-
+
+```typescript
+await client.counterparts.vatIds.deleteById("vat_id", "counterpart_id");
+```
+
+
+
+
+
+
+#### ⚙️ Parameters
+
+
+-
+
+
+-
+
+**vatId:** `string`
+
+
+
+
+
+-
+
+**counterpartId:** `string`
+
+
+
+
+
+-
+
+**requestOptions:** `VatIds.RequestOptions`
+
+
+
+
+
+
+
+
+
+
+client.counterparts.vatIds.updateById(vatId, counterpartId, { ...params }) -> Monite.CounterpartVatIdResponse
+
+-
+
+#### 🔌 Usage
+
+
+-
+
+
+-
+
+```typescript
+await client.counterparts.vatIds.updateById("vat_id", "counterpart_id");
+```
+
+
+
+
+
+
+#### ⚙️ Parameters
+
+
+-
+
+
+-
+
+**vatId:** `string`
+
+
+
+
+
+-
+
+**counterpartId:** `string`
+
+
+
+
+
+-
+
+**request:** `Monite.counterparts.CounterpartUpdateVatId`
+
+
+
+
+
+-
+
+**requestOptions:** `VatIds.RequestOptions`
+
+
+
+
+
+
+
+
+
+
+## DataExports ExtraData
+
+client.dataExports.extraData.get({ ...params }) -> Monite.ExtraDataResourceList
+
+-
+
+#### 🔌 Usage
+
+
+-
+
+
+-
+
+```typescript
+await client.dataExports.extraData.get();
+```
+
+
+
+
+
+
+#### ⚙️ Parameters
+
+
+-
+
+
+-
+
+**request:** `Monite.dataExports.ExtraDataGetRequest`
+
+
+
+
+
+-
+
+**requestOptions:** `ExtraData.RequestOptions`
+
+
+
+
+
+
+
+
+
+
+client.dataExports.extraData.create({ ...params }) -> Monite.ExtraDataResource
+
+-
+
+#### 🔌 Usage
+
+
+-
+
+
+-
+
+```typescript
+await client.dataExports.extraData.create({
+ field_name: "default_account_code",
+ field_value: "field_value",
+ object_id: "object_id",
+});
+```
+
+
+
+
+
+
+#### ⚙️ Parameters
+
+
+-
+
+
+-
+
+**request:** `Monite.dataExports.ExtraDataCreateRequest`
+
+
+
+
+
+-
+
+**requestOptions:** `ExtraData.RequestOptions`
+
+
+
+
+
+
+
+
+
+
+client.dataExports.extraData.getById(extraDataId) -> Monite.ExtraDataResource
+
+-
+
+#### 🔌 Usage
+
+
+-
+
+
+-
+
+```typescript
+await client.dataExports.extraData.getById("extra_data_id");
+```
+
+
+
+
+
+
+#### ⚙️ Parameters
+
+
+-
+
+
+-
+
+**extraDataId:** `string`
+
+
+
+
+
+-
+
+**requestOptions:** `ExtraData.RequestOptions`
+
+
+
+
+
+
+
+
+
+
+client.dataExports.extraData.deleteById(extraDataId) -> Monite.ExtraDataResource
+
+-
+
+#### 🔌 Usage
+
+
+-
+
+
+-
+
+```typescript
+await client.dataExports.extraData.deleteById("extra_data_id");
+```
+
+
+
+
+
+
+#### ⚙️ Parameters
+
+
+-
+
+
+-
+
+**extraDataId:** `string`
+
+
+
+
+
+-
+
+**requestOptions:** `ExtraData.RequestOptions`
+
+
+
+
+
+
+
+
+
+
+client.dataExports.extraData.updateById(extraDataId, { ...params }) -> Monite.ExtraDataResource
+
+-
+
+#### 🔌 Usage
+
+
+-
+
+
+-
+
+```typescript
+await client.dataExports.extraData.updateById("extra_data_id");
+```
+
+
+
+
+
+
+#### ⚙️ Parameters
+
+
+-
+
+
+-
+
+**extraDataId:** `string`
+
+
+
+
+
+-
+
+**request:** `Monite.dataExports.ExtraDataUpdateRequest`
+
+
+
+
+
+-
+
+**requestOptions:** `ExtraData.RequestOptions`
+
+
+
+
+
+
+
+
+
+
+## Entities BankAccounts
+
+client.entities.bankAccounts.get() -> Monite.EntityBankAccountPaginationResponse
+
+-
+
+#### 📝 Description
+
+
+-
+
+
+-
+
+Get all bank accounts of this entity.
+
+
+
+
+
+
+#### 🔌 Usage
+
+
+-
+
+
+-
+
+```typescript
+await client.entities.bankAccounts.get();
+```
+
+
+
+
+
+
+#### ⚙️ Parameters
+
+
+-
+
+
+-
+
+**requestOptions:** `BankAccounts.RequestOptions`
+
+
+
+
+
+
+
+
+
+
+client.entities.bankAccounts.create({ ...params }) -> Monite.EntityBankAccountResponse
+
+-
+
+#### 📝 Description
+
+
+-
+
+
+-
+
+Add a new bank account for the specified entity.
+
+The minimum required fields are `currency` and `country`. Other required fields depend on the currency:
+
+- EUR accounts require `iban`.
+- GBP accounts require `account_holder_name`, `account_number`, and `sort_code`.
+- USD accounts require `account_holder_name`, `account_number`, and `routing_number`.
+- Accounts in other currencies require one of:
+ - `iban`
+ - `account_number` and `sort_code`
+ - `account_number` and `routing_number`
+
+
+
+
+
+#### 🔌 Usage
+
+
+-
+
+
+-
+
+```typescript
+await client.entities.bankAccounts.create({
+ country: "AF",
+ currency: "AED",
+});
+```
+
+
+
+
+
+
+#### ⚙️ Parameters
+
+
+-
+
+
+-
+
+**request:** `Monite.entities.CreateEntityBankAccountRequest`
+
+
+
+
+
+-
+
+**requestOptions:** `BankAccounts.RequestOptions`
+
+
+
+
+
+
+
+
+
+
+client.entities.bankAccounts.completeVerification({ ...params }) -> Monite.CompleteVerificationResponse
+
+-
+
+#### 🔌 Usage
+
+
+-
+
+
+-
+
+```typescript
+await client.entities.bankAccounts.completeVerification({
+ airwallex_plaid: {
+ account: {
+ id: "id",
+ mask: "mask",
+ name: "name",
+ },
+ institution: {
+ id: "id",
+ name: "name",
+ },
+ mandate: {
+ email: "email",
+ signatory: "signatory",
+ type: "us_ach_debit",
+ version: "1.0",
+ },
+ public_token: "public_token",
+ },
+ type: "airwallex_plaid",
+});
+```
+
+
+
+
+
+
+#### ⚙️ Parameters
+
+
+-
+
+
+-
+
+**request:** `Monite.entities.CompleteVerificationRequest`
+
+
+
+
+
+-
+
+**requestOptions:** `BankAccounts.RequestOptions`
+
+
+
+
+
+
+
+
+
+
+client.entities.bankAccounts.startVerification({ ...params }) -> Monite.VerificationResponse
+
+-
+
+#### 📝 Description
+
+
+-
+
+
+-
+
+Start entity bank account verification. The flow depends on verification type.
+For airwallex_plaid it generates Plaid Link token to init the Plaid SDK.
+
+
+
+
+
+
+#### 🔌 Usage
+
+
+-
+
+
+-
+
+```typescript
+await client.entities.bankAccounts.startVerification({
+ airwallex_plaid: {
+ client_name: "client_name",
+ redirect_url: "redirect_url",
+ },
+ type: "airwallex_plaid",
+});
+```
+
+
+
+
+
+
+#### ⚙️ Parameters
+
+
+-
+
+
+-
+
+**request:** `Monite.VerificationRequest`
+
+
+
+
+
+-
+
+**requestOptions:** `BankAccounts.RequestOptions`
+
+
+
+
+
+
+
+
+
+
+client.entities.bankAccounts.getById(bankAccountId) -> Monite.EntityBankAccountResponse
+
+-
+
+#### 📝 Description
+
+
+-
+
+
+-
+
+Retrieve a bank account by its ID.
+
+
+
+
+
+
+#### 🔌 Usage
+
+
+-
+
+
+-
+
+```typescript
+await client.entities.bankAccounts.getById("bank_account_id");
+```
+
+
+
+
+
+
+#### ⚙️ Parameters
+
+
+-
+
+
+-
+
+**bankAccountId:** `string`
+
+
+
+
+
+-
+
+**requestOptions:** `BankAccounts.RequestOptions`
+
+
+
+
+
+
+
+
+
+
+client.entities.bankAccounts.deleteById(bankAccountId) -> void
+
+-
+
+#### 📝 Description
+
+
+-
+
+
+-
+
+Delete the bank account specified by its ID.
+
+
+
+
+
+
+#### 🔌 Usage
+
+
+-
+
+
+-
+
+```typescript
+await client.entities.bankAccounts.deleteById("bank_account_id");
+```
+
+
+
+
+
+
+#### ⚙️ Parameters
+
+
+-
+
+
+-
+
+**bankAccountId:** `string`
+
+
+
+
+
+-
+
+**requestOptions:** `BankAccounts.RequestOptions`
+
+
+
+
+
+
+
+
+
+
+client.entities.bankAccounts.updateById(bankAccountId, { ...params }) -> Monite.EntityBankAccountResponse
+
+-
+
+#### 📝 Description
+
+
+-
+
+
+-
+
+Change the specified fields with the provided values.
+
+
+
+
+
+
+#### 🔌 Usage
+
+
+-
+
+
+-
+
+```typescript
+await client.entities.bankAccounts.updateById("bank_account_id");
+```
+
+
+
+
+
+
+#### ⚙️ Parameters
+
+
+-
+
+
+-
+
+**bankAccountId:** `string`
+
+
+
+
+
+-
+
+**request:** `Monite.entities.UpdateEntityBankAccountRequest`
+
+
+
+
+
+-
+
+**requestOptions:** `BankAccounts.RequestOptions`
+
+
+
+
+
+
+
+
+
+
+client.entities.bankAccounts.completeVerificationById(bankAccountId, { ...params }) -> Monite.CompleteRefreshVerificationResponse
+
+-
+
+#### 🔌 Usage
+
+
+-
+
+
+-
+
+```typescript
+await client.entities.bankAccounts.completeVerificationById("bank_account_id", {
+ type: "airwallex_plaid",
+});
+```
+
+
+
+
+
+
+#### ⚙️ Parameters
+
+
+-
+
+
+-
+
+**bankAccountId:** `string`
+
+
+
+
+
+-
+
+**request:** `Monite.entities.CompleteRefreshVerificationRequest`
+
+
+
+
+
+-
+
+**requestOptions:** `BankAccounts.RequestOptions`
+
+
+
+
+
+
+
+
+
+
+client.entities.bankAccounts.makeDefaultById(bankAccountId) -> Monite.EntityBankAccountResponse
+
+-
+
+#### 📝 Description
+
+
+-
+
+
+-
+
+Set a bank account as the default for this entity per currency.
+
+
+
+
+
+
+#### 🔌 Usage
+
+
+-
+
+
+-
+
+```typescript
+await client.entities.bankAccounts.makeDefaultById("bank_account_id");
+```
+
+
+
+
+
+
+#### ⚙️ Parameters
+
+
+-
+
+
+-
+
+**bankAccountId:** `string`
+
+
+
+
+
+-
+
+**requestOptions:** `BankAccounts.RequestOptions`
+
+
+
+
+
+
+
+
+
+
+client.entities.bankAccounts.refreshVerificationById(bankAccountId, { ...params }) -> Monite.VerificationResponse
+
+-
+
+#### 🔌 Usage
+
+
+-
+
+
+-
+
+```typescript
+await client.entities.bankAccounts.refreshVerificationById("bank_account_id", {
+ airwallex_plaid: {
+ client_name: "client_name",
+ redirect_url: "redirect_url",
+ },
+ type: "airwallex_plaid",
+});
+```
+
+
+
+
+
+
+#### ⚙️ Parameters
+
+
+-
+
+
+-
+
+**bankAccountId:** `string`
+
+
+
+
+
+-
+
+**request:** `Monite.VerificationRequest`
+
+
+
+
+
+-
+
+**requestOptions:** `BankAccounts.RequestOptions`
+
+
+
+
+
+
+
+
+
+
+client.entities.bankAccounts.getVerificationsById(bankAccountId) -> Monite.BankAccountVerifications
+
+-
+
+#### 🔌 Usage
+
+
+-
+
+
+-
+
+```typescript
+await client.entities.bankAccounts.getVerificationsById("bank_account_id");
+```
+
+
+
+
+
+
+#### ⚙️ Parameters
+
+
+-
+
+
+-
+
+**bankAccountId:** `string`
+
+
+
+
+
+-
+
+**requestOptions:** `BankAccounts.RequestOptions`
+
+
+
+
+
+
+
+
+
+
+## Entities OnboardingData
+
+client.entities.onboardingData.get(entityId) -> Monite.EntityOnboardingDataResponse
+
+-
+
+#### 🔌 Usage
+
+
+-
+
+
+-
+
+```typescript
+await client.entities.onboardingData.get("entity_id");
+```
+
+
+
+
+
+
+#### ⚙️ Parameters
+
+
+-
+
+
+-
+
+**entityId:** `string`
+
+
+
+
+
+-
+
+**requestOptions:** `OnboardingData.RequestOptions`
+
+
+
+
+
+
+
+
+
+
+client.entities.onboardingData.update(entityId, { ...params }) -> Monite.EntityOnboardingDataResponse
+
+-
+
+#### 🔌 Usage
+
+
+-
+
+
+-
+
+```typescript
+await client.entities.onboardingData.update("entity_id");
+```
+
+
+
+
+
+
+#### ⚙️ Parameters
+
+
+-
+
+
+-
+
+**entityId:** `string`
+
+
+
+
+
+-
+
+**request:** `Monite.entities.EntityOnboardingDataRequest`
+
+
+
+
+
+-
+
+**requestOptions:** `OnboardingData.RequestOptions`
+
+
+
+
+
+
+
+
+
+
+## Entities PaymentMethods
+
+client.entities.paymentMethods.get(entityId) -> Monite.OnboardingPaymentMethodsResponse
+
+-
+
+#### 📝 Description
+
+
+-
+
+
+-
+
+Get all enabled payment methods.
+
+
+
+
+
+
+#### 🔌 Usage
+
+
+-
+
+
+-
+
+```typescript
+await client.entities.paymentMethods.get("entity_id");
+```
+
+
+
+
+
+
+#### ⚙️ Parameters
+
+
+-
+
+
+-
+
+**entityId:** `string`
+
+
+
+
+
+-
+
+**requestOptions:** `PaymentMethods.RequestOptions`
+
+
+
+
+
+
+
+
+
+
+client.entities.paymentMethods.set(entityId, { ...params }) -> Monite.OnboardingPaymentMethodsResponse
+
+-
+
+#### 📝 Description
+
+
+-
+
+
+-
+
+Set which payment methods should be enabled.
+
+
+
+
+
+
+#### 🔌 Usage
+
+
+-
+
+
+-
+
+```typescript
+await client.entities.paymentMethods.set("entity_id");
+```
+
+
+
+
+
+
+#### ⚙️ Parameters
+
+
+-
+
+
+-
+
+**entityId:** `string`
+
+
+
+
+
+-
+
+**request:** `Monite.entities.EnabledPaymentMethods`
+
+
+
+
+
+-
+
+**requestOptions:** `PaymentMethods.RequestOptions`
+
+
+
+
+
+
+
+
+
+
+## Entities VatIds
+
+client.entities.vatIds.get(entityId) -> Monite.EntityVatIdResourceList
+
+-
+
+#### 🔌 Usage
+
+
+-
+
+
+-
+
+```typescript
+await client.entities.vatIds.get("entity_id");
+```
+
+
+
+
+
+
+#### ⚙️ Parameters
+
+
+-
+
+
+-
+
+**entityId:** `string`
+
+
+
+
+
+-
+
+**requestOptions:** `VatIds.RequestOptions`
+
+
+
+
+
+
+
+
+
+
+client.entities.vatIds.create(entityId, { ...params }) -> Monite.EntityVatIdResponse
+
+-
+
+#### 🔌 Usage
+
+
+-
+
+
+-
+
+```typescript
+await client.entities.vatIds.create("entity_id", {
+ country: "AF",
+ value: "123456789",
+});
+```
+
+
+
+
+
+
+#### ⚙️ Parameters
+
+
+-
+
+
+-
+
+**entityId:** `string`
+
+
+
+
+
+-
+
+**request:** `Monite.entities.EntityVatId`
+
+
+
+
+
+-
+
+**requestOptions:** `VatIds.RequestOptions`
+
+
+
+
+
+
+
+
+
+
+client.entities.vatIds.getById(id, entityId) -> Monite.EntityVatIdResponse
+
+-
+
+#### 🔌 Usage
+
+
+-
+
+
+-
+
+```typescript
+await client.entities.vatIds.getById("id", "entity_id");
+```
+
+
+
+
+
+
+#### ⚙️ Parameters
+
+
+-
+
+
+-
+
+**id:** `string`
+
+
+
+
+
+-
+
+**entityId:** `string`
+
+
+
+
+
+-
+
+**requestOptions:** `VatIds.RequestOptions`
+
+
+
+
+
+
+
+
+
+
+client.entities.vatIds.deleteById(id, entityId) -> void
+
+-
+
+#### 🔌 Usage
+
+
+-
+
+
+-
+
+```typescript
+await client.entities.vatIds.deleteById("id", "entity_id");
+```
+
+
+
+
+
+
+#### ⚙️ Parameters
+
+
+-
+
+
+-
+
+**id:** `string`
+
+
+
+
+
+-
+
+**entityId:** `string`
+
+
+
+
+
+-
+
+**requestOptions:** `VatIds.RequestOptions`
+
+
+
+
+
+
+
+
+
+
+client.entities.vatIds.updateById(id, entityId, { ...params }) -> Monite.EntityVatIdResponse
+
+-
+
+#### 🔌 Usage
+
+
+-
+
+
+-
+
+```typescript
+await client.entities.vatIds.updateById("id", "entity_id");
+```
+
+
+
+
+
+
+#### ⚙️ Parameters
+
+
+-
+
+
+-
+
+**id:** `string`
+
+
+
+
+
+-
+
+**entityId:** `string`
+
+
+
+
+
+-
+
+**request:** `Monite.entities.EntityUpdateVatId`
+
+
+
+
+
+-
+
+**requestOptions:** `VatIds.RequestOptions`
+
+
+
+
+
+
+
+
+
+
+## Entities Persons
+
+client.entities.persons.get() -> Monite.PersonsResponse
+
+-
+
+#### 🔌 Usage
+
+
+-
+
+
+-
+
+```typescript
+await client.entities.persons.get();
+```
+
+
+
+
+
+
+#### ⚙️ Parameters
+
+
+-
+
+
+-
+
+**requestOptions:** `Persons.RequestOptions`
+
+
+
+
+
+
+
+
+
+
+client.entities.persons.create({ ...params }) -> Monite.PersonResponse
+
+-
+
+#### 🔌 Usage
+
+
+-
+
+
+-
+
+```typescript
+await client.entities.persons.create({
+ first_name: "first_name",
+ last_name: "last_name",
+ email: "email",
+ relationship: {},
+});
+```
+
+
+
+
+
+
+#### ⚙️ Parameters
+
+
+-
+
+
+-
+
+**request:** `Monite.entities.PersonRequest`
+
+
+
+
+
+-
+
+**requestOptions:** `Persons.RequestOptions`
+
+
+
+
+
+
+
+
+
+
+client.entities.persons.getById(personId) -> Monite.PersonResponse
+
+-
+
+#### 🔌 Usage
+
+
+-
+
+
+-
+
+```typescript
+await client.entities.persons.getById("person_id");
+```
+
+
+
+
+
+
+#### ⚙️ Parameters
+
+
+-
+
+
+-
+
+**personId:** `string`
+
+
+
+
+
+-
+
+**requestOptions:** `Persons.RequestOptions`
+
+
+
+
+
+
+
+
+
+
+client.entities.persons.deleteById(personId) -> void
+
+-
+
+#### 🔌 Usage
+
+
+-
+
+
+-
+
+```typescript
+await client.entities.persons.deleteById("person_id");
+```
+
+
+
+
+
+
+#### ⚙️ Parameters
+
+
+-
+
+
+-
+
+**personId:** `string`
+
+
+
+
+
+-
+
+**requestOptions:** `Persons.RequestOptions`
+
+
+
+
+
+
+
+
+
+
+client.entities.persons.updateById(personId, { ...params }) -> Monite.PersonResponse
+
+-
+
+#### 🔌 Usage
+
+
+-
+
+
+-
+
+```typescript
+await client.entities.persons.updateById("person_id");
+```
+
+
+
+
+
+
+#### ⚙️ Parameters
+
+
+-
+
+
+-
+
+**personId:** `string`
+
+
+
+
+
+-
+
+**request:** `Monite.entities.OptionalPersonRequest`
+
+
+
+
+
+-
+
+**requestOptions:** `Persons.RequestOptions`
+
+
+
+
+
+
+
+
+
+
+client.entities.persons.uploadOnboardingDocuments(personId, { ...params }) -> void
+
+-
+
+#### 📝 Description
+
+
+-
+
+
+-
+
+Provide files for person onboarding verification
+
+
+
+
+
+
+#### 🔌 Usage
+
+
+-
+
+
+-
+
+```typescript
+await client.entities.persons.uploadOnboardingDocuments("person_id");
+```
+
+
+
+
+
+
+#### ⚙️ Parameters
+
+
+-
+
+
+-
+
+**personId:** `string`
+
+
+
+
+
+-
+
+**request:** `Monite.entities.PersonOnboardingDocumentsPayload`
+
+
+
+
+
+-
+
+**requestOptions:** `Persons.RequestOptions`
+
+
+
+
+
+
+
+
+
+
+## Payables LineItems
+
+client.payables.lineItems.get(payableId, { ...params }) -> Monite.LineItemPaginationResponse
+
+-
+
+#### 📝 Description
+
+
+-
+
+
+-
+
+Get a list of all line items related to a specific payable.
+Related guide: [List all payable line items](https://docs.monite.com/docs/manage-line-items#list-all-line-items-of-a-payable)
+
+See also:
+
+[Manage line items](https://docs.monite.com/docs/manage-line-items)
+
+[Collect payables](https://docs.monite.com/docs/collect-payables)
+
+
+
+
+
+
+#### 🔌 Usage
+
+
+-
+
+
+-
+
+```typescript
+await client.payables.lineItems.get("payable_id");
+```
+
+
+
+
+
+
+#### ⚙️ Parameters
+
+
+-
+
+
+-
+
+**payableId:** `string`
+
+
+
+
+
+-
+
+**request:** `Monite.payables.LineItemsGetRequest`
+
+
+
+
+
+-
+
+**requestOptions:** `LineItems.RequestOptions`
+
+
+
+
+
+
+
+
+
+
+client.payables.lineItems.create(payableId, { ...params }) -> Monite.LineItemResponse
+
+-
+
+#### 📝 Description
+
+
+-
+
+
+-
+
+Add a new line item to a specific payable.
+
+The `subtotal` and `total` fields of line items are automatically calculated based on the `unit_price`,
+`quantity`, and `tax` fields, therefore, are read-only and appear only in the response schema. The field
+`ledger_account_id` is required **only** for account integration, otherwise, it is optional.
+
+Related guide: [Add line items to a payable](https://docs.monite.com/docs/manage-line-items#add-line-items-to-a-payable)
+
+See also:
+
+[Manage line items](https://docs.monite.com/docs/manage-line-items)
+
+[Collect payables](https://docs.monite.com/docs/collect-payables)
+
+
+
+
+
+
+#### 🔌 Usage
+
+
+-
+
+
+-
+
+```typescript
+await client.payables.lineItems.create("payable_id", {});
+```
+
+
+
+
+
+
+#### ⚙️ Parameters
+
+
+-
+
+
+-
+
+**payableId:** `string`
+
+
+
+
+
+-
+
+**request:** `Monite.LineItemRequest`
+
+
+
+
+
+-
+
+**requestOptions:** `LineItems.RequestOptions`
+
+
+
+
+
+
+
+
+
+
+client.payables.lineItems.replace(payableId, { ...params }) -> Monite.LineItemsReplaceResponse
+
+-
+
+#### 📝 Description
+
+
+-
+
+
+-
+
+Replaces the information of all line items of a specific payable.
+
+Related guide: [Replace all line items](https://docs.monite.com/docs/manage-line-items#replace-all-line-items)
+
+See also:
+
+[Manage line items](https://docs.monite.com/docs/manage-line-items)
+
+[Collect payables](https://docs.monite.com/docs/collect-payables)
+
+
+
+
+
+
+#### 🔌 Usage
+
+
+-
+
+
+-
+
+```typescript
+await client.payables.lineItems.replace("payable_id", {
+ data: [{}],
+});
+```
+
+
+
+
+
+
+#### ⚙️ Parameters
+
+
+-
+
+
+-
+
+**payableId:** `string`
+
+
+
+
+
+-
+
+**request:** `Monite.payables.LineItemsReplaceRequest`
+
+
+
+
+
+-
+
+**requestOptions:** `LineItems.RequestOptions`
+
+
+
+
+
+
+
+
+
+
+client.payables.lineItems.getById(lineItemId, payableId) -> Monite.LineItemResponse
+
+-
+
+#### 📝 Description
+
+
+-
+
+
+-
+
+Get information about a specific line item with a given ID.
+
+Related guide: [Retrieve a line item](https://docs.monite.com/docs/manage-line-items#retrieve-a-line-item)
+
+See also:
+
+[Manage line items](https://docs.monite.com/docs/manage-line-items)
+
+[Collect payables](https://docs.monite.com/docs/collect-payables)
+
+
+
+
+
+
+#### 🔌 Usage
+
+
+-
+
+
+-
+
+```typescript
+await client.payables.lineItems.getById("line_item_id", "payable_id");
+```
+
+
+
+
+
+
+#### ⚙️ Parameters
+
+
+-
+
+
+-
+
+**lineItemId:** `string`
+
+
+
+
+
+-
+
+**payableId:** `string`
+
+
+
+
+
+-
+
+**requestOptions:** `LineItems.RequestOptions`
+
+
+
+
+
+
+
+
+
+
+client.payables.lineItems.deleteById(lineItemId, payableId) -> void
+
+-
+
+#### 📝 Description
+
+
+-
+
+
+-
+
+Delete the line item with the given ID.
+
+Related guide: [Remove a line item](https://docs.monite.com/docs/manage-line-items#remove-a-line-item)
+
+See also:
+
+[Manage line items](https://docs.monite.com/docs/manage-line-items)
+
+[Collect payables](https://docs.monite.com/docs/collect-payables)
+
+
+
+
+
+
+#### 🔌 Usage
+
+
+-
+
+
+-
+
+```typescript
+await client.payables.lineItems.deleteById("line_item_id", "payable_id");
+```
+
+
+
+
+
+
+#### ⚙️ Parameters
+
+
+-
+
+
+-
+
+**lineItemId:** `string`
+
+
+
+
+
+-
+
+**payableId:** `string`
+
+
+
+
+
+-
+
+**requestOptions:** `LineItems.RequestOptions`
+
+
+
+
+
+
+
+
+
+
+client.payables.lineItems.updateById(lineItemId, payableId, { ...params }) -> Monite.LineItemResponse
+
+-
+
+#### 📝 Description
+
+
+-
+
+
+-
+
+Edits the information of a specific line item.
+
+Related guide: [Update a line item](https://docs.monite.com/docs/manage-line-items#update-a-line-item)
+
+See also:
+
+[Manage line items](https://docs.monite.com/docs/manage-line-items)
+
+[Collect payables](https://docs.monite.com/docs/collect-payables)
+
+
+
+
+
+
+#### 🔌 Usage
+
+
+-
+
+
+-
+
+```typescript
+await client.payables.lineItems.updateById("line_item_id", "payable_id", {});
+```
+
+
+
+
+
+
+#### ⚙️ Parameters
+
+
+-
+
+
+-
+
+**lineItemId:** `string`
+
+
+
+
+
+-
+
+**payableId:** `string`
+
+
+
+
+
+-
+
+**request:** `Monite.LineItemRequest`
+
+
+
+
+
+-
+
+**requestOptions:** `LineItems.RequestOptions`
+
+
+
+
+
+
+
+
+
diff --git a/src/Client.ts b/src/Client.ts
new file mode 100644
index 0000000..8517cfd
--- /dev/null
+++ b/src/Client.ts
@@ -0,0 +1,301 @@
+/**
+ * This file was auto-generated by Fern from our API Definition.
+ */
+
+import * as environments from "./environments";
+import * as core from "./core";
+import { ApprovalPolicies } from "./api/resources/approvalPolicies/client/Client";
+import { ApprovalRequests } from "./api/resources/approvalRequests/client/Client";
+import { AuditLogs } from "./api/resources/auditLogs/client/Client";
+import { AccessTokens } from "./api/resources/accessTokens/client/Client";
+import { BatchPayments } from "./api/resources/batchPayments/client/Client";
+import { Comments } from "./api/resources/comments/client/Client";
+import { Counterparts } from "./api/resources/counterparts/client/Client";
+import { DataExports } from "./api/resources/dataExports/client/Client";
+import { PdfTemplates } from "./api/resources/pdfTemplates/client/Client";
+import { Entities } from "./api/resources/entities/client/Client";
+import { EntityUsers } from "./api/resources/entityUsers/client/Client";
+import { Events } from "./api/resources/events/client/Client";
+import { Files } from "./api/resources/files/client/Client";
+import { MailTemplates } from "./api/resources/mailTemplates/client/Client";
+import { MailboxDomains } from "./api/resources/mailboxDomains/client/Client";
+import { Mailboxes } from "./api/resources/mailboxes/client/Client";
+import { MeasureUnits } from "./api/resources/measureUnits/client/Client";
+import { OnboardingLinks } from "./api/resources/onboardingLinks/client/Client";
+import { OverdueReminders } from "./api/resources/overdueReminders/client/Client";
+import { PurchaseOrders } from "./api/resources/purchaseOrders/client/Client";
+import { Payables } from "./api/resources/payables/client/Client";
+import { PaymentIntents } from "./api/resources/paymentIntents/client/Client";
+import { PaymentLinks } from "./api/resources/paymentLinks/client/Client";
+import { PaymentRecords } from "./api/resources/paymentRecords/client/Client";
+import { PaymentReminders } from "./api/resources/paymentReminders/client/Client";
+import { PaymentTerms } from "./api/resources/paymentTerms/client/Client";
+import { Products } from "./api/resources/products/client/Client";
+import { Projects } from "./api/resources/projects/client/Client";
+import { Receivables } from "./api/resources/receivables/client/Client";
+import { Recurrences } from "./api/resources/recurrences/client/Client";
+import { Roles } from "./api/resources/roles/client/Client";
+import { PartnerSettings } from "./api/resources/partnerSettings/client/Client";
+import { Tags } from "./api/resources/tags/client/Client";
+import { TextTemplates } from "./api/resources/textTemplates/client/Client";
+import { VatRates } from "./api/resources/vatRates/client/Client";
+import { WebhookDeliveries } from "./api/resources/webhookDeliveries/client/Client";
+import { WebhookSubscriptions } from "./api/resources/webhookSubscriptions/client/Client";
+import { Accounting } from "./api/resources/accounting/client/Client";
+
+export declare namespace MoniteClient {
+ interface Options {
+ environment?: core.Supplier;
+ token?: core.Supplier;
+ /** Override the x-monite-version header */
+ moniteVersion: core.Supplier;
+ /** Override the x-monite-entity-id header */
+ moniteEntityId?: core.Supplier;
+ fetcher?: core.FetchFunction;
+ }
+
+ interface RequestOptions {
+ /** The maximum time to wait for a response in seconds. */
+ timeoutInSeconds?: number;
+ /** The number of times to retry the request. Defaults to 2. */
+ maxRetries?: number;
+ /** A hook to abort the request. */
+ abortSignal?: AbortSignal;
+ /** Override the x-monite-version header */
+ moniteVersion?: string;
+ /** Override the x-monite-entity-id header */
+ moniteEntityId?: string | undefined;
+ }
+}
+
+export class MoniteClient {
+ constructor(protected readonly _options: MoniteClient.Options) {}
+
+ protected _approvalPolicies: ApprovalPolicies | undefined;
+
+ public get approvalPolicies(): ApprovalPolicies {
+ return (this._approvalPolicies ??= new ApprovalPolicies(this._options));
+ }
+
+ protected _approvalRequests: ApprovalRequests | undefined;
+
+ public get approvalRequests(): ApprovalRequests {
+ return (this._approvalRequests ??= new ApprovalRequests(this._options));
+ }
+
+ protected _auditLogs: AuditLogs | undefined;
+
+ public get auditLogs(): AuditLogs {
+ return (this._auditLogs ??= new AuditLogs(this._options));
+ }
+
+ protected _accessTokens: AccessTokens | undefined;
+
+ public get accessTokens(): AccessTokens {
+ return (this._accessTokens ??= new AccessTokens(this._options));
+ }
+
+ protected _batchPayments: BatchPayments | undefined;
+
+ public get batchPayments(): BatchPayments {
+ return (this._batchPayments ??= new BatchPayments(this._options));
+ }
+
+ protected _comments: Comments | undefined;
+
+ public get comments(): Comments {
+ return (this._comments ??= new Comments(this._options));
+ }
+
+ protected _counterparts: Counterparts | undefined;
+
+ public get counterparts(): Counterparts {
+ return (this._counterparts ??= new Counterparts(this._options));
+ }
+
+ protected _dataExports: DataExports | undefined;
+
+ public get dataExports(): DataExports {
+ return (this._dataExports ??= new DataExports(this._options));
+ }
+
+ protected _pdfTemplates: PdfTemplates | undefined;
+
+ public get pdfTemplates(): PdfTemplates {
+ return (this._pdfTemplates ??= new PdfTemplates(this._options));
+ }
+
+ protected _entities: Entities | undefined;
+
+ public get entities(): Entities {
+ return (this._entities ??= new Entities(this._options));
+ }
+
+ protected _entityUsers: EntityUsers | undefined;
+
+ public get entityUsers(): EntityUsers {
+ return (this._entityUsers ??= new EntityUsers(this._options));
+ }
+
+ protected _events: Events | undefined;
+
+ public get events(): Events {
+ return (this._events ??= new Events(this._options));
+ }
+
+ protected _files: Files | undefined;
+
+ public get files(): Files {
+ return (this._files ??= new Files(this._options));
+ }
+
+ protected _mailTemplates: MailTemplates | undefined;
+
+ public get mailTemplates(): MailTemplates {
+ return (this._mailTemplates ??= new MailTemplates(this._options));
+ }
+
+ protected _mailboxDomains: MailboxDomains | undefined;
+
+ public get mailboxDomains(): MailboxDomains {
+ return (this._mailboxDomains ??= new MailboxDomains(this._options));
+ }
+
+ protected _mailboxes: Mailboxes | undefined;
+
+ public get mailboxes(): Mailboxes {
+ return (this._mailboxes ??= new Mailboxes(this._options));
+ }
+
+ protected _measureUnits: MeasureUnits | undefined;
+
+ public get measureUnits(): MeasureUnits {
+ return (this._measureUnits ??= new MeasureUnits(this._options));
+ }
+
+ protected _onboardingLinks: OnboardingLinks | undefined;
+
+ public get onboardingLinks(): OnboardingLinks {
+ return (this._onboardingLinks ??= new OnboardingLinks(this._options));
+ }
+
+ protected _overdueReminders: OverdueReminders | undefined;
+
+ public get overdueReminders(): OverdueReminders {
+ return (this._overdueReminders ??= new OverdueReminders(this._options));
+ }
+
+ protected _purchaseOrders: PurchaseOrders | undefined;
+
+ public get purchaseOrders(): PurchaseOrders {
+ return (this._purchaseOrders ??= new PurchaseOrders(this._options));
+ }
+
+ protected _payables: Payables | undefined;
+
+ public get payables(): Payables {
+ return (this._payables ??= new Payables(this._options));
+ }
+
+ protected _paymentIntents: PaymentIntents | undefined;
+
+ public get paymentIntents(): PaymentIntents {
+ return (this._paymentIntents ??= new PaymentIntents(this._options));
+ }
+
+ protected _paymentLinks: PaymentLinks | undefined;
+
+ public get paymentLinks(): PaymentLinks {
+ return (this._paymentLinks ??= new PaymentLinks(this._options));
+ }
+
+ protected _paymentRecords: PaymentRecords | undefined;
+
+ public get paymentRecords(): PaymentRecords {
+ return (this._paymentRecords ??= new PaymentRecords(this._options));
+ }
+
+ protected _paymentReminders: PaymentReminders | undefined;
+
+ public get paymentReminders(): PaymentReminders {
+ return (this._paymentReminders ??= new PaymentReminders(this._options));
+ }
+
+ protected _paymentTerms: PaymentTerms | undefined;
+
+ public get paymentTerms(): PaymentTerms {
+ return (this._paymentTerms ??= new PaymentTerms(this._options));
+ }
+
+ protected _products: Products | undefined;
+
+ public get products(): Products {
+ return (this._products ??= new Products(this._options));
+ }
+
+ protected _projects: Projects | undefined;
+
+ public get projects(): Projects {
+ return (this._projects ??= new Projects(this._options));
+ }
+
+ protected _receivables: Receivables | undefined;
+
+ public get receivables(): Receivables {
+ return (this._receivables ??= new Receivables(this._options));
+ }
+
+ protected _recurrences: Recurrences | undefined;
+
+ public get recurrences(): Recurrences {
+ return (this._recurrences ??= new Recurrences(this._options));
+ }
+
+ protected _roles: Roles | undefined;
+
+ public get roles(): Roles {
+ return (this._roles ??= new Roles(this._options));
+ }
+
+ protected _partnerSettings: PartnerSettings | undefined;
+
+ public get partnerSettings(): PartnerSettings {
+ return (this._partnerSettings ??= new PartnerSettings(this._options));
+ }
+
+ protected _tags: Tags | undefined;
+
+ public get tags(): Tags {
+ return (this._tags ??= new Tags(this._options));
+ }
+
+ protected _textTemplates: TextTemplates | undefined;
+
+ public get textTemplates(): TextTemplates {
+ return (this._textTemplates ??= new TextTemplates(this._options));
+ }
+
+ protected _vatRates: VatRates | undefined;
+
+ public get vatRates(): VatRates {
+ return (this._vatRates ??= new VatRates(this._options));
+ }
+
+ protected _webhookDeliveries: WebhookDeliveries | undefined;
+
+ public get webhookDeliveries(): WebhookDeliveries {
+ return (this._webhookDeliveries ??= new WebhookDeliveries(this._options));
+ }
+
+ protected _webhookSubscriptions: WebhookSubscriptions | undefined;
+
+ public get webhookSubscriptions(): WebhookSubscriptions {
+ return (this._webhookSubscriptions ??= new WebhookSubscriptions(this._options));
+ }
+
+ protected _accounting: Accounting | undefined;
+
+ public get accounting(): Accounting {
+ return (this._accounting ??= new Accounting(this._options));
+ }
+}
diff --git a/src/api/errors/BadRequestError.ts b/src/api/errors/BadRequestError.ts
new file mode 100644
index 0000000..410259c
--- /dev/null
+++ b/src/api/errors/BadRequestError.ts
@@ -0,0 +1,17 @@
+/**
+ * This file was auto-generated by Fern from our API Definition.
+ */
+
+import * as errors from "../../errors/index";
+import * as Monite from "../index";
+
+export class BadRequestError extends errors.MoniteError {
+ constructor(body: Monite.ErrorSchemaResponse) {
+ super({
+ message: "BadRequestError",
+ statusCode: 400,
+ body: body,
+ });
+ Object.setPrototypeOf(this, BadRequestError.prototype);
+ }
+}
diff --git a/src/api/errors/ConflictError.ts b/src/api/errors/ConflictError.ts
new file mode 100644
index 0000000..2710275
--- /dev/null
+++ b/src/api/errors/ConflictError.ts
@@ -0,0 +1,17 @@
+/**
+ * This file was auto-generated by Fern from our API Definition.
+ */
+
+import * as errors from "../../errors/index";
+import * as Monite from "../index";
+
+export class ConflictError extends errors.MoniteError {
+ constructor(body: Monite.ErrorSchemaResponse) {
+ super({
+ message: "ConflictError",
+ statusCode: 409,
+ body: body,
+ });
+ Object.setPrototypeOf(this, ConflictError.prototype);
+ }
+}
diff --git a/src/api/errors/ForbiddenError.ts b/src/api/errors/ForbiddenError.ts
new file mode 100644
index 0000000..b3ecaf5
--- /dev/null
+++ b/src/api/errors/ForbiddenError.ts
@@ -0,0 +1,17 @@
+/**
+ * This file was auto-generated by Fern from our API Definition.
+ */
+
+import * as errors from "../../errors/index";
+import * as Monite from "../index";
+
+export class ForbiddenError extends errors.MoniteError {
+ constructor(body: Monite.ErrorSchemaResponse) {
+ super({
+ message: "ForbiddenError",
+ statusCode: 403,
+ body: body,
+ });
+ Object.setPrototypeOf(this, ForbiddenError.prototype);
+ }
+}
diff --git a/src/api/errors/InternalServerError.ts b/src/api/errors/InternalServerError.ts
new file mode 100644
index 0000000..32a245c
--- /dev/null
+++ b/src/api/errors/InternalServerError.ts
@@ -0,0 +1,17 @@
+/**
+ * This file was auto-generated by Fern from our API Definition.
+ */
+
+import * as errors from "../../errors/index";
+import * as Monite from "../index";
+
+export class InternalServerError extends errors.MoniteError {
+ constructor(body: Monite.ErrorSchemaResponse) {
+ super({
+ message: "InternalServerError",
+ statusCode: 500,
+ body: body,
+ });
+ Object.setPrototypeOf(this, InternalServerError.prototype);
+ }
+}
diff --git a/src/api/errors/NotAcceptableError.ts b/src/api/errors/NotAcceptableError.ts
new file mode 100644
index 0000000..fdeefd9
--- /dev/null
+++ b/src/api/errors/NotAcceptableError.ts
@@ -0,0 +1,17 @@
+/**
+ * This file was auto-generated by Fern from our API Definition.
+ */
+
+import * as errors from "../../errors/index";
+import * as Monite from "../index";
+
+export class NotAcceptableError extends errors.MoniteError {
+ constructor(body: Monite.ErrorSchemaResponse) {
+ super({
+ message: "NotAcceptableError",
+ statusCode: 406,
+ body: body,
+ });
+ Object.setPrototypeOf(this, NotAcceptableError.prototype);
+ }
+}
diff --git a/src/api/errors/NotFoundError.ts b/src/api/errors/NotFoundError.ts
new file mode 100644
index 0000000..a7e7502
--- /dev/null
+++ b/src/api/errors/NotFoundError.ts
@@ -0,0 +1,17 @@
+/**
+ * This file was auto-generated by Fern from our API Definition.
+ */
+
+import * as errors from "../../errors/index";
+import * as Monite from "../index";
+
+export class NotFoundError extends errors.MoniteError {
+ constructor(body: Monite.ErrorSchemaResponse) {
+ super({
+ message: "NotFoundError",
+ statusCode: 404,
+ body: body,
+ });
+ Object.setPrototypeOf(this, NotFoundError.prototype);
+ }
+}
diff --git a/src/api/errors/RangeNotSatisfiableError.ts b/src/api/errors/RangeNotSatisfiableError.ts
new file mode 100644
index 0000000..8669a2d
--- /dev/null
+++ b/src/api/errors/RangeNotSatisfiableError.ts
@@ -0,0 +1,17 @@
+/**
+ * This file was auto-generated by Fern from our API Definition.
+ */
+
+import * as errors from "../../errors/index";
+import * as Monite from "../index";
+
+export class RangeNotSatisfiableError extends errors.MoniteError {
+ constructor(body: Monite.ErrorSchemaResponse) {
+ super({
+ message: "RangeNotSatisfiableError",
+ statusCode: 416,
+ body: body,
+ });
+ Object.setPrototypeOf(this, RangeNotSatisfiableError.prototype);
+ }
+}
diff --git a/src/api/errors/UnauthorizedError.ts b/src/api/errors/UnauthorizedError.ts
new file mode 100644
index 0000000..137cfea
--- /dev/null
+++ b/src/api/errors/UnauthorizedError.ts
@@ -0,0 +1,17 @@
+/**
+ * This file was auto-generated by Fern from our API Definition.
+ */
+
+import * as errors from "../../errors/index";
+import * as Monite from "../index";
+
+export class UnauthorizedError extends errors.MoniteError {
+ constructor(body: Monite.ErrorSchemaResponse) {
+ super({
+ message: "UnauthorizedError",
+ statusCode: 401,
+ body: body,
+ });
+ Object.setPrototypeOf(this, UnauthorizedError.prototype);
+ }
+}
diff --git a/src/api/errors/UnprocessableEntityError.ts b/src/api/errors/UnprocessableEntityError.ts
new file mode 100644
index 0000000..c2de2bb
--- /dev/null
+++ b/src/api/errors/UnprocessableEntityError.ts
@@ -0,0 +1,17 @@
+/**
+ * This file was auto-generated by Fern from our API Definition.
+ */
+
+import * as errors from "../../errors/index";
+import * as Monite from "../index";
+
+export class UnprocessableEntityError extends errors.MoniteError {
+ constructor(body: Monite.HttpValidationError) {
+ super({
+ message: "UnprocessableEntityError",
+ statusCode: 422,
+ body: body,
+ });
+ Object.setPrototypeOf(this, UnprocessableEntityError.prototype);
+ }
+}
diff --git a/src/api/errors/index.ts b/src/api/errors/index.ts
new file mode 100644
index 0000000..95220b9
--- /dev/null
+++ b/src/api/errors/index.ts
@@ -0,0 +1,9 @@
+export * from "./UnprocessableEntityError";
+export * from "./InternalServerError";
+export * from "./UnauthorizedError";
+export * from "./ConflictError";
+export * from "./BadRequestError";
+export * from "./NotFoundError";
+export * from "./ForbiddenError";
+export * from "./NotAcceptableError";
+export * from "./RangeNotSatisfiableError";
diff --git a/src/api/index.ts b/src/api/index.ts
new file mode 100644
index 0000000..3006072
--- /dev/null
+++ b/src/api/index.ts
@@ -0,0 +1,3 @@
+export * from "./resources";
+export * from "./types";
+export * from "./errors";
diff --git a/src/api/resources/accessTokens/client/Client.ts b/src/api/resources/accessTokens/client/Client.ts
new file mode 100644
index 0000000..615e08e
--- /dev/null
+++ b/src/api/resources/accessTokens/client/Client.ts
@@ -0,0 +1,208 @@
+/**
+ * This file was auto-generated by Fern from our API Definition.
+ */
+
+import * as environments from "../../../../environments";
+import * as core from "../../../../core";
+import * as Monite from "../../../index";
+import urlJoin from "url-join";
+import * as errors from "../../../../errors/index";
+
+export declare namespace AccessTokens {
+ interface Options {
+ environment?: core.Supplier;
+ token?: core.Supplier;
+ /** Override the x-monite-version header */
+ moniteVersion: core.Supplier;
+ /** Override the x-monite-entity-id header */
+ moniteEntityId?: core.Supplier;
+ fetcher?: core.FetchFunction;
+ }
+
+ interface RequestOptions {
+ /** The maximum time to wait for a response in seconds. */
+ timeoutInSeconds?: number;
+ /** The number of times to retry the request. Defaults to 2. */
+ maxRetries?: number;
+ /** A hook to abort the request. */
+ abortSignal?: AbortSignal;
+ /** Override the x-monite-version header */
+ moniteVersion?: string;
+ /** Override the x-monite-entity-id header */
+ moniteEntityId?: string | undefined;
+ }
+}
+
+export class AccessTokens {
+ constructor(protected readonly _options: AccessTokens.Options) {}
+
+ /**
+ * Revoke an existing token immediately.
+ *
+ * @param {Monite.RevokeTokenPayload} request
+ * @param {AccessTokens.RequestOptions} requestOptions - Request-specific configuration.
+ *
+ * @throws {@link Monite.UnprocessableEntityError}
+ * @throws {@link Monite.InternalServerError}
+ *
+ * @example
+ * await client.accessTokens.revoke({
+ * client_id: "client_id",
+ * client_secret: "client_secret",
+ * token: "token"
+ * })
+ */
+ public async revoke(
+ request: Monite.RevokeTokenPayload,
+ requestOptions?: AccessTokens.RequestOptions
+ ): Promise {
+ const _response = await (this._options.fetcher ?? core.fetcher)({
+ url: urlJoin(
+ (await core.Supplier.get(this._options.environment)) ?? environments.MoniteEnvironment.Sandbox,
+ "auth/revoke"
+ ),
+ method: "POST",
+ headers: {
+ Authorization: await this._getAuthorizationHeader(),
+ "x-monite-version": await core.Supplier.get(this._options.moniteVersion),
+ "x-monite-entity-id":
+ (await core.Supplier.get(this._options.moniteEntityId)) != null
+ ? await core.Supplier.get(this._options.moniteEntityId)
+ : undefined,
+ "X-Fern-Language": "JavaScript",
+ "X-Fern-SDK-Name": "",
+ "X-Fern-SDK-Version": "0.1.0",
+ "X-Fern-Runtime": core.RUNTIME.type,
+ "X-Fern-Runtime-Version": core.RUNTIME.version,
+ },
+ contentType: "application/json",
+ requestType: "json",
+ body: request,
+ timeoutMs: requestOptions?.timeoutInSeconds != null ? requestOptions.timeoutInSeconds * 1000 : 60000,
+ maxRetries: requestOptions?.maxRetries,
+ abortSignal: requestOptions?.abortSignal,
+ });
+ if (_response.ok) {
+ return _response.body as Monite.MessageResponse;
+ }
+
+ if (_response.error.reason === "status-code") {
+ switch (_response.error.statusCode) {
+ case 422:
+ throw new Monite.UnprocessableEntityError(_response.error.body as Monite.HttpValidationError);
+ case 500:
+ throw new Monite.InternalServerError(_response.error.body as Monite.ErrorSchemaResponse);
+ default:
+ throw new errors.MoniteError({
+ statusCode: _response.error.statusCode,
+ body: _response.error.body,
+ });
+ }
+ }
+
+ switch (_response.error.reason) {
+ case "non-json":
+ throw new errors.MoniteError({
+ statusCode: _response.error.statusCode,
+ body: _response.error.rawBody,
+ });
+ case "timeout":
+ throw new errors.MoniteTimeoutError();
+ case "unknown":
+ throw new errors.MoniteError({
+ message: _response.error.errorMessage,
+ });
+ }
+ }
+
+ /**
+ * Create a new access token based on client ID and client secret.
+ *
+ * @param {Monite.ObtainTokenPayload} request
+ * @param {AccessTokens.RequestOptions} requestOptions - Request-specific configuration.
+ *
+ * @throws {@link Monite.UnauthorizedError}
+ * @throws {@link Monite.UnprocessableEntityError}
+ * @throws {@link Monite.InternalServerError}
+ *
+ * @example
+ * await client.accessTokens.create({
+ * client_id: "client_id",
+ * client_secret: "client_secret",
+ * grant_type: "client_credentials"
+ * })
+ */
+ public async create(
+ request: Monite.ObtainTokenPayload,
+ requestOptions?: AccessTokens.RequestOptions
+ ): Promise {
+ const _response = await (this._options.fetcher ?? core.fetcher)({
+ url: urlJoin(
+ (await core.Supplier.get(this._options.environment)) ?? environments.MoniteEnvironment.Sandbox,
+ "auth/token"
+ ),
+ method: "POST",
+ headers: {
+ Authorization: await this._getAuthorizationHeader(),
+ "x-monite-version": await core.Supplier.get(this._options.moniteVersion),
+ "x-monite-entity-id":
+ (await core.Supplier.get(this._options.moniteEntityId)) != null
+ ? await core.Supplier.get(this._options.moniteEntityId)
+ : undefined,
+ "X-Fern-Language": "JavaScript",
+ "X-Fern-SDK-Name": "",
+ "X-Fern-SDK-Version": "0.1.0",
+ "X-Fern-Runtime": core.RUNTIME.type,
+ "X-Fern-Runtime-Version": core.RUNTIME.version,
+ },
+ contentType: "application/json",
+ requestType: "json",
+ body: request,
+ timeoutMs: requestOptions?.timeoutInSeconds != null ? requestOptions.timeoutInSeconds * 1000 : 60000,
+ maxRetries: requestOptions?.maxRetries,
+ abortSignal: requestOptions?.abortSignal,
+ });
+ if (_response.ok) {
+ return _response.body as Monite.AccessTokenResponse;
+ }
+
+ if (_response.error.reason === "status-code") {
+ switch (_response.error.statusCode) {
+ case 401:
+ throw new Monite.UnauthorizedError(_response.error.body as Monite.ErrorSchemaResponse);
+ case 422:
+ throw new Monite.UnprocessableEntityError(_response.error.body as Monite.HttpValidationError);
+ case 500:
+ throw new Monite.InternalServerError(_response.error.body as Monite.ErrorSchemaResponse);
+ default:
+ throw new errors.MoniteError({
+ statusCode: _response.error.statusCode,
+ body: _response.error.body,
+ });
+ }
+ }
+
+ switch (_response.error.reason) {
+ case "non-json":
+ throw new errors.MoniteError({
+ statusCode: _response.error.statusCode,
+ body: _response.error.rawBody,
+ });
+ case "timeout":
+ throw new errors.MoniteTimeoutError();
+ case "unknown":
+ throw new errors.MoniteError({
+ message: _response.error.errorMessage,
+ });
+ }
+ }
+
+ protected async _getAuthorizationHeader(): Promise {
+ const bearer = await core.Supplier.get(this._options.token);
+ if (bearer != null) {
+ return `Bearer ${bearer}`;
+ }
+
+ return undefined;
+ }
+}
diff --git a/src/api/resources/accessTokens/client/index.ts b/src/api/resources/accessTokens/client/index.ts
new file mode 100644
index 0000000..415726b
--- /dev/null
+++ b/src/api/resources/accessTokens/client/index.ts
@@ -0,0 +1 @@
+export * from "./requests";
diff --git a/src/api/resources/accessTokens/client/requests/ObtainTokenPayload.ts b/src/api/resources/accessTokens/client/requests/ObtainTokenPayload.ts
new file mode 100644
index 0000000..7469ff3
--- /dev/null
+++ b/src/api/resources/accessTokens/client/requests/ObtainTokenPayload.ts
@@ -0,0 +1,20 @@
+/**
+ * This file was auto-generated by Fern from our API Definition.
+ */
+
+import * as Monite from "../../../../index";
+
+/**
+ * @example
+ * {
+ * client_id: "client_id",
+ * client_secret: "client_secret",
+ * grant_type: "client_credentials"
+ * }
+ */
+export interface ObtainTokenPayload {
+ client_id: string;
+ client_secret: string;
+ entity_user_id?: string;
+ grant_type: Monite.GrantType;
+}
diff --git a/src/api/resources/accessTokens/client/requests/RevokeTokenPayload.ts b/src/api/resources/accessTokens/client/requests/RevokeTokenPayload.ts
new file mode 100644
index 0000000..4517fc1
--- /dev/null
+++ b/src/api/resources/accessTokens/client/requests/RevokeTokenPayload.ts
@@ -0,0 +1,17 @@
+/**
+ * This file was auto-generated by Fern from our API Definition.
+ */
+
+/**
+ * @example
+ * {
+ * client_id: "client_id",
+ * client_secret: "client_secret",
+ * token: "token"
+ * }
+ */
+export interface RevokeTokenPayload {
+ client_id: string;
+ client_secret: string;
+ token: string;
+}
diff --git a/src/api/resources/accessTokens/client/requests/index.ts b/src/api/resources/accessTokens/client/requests/index.ts
new file mode 100644
index 0000000..bcdd0bc
--- /dev/null
+++ b/src/api/resources/accessTokens/client/requests/index.ts
@@ -0,0 +1,2 @@
+export { type RevokeTokenPayload } from "./RevokeTokenPayload";
+export { type ObtainTokenPayload } from "./ObtainTokenPayload";
diff --git a/src/api/resources/accessTokens/index.ts b/src/api/resources/accessTokens/index.ts
new file mode 100644
index 0000000..5ec7692
--- /dev/null
+++ b/src/api/resources/accessTokens/index.ts
@@ -0,0 +1 @@
+export * from "./client";
diff --git a/src/api/resources/accounting/client/Client.ts b/src/api/resources/accounting/client/Client.ts
new file mode 100644
index 0000000..fbcfcf7
--- /dev/null
+++ b/src/api/resources/accounting/client/Client.ts
@@ -0,0 +1,77 @@
+/**
+ * This file was auto-generated by Fern from our API Definition.
+ */
+
+import * as environments from "../../../../environments";
+import * as core from "../../../../core";
+import { Payables } from "../resources/payables/client/Client";
+import { Receivables } from "../resources/receivables/client/Client";
+import { Connections } from "../resources/connections/client/Client";
+import { SyncedRecords } from "../resources/syncedRecords/client/Client";
+import { TaxRates } from "../resources/taxRates/client/Client";
+import { LedgerAccounts } from "../resources/ledgerAccounts/client/Client";
+
+export declare namespace Accounting {
+ interface Options {
+ environment?: core.Supplier;
+ token?: core.Supplier;
+ /** Override the x-monite-version header */
+ moniteVersion: core.Supplier;
+ /** Override the x-monite-entity-id header */
+ moniteEntityId?: core.Supplier;
+ fetcher?: core.FetchFunction;
+ }
+
+ interface RequestOptions {
+ /** The maximum time to wait for a response in seconds. */
+ timeoutInSeconds?: number;
+ /** The number of times to retry the request. Defaults to 2. */
+ maxRetries?: number;
+ /** A hook to abort the request. */
+ abortSignal?: AbortSignal;
+ /** Override the x-monite-version header */
+ moniteVersion?: string;
+ /** Override the x-monite-entity-id header */
+ moniteEntityId?: string | undefined;
+ }
+}
+
+export class Accounting {
+ constructor(protected readonly _options: Accounting.Options) {}
+
+ protected _payables: Payables | undefined;
+
+ public get payables(): Payables {
+ return (this._payables ??= new Payables(this._options));
+ }
+
+ protected _receivables: Receivables | undefined;
+
+ public get receivables(): Receivables {
+ return (this._receivables ??= new Receivables(this._options));
+ }
+
+ protected _connections: Connections | undefined;
+
+ public get connections(): Connections {
+ return (this._connections ??= new Connections(this._options));
+ }
+
+ protected _syncedRecords: SyncedRecords | undefined;
+
+ public get syncedRecords(): SyncedRecords {
+ return (this._syncedRecords ??= new SyncedRecords(this._options));
+ }
+
+ protected _taxRates: TaxRates | undefined;
+
+ public get taxRates(): TaxRates {
+ return (this._taxRates ??= new TaxRates(this._options));
+ }
+
+ protected _ledgerAccounts: LedgerAccounts | undefined;
+
+ public get ledgerAccounts(): LedgerAccounts {
+ return (this._ledgerAccounts ??= new LedgerAccounts(this._options));
+ }
+}
diff --git a/src/api/resources/accounting/client/index.ts b/src/api/resources/accounting/client/index.ts
new file mode 100644
index 0000000..cb0ff5c
--- /dev/null
+++ b/src/api/resources/accounting/client/index.ts
@@ -0,0 +1 @@
+export {};
diff --git a/src/api/resources/accounting/index.ts b/src/api/resources/accounting/index.ts
new file mode 100644
index 0000000..33a87f1
--- /dev/null
+++ b/src/api/resources/accounting/index.ts
@@ -0,0 +1,2 @@
+export * from "./client";
+export * from "./resources";
diff --git a/src/api/resources/accounting/resources/connections/client/Client.ts b/src/api/resources/accounting/resources/connections/client/Client.ts
new file mode 100644
index 0000000..541c432
--- /dev/null
+++ b/src/api/resources/accounting/resources/connections/client/Client.ts
@@ -0,0 +1,412 @@
+/**
+ * This file was auto-generated by Fern from our API Definition.
+ */
+
+import * as environments from "../../../../../../environments";
+import * as core from "../../../../../../core";
+import * as Monite from "../../../../../index";
+import urlJoin from "url-join";
+import * as errors from "../../../../../../errors/index";
+
+export declare namespace Connections {
+ interface Options {
+ environment?: core.Supplier;
+ token?: core.Supplier;
+ /** Override the x-monite-version header */
+ moniteVersion: core.Supplier;
+ /** Override the x-monite-entity-id header */
+ moniteEntityId?: core.Supplier;
+ fetcher?: core.FetchFunction;
+ }
+
+ interface RequestOptions {
+ /** The maximum time to wait for a response in seconds. */
+ timeoutInSeconds?: number;
+ /** The number of times to retry the request. Defaults to 2. */
+ maxRetries?: number;
+ /** A hook to abort the request. */
+ abortSignal?: AbortSignal;
+ /** Override the x-monite-version header */
+ moniteVersion?: string;
+ /** Override the x-monite-entity-id header */
+ moniteEntityId?: string | undefined;
+ }
+}
+
+export class Connections {
+ constructor(protected readonly _options: Connections.Options) {}
+
+ /**
+ * Get all connections
+ *
+ * @param {Connections.RequestOptions} requestOptions - Request-specific configuration.
+ *
+ * @throws {@link Monite.UnprocessableEntityError}
+ * @throws {@link Monite.InternalServerError}
+ *
+ * @example
+ * await client.accounting.connections.get()
+ */
+ public async get(requestOptions?: Connections.RequestOptions): Promise {
+ const _response = await (this._options.fetcher ?? core.fetcher)({
+ url: urlJoin(
+ (await core.Supplier.get(this._options.environment)) ?? environments.MoniteEnvironment.Sandbox,
+ "accounting_connections"
+ ),
+ method: "GET",
+ headers: {
+ Authorization: await this._getAuthorizationHeader(),
+ "x-monite-version": await core.Supplier.get(this._options.moniteVersion),
+ "x-monite-entity-id":
+ (await core.Supplier.get(this._options.moniteEntityId)) != null
+ ? await core.Supplier.get(this._options.moniteEntityId)
+ : undefined,
+ "X-Fern-Language": "JavaScript",
+ "X-Fern-SDK-Name": "",
+ "X-Fern-SDK-Version": "0.1.0",
+ "X-Fern-Runtime": core.RUNTIME.type,
+ "X-Fern-Runtime-Version": core.RUNTIME.version,
+ },
+ contentType: "application/json",
+ requestType: "json",
+ timeoutMs: requestOptions?.timeoutInSeconds != null ? requestOptions.timeoutInSeconds * 1000 : 60000,
+ maxRetries: requestOptions?.maxRetries,
+ abortSignal: requestOptions?.abortSignal,
+ });
+ if (_response.ok) {
+ return _response.body as Monite.AccountingConnectionList;
+ }
+
+ if (_response.error.reason === "status-code") {
+ switch (_response.error.statusCode) {
+ case 422:
+ throw new Monite.UnprocessableEntityError(_response.error.body as Monite.HttpValidationError);
+ case 500:
+ throw new Monite.InternalServerError(_response.error.body as Monite.ErrorSchemaResponse);
+ default:
+ throw new errors.MoniteError({
+ statusCode: _response.error.statusCode,
+ body: _response.error.body,
+ });
+ }
+ }
+
+ switch (_response.error.reason) {
+ case "non-json":
+ throw new errors.MoniteError({
+ statusCode: _response.error.statusCode,
+ body: _response.error.rawBody,
+ });
+ case "timeout":
+ throw new errors.MoniteTimeoutError();
+ case "unknown":
+ throw new errors.MoniteError({
+ message: _response.error.errorMessage,
+ });
+ }
+ }
+
+ /**
+ * Create new connection
+ *
+ * @param {Monite.accounting.AccountingConnectionRequest} request
+ * @param {Connections.RequestOptions} requestOptions - Request-specific configuration.
+ *
+ * @throws {@link Monite.UnprocessableEntityError}
+ * @throws {@link Monite.InternalServerError}
+ *
+ * @example
+ * await client.accounting.connections.create()
+ */
+ public async create(
+ request: Monite.accounting.AccountingConnectionRequest = {},
+ requestOptions?: Connections.RequestOptions
+ ): Promise {
+ const _response = await (this._options.fetcher ?? core.fetcher)({
+ url: urlJoin(
+ (await core.Supplier.get(this._options.environment)) ?? environments.MoniteEnvironment.Sandbox,
+ "accounting_connections"
+ ),
+ method: "POST",
+ headers: {
+ Authorization: await this._getAuthorizationHeader(),
+ "x-monite-version": await core.Supplier.get(this._options.moniteVersion),
+ "x-monite-entity-id":
+ (await core.Supplier.get(this._options.moniteEntityId)) != null
+ ? await core.Supplier.get(this._options.moniteEntityId)
+ : undefined,
+ "X-Fern-Language": "JavaScript",
+ "X-Fern-SDK-Name": "",
+ "X-Fern-SDK-Version": "0.1.0",
+ "X-Fern-Runtime": core.RUNTIME.type,
+ "X-Fern-Runtime-Version": core.RUNTIME.version,
+ },
+ contentType: "application/json",
+ requestType: "json",
+ body: request,
+ timeoutMs: requestOptions?.timeoutInSeconds != null ? requestOptions.timeoutInSeconds * 1000 : 60000,
+ maxRetries: requestOptions?.maxRetries,
+ abortSignal: requestOptions?.abortSignal,
+ });
+ if (_response.ok) {
+ return _response.body as Monite.AccountingConnectionResponse;
+ }
+
+ if (_response.error.reason === "status-code") {
+ switch (_response.error.statusCode) {
+ case 422:
+ throw new Monite.UnprocessableEntityError(_response.error.body as Monite.HttpValidationError);
+ case 500:
+ throw new Monite.InternalServerError(_response.error.body as Monite.ErrorSchemaResponse);
+ default:
+ throw new errors.MoniteError({
+ statusCode: _response.error.statusCode,
+ body: _response.error.body,
+ });
+ }
+ }
+
+ switch (_response.error.reason) {
+ case "non-json":
+ throw new errors.MoniteError({
+ statusCode: _response.error.statusCode,
+ body: _response.error.rawBody,
+ });
+ case "timeout":
+ throw new errors.MoniteTimeoutError();
+ case "unknown":
+ throw new errors.MoniteError({
+ message: _response.error.errorMessage,
+ });
+ }
+ }
+
+ /**
+ * Get connection by id
+ *
+ * @param {string} connectionId
+ * @param {Connections.RequestOptions} requestOptions - Request-specific configuration.
+ *
+ * @throws {@link Monite.UnprocessableEntityError}
+ * @throws {@link Monite.InternalServerError}
+ *
+ * @example
+ * await client.accounting.connections.getById("connection_id")
+ */
+ public async getById(
+ connectionId: string,
+ requestOptions?: Connections.RequestOptions
+ ): Promise {
+ const _response = await (this._options.fetcher ?? core.fetcher)({
+ url: urlJoin(
+ (await core.Supplier.get(this._options.environment)) ?? environments.MoniteEnvironment.Sandbox,
+ `accounting_connections/${encodeURIComponent(connectionId)}`
+ ),
+ method: "GET",
+ headers: {
+ Authorization: await this._getAuthorizationHeader(),
+ "x-monite-version": await core.Supplier.get(this._options.moniteVersion),
+ "x-monite-entity-id":
+ (await core.Supplier.get(this._options.moniteEntityId)) != null
+ ? await core.Supplier.get(this._options.moniteEntityId)
+ : undefined,
+ "X-Fern-Language": "JavaScript",
+ "X-Fern-SDK-Name": "",
+ "X-Fern-SDK-Version": "0.1.0",
+ "X-Fern-Runtime": core.RUNTIME.type,
+ "X-Fern-Runtime-Version": core.RUNTIME.version,
+ },
+ contentType: "application/json",
+ requestType: "json",
+ timeoutMs: requestOptions?.timeoutInSeconds != null ? requestOptions.timeoutInSeconds * 1000 : 60000,
+ maxRetries: requestOptions?.maxRetries,
+ abortSignal: requestOptions?.abortSignal,
+ });
+ if (_response.ok) {
+ return _response.body as Monite.AccountingConnectionResponse;
+ }
+
+ if (_response.error.reason === "status-code") {
+ switch (_response.error.statusCode) {
+ case 422:
+ throw new Monite.UnprocessableEntityError(_response.error.body as Monite.HttpValidationError);
+ case 500:
+ throw new Monite.InternalServerError(_response.error.body as Monite.ErrorSchemaResponse);
+ default:
+ throw new errors.MoniteError({
+ statusCode: _response.error.statusCode,
+ body: _response.error.body,
+ });
+ }
+ }
+
+ switch (_response.error.reason) {
+ case "non-json":
+ throw new errors.MoniteError({
+ statusCode: _response.error.statusCode,
+ body: _response.error.rawBody,
+ });
+ case "timeout":
+ throw new errors.MoniteTimeoutError();
+ case "unknown":
+ throw new errors.MoniteError({
+ message: _response.error.errorMessage,
+ });
+ }
+ }
+
+ /**
+ * Disconnect
+ *
+ * @param {string} connectionId
+ * @param {Connections.RequestOptions} requestOptions - Request-specific configuration.
+ *
+ * @throws {@link Monite.UnprocessableEntityError}
+ * @throws {@link Monite.InternalServerError}
+ *
+ * @example
+ * await client.accounting.connections.disconnectById("connection_id")
+ */
+ public async disconnectById(
+ connectionId: string,
+ requestOptions?: Connections.RequestOptions
+ ): Promise {
+ const _response = await (this._options.fetcher ?? core.fetcher)({
+ url: urlJoin(
+ (await core.Supplier.get(this._options.environment)) ?? environments.MoniteEnvironment.Sandbox,
+ `accounting_connections/${encodeURIComponent(connectionId)}/disconnect`
+ ),
+ method: "POST",
+ headers: {
+ Authorization: await this._getAuthorizationHeader(),
+ "x-monite-version": await core.Supplier.get(this._options.moniteVersion),
+ "x-monite-entity-id":
+ (await core.Supplier.get(this._options.moniteEntityId)) != null
+ ? await core.Supplier.get(this._options.moniteEntityId)
+ : undefined,
+ "X-Fern-Language": "JavaScript",
+ "X-Fern-SDK-Name": "",
+ "X-Fern-SDK-Version": "0.1.0",
+ "X-Fern-Runtime": core.RUNTIME.type,
+ "X-Fern-Runtime-Version": core.RUNTIME.version,
+ },
+ contentType: "application/json",
+ requestType: "json",
+ timeoutMs: requestOptions?.timeoutInSeconds != null ? requestOptions.timeoutInSeconds * 1000 : 60000,
+ maxRetries: requestOptions?.maxRetries,
+ abortSignal: requestOptions?.abortSignal,
+ });
+ if (_response.ok) {
+ return _response.body as Monite.AccountingConnectionResponse;
+ }
+
+ if (_response.error.reason === "status-code") {
+ switch (_response.error.statusCode) {
+ case 422:
+ throw new Monite.UnprocessableEntityError(_response.error.body as Monite.HttpValidationError);
+ case 500:
+ throw new Monite.InternalServerError(_response.error.body as Monite.ErrorSchemaResponse);
+ default:
+ throw new errors.MoniteError({
+ statusCode: _response.error.statusCode,
+ body: _response.error.body,
+ });
+ }
+ }
+
+ switch (_response.error.reason) {
+ case "non-json":
+ throw new errors.MoniteError({
+ statusCode: _response.error.statusCode,
+ body: _response.error.rawBody,
+ });
+ case "timeout":
+ throw new errors.MoniteTimeoutError();
+ case "unknown":
+ throw new errors.MoniteError({
+ message: _response.error.errorMessage,
+ });
+ }
+ }
+
+ /**
+ * @param {string} connectionId
+ * @param {Connections.RequestOptions} requestOptions - Request-specific configuration.
+ *
+ * @throws {@link Monite.UnprocessableEntityError}
+ * @throws {@link Monite.InternalServerError}
+ *
+ * @example
+ * await client.accounting.connections.syncById("connection_id")
+ */
+ public async syncById(
+ connectionId: string,
+ requestOptions?: Connections.RequestOptions
+ ): Promise {
+ const _response = await (this._options.fetcher ?? core.fetcher)({
+ url: urlJoin(
+ (await core.Supplier.get(this._options.environment)) ?? environments.MoniteEnvironment.Sandbox,
+ `accounting_connections/${encodeURIComponent(connectionId)}/sync`
+ ),
+ method: "POST",
+ headers: {
+ Authorization: await this._getAuthorizationHeader(),
+ "x-monite-version": await core.Supplier.get(this._options.moniteVersion),
+ "x-monite-entity-id":
+ (await core.Supplier.get(this._options.moniteEntityId)) != null
+ ? await core.Supplier.get(this._options.moniteEntityId)
+ : undefined,
+ "X-Fern-Language": "JavaScript",
+ "X-Fern-SDK-Name": "",
+ "X-Fern-SDK-Version": "0.1.0",
+ "X-Fern-Runtime": core.RUNTIME.type,
+ "X-Fern-Runtime-Version": core.RUNTIME.version,
+ },
+ contentType: "application/json",
+ requestType: "json",
+ timeoutMs: requestOptions?.timeoutInSeconds != null ? requestOptions.timeoutInSeconds * 1000 : 60000,
+ maxRetries: requestOptions?.maxRetries,
+ abortSignal: requestOptions?.abortSignal,
+ });
+ if (_response.ok) {
+ return _response.body as Monite.AccountingMessageResponse;
+ }
+
+ if (_response.error.reason === "status-code") {
+ switch (_response.error.statusCode) {
+ case 422:
+ throw new Monite.UnprocessableEntityError(_response.error.body as Monite.HttpValidationError);
+ case 500:
+ throw new Monite.InternalServerError(_response.error.body as Monite.ErrorSchemaResponse);
+ default:
+ throw new errors.MoniteError({
+ statusCode: _response.error.statusCode,
+ body: _response.error.body,
+ });
+ }
+ }
+
+ switch (_response.error.reason) {
+ case "non-json":
+ throw new errors.MoniteError({
+ statusCode: _response.error.statusCode,
+ body: _response.error.rawBody,
+ });
+ case "timeout":
+ throw new errors.MoniteTimeoutError();
+ case "unknown":
+ throw new errors.MoniteError({
+ message: _response.error.errorMessage,
+ });
+ }
+ }
+
+ protected async _getAuthorizationHeader(): Promise {
+ const bearer = await core.Supplier.get(this._options.token);
+ if (bearer != null) {
+ return `Bearer ${bearer}`;
+ }
+
+ return undefined;
+ }
+}
diff --git a/src/api/resources/accounting/resources/connections/client/index.ts b/src/api/resources/accounting/resources/connections/client/index.ts
new file mode 100644
index 0000000..415726b
--- /dev/null
+++ b/src/api/resources/accounting/resources/connections/client/index.ts
@@ -0,0 +1 @@
+export * from "./requests";
diff --git a/src/api/resources/accounting/resources/connections/client/requests/AccountingConnectionRequest.ts b/src/api/resources/accounting/resources/connections/client/requests/AccountingConnectionRequest.ts
new file mode 100644
index 0000000..9350b33
--- /dev/null
+++ b/src/api/resources/accounting/resources/connections/client/requests/AccountingConnectionRequest.ts
@@ -0,0 +1,13 @@
+/**
+ * This file was auto-generated by Fern from our API Definition.
+ */
+
+import * as Monite from "../../../../../../index";
+
+/**
+ * @example
+ * {}
+ */
+export interface AccountingConnectionRequest {
+ platform?: Monite.Platform;
+}
diff --git a/src/api/resources/accounting/resources/connections/client/requests/index.ts b/src/api/resources/accounting/resources/connections/client/requests/index.ts
new file mode 100644
index 0000000..20704a1
--- /dev/null
+++ b/src/api/resources/accounting/resources/connections/client/requests/index.ts
@@ -0,0 +1 @@
+export { type AccountingConnectionRequest } from "./AccountingConnectionRequest";
diff --git a/src/api/resources/accounting/resources/connections/index.ts b/src/api/resources/accounting/resources/connections/index.ts
new file mode 100644
index 0000000..5ec7692
--- /dev/null
+++ b/src/api/resources/accounting/resources/connections/index.ts
@@ -0,0 +1 @@
+export * from "./client";
diff --git a/src/api/resources/accounting/resources/index.ts b/src/api/resources/accounting/resources/index.ts
new file mode 100644
index 0000000..9dbb0bc
--- /dev/null
+++ b/src/api/resources/accounting/resources/index.ts
@@ -0,0 +1,12 @@
+export * as payables from "./payables";
+export * as receivables from "./receivables";
+export * as connections from "./connections";
+export * as syncedRecords from "./syncedRecords";
+export * as taxRates from "./taxRates";
+export * as ledgerAccounts from "./ledgerAccounts";
+export * from "./payables/client/requests";
+export * from "./receivables/client/requests";
+export * from "./connections/client/requests";
+export * from "./syncedRecords/client/requests";
+export * from "./taxRates/client/requests";
+export * from "./ledgerAccounts/client/requests";
diff --git a/src/api/resources/accounting/resources/ledgerAccounts/client/Client.ts b/src/api/resources/accounting/resources/ledgerAccounts/client/Client.ts
new file mode 100644
index 0000000..39836e9
--- /dev/null
+++ b/src/api/resources/accounting/resources/ledgerAccounts/client/Client.ts
@@ -0,0 +1,214 @@
+/**
+ * This file was auto-generated by Fern from our API Definition.
+ */
+
+import * as environments from "../../../../../../environments";
+import * as core from "../../../../../../core";
+import * as Monite from "../../../../../index";
+import urlJoin from "url-join";
+import * as errors from "../../../../../../errors/index";
+
+export declare namespace LedgerAccounts {
+ interface Options {
+ environment?: core.Supplier;
+ token?: core.Supplier;
+ /** Override the x-monite-version header */
+ moniteVersion: core.Supplier;
+ /** Override the x-monite-entity-id header */
+ moniteEntityId?: core.Supplier;
+ fetcher?: core.FetchFunction;
+ }
+
+ interface RequestOptions {
+ /** The maximum time to wait for a response in seconds. */
+ timeoutInSeconds?: number;
+ /** The number of times to retry the request. Defaults to 2. */
+ maxRetries?: number;
+ /** A hook to abort the request. */
+ abortSignal?: AbortSignal;
+ /** Override the x-monite-version header */
+ moniteVersion?: string;
+ /** Override the x-monite-entity-id header */
+ moniteEntityId?: string | undefined;
+ }
+}
+
+export class LedgerAccounts {
+ constructor(protected readonly _options: LedgerAccounts.Options) {}
+
+ /**
+ * Get all ledger accounts
+ *
+ * @param {Monite.accounting.LedgerAccountsGetRequest} request
+ * @param {LedgerAccounts.RequestOptions} requestOptions - Request-specific configuration.
+ *
+ * @throws {@link Monite.UnprocessableEntityError}
+ * @throws {@link Monite.InternalServerError}
+ *
+ * @example
+ * await client.accounting.ledgerAccounts.get()
+ */
+ public async get(
+ request: Monite.accounting.LedgerAccountsGetRequest = {},
+ requestOptions?: LedgerAccounts.RequestOptions
+ ): Promise {
+ const { order, limit, pagination_token: paginationToken, sort } = request;
+ const _queryParams: Record = {};
+ if (order != null) {
+ _queryParams["order"] = order;
+ }
+
+ if (limit != null) {
+ _queryParams["limit"] = limit.toString();
+ }
+
+ if (paginationToken != null) {
+ _queryParams["pagination_token"] = paginationToken;
+ }
+
+ if (sort != null) {
+ _queryParams["sort"] = sort;
+ }
+
+ const _response = await (this._options.fetcher ?? core.fetcher)({
+ url: urlJoin(
+ (await core.Supplier.get(this._options.environment)) ?? environments.MoniteEnvironment.Sandbox,
+ "ledger_accounts"
+ ),
+ method: "GET",
+ headers: {
+ Authorization: await this._getAuthorizationHeader(),
+ "x-monite-version": await core.Supplier.get(this._options.moniteVersion),
+ "x-monite-entity-id":
+ (await core.Supplier.get(this._options.moniteEntityId)) != null
+ ? await core.Supplier.get(this._options.moniteEntityId)
+ : undefined,
+ "X-Fern-Language": "JavaScript",
+ "X-Fern-SDK-Name": "",
+ "X-Fern-SDK-Version": "0.1.0",
+ "X-Fern-Runtime": core.RUNTIME.type,
+ "X-Fern-Runtime-Version": core.RUNTIME.version,
+ },
+ contentType: "application/json",
+ queryParameters: _queryParams,
+ requestType: "json",
+ timeoutMs: requestOptions?.timeoutInSeconds != null ? requestOptions.timeoutInSeconds * 1000 : 60000,
+ maxRetries: requestOptions?.maxRetries,
+ abortSignal: requestOptions?.abortSignal,
+ });
+ if (_response.ok) {
+ return _response.body as Monite.LedgerAccountListResponse;
+ }
+
+ if (_response.error.reason === "status-code") {
+ switch (_response.error.statusCode) {
+ case 422:
+ throw new Monite.UnprocessableEntityError(_response.error.body as Monite.HttpValidationError);
+ case 500:
+ throw new Monite.InternalServerError(_response.error.body as Monite.ErrorSchemaResponse);
+ default:
+ throw new errors.MoniteError({
+ statusCode: _response.error.statusCode,
+ body: _response.error.body,
+ });
+ }
+ }
+
+ switch (_response.error.reason) {
+ case "non-json":
+ throw new errors.MoniteError({
+ statusCode: _response.error.statusCode,
+ body: _response.error.rawBody,
+ });
+ case "timeout":
+ throw new errors.MoniteTimeoutError();
+ case "unknown":
+ throw new errors.MoniteError({
+ message: _response.error.errorMessage,
+ });
+ }
+ }
+
+ /**
+ * Get ledger account by id
+ *
+ * @param {string} ledgerAccountId
+ * @param {LedgerAccounts.RequestOptions} requestOptions - Request-specific configuration.
+ *
+ * @throws {@link Monite.UnprocessableEntityError}
+ * @throws {@link Monite.InternalServerError}
+ *
+ * @example
+ * await client.accounting.ledgerAccounts.getById("ledger_account_id")
+ */
+ public async getById(
+ ledgerAccountId: string,
+ requestOptions?: LedgerAccounts.RequestOptions
+ ): Promise {
+ const _response = await (this._options.fetcher ?? core.fetcher)({
+ url: urlJoin(
+ (await core.Supplier.get(this._options.environment)) ?? environments.MoniteEnvironment.Sandbox,
+ `ledger_accounts/${encodeURIComponent(ledgerAccountId)}`
+ ),
+ method: "GET",
+ headers: {
+ Authorization: await this._getAuthorizationHeader(),
+ "x-monite-version": await core.Supplier.get(this._options.moniteVersion),
+ "x-monite-entity-id":
+ (await core.Supplier.get(this._options.moniteEntityId)) != null
+ ? await core.Supplier.get(this._options.moniteEntityId)
+ : undefined,
+ "X-Fern-Language": "JavaScript",
+ "X-Fern-SDK-Name": "",
+ "X-Fern-SDK-Version": "0.1.0",
+ "X-Fern-Runtime": core.RUNTIME.type,
+ "X-Fern-Runtime-Version": core.RUNTIME.version,
+ },
+ contentType: "application/json",
+ requestType: "json",
+ timeoutMs: requestOptions?.timeoutInSeconds != null ? requestOptions.timeoutInSeconds * 1000 : 60000,
+ maxRetries: requestOptions?.maxRetries,
+ abortSignal: requestOptions?.abortSignal,
+ });
+ if (_response.ok) {
+ return _response.body as Monite.LedgerAccountResponse;
+ }
+
+ if (_response.error.reason === "status-code") {
+ switch (_response.error.statusCode) {
+ case 422:
+ throw new Monite.UnprocessableEntityError(_response.error.body as Monite.HttpValidationError);
+ case 500:
+ throw new Monite.InternalServerError(_response.error.body as Monite.ErrorSchemaResponse);
+ default:
+ throw new errors.MoniteError({
+ statusCode: _response.error.statusCode,
+ body: _response.error.body,
+ });
+ }
+ }
+
+ switch (_response.error.reason) {
+ case "non-json":
+ throw new errors.MoniteError({
+ statusCode: _response.error.statusCode,
+ body: _response.error.rawBody,
+ });
+ case "timeout":
+ throw new errors.MoniteTimeoutError();
+ case "unknown":
+ throw new errors.MoniteError({
+ message: _response.error.errorMessage,
+ });
+ }
+ }
+
+ protected async _getAuthorizationHeader(): Promise {
+ const bearer = await core.Supplier.get(this._options.token);
+ if (bearer != null) {
+ return `Bearer ${bearer}`;
+ }
+
+ return undefined;
+ }
+}
diff --git a/src/api/resources/accounting/resources/ledgerAccounts/client/index.ts b/src/api/resources/accounting/resources/ledgerAccounts/client/index.ts
new file mode 100644
index 0000000..415726b
--- /dev/null
+++ b/src/api/resources/accounting/resources/ledgerAccounts/client/index.ts
@@ -0,0 +1 @@
+export * from "./requests";
diff --git a/src/api/resources/accounting/resources/ledgerAccounts/client/requests/LedgerAccountsGetRequest.ts b/src/api/resources/accounting/resources/ledgerAccounts/client/requests/LedgerAccountsGetRequest.ts
new file mode 100644
index 0000000..14b95ea
--- /dev/null
+++ b/src/api/resources/accounting/resources/ledgerAccounts/client/requests/LedgerAccountsGetRequest.ts
@@ -0,0 +1,28 @@
+/**
+ * This file was auto-generated by Fern from our API Definition.
+ */
+
+import * as Monite from "../../../../../../index";
+
+/**
+ * @example
+ * {}
+ */
+export interface LedgerAccountsGetRequest {
+ /**
+ * Order by
+ */
+ order?: Monite.OrderEnum;
+ /**
+ * Max is 100
+ */
+ limit?: number;
+ /**
+ * A token, obtained from previous page. Prior over other filters
+ */
+ pagination_token?: string;
+ /**
+ * Allowed sort fields
+ */
+ sort?: Monite.LedgerAccountCursorFields;
+}
diff --git a/src/api/resources/accounting/resources/ledgerAccounts/client/requests/index.ts b/src/api/resources/accounting/resources/ledgerAccounts/client/requests/index.ts
new file mode 100644
index 0000000..f70a0ef
--- /dev/null
+++ b/src/api/resources/accounting/resources/ledgerAccounts/client/requests/index.ts
@@ -0,0 +1 @@
+export { type LedgerAccountsGetRequest } from "./LedgerAccountsGetRequest";
diff --git a/src/api/resources/accounting/resources/ledgerAccounts/index.ts b/src/api/resources/accounting/resources/ledgerAccounts/index.ts
new file mode 100644
index 0000000..5ec7692
--- /dev/null
+++ b/src/api/resources/accounting/resources/ledgerAccounts/index.ts
@@ -0,0 +1 @@
+export * from "./client";
diff --git a/src/api/resources/accounting/resources/payables/client/Client.ts b/src/api/resources/accounting/resources/payables/client/Client.ts
new file mode 100644
index 0000000..bf6e743
--- /dev/null
+++ b/src/api/resources/accounting/resources/payables/client/Client.ts
@@ -0,0 +1,210 @@
+/**
+ * This file was auto-generated by Fern from our API Definition.
+ */
+
+import * as environments from "../../../../../../environments";
+import * as core from "../../../../../../core";
+import * as Monite from "../../../../../index";
+import urlJoin from "url-join";
+import * as errors from "../../../../../../errors/index";
+
+export declare namespace Payables {
+ interface Options {
+ environment?: core.Supplier;
+ token?: core.Supplier;
+ /** Override the x-monite-version header */
+ moniteVersion: core.Supplier;
+ /** Override the x-monite-entity-id header */
+ moniteEntityId?: core.Supplier;
+ fetcher?: core.FetchFunction;
+ }
+
+ interface RequestOptions {
+ /** The maximum time to wait for a response in seconds. */
+ timeoutInSeconds?: number;
+ /** The number of times to retry the request. Defaults to 2. */
+ maxRetries?: number;
+ /** A hook to abort the request. */
+ abortSignal?: AbortSignal;
+ /** Override the x-monite-version header */
+ moniteVersion?: string;
+ /** Override the x-monite-entity-id header */
+ moniteEntityId?: string | undefined;
+ }
+}
+
+export class Payables {
+ constructor(protected readonly _options: Payables.Options) {}
+
+ /**
+ * Returns a list of accounts payable invoices (bills) that exist in the entity's accounting system. This requires that an accounting connection has been previously established. Refer to the [Accounting integration guide](https://docs.monite.com/accounting/integration/index) for details.
+ *
+ * This endpoint only provides read-only access to the accounting system's data but does not pull those payables into Monite. You can use it to review the data in the accounting system and find out which of those payables already exist or do not exist in Monite.
+ *
+ * Data is actual as of the date and time of the last accounting synchronization, which is specified by the `last_pull` value in the response from `GET /accounting_connections/{connection_id}`. To make sure you are accessing the most up-to-date accounting data, you can use `POST /accounting_connections/{connection_id}/sync` to trigger on-demand synchronization before getting the list of payables.
+ *
+ * @param {Monite.accounting.PayablesGetRequest} request
+ * @param {Payables.RequestOptions} requestOptions - Request-specific configuration.
+ *
+ * @throws {@link Monite.UnprocessableEntityError}
+ * @throws {@link Monite.InternalServerError}
+ *
+ * @example
+ * await client.accounting.payables.get()
+ */
+ public async get(
+ request: Monite.accounting.PayablesGetRequest = {},
+ requestOptions?: Payables.RequestOptions
+ ): Promise {
+ const { limit, offset } = request;
+ const _queryParams: Record = {};
+ if (limit != null) {
+ _queryParams["limit"] = limit.toString();
+ }
+
+ if (offset != null) {
+ _queryParams["offset"] = offset.toString();
+ }
+
+ const _response = await (this._options.fetcher ?? core.fetcher)({
+ url: urlJoin(
+ (await core.Supplier.get(this._options.environment)) ?? environments.MoniteEnvironment.Sandbox,
+ "accounting/payables"
+ ),
+ method: "GET",
+ headers: {
+ Authorization: await this._getAuthorizationHeader(),
+ "x-monite-version": await core.Supplier.get(this._options.moniteVersion),
+ "x-monite-entity-id":
+ (await core.Supplier.get(this._options.moniteEntityId)) != null
+ ? await core.Supplier.get(this._options.moniteEntityId)
+ : undefined,
+ "X-Fern-Language": "JavaScript",
+ "X-Fern-SDK-Name": "",
+ "X-Fern-SDK-Version": "0.1.0",
+ "X-Fern-Runtime": core.RUNTIME.type,
+ "X-Fern-Runtime-Version": core.RUNTIME.version,
+ },
+ contentType: "application/json",
+ queryParameters: _queryParams,
+ requestType: "json",
+ timeoutMs: requestOptions?.timeoutInSeconds != null ? requestOptions.timeoutInSeconds * 1000 : 60000,
+ maxRetries: requestOptions?.maxRetries,
+ abortSignal: requestOptions?.abortSignal,
+ });
+ if (_response.ok) {
+ return _response.body as Monite.AccountingPayableList;
+ }
+
+ if (_response.error.reason === "status-code") {
+ switch (_response.error.statusCode) {
+ case 422:
+ throw new Monite.UnprocessableEntityError(_response.error.body as Monite.HttpValidationError);
+ case 500:
+ throw new Monite.InternalServerError(_response.error.body as Monite.ErrorSchemaResponse);
+ default:
+ throw new errors.MoniteError({
+ statusCode: _response.error.statusCode,
+ body: _response.error.body,
+ });
+ }
+ }
+
+ switch (_response.error.reason) {
+ case "non-json":
+ throw new errors.MoniteError({
+ statusCode: _response.error.statusCode,
+ body: _response.error.rawBody,
+ });
+ case "timeout":
+ throw new errors.MoniteTimeoutError();
+ case "unknown":
+ throw new errors.MoniteError({
+ message: _response.error.errorMessage,
+ });
+ }
+ }
+
+ /**
+ * Returns information about an individual payable invoice (bill) that exists in the entity's accounting system. This payable may or may not also exist in Monite.
+ *
+ * @param {string} payableId - An internal ID of the payable invoice (bill) in the accounting system. You can get these IDs from `GET /accounting/payables`.
+ * @param {Payables.RequestOptions} requestOptions - Request-specific configuration.
+ *
+ * @throws {@link Monite.UnprocessableEntityError}
+ * @throws {@link Monite.InternalServerError}
+ *
+ * @example
+ * await client.accounting.payables.getById("payable_id")
+ */
+ public async getById(
+ payableId: string,
+ requestOptions?: Payables.RequestOptions
+ ): Promise {
+ const _response = await (this._options.fetcher ?? core.fetcher)({
+ url: urlJoin(
+ (await core.Supplier.get(this._options.environment)) ?? environments.MoniteEnvironment.Sandbox,
+ `accounting/payables/${encodeURIComponent(payableId)}`
+ ),
+ method: "GET",
+ headers: {
+ Authorization: await this._getAuthorizationHeader(),
+ "x-monite-version": await core.Supplier.get(this._options.moniteVersion),
+ "x-monite-entity-id":
+ (await core.Supplier.get(this._options.moniteEntityId)) != null
+ ? await core.Supplier.get(this._options.moniteEntityId)
+ : undefined,
+ "X-Fern-Language": "JavaScript",
+ "X-Fern-SDK-Name": "",
+ "X-Fern-SDK-Version": "0.1.0",
+ "X-Fern-Runtime": core.RUNTIME.type,
+ "X-Fern-Runtime-Version": core.RUNTIME.version,
+ },
+ contentType: "application/json",
+ requestType: "json",
+ timeoutMs: requestOptions?.timeoutInSeconds != null ? requestOptions.timeoutInSeconds * 1000 : 60000,
+ maxRetries: requestOptions?.maxRetries,
+ abortSignal: requestOptions?.abortSignal,
+ });
+ if (_response.ok) {
+ return _response.body as Monite.AccountingPayable;
+ }
+
+ if (_response.error.reason === "status-code") {
+ switch (_response.error.statusCode) {
+ case 422:
+ throw new Monite.UnprocessableEntityError(_response.error.body as Monite.HttpValidationError);
+ case 500:
+ throw new Monite.InternalServerError(_response.error.body as Monite.ErrorSchemaResponse);
+ default:
+ throw new errors.MoniteError({
+ statusCode: _response.error.statusCode,
+ body: _response.error.body,
+ });
+ }
+ }
+
+ switch (_response.error.reason) {
+ case "non-json":
+ throw new errors.MoniteError({
+ statusCode: _response.error.statusCode,
+ body: _response.error.rawBody,
+ });
+ case "timeout":
+ throw new errors.MoniteTimeoutError();
+ case "unknown":
+ throw new errors.MoniteError({
+ message: _response.error.errorMessage,
+ });
+ }
+ }
+
+ protected async _getAuthorizationHeader(): Promise {
+ const bearer = await core.Supplier.get(this._options.token);
+ if (bearer != null) {
+ return `Bearer ${bearer}`;
+ }
+
+ return undefined;
+ }
+}
diff --git a/src/api/resources/accounting/resources/payables/client/index.ts b/src/api/resources/accounting/resources/payables/client/index.ts
new file mode 100644
index 0000000..415726b
--- /dev/null
+++ b/src/api/resources/accounting/resources/payables/client/index.ts
@@ -0,0 +1 @@
+export * from "./requests";
diff --git a/src/api/resources/accounting/resources/payables/client/requests/PayablesGetRequest.ts b/src/api/resources/accounting/resources/payables/client/requests/PayablesGetRequest.ts
new file mode 100644
index 0000000..9434b0e
--- /dev/null
+++ b/src/api/resources/accounting/resources/payables/client/requests/PayablesGetRequest.ts
@@ -0,0 +1,18 @@
+/**
+ * This file was auto-generated by Fern from our API Definition.
+ */
+
+/**
+ * @example
+ * {}
+ */
+export interface PayablesGetRequest {
+ /**
+ * Number of results per page.
+ */
+ limit?: number;
+ /**
+ * Number of results to skip before selecting items to return.
+ */
+ offset?: number;
+}
diff --git a/src/api/resources/accounting/resources/payables/client/requests/index.ts b/src/api/resources/accounting/resources/payables/client/requests/index.ts
new file mode 100644
index 0000000..ac4bf74
--- /dev/null
+++ b/src/api/resources/accounting/resources/payables/client/requests/index.ts
@@ -0,0 +1 @@
+export { type PayablesGetRequest } from "./PayablesGetRequest";
diff --git a/src/api/resources/accounting/resources/payables/index.ts b/src/api/resources/accounting/resources/payables/index.ts
new file mode 100644
index 0000000..5ec7692
--- /dev/null
+++ b/src/api/resources/accounting/resources/payables/index.ts
@@ -0,0 +1 @@
+export * from "./client";
diff --git a/src/api/resources/accounting/resources/receivables/client/Client.ts b/src/api/resources/accounting/resources/receivables/client/Client.ts
new file mode 100644
index 0000000..a21c794
--- /dev/null
+++ b/src/api/resources/accounting/resources/receivables/client/Client.ts
@@ -0,0 +1,210 @@
+/**
+ * This file was auto-generated by Fern from our API Definition.
+ */
+
+import * as environments from "../../../../../../environments";
+import * as core from "../../../../../../core";
+import * as Monite from "../../../../../index";
+import urlJoin from "url-join";
+import * as errors from "../../../../../../errors/index";
+
+export declare namespace Receivables {
+ interface Options {
+ environment?: core.Supplier;
+ token?: core.Supplier;
+ /** Override the x-monite-version header */
+ moniteVersion: core.Supplier;
+ /** Override the x-monite-entity-id header */
+ moniteEntityId?: core.Supplier;
+ fetcher?: core.FetchFunction;
+ }
+
+ interface RequestOptions {
+ /** The maximum time to wait for a response in seconds. */
+ timeoutInSeconds?: number;
+ /** The number of times to retry the request. Defaults to 2. */
+ maxRetries?: number;
+ /** A hook to abort the request. */
+ abortSignal?: AbortSignal;
+ /** Override the x-monite-version header */
+ moniteVersion?: string;
+ /** Override the x-monite-entity-id header */
+ moniteEntityId?: string | undefined;
+ }
+}
+
+export class Receivables {
+ constructor(protected readonly _options: Receivables.Options) {}
+
+ /**
+ * Returns a list of invoices that exist in the entity's accounting system. This requires that an accounting connection has been previously established. Refer to the [Accounting integration guide](https://docs.monite.com/accounting/integration/index) for details.
+ *
+ * This endpoint only provides read-only access to the accounting system's data but does not pull those invoices into Monite. You can use it to review the data in the accounting system and find out which of those invoices already exist or do not exist in Monite.
+ *
+ * Data is actual as of the date and time of the last accounting synchronization, which is specified by the `last_pull` value in the response from `GET /accounting_connections/{connection_id}`. To make sure you are accessing the most up-to-date accounting data, you can use `POST /accounting_connections/{connection_id}/sync` to trigger on-demand synchronization before getting the invoice list.
+ *
+ * @param {Monite.accounting.ReceivablesGetRequest} request
+ * @param {Receivables.RequestOptions} requestOptions - Request-specific configuration.
+ *
+ * @throws {@link Monite.UnprocessableEntityError}
+ * @throws {@link Monite.InternalServerError}
+ *
+ * @example
+ * await client.accounting.receivables.get()
+ */
+ public async get(
+ request: Monite.accounting.ReceivablesGetRequest = {},
+ requestOptions?: Receivables.RequestOptions
+ ): Promise {
+ const { limit, offset } = request;
+ const _queryParams: Record = {};
+ if (limit != null) {
+ _queryParams["limit"] = limit.toString();
+ }
+
+ if (offset != null) {
+ _queryParams["offset"] = offset.toString();
+ }
+
+ const _response = await (this._options.fetcher ?? core.fetcher)({
+ url: urlJoin(
+ (await core.Supplier.get(this._options.environment)) ?? environments.MoniteEnvironment.Sandbox,
+ "accounting/receivables"
+ ),
+ method: "GET",
+ headers: {
+ Authorization: await this._getAuthorizationHeader(),
+ "x-monite-version": await core.Supplier.get(this._options.moniteVersion),
+ "x-monite-entity-id":
+ (await core.Supplier.get(this._options.moniteEntityId)) != null
+ ? await core.Supplier.get(this._options.moniteEntityId)
+ : undefined,
+ "X-Fern-Language": "JavaScript",
+ "X-Fern-SDK-Name": "",
+ "X-Fern-SDK-Version": "0.1.0",
+ "X-Fern-Runtime": core.RUNTIME.type,
+ "X-Fern-Runtime-Version": core.RUNTIME.version,
+ },
+ contentType: "application/json",
+ queryParameters: _queryParams,
+ requestType: "json",
+ timeoutMs: requestOptions?.timeoutInSeconds != null ? requestOptions.timeoutInSeconds * 1000 : 60000,
+ maxRetries: requestOptions?.maxRetries,
+ abortSignal: requestOptions?.abortSignal,
+ });
+ if (_response.ok) {
+ return _response.body as Monite.AccountingReceivableList;
+ }
+
+ if (_response.error.reason === "status-code") {
+ switch (_response.error.statusCode) {
+ case 422:
+ throw new Monite.UnprocessableEntityError(_response.error.body as Monite.HttpValidationError);
+ case 500:
+ throw new Monite.InternalServerError(_response.error.body as Monite.ErrorSchemaResponse);
+ default:
+ throw new errors.MoniteError({
+ statusCode: _response.error.statusCode,
+ body: _response.error.body,
+ });
+ }
+ }
+
+ switch (_response.error.reason) {
+ case "non-json":
+ throw new errors.MoniteError({
+ statusCode: _response.error.statusCode,
+ body: _response.error.rawBody,
+ });
+ case "timeout":
+ throw new errors.MoniteTimeoutError();
+ case "unknown":
+ throw new errors.MoniteError({
+ message: _response.error.errorMessage,
+ });
+ }
+ }
+
+ /**
+ * Returns information about an individual invoice that exists in the entity's accounting system. This invoice may or may not also exist in Monite.
+ *
+ * @param {string} invoiceId - An internal ID of the invoice in the accounting system. You can get these IDs from `GET /accounting/receivables`.
+ * @param {Receivables.RequestOptions} requestOptions - Request-specific configuration.
+ *
+ * @throws {@link Monite.UnprocessableEntityError}
+ * @throws {@link Monite.InternalServerError}
+ *
+ * @example
+ * await client.accounting.receivables.getById("invoice_id")
+ */
+ public async getById(
+ invoiceId: string,
+ requestOptions?: Receivables.RequestOptions
+ ): Promise {
+ const _response = await (this._options.fetcher ?? core.fetcher)({
+ url: urlJoin(
+ (await core.Supplier.get(this._options.environment)) ?? environments.MoniteEnvironment.Sandbox,
+ `accounting/receivables/${encodeURIComponent(invoiceId)}`
+ ),
+ method: "GET",
+ headers: {
+ Authorization: await this._getAuthorizationHeader(),
+ "x-monite-version": await core.Supplier.get(this._options.moniteVersion),
+ "x-monite-entity-id":
+ (await core.Supplier.get(this._options.moniteEntityId)) != null
+ ? await core.Supplier.get(this._options.moniteEntityId)
+ : undefined,
+ "X-Fern-Language": "JavaScript",
+ "X-Fern-SDK-Name": "",
+ "X-Fern-SDK-Version": "0.1.0",
+ "X-Fern-Runtime": core.RUNTIME.type,
+ "X-Fern-Runtime-Version": core.RUNTIME.version,
+ },
+ contentType: "application/json",
+ requestType: "json",
+ timeoutMs: requestOptions?.timeoutInSeconds != null ? requestOptions.timeoutInSeconds * 1000 : 60000,
+ maxRetries: requestOptions?.maxRetries,
+ abortSignal: requestOptions?.abortSignal,
+ });
+ if (_response.ok) {
+ return _response.body as Monite.AccountingReceivable;
+ }
+
+ if (_response.error.reason === "status-code") {
+ switch (_response.error.statusCode) {
+ case 422:
+ throw new Monite.UnprocessableEntityError(_response.error.body as Monite.HttpValidationError);
+ case 500:
+ throw new Monite.InternalServerError(_response.error.body as Monite.ErrorSchemaResponse);
+ default:
+ throw new errors.MoniteError({
+ statusCode: _response.error.statusCode,
+ body: _response.error.body,
+ });
+ }
+ }
+
+ switch (_response.error.reason) {
+ case "non-json":
+ throw new errors.MoniteError({
+ statusCode: _response.error.statusCode,
+ body: _response.error.rawBody,
+ });
+ case "timeout":
+ throw new errors.MoniteTimeoutError();
+ case "unknown":
+ throw new errors.MoniteError({
+ message: _response.error.errorMessage,
+ });
+ }
+ }
+
+ protected async _getAuthorizationHeader(): Promise {
+ const bearer = await core.Supplier.get(this._options.token);
+ if (bearer != null) {
+ return `Bearer ${bearer}`;
+ }
+
+ return undefined;
+ }
+}
diff --git a/src/api/resources/accounting/resources/receivables/client/index.ts b/src/api/resources/accounting/resources/receivables/client/index.ts
new file mode 100644
index 0000000..415726b
--- /dev/null
+++ b/src/api/resources/accounting/resources/receivables/client/index.ts
@@ -0,0 +1 @@
+export * from "./requests";
diff --git a/src/api/resources/accounting/resources/receivables/client/requests/ReceivablesGetRequest.ts b/src/api/resources/accounting/resources/receivables/client/requests/ReceivablesGetRequest.ts
new file mode 100644
index 0000000..8d1bbfa
--- /dev/null
+++ b/src/api/resources/accounting/resources/receivables/client/requests/ReceivablesGetRequest.ts
@@ -0,0 +1,18 @@
+/**
+ * This file was auto-generated by Fern from our API Definition.
+ */
+
+/**
+ * @example
+ * {}
+ */
+export interface ReceivablesGetRequest {
+ /**
+ * Number of results per page.
+ */
+ limit?: number;
+ /**
+ * Number of results to skip before selecting items to return.
+ */
+ offset?: number;
+}
diff --git a/src/api/resources/accounting/resources/receivables/client/requests/index.ts b/src/api/resources/accounting/resources/receivables/client/requests/index.ts
new file mode 100644
index 0000000..3a6d011
--- /dev/null
+++ b/src/api/resources/accounting/resources/receivables/client/requests/index.ts
@@ -0,0 +1 @@
+export { type ReceivablesGetRequest } from "./ReceivablesGetRequest";
diff --git a/src/api/resources/accounting/resources/receivables/index.ts b/src/api/resources/accounting/resources/receivables/index.ts
new file mode 100644
index 0000000..5ec7692
--- /dev/null
+++ b/src/api/resources/accounting/resources/receivables/index.ts
@@ -0,0 +1 @@
+export * from "./client";
diff --git a/src/api/resources/accounting/resources/syncedRecords/client/Client.ts b/src/api/resources/accounting/resources/syncedRecords/client/Client.ts
new file mode 100644
index 0000000..168ef97
--- /dev/null
+++ b/src/api/resources/accounting/resources/syncedRecords/client/Client.ts
@@ -0,0 +1,351 @@
+/**
+ * This file was auto-generated by Fern from our API Definition.
+ */
+
+import * as environments from "../../../../../../environments";
+import * as core from "../../../../../../core";
+import * as Monite from "../../../../../index";
+import urlJoin from "url-join";
+import * as errors from "../../../../../../errors/index";
+
+export declare namespace SyncedRecords {
+ interface Options {
+ environment?: core.Supplier;
+ token?: core.Supplier;
+ /** Override the x-monite-version header */
+ moniteVersion: core.Supplier;
+ /** Override the x-monite-entity-id header */
+ moniteEntityId?: core.Supplier;
+ fetcher?: core.FetchFunction;
+ }
+
+ interface RequestOptions {
+ /** The maximum time to wait for a response in seconds. */
+ timeoutInSeconds?: number;
+ /** The number of times to retry the request. Defaults to 2. */
+ maxRetries?: number;
+ /** A hook to abort the request. */
+ abortSignal?: AbortSignal;
+ /** Override the x-monite-version header */
+ moniteVersion?: string;
+ /** Override the x-monite-entity-id header */
+ moniteEntityId?: string | undefined;
+ }
+}
+
+export class SyncedRecords {
+ constructor(protected readonly _options: SyncedRecords.Options) {}
+
+ /**
+ * Get synchronized records
+ *
+ * @param {Monite.accounting.SyncedRecordsGetRequest} request
+ * @param {SyncedRecords.RequestOptions} requestOptions - Request-specific configuration.
+ *
+ * @throws {@link Monite.UnprocessableEntityError}
+ * @throws {@link Monite.InternalServerError}
+ *
+ * @example
+ * await client.accounting.syncedRecords.get({
+ * object_type: "product"
+ * })
+ */
+ public async get(
+ request: Monite.accounting.SyncedRecordsGetRequest,
+ requestOptions?: SyncedRecords.RequestOptions
+ ): Promise {
+ const {
+ object_type: objectType,
+ order,
+ limit,
+ pagination_token: paginationToken,
+ sort,
+ object_id: objectId,
+ object_id__in: objectIdIn,
+ created_at__gt: createdAtGt,
+ created_at__lt: createdAtLt,
+ created_at__gte: createdAtGte,
+ created_at__lte: createdAtLte,
+ updated_at__gt: updatedAtGt,
+ updated_at__lt: updatedAtLt,
+ updated_at__gte: updatedAtGte,
+ updated_at__lte: updatedAtLte,
+ } = request;
+ const _queryParams: Record = {};
+ _queryParams["object_type"] = objectType;
+ if (order != null) {
+ _queryParams["order"] = order;
+ }
+
+ if (limit != null) {
+ _queryParams["limit"] = limit.toString();
+ }
+
+ if (paginationToken != null) {
+ _queryParams["pagination_token"] = paginationToken;
+ }
+
+ if (sort != null) {
+ _queryParams["sort"] = sort;
+ }
+
+ if (objectId != null) {
+ _queryParams["object_id"] = objectId;
+ }
+
+ if (objectIdIn != null) {
+ if (Array.isArray(objectIdIn)) {
+ _queryParams["object_id__in"] = objectIdIn.map((item) => item);
+ } else {
+ _queryParams["object_id__in"] = objectIdIn;
+ }
+ }
+
+ if (createdAtGt != null) {
+ _queryParams["created_at__gt"] = createdAtGt;
+ }
+
+ if (createdAtLt != null) {
+ _queryParams["created_at__lt"] = createdAtLt;
+ }
+
+ if (createdAtGte != null) {
+ _queryParams["created_at__gte"] = createdAtGte;
+ }
+
+ if (createdAtLte != null) {
+ _queryParams["created_at__lte"] = createdAtLte;
+ }
+
+ if (updatedAtGt != null) {
+ _queryParams["updated_at__gt"] = updatedAtGt;
+ }
+
+ if (updatedAtLt != null) {
+ _queryParams["updated_at__lt"] = updatedAtLt;
+ }
+
+ if (updatedAtGte != null) {
+ _queryParams["updated_at__gte"] = updatedAtGte;
+ }
+
+ if (updatedAtLte != null) {
+ _queryParams["updated_at__lte"] = updatedAtLte;
+ }
+
+ const _response = await (this._options.fetcher ?? core.fetcher)({
+ url: urlJoin(
+ (await core.Supplier.get(this._options.environment)) ?? environments.MoniteEnvironment.Sandbox,
+ "accounting_synced_records"
+ ),
+ method: "GET",
+ headers: {
+ Authorization: await this._getAuthorizationHeader(),
+ "x-monite-version": await core.Supplier.get(this._options.moniteVersion),
+ "x-monite-entity-id":
+ (await core.Supplier.get(this._options.moniteEntityId)) != null
+ ? await core.Supplier.get(this._options.moniteEntityId)
+ : undefined,
+ "X-Fern-Language": "JavaScript",
+ "X-Fern-SDK-Name": "",
+ "X-Fern-SDK-Version": "0.1.0",
+ "X-Fern-Runtime": core.RUNTIME.type,
+ "X-Fern-Runtime-Version": core.RUNTIME.version,
+ },
+ contentType: "application/json",
+ queryParameters: _queryParams,
+ requestType: "json",
+ timeoutMs: requestOptions?.timeoutInSeconds != null ? requestOptions.timeoutInSeconds * 1000 : 60000,
+ maxRetries: requestOptions?.maxRetries,
+ abortSignal: requestOptions?.abortSignal,
+ });
+ if (_response.ok) {
+ return _response.body as Monite.SyncRecordResourceList;
+ }
+
+ if (_response.error.reason === "status-code") {
+ switch (_response.error.statusCode) {
+ case 422:
+ throw new Monite.UnprocessableEntityError(_response.error.body as Monite.HttpValidationError);
+ case 500:
+ throw new Monite.InternalServerError(_response.error.body as Monite.ErrorSchemaResponse);
+ default:
+ throw new errors.MoniteError({
+ statusCode: _response.error.statusCode,
+ body: _response.error.body,
+ });
+ }
+ }
+
+ switch (_response.error.reason) {
+ case "non-json":
+ throw new errors.MoniteError({
+ statusCode: _response.error.statusCode,
+ body: _response.error.rawBody,
+ });
+ case "timeout":
+ throw new errors.MoniteTimeoutError();
+ case "unknown":
+ throw new errors.MoniteError({
+ message: _response.error.errorMessage,
+ });
+ }
+ }
+
+ /**
+ * Get synchronized record by id
+ *
+ * @param {string} syncedRecordId
+ * @param {SyncedRecords.RequestOptions} requestOptions - Request-specific configuration.
+ *
+ * @throws {@link Monite.UnprocessableEntityError}
+ * @throws {@link Monite.InternalServerError}
+ *
+ * @example
+ * await client.accounting.syncedRecords.getById("synced_record_id")
+ */
+ public async getById(
+ syncedRecordId: string,
+ requestOptions?: SyncedRecords.RequestOptions
+ ): Promise {
+ const _response = await (this._options.fetcher ?? core.fetcher)({
+ url: urlJoin(
+ (await core.Supplier.get(this._options.environment)) ?? environments.MoniteEnvironment.Sandbox,
+ `accounting_synced_records/${encodeURIComponent(syncedRecordId)}`
+ ),
+ method: "GET",
+ headers: {
+ Authorization: await this._getAuthorizationHeader(),
+ "x-monite-version": await core.Supplier.get(this._options.moniteVersion),
+ "x-monite-entity-id":
+ (await core.Supplier.get(this._options.moniteEntityId)) != null
+ ? await core.Supplier.get(this._options.moniteEntityId)
+ : undefined,
+ "X-Fern-Language": "JavaScript",
+ "X-Fern-SDK-Name": "",
+ "X-Fern-SDK-Version": "0.1.0",
+ "X-Fern-Runtime": core.RUNTIME.type,
+ "X-Fern-Runtime-Version": core.RUNTIME.version,
+ },
+ contentType: "application/json",
+ requestType: "json",
+ timeoutMs: requestOptions?.timeoutInSeconds != null ? requestOptions.timeoutInSeconds * 1000 : 60000,
+ maxRetries: requestOptions?.maxRetries,
+ abortSignal: requestOptions?.abortSignal,
+ });
+ if (_response.ok) {
+ return _response.body as Monite.SyncRecordResource;
+ }
+
+ if (_response.error.reason === "status-code") {
+ switch (_response.error.statusCode) {
+ case 422:
+ throw new Monite.UnprocessableEntityError(_response.error.body as Monite.HttpValidationError);
+ case 500:
+ throw new Monite.InternalServerError(_response.error.body as Monite.ErrorSchemaResponse);
+ default:
+ throw new errors.MoniteError({
+ statusCode: _response.error.statusCode,
+ body: _response.error.body,
+ });
+ }
+ }
+
+ switch (_response.error.reason) {
+ case "non-json":
+ throw new errors.MoniteError({
+ statusCode: _response.error.statusCode,
+ body: _response.error.rawBody,
+ });
+ case "timeout":
+ throw new errors.MoniteTimeoutError();
+ case "unknown":
+ throw new errors.MoniteError({
+ message: _response.error.errorMessage,
+ });
+ }
+ }
+
+ /**
+ * Push object to the accounting system manually
+ *
+ * @param {string} syncedRecordId
+ * @param {SyncedRecords.RequestOptions} requestOptions - Request-specific configuration.
+ *
+ * @throws {@link Monite.UnprocessableEntityError}
+ * @throws {@link Monite.InternalServerError}
+ *
+ * @example
+ * await client.accounting.syncedRecords.pushById("synced_record_id")
+ */
+ public async pushById(
+ syncedRecordId: string,
+ requestOptions?: SyncedRecords.RequestOptions
+ ): Promise {
+ const _response = await (this._options.fetcher ?? core.fetcher)({
+ url: urlJoin(
+ (await core.Supplier.get(this._options.environment)) ?? environments.MoniteEnvironment.Sandbox,
+ `accounting_synced_records/${encodeURIComponent(syncedRecordId)}/push`
+ ),
+ method: "POST",
+ headers: {
+ Authorization: await this._getAuthorizationHeader(),
+ "x-monite-version": await core.Supplier.get(this._options.moniteVersion),
+ "x-monite-entity-id":
+ (await core.Supplier.get(this._options.moniteEntityId)) != null
+ ? await core.Supplier.get(this._options.moniteEntityId)
+ : undefined,
+ "X-Fern-Language": "JavaScript",
+ "X-Fern-SDK-Name": "",
+ "X-Fern-SDK-Version": "0.1.0",
+ "X-Fern-Runtime": core.RUNTIME.type,
+ "X-Fern-Runtime-Version": core.RUNTIME.version,
+ },
+ contentType: "application/json",
+ requestType: "json",
+ timeoutMs: requestOptions?.timeoutInSeconds != null ? requestOptions.timeoutInSeconds * 1000 : 60000,
+ maxRetries: requestOptions?.maxRetries,
+ abortSignal: requestOptions?.abortSignal,
+ });
+ if (_response.ok) {
+ return _response.body as Monite.SyncRecordResource;
+ }
+
+ if (_response.error.reason === "status-code") {
+ switch (_response.error.statusCode) {
+ case 422:
+ throw new Monite.UnprocessableEntityError(_response.error.body as Monite.HttpValidationError);
+ case 500:
+ throw new Monite.InternalServerError(_response.error.body as Monite.ErrorSchemaResponse);
+ default:
+ throw new errors.MoniteError({
+ statusCode: _response.error.statusCode,
+ body: _response.error.body,
+ });
+ }
+ }
+
+ switch (_response.error.reason) {
+ case "non-json":
+ throw new errors.MoniteError({
+ statusCode: _response.error.statusCode,
+ body: _response.error.rawBody,
+ });
+ case "timeout":
+ throw new errors.MoniteTimeoutError();
+ case "unknown":
+ throw new errors.MoniteError({
+ message: _response.error.errorMessage,
+ });
+ }
+ }
+
+ protected async _getAuthorizationHeader(): Promise {
+ const bearer = await core.Supplier.get(this._options.token);
+ if (bearer != null) {
+ return `Bearer ${bearer}`;
+ }
+
+ return undefined;
+ }
+}
diff --git a/src/api/resources/accounting/resources/syncedRecords/client/index.ts b/src/api/resources/accounting/resources/syncedRecords/client/index.ts
new file mode 100644
index 0000000..415726b
--- /dev/null
+++ b/src/api/resources/accounting/resources/syncedRecords/client/index.ts
@@ -0,0 +1 @@
+export * from "./requests";
diff --git a/src/api/resources/accounting/resources/syncedRecords/client/requests/SyncedRecordsGetRequest.ts b/src/api/resources/accounting/resources/syncedRecords/client/requests/SyncedRecordsGetRequest.ts
new file mode 100644
index 0000000..a2b3d1b
--- /dev/null
+++ b/src/api/resources/accounting/resources/syncedRecords/client/requests/SyncedRecordsGetRequest.ts
@@ -0,0 +1,41 @@
+/**
+ * This file was auto-generated by Fern from our API Definition.
+ */
+
+import * as Monite from "../../../../../../index";
+
+/**
+ * @example
+ * {
+ * object_type: "product"
+ * }
+ */
+export interface SyncedRecordsGetRequest {
+ object_type: Monite.ObjectMatchTypes;
+ /**
+ * Order by
+ */
+ order?: Monite.OrderEnum;
+ /**
+ * Max is 100
+ */
+ limit?: number;
+ /**
+ * A token, obtained from previous page. Prior over other filters
+ */
+ pagination_token?: string;
+ /**
+ * Allowed sort fields
+ */
+ sort?: Monite.SyncRecordCursorFields;
+ object_id?: string;
+ object_id__in?: string | string[];
+ created_at__gt?: string;
+ created_at__lt?: string;
+ created_at__gte?: string;
+ created_at__lte?: string;
+ updated_at__gt?: string;
+ updated_at__lt?: string;
+ updated_at__gte?: string;
+ updated_at__lte?: string;
+}
diff --git a/src/api/resources/accounting/resources/syncedRecords/client/requests/index.ts b/src/api/resources/accounting/resources/syncedRecords/client/requests/index.ts
new file mode 100644
index 0000000..8bd3725
--- /dev/null
+++ b/src/api/resources/accounting/resources/syncedRecords/client/requests/index.ts
@@ -0,0 +1 @@
+export { type SyncedRecordsGetRequest } from "./SyncedRecordsGetRequest";
diff --git a/src/api/resources/accounting/resources/syncedRecords/index.ts b/src/api/resources/accounting/resources/syncedRecords/index.ts
new file mode 100644
index 0000000..5ec7692
--- /dev/null
+++ b/src/api/resources/accounting/resources/syncedRecords/index.ts
@@ -0,0 +1 @@
+export * from "./client";
diff --git a/src/api/resources/accounting/resources/taxRates/client/Client.ts b/src/api/resources/accounting/resources/taxRates/client/Client.ts
new file mode 100644
index 0000000..34424ac
--- /dev/null
+++ b/src/api/resources/accounting/resources/taxRates/client/Client.ts
@@ -0,0 +1,214 @@
+/**
+ * This file was auto-generated by Fern from our API Definition.
+ */
+
+import * as environments from "../../../../../../environments";
+import * as core from "../../../../../../core";
+import * as Monite from "../../../../../index";
+import urlJoin from "url-join";
+import * as errors from "../../../../../../errors/index";
+
+export declare namespace TaxRates {
+ interface Options {
+ environment?: core.Supplier;
+ token?: core.Supplier;
+ /** Override the x-monite-version header */
+ moniteVersion: core.Supplier;
+ /** Override the x-monite-entity-id header */
+ moniteEntityId?: core.Supplier;
+ fetcher?: core.FetchFunction;
+ }
+
+ interface RequestOptions {
+ /** The maximum time to wait for a response in seconds. */
+ timeoutInSeconds?: number;
+ /** The number of times to retry the request. Defaults to 2. */
+ maxRetries?: number;
+ /** A hook to abort the request. */
+ abortSignal?: AbortSignal;
+ /** Override the x-monite-version header */
+ moniteVersion?: string;
+ /** Override the x-monite-entity-id header */
+ moniteEntityId?: string | undefined;
+ }
+}
+
+export class TaxRates {
+ constructor(protected readonly _options: TaxRates.Options) {}
+
+ /**
+ * Get all tax rate accounts
+ *
+ * @param {Monite.accounting.TaxRatesGetRequest} request
+ * @param {TaxRates.RequestOptions} requestOptions - Request-specific configuration.
+ *
+ * @throws {@link Monite.UnprocessableEntityError}
+ * @throws {@link Monite.InternalServerError}
+ *
+ * @example
+ * await client.accounting.taxRates.get()
+ */
+ public async get(
+ request: Monite.accounting.TaxRatesGetRequest = {},
+ requestOptions?: TaxRates.RequestOptions
+ ): Promise {
+ const { order, limit, pagination_token: paginationToken, sort } = request;
+ const _queryParams: Record = {};
+ if (order != null) {
+ _queryParams["order"] = order;
+ }
+
+ if (limit != null) {
+ _queryParams["limit"] = limit.toString();
+ }
+
+ if (paginationToken != null) {
+ _queryParams["pagination_token"] = paginationToken;
+ }
+
+ if (sort != null) {
+ _queryParams["sort"] = sort;
+ }
+
+ const _response = await (this._options.fetcher ?? core.fetcher)({
+ url: urlJoin(
+ (await core.Supplier.get(this._options.environment)) ?? environments.MoniteEnvironment.Sandbox,
+ "accounting_tax_rates"
+ ),
+ method: "GET",
+ headers: {
+ Authorization: await this._getAuthorizationHeader(),
+ "x-monite-version": await core.Supplier.get(this._options.moniteVersion),
+ "x-monite-entity-id":
+ (await core.Supplier.get(this._options.moniteEntityId)) != null
+ ? await core.Supplier.get(this._options.moniteEntityId)
+ : undefined,
+ "X-Fern-Language": "JavaScript",
+ "X-Fern-SDK-Name": "",
+ "X-Fern-SDK-Version": "0.1.0",
+ "X-Fern-Runtime": core.RUNTIME.type,
+ "X-Fern-Runtime-Version": core.RUNTIME.version,
+ },
+ contentType: "application/json",
+ queryParameters: _queryParams,
+ requestType: "json",
+ timeoutMs: requestOptions?.timeoutInSeconds != null ? requestOptions.timeoutInSeconds * 1000 : 60000,
+ maxRetries: requestOptions?.maxRetries,
+ abortSignal: requestOptions?.abortSignal,
+ });
+ if (_response.ok) {
+ return _response.body as Monite.AccountingTaxRateListResponse;
+ }
+
+ if (_response.error.reason === "status-code") {
+ switch (_response.error.statusCode) {
+ case 422:
+ throw new Monite.UnprocessableEntityError(_response.error.body as Monite.HttpValidationError);
+ case 500:
+ throw new Monite.InternalServerError(_response.error.body as Monite.ErrorSchemaResponse);
+ default:
+ throw new errors.MoniteError({
+ statusCode: _response.error.statusCode,
+ body: _response.error.body,
+ });
+ }
+ }
+
+ switch (_response.error.reason) {
+ case "non-json":
+ throw new errors.MoniteError({
+ statusCode: _response.error.statusCode,
+ body: _response.error.rawBody,
+ });
+ case "timeout":
+ throw new errors.MoniteTimeoutError();
+ case "unknown":
+ throw new errors.MoniteError({
+ message: _response.error.errorMessage,
+ });
+ }
+ }
+
+ /**
+ * Get tax rate account by id
+ *
+ * @param {string} taxRateId
+ * @param {TaxRates.RequestOptions} requestOptions - Request-specific configuration.
+ *
+ * @throws {@link Monite.UnprocessableEntityError}
+ * @throws {@link Monite.InternalServerError}
+ *
+ * @example
+ * await client.accounting.taxRates.getById("tax_rate_id")
+ */
+ public async getById(
+ taxRateId: string,
+ requestOptions?: TaxRates.RequestOptions
+ ): Promise {
+ const _response = await (this._options.fetcher ?? core.fetcher)({
+ url: urlJoin(
+ (await core.Supplier.get(this._options.environment)) ?? environments.MoniteEnvironment.Sandbox,
+ `accounting_tax_rates/${encodeURIComponent(taxRateId)}`
+ ),
+ method: "GET",
+ headers: {
+ Authorization: await this._getAuthorizationHeader(),
+ "x-monite-version": await core.Supplier.get(this._options.moniteVersion),
+ "x-monite-entity-id":
+ (await core.Supplier.get(this._options.moniteEntityId)) != null
+ ? await core.Supplier.get(this._options.moniteEntityId)
+ : undefined,
+ "X-Fern-Language": "JavaScript",
+ "X-Fern-SDK-Name": "",
+ "X-Fern-SDK-Version": "0.1.0",
+ "X-Fern-Runtime": core.RUNTIME.type,
+ "X-Fern-Runtime-Version": core.RUNTIME.version,
+ },
+ contentType: "application/json",
+ requestType: "json",
+ timeoutMs: requestOptions?.timeoutInSeconds != null ? requestOptions.timeoutInSeconds * 1000 : 60000,
+ maxRetries: requestOptions?.maxRetries,
+ abortSignal: requestOptions?.abortSignal,
+ });
+ if (_response.ok) {
+ return _response.body as Monite.AccountingTaxRateResponse;
+ }
+
+ if (_response.error.reason === "status-code") {
+ switch (_response.error.statusCode) {
+ case 422:
+ throw new Monite.UnprocessableEntityError(_response.error.body as Monite.HttpValidationError);
+ case 500:
+ throw new Monite.InternalServerError(_response.error.body as Monite.ErrorSchemaResponse);
+ default:
+ throw new errors.MoniteError({
+ statusCode: _response.error.statusCode,
+ body: _response.error.body,
+ });
+ }
+ }
+
+ switch (_response.error.reason) {
+ case "non-json":
+ throw new errors.MoniteError({
+ statusCode: _response.error.statusCode,
+ body: _response.error.rawBody,
+ });
+ case "timeout":
+ throw new errors.MoniteTimeoutError();
+ case "unknown":
+ throw new errors.MoniteError({
+ message: _response.error.errorMessage,
+ });
+ }
+ }
+
+ protected async _getAuthorizationHeader(): Promise {
+ const bearer = await core.Supplier.get(this._options.token);
+ if (bearer != null) {
+ return `Bearer ${bearer}`;
+ }
+
+ return undefined;
+ }
+}
diff --git a/src/api/resources/accounting/resources/taxRates/client/index.ts b/src/api/resources/accounting/resources/taxRates/client/index.ts
new file mode 100644
index 0000000..415726b
--- /dev/null
+++ b/src/api/resources/accounting/resources/taxRates/client/index.ts
@@ -0,0 +1 @@
+export * from "./requests";
diff --git a/src/api/resources/accounting/resources/taxRates/client/requests/TaxRatesGetRequest.ts b/src/api/resources/accounting/resources/taxRates/client/requests/TaxRatesGetRequest.ts
new file mode 100644
index 0000000..023078a
--- /dev/null
+++ b/src/api/resources/accounting/resources/taxRates/client/requests/TaxRatesGetRequest.ts
@@ -0,0 +1,28 @@
+/**
+ * This file was auto-generated by Fern from our API Definition.
+ */
+
+import * as Monite from "../../../../../../index";
+
+/**
+ * @example
+ * {}
+ */
+export interface TaxRatesGetRequest {
+ /**
+ * Order by
+ */
+ order?: Monite.OrderEnum;
+ /**
+ * Max is 100
+ */
+ limit?: number;
+ /**
+ * A token, obtained from previous page. Prior over other filters
+ */
+ pagination_token?: string;
+ /**
+ * Allowed sort fields
+ */
+ sort?: Monite.TaxRateAccountCursorFields;
+}
diff --git a/src/api/resources/accounting/resources/taxRates/client/requests/index.ts b/src/api/resources/accounting/resources/taxRates/client/requests/index.ts
new file mode 100644
index 0000000..4f12a9a
--- /dev/null
+++ b/src/api/resources/accounting/resources/taxRates/client/requests/index.ts
@@ -0,0 +1 @@
+export { type TaxRatesGetRequest } from "./TaxRatesGetRequest";
diff --git a/src/api/resources/accounting/resources/taxRates/index.ts b/src/api/resources/accounting/resources/taxRates/index.ts
new file mode 100644
index 0000000..5ec7692
--- /dev/null
+++ b/src/api/resources/accounting/resources/taxRates/index.ts
@@ -0,0 +1 @@
+export * from "./client";
diff --git a/src/api/resources/approvalPolicies/client/Client.ts b/src/api/resources/approvalPolicies/client/Client.ts
new file mode 100644
index 0000000..e566d94
--- /dev/null
+++ b/src/api/resources/approvalPolicies/client/Client.ts
@@ -0,0 +1,581 @@
+/**
+ * This file was auto-generated by Fern from our API Definition.
+ */
+
+import * as environments from "../../../../environments";
+import * as core from "../../../../core";
+import * as Monite from "../../../index";
+import urlJoin from "url-join";
+import * as errors from "../../../../errors/index";
+import { Processes } from "../resources/processes/client/Client";
+
+export declare namespace ApprovalPolicies {
+ interface Options {
+ environment?: core.Supplier;
+ token?: core.Supplier;
+ /** Override the x-monite-version header */
+ moniteVersion: core.Supplier;
+ /** Override the x-monite-entity-id header */
+ moniteEntityId?: core.Supplier;
+ fetcher?: core.FetchFunction;
+ }
+
+ interface RequestOptions {
+ /** The maximum time to wait for a response in seconds. */
+ timeoutInSeconds?: number;
+ /** The number of times to retry the request. Defaults to 2. */
+ maxRetries?: number;
+ /** A hook to abort the request. */
+ abortSignal?: AbortSignal;
+ /** Override the x-monite-version header */
+ moniteVersion?: string;
+ /** Override the x-monite-entity-id header */
+ moniteEntityId?: string | undefined;
+ }
+}
+
+export class ApprovalPolicies {
+ constructor(protected readonly _options: ApprovalPolicies.Options) {}
+
+ /**
+ * Retrieve a list of all approval policies with pagination.
+ *
+ * @param {Monite.ApprovalPoliciesGetRequest} request
+ * @param {ApprovalPolicies.RequestOptions} requestOptions - Request-specific configuration.
+ *
+ * @throws {@link Monite.UnauthorizedError}
+ * @throws {@link Monite.ConflictError}
+ * @throws {@link Monite.UnprocessableEntityError}
+ * @throws {@link Monite.InternalServerError}
+ *
+ * @example
+ * await client.approvalPolicies.get()
+ */
+ public async get(
+ request: Monite.ApprovalPoliciesGetRequest = {},
+ requestOptions?: ApprovalPolicies.RequestOptions
+ ): Promise {
+ const {
+ order,
+ limit,
+ pagination_token: paginationToken,
+ sort,
+ id__in: idIn,
+ status,
+ status__in: statusIn,
+ name,
+ name__contains: nameContains,
+ name__ncontains: nameNcontains,
+ created_by: createdBy,
+ created_at__gt: createdAtGt,
+ created_at__lt: createdAtLt,
+ created_at__gte: createdAtGte,
+ created_at__lte: createdAtLte,
+ updated_at__gt: updatedAtGt,
+ updated_at__lt: updatedAtLt,
+ updated_at__gte: updatedAtGte,
+ updated_at__lte: updatedAtLte,
+ } = request;
+ const _queryParams: Record = {};
+ if (order != null) {
+ _queryParams["order"] = order;
+ }
+
+ if (limit != null) {
+ _queryParams["limit"] = limit.toString();
+ }
+
+ if (paginationToken != null) {
+ _queryParams["pagination_token"] = paginationToken;
+ }
+
+ if (sort != null) {
+ _queryParams["sort"] = sort;
+ }
+
+ if (idIn != null) {
+ if (Array.isArray(idIn)) {
+ _queryParams["id__in"] = idIn.map((item) => item);
+ } else {
+ _queryParams["id__in"] = idIn;
+ }
+ }
+
+ if (status != null) {
+ _queryParams["status"] = status;
+ }
+
+ if (statusIn != null) {
+ if (Array.isArray(statusIn)) {
+ _queryParams["status__in"] = statusIn.map((item) => item);
+ } else {
+ _queryParams["status__in"] = statusIn;
+ }
+ }
+
+ if (name != null) {
+ _queryParams["name"] = name;
+ }
+
+ if (nameContains != null) {
+ _queryParams["name__contains"] = nameContains;
+ }
+
+ if (nameNcontains != null) {
+ _queryParams["name__ncontains"] = nameNcontains;
+ }
+
+ if (createdBy != null) {
+ _queryParams["created_by"] = createdBy;
+ }
+
+ if (createdAtGt != null) {
+ _queryParams["created_at__gt"] = createdAtGt;
+ }
+
+ if (createdAtLt != null) {
+ _queryParams["created_at__lt"] = createdAtLt;
+ }
+
+ if (createdAtGte != null) {
+ _queryParams["created_at__gte"] = createdAtGte;
+ }
+
+ if (createdAtLte != null) {
+ _queryParams["created_at__lte"] = createdAtLte;
+ }
+
+ if (updatedAtGt != null) {
+ _queryParams["updated_at__gt"] = updatedAtGt;
+ }
+
+ if (updatedAtLt != null) {
+ _queryParams["updated_at__lt"] = updatedAtLt;
+ }
+
+ if (updatedAtGte != null) {
+ _queryParams["updated_at__gte"] = updatedAtGte;
+ }
+
+ if (updatedAtLte != null) {
+ _queryParams["updated_at__lte"] = updatedAtLte;
+ }
+
+ const _response = await (this._options.fetcher ?? core.fetcher)({
+ url: urlJoin(
+ (await core.Supplier.get(this._options.environment)) ?? environments.MoniteEnvironment.Sandbox,
+ "approval_policies"
+ ),
+ method: "GET",
+ headers: {
+ Authorization: await this._getAuthorizationHeader(),
+ "x-monite-version": await core.Supplier.get(this._options.moniteVersion),
+ "x-monite-entity-id":
+ (await core.Supplier.get(this._options.moniteEntityId)) != null
+ ? await core.Supplier.get(this._options.moniteEntityId)
+ : undefined,
+ "X-Fern-Language": "JavaScript",
+ "X-Fern-SDK-Name": "",
+ "X-Fern-SDK-Version": "0.1.0",
+ "X-Fern-Runtime": core.RUNTIME.type,
+ "X-Fern-Runtime-Version": core.RUNTIME.version,
+ },
+ contentType: "application/json",
+ queryParameters: _queryParams,
+ requestType: "json",
+ timeoutMs: requestOptions?.timeoutInSeconds != null ? requestOptions.timeoutInSeconds * 1000 : 60000,
+ maxRetries: requestOptions?.maxRetries,
+ abortSignal: requestOptions?.abortSignal,
+ });
+ if (_response.ok) {
+ return _response.body as Monite.ApprovalPolicyResourceList;
+ }
+
+ if (_response.error.reason === "status-code") {
+ switch (_response.error.statusCode) {
+ case 401:
+ throw new Monite.UnauthorizedError(_response.error.body as Monite.ErrorSchemaResponse);
+ case 409:
+ throw new Monite.ConflictError(_response.error.body as Monite.ErrorSchemaResponse);
+ case 422:
+ throw new Monite.UnprocessableEntityError(_response.error.body as Monite.HttpValidationError);
+ case 500:
+ throw new Monite.InternalServerError(_response.error.body as Monite.ErrorSchemaResponse);
+ default:
+ throw new errors.MoniteError({
+ statusCode: _response.error.statusCode,
+ body: _response.error.body,
+ });
+ }
+ }
+
+ switch (_response.error.reason) {
+ case "non-json":
+ throw new errors.MoniteError({
+ statusCode: _response.error.statusCode,
+ body: _response.error.rawBody,
+ });
+ case "timeout":
+ throw new errors.MoniteTimeoutError();
+ case "unknown":
+ throw new errors.MoniteError({
+ message: _response.error.errorMessage,
+ });
+ }
+ }
+
+ /**
+ * Create a new approval policy.
+ *
+ * @param {Monite.ApprovalPolicyCreate} request
+ * @param {ApprovalPolicies.RequestOptions} requestOptions - Request-specific configuration.
+ *
+ * @throws {@link Monite.BadRequestError}
+ * @throws {@link Monite.UnauthorizedError}
+ * @throws {@link Monite.ConflictError}
+ * @throws {@link Monite.UnprocessableEntityError}
+ * @throws {@link Monite.InternalServerError}
+ *
+ * @example
+ * await client.approvalPolicies.create({
+ * name: "name",
+ * description: "description",
+ * script: [true]
+ * })
+ */
+ public async create(
+ request: Monite.ApprovalPolicyCreate,
+ requestOptions?: ApprovalPolicies.RequestOptions
+ ): Promise {
+ const _response = await (this._options.fetcher ?? core.fetcher)({
+ url: urlJoin(
+ (await core.Supplier.get(this._options.environment)) ?? environments.MoniteEnvironment.Sandbox,
+ "approval_policies"
+ ),
+ method: "POST",
+ headers: {
+ Authorization: await this._getAuthorizationHeader(),
+ "x-monite-version": await core.Supplier.get(this._options.moniteVersion),
+ "x-monite-entity-id":
+ (await core.Supplier.get(this._options.moniteEntityId)) != null
+ ? await core.Supplier.get(this._options.moniteEntityId)
+ : undefined,
+ "X-Fern-Language": "JavaScript",
+ "X-Fern-SDK-Name": "",
+ "X-Fern-SDK-Version": "0.1.0",
+ "X-Fern-Runtime": core.RUNTIME.type,
+ "X-Fern-Runtime-Version": core.RUNTIME.version,
+ },
+ contentType: "application/json",
+ requestType: "json",
+ body: request,
+ timeoutMs: requestOptions?.timeoutInSeconds != null ? requestOptions.timeoutInSeconds * 1000 : 60000,
+ maxRetries: requestOptions?.maxRetries,
+ abortSignal: requestOptions?.abortSignal,
+ });
+ if (_response.ok) {
+ return _response.body as Monite.ApprovalPolicyResource;
+ }
+
+ if (_response.error.reason === "status-code") {
+ switch (_response.error.statusCode) {
+ case 400:
+ throw new Monite.BadRequestError(_response.error.body as Monite.ErrorSchemaResponse);
+ case 401:
+ throw new Monite.UnauthorizedError(_response.error.body as Monite.ErrorSchemaResponse);
+ case 409:
+ throw new Monite.ConflictError(_response.error.body as Monite.ErrorSchemaResponse);
+ case 422:
+ throw new Monite.UnprocessableEntityError(_response.error.body as Monite.HttpValidationError);
+ case 500:
+ throw new Monite.InternalServerError(_response.error.body as Monite.ErrorSchemaResponse);
+ default:
+ throw new errors.MoniteError({
+ statusCode: _response.error.statusCode,
+ body: _response.error.body,
+ });
+ }
+ }
+
+ switch (_response.error.reason) {
+ case "non-json":
+ throw new errors.MoniteError({
+ statusCode: _response.error.statusCode,
+ body: _response.error.rawBody,
+ });
+ case "timeout":
+ throw new errors.MoniteTimeoutError();
+ case "unknown":
+ throw new errors.MoniteError({
+ message: _response.error.errorMessage,
+ });
+ }
+ }
+
+ /**
+ * Retrieve a specific approval policy.
+ *
+ * @param {string} approvalPolicyId
+ * @param {ApprovalPolicies.RequestOptions} requestOptions - Request-specific configuration.
+ *
+ * @throws {@link Monite.UnauthorizedError}
+ * @throws {@link Monite.NotFoundError}
+ * @throws {@link Monite.ConflictError}
+ * @throws {@link Monite.UnprocessableEntityError}
+ * @throws {@link Monite.InternalServerError}
+ *
+ * @example
+ * await client.approvalPolicies.getById("approval_policy_id")
+ */
+ public async getById(
+ approvalPolicyId: string,
+ requestOptions?: ApprovalPolicies.RequestOptions
+ ): Promise {
+ const _response = await (this._options.fetcher ?? core.fetcher)({
+ url: urlJoin(
+ (await core.Supplier.get(this._options.environment)) ?? environments.MoniteEnvironment.Sandbox,
+ `approval_policies/${encodeURIComponent(approvalPolicyId)}`
+ ),
+ method: "GET",
+ headers: {
+ Authorization: await this._getAuthorizationHeader(),
+ "x-monite-version": await core.Supplier.get(this._options.moniteVersion),
+ "x-monite-entity-id":
+ (await core.Supplier.get(this._options.moniteEntityId)) != null
+ ? await core.Supplier.get(this._options.moniteEntityId)
+ : undefined,
+ "X-Fern-Language": "JavaScript",
+ "X-Fern-SDK-Name": "",
+ "X-Fern-SDK-Version": "0.1.0",
+ "X-Fern-Runtime": core.RUNTIME.type,
+ "X-Fern-Runtime-Version": core.RUNTIME.version,
+ },
+ contentType: "application/json",
+ requestType: "json",
+ timeoutMs: requestOptions?.timeoutInSeconds != null ? requestOptions.timeoutInSeconds * 1000 : 60000,
+ maxRetries: requestOptions?.maxRetries,
+ abortSignal: requestOptions?.abortSignal,
+ });
+ if (_response.ok) {
+ return _response.body as Monite.ApprovalPolicyResource;
+ }
+
+ if (_response.error.reason === "status-code") {
+ switch (_response.error.statusCode) {
+ case 401:
+ throw new Monite.UnauthorizedError(_response.error.body as Monite.ErrorSchemaResponse);
+ case 404:
+ throw new Monite.NotFoundError(_response.error.body as Monite.ErrorSchemaResponse);
+ case 409:
+ throw new Monite.ConflictError(_response.error.body as Monite.ErrorSchemaResponse);
+ case 422:
+ throw new Monite.UnprocessableEntityError(_response.error.body as Monite.HttpValidationError);
+ case 500:
+ throw new Monite.InternalServerError(_response.error.body as Monite.ErrorSchemaResponse);
+ default:
+ throw new errors.MoniteError({
+ statusCode: _response.error.statusCode,
+ body: _response.error.body,
+ });
+ }
+ }
+
+ switch (_response.error.reason) {
+ case "non-json":
+ throw new errors.MoniteError({
+ statusCode: _response.error.statusCode,
+ body: _response.error.rawBody,
+ });
+ case "timeout":
+ throw new errors.MoniteTimeoutError();
+ case "unknown":
+ throw new errors.MoniteError({
+ message: _response.error.errorMessage,
+ });
+ }
+ }
+
+ /**
+ * Delete an existing approval policy.
+ *
+ * @param {string} approvalPolicyId
+ * @param {ApprovalPolicies.RequestOptions} requestOptions - Request-specific configuration.
+ *
+ * @throws {@link Monite.UnauthorizedError}
+ * @throws {@link Monite.NotFoundError}
+ * @throws {@link Monite.ConflictError}
+ * @throws {@link Monite.UnprocessableEntityError}
+ * @throws {@link Monite.InternalServerError}
+ *
+ * @example
+ * await client.approvalPolicies.deleteById("approval_policy_id")
+ */
+ public async deleteById(approvalPolicyId: string, requestOptions?: ApprovalPolicies.RequestOptions): Promise {
+ const _response = await (this._options.fetcher ?? core.fetcher)({
+ url: urlJoin(
+ (await core.Supplier.get(this._options.environment)) ?? environments.MoniteEnvironment.Sandbox,
+ `approval_policies/${encodeURIComponent(approvalPolicyId)}`
+ ),
+ method: "DELETE",
+ headers: {
+ Authorization: await this._getAuthorizationHeader(),
+ "x-monite-version": await core.Supplier.get(this._options.moniteVersion),
+ "x-monite-entity-id":
+ (await core.Supplier.get(this._options.moniteEntityId)) != null
+ ? await core.Supplier.get(this._options.moniteEntityId)
+ : undefined,
+ "X-Fern-Language": "JavaScript",
+ "X-Fern-SDK-Name": "",
+ "X-Fern-SDK-Version": "0.1.0",
+ "X-Fern-Runtime": core.RUNTIME.type,
+ "X-Fern-Runtime-Version": core.RUNTIME.version,
+ },
+ contentType: "application/json",
+ requestType: "json",
+ timeoutMs: requestOptions?.timeoutInSeconds != null ? requestOptions.timeoutInSeconds * 1000 : 60000,
+ maxRetries: requestOptions?.maxRetries,
+ abortSignal: requestOptions?.abortSignal,
+ });
+ if (_response.ok) {
+ return;
+ }
+
+ if (_response.error.reason === "status-code") {
+ switch (_response.error.statusCode) {
+ case 401:
+ throw new Monite.UnauthorizedError(_response.error.body as Monite.ErrorSchemaResponse);
+ case 404:
+ throw new Monite.NotFoundError(_response.error.body as Monite.ErrorSchemaResponse);
+ case 409:
+ throw new Monite.ConflictError(_response.error.body as Monite.ErrorSchemaResponse);
+ case 422:
+ throw new Monite.UnprocessableEntityError(_response.error.body as Monite.HttpValidationError);
+ case 500:
+ throw new Monite.InternalServerError(_response.error.body as Monite.ErrorSchemaResponse);
+ default:
+ throw new errors.MoniteError({
+ statusCode: _response.error.statusCode,
+ body: _response.error.body,
+ });
+ }
+ }
+
+ switch (_response.error.reason) {
+ case "non-json":
+ throw new errors.MoniteError({
+ statusCode: _response.error.statusCode,
+ body: _response.error.rawBody,
+ });
+ case "timeout":
+ throw new errors.MoniteTimeoutError();
+ case "unknown":
+ throw new errors.MoniteError({
+ message: _response.error.errorMessage,
+ });
+ }
+ }
+
+ /**
+ * Update an existing approval policy.
+ *
+ * @param {string} approvalPolicyId
+ * @param {Monite.ApprovalPolicyUpdate} request
+ * @param {ApprovalPolicies.RequestOptions} requestOptions - Request-specific configuration.
+ *
+ * @throws {@link Monite.BadRequestError}
+ * @throws {@link Monite.UnauthorizedError}
+ * @throws {@link Monite.NotFoundError}
+ * @throws {@link Monite.ConflictError}
+ * @throws {@link Monite.UnprocessableEntityError}
+ * @throws {@link Monite.InternalServerError}
+ *
+ * @example
+ * await client.approvalPolicies.updateById("approval_policy_id")
+ */
+ public async updateById(
+ approvalPolicyId: string,
+ request: Monite.ApprovalPolicyUpdate = {},
+ requestOptions?: ApprovalPolicies.RequestOptions
+ ): Promise {
+ const _response = await (this._options.fetcher ?? core.fetcher)({
+ url: urlJoin(
+ (await core.Supplier.get(this._options.environment)) ?? environments.MoniteEnvironment.Sandbox,
+ `approval_policies/${encodeURIComponent(approvalPolicyId)}`
+ ),
+ method: "PATCH",
+ headers: {
+ Authorization: await this._getAuthorizationHeader(),
+ "x-monite-version": await core.Supplier.get(this._options.moniteVersion),
+ "x-monite-entity-id":
+ (await core.Supplier.get(this._options.moniteEntityId)) != null
+ ? await core.Supplier.get(this._options.moniteEntityId)
+ : undefined,
+ "X-Fern-Language": "JavaScript",
+ "X-Fern-SDK-Name": "",
+ "X-Fern-SDK-Version": "0.1.0",
+ "X-Fern-Runtime": core.RUNTIME.type,
+ "X-Fern-Runtime-Version": core.RUNTIME.version,
+ },
+ contentType: "application/json",
+ requestType: "json",
+ body: request,
+ timeoutMs: requestOptions?.timeoutInSeconds != null ? requestOptions.timeoutInSeconds * 1000 : 60000,
+ maxRetries: requestOptions?.maxRetries,
+ abortSignal: requestOptions?.abortSignal,
+ });
+ if (_response.ok) {
+ return _response.body as Monite.ApprovalPolicyResource;
+ }
+
+ if (_response.error.reason === "status-code") {
+ switch (_response.error.statusCode) {
+ case 400:
+ throw new Monite.BadRequestError(_response.error.body as Monite.ErrorSchemaResponse);
+ case 401:
+ throw new Monite.UnauthorizedError(_response.error.body as Monite.ErrorSchemaResponse);
+ case 404:
+ throw new Monite.NotFoundError(_response.error.body as Monite.ErrorSchemaResponse);
+ case 409:
+ throw new Monite.ConflictError(_response.error.body as Monite.ErrorSchemaResponse);
+ case 422:
+ throw new Monite.UnprocessableEntityError(_response.error.body as Monite.HttpValidationError);
+ case 500:
+ throw new Monite.InternalServerError(_response.error.body as Monite.ErrorSchemaResponse);
+ default:
+ throw new errors.MoniteError({
+ statusCode: _response.error.statusCode,
+ body: _response.error.body,
+ });
+ }
+ }
+
+ switch (_response.error.reason) {
+ case "non-json":
+ throw new errors.MoniteError({
+ statusCode: _response.error.statusCode,
+ body: _response.error.rawBody,
+ });
+ case "timeout":
+ throw new errors.MoniteTimeoutError();
+ case "unknown":
+ throw new errors.MoniteError({
+ message: _response.error.errorMessage,
+ });
+ }
+ }
+
+ protected _processes: Processes | undefined;
+
+ public get processes(): Processes {
+ return (this._processes ??= new Processes(this._options));
+ }
+
+ protected async _getAuthorizationHeader(): Promise {
+ const bearer = await core.Supplier.get(this._options.token);
+ if (bearer != null) {
+ return `Bearer ${bearer}`;
+ }
+
+ return undefined;
+ }
+}
diff --git a/src/api/resources/approvalPolicies/client/index.ts b/src/api/resources/approvalPolicies/client/index.ts
new file mode 100644
index 0000000..415726b
--- /dev/null
+++ b/src/api/resources/approvalPolicies/client/index.ts
@@ -0,0 +1 @@
+export * from "./requests";
diff --git a/src/api/resources/approvalPolicies/client/requests/ApprovalPoliciesGetRequest.ts b/src/api/resources/approvalPolicies/client/requests/ApprovalPoliciesGetRequest.ts
new file mode 100644
index 0000000..68319e0
--- /dev/null
+++ b/src/api/resources/approvalPolicies/client/requests/ApprovalPoliciesGetRequest.ts
@@ -0,0 +1,43 @@
+/**
+ * This file was auto-generated by Fern from our API Definition.
+ */
+
+import * as Monite from "../../../../index";
+
+/**
+ * @example
+ * {}
+ */
+export interface ApprovalPoliciesGetRequest {
+ /**
+ * Order by
+ */
+ order?: Monite.OrderEnum;
+ /**
+ * Max is 100
+ */
+ limit?: number;
+ /**
+ * A token, obtained from previous page. Prior over other filters
+ */
+ pagination_token?: string;
+ /**
+ * Allowed sort fields
+ */
+ sort?: Monite.ApprovalPolicyCursorFields;
+ id__in?: string | string[];
+ status?: Monite.ApprovalPoliciesGetRequestStatus;
+ status__in?: Monite.ApprovalPoliciesGetRequestStatusInItem | Monite.ApprovalPoliciesGetRequestStatusInItem[];
+ name?: string;
+ name__contains?: string;
+ name__ncontains?: string;
+ created_by?: string;
+ created_at__gt?: string;
+ created_at__lt?: string;
+ created_at__gte?: string;
+ created_at__lte?: string;
+ updated_at__gt?: string;
+ updated_at__lt?: string;
+ updated_at__gte?: string;
+ updated_at__lte?: string;
+}
diff --git a/src/api/resources/approvalPolicies/client/requests/ApprovalPolicyCreate.ts b/src/api/resources/approvalPolicies/client/requests/ApprovalPolicyCreate.ts
new file mode 100644
index 0000000..160a355
--- /dev/null
+++ b/src/api/resources/approvalPolicies/client/requests/ApprovalPolicyCreate.ts
@@ -0,0 +1,24 @@
+/**
+ * This file was auto-generated by Fern from our API Definition.
+ */
+
+import * as Monite from "../../../../index";
+
+/**
+ * @example
+ * {
+ * name: "name",
+ * description: "description",
+ * script: [true]
+ * }
+ */
+export interface ApprovalPolicyCreate {
+ /** The name of the approval policy. */
+ name: string;
+ /** A brief description of the approval policy. */
+ description: string;
+ /** A list of JSON objects that represents the approval policy script. The script contains the logic that determines whether an action should be sent to approval. This field is required, and it should contain at least one script object. */
+ script: Monite.ApprovalPolicyCreateScriptItem[];
+ /** A JSON object that represents the trigger for the approval policy. The trigger specifies the event that will trigger the policy to be evaluated. */
+ trigger?: Monite.ApprovalPolicyCreateTrigger;
+}
diff --git a/src/api/resources/approvalPolicies/client/requests/ApprovalPolicyUpdate.ts b/src/api/resources/approvalPolicies/client/requests/ApprovalPolicyUpdate.ts
new file mode 100644
index 0000000..47ab434
--- /dev/null
+++ b/src/api/resources/approvalPolicies/client/requests/ApprovalPolicyUpdate.ts
@@ -0,0 +1,22 @@
+/**
+ * This file was auto-generated by Fern from our API Definition.
+ */
+
+import * as Monite from "../../../../index";
+
+/**
+ * @example
+ * {}
+ */
+export interface ApprovalPolicyUpdate {
+ /** The name of the approval policy. */
+ name?: string;
+ /** A brief description of the approval policy. */
+ description?: string;
+ /** A list of JSON objects that represents the approval policy script. The script contains the logic that determines whether an action should be sent to approval. This field is required, and it should contain at least one script object. */
+ script?: Monite.ApprovalPolicyUpdateScriptItem[];
+ /** A JSON object that represents the trigger for the approval policy. The trigger specifies the event that will trigger the policy to be evaluated. */
+ trigger?: Monite.ApprovalPolicyUpdateTrigger;
+ /** A string that represents the current status of the approval policy. */
+ status?: Monite.ApprovalPolicyStatus;
+}
diff --git a/src/api/resources/approvalPolicies/client/requests/index.ts b/src/api/resources/approvalPolicies/client/requests/index.ts
new file mode 100644
index 0000000..ea52561
--- /dev/null
+++ b/src/api/resources/approvalPolicies/client/requests/index.ts
@@ -0,0 +1,3 @@
+export { type ApprovalPoliciesGetRequest } from "./ApprovalPoliciesGetRequest";
+export { type ApprovalPolicyCreate } from "./ApprovalPolicyCreate";
+export { type ApprovalPolicyUpdate } from "./ApprovalPolicyUpdate";
diff --git a/src/api/resources/approvalPolicies/index.ts b/src/api/resources/approvalPolicies/index.ts
new file mode 100644
index 0000000..848e75a
--- /dev/null
+++ b/src/api/resources/approvalPolicies/index.ts
@@ -0,0 +1,3 @@
+export * from "./types";
+export * from "./client";
+export * from "./resources";
diff --git a/src/api/resources/approvalPolicies/resources/index.ts b/src/api/resources/approvalPolicies/resources/index.ts
new file mode 100644
index 0000000..148fe85
--- /dev/null
+++ b/src/api/resources/approvalPolicies/resources/index.ts
@@ -0,0 +1 @@
+export * as processes from "./processes";
diff --git a/src/api/resources/approvalPolicies/resources/processes/client/Client.ts b/src/api/resources/approvalPolicies/resources/processes/client/Client.ts
new file mode 100644
index 0000000..ae2209b
--- /dev/null
+++ b/src/api/resources/approvalPolicies/resources/processes/client/Client.ts
@@ -0,0 +1,389 @@
+/**
+ * This file was auto-generated by Fern from our API Definition.
+ */
+
+import * as environments from "../../../../../../environments";
+import * as core from "../../../../../../core";
+import * as Monite from "../../../../../index";
+import urlJoin from "url-join";
+import * as errors from "../../../../../../errors/index";
+
+export declare namespace Processes {
+ interface Options {
+ environment?: core.Supplier;
+ token?: core.Supplier;
+ /** Override the x-monite-version header */
+ moniteVersion: core.Supplier;
+ /** Override the x-monite-entity-id header */
+ moniteEntityId?: core.Supplier;
+ fetcher?: core.FetchFunction;
+ }
+
+ interface RequestOptions {
+ /** The maximum time to wait for a response in seconds. */
+ timeoutInSeconds?: number;
+ /** The number of times to retry the request. Defaults to 2. */
+ maxRetries?: number;
+ /** A hook to abort the request. */
+ abortSignal?: AbortSignal;
+ /** Override the x-monite-version header */
+ moniteVersion?: string;
+ /** Override the x-monite-entity-id header */
+ moniteEntityId?: string | undefined;
+ }
+}
+
+export class Processes {
+ constructor(protected readonly _options: Processes.Options) {}
+
+ /**
+ * Retrieve a list of all approval policy processes.
+ *
+ * @param {string} approvalPolicyId
+ * @param {Processes.RequestOptions} requestOptions - Request-specific configuration.
+ *
+ * @throws {@link Monite.UnauthorizedError}
+ * @throws {@link Monite.NotFoundError}
+ * @throws {@link Monite.ConflictError}
+ * @throws {@link Monite.UnprocessableEntityError}
+ * @throws {@link Monite.InternalServerError}
+ *
+ * @example
+ * await client.approvalPolicies.processes.get("approval_policy_id")
+ */
+ public async get(
+ approvalPolicyId: string,
+ requestOptions?: Processes.RequestOptions
+ ): Promise {
+ const _response = await (this._options.fetcher ?? core.fetcher)({
+ url: urlJoin(
+ (await core.Supplier.get(this._options.environment)) ?? environments.MoniteEnvironment.Sandbox,
+ `approval_policies/${encodeURIComponent(approvalPolicyId)}/processes`
+ ),
+ method: "GET",
+ headers: {
+ Authorization: await this._getAuthorizationHeader(),
+ "x-monite-version": await core.Supplier.get(this._options.moniteVersion),
+ "x-monite-entity-id":
+ (await core.Supplier.get(this._options.moniteEntityId)) != null
+ ? await core.Supplier.get(this._options.moniteEntityId)
+ : undefined,
+ "X-Fern-Language": "JavaScript",
+ "X-Fern-SDK-Name": "",
+ "X-Fern-SDK-Version": "0.1.0",
+ "X-Fern-Runtime": core.RUNTIME.type,
+ "X-Fern-Runtime-Version": core.RUNTIME.version,
+ },
+ contentType: "application/json",
+ requestType: "json",
+ timeoutMs: requestOptions?.timeoutInSeconds != null ? requestOptions.timeoutInSeconds * 1000 : 60000,
+ maxRetries: requestOptions?.maxRetries,
+ abortSignal: requestOptions?.abortSignal,
+ });
+ if (_response.ok) {
+ return _response.body as Monite.ApprovalProcessResourceList;
+ }
+
+ if (_response.error.reason === "status-code") {
+ switch (_response.error.statusCode) {
+ case 401:
+ throw new Monite.UnauthorizedError(_response.error.body as Monite.ErrorSchemaResponse);
+ case 404:
+ throw new Monite.NotFoundError(_response.error.body as Monite.ErrorSchemaResponse);
+ case 409:
+ throw new Monite.ConflictError(_response.error.body as Monite.ErrorSchemaResponse);
+ case 422:
+ throw new Monite.UnprocessableEntityError(_response.error.body as Monite.HttpValidationError);
+ case 500:
+ throw new Monite.InternalServerError(_response.error.body as Monite.ErrorSchemaResponse);
+ default:
+ throw new errors.MoniteError({
+ statusCode: _response.error.statusCode,
+ body: _response.error.body,
+ });
+ }
+ }
+
+ switch (_response.error.reason) {
+ case "non-json":
+ throw new errors.MoniteError({
+ statusCode: _response.error.statusCode,
+ body: _response.error.rawBody,
+ });
+ case "timeout":
+ throw new errors.MoniteTimeoutError();
+ case "unknown":
+ throw new errors.MoniteError({
+ message: _response.error.errorMessage,
+ });
+ }
+ }
+
+ /**
+ * Retrieve a specific approval policy process.
+ *
+ * @param {string} approvalPolicyId
+ * @param {string} processId
+ * @param {Processes.RequestOptions} requestOptions - Request-specific configuration.
+ *
+ * @throws {@link Monite.UnauthorizedError}
+ * @throws {@link Monite.NotFoundError}
+ * @throws {@link Monite.ConflictError}
+ * @throws {@link Monite.UnprocessableEntityError}
+ * @throws {@link Monite.InternalServerError}
+ *
+ * @example
+ * await client.approvalPolicies.processes.getById("approval_policy_id", "process_id")
+ */
+ public async getById(
+ approvalPolicyId: string,
+ processId: string,
+ requestOptions?: Processes.RequestOptions
+ ): Promise {
+ const _response = await (this._options.fetcher ?? core.fetcher)({
+ url: urlJoin(
+ (await core.Supplier.get(this._options.environment)) ?? environments.MoniteEnvironment.Sandbox,
+ `approval_policies/${encodeURIComponent(approvalPolicyId)}/processes/${encodeURIComponent(processId)}`
+ ),
+ method: "GET",
+ headers: {
+ Authorization: await this._getAuthorizationHeader(),
+ "x-monite-version": await core.Supplier.get(this._options.moniteVersion),
+ "x-monite-entity-id":
+ (await core.Supplier.get(this._options.moniteEntityId)) != null
+ ? await core.Supplier.get(this._options.moniteEntityId)
+ : undefined,
+ "X-Fern-Language": "JavaScript",
+ "X-Fern-SDK-Name": "",
+ "X-Fern-SDK-Version": "0.1.0",
+ "X-Fern-Runtime": core.RUNTIME.type,
+ "X-Fern-Runtime-Version": core.RUNTIME.version,
+ },
+ contentType: "application/json",
+ requestType: "json",
+ timeoutMs: requestOptions?.timeoutInSeconds != null ? requestOptions.timeoutInSeconds * 1000 : 60000,
+ maxRetries: requestOptions?.maxRetries,
+ abortSignal: requestOptions?.abortSignal,
+ });
+ if (_response.ok) {
+ return _response.body as Monite.ProcessResource;
+ }
+
+ if (_response.error.reason === "status-code") {
+ switch (_response.error.statusCode) {
+ case 401:
+ throw new Monite.UnauthorizedError(_response.error.body as Monite.ErrorSchemaResponse);
+ case 404:
+ throw new Monite.NotFoundError(_response.error.body as Monite.ErrorSchemaResponse);
+ case 409:
+ throw new Monite.ConflictError(_response.error.body as Monite.ErrorSchemaResponse);
+ case 422:
+ throw new Monite.UnprocessableEntityError(_response.error.body as Monite.HttpValidationError);
+ case 500:
+ throw new Monite.InternalServerError(_response.error.body as Monite.ErrorSchemaResponse);
+ default:
+ throw new errors.MoniteError({
+ statusCode: _response.error.statusCode,
+ body: _response.error.body,
+ });
+ }
+ }
+
+ switch (_response.error.reason) {
+ case "non-json":
+ throw new errors.MoniteError({
+ statusCode: _response.error.statusCode,
+ body: _response.error.rawBody,
+ });
+ case "timeout":
+ throw new errors.MoniteTimeoutError();
+ case "unknown":
+ throw new errors.MoniteError({
+ message: _response.error.errorMessage,
+ });
+ }
+ }
+
+ /**
+ * Cancel an ongoing approval process for a specific approval policy.
+ *
+ * @param {string} approvalPolicyId
+ * @param {string} processId
+ * @param {Processes.RequestOptions} requestOptions - Request-specific configuration.
+ *
+ * @throws {@link Monite.UnauthorizedError}
+ * @throws {@link Monite.NotFoundError}
+ * @throws {@link Monite.ConflictError}
+ * @throws {@link Monite.UnprocessableEntityError}
+ * @throws {@link Monite.InternalServerError}
+ *
+ * @example
+ * await client.approvalPolicies.processes.cancelById("approval_policy_id", "process_id")
+ */
+ public async cancelById(
+ approvalPolicyId: string,
+ processId: string,
+ requestOptions?: Processes.RequestOptions
+ ): Promise {
+ const _response = await (this._options.fetcher ?? core.fetcher)({
+ url: urlJoin(
+ (await core.Supplier.get(this._options.environment)) ?? environments.MoniteEnvironment.Sandbox,
+ `approval_policies/${encodeURIComponent(approvalPolicyId)}/processes/${encodeURIComponent(
+ processId
+ )}/cancel`
+ ),
+ method: "POST",
+ headers: {
+ Authorization: await this._getAuthorizationHeader(),
+ "x-monite-version": await core.Supplier.get(this._options.moniteVersion),
+ "x-monite-entity-id":
+ (await core.Supplier.get(this._options.moniteEntityId)) != null
+ ? await core.Supplier.get(this._options.moniteEntityId)
+ : undefined,
+ "X-Fern-Language": "JavaScript",
+ "X-Fern-SDK-Name": "",
+ "X-Fern-SDK-Version": "0.1.0",
+ "X-Fern-Runtime": core.RUNTIME.type,
+ "X-Fern-Runtime-Version": core.RUNTIME.version,
+ },
+ contentType: "application/json",
+ requestType: "json",
+ timeoutMs: requestOptions?.timeoutInSeconds != null ? requestOptions.timeoutInSeconds * 1000 : 60000,
+ maxRetries: requestOptions?.maxRetries,
+ abortSignal: requestOptions?.abortSignal,
+ });
+ if (_response.ok) {
+ return _response.body as Monite.ProcessResource;
+ }
+
+ if (_response.error.reason === "status-code") {
+ switch (_response.error.statusCode) {
+ case 401:
+ throw new Monite.UnauthorizedError(_response.error.body as Monite.ErrorSchemaResponse);
+ case 404:
+ throw new Monite.NotFoundError(_response.error.body as Monite.ErrorSchemaResponse);
+ case 409:
+ throw new Monite.ConflictError(_response.error.body as Monite.ErrorSchemaResponse);
+ case 422:
+ throw new Monite.UnprocessableEntityError(_response.error.body as Monite.HttpValidationError);
+ case 500:
+ throw new Monite.InternalServerError(_response.error.body as Monite.ErrorSchemaResponse);
+ default:
+ throw new errors.MoniteError({
+ statusCode: _response.error.statusCode,
+ body: _response.error.body,
+ });
+ }
+ }
+
+ switch (_response.error.reason) {
+ case "non-json":
+ throw new errors.MoniteError({
+ statusCode: _response.error.statusCode,
+ body: _response.error.rawBody,
+ });
+ case "timeout":
+ throw new errors.MoniteTimeoutError();
+ case "unknown":
+ throw new errors.MoniteError({
+ message: _response.error.errorMessage,
+ });
+ }
+ }
+
+ /**
+ * Retrieve a list of approval policy process steps.
+ *
+ * @param {string} approvalPolicyId
+ * @param {string} processId
+ * @param {Processes.RequestOptions} requestOptions - Request-specific configuration.
+ *
+ * @throws {@link Monite.UnauthorizedError}
+ * @throws {@link Monite.NotFoundError}
+ * @throws {@link Monite.ConflictError}
+ * @throws {@link Monite.UnprocessableEntityError}
+ * @throws {@link Monite.InternalServerError}
+ *
+ * @example
+ * await client.approvalPolicies.processes.getSteps("approval_policy_id", "process_id")
+ */
+ public async getSteps(
+ approvalPolicyId: string,
+ processId: string,
+ requestOptions?: Processes.RequestOptions
+ ): Promise {
+ const _response = await (this._options.fetcher ?? core.fetcher)({
+ url: urlJoin(
+ (await core.Supplier.get(this._options.environment)) ?? environments.MoniteEnvironment.Sandbox,
+ `approval_policies/${encodeURIComponent(approvalPolicyId)}/processes/${encodeURIComponent(
+ processId
+ )}/steps`
+ ),
+ method: "GET",
+ headers: {
+ Authorization: await this._getAuthorizationHeader(),
+ "x-monite-version": await core.Supplier.get(this._options.moniteVersion),
+ "x-monite-entity-id":
+ (await core.Supplier.get(this._options.moniteEntityId)) != null
+ ? await core.Supplier.get(this._options.moniteEntityId)
+ : undefined,
+ "X-Fern-Language": "JavaScript",
+ "X-Fern-SDK-Name": "",
+ "X-Fern-SDK-Version": "0.1.0",
+ "X-Fern-Runtime": core.RUNTIME.type,
+ "X-Fern-Runtime-Version": core.RUNTIME.version,
+ },
+ contentType: "application/json",
+ requestType: "json",
+ timeoutMs: requestOptions?.timeoutInSeconds != null ? requestOptions.timeoutInSeconds * 1000 : 60000,
+ maxRetries: requestOptions?.maxRetries,
+ abortSignal: requestOptions?.abortSignal,
+ });
+ if (_response.ok) {
+ return _response.body as Monite.ApprovalProcessStepResourceList;
+ }
+
+ if (_response.error.reason === "status-code") {
+ switch (_response.error.statusCode) {
+ case 401:
+ throw new Monite.UnauthorizedError(_response.error.body as Monite.ErrorSchemaResponse);
+ case 404:
+ throw new Monite.NotFoundError(_response.error.body as Monite.ErrorSchemaResponse);
+ case 409:
+ throw new Monite.ConflictError(_response.error.body as Monite.ErrorSchemaResponse);
+ case 422:
+ throw new Monite.UnprocessableEntityError(_response.error.body as Monite.HttpValidationError);
+ case 500:
+ throw new Monite.InternalServerError(_response.error.body as Monite.ErrorSchemaResponse);
+ default:
+ throw new errors.MoniteError({
+ statusCode: _response.error.statusCode,
+ body: _response.error.body,
+ });
+ }
+ }
+
+ switch (_response.error.reason) {
+ case "non-json":
+ throw new errors.MoniteError({
+ statusCode: _response.error.statusCode,
+ body: _response.error.rawBody,
+ });
+ case "timeout":
+ throw new errors.MoniteTimeoutError();
+ case "unknown":
+ throw new errors.MoniteError({
+ message: _response.error.errorMessage,
+ });
+ }
+ }
+
+ protected async _getAuthorizationHeader(): Promise {
+ const bearer = await core.Supplier.get(this._options.token);
+ if (bearer != null) {
+ return `Bearer ${bearer}`;
+ }
+
+ return undefined;
+ }
+}
diff --git a/src/api/resources/approvalPolicies/resources/processes/client/index.ts b/src/api/resources/approvalPolicies/resources/processes/client/index.ts
new file mode 100644
index 0000000..cb0ff5c
--- /dev/null
+++ b/src/api/resources/approvalPolicies/resources/processes/client/index.ts
@@ -0,0 +1 @@
+export {};
diff --git a/src/api/resources/approvalPolicies/resources/processes/index.ts b/src/api/resources/approvalPolicies/resources/processes/index.ts
new file mode 100644
index 0000000..5ec7692
--- /dev/null
+++ b/src/api/resources/approvalPolicies/resources/processes/index.ts
@@ -0,0 +1 @@
+export * from "./client";
diff --git a/src/api/resources/approvalPolicies/types/ApprovalPoliciesGetRequestStatus.ts b/src/api/resources/approvalPolicies/types/ApprovalPoliciesGetRequestStatus.ts
new file mode 100644
index 0000000..d90aede
--- /dev/null
+++ b/src/api/resources/approvalPolicies/types/ApprovalPoliciesGetRequestStatus.ts
@@ -0,0 +1,10 @@
+/**
+ * This file was auto-generated by Fern from our API Definition.
+ */
+
+export type ApprovalPoliciesGetRequestStatus = "active" | "pending";
+
+export const ApprovalPoliciesGetRequestStatus = {
+ Active: "active",
+ Pending: "pending",
+} as const;
diff --git a/src/api/resources/approvalPolicies/types/ApprovalPoliciesGetRequestStatusInItem.ts b/src/api/resources/approvalPolicies/types/ApprovalPoliciesGetRequestStatusInItem.ts
new file mode 100644
index 0000000..f0f488b
--- /dev/null
+++ b/src/api/resources/approvalPolicies/types/ApprovalPoliciesGetRequestStatusInItem.ts
@@ -0,0 +1,10 @@
+/**
+ * This file was auto-generated by Fern from our API Definition.
+ */
+
+export type ApprovalPoliciesGetRequestStatusInItem = "active" | "pending";
+
+export const ApprovalPoliciesGetRequestStatusInItem = {
+ Active: "active",
+ Pending: "pending",
+} as const;
diff --git a/src/api/resources/approvalPolicies/types/ApprovalPolicyCreateScriptItem.ts b/src/api/resources/approvalPolicies/types/ApprovalPolicyCreateScriptItem.ts
new file mode 100644
index 0000000..7317ce5
--- /dev/null
+++ b/src/api/resources/approvalPolicies/types/ApprovalPolicyCreateScriptItem.ts
@@ -0,0 +1,5 @@
+/**
+ * This file was auto-generated by Fern from our API Definition.
+ */
+
+export type ApprovalPolicyCreateScriptItem = boolean | number | string | unknown[] | Record;
diff --git a/src/api/resources/approvalPolicies/types/ApprovalPolicyCreateTrigger.ts b/src/api/resources/approvalPolicies/types/ApprovalPolicyCreateTrigger.ts
new file mode 100644
index 0000000..29dda8f
--- /dev/null
+++ b/src/api/resources/approvalPolicies/types/ApprovalPolicyCreateTrigger.ts
@@ -0,0 +1,8 @@
+/**
+ * This file was auto-generated by Fern from our API Definition.
+ */
+
+/**
+ * A JSON object that represents the trigger for the approval policy. The trigger specifies the event that will trigger the policy to be evaluated.
+ */
+export type ApprovalPolicyCreateTrigger = boolean | number | string | unknown[] | Record;
diff --git a/src/api/resources/approvalPolicies/types/ApprovalPolicyUpdateScriptItem.ts b/src/api/resources/approvalPolicies/types/ApprovalPolicyUpdateScriptItem.ts
new file mode 100644
index 0000000..ca820cb
--- /dev/null
+++ b/src/api/resources/approvalPolicies/types/ApprovalPolicyUpdateScriptItem.ts
@@ -0,0 +1,5 @@
+/**
+ * This file was auto-generated by Fern from our API Definition.
+ */
+
+export type ApprovalPolicyUpdateScriptItem = boolean | number | string | unknown[] | Record;
diff --git a/src/api/resources/approvalPolicies/types/ApprovalPolicyUpdateTrigger.ts b/src/api/resources/approvalPolicies/types/ApprovalPolicyUpdateTrigger.ts
new file mode 100644
index 0000000..8296072
--- /dev/null
+++ b/src/api/resources/approvalPolicies/types/ApprovalPolicyUpdateTrigger.ts
@@ -0,0 +1,8 @@
+/**
+ * This file was auto-generated by Fern from our API Definition.
+ */
+
+/**
+ * A JSON object that represents the trigger for the approval policy. The trigger specifies the event that will trigger the policy to be evaluated.
+ */
+export type ApprovalPolicyUpdateTrigger = boolean | number | string | unknown[] | Record;
diff --git a/src/api/resources/approvalPolicies/types/index.ts b/src/api/resources/approvalPolicies/types/index.ts
new file mode 100644
index 0000000..fd8bc1d
--- /dev/null
+++ b/src/api/resources/approvalPolicies/types/index.ts
@@ -0,0 +1,6 @@
+export * from "./ApprovalPoliciesGetRequestStatus";
+export * from "./ApprovalPoliciesGetRequestStatusInItem";
+export * from "./ApprovalPolicyCreateScriptItem";
+export * from "./ApprovalPolicyCreateTrigger";
+export * from "./ApprovalPolicyUpdateScriptItem";
+export * from "./ApprovalPolicyUpdateTrigger";
diff --git a/src/api/resources/approvalRequests/client/Client.ts b/src/api/resources/approvalRequests/client/Client.ts
new file mode 100644
index 0000000..4ad2c87
--- /dev/null
+++ b/src/api/resources/approvalRequests/client/Client.ts
@@ -0,0 +1,693 @@
+/**
+ * This file was auto-generated by Fern from our API Definition.
+ */
+
+import * as environments from "../../../../environments";
+import * as core from "../../../../core";
+import * as Monite from "../../../index";
+import urlJoin from "url-join";
+import * as errors from "../../../../errors/index";
+
+export declare namespace ApprovalRequests {
+ interface Options {
+ environment?: core.Supplier;
+ token?: core.Supplier;
+ /** Override the x-monite-version header */
+ moniteVersion: core.Supplier;
+ /** Override the x-monite-entity-id header */
+ moniteEntityId?: core.Supplier;
+ fetcher?: core.FetchFunction;
+ }
+
+ interface RequestOptions {
+ /** The maximum time to wait for a response in seconds. */
+ timeoutInSeconds?: number;
+ /** The number of times to retry the request. Defaults to 2. */
+ maxRetries?: number;
+ /** A hook to abort the request. */
+ abortSignal?: AbortSignal;
+ /** Override the x-monite-version header */
+ moniteVersion?: string;
+ /** Override the x-monite-entity-id header */
+ moniteEntityId?: string | undefined;
+ }
+}
+
+export class ApprovalRequests {
+ constructor(protected readonly _options: ApprovalRequests.Options) {}
+
+ /**
+ * @param {Monite.ApprovalRequestsGetRequest} request
+ * @param {ApprovalRequests.RequestOptions} requestOptions - Request-specific configuration.
+ *
+ * @throws {@link Monite.BadRequestError}
+ * @throws {@link Monite.UnauthorizedError}
+ * @throws {@link Monite.ForbiddenError}
+ * @throws {@link Monite.NotAcceptableError}
+ * @throws {@link Monite.UnprocessableEntityError}
+ * @throws {@link Monite.InternalServerError}
+ *
+ * @example
+ * await client.approvalRequests.get()
+ */
+ public async get(
+ request: Monite.ApprovalRequestsGetRequest = {},
+ requestOptions?: ApprovalRequests.RequestOptions
+ ): Promise {
+ const {
+ order,
+ limit,
+ pagination_token: paginationToken,
+ sort,
+ created_at__gt: createdAtGt,
+ created_at__lt: createdAtLt,
+ created_at__gte: createdAtGte,
+ created_at__lte: createdAtLte,
+ updated_at__gt: updatedAtGt,
+ updated_at__lt: updatedAtLt,
+ updated_at__gte: updatedAtGte,
+ updated_at__lte: updatedAtLte,
+ object_id: objectId,
+ object_id__in: objectIdIn,
+ status,
+ status__in: statusIn,
+ user_id: userId,
+ role_id: roleId,
+ object_type: objectType,
+ object_type__in: objectTypeIn,
+ created_by: createdBy,
+ } = request;
+ const _queryParams: Record = {};
+ if (order != null) {
+ _queryParams["order"] = order;
+ }
+
+ if (limit != null) {
+ _queryParams["limit"] = limit.toString();
+ }
+
+ if (paginationToken != null) {
+ _queryParams["pagination_token"] = paginationToken;
+ }
+
+ if (sort != null) {
+ _queryParams["sort"] = sort;
+ }
+
+ if (createdAtGt != null) {
+ _queryParams["created_at__gt"] = createdAtGt;
+ }
+
+ if (createdAtLt != null) {
+ _queryParams["created_at__lt"] = createdAtLt;
+ }
+
+ if (createdAtGte != null) {
+ _queryParams["created_at__gte"] = createdAtGte;
+ }
+
+ if (createdAtLte != null) {
+ _queryParams["created_at__lte"] = createdAtLte;
+ }
+
+ if (updatedAtGt != null) {
+ _queryParams["updated_at__gt"] = updatedAtGt;
+ }
+
+ if (updatedAtLt != null) {
+ _queryParams["updated_at__lt"] = updatedAtLt;
+ }
+
+ if (updatedAtGte != null) {
+ _queryParams["updated_at__gte"] = updatedAtGte;
+ }
+
+ if (updatedAtLte != null) {
+ _queryParams["updated_at__lte"] = updatedAtLte;
+ }
+
+ if (objectId != null) {
+ _queryParams["object_id"] = objectId;
+ }
+
+ if (objectIdIn != null) {
+ if (Array.isArray(objectIdIn)) {
+ _queryParams["object_id__in"] = objectIdIn.map((item) => item);
+ } else {
+ _queryParams["object_id__in"] = objectIdIn;
+ }
+ }
+
+ if (status != null) {
+ _queryParams["status"] = status;
+ }
+
+ if (statusIn != null) {
+ if (Array.isArray(statusIn)) {
+ _queryParams["status__in"] = statusIn.map((item) => item);
+ } else {
+ _queryParams["status__in"] = statusIn;
+ }
+ }
+
+ if (userId != null) {
+ _queryParams["user_id"] = userId;
+ }
+
+ if (roleId != null) {
+ _queryParams["role_id"] = roleId;
+ }
+
+ if (objectType != null) {
+ _queryParams["object_type"] = objectType;
+ }
+
+ if (objectTypeIn != null) {
+ if (Array.isArray(objectTypeIn)) {
+ _queryParams["object_type__in"] = objectTypeIn.map((item) => item);
+ } else {
+ _queryParams["object_type__in"] = objectTypeIn;
+ }
+ }
+
+ if (createdBy != null) {
+ _queryParams["created_by"] = createdBy;
+ }
+
+ const _response = await (this._options.fetcher ?? core.fetcher)({
+ url: urlJoin(
+ (await core.Supplier.get(this._options.environment)) ?? environments.MoniteEnvironment.Sandbox,
+ "approval_requests"
+ ),
+ method: "GET",
+ headers: {
+ Authorization: await this._getAuthorizationHeader(),
+ "x-monite-version": await core.Supplier.get(this._options.moniteVersion),
+ "x-monite-entity-id":
+ (await core.Supplier.get(this._options.moniteEntityId)) != null
+ ? await core.Supplier.get(this._options.moniteEntityId)
+ : undefined,
+ "X-Fern-Language": "JavaScript",
+ "X-Fern-SDK-Name": "",
+ "X-Fern-SDK-Version": "0.1.0",
+ "X-Fern-Runtime": core.RUNTIME.type,
+ "X-Fern-Runtime-Version": core.RUNTIME.version,
+ },
+ contentType: "application/json",
+ queryParameters: _queryParams,
+ requestType: "json",
+ timeoutMs: requestOptions?.timeoutInSeconds != null ? requestOptions.timeoutInSeconds * 1000 : 60000,
+ maxRetries: requestOptions?.maxRetries,
+ abortSignal: requestOptions?.abortSignal,
+ });
+ if (_response.ok) {
+ return _response.body as Monite.ApprovalRequestResourceList;
+ }
+
+ if (_response.error.reason === "status-code") {
+ switch (_response.error.statusCode) {
+ case 400:
+ throw new Monite.BadRequestError(_response.error.body as Monite.ErrorSchemaResponse);
+ case 401:
+ throw new Monite.UnauthorizedError(_response.error.body as Monite.ErrorSchemaResponse);
+ case 403:
+ throw new Monite.ForbiddenError(_response.error.body as Monite.ErrorSchemaResponse);
+ case 406:
+ throw new Monite.NotAcceptableError(_response.error.body as Monite.ErrorSchemaResponse);
+ case 422:
+ throw new Monite.UnprocessableEntityError(_response.error.body as Monite.HttpValidationError);
+ case 500:
+ throw new Monite.InternalServerError(_response.error.body as Monite.ErrorSchemaResponse);
+ default:
+ throw new errors.MoniteError({
+ statusCode: _response.error.statusCode,
+ body: _response.error.body,
+ });
+ }
+ }
+
+ switch (_response.error.reason) {
+ case "non-json":
+ throw new errors.MoniteError({
+ statusCode: _response.error.statusCode,
+ body: _response.error.rawBody,
+ });
+ case "timeout":
+ throw new errors.MoniteTimeoutError();
+ case "unknown":
+ throw new errors.MoniteError({
+ message: _response.error.errorMessage,
+ });
+ }
+ }
+
+ /**
+ * @param {Monite.ApprovalRequestCreateRequest} request
+ * @param {ApprovalRequests.RequestOptions} requestOptions - Request-specific configuration.
+ *
+ * @throws {@link Monite.BadRequestError}
+ * @throws {@link Monite.UnauthorizedError}
+ * @throws {@link Monite.ForbiddenError}
+ * @throws {@link Monite.NotFoundError}
+ * @throws {@link Monite.NotAcceptableError}
+ * @throws {@link Monite.UnprocessableEntityError}
+ * @throws {@link Monite.InternalServerError}
+ *
+ * @example
+ * await client.approvalRequests.create({
+ * object_id: "object_id",
+ * object_type: "account",
+ * required_approval_count: 1,
+ * role_ids: ["role_ids"]
+ * })
+ */
+ public async create(
+ request: Monite.ApprovalRequestCreateRequest,
+ requestOptions?: ApprovalRequests.RequestOptions
+ ): Promise {
+ const _response = await (this._options.fetcher ?? core.fetcher)({
+ url: urlJoin(
+ (await core.Supplier.get(this._options.environment)) ?? environments.MoniteEnvironment.Sandbox,
+ "approval_requests"
+ ),
+ method: "POST",
+ headers: {
+ Authorization: await this._getAuthorizationHeader(),
+ "x-monite-version": await core.Supplier.get(this._options.moniteVersion),
+ "x-monite-entity-id":
+ (await core.Supplier.get(this._options.moniteEntityId)) != null
+ ? await core.Supplier.get(this._options.moniteEntityId)
+ : undefined,
+ "X-Fern-Language": "JavaScript",
+ "X-Fern-SDK-Name": "",
+ "X-Fern-SDK-Version": "0.1.0",
+ "X-Fern-Runtime": core.RUNTIME.type,
+ "X-Fern-Runtime-Version": core.RUNTIME.version,
+ },
+ contentType: "application/json",
+ requestType: "json",
+ body: request,
+ timeoutMs: requestOptions?.timeoutInSeconds != null ? requestOptions.timeoutInSeconds * 1000 : 60000,
+ maxRetries: requestOptions?.maxRetries,
+ abortSignal: requestOptions?.abortSignal,
+ });
+ if (_response.ok) {
+ return _response.body as Monite.ApprovalRequestResourceWithMetadata;
+ }
+
+ if (_response.error.reason === "status-code") {
+ switch (_response.error.statusCode) {
+ case 400:
+ throw new Monite.BadRequestError(_response.error.body as Monite.ErrorSchemaResponse);
+ case 401:
+ throw new Monite.UnauthorizedError(_response.error.body as Monite.ErrorSchemaResponse);
+ case 403:
+ throw new Monite.ForbiddenError(_response.error.body as Monite.ErrorSchemaResponse);
+ case 404:
+ throw new Monite.NotFoundError(_response.error.body as Monite.ErrorSchemaResponse);
+ case 406:
+ throw new Monite.NotAcceptableError(_response.error.body as Monite.ErrorSchemaResponse);
+ case 422:
+ throw new Monite.UnprocessableEntityError(_response.error.body as Monite.HttpValidationError);
+ case 500:
+ throw new Monite.InternalServerError(_response.error.body as Monite.ErrorSchemaResponse);
+ default:
+ throw new errors.MoniteError({
+ statusCode: _response.error.statusCode,
+ body: _response.error.body,
+ });
+ }
+ }
+
+ switch (_response.error.reason) {
+ case "non-json":
+ throw new errors.MoniteError({
+ statusCode: _response.error.statusCode,
+ body: _response.error.rawBody,
+ });
+ case "timeout":
+ throw new errors.MoniteTimeoutError();
+ case "unknown":
+ throw new errors.MoniteError({
+ message: _response.error.errorMessage,
+ });
+ }
+ }
+
+ /**
+ * @param {string} approvalRequestId
+ * @param {ApprovalRequests.RequestOptions} requestOptions - Request-specific configuration.
+ *
+ * @throws {@link Monite.BadRequestError}
+ * @throws {@link Monite.UnauthorizedError}
+ * @throws {@link Monite.ForbiddenError}
+ * @throws {@link Monite.NotFoundError}
+ * @throws {@link Monite.NotAcceptableError}
+ * @throws {@link Monite.UnprocessableEntityError}
+ * @throws {@link Monite.InternalServerError}
+ *
+ * @example
+ * await client.approvalRequests.getById("approval_request_id")
+ */
+ public async getById(
+ approvalRequestId: string,
+ requestOptions?: ApprovalRequests.RequestOptions
+ ): Promise {
+ const _response = await (this._options.fetcher ?? core.fetcher)({
+ url: urlJoin(
+ (await core.Supplier.get(this._options.environment)) ?? environments.MoniteEnvironment.Sandbox,
+ `approval_requests/${encodeURIComponent(approvalRequestId)}`
+ ),
+ method: "GET",
+ headers: {
+ Authorization: await this._getAuthorizationHeader(),
+ "x-monite-version": await core.Supplier.get(this._options.moniteVersion),
+ "x-monite-entity-id":
+ (await core.Supplier.get(this._options.moniteEntityId)) != null
+ ? await core.Supplier.get(this._options.moniteEntityId)
+ : undefined,
+ "X-Fern-Language": "JavaScript",
+ "X-Fern-SDK-Name": "",
+ "X-Fern-SDK-Version": "0.1.0",
+ "X-Fern-Runtime": core.RUNTIME.type,
+ "X-Fern-Runtime-Version": core.RUNTIME.version,
+ },
+ contentType: "application/json",
+ requestType: "json",
+ timeoutMs: requestOptions?.timeoutInSeconds != null ? requestOptions.timeoutInSeconds * 1000 : 60000,
+ maxRetries: requestOptions?.maxRetries,
+ abortSignal: requestOptions?.abortSignal,
+ });
+ if (_response.ok) {
+ return _response.body as Monite.ApprovalRequestResourceWithMetadata;
+ }
+
+ if (_response.error.reason === "status-code") {
+ switch (_response.error.statusCode) {
+ case 400:
+ throw new Monite.BadRequestError(_response.error.body as Monite.ErrorSchemaResponse);
+ case 401:
+ throw new Monite.UnauthorizedError(_response.error.body as Monite.ErrorSchemaResponse);
+ case 403:
+ throw new Monite.ForbiddenError(_response.error.body as Monite.ErrorSchemaResponse);
+ case 404:
+ throw new Monite.NotFoundError(_response.error.body as Monite.ErrorSchemaResponse);
+ case 406:
+ throw new Monite.NotAcceptableError(_response.error.body as Monite.ErrorSchemaResponse);
+ case 422:
+ throw new Monite.UnprocessableEntityError(_response.error.body as Monite.HttpValidationError);
+ case 500:
+ throw new Monite.InternalServerError(_response.error.body as Monite.ErrorSchemaResponse);
+ default:
+ throw new errors.MoniteError({
+ statusCode: _response.error.statusCode,
+ body: _response.error.body,
+ });
+ }
+ }
+
+ switch (_response.error.reason) {
+ case "non-json":
+ throw new errors.MoniteError({
+ statusCode: _response.error.statusCode,
+ body: _response.error.rawBody,
+ });
+ case "timeout":
+ throw new errors.MoniteTimeoutError();
+ case "unknown":
+ throw new errors.MoniteError({
+ message: _response.error.errorMessage,
+ });
+ }
+ }
+
+ /**
+ * @param {string} approvalRequestId
+ * @param {ApprovalRequests.RequestOptions} requestOptions - Request-specific configuration.
+ *
+ * @throws {@link Monite.BadRequestError}
+ * @throws {@link Monite.UnauthorizedError}
+ * @throws {@link Monite.ForbiddenError}
+ * @throws {@link Monite.NotFoundError}
+ * @throws {@link Monite.ConflictError}
+ * @throws {@link Monite.UnprocessableEntityError}
+ * @throws {@link Monite.InternalServerError}
+ *
+ * @example
+ * await client.approvalRequests.approveById("approval_request_id")
+ */
+ public async approveById(
+ approvalRequestId: string,
+ requestOptions?: ApprovalRequests.RequestOptions
+ ): Promise {
+ const _response = await (this._options.fetcher ?? core.fetcher)({
+ url: urlJoin(
+ (await core.Supplier.get(this._options.environment)) ?? environments.MoniteEnvironment.Sandbox,
+ `approval_requests/${encodeURIComponent(approvalRequestId)}/approve`
+ ),
+ method: "POST",
+ headers: {
+ Authorization: await this._getAuthorizationHeader(),
+ "x-monite-version": await core.Supplier.get(this._options.moniteVersion),
+ "x-monite-entity-id":
+ (await core.Supplier.get(this._options.moniteEntityId)) != null
+ ? await core.Supplier.get(this._options.moniteEntityId)
+ : undefined,
+ "X-Fern-Language": "JavaScript",
+ "X-Fern-SDK-Name": "",
+ "X-Fern-SDK-Version": "0.1.0",
+ "X-Fern-Runtime": core.RUNTIME.type,
+ "X-Fern-Runtime-Version": core.RUNTIME.version,
+ },
+ contentType: "application/json",
+ requestType: "json",
+ timeoutMs: requestOptions?.timeoutInSeconds != null ? requestOptions.timeoutInSeconds * 1000 : 60000,
+ maxRetries: requestOptions?.maxRetries,
+ abortSignal: requestOptions?.abortSignal,
+ });
+ if (_response.ok) {
+ return _response.body as Monite.ApprovalRequestResourceWithMetadata;
+ }
+
+ if (_response.error.reason === "status-code") {
+ switch (_response.error.statusCode) {
+ case 400:
+ throw new Monite.BadRequestError(_response.error.body as Monite.ErrorSchemaResponse);
+ case 401:
+ throw new Monite.UnauthorizedError(_response.error.body as Monite.ErrorSchemaResponse);
+ case 403:
+ throw new Monite.ForbiddenError(_response.error.body as Monite.ErrorSchemaResponse);
+ case 404:
+ throw new Monite.NotFoundError(_response.error.body as Monite.ErrorSchemaResponse);
+ case 409:
+ throw new Monite.ConflictError(_response.error.body as Monite.ErrorSchemaResponse);
+ case 422:
+ throw new Monite.UnprocessableEntityError(_response.error.body as Monite.HttpValidationError);
+ case 500:
+ throw new Monite.InternalServerError(_response.error.body as Monite.ErrorSchemaResponse);
+ default:
+ throw new errors.MoniteError({
+ statusCode: _response.error.statusCode,
+ body: _response.error.body,
+ });
+ }
+ }
+
+ switch (_response.error.reason) {
+ case "non-json":
+ throw new errors.MoniteError({
+ statusCode: _response.error.statusCode,
+ body: _response.error.rawBody,
+ });
+ case "timeout":
+ throw new errors.MoniteTimeoutError();
+ case "unknown":
+ throw new errors.MoniteError({
+ message: _response.error.errorMessage,
+ });
+ }
+ }
+
+ /**
+ * @param {string} approvalRequestId
+ * @param {ApprovalRequests.RequestOptions} requestOptions - Request-specific configuration.
+ *
+ * @throws {@link Monite.BadRequestError}
+ * @throws {@link Monite.UnauthorizedError}
+ * @throws {@link Monite.ForbiddenError}
+ * @throws {@link Monite.NotFoundError}
+ * @throws {@link Monite.ConflictError}
+ * @throws {@link Monite.UnprocessableEntityError}
+ * @throws {@link Monite.InternalServerError}
+ *
+ * @example
+ * await client.approvalRequests.cancelById("approval_request_id")
+ */
+ public async cancelById(
+ approvalRequestId: string,
+ requestOptions?: ApprovalRequests.RequestOptions
+ ): Promise {
+ const _response = await (this._options.fetcher ?? core.fetcher)({
+ url: urlJoin(
+ (await core.Supplier.get(this._options.environment)) ?? environments.MoniteEnvironment.Sandbox,
+ `approval_requests/${encodeURIComponent(approvalRequestId)}/cancel`
+ ),
+ method: "POST",
+ headers: {
+ Authorization: await this._getAuthorizationHeader(),
+ "x-monite-version": await core.Supplier.get(this._options.moniteVersion),
+ "x-monite-entity-id":
+ (await core.Supplier.get(this._options.moniteEntityId)) != null
+ ? await core.Supplier.get(this._options.moniteEntityId)
+ : undefined,
+ "X-Fern-Language": "JavaScript",
+ "X-Fern-SDK-Name": "",
+ "X-Fern-SDK-Version": "0.1.0",
+ "X-Fern-Runtime": core.RUNTIME.type,
+ "X-Fern-Runtime-Version": core.RUNTIME.version,
+ },
+ contentType: "application/json",
+ requestType: "json",
+ timeoutMs: requestOptions?.timeoutInSeconds != null ? requestOptions.timeoutInSeconds * 1000 : 60000,
+ maxRetries: requestOptions?.maxRetries,
+ abortSignal: requestOptions?.abortSignal,
+ });
+ if (_response.ok) {
+ return _response.body as Monite.ApprovalRequestResourceWithMetadata;
+ }
+
+ if (_response.error.reason === "status-code") {
+ switch (_response.error.statusCode) {
+ case 400:
+ throw new Monite.BadRequestError(_response.error.body as Monite.ErrorSchemaResponse);
+ case 401:
+ throw new Monite.UnauthorizedError(_response.error.body as Monite.ErrorSchemaResponse);
+ case 403:
+ throw new Monite.ForbiddenError(_response.error.body as Monite.ErrorSchemaResponse);
+ case 404:
+ throw new Monite.NotFoundError(_response.error.body as Monite.ErrorSchemaResponse);
+ case 409:
+ throw new Monite.ConflictError(_response.error.body as Monite.ErrorSchemaResponse);
+ case 422:
+ throw new Monite.UnprocessableEntityError(_response.error.body as Monite.HttpValidationError);
+ case 500:
+ throw new Monite.InternalServerError(_response.error.body as Monite.ErrorSchemaResponse);
+ default:
+ throw new errors.MoniteError({
+ statusCode: _response.error.statusCode,
+ body: _response.error.body,
+ });
+ }
+ }
+
+ switch (_response.error.reason) {
+ case "non-json":
+ throw new errors.MoniteError({
+ statusCode: _response.error.statusCode,
+ body: _response.error.rawBody,
+ });
+ case "timeout":
+ throw new errors.MoniteTimeoutError();
+ case "unknown":
+ throw new errors.MoniteError({
+ message: _response.error.errorMessage,
+ });
+ }
+ }
+
+ /**
+ * @param {string} approvalRequestId
+ * @param {ApprovalRequests.RequestOptions} requestOptions - Request-specific configuration.
+ *
+ * @throws {@link Monite.BadRequestError}
+ * @throws {@link Monite.UnauthorizedError}
+ * @throws {@link Monite.ForbiddenError}
+ * @throws {@link Monite.NotFoundError}
+ * @throws {@link Monite.ConflictError}
+ * @throws {@link Monite.UnprocessableEntityError}
+ * @throws {@link Monite.InternalServerError}
+ *
+ * @example
+ * await client.approvalRequests.rejectById("approval_request_id")
+ */
+ public async rejectById(
+ approvalRequestId: string,
+ requestOptions?: ApprovalRequests.RequestOptions
+ ): Promise {
+ const _response = await (this._options.fetcher ?? core.fetcher)({
+ url: urlJoin(
+ (await core.Supplier.get(this._options.environment)) ?? environments.MoniteEnvironment.Sandbox,
+ `approval_requests/${encodeURIComponent(approvalRequestId)}/reject`
+ ),
+ method: "POST",
+ headers: {
+ Authorization: await this._getAuthorizationHeader(),
+ "x-monite-version": await core.Supplier.get(this._options.moniteVersion),
+ "x-monite-entity-id":
+ (await core.Supplier.get(this._options.moniteEntityId)) != null
+ ? await core.Supplier.get(this._options.moniteEntityId)
+ : undefined,
+ "X-Fern-Language": "JavaScript",
+ "X-Fern-SDK-Name": "",
+ "X-Fern-SDK-Version": "0.1.0",
+ "X-Fern-Runtime": core.RUNTIME.type,
+ "X-Fern-Runtime-Version": core.RUNTIME.version,
+ },
+ contentType: "application/json",
+ requestType: "json",
+ timeoutMs: requestOptions?.timeoutInSeconds != null ? requestOptions.timeoutInSeconds * 1000 : 60000,
+ maxRetries: requestOptions?.maxRetries,
+ abortSignal: requestOptions?.abortSignal,
+ });
+ if (_response.ok) {
+ return _response.body as Monite.ApprovalRequestResourceWithMetadata;
+ }
+
+ if (_response.error.reason === "status-code") {
+ switch (_response.error.statusCode) {
+ case 400:
+ throw new Monite.BadRequestError(_response.error.body as Monite.ErrorSchemaResponse);
+ case 401:
+ throw new Monite.UnauthorizedError(_response.error.body as Monite.ErrorSchemaResponse);
+ case 403:
+ throw new Monite.ForbiddenError(_response.error.body as Monite.ErrorSchemaResponse);
+ case 404:
+ throw new Monite.NotFoundError(_response.error.body as Monite.ErrorSchemaResponse);
+ case 409:
+ throw new Monite.ConflictError(_response.error.body as Monite.ErrorSchemaResponse);
+ case 422:
+ throw new Monite.UnprocessableEntityError(_response.error.body as Monite.HttpValidationError);
+ case 500:
+ throw new Monite.InternalServerError(_response.error.body as Monite.ErrorSchemaResponse);
+ default:
+ throw new errors.MoniteError({
+ statusCode: _response.error.statusCode,
+ body: _response.error.body,
+ });
+ }
+ }
+
+ switch (_response.error.reason) {
+ case "non-json":
+ throw new errors.MoniteError({
+ statusCode: _response.error.statusCode,
+ body: _response.error.rawBody,
+ });
+ case "timeout":
+ throw new errors.MoniteTimeoutError();
+ case "unknown":
+ throw new errors.MoniteError({
+ message: _response.error.errorMessage,
+ });
+ }
+ }
+
+ protected async _getAuthorizationHeader(): Promise {
+ const bearer = await core.Supplier.get(this._options.token);
+ if (bearer != null) {
+ return `Bearer ${bearer}`;
+ }
+
+ return undefined;
+ }
+}
diff --git a/src/api/resources/approvalRequests/client/index.ts b/src/api/resources/approvalRequests/client/index.ts
new file mode 100644
index 0000000..415726b
--- /dev/null
+++ b/src/api/resources/approvalRequests/client/index.ts
@@ -0,0 +1 @@
+export * from "./requests";
diff --git a/src/api/resources/approvalRequests/client/requests/ApprovalRequestsGetRequest.ts b/src/api/resources/approvalRequests/client/requests/ApprovalRequestsGetRequest.ts
new file mode 100644
index 0000000..bdedacf
--- /dev/null
+++ b/src/api/resources/approvalRequests/client/requests/ApprovalRequestsGetRequest.ts
@@ -0,0 +1,45 @@
+/**
+ * This file was auto-generated by Fern from our API Definition.
+ */
+
+import * as Monite from "../../../../index";
+
+/**
+ * @example
+ * {}
+ */
+export interface ApprovalRequestsGetRequest {
+ /**
+ * Order by
+ */
+ order?: Monite.OrderEnum;
+ /**
+ * Max is 100
+ */
+ limit?: number;
+ /**
+ * A token, obtained from previous page. Prior over other filters
+ */
+ pagination_token?: string;
+ /**
+ * Allowed sort fields
+ */
+ sort?: Monite.ApprovalRequestCursorFields;
+ created_at__gt?: string;
+ created_at__lt?: string;
+ created_at__gte?: string;
+ created_at__lte?: string;
+ updated_at__gt?: string;
+ updated_at__lt?: string;
+ updated_at__gte?: string;
+ updated_at__lte?: string;
+ object_id?: string;
+ object_id__in?: string | string[];
+ status?: Monite.ApprovalRequestStatus;
+ status__in?: Monite.ApprovalRequestStatus | Monite.ApprovalRequestStatus[];
+ user_id?: string;
+ role_id?: string;
+ object_type?: Monite.ObjectType;
+ object_type__in?: Monite.ObjectType | Monite.ObjectType[];
+ created_by?: string;
+}
diff --git a/src/api/resources/approvalRequests/client/requests/index.ts b/src/api/resources/approvalRequests/client/requests/index.ts
new file mode 100644
index 0000000..884f342
--- /dev/null
+++ b/src/api/resources/approvalRequests/client/requests/index.ts
@@ -0,0 +1 @@
+export { type ApprovalRequestsGetRequest } from "./ApprovalRequestsGetRequest";
diff --git a/src/api/resources/approvalRequests/index.ts b/src/api/resources/approvalRequests/index.ts
new file mode 100644
index 0000000..5ec7692
--- /dev/null
+++ b/src/api/resources/approvalRequests/index.ts
@@ -0,0 +1 @@
+export * from "./client";
diff --git a/src/api/resources/auditLogs/client/Client.ts b/src/api/resources/auditLogs/client/Client.ts
new file mode 100644
index 0000000..84b1841
--- /dev/null
+++ b/src/api/resources/auditLogs/client/Client.ts
@@ -0,0 +1,252 @@
+/**
+ * This file was auto-generated by Fern from our API Definition.
+ */
+
+import * as environments from "../../../../environments";
+import * as core from "../../../../core";
+import * as Monite from "../../../index";
+import urlJoin from "url-join";
+import * as errors from "../../../../errors/index";
+
+export declare namespace AuditLogs {
+ interface Options {
+ environment?: core.Supplier;
+ token?: core.Supplier;
+ /** Override the x-monite-version header */
+ moniteVersion: core.Supplier;
+ /** Override the x-monite-entity-id header */
+ moniteEntityId?: core.Supplier;
+ fetcher?: core.FetchFunction;
+ }
+
+ interface RequestOptions {
+ /** The maximum time to wait for a response in seconds. */
+ timeoutInSeconds?: number;
+ /** The number of times to retry the request. Defaults to 2. */
+ maxRetries?: number;
+ /** A hook to abort the request. */
+ abortSignal?: AbortSignal;
+ /** Override the x-monite-version header */
+ moniteVersion?: string;
+ /** Override the x-monite-entity-id header */
+ moniteEntityId?: string | undefined;
+ }
+}
+
+export class AuditLogs {
+ constructor(protected readonly _options: AuditLogs.Options) {}
+
+ /**
+ * @param {Monite.AuditLogsGetRequest} request
+ * @param {AuditLogs.RequestOptions} requestOptions - Request-specific configuration.
+ *
+ * @throws {@link Monite.UnprocessableEntityError}
+ * @throws {@link Monite.InternalServerError}
+ *
+ * @example
+ * await client.auditLogs.get()
+ */
+ public async get(
+ request: Monite.AuditLogsGetRequest = {},
+ requestOptions?: AuditLogs.RequestOptions
+ ): Promise {
+ const {
+ pagination_token: paginationToken,
+ entity_user_id: entityUserId,
+ path__contains: pathContains,
+ type: type_,
+ method,
+ status_code: statusCode,
+ timestamp__gt: timestampGt,
+ timestamp__lt: timestampLt,
+ timestamp__gte: timestampGte,
+ timestamp__lte: timestampLte,
+ page_size: pageSize,
+ page_num: pageNum,
+ } = request;
+ const _queryParams: Record = {};
+ if (paginationToken != null) {
+ _queryParams["pagination_token"] = paginationToken;
+ }
+
+ if (entityUserId != null) {
+ _queryParams["entity_user_id"] = entityUserId;
+ }
+
+ if (pathContains != null) {
+ _queryParams["path__contains"] = pathContains;
+ }
+
+ if (type_ != null) {
+ _queryParams["type"] = type_;
+ }
+
+ if (method != null) {
+ _queryParams["method"] = method;
+ }
+
+ if (statusCode != null) {
+ _queryParams["status_code"] = statusCode.toString();
+ }
+
+ if (timestampGt != null) {
+ _queryParams["timestamp__gt"] = timestampGt;
+ }
+
+ if (timestampLt != null) {
+ _queryParams["timestamp__lt"] = timestampLt;
+ }
+
+ if (timestampGte != null) {
+ _queryParams["timestamp__gte"] = timestampGte;
+ }
+
+ if (timestampLte != null) {
+ _queryParams["timestamp__lte"] = timestampLte;
+ }
+
+ if (pageSize != null) {
+ _queryParams["page_size"] = pageSize.toString();
+ }
+
+ if (pageNum != null) {
+ _queryParams["page_num"] = pageNum.toString();
+ }
+
+ const _response = await (this._options.fetcher ?? core.fetcher)({
+ url: urlJoin(
+ (await core.Supplier.get(this._options.environment)) ?? environments.MoniteEnvironment.Sandbox,
+ "audit_logs"
+ ),
+ method: "GET",
+ headers: {
+ Authorization: await this._getAuthorizationHeader(),
+ "x-monite-version": await core.Supplier.get(this._options.moniteVersion),
+ "x-monite-entity-id":
+ (await core.Supplier.get(this._options.moniteEntityId)) != null
+ ? await core.Supplier.get(this._options.moniteEntityId)
+ : undefined,
+ "X-Fern-Language": "JavaScript",
+ "X-Fern-SDK-Name": "",
+ "X-Fern-SDK-Version": "0.1.0",
+ "X-Fern-Runtime": core.RUNTIME.type,
+ "X-Fern-Runtime-Version": core.RUNTIME.version,
+ },
+ contentType: "application/json",
+ queryParameters: _queryParams,
+ requestType: "json",
+ timeoutMs: requestOptions?.timeoutInSeconds != null ? requestOptions.timeoutInSeconds * 1000 : 60000,
+ maxRetries: requestOptions?.maxRetries,
+ abortSignal: requestOptions?.abortSignal,
+ });
+ if (_response.ok) {
+ return _response.body as Monite.LogsResponse;
+ }
+
+ if (_response.error.reason === "status-code") {
+ switch (_response.error.statusCode) {
+ case 422:
+ throw new Monite.UnprocessableEntityError(_response.error.body as Monite.HttpValidationError);
+ case 500:
+ throw new Monite.InternalServerError(_response.error.body as Monite.ErrorSchemaResponse);
+ default:
+ throw new errors.MoniteError({
+ statusCode: _response.error.statusCode,
+ body: _response.error.body,
+ });
+ }
+ }
+
+ switch (_response.error.reason) {
+ case "non-json":
+ throw new errors.MoniteError({
+ statusCode: _response.error.statusCode,
+ body: _response.error.rawBody,
+ });
+ case "timeout":
+ throw new errors.MoniteTimeoutError();
+ case "unknown":
+ throw new errors.MoniteError({
+ message: _response.error.errorMessage,
+ });
+ }
+ }
+
+ /**
+ * @param {string} logId
+ * @param {AuditLogs.RequestOptions} requestOptions - Request-specific configuration.
+ *
+ * @throws {@link Monite.UnprocessableEntityError}
+ * @throws {@link Monite.InternalServerError}
+ *
+ * @example
+ * await client.auditLogs.getById("log_id")
+ */
+ public async getById(logId: string, requestOptions?: AuditLogs.RequestOptions): Promise {
+ const _response = await (this._options.fetcher ?? core.fetcher)({
+ url: urlJoin(
+ (await core.Supplier.get(this._options.environment)) ?? environments.MoniteEnvironment.Sandbox,
+ `audit_logs/${encodeURIComponent(logId)}`
+ ),
+ method: "GET",
+ headers: {
+ Authorization: await this._getAuthorizationHeader(),
+ "x-monite-version": await core.Supplier.get(this._options.moniteVersion),
+ "x-monite-entity-id":
+ (await core.Supplier.get(this._options.moniteEntityId)) != null
+ ? await core.Supplier.get(this._options.moniteEntityId)
+ : undefined,
+ "X-Fern-Language": "JavaScript",
+ "X-Fern-SDK-Name": "",
+ "X-Fern-SDK-Version": "0.1.0",
+ "X-Fern-Runtime": core.RUNTIME.type,
+ "X-Fern-Runtime-Version": core.RUNTIME.version,
+ },
+ contentType: "application/json",
+ requestType: "json",
+ timeoutMs: requestOptions?.timeoutInSeconds != null ? requestOptions.timeoutInSeconds * 1000 : 60000,
+ maxRetries: requestOptions?.maxRetries,
+ abortSignal: requestOptions?.abortSignal,
+ });
+ if (_response.ok) {
+ return _response.body as Monite.LogResponse;
+ }
+
+ if (_response.error.reason === "status-code") {
+ switch (_response.error.statusCode) {
+ case 422:
+ throw new Monite.UnprocessableEntityError(_response.error.body as Monite.HttpValidationError);
+ case 500:
+ throw new Monite.InternalServerError(_response.error.body as Monite.ErrorSchemaResponse);
+ default:
+ throw new errors.MoniteError({
+ statusCode: _response.error.statusCode,
+ body: _response.error.body,
+ });
+ }
+ }
+
+ switch (_response.error.reason) {
+ case "non-json":
+ throw new errors.MoniteError({
+ statusCode: _response.error.statusCode,
+ body: _response.error.rawBody,
+ });
+ case "timeout":
+ throw new errors.MoniteTimeoutError();
+ case "unknown":
+ throw new errors.MoniteError({
+ message: _response.error.errorMessage,
+ });
+ }
+ }
+
+ protected async _getAuthorizationHeader(): Promise {
+ const bearer = await core.Supplier.get(this._options.token);
+ if (bearer != null) {
+ return `Bearer ${bearer}`;
+ }
+
+ return undefined;
+ }
+}
diff --git a/src/api/resources/auditLogs/client/index.ts b/src/api/resources/auditLogs/client/index.ts
new file mode 100644
index 0000000..415726b
--- /dev/null
+++ b/src/api/resources/auditLogs/client/index.ts
@@ -0,0 +1 @@
+export * from "./requests";
diff --git a/src/api/resources/auditLogs/client/requests/AuditLogsGetRequest.ts b/src/api/resources/auditLogs/client/requests/AuditLogsGetRequest.ts
new file mode 100644
index 0000000..6a603c4
--- /dev/null
+++ b/src/api/resources/auditLogs/client/requests/AuditLogsGetRequest.ts
@@ -0,0 +1,24 @@
+/**
+ * This file was auto-generated by Fern from our API Definition.
+ */
+
+import * as Monite from "../../../../index";
+
+/**
+ * @example
+ * {}
+ */
+export interface AuditLogsGetRequest {
+ pagination_token?: string;
+ entity_user_id?: string;
+ path__contains?: string;
+ type?: Monite.LogTypeEnum;
+ method?: Monite.LogMethodEnum;
+ status_code?: number;
+ timestamp__gt?: string;
+ timestamp__lt?: string;
+ timestamp__gte?: string;
+ timestamp__lte?: string;
+ page_size?: number;
+ page_num?: number;
+}
diff --git a/src/api/resources/auditLogs/client/requests/index.ts b/src/api/resources/auditLogs/client/requests/index.ts
new file mode 100644
index 0000000..4e89428
--- /dev/null
+++ b/src/api/resources/auditLogs/client/requests/index.ts
@@ -0,0 +1 @@
+export { type AuditLogsGetRequest } from "./AuditLogsGetRequest";
diff --git a/src/api/resources/auditLogs/index.ts b/src/api/resources/auditLogs/index.ts
new file mode 100644
index 0000000..5ec7692
--- /dev/null
+++ b/src/api/resources/auditLogs/index.ts
@@ -0,0 +1 @@
+export * from "./client";
diff --git a/src/api/resources/batchPayments/client/Client.ts b/src/api/resources/batchPayments/client/Client.ts
new file mode 100644
index 0000000..d74748e
--- /dev/null
+++ b/src/api/resources/batchPayments/client/Client.ts
@@ -0,0 +1,204 @@
+/**
+ * This file was auto-generated by Fern from our API Definition.
+ */
+
+import * as environments from "../../../../environments";
+import * as core from "../../../../core";
+import * as Monite from "../../../index";
+import urlJoin from "url-join";
+import * as errors from "../../../../errors/index";
+
+export declare namespace BatchPayments {
+ interface Options {
+ environment?: core.Supplier;
+ token?: core.Supplier;
+ /** Override the x-monite-version header */
+ moniteVersion: core.Supplier;
+ /** Override the x-monite-entity-id header */
+ moniteEntityId?: core.Supplier;
+ fetcher?: core.FetchFunction;
+ }
+
+ interface RequestOptions {
+ /** The maximum time to wait for a response in seconds. */
+ timeoutInSeconds?: number;
+ /** The number of times to retry the request. Defaults to 2. */
+ maxRetries?: number;
+ /** A hook to abort the request. */
+ abortSignal?: AbortSignal;
+ /** Override the x-monite-version header */
+ moniteVersion?: string;
+ /** Override the x-monite-entity-id header */
+ moniteEntityId?: string | undefined;
+ }
+}
+
+export class BatchPayments {
+ constructor(protected readonly _options: BatchPayments.Options) {}
+
+ /**
+ * @param {Monite.PaymentsBatchPaymentRequest} request
+ * @param {BatchPayments.RequestOptions} requestOptions - Request-specific configuration.
+ *
+ * @throws {@link Monite.UnprocessableEntityError}
+ * @throws {@link Monite.InternalServerError}
+ *
+ * @example
+ * await client.batchPayments.create({
+ * payer_bank_account_id: "payer_bank_account_id",
+ * payment_intents: [{
+ * object: {
+ * id: "id",
+ * type: "payable"
+ * },
+ * recipient: {
+ * id: "id",
+ * type: "counterpart"
+ * }
+ * }]
+ * })
+ */
+ public async create(
+ request: Monite.PaymentsBatchPaymentRequest,
+ requestOptions?: BatchPayments.RequestOptions
+ ): Promise {
+ const _response = await (this._options.fetcher ?? core.fetcher)({
+ url: urlJoin(
+ (await core.Supplier.get(this._options.environment)) ?? environments.MoniteEnvironment.Sandbox,
+ "batch_payments"
+ ),
+ method: "POST",
+ headers: {
+ Authorization: await this._getAuthorizationHeader(),
+ "x-monite-version": await core.Supplier.get(this._options.moniteVersion),
+ "x-monite-entity-id":
+ (await core.Supplier.get(this._options.moniteEntityId)) != null
+ ? await core.Supplier.get(this._options.moniteEntityId)
+ : undefined,
+ "X-Fern-Language": "JavaScript",
+ "X-Fern-SDK-Name": "",
+ "X-Fern-SDK-Version": "0.1.0",
+ "X-Fern-Runtime": core.RUNTIME.type,
+ "X-Fern-Runtime-Version": core.RUNTIME.version,
+ },
+ contentType: "application/json",
+ requestType: "json",
+ body: { ...request, payment_method: "us_ach" },
+ timeoutMs: requestOptions?.timeoutInSeconds != null ? requestOptions.timeoutInSeconds * 1000 : 60000,
+ maxRetries: requestOptions?.maxRetries,
+ abortSignal: requestOptions?.abortSignal,
+ });
+ if (_response.ok) {
+ return _response.body as Monite.PaymentsBatchPaymentResponse;
+ }
+
+ if (_response.error.reason === "status-code") {
+ switch (_response.error.statusCode) {
+ case 422:
+ throw new Monite.UnprocessableEntityError(_response.error.body as Monite.HttpValidationError);
+ case 500:
+ throw new Monite.InternalServerError(_response.error.body as Monite.ErrorSchemaResponse);
+ default:
+ throw new errors.MoniteError({
+ statusCode: _response.error.statusCode,
+ body: _response.error.body,
+ });
+ }
+ }
+
+ switch (_response.error.reason) {
+ case "non-json":
+ throw new errors.MoniteError({
+ statusCode: _response.error.statusCode,
+ body: _response.error.rawBody,
+ });
+ case "timeout":
+ throw new errors.MoniteTimeoutError();
+ case "unknown":
+ throw new errors.MoniteError({
+ message: _response.error.errorMessage,
+ });
+ }
+ }
+
+ /**
+ * @param {string} batchPaymentId
+ * @param {BatchPayments.RequestOptions} requestOptions - Request-specific configuration.
+ *
+ * @throws {@link Monite.UnprocessableEntityError}
+ * @throws {@link Monite.InternalServerError}
+ *
+ * @example
+ * await client.batchPayments.getById("batch_payment_id")
+ */
+ public async getById(
+ batchPaymentId: string,
+ requestOptions?: BatchPayments.RequestOptions
+ ): Promise {
+ const _response = await (this._options.fetcher ?? core.fetcher)({
+ url: urlJoin(
+ (await core.Supplier.get(this._options.environment)) ?? environments.MoniteEnvironment.Sandbox,
+ `batch_payments/${encodeURIComponent(batchPaymentId)}`
+ ),
+ method: "GET",
+ headers: {
+ Authorization: await this._getAuthorizationHeader(),
+ "x-monite-version": await core.Supplier.get(this._options.moniteVersion),
+ "x-monite-entity-id":
+ (await core.Supplier.get(this._options.moniteEntityId)) != null
+ ? await core.Supplier.get(this._options.moniteEntityId)
+ : undefined,
+ "X-Fern-Language": "JavaScript",
+ "X-Fern-SDK-Name": "",
+ "X-Fern-SDK-Version": "0.1.0",
+ "X-Fern-Runtime": core.RUNTIME.type,
+ "X-Fern-Runtime-Version": core.RUNTIME.version,
+ },
+ contentType: "application/json",
+ requestType: "json",
+ timeoutMs: requestOptions?.timeoutInSeconds != null ? requestOptions.timeoutInSeconds * 1000 : 60000,
+ maxRetries: requestOptions?.maxRetries,
+ abortSignal: requestOptions?.abortSignal,
+ });
+ if (_response.ok) {
+ return _response.body as Monite.PaymentsBatchPaymentResponse;
+ }
+
+ if (_response.error.reason === "status-code") {
+ switch (_response.error.statusCode) {
+ case 422:
+ throw new Monite.UnprocessableEntityError(_response.error.body as Monite.HttpValidationError);
+ case 500:
+ throw new Monite.InternalServerError(_response.error.body as Monite.ErrorSchemaResponse);
+ default:
+ throw new errors.MoniteError({
+ statusCode: _response.error.statusCode,
+ body: _response.error.body,
+ });
+ }
+ }
+
+ switch (_response.error.reason) {
+ case "non-json":
+ throw new errors.MoniteError({
+ statusCode: _response.error.statusCode,
+ body: _response.error.rawBody,
+ });
+ case "timeout":
+ throw new errors.MoniteTimeoutError();
+ case "unknown":
+ throw new errors.MoniteError({
+ message: _response.error.errorMessage,
+ });
+ }
+ }
+
+ protected async _getAuthorizationHeader(): Promise {
+ const bearer = await core.Supplier.get(this._options.token);
+ if (bearer != null) {
+ return `Bearer ${bearer}`;
+ }
+
+ return undefined;
+ }
+}
diff --git a/src/api/resources/batchPayments/client/index.ts b/src/api/resources/batchPayments/client/index.ts
new file mode 100644
index 0000000..415726b
--- /dev/null
+++ b/src/api/resources/batchPayments/client/index.ts
@@ -0,0 +1 @@
+export * from "./requests";
diff --git a/src/api/resources/batchPayments/client/requests/PaymentsBatchPaymentRequest.ts b/src/api/resources/batchPayments/client/requests/PaymentsBatchPaymentRequest.ts
new file mode 100644
index 0000000..5f3d658
--- /dev/null
+++ b/src/api/resources/batchPayments/client/requests/PaymentsBatchPaymentRequest.ts
@@ -0,0 +1,26 @@
+/**
+ * This file was auto-generated by Fern from our API Definition.
+ */
+
+import * as Monite from "../../../../index";
+
+/**
+ * @example
+ * {
+ * payer_bank_account_id: "payer_bank_account_id",
+ * payment_intents: [{
+ * object: {
+ * id: "id",
+ * type: "payable"
+ * },
+ * recipient: {
+ * id: "id",
+ * type: "counterpart"
+ * }
+ * }]
+ * }
+ */
+export interface PaymentsBatchPaymentRequest {
+ payer_bank_account_id: string;
+ payment_intents: Monite.SinglePaymentIntent[];
+}
diff --git a/src/api/resources/batchPayments/client/requests/index.ts b/src/api/resources/batchPayments/client/requests/index.ts
new file mode 100644
index 0000000..b3e5ba6
--- /dev/null
+++ b/src/api/resources/batchPayments/client/requests/index.ts
@@ -0,0 +1 @@
+export { type PaymentsBatchPaymentRequest } from "./PaymentsBatchPaymentRequest";
diff --git a/src/api/resources/batchPayments/index.ts b/src/api/resources/batchPayments/index.ts
new file mode 100644
index 0000000..5ec7692
--- /dev/null
+++ b/src/api/resources/batchPayments/index.ts
@@ -0,0 +1 @@
+export * from "./client";
diff --git a/src/api/resources/comments/client/Client.ts b/src/api/resources/comments/client/Client.ts
new file mode 100644
index 0000000..41d35a7
--- /dev/null
+++ b/src/api/resources/comments/client/Client.ts
@@ -0,0 +1,527 @@
+/**
+ * This file was auto-generated by Fern from our API Definition.
+ */
+
+import * as environments from "../../../../environments";
+import * as core from "../../../../core";
+import * as Monite from "../../../index";
+import urlJoin from "url-join";
+import * as errors from "../../../../errors/index";
+
+export declare namespace Comments {
+ interface Options {
+ environment?: core.Supplier;
+ token?: core.Supplier;
+ /** Override the x-monite-version header */
+ moniteVersion: core.Supplier;
+ /** Override the x-monite-entity-id header */
+ moniteEntityId?: core.Supplier;
+ fetcher?: core.FetchFunction;
+ }
+
+ interface RequestOptions {
+ /** The maximum time to wait for a response in seconds. */
+ timeoutInSeconds?: number;
+ /** The number of times to retry the request. Defaults to 2. */
+ maxRetries?: number;
+ /** A hook to abort the request. */
+ abortSignal?: AbortSignal;
+ /** Override the x-monite-version header */
+ moniteVersion?: string;
+ /** Override the x-monite-entity-id header */
+ moniteEntityId?: string | undefined;
+ }
+}
+
+export class Comments {
+ constructor(protected readonly _options: Comments.Options) {}
+
+ /**
+ * Get comments
+ *
+ * @param {Monite.CommentsGetRequest} request
+ * @param {Comments.RequestOptions} requestOptions - Request-specific configuration.
+ *
+ * @throws {@link Monite.BadRequestError}
+ * @throws {@link Monite.ForbiddenError}
+ * @throws {@link Monite.ConflictError}
+ * @throws {@link Monite.UnprocessableEntityError}
+ * @throws {@link Monite.InternalServerError}
+ *
+ * @example
+ * await client.comments.get({
+ * object_type: "payable",
+ * object_id: "object_id"
+ * })
+ */
+ public async get(
+ request: Monite.CommentsGetRequest,
+ requestOptions?: Comments.RequestOptions
+ ): Promise {
+ const {
+ object_type: objectType,
+ object_id: objectId,
+ order,
+ limit,
+ pagination_token: paginationToken,
+ sort,
+ created_at__gt: createdAtGt,
+ created_at__lt: createdAtLt,
+ created_at__gte: createdAtGte,
+ created_at__lte: createdAtLte,
+ } = request;
+ const _queryParams: Record = {};
+ _queryParams["object_type"] = objectType;
+ _queryParams["object_id"] = objectId;
+ if (order != null) {
+ _queryParams["order"] = order;
+ }
+
+ if (limit != null) {
+ _queryParams["limit"] = limit.toString();
+ }
+
+ if (paginationToken != null) {
+ _queryParams["pagination_token"] = paginationToken;
+ }
+
+ if (sort != null) {
+ _queryParams["sort"] = sort;
+ }
+
+ if (createdAtGt != null) {
+ _queryParams["created_at__gt"] = createdAtGt;
+ }
+
+ if (createdAtLt != null) {
+ _queryParams["created_at__lt"] = createdAtLt;
+ }
+
+ if (createdAtGte != null) {
+ _queryParams["created_at__gte"] = createdAtGte;
+ }
+
+ if (createdAtLte != null) {
+ _queryParams["created_at__lte"] = createdAtLte;
+ }
+
+ const _response = await (this._options.fetcher ?? core.fetcher)({
+ url: urlJoin(
+ (await core.Supplier.get(this._options.environment)) ?? environments.MoniteEnvironment.Sandbox,
+ "comments"
+ ),
+ method: "GET",
+ headers: {
+ Authorization: await this._getAuthorizationHeader(),
+ "x-monite-version": await core.Supplier.get(this._options.moniteVersion),
+ "x-monite-entity-id":
+ (await core.Supplier.get(this._options.moniteEntityId)) != null
+ ? await core.Supplier.get(this._options.moniteEntityId)
+ : undefined,
+ "X-Fern-Language": "JavaScript",
+ "X-Fern-SDK-Name": "",
+ "X-Fern-SDK-Version": "0.1.0",
+ "X-Fern-Runtime": core.RUNTIME.type,
+ "X-Fern-Runtime-Version": core.RUNTIME.version,
+ },
+ contentType: "application/json",
+ queryParameters: _queryParams,
+ requestType: "json",
+ timeoutMs: requestOptions?.timeoutInSeconds != null ? requestOptions.timeoutInSeconds * 1000 : 60000,
+ maxRetries: requestOptions?.maxRetries,
+ abortSignal: requestOptions?.abortSignal,
+ });
+ if (_response.ok) {
+ return _response.body as Monite.CommentResourceList;
+ }
+
+ if (_response.error.reason === "status-code") {
+ switch (_response.error.statusCode) {
+ case 400:
+ throw new Monite.BadRequestError(_response.error.body as Monite.ErrorSchemaResponse);
+ case 403:
+ throw new Monite.ForbiddenError(_response.error.body as Monite.ErrorSchemaResponse);
+ case 409:
+ throw new Monite.ConflictError(_response.error.body as Monite.ErrorSchemaResponse);
+ case 422:
+ throw new Monite.UnprocessableEntityError(_response.error.body as Monite.HttpValidationError);
+ case 500:
+ throw new Monite.InternalServerError(_response.error.body as Monite.ErrorSchemaResponse);
+ default:
+ throw new errors.MoniteError({
+ statusCode: _response.error.statusCode,
+ body: _response.error.body,
+ });
+ }
+ }
+
+ switch (_response.error.reason) {
+ case "non-json":
+ throw new errors.MoniteError({
+ statusCode: _response.error.statusCode,
+ body: _response.error.rawBody,
+ });
+ case "timeout":
+ throw new errors.MoniteTimeoutError();
+ case "unknown":
+ throw new errors.MoniteError({
+ message: _response.error.errorMessage,
+ });
+ }
+ }
+
+ /**
+ * Create new comment
+ *
+ * @param {Monite.CommentCreateRequest} request
+ * @param {Comments.RequestOptions} requestOptions - Request-specific configuration.
+ *
+ * @throws {@link Monite.BadRequestError}
+ * @throws {@link Monite.ForbiddenError}
+ * @throws {@link Monite.NotFoundError}
+ * @throws {@link Monite.ConflictError}
+ * @throws {@link Monite.UnprocessableEntityError}
+ * @throws {@link Monite.InternalServerError}
+ *
+ * @example
+ * await client.comments.create({
+ * object_id: "object_id",
+ * object_type: "object_type",
+ * text: "text"
+ * })
+ */
+ public async create(
+ request: Monite.CommentCreateRequest,
+ requestOptions?: Comments.RequestOptions
+ ): Promise {
+ const _response = await (this._options.fetcher ?? core.fetcher)({
+ url: urlJoin(
+ (await core.Supplier.get(this._options.environment)) ?? environments.MoniteEnvironment.Sandbox,
+ "comments"
+ ),
+ method: "POST",
+ headers: {
+ Authorization: await this._getAuthorizationHeader(),
+ "x-monite-version": await core.Supplier.get(this._options.moniteVersion),
+ "x-monite-entity-id":
+ (await core.Supplier.get(this._options.moniteEntityId)) != null
+ ? await core.Supplier.get(this._options.moniteEntityId)
+ : undefined,
+ "X-Fern-Language": "JavaScript",
+ "X-Fern-SDK-Name": "",
+ "X-Fern-SDK-Version": "0.1.0",
+ "X-Fern-Runtime": core.RUNTIME.type,
+ "X-Fern-Runtime-Version": core.RUNTIME.version,
+ },
+ contentType: "application/json",
+ requestType: "json",
+ body: request,
+ timeoutMs: requestOptions?.timeoutInSeconds != null ? requestOptions.timeoutInSeconds * 1000 : 60000,
+ maxRetries: requestOptions?.maxRetries,
+ abortSignal: requestOptions?.abortSignal,
+ });
+ if (_response.ok) {
+ return _response.body as Monite.CommentResource;
+ }
+
+ if (_response.error.reason === "status-code") {
+ switch (_response.error.statusCode) {
+ case 400:
+ throw new Monite.BadRequestError(_response.error.body as Monite.ErrorSchemaResponse);
+ case 403:
+ throw new Monite.ForbiddenError(_response.error.body as Monite.ErrorSchemaResponse);
+ case 404:
+ throw new Monite.NotFoundError(_response.error.body as Monite.ErrorSchemaResponse);
+ case 409:
+ throw new Monite.ConflictError(_response.error.body as Monite.ErrorSchemaResponse);
+ case 422:
+ throw new Monite.UnprocessableEntityError(_response.error.body as Monite.HttpValidationError);
+ case 500:
+ throw new Monite.InternalServerError(_response.error.body as Monite.ErrorSchemaResponse);
+ default:
+ throw new errors.MoniteError({
+ statusCode: _response.error.statusCode,
+ body: _response.error.body,
+ });
+ }
+ }
+
+ switch (_response.error.reason) {
+ case "non-json":
+ throw new errors.MoniteError({
+ statusCode: _response.error.statusCode,
+ body: _response.error.rawBody,
+ });
+ case "timeout":
+ throw new errors.MoniteTimeoutError();
+ case "unknown":
+ throw new errors.MoniteError({
+ message: _response.error.errorMessage,
+ });
+ }
+ }
+
+ /**
+ * Get comment
+ *
+ * @param {string} commentId
+ * @param {Comments.RequestOptions} requestOptions - Request-specific configuration.
+ *
+ * @throws {@link Monite.BadRequestError}
+ * @throws {@link Monite.ForbiddenError}
+ * @throws {@link Monite.NotFoundError}
+ * @throws {@link Monite.ConflictError}
+ * @throws {@link Monite.UnprocessableEntityError}
+ * @throws {@link Monite.InternalServerError}
+ *
+ * @example
+ * await client.comments.getById("comment_id")
+ */
+ public async getById(commentId: string, requestOptions?: Comments.RequestOptions): Promise {
+ const _response = await (this._options.fetcher ?? core.fetcher)({
+ url: urlJoin(
+ (await core.Supplier.get(this._options.environment)) ?? environments.MoniteEnvironment.Sandbox,
+ `comments/${encodeURIComponent(commentId)}`
+ ),
+ method: "GET",
+ headers: {
+ Authorization: await this._getAuthorizationHeader(),
+ "x-monite-version": await core.Supplier.get(this._options.moniteVersion),
+ "x-monite-entity-id":
+ (await core.Supplier.get(this._options.moniteEntityId)) != null
+ ? await core.Supplier.get(this._options.moniteEntityId)
+ : undefined,
+ "X-Fern-Language": "JavaScript",
+ "X-Fern-SDK-Name": "",
+ "X-Fern-SDK-Version": "0.1.0",
+ "X-Fern-Runtime": core.RUNTIME.type,
+ "X-Fern-Runtime-Version": core.RUNTIME.version,
+ },
+ contentType: "application/json",
+ requestType: "json",
+ timeoutMs: requestOptions?.timeoutInSeconds != null ? requestOptions.timeoutInSeconds * 1000 : 60000,
+ maxRetries: requestOptions?.maxRetries,
+ abortSignal: requestOptions?.abortSignal,
+ });
+ if (_response.ok) {
+ return _response.body as Monite.CommentResource;
+ }
+
+ if (_response.error.reason === "status-code") {
+ switch (_response.error.statusCode) {
+ case 400:
+ throw new Monite.BadRequestError(_response.error.body as Monite.ErrorSchemaResponse);
+ case 403:
+ throw new Monite.ForbiddenError(_response.error.body as Monite.ErrorSchemaResponse);
+ case 404:
+ throw new Monite.NotFoundError(_response.error.body as Monite.ErrorSchemaResponse);
+ case 409:
+ throw new Monite.ConflictError(_response.error.body as Monite.ErrorSchemaResponse);
+ case 422:
+ throw new Monite.UnprocessableEntityError(_response.error.body as Monite.HttpValidationError);
+ case 500:
+ throw new Monite.InternalServerError(_response.error.body as Monite.ErrorSchemaResponse);
+ default:
+ throw new errors.MoniteError({
+ statusCode: _response.error.statusCode,
+ body: _response.error.body,
+ });
+ }
+ }
+
+ switch (_response.error.reason) {
+ case "non-json":
+ throw new errors.MoniteError({
+ statusCode: _response.error.statusCode,
+ body: _response.error.rawBody,
+ });
+ case "timeout":
+ throw new errors.MoniteTimeoutError();
+ case "unknown":
+ throw new errors.MoniteError({
+ message: _response.error.errorMessage,
+ });
+ }
+ }
+
+ /**
+ * Delete comment
+ *
+ * @param {string} commentId
+ * @param {Comments.RequestOptions} requestOptions - Request-specific configuration.
+ *
+ * @throws {@link Monite.BadRequestError}
+ * @throws {@link Monite.ForbiddenError}
+ * @throws {@link Monite.NotFoundError}
+ * @throws {@link Monite.ConflictError}
+ * @throws {@link Monite.UnprocessableEntityError}
+ * @throws {@link Monite.InternalServerError}
+ *
+ * @example
+ * await client.comments.deleteById("comment_id")
+ */
+ public async deleteById(commentId: string, requestOptions?: Comments.RequestOptions): Promise {
+ const _response = await (this._options.fetcher ?? core.fetcher)({
+ url: urlJoin(
+ (await core.Supplier.get(this._options.environment)) ?? environments.MoniteEnvironment.Sandbox,
+ `comments/${encodeURIComponent(commentId)}`
+ ),
+ method: "DELETE",
+ headers: {
+ Authorization: await this._getAuthorizationHeader(),
+ "x-monite-version": await core.Supplier.get(this._options.moniteVersion),
+ "x-monite-entity-id":
+ (await core.Supplier.get(this._options.moniteEntityId)) != null
+ ? await core.Supplier.get(this._options.moniteEntityId)
+ : undefined,
+ "X-Fern-Language": "JavaScript",
+ "X-Fern-SDK-Name": "",
+ "X-Fern-SDK-Version": "0.1.0",
+ "X-Fern-Runtime": core.RUNTIME.type,
+ "X-Fern-Runtime-Version": core.RUNTIME.version,
+ },
+ contentType: "application/json",
+ requestType: "json",
+ timeoutMs: requestOptions?.timeoutInSeconds != null ? requestOptions.timeoutInSeconds * 1000 : 60000,
+ maxRetries: requestOptions?.maxRetries,
+ abortSignal: requestOptions?.abortSignal,
+ });
+ if (_response.ok) {
+ return;
+ }
+
+ if (_response.error.reason === "status-code") {
+ switch (_response.error.statusCode) {
+ case 400:
+ throw new Monite.BadRequestError(_response.error.body as Monite.ErrorSchemaResponse);
+ case 403:
+ throw new Monite.ForbiddenError(_response.error.body as Monite.ErrorSchemaResponse);
+ case 404:
+ throw new Monite.NotFoundError(_response.error.body as Monite.ErrorSchemaResponse);
+ case 409:
+ throw new Monite.ConflictError(_response.error.body as Monite.ErrorSchemaResponse);
+ case 422:
+ throw new Monite.UnprocessableEntityError(_response.error.body as Monite.HttpValidationError);
+ case 500:
+ throw new Monite.InternalServerError(_response.error.body as Monite.ErrorSchemaResponse);
+ default:
+ throw new errors.MoniteError({
+ statusCode: _response.error.statusCode,
+ body: _response.error.body,
+ });
+ }
+ }
+
+ switch (_response.error.reason) {
+ case "non-json":
+ throw new errors.MoniteError({
+ statusCode: _response.error.statusCode,
+ body: _response.error.rawBody,
+ });
+ case "timeout":
+ throw new errors.MoniteTimeoutError();
+ case "unknown":
+ throw new errors.MoniteError({
+ message: _response.error.errorMessage,
+ });
+ }
+ }
+
+ /**
+ * Update comment
+ *
+ * @param {string} commentId
+ * @param {Monite.CommentUpdateRequest} request
+ * @param {Comments.RequestOptions} requestOptions - Request-specific configuration.
+ *
+ * @throws {@link Monite.BadRequestError}
+ * @throws {@link Monite.ForbiddenError}
+ * @throws {@link Monite.NotFoundError}
+ * @throws {@link Monite.ConflictError}
+ * @throws {@link Monite.UnprocessableEntityError}
+ * @throws {@link Monite.InternalServerError}
+ *
+ * @example
+ * await client.comments.updateById("comment_id")
+ */
+ public async updateById(
+ commentId: string,
+ request: Monite.CommentUpdateRequest = {},
+ requestOptions?: Comments.RequestOptions
+ ): Promise {
+ const _response = await (this._options.fetcher ?? core.fetcher)({
+ url: urlJoin(
+ (await core.Supplier.get(this._options.environment)) ?? environments.MoniteEnvironment.Sandbox,
+ `comments/${encodeURIComponent(commentId)}`
+ ),
+ method: "PATCH",
+ headers: {
+ Authorization: await this._getAuthorizationHeader(),
+ "x-monite-version": await core.Supplier.get(this._options.moniteVersion),
+ "x-monite-entity-id":
+ (await core.Supplier.get(this._options.moniteEntityId)) != null
+ ? await core.Supplier.get(this._options.moniteEntityId)
+ : undefined,
+ "X-Fern-Language": "JavaScript",
+ "X-Fern-SDK-Name": "",
+ "X-Fern-SDK-Version": "0.1.0",
+ "X-Fern-Runtime": core.RUNTIME.type,
+ "X-Fern-Runtime-Version": core.RUNTIME.version,
+ },
+ contentType: "application/json",
+ requestType: "json",
+ body: request,
+ timeoutMs: requestOptions?.timeoutInSeconds != null ? requestOptions.timeoutInSeconds * 1000 : 60000,
+ maxRetries: requestOptions?.maxRetries,
+ abortSignal: requestOptions?.abortSignal,
+ });
+ if (_response.ok) {
+ return _response.body as Monite.CommentResource;
+ }
+
+ if (_response.error.reason === "status-code") {
+ switch (_response.error.statusCode) {
+ case 400:
+ throw new Monite.BadRequestError(_response.error.body as Monite.ErrorSchemaResponse);
+ case 403:
+ throw new Monite.ForbiddenError(_response.error.body as Monite.ErrorSchemaResponse);
+ case 404:
+ throw new Monite.NotFoundError(_response.error.body as Monite.ErrorSchemaResponse);
+ case 409:
+ throw new Monite.ConflictError(_response.error.body as Monite.ErrorSchemaResponse);
+ case 422:
+ throw new Monite.UnprocessableEntityError(_response.error.body as Monite.HttpValidationError);
+ case 500:
+ throw new Monite.InternalServerError(_response.error.body as Monite.ErrorSchemaResponse);
+ default:
+ throw new errors.MoniteError({
+ statusCode: _response.error.statusCode,
+ body: _response.error.body,
+ });
+ }
+ }
+
+ switch (_response.error.reason) {
+ case "non-json":
+ throw new errors.MoniteError({
+ statusCode: _response.error.statusCode,
+ body: _response.error.rawBody,
+ });
+ case "timeout":
+ throw new errors.MoniteTimeoutError();
+ case "unknown":
+ throw new errors.MoniteError({
+ message: _response.error.errorMessage,
+ });
+ }
+ }
+
+ protected async _getAuthorizationHeader(): Promise {
+ const bearer = await core.Supplier.get(this._options.token);
+ if (bearer != null) {
+ return `Bearer ${bearer}`;
+ }
+
+ return undefined;
+ }
+}
diff --git a/src/api/resources/comments/client/index.ts b/src/api/resources/comments/client/index.ts
new file mode 100644
index 0000000..415726b
--- /dev/null
+++ b/src/api/resources/comments/client/index.ts
@@ -0,0 +1 @@
+export * from "./requests";
diff --git a/src/api/resources/comments/client/requests/CommentCreateRequest.ts b/src/api/resources/comments/client/requests/CommentCreateRequest.ts
new file mode 100644
index 0000000..c165628
--- /dev/null
+++ b/src/api/resources/comments/client/requests/CommentCreateRequest.ts
@@ -0,0 +1,18 @@
+/**
+ * This file was auto-generated by Fern from our API Definition.
+ */
+
+/**
+ * @example
+ * {
+ * object_id: "object_id",
+ * object_type: "object_type",
+ * text: "text"
+ * }
+ */
+export interface CommentCreateRequest {
+ object_id: string;
+ object_type: string;
+ reply_to_entity_user_id?: string;
+ text: string;
+}
diff --git a/src/api/resources/comments/client/requests/CommentUpdateRequest.ts b/src/api/resources/comments/client/requests/CommentUpdateRequest.ts
new file mode 100644
index 0000000..24f8cb1
--- /dev/null
+++ b/src/api/resources/comments/client/requests/CommentUpdateRequest.ts
@@ -0,0 +1,12 @@
+/**
+ * This file was auto-generated by Fern from our API Definition.
+ */
+
+/**
+ * @example
+ * {}
+ */
+export interface CommentUpdateRequest {
+ reply_to_entity_user_id?: string;
+ text?: string;
+}
diff --git a/src/api/resources/comments/client/requests/CommentsGetRequest.ts b/src/api/resources/comments/client/requests/CommentsGetRequest.ts
new file mode 100644
index 0000000..e2e4987
--- /dev/null
+++ b/src/api/resources/comments/client/requests/CommentsGetRequest.ts
@@ -0,0 +1,37 @@
+/**
+ * This file was auto-generated by Fern from our API Definition.
+ */
+
+import * as Monite from "../../../../index";
+
+/**
+ * @example
+ * {
+ * object_type: "payable",
+ * object_id: "object_id"
+ * }
+ */
+export interface CommentsGetRequest {
+ object_type: Monite.ObjectTypeAvailableComment;
+ object_id: string;
+ /**
+ * Order by
+ */
+ order?: Monite.OrderEnum;
+ /**
+ * Max is 100
+ */
+ limit?: number;
+ /**
+ * A token, obtained from previous page. Prior over other filters
+ */
+ pagination_token?: string;
+ /**
+ * Allowed sort fields
+ */
+ sort?: Monite.CommentCursorFields;
+ created_at__gt?: string;
+ created_at__lt?: string;
+ created_at__gte?: string;
+ created_at__lte?: string;
+}
diff --git a/src/api/resources/comments/client/requests/index.ts b/src/api/resources/comments/client/requests/index.ts
new file mode 100644
index 0000000..abd2be4
--- /dev/null
+++ b/src/api/resources/comments/client/requests/index.ts
@@ -0,0 +1,3 @@
+export { type CommentsGetRequest } from "./CommentsGetRequest";
+export { type CommentCreateRequest } from "./CommentCreateRequest";
+export { type CommentUpdateRequest } from "./CommentUpdateRequest";
diff --git a/src/api/resources/comments/index.ts b/src/api/resources/comments/index.ts
new file mode 100644
index 0000000..5ec7692
--- /dev/null
+++ b/src/api/resources/comments/index.ts
@@ -0,0 +1 @@
+export * from "./client";
diff --git a/src/api/resources/counterparts/client/Client.ts b/src/api/resources/counterparts/client/Client.ts
new file mode 100644
index 0000000..361d3aa
--- /dev/null
+++ b/src/api/resources/counterparts/client/Client.ts
@@ -0,0 +1,784 @@
+/**
+ * This file was auto-generated by Fern from our API Definition.
+ */
+
+import * as environments from "../../../../environments";
+import * as core from "../../../../core";
+import * as Monite from "../../../index";
+import urlJoin from "url-join";
+import * as errors from "../../../../errors/index";
+import { Addresses } from "../resources/addresses/client/Client";
+import { BankAccounts } from "../resources/bankAccounts/client/Client";
+import { Contacts } from "../resources/contacts/client/Client";
+import { VatIds } from "../resources/vatIds/client/Client";
+
+export declare namespace Counterparts {
+ interface Options {
+ environment?: core.Supplier;
+ token?: core.Supplier;
+ /** Override the x-monite-version header */
+ moniteVersion: core.Supplier;
+ /** Override the x-monite-entity-id header */
+ moniteEntityId?: core.Supplier;
+ fetcher?: core.FetchFunction;
+ }
+
+ interface RequestOptions {
+ /** The maximum time to wait for a response in seconds. */
+ timeoutInSeconds?: number;
+ /** The number of times to retry the request. Defaults to 2. */
+ maxRetries?: number;
+ /** A hook to abort the request. */
+ abortSignal?: AbortSignal;
+ /** Override the x-monite-version header */
+ moniteVersion?: string;
+ /** Override the x-monite-entity-id header */
+ moniteEntityId?: string | undefined;
+ }
+}
+
+export class Counterparts {
+ constructor(protected readonly _options: Counterparts.Options) {}
+
+ /**
+ * @param {Monite.CounterpartsGetRequest} request
+ * @param {Counterparts.RequestOptions} requestOptions - Request-specific configuration.
+ *
+ * @throws {@link Monite.NotFoundError}
+ * @throws {@link Monite.UnprocessableEntityError}
+ * @throws {@link Monite.InternalServerError}
+ *
+ * @example
+ * await client.counterparts.get({
+ * sort_code: "123456"
+ * })
+ */
+ public async get(
+ request: Monite.CounterpartsGetRequest = {},
+ requestOptions?: Counterparts.RequestOptions
+ ): Promise {
+ const {
+ iban,
+ sort_code: sortCode,
+ account_number: accountNumber,
+ tax_id: taxId,
+ vat_id: vatId,
+ id__in: idIn,
+ order,
+ limit,
+ pagination_token: paginationToken,
+ sort,
+ type: type_,
+ counterpart_name: counterpartName,
+ counterpart_name__iexact: counterpartNameIexact,
+ counterpart_name__contains: counterpartNameContains,
+ counterpart_name__icontains: counterpartNameIcontains,
+ is_vendor: isVendor,
+ is_customer: isCustomer,
+ email,
+ email__contains: emailContains,
+ email__icontains: emailIcontains,
+ created_at__gt: createdAtGt,
+ created_at__lt: createdAtLt,
+ created_at__gte: createdAtGte,
+ created_at__lte: createdAtLte,
+ "address.country": addressCountry,
+ "address.city": addressCity,
+ "address.postal_code": addressPostalCode,
+ "address.state": addressState,
+ "address.line1": addressLine1,
+ "address.line2": addressLine2,
+ tag_ids__in: tagIdsIn,
+ } = request;
+ const _queryParams: Record = {};
+ if (iban != null) {
+ _queryParams["iban"] = iban;
+ }
+
+ if (sortCode != null) {
+ _queryParams["sort_code"] = sortCode;
+ }
+
+ if (accountNumber != null) {
+ _queryParams["account_number"] = accountNumber;
+ }
+
+ if (taxId != null) {
+ _queryParams["tax_id"] = taxId;
+ }
+
+ if (vatId != null) {
+ _queryParams["vat_id"] = vatId;
+ }
+
+ if (idIn != null) {
+ if (Array.isArray(idIn)) {
+ _queryParams["id__in"] = idIn.map((item) => item);
+ } else {
+ _queryParams["id__in"] = idIn;
+ }
+ }
+
+ if (order != null) {
+ _queryParams["order"] = order;
+ }
+
+ if (limit != null) {
+ _queryParams["limit"] = limit.toString();
+ }
+
+ if (paginationToken != null) {
+ _queryParams["pagination_token"] = paginationToken;
+ }
+
+ if (sort != null) {
+ _queryParams["sort"] = sort;
+ }
+
+ if (type_ != null) {
+ _queryParams["type"] = type_;
+ }
+
+ if (counterpartName != null) {
+ _queryParams["counterpart_name"] = counterpartName;
+ }
+
+ if (counterpartNameIexact != null) {
+ _queryParams["counterpart_name__iexact"] = counterpartNameIexact;
+ }
+
+ if (counterpartNameContains != null) {
+ _queryParams["counterpart_name__contains"] = counterpartNameContains;
+ }
+
+ if (counterpartNameIcontains != null) {
+ _queryParams["counterpart_name__icontains"] = counterpartNameIcontains;
+ }
+
+ if (isVendor != null) {
+ _queryParams["is_vendor"] = isVendor.toString();
+ }
+
+ if (isCustomer != null) {
+ _queryParams["is_customer"] = isCustomer.toString();
+ }
+
+ if (email != null) {
+ _queryParams["email"] = email;
+ }
+
+ if (emailContains != null) {
+ _queryParams["email__contains"] = emailContains;
+ }
+
+ if (emailIcontains != null) {
+ _queryParams["email__icontains"] = emailIcontains;
+ }
+
+ if (createdAtGt != null) {
+ _queryParams["created_at__gt"] = createdAtGt;
+ }
+
+ if (createdAtLt != null) {
+ _queryParams["created_at__lt"] = createdAtLt;
+ }
+
+ if (createdAtGte != null) {
+ _queryParams["created_at__gte"] = createdAtGte;
+ }
+
+ if (createdAtLte != null) {
+ _queryParams["created_at__lte"] = createdAtLte;
+ }
+
+ if (addressCountry != null) {
+ _queryParams["address.country"] = addressCountry;
+ }
+
+ if (addressCity != null) {
+ _queryParams["address.city"] = addressCity;
+ }
+
+ if (addressPostalCode != null) {
+ _queryParams["address.postal_code"] = addressPostalCode;
+ }
+
+ if (addressState != null) {
+ _queryParams["address.state"] = addressState;
+ }
+
+ if (addressLine1 != null) {
+ _queryParams["address.line1"] = addressLine1;
+ }
+
+ if (addressLine2 != null) {
+ _queryParams["address.line2"] = addressLine2;
+ }
+
+ if (tagIdsIn != null) {
+ if (Array.isArray(tagIdsIn)) {
+ _queryParams["tag_ids__in"] = tagIdsIn.map((item) => item);
+ } else {
+ _queryParams["tag_ids__in"] = tagIdsIn;
+ }
+ }
+
+ const _response = await (this._options.fetcher ?? core.fetcher)({
+ url: urlJoin(
+ (await core.Supplier.get(this._options.environment)) ?? environments.MoniteEnvironment.Sandbox,
+ "counterparts"
+ ),
+ method: "GET",
+ headers: {
+ Authorization: await this._getAuthorizationHeader(),
+ "x-monite-version": await core.Supplier.get(this._options.moniteVersion),
+ "x-monite-entity-id":
+ (await core.Supplier.get(this._options.moniteEntityId)) != null
+ ? await core.Supplier.get(this._options.moniteEntityId)
+ : undefined,
+ "X-Fern-Language": "JavaScript",
+ "X-Fern-SDK-Name": "",
+ "X-Fern-SDK-Version": "0.1.0",
+ "X-Fern-Runtime": core.RUNTIME.type,
+ "X-Fern-Runtime-Version": core.RUNTIME.version,
+ },
+ contentType: "application/json",
+ queryParameters: _queryParams,
+ requestType: "json",
+ timeoutMs: requestOptions?.timeoutInSeconds != null ? requestOptions.timeoutInSeconds * 1000 : 60000,
+ maxRetries: requestOptions?.maxRetries,
+ abortSignal: requestOptions?.abortSignal,
+ });
+ if (_response.ok) {
+ return _response.body as Monite.CounterpartPaginationResponse;
+ }
+
+ if (_response.error.reason === "status-code") {
+ switch (_response.error.statusCode) {
+ case 404:
+ throw new Monite.NotFoundError(_response.error.body as Monite.ErrorSchemaResponse);
+ case 422:
+ throw new Monite.UnprocessableEntityError(_response.error.body as Monite.HttpValidationError);
+ case 500:
+ throw new Monite.InternalServerError(_response.error.body as Monite.ErrorSchemaResponse);
+ default:
+ throw new errors.MoniteError({
+ statusCode: _response.error.statusCode,
+ body: _response.error.body,
+ });
+ }
+ }
+
+ switch (_response.error.reason) {
+ case "non-json":
+ throw new errors.MoniteError({
+ statusCode: _response.error.statusCode,
+ body: _response.error.rawBody,
+ });
+ case "timeout":
+ throw new errors.MoniteTimeoutError();
+ case "unknown":
+ throw new errors.MoniteError({
+ message: _response.error.errorMessage,
+ });
+ }
+ }
+
+ /**
+ * @param {Monite.CounterpartCreatePayload} request
+ * @param {Counterparts.RequestOptions} requestOptions - Request-specific configuration.
+ *
+ * @throws {@link Monite.UnprocessableEntityError}
+ * @throws {@link Monite.InternalServerError}
+ *
+ * @example
+ * await client.counterparts.create({
+ * type: "individual",
+ * individual: {
+ * address: {
+ * city: "Berlin",
+ * country: "AF",
+ * line1: "Flughafenstrasse 52",
+ * postal_code: "10115"
+ * },
+ * first_name: "Adnan",
+ * is_customer: true,
+ * is_vendor: true,
+ * last_name: "Singh"
+ * }
+ * })
+ */
+ public async create(
+ request: Monite.CounterpartCreatePayload,
+ requestOptions?: Counterparts.RequestOptions
+ ): Promise {
+ const _response = await (this._options.fetcher ?? core.fetcher)({
+ url: urlJoin(
+ (await core.Supplier.get(this._options.environment)) ?? environments.MoniteEnvironment.Sandbox,
+ "counterparts"
+ ),
+ method: "POST",
+ headers: {
+ Authorization: await this._getAuthorizationHeader(),
+ "x-monite-version": await core.Supplier.get(this._options.moniteVersion),
+ "x-monite-entity-id":
+ (await core.Supplier.get(this._options.moniteEntityId)) != null
+ ? await core.Supplier.get(this._options.moniteEntityId)
+ : undefined,
+ "X-Fern-Language": "JavaScript",
+ "X-Fern-SDK-Name": "",
+ "X-Fern-SDK-Version": "0.1.0",
+ "X-Fern-Runtime": core.RUNTIME.type,
+ "X-Fern-Runtime-Version": core.RUNTIME.version,
+ },
+ contentType: "application/json",
+ requestType: "json",
+ body: request,
+ timeoutMs: requestOptions?.timeoutInSeconds != null ? requestOptions.timeoutInSeconds * 1000 : 60000,
+ maxRetries: requestOptions?.maxRetries,
+ abortSignal: requestOptions?.abortSignal,
+ });
+ if (_response.ok) {
+ return _response.body as Monite.CounterpartResponse;
+ }
+
+ if (_response.error.reason === "status-code") {
+ switch (_response.error.statusCode) {
+ case 422:
+ throw new Monite.UnprocessableEntityError(_response.error.body as Monite.HttpValidationError);
+ case 500:
+ throw new Monite.InternalServerError(_response.error.body as Monite.ErrorSchemaResponse);
+ default:
+ throw new errors.MoniteError({
+ statusCode: _response.error.statusCode,
+ body: _response.error.body,
+ });
+ }
+ }
+
+ switch (_response.error.reason) {
+ case "non-json":
+ throw new errors.MoniteError({
+ statusCode: _response.error.statusCode,
+ body: _response.error.rawBody,
+ });
+ case "timeout":
+ throw new errors.MoniteTimeoutError();
+ case "unknown":
+ throw new errors.MoniteError({
+ message: _response.error.errorMessage,
+ });
+ }
+ }
+
+ /**
+ * @param {string} counterpartId
+ * @param {Counterparts.RequestOptions} requestOptions - Request-specific configuration.
+ *
+ * @throws {@link Monite.NotFoundError}
+ * @throws {@link Monite.UnprocessableEntityError}
+ * @throws {@link Monite.InternalServerError}
+ *
+ * @example
+ * await client.counterparts.getById("counterpart_id")
+ */
+ public async getById(
+ counterpartId: string,
+ requestOptions?: Counterparts.RequestOptions
+ ): Promise {
+ const _response = await (this._options.fetcher ?? core.fetcher)({
+ url: urlJoin(
+ (await core.Supplier.get(this._options.environment)) ?? environments.MoniteEnvironment.Sandbox,
+ `counterparts/${encodeURIComponent(counterpartId)}`
+ ),
+ method: "GET",
+ headers: {
+ Authorization: await this._getAuthorizationHeader(),
+ "x-monite-version": await core.Supplier.get(this._options.moniteVersion),
+ "x-monite-entity-id":
+ (await core.Supplier.get(this._options.moniteEntityId)) != null
+ ? await core.Supplier.get(this._options.moniteEntityId)
+ : undefined,
+ "X-Fern-Language": "JavaScript",
+ "X-Fern-SDK-Name": "",
+ "X-Fern-SDK-Version": "0.1.0",
+ "X-Fern-Runtime": core.RUNTIME.type,
+ "X-Fern-Runtime-Version": core.RUNTIME.version,
+ },
+ contentType: "application/json",
+ requestType: "json",
+ timeoutMs: requestOptions?.timeoutInSeconds != null ? requestOptions.timeoutInSeconds * 1000 : 60000,
+ maxRetries: requestOptions?.maxRetries,
+ abortSignal: requestOptions?.abortSignal,
+ });
+ if (_response.ok) {
+ return _response.body as Monite.CounterpartResponse;
+ }
+
+ if (_response.error.reason === "status-code") {
+ switch (_response.error.statusCode) {
+ case 404:
+ throw new Monite.NotFoundError(_response.error.body as Monite.ErrorSchemaResponse);
+ case 422:
+ throw new Monite.UnprocessableEntityError(_response.error.body as Monite.HttpValidationError);
+ case 500:
+ throw new Monite.InternalServerError(_response.error.body as Monite.ErrorSchemaResponse);
+ default:
+ throw new errors.MoniteError({
+ statusCode: _response.error.statusCode,
+ body: _response.error.body,
+ });
+ }
+ }
+
+ switch (_response.error.reason) {
+ case "non-json":
+ throw new errors.MoniteError({
+ statusCode: _response.error.statusCode,
+ body: _response.error.rawBody,
+ });
+ case "timeout":
+ throw new errors.MoniteTimeoutError();
+ case "unknown":
+ throw new errors.MoniteError({
+ message: _response.error.errorMessage,
+ });
+ }
+ }
+
+ /**
+ * @param {string} counterpartId
+ * @param {Counterparts.RequestOptions} requestOptions - Request-specific configuration.
+ *
+ * @throws {@link Monite.NotFoundError}
+ * @throws {@link Monite.UnprocessableEntityError}
+ * @throws {@link Monite.InternalServerError}
+ *
+ * @example
+ * await client.counterparts.deleteById("counterpart_id")
+ */
+ public async deleteById(counterpartId: string, requestOptions?: Counterparts.RequestOptions): Promise {
+ const _response = await (this._options.fetcher ?? core.fetcher)({
+ url: urlJoin(
+ (await core.Supplier.get(this._options.environment)) ?? environments.MoniteEnvironment.Sandbox,
+ `counterparts/${encodeURIComponent(counterpartId)}`
+ ),
+ method: "DELETE",
+ headers: {
+ Authorization: await this._getAuthorizationHeader(),
+ "x-monite-version": await core.Supplier.get(this._options.moniteVersion),
+ "x-monite-entity-id":
+ (await core.Supplier.get(this._options.moniteEntityId)) != null
+ ? await core.Supplier.get(this._options.moniteEntityId)
+ : undefined,
+ "X-Fern-Language": "JavaScript",
+ "X-Fern-SDK-Name": "",
+ "X-Fern-SDK-Version": "0.1.0",
+ "X-Fern-Runtime": core.RUNTIME.type,
+ "X-Fern-Runtime-Version": core.RUNTIME.version,
+ },
+ contentType: "application/json",
+ requestType: "json",
+ timeoutMs: requestOptions?.timeoutInSeconds != null ? requestOptions.timeoutInSeconds * 1000 : 60000,
+ maxRetries: requestOptions?.maxRetries,
+ abortSignal: requestOptions?.abortSignal,
+ });
+ if (_response.ok) {
+ return;
+ }
+
+ if (_response.error.reason === "status-code") {
+ switch (_response.error.statusCode) {
+ case 404:
+ throw new Monite.NotFoundError(_response.error.body as Monite.ErrorSchemaResponse);
+ case 422:
+ throw new Monite.UnprocessableEntityError(_response.error.body as Monite.HttpValidationError);
+ case 500:
+ throw new Monite.InternalServerError(_response.error.body as Monite.ErrorSchemaResponse);
+ default:
+ throw new errors.MoniteError({
+ statusCode: _response.error.statusCode,
+ body: _response.error.body,
+ });
+ }
+ }
+
+ switch (_response.error.reason) {
+ case "non-json":
+ throw new errors.MoniteError({
+ statusCode: _response.error.statusCode,
+ body: _response.error.rawBody,
+ });
+ case "timeout":
+ throw new errors.MoniteTimeoutError();
+ case "unknown":
+ throw new errors.MoniteError({
+ message: _response.error.errorMessage,
+ });
+ }
+ }
+
+ /**
+ * @param {string} counterpartId
+ * @param {Monite.CounterpartUpdatePayload} request
+ * @param {Counterparts.RequestOptions} requestOptions - Request-specific configuration.
+ *
+ * @throws {@link Monite.NotFoundError}
+ * @throws {@link Monite.UnprocessableEntityError}
+ * @throws {@link Monite.InternalServerError}
+ *
+ * @example
+ * await client.counterparts.updateById("counterpart_id", {
+ * individual: {}
+ * })
+ */
+ public async updateById(
+ counterpartId: string,
+ request: Monite.CounterpartUpdatePayload,
+ requestOptions?: Counterparts.RequestOptions
+ ): Promise {
+ const _response = await (this._options.fetcher ?? core.fetcher)({
+ url: urlJoin(
+ (await core.Supplier.get(this._options.environment)) ?? environments.MoniteEnvironment.Sandbox,
+ `counterparts/${encodeURIComponent(counterpartId)}`
+ ),
+ method: "PATCH",
+ headers: {
+ Authorization: await this._getAuthorizationHeader(),
+ "x-monite-version": await core.Supplier.get(this._options.moniteVersion),
+ "x-monite-entity-id":
+ (await core.Supplier.get(this._options.moniteEntityId)) != null
+ ? await core.Supplier.get(this._options.moniteEntityId)
+ : undefined,
+ "X-Fern-Language": "JavaScript",
+ "X-Fern-SDK-Name": "",
+ "X-Fern-SDK-Version": "0.1.0",
+ "X-Fern-Runtime": core.RUNTIME.type,
+ "X-Fern-Runtime-Version": core.RUNTIME.version,
+ },
+ contentType: "application/json",
+ requestType: "json",
+ body: request,
+ timeoutMs: requestOptions?.timeoutInSeconds != null ? requestOptions.timeoutInSeconds * 1000 : 60000,
+ maxRetries: requestOptions?.maxRetries,
+ abortSignal: requestOptions?.abortSignal,
+ });
+ if (_response.ok) {
+ return _response.body as Monite.CounterpartResponse;
+ }
+
+ if (_response.error.reason === "status-code") {
+ switch (_response.error.statusCode) {
+ case 404:
+ throw new Monite.NotFoundError(_response.error.body as Monite.ErrorSchemaResponse);
+ case 422:
+ throw new Monite.UnprocessableEntityError(_response.error.body as Monite.HttpValidationError);
+ case 500:
+ throw new Monite.InternalServerError(_response.error.body as Monite.ErrorSchemaResponse);
+ default:
+ throw new errors.MoniteError({
+ statusCode: _response.error.statusCode,
+ body: _response.error.body,
+ });
+ }
+ }
+
+ switch (_response.error.reason) {
+ case "non-json":
+ throw new errors.MoniteError({
+ statusCode: _response.error.statusCode,
+ body: _response.error.rawBody,
+ });
+ case "timeout":
+ throw new errors.MoniteTimeoutError();
+ case "unknown":
+ throw new errors.MoniteError({
+ message: _response.error.errorMessage,
+ });
+ }
+ }
+
+ /**
+ * @param {string} counterpartId
+ * @param {Counterparts.RequestOptions} requestOptions - Request-specific configuration.
+ *
+ * @throws {@link Monite.UnprocessableEntityError}
+ * @throws {@link Monite.InternalServerError}
+ *
+ * @example
+ * await client.counterparts.getPartnerMetadataById("counterpart_id")
+ */
+ public async getPartnerMetadataById(
+ counterpartId: string,
+ requestOptions?: Counterparts.RequestOptions
+ ): Promise {
+ const _response = await (this._options.fetcher ?? core.fetcher)({
+ url: urlJoin(
+ (await core.Supplier.get(this._options.environment)) ?? environments.MoniteEnvironment.Sandbox,
+ `counterparts/${encodeURIComponent(counterpartId)}/partner_metadata`
+ ),
+ method: "GET",
+ headers: {
+ Authorization: await this._getAuthorizationHeader(),
+ "x-monite-version": await core.Supplier.get(this._options.moniteVersion),
+ "x-monite-entity-id":
+ (await core.Supplier.get(this._options.moniteEntityId)) != null
+ ? await core.Supplier.get(this._options.moniteEntityId)
+ : undefined,
+ "X-Fern-Language": "JavaScript",
+ "X-Fern-SDK-Name": "",
+ "X-Fern-SDK-Version": "0.1.0",
+ "X-Fern-Runtime": core.RUNTIME.type,
+ "X-Fern-Runtime-Version": core.RUNTIME.version,
+ },
+ contentType: "application/json",
+ requestType: "json",
+ timeoutMs: requestOptions?.timeoutInSeconds != null ? requestOptions.timeoutInSeconds * 1000 : 60000,
+ maxRetries: requestOptions?.maxRetries,
+ abortSignal: requestOptions?.abortSignal,
+ });
+ if (_response.ok) {
+ return _response.body as Monite.PartnerMetadataResponse;
+ }
+
+ if (_response.error.reason === "status-code") {
+ switch (_response.error.statusCode) {
+ case 422:
+ throw new Monite.UnprocessableEntityError(_response.error.body as Monite.HttpValidationError);
+ case 500:
+ throw new Monite.InternalServerError(_response.error.body as Monite.ErrorSchemaResponse);
+ default:
+ throw new errors.MoniteError({
+ statusCode: _response.error.statusCode,
+ body: _response.error.body,
+ });
+ }
+ }
+
+ switch (_response.error.reason) {
+ case "non-json":
+ throw new errors.MoniteError({
+ statusCode: _response.error.statusCode,
+ body: _response.error.rawBody,
+ });
+ case "timeout":
+ throw new errors.MoniteTimeoutError();
+ case "unknown":
+ throw new errors.MoniteError({
+ message: _response.error.errorMessage,
+ });
+ }
+ }
+
+ /**
+ * @param {string} counterpartId
+ * @param {Monite.PartnerMetadata} request
+ * @param {Counterparts.RequestOptions} requestOptions - Request-specific configuration.
+ *
+ * @throws {@link Monite.UnprocessableEntityError}
+ * @throws {@link Monite.InternalServerError}
+ *
+ * @example
+ * await client.counterparts.updatePartnerMetadataById("counterpart_id", {
+ * metadata: {
+ * "key": "value"
+ * }
+ * })
+ */
+ public async updatePartnerMetadataById(
+ counterpartId: string,
+ request: Monite.PartnerMetadata,
+ requestOptions?: Counterparts.RequestOptions
+ ): Promise {
+ const _response = await (this._options.fetcher ?? core.fetcher)({
+ url: urlJoin(
+ (await core.Supplier.get(this._options.environment)) ?? environments.MoniteEnvironment.Sandbox,
+ `counterparts/${encodeURIComponent(counterpartId)}/partner_metadata`
+ ),
+ method: "PUT",
+ headers: {
+ Authorization: await this._getAuthorizationHeader(),
+ "x-monite-version": await core.Supplier.get(this._options.moniteVersion),
+ "x-monite-entity-id":
+ (await core.Supplier.get(this._options.moniteEntityId)) != null
+ ? await core.Supplier.get(this._options.moniteEntityId)
+ : undefined,
+ "X-Fern-Language": "JavaScript",
+ "X-Fern-SDK-Name": "",
+ "X-Fern-SDK-Version": "0.1.0",
+ "X-Fern-Runtime": core.RUNTIME.type,
+ "X-Fern-Runtime-Version": core.RUNTIME.version,
+ },
+ contentType: "application/json",
+ requestType: "json",
+ body: request,
+ timeoutMs: requestOptions?.timeoutInSeconds != null ? requestOptions.timeoutInSeconds * 1000 : 60000,
+ maxRetries: requestOptions?.maxRetries,
+ abortSignal: requestOptions?.abortSignal,
+ });
+ if (_response.ok) {
+ return _response.body as Monite.PartnerMetadataResponse;
+ }
+
+ if (_response.error.reason === "status-code") {
+ switch (_response.error.statusCode) {
+ case 422:
+ throw new Monite.UnprocessableEntityError(_response.error.body as Monite.HttpValidationError);
+ case 500:
+ throw new Monite.InternalServerError(_response.error.body as Monite.ErrorSchemaResponse);
+ default:
+ throw new errors.MoniteError({
+ statusCode: _response.error.statusCode,
+ body: _response.error.body,
+ });
+ }
+ }
+
+ switch (_response.error.reason) {
+ case "non-json":
+ throw new errors.MoniteError({
+ statusCode: _response.error.statusCode,
+ body: _response.error.rawBody,
+ });
+ case "timeout":
+ throw new errors.MoniteTimeoutError();
+ case "unknown":
+ throw new errors.MoniteError({
+ message: _response.error.errorMessage,
+ });
+ }
+ }
+
+ protected _addresses: Addresses | undefined;
+
+ public get addresses(): Addresses {
+ return (this._addresses ??= new Addresses(this._options));
+ }
+
+ protected _bankAccounts: BankAccounts | undefined;
+
+ public get bankAccounts(): BankAccounts {
+ return (this._bankAccounts ??= new BankAccounts(this._options));
+ }
+
+ protected _contacts: Contacts | undefined;
+
+ public get contacts(): Contacts {
+ return (this._contacts ??= new Contacts(this._options));
+ }
+
+ protected _vatIds: VatIds | undefined;
+
+ public get vatIds(): VatIds {
+ return (this._vatIds ??= new VatIds(this._options));
+ }
+
+ protected async _getAuthorizationHeader(): Promise {
+ const bearer = await core.Supplier.get(this._options.token);
+ if (bearer != null) {
+ return `Bearer ${bearer}`;
+ }
+
+ return undefined;
+ }
+}
diff --git a/src/api/resources/counterparts/client/index.ts b/src/api/resources/counterparts/client/index.ts
new file mode 100644
index 0000000..415726b
--- /dev/null
+++ b/src/api/resources/counterparts/client/index.ts
@@ -0,0 +1 @@
+export * from "./requests";
diff --git a/src/api/resources/counterparts/client/requests/CounterpartsGetRequest.ts b/src/api/resources/counterparts/client/requests/CounterpartsGetRequest.ts
new file mode 100644
index 0000000..4009234
--- /dev/null
+++ b/src/api/resources/counterparts/client/requests/CounterpartsGetRequest.ts
@@ -0,0 +1,75 @@
+/**
+ * This file was auto-generated by Fern from our API Definition.
+ */
+
+import * as Monite from "../../../../index";
+
+/**
+ * @example
+ * {
+ * sort_code: "123456"
+ * }
+ */
+export interface CounterpartsGetRequest {
+ /**
+ * The IBAN of the counterpart's bank account.
+ */
+ iban?: string;
+ /**
+ * The bank's sort code.
+ */
+ sort_code?: string;
+ /**
+ * The bank account number. Required for US bank accounts to accept ACH payments. US account numbers contain 9 to 12 digits. UK account numbers typically contain 8 digits.
+ */
+ account_number?: string;
+ /**
+ * The tax ID of the counterpart.
+ */
+ tax_id?: string;
+ /**
+ * The VAT ID of the counterpart.
+ */
+ vat_id?: string;
+ /**
+ * A list of counterpart IDs to search through.
+ */
+ id__in?: string | string[];
+ /**
+ * Order by
+ */
+ order?: Monite.OrderEnum;
+ /**
+ * Max is 100
+ */
+ limit?: number;
+ /**
+ * A token, obtained from previous page. Prior over other filters
+ */
+ pagination_token?: string;
+ /**
+ * Allowed sort fields
+ */
+ sort?: Monite.CounterpartCursorFields;
+ type?: Monite.CounterpartType;
+ counterpart_name?: string;
+ counterpart_name__iexact?: string;
+ counterpart_name__contains?: string;
+ counterpart_name__icontains?: string;
+ is_vendor?: boolean;
+ is_customer?: boolean;
+ email?: string;
+ email__contains?: string;
+ email__icontains?: string;
+ created_at__gt?: string;
+ created_at__lt?: string;
+ created_at__gte?: string;
+ created_at__lte?: string;
+ "address.country"?: string;
+ "address.city"?: string;
+ "address.postal_code"?: string;
+ "address.state"?: string;
+ "address.line1"?: string;
+ "address.line2"?: string;
+ tag_ids__in?: string | string[];
+}
diff --git a/src/api/resources/counterparts/client/requests/index.ts b/src/api/resources/counterparts/client/requests/index.ts
new file mode 100644
index 0000000..1243c04
--- /dev/null
+++ b/src/api/resources/counterparts/client/requests/index.ts
@@ -0,0 +1 @@
+export { type CounterpartsGetRequest } from "./CounterpartsGetRequest";
diff --git a/src/api/resources/counterparts/index.ts b/src/api/resources/counterparts/index.ts
new file mode 100644
index 0000000..33a87f1
--- /dev/null
+++ b/src/api/resources/counterparts/index.ts
@@ -0,0 +1,2 @@
+export * from "./client";
+export * from "./resources";
diff --git a/src/api/resources/counterparts/resources/addresses/client/Client.ts b/src/api/resources/counterparts/resources/addresses/client/Client.ts
new file mode 100644
index 0000000..aec4965
--- /dev/null
+++ b/src/api/resources/counterparts/resources/addresses/client/Client.ts
@@ -0,0 +1,439 @@
+/**
+ * This file was auto-generated by Fern from our API Definition.
+ */
+
+import * as environments from "../../../../../../environments";
+import * as core from "../../../../../../core";
+import * as Monite from "../../../../../index";
+import urlJoin from "url-join";
+import * as errors from "../../../../../../errors/index";
+
+export declare namespace Addresses {
+ interface Options {
+ environment?: core.Supplier;
+ token?: core.Supplier;
+ /** Override the x-monite-version header */
+ moniteVersion: core.Supplier;
+ /** Override the x-monite-entity-id header */
+ moniteEntityId?: core.Supplier;
+ fetcher?: core.FetchFunction;
+ }
+
+ interface RequestOptions {
+ /** The maximum time to wait for a response in seconds. */
+ timeoutInSeconds?: number;
+ /** The number of times to retry the request. Defaults to 2. */
+ maxRetries?: number;
+ /** A hook to abort the request. */
+ abortSignal?: AbortSignal;
+ /** Override the x-monite-version header */
+ moniteVersion?: string;
+ /** Override the x-monite-entity-id header */
+ moniteEntityId?: string | undefined;
+ }
+}
+
+export class Addresses {
+ constructor(protected readonly _options: Addresses.Options) {}
+
+ /**
+ * @param {string} counterpartId
+ * @param {Addresses.RequestOptions} requestOptions - Request-specific configuration.
+ *
+ * @throws {@link Monite.NotFoundError}
+ * @throws {@link Monite.UnprocessableEntityError}
+ * @throws {@link Monite.InternalServerError}
+ *
+ * @example
+ * await client.counterparts.addresses.get("counterpart_id")
+ */
+ public async get(
+ counterpartId: string,
+ requestOptions?: Addresses.RequestOptions
+ ): Promise {
+ const _response = await (this._options.fetcher ?? core.fetcher)({
+ url: urlJoin(
+ (await core.Supplier.get(this._options.environment)) ?? environments.MoniteEnvironment.Sandbox,
+ `counterparts/${encodeURIComponent(counterpartId)}/addresses`
+ ),
+ method: "GET",
+ headers: {
+ Authorization: await this._getAuthorizationHeader(),
+ "x-monite-version": await core.Supplier.get(this._options.moniteVersion),
+ "x-monite-entity-id":
+ (await core.Supplier.get(this._options.moniteEntityId)) != null
+ ? await core.Supplier.get(this._options.moniteEntityId)
+ : undefined,
+ "X-Fern-Language": "JavaScript",
+ "X-Fern-SDK-Name": "",
+ "X-Fern-SDK-Version": "0.1.0",
+ "X-Fern-Runtime": core.RUNTIME.type,
+ "X-Fern-Runtime-Version": core.RUNTIME.version,
+ },
+ contentType: "application/json",
+ requestType: "json",
+ timeoutMs: requestOptions?.timeoutInSeconds != null ? requestOptions.timeoutInSeconds * 1000 : 60000,
+ maxRetries: requestOptions?.maxRetries,
+ abortSignal: requestOptions?.abortSignal,
+ });
+ if (_response.ok) {
+ return _response.body as Monite.CounterpartAddressResourceList;
+ }
+
+ if (_response.error.reason === "status-code") {
+ switch (_response.error.statusCode) {
+ case 404:
+ throw new Monite.NotFoundError(_response.error.body as Monite.ErrorSchemaResponse);
+ case 422:
+ throw new Monite.UnprocessableEntityError(_response.error.body as Monite.HttpValidationError);
+ case 500:
+ throw new Monite.InternalServerError(_response.error.body as Monite.ErrorSchemaResponse);
+ default:
+ throw new errors.MoniteError({
+ statusCode: _response.error.statusCode,
+ body: _response.error.body,
+ });
+ }
+ }
+
+ switch (_response.error.reason) {
+ case "non-json":
+ throw new errors.MoniteError({
+ statusCode: _response.error.statusCode,
+ body: _response.error.rawBody,
+ });
+ case "timeout":
+ throw new errors.MoniteTimeoutError();
+ case "unknown":
+ throw new errors.MoniteError({
+ message: _response.error.errorMessage,
+ });
+ }
+ }
+
+ /**
+ * @param {string} counterpartId
+ * @param {Monite.CounterpartAddress} request
+ * @param {Addresses.RequestOptions} requestOptions - Request-specific configuration.
+ *
+ * @throws {@link Monite.NotFoundError}
+ * @throws {@link Monite.UnprocessableEntityError}
+ * @throws {@link Monite.InternalServerError}
+ *
+ * @example
+ * await client.counterparts.addresses.create("counterpart_id", {
+ * city: "Berlin",
+ * country: "AF",
+ * line1: "Flughafenstrasse 52",
+ * postal_code: "10115"
+ * })
+ */
+ public async create(
+ counterpartId: string,
+ request: Monite.CounterpartAddress,
+ requestOptions?: Addresses.RequestOptions
+ ): Promise {
+ const _response = await (this._options.fetcher ?? core.fetcher)({
+ url: urlJoin(
+ (await core.Supplier.get(this._options.environment)) ?? environments.MoniteEnvironment.Sandbox,
+ `counterparts/${encodeURIComponent(counterpartId)}/addresses`
+ ),
+ method: "POST",
+ headers: {
+ Authorization: await this._getAuthorizationHeader(),
+ "x-monite-version": await core.Supplier.get(this._options.moniteVersion),
+ "x-monite-entity-id":
+ (await core.Supplier.get(this._options.moniteEntityId)) != null
+ ? await core.Supplier.get(this._options.moniteEntityId)
+ : undefined,
+ "X-Fern-Language": "JavaScript",
+ "X-Fern-SDK-Name": "",
+ "X-Fern-SDK-Version": "0.1.0",
+ "X-Fern-Runtime": core.RUNTIME.type,
+ "X-Fern-Runtime-Version": core.RUNTIME.version,
+ },
+ contentType: "application/json",
+ requestType: "json",
+ body: request,
+ timeoutMs: requestOptions?.timeoutInSeconds != null ? requestOptions.timeoutInSeconds * 1000 : 60000,
+ maxRetries: requestOptions?.maxRetries,
+ abortSignal: requestOptions?.abortSignal,
+ });
+ if (_response.ok) {
+ return _response.body as Monite.CounterpartAddressResponseWithCounterpartId;
+ }
+
+ if (_response.error.reason === "status-code") {
+ switch (_response.error.statusCode) {
+ case 404:
+ throw new Monite.NotFoundError(_response.error.body as Monite.ErrorSchemaResponse);
+ case 422:
+ throw new Monite.UnprocessableEntityError(_response.error.body as Monite.HttpValidationError);
+ case 500:
+ throw new Monite.InternalServerError(_response.error.body as Monite.ErrorSchemaResponse);
+ default:
+ throw new errors.MoniteError({
+ statusCode: _response.error.statusCode,
+ body: _response.error.body,
+ });
+ }
+ }
+
+ switch (_response.error.reason) {
+ case "non-json":
+ throw new errors.MoniteError({
+ statusCode: _response.error.statusCode,
+ body: _response.error.rawBody,
+ });
+ case "timeout":
+ throw new errors.MoniteTimeoutError();
+ case "unknown":
+ throw new errors.MoniteError({
+ message: _response.error.errorMessage,
+ });
+ }
+ }
+
+ /**
+ * @param {string} addressId
+ * @param {string} counterpartId
+ * @param {Addresses.RequestOptions} requestOptions - Request-specific configuration.
+ *
+ * @throws {@link Monite.NotFoundError}
+ * @throws {@link Monite.UnprocessableEntityError}
+ * @throws {@link Monite.InternalServerError}
+ *
+ * @example
+ * await client.counterparts.addresses.getById("address_id", "counterpart_id")
+ */
+ public async getById(
+ addressId: string,
+ counterpartId: string,
+ requestOptions?: Addresses.RequestOptions
+ ): Promise {
+ const _response = await (this._options.fetcher ?? core.fetcher)({
+ url: urlJoin(
+ (await core.Supplier.get(this._options.environment)) ?? environments.MoniteEnvironment.Sandbox,
+ `counterparts/${encodeURIComponent(counterpartId)}/addresses/${encodeURIComponent(addressId)}`
+ ),
+ method: "GET",
+ headers: {
+ Authorization: await this._getAuthorizationHeader(),
+ "x-monite-version": await core.Supplier.get(this._options.moniteVersion),
+ "x-monite-entity-id":
+ (await core.Supplier.get(this._options.moniteEntityId)) != null
+ ? await core.Supplier.get(this._options.moniteEntityId)
+ : undefined,
+ "X-Fern-Language": "JavaScript",
+ "X-Fern-SDK-Name": "",
+ "X-Fern-SDK-Version": "0.1.0",
+ "X-Fern-Runtime": core.RUNTIME.type,
+ "X-Fern-Runtime-Version": core.RUNTIME.version,
+ },
+ contentType: "application/json",
+ requestType: "json",
+ timeoutMs: requestOptions?.timeoutInSeconds != null ? requestOptions.timeoutInSeconds * 1000 : 60000,
+ maxRetries: requestOptions?.maxRetries,
+ abortSignal: requestOptions?.abortSignal,
+ });
+ if (_response.ok) {
+ return _response.body as Monite.CounterpartAddressResponseWithCounterpartId;
+ }
+
+ if (_response.error.reason === "status-code") {
+ switch (_response.error.statusCode) {
+ case 404:
+ throw new Monite.NotFoundError(_response.error.body as Monite.ErrorSchemaResponse);
+ case 422:
+ throw new Monite.UnprocessableEntityError(_response.error.body as Monite.HttpValidationError);
+ case 500:
+ throw new Monite.InternalServerError(_response.error.body as Monite.ErrorSchemaResponse);
+ default:
+ throw new errors.MoniteError({
+ statusCode: _response.error.statusCode,
+ body: _response.error.body,
+ });
+ }
+ }
+
+ switch (_response.error.reason) {
+ case "non-json":
+ throw new errors.MoniteError({
+ statusCode: _response.error.statusCode,
+ body: _response.error.rawBody,
+ });
+ case "timeout":
+ throw new errors.MoniteTimeoutError();
+ case "unknown":
+ throw new errors.MoniteError({
+ message: _response.error.errorMessage,
+ });
+ }
+ }
+
+ /**
+ * @param {string} addressId
+ * @param {string} counterpartId
+ * @param {Addresses.RequestOptions} requestOptions - Request-specific configuration.
+ *
+ * @throws {@link Monite.NotFoundError}
+ * @throws {@link Monite.UnprocessableEntityError}
+ * @throws {@link Monite.InternalServerError}
+ *
+ * @example
+ * await client.counterparts.addresses.deleteById("address_id", "counterpart_id")
+ */
+ public async deleteById(
+ addressId: string,
+ counterpartId: string,
+ requestOptions?: Addresses.RequestOptions
+ ): Promise {
+ const _response = await (this._options.fetcher ?? core.fetcher)({
+ url: urlJoin(
+ (await core.Supplier.get(this._options.environment)) ?? environments.MoniteEnvironment.Sandbox,
+ `counterparts/${encodeURIComponent(counterpartId)}/addresses/${encodeURIComponent(addressId)}`
+ ),
+ method: "DELETE",
+ headers: {
+ Authorization: await this._getAuthorizationHeader(),
+ "x-monite-version": await core.Supplier.get(this._options.moniteVersion),
+ "x-monite-entity-id":
+ (await core.Supplier.get(this._options.moniteEntityId)) != null
+ ? await core.Supplier.get(this._options.moniteEntityId)
+ : undefined,
+ "X-Fern-Language": "JavaScript",
+ "X-Fern-SDK-Name": "",
+ "X-Fern-SDK-Version": "0.1.0",
+ "X-Fern-Runtime": core.RUNTIME.type,
+ "X-Fern-Runtime-Version": core.RUNTIME.version,
+ },
+ contentType: "application/json",
+ requestType: "json",
+ timeoutMs: requestOptions?.timeoutInSeconds != null ? requestOptions.timeoutInSeconds * 1000 : 60000,
+ maxRetries: requestOptions?.maxRetries,
+ abortSignal: requestOptions?.abortSignal,
+ });
+ if (_response.ok) {
+ return;
+ }
+
+ if (_response.error.reason === "status-code") {
+ switch (_response.error.statusCode) {
+ case 404:
+ throw new Monite.NotFoundError(_response.error.body as Monite.ErrorSchemaResponse);
+ case 422:
+ throw new Monite.UnprocessableEntityError(_response.error.body as Monite.HttpValidationError);
+ case 500:
+ throw new Monite.InternalServerError(_response.error.body as Monite.ErrorSchemaResponse);
+ default:
+ throw new errors.MoniteError({
+ statusCode: _response.error.statusCode,
+ body: _response.error.body,
+ });
+ }
+ }
+
+ switch (_response.error.reason) {
+ case "non-json":
+ throw new errors.MoniteError({
+ statusCode: _response.error.statusCode,
+ body: _response.error.rawBody,
+ });
+ case "timeout":
+ throw new errors.MoniteTimeoutError();
+ case "unknown":
+ throw new errors.MoniteError({
+ message: _response.error.errorMessage,
+ });
+ }
+ }
+
+ /**
+ * @param {string} addressId
+ * @param {string} counterpartId
+ * @param {Monite.counterparts.CounterpartUpdateAddress} request
+ * @param {Addresses.RequestOptions} requestOptions - Request-specific configuration.
+ *
+ * @throws {@link Monite.NotFoundError}
+ * @throws {@link Monite.UnprocessableEntityError}
+ * @throws {@link Monite.InternalServerError}
+ *
+ * @example
+ * await client.counterparts.addresses.updateById("address_id", "counterpart_id")
+ */
+ public async updateById(
+ addressId: string,
+ counterpartId: string,
+ request: Monite.counterparts.CounterpartUpdateAddress = {},
+ requestOptions?: Addresses.RequestOptions
+ ): Promise {
+ const _response = await (this._options.fetcher ?? core.fetcher)({
+ url: urlJoin(
+ (await core.Supplier.get(this._options.environment)) ?? environments.MoniteEnvironment.Sandbox,
+ `counterparts/${encodeURIComponent(counterpartId)}/addresses/${encodeURIComponent(addressId)}`
+ ),
+ method: "PATCH",
+ headers: {
+ Authorization: await this._getAuthorizationHeader(),
+ "x-monite-version": await core.Supplier.get(this._options.moniteVersion),
+ "x-monite-entity-id":
+ (await core.Supplier.get(this._options.moniteEntityId)) != null
+ ? await core.Supplier.get(this._options.moniteEntityId)
+ : undefined,
+ "X-Fern-Language": "JavaScript",
+ "X-Fern-SDK-Name": "",
+ "X-Fern-SDK-Version": "0.1.0",
+ "X-Fern-Runtime": core.RUNTIME.type,
+ "X-Fern-Runtime-Version": core.RUNTIME.version,
+ },
+ contentType: "application/json",
+ requestType: "json",
+ body: request,
+ timeoutMs: requestOptions?.timeoutInSeconds != null ? requestOptions.timeoutInSeconds * 1000 : 60000,
+ maxRetries: requestOptions?.maxRetries,
+ abortSignal: requestOptions?.abortSignal,
+ });
+ if (_response.ok) {
+ return _response.body as Monite.CounterpartAddressResponseWithCounterpartId;
+ }
+
+ if (_response.error.reason === "status-code") {
+ switch (_response.error.statusCode) {
+ case 404:
+ throw new Monite.NotFoundError(_response.error.body as Monite.ErrorSchemaResponse);
+ case 422:
+ throw new Monite.UnprocessableEntityError(_response.error.body as Monite.HttpValidationError);
+ case 500:
+ throw new Monite.InternalServerError(_response.error.body as Monite.ErrorSchemaResponse);
+ default:
+ throw new errors.MoniteError({
+ statusCode: _response.error.statusCode,
+ body: _response.error.body,
+ });
+ }
+ }
+
+ switch (_response.error.reason) {
+ case "non-json":
+ throw new errors.MoniteError({
+ statusCode: _response.error.statusCode,
+ body: _response.error.rawBody,
+ });
+ case "timeout":
+ throw new errors.MoniteTimeoutError();
+ case "unknown":
+ throw new errors.MoniteError({
+ message: _response.error.errorMessage,
+ });
+ }
+ }
+
+ protected async _getAuthorizationHeader(): Promise {
+ const bearer = await core.Supplier.get(this._options.token);
+ if (bearer != null) {
+ return `Bearer ${bearer}`;
+ }
+
+ return undefined;
+ }
+}
diff --git a/src/api/resources/counterparts/resources/addresses/client/index.ts b/src/api/resources/counterparts/resources/addresses/client/index.ts
new file mode 100644
index 0000000..415726b
--- /dev/null
+++ b/src/api/resources/counterparts/resources/addresses/client/index.ts
@@ -0,0 +1 @@
+export * from "./requests";
diff --git a/src/api/resources/counterparts/resources/addresses/client/requests/CounterpartUpdateAddress.ts b/src/api/resources/counterparts/resources/addresses/client/requests/CounterpartUpdateAddress.ts
new file mode 100644
index 0000000..375e2f0
--- /dev/null
+++ b/src/api/resources/counterparts/resources/addresses/client/requests/CounterpartUpdateAddress.ts
@@ -0,0 +1,24 @@
+/**
+ * This file was auto-generated by Fern from our API Definition.
+ */
+
+import * as Monite from "../../../../../../index";
+
+/**
+ * @example
+ * {}
+ */
+export interface CounterpartUpdateAddress {
+ /** City name. */
+ city?: string;
+ /** Two-letter ISO country code ([ISO 3166-1 alpha-2](https://en.wikipedia.org/wiki/ISO_3166-1_alpha-2)). */
+ country?: Monite.AllowedCountries;
+ /** Street address. */
+ line1?: string;
+ /** Additional address information (if any). */
+ line2?: string;
+ /** ZIP or postal code. */
+ postal_code?: string;
+ /** State, region, province, or county. */
+ state?: string;
+}
diff --git a/src/api/resources/counterparts/resources/addresses/client/requests/index.ts b/src/api/resources/counterparts/resources/addresses/client/requests/index.ts
new file mode 100644
index 0000000..99b2e21
--- /dev/null
+++ b/src/api/resources/counterparts/resources/addresses/client/requests/index.ts
@@ -0,0 +1 @@
+export { type CounterpartUpdateAddress } from "./CounterpartUpdateAddress";
diff --git a/src/api/resources/counterparts/resources/addresses/index.ts b/src/api/resources/counterparts/resources/addresses/index.ts
new file mode 100644
index 0000000..5ec7692
--- /dev/null
+++ b/src/api/resources/counterparts/resources/addresses/index.ts
@@ -0,0 +1 @@
+export * from "./client";
diff --git a/src/api/resources/counterparts/resources/bankAccounts/client/Client.ts b/src/api/resources/counterparts/resources/bankAccounts/client/Client.ts
new file mode 100644
index 0000000..fe5bf59
--- /dev/null
+++ b/src/api/resources/counterparts/resources/bankAccounts/client/Client.ts
@@ -0,0 +1,510 @@
+/**
+ * This file was auto-generated by Fern from our API Definition.
+ */
+
+import * as environments from "../../../../../../environments";
+import * as core from "../../../../../../core";
+import * as Monite from "../../../../../index";
+import urlJoin from "url-join";
+import * as errors from "../../../../../../errors/index";
+
+export declare namespace BankAccounts {
+ interface Options {
+ environment?: core.Supplier;
+ token?: core.Supplier;
+ /** Override the x-monite-version header */
+ moniteVersion: core.Supplier;
+ /** Override the x-monite-entity-id header */
+ moniteEntityId?: core.Supplier;
+ fetcher?: core.FetchFunction;
+ }
+
+ interface RequestOptions {
+ /** The maximum time to wait for a response in seconds. */
+ timeoutInSeconds?: number;
+ /** The number of times to retry the request. Defaults to 2. */
+ maxRetries?: number;
+ /** A hook to abort the request. */
+ abortSignal?: AbortSignal;
+ /** Override the x-monite-version header */
+ moniteVersion?: string;
+ /** Override the x-monite-entity-id header */
+ moniteEntityId?: string | undefined;
+ }
+}
+
+export class BankAccounts {
+ constructor(protected readonly _options: BankAccounts.Options) {}
+
+ /**
+ * @param {string} counterpartId
+ * @param {BankAccounts.RequestOptions} requestOptions - Request-specific configuration.
+ *
+ * @throws {@link Monite.UnprocessableEntityError}
+ * @throws {@link Monite.InternalServerError}
+ *
+ * @example
+ * await client.counterparts.bankAccounts.get("counterpart_id")
+ */
+ public async get(
+ counterpartId: string,
+ requestOptions?: BankAccounts.RequestOptions
+ ): Promise {
+ const _response = await (this._options.fetcher ?? core.fetcher)({
+ url: urlJoin(
+ (await core.Supplier.get(this._options.environment)) ?? environments.MoniteEnvironment.Sandbox,
+ `counterparts/${encodeURIComponent(counterpartId)}/bank_accounts`
+ ),
+ method: "GET",
+ headers: {
+ Authorization: await this._getAuthorizationHeader(),
+ "x-monite-version": await core.Supplier.get(this._options.moniteVersion),
+ "x-monite-entity-id":
+ (await core.Supplier.get(this._options.moniteEntityId)) != null
+ ? await core.Supplier.get(this._options.moniteEntityId)
+ : undefined,
+ "X-Fern-Language": "JavaScript",
+ "X-Fern-SDK-Name": "",
+ "X-Fern-SDK-Version": "0.1.0",
+ "X-Fern-Runtime": core.RUNTIME.type,
+ "X-Fern-Runtime-Version": core.RUNTIME.version,
+ },
+ contentType: "application/json",
+ requestType: "json",
+ timeoutMs: requestOptions?.timeoutInSeconds != null ? requestOptions.timeoutInSeconds * 1000 : 60000,
+ maxRetries: requestOptions?.maxRetries,
+ abortSignal: requestOptions?.abortSignal,
+ });
+ if (_response.ok) {
+ return _response.body as Monite.CounterpartBankAccountResourceList;
+ }
+
+ if (_response.error.reason === "status-code") {
+ switch (_response.error.statusCode) {
+ case 422:
+ throw new Monite.UnprocessableEntityError(_response.error.body as Monite.HttpValidationError);
+ case 500:
+ throw new Monite.InternalServerError(_response.error.body as Monite.ErrorSchemaResponse);
+ default:
+ throw new errors.MoniteError({
+ statusCode: _response.error.statusCode,
+ body: _response.error.body,
+ });
+ }
+ }
+
+ switch (_response.error.reason) {
+ case "non-json":
+ throw new errors.MoniteError({
+ statusCode: _response.error.statusCode,
+ body: _response.error.rawBody,
+ });
+ case "timeout":
+ throw new errors.MoniteTimeoutError();
+ case "unknown":
+ throw new errors.MoniteError({
+ message: _response.error.errorMessage,
+ });
+ }
+ }
+
+ /**
+ * @param {string} counterpartId
+ * @param {Monite.counterparts.CreateCounterpartBankAccount} request
+ * @param {BankAccounts.RequestOptions} requestOptions - Request-specific configuration.
+ *
+ * @throws {@link Monite.NotFoundError}
+ * @throws {@link Monite.UnprocessableEntityError}
+ * @throws {@link Monite.InternalServerError}
+ *
+ * @example
+ * await client.counterparts.bankAccounts.create("counterpart_id", {
+ * country: "AF",
+ * currency: "AED"
+ * })
+ */
+ public async create(
+ counterpartId: string,
+ request: Monite.counterparts.CreateCounterpartBankAccount,
+ requestOptions?: BankAccounts.RequestOptions
+ ): Promise {
+ const _response = await (this._options.fetcher ?? core.fetcher)({
+ url: urlJoin(
+ (await core.Supplier.get(this._options.environment)) ?? environments.MoniteEnvironment.Sandbox,
+ `counterparts/${encodeURIComponent(counterpartId)}/bank_accounts`
+ ),
+ method: "POST",
+ headers: {
+ Authorization: await this._getAuthorizationHeader(),
+ "x-monite-version": await core.Supplier.get(this._options.moniteVersion),
+ "x-monite-entity-id":
+ (await core.Supplier.get(this._options.moniteEntityId)) != null
+ ? await core.Supplier.get(this._options.moniteEntityId)
+ : undefined,
+ "X-Fern-Language": "JavaScript",
+ "X-Fern-SDK-Name": "",
+ "X-Fern-SDK-Version": "0.1.0",
+ "X-Fern-Runtime": core.RUNTIME.type,
+ "X-Fern-Runtime-Version": core.RUNTIME.version,
+ },
+ contentType: "application/json",
+ requestType: "json",
+ body: request,
+ timeoutMs: requestOptions?.timeoutInSeconds != null ? requestOptions.timeoutInSeconds * 1000 : 60000,
+ maxRetries: requestOptions?.maxRetries,
+ abortSignal: requestOptions?.abortSignal,
+ });
+ if (_response.ok) {
+ return _response.body as Monite.CounterpartBankAccountResponse;
+ }
+
+ if (_response.error.reason === "status-code") {
+ switch (_response.error.statusCode) {
+ case 404:
+ throw new Monite.NotFoundError(_response.error.body as Monite.ErrorSchemaResponse);
+ case 422:
+ throw new Monite.UnprocessableEntityError(_response.error.body as Monite.HttpValidationError);
+ case 500:
+ throw new Monite.InternalServerError(_response.error.body as Monite.ErrorSchemaResponse);
+ default:
+ throw new errors.MoniteError({
+ statusCode: _response.error.statusCode,
+ body: _response.error.body,
+ });
+ }
+ }
+
+ switch (_response.error.reason) {
+ case "non-json":
+ throw new errors.MoniteError({
+ statusCode: _response.error.statusCode,
+ body: _response.error.rawBody,
+ });
+ case "timeout":
+ throw new errors.MoniteTimeoutError();
+ case "unknown":
+ throw new errors.MoniteError({
+ message: _response.error.errorMessage,
+ });
+ }
+ }
+
+ /**
+ * @param {string} bankAccountId
+ * @param {string} counterpartId
+ * @param {BankAccounts.RequestOptions} requestOptions - Request-specific configuration.
+ *
+ * @throws {@link Monite.NotFoundError}
+ * @throws {@link Monite.UnprocessableEntityError}
+ * @throws {@link Monite.InternalServerError}
+ *
+ * @example
+ * await client.counterparts.bankAccounts.getById("bank_account_id", "counterpart_id")
+ */
+ public async getById(
+ bankAccountId: string,
+ counterpartId: string,
+ requestOptions?: BankAccounts.RequestOptions
+ ): Promise {
+ const _response = await (this._options.fetcher ?? core.fetcher)({
+ url: urlJoin(
+ (await core.Supplier.get(this._options.environment)) ?? environments.MoniteEnvironment.Sandbox,
+ `counterparts/${encodeURIComponent(counterpartId)}/bank_accounts/${encodeURIComponent(bankAccountId)}`
+ ),
+ method: "GET",
+ headers: {
+ Authorization: await this._getAuthorizationHeader(),
+ "x-monite-version": await core.Supplier.get(this._options.moniteVersion),
+ "x-monite-entity-id":
+ (await core.Supplier.get(this._options.moniteEntityId)) != null
+ ? await core.Supplier.get(this._options.moniteEntityId)
+ : undefined,
+ "X-Fern-Language": "JavaScript",
+ "X-Fern-SDK-Name": "",
+ "X-Fern-SDK-Version": "0.1.0",
+ "X-Fern-Runtime": core.RUNTIME.type,
+ "X-Fern-Runtime-Version": core.RUNTIME.version,
+ },
+ contentType: "application/json",
+ requestType: "json",
+ timeoutMs: requestOptions?.timeoutInSeconds != null ? requestOptions.timeoutInSeconds * 1000 : 60000,
+ maxRetries: requestOptions?.maxRetries,
+ abortSignal: requestOptions?.abortSignal,
+ });
+ if (_response.ok) {
+ return _response.body as Monite.CounterpartBankAccountResponse;
+ }
+
+ if (_response.error.reason === "status-code") {
+ switch (_response.error.statusCode) {
+ case 404:
+ throw new Monite.NotFoundError(_response.error.body as Monite.ErrorSchemaResponse);
+ case 422:
+ throw new Monite.UnprocessableEntityError(_response.error.body as Monite.HttpValidationError);
+ case 500:
+ throw new Monite.InternalServerError(_response.error.body as Monite.ErrorSchemaResponse);
+ default:
+ throw new errors.MoniteError({
+ statusCode: _response.error.statusCode,
+ body: _response.error.body,
+ });
+ }
+ }
+
+ switch (_response.error.reason) {
+ case "non-json":
+ throw new errors.MoniteError({
+ statusCode: _response.error.statusCode,
+ body: _response.error.rawBody,
+ });
+ case "timeout":
+ throw new errors.MoniteTimeoutError();
+ case "unknown":
+ throw new errors.MoniteError({
+ message: _response.error.errorMessage,
+ });
+ }
+ }
+
+ /**
+ * @param {string} bankAccountId
+ * @param {string} counterpartId
+ * @param {BankAccounts.RequestOptions} requestOptions - Request-specific configuration.
+ *
+ * @throws {@link Monite.NotFoundError}
+ * @throws {@link Monite.UnprocessableEntityError}
+ * @throws {@link Monite.InternalServerError}
+ *
+ * @example
+ * await client.counterparts.bankAccounts.deleteById("bank_account_id", "counterpart_id")
+ */
+ public async deleteById(
+ bankAccountId: string,
+ counterpartId: string,
+ requestOptions?: BankAccounts.RequestOptions
+ ): Promise {
+ const _response = await (this._options.fetcher ?? core.fetcher)({
+ url: urlJoin(
+ (await core.Supplier.get(this._options.environment)) ?? environments.MoniteEnvironment.Sandbox,
+ `counterparts/${encodeURIComponent(counterpartId)}/bank_accounts/${encodeURIComponent(bankAccountId)}`
+ ),
+ method: "DELETE",
+ headers: {
+ Authorization: await this._getAuthorizationHeader(),
+ "x-monite-version": await core.Supplier.get(this._options.moniteVersion),
+ "x-monite-entity-id":
+ (await core.Supplier.get(this._options.moniteEntityId)) != null
+ ? await core.Supplier.get(this._options.moniteEntityId)
+ : undefined,
+ "X-Fern-Language": "JavaScript",
+ "X-Fern-SDK-Name": "",
+ "X-Fern-SDK-Version": "0.1.0",
+ "X-Fern-Runtime": core.RUNTIME.type,
+ "X-Fern-Runtime-Version": core.RUNTIME.version,
+ },
+ contentType: "application/json",
+ requestType: "json",
+ timeoutMs: requestOptions?.timeoutInSeconds != null ? requestOptions.timeoutInSeconds * 1000 : 60000,
+ maxRetries: requestOptions?.maxRetries,
+ abortSignal: requestOptions?.abortSignal,
+ });
+ if (_response.ok) {
+ return;
+ }
+
+ if (_response.error.reason === "status-code") {
+ switch (_response.error.statusCode) {
+ case 404:
+ throw new Monite.NotFoundError(_response.error.body as Monite.ErrorSchemaResponse);
+ case 422:
+ throw new Monite.UnprocessableEntityError(_response.error.body as Monite.HttpValidationError);
+ case 500:
+ throw new Monite.InternalServerError(_response.error.body as Monite.ErrorSchemaResponse);
+ default:
+ throw new errors.MoniteError({
+ statusCode: _response.error.statusCode,
+ body: _response.error.body,
+ });
+ }
+ }
+
+ switch (_response.error.reason) {
+ case "non-json":
+ throw new errors.MoniteError({
+ statusCode: _response.error.statusCode,
+ body: _response.error.rawBody,
+ });
+ case "timeout":
+ throw new errors.MoniteTimeoutError();
+ case "unknown":
+ throw new errors.MoniteError({
+ message: _response.error.errorMessage,
+ });
+ }
+ }
+
+ /**
+ * @param {string} bankAccountId
+ * @param {string} counterpartId
+ * @param {Monite.counterparts.UpdateCounterpartBankAccount} request
+ * @param {BankAccounts.RequestOptions} requestOptions - Request-specific configuration.
+ *
+ * @throws {@link Monite.NotFoundError}
+ * @throws {@link Monite.UnprocessableEntityError}
+ * @throws {@link Monite.InternalServerError}
+ *
+ * @example
+ * await client.counterparts.bankAccounts.updateById("bank_account_id", "counterpart_id")
+ */
+ public async updateById(
+ bankAccountId: string,
+ counterpartId: string,
+ request: Monite.counterparts.UpdateCounterpartBankAccount = {},
+ requestOptions?: BankAccounts.RequestOptions
+ ): Promise {
+ const _response = await (this._options.fetcher ?? core.fetcher)({
+ url: urlJoin(
+ (await core.Supplier.get(this._options.environment)) ?? environments.MoniteEnvironment.Sandbox,
+ `counterparts/${encodeURIComponent(counterpartId)}/bank_accounts/${encodeURIComponent(bankAccountId)}`
+ ),
+ method: "PATCH",
+ headers: {
+ Authorization: await this._getAuthorizationHeader(),
+ "x-monite-version": await core.Supplier.get(this._options.moniteVersion),
+ "x-monite-entity-id":
+ (await core.Supplier.get(this._options.moniteEntityId)) != null
+ ? await core.Supplier.get(this._options.moniteEntityId)
+ : undefined,
+ "X-Fern-Language": "JavaScript",
+ "X-Fern-SDK-Name": "",
+ "X-Fern-SDK-Version": "0.1.0",
+ "X-Fern-Runtime": core.RUNTIME.type,
+ "X-Fern-Runtime-Version": core.RUNTIME.version,
+ },
+ contentType: "application/json",
+ requestType: "json",
+ body: request,
+ timeoutMs: requestOptions?.timeoutInSeconds != null ? requestOptions.timeoutInSeconds * 1000 : 60000,
+ maxRetries: requestOptions?.maxRetries,
+ abortSignal: requestOptions?.abortSignal,
+ });
+ if (_response.ok) {
+ return _response.body as Monite.CounterpartBankAccountResponse;
+ }
+
+ if (_response.error.reason === "status-code") {
+ switch (_response.error.statusCode) {
+ case 404:
+ throw new Monite.NotFoundError(_response.error.body as Monite.ErrorSchemaResponse);
+ case 422:
+ throw new Monite.UnprocessableEntityError(_response.error.body as Monite.HttpValidationError);
+ case 500:
+ throw new Monite.InternalServerError(_response.error.body as Monite.ErrorSchemaResponse);
+ default:
+ throw new errors.MoniteError({
+ statusCode: _response.error.statusCode,
+ body: _response.error.body,
+ });
+ }
+ }
+
+ switch (_response.error.reason) {
+ case "non-json":
+ throw new errors.MoniteError({
+ statusCode: _response.error.statusCode,
+ body: _response.error.rawBody,
+ });
+ case "timeout":
+ throw new errors.MoniteTimeoutError();
+ case "unknown":
+ throw new errors.MoniteError({
+ message: _response.error.errorMessage,
+ });
+ }
+ }
+
+ /**
+ * @param {string} bankAccountId
+ * @param {string} counterpartId
+ * @param {BankAccounts.RequestOptions} requestOptions - Request-specific configuration.
+ *
+ * @throws {@link Monite.UnprocessableEntityError}
+ * @throws {@link Monite.InternalServerError}
+ *
+ * @example
+ * await client.counterparts.bankAccounts.makeDefaultById("bank_account_id", "counterpart_id")
+ */
+ public async makeDefaultById(
+ bankAccountId: string,
+ counterpartId: string,
+ requestOptions?: BankAccounts.RequestOptions
+ ): Promise {
+ const _response = await (this._options.fetcher ?? core.fetcher)({
+ url: urlJoin(
+ (await core.Supplier.get(this._options.environment)) ?? environments.MoniteEnvironment.Sandbox,
+ `counterparts/${encodeURIComponent(counterpartId)}/bank_accounts/${encodeURIComponent(
+ bankAccountId
+ )}/make_default`
+ ),
+ method: "POST",
+ headers: {
+ Authorization: await this._getAuthorizationHeader(),
+ "x-monite-version": await core.Supplier.get(this._options.moniteVersion),
+ "x-monite-entity-id":
+ (await core.Supplier.get(this._options.moniteEntityId)) != null
+ ? await core.Supplier.get(this._options.moniteEntityId)
+ : undefined,
+ "X-Fern-Language": "JavaScript",
+ "X-Fern-SDK-Name": "",
+ "X-Fern-SDK-Version": "0.1.0",
+ "X-Fern-Runtime": core.RUNTIME.type,
+ "X-Fern-Runtime-Version": core.RUNTIME.version,
+ },
+ contentType: "application/json",
+ requestType: "json",
+ timeoutMs: requestOptions?.timeoutInSeconds != null ? requestOptions.timeoutInSeconds * 1000 : 60000,
+ maxRetries: requestOptions?.maxRetries,
+ abortSignal: requestOptions?.abortSignal,
+ });
+ if (_response.ok) {
+ return _response.body;
+ }
+
+ if (_response.error.reason === "status-code") {
+ switch (_response.error.statusCode) {
+ case 422:
+ throw new Monite.UnprocessableEntityError(_response.error.body as Monite.HttpValidationError);
+ case 500:
+ throw new Monite.InternalServerError(_response.error.body as Monite.ErrorSchemaResponse);
+ default:
+ throw new errors.MoniteError({
+ statusCode: _response.error.statusCode,
+ body: _response.error.body,
+ });
+ }
+ }
+
+ switch (_response.error.reason) {
+ case "non-json":
+ throw new errors.MoniteError({
+ statusCode: _response.error.statusCode,
+ body: _response.error.rawBody,
+ });
+ case "timeout":
+ throw new errors.MoniteTimeoutError();
+ case "unknown":
+ throw new errors.MoniteError({
+ message: _response.error.errorMessage,
+ });
+ }
+ }
+
+ protected async _getAuthorizationHeader(): Promise {
+ const bearer = await core.Supplier.get(this._options.token);
+ if (bearer != null) {
+ return `Bearer ${bearer}`;
+ }
+
+ return undefined;
+ }
+}
diff --git a/src/api/resources/counterparts/resources/bankAccounts/client/index.ts b/src/api/resources/counterparts/resources/bankAccounts/client/index.ts
new file mode 100644
index 0000000..415726b
--- /dev/null
+++ b/src/api/resources/counterparts/resources/bankAccounts/client/index.ts
@@ -0,0 +1 @@
+export * from "./requests";
diff --git a/src/api/resources/counterparts/resources/bankAccounts/client/requests/CreateCounterpartBankAccount.ts b/src/api/resources/counterparts/resources/bankAccounts/client/requests/CreateCounterpartBankAccount.ts
new file mode 100644
index 0000000..fd236d5
--- /dev/null
+++ b/src/api/resources/counterparts/resources/bankAccounts/client/requests/CreateCounterpartBankAccount.ts
@@ -0,0 +1,33 @@
+/**
+ * This file was auto-generated by Fern from our API Definition.
+ */
+
+import * as Monite from "../../../../../../index";
+
+/**
+ * @example
+ * {
+ * country: "AF",
+ * currency: "AED"
+ * }
+ */
+export interface CreateCounterpartBankAccount {
+ /** The name of the person or business that owns this bank account. Required for US bank accounts to accept ACH payments. */
+ account_holder_name?: string;
+ /** The bank account number. Required for US bank accounts to accept ACH payments. US account numbers contain 9 to 12 digits. UK account numbers typically contain 8 digits. */
+ account_number?: string;
+ /** The BIC/SWIFT code of the bank. */
+ bic?: string;
+ country: Monite.AllowedCountries;
+ currency: Monite.CurrencyEnum;
+ /** The IBAN of the bank account. */
+ iban?: string;
+ is_default_for_currency?: boolean;
+ name?: string;
+ /** Metadata for partner needs. */
+ partner_metadata?: Record;
+ /** The bank's routing transit number (RTN). Required for US bank accounts to accept ACH payments. US routing numbers consist of 9 digits. */
+ routing_number?: string;
+ /** The bank's sort code. */
+ sort_code?: string;
+}
diff --git a/src/api/resources/counterparts/resources/bankAccounts/client/requests/UpdateCounterpartBankAccount.ts b/src/api/resources/counterparts/resources/bankAccounts/client/requests/UpdateCounterpartBankAccount.ts
new file mode 100644
index 0000000..c5cea4e
--- /dev/null
+++ b/src/api/resources/counterparts/resources/bankAccounts/client/requests/UpdateCounterpartBankAccount.ts
@@ -0,0 +1,29 @@
+/**
+ * This file was auto-generated by Fern from our API Definition.
+ */
+
+import * as Monite from "../../../../../../index";
+
+/**
+ * @example
+ * {}
+ */
+export interface UpdateCounterpartBankAccount {
+ /** The name of the person or business that owns this bank account. Required for US bank accounts to accept ACH payments. */
+ account_holder_name?: string;
+ /** The bank account number. Required for US bank accounts to accept ACH payments. US account numbers contain 9 to 12 digits. UK account numbers typically contain 8 digits. */
+ account_number?: string;
+ /** The BIC/SWIFT code of the bank. */
+ bic?: string;
+ country?: Monite.AllowedCountries;
+ currency?: Monite.CurrencyEnum;
+ /** The IBAN of the bank account. */
+ iban?: string;
+ name?: string;
+ /** Metadata for partner needs. */
+ partner_metadata?: Record;
+ /** The bank's routing transit number (RTN). Required for US bank accounts to accept ACH payments. US routing numbers consist of 9 digits. */
+ routing_number?: string;
+ /** The bank's sort code. */
+ sort_code?: string;
+}
diff --git a/src/api/resources/counterparts/resources/bankAccounts/client/requests/index.ts b/src/api/resources/counterparts/resources/bankAccounts/client/requests/index.ts
new file mode 100644
index 0000000..a99d6fa
--- /dev/null
+++ b/src/api/resources/counterparts/resources/bankAccounts/client/requests/index.ts
@@ -0,0 +1,2 @@
+export { type CreateCounterpartBankAccount } from "./CreateCounterpartBankAccount";
+export { type UpdateCounterpartBankAccount } from "./UpdateCounterpartBankAccount";
diff --git a/src/api/resources/counterparts/resources/bankAccounts/index.ts b/src/api/resources/counterparts/resources/bankAccounts/index.ts
new file mode 100644
index 0000000..5ec7692
--- /dev/null
+++ b/src/api/resources/counterparts/resources/bankAccounts/index.ts
@@ -0,0 +1 @@
+export * from "./client";
diff --git a/src/api/resources/counterparts/resources/contacts/client/Client.ts b/src/api/resources/counterparts/resources/contacts/client/Client.ts
new file mode 100644
index 0000000..a67945a
--- /dev/null
+++ b/src/api/resources/counterparts/resources/contacts/client/Client.ts
@@ -0,0 +1,519 @@
+/**
+ * This file was auto-generated by Fern from our API Definition.
+ */
+
+import * as environments from "../../../../../../environments";
+import * as core from "../../../../../../core";
+import * as Monite from "../../../../../index";
+import urlJoin from "url-join";
+import * as errors from "../../../../../../errors/index";
+
+export declare namespace Contacts {
+ interface Options {
+ environment?: core.Supplier;
+ token?: core.Supplier;
+ /** Override the x-monite-version header */
+ moniteVersion: core.Supplier;
+ /** Override the x-monite-entity-id header */
+ moniteEntityId?: core.Supplier;
+ fetcher?: core.FetchFunction;
+ }
+
+ interface RequestOptions {
+ /** The maximum time to wait for a response in seconds. */
+ timeoutInSeconds?: number;
+ /** The number of times to retry the request. Defaults to 2. */
+ maxRetries?: number;
+ /** A hook to abort the request. */
+ abortSignal?: AbortSignal;
+ /** Override the x-monite-version header */
+ moniteVersion?: string;
+ /** Override the x-monite-entity-id header */
+ moniteEntityId?: string | undefined;
+ }
+}
+
+export class Contacts {
+ constructor(protected readonly _options: Contacts.Options) {}
+
+ /**
+ * @param {string} counterpartId
+ * @param {Contacts.RequestOptions} requestOptions - Request-specific configuration.
+ *
+ * @throws {@link Monite.UnprocessableEntityError}
+ * @throws {@link Monite.InternalServerError}
+ *
+ * @example
+ * await client.counterparts.contacts.get("counterpart_id")
+ */
+ public async get(
+ counterpartId: string,
+ requestOptions?: Contacts.RequestOptions
+ ): Promise {
+ const _response = await (this._options.fetcher ?? core.fetcher)({
+ url: urlJoin(
+ (await core.Supplier.get(this._options.environment)) ?? environments.MoniteEnvironment.Sandbox,
+ `counterparts/${encodeURIComponent(counterpartId)}/contacts`
+ ),
+ method: "GET",
+ headers: {
+ Authorization: await this._getAuthorizationHeader(),
+ "x-monite-version": await core.Supplier.get(this._options.moniteVersion),
+ "x-monite-entity-id":
+ (await core.Supplier.get(this._options.moniteEntityId)) != null
+ ? await core.Supplier.get(this._options.moniteEntityId)
+ : undefined,
+ "X-Fern-Language": "JavaScript",
+ "X-Fern-SDK-Name": "",
+ "X-Fern-SDK-Version": "0.1.0",
+ "X-Fern-Runtime": core.RUNTIME.type,
+ "X-Fern-Runtime-Version": core.RUNTIME.version,
+ },
+ contentType: "application/json",
+ requestType: "json",
+ timeoutMs: requestOptions?.timeoutInSeconds != null ? requestOptions.timeoutInSeconds * 1000 : 60000,
+ maxRetries: requestOptions?.maxRetries,
+ abortSignal: requestOptions?.abortSignal,
+ });
+ if (_response.ok) {
+ return _response.body as Monite.CounterpartContactsResourceList;
+ }
+
+ if (_response.error.reason === "status-code") {
+ switch (_response.error.statusCode) {
+ case 422:
+ throw new Monite.UnprocessableEntityError(_response.error.body as Monite.HttpValidationError);
+ case 500:
+ throw new Monite.InternalServerError(_response.error.body as Monite.ErrorSchemaResponse);
+ default:
+ throw new errors.MoniteError({
+ statusCode: _response.error.statusCode,
+ body: _response.error.body,
+ });
+ }
+ }
+
+ switch (_response.error.reason) {
+ case "non-json":
+ throw new errors.MoniteError({
+ statusCode: _response.error.statusCode,
+ body: _response.error.rawBody,
+ });
+ case "timeout":
+ throw new errors.MoniteTimeoutError();
+ case "unknown":
+ throw new errors.MoniteError({
+ message: _response.error.errorMessage,
+ });
+ }
+ }
+
+ /**
+ * @param {string} counterpartId
+ * @param {Monite.counterparts.CreateCounterpartContactPayload} request
+ * @param {Contacts.RequestOptions} requestOptions - Request-specific configuration.
+ *
+ * @throws {@link Monite.NotFoundError}
+ * @throws {@link Monite.UnprocessableEntityError}
+ * @throws {@link Monite.InternalServerError}
+ *
+ * @example
+ * await client.counterparts.contacts.create("counterpart_id", {
+ * address: {
+ * city: "Berlin",
+ * country: "AF",
+ * line1: "Flughafenstrasse 52",
+ * postal_code: "10115"
+ * },
+ * first_name: "Mary",
+ * last_name: "O'Brien"
+ * })
+ */
+ public async create(
+ counterpartId: string,
+ request: Monite.counterparts.CreateCounterpartContactPayload,
+ requestOptions?: Contacts.RequestOptions
+ ): Promise {
+ const _response = await (this._options.fetcher ?? core.fetcher)({
+ url: urlJoin(
+ (await core.Supplier.get(this._options.environment)) ?? environments.MoniteEnvironment.Sandbox,
+ `counterparts/${encodeURIComponent(counterpartId)}/contacts`
+ ),
+ method: "POST",
+ headers: {
+ Authorization: await this._getAuthorizationHeader(),
+ "x-monite-version": await core.Supplier.get(this._options.moniteVersion),
+ "x-monite-entity-id":
+ (await core.Supplier.get(this._options.moniteEntityId)) != null
+ ? await core.Supplier.get(this._options.moniteEntityId)
+ : undefined,
+ "X-Fern-Language": "JavaScript",
+ "X-Fern-SDK-Name": "",
+ "X-Fern-SDK-Version": "0.1.0",
+ "X-Fern-Runtime": core.RUNTIME.type,
+ "X-Fern-Runtime-Version": core.RUNTIME.version,
+ },
+ contentType: "application/json",
+ requestType: "json",
+ body: request,
+ timeoutMs: requestOptions?.timeoutInSeconds != null ? requestOptions.timeoutInSeconds * 1000 : 60000,
+ maxRetries: requestOptions?.maxRetries,
+ abortSignal: requestOptions?.abortSignal,
+ });
+ if (_response.ok) {
+ return _response.body as Monite.CounterpartContactResponse;
+ }
+
+ if (_response.error.reason === "status-code") {
+ switch (_response.error.statusCode) {
+ case 404:
+ throw new Monite.NotFoundError(_response.error.body as Monite.ErrorSchemaResponse);
+ case 422:
+ throw new Monite.UnprocessableEntityError(_response.error.body as Monite.HttpValidationError);
+ case 500:
+ throw new Monite.InternalServerError(_response.error.body as Monite.ErrorSchemaResponse);
+ default:
+ throw new errors.MoniteError({
+ statusCode: _response.error.statusCode,
+ body: _response.error.body,
+ });
+ }
+ }
+
+ switch (_response.error.reason) {
+ case "non-json":
+ throw new errors.MoniteError({
+ statusCode: _response.error.statusCode,
+ body: _response.error.rawBody,
+ });
+ case "timeout":
+ throw new errors.MoniteTimeoutError();
+ case "unknown":
+ throw new errors.MoniteError({
+ message: _response.error.errorMessage,
+ });
+ }
+ }
+
+ /**
+ * @param {string} contactId
+ * @param {string} counterpartId
+ * @param {Contacts.RequestOptions} requestOptions - Request-specific configuration.
+ *
+ * @throws {@link Monite.NotFoundError}
+ * @throws {@link Monite.UnprocessableEntityError}
+ * @throws {@link Monite.InternalServerError}
+ *
+ * @example
+ * await client.counterparts.contacts.getById("contact_id", "counterpart_id")
+ */
+ public async getById(
+ contactId: string,
+ counterpartId: string,
+ requestOptions?: Contacts.RequestOptions
+ ): Promise {
+ const _response = await (this._options.fetcher ?? core.fetcher)({
+ url: urlJoin(
+ (await core.Supplier.get(this._options.environment)) ?? environments.MoniteEnvironment.Sandbox,
+ `counterparts/${encodeURIComponent(counterpartId)}/contacts/${encodeURIComponent(contactId)}`
+ ),
+ method: "GET",
+ headers: {
+ Authorization: await this._getAuthorizationHeader(),
+ "x-monite-version": await core.Supplier.get(this._options.moniteVersion),
+ "x-monite-entity-id":
+ (await core.Supplier.get(this._options.moniteEntityId)) != null
+ ? await core.Supplier.get(this._options.moniteEntityId)
+ : undefined,
+ "X-Fern-Language": "JavaScript",
+ "X-Fern-SDK-Name": "",
+ "X-Fern-SDK-Version": "0.1.0",
+ "X-Fern-Runtime": core.RUNTIME.type,
+ "X-Fern-Runtime-Version": core.RUNTIME.version,
+ },
+ contentType: "application/json",
+ requestType: "json",
+ timeoutMs: requestOptions?.timeoutInSeconds != null ? requestOptions.timeoutInSeconds * 1000 : 60000,
+ maxRetries: requestOptions?.maxRetries,
+ abortSignal: requestOptions?.abortSignal,
+ });
+ if (_response.ok) {
+ return _response.body as Monite.CounterpartContactResponse;
+ }
+
+ if (_response.error.reason === "status-code") {
+ switch (_response.error.statusCode) {
+ case 404:
+ throw new Monite.NotFoundError(_response.error.body as Monite.ErrorSchemaResponse);
+ case 422:
+ throw new Monite.UnprocessableEntityError(_response.error.body as Monite.HttpValidationError);
+ case 500:
+ throw new Monite.InternalServerError(_response.error.body as Monite.ErrorSchemaResponse);
+ default:
+ throw new errors.MoniteError({
+ statusCode: _response.error.statusCode,
+ body: _response.error.body,
+ });
+ }
+ }
+
+ switch (_response.error.reason) {
+ case "non-json":
+ throw new errors.MoniteError({
+ statusCode: _response.error.statusCode,
+ body: _response.error.rawBody,
+ });
+ case "timeout":
+ throw new errors.MoniteTimeoutError();
+ case "unknown":
+ throw new errors.MoniteError({
+ message: _response.error.errorMessage,
+ });
+ }
+ }
+
+ /**
+ * @param {string} contactId
+ * @param {string} counterpartId
+ * @param {Contacts.RequestOptions} requestOptions - Request-specific configuration.
+ *
+ * @throws {@link Monite.NotFoundError}
+ * @throws {@link Monite.UnprocessableEntityError}
+ * @throws {@link Monite.InternalServerError}
+ *
+ * @example
+ * await client.counterparts.contacts.deleteById("contact_id", "counterpart_id")
+ */
+ public async deleteById(
+ contactId: string,
+ counterpartId: string,
+ requestOptions?: Contacts.RequestOptions
+ ): Promise {
+ const _response = await (this._options.fetcher ?? core.fetcher)({
+ url: urlJoin(
+ (await core.Supplier.get(this._options.environment)) ?? environments.MoniteEnvironment.Sandbox,
+ `counterparts/${encodeURIComponent(counterpartId)}/contacts/${encodeURIComponent(contactId)}`
+ ),
+ method: "DELETE",
+ headers: {
+ Authorization: await this._getAuthorizationHeader(),
+ "x-monite-version": await core.Supplier.get(this._options.moniteVersion),
+ "x-monite-entity-id":
+ (await core.Supplier.get(this._options.moniteEntityId)) != null
+ ? await core.Supplier.get(this._options.moniteEntityId)
+ : undefined,
+ "X-Fern-Language": "JavaScript",
+ "X-Fern-SDK-Name": "",
+ "X-Fern-SDK-Version": "0.1.0",
+ "X-Fern-Runtime": core.RUNTIME.type,
+ "X-Fern-Runtime-Version": core.RUNTIME.version,
+ },
+ contentType: "application/json",
+ requestType: "json",
+ timeoutMs: requestOptions?.timeoutInSeconds != null ? requestOptions.timeoutInSeconds * 1000 : 60000,
+ maxRetries: requestOptions?.maxRetries,
+ abortSignal: requestOptions?.abortSignal,
+ });
+ if (_response.ok) {
+ return;
+ }
+
+ if (_response.error.reason === "status-code") {
+ switch (_response.error.statusCode) {
+ case 404:
+ throw new Monite.NotFoundError(_response.error.body as Monite.ErrorSchemaResponse);
+ case 422:
+ throw new Monite.UnprocessableEntityError(_response.error.body as Monite.HttpValidationError);
+ case 500:
+ throw new Monite.InternalServerError(_response.error.body as Monite.ErrorSchemaResponse);
+ default:
+ throw new errors.MoniteError({
+ statusCode: _response.error.statusCode,
+ body: _response.error.body,
+ });
+ }
+ }
+
+ switch (_response.error.reason) {
+ case "non-json":
+ throw new errors.MoniteError({
+ statusCode: _response.error.statusCode,
+ body: _response.error.rawBody,
+ });
+ case "timeout":
+ throw new errors.MoniteTimeoutError();
+ case "unknown":
+ throw new errors.MoniteError({
+ message: _response.error.errorMessage,
+ });
+ }
+ }
+
+ /**
+ * @param {string} contactId
+ * @param {string} counterpartId
+ * @param {Monite.counterparts.UpdateCounterpartContactPayload} request
+ * @param {Contacts.RequestOptions} requestOptions - Request-specific configuration.
+ *
+ * @throws {@link Monite.NotFoundError}
+ * @throws {@link Monite.UnprocessableEntityError}
+ * @throws {@link Monite.InternalServerError}
+ *
+ * @example
+ * await client.counterparts.contacts.updateById("contact_id", "counterpart_id")
+ */
+ public async updateById(
+ contactId: string,
+ counterpartId: string,
+ request: Monite.counterparts.UpdateCounterpartContactPayload = {},
+ requestOptions?: Contacts.RequestOptions
+ ): Promise {
+ const _response = await (this._options.fetcher ?? core.fetcher)({
+ url: urlJoin(
+ (await core.Supplier.get(this._options.environment)) ?? environments.MoniteEnvironment.Sandbox,
+ `counterparts/${encodeURIComponent(counterpartId)}/contacts/${encodeURIComponent(contactId)}`
+ ),
+ method: "PATCH",
+ headers: {
+ Authorization: await this._getAuthorizationHeader(),
+ "x-monite-version": await core.Supplier.get(this._options.moniteVersion),
+ "x-monite-entity-id":
+ (await core.Supplier.get(this._options.moniteEntityId)) != null
+ ? await core.Supplier.get(this._options.moniteEntityId)
+ : undefined,
+ "X-Fern-Language": "JavaScript",
+ "X-Fern-SDK-Name": "",
+ "X-Fern-SDK-Version": "0.1.0",
+ "X-Fern-Runtime": core.RUNTIME.type,
+ "X-Fern-Runtime-Version": core.RUNTIME.version,
+ },
+ contentType: "application/json",
+ requestType: "json",
+ body: request,
+ timeoutMs: requestOptions?.timeoutInSeconds != null ? requestOptions.timeoutInSeconds * 1000 : 60000,
+ maxRetries: requestOptions?.maxRetries,
+ abortSignal: requestOptions?.abortSignal,
+ });
+ if (_response.ok) {
+ return _response.body as Monite.CounterpartContactResponse;
+ }
+
+ if (_response.error.reason === "status-code") {
+ switch (_response.error.statusCode) {
+ case 404:
+ throw new Monite.NotFoundError(_response.error.body as Monite.ErrorSchemaResponse);
+ case 422:
+ throw new Monite.UnprocessableEntityError(_response.error.body as Monite.HttpValidationError);
+ case 500:
+ throw new Monite.InternalServerError(_response.error.body as Monite.ErrorSchemaResponse);
+ default:
+ throw new errors.MoniteError({
+ statusCode: _response.error.statusCode,
+ body: _response.error.body,
+ });
+ }
+ }
+
+ switch (_response.error.reason) {
+ case "non-json":
+ throw new errors.MoniteError({
+ statusCode: _response.error.statusCode,
+ body: _response.error.rawBody,
+ });
+ case "timeout":
+ throw new errors.MoniteTimeoutError();
+ case "unknown":
+ throw new errors.MoniteError({
+ message: _response.error.errorMessage,
+ });
+ }
+ }
+
+ /**
+ * @param {string} contactId
+ * @param {string} counterpartId
+ * @param {Contacts.RequestOptions} requestOptions - Request-specific configuration.
+ *
+ * @throws {@link Monite.NotFoundError}
+ * @throws {@link Monite.UnprocessableEntityError}
+ * @throws {@link Monite.InternalServerError}
+ *
+ * @example
+ * await client.counterparts.contacts.makeDefaultById("contact_id", "counterpart_id")
+ */
+ public async makeDefaultById(
+ contactId: string,
+ counterpartId: string,
+ requestOptions?: Contacts.RequestOptions
+ ): Promise {
+ const _response = await (this._options.fetcher ?? core.fetcher)({
+ url: urlJoin(
+ (await core.Supplier.get(this._options.environment)) ?? environments.MoniteEnvironment.Sandbox,
+ `counterparts/${encodeURIComponent(counterpartId)}/contacts/${encodeURIComponent(
+ contactId
+ )}/make_default`
+ ),
+ method: "POST",
+ headers: {
+ Authorization: await this._getAuthorizationHeader(),
+ "x-monite-version": await core.Supplier.get(this._options.moniteVersion),
+ "x-monite-entity-id":
+ (await core.Supplier.get(this._options.moniteEntityId)) != null
+ ? await core.Supplier.get(this._options.moniteEntityId)
+ : undefined,
+ "X-Fern-Language": "JavaScript",
+ "X-Fern-SDK-Name": "",
+ "X-Fern-SDK-Version": "0.1.0",
+ "X-Fern-Runtime": core.RUNTIME.type,
+ "X-Fern-Runtime-Version": core.RUNTIME.version,
+ },
+ contentType: "application/json",
+ requestType: "json",
+ timeoutMs: requestOptions?.timeoutInSeconds != null ? requestOptions.timeoutInSeconds * 1000 : 60000,
+ maxRetries: requestOptions?.maxRetries,
+ abortSignal: requestOptions?.abortSignal,
+ });
+ if (_response.ok) {
+ return _response.body as Monite.CounterpartContactResponse;
+ }
+
+ if (_response.error.reason === "status-code") {
+ switch (_response.error.statusCode) {
+ case 404:
+ throw new Monite.NotFoundError(_response.error.body as Monite.ErrorSchemaResponse);
+ case 422:
+ throw new Monite.UnprocessableEntityError(_response.error.body as Monite.HttpValidationError);
+ case 500:
+ throw new Monite.InternalServerError(_response.error.body as Monite.ErrorSchemaResponse);
+ default:
+ throw new errors.MoniteError({
+ statusCode: _response.error.statusCode,
+ body: _response.error.body,
+ });
+ }
+ }
+
+ switch (_response.error.reason) {
+ case "non-json":
+ throw new errors.MoniteError({
+ statusCode: _response.error.statusCode,
+ body: _response.error.rawBody,
+ });
+ case "timeout":
+ throw new errors.MoniteTimeoutError();
+ case "unknown":
+ throw new errors.MoniteError({
+ message: _response.error.errorMessage,
+ });
+ }
+ }
+
+ protected async _getAuthorizationHeader(): Promise {
+ const bearer = await core.Supplier.get(this._options.token);
+ if (bearer != null) {
+ return `Bearer ${bearer}`;
+ }
+
+ return undefined;
+ }
+}
diff --git a/src/api/resources/counterparts/resources/contacts/client/index.ts b/src/api/resources/counterparts/resources/contacts/client/index.ts
new file mode 100644
index 0000000..415726b
--- /dev/null
+++ b/src/api/resources/counterparts/resources/contacts/client/index.ts
@@ -0,0 +1 @@
+export * from "./requests";
diff --git a/src/api/resources/counterparts/resources/contacts/client/requests/CreateCounterpartContactPayload.ts b/src/api/resources/counterparts/resources/contacts/client/requests/CreateCounterpartContactPayload.ts
new file mode 100644
index 0000000..2db3fba
--- /dev/null
+++ b/src/api/resources/counterparts/resources/contacts/client/requests/CreateCounterpartContactPayload.ts
@@ -0,0 +1,33 @@
+/**
+ * This file was auto-generated by Fern from our API Definition.
+ */
+
+import * as Monite from "../../../../../../index";
+
+/**
+ * @example
+ * {
+ * address: {
+ * city: "Berlin",
+ * country: "AF",
+ * line1: "Flughafenstrasse 52",
+ * postal_code: "10115"
+ * },
+ * first_name: "Mary",
+ * last_name: "O'Brien"
+ * }
+ */
+export interface CreateCounterpartContactPayload {
+ /** The address of a contact person. */
+ address: Monite.CounterpartAddress;
+ /** The email address of a contact person. */
+ email?: string;
+ /** The first name of a contact person. */
+ first_name: string;
+ /** The last name of a contact person. */
+ last_name: string;
+ /** The phone number of a contact person */
+ phone?: string;
+ /** The title or honorific of a contact person. Examples: Mr., Ms., Dr., Prof. */
+ title?: string;
+}
diff --git a/src/api/resources/counterparts/resources/contacts/client/requests/UpdateCounterpartContactPayload.ts b/src/api/resources/counterparts/resources/contacts/client/requests/UpdateCounterpartContactPayload.ts
new file mode 100644
index 0000000..dc71dbd
--- /dev/null
+++ b/src/api/resources/counterparts/resources/contacts/client/requests/UpdateCounterpartContactPayload.ts
@@ -0,0 +1,24 @@
+/**
+ * This file was auto-generated by Fern from our API Definition.
+ */
+
+import * as Monite from "../../../../../../index";
+
+/**
+ * @example
+ * {}
+ */
+export interface UpdateCounterpartContactPayload {
+ /** The address of a contact person. */
+ address?: Monite.CounterpartAddress;
+ /** The email address of a contact person. */
+ email?: string;
+ /** The first name of a contact person. */
+ first_name?: string;
+ /** The last name of a contact person. */
+ last_name?: string;
+ /** The phone number of a contact person */
+ phone?: string;
+ /** The title or honorific of a contact person. Examples: Mr., Ms., Dr., Prof. */
+ title?: string;
+}
diff --git a/src/api/resources/counterparts/resources/contacts/client/requests/index.ts b/src/api/resources/counterparts/resources/contacts/client/requests/index.ts
new file mode 100644
index 0000000..af0868f
--- /dev/null
+++ b/src/api/resources/counterparts/resources/contacts/client/requests/index.ts
@@ -0,0 +1,2 @@
+export { type CreateCounterpartContactPayload } from "./CreateCounterpartContactPayload";
+export { type UpdateCounterpartContactPayload } from "./UpdateCounterpartContactPayload";
diff --git a/src/api/resources/counterparts/resources/contacts/index.ts b/src/api/resources/counterparts/resources/contacts/index.ts
new file mode 100644
index 0000000..5ec7692
--- /dev/null
+++ b/src/api/resources/counterparts/resources/contacts/index.ts
@@ -0,0 +1 @@
+export * from "./client";
diff --git a/src/api/resources/counterparts/resources/index.ts b/src/api/resources/counterparts/resources/index.ts
new file mode 100644
index 0000000..0464014
--- /dev/null
+++ b/src/api/resources/counterparts/resources/index.ts
@@ -0,0 +1,8 @@
+export * as addresses from "./addresses";
+export * as bankAccounts from "./bankAccounts";
+export * as contacts from "./contacts";
+export * as vatIds from "./vatIds";
+export * from "./addresses/client/requests";
+export * from "./bankAccounts/client/requests";
+export * from "./contacts/client/requests";
+export * from "./vatIds/client/requests";
diff --git a/src/api/resources/counterparts/resources/vatIds/client/Client.ts b/src/api/resources/counterparts/resources/vatIds/client/Client.ts
new file mode 100644
index 0000000..3a1bff9
--- /dev/null
+++ b/src/api/resources/counterparts/resources/vatIds/client/Client.ts
@@ -0,0 +1,433 @@
+/**
+ * This file was auto-generated by Fern from our API Definition.
+ */
+
+import * as environments from "../../../../../../environments";
+import * as core from "../../../../../../core";
+import * as Monite from "../../../../../index";
+import urlJoin from "url-join";
+import * as errors from "../../../../../../errors/index";
+
+export declare namespace VatIds {
+ interface Options {
+ environment?: core.Supplier;
+ token?: core.Supplier;
+ /** Override the x-monite-version header */
+ moniteVersion: core.Supplier;
+ /** Override the x-monite-entity-id header */
+ moniteEntityId?: core.Supplier;
+ fetcher?: core.FetchFunction;
+ }
+
+ interface RequestOptions {
+ /** The maximum time to wait for a response in seconds. */
+ timeoutInSeconds?: number;
+ /** The number of times to retry the request. Defaults to 2. */
+ maxRetries?: number;
+ /** A hook to abort the request. */
+ abortSignal?: AbortSignal;
+ /** Override the x-monite-version header */
+ moniteVersion?: string;
+ /** Override the x-monite-entity-id header */
+ moniteEntityId?: string | undefined;
+ }
+}
+
+export class VatIds {
+ constructor(protected readonly _options: VatIds.Options) {}
+
+ /**
+ * @param {string} counterpartId
+ * @param {VatIds.RequestOptions} requestOptions - Request-specific configuration.
+ *
+ * @throws {@link Monite.UnprocessableEntityError}
+ * @throws {@link Monite.InternalServerError}
+ *
+ * @example
+ * await client.counterparts.vatIds.get("counterpart_id")
+ */
+ public async get(
+ counterpartId: string,
+ requestOptions?: VatIds.RequestOptions
+ ): Promise {
+ const _response = await (this._options.fetcher ?? core.fetcher)({
+ url: urlJoin(
+ (await core.Supplier.get(this._options.environment)) ?? environments.MoniteEnvironment.Sandbox,
+ `counterparts/${encodeURIComponent(counterpartId)}/vat_ids`
+ ),
+ method: "GET",
+ headers: {
+ Authorization: await this._getAuthorizationHeader(),
+ "x-monite-version": await core.Supplier.get(this._options.moniteVersion),
+ "x-monite-entity-id":
+ (await core.Supplier.get(this._options.moniteEntityId)) != null
+ ? await core.Supplier.get(this._options.moniteEntityId)
+ : undefined,
+ "X-Fern-Language": "JavaScript",
+ "X-Fern-SDK-Name": "",
+ "X-Fern-SDK-Version": "0.1.0",
+ "X-Fern-Runtime": core.RUNTIME.type,
+ "X-Fern-Runtime-Version": core.RUNTIME.version,
+ },
+ contentType: "application/json",
+ requestType: "json",
+ timeoutMs: requestOptions?.timeoutInSeconds != null ? requestOptions.timeoutInSeconds * 1000 : 60000,
+ maxRetries: requestOptions?.maxRetries,
+ abortSignal: requestOptions?.abortSignal,
+ });
+ if (_response.ok) {
+ return _response.body as Monite.CounterpartVatIdResourceList;
+ }
+
+ if (_response.error.reason === "status-code") {
+ switch (_response.error.statusCode) {
+ case 422:
+ throw new Monite.UnprocessableEntityError(_response.error.body as Monite.HttpValidationError);
+ case 500:
+ throw new Monite.InternalServerError(_response.error.body as Monite.ErrorSchemaResponse);
+ default:
+ throw new errors.MoniteError({
+ statusCode: _response.error.statusCode,
+ body: _response.error.body,
+ });
+ }
+ }
+
+ switch (_response.error.reason) {
+ case "non-json":
+ throw new errors.MoniteError({
+ statusCode: _response.error.statusCode,
+ body: _response.error.rawBody,
+ });
+ case "timeout":
+ throw new errors.MoniteTimeoutError();
+ case "unknown":
+ throw new errors.MoniteError({
+ message: _response.error.errorMessage,
+ });
+ }
+ }
+
+ /**
+ * @param {string} counterpartId
+ * @param {Monite.counterparts.CounterpartVatId} request
+ * @param {VatIds.RequestOptions} requestOptions - Request-specific configuration.
+ *
+ * @throws {@link Monite.NotFoundError}
+ * @throws {@link Monite.UnprocessableEntityError}
+ * @throws {@link Monite.InternalServerError}
+ *
+ * @example
+ * await client.counterparts.vatIds.create("counterpart_id", {
+ * value: "123456789"
+ * })
+ */
+ public async create(
+ counterpartId: string,
+ request: Monite.counterparts.CounterpartVatId,
+ requestOptions?: VatIds.RequestOptions
+ ): Promise {
+ const _response = await (this._options.fetcher ?? core.fetcher)({
+ url: urlJoin(
+ (await core.Supplier.get(this._options.environment)) ?? environments.MoniteEnvironment.Sandbox,
+ `counterparts/${encodeURIComponent(counterpartId)}/vat_ids`
+ ),
+ method: "POST",
+ headers: {
+ Authorization: await this._getAuthorizationHeader(),
+ "x-monite-version": await core.Supplier.get(this._options.moniteVersion),
+ "x-monite-entity-id":
+ (await core.Supplier.get(this._options.moniteEntityId)) != null
+ ? await core.Supplier.get(this._options.moniteEntityId)
+ : undefined,
+ "X-Fern-Language": "JavaScript",
+ "X-Fern-SDK-Name": "",
+ "X-Fern-SDK-Version": "0.1.0",
+ "X-Fern-Runtime": core.RUNTIME.type,
+ "X-Fern-Runtime-Version": core.RUNTIME.version,
+ },
+ contentType: "application/json",
+ requestType: "json",
+ body: request,
+ timeoutMs: requestOptions?.timeoutInSeconds != null ? requestOptions.timeoutInSeconds * 1000 : 60000,
+ maxRetries: requestOptions?.maxRetries,
+ abortSignal: requestOptions?.abortSignal,
+ });
+ if (_response.ok) {
+ return _response.body as Monite.CounterpartVatIdResponse;
+ }
+
+ if (_response.error.reason === "status-code") {
+ switch (_response.error.statusCode) {
+ case 404:
+ throw new Monite.NotFoundError(_response.error.body as Monite.ErrorSchemaResponse);
+ case 422:
+ throw new Monite.UnprocessableEntityError(_response.error.body as Monite.HttpValidationError);
+ case 500:
+ throw new Monite.InternalServerError(_response.error.body as Monite.ErrorSchemaResponse);
+ default:
+ throw new errors.MoniteError({
+ statusCode: _response.error.statusCode,
+ body: _response.error.body,
+ });
+ }
+ }
+
+ switch (_response.error.reason) {
+ case "non-json":
+ throw new errors.MoniteError({
+ statusCode: _response.error.statusCode,
+ body: _response.error.rawBody,
+ });
+ case "timeout":
+ throw new errors.MoniteTimeoutError();
+ case "unknown":
+ throw new errors.MoniteError({
+ message: _response.error.errorMessage,
+ });
+ }
+ }
+
+ /**
+ * @param {string} vatId
+ * @param {string} counterpartId
+ * @param {VatIds.RequestOptions} requestOptions - Request-specific configuration.
+ *
+ * @throws {@link Monite.NotFoundError}
+ * @throws {@link Monite.UnprocessableEntityError}
+ * @throws {@link Monite.InternalServerError}
+ *
+ * @example
+ * await client.counterparts.vatIds.getById("vat_id", "counterpart_id")
+ */
+ public async getById(
+ vatId: string,
+ counterpartId: string,
+ requestOptions?: VatIds.RequestOptions
+ ): Promise {
+ const _response = await (this._options.fetcher ?? core.fetcher)({
+ url: urlJoin(
+ (await core.Supplier.get(this._options.environment)) ?? environments.MoniteEnvironment.Sandbox,
+ `counterparts/${encodeURIComponent(counterpartId)}/vat_ids/${encodeURIComponent(vatId)}`
+ ),
+ method: "GET",
+ headers: {
+ Authorization: await this._getAuthorizationHeader(),
+ "x-monite-version": await core.Supplier.get(this._options.moniteVersion),
+ "x-monite-entity-id":
+ (await core.Supplier.get(this._options.moniteEntityId)) != null
+ ? await core.Supplier.get(this._options.moniteEntityId)
+ : undefined,
+ "X-Fern-Language": "JavaScript",
+ "X-Fern-SDK-Name": "",
+ "X-Fern-SDK-Version": "0.1.0",
+ "X-Fern-Runtime": core.RUNTIME.type,
+ "X-Fern-Runtime-Version": core.RUNTIME.version,
+ },
+ contentType: "application/json",
+ requestType: "json",
+ timeoutMs: requestOptions?.timeoutInSeconds != null ? requestOptions.timeoutInSeconds * 1000 : 60000,
+ maxRetries: requestOptions?.maxRetries,
+ abortSignal: requestOptions?.abortSignal,
+ });
+ if (_response.ok) {
+ return _response.body as Monite.CounterpartVatIdResponse;
+ }
+
+ if (_response.error.reason === "status-code") {
+ switch (_response.error.statusCode) {
+ case 404:
+ throw new Monite.NotFoundError(_response.error.body as Monite.ErrorSchemaResponse);
+ case 422:
+ throw new Monite.UnprocessableEntityError(_response.error.body as Monite.HttpValidationError);
+ case 500:
+ throw new Monite.InternalServerError(_response.error.body as Monite.ErrorSchemaResponse);
+ default:
+ throw new errors.MoniteError({
+ statusCode: _response.error.statusCode,
+ body: _response.error.body,
+ });
+ }
+ }
+
+ switch (_response.error.reason) {
+ case "non-json":
+ throw new errors.MoniteError({
+ statusCode: _response.error.statusCode,
+ body: _response.error.rawBody,
+ });
+ case "timeout":
+ throw new errors.MoniteTimeoutError();
+ case "unknown":
+ throw new errors.MoniteError({
+ message: _response.error.errorMessage,
+ });
+ }
+ }
+
+ /**
+ * @param {string} vatId
+ * @param {string} counterpartId
+ * @param {VatIds.RequestOptions} requestOptions - Request-specific configuration.
+ *
+ * @throws {@link Monite.NotFoundError}
+ * @throws {@link Monite.UnprocessableEntityError}
+ * @throws {@link Monite.InternalServerError}
+ *
+ * @example
+ * await client.counterparts.vatIds.deleteById("vat_id", "counterpart_id")
+ */
+ public async deleteById(
+ vatId: string,
+ counterpartId: string,
+ requestOptions?: VatIds.RequestOptions
+ ): Promise {
+ const _response = await (this._options.fetcher ?? core.fetcher)({
+ url: urlJoin(
+ (await core.Supplier.get(this._options.environment)) ?? environments.MoniteEnvironment.Sandbox,
+ `counterparts/${encodeURIComponent(counterpartId)}/vat_ids/${encodeURIComponent(vatId)}`
+ ),
+ method: "DELETE",
+ headers: {
+ Authorization: await this._getAuthorizationHeader(),
+ "x-monite-version": await core.Supplier.get(this._options.moniteVersion),
+ "x-monite-entity-id":
+ (await core.Supplier.get(this._options.moniteEntityId)) != null
+ ? await core.Supplier.get(this._options.moniteEntityId)
+ : undefined,
+ "X-Fern-Language": "JavaScript",
+ "X-Fern-SDK-Name": "",
+ "X-Fern-SDK-Version": "0.1.0",
+ "X-Fern-Runtime": core.RUNTIME.type,
+ "X-Fern-Runtime-Version": core.RUNTIME.version,
+ },
+ contentType: "application/json",
+ requestType: "json",
+ timeoutMs: requestOptions?.timeoutInSeconds != null ? requestOptions.timeoutInSeconds * 1000 : 60000,
+ maxRetries: requestOptions?.maxRetries,
+ abortSignal: requestOptions?.abortSignal,
+ });
+ if (_response.ok) {
+ return;
+ }
+
+ if (_response.error.reason === "status-code") {
+ switch (_response.error.statusCode) {
+ case 404:
+ throw new Monite.NotFoundError(_response.error.body as Monite.ErrorSchemaResponse);
+ case 422:
+ throw new Monite.UnprocessableEntityError(_response.error.body as Monite.HttpValidationError);
+ case 500:
+ throw new Monite.InternalServerError(_response.error.body as Monite.ErrorSchemaResponse);
+ default:
+ throw new errors.MoniteError({
+ statusCode: _response.error.statusCode,
+ body: _response.error.body,
+ });
+ }
+ }
+
+ switch (_response.error.reason) {
+ case "non-json":
+ throw new errors.MoniteError({
+ statusCode: _response.error.statusCode,
+ body: _response.error.rawBody,
+ });
+ case "timeout":
+ throw new errors.MoniteTimeoutError();
+ case "unknown":
+ throw new errors.MoniteError({
+ message: _response.error.errorMessage,
+ });
+ }
+ }
+
+ /**
+ * @param {string} vatId
+ * @param {string} counterpartId
+ * @param {Monite.counterparts.CounterpartUpdateVatId} request
+ * @param {VatIds.RequestOptions} requestOptions - Request-specific configuration.
+ *
+ * @throws {@link Monite.NotFoundError}
+ * @throws {@link Monite.UnprocessableEntityError}
+ * @throws {@link Monite.InternalServerError}
+ *
+ * @example
+ * await client.counterparts.vatIds.updateById("vat_id", "counterpart_id")
+ */
+ public async updateById(
+ vatId: string,
+ counterpartId: string,
+ request: Monite.counterparts.CounterpartUpdateVatId = {},
+ requestOptions?: VatIds.RequestOptions
+ ): Promise {
+ const _response = await (this._options.fetcher ?? core.fetcher)({
+ url: urlJoin(
+ (await core.Supplier.get(this._options.environment)) ?? environments.MoniteEnvironment.Sandbox,
+ `counterparts/${encodeURIComponent(counterpartId)}/vat_ids/${encodeURIComponent(vatId)}`
+ ),
+ method: "PATCH",
+ headers: {
+ Authorization: await this._getAuthorizationHeader(),
+ "x-monite-version": await core.Supplier.get(this._options.moniteVersion),
+ "x-monite-entity-id":
+ (await core.Supplier.get(this._options.moniteEntityId)) != null
+ ? await core.Supplier.get(this._options.moniteEntityId)
+ : undefined,
+ "X-Fern-Language": "JavaScript",
+ "X-Fern-SDK-Name": "",
+ "X-Fern-SDK-Version": "0.1.0",
+ "X-Fern-Runtime": core.RUNTIME.type,
+ "X-Fern-Runtime-Version": core.RUNTIME.version,
+ },
+ contentType: "application/json",
+ requestType: "json",
+ body: request,
+ timeoutMs: requestOptions?.timeoutInSeconds != null ? requestOptions.timeoutInSeconds * 1000 : 60000,
+ maxRetries: requestOptions?.maxRetries,
+ abortSignal: requestOptions?.abortSignal,
+ });
+ if (_response.ok) {
+ return _response.body as Monite.CounterpartVatIdResponse;
+ }
+
+ if (_response.error.reason === "status-code") {
+ switch (_response.error.statusCode) {
+ case 404:
+ throw new Monite.NotFoundError(_response.error.body as Monite.ErrorSchemaResponse);
+ case 422:
+ throw new Monite.UnprocessableEntityError(_response.error.body as Monite.HttpValidationError);
+ case 500:
+ throw new Monite.InternalServerError(_response.error.body as Monite.ErrorSchemaResponse);
+ default:
+ throw new errors.MoniteError({
+ statusCode: _response.error.statusCode,
+ body: _response.error.body,
+ });
+ }
+ }
+
+ switch (_response.error.reason) {
+ case "non-json":
+ throw new errors.MoniteError({
+ statusCode: _response.error.statusCode,
+ body: _response.error.rawBody,
+ });
+ case "timeout":
+ throw new errors.MoniteTimeoutError();
+ case "unknown":
+ throw new errors.MoniteError({
+ message: _response.error.errorMessage,
+ });
+ }
+ }
+
+ protected async _getAuthorizationHeader(): Promise {
+ const bearer = await core.Supplier.get(this._options.token);
+ if (bearer != null) {
+ return `Bearer ${bearer}`;
+ }
+
+ return undefined;
+ }
+}
diff --git a/src/api/resources/counterparts/resources/vatIds/client/index.ts b/src/api/resources/counterparts/resources/vatIds/client/index.ts
new file mode 100644
index 0000000..415726b
--- /dev/null
+++ b/src/api/resources/counterparts/resources/vatIds/client/index.ts
@@ -0,0 +1 @@
+export * from "./requests";
diff --git a/src/api/resources/counterparts/resources/vatIds/client/requests/CounterpartUpdateVatId.ts b/src/api/resources/counterparts/resources/vatIds/client/requests/CounterpartUpdateVatId.ts
new file mode 100644
index 0000000..b9d39e4
--- /dev/null
+++ b/src/api/resources/counterparts/resources/vatIds/client/requests/CounterpartUpdateVatId.ts
@@ -0,0 +1,15 @@
+/**
+ * This file was auto-generated by Fern from our API Definition.
+ */
+
+import * as Monite from "../../../../../../index";
+
+/**
+ * @example
+ * {}
+ */
+export interface CounterpartUpdateVatId {
+ country?: Monite.AllowedCountries;
+ type?: Monite.VatIdTypeEnum;
+ value?: string;
+}
diff --git a/src/api/resources/counterparts/resources/vatIds/client/requests/CounterpartVatId.ts b/src/api/resources/counterparts/resources/vatIds/client/requests/CounterpartVatId.ts
new file mode 100644
index 0000000..c0d38c5
--- /dev/null
+++ b/src/api/resources/counterparts/resources/vatIds/client/requests/CounterpartVatId.ts
@@ -0,0 +1,17 @@
+/**
+ * This file was auto-generated by Fern from our API Definition.
+ */
+
+import * as Monite from "../../../../../../index";
+
+/**
+ * @example
+ * {
+ * value: "123456789"
+ * }
+ */
+export interface CounterpartVatId {
+ country?: Monite.AllowedCountries;
+ type?: Monite.VatIdTypeEnum;
+ value: string;
+}
diff --git a/src/api/resources/counterparts/resources/vatIds/client/requests/index.ts b/src/api/resources/counterparts/resources/vatIds/client/requests/index.ts
new file mode 100644
index 0000000..21c9ada
--- /dev/null
+++ b/src/api/resources/counterparts/resources/vatIds/client/requests/index.ts
@@ -0,0 +1,2 @@
+export { type CounterpartVatId } from "./CounterpartVatId";
+export { type CounterpartUpdateVatId } from "./CounterpartUpdateVatId";
diff --git a/src/api/resources/counterparts/resources/vatIds/index.ts b/src/api/resources/counterparts/resources/vatIds/index.ts
new file mode 100644
index 0000000..5ec7692
--- /dev/null
+++ b/src/api/resources/counterparts/resources/vatIds/index.ts
@@ -0,0 +1 @@
+export * from "./client";
diff --git a/src/api/resources/dataExports/client/Client.ts b/src/api/resources/dataExports/client/Client.ts
new file mode 100644
index 0000000..48756ec
--- /dev/null
+++ b/src/api/resources/dataExports/client/Client.ts
@@ -0,0 +1,437 @@
+/**
+ * This file was auto-generated by Fern from our API Definition.
+ */
+
+import * as environments from "../../../../environments";
+import * as core from "../../../../core";
+import * as Monite from "../../../index";
+import urlJoin from "url-join";
+import * as errors from "../../../../errors/index";
+import { ExtraData } from "../resources/extraData/client/Client";
+
+export declare namespace DataExports {
+ interface Options {
+ environment?: core.Supplier;
+ token?: core.Supplier;
+ /** Override the x-monite-version header */
+ moniteVersion: core.Supplier;
+ /** Override the x-monite-entity-id header */
+ moniteEntityId?: core.Supplier;
+ fetcher?: core.FetchFunction;
+ }
+
+ interface RequestOptions {
+ /** The maximum time to wait for a response in seconds. */
+ timeoutInSeconds?: number;
+ /** The number of times to retry the request. Defaults to 2. */
+ maxRetries?: number;
+ /** A hook to abort the request. */
+ abortSignal?: AbortSignal;
+ /** Override the x-monite-version header */
+ moniteVersion?: string;
+ /** Override the x-monite-entity-id header */
+ moniteEntityId?: string | undefined;
+ }
+}
+
+export class DataExports {
+ constructor(protected readonly _options: DataExports.Options) {}
+
+ /**
+ * @param {Monite.DataExportsGetRequest} request
+ * @param {DataExports.RequestOptions} requestOptions - Request-specific configuration.
+ *
+ * @throws {@link Monite.BadRequestError}
+ * @throws {@link Monite.UnauthorizedError}
+ * @throws {@link Monite.ForbiddenError}
+ * @throws {@link Monite.NotAcceptableError}
+ * @throws {@link Monite.UnprocessableEntityError}
+ * @throws {@link Monite.InternalServerError}
+ *
+ * @example
+ * await client.dataExports.get()
+ */
+ public async get(
+ request: Monite.DataExportsGetRequest = {},
+ requestOptions?: DataExports.RequestOptions
+ ): Promise {
+ const {
+ order,
+ limit,
+ pagination_token: paginationToken,
+ sort,
+ created_at__gt: createdAtGt,
+ created_at__lt: createdAtLt,
+ created_at__gte: createdAtGte,
+ created_at__lte: createdAtLte,
+ created_by_entity_user_id: createdByEntityUserId,
+ } = request;
+ const _queryParams: Record = {};
+ if (order != null) {
+ _queryParams["order"] = order;
+ }
+
+ if (limit != null) {
+ _queryParams["limit"] = limit.toString();
+ }
+
+ if (paginationToken != null) {
+ _queryParams["pagination_token"] = paginationToken;
+ }
+
+ if (sort != null) {
+ _queryParams["sort"] = sort;
+ }
+
+ if (createdAtGt != null) {
+ _queryParams["created_at__gt"] = createdAtGt;
+ }
+
+ if (createdAtLt != null) {
+ _queryParams["created_at__lt"] = createdAtLt;
+ }
+
+ if (createdAtGte != null) {
+ _queryParams["created_at__gte"] = createdAtGte;
+ }
+
+ if (createdAtLte != null) {
+ _queryParams["created_at__lte"] = createdAtLte;
+ }
+
+ if (createdByEntityUserId != null) {
+ _queryParams["created_by_entity_user_id"] = createdByEntityUserId;
+ }
+
+ const _response = await (this._options.fetcher ?? core.fetcher)({
+ url: urlJoin(
+ (await core.Supplier.get(this._options.environment)) ?? environments.MoniteEnvironment.Sandbox,
+ "data_exports"
+ ),
+ method: "GET",
+ headers: {
+ Authorization: await this._getAuthorizationHeader(),
+ "x-monite-version": await core.Supplier.get(this._options.moniteVersion),
+ "x-monite-entity-id":
+ (await core.Supplier.get(this._options.moniteEntityId)) != null
+ ? await core.Supplier.get(this._options.moniteEntityId)
+ : undefined,
+ "X-Fern-Language": "JavaScript",
+ "X-Fern-SDK-Name": "",
+ "X-Fern-SDK-Version": "0.1.0",
+ "X-Fern-Runtime": core.RUNTIME.type,
+ "X-Fern-Runtime-Version": core.RUNTIME.version,
+ },
+ contentType: "application/json",
+ queryParameters: _queryParams,
+ requestType: "json",
+ timeoutMs: requestOptions?.timeoutInSeconds != null ? requestOptions.timeoutInSeconds * 1000 : 60000,
+ maxRetries: requestOptions?.maxRetries,
+ abortSignal: requestOptions?.abortSignal,
+ });
+ if (_response.ok) {
+ return _response.body as Monite.AllDocumentExportResponseSchema;
+ }
+
+ if (_response.error.reason === "status-code") {
+ switch (_response.error.statusCode) {
+ case 400:
+ throw new Monite.BadRequestError(_response.error.body as Monite.ErrorSchemaResponse);
+ case 401:
+ throw new Monite.UnauthorizedError(_response.error.body as Monite.ErrorSchemaResponse);
+ case 403:
+ throw new Monite.ForbiddenError(_response.error.body as Monite.ErrorSchemaResponse);
+ case 406:
+ throw new Monite.NotAcceptableError(_response.error.body as Monite.ErrorSchemaResponse);
+ case 422:
+ throw new Monite.UnprocessableEntityError(_response.error.body as Monite.HttpValidationError);
+ case 500:
+ throw new Monite.InternalServerError(_response.error.body as Monite.ErrorSchemaResponse);
+ default:
+ throw new errors.MoniteError({
+ statusCode: _response.error.statusCode,
+ body: _response.error.body,
+ });
+ }
+ }
+
+ switch (_response.error.reason) {
+ case "non-json":
+ throw new errors.MoniteError({
+ statusCode: _response.error.statusCode,
+ body: _response.error.rawBody,
+ });
+ case "timeout":
+ throw new errors.MoniteTimeoutError();
+ case "unknown":
+ throw new errors.MoniteError({
+ message: _response.error.errorMessage,
+ });
+ }
+ }
+
+ /**
+ * @param {Monite.ExportPayloadSchema} request
+ * @param {DataExports.RequestOptions} requestOptions - Request-specific configuration.
+ *
+ * @throws {@link Monite.BadRequestError}
+ * @throws {@link Monite.UnauthorizedError}
+ * @throws {@link Monite.ForbiddenError}
+ * @throws {@link Monite.NotFoundError}
+ * @throws {@link Monite.ConflictError}
+ * @throws {@link Monite.UnprocessableEntityError}
+ * @throws {@link Monite.InternalServerError}
+ *
+ * @example
+ * await client.dataExports.create({
+ * date_from: "date_from",
+ * date_to: "date_to",
+ * format: "csv",
+ * objects: [{
+ * name: "receivable",
+ * statuses: ["draft"]
+ * }]
+ * })
+ */
+ public async create(
+ request: Monite.ExportPayloadSchema,
+ requestOptions?: DataExports.RequestOptions
+ ): Promise {
+ const _response = await (this._options.fetcher ?? core.fetcher)({
+ url: urlJoin(
+ (await core.Supplier.get(this._options.environment)) ?? environments.MoniteEnvironment.Sandbox,
+ "data_exports"
+ ),
+ method: "POST",
+ headers: {
+ Authorization: await this._getAuthorizationHeader(),
+ "x-monite-version": await core.Supplier.get(this._options.moniteVersion),
+ "x-monite-entity-id":
+ (await core.Supplier.get(this._options.moniteEntityId)) != null
+ ? await core.Supplier.get(this._options.moniteEntityId)
+ : undefined,
+ "X-Fern-Language": "JavaScript",
+ "X-Fern-SDK-Name": "",
+ "X-Fern-SDK-Version": "0.1.0",
+ "X-Fern-Runtime": core.RUNTIME.type,
+ "X-Fern-Runtime-Version": core.RUNTIME.version,
+ },
+ contentType: "application/json",
+ requestType: "json",
+ body: request,
+ timeoutMs: requestOptions?.timeoutInSeconds != null ? requestOptions.timeoutInSeconds * 1000 : 60000,
+ maxRetries: requestOptions?.maxRetries,
+ abortSignal: requestOptions?.abortSignal,
+ });
+ if (_response.ok) {
+ return _response.body as Monite.CreateExportTaskResponseSchema;
+ }
+
+ if (_response.error.reason === "status-code") {
+ switch (_response.error.statusCode) {
+ case 400:
+ throw new Monite.BadRequestError(_response.error.body as Monite.ErrorSchemaResponse);
+ case 401:
+ throw new Monite.UnauthorizedError(_response.error.body as Monite.ErrorSchemaResponse);
+ case 403:
+ throw new Monite.ForbiddenError(_response.error.body as Monite.ErrorSchemaResponse);
+ case 404:
+ throw new Monite.NotFoundError(_response.error.body as Monite.ErrorSchemaResponse);
+ case 409:
+ throw new Monite.ConflictError(_response.error.body as Monite.ErrorSchemaResponse);
+ case 422:
+ throw new Monite.UnprocessableEntityError(_response.error.body as Monite.HttpValidationError);
+ case 500:
+ throw new Monite.InternalServerError(_response.error.body as Monite.ErrorSchemaResponse);
+ default:
+ throw new errors.MoniteError({
+ statusCode: _response.error.statusCode,
+ body: _response.error.body,
+ });
+ }
+ }
+
+ switch (_response.error.reason) {
+ case "non-json":
+ throw new errors.MoniteError({
+ statusCode: _response.error.statusCode,
+ body: _response.error.rawBody,
+ });
+ case "timeout":
+ throw new errors.MoniteTimeoutError();
+ case "unknown":
+ throw new errors.MoniteError({
+ message: _response.error.errorMessage,
+ });
+ }
+ }
+
+ /**
+ * @param {DataExports.RequestOptions} requestOptions - Request-specific configuration.
+ *
+ * @throws {@link Monite.UnprocessableEntityError}
+ * @throws {@link Monite.InternalServerError}
+ *
+ * @example
+ * await client.dataExports.getSupportedFormats()
+ */
+ public async getSupportedFormats(
+ requestOptions?: DataExports.RequestOptions
+ ): Promise {
+ const _response = await (this._options.fetcher ?? core.fetcher)({
+ url: urlJoin(
+ (await core.Supplier.get(this._options.environment)) ?? environments.MoniteEnvironment.Sandbox,
+ "data_exports/supported_formats"
+ ),
+ method: "GET",
+ headers: {
+ Authorization: await this._getAuthorizationHeader(),
+ "x-monite-version": await core.Supplier.get(this._options.moniteVersion),
+ "x-monite-entity-id":
+ (await core.Supplier.get(this._options.moniteEntityId)) != null
+ ? await core.Supplier.get(this._options.moniteEntityId)
+ : undefined,
+ "X-Fern-Language": "JavaScript",
+ "X-Fern-SDK-Name": "",
+ "X-Fern-SDK-Version": "0.1.0",
+ "X-Fern-Runtime": core.RUNTIME.type,
+ "X-Fern-Runtime-Version": core.RUNTIME.version,
+ },
+ contentType: "application/json",
+ requestType: "json",
+ timeoutMs: requestOptions?.timeoutInSeconds != null ? requestOptions.timeoutInSeconds * 1000 : 60000,
+ maxRetries: requestOptions?.maxRetries,
+ abortSignal: requestOptions?.abortSignal,
+ });
+ if (_response.ok) {
+ return _response.body as Monite.SupportedFormatSchema[];
+ }
+
+ if (_response.error.reason === "status-code") {
+ switch (_response.error.statusCode) {
+ case 422:
+ throw new Monite.UnprocessableEntityError(_response.error.body as Monite.HttpValidationError);
+ case 500:
+ throw new Monite.InternalServerError(_response.error.body as Monite.ErrorSchemaResponse);
+ default:
+ throw new errors.MoniteError({
+ statusCode: _response.error.statusCode,
+ body: _response.error.body,
+ });
+ }
+ }
+
+ switch (_response.error.reason) {
+ case "non-json":
+ throw new errors.MoniteError({
+ statusCode: _response.error.statusCode,
+ body: _response.error.rawBody,
+ });
+ case "timeout":
+ throw new errors.MoniteTimeoutError();
+ case "unknown":
+ throw new errors.MoniteError({
+ message: _response.error.errorMessage,
+ });
+ }
+ }
+
+ /**
+ * @param {string} documentExportId
+ * @param {DataExports.RequestOptions} requestOptions - Request-specific configuration.
+ *
+ * @throws {@link Monite.BadRequestError}
+ * @throws {@link Monite.UnauthorizedError}
+ * @throws {@link Monite.ForbiddenError}
+ * @throws {@link Monite.NotFoundError}
+ * @throws {@link Monite.UnprocessableEntityError}
+ * @throws {@link Monite.InternalServerError}
+ *
+ * @example
+ * await client.dataExports.getById("document_export_id")
+ */
+ public async getById(
+ documentExportId: string,
+ requestOptions?: DataExports.RequestOptions
+ ): Promise {
+ const _response = await (this._options.fetcher ?? core.fetcher)({
+ url: urlJoin(
+ (await core.Supplier.get(this._options.environment)) ?? environments.MoniteEnvironment.Sandbox,
+ `data_exports/${encodeURIComponent(documentExportId)}`
+ ),
+ method: "GET",
+ headers: {
+ Authorization: await this._getAuthorizationHeader(),
+ "x-monite-version": await core.Supplier.get(this._options.moniteVersion),
+ "x-monite-entity-id":
+ (await core.Supplier.get(this._options.moniteEntityId)) != null
+ ? await core.Supplier.get(this._options.moniteEntityId)
+ : undefined,
+ "X-Fern-Language": "JavaScript",
+ "X-Fern-SDK-Name": "",
+ "X-Fern-SDK-Version": "0.1.0",
+ "X-Fern-Runtime": core.RUNTIME.type,
+ "X-Fern-Runtime-Version": core.RUNTIME.version,
+ },
+ contentType: "application/json",
+ requestType: "json",
+ timeoutMs: requestOptions?.timeoutInSeconds != null ? requestOptions.timeoutInSeconds * 1000 : 60000,
+ maxRetries: requestOptions?.maxRetries,
+ abortSignal: requestOptions?.abortSignal,
+ });
+ if (_response.ok) {
+ return _response.body as Monite.DocumentExportResponseSchema;
+ }
+
+ if (_response.error.reason === "status-code") {
+ switch (_response.error.statusCode) {
+ case 400:
+ throw new Monite.BadRequestError(_response.error.body as Monite.ErrorSchemaResponse);
+ case 401:
+ throw new Monite.UnauthorizedError(_response.error.body as Monite.ErrorSchemaResponse);
+ case 403:
+ throw new Monite.ForbiddenError(_response.error.body as Monite.ErrorSchemaResponse);
+ case 404:
+ throw new Monite.NotFoundError(_response.error.body as Monite.ErrorSchemaResponse);
+ case 422:
+ throw new Monite.UnprocessableEntityError(_response.error.body as Monite.HttpValidationError);
+ case 500:
+ throw new Monite.InternalServerError(_response.error.body as Monite.ErrorSchemaResponse);
+ default:
+ throw new errors.MoniteError({
+ statusCode: _response.error.statusCode,
+ body: _response.error.body,
+ });
+ }
+ }
+
+ switch (_response.error.reason) {
+ case "non-json":
+ throw new errors.MoniteError({
+ statusCode: _response.error.statusCode,
+ body: _response.error.rawBody,
+ });
+ case "timeout":
+ throw new errors.MoniteTimeoutError();
+ case "unknown":
+ throw new errors.MoniteError({
+ message: _response.error.errorMessage,
+ });
+ }
+ }
+
+ protected _extraData: ExtraData | undefined;
+
+ public get extraData(): ExtraData {
+ return (this._extraData ??= new ExtraData(this._options));
+ }
+
+ protected async _getAuthorizationHeader(): Promise {
+ const bearer = await core.Supplier.get(this._options.token);
+ if (bearer != null) {
+ return `Bearer ${bearer}`;
+ }
+
+ return undefined;
+ }
+}
diff --git a/src/api/resources/dataExports/client/index.ts b/src/api/resources/dataExports/client/index.ts
new file mode 100644
index 0000000..415726b
--- /dev/null
+++ b/src/api/resources/dataExports/client/index.ts
@@ -0,0 +1 @@
+export * from "./requests";
diff --git a/src/api/resources/dataExports/client/requests/DataExportsGetRequest.ts b/src/api/resources/dataExports/client/requests/DataExportsGetRequest.ts
new file mode 100644
index 0000000..843f4e9
--- /dev/null
+++ b/src/api/resources/dataExports/client/requests/DataExportsGetRequest.ts
@@ -0,0 +1,33 @@
+/**
+ * This file was auto-generated by Fern from our API Definition.
+ */
+
+import * as Monite from "../../../../index";
+
+/**
+ * @example
+ * {}
+ */
+export interface DataExportsGetRequest {
+ /**
+ * Order by
+ */
+ order?: Monite.OrderEnum;
+ /**
+ * Max is 100
+ */
+ limit?: number;
+ /**
+ * A token, obtained from previous page. Prior over other filters
+ */
+ pagination_token?: string;
+ /**
+ * Allowed sort fields
+ */
+ sort?: Monite.DataExportCursorFields;
+ created_at__gt?: string;
+ created_at__lt?: string;
+ created_at__gte?: string;
+ created_at__lte?: string;
+ created_by_entity_user_id?: string;
+}
diff --git a/src/api/resources/dataExports/client/requests/ExportPayloadSchema.ts b/src/api/resources/dataExports/client/requests/ExportPayloadSchema.ts
new file mode 100644
index 0000000..5609e58
--- /dev/null
+++ b/src/api/resources/dataExports/client/requests/ExportPayloadSchema.ts
@@ -0,0 +1,24 @@
+/**
+ * This file was auto-generated by Fern from our API Definition.
+ */
+
+import * as Monite from "../../../../index";
+
+/**
+ * @example
+ * {
+ * date_from: "date_from",
+ * date_to: "date_to",
+ * format: "csv",
+ * objects: [{
+ * name: "receivable",
+ * statuses: ["draft"]
+ * }]
+ * }
+ */
+export interface ExportPayloadSchema {
+ date_from: string;
+ date_to: string;
+ format: Monite.ExportFormat;
+ objects: Monite.ExportObjectSchema[];
+}
diff --git a/src/api/resources/dataExports/client/requests/index.ts b/src/api/resources/dataExports/client/requests/index.ts
new file mode 100644
index 0000000..c27373e
--- /dev/null
+++ b/src/api/resources/dataExports/client/requests/index.ts
@@ -0,0 +1,2 @@
+export { type DataExportsGetRequest } from "./DataExportsGetRequest";
+export { type ExportPayloadSchema } from "./ExportPayloadSchema";
diff --git a/src/api/resources/dataExports/index.ts b/src/api/resources/dataExports/index.ts
new file mode 100644
index 0000000..33a87f1
--- /dev/null
+++ b/src/api/resources/dataExports/index.ts
@@ -0,0 +1,2 @@
+export * from "./client";
+export * from "./resources";
diff --git a/src/api/resources/dataExports/resources/extraData/client/Client.ts b/src/api/resources/dataExports/resources/extraData/client/Client.ts
new file mode 100644
index 0000000..45c92aa
--- /dev/null
+++ b/src/api/resources/dataExports/resources/extraData/client/Client.ts
@@ -0,0 +1,539 @@
+/**
+ * This file was auto-generated by Fern from our API Definition.
+ */
+
+import * as environments from "../../../../../../environments";
+import * as core from "../../../../../../core";
+import * as Monite from "../../../../../index";
+import urlJoin from "url-join";
+import * as errors from "../../../../../../errors/index";
+
+export declare namespace ExtraData {
+ interface Options {
+ environment?: core.Supplier;
+ token?: core.Supplier;
+ /** Override the x-monite-version header */
+ moniteVersion: core.Supplier;
+ /** Override the x-monite-entity-id header */
+ moniteEntityId?: core.Supplier;
+ fetcher?: core.FetchFunction;
+ }
+
+ interface RequestOptions {
+ /** The maximum time to wait for a response in seconds. */
+ timeoutInSeconds?: number;
+ /** The number of times to retry the request. Defaults to 2. */
+ maxRetries?: number;
+ /** A hook to abort the request. */
+ abortSignal?: AbortSignal;
+ /** Override the x-monite-version header */
+ moniteVersion?: string;
+ /** Override the x-monite-entity-id header */
+ moniteEntityId?: string | undefined;
+ }
+}
+
+export class ExtraData {
+ constructor(protected readonly _options: ExtraData.Options) {}
+
+ /**
+ * @param {Monite.dataExports.ExtraDataGetRequest} request
+ * @param {ExtraData.RequestOptions} requestOptions - Request-specific configuration.
+ *
+ * @throws {@link Monite.UnauthorizedError}
+ * @throws {@link Monite.ForbiddenError}
+ * @throws {@link Monite.UnprocessableEntityError}
+ * @throws {@link Monite.InternalServerError}
+ *
+ * @example
+ * await client.dataExports.extraData.get()
+ */
+ public async get(
+ request: Monite.dataExports.ExtraDataGetRequest = {},
+ requestOptions?: ExtraData.RequestOptions
+ ): Promise {
+ const {
+ order,
+ limit,
+ pagination_token: paginationToken,
+ sort,
+ created_at__gt: createdAtGt,
+ created_at__lt: createdAtLt,
+ created_at__gte: createdAtGte,
+ created_at__lte: createdAtLte,
+ updated_at__gt: updatedAtGt,
+ updated_at__lt: updatedAtLt,
+ updated_at__gte: updatedAtGte,
+ updated_at__lte: updatedAtLte,
+ object_id: objectId,
+ field_name: fieldName,
+ field_value: fieldValue,
+ } = request;
+ const _queryParams: Record = {};
+ if (order != null) {
+ _queryParams["order"] = order;
+ }
+
+ if (limit != null) {
+ _queryParams["limit"] = limit.toString();
+ }
+
+ if (paginationToken != null) {
+ _queryParams["pagination_token"] = paginationToken;
+ }
+
+ if (sort != null) {
+ _queryParams["sort"] = sort;
+ }
+
+ if (createdAtGt != null) {
+ _queryParams["created_at__gt"] = createdAtGt;
+ }
+
+ if (createdAtLt != null) {
+ _queryParams["created_at__lt"] = createdAtLt;
+ }
+
+ if (createdAtGte != null) {
+ _queryParams["created_at__gte"] = createdAtGte;
+ }
+
+ if (createdAtLte != null) {
+ _queryParams["created_at__lte"] = createdAtLte;
+ }
+
+ if (updatedAtGt != null) {
+ _queryParams["updated_at__gt"] = updatedAtGt;
+ }
+
+ if (updatedAtLt != null) {
+ _queryParams["updated_at__lt"] = updatedAtLt;
+ }
+
+ if (updatedAtGte != null) {
+ _queryParams["updated_at__gte"] = updatedAtGte;
+ }
+
+ if (updatedAtLte != null) {
+ _queryParams["updated_at__lte"] = updatedAtLte;
+ }
+
+ if (objectId != null) {
+ _queryParams["object_id"] = objectId;
+ }
+
+ if (fieldName != null) {
+ _queryParams["field_name"] = fieldName;
+ }
+
+ if (fieldValue != null) {
+ _queryParams["field_value"] = fieldValue;
+ }
+
+ const _response = await (this._options.fetcher ?? core.fetcher)({
+ url: urlJoin(
+ (await core.Supplier.get(this._options.environment)) ?? environments.MoniteEnvironment.Sandbox,
+ "data_exports/extra_data"
+ ),
+ method: "GET",
+ headers: {
+ Authorization: await this._getAuthorizationHeader(),
+ "x-monite-version": await core.Supplier.get(this._options.moniteVersion),
+ "x-monite-entity-id":
+ (await core.Supplier.get(this._options.moniteEntityId)) != null
+ ? await core.Supplier.get(this._options.moniteEntityId)
+ : undefined,
+ "X-Fern-Language": "JavaScript",
+ "X-Fern-SDK-Name": "",
+ "X-Fern-SDK-Version": "0.1.0",
+ "X-Fern-Runtime": core.RUNTIME.type,
+ "X-Fern-Runtime-Version": core.RUNTIME.version,
+ },
+ contentType: "application/json",
+ queryParameters: _queryParams,
+ requestType: "json",
+ timeoutMs: requestOptions?.timeoutInSeconds != null ? requestOptions.timeoutInSeconds * 1000 : 60000,
+ maxRetries: requestOptions?.maxRetries,
+ abortSignal: requestOptions?.abortSignal,
+ });
+ if (_response.ok) {
+ return _response.body as Monite.ExtraDataResourceList;
+ }
+
+ if (_response.error.reason === "status-code") {
+ switch (_response.error.statusCode) {
+ case 401:
+ throw new Monite.UnauthorizedError(_response.error.body as Monite.ErrorSchemaResponse);
+ case 403:
+ throw new Monite.ForbiddenError(_response.error.body as Monite.ErrorSchemaResponse);
+ case 422:
+ throw new Monite.UnprocessableEntityError(_response.error.body as Monite.HttpValidationError);
+ case 500:
+ throw new Monite.InternalServerError(_response.error.body as Monite.ErrorSchemaResponse);
+ default:
+ throw new errors.MoniteError({
+ statusCode: _response.error.statusCode,
+ body: _response.error.body,
+ });
+ }
+ }
+
+ switch (_response.error.reason) {
+ case "non-json":
+ throw new errors.MoniteError({
+ statusCode: _response.error.statusCode,
+ body: _response.error.rawBody,
+ });
+ case "timeout":
+ throw new errors.MoniteTimeoutError();
+ case "unknown":
+ throw new errors.MoniteError({
+ message: _response.error.errorMessage,
+ });
+ }
+ }
+
+ /**
+ * @param {Monite.dataExports.ExtraDataCreateRequest} request
+ * @param {ExtraData.RequestOptions} requestOptions - Request-specific configuration.
+ *
+ * @throws {@link Monite.BadRequestError}
+ * @throws {@link Monite.UnauthorizedError}
+ * @throws {@link Monite.ForbiddenError}
+ * @throws {@link Monite.UnprocessableEntityError}
+ * @throws {@link Monite.InternalServerError}
+ *
+ * @example
+ * await client.dataExports.extraData.create({
+ * field_name: "default_account_code",
+ * field_value: "field_value",
+ * object_id: "object_id"
+ * })
+ */
+ public async create(
+ request: Monite.dataExports.ExtraDataCreateRequest,
+ requestOptions?: ExtraData.RequestOptions
+ ): Promise {
+ const _response = await (this._options.fetcher ?? core.fetcher)({
+ url: urlJoin(
+ (await core.Supplier.get(this._options.environment)) ?? environments.MoniteEnvironment.Sandbox,
+ "data_exports/extra_data"
+ ),
+ method: "POST",
+ headers: {
+ Authorization: await this._getAuthorizationHeader(),
+ "x-monite-version": await core.Supplier.get(this._options.moniteVersion),
+ "x-monite-entity-id":
+ (await core.Supplier.get(this._options.moniteEntityId)) != null
+ ? await core.Supplier.get(this._options.moniteEntityId)
+ : undefined,
+ "X-Fern-Language": "JavaScript",
+ "X-Fern-SDK-Name": "",
+ "X-Fern-SDK-Version": "0.1.0",
+ "X-Fern-Runtime": core.RUNTIME.type,
+ "X-Fern-Runtime-Version": core.RUNTIME.version,
+ },
+ contentType: "application/json",
+ requestType: "json",
+ body: { ...request, object_type: "counterpart" },
+ timeoutMs: requestOptions?.timeoutInSeconds != null ? requestOptions.timeoutInSeconds * 1000 : 60000,
+ maxRetries: requestOptions?.maxRetries,
+ abortSignal: requestOptions?.abortSignal,
+ });
+ if (_response.ok) {
+ return _response.body as Monite.ExtraDataResource;
+ }
+
+ if (_response.error.reason === "status-code") {
+ switch (_response.error.statusCode) {
+ case 400:
+ throw new Monite.BadRequestError(_response.error.body as Monite.ErrorSchemaResponse);
+ case 401:
+ throw new Monite.UnauthorizedError(_response.error.body as Monite.ErrorSchemaResponse);
+ case 403:
+ throw new Monite.ForbiddenError(_response.error.body as Monite.ErrorSchemaResponse);
+ case 422:
+ throw new Monite.UnprocessableEntityError(_response.error.body as Monite.HttpValidationError);
+ case 500:
+ throw new Monite.InternalServerError(_response.error.body as Monite.ErrorSchemaResponse);
+ default:
+ throw new errors.MoniteError({
+ statusCode: _response.error.statusCode,
+ body: _response.error.body,
+ });
+ }
+ }
+
+ switch (_response.error.reason) {
+ case "non-json":
+ throw new errors.MoniteError({
+ statusCode: _response.error.statusCode,
+ body: _response.error.rawBody,
+ });
+ case "timeout":
+ throw new errors.MoniteTimeoutError();
+ case "unknown":
+ throw new errors.MoniteError({
+ message: _response.error.errorMessage,
+ });
+ }
+ }
+
+ /**
+ * @param {string} extraDataId
+ * @param {ExtraData.RequestOptions} requestOptions - Request-specific configuration.
+ *
+ * @throws {@link Monite.UnauthorizedError}
+ * @throws {@link Monite.ForbiddenError}
+ * @throws {@link Monite.NotFoundError}
+ * @throws {@link Monite.UnprocessableEntityError}
+ * @throws {@link Monite.InternalServerError}
+ *
+ * @example
+ * await client.dataExports.extraData.getById("extra_data_id")
+ */
+ public async getById(
+ extraDataId: string,
+ requestOptions?: ExtraData.RequestOptions
+ ): Promise {
+ const _response = await (this._options.fetcher ?? core.fetcher)({
+ url: urlJoin(
+ (await core.Supplier.get(this._options.environment)) ?? environments.MoniteEnvironment.Sandbox,
+ `data_exports/extra_data/${encodeURIComponent(extraDataId)}`
+ ),
+ method: "GET",
+ headers: {
+ Authorization: await this._getAuthorizationHeader(),
+ "x-monite-version": await core.Supplier.get(this._options.moniteVersion),
+ "x-monite-entity-id":
+ (await core.Supplier.get(this._options.moniteEntityId)) != null
+ ? await core.Supplier.get(this._options.moniteEntityId)
+ : undefined,
+ "X-Fern-Language": "JavaScript",
+ "X-Fern-SDK-Name": "",
+ "X-Fern-SDK-Version": "0.1.0",
+ "X-Fern-Runtime": core.RUNTIME.type,
+ "X-Fern-Runtime-Version": core.RUNTIME.version,
+ },
+ contentType: "application/json",
+ requestType: "json",
+ timeoutMs: requestOptions?.timeoutInSeconds != null ? requestOptions.timeoutInSeconds * 1000 : 60000,
+ maxRetries: requestOptions?.maxRetries,
+ abortSignal: requestOptions?.abortSignal,
+ });
+ if (_response.ok) {
+ return _response.body as Monite.ExtraDataResource;
+ }
+
+ if (_response.error.reason === "status-code") {
+ switch (_response.error.statusCode) {
+ case 401:
+ throw new Monite.UnauthorizedError(_response.error.body as Monite.ErrorSchemaResponse);
+ case 403:
+ throw new Monite.ForbiddenError(_response.error.body as Monite.ErrorSchemaResponse);
+ case 404:
+ throw new Monite.NotFoundError(_response.error.body as Monite.ErrorSchemaResponse);
+ case 422:
+ throw new Monite.UnprocessableEntityError(_response.error.body as Monite.HttpValidationError);
+ case 500:
+ throw new Monite.InternalServerError(_response.error.body as Monite.ErrorSchemaResponse);
+ default:
+ throw new errors.MoniteError({
+ statusCode: _response.error.statusCode,
+ body: _response.error.body,
+ });
+ }
+ }
+
+ switch (_response.error.reason) {
+ case "non-json":
+ throw new errors.MoniteError({
+ statusCode: _response.error.statusCode,
+ body: _response.error.rawBody,
+ });
+ case "timeout":
+ throw new errors.MoniteTimeoutError();
+ case "unknown":
+ throw new errors.MoniteError({
+ message: _response.error.errorMessage,
+ });
+ }
+ }
+
+ /**
+ * @param {string} extraDataId
+ * @param {ExtraData.RequestOptions} requestOptions - Request-specific configuration.
+ *
+ * @throws {@link Monite.UnauthorizedError}
+ * @throws {@link Monite.ForbiddenError}
+ * @throws {@link Monite.NotFoundError}
+ * @throws {@link Monite.UnprocessableEntityError}
+ * @throws {@link Monite.InternalServerError}
+ *
+ * @example
+ * await client.dataExports.extraData.deleteById("extra_data_id")
+ */
+ public async deleteById(
+ extraDataId: string,
+ requestOptions?: ExtraData.RequestOptions
+ ): Promise {
+ const _response = await (this._options.fetcher ?? core.fetcher)({
+ url: urlJoin(
+ (await core.Supplier.get(this._options.environment)) ?? environments.MoniteEnvironment.Sandbox,
+ `data_exports/extra_data/${encodeURIComponent(extraDataId)}`
+ ),
+ method: "DELETE",
+ headers: {
+ Authorization: await this._getAuthorizationHeader(),
+ "x-monite-version": await core.Supplier.get(this._options.moniteVersion),
+ "x-monite-entity-id":
+ (await core.Supplier.get(this._options.moniteEntityId)) != null
+ ? await core.Supplier.get(this._options.moniteEntityId)
+ : undefined,
+ "X-Fern-Language": "JavaScript",
+ "X-Fern-SDK-Name": "",
+ "X-Fern-SDK-Version": "0.1.0",
+ "X-Fern-Runtime": core.RUNTIME.type,
+ "X-Fern-Runtime-Version": core.RUNTIME.version,
+ },
+ contentType: "application/json",
+ requestType: "json",
+ timeoutMs: requestOptions?.timeoutInSeconds != null ? requestOptions.timeoutInSeconds * 1000 : 60000,
+ maxRetries: requestOptions?.maxRetries,
+ abortSignal: requestOptions?.abortSignal,
+ });
+ if (_response.ok) {
+ return _response.body as Monite.ExtraDataResource;
+ }
+
+ if (_response.error.reason === "status-code") {
+ switch (_response.error.statusCode) {
+ case 401:
+ throw new Monite.UnauthorizedError(_response.error.body as Monite.ErrorSchemaResponse);
+ case 403:
+ throw new Monite.ForbiddenError(_response.error.body as Monite.ErrorSchemaResponse);
+ case 404:
+ throw new Monite.NotFoundError(_response.error.body as Monite.ErrorSchemaResponse);
+ case 422:
+ throw new Monite.UnprocessableEntityError(_response.error.body as Monite.HttpValidationError);
+ case 500:
+ throw new Monite.InternalServerError(_response.error.body as Monite.ErrorSchemaResponse);
+ default:
+ throw new errors.MoniteError({
+ statusCode: _response.error.statusCode,
+ body: _response.error.body,
+ });
+ }
+ }
+
+ switch (_response.error.reason) {
+ case "non-json":
+ throw new errors.MoniteError({
+ statusCode: _response.error.statusCode,
+ body: _response.error.rawBody,
+ });
+ case "timeout":
+ throw new errors.MoniteTimeoutError();
+ case "unknown":
+ throw new errors.MoniteError({
+ message: _response.error.errorMessage,
+ });
+ }
+ }
+
+ /**
+ * @param {string} extraDataId
+ * @param {Monite.dataExports.ExtraDataUpdateRequest} request
+ * @param {ExtraData.RequestOptions} requestOptions - Request-specific configuration.
+ *
+ * @throws {@link Monite.BadRequestError}
+ * @throws {@link Monite.UnauthorizedError}
+ * @throws {@link Monite.ForbiddenError}
+ * @throws {@link Monite.NotFoundError}
+ * @throws {@link Monite.UnprocessableEntityError}
+ * @throws {@link Monite.InternalServerError}
+ *
+ * @example
+ * await client.dataExports.extraData.updateById("extra_data_id")
+ */
+ public async updateById(
+ extraDataId: string,
+ request: Monite.dataExports.ExtraDataUpdateRequest = {},
+ requestOptions?: ExtraData.RequestOptions
+ ): Promise {
+ const _response = await (this._options.fetcher ?? core.fetcher)({
+ url: urlJoin(
+ (await core.Supplier.get(this._options.environment)) ?? environments.MoniteEnvironment.Sandbox,
+ `data_exports/extra_data/${encodeURIComponent(extraDataId)}`
+ ),
+ method: "PATCH",
+ headers: {
+ Authorization: await this._getAuthorizationHeader(),
+ "x-monite-version": await core.Supplier.get(this._options.moniteVersion),
+ "x-monite-entity-id":
+ (await core.Supplier.get(this._options.moniteEntityId)) != null
+ ? await core.Supplier.get(this._options.moniteEntityId)
+ : undefined,
+ "X-Fern-Language": "JavaScript",
+ "X-Fern-SDK-Name": "",
+ "X-Fern-SDK-Version": "0.1.0",
+ "X-Fern-Runtime": core.RUNTIME.type,
+ "X-Fern-Runtime-Version": core.RUNTIME.version,
+ },
+ contentType: "application/json",
+ requestType: "json",
+ body: request,
+ timeoutMs: requestOptions?.timeoutInSeconds != null ? requestOptions.timeoutInSeconds * 1000 : 60000,
+ maxRetries: requestOptions?.maxRetries,
+ abortSignal: requestOptions?.abortSignal,
+ });
+ if (_response.ok) {
+ return _response.body as Monite.ExtraDataResource;
+ }
+
+ if (_response.error.reason === "status-code") {
+ switch (_response.error.statusCode) {
+ case 400:
+ throw new Monite.BadRequestError(_response.error.body as Monite.ErrorSchemaResponse);
+ case 401:
+ throw new Monite.UnauthorizedError(_response.error.body as Monite.ErrorSchemaResponse);
+ case 403:
+ throw new Monite.ForbiddenError(_response.error.body as Monite.ErrorSchemaResponse);
+ case 404:
+ throw new Monite.NotFoundError(_response.error.body as Monite.ErrorSchemaResponse);
+ case 422:
+ throw new Monite.UnprocessableEntityError(_response.error.body as Monite.HttpValidationError);
+ case 500:
+ throw new Monite.InternalServerError(_response.error.body as Monite.ErrorSchemaResponse);
+ default:
+ throw new errors.MoniteError({
+ statusCode: _response.error.statusCode,
+ body: _response.error.body,
+ });
+ }
+ }
+
+ switch (_response.error.reason) {
+ case "non-json":
+ throw new errors.MoniteError({
+ statusCode: _response.error.statusCode,
+ body: _response.error.rawBody,
+ });
+ case "timeout":
+ throw new errors.MoniteTimeoutError();
+ case "unknown":
+ throw new errors.MoniteError({
+ message: _response.error.errorMessage,
+ });
+ }
+ }
+
+ protected async _getAuthorizationHeader(): Promise {
+ const bearer = await core.Supplier.get(this._options.token);
+ if (bearer != null) {
+ return `Bearer ${bearer}`;
+ }
+
+ return undefined;
+ }
+}
diff --git a/src/api/resources/dataExports/resources/extraData/client/index.ts b/src/api/resources/dataExports/resources/extraData/client/index.ts
new file mode 100644
index 0000000..415726b
--- /dev/null
+++ b/src/api/resources/dataExports/resources/extraData/client/index.ts
@@ -0,0 +1 @@
+export * from "./requests";
diff --git a/src/api/resources/dataExports/resources/extraData/client/requests/ExtraDataCreateRequest.ts b/src/api/resources/dataExports/resources/extraData/client/requests/ExtraDataCreateRequest.ts
new file mode 100644
index 0000000..7ced08e
--- /dev/null
+++ b/src/api/resources/dataExports/resources/extraData/client/requests/ExtraDataCreateRequest.ts
@@ -0,0 +1,19 @@
+/**
+ * This file was auto-generated by Fern from our API Definition.
+ */
+
+import * as Monite from "../../../../../../index";
+
+/**
+ * @example
+ * {
+ * field_name: "default_account_code",
+ * field_value: "field_value",
+ * object_id: "object_id"
+ * }
+ */
+export interface ExtraDataCreateRequest {
+ field_name: Monite.SupportedFieldNames;
+ field_value: string;
+ object_id: string;
+}
diff --git a/src/api/resources/dataExports/resources/extraData/client/requests/ExtraDataGetRequest.ts b/src/api/resources/dataExports/resources/extraData/client/requests/ExtraDataGetRequest.ts
new file mode 100644
index 0000000..859d50b
--- /dev/null
+++ b/src/api/resources/dataExports/resources/extraData/client/requests/ExtraDataGetRequest.ts
@@ -0,0 +1,39 @@
+/**
+ * This file was auto-generated by Fern from our API Definition.
+ */
+
+import * as Monite from "../../../../../../index";
+
+/**
+ * @example
+ * {}
+ */
+export interface ExtraDataGetRequest {
+ /**
+ * Order by
+ */
+ order?: Monite.OrderEnum;
+ /**
+ * Max is 100
+ */
+ limit?: number;
+ /**
+ * A token, obtained from previous page. Prior over other filters
+ */
+ pagination_token?: string;
+ /**
+ * Allowed sort fields
+ */
+ sort?: Monite.ExportSettingCursorFields;
+ created_at__gt?: string;
+ created_at__lt?: string;
+ created_at__gte?: string;
+ created_at__lte?: string;
+ updated_at__gt?: string;
+ updated_at__lt?: string;
+ updated_at__gte?: string;
+ updated_at__lte?: string;
+ object_id?: string;
+ field_name?: string;
+ field_value?: string;
+}
diff --git a/src/api/resources/dataExports/resources/extraData/client/requests/ExtraDataUpdateRequest.ts b/src/api/resources/dataExports/resources/extraData/client/requests/ExtraDataUpdateRequest.ts
new file mode 100644
index 0000000..8893401
--- /dev/null
+++ b/src/api/resources/dataExports/resources/extraData/client/requests/ExtraDataUpdateRequest.ts
@@ -0,0 +1,16 @@
+/**
+ * This file was auto-generated by Fern from our API Definition.
+ */
+
+import * as Monite from "../../../../../../index";
+
+/**
+ * @example
+ * {}
+ */
+export interface ExtraDataUpdateRequest {
+ field_name?: Monite.SupportedFieldNames;
+ field_value?: string;
+ object_id?: string;
+ object_type?: "counterpart";
+}
diff --git a/src/api/resources/dataExports/resources/extraData/client/requests/index.ts b/src/api/resources/dataExports/resources/extraData/client/requests/index.ts
new file mode 100644
index 0000000..e0f9cfe
--- /dev/null
+++ b/src/api/resources/dataExports/resources/extraData/client/requests/index.ts
@@ -0,0 +1,3 @@
+export { type ExtraDataGetRequest } from "./ExtraDataGetRequest";
+export { type ExtraDataCreateRequest } from "./ExtraDataCreateRequest";
+export { type ExtraDataUpdateRequest } from "./ExtraDataUpdateRequest";
diff --git a/src/api/resources/dataExports/resources/extraData/index.ts b/src/api/resources/dataExports/resources/extraData/index.ts
new file mode 100644
index 0000000..5ec7692
--- /dev/null
+++ b/src/api/resources/dataExports/resources/extraData/index.ts
@@ -0,0 +1 @@
+export * from "./client";
diff --git a/src/api/resources/dataExports/resources/index.ts b/src/api/resources/dataExports/resources/index.ts
new file mode 100644
index 0000000..075edd4
--- /dev/null
+++ b/src/api/resources/dataExports/resources/index.ts
@@ -0,0 +1,2 @@
+export * as extraData from "./extraData";
+export * from "./extraData/client/requests";
diff --git a/src/api/resources/entities/client/Client.ts b/src/api/resources/entities/client/Client.ts
new file mode 100644
index 0000000..f1717f1
--- /dev/null
+++ b/src/api/resources/entities/client/Client.ts
@@ -0,0 +1,1267 @@
+/**
+ * This file was auto-generated by Fern from our API Definition.
+ */
+
+import * as environments from "../../../../environments";
+import * as core from "../../../../core";
+import * as Monite from "../../../index";
+import urlJoin from "url-join";
+import * as errors from "../../../../errors/index";
+import * as fs from "fs";
+import { Blob } from "buffer";
+import { BankAccounts } from "../resources/bankAccounts/client/Client";
+import { OnboardingData } from "../resources/onboardingData/client/Client";
+import { PaymentMethods } from "../resources/paymentMethods/client/Client";
+import { VatIds } from "../resources/vatIds/client/Client";
+import { Persons } from "../resources/persons/client/Client";
+
+export declare namespace Entities {
+ interface Options {
+ environment?: core.Supplier;
+ token?: core.Supplier;
+ /** Override the x-monite-version header */
+ moniteVersion: core.Supplier;
+ /** Override the x-monite-entity-id header */
+ moniteEntityId?: core.Supplier;
+ fetcher?: core.FetchFunction;
+ }
+
+ interface RequestOptions {
+ /** The maximum time to wait for a response in seconds. */
+ timeoutInSeconds?: number;
+ /** The number of times to retry the request. Defaults to 2. */
+ maxRetries?: number;
+ /** A hook to abort the request. */
+ abortSignal?: AbortSignal;
+ /** Override the x-monite-version header */
+ moniteVersion?: string;
+ /** Override the x-monite-entity-id header */
+ moniteEntityId?: string | undefined;
+ }
+}
+
+export class Entities {
+ constructor(protected readonly _options: Entities.Options) {}
+
+ /**
+ * Retrieve a list of all entities.
+ *
+ * @param {Monite.EntitiesGetRequest} request
+ * @param {Entities.RequestOptions} requestOptions - Request-specific configuration.
+ *
+ * @throws {@link Monite.BadRequestError}
+ * @throws {@link Monite.UnauthorizedError}
+ * @throws {@link Monite.ForbiddenError}
+ * @throws {@link Monite.NotAcceptableError}
+ * @throws {@link Monite.UnprocessableEntityError}
+ * @throws {@link Monite.InternalServerError}
+ *
+ * @example
+ * await client.entities.get()
+ */
+ public async get(
+ request: Monite.EntitiesGetRequest = {},
+ requestOptions?: Entities.RequestOptions
+ ): Promise {
+ const {
+ order,
+ limit,
+ pagination_token: paginationToken,
+ sort,
+ type: type_,
+ created_at__gt: createdAtGt,
+ created_at__lt: createdAtLt,
+ created_at__gte: createdAtGte,
+ created_at__lte: createdAtLte,
+ id__in: idIn,
+ id__not_in: idNotIn,
+ email,
+ email__in: emailIn,
+ email__not_in: emailNotIn,
+ } = request;
+ const _queryParams: Record = {};
+ if (order != null) {
+ _queryParams["order"] = order;
+ }
+
+ if (limit != null) {
+ _queryParams["limit"] = limit.toString();
+ }
+
+ if (paginationToken != null) {
+ _queryParams["pagination_token"] = paginationToken;
+ }
+
+ if (sort != null) {
+ _queryParams["sort"] = sort;
+ }
+
+ if (type_ != null) {
+ _queryParams["type"] = type_;
+ }
+
+ if (createdAtGt != null) {
+ _queryParams["created_at__gt"] = createdAtGt;
+ }
+
+ if (createdAtLt != null) {
+ _queryParams["created_at__lt"] = createdAtLt;
+ }
+
+ if (createdAtGte != null) {
+ _queryParams["created_at__gte"] = createdAtGte;
+ }
+
+ if (createdAtLte != null) {
+ _queryParams["created_at__lte"] = createdAtLte;
+ }
+
+ if (idIn != null) {
+ if (Array.isArray(idIn)) {
+ _queryParams["id__in"] = idIn.map((item) => item);
+ } else {
+ _queryParams["id__in"] = idIn;
+ }
+ }
+
+ if (idNotIn != null) {
+ if (Array.isArray(idNotIn)) {
+ _queryParams["id__not_in"] = idNotIn.map((item) => item);
+ } else {
+ _queryParams["id__not_in"] = idNotIn;
+ }
+ }
+
+ if (email != null) {
+ _queryParams["email"] = email;
+ }
+
+ if (emailIn != null) {
+ if (Array.isArray(emailIn)) {
+ _queryParams["email__in"] = emailIn.map((item) => item);
+ } else {
+ _queryParams["email__in"] = emailIn;
+ }
+ }
+
+ if (emailNotIn != null) {
+ if (Array.isArray(emailNotIn)) {
+ _queryParams["email__not_in"] = emailNotIn.map((item) => item);
+ } else {
+ _queryParams["email__not_in"] = emailNotIn;
+ }
+ }
+
+ const _response = await (this._options.fetcher ?? core.fetcher)({
+ url: urlJoin(
+ (await core.Supplier.get(this._options.environment)) ?? environments.MoniteEnvironment.Sandbox,
+ "entities"
+ ),
+ method: "GET",
+ headers: {
+ Authorization: await this._getAuthorizationHeader(),
+ "x-monite-version": await core.Supplier.get(this._options.moniteVersion),
+ "x-monite-entity-id":
+ (await core.Supplier.get(this._options.moniteEntityId)) != null
+ ? await core.Supplier.get(this._options.moniteEntityId)
+ : undefined,
+ "X-Fern-Language": "JavaScript",
+ "X-Fern-SDK-Name": "",
+ "X-Fern-SDK-Version": "0.1.0",
+ "X-Fern-Runtime": core.RUNTIME.type,
+ "X-Fern-Runtime-Version": core.RUNTIME.version,
+ },
+ contentType: "application/json",
+ queryParameters: _queryParams,
+ requestType: "json",
+ timeoutMs: requestOptions?.timeoutInSeconds != null ? requestOptions.timeoutInSeconds * 1000 : 60000,
+ maxRetries: requestOptions?.maxRetries,
+ abortSignal: requestOptions?.abortSignal,
+ });
+ if (_response.ok) {
+ return _response.body as Monite.EntityPaginationResponse;
+ }
+
+ if (_response.error.reason === "status-code") {
+ switch (_response.error.statusCode) {
+ case 400:
+ throw new Monite.BadRequestError(_response.error.body as Monite.ErrorSchemaResponse);
+ case 401:
+ throw new Monite.UnauthorizedError(_response.error.body as Monite.ErrorSchemaResponse);
+ case 403:
+ throw new Monite.ForbiddenError(_response.error.body as Monite.ErrorSchemaResponse);
+ case 406:
+ throw new Monite.NotAcceptableError(_response.error.body as Monite.ErrorSchemaResponse);
+ case 422:
+ throw new Monite.UnprocessableEntityError(_response.error.body as Monite.HttpValidationError);
+ case 500:
+ throw new Monite.InternalServerError(_response.error.body as Monite.ErrorSchemaResponse);
+ default:
+ throw new errors.MoniteError({
+ statusCode: _response.error.statusCode,
+ body: _response.error.body,
+ });
+ }
+ }
+
+ switch (_response.error.reason) {
+ case "non-json":
+ throw new errors.MoniteError({
+ statusCode: _response.error.statusCode,
+ body: _response.error.rawBody,
+ });
+ case "timeout":
+ throw new errors.MoniteTimeoutError();
+ case "unknown":
+ throw new errors.MoniteError({
+ message: _response.error.errorMessage,
+ });
+ }
+ }
+
+ /**
+ * Create a new entity from the specified values.
+ *
+ * @param {Monite.CreateEntityRequest} request
+ * @param {Entities.RequestOptions} requestOptions - Request-specific configuration.
+ *
+ * @throws {@link Monite.BadRequestError}
+ * @throws {@link Monite.UnprocessableEntityError}
+ * @throws {@link Monite.InternalServerError}
+ *
+ * @example
+ * await client.entities.create({
+ * address: {
+ * city: "city",
+ * country: "AF",
+ * line1: "line1",
+ * postal_code: "postal_code"
+ * },
+ * email: "email",
+ * type: "individual"
+ * })
+ */
+ public async create(
+ request: Monite.CreateEntityRequest,
+ requestOptions?: Entities.RequestOptions
+ ): Promise {
+ const _response = await (this._options.fetcher ?? core.fetcher)({
+ url: urlJoin(
+ (await core.Supplier.get(this._options.environment)) ?? environments.MoniteEnvironment.Sandbox,
+ "entities"
+ ),
+ method: "POST",
+ headers: {
+ Authorization: await this._getAuthorizationHeader(),
+ "x-monite-version": await core.Supplier.get(this._options.moniteVersion),
+ "x-monite-entity-id":
+ (await core.Supplier.get(this._options.moniteEntityId)) != null
+ ? await core.Supplier.get(this._options.moniteEntityId)
+ : undefined,
+ "X-Fern-Language": "JavaScript",
+ "X-Fern-SDK-Name": "",
+ "X-Fern-SDK-Version": "0.1.0",
+ "X-Fern-Runtime": core.RUNTIME.type,
+ "X-Fern-Runtime-Version": core.RUNTIME.version,
+ },
+ contentType: "application/json",
+ requestType: "json",
+ body: request,
+ timeoutMs: requestOptions?.timeoutInSeconds != null ? requestOptions.timeoutInSeconds * 1000 : 60000,
+ maxRetries: requestOptions?.maxRetries,
+ abortSignal: requestOptions?.abortSignal,
+ });
+ if (_response.ok) {
+ return _response.body as Monite.EntityResponse;
+ }
+
+ if (_response.error.reason === "status-code") {
+ switch (_response.error.statusCode) {
+ case 400:
+ throw new Monite.BadRequestError(_response.error.body as Monite.ErrorSchemaResponse);
+ case 422:
+ throw new Monite.UnprocessableEntityError(_response.error.body as Monite.HttpValidationError);
+ case 500:
+ throw new Monite.InternalServerError(_response.error.body as Monite.ErrorSchemaResponse);
+ default:
+ throw new errors.MoniteError({
+ statusCode: _response.error.statusCode,
+ body: _response.error.body,
+ });
+ }
+ }
+
+ switch (_response.error.reason) {
+ case "non-json":
+ throw new errors.MoniteError({
+ statusCode: _response.error.statusCode,
+ body: _response.error.rawBody,
+ });
+ case "timeout":
+ throw new errors.MoniteTimeoutError();
+ case "unknown":
+ throw new errors.MoniteError({
+ message: _response.error.errorMessage,
+ });
+ }
+ }
+
+ /**
+ * Deprecated. Use `GET /entity_users/my_entity` instead.
+ *
+ * @param {Entities.RequestOptions} requestOptions - Request-specific configuration.
+ *
+ * @throws {@link Monite.BadRequestError}
+ * @throws {@link Monite.UnprocessableEntityError}
+ * @throws {@link Monite.InternalServerError}
+ *
+ * @example
+ * await client.entities.getEntitiesMe()
+ */
+ public async getEntitiesMe(requestOptions?: Entities.RequestOptions): Promise {
+ const _response = await (this._options.fetcher ?? core.fetcher)({
+ url: urlJoin(
+ (await core.Supplier.get(this._options.environment)) ?? environments.MoniteEnvironment.Sandbox,
+ "entities/me"
+ ),
+ method: "GET",
+ headers: {
+ Authorization: await this._getAuthorizationHeader(),
+ "x-monite-version": await core.Supplier.get(this._options.moniteVersion),
+ "x-monite-entity-id":
+ (await core.Supplier.get(this._options.moniteEntityId)) != null
+ ? await core.Supplier.get(this._options.moniteEntityId)
+ : undefined,
+ "X-Fern-Language": "JavaScript",
+ "X-Fern-SDK-Name": "",
+ "X-Fern-SDK-Version": "0.1.0",
+ "X-Fern-Runtime": core.RUNTIME.type,
+ "X-Fern-Runtime-Version": core.RUNTIME.version,
+ },
+ contentType: "application/json",
+ requestType: "json",
+ timeoutMs: requestOptions?.timeoutInSeconds != null ? requestOptions.timeoutInSeconds * 1000 : 60000,
+ maxRetries: requestOptions?.maxRetries,
+ abortSignal: requestOptions?.abortSignal,
+ });
+ if (_response.ok) {
+ return _response.body as Monite.EntityResponse;
+ }
+
+ if (_response.error.reason === "status-code") {
+ switch (_response.error.statusCode) {
+ case 400:
+ throw new Monite.BadRequestError(_response.error.body as Monite.ErrorSchemaResponse);
+ case 422:
+ throw new Monite.UnprocessableEntityError(_response.error.body as Monite.HttpValidationError);
+ case 500:
+ throw new Monite.InternalServerError(_response.error.body as Monite.ErrorSchemaResponse);
+ default:
+ throw new errors.MoniteError({
+ statusCode: _response.error.statusCode,
+ body: _response.error.body,
+ });
+ }
+ }
+
+ switch (_response.error.reason) {
+ case "non-json":
+ throw new errors.MoniteError({
+ statusCode: _response.error.statusCode,
+ body: _response.error.rawBody,
+ });
+ case "timeout":
+ throw new errors.MoniteTimeoutError();
+ case "unknown":
+ throw new errors.MoniteError({
+ message: _response.error.errorMessage,
+ });
+ }
+ }
+
+ /**
+ * Deprecated. Use `PATCH /entity_users/my_entity` instead.
+ *
+ * @param {Monite.UpdateEntityRequest} request
+ * @param {Entities.RequestOptions} requestOptions - Request-specific configuration.
+ *
+ * @throws {@link Monite.BadRequestError}
+ * @throws {@link Monite.UnprocessableEntityError}
+ * @throws {@link Monite.InternalServerError}
+ *
+ * @example
+ * await client.entities.patchEntitiesMe({})
+ */
+ public async patchEntitiesMe(
+ request: Monite.UpdateEntityRequest,
+ requestOptions?: Entities.RequestOptions
+ ): Promise {
+ const _response = await (this._options.fetcher ?? core.fetcher)({
+ url: urlJoin(
+ (await core.Supplier.get(this._options.environment)) ?? environments.MoniteEnvironment.Sandbox,
+ "entities/me"
+ ),
+ method: "PATCH",
+ headers: {
+ Authorization: await this._getAuthorizationHeader(),
+ "x-monite-version": await core.Supplier.get(this._options.moniteVersion),
+ "x-monite-entity-id":
+ (await core.Supplier.get(this._options.moniteEntityId)) != null
+ ? await core.Supplier.get(this._options.moniteEntityId)
+ : undefined,
+ "X-Fern-Language": "JavaScript",
+ "X-Fern-SDK-Name": "",
+ "X-Fern-SDK-Version": "0.1.0",
+ "X-Fern-Runtime": core.RUNTIME.type,
+ "X-Fern-Runtime-Version": core.RUNTIME.version,
+ },
+ contentType: "application/json",
+ requestType: "json",
+ body: request,
+ timeoutMs: requestOptions?.timeoutInSeconds != null ? requestOptions.timeoutInSeconds * 1000 : 60000,
+ maxRetries: requestOptions?.maxRetries,
+ abortSignal: requestOptions?.abortSignal,
+ });
+ if (_response.ok) {
+ return _response.body as Monite.EntityResponse;
+ }
+
+ if (_response.error.reason === "status-code") {
+ switch (_response.error.statusCode) {
+ case 400:
+ throw new Monite.BadRequestError(_response.error.body as Monite.ErrorSchemaResponse);
+ case 422:
+ throw new Monite.UnprocessableEntityError(_response.error.body as Monite.HttpValidationError);
+ case 500:
+ throw new Monite.InternalServerError(_response.error.body as Monite.ErrorSchemaResponse);
+ default:
+ throw new errors.MoniteError({
+ statusCode: _response.error.statusCode,
+ body: _response.error.body,
+ });
+ }
+ }
+
+ switch (_response.error.reason) {
+ case "non-json":
+ throw new errors.MoniteError({
+ statusCode: _response.error.statusCode,
+ body: _response.error.rawBody,
+ });
+ case "timeout":
+ throw new errors.MoniteTimeoutError();
+ case "unknown":
+ throw new errors.MoniteError({
+ message: _response.error.errorMessage,
+ });
+ }
+ }
+
+ /**
+ * Retrieve an entity by its ID.
+ *
+ * @param {string} entityId - A unique ID to specify the entity.
+ * @param {Entities.RequestOptions} requestOptions - Request-specific configuration.
+ *
+ * @throws {@link Monite.BadRequestError}
+ * @throws {@link Monite.UnprocessableEntityError}
+ * @throws {@link Monite.InternalServerError}
+ *
+ * @example
+ * await client.entities.getById("ea837e28-509b-4b6a-a600-d54b6aa0b1f5")
+ */
+ public async getById(entityId: string, requestOptions?: Entities.RequestOptions): Promise {
+ const _response = await (this._options.fetcher ?? core.fetcher)({
+ url: urlJoin(
+ (await core.Supplier.get(this._options.environment)) ?? environments.MoniteEnvironment.Sandbox,
+ `entities/${encodeURIComponent(entityId)}`
+ ),
+ method: "GET",
+ headers: {
+ Authorization: await this._getAuthorizationHeader(),
+ "x-monite-version": await core.Supplier.get(this._options.moniteVersion),
+ "x-monite-entity-id":
+ (await core.Supplier.get(this._options.moniteEntityId)) != null
+ ? await core.Supplier.get(this._options.moniteEntityId)
+ : undefined,
+ "X-Fern-Language": "JavaScript",
+ "X-Fern-SDK-Name": "",
+ "X-Fern-SDK-Version": "0.1.0",
+ "X-Fern-Runtime": core.RUNTIME.type,
+ "X-Fern-Runtime-Version": core.RUNTIME.version,
+ },
+ contentType: "application/json",
+ requestType: "json",
+ timeoutMs: requestOptions?.timeoutInSeconds != null ? requestOptions.timeoutInSeconds * 1000 : 60000,
+ maxRetries: requestOptions?.maxRetries,
+ abortSignal: requestOptions?.abortSignal,
+ });
+ if (_response.ok) {
+ return _response.body as Monite.EntityResponse;
+ }
+
+ if (_response.error.reason === "status-code") {
+ switch (_response.error.statusCode) {
+ case 400:
+ throw new Monite.BadRequestError(_response.error.body as Monite.ErrorSchemaResponse);
+ case 422:
+ throw new Monite.UnprocessableEntityError(_response.error.body as Monite.HttpValidationError);
+ case 500:
+ throw new Monite.InternalServerError(_response.error.body as Monite.ErrorSchemaResponse);
+ default:
+ throw new errors.MoniteError({
+ statusCode: _response.error.statusCode,
+ body: _response.error.body,
+ });
+ }
+ }
+
+ switch (_response.error.reason) {
+ case "non-json":
+ throw new errors.MoniteError({
+ statusCode: _response.error.statusCode,
+ body: _response.error.rawBody,
+ });
+ case "timeout":
+ throw new errors.MoniteTimeoutError();
+ case "unknown":
+ throw new errors.MoniteError({
+ message: _response.error.errorMessage,
+ });
+ }
+ }
+
+ /**
+ * Change the specified fields with the provided values.
+ *
+ * @param {string} entityId - A unique ID to specify the entity.
+ * @param {Monite.UpdateEntityRequest} request
+ * @param {Entities.RequestOptions} requestOptions - Request-specific configuration.
+ *
+ * @throws {@link Monite.BadRequestError}
+ * @throws {@link Monite.UnprocessableEntityError}
+ * @throws {@link Monite.InternalServerError}
+ *
+ * @example
+ * await client.entities.updateById("ea837e28-509b-4b6a-a600-d54b6aa0b1f5", {})
+ */
+ public async updateById(
+ entityId: string,
+ request: Monite.UpdateEntityRequest,
+ requestOptions?: Entities.RequestOptions
+ ): Promise {
+ const _response = await (this._options.fetcher ?? core.fetcher)({
+ url: urlJoin(
+ (await core.Supplier.get(this._options.environment)) ?? environments.MoniteEnvironment.Sandbox,
+ `entities/${encodeURIComponent(entityId)}`
+ ),
+ method: "PATCH",
+ headers: {
+ Authorization: await this._getAuthorizationHeader(),
+ "x-monite-version": await core.Supplier.get(this._options.moniteVersion),
+ "x-monite-entity-id":
+ (await core.Supplier.get(this._options.moniteEntityId)) != null
+ ? await core.Supplier.get(this._options.moniteEntityId)
+ : undefined,
+ "X-Fern-Language": "JavaScript",
+ "X-Fern-SDK-Name": "",
+ "X-Fern-SDK-Version": "0.1.0",
+ "X-Fern-Runtime": core.RUNTIME.type,
+ "X-Fern-Runtime-Version": core.RUNTIME.version,
+ },
+ contentType: "application/json",
+ requestType: "json",
+ body: request,
+ timeoutMs: requestOptions?.timeoutInSeconds != null ? requestOptions.timeoutInSeconds * 1000 : 60000,
+ maxRetries: requestOptions?.maxRetries,
+ abortSignal: requestOptions?.abortSignal,
+ });
+ if (_response.ok) {
+ return _response.body as Monite.EntityResponse;
+ }
+
+ if (_response.error.reason === "status-code") {
+ switch (_response.error.statusCode) {
+ case 400:
+ throw new Monite.BadRequestError(_response.error.body as Monite.ErrorSchemaResponse);
+ case 422:
+ throw new Monite.UnprocessableEntityError(_response.error.body as Monite.HttpValidationError);
+ case 500:
+ throw new Monite.InternalServerError(_response.error.body as Monite.ErrorSchemaResponse);
+ default:
+ throw new errors.MoniteError({
+ statusCode: _response.error.statusCode,
+ body: _response.error.body,
+ });
+ }
+ }
+
+ switch (_response.error.reason) {
+ case "non-json":
+ throw new errors.MoniteError({
+ statusCode: _response.error.statusCode,
+ body: _response.error.rawBody,
+ });
+ case "timeout":
+ throw new errors.MoniteTimeoutError();
+ case "unknown":
+ throw new errors.MoniteError({
+ message: _response.error.errorMessage,
+ });
+ }
+ }
+
+ /**
+ * Entity logo can be PNG, JPG, or GIF, up to 10 MB in size. The logo is used, for example, in PDF documents created by this entity.
+ *
+ * @param {File | fs.ReadStream | Blob} file
+ * @param {string} entityId
+ * @param {Entities.RequestOptions} requestOptions - Request-specific configuration.
+ *
+ * @throws {@link Monite.BadRequestError}
+ * @throws {@link Monite.UnprocessableEntityError}
+ * @throws {@link Monite.InternalServerError}
+ *
+ * @example
+ * await client.entities.uploadLogoById(fs.createReadStream("/path/to/your/file"), "ea837e28-509b-4b6a-a600-d54b6aa0b1f5")
+ */
+ public async uploadLogoById(
+ file: File | fs.ReadStream | Blob,
+ entityId: string,
+ requestOptions?: Entities.RequestOptions
+ ): Promise {
+ const _request = await core.newFormData();
+ await _request.appendFile("file", file);
+ const _maybeEncodedRequest = await _request.getRequest();
+ const _response = await (this._options.fetcher ?? core.fetcher)({
+ url: urlJoin(
+ (await core.Supplier.get(this._options.environment)) ?? environments.MoniteEnvironment.Sandbox,
+ `entities/${encodeURIComponent(entityId)}/logo`
+ ),
+ method: "PUT",
+ headers: {
+ Authorization: await this._getAuthorizationHeader(),
+ "x-monite-version": await core.Supplier.get(this._options.moniteVersion),
+ "x-monite-entity-id":
+ (await core.Supplier.get(this._options.moniteEntityId)) != null
+ ? await core.Supplier.get(this._options.moniteEntityId)
+ : undefined,
+ "X-Fern-Language": "JavaScript",
+ "X-Fern-SDK-Name": "",
+ "X-Fern-SDK-Version": "0.1.0",
+ "X-Fern-Runtime": core.RUNTIME.type,
+ "X-Fern-Runtime-Version": core.RUNTIME.version,
+ ..._maybeEncodedRequest.headers,
+ },
+ requestType: "file",
+ duplex: _maybeEncodedRequest.duplex,
+ body: _maybeEncodedRequest.body,
+ timeoutMs: requestOptions?.timeoutInSeconds != null ? requestOptions.timeoutInSeconds * 1000 : 60000,
+ maxRetries: requestOptions?.maxRetries,
+ abortSignal: requestOptions?.abortSignal,
+ });
+ if (_response.ok) {
+ return _response.body as Monite.FileSchema3;
+ }
+
+ if (_response.error.reason === "status-code") {
+ switch (_response.error.statusCode) {
+ case 400:
+ throw new Monite.BadRequestError(_response.error.body as Monite.ErrorSchemaResponse);
+ case 422:
+ throw new Monite.UnprocessableEntityError(_response.error.body as Monite.HttpValidationError);
+ case 500:
+ throw new Monite.InternalServerError(_response.error.body as Monite.ErrorSchemaResponse);
+ default:
+ throw new errors.MoniteError({
+ statusCode: _response.error.statusCode,
+ body: _response.error.body,
+ });
+ }
+ }
+
+ switch (_response.error.reason) {
+ case "non-json":
+ throw new errors.MoniteError({
+ statusCode: _response.error.statusCode,
+ body: _response.error.rawBody,
+ });
+ case "timeout":
+ throw new errors.MoniteTimeoutError();
+ case "unknown":
+ throw new errors.MoniteError({
+ message: _response.error.errorMessage,
+ });
+ }
+ }
+
+ /**
+ * @param {string} entityId - A unique ID to specify the entity.
+ * @param {Entities.RequestOptions} requestOptions - Request-specific configuration.
+ *
+ * @throws {@link Monite.NotFoundError}
+ * @throws {@link Monite.UnprocessableEntityError}
+ * @throws {@link Monite.InternalServerError}
+ *
+ * @example
+ * await client.entities.deleteLogoById("ea837e28-509b-4b6a-a600-d54b6aa0b1f5")
+ */
+ public async deleteLogoById(entityId: string, requestOptions?: Entities.RequestOptions): Promise {
+ const _response = await (this._options.fetcher ?? core.fetcher)({
+ url: urlJoin(
+ (await core.Supplier.get(this._options.environment)) ?? environments.MoniteEnvironment.Sandbox,
+ `entities/${encodeURIComponent(entityId)}/logo`
+ ),
+ method: "DELETE",
+ headers: {
+ Authorization: await this._getAuthorizationHeader(),
+ "x-monite-version": await core.Supplier.get(this._options.moniteVersion),
+ "x-monite-entity-id":
+ (await core.Supplier.get(this._options.moniteEntityId)) != null
+ ? await core.Supplier.get(this._options.moniteEntityId)
+ : undefined,
+ "X-Fern-Language": "JavaScript",
+ "X-Fern-SDK-Name": "",
+ "X-Fern-SDK-Version": "0.1.0",
+ "X-Fern-Runtime": core.RUNTIME.type,
+ "X-Fern-Runtime-Version": core.RUNTIME.version,
+ },
+ contentType: "application/json",
+ requestType: "json",
+ timeoutMs: requestOptions?.timeoutInSeconds != null ? requestOptions.timeoutInSeconds * 1000 : 60000,
+ maxRetries: requestOptions?.maxRetries,
+ abortSignal: requestOptions?.abortSignal,
+ });
+ if (_response.ok) {
+ return;
+ }
+
+ if (_response.error.reason === "status-code") {
+ switch (_response.error.statusCode) {
+ case 404:
+ throw new Monite.NotFoundError(_response.error.body as Monite.ErrorSchemaResponse);
+ case 422:
+ throw new Monite.UnprocessableEntityError(_response.error.body as Monite.HttpValidationError);
+ case 500:
+ throw new Monite.InternalServerError(_response.error.body as Monite.ErrorSchemaResponse);
+ default:
+ throw new errors.MoniteError({
+ statusCode: _response.error.statusCode,
+ body: _response.error.body,
+ });
+ }
+ }
+
+ switch (_response.error.reason) {
+ case "non-json":
+ throw new errors.MoniteError({
+ statusCode: _response.error.statusCode,
+ body: _response.error.rawBody,
+ });
+ case "timeout":
+ throw new errors.MoniteTimeoutError();
+ case "unknown":
+ throw new errors.MoniteError({
+ message: _response.error.errorMessage,
+ });
+ }
+ }
+
+ /**
+ * Retrieve a metadata object associated with this entity, usually in a JSON format.
+ *
+ * @param {string} entityId
+ * @param {Entities.RequestOptions} requestOptions - Request-specific configuration.
+ *
+ * @throws {@link Monite.UnprocessableEntityError}
+ * @throws {@link Monite.InternalServerError}
+ *
+ * @example
+ * await client.entities.getPartnerMetadataById("entity_id")
+ */
+ public async getPartnerMetadataById(
+ entityId: string,
+ requestOptions?: Entities.RequestOptions
+ ): Promise {
+ const _response = await (this._options.fetcher ?? core.fetcher)({
+ url: urlJoin(
+ (await core.Supplier.get(this._options.environment)) ?? environments.MoniteEnvironment.Sandbox,
+ `entities/${encodeURIComponent(entityId)}/partner_metadata`
+ ),
+ method: "GET",
+ headers: {
+ Authorization: await this._getAuthorizationHeader(),
+ "x-monite-version": await core.Supplier.get(this._options.moniteVersion),
+ "x-monite-entity-id":
+ (await core.Supplier.get(this._options.moniteEntityId)) != null
+ ? await core.Supplier.get(this._options.moniteEntityId)
+ : undefined,
+ "X-Fern-Language": "JavaScript",
+ "X-Fern-SDK-Name": "",
+ "X-Fern-SDK-Version": "0.1.0",
+ "X-Fern-Runtime": core.RUNTIME.type,
+ "X-Fern-Runtime-Version": core.RUNTIME.version,
+ },
+ contentType: "application/json",
+ requestType: "json",
+ timeoutMs: requestOptions?.timeoutInSeconds != null ? requestOptions.timeoutInSeconds * 1000 : 60000,
+ maxRetries: requestOptions?.maxRetries,
+ abortSignal: requestOptions?.abortSignal,
+ });
+ if (_response.ok) {
+ return _response.body as Monite.PartnerMetadataResponse;
+ }
+
+ if (_response.error.reason === "status-code") {
+ switch (_response.error.statusCode) {
+ case 422:
+ throw new Monite.UnprocessableEntityError(_response.error.body as Monite.HttpValidationError);
+ case 500:
+ throw new Monite.InternalServerError(_response.error.body as Monite.ErrorSchemaResponse);
+ default:
+ throw new errors.MoniteError({
+ statusCode: _response.error.statusCode,
+ body: _response.error.body,
+ });
+ }
+ }
+
+ switch (_response.error.reason) {
+ case "non-json":
+ throw new errors.MoniteError({
+ statusCode: _response.error.statusCode,
+ body: _response.error.rawBody,
+ });
+ case "timeout":
+ throw new errors.MoniteTimeoutError();
+ case "unknown":
+ throw new errors.MoniteError({
+ message: _response.error.errorMessage,
+ });
+ }
+ }
+
+ /**
+ * Fully replace the current metadata object with the specified instance.
+ *
+ * @param {string} entityId
+ * @param {Monite.PartnerMetadata} request
+ * @param {Entities.RequestOptions} requestOptions - Request-specific configuration.
+ *
+ * @throws {@link Monite.UnprocessableEntityError}
+ * @throws {@link Monite.InternalServerError}
+ *
+ * @example
+ * await client.entities.updatePartnerMetadataById("entity_id", {
+ * metadata: {
+ * "key": "value"
+ * }
+ * })
+ */
+ public async updatePartnerMetadataById(
+ entityId: string,
+ request: Monite.PartnerMetadata,
+ requestOptions?: Entities.RequestOptions
+ ): Promise {
+ const _response = await (this._options.fetcher ?? core.fetcher)({
+ url: urlJoin(
+ (await core.Supplier.get(this._options.environment)) ?? environments.MoniteEnvironment.Sandbox,
+ `entities/${encodeURIComponent(entityId)}/partner_metadata`
+ ),
+ method: "PUT",
+ headers: {
+ Authorization: await this._getAuthorizationHeader(),
+ "x-monite-version": await core.Supplier.get(this._options.moniteVersion),
+ "x-monite-entity-id":
+ (await core.Supplier.get(this._options.moniteEntityId)) != null
+ ? await core.Supplier.get(this._options.moniteEntityId)
+ : undefined,
+ "X-Fern-Language": "JavaScript",
+ "X-Fern-SDK-Name": "",
+ "X-Fern-SDK-Version": "0.1.0",
+ "X-Fern-Runtime": core.RUNTIME.type,
+ "X-Fern-Runtime-Version": core.RUNTIME.version,
+ },
+ contentType: "application/json",
+ requestType: "json",
+ body: request,
+ timeoutMs: requestOptions?.timeoutInSeconds != null ? requestOptions.timeoutInSeconds * 1000 : 60000,
+ maxRetries: requestOptions?.maxRetries,
+ abortSignal: requestOptions?.abortSignal,
+ });
+ if (_response.ok) {
+ return _response.body as Monite.PartnerMetadataResponse;
+ }
+
+ if (_response.error.reason === "status-code") {
+ switch (_response.error.statusCode) {
+ case 422:
+ throw new Monite.UnprocessableEntityError(_response.error.body as Monite.HttpValidationError);
+ case 500:
+ throw new Monite.InternalServerError(_response.error.body as Monite.ErrorSchemaResponse);
+ default:
+ throw new errors.MoniteError({
+ statusCode: _response.error.statusCode,
+ body: _response.error.body,
+ });
+ }
+ }
+
+ switch (_response.error.reason) {
+ case "non-json":
+ throw new errors.MoniteError({
+ statusCode: _response.error.statusCode,
+ body: _response.error.rawBody,
+ });
+ case "timeout":
+ throw new errors.MoniteTimeoutError();
+ case "unknown":
+ throw new errors.MoniteError({
+ message: _response.error.errorMessage,
+ });
+ }
+ }
+
+ /**
+ * Retrieve all settings for this entity.
+ *
+ * @param {string} entityId - A unique ID to specify the entity.
+ * @param {Entities.RequestOptions} requestOptions - Request-specific configuration.
+ *
+ * @throws {@link Monite.BadRequestError}
+ * @throws {@link Monite.UnprocessableEntityError}
+ * @throws {@link Monite.InternalServerError}
+ *
+ * @example
+ * await client.entities.getSettingsById("ea837e28-509b-4b6a-a600-d54b6aa0b1f5")
+ */
+ public async getSettingsById(
+ entityId: string,
+ requestOptions?: Entities.RequestOptions
+ ): Promise {
+ const _response = await (this._options.fetcher ?? core.fetcher)({
+ url: urlJoin(
+ (await core.Supplier.get(this._options.environment)) ?? environments.MoniteEnvironment.Sandbox,
+ `entities/${encodeURIComponent(entityId)}/settings`
+ ),
+ method: "GET",
+ headers: {
+ Authorization: await this._getAuthorizationHeader(),
+ "x-monite-version": await core.Supplier.get(this._options.moniteVersion),
+ "x-monite-entity-id":
+ (await core.Supplier.get(this._options.moniteEntityId)) != null
+ ? await core.Supplier.get(this._options.moniteEntityId)
+ : undefined,
+ "X-Fern-Language": "JavaScript",
+ "X-Fern-SDK-Name": "",
+ "X-Fern-SDK-Version": "0.1.0",
+ "X-Fern-Runtime": core.RUNTIME.type,
+ "X-Fern-Runtime-Version": core.RUNTIME.version,
+ },
+ contentType: "application/json",
+ requestType: "json",
+ timeoutMs: requestOptions?.timeoutInSeconds != null ? requestOptions.timeoutInSeconds * 1000 : 60000,
+ maxRetries: requestOptions?.maxRetries,
+ abortSignal: requestOptions?.abortSignal,
+ });
+ if (_response.ok) {
+ return _response.body as Monite.MergedSettingsResponse;
+ }
+
+ if (_response.error.reason === "status-code") {
+ switch (_response.error.statusCode) {
+ case 400:
+ throw new Monite.BadRequestError(_response.error.body as Monite.ErrorSchemaResponse);
+ case 422:
+ throw new Monite.UnprocessableEntityError(_response.error.body as Monite.HttpValidationError);
+ case 500:
+ throw new Monite.InternalServerError(_response.error.body as Monite.ErrorSchemaResponse);
+ default:
+ throw new errors.MoniteError({
+ statusCode: _response.error.statusCode,
+ body: _response.error.body,
+ });
+ }
+ }
+
+ switch (_response.error.reason) {
+ case "non-json":
+ throw new errors.MoniteError({
+ statusCode: _response.error.statusCode,
+ body: _response.error.rawBody,
+ });
+ case "timeout":
+ throw new errors.MoniteTimeoutError();
+ case "unknown":
+ throw new errors.MoniteError({
+ message: _response.error.errorMessage,
+ });
+ }
+ }
+
+ /**
+ * Change the specified fields with the provided values.
+ *
+ * @param {string} entityId - A unique ID to specify the entity.
+ * @param {Monite.PatchSettingsPayload} request
+ * @param {Entities.RequestOptions} requestOptions - Request-specific configuration.
+ *
+ * @throws {@link Monite.BadRequestError}
+ * @throws {@link Monite.UnprocessableEntityError}
+ * @throws {@link Monite.InternalServerError}
+ *
+ * @example
+ * await client.entities.updateSettingsById("ea837e28-509b-4b6a-a600-d54b6aa0b1f5")
+ */
+ public async updateSettingsById(
+ entityId: string,
+ request: Monite.PatchSettingsPayload = {},
+ requestOptions?: Entities.RequestOptions
+ ): Promise {
+ const _response = await (this._options.fetcher ?? core.fetcher)({
+ url: urlJoin(
+ (await core.Supplier.get(this._options.environment)) ?? environments.MoniteEnvironment.Sandbox,
+ `entities/${encodeURIComponent(entityId)}/settings`
+ ),
+ method: "PATCH",
+ headers: {
+ Authorization: await this._getAuthorizationHeader(),
+ "x-monite-version": await core.Supplier.get(this._options.moniteVersion),
+ "x-monite-entity-id":
+ (await core.Supplier.get(this._options.moniteEntityId)) != null
+ ? await core.Supplier.get(this._options.moniteEntityId)
+ : undefined,
+ "X-Fern-Language": "JavaScript",
+ "X-Fern-SDK-Name": "",
+ "X-Fern-SDK-Version": "0.1.0",
+ "X-Fern-Runtime": core.RUNTIME.type,
+ "X-Fern-Runtime-Version": core.RUNTIME.version,
+ },
+ contentType: "application/json",
+ requestType: "json",
+ body: request,
+ timeoutMs: requestOptions?.timeoutInSeconds != null ? requestOptions.timeoutInSeconds * 1000 : 60000,
+ maxRetries: requestOptions?.maxRetries,
+ abortSignal: requestOptions?.abortSignal,
+ });
+ if (_response.ok) {
+ return _response.body as Monite.MergedSettingsResponse;
+ }
+
+ if (_response.error.reason === "status-code") {
+ switch (_response.error.statusCode) {
+ case 400:
+ throw new Monite.BadRequestError(_response.error.body as Monite.ErrorSchemaResponse);
+ case 422:
+ throw new Monite.UnprocessableEntityError(_response.error.body as Monite.HttpValidationError);
+ case 500:
+ throw new Monite.InternalServerError(_response.error.body as Monite.ErrorSchemaResponse);
+ default:
+ throw new errors.MoniteError({
+ statusCode: _response.error.statusCode,
+ body: _response.error.body,
+ });
+ }
+ }
+
+ switch (_response.error.reason) {
+ case "non-json":
+ throw new errors.MoniteError({
+ statusCode: _response.error.statusCode,
+ body: _response.error.rawBody,
+ });
+ case "timeout":
+ throw new errors.MoniteTimeoutError();
+ case "unknown":
+ throw new errors.MoniteError({
+ message: _response.error.errorMessage,
+ });
+ }
+ }
+
+ /**
+ * Provide files for entity onboarding verification
+ *
+ * @param {Monite.EntityOnboardingDocumentsPayload} request
+ * @param {Entities.RequestOptions} requestOptions - Request-specific configuration.
+ *
+ * @throws {@link Monite.UnprocessableEntityError}
+ * @throws {@link Monite.InternalServerError}
+ *
+ * @example
+ * await client.entities.uploadOnboardingDocuments()
+ */
+ public async uploadOnboardingDocuments(
+ request: Monite.EntityOnboardingDocumentsPayload = {},
+ requestOptions?: Entities.RequestOptions
+ ): Promise {
+ const _response = await (this._options.fetcher ?? core.fetcher)({
+ url: urlJoin(
+ (await core.Supplier.get(this._options.environment)) ?? environments.MoniteEnvironment.Sandbox,
+ "onboarding_documents"
+ ),
+ method: "POST",
+ headers: {
+ Authorization: await this._getAuthorizationHeader(),
+ "x-monite-version": await core.Supplier.get(this._options.moniteVersion),
+ "x-monite-entity-id":
+ (await core.Supplier.get(this._options.moniteEntityId)) != null
+ ? await core.Supplier.get(this._options.moniteEntityId)
+ : undefined,
+ "X-Fern-Language": "JavaScript",
+ "X-Fern-SDK-Name": "",
+ "X-Fern-SDK-Version": "0.1.0",
+ "X-Fern-Runtime": core.RUNTIME.type,
+ "X-Fern-Runtime-Version": core.RUNTIME.version,
+ },
+ contentType: "application/json",
+ requestType: "json",
+ body: request,
+ timeoutMs: requestOptions?.timeoutInSeconds != null ? requestOptions.timeoutInSeconds * 1000 : 60000,
+ maxRetries: requestOptions?.maxRetries,
+ abortSignal: requestOptions?.abortSignal,
+ });
+ if (_response.ok) {
+ return;
+ }
+
+ if (_response.error.reason === "status-code") {
+ switch (_response.error.statusCode) {
+ case 422:
+ throw new Monite.UnprocessableEntityError(_response.error.body as Monite.HttpValidationError);
+ case 500:
+ throw new Monite.InternalServerError(_response.error.body as Monite.ErrorSchemaResponse);
+ default:
+ throw new errors.MoniteError({
+ statusCode: _response.error.statusCode,
+ body: _response.error.body,
+ });
+ }
+ }
+
+ switch (_response.error.reason) {
+ case "non-json":
+ throw new errors.MoniteError({
+ statusCode: _response.error.statusCode,
+ body: _response.error.rawBody,
+ });
+ case "timeout":
+ throw new errors.MoniteTimeoutError();
+ case "unknown":
+ throw new errors.MoniteError({
+ message: _response.error.errorMessage,
+ });
+ }
+ }
+
+ /**
+ * Get onboarding requirements for the entity
+ *
+ * @param {Entities.RequestOptions} requestOptions - Request-specific configuration.
+ *
+ * @throws {@link Monite.UnprocessableEntityError}
+ * @throws {@link Monite.InternalServerError}
+ *
+ * @example
+ * await client.entities.getOnboardingRequirements()
+ */
+ public async getOnboardingRequirements(
+ requestOptions?: Entities.RequestOptions
+ ): Promise {
+ const _response = await (this._options.fetcher ?? core.fetcher)({
+ url: urlJoin(
+ (await core.Supplier.get(this._options.environment)) ?? environments.MoniteEnvironment.Sandbox,
+ "onboarding_requirements"
+ ),
+ method: "GET",
+ headers: {
+ Authorization: await this._getAuthorizationHeader(),
+ "x-monite-version": await core.Supplier.get(this._options.moniteVersion),
+ "x-monite-entity-id":
+ (await core.Supplier.get(this._options.moniteEntityId)) != null
+ ? await core.Supplier.get(this._options.moniteEntityId)
+ : undefined,
+ "X-Fern-Language": "JavaScript",
+ "X-Fern-SDK-Name": "",
+ "X-Fern-SDK-Version": "0.1.0",
+ "X-Fern-Runtime": core.RUNTIME.type,
+ "X-Fern-Runtime-Version": core.RUNTIME.version,
+ },
+ contentType: "application/json",
+ requestType: "json",
+ timeoutMs: requestOptions?.timeoutInSeconds != null ? requestOptions.timeoutInSeconds * 1000 : 60000,
+ maxRetries: requestOptions?.maxRetries,
+ abortSignal: requestOptions?.abortSignal,
+ });
+ if (_response.ok) {
+ return _response.body as Monite.GetOnboardingRequirementsResponse;
+ }
+
+ if (_response.error.reason === "status-code") {
+ switch (_response.error.statusCode) {
+ case 422:
+ throw new Monite.UnprocessableEntityError(_response.error.body as Monite.HttpValidationError);
+ case 500:
+ throw new Monite.InternalServerError(_response.error.body as Monite.ErrorSchemaResponse);
+ default:
+ throw new errors.MoniteError({
+ statusCode: _response.error.statusCode,
+ body: _response.error.body,
+ });
+ }
+ }
+
+ switch (_response.error.reason) {
+ case "non-json":
+ throw new errors.MoniteError({
+ statusCode: _response.error.statusCode,
+ body: _response.error.rawBody,
+ });
+ case "timeout":
+ throw new errors.MoniteTimeoutError();
+ case "unknown":
+ throw new errors.MoniteError({
+ message: _response.error.errorMessage,
+ });
+ }
+ }
+
+ protected _bankAccounts: BankAccounts | undefined;
+
+ public get bankAccounts(): BankAccounts {
+ return (this._bankAccounts ??= new BankAccounts(this._options));
+ }
+
+ protected _onboardingData: OnboardingData | undefined;
+
+ public get onboardingData(): OnboardingData {
+ return (this._onboardingData ??= new OnboardingData(this._options));
+ }
+
+ protected _paymentMethods: PaymentMethods | undefined;
+
+ public get paymentMethods(): PaymentMethods {
+ return (this._paymentMethods ??= new PaymentMethods(this._options));
+ }
+
+ protected _vatIds: VatIds | undefined;
+
+ public get vatIds(): VatIds {
+ return (this._vatIds ??= new VatIds(this._options));
+ }
+
+ protected _persons: Persons | undefined;
+
+ public get persons(): Persons {
+ return (this._persons ??= new Persons(this._options));
+ }
+
+ protected async _getAuthorizationHeader(): Promise {
+ const bearer = await core.Supplier.get(this._options.token);
+ if (bearer != null) {
+ return `Bearer ${bearer}`;
+ }
+
+ return undefined;
+ }
+}
diff --git a/src/api/resources/entities/client/index.ts b/src/api/resources/entities/client/index.ts
new file mode 100644
index 0000000..415726b
--- /dev/null
+++ b/src/api/resources/entities/client/index.ts
@@ -0,0 +1 @@
+export * from "./requests";
diff --git a/src/api/resources/entities/client/requests/CreateEntityRequest.ts b/src/api/resources/entities/client/requests/CreateEntityRequest.ts
new file mode 100644
index 0000000..bad8323
--- /dev/null
+++ b/src/api/resources/entities/client/requests/CreateEntityRequest.ts
@@ -0,0 +1,37 @@
+/**
+ * This file was auto-generated by Fern from our API Definition.
+ */
+
+import * as Monite from "../../../../index";
+
+/**
+ * @example
+ * {
+ * address: {
+ * city: "city",
+ * country: "AF",
+ * line1: "line1",
+ * postal_code: "postal_code"
+ * },
+ * email: "email",
+ * type: "individual"
+ * }
+ */
+export interface CreateEntityRequest {
+ /** An address description of the entity */
+ address: Monite.EntityAddressSchema;
+ /** An official email address of the entity */
+ email: string;
+ /** A set of meta data describing the individual */
+ individual?: Monite.IndividualSchema;
+ /** A set of meta data describing the organization */
+ organization?: Monite.OrganizationSchema;
+ /** A phone number of the entity */
+ phone?: string;
+ /** The entity's taxpayer identification number or tax ID. This field is required for entities that are non-VAT registered. */
+ tax_id?: string;
+ /** A type for an entity */
+ type: Monite.EntityTypeEnum;
+ /** A website of the entity */
+ website?: string;
+}
diff --git a/src/api/resources/entities/client/requests/EntitiesGetRequest.ts b/src/api/resources/entities/client/requests/EntitiesGetRequest.ts
new file mode 100644
index 0000000..a784c59
--- /dev/null
+++ b/src/api/resources/entities/client/requests/EntitiesGetRequest.ts
@@ -0,0 +1,38 @@
+/**
+ * This file was auto-generated by Fern from our API Definition.
+ */
+
+import * as Monite from "../../../../index";
+
+/**
+ * @example
+ * {}
+ */
+export interface EntitiesGetRequest {
+ /**
+ * Order by
+ */
+ order?: Monite.OrderEnum;
+ /**
+ * Max is 100
+ */
+ limit?: number;
+ /**
+ * A token, obtained from previous page. Prior over other filters
+ */
+ pagination_token?: string;
+ /**
+ * Allowed sort fields
+ */
+ sort?: Monite.EntityCursorFields;
+ type?: Monite.EntityTypeEnum;
+ created_at__gt?: string;
+ created_at__lt?: string;
+ created_at__gte?: string;
+ created_at__lte?: string;
+ id__in?: string | string[];
+ id__not_in?: string | string[];
+ email?: string;
+ email__in?: string | string[];
+ email__not_in?: string | string[];
+}
diff --git a/src/api/resources/entities/client/requests/EntityLogoUploadRequest.ts b/src/api/resources/entities/client/requests/EntityLogoUploadRequest.ts
new file mode 100644
index 0000000..8c638b6
--- /dev/null
+++ b/src/api/resources/entities/client/requests/EntityLogoUploadRequest.ts
@@ -0,0 +1,9 @@
+/**
+ * This file was auto-generated by Fern from our API Definition.
+ */
+
+/**
+ * @example
+ * {}
+ */
+export interface EntityLogoUploadRequest {}
diff --git a/src/api/resources/entities/client/requests/EntityOnboardingDocumentsPayload.ts b/src/api/resources/entities/client/requests/EntityOnboardingDocumentsPayload.ts
new file mode 100644
index 0000000..f3d890f
--- /dev/null
+++ b/src/api/resources/entities/client/requests/EntityOnboardingDocumentsPayload.ts
@@ -0,0 +1,21 @@
+/**
+ * This file was auto-generated by Fern from our API Definition.
+ */
+
+/**
+ * @example
+ * {}
+ */
+export interface EntityOnboardingDocumentsPayload {
+ additional_verification_document_back?: string;
+ additional_verification_document_front?: string;
+ bank_account_ownership_verification?: string[];
+ company_license?: string[];
+ company_memorandum_of_association?: string[];
+ company_ministerial_decree?: string[];
+ company_registration_verification?: string[];
+ company_tax_id_verification?: string[];
+ proof_of_registration?: string[];
+ verification_document_back?: string;
+ verification_document_front?: string;
+}
diff --git a/src/api/resources/entities/client/requests/PatchSettingsPayload.ts b/src/api/resources/entities/client/requests/PatchSettingsPayload.ts
new file mode 100644
index 0000000..228d891
--- /dev/null
+++ b/src/api/resources/entities/client/requests/PatchSettingsPayload.ts
@@ -0,0 +1,29 @@
+/**
+ * This file was auto-generated by Fern from our API Definition.
+ */
+
+import * as Monite from "../../../../index";
+
+/**
+ * @example
+ * {}
+ */
+export interface PatchSettingsPayload {
+ language?: Monite.LanguageCodeEnum;
+ currency?: Monite.CurrencySettings;
+ reminder?: Monite.RemindersSettings;
+ /** Defines whether the prices of products in receivables will already include VAT or not. */
+ vat_mode?: Monite.VatModeEnum;
+ /** Payment preferences for entity to automate calculating suggested payment date basing on payment terms and entity preferences */
+ payment_priority?: Monite.PaymentPriorityEnum;
+ /** Automatically attempt to find a corresponding purchase order for all incoming payables. */
+ allow_purchase_order_autolinking?: boolean;
+ receivable_edit_flow?: Monite.ReceivableEditFlow;
+ document_ids?: Monite.DocumentIDsSettingsRequest;
+ /** Auto tagging settings for all incoming OCR payable documents. */
+ payables_ocr_auto_tagging?: Monite.OcrAutoTaggingSettingsRequest[];
+ /** Sets the default behavior of whether a signature is required to accept quotes */
+ quote_signature_required?: boolean;
+ /** If enabled, the paid invoice's PDF will be in a new layout set by the user */
+ generate_paid_invoice_pdf?: boolean;
+}
diff --git a/src/api/resources/entities/client/requests/index.ts b/src/api/resources/entities/client/requests/index.ts
new file mode 100644
index 0000000..aa4d51e
--- /dev/null
+++ b/src/api/resources/entities/client/requests/index.ts
@@ -0,0 +1,5 @@
+export { type EntitiesGetRequest } from "./EntitiesGetRequest";
+export { type CreateEntityRequest } from "./CreateEntityRequest";
+export { type EntityLogoUploadRequest } from "./EntityLogoUploadRequest";
+export { type PatchSettingsPayload } from "./PatchSettingsPayload";
+export { type EntityOnboardingDocumentsPayload } from "./EntityOnboardingDocumentsPayload";
diff --git a/src/api/resources/entities/index.ts b/src/api/resources/entities/index.ts
new file mode 100644
index 0000000..33a87f1
--- /dev/null
+++ b/src/api/resources/entities/index.ts
@@ -0,0 +1,2 @@
+export * from "./client";
+export * from "./resources";
diff --git a/src/api/resources/entities/resources/bankAccounts/client/Client.ts b/src/api/resources/entities/resources/bankAccounts/client/Client.ts
new file mode 100644
index 0000000..2c7a561
--- /dev/null
+++ b/src/api/resources/entities/resources/bankAccounts/client/Client.ts
@@ -0,0 +1,938 @@
+/**
+ * This file was auto-generated by Fern from our API Definition.
+ */
+
+import * as environments from "../../../../../../environments";
+import * as core from "../../../../../../core";
+import * as Monite from "../../../../../index";
+import urlJoin from "url-join";
+import * as errors from "../../../../../../errors/index";
+
+export declare namespace BankAccounts {
+ interface Options {
+ environment?: core.Supplier;
+ token?: core.Supplier;
+ /** Override the x-monite-version header */
+ moniteVersion: core.Supplier;
+ /** Override the x-monite-entity-id header */
+ moniteEntityId?: core.Supplier;
+ fetcher?: core.FetchFunction;
+ }
+
+ interface RequestOptions {
+ /** The maximum time to wait for a response in seconds. */
+ timeoutInSeconds?: number;
+ /** The number of times to retry the request. Defaults to 2. */
+ maxRetries?: number;
+ /** A hook to abort the request. */
+ abortSignal?: AbortSignal;
+ /** Override the x-monite-version header */
+ moniteVersion?: string;
+ /** Override the x-monite-entity-id header */
+ moniteEntityId?: string | undefined;
+ }
+}
+
+export class BankAccounts {
+ constructor(protected readonly _options: BankAccounts.Options) {}
+
+ /**
+ * Get all bank accounts of this entity.
+ *
+ * @param {BankAccounts.RequestOptions} requestOptions - Request-specific configuration.
+ *
+ * @throws {@link Monite.ConflictError}
+ * @throws {@link Monite.UnprocessableEntityError}
+ * @throws {@link Monite.InternalServerError}
+ *
+ * @example
+ * await client.entities.bankAccounts.get()
+ */
+ public async get(
+ requestOptions?: BankAccounts.RequestOptions
+ ): Promise {
+ const _response = await (this._options.fetcher ?? core.fetcher)({
+ url: urlJoin(
+ (await core.Supplier.get(this._options.environment)) ?? environments.MoniteEnvironment.Sandbox,
+ "bank_accounts"
+ ),
+ method: "GET",
+ headers: {
+ Authorization: await this._getAuthorizationHeader(),
+ "x-monite-version": await core.Supplier.get(this._options.moniteVersion),
+ "x-monite-entity-id":
+ (await core.Supplier.get(this._options.moniteEntityId)) != null
+ ? await core.Supplier.get(this._options.moniteEntityId)
+ : undefined,
+ "X-Fern-Language": "JavaScript",
+ "X-Fern-SDK-Name": "",
+ "X-Fern-SDK-Version": "0.1.0",
+ "X-Fern-Runtime": core.RUNTIME.type,
+ "X-Fern-Runtime-Version": core.RUNTIME.version,
+ },
+ contentType: "application/json",
+ requestType: "json",
+ timeoutMs: requestOptions?.timeoutInSeconds != null ? requestOptions.timeoutInSeconds * 1000 : 60000,
+ maxRetries: requestOptions?.maxRetries,
+ abortSignal: requestOptions?.abortSignal,
+ });
+ if (_response.ok) {
+ return _response.body as Monite.EntityBankAccountPaginationResponse;
+ }
+
+ if (_response.error.reason === "status-code") {
+ switch (_response.error.statusCode) {
+ case 409:
+ throw new Monite.ConflictError(_response.error.body as Monite.ErrorSchemaResponse);
+ case 422:
+ throw new Monite.UnprocessableEntityError(_response.error.body as Monite.HttpValidationError);
+ case 500:
+ throw new Monite.InternalServerError(_response.error.body as Monite.ErrorSchemaResponse);
+ default:
+ throw new errors.MoniteError({
+ statusCode: _response.error.statusCode,
+ body: _response.error.body,
+ });
+ }
+ }
+
+ switch (_response.error.reason) {
+ case "non-json":
+ throw new errors.MoniteError({
+ statusCode: _response.error.statusCode,
+ body: _response.error.rawBody,
+ });
+ case "timeout":
+ throw new errors.MoniteTimeoutError();
+ case "unknown":
+ throw new errors.MoniteError({
+ message: _response.error.errorMessage,
+ });
+ }
+ }
+
+ /**
+ * Add a new bank account for the specified entity.
+ *
+ * The minimum required fields are `currency` and `country`. Other required fields depend on the currency:
+ *
+ * - EUR accounts require `iban`.
+ * - GBP accounts require `account_holder_name`, `account_number`, and `sort_code`.
+ * - USD accounts require `account_holder_name`, `account_number`, and `routing_number`.
+ * - Accounts in other currencies require one of:
+ * - `iban`
+ * - `account_number` and `sort_code`
+ * - `account_number` and `routing_number`
+ *
+ * @param {Monite.entities.CreateEntityBankAccountRequest} request
+ * @param {BankAccounts.RequestOptions} requestOptions - Request-specific configuration.
+ *
+ * @throws {@link Monite.ConflictError}
+ * @throws {@link Monite.UnprocessableEntityError}
+ * @throws {@link Monite.InternalServerError}
+ *
+ * @example
+ * await client.entities.bankAccounts.create({
+ * country: "AF",
+ * currency: "AED"
+ * })
+ */
+ public async create(
+ request: Monite.entities.CreateEntityBankAccountRequest,
+ requestOptions?: BankAccounts.RequestOptions
+ ): Promise {
+ const _response = await (this._options.fetcher ?? core.fetcher)({
+ url: urlJoin(
+ (await core.Supplier.get(this._options.environment)) ?? environments.MoniteEnvironment.Sandbox,
+ "bank_accounts"
+ ),
+ method: "POST",
+ headers: {
+ Authorization: await this._getAuthorizationHeader(),
+ "x-monite-version": await core.Supplier.get(this._options.moniteVersion),
+ "x-monite-entity-id":
+ (await core.Supplier.get(this._options.moniteEntityId)) != null
+ ? await core.Supplier.get(this._options.moniteEntityId)
+ : undefined,
+ "X-Fern-Language": "JavaScript",
+ "X-Fern-SDK-Name": "",
+ "X-Fern-SDK-Version": "0.1.0",
+ "X-Fern-Runtime": core.RUNTIME.type,
+ "X-Fern-Runtime-Version": core.RUNTIME.version,
+ },
+ contentType: "application/json",
+ requestType: "json",
+ body: request,
+ timeoutMs: requestOptions?.timeoutInSeconds != null ? requestOptions.timeoutInSeconds * 1000 : 60000,
+ maxRetries: requestOptions?.maxRetries,
+ abortSignal: requestOptions?.abortSignal,
+ });
+ if (_response.ok) {
+ return _response.body as Monite.EntityBankAccountResponse;
+ }
+
+ if (_response.error.reason === "status-code") {
+ switch (_response.error.statusCode) {
+ case 409:
+ throw new Monite.ConflictError(_response.error.body as Monite.ErrorSchemaResponse);
+ case 422:
+ throw new Monite.UnprocessableEntityError(_response.error.body as Monite.HttpValidationError);
+ case 500:
+ throw new Monite.InternalServerError(_response.error.body as Monite.ErrorSchemaResponse);
+ default:
+ throw new errors.MoniteError({
+ statusCode: _response.error.statusCode,
+ body: _response.error.body,
+ });
+ }
+ }
+
+ switch (_response.error.reason) {
+ case "non-json":
+ throw new errors.MoniteError({
+ statusCode: _response.error.statusCode,
+ body: _response.error.rawBody,
+ });
+ case "timeout":
+ throw new errors.MoniteTimeoutError();
+ case "unknown":
+ throw new errors.MoniteError({
+ message: _response.error.errorMessage,
+ });
+ }
+ }
+
+ /**
+ * @param {Monite.entities.CompleteVerificationRequest} request
+ * @param {BankAccounts.RequestOptions} requestOptions - Request-specific configuration.
+ *
+ * @throws {@link Monite.UnprocessableEntityError}
+ * @throws {@link Monite.InternalServerError}
+ *
+ * @example
+ * await client.entities.bankAccounts.completeVerification({
+ * airwallex_plaid: {
+ * account: {
+ * id: "id",
+ * mask: "mask",
+ * name: "name"
+ * },
+ * institution: {
+ * id: "id",
+ * name: "name"
+ * },
+ * mandate: {
+ * email: "email",
+ * signatory: "signatory",
+ * type: "us_ach_debit",
+ * version: "1.0"
+ * },
+ * public_token: "public_token"
+ * },
+ * type: "airwallex_plaid"
+ * })
+ */
+ public async completeVerification(
+ request: Monite.entities.CompleteVerificationRequest,
+ requestOptions?: BankAccounts.RequestOptions
+ ): Promise {
+ const _response = await (this._options.fetcher ?? core.fetcher)({
+ url: urlJoin(
+ (await core.Supplier.get(this._options.environment)) ?? environments.MoniteEnvironment.Sandbox,
+ "bank_accounts/complete_verification"
+ ),
+ method: "POST",
+ headers: {
+ Authorization: await this._getAuthorizationHeader(),
+ "x-monite-version": await core.Supplier.get(this._options.moniteVersion),
+ "x-monite-entity-id":
+ (await core.Supplier.get(this._options.moniteEntityId)) != null
+ ? await core.Supplier.get(this._options.moniteEntityId)
+ : undefined,
+ "X-Fern-Language": "JavaScript",
+ "X-Fern-SDK-Name": "",
+ "X-Fern-SDK-Version": "0.1.0",
+ "X-Fern-Runtime": core.RUNTIME.type,
+ "X-Fern-Runtime-Version": core.RUNTIME.version,
+ },
+ contentType: "application/json",
+ requestType: "json",
+ body: { ...request, type: "airwallex_plaid" },
+ timeoutMs: requestOptions?.timeoutInSeconds != null ? requestOptions.timeoutInSeconds * 1000 : 60000,
+ maxRetries: requestOptions?.maxRetries,
+ abortSignal: requestOptions?.abortSignal,
+ });
+ if (_response.ok) {
+ return _response.body as Monite.CompleteVerificationResponse;
+ }
+
+ if (_response.error.reason === "status-code") {
+ switch (_response.error.statusCode) {
+ case 422:
+ throw new Monite.UnprocessableEntityError(_response.error.body as Monite.HttpValidationError);
+ case 500:
+ throw new Monite.InternalServerError(_response.error.body as Monite.ErrorSchemaResponse);
+ default:
+ throw new errors.MoniteError({
+ statusCode: _response.error.statusCode,
+ body: _response.error.body,
+ });
+ }
+ }
+
+ switch (_response.error.reason) {
+ case "non-json":
+ throw new errors.MoniteError({
+ statusCode: _response.error.statusCode,
+ body: _response.error.rawBody,
+ });
+ case "timeout":
+ throw new errors.MoniteTimeoutError();
+ case "unknown":
+ throw new errors.MoniteError({
+ message: _response.error.errorMessage,
+ });
+ }
+ }
+
+ /**
+ * Start entity bank account verification. The flow depends on verification type.
+ * For airwallex_plaid it generates Plaid Link token to init the Plaid SDK.
+ *
+ * @param {Monite.VerificationRequest} request
+ * @param {BankAccounts.RequestOptions} requestOptions - Request-specific configuration.
+ *
+ * @throws {@link Monite.UnprocessableEntityError}
+ * @throws {@link Monite.InternalServerError}
+ *
+ * @example
+ * await client.entities.bankAccounts.startVerification({
+ * airwallex_plaid: {
+ * client_name: "client_name",
+ * redirect_url: "redirect_url"
+ * },
+ * type: "airwallex_plaid"
+ * })
+ */
+ public async startVerification(
+ request: Monite.VerificationRequest,
+ requestOptions?: BankAccounts.RequestOptions
+ ): Promise {
+ const _response = await (this._options.fetcher ?? core.fetcher)({
+ url: urlJoin(
+ (await core.Supplier.get(this._options.environment)) ?? environments.MoniteEnvironment.Sandbox,
+ "bank_accounts/start_verification"
+ ),
+ method: "POST",
+ headers: {
+ Authorization: await this._getAuthorizationHeader(),
+ "x-monite-version": await core.Supplier.get(this._options.moniteVersion),
+ "x-monite-entity-id":
+ (await core.Supplier.get(this._options.moniteEntityId)) != null
+ ? await core.Supplier.get(this._options.moniteEntityId)
+ : undefined,
+ "X-Fern-Language": "JavaScript",
+ "X-Fern-SDK-Name": "",
+ "X-Fern-SDK-Version": "0.1.0",
+ "X-Fern-Runtime": core.RUNTIME.type,
+ "X-Fern-Runtime-Version": core.RUNTIME.version,
+ },
+ contentType: "application/json",
+ requestType: "json",
+ body: request,
+ timeoutMs: requestOptions?.timeoutInSeconds != null ? requestOptions.timeoutInSeconds * 1000 : 60000,
+ maxRetries: requestOptions?.maxRetries,
+ abortSignal: requestOptions?.abortSignal,
+ });
+ if (_response.ok) {
+ return _response.body as Monite.VerificationResponse;
+ }
+
+ if (_response.error.reason === "status-code") {
+ switch (_response.error.statusCode) {
+ case 422:
+ throw new Monite.UnprocessableEntityError(_response.error.body as Monite.HttpValidationError);
+ case 500:
+ throw new Monite.InternalServerError(_response.error.body as Monite.ErrorSchemaResponse);
+ default:
+ throw new errors.MoniteError({
+ statusCode: _response.error.statusCode,
+ body: _response.error.body,
+ });
+ }
+ }
+
+ switch (_response.error.reason) {
+ case "non-json":
+ throw new errors.MoniteError({
+ statusCode: _response.error.statusCode,
+ body: _response.error.rawBody,
+ });
+ case "timeout":
+ throw new errors.MoniteTimeoutError();
+ case "unknown":
+ throw new errors.MoniteError({
+ message: _response.error.errorMessage,
+ });
+ }
+ }
+
+ /**
+ * Retrieve a bank account by its ID.
+ *
+ * @param {string} bankAccountId
+ * @param {BankAccounts.RequestOptions} requestOptions - Request-specific configuration.
+ *
+ * @throws {@link Monite.NotFoundError}
+ * @throws {@link Monite.ConflictError}
+ * @throws {@link Monite.UnprocessableEntityError}
+ * @throws {@link Monite.InternalServerError}
+ *
+ * @example
+ * await client.entities.bankAccounts.getById("bank_account_id")
+ */
+ public async getById(
+ bankAccountId: string,
+ requestOptions?: BankAccounts.RequestOptions
+ ): Promise {
+ const _response = await (this._options.fetcher ?? core.fetcher)({
+ url: urlJoin(
+ (await core.Supplier.get(this._options.environment)) ?? environments.MoniteEnvironment.Sandbox,
+ `bank_accounts/${encodeURIComponent(bankAccountId)}`
+ ),
+ method: "GET",
+ headers: {
+ Authorization: await this._getAuthorizationHeader(),
+ "x-monite-version": await core.Supplier.get(this._options.moniteVersion),
+ "x-monite-entity-id":
+ (await core.Supplier.get(this._options.moniteEntityId)) != null
+ ? await core.Supplier.get(this._options.moniteEntityId)
+ : undefined,
+ "X-Fern-Language": "JavaScript",
+ "X-Fern-SDK-Name": "",
+ "X-Fern-SDK-Version": "0.1.0",
+ "X-Fern-Runtime": core.RUNTIME.type,
+ "X-Fern-Runtime-Version": core.RUNTIME.version,
+ },
+ contentType: "application/json",
+ requestType: "json",
+ timeoutMs: requestOptions?.timeoutInSeconds != null ? requestOptions.timeoutInSeconds * 1000 : 60000,
+ maxRetries: requestOptions?.maxRetries,
+ abortSignal: requestOptions?.abortSignal,
+ });
+ if (_response.ok) {
+ return _response.body as Monite.EntityBankAccountResponse;
+ }
+
+ if (_response.error.reason === "status-code") {
+ switch (_response.error.statusCode) {
+ case 404:
+ throw new Monite.NotFoundError(_response.error.body as Monite.ErrorSchemaResponse);
+ case 409:
+ throw new Monite.ConflictError(_response.error.body as Monite.ErrorSchemaResponse);
+ case 422:
+ throw new Monite.UnprocessableEntityError(_response.error.body as Monite.HttpValidationError);
+ case 500:
+ throw new Monite.InternalServerError(_response.error.body as Monite.ErrorSchemaResponse);
+ default:
+ throw new errors.MoniteError({
+ statusCode: _response.error.statusCode,
+ body: _response.error.body,
+ });
+ }
+ }
+
+ switch (_response.error.reason) {
+ case "non-json":
+ throw new errors.MoniteError({
+ statusCode: _response.error.statusCode,
+ body: _response.error.rawBody,
+ });
+ case "timeout":
+ throw new errors.MoniteTimeoutError();
+ case "unknown":
+ throw new errors.MoniteError({
+ message: _response.error.errorMessage,
+ });
+ }
+ }
+
+ /**
+ * Delete the bank account specified by its ID.
+ *
+ * @param {string} bankAccountId
+ * @param {BankAccounts.RequestOptions} requestOptions - Request-specific configuration.
+ *
+ * @throws {@link Monite.NotFoundError}
+ * @throws {@link Monite.ConflictError}
+ * @throws {@link Monite.UnprocessableEntityError}
+ * @throws {@link Monite.InternalServerError}
+ *
+ * @example
+ * await client.entities.bankAccounts.deleteById("bank_account_id")
+ */
+ public async deleteById(bankAccountId: string, requestOptions?: BankAccounts.RequestOptions): Promise {
+ const _response = await (this._options.fetcher ?? core.fetcher)({
+ url: urlJoin(
+ (await core.Supplier.get(this._options.environment)) ?? environments.MoniteEnvironment.Sandbox,
+ `bank_accounts/${encodeURIComponent(bankAccountId)}`
+ ),
+ method: "DELETE",
+ headers: {
+ Authorization: await this._getAuthorizationHeader(),
+ "x-monite-version": await core.Supplier.get(this._options.moniteVersion),
+ "x-monite-entity-id":
+ (await core.Supplier.get(this._options.moniteEntityId)) != null
+ ? await core.Supplier.get(this._options.moniteEntityId)
+ : undefined,
+ "X-Fern-Language": "JavaScript",
+ "X-Fern-SDK-Name": "",
+ "X-Fern-SDK-Version": "0.1.0",
+ "X-Fern-Runtime": core.RUNTIME.type,
+ "X-Fern-Runtime-Version": core.RUNTIME.version,
+ },
+ contentType: "application/json",
+ requestType: "json",
+ timeoutMs: requestOptions?.timeoutInSeconds != null ? requestOptions.timeoutInSeconds * 1000 : 60000,
+ maxRetries: requestOptions?.maxRetries,
+ abortSignal: requestOptions?.abortSignal,
+ });
+ if (_response.ok) {
+ return;
+ }
+
+ if (_response.error.reason === "status-code") {
+ switch (_response.error.statusCode) {
+ case 404:
+ throw new Monite.NotFoundError(_response.error.body as Monite.ErrorSchemaResponse);
+ case 409:
+ throw new Monite.ConflictError(_response.error.body as Monite.ErrorSchemaResponse);
+ case 422:
+ throw new Monite.UnprocessableEntityError(_response.error.body as Monite.HttpValidationError);
+ case 500:
+ throw new Monite.InternalServerError(_response.error.body as Monite.ErrorSchemaResponse);
+ default:
+ throw new errors.MoniteError({
+ statusCode: _response.error.statusCode,
+ body: _response.error.body,
+ });
+ }
+ }
+
+ switch (_response.error.reason) {
+ case "non-json":
+ throw new errors.MoniteError({
+ statusCode: _response.error.statusCode,
+ body: _response.error.rawBody,
+ });
+ case "timeout":
+ throw new errors.MoniteTimeoutError();
+ case "unknown":
+ throw new errors.MoniteError({
+ message: _response.error.errorMessage,
+ });
+ }
+ }
+
+ /**
+ * Change the specified fields with the provided values.
+ *
+ * @param {string} bankAccountId
+ * @param {Monite.entities.UpdateEntityBankAccountRequest} request
+ * @param {BankAccounts.RequestOptions} requestOptions - Request-specific configuration.
+ *
+ * @throws {@link Monite.NotFoundError}
+ * @throws {@link Monite.ConflictError}
+ * @throws {@link Monite.UnprocessableEntityError}
+ * @throws {@link Monite.InternalServerError}
+ *
+ * @example
+ * await client.entities.bankAccounts.updateById("bank_account_id")
+ */
+ public async updateById(
+ bankAccountId: string,
+ request: Monite.entities.UpdateEntityBankAccountRequest = {},
+ requestOptions?: BankAccounts.RequestOptions
+ ): Promise {
+ const _response = await (this._options.fetcher ?? core.fetcher)({
+ url: urlJoin(
+ (await core.Supplier.get(this._options.environment)) ?? environments.MoniteEnvironment.Sandbox,
+ `bank_accounts/${encodeURIComponent(bankAccountId)}`
+ ),
+ method: "PATCH",
+ headers: {
+ Authorization: await this._getAuthorizationHeader(),
+ "x-monite-version": await core.Supplier.get(this._options.moniteVersion),
+ "x-monite-entity-id":
+ (await core.Supplier.get(this._options.moniteEntityId)) != null
+ ? await core.Supplier.get(this._options.moniteEntityId)
+ : undefined,
+ "X-Fern-Language": "JavaScript",
+ "X-Fern-SDK-Name": "",
+ "X-Fern-SDK-Version": "0.1.0",
+ "X-Fern-Runtime": core.RUNTIME.type,
+ "X-Fern-Runtime-Version": core.RUNTIME.version,
+ },
+ contentType: "application/json",
+ requestType: "json",
+ body: request,
+ timeoutMs: requestOptions?.timeoutInSeconds != null ? requestOptions.timeoutInSeconds * 1000 : 60000,
+ maxRetries: requestOptions?.maxRetries,
+ abortSignal: requestOptions?.abortSignal,
+ });
+ if (_response.ok) {
+ return _response.body as Monite.EntityBankAccountResponse;
+ }
+
+ if (_response.error.reason === "status-code") {
+ switch (_response.error.statusCode) {
+ case 404:
+ throw new Monite.NotFoundError(_response.error.body as Monite.ErrorSchemaResponse);
+ case 409:
+ throw new Monite.ConflictError(_response.error.body as Monite.ErrorSchemaResponse);
+ case 422:
+ throw new Monite.UnprocessableEntityError(_response.error.body as Monite.HttpValidationError);
+ case 500:
+ throw new Monite.InternalServerError(_response.error.body as Monite.ErrorSchemaResponse);
+ default:
+ throw new errors.MoniteError({
+ statusCode: _response.error.statusCode,
+ body: _response.error.body,
+ });
+ }
+ }
+
+ switch (_response.error.reason) {
+ case "non-json":
+ throw new errors.MoniteError({
+ statusCode: _response.error.statusCode,
+ body: _response.error.rawBody,
+ });
+ case "timeout":
+ throw new errors.MoniteTimeoutError();
+ case "unknown":
+ throw new errors.MoniteError({
+ message: _response.error.errorMessage,
+ });
+ }
+ }
+
+ /**
+ * @param {string} bankAccountId
+ * @param {Monite.entities.CompleteRefreshVerificationRequest} request
+ * @param {BankAccounts.RequestOptions} requestOptions - Request-specific configuration.
+ *
+ * @throws {@link Monite.UnprocessableEntityError}
+ * @throws {@link Monite.InternalServerError}
+ *
+ * @example
+ * await client.entities.bankAccounts.completeVerificationById("bank_account_id", {
+ * type: "airwallex_plaid"
+ * })
+ */
+ public async completeVerificationById(
+ bankAccountId: string,
+ request: Monite.entities.CompleteRefreshVerificationRequest,
+ requestOptions?: BankAccounts.RequestOptions
+ ): Promise {
+ const _response = await (this._options.fetcher ?? core.fetcher)({
+ url: urlJoin(
+ (await core.Supplier.get(this._options.environment)) ?? environments.MoniteEnvironment.Sandbox,
+ `bank_accounts/${encodeURIComponent(bankAccountId)}/complete_verification`
+ ),
+ method: "POST",
+ headers: {
+ Authorization: await this._getAuthorizationHeader(),
+ "x-monite-version": await core.Supplier.get(this._options.moniteVersion),
+ "x-monite-entity-id":
+ (await core.Supplier.get(this._options.moniteEntityId)) != null
+ ? await core.Supplier.get(this._options.moniteEntityId)
+ : undefined,
+ "X-Fern-Language": "JavaScript",
+ "X-Fern-SDK-Name": "",
+ "X-Fern-SDK-Version": "0.1.0",
+ "X-Fern-Runtime": core.RUNTIME.type,
+ "X-Fern-Runtime-Version": core.RUNTIME.version,
+ },
+ contentType: "application/json",
+ requestType: "json",
+ body: { ...request, type: "airwallex_plaid" },
+ timeoutMs: requestOptions?.timeoutInSeconds != null ? requestOptions.timeoutInSeconds * 1000 : 60000,
+ maxRetries: requestOptions?.maxRetries,
+ abortSignal: requestOptions?.abortSignal,
+ });
+ if (_response.ok) {
+ return _response.body as Monite.CompleteRefreshVerificationResponse;
+ }
+
+ if (_response.error.reason === "status-code") {
+ switch (_response.error.statusCode) {
+ case 422:
+ throw new Monite.UnprocessableEntityError(_response.error.body as Monite.HttpValidationError);
+ case 500:
+ throw new Monite.InternalServerError(_response.error.body as Monite.ErrorSchemaResponse);
+ default:
+ throw new errors.MoniteError({
+ statusCode: _response.error.statusCode,
+ body: _response.error.body,
+ });
+ }
+ }
+
+ switch (_response.error.reason) {
+ case "non-json":
+ throw new errors.MoniteError({
+ statusCode: _response.error.statusCode,
+ body: _response.error.rawBody,
+ });
+ case "timeout":
+ throw new errors.MoniteTimeoutError();
+ case "unknown":
+ throw new errors.MoniteError({
+ message: _response.error.errorMessage,
+ });
+ }
+ }
+
+ /**
+ * Set a bank account as the default for this entity per currency.
+ *
+ * @param {string} bankAccountId
+ * @param {BankAccounts.RequestOptions} requestOptions - Request-specific configuration.
+ *
+ * @throws {@link Monite.NotFoundError}
+ * @throws {@link Monite.ConflictError}
+ * @throws {@link Monite.UnprocessableEntityError}
+ * @throws {@link Monite.InternalServerError}
+ *
+ * @example
+ * await client.entities.bankAccounts.makeDefaultById("bank_account_id")
+ */
+ public async makeDefaultById(
+ bankAccountId: string,
+ requestOptions?: BankAccounts.RequestOptions
+ ): Promise {
+ const _response = await (this._options.fetcher ?? core.fetcher)({
+ url: urlJoin(
+ (await core.Supplier.get(this._options.environment)) ?? environments.MoniteEnvironment.Sandbox,
+ `bank_accounts/${encodeURIComponent(bankAccountId)}/make_default`
+ ),
+ method: "POST",
+ headers: {
+ Authorization: await this._getAuthorizationHeader(),
+ "x-monite-version": await core.Supplier.get(this._options.moniteVersion),
+ "x-monite-entity-id":
+ (await core.Supplier.get(this._options.moniteEntityId)) != null
+ ? await core.Supplier.get(this._options.moniteEntityId)
+ : undefined,
+ "X-Fern-Language": "JavaScript",
+ "X-Fern-SDK-Name": "",
+ "X-Fern-SDK-Version": "0.1.0",
+ "X-Fern-Runtime": core.RUNTIME.type,
+ "X-Fern-Runtime-Version": core.RUNTIME.version,
+ },
+ contentType: "application/json",
+ requestType: "json",
+ timeoutMs: requestOptions?.timeoutInSeconds != null ? requestOptions.timeoutInSeconds * 1000 : 60000,
+ maxRetries: requestOptions?.maxRetries,
+ abortSignal: requestOptions?.abortSignal,
+ });
+ if (_response.ok) {
+ return _response.body as Monite.EntityBankAccountResponse;
+ }
+
+ if (_response.error.reason === "status-code") {
+ switch (_response.error.statusCode) {
+ case 404:
+ throw new Monite.NotFoundError(_response.error.body as Monite.ErrorSchemaResponse);
+ case 409:
+ throw new Monite.ConflictError(_response.error.body as Monite.ErrorSchemaResponse);
+ case 422:
+ throw new Monite.UnprocessableEntityError(_response.error.body as Monite.HttpValidationError);
+ case 500:
+ throw new Monite.InternalServerError(_response.error.body as Monite.ErrorSchemaResponse);
+ default:
+ throw new errors.MoniteError({
+ statusCode: _response.error.statusCode,
+ body: _response.error.body,
+ });
+ }
+ }
+
+ switch (_response.error.reason) {
+ case "non-json":
+ throw new errors.MoniteError({
+ statusCode: _response.error.statusCode,
+ body: _response.error.rawBody,
+ });
+ case "timeout":
+ throw new errors.MoniteTimeoutError();
+ case "unknown":
+ throw new errors.MoniteError({
+ message: _response.error.errorMessage,
+ });
+ }
+ }
+
+ /**
+ * @param {string} bankAccountId
+ * @param {Monite.VerificationRequest} request
+ * @param {BankAccounts.RequestOptions} requestOptions - Request-specific configuration.
+ *
+ * @throws {@link Monite.UnprocessableEntityError}
+ * @throws {@link Monite.InternalServerError}
+ *
+ * @example
+ * await client.entities.bankAccounts.refreshVerificationById("bank_account_id", {
+ * airwallex_plaid: {
+ * client_name: "client_name",
+ * redirect_url: "redirect_url"
+ * },
+ * type: "airwallex_plaid"
+ * })
+ */
+ public async refreshVerificationById(
+ bankAccountId: string,
+ request: Monite.VerificationRequest,
+ requestOptions?: BankAccounts.RequestOptions
+ ): Promise {
+ const _response = await (this._options.fetcher ?? core.fetcher)({
+ url: urlJoin(
+ (await core.Supplier.get(this._options.environment)) ?? environments.MoniteEnvironment.Sandbox,
+ `bank_accounts/${encodeURIComponent(bankAccountId)}/refresh_verification`
+ ),
+ method: "POST",
+ headers: {
+ Authorization: await this._getAuthorizationHeader(),
+ "x-monite-version": await core.Supplier.get(this._options.moniteVersion),
+ "x-monite-entity-id":
+ (await core.Supplier.get(this._options.moniteEntityId)) != null
+ ? await core.Supplier.get(this._options.moniteEntityId)
+ : undefined,
+ "X-Fern-Language": "JavaScript",
+ "X-Fern-SDK-Name": "",
+ "X-Fern-SDK-Version": "0.1.0",
+ "X-Fern-Runtime": core.RUNTIME.type,
+ "X-Fern-Runtime-Version": core.RUNTIME.version,
+ },
+ contentType: "application/json",
+ requestType: "json",
+ body: request,
+ timeoutMs: requestOptions?.timeoutInSeconds != null ? requestOptions.timeoutInSeconds * 1000 : 60000,
+ maxRetries: requestOptions?.maxRetries,
+ abortSignal: requestOptions?.abortSignal,
+ });
+ if (_response.ok) {
+ return _response.body as Monite.VerificationResponse;
+ }
+
+ if (_response.error.reason === "status-code") {
+ switch (_response.error.statusCode) {
+ case 422:
+ throw new Monite.UnprocessableEntityError(_response.error.body as Monite.HttpValidationError);
+ case 500:
+ throw new Monite.InternalServerError(_response.error.body as Monite.ErrorSchemaResponse);
+ default:
+ throw new errors.MoniteError({
+ statusCode: _response.error.statusCode,
+ body: _response.error.body,
+ });
+ }
+ }
+
+ switch (_response.error.reason) {
+ case "non-json":
+ throw new errors.MoniteError({
+ statusCode: _response.error.statusCode,
+ body: _response.error.rawBody,
+ });
+ case "timeout":
+ throw new errors.MoniteTimeoutError();
+ case "unknown":
+ throw new errors.MoniteError({
+ message: _response.error.errorMessage,
+ });
+ }
+ }
+
+ /**
+ * @param {string} bankAccountId
+ * @param {BankAccounts.RequestOptions} requestOptions - Request-specific configuration.
+ *
+ * @throws {@link Monite.UnprocessableEntityError}
+ * @throws {@link Monite.InternalServerError}
+ *
+ * @example
+ * await client.entities.bankAccounts.getVerificationsById("bank_account_id")
+ */
+ public async getVerificationsById(
+ bankAccountId: string,
+ requestOptions?: BankAccounts.RequestOptions
+ ): Promise {
+ const _response = await (this._options.fetcher ?? core.fetcher)({
+ url: urlJoin(
+ (await core.Supplier.get(this._options.environment)) ?? environments.MoniteEnvironment.Sandbox,
+ `bank_accounts/${encodeURIComponent(bankAccountId)}/verifications`
+ ),
+ method: "GET",
+ headers: {
+ Authorization: await this._getAuthorizationHeader(),
+ "x-monite-version": await core.Supplier.get(this._options.moniteVersion),
+ "x-monite-entity-id":
+ (await core.Supplier.get(this._options.moniteEntityId)) != null
+ ? await core.Supplier.get(this._options.moniteEntityId)
+ : undefined,
+ "X-Fern-Language": "JavaScript",
+ "X-Fern-SDK-Name": "",
+ "X-Fern-SDK-Version": "0.1.0",
+ "X-Fern-Runtime": core.RUNTIME.type,
+ "X-Fern-Runtime-Version": core.RUNTIME.version,
+ },
+ contentType: "application/json",
+ requestType: "json",
+ timeoutMs: requestOptions?.timeoutInSeconds != null ? requestOptions.timeoutInSeconds * 1000 : 60000,
+ maxRetries: requestOptions?.maxRetries,
+ abortSignal: requestOptions?.abortSignal,
+ });
+ if (_response.ok) {
+ return _response.body as Monite.BankAccountVerifications;
+ }
+
+ if (_response.error.reason === "status-code") {
+ switch (_response.error.statusCode) {
+ case 422:
+ throw new Monite.UnprocessableEntityError(_response.error.body as Monite.HttpValidationError);
+ case 500:
+ throw new Monite.InternalServerError(_response.error.body as Monite.ErrorSchemaResponse);
+ default:
+ throw new errors.MoniteError({
+ statusCode: _response.error.statusCode,
+ body: _response.error.body,
+ });
+ }
+ }
+
+ switch (_response.error.reason) {
+ case "non-json":
+ throw new errors.MoniteError({
+ statusCode: _response.error.statusCode,
+ body: _response.error.rawBody,
+ });
+ case "timeout":
+ throw new errors.MoniteTimeoutError();
+ case "unknown":
+ throw new errors.MoniteError({
+ message: _response.error.errorMessage,
+ });
+ }
+ }
+
+ protected async _getAuthorizationHeader(): Promise {
+ const bearer = await core.Supplier.get(this._options.token);
+ if (bearer != null) {
+ return `Bearer ${bearer}`;
+ }
+
+ return undefined;
+ }
+}
diff --git a/src/api/resources/entities/resources/bankAccounts/client/index.ts b/src/api/resources/entities/resources/bankAccounts/client/index.ts
new file mode 100644
index 0000000..415726b
--- /dev/null
+++ b/src/api/resources/entities/resources/bankAccounts/client/index.ts
@@ -0,0 +1 @@
+export * from "./requests";
diff --git a/src/api/resources/entities/resources/bankAccounts/client/requests/CompleteRefreshVerificationRequest.ts b/src/api/resources/entities/resources/bankAccounts/client/requests/CompleteRefreshVerificationRequest.ts
new file mode 100644
index 0000000..08c3d16
--- /dev/null
+++ b/src/api/resources/entities/resources/bankAccounts/client/requests/CompleteRefreshVerificationRequest.ts
@@ -0,0 +1,11 @@
+/**
+ * This file was auto-generated by Fern from our API Definition.
+ */
+
+/**
+ * @example
+ * {
+ * type: "airwallex_plaid"
+ * }
+ */
+export interface CompleteRefreshVerificationRequest {}
diff --git a/src/api/resources/entities/resources/bankAccounts/client/requests/CompleteVerificationRequest.ts b/src/api/resources/entities/resources/bankAccounts/client/requests/CompleteVerificationRequest.ts
new file mode 100644
index 0000000..6b6c7f9
--- /dev/null
+++ b/src/api/resources/entities/resources/bankAccounts/client/requests/CompleteVerificationRequest.ts
@@ -0,0 +1,33 @@
+/**
+ * This file was auto-generated by Fern from our API Definition.
+ */
+
+import * as Monite from "../../../../../../index";
+
+/**
+ * @example
+ * {
+ * airwallex_plaid: {
+ * account: {
+ * id: "id",
+ * mask: "mask",
+ * name: "name"
+ * },
+ * institution: {
+ * id: "id",
+ * name: "name"
+ * },
+ * mandate: {
+ * email: "email",
+ * signatory: "signatory",
+ * type: "us_ach_debit",
+ * version: "1.0"
+ * },
+ * public_token: "public_token"
+ * },
+ * type: "airwallex_plaid"
+ * }
+ */
+export interface CompleteVerificationRequest {
+ airwallex_plaid: Monite.CompleteVerificationAirwallexPlaidRequest;
+}
diff --git a/src/api/resources/entities/resources/bankAccounts/client/requests/CreateEntityBankAccountRequest.ts b/src/api/resources/entities/resources/bankAccounts/client/requests/CreateEntityBankAccountRequest.ts
new file mode 100644
index 0000000..688002c
--- /dev/null
+++ b/src/api/resources/entities/resources/bankAccounts/client/requests/CreateEntityBankAccountRequest.ts
@@ -0,0 +1,37 @@
+/**
+ * This file was auto-generated by Fern from our API Definition.
+ */
+
+import * as Monite from "../../../../../../index";
+
+/**
+ * @example
+ * {
+ * country: "AF",
+ * currency: "AED"
+ * }
+ */
+export interface CreateEntityBankAccountRequest {
+ /** The name of the person or business that owns this bank account. Required if the account currency is GBP or USD. */
+ account_holder_name?: string;
+ /** The bank account number. Required if the account currency is GBP or USD. UK account numbers typically contain 8 digits. US bank account numbers contain 9 to 12 digits. */
+ account_number?: string;
+ /** The bank name. */
+ bank_name?: string;
+ /** The SWIFT/BIC code of the bank. */
+ bic?: string;
+ /** The country in which the bank account is registered, repsesented as a two-letter country code ([ISO 3166-1 alpha-2](https://en.wikipedia.org/wiki/ISO_3166-1_alpha-2)). */
+ country: Monite.AllowedCountries;
+ /** The currency of the bank account, represented as a three-letter ISO [currency code](https://docs.monite.com/docs/currencies). */
+ currency: Monite.CurrencyEnum;
+ /** User-defined name of this bank account, such as 'Primary account' or 'Savings account'. */
+ display_name?: string;
+ /** The IBAN of the bank account. Required if the account currency is EUR. */
+ iban?: string;
+ /** If set to `true` or if this is the first bank account added for the given currency, this account becomes the default one for its currency. */
+ is_default_for_currency?: boolean;
+ /** The bank's routing transit number (RTN). Required if the account currency is USD. US routing numbers consist of 9 digits. */
+ routing_number?: string;
+ /** The bank's sort code. Required if the account currency is GBP. */
+ sort_code?: string;
+}
diff --git a/src/api/resources/entities/resources/bankAccounts/client/requests/UpdateEntityBankAccountRequest.ts b/src/api/resources/entities/resources/bankAccounts/client/requests/UpdateEntityBankAccountRequest.ts
new file mode 100644
index 0000000..a35c3c2
--- /dev/null
+++ b/src/api/resources/entities/resources/bankAccounts/client/requests/UpdateEntityBankAccountRequest.ts
@@ -0,0 +1,14 @@
+/**
+ * This file was auto-generated by Fern from our API Definition.
+ */
+
+/**
+ * @example
+ * {}
+ */
+export interface UpdateEntityBankAccountRequest {
+ /** The name of the person or business that owns this bank account. If the account currency is GBP or USD, the holder name cannot be changed to an empty string. */
+ account_holder_name?: string;
+ /** User-defined name of this bank account, such as 'Primary account' or 'Savings account'. */
+ display_name?: string;
+}
diff --git a/src/api/resources/entities/resources/bankAccounts/client/requests/index.ts b/src/api/resources/entities/resources/bankAccounts/client/requests/index.ts
new file mode 100644
index 0000000..a615e7d
--- /dev/null
+++ b/src/api/resources/entities/resources/bankAccounts/client/requests/index.ts
@@ -0,0 +1,4 @@
+export { type CreateEntityBankAccountRequest } from "./CreateEntityBankAccountRequest";
+export { type CompleteVerificationRequest } from "./CompleteVerificationRequest";
+export { type UpdateEntityBankAccountRequest } from "./UpdateEntityBankAccountRequest";
+export { type CompleteRefreshVerificationRequest } from "./CompleteRefreshVerificationRequest";
diff --git a/src/api/resources/entities/resources/bankAccounts/index.ts b/src/api/resources/entities/resources/bankAccounts/index.ts
new file mode 100644
index 0000000..5ec7692
--- /dev/null
+++ b/src/api/resources/entities/resources/bankAccounts/index.ts
@@ -0,0 +1 @@
+export * from "./client";
diff --git a/src/api/resources/entities/resources/index.ts b/src/api/resources/entities/resources/index.ts
new file mode 100644
index 0000000..791b011
--- /dev/null
+++ b/src/api/resources/entities/resources/index.ts
@@ -0,0 +1,10 @@
+export * as bankAccounts from "./bankAccounts";
+export * as onboardingData from "./onboardingData";
+export * as paymentMethods from "./paymentMethods";
+export * as vatIds from "./vatIds";
+export * as persons from "./persons";
+export * from "./bankAccounts/client/requests";
+export * from "./onboardingData/client/requests";
+export * from "./paymentMethods/client/requests";
+export * from "./vatIds/client/requests";
+export * from "./persons/client/requests";
diff --git a/src/api/resources/entities/resources/onboardingData/client/Client.ts b/src/api/resources/entities/resources/onboardingData/client/Client.ts
new file mode 100644
index 0000000..90d8598
--- /dev/null
+++ b/src/api/resources/entities/resources/onboardingData/client/Client.ts
@@ -0,0 +1,206 @@
+/**
+ * This file was auto-generated by Fern from our API Definition.
+ */
+
+import * as environments from "../../../../../../environments";
+import * as core from "../../../../../../core";
+import * as Monite from "../../../../../index";
+import urlJoin from "url-join";
+import * as errors from "../../../../../../errors/index";
+
+export declare namespace OnboardingData {
+ interface Options {
+ environment?: core.Supplier;
+ token?: core.Supplier;
+ /** Override the x-monite-version header */
+ moniteVersion: core.Supplier;
+ /** Override the x-monite-entity-id header */
+ moniteEntityId?: core.Supplier;
+ fetcher?: core.FetchFunction;
+ }
+
+ interface RequestOptions {
+ /** The maximum time to wait for a response in seconds. */
+ timeoutInSeconds?: number;
+ /** The number of times to retry the request. Defaults to 2. */
+ maxRetries?: number;
+ /** A hook to abort the request. */
+ abortSignal?: AbortSignal;
+ /** Override the x-monite-version header */
+ moniteVersion?: string;
+ /** Override the x-monite-entity-id header */
+ moniteEntityId?: string | undefined;
+ }
+}
+
+export class OnboardingData {
+ constructor(protected readonly _options: OnboardingData.Options) {}
+
+ /**
+ * @param {string} entityId
+ * @param {OnboardingData.RequestOptions} requestOptions - Request-specific configuration.
+ *
+ * @throws {@link Monite.NotFoundError}
+ * @throws {@link Monite.ConflictError}
+ * @throws {@link Monite.UnprocessableEntityError}
+ * @throws {@link Monite.InternalServerError}
+ *
+ * @example
+ * await client.entities.onboardingData.get("entity_id")
+ */
+ public async get(
+ entityId: string,
+ requestOptions?: OnboardingData.RequestOptions
+ ): Promise {
+ const _response = await (this._options.fetcher ?? core.fetcher)({
+ url: urlJoin(
+ (await core.Supplier.get(this._options.environment)) ?? environments.MoniteEnvironment.Sandbox,
+ `entities/${encodeURIComponent(entityId)}/onboarding_data`
+ ),
+ method: "GET",
+ headers: {
+ Authorization: await this._getAuthorizationHeader(),
+ "x-monite-version": await core.Supplier.get(this._options.moniteVersion),
+ "x-monite-entity-id":
+ (await core.Supplier.get(this._options.moniteEntityId)) != null
+ ? await core.Supplier.get(this._options.moniteEntityId)
+ : undefined,
+ "X-Fern-Language": "JavaScript",
+ "X-Fern-SDK-Name": "",
+ "X-Fern-SDK-Version": "0.1.0",
+ "X-Fern-Runtime": core.RUNTIME.type,
+ "X-Fern-Runtime-Version": core.RUNTIME.version,
+ },
+ contentType: "application/json",
+ requestType: "json",
+ timeoutMs: requestOptions?.timeoutInSeconds != null ? requestOptions.timeoutInSeconds * 1000 : 60000,
+ maxRetries: requestOptions?.maxRetries,
+ abortSignal: requestOptions?.abortSignal,
+ });
+ if (_response.ok) {
+ return _response.body as Monite.EntityOnboardingDataResponse;
+ }
+
+ if (_response.error.reason === "status-code") {
+ switch (_response.error.statusCode) {
+ case 404:
+ throw new Monite.NotFoundError(_response.error.body as Monite.ErrorSchemaResponse);
+ case 409:
+ throw new Monite.ConflictError(_response.error.body as Monite.ErrorSchemaResponse);
+ case 422:
+ throw new Monite.UnprocessableEntityError(_response.error.body as Monite.HttpValidationError);
+ case 500:
+ throw new Monite.InternalServerError(_response.error.body as Monite.ErrorSchemaResponse);
+ default:
+ throw new errors.MoniteError({
+ statusCode: _response.error.statusCode,
+ body: _response.error.body,
+ });
+ }
+ }
+
+ switch (_response.error.reason) {
+ case "non-json":
+ throw new errors.MoniteError({
+ statusCode: _response.error.statusCode,
+ body: _response.error.rawBody,
+ });
+ case "timeout":
+ throw new errors.MoniteTimeoutError();
+ case "unknown":
+ throw new errors.MoniteError({
+ message: _response.error.errorMessage,
+ });
+ }
+ }
+
+ /**
+ * @param {string} entityId
+ * @param {Monite.entities.EntityOnboardingDataRequest} request
+ * @param {OnboardingData.RequestOptions} requestOptions - Request-specific configuration.
+ *
+ * @throws {@link Monite.NotFoundError}
+ * @throws {@link Monite.ConflictError}
+ * @throws {@link Monite.UnprocessableEntityError}
+ * @throws {@link Monite.InternalServerError}
+ *
+ * @example
+ * await client.entities.onboardingData.update("entity_id")
+ */
+ public async update(
+ entityId: string,
+ request: Monite.entities.EntityOnboardingDataRequest = {},
+ requestOptions?: OnboardingData.RequestOptions
+ ): Promise {
+ const _response = await (this._options.fetcher ?? core.fetcher)({
+ url: urlJoin(
+ (await core.Supplier.get(this._options.environment)) ?? environments.MoniteEnvironment.Sandbox,
+ `entities/${encodeURIComponent(entityId)}/onboarding_data`
+ ),
+ method: "PATCH",
+ headers: {
+ Authorization: await this._getAuthorizationHeader(),
+ "x-monite-version": await core.Supplier.get(this._options.moniteVersion),
+ "x-monite-entity-id":
+ (await core.Supplier.get(this._options.moniteEntityId)) != null
+ ? await core.Supplier.get(this._options.moniteEntityId)
+ : undefined,
+ "X-Fern-Language": "JavaScript",
+ "X-Fern-SDK-Name": "",
+ "X-Fern-SDK-Version": "0.1.0",
+ "X-Fern-Runtime": core.RUNTIME.type,
+ "X-Fern-Runtime-Version": core.RUNTIME.version,
+ },
+ contentType: "application/json",
+ requestType: "json",
+ body: request,
+ timeoutMs: requestOptions?.timeoutInSeconds != null ? requestOptions.timeoutInSeconds * 1000 : 60000,
+ maxRetries: requestOptions?.maxRetries,
+ abortSignal: requestOptions?.abortSignal,
+ });
+ if (_response.ok) {
+ return _response.body as Monite.EntityOnboardingDataResponse;
+ }
+
+ if (_response.error.reason === "status-code") {
+ switch (_response.error.statusCode) {
+ case 404:
+ throw new Monite.NotFoundError(_response.error.body as Monite.ErrorSchemaResponse);
+ case 409:
+ throw new Monite.ConflictError(_response.error.body as Monite.ErrorSchemaResponse);
+ case 422:
+ throw new Monite.UnprocessableEntityError(_response.error.body as Monite.HttpValidationError);
+ case 500:
+ throw new Monite.InternalServerError(_response.error.body as Monite.ErrorSchemaResponse);
+ default:
+ throw new errors.MoniteError({
+ statusCode: _response.error.statusCode,
+ body: _response.error.body,
+ });
+ }
+ }
+
+ switch (_response.error.reason) {
+ case "non-json":
+ throw new errors.MoniteError({
+ statusCode: _response.error.statusCode,
+ body: _response.error.rawBody,
+ });
+ case "timeout":
+ throw new errors.MoniteTimeoutError();
+ case "unknown":
+ throw new errors.MoniteError({
+ message: _response.error.errorMessage,
+ });
+ }
+ }
+
+ protected async _getAuthorizationHeader(): Promise {
+ const bearer = await core.Supplier.get(this._options.token);
+ if (bearer != null) {
+ return `Bearer ${bearer}`;
+ }
+
+ return undefined;
+ }
+}
diff --git a/src/api/resources/entities/resources/onboardingData/client/index.ts b/src/api/resources/entities/resources/onboardingData/client/index.ts
new file mode 100644
index 0000000..415726b
--- /dev/null
+++ b/src/api/resources/entities/resources/onboardingData/client/index.ts
@@ -0,0 +1 @@
+export * from "./requests";
diff --git a/src/api/resources/entities/resources/onboardingData/client/requests/EntityOnboardingDataRequest.ts b/src/api/resources/entities/resources/onboardingData/client/requests/EntityOnboardingDataRequest.ts
new file mode 100644
index 0000000..b8cf5ec
--- /dev/null
+++ b/src/api/resources/entities/resources/onboardingData/client/requests/EntityOnboardingDataRequest.ts
@@ -0,0 +1,18 @@
+/**
+ * This file was auto-generated by Fern from our API Definition.
+ */
+
+import * as Monite from "../../../../../../index";
+
+/**
+ * @example
+ * {}
+ */
+export interface EntityOnboardingDataRequest {
+ /** Business information about the entity. */
+ business_profile?: Monite.BusinessProfile;
+ /** Used to attest that the beneficial owner information provided is both current and correct. */
+ ownership_declaration?: Monite.OwnershipDeclaration;
+ /** Details on the entity's acceptance of the service agreement. */
+ tos_acceptance?: Monite.TermsOfServiceAcceptance;
+}
diff --git a/src/api/resources/entities/resources/onboardingData/client/requests/index.ts b/src/api/resources/entities/resources/onboardingData/client/requests/index.ts
new file mode 100644
index 0000000..d7bd248
--- /dev/null
+++ b/src/api/resources/entities/resources/onboardingData/client/requests/index.ts
@@ -0,0 +1 @@
+export { type EntityOnboardingDataRequest } from "./EntityOnboardingDataRequest";
diff --git a/src/api/resources/entities/resources/onboardingData/index.ts b/src/api/resources/entities/resources/onboardingData/index.ts
new file mode 100644
index 0000000..5ec7692
--- /dev/null
+++ b/src/api/resources/entities/resources/onboardingData/index.ts
@@ -0,0 +1 @@
+export * from "./client";
diff --git a/src/api/resources/entities/resources/paymentMethods/client/Client.ts b/src/api/resources/entities/resources/paymentMethods/client/Client.ts
new file mode 100644
index 0000000..747bbbc
--- /dev/null
+++ b/src/api/resources/entities/resources/paymentMethods/client/Client.ts
@@ -0,0 +1,198 @@
+/**
+ * This file was auto-generated by Fern from our API Definition.
+ */
+
+import * as environments from "../../../../../../environments";
+import * as core from "../../../../../../core";
+import * as Monite from "../../../../../index";
+import urlJoin from "url-join";
+import * as errors from "../../../../../../errors/index";
+
+export declare namespace PaymentMethods {
+ interface Options {
+ environment?: core.Supplier;
+ token?: core.Supplier;
+ /** Override the x-monite-version header */
+ moniteVersion: core.Supplier;
+ /** Override the x-monite-entity-id header */
+ moniteEntityId?: core.Supplier;
+ fetcher?: core.FetchFunction;
+ }
+
+ interface RequestOptions {
+ /** The maximum time to wait for a response in seconds. */
+ timeoutInSeconds?: number;
+ /** The number of times to retry the request. Defaults to 2. */
+ maxRetries?: number;
+ /** A hook to abort the request. */
+ abortSignal?: AbortSignal;
+ /** Override the x-monite-version header */
+ moniteVersion?: string;
+ /** Override the x-monite-entity-id header */
+ moniteEntityId?: string | undefined;
+ }
+}
+
+export class PaymentMethods {
+ constructor(protected readonly _options: PaymentMethods.Options) {}
+
+ /**
+ * Get all enabled payment methods.
+ *
+ * @param {string} entityId
+ * @param {PaymentMethods.RequestOptions} requestOptions - Request-specific configuration.
+ *
+ * @throws {@link Monite.UnprocessableEntityError}
+ * @throws {@link Monite.InternalServerError}
+ *
+ * @example
+ * await client.entities.paymentMethods.get("entity_id")
+ */
+ public async get(
+ entityId: string,
+ requestOptions?: PaymentMethods.RequestOptions
+ ): Promise {
+ const _response = await (this._options.fetcher ?? core.fetcher)({
+ url: urlJoin(
+ (await core.Supplier.get(this._options.environment)) ?? environments.MoniteEnvironment.Sandbox,
+ `entities/${encodeURIComponent(entityId)}/payment_methods`
+ ),
+ method: "GET",
+ headers: {
+ Authorization: await this._getAuthorizationHeader(),
+ "x-monite-version": await core.Supplier.get(this._options.moniteVersion),
+ "x-monite-entity-id":
+ (await core.Supplier.get(this._options.moniteEntityId)) != null
+ ? await core.Supplier.get(this._options.moniteEntityId)
+ : undefined,
+ "X-Fern-Language": "JavaScript",
+ "X-Fern-SDK-Name": "",
+ "X-Fern-SDK-Version": "0.1.0",
+ "X-Fern-Runtime": core.RUNTIME.type,
+ "X-Fern-Runtime-Version": core.RUNTIME.version,
+ },
+ contentType: "application/json",
+ requestType: "json",
+ timeoutMs: requestOptions?.timeoutInSeconds != null ? requestOptions.timeoutInSeconds * 1000 : 60000,
+ maxRetries: requestOptions?.maxRetries,
+ abortSignal: requestOptions?.abortSignal,
+ });
+ if (_response.ok) {
+ return _response.body as Monite.OnboardingPaymentMethodsResponse;
+ }
+
+ if (_response.error.reason === "status-code") {
+ switch (_response.error.statusCode) {
+ case 422:
+ throw new Monite.UnprocessableEntityError(_response.error.body as Monite.HttpValidationError);
+ case 500:
+ throw new Monite.InternalServerError(_response.error.body as Monite.ErrorSchemaResponse);
+ default:
+ throw new errors.MoniteError({
+ statusCode: _response.error.statusCode,
+ body: _response.error.body,
+ });
+ }
+ }
+
+ switch (_response.error.reason) {
+ case "non-json":
+ throw new errors.MoniteError({
+ statusCode: _response.error.statusCode,
+ body: _response.error.rawBody,
+ });
+ case "timeout":
+ throw new errors.MoniteTimeoutError();
+ case "unknown":
+ throw new errors.MoniteError({
+ message: _response.error.errorMessage,
+ });
+ }
+ }
+
+ /**
+ * Set which payment methods should be enabled.
+ *
+ * @param {string} entityId
+ * @param {Monite.entities.EnabledPaymentMethods} request
+ * @param {PaymentMethods.RequestOptions} requestOptions - Request-specific configuration.
+ *
+ * @throws {@link Monite.UnprocessableEntityError}
+ * @throws {@link Monite.InternalServerError}
+ *
+ * @example
+ * await client.entities.paymentMethods.set("entity_id")
+ */
+ public async set(
+ entityId: string,
+ request: Monite.entities.EnabledPaymentMethods = {},
+ requestOptions?: PaymentMethods.RequestOptions
+ ): Promise