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..1a55fdb
--- /dev/null
+++ b/.github/workflows/ci.yml
@@ -0,0 +1,57 @@
+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
+
+ publish:
+ needs: [ compile, test ]
+ if: github.event_name == 'push' && contains(github.ref, 'refs/tags/')
+ runs-on: ubuntu-latest
+ steps:
+ - name: Checkout repo
+ uses: actions/checkout@v3
+ - name: Set up node
+ uses: actions/setup-node@v3
+ - name: Install dependencies
+ run: yarn install
+ - name: Build
+ run: yarn build
+
+ - name: Publish to npm
+ run: |
+ npm config set //registry.npmjs.org/:_authToken ${NPM_TOKEN}
+ if [[ ${GITHUB_REF} == *alpha* ]]; then
+ npm publish --access public --tag alpha
+ elif [[ ${GITHUB_REF} == *beta* ]]; then
+ npm publish --access public --tag beta
+ else
+ npm publish --access public
+ fi
+ env:
+ NPM_TOKEN: ${{ secrets.NPM_TOKEN }}
\ No newline at end of file
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/README.md b/README.md
index 555e4ea..36a9837 100644
--- a/README.md
+++ b/README.md
@@ -1,2 +1,137 @@
-# sdk-typescript
-TypeScript SDK generated by Fern
+# Devrev TypeScript Library
+
+[![fern shield](https://img.shields.io/badge/%F0%9F%8C%BF-SDK%20generated%20by%20Fern-brightgreen)](https://github.com/fern-api/fern)
+[![npm shield](https://img.shields.io/npm/v/@devrev/api)](https://www.npmjs.com/package/@devrev/api)
+
+The Devrev TypeScript library provides convenient access to the Devrev API from TypeScript.
+
+## Installation
+
+```sh
+npm i -s @devrev/api
+```
+
+## Usage
+
+Instantiate and use the client with the following:
+
+```typescript
+import { DevRevClient } from "@devrev/api";
+
+const client = new DevRevClient({ token: "YOUR_TOKEN" });
+await client.accounts.create({
+ displayName: "display_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 { DevRev } from "@devrev/api";
+
+const request: DevRev.AccountsCreateRequest = {
+ ...
+};
+```
+
+## 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 { DevRevError } from "@devrev/api";
+
+try {
+ await client.accounts.create(...);
+} catch (err) {
+ if (err instanceof DevRevError) {
+ 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.accounts.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.accounts.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.accounts.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 { DevRevClient } from "@devrev/api";
+
+const client = new DevRevClient({
+ ...
+ 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..03ae68a
--- /dev/null
+++ b/package.json
@@ -0,0 +1,39 @@
+{
+ "name": "@devrev/api",
+ "version": "0.0.14",
+ "private": false,
+ "repository": "https://github.com/devrev/sdk-typescript",
+ "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",
+ "js-base64": "3.7.2"
+ },
+ "devDependencies": {
+ "@types/url-join": "4.0.1",
+ "@types/qs": "6.9.8",
+ "@types/node-fetch": "2.6.9",
+ "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..0dbc2a3
--- /dev/null
+++ b/reference.md
@@ -0,0 +1,4763 @@
+# Reference
+
+## accounts
+
+client.accounts.create({ ...params }) -> DevRev.AccountsCreateResponse
+
+-
+
+#### 📝 Description
+
+
+-
+
+
+-
+
+Creates an account, which is a record representing a customer or an
+organization.
+
+
+
+
+
+
+#### 🔌 Usage
+
+
+-
+
+
+-
+
+```typescript
+await client.accounts.create({
+ displayName: "display_name",
+});
+```
+
+
+
+
+
+
+#### ⚙️ Parameters
+
+
+-
+
+
+-
+
+**request:** `DevRev.AccountsCreateRequest`
+
+
+
+
+
+-
+
+**requestOptions:** `Accounts.RequestOptions`
+
+
+
+
+
+
+
+
+
+
+client.accounts.delete({ ...params }) -> DevRev.AccountsDeleteResponse
+
+-
+
+#### 📝 Description
+
+
+-
+
+
+-
+
+Deletes an account.
+
+
+
+
+
+
+#### 🔌 Usage
+
+
+-
+
+
+-
+
+```typescript
+await client.accounts.delete({
+ id: "ACC-12345",
+});
+```
+
+
+
+
+
+
+#### ⚙️ Parameters
+
+
+-
+
+
+-
+
+**request:** `DevRev.AccountsDeleteRequest`
+
+
+
+
+
+-
+
+**requestOptions:** `Accounts.RequestOptions`
+
+
+
+
+
+
+
+
+
+
+client.accounts.export({ ...params }) -> DevRev.AccountsExportResponse
+
+-
+
+#### 📝 Description
+
+
+-
+
+
+-
+
+Exports a collection of accounts.
+
+
+
+
+
+
+#### 🔌 Usage
+
+
+-
+
+
+-
+
+```typescript
+await client.accounts.export({
+ createdDateAfter: new Date("2023-01-01T12:00:00.000Z"),
+ createdDateBefore: new Date("2023-01-01T12:00:00.000Z"),
+ modifiedDateAfter: new Date("2023-01-01T12:00:00.000Z"),
+ modifiedDateBefore: new Date("2023-01-01T12:00:00.000Z"),
+});
+```
+
+
+
+
+
+
+#### ⚙️ Parameters
+
+
+-
+
+
+-
+
+**request:** `DevRev.AccountsExportQuery`
+
+
+
+
+
+-
+
+**requestOptions:** `Accounts.RequestOptions`
+
+
+
+
+
+
+
+
+
+
+client.accounts.exportPost({ ...params }) -> DevRev.AccountsExportResponse
+
+-
+
+#### 📝 Description
+
+
+-
+
+
+-
+
+Exports a collection of accounts.
+
+
+
+
+
+
+#### 🔌 Usage
+
+
+-
+
+
+-
+
+```typescript
+await client.accounts.exportPost();
+```
+
+
+
+
+
+
+#### ⚙️ Parameters
+
+
+-
+
+
+-
+
+**request:** `DevRev.AccountsExportRequest`
+
+
+
+
+
+-
+
+**requestOptions:** `Accounts.RequestOptions`
+
+
+
+
+
+
+
+
+
+
+client.accounts.get({ ...params }) -> DevRev.AccountsGetResponse
+
+-
+
+#### 📝 Description
+
+
+-
+
+
+-
+
+Retrieves an account's information.
+
+
+
+
+
+
+#### 🔌 Usage
+
+
+-
+
+
+-
+
+```typescript
+await client.accounts.get({
+ id: "ACC-12345",
+});
+```
+
+
+
+
+
+
+#### ⚙️ Parameters
+
+
+-
+
+
+-
+
+**request:** `DevRev.AccountsGetQuery`
+
+
+
+
+
+-
+
+**requestOptions:** `Accounts.RequestOptions`
+
+
+
+
+
+
+
+
+
+
+client.accounts.getPost({ ...params }) -> DevRev.AccountsGetResponse
+
+-
+
+#### 📝 Description
+
+
+-
+
+
+-
+
+Retrieves an account's information.
+
+
+
+
+
+
+#### 🔌 Usage
+
+
+-
+
+
+-
+
+```typescript
+await client.accounts.getPost({
+ id: "ACC-12345",
+});
+```
+
+
+
+
+
+
+#### ⚙️ Parameters
+
+
+-
+
+
+-
+
+**request:** `DevRev.AccountsGetRequest`
+
+
+
+
+
+-
+
+**requestOptions:** `Accounts.RequestOptions`
+
+
+
+
+
+
+
+
+
+
+client.accounts.list({ ...params }) -> DevRev.AccountsListResponse
+
+-
+
+#### 📝 Description
+
+
+-
+
+
+-
+
+Gets a list of accounts.
+
+
+
+
+
+
+#### 🔌 Usage
+
+
+-
+
+
+-
+
+```typescript
+await client.accounts.list({
+ createdDateAfter: new Date("2023-01-01T12:00:00.000Z"),
+ createdDateBefore: new Date("2023-01-01T12:00:00.000Z"),
+ modifiedDateAfter: new Date("2023-01-01T12:00:00.000Z"),
+ modifiedDateBefore: new Date("2023-01-01T12:00:00.000Z"),
+});
+```
+
+
+
+
+
+
+#### ⚙️ Parameters
+
+
+-
+
+
+-
+
+**request:** `DevRev.AccountsListQuery`
+
+
+
+
+
+-
+
+**requestOptions:** `Accounts.RequestOptions`
+
+
+
+
+
+
+
+
+
+
+client.accounts.listPost({ ...params }) -> DevRev.AccountsListResponse
+
+-
+
+#### 📝 Description
+
+
+-
+
+
+-
+
+Gets a list of accounts.
+
+
+
+
+
+
+#### 🔌 Usage
+
+
+-
+
+
+-
+
+```typescript
+await client.accounts.listPost();
+```
+
+
+
+
+
+
+#### ⚙️ Parameters
+
+
+-
+
+
+-
+
+**request:** `DevRev.AccountsListRequest`
+
+
+
+
+
+-
+
+**requestOptions:** `Accounts.RequestOptions`
+
+
+
+
+
+
+
+
+
+
+client.accounts.update({ ...params }) -> DevRev.AccountsUpdateResponse
+
+-
+
+#### 📝 Description
+
+
+-
+
+
+-
+
+Updates an account's information.
+
+
+
+
+
+
+#### 🔌 Usage
+
+
+-
+
+
+-
+
+```typescript
+await client.accounts.update({
+ id: "ACC-12345",
+});
+```
+
+
+
+
+
+
+#### ⚙️ Parameters
+
+
+-
+
+
+-
+
+**request:** `DevRev.AccountsUpdateRequest`
+
+
+
+
+
+-
+
+**requestOptions:** `Accounts.RequestOptions`
+
+
+
+
+
+
+
+
+
+
+## articles
+
+client.articles.count({ ...params }) -> DevRev.ArticlesCountResponse
+
+-
+
+#### 📝 Description
+
+
+-
+
+
+-
+
+Get count of articles matching given filter.
+
+
+
+
+
+
+#### 🔌 Usage
+
+
+-
+
+
+-
+
+```typescript
+await client.articles.count();
+```
+
+
+
+
+
+
+#### ⚙️ Parameters
+
+
+-
+
+
+-
+
+**request:** `DevRev.ArticlesCountQuery`
+
+
+
+
+
+-
+
+**requestOptions:** `Articles.RequestOptions`
+
+
+
+
+
+
+
+
+
+
+client.articles.countPost({ ...params }) -> DevRev.ArticlesCountResponse
+
+-
+
+#### 📝 Description
+
+
+-
+
+
+-
+
+Get count of articles matching given filter.
+
+
+
+
+
+
+#### 🔌 Usage
+
+
+-
+
+
+-
+
+```typescript
+await client.articles.countPost();
+```
+
+
+
+
+
+
+#### ⚙️ Parameters
+
+
+-
+
+
+-
+
+**request:** `DevRev.ArticlesCountRequest`
+
+
+
+
+
+-
+
+**requestOptions:** `Articles.RequestOptions`
+
+
+
+
+
+
+
+
+
+
+client.articles.create({ ...params }) -> DevRev.ArticlesCreateResponse
+
+-
+
+#### 📝 Description
+
+
+-
+
+
+-
+
+Article is an object which can contain a URL or artifacts in the
+resource. It also contains the data regarding the owner, author, status
+and published date of the object. This call creates an article.
+
+
+
+
+
+
+#### 🔌 Usage
+
+
+-
+
+
+-
+
+```typescript
+await client.articles.create({
+ appliesToParts: ["PROD-12345"],
+ ownedBy: ["DEVU-12345"],
+ resource: {},
+ title: "title",
+});
+```
+
+
+
+
+
+
+#### ⚙️ Parameters
+
+
+-
+
+
+-
+
+**request:** `DevRev.ArticlesCreateRequest`
+
+
+
+
+
+-
+
+**requestOptions:** `Articles.RequestOptions`
+
+
+
+
+
+
+
+
+
+
+client.articles.delete({ ...params }) -> DevRev.ArticlesDeleteResponse
+
+-
+
+#### 📝 Description
+
+
+-
+
+
+-
+
+Deletes an article.
+
+
+
+
+
+
+#### 🔌 Usage
+
+
+-
+
+
+-
+
+```typescript
+await client.articles.delete({
+ id: "ARTICLE-12345",
+});
+```
+
+
+
+
+
+
+#### ⚙️ Parameters
+
+
+-
+
+
+-
+
+**request:** `DevRev.ArticlesDeleteRequest`
+
+
+
+
+
+-
+
+**requestOptions:** `Articles.RequestOptions`
+
+
+
+
+
+
+
+
+
+
+client.articles.get({ ...params }) -> DevRev.ArticlesGetResponse
+
+-
+
+#### 📝 Description
+
+
+-
+
+
+-
+
+Gets an article.
+
+
+
+
+
+
+#### 🔌 Usage
+
+
+-
+
+
+-
+
+```typescript
+await client.articles.get({
+ id: "ARTICLE-12345",
+});
+```
+
+
+
+
+
+
+#### ⚙️ Parameters
+
+
+-
+
+
+-
+
+**request:** `DevRev.GetArticleQuery`
+
+
+
+
+
+-
+
+**requestOptions:** `Articles.RequestOptions`
+
+
+
+
+
+
+
+
+
+
+client.articles.getPost({ ...params }) -> DevRev.ArticlesGetResponse
+
+-
+
+#### 📝 Description
+
+
+-
+
+
+-
+
+Gets an article.
+
+
+
+
+
+
+#### 🔌 Usage
+
+
+-
+
+
+-
+
+```typescript
+await client.articles.getPost({
+ id: "ARTICLE-12345",
+});
+```
+
+
+
+
+
+
+#### ⚙️ Parameters
+
+
+-
+
+
+-
+
+**request:** `DevRev.ArticlesGetRequest`
+
+
+
+
+
+-
+
+**requestOptions:** `Articles.RequestOptions`
+
+
+
+
+
+
+
+
+
+
+client.articles.list({ ...params }) -> DevRev.ArticlesListResponse
+
+-
+
+#### 📝 Description
+
+
+-
+
+
+-
+
+Lists a collection of articles.
+
+
+
+
+
+
+#### 🔌 Usage
+
+
+-
+
+
+-
+
+```typescript
+await client.articles.list();
+```
+
+
+
+
+
+
+#### ⚙️ Parameters
+
+
+-
+
+
+-
+
+**request:** `DevRev.ListArticlesQuery`
+
+
+
+
+
+-
+
+**requestOptions:** `Articles.RequestOptions`
+
+
+
+
+
+
+
+
+
+
+client.articles.listPost({ ...params }) -> DevRev.ArticlesListResponse
+
+-
+
+#### 📝 Description
+
+
+-
+
+
+-
+
+Lists a collection of articles.
+
+
+
+
+
+
+#### 🔌 Usage
+
+
+-
+
+
+-
+
+```typescript
+await client.articles.listPost();
+```
+
+
+
+
+
+
+#### ⚙️ Parameters
+
+
+-
+
+
+-
+
+**request:** `DevRev.ArticlesListRequest`
+
+
+
+
+
+-
+
+**requestOptions:** `Articles.RequestOptions`
+
+
+
+
+
+
+
+
+
+
+client.articles.update({ ...params }) -> DevRev.ArticlesUpdateResponse
+
+-
+
+#### 📝 Description
+
+
+-
+
+
+-
+
+Updates an article.
+
+
+
+
+
+
+#### 🔌 Usage
+
+
+-
+
+
+-
+
+```typescript
+await client.articles.update({
+ id: "ARTICLE-12345",
+});
+```
+
+
+
+
+
+
+#### ⚙️ Parameters
+
+
+-
+
+
+-
+
+**request:** `DevRev.ArticlesUpdateRequest`
+
+
+
+
+
+-
+
+**requestOptions:** `Articles.RequestOptions`
+
+
+
+
+
+
+
+
+
+
+## artifacts
+
+client.artifacts.prepare({ ...params }) -> DevRev.ArtifactsPrepareResponse
+
+-
+
+#### 📝 Description
+
+
+-
+
+
+-
+
+Creates an artifact and generates an upload URL for its data.
+
+
+
+
+
+
+#### 🔌 Usage
+
+
+-
+
+
+-
+
+```typescript
+await client.artifacts.prepare({
+ fileName: "file_name",
+});
+```
+
+
+
+
+
+
+#### ⚙️ Parameters
+
+
+-
+
+
+-
+
+**request:** `DevRev.ArtifactsPrepareRequest`
+
+
+
+
+
+-
+
+**requestOptions:** `Artifacts.RequestOptions`
+
+
+
+
+
+
+
+
+
+
+client.artifacts.versionsPrepare({ ...params }) -> DevRev.ArtifactsVersionsPrepareResponse
+
+-
+
+#### 📝 Description
+
+
+-
+
+
+-
+
+Prepares a new version for an artifact, returning the URL and form data
+to upload the updated file.
+
+
+
+
+
+
+#### 🔌 Usage
+
+
+-
+
+
+-
+
+```typescript
+await client.artifacts.versionsPrepare({
+ id: "ARTIFACT-12345",
+});
+```
+
+
+
+
+
+
+#### ⚙️ Parameters
+
+
+-
+
+
+-
+
+**request:** `DevRev.ArtifactsVersionsPrepareRequest`
+
+
+
+
+
+-
+
+**requestOptions:** `Artifacts.RequestOptions`
+
+
+
+
+
+
+
+
+
+
+## code-changes
+
+client.codeChanges.create({ ...params }) -> DevRev.CodeChangesCreateResponse
+
+-
+
+#### 📝 Description
+
+
+-
+
+
+-
+
+Creates a code change object.
+
+
+
+
+
+
+#### 🔌 Usage
+
+
+-
+
+
+-
+
+```typescript
+await client.codeChanges.create({
+ key: "value",
+});
+```
+
+
+
+
+
+
+#### ⚙️ Parameters
+
+
+-
+
+
+-
+
+**request:** `DevRev.CodeChangesCreateRequest`
+
+
+
+
+
+-
+
+**requestOptions:** `CodeChanges.RequestOptions`
+
+
+
+
+
+
+
+
+
+
+client.codeChanges.delete({ ...params }) -> DevRev.CodeChangesDeleteResponse
+
+-
+
+#### 📝 Description
+
+
+-
+
+
+-
+
+Deletes a code change object.
+
+
+
+
+
+
+#### 🔌 Usage
+
+
+-
+
+
+-
+
+```typescript
+await client.codeChanges.delete({
+ id: "id",
+});
+```
+
+
+
+
+
+
+#### ⚙️ Parameters
+
+
+-
+
+
+-
+
+**request:** `DevRev.CodeChangesDeleteRequest`
+
+
+
+
+
+-
+
+**requestOptions:** `CodeChanges.RequestOptions`
+
+
+
+
+
+
+
+
+
+
+client.codeChanges.get({ ...params }) -> DevRev.CodeChangesGetResponse
+
+-
+
+#### 📝 Description
+
+
+-
+
+
+-
+
+Gets a code change object.
+
+
+
+
+
+
+#### 🔌 Usage
+
+
+-
+
+
+-
+
+```typescript
+await client.codeChanges.get({
+ id: "id",
+});
+```
+
+
+
+
+
+
+#### ⚙️ Parameters
+
+
+-
+
+
+-
+
+**request:** `DevRev.CodeChangesGetQuery`
+
+
+
+
+
+-
+
+**requestOptions:** `CodeChanges.RequestOptions`
+
+
+
+
+
+
+
+
+
+
+client.codeChanges.getPost({ ...params }) -> DevRev.CodeChangesGetResponse
+
+-
+
+#### 📝 Description
+
+
+-
+
+
+-
+
+Gets a code change object.
+
+
+
+
+
+
+#### 🔌 Usage
+
+
+-
+
+
+-
+
+```typescript
+await client.codeChanges.getPost({
+ id: "id",
+});
+```
+
+
+
+
+
+
+#### ⚙️ Parameters
+
+
+-
+
+
+-
+
+**request:** `DevRev.CodeChangesGetRequest`
+
+
+
+
+
+-
+
+**requestOptions:** `CodeChanges.RequestOptions`
+
+
+
+
+
+
+
+
+
+
+client.codeChanges.list({ ...params }) -> DevRev.CodeChangesListResponse
+
+-
+
+#### 📝 Description
+
+
+-
+
+
+-
+
+Lists code change objects.
+
+
+
+
+
+
+#### 🔌 Usage
+
+
+-
+
+
+-
+
+```typescript
+await client.codeChanges.list();
+```
+
+
+
+
+
+
+#### ⚙️ Parameters
+
+
+-
+
+
+-
+
+**request:** `DevRev.CodeChangesListQuery`
+
+
+
+
+
+-
+
+**requestOptions:** `CodeChanges.RequestOptions`
+
+
+
+
+
+
+
+
+
+
+client.codeChanges.listPost({ ...params }) -> DevRev.CodeChangesListResponse
+
+-
+
+#### 📝 Description
+
+
+-
+
+
+-
+
+Lists code change objects.
+
+
+
+
+
+
+#### 🔌 Usage
+
+
+-
+
+
+-
+
+```typescript
+await client.codeChanges.listPost();
+```
+
+
+
+
+
+
+#### ⚙️ Parameters
+
+
+-
+
+
+-
+
+**request:** `DevRev.CodeChangesListRequest`
+
+
+
+
+
+-
+
+**requestOptions:** `CodeChanges.RequestOptions`
+
+
+
+
+
+
+
+
+
+
+client.codeChanges.update({ ...params }) -> DevRev.CodeChangesUpdateResponse
+
+-
+
+#### 📝 Description
+
+
+-
+
+
+-
+
+Updates a code change object.
+
+
+
+
+
+
+#### 🔌 Usage
+
+
+-
+
+
+-
+
+```typescript
+await client.codeChanges.update({
+ id: "id",
+});
+```
+
+
+
+
+
+
+#### ⚙️ Parameters
+
+
+-
+
+
+-
+
+**request:** `DevRev.CodeChangesUpdateRequest`
+
+
+
+
+
+-
+
+**requestOptions:** `CodeChanges.RequestOptions`
+
+
+
+
+
+
+
+
+
+
+## conversations
+
+client.conversations.create({ ...params }) -> DevRev.ConversationsCreateResponse
+
+-
+
+#### 📝 Description
+
+
+-
+
+
+-
+
+Creates a conversation.
+
+
+
+
+
+
+#### 🔌 Usage
+
+
+-
+
+
+-
+
+```typescript
+await client.conversations.create({
+ type: "support",
+});
+```
+
+
+
+
+
+
+#### ⚙️ Parameters
+
+
+-
+
+
+-
+
+**request:** `DevRev.ConversationsCreateRequest`
+
+
+
+
+
+-
+
+**requestOptions:** `Conversations.RequestOptions`
+
+
+
+
+
+
+
+
+
+
+client.conversations.delete({ ...params }) -> DevRev.ConversationsDeleteResponse
+
+-
+
+#### 📝 Description
+
+
+-
+
+
+-
+
+Deletes the requested conversation.
+
+
+
+
+
+
+#### 🔌 Usage
+
+
+-
+
+
+-
+
+```typescript
+await client.conversations.delete({
+ id: "id",
+});
+```
+
+
+
+
+
+
+#### ⚙️ Parameters
+
+
+-
+
+
+-
+
+**request:** `DevRev.ConversationsDeleteRequest`
+
+
+
+
+
+-
+
+**requestOptions:** `Conversations.RequestOptions`
+
+
+
+
+
+
+
+
+
+
+client.conversations.export({ ...params }) -> DevRev.ConversationsExportResponse
+
+-
+
+#### 📝 Description
+
+
+-
+
+
+-
+
+Exports a collection of conversation items.
+
+
+
+
+
+
+#### 🔌 Usage
+
+
+-
+
+
+-
+
+```typescript
+await client.conversations.export({
+ tagsV2Id: "TAG-12345",
+});
+```
+
+
+
+
+
+
+#### ⚙️ Parameters
+
+
+-
+
+
+-
+
+**request:** `DevRev.ConversationsExportQuery`
+
+
+
+
+
+-
+
+**requestOptions:** `Conversations.RequestOptions`
+
+
+
+
+
+
+
+
+
+
+client.conversations.exportPost({ ...params }) -> DevRev.ConversationsExportResponse
+
+-
+
+#### 📝 Description
+
+
+-
+
+
+-
+
+Exports a collection of conversation items.
+
+
+
+
+
+
+#### 🔌 Usage
+
+
+-
+
+
+-
+
+```typescript
+await client.conversations.exportPost();
+```
+
+
+
+
+
+
+#### ⚙️ Parameters
+
+
+-
+
+
+-
+
+**request:** `DevRev.ConversationsExportRequest`
+
+
+
+
+
+-
+
+**requestOptions:** `Conversations.RequestOptions`
+
+
+
+
+
+
+
+
+
+
+client.conversations.get({ ...params }) -> DevRev.ConversationsGetResponse
+
+-
+
+#### 📝 Description
+
+
+-
+
+
+-
+
+Gets the requested conversation's information.
+
+
+
+
+
+
+#### 🔌 Usage
+
+
+-
+
+
+-
+
+```typescript
+await client.conversations.get({
+ id: "id",
+});
+```
+
+
+
+
+
+
+#### ⚙️ Parameters
+
+
+-
+
+
+-
+
+**request:** `DevRev.ConversationsGetQuery`
+
+
+
+
+
+-
+
+**requestOptions:** `Conversations.RequestOptions`
+
+
+
+
+
+
+
+
+
+
+client.conversations.getPost({ ...params }) -> DevRev.ConversationsGetResponse
+
+-
+
+#### 📝 Description
+
+
+-
+
+
+-
+
+Gets the requested conversation's information.
+
+
+
+
+
+
+#### 🔌 Usage
+
+
+-
+
+
+-
+
+```typescript
+await client.conversations.getPost({
+ id: "id",
+});
+```
+
+
+
+
+
+
+#### ⚙️ Parameters
+
+
+-
+
+
+-
+
+**request:** `DevRev.ConversationsGetRequest`
+
+
+
+
+
+-
+
+**requestOptions:** `Conversations.RequestOptions`
+
+
+
+
+
+
+
+
+
+
+client.conversations.list({ ...params }) -> DevRev.ConversationsListResponse
+
+-
+
+#### 📝 Description
+
+
+-
+
+
+-
+
+Lists the available conversations.
+
+
+
+
+
+
+#### 🔌 Usage
+
+
+-
+
+
+-
+
+```typescript
+await client.conversations.list({
+ tagsV2Id: "TAG-12345",
+});
+```
+
+
+
+
+
+
+#### ⚙️ Parameters
+
+
+-
+
+
+-
+
+**request:** `DevRev.ConversationsListQuery`
+
+
+
+
+
+-
+
+**requestOptions:** `Conversations.RequestOptions`
+
+
+
+
+
+
+
+
+
+
+client.conversations.listPost({ ...params }) -> DevRev.ConversationsListResponse
+
+-
+
+#### 📝 Description
+
+
+-
+
+
+-
+
+Lists the available conversations.
+
+
+
+
+
+
+#### 🔌 Usage
+
+
+-
+
+
+-
+
+```typescript
+await client.conversations.listPost();
+```
+
+
+
+
+
+
+#### ⚙️ Parameters
+
+
+-
+
+
+-
+
+**request:** `DevRev.ConversationsListRequest`
+
+
+
+
+
+-
+
+**requestOptions:** `Conversations.RequestOptions`
+
+
+
+
+
+
+
+
+
+
+client.conversations.update({ ...params }) -> DevRev.ConversationsUpdateResponse
+
+-
+
+#### 📝 Description
+
+
+-
+
+
+-
+
+Updates the requested conversation.
+
+
+
+
+
+
+#### 🔌 Usage
+
+
+-
+
+
+-
+
+```typescript
+await client.conversations.update({
+ id: "id",
+});
+```
+
+
+
+
+
+
+#### ⚙️ Parameters
+
+
+-
+
+
+-
+
+**request:** `DevRev.ConversationsUpdateRequest`
+
+
+
+
+
+-
+
+**requestOptions:** `Conversations.RequestOptions`
+
+
+
+
+
+
+
+
+
+
+## dev-users
+
+client.devUsers.identitiesLink({ ...params }) -> DevRev.DevUsersIdentitiesLinkResponse
+
+-
+
+#### 📝 Description
+
+
+-
+
+
+-
+
+Links an external/secondary identity to the Dev user.
+
+
+
+
+
+
+#### 🔌 Usage
+
+
+-
+
+
+-
+
+```typescript
+await client.devUsers.identitiesLink({
+ devUser: "dev_user",
+ id: "id",
+ issuer: "issuer",
+});
+```
+
+
+
+
+
+
+#### ⚙️ Parameters
+
+
+-
+
+
+-
+
+**request:** `DevRev.DevUsersIdentitiesLinkRequest`
+
+
+
+
+
+-
+
+**requestOptions:** `DevUsers.RequestOptions`
+
+
+
+
+
+
+
+
+
+
+client.devUsers.identitiesUnlink({ ...params }) -> DevRev.DevUsersIdentitiesUnlinkResponse
+
+-
+
+#### 📝 Description
+
+
+-
+
+
+-
+
+Unlinks an external/secondary identity from the Dev user.
+
+
+
+
+
+
+#### 🔌 Usage
+
+
+-
+
+
+-
+
+```typescript
+await client.devUsers.identitiesUnlink({
+ devUser: "dev_user",
+ issuer: "issuer",
+});
+```
+
+
+
+
+
+
+#### ⚙️ Parameters
+
+
+-
+
+
+-
+
+**request:** `DevRev.DevUsersIdentitiesUnlinkRequest`
+
+
+
+
+
+-
+
+**requestOptions:** `DevUsers.RequestOptions`
+
+
+
+
+
+
+
+
+
+
+client.devUsers.selfUpdate({ ...params }) -> DevRev.DevUsersUpdateResponse
+
+-
+
+#### 📝 Description
+
+
+-
+
+
+-
+
+Updates the authenticated user.
+
+
+
+
+
+
+#### 🔌 Usage
+
+
+-
+
+
+-
+
+```typescript
+await client.devUsers.selfUpdate();
+```
+
+
+
+
+
+
+#### ⚙️ Parameters
+
+
+-
+
+
+-
+
+**request:** `DevRev.DevUsersSelfUpdateRequest`
+
+
+
+
+
+-
+
+**requestOptions:** `DevUsers.RequestOptions`
+
+
+
+
+
+
+
+
+
+
+client.devUsers.update({ ...params }) -> DevRev.DevUsersUpdateResponse
+
+-
+
+#### 📝 Description
+
+
+-
+
+
+-
+
+Updates the user corresponding to the input Id.
+
+
+
+
+
+
+#### 🔌 Usage
+
+
+-
+
+
+-
+
+```typescript
+await client.devUsers.update({
+ id: "id",
+});
+```
+
+
+
+
+
+
+#### ⚙️ Parameters
+
+
+-
+
+
+-
+
+**request:** `DevRev.DevUsersUpdateRequest`
+
+
+
+
+
+-
+
+**requestOptions:** `DevUsers.RequestOptions`
+
+
+
+
+
+
+
+
+
+
+## engagements
+
+client.engagements.count({ ...params }) -> DevRev.EngagementsCountResponse
+
+-
+
+#### 📝 Description
+
+
+-
+
+
+-
+
+Counts the engagement records.
+
+
+
+
+
+
+#### 🔌 Usage
+
+
+-
+
+
+-
+
+```typescript
+await client.engagements.count();
+```
+
+
+
+
+
+
+#### ⚙️ Parameters
+
+
+-
+
+
+-
+
+**request:** `DevRev.EngagementsCountQuery`
+
+
+
+
+
+-
+
+**requestOptions:** `Engagements.RequestOptions`
+
+
+
+
+
+
+
+
+
+
+client.engagements.countPost({ ...params }) -> DevRev.EngagementsCountResponse
+
+-
+
+#### 📝 Description
+
+
+-
+
+
+-
+
+Counts the engagement records.
+
+
+
+
+
+
+#### 🔌 Usage
+
+
+-
+
+
+-
+
+```typescript
+await client.engagements.countPost();
+```
+
+
+
+
+
+
+#### ⚙️ Parameters
+
+
+-
+
+
+-
+
+**request:** `DevRev.EngagementsCountRequest`
+
+
+
+
+
+-
+
+**requestOptions:** `Engagements.RequestOptions`
+
+
+
+
+
+
+
+
+
+
+client.engagements.create({ ...params }) -> DevRev.EngagementsCreateResponse
+
+-
+
+#### 📝 Description
+
+
+-
+
+
+-
+
+Creates a new engagement record.
+
+
+
+
+
+
+#### 🔌 Usage
+
+
+-
+
+
+-
+
+```typescript
+await client.engagements.create({
+ members: ["DEVU-12345"],
+ parent: "ACC-12345",
+ scheduledDate: new Date("2023-01-01T12:00:00.000Z"),
+ title: "title",
+});
+```
+
+
+
+
+
+
+#### ⚙️ Parameters
+
+
+-
+
+
+-
+
+**request:** `DevRev.EngagementsCreateRequest`
+
+
+
+
+
+-
+
+**requestOptions:** `Engagements.RequestOptions`
+
+
+
+
+
+
+
+
+
+
+client.engagements.delete({ ...params }) -> DevRev.EngagementsDeleteResponse
+
+-
+
+#### 📝 Description
+
+
+-
+
+
+-
+
+Deletes the engagement record.
+
+
+
+
+
+
+#### 🔌 Usage
+
+
+-
+
+
+-
+
+```typescript
+await client.engagements.delete({
+ id: "id",
+});
+```
+
+
+
+
+
+
+#### ⚙️ Parameters
+
+
+-
+
+
+-
+
+**request:** `DevRev.EngagementsDeleteRequest`
+
+
+
+
+
+-
+
+**requestOptions:** `Engagements.RequestOptions`
+
+
+
+
+
+
+
+
+
+
+client.engagements.get({ ...params }) -> DevRev.EngagementsGetResponse
+
+-
+
+#### 📝 Description
+
+
+-
+
+
+-
+
+Gets the engagement record.
+
+
+
+
+
+
+#### 🔌 Usage
+
+
+-
+
+
+-
+
+```typescript
+await client.engagements.get({
+ id: "id",
+});
+```
+
+
+
+
+
+
+#### ⚙️ Parameters
+
+
+-
+
+
+-
+
+**request:** `DevRev.EngagementsGetQuery`
+
+
+
+
+
+-
+
+**requestOptions:** `Engagements.RequestOptions`
+
+
+
+
+
+
+
+
+
+
+client.engagements.getPost({ ...params }) -> DevRev.EngagementsGetResponse
+
+-
+
+#### 📝 Description
+
+
+-
+
+
+-
+
+Gets the engagement record.
+
+
+
+
+
+
+#### 🔌 Usage
+
+
+-
+
+
+-
+
+```typescript
+await client.engagements.getPost({
+ id: "id",
+});
+```
+
+
+
+
+
+
+#### ⚙️ Parameters
+
+
+-
+
+
+-
+
+**request:** `DevRev.EngagementsGetRequest`
+
+
+
+
+
+-
+
+**requestOptions:** `Engagements.RequestOptions`
+
+
+
+
+
+
+
+
+
+
+client.engagements.list({ ...params }) -> DevRev.EngagementsListResponse
+
+-
+
+#### 📝 Description
+
+
+-
+
+
+-
+
+Lists the engagement records.
+
+
+
+
+
+
+#### 🔌 Usage
+
+
+-
+
+
+-
+
+```typescript
+await client.engagements.list();
+```
+
+
+
+
+
+
+#### ⚙️ Parameters
+
+
+-
+
+
+-
+
+**request:** `DevRev.EngagementsListQuery`
+
+
+
+
+
+-
+
+**requestOptions:** `Engagements.RequestOptions`
+
+
+
+
+
+
+
+
+
+
+client.engagements.listPost({ ...params }) -> DevRev.EngagementsListResponse
+
+-
+
+#### 📝 Description
+
+
+-
+
+
+-
+
+Lists the engagement records.
+
+
+
+
+
+
+#### 🔌 Usage
+
+
+-
+
+
+-
+
+```typescript
+await client.engagements.listPost();
+```
+
+
+
+
+
+
+#### ⚙️ Parameters
+
+
+-
+
+
+-
+
+**request:** `DevRev.EngagementsListRequest`
+
+
+
+
+
+-
+
+**requestOptions:** `Engagements.RequestOptions`
+
+
+
+
+
+
+
+
+
+
+client.engagements.update({ ...params }) -> DevRev.EngagementsUpdateResponse
+
+-
+
+#### 📝 Description
+
+
+-
+
+
+-
+
+Updates the engagement record.
+
+
+
+
+
+
+#### 🔌 Usage
+
+
+-
+
+
+-
+
+```typescript
+await client.engagements.update({
+ id: "id",
+});
+```
+
+
+
+
+
+
+#### ⚙️ Parameters
+
+
+-
+
+
+-
+
+**request:** `DevRev.EngagementsUpdateRequest`
+
+
+
+
+
+-
+
+**requestOptions:** `Engagements.RequestOptions`
+
+
+
+
+
+
+
+
+
+
+## event-source
+
+client.eventSource.get({ ...params }) -> DevRev.EventSourceGetResponse
+
+-
+
+#### 📝 Description
+
+
+-
+
+
+-
+
+Gets an event source.
+
+
+
+
+
+
+#### 🔌 Usage
+
+
+-
+
+
+-
+
+```typescript
+await client.eventSource.get({
+ id: "id",
+});
+```
+
+
+
+
+
+
+#### ⚙️ Parameters
+
+
+-
+
+
+-
+
+**request:** `DevRev.EventSourcesGetQuery`
+
+
+
+
+
+-
+
+**requestOptions:** `EventSource.RequestOptions`
+
+
+
+
+
+
+
+
+
+
+client.eventSource.getPost({ ...params }) -> DevRev.EventSourceGetResponse
+
+-
+
+#### 📝 Description
+
+
+-
+
+
+-
+
+Gets an event source.
+
+
+
+
+
+
+#### 🔌 Usage
+
+
+-
+
+
+-
+
+```typescript
+await client.eventSource.getPost({
+ id: "id",
+});
+```
+
+
+
+
+
+
+#### ⚙️ Parameters
+
+
+-
+
+
+-
+
+**request:** `DevRev.EventSourceGetRequest`
+
+
+
+
+
+-
+
+**requestOptions:** `EventSource.RequestOptions`
+
+
+
+
+
+
+
+
+
+
+client.eventSource.scheduleEvent({ ...params }) -> DevRev.EventSourcesScheduleEventResponse
+
+-
+
+#### 📝 Description
+
+
+-
+
+
+-
+
+Schedules an event to be published to the specified event source.
+
+
+
+
+
+
+#### 🔌 Usage
+
+
+-
+
+
+-
+
+```typescript
+await client.eventSource.scheduleEvent({
+ eventType: "event_type",
+ id: "id",
+ payload: "payload",
+});
+```
+
+
+
+
+
+
+#### ⚙️ Parameters
+
+
+-
+
+
+-
+
+**request:** `DevRev.EventSourcesScheduleEventRequest`
+
+
+
+
+
+-
+
+**requestOptions:** `EventSource.RequestOptions`
+
+
+
+
+
+
+
+
+
+
+client.eventSource.deleteScheduledEvent({ ...params }) -> void
+
+-
+
+#### 📝 Description
+
+
+-
+
+
+-
+
+Deletes an event scheduled for the specified event source.
+
+
+
+
+
+
+#### 🔌 Usage
+
+
+-
+
+
+-
+
+```typescript
+await client.eventSource.deleteScheduledEvent({
+ eventKey: "event_key",
+ id: "id",
+});
+```
+
+
+
+
+
+
+#### ⚙️ Parameters
+
+
+-
+
+
+-
+
+**request:** `DevRev.EventSourcesDeleteScheduledEventRequest`
+
+
+
+
+
+-
+
+**requestOptions:** `EventSource.RequestOptions`
+
+
+
+
+
+
+
+
+
+
+client.eventSource.trackEventsPublish({ ...params }) -> DevRev.TrackEventsPublishResponse
+
+-
+
+#### 📝 Description
+
+
+-
+
+
+-
+
+Allows publishing of events (example from plug widget).
+
+
+
+
+
+
+#### 🔌 Usage
+
+
+-
+
+
+-
+
+```typescript
+await client.eventSource.trackEventsPublish({
+ eventsList: [
+ {
+ name: "name",
+ payload: {
+ key: "value",
+ },
+ },
+ ],
+});
+```
+
+
+
+
+
+
+#### ⚙️ Parameters
+
+
+-
+
+
+-
+
+**request:** `DevRev.TrackEventsPublishRequest`
+
+
+
+
+
+-
+
+**requestOptions:** `EventSource.RequestOptions`
+
+
+
+
+
+
+
+
+
+
+## groups
+
+client.groups.create({ ...params }) -> DevRev.GroupsCreateResponse
+
+-
+
+#### 📝 Description
+
+
+-
+
+
+-
+
+Creates a new group. A group is a collection of users.
+
+
+
+
+
+
+#### 🔌 Usage
+
+
+-
+
+
+-
+
+```typescript
+await client.groups.create({
+ description: "description",
+ name: "name",
+});
+```
+
+
+
+
+
+
+#### ⚙️ Parameters
+
+
+-
+
+
+-
+
+**request:** `DevRev.GroupsCreateRequest`
+
+
+
+
+
+-
+
+**requestOptions:** `Groups.RequestOptions`
+
+
+
+
+
+
+
+
+
+
+client.groups.get({ ...params }) -> DevRev.GroupsGetResponse
+
+-
+
+#### 📝 Description
+
+
+-
+
+
+-
+
+Gets the requested group.
+
+
+
+
+
+
+#### 🔌 Usage
+
+
+-
+
+
+-
+
+```typescript
+await client.groups.get({
+ id: "id",
+});
+```
+
+
+
+
+
+
+#### ⚙️ Parameters
+
+
+-
+
+
+-
+
+**request:** `DevRev.GroupsGetQuery`
+
+
+
+
+
+-
+
+**requestOptions:** `Groups.RequestOptions`
+
+
+
+
+
+
+
+
+
+
+client.groups.getPost({ ...params }) -> DevRev.GroupsGetResponse
+
+-
+
+#### 📝 Description
+
+
+-
+
+
+-
+
+Gets the requested group.
+
+
+
+
+
+
+#### 🔌 Usage
+
+
+-
+
+
+-
+
+```typescript
+await client.groups.getPost({
+ id: "id",
+});
+```
+
+
+
+
+
+
+#### ⚙️ Parameters
+
+
+-
+
+
+-
+
+**request:** `DevRev.GroupsGetRequest`
+
+
+
+
+
+-
+
+**requestOptions:** `Groups.RequestOptions`
+
+
+
+
+
+
+
+
+
+
+client.groups.list({ ...params }) -> DevRev.GroupsListResponse
+
+-
+
+#### 📝 Description
+
+
+-
+
+
+-
+
+Lists the available groups.
+
+
+
+
+
+
+#### 🔌 Usage
+
+
+-
+
+
+-
+
+```typescript
+await client.groups.list();
+```
+
+
+
+
+
+
+#### ⚙️ Parameters
+
+
+-
+
+
+-
+
+**request:** `DevRev.GroupsListQuery`
+
+
+
+
+
+-
+
+**requestOptions:** `Groups.RequestOptions`
+
+
+
+
+
+
+
+
+
+
+client.groups.listPost({ ...params }) -> DevRev.GroupsListResponse
+
+-
+
+#### 📝 Description
+
+
+-
+
+
+-
+
+Lists the available groups.
+
+
+
+
+
+
+#### 🔌 Usage
+
+
+-
+
+
+-
+
+```typescript
+await client.groups.listPost();
+```
+
+
+
+
+
+
+#### ⚙️ Parameters
+
+
+-
+
+
+-
+
+**request:** `DevRev.GroupsListRequest`
+
+
+
+
+
+-
+
+**requestOptions:** `Groups.RequestOptions`
+
+
+
+
+
+
+
+
+
+
+client.groups.groupMembersAdd({ ...params }) -> DevRev.GroupMembersAddResponse
+
+-
+
+#### 📝 Description
+
+
+-
+
+
+-
+
+Adds a member to a group.
+
+
+
+
+
+
+#### 🔌 Usage
+
+
+-
+
+
+-
+
+```typescript
+await client.groups.groupMembersAdd({
+ group: "group",
+ member: "DEVU-12345",
+});
+```
+
+
+
+
+
+
+#### ⚙️ Parameters
+
+
+-
+
+
+-
+
+**request:** `DevRev.GroupMembersAddRequest`
+
+
+
+
+
+-
+
+**requestOptions:** `Groups.RequestOptions`
+
+
+
+
+
+
+
+
+
+
+client.groups.groupMembersList({ ...params }) -> DevRev.GroupMembersListResponse
+
+-
+
+#### 📝 Description
+
+
+-
+
+
+-
+
+Lists the members in a group.
+
+
+
+
+
+
+#### 🔌 Usage
+
+
+-
+
+
+-
+
+```typescript
+await client.groups.groupMembersList({
+ group: "group",
+});
+```
+
+
+
+
+
+
+#### ⚙️ Parameters
+
+
+-
+
+
+-
+
+**request:** `DevRev.GroupMembersListQuery`
+
+
+
+
+
+-
+
+**requestOptions:** `Groups.RequestOptions`
+
+
+
+
+
+
+
+
+
+
+client.groups.groupMembersListPost({ ...params }) -> DevRev.GroupMembersListResponse
+
+-
+
+#### 📝 Description
+
+
+-
+
+
+-
+
+Lists the members in a group.
+
+
+
+
+
+
+#### 🔌 Usage
+
+
+-
+
+
+-
+
+```typescript
+await client.groups.groupMembersListPost({
+ group: "group",
+});
+```
+
+
+
+
+
+
+#### ⚙️ Parameters
+
+
+-
+
+
+-
+
+**request:** `DevRev.GroupMembersListRequest`
+
+
+
+
+
+-
+
+**requestOptions:** `Groups.RequestOptions`
+
+
+
+
+
+
+
+
+
+
+client.groups.groupMembersRemove({ ...params }) -> DevRev.GroupMembersRemoveResponse
+
+-
+
+#### 📝 Description
+
+
+-
+
+
+-
+
+Removes a member from a group.
+
+
+
+
+
+
+#### 🔌 Usage
+
+
+-
+
+
+-
+
+```typescript
+await client.groups.groupMembersRemove({
+ group: "group",
+ member: "DEVU-12345",
+});
+```
+
+
+
+
+
+
+#### ⚙️ Parameters
+
+
+-
+
+
+-
+
+**request:** `DevRev.GroupMembersRemoveRequest`
+
+
+
+
+
+-
+
+**requestOptions:** `Groups.RequestOptions`
+
+
+
+
+
+
+
+
+
+
+client.groups.update({ ...params }) -> DevRev.GroupsUpdateResponse
+
+-
+
+#### 📝 Description
+
+
+-
+
+
+-
+
+Updates the requested group.
+
+
+
+
+
+
+#### 🔌 Usage
+
+
+-
+
+
+-
+
+```typescript
+await client.groups.update({
+ id: "id",
+});
+```
+
+
+
+
+
+
+#### ⚙️ Parameters
+
+
+-
+
+
+-
+
+**request:** `DevRev.GroupsUpdateRequest`
+
+
+
+
+
+-
+
+**requestOptions:** `Groups.RequestOptions`
+
+
+
+
+
+
+
+
+
+
+## links
+
+client.links.create({ ...params }) -> DevRev.LinksCreateResponse
+
+-
+
+#### 📝 Description
+
+
+-
+
+
+-
+
+Creates a link between two objects to indicate a relationship.
+
+
+
+
+
+
+#### 🔌 Usage
+
+
+-
+
+
+-
+
+```typescript
+await client.links.create({
+ linkType: DevRev.LinkType.CustomLink,
+ source: "string",
+ target: "string",
+});
+```
+
+
+
+
+
+
+#### ⚙️ Parameters
+
+
+-
+
+
+-
+
+**request:** `DevRev.LinksCreateRequest`
+
+
+
+
+
+-
+
+**requestOptions:** `Links.RequestOptions`
+
+
+
+
+
+
+
+
+
+
+client.links.delete({ ...params }) -> DevRev.LinksDeleteResponse
+
+-
+
+#### 📝 Description
+
+
+-
+
+
+-
+
+Deletes a link.
+
+
+
+
+
+
+#### 🔌 Usage
+
+
+-
+
+
+-
+
+```typescript
+await client.links.delete({
+ id: "id",
+});
+```
+
+
+
+
+
+
+#### ⚙️ Parameters
+
+
+-
+
+
+-
+
+**request:** `DevRev.LinksDeleteRequest`
+
+
+
+
+
+-
+
+**requestOptions:** `Links.RequestOptions`
+
+
+
+
+
+
+
+
+
+
+client.links.get({ ...params }) -> DevRev.LinksGetResponse
+
+-
+
+#### 📝 Description
+
+
+-
+
+
+-
+
+Gets the requested link's information.
+
+
+
+
+
+
+#### 🔌 Usage
+
+
+-
+
+
+-
+
+```typescript
+await client.links.get({
+ id: "string",
+});
+```
+
+
+
+
+
+
+#### ⚙️ Parameters
+
+
+-
+
+
+-
+
+**request:** `DevRev.LinksGetQuery`
+
+
+
+
+
+-
+
+**requestOptions:** `Links.RequestOptions`
+
+
+
+
+
+
+
+
+
+
+client.links.getPost({ ...params }) -> DevRev.LinksGetResponse
+
+-
+
+#### 📝 Description
+
+
+-
+
+
+-
+
+Gets the requested link's information.
+
+
+
+
+
+
+#### 🔌 Usage
+
+
+-
+
+
+-
+
+```typescript
+await client.links.getPost({
+ id: "string",
+});
+```
+
+
+
+
+
+
+#### ⚙️ Parameters
+
+
+-
+
+
+-
+
+**request:** `DevRev.LinksGetRequest`
+
+
+
+
+
+-
+
+**requestOptions:** `Links.RequestOptions`
+
+
+
+
+
+
+
+
+
+
+client.links.list({ ...params }) -> DevRev.LinksListResponse
+
+-
+
+#### 📝 Description
+
+
+-
+
+
+-
+
+Lists the available links.
+
+
+
+
+
+
+#### 🔌 Usage
+
+
+-
+
+
+-
+
+```typescript
+await client.links.list({
+ object: "object",
+});
+```
+
+
+
+
+
+
+#### ⚙️ Parameters
+
+
+-
+
+
+-
+
+**request:** `DevRev.LinksListQuery`
+
+
+
+
+
+-
+
+**requestOptions:** `Links.RequestOptions`
+
+
+
+
+
+
+
+
+
+
+client.links.listPost({ ...params }) -> DevRev.LinksListResponse
+
+-
+
+#### 📝 Description
+
+
+-
+
+
+-
+
+Lists the available links.
+
+
+
+
+
+
+#### 🔌 Usage
+
+
+-
+
+
+-
+
+```typescript
+await client.links.listPost({
+ object: "object",
+});
+```
+
+
+
+
+
+
+#### ⚙️ Parameters
+
+
+-
+
+
+-
+
+**request:** `DevRev.LinksListRequest`
+
+
+
+
+
+-
+
+**requestOptions:** `Links.RequestOptions`
+
+
+
+
+
+
+
+
+
+
+## slas
+
+client.slas.metricDefinitionsList({ ...params }) -> DevRev.MetricDefinitionsListResponse
+
+-
+
+#### 📝 Description
+
+
+-
+
+
+-
+
+Lists metric definitions matching a filter.
+
+
+
+
+
+
+#### 🔌 Usage
+
+
+-
+
+
+-
+
+```typescript
+await client.slas.metricDefinitionsList();
+```
+
+
+
+
+
+
+#### ⚙️ Parameters
+
+
+-
+
+
+-
+
+**request:** `DevRev.MetricDefinitionsListQuery`
+
+
+
+
+
+-
+
+**requestOptions:** `Slas.RequestOptions`
+
+
+
+
+
+
+
+
+
+
+client.slas.metricDefinitionsListPost({ ...params }) -> DevRev.MetricDefinitionsListResponse
+
+-
+
+#### 📝 Description
+
+
+-
+
+
+-
+
+Lists metric definitions matching a filter.
+
+
+
+
+
+
+#### 🔌 Usage
+
+
+-
+
+
+-
+
+```typescript
+await client.slas.metricDefinitionsListPost();
+```
+
+
+
+
+
+
+#### ⚙️ Parameters
+
+
+-
+
+
+-
+
+**request:** `DevRev.MetricDefinitionsListRequest`
+
+
+
+
+
+-
+
+**requestOptions:** `Slas.RequestOptions`
+
+
+
+
+
+
+
+
+
+
+client.slas.assign({ ...params }) -> DevRev.SlasAssignResponse
+
+-
+
+#### 📝 Description
+
+
+-
+
+
+-
+
+Assigns the SLA to a set of Rev organizations.
+
+
+
+
+
+
+#### 🔌 Usage
+
+
+-
+
+
+-
+
+```typescript
+await client.slas.assign({
+ revOrgs: ["REV-AbCdEfGh"],
+});
+```
+
+
+
+
+
+
+#### ⚙️ Parameters
+
+
+-
+
+
+-
+
+**request:** `DevRev.SlasAssignRequest`
+
+
+
+
+
+-
+
+**requestOptions:** `Slas.RequestOptions`
+
+
+
+
+
+
+
+
diff --git a/src/Client.ts b/src/Client.ts
new file mode 100644
index 0000000..d348eb3
--- /dev/null
+++ b/src/Client.ts
@@ -0,0 +1,209 @@
+/**
+ * This file was auto-generated by Fern from our API Definition.
+ */
+
+import * as environments from "./environments";
+import * as core from "./core";
+import { Accounts } from "./api/resources/accounts/client/Client";
+import { Articles } from "./api/resources/articles/client/Client";
+import { Artifacts } from "./api/resources/artifacts/client/Client";
+import { CodeChanges } from "./api/resources/codeChanges/client/Client";
+import { Conversations } from "./api/resources/conversations/client/Client";
+import { DevUsers } from "./api/resources/devUsers/client/Client";
+import { Engagements } from "./api/resources/engagements/client/Client";
+import { EventSource } from "./api/resources/eventSource/client/Client";
+import { Groups } from "./api/resources/groups/client/Client";
+import { Links } from "./api/resources/links/client/Client";
+import { Slas } from "./api/resources/slas/client/Client";
+import { ProductUsage } from "./api/resources/productUsage/client/Client";
+import { Schedules } from "./api/resources/schedules/client/Client";
+import { Parts } from "./api/resources/parts/client/Client";
+import { QuestionAnswers } from "./api/resources/questionAnswers/client/Client";
+import { RevOrgs } from "./api/resources/revOrgs/client/Client";
+import { RevUsers } from "./api/resources/revUsers/client/Client";
+import { Customization } from "./api/resources/customization/client/Client";
+import { Search } from "./api/resources/search/client/Client";
+import { ServiceAccounts } from "./api/resources/serviceAccounts/client/Client";
+import { SnapIns } from "./api/resources/snapIns/client/Client";
+import { SnapWidgets } from "./api/resources/snapWidgets/client/Client";
+import { Surveys } from "./api/resources/surveys/client/Client";
+import { SysUsers } from "./api/resources/sysUsers/client/Client";
+import { TimelineEntries } from "./api/resources/timelineEntries/client/Client";
+import { Works } from "./api/resources/works/client/Client";
+
+export declare namespace DevRevClient {
+ interface Options {
+ environment?: core.Supplier;
+ token?: 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;
+ }
+}
+
+export class DevRevClient {
+ constructor(protected readonly _options: DevRevClient.Options = {}) {}
+
+ protected _accounts: Accounts | undefined;
+
+ public get accounts(): Accounts {
+ return (this._accounts ??= new Accounts(this._options));
+ }
+
+ protected _articles: Articles | undefined;
+
+ public get articles(): Articles {
+ return (this._articles ??= new Articles(this._options));
+ }
+
+ protected _artifacts: Artifacts | undefined;
+
+ public get artifacts(): Artifacts {
+ return (this._artifacts ??= new Artifacts(this._options));
+ }
+
+ protected _codeChanges: CodeChanges | undefined;
+
+ public get codeChanges(): CodeChanges {
+ return (this._codeChanges ??= new CodeChanges(this._options));
+ }
+
+ protected _conversations: Conversations | undefined;
+
+ public get conversations(): Conversations {
+ return (this._conversations ??= new Conversations(this._options));
+ }
+
+ protected _devUsers: DevUsers | undefined;
+
+ public get devUsers(): DevUsers {
+ return (this._devUsers ??= new DevUsers(this._options));
+ }
+
+ protected _engagements: Engagements | undefined;
+
+ public get engagements(): Engagements {
+ return (this._engagements ??= new Engagements(this._options));
+ }
+
+ protected _eventSource: EventSource | undefined;
+
+ public get eventSource(): EventSource {
+ return (this._eventSource ??= new EventSource(this._options));
+ }
+
+ protected _groups: Groups | undefined;
+
+ public get groups(): Groups {
+ return (this._groups ??= new Groups(this._options));
+ }
+
+ protected _links: Links | undefined;
+
+ public get links(): Links {
+ return (this._links ??= new Links(this._options));
+ }
+
+ protected _slas: Slas | undefined;
+
+ public get slas(): Slas {
+ return (this._slas ??= new Slas(this._options));
+ }
+
+ protected _productUsage: ProductUsage | undefined;
+
+ public get productUsage(): ProductUsage {
+ return (this._productUsage ??= new ProductUsage(this._options));
+ }
+
+ protected _schedules: Schedules | undefined;
+
+ public get schedules(): Schedules {
+ return (this._schedules ??= new Schedules(this._options));
+ }
+
+ protected _parts: Parts | undefined;
+
+ public get parts(): Parts {
+ return (this._parts ??= new Parts(this._options));
+ }
+
+ protected _questionAnswers: QuestionAnswers | undefined;
+
+ public get questionAnswers(): QuestionAnswers {
+ return (this._questionAnswers ??= new QuestionAnswers(this._options));
+ }
+
+ protected _revOrgs: RevOrgs | undefined;
+
+ public get revOrgs(): RevOrgs {
+ return (this._revOrgs ??= new RevOrgs(this._options));
+ }
+
+ protected _revUsers: RevUsers | undefined;
+
+ public get revUsers(): RevUsers {
+ return (this._revUsers ??= new RevUsers(this._options));
+ }
+
+ protected _customization: Customization | undefined;
+
+ public get customization(): Customization {
+ return (this._customization ??= new Customization(this._options));
+ }
+
+ protected _search: Search | undefined;
+
+ public get search(): Search {
+ return (this._search ??= new Search(this._options));
+ }
+
+ protected _serviceAccounts: ServiceAccounts | undefined;
+
+ public get serviceAccounts(): ServiceAccounts {
+ return (this._serviceAccounts ??= new ServiceAccounts(this._options));
+ }
+
+ protected _snapIns: SnapIns | undefined;
+
+ public get snapIns(): SnapIns {
+ return (this._snapIns ??= new SnapIns(this._options));
+ }
+
+ protected _snapWidgets: SnapWidgets | undefined;
+
+ public get snapWidgets(): SnapWidgets {
+ return (this._snapWidgets ??= new SnapWidgets(this._options));
+ }
+
+ protected _surveys: Surveys | undefined;
+
+ public get surveys(): Surveys {
+ return (this._surveys ??= new Surveys(this._options));
+ }
+
+ protected _sysUsers: SysUsers | undefined;
+
+ public get sysUsers(): SysUsers {
+ return (this._sysUsers ??= new SysUsers(this._options));
+ }
+
+ protected _timelineEntries: TimelineEntries | undefined;
+
+ public get timelineEntries(): TimelineEntries {
+ return (this._timelineEntries ??= new TimelineEntries(this._options));
+ }
+
+ protected _works: Works | undefined;
+
+ public get works(): Works {
+ return (this._works ??= new Works(this._options));
+ }
+}
diff --git a/src/api/errors/BadRequestError.ts b/src/api/errors/BadRequestError.ts
new file mode 100644
index 0000000..6df4e08
--- /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 DevRev from "../index";
+
+export class BadRequestError extends errors.DevRevError {
+ constructor(body: DevRev.ErrorBadRequest) {
+ 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..9d274ac
--- /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 DevRev from "../index";
+
+export class ConflictError extends errors.DevRevError {
+ constructor(body: DevRev.ErrorConflict) {
+ 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..29e5562
--- /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 DevRev from "../index";
+
+export class ForbiddenError extends errors.DevRevError {
+ constructor(body: DevRev.ErrorForbidden) {
+ 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..b61d941
--- /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 DevRev from "../index";
+
+export class InternalServerError extends errors.DevRevError {
+ constructor(body: DevRev.ErrorInternalServerError) {
+ super({
+ message: "InternalServerError",
+ statusCode: 500,
+ body: body,
+ });
+ Object.setPrototypeOf(this, InternalServerError.prototype);
+ }
+}
diff --git a/src/api/errors/NotFoundError.ts b/src/api/errors/NotFoundError.ts
new file mode 100644
index 0000000..30d3620
--- /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 DevRev from "../index";
+
+export class NotFoundError extends errors.DevRevError {
+ constructor(body: DevRev.ErrorNotFound) {
+ super({
+ message: "NotFoundError",
+ statusCode: 404,
+ body: body,
+ });
+ Object.setPrototypeOf(this, NotFoundError.prototype);
+ }
+}
diff --git a/src/api/errors/ServiceUnavailableError.ts b/src/api/errors/ServiceUnavailableError.ts
new file mode 100644
index 0000000..c8840d4
--- /dev/null
+++ b/src/api/errors/ServiceUnavailableError.ts
@@ -0,0 +1,17 @@
+/**
+ * This file was auto-generated by Fern from our API Definition.
+ */
+
+import * as errors from "../../errors/index";
+import * as DevRev from "../index";
+
+export class ServiceUnavailableError extends errors.DevRevError {
+ constructor(body: DevRev.ErrorServiceUnavailable) {
+ super({
+ message: "ServiceUnavailableError",
+ statusCode: 503,
+ body: body,
+ });
+ Object.setPrototypeOf(this, ServiceUnavailableError.prototype);
+ }
+}
diff --git a/src/api/errors/TooManyRequestsError.ts b/src/api/errors/TooManyRequestsError.ts
new file mode 100644
index 0000000..a88696c
--- /dev/null
+++ b/src/api/errors/TooManyRequestsError.ts
@@ -0,0 +1,17 @@
+/**
+ * This file was auto-generated by Fern from our API Definition.
+ */
+
+import * as errors from "../../errors/index";
+import * as DevRev from "../index";
+
+export class TooManyRequestsError extends errors.DevRevError {
+ constructor(body: DevRev.ErrorTooManyRequests) {
+ super({
+ message: "TooManyRequestsError",
+ statusCode: 429,
+ body: body,
+ });
+ Object.setPrototypeOf(this, TooManyRequestsError.prototype);
+ }
+}
diff --git a/src/api/errors/UnauthorizedError.ts b/src/api/errors/UnauthorizedError.ts
new file mode 100644
index 0000000..1b451a4
--- /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 DevRev from "../index";
+
+export class UnauthorizedError extends errors.DevRevError {
+ constructor(body: DevRev.ErrorUnauthorized) {
+ super({
+ message: "UnauthorizedError",
+ statusCode: 401,
+ body: body,
+ });
+ Object.setPrototypeOf(this, UnauthorizedError.prototype);
+ }
+}
diff --git a/src/api/errors/index.ts b/src/api/errors/index.ts
new file mode 100644
index 0000000..50bf98f
--- /dev/null
+++ b/src/api/errors/index.ts
@@ -0,0 +1,8 @@
+export * from "./BadRequestError";
+export * from "./UnauthorizedError";
+export * from "./ForbiddenError";
+export * from "./ConflictError";
+export * from "./TooManyRequestsError";
+export * from "./InternalServerError";
+export * from "./ServiceUnavailableError";
+export * from "./NotFoundError";
diff --git a/src/api/index.ts b/src/api/index.ts
new file mode 100644
index 0000000..1cb55b6
--- /dev/null
+++ b/src/api/index.ts
@@ -0,0 +1,3 @@
+export * from "./types";
+export * from "./errors";
+export * from "./resources";
diff --git a/src/api/resources/accounts/client/Client.ts b/src/api/resources/accounts/client/Client.ts
new file mode 100644
index 0000000..20d2a72
--- /dev/null
+++ b/src/api/resources/accounts/client/Client.ts
@@ -0,0 +1,1601 @@
+/**
+ * This file was auto-generated by Fern from our API Definition.
+ */
+
+import * as environments from "../../../../environments";
+import * as core from "../../../../core";
+import * as DevRev from "../../../index";
+import * as serializers from "../../../../serialization/index";
+import urlJoin from "url-join";
+import * as errors from "../../../../errors/index";
+
+export declare namespace Accounts {
+ interface Options {
+ environment?: core.Supplier;
+ token?: 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;
+ }
+}
+
+/**
+ * Accounts management APIs
+ */
+export class Accounts {
+ constructor(protected readonly _options: Accounts.Options = {}) {}
+
+ /**
+ * Creates an account, which is a record representing a customer or an
+ * organization.
+ *
+ * @param {DevRev.AccountsCreateRequest} request
+ * @param {Accounts.RequestOptions} requestOptions - Request-specific configuration.
+ *
+ * @throws {@link DevRev.BadRequestError}
+ * @throws {@link DevRev.UnauthorizedError}
+ * @throws {@link DevRev.ForbiddenError}
+ * @throws {@link DevRev.ConflictError}
+ * @throws {@link DevRev.TooManyRequestsError}
+ * @throws {@link DevRev.InternalServerError}
+ * @throws {@link DevRev.ServiceUnavailableError}
+ *
+ * @example
+ * await client.accounts.create({
+ * displayName: "display_name"
+ * })
+ */
+ public async create(
+ request: DevRev.AccountsCreateRequest,
+ requestOptions?: Accounts.RequestOptions
+ ): Promise {
+ const _response = await (this._options.fetcher ?? core.fetcher)({
+ url: urlJoin(
+ (await core.Supplier.get(this._options.environment)) ?? environments.DevRevEnvironment.Default,
+ "accounts.create"
+ ),
+ method: "POST",
+ headers: {
+ Authorization: await this._getAuthorizationHeader(),
+ "X-Fern-Language": "JavaScript",
+ "X-Fern-SDK-Name": "@devrev/api",
+ "X-Fern-SDK-Version": "0.0.14",
+ "X-Fern-Runtime": core.RUNTIME.type,
+ "X-Fern-Runtime-Version": core.RUNTIME.version,
+ },
+ contentType: "application/json",
+ requestType: "json",
+ body: serializers.AccountsCreateRequest.jsonOrThrow(request, { unrecognizedObjectKeys: "strip" }),
+ timeoutMs: requestOptions?.timeoutInSeconds != null ? requestOptions.timeoutInSeconds * 1000 : 60000,
+ maxRetries: requestOptions?.maxRetries,
+ abortSignal: requestOptions?.abortSignal,
+ });
+ if (_response.ok) {
+ return serializers.AccountsCreateResponse.parseOrThrow(_response.body, {
+ unrecognizedObjectKeys: "passthrough",
+ allowUnrecognizedUnionMembers: true,
+ allowUnrecognizedEnumValues: true,
+ skipValidation: true,
+ breadcrumbsPrefix: ["response"],
+ });
+ }
+
+ if (_response.error.reason === "status-code") {
+ switch (_response.error.statusCode) {
+ case 400:
+ throw new DevRev.BadRequestError(
+ serializers.ErrorBadRequest.parseOrThrow(_response.error.body, {
+ unrecognizedObjectKeys: "passthrough",
+ allowUnrecognizedUnionMembers: true,
+ allowUnrecognizedEnumValues: true,
+ skipValidation: true,
+ breadcrumbsPrefix: ["response"],
+ })
+ );
+ case 401:
+ throw new DevRev.UnauthorizedError(
+ serializers.ErrorUnauthorized.parseOrThrow(_response.error.body, {
+ unrecognizedObjectKeys: "passthrough",
+ allowUnrecognizedUnionMembers: true,
+ allowUnrecognizedEnumValues: true,
+ skipValidation: true,
+ breadcrumbsPrefix: ["response"],
+ })
+ );
+ case 403:
+ throw new DevRev.ForbiddenError(
+ serializers.ErrorForbidden.parseOrThrow(_response.error.body, {
+ unrecognizedObjectKeys: "passthrough",
+ allowUnrecognizedUnionMembers: true,
+ allowUnrecognizedEnumValues: true,
+ skipValidation: true,
+ breadcrumbsPrefix: ["response"],
+ })
+ );
+ case 409:
+ throw new DevRev.ConflictError(
+ serializers.ErrorConflict.parseOrThrow(_response.error.body, {
+ unrecognizedObjectKeys: "passthrough",
+ allowUnrecognizedUnionMembers: true,
+ allowUnrecognizedEnumValues: true,
+ skipValidation: true,
+ breadcrumbsPrefix: ["response"],
+ })
+ );
+ case 429:
+ throw new DevRev.TooManyRequestsError(
+ serializers.ErrorTooManyRequests.parseOrThrow(_response.error.body, {
+ unrecognizedObjectKeys: "passthrough",
+ allowUnrecognizedUnionMembers: true,
+ allowUnrecognizedEnumValues: true,
+ skipValidation: true,
+ breadcrumbsPrefix: ["response"],
+ })
+ );
+ case 500:
+ throw new DevRev.InternalServerError(
+ serializers.ErrorInternalServerError.parseOrThrow(_response.error.body, {
+ unrecognizedObjectKeys: "passthrough",
+ allowUnrecognizedUnionMembers: true,
+ allowUnrecognizedEnumValues: true,
+ skipValidation: true,
+ breadcrumbsPrefix: ["response"],
+ })
+ );
+ case 503:
+ throw new DevRev.ServiceUnavailableError(
+ serializers.ErrorServiceUnavailable.parseOrThrow(_response.error.body, {
+ unrecognizedObjectKeys: "passthrough",
+ allowUnrecognizedUnionMembers: true,
+ allowUnrecognizedEnumValues: true,
+ skipValidation: true,
+ breadcrumbsPrefix: ["response"],
+ })
+ );
+ default:
+ throw new errors.DevRevError({
+ statusCode: _response.error.statusCode,
+ body: _response.error.body,
+ });
+ }
+ }
+
+ switch (_response.error.reason) {
+ case "non-json":
+ throw new errors.DevRevError({
+ statusCode: _response.error.statusCode,
+ body: _response.error.rawBody,
+ });
+ case "timeout":
+ throw new errors.DevRevTimeoutError();
+ case "unknown":
+ throw new errors.DevRevError({
+ message: _response.error.errorMessage,
+ });
+ }
+ }
+
+ /**
+ * Deletes an account.
+ *
+ * @param {DevRev.AccountsDeleteRequest} request
+ * @param {Accounts.RequestOptions} requestOptions - Request-specific configuration.
+ *
+ * @throws {@link DevRev.BadRequestError}
+ * @throws {@link DevRev.UnauthorizedError}
+ * @throws {@link DevRev.ForbiddenError}
+ * @throws {@link DevRev.NotFoundError}
+ * @throws {@link DevRev.TooManyRequestsError}
+ * @throws {@link DevRev.InternalServerError}
+ * @throws {@link DevRev.ServiceUnavailableError}
+ *
+ * @example
+ * await client.accounts.delete({
+ * id: "ACC-12345"
+ * })
+ */
+ public async delete(
+ request: DevRev.AccountsDeleteRequest,
+ requestOptions?: Accounts.RequestOptions
+ ): Promise {
+ const _response = await (this._options.fetcher ?? core.fetcher)({
+ url: urlJoin(
+ (await core.Supplier.get(this._options.environment)) ?? environments.DevRevEnvironment.Default,
+ "accounts.delete"
+ ),
+ method: "POST",
+ headers: {
+ Authorization: await this._getAuthorizationHeader(),
+ "X-Fern-Language": "JavaScript",
+ "X-Fern-SDK-Name": "@devrev/api",
+ "X-Fern-SDK-Version": "0.0.14",
+ "X-Fern-Runtime": core.RUNTIME.type,
+ "X-Fern-Runtime-Version": core.RUNTIME.version,
+ },
+ contentType: "application/json",
+ requestType: "json",
+ body: serializers.AccountsDeleteRequest.jsonOrThrow(request, { unrecognizedObjectKeys: "strip" }),
+ timeoutMs: requestOptions?.timeoutInSeconds != null ? requestOptions.timeoutInSeconds * 1000 : 60000,
+ maxRetries: requestOptions?.maxRetries,
+ abortSignal: requestOptions?.abortSignal,
+ });
+ if (_response.ok) {
+ return serializers.AccountsDeleteResponse.parseOrThrow(_response.body, {
+ unrecognizedObjectKeys: "passthrough",
+ allowUnrecognizedUnionMembers: true,
+ allowUnrecognizedEnumValues: true,
+ skipValidation: true,
+ breadcrumbsPrefix: ["response"],
+ });
+ }
+
+ if (_response.error.reason === "status-code") {
+ switch (_response.error.statusCode) {
+ case 400:
+ throw new DevRev.BadRequestError(
+ serializers.ErrorBadRequest.parseOrThrow(_response.error.body, {
+ unrecognizedObjectKeys: "passthrough",
+ allowUnrecognizedUnionMembers: true,
+ allowUnrecognizedEnumValues: true,
+ skipValidation: true,
+ breadcrumbsPrefix: ["response"],
+ })
+ );
+ case 401:
+ throw new DevRev.UnauthorizedError(
+ serializers.ErrorUnauthorized.parseOrThrow(_response.error.body, {
+ unrecognizedObjectKeys: "passthrough",
+ allowUnrecognizedUnionMembers: true,
+ allowUnrecognizedEnumValues: true,
+ skipValidation: true,
+ breadcrumbsPrefix: ["response"],
+ })
+ );
+ case 403:
+ throw new DevRev.ForbiddenError(
+ serializers.ErrorForbidden.parseOrThrow(_response.error.body, {
+ unrecognizedObjectKeys: "passthrough",
+ allowUnrecognizedUnionMembers: true,
+ allowUnrecognizedEnumValues: true,
+ skipValidation: true,
+ breadcrumbsPrefix: ["response"],
+ })
+ );
+ case 404:
+ throw new DevRev.NotFoundError(
+ serializers.ErrorNotFound.parseOrThrow(_response.error.body, {
+ unrecognizedObjectKeys: "passthrough",
+ allowUnrecognizedUnionMembers: true,
+ allowUnrecognizedEnumValues: true,
+ skipValidation: true,
+ breadcrumbsPrefix: ["response"],
+ })
+ );
+ case 429:
+ throw new DevRev.TooManyRequestsError(
+ serializers.ErrorTooManyRequests.parseOrThrow(_response.error.body, {
+ unrecognizedObjectKeys: "passthrough",
+ allowUnrecognizedUnionMembers: true,
+ allowUnrecognizedEnumValues: true,
+ skipValidation: true,
+ breadcrumbsPrefix: ["response"],
+ })
+ );
+ case 500:
+ throw new DevRev.InternalServerError(
+ serializers.ErrorInternalServerError.parseOrThrow(_response.error.body, {
+ unrecognizedObjectKeys: "passthrough",
+ allowUnrecognizedUnionMembers: true,
+ allowUnrecognizedEnumValues: true,
+ skipValidation: true,
+ breadcrumbsPrefix: ["response"],
+ })
+ );
+ case 503:
+ throw new DevRev.ServiceUnavailableError(
+ serializers.ErrorServiceUnavailable.parseOrThrow(_response.error.body, {
+ unrecognizedObjectKeys: "passthrough",
+ allowUnrecognizedUnionMembers: true,
+ allowUnrecognizedEnumValues: true,
+ skipValidation: true,
+ breadcrumbsPrefix: ["response"],
+ })
+ );
+ default:
+ throw new errors.DevRevError({
+ statusCode: _response.error.statusCode,
+ body: _response.error.body,
+ });
+ }
+ }
+
+ switch (_response.error.reason) {
+ case "non-json":
+ throw new errors.DevRevError({
+ statusCode: _response.error.statusCode,
+ body: _response.error.rawBody,
+ });
+ case "timeout":
+ throw new errors.DevRevTimeoutError();
+ case "unknown":
+ throw new errors.DevRevError({
+ message: _response.error.errorMessage,
+ });
+ }
+ }
+
+ /**
+ * Exports a collection of accounts.
+ *
+ * @param {DevRev.AccountsExportQuery} request
+ * @param {Accounts.RequestOptions} requestOptions - Request-specific configuration.
+ *
+ * @throws {@link DevRev.BadRequestError}
+ * @throws {@link DevRev.UnauthorizedError}
+ * @throws {@link DevRev.ForbiddenError}
+ * @throws {@link DevRev.TooManyRequestsError}
+ * @throws {@link DevRev.InternalServerError}
+ * @throws {@link DevRev.ServiceUnavailableError}
+ *
+ * @example
+ * await client.accounts.export({
+ * createdDateAfter: new Date("2023-01-01T12:00:00.000Z"),
+ * createdDateBefore: new Date("2023-01-01T12:00:00.000Z"),
+ * modifiedDateAfter: new Date("2023-01-01T12:00:00.000Z"),
+ * modifiedDateBefore: new Date("2023-01-01T12:00:00.000Z")
+ * })
+ */
+ public async export(
+ request: DevRev.AccountsExportQuery = {},
+ requestOptions?: Accounts.RequestOptions
+ ): Promise {
+ const {
+ createdBy,
+ createdDateAfter,
+ createdDateBefore,
+ customFields,
+ displayName,
+ domains,
+ externalRefs,
+ first,
+ modifiedDateAfter,
+ modifiedDateBefore,
+ ownedBy,
+ sortBy,
+ stage,
+ tags,
+ } = request;
+ const _queryParams: Record = {};
+ if (createdBy != null) {
+ if (Array.isArray(createdBy)) {
+ _queryParams["created_by"] = createdBy.map((item) => item);
+ } else {
+ _queryParams["created_by"] = createdBy;
+ }
+ }
+
+ if (createdDateAfter != null) {
+ _queryParams["created_date.after"] = createdDateAfter.toISOString();
+ }
+
+ if (createdDateBefore != null) {
+ _queryParams["created_date.before"] = createdDateBefore.toISOString();
+ }
+
+ if (customFields != null) {
+ _queryParams["custom_fields"] = JSON.stringify(customFields);
+ }
+
+ if (displayName != null) {
+ if (Array.isArray(displayName)) {
+ _queryParams["display_name"] = displayName.map((item) => item);
+ } else {
+ _queryParams["display_name"] = displayName;
+ }
+ }
+
+ if (domains != null) {
+ if (Array.isArray(domains)) {
+ _queryParams["domains"] = domains.map((item) => item);
+ } else {
+ _queryParams["domains"] = domains;
+ }
+ }
+
+ if (externalRefs != null) {
+ if (Array.isArray(externalRefs)) {
+ _queryParams["external_refs"] = externalRefs.map((item) => item);
+ } else {
+ _queryParams["external_refs"] = externalRefs;
+ }
+ }
+
+ if (first != null) {
+ _queryParams["first"] = first.toString();
+ }
+
+ if (modifiedDateAfter != null) {
+ _queryParams["modified_date.after"] = modifiedDateAfter.toISOString();
+ }
+
+ if (modifiedDateBefore != null) {
+ _queryParams["modified_date.before"] = modifiedDateBefore.toISOString();
+ }
+
+ if (ownedBy != null) {
+ if (Array.isArray(ownedBy)) {
+ _queryParams["owned_by"] = ownedBy.map((item) => item);
+ } else {
+ _queryParams["owned_by"] = ownedBy;
+ }
+ }
+
+ if (sortBy != null) {
+ if (Array.isArray(sortBy)) {
+ _queryParams["sort_by"] = sortBy.map((item) => item);
+ } else {
+ _queryParams["sort_by"] = sortBy;
+ }
+ }
+
+ if (stage != null) {
+ if (Array.isArray(stage)) {
+ _queryParams["stage"] = stage.map((item) => item);
+ } else {
+ _queryParams["stage"] = stage;
+ }
+ }
+
+ if (tags != null) {
+ if (Array.isArray(tags)) {
+ _queryParams["tags"] = tags.map((item) => item);
+ } else {
+ _queryParams["tags"] = tags;
+ }
+ }
+
+ const _response = await (this._options.fetcher ?? core.fetcher)({
+ url: urlJoin(
+ (await core.Supplier.get(this._options.environment)) ?? environments.DevRevEnvironment.Default,
+ "accounts.export"
+ ),
+ method: "GET",
+ headers: {
+ Authorization: await this._getAuthorizationHeader(),
+ "X-Fern-Language": "JavaScript",
+ "X-Fern-SDK-Name": "@devrev/api",
+ "X-Fern-SDK-Version": "0.0.14",
+ "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 serializers.AccountsExportResponse.parseOrThrow(_response.body, {
+ unrecognizedObjectKeys: "passthrough",
+ allowUnrecognizedUnionMembers: true,
+ allowUnrecognizedEnumValues: true,
+ skipValidation: true,
+ breadcrumbsPrefix: ["response"],
+ });
+ }
+
+ if (_response.error.reason === "status-code") {
+ switch (_response.error.statusCode) {
+ case 400:
+ throw new DevRev.BadRequestError(
+ serializers.ErrorBadRequest.parseOrThrow(_response.error.body, {
+ unrecognizedObjectKeys: "passthrough",
+ allowUnrecognizedUnionMembers: true,
+ allowUnrecognizedEnumValues: true,
+ skipValidation: true,
+ breadcrumbsPrefix: ["response"],
+ })
+ );
+ case 401:
+ throw new DevRev.UnauthorizedError(
+ serializers.ErrorUnauthorized.parseOrThrow(_response.error.body, {
+ unrecognizedObjectKeys: "passthrough",
+ allowUnrecognizedUnionMembers: true,
+ allowUnrecognizedEnumValues: true,
+ skipValidation: true,
+ breadcrumbsPrefix: ["response"],
+ })
+ );
+ case 403:
+ throw new DevRev.ForbiddenError(
+ serializers.ErrorForbidden.parseOrThrow(_response.error.body, {
+ unrecognizedObjectKeys: "passthrough",
+ allowUnrecognizedUnionMembers: true,
+ allowUnrecognizedEnumValues: true,
+ skipValidation: true,
+ breadcrumbsPrefix: ["response"],
+ })
+ );
+ case 429:
+ throw new DevRev.TooManyRequestsError(
+ serializers.ErrorTooManyRequests.parseOrThrow(_response.error.body, {
+ unrecognizedObjectKeys: "passthrough",
+ allowUnrecognizedUnionMembers: true,
+ allowUnrecognizedEnumValues: true,
+ skipValidation: true,
+ breadcrumbsPrefix: ["response"],
+ })
+ );
+ case 500:
+ throw new DevRev.InternalServerError(
+ serializers.ErrorInternalServerError.parseOrThrow(_response.error.body, {
+ unrecognizedObjectKeys: "passthrough",
+ allowUnrecognizedUnionMembers: true,
+ allowUnrecognizedEnumValues: true,
+ skipValidation: true,
+ breadcrumbsPrefix: ["response"],
+ })
+ );
+ case 503:
+ throw new DevRev.ServiceUnavailableError(
+ serializers.ErrorServiceUnavailable.parseOrThrow(_response.error.body, {
+ unrecognizedObjectKeys: "passthrough",
+ allowUnrecognizedUnionMembers: true,
+ allowUnrecognizedEnumValues: true,
+ skipValidation: true,
+ breadcrumbsPrefix: ["response"],
+ })
+ );
+ default:
+ throw new errors.DevRevError({
+ statusCode: _response.error.statusCode,
+ body: _response.error.body,
+ });
+ }
+ }
+
+ switch (_response.error.reason) {
+ case "non-json":
+ throw new errors.DevRevError({
+ statusCode: _response.error.statusCode,
+ body: _response.error.rawBody,
+ });
+ case "timeout":
+ throw new errors.DevRevTimeoutError();
+ case "unknown":
+ throw new errors.DevRevError({
+ message: _response.error.errorMessage,
+ });
+ }
+ }
+
+ /**
+ * Exports a collection of accounts.
+ *
+ * @param {DevRev.AccountsExportRequest} request
+ * @param {Accounts.RequestOptions} requestOptions - Request-specific configuration.
+ *
+ * @throws {@link DevRev.BadRequestError}
+ * @throws {@link DevRev.UnauthorizedError}
+ * @throws {@link DevRev.ForbiddenError}
+ * @throws {@link DevRev.TooManyRequestsError}
+ * @throws {@link DevRev.InternalServerError}
+ * @throws {@link DevRev.ServiceUnavailableError}
+ *
+ * @example
+ * await client.accounts.exportPost()
+ */
+ public async exportPost(
+ request: DevRev.AccountsExportRequest = {},
+ requestOptions?: Accounts.RequestOptions
+ ): Promise {
+ const _response = await (this._options.fetcher ?? core.fetcher)({
+ url: urlJoin(
+ (await core.Supplier.get(this._options.environment)) ?? environments.DevRevEnvironment.Default,
+ "accounts.export"
+ ),
+ method: "POST",
+ headers: {
+ Authorization: await this._getAuthorizationHeader(),
+ "X-Fern-Language": "JavaScript",
+ "X-Fern-SDK-Name": "@devrev/api",
+ "X-Fern-SDK-Version": "0.0.14",
+ "X-Fern-Runtime": core.RUNTIME.type,
+ "X-Fern-Runtime-Version": core.RUNTIME.version,
+ },
+ contentType: "application/json",
+ requestType: "json",
+ body: serializers.AccountsExportRequest.jsonOrThrow(request, { unrecognizedObjectKeys: "strip" }),
+ timeoutMs: requestOptions?.timeoutInSeconds != null ? requestOptions.timeoutInSeconds * 1000 : 60000,
+ maxRetries: requestOptions?.maxRetries,
+ abortSignal: requestOptions?.abortSignal,
+ });
+ if (_response.ok) {
+ return serializers.AccountsExportResponse.parseOrThrow(_response.body, {
+ unrecognizedObjectKeys: "passthrough",
+ allowUnrecognizedUnionMembers: true,
+ allowUnrecognizedEnumValues: true,
+ skipValidation: true,
+ breadcrumbsPrefix: ["response"],
+ });
+ }
+
+ if (_response.error.reason === "status-code") {
+ switch (_response.error.statusCode) {
+ case 400:
+ throw new DevRev.BadRequestError(
+ serializers.ErrorBadRequest.parseOrThrow(_response.error.body, {
+ unrecognizedObjectKeys: "passthrough",
+ allowUnrecognizedUnionMembers: true,
+ allowUnrecognizedEnumValues: true,
+ skipValidation: true,
+ breadcrumbsPrefix: ["response"],
+ })
+ );
+ case 401:
+ throw new DevRev.UnauthorizedError(
+ serializers.ErrorUnauthorized.parseOrThrow(_response.error.body, {
+ unrecognizedObjectKeys: "passthrough",
+ allowUnrecognizedUnionMembers: true,
+ allowUnrecognizedEnumValues: true,
+ skipValidation: true,
+ breadcrumbsPrefix: ["response"],
+ })
+ );
+ case 403:
+ throw new DevRev.ForbiddenError(
+ serializers.ErrorForbidden.parseOrThrow(_response.error.body, {
+ unrecognizedObjectKeys: "passthrough",
+ allowUnrecognizedUnionMembers: true,
+ allowUnrecognizedEnumValues: true,
+ skipValidation: true,
+ breadcrumbsPrefix: ["response"],
+ })
+ );
+ case 429:
+ throw new DevRev.TooManyRequestsError(
+ serializers.ErrorTooManyRequests.parseOrThrow(_response.error.body, {
+ unrecognizedObjectKeys: "passthrough",
+ allowUnrecognizedUnionMembers: true,
+ allowUnrecognizedEnumValues: true,
+ skipValidation: true,
+ breadcrumbsPrefix: ["response"],
+ })
+ );
+ case 500:
+ throw new DevRev.InternalServerError(
+ serializers.ErrorInternalServerError.parseOrThrow(_response.error.body, {
+ unrecognizedObjectKeys: "passthrough",
+ allowUnrecognizedUnionMembers: true,
+ allowUnrecognizedEnumValues: true,
+ skipValidation: true,
+ breadcrumbsPrefix: ["response"],
+ })
+ );
+ case 503:
+ throw new DevRev.ServiceUnavailableError(
+ serializers.ErrorServiceUnavailable.parseOrThrow(_response.error.body, {
+ unrecognizedObjectKeys: "passthrough",
+ allowUnrecognizedUnionMembers: true,
+ allowUnrecognizedEnumValues: true,
+ skipValidation: true,
+ breadcrumbsPrefix: ["response"],
+ })
+ );
+ default:
+ throw new errors.DevRevError({
+ statusCode: _response.error.statusCode,
+ body: _response.error.body,
+ });
+ }
+ }
+
+ switch (_response.error.reason) {
+ case "non-json":
+ throw new errors.DevRevError({
+ statusCode: _response.error.statusCode,
+ body: _response.error.rawBody,
+ });
+ case "timeout":
+ throw new errors.DevRevTimeoutError();
+ case "unknown":
+ throw new errors.DevRevError({
+ message: _response.error.errorMessage,
+ });
+ }
+ }
+
+ /**
+ * Retrieves an account's information.
+ *
+ * @param {DevRev.AccountsGetQuery} request
+ * @param {Accounts.RequestOptions} requestOptions - Request-specific configuration.
+ *
+ * @throws {@link DevRev.BadRequestError}
+ * @throws {@link DevRev.UnauthorizedError}
+ * @throws {@link DevRev.ForbiddenError}
+ * @throws {@link DevRev.NotFoundError}
+ * @throws {@link DevRev.TooManyRequestsError}
+ * @throws {@link DevRev.InternalServerError}
+ * @throws {@link DevRev.ServiceUnavailableError}
+ *
+ * @example
+ * await client.accounts.get({
+ * id: "ACC-12345"
+ * })
+ */
+ public async get(
+ request: DevRev.AccountsGetQuery,
+ requestOptions?: Accounts.RequestOptions
+ ): Promise {
+ const { id } = request;
+ const _queryParams: Record = {};
+ _queryParams["id"] = id;
+ const _response = await (this._options.fetcher ?? core.fetcher)({
+ url: urlJoin(
+ (await core.Supplier.get(this._options.environment)) ?? environments.DevRevEnvironment.Default,
+ "accounts.get"
+ ),
+ method: "GET",
+ headers: {
+ Authorization: await this._getAuthorizationHeader(),
+ "X-Fern-Language": "JavaScript",
+ "X-Fern-SDK-Name": "@devrev/api",
+ "X-Fern-SDK-Version": "0.0.14",
+ "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 serializers.AccountsGetResponse.parseOrThrow(_response.body, {
+ unrecognizedObjectKeys: "passthrough",
+ allowUnrecognizedUnionMembers: true,
+ allowUnrecognizedEnumValues: true,
+ skipValidation: true,
+ breadcrumbsPrefix: ["response"],
+ });
+ }
+
+ if (_response.error.reason === "status-code") {
+ switch (_response.error.statusCode) {
+ case 400:
+ throw new DevRev.BadRequestError(
+ serializers.ErrorBadRequest.parseOrThrow(_response.error.body, {
+ unrecognizedObjectKeys: "passthrough",
+ allowUnrecognizedUnionMembers: true,
+ allowUnrecognizedEnumValues: true,
+ skipValidation: true,
+ breadcrumbsPrefix: ["response"],
+ })
+ );
+ case 401:
+ throw new DevRev.UnauthorizedError(
+ serializers.ErrorUnauthorized.parseOrThrow(_response.error.body, {
+ unrecognizedObjectKeys: "passthrough",
+ allowUnrecognizedUnionMembers: true,
+ allowUnrecognizedEnumValues: true,
+ skipValidation: true,
+ breadcrumbsPrefix: ["response"],
+ })
+ );
+ case 403:
+ throw new DevRev.ForbiddenError(
+ serializers.ErrorForbidden.parseOrThrow(_response.error.body, {
+ unrecognizedObjectKeys: "passthrough",
+ allowUnrecognizedUnionMembers: true,
+ allowUnrecognizedEnumValues: true,
+ skipValidation: true,
+ breadcrumbsPrefix: ["response"],
+ })
+ );
+ case 404:
+ throw new DevRev.NotFoundError(
+ serializers.ErrorNotFound.parseOrThrow(_response.error.body, {
+ unrecognizedObjectKeys: "passthrough",
+ allowUnrecognizedUnionMembers: true,
+ allowUnrecognizedEnumValues: true,
+ skipValidation: true,
+ breadcrumbsPrefix: ["response"],
+ })
+ );
+ case 429:
+ throw new DevRev.TooManyRequestsError(
+ serializers.ErrorTooManyRequests.parseOrThrow(_response.error.body, {
+ unrecognizedObjectKeys: "passthrough",
+ allowUnrecognizedUnionMembers: true,
+ allowUnrecognizedEnumValues: true,
+ skipValidation: true,
+ breadcrumbsPrefix: ["response"],
+ })
+ );
+ case 500:
+ throw new DevRev.InternalServerError(
+ serializers.ErrorInternalServerError.parseOrThrow(_response.error.body, {
+ unrecognizedObjectKeys: "passthrough",
+ allowUnrecognizedUnionMembers: true,
+ allowUnrecognizedEnumValues: true,
+ skipValidation: true,
+ breadcrumbsPrefix: ["response"],
+ })
+ );
+ case 503:
+ throw new DevRev.ServiceUnavailableError(
+ serializers.ErrorServiceUnavailable.parseOrThrow(_response.error.body, {
+ unrecognizedObjectKeys: "passthrough",
+ allowUnrecognizedUnionMembers: true,
+ allowUnrecognizedEnumValues: true,
+ skipValidation: true,
+ breadcrumbsPrefix: ["response"],
+ })
+ );
+ default:
+ throw new errors.DevRevError({
+ statusCode: _response.error.statusCode,
+ body: _response.error.body,
+ });
+ }
+ }
+
+ switch (_response.error.reason) {
+ case "non-json":
+ throw new errors.DevRevError({
+ statusCode: _response.error.statusCode,
+ body: _response.error.rawBody,
+ });
+ case "timeout":
+ throw new errors.DevRevTimeoutError();
+ case "unknown":
+ throw new errors.DevRevError({
+ message: _response.error.errorMessage,
+ });
+ }
+ }
+
+ /**
+ * Retrieves an account's information.
+ *
+ * @param {DevRev.AccountsGetRequest} request
+ * @param {Accounts.RequestOptions} requestOptions - Request-specific configuration.
+ *
+ * @throws {@link DevRev.BadRequestError}
+ * @throws {@link DevRev.UnauthorizedError}
+ * @throws {@link DevRev.ForbiddenError}
+ * @throws {@link DevRev.NotFoundError}
+ * @throws {@link DevRev.TooManyRequestsError}
+ * @throws {@link DevRev.InternalServerError}
+ * @throws {@link DevRev.ServiceUnavailableError}
+ *
+ * @example
+ * await client.accounts.getPost({
+ * id: "ACC-12345"
+ * })
+ */
+ public async getPost(
+ request: DevRev.AccountsGetRequest,
+ requestOptions?: Accounts.RequestOptions
+ ): Promise {
+ const _response = await (this._options.fetcher ?? core.fetcher)({
+ url: urlJoin(
+ (await core.Supplier.get(this._options.environment)) ?? environments.DevRevEnvironment.Default,
+ "accounts.get"
+ ),
+ method: "POST",
+ headers: {
+ Authorization: await this._getAuthorizationHeader(),
+ "X-Fern-Language": "JavaScript",
+ "X-Fern-SDK-Name": "@devrev/api",
+ "X-Fern-SDK-Version": "0.0.14",
+ "X-Fern-Runtime": core.RUNTIME.type,
+ "X-Fern-Runtime-Version": core.RUNTIME.version,
+ },
+ contentType: "application/json",
+ requestType: "json",
+ body: serializers.AccountsGetRequest.jsonOrThrow(request, { unrecognizedObjectKeys: "strip" }),
+ timeoutMs: requestOptions?.timeoutInSeconds != null ? requestOptions.timeoutInSeconds * 1000 : 60000,
+ maxRetries: requestOptions?.maxRetries,
+ abortSignal: requestOptions?.abortSignal,
+ });
+ if (_response.ok) {
+ return serializers.AccountsGetResponse.parseOrThrow(_response.body, {
+ unrecognizedObjectKeys: "passthrough",
+ allowUnrecognizedUnionMembers: true,
+ allowUnrecognizedEnumValues: true,
+ skipValidation: true,
+ breadcrumbsPrefix: ["response"],
+ });
+ }
+
+ if (_response.error.reason === "status-code") {
+ switch (_response.error.statusCode) {
+ case 400:
+ throw new DevRev.BadRequestError(
+ serializers.ErrorBadRequest.parseOrThrow(_response.error.body, {
+ unrecognizedObjectKeys: "passthrough",
+ allowUnrecognizedUnionMembers: true,
+ allowUnrecognizedEnumValues: true,
+ skipValidation: true,
+ breadcrumbsPrefix: ["response"],
+ })
+ );
+ case 401:
+ throw new DevRev.UnauthorizedError(
+ serializers.ErrorUnauthorized.parseOrThrow(_response.error.body, {
+ unrecognizedObjectKeys: "passthrough",
+ allowUnrecognizedUnionMembers: true,
+ allowUnrecognizedEnumValues: true,
+ skipValidation: true,
+ breadcrumbsPrefix: ["response"],
+ })
+ );
+ case 403:
+ throw new DevRev.ForbiddenError(
+ serializers.ErrorForbidden.parseOrThrow(_response.error.body, {
+ unrecognizedObjectKeys: "passthrough",
+ allowUnrecognizedUnionMembers: true,
+ allowUnrecognizedEnumValues: true,
+ skipValidation: true,
+ breadcrumbsPrefix: ["response"],
+ })
+ );
+ case 404:
+ throw new DevRev.NotFoundError(
+ serializers.ErrorNotFound.parseOrThrow(_response.error.body, {
+ unrecognizedObjectKeys: "passthrough",
+ allowUnrecognizedUnionMembers: true,
+ allowUnrecognizedEnumValues: true,
+ skipValidation: true,
+ breadcrumbsPrefix: ["response"],
+ })
+ );
+ case 429:
+ throw new DevRev.TooManyRequestsError(
+ serializers.ErrorTooManyRequests.parseOrThrow(_response.error.body, {
+ unrecognizedObjectKeys: "passthrough",
+ allowUnrecognizedUnionMembers: true,
+ allowUnrecognizedEnumValues: true,
+ skipValidation: true,
+ breadcrumbsPrefix: ["response"],
+ })
+ );
+ case 500:
+ throw new DevRev.InternalServerError(
+ serializers.ErrorInternalServerError.parseOrThrow(_response.error.body, {
+ unrecognizedObjectKeys: "passthrough",
+ allowUnrecognizedUnionMembers: true,
+ allowUnrecognizedEnumValues: true,
+ skipValidation: true,
+ breadcrumbsPrefix: ["response"],
+ })
+ );
+ case 503:
+ throw new DevRev.ServiceUnavailableError(
+ serializers.ErrorServiceUnavailable.parseOrThrow(_response.error.body, {
+ unrecognizedObjectKeys: "passthrough",
+ allowUnrecognizedUnionMembers: true,
+ allowUnrecognizedEnumValues: true,
+ skipValidation: true,
+ breadcrumbsPrefix: ["response"],
+ })
+ );
+ default:
+ throw new errors.DevRevError({
+ statusCode: _response.error.statusCode,
+ body: _response.error.body,
+ });
+ }
+ }
+
+ switch (_response.error.reason) {
+ case "non-json":
+ throw new errors.DevRevError({
+ statusCode: _response.error.statusCode,
+ body: _response.error.rawBody,
+ });
+ case "timeout":
+ throw new errors.DevRevTimeoutError();
+ case "unknown":
+ throw new errors.DevRevError({
+ message: _response.error.errorMessage,
+ });
+ }
+ }
+
+ /**
+ * Gets a list of accounts.
+ *
+ * @param {DevRev.AccountsListQuery} request
+ * @param {Accounts.RequestOptions} requestOptions - Request-specific configuration.
+ *
+ * @throws {@link DevRev.BadRequestError}
+ * @throws {@link DevRev.UnauthorizedError}
+ * @throws {@link DevRev.ForbiddenError}
+ * @throws {@link DevRev.NotFoundError}
+ * @throws {@link DevRev.TooManyRequestsError}
+ * @throws {@link DevRev.InternalServerError}
+ * @throws {@link DevRev.ServiceUnavailableError}
+ *
+ * @example
+ * await client.accounts.list({
+ * createdDateAfter: new Date("2023-01-01T12:00:00.000Z"),
+ * createdDateBefore: new Date("2023-01-01T12:00:00.000Z"),
+ * modifiedDateAfter: new Date("2023-01-01T12:00:00.000Z"),
+ * modifiedDateBefore: new Date("2023-01-01T12:00:00.000Z")
+ * })
+ */
+ public async list(
+ request: DevRev.AccountsListQuery = {},
+ requestOptions?: Accounts.RequestOptions
+ ): Promise {
+ const {
+ createdBy,
+ createdDateAfter,
+ createdDateBefore,
+ cursor,
+ customFields,
+ displayName,
+ domains,
+ externalRefs,
+ limit,
+ mode,
+ modifiedDateAfter,
+ modifiedDateBefore,
+ ownedBy,
+ sortBy,
+ stage,
+ tags,
+ } = request;
+ const _queryParams: Record = {};
+ if (createdBy != null) {
+ if (Array.isArray(createdBy)) {
+ _queryParams["created_by"] = createdBy.map((item) => item);
+ } else {
+ _queryParams["created_by"] = createdBy;
+ }
+ }
+
+ if (createdDateAfter != null) {
+ _queryParams["created_date.after"] = createdDateAfter.toISOString();
+ }
+
+ if (createdDateBefore != null) {
+ _queryParams["created_date.before"] = createdDateBefore.toISOString();
+ }
+
+ if (cursor != null) {
+ _queryParams["cursor"] = cursor;
+ }
+
+ if (customFields != null) {
+ _queryParams["custom_fields"] = JSON.stringify(customFields);
+ }
+
+ if (displayName != null) {
+ if (Array.isArray(displayName)) {
+ _queryParams["display_name"] = displayName.map((item) => item);
+ } else {
+ _queryParams["display_name"] = displayName;
+ }
+ }
+
+ if (domains != null) {
+ if (Array.isArray(domains)) {
+ _queryParams["domains"] = domains.map((item) => item);
+ } else {
+ _queryParams["domains"] = domains;
+ }
+ }
+
+ if (externalRefs != null) {
+ if (Array.isArray(externalRefs)) {
+ _queryParams["external_refs"] = externalRefs.map((item) => item);
+ } else {
+ _queryParams["external_refs"] = externalRefs;
+ }
+ }
+
+ if (limit != null) {
+ _queryParams["limit"] = limit.toString();
+ }
+
+ if (mode != null) {
+ _queryParams["mode"] = mode;
+ }
+
+ if (modifiedDateAfter != null) {
+ _queryParams["modified_date.after"] = modifiedDateAfter.toISOString();
+ }
+
+ if (modifiedDateBefore != null) {
+ _queryParams["modified_date.before"] = modifiedDateBefore.toISOString();
+ }
+
+ if (ownedBy != null) {
+ if (Array.isArray(ownedBy)) {
+ _queryParams["owned_by"] = ownedBy.map((item) => item);
+ } else {
+ _queryParams["owned_by"] = ownedBy;
+ }
+ }
+
+ if (sortBy != null) {
+ if (Array.isArray(sortBy)) {
+ _queryParams["sort_by"] = sortBy.map((item) => item);
+ } else {
+ _queryParams["sort_by"] = sortBy;
+ }
+ }
+
+ if (stage != null) {
+ if (Array.isArray(stage)) {
+ _queryParams["stage"] = stage.map((item) => item);
+ } else {
+ _queryParams["stage"] = stage;
+ }
+ }
+
+ if (tags != null) {
+ if (Array.isArray(tags)) {
+ _queryParams["tags"] = tags.map((item) => item);
+ } else {
+ _queryParams["tags"] = tags;
+ }
+ }
+
+ const _response = await (this._options.fetcher ?? core.fetcher)({
+ url: urlJoin(
+ (await core.Supplier.get(this._options.environment)) ?? environments.DevRevEnvironment.Default,
+ "accounts.list"
+ ),
+ method: "GET",
+ headers: {
+ Authorization: await this._getAuthorizationHeader(),
+ "X-Fern-Language": "JavaScript",
+ "X-Fern-SDK-Name": "@devrev/api",
+ "X-Fern-SDK-Version": "0.0.14",
+ "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 serializers.AccountsListResponse.parseOrThrow(_response.body, {
+ unrecognizedObjectKeys: "passthrough",
+ allowUnrecognizedUnionMembers: true,
+ allowUnrecognizedEnumValues: true,
+ skipValidation: true,
+ breadcrumbsPrefix: ["response"],
+ });
+ }
+
+ if (_response.error.reason === "status-code") {
+ switch (_response.error.statusCode) {
+ case 400:
+ throw new DevRev.BadRequestError(
+ serializers.ErrorBadRequest.parseOrThrow(_response.error.body, {
+ unrecognizedObjectKeys: "passthrough",
+ allowUnrecognizedUnionMembers: true,
+ allowUnrecognizedEnumValues: true,
+ skipValidation: true,
+ breadcrumbsPrefix: ["response"],
+ })
+ );
+ case 401:
+ throw new DevRev.UnauthorizedError(
+ serializers.ErrorUnauthorized.parseOrThrow(_response.error.body, {
+ unrecognizedObjectKeys: "passthrough",
+ allowUnrecognizedUnionMembers: true,
+ allowUnrecognizedEnumValues: true,
+ skipValidation: true,
+ breadcrumbsPrefix: ["response"],
+ })
+ );
+ case 403:
+ throw new DevRev.ForbiddenError(
+ serializers.ErrorForbidden.parseOrThrow(_response.error.body, {
+ unrecognizedObjectKeys: "passthrough",
+ allowUnrecognizedUnionMembers: true,
+ allowUnrecognizedEnumValues: true,
+ skipValidation: true,
+ breadcrumbsPrefix: ["response"],
+ })
+ );
+ case 404:
+ throw new DevRev.NotFoundError(
+ serializers.ErrorNotFound.parseOrThrow(_response.error.body, {
+ unrecognizedObjectKeys: "passthrough",
+ allowUnrecognizedUnionMembers: true,
+ allowUnrecognizedEnumValues: true,
+ skipValidation: true,
+ breadcrumbsPrefix: ["response"],
+ })
+ );
+ case 429:
+ throw new DevRev.TooManyRequestsError(
+ serializers.ErrorTooManyRequests.parseOrThrow(_response.error.body, {
+ unrecognizedObjectKeys: "passthrough",
+ allowUnrecognizedUnionMembers: true,
+ allowUnrecognizedEnumValues: true,
+ skipValidation: true,
+ breadcrumbsPrefix: ["response"],
+ })
+ );
+ case 500:
+ throw new DevRev.InternalServerError(
+ serializers.ErrorInternalServerError.parseOrThrow(_response.error.body, {
+ unrecognizedObjectKeys: "passthrough",
+ allowUnrecognizedUnionMembers: true,
+ allowUnrecognizedEnumValues: true,
+ skipValidation: true,
+ breadcrumbsPrefix: ["response"],
+ })
+ );
+ case 503:
+ throw new DevRev.ServiceUnavailableError(
+ serializers.ErrorServiceUnavailable.parseOrThrow(_response.error.body, {
+ unrecognizedObjectKeys: "passthrough",
+ allowUnrecognizedUnionMembers: true,
+ allowUnrecognizedEnumValues: true,
+ skipValidation: true,
+ breadcrumbsPrefix: ["response"],
+ })
+ );
+ default:
+ throw new errors.DevRevError({
+ statusCode: _response.error.statusCode,
+ body: _response.error.body,
+ });
+ }
+ }
+
+ switch (_response.error.reason) {
+ case "non-json":
+ throw new errors.DevRevError({
+ statusCode: _response.error.statusCode,
+ body: _response.error.rawBody,
+ });
+ case "timeout":
+ throw new errors.DevRevTimeoutError();
+ case "unknown":
+ throw new errors.DevRevError({
+ message: _response.error.errorMessage,
+ });
+ }
+ }
+
+ /**
+ * Gets a list of accounts.
+ *
+ * @param {DevRev.AccountsListRequest} request
+ * @param {Accounts.RequestOptions} requestOptions - Request-specific configuration.
+ *
+ * @throws {@link DevRev.BadRequestError}
+ * @throws {@link DevRev.UnauthorizedError}
+ * @throws {@link DevRev.ForbiddenError}
+ * @throws {@link DevRev.NotFoundError}
+ * @throws {@link DevRev.TooManyRequestsError}
+ * @throws {@link DevRev.InternalServerError}
+ * @throws {@link DevRev.ServiceUnavailableError}
+ *
+ * @example
+ * await client.accounts.listPost()
+ */
+ public async listPost(
+ request: DevRev.AccountsListRequest = {},
+ requestOptions?: Accounts.RequestOptions
+ ): Promise {
+ const _response = await (this._options.fetcher ?? core.fetcher)({
+ url: urlJoin(
+ (await core.Supplier.get(this._options.environment)) ?? environments.DevRevEnvironment.Default,
+ "accounts.list"
+ ),
+ method: "POST",
+ headers: {
+ Authorization: await this._getAuthorizationHeader(),
+ "X-Fern-Language": "JavaScript",
+ "X-Fern-SDK-Name": "@devrev/api",
+ "X-Fern-SDK-Version": "0.0.14",
+ "X-Fern-Runtime": core.RUNTIME.type,
+ "X-Fern-Runtime-Version": core.RUNTIME.version,
+ },
+ contentType: "application/json",
+ requestType: "json",
+ body: serializers.AccountsListRequest.jsonOrThrow(request, { unrecognizedObjectKeys: "strip" }),
+ timeoutMs: requestOptions?.timeoutInSeconds != null ? requestOptions.timeoutInSeconds * 1000 : 60000,
+ maxRetries: requestOptions?.maxRetries,
+ abortSignal: requestOptions?.abortSignal,
+ });
+ if (_response.ok) {
+ return serializers.AccountsListResponse.parseOrThrow(_response.body, {
+ unrecognizedObjectKeys: "passthrough",
+ allowUnrecognizedUnionMembers: true,
+ allowUnrecognizedEnumValues: true,
+ skipValidation: true,
+ breadcrumbsPrefix: ["response"],
+ });
+ }
+
+ if (_response.error.reason === "status-code") {
+ switch (_response.error.statusCode) {
+ case 400:
+ throw new DevRev.BadRequestError(
+ serializers.ErrorBadRequest.parseOrThrow(_response.error.body, {
+ unrecognizedObjectKeys: "passthrough",
+ allowUnrecognizedUnionMembers: true,
+ allowUnrecognizedEnumValues: true,
+ skipValidation: true,
+ breadcrumbsPrefix: ["response"],
+ })
+ );
+ case 401:
+ throw new DevRev.UnauthorizedError(
+ serializers.ErrorUnauthorized.parseOrThrow(_response.error.body, {
+ unrecognizedObjectKeys: "passthrough",
+ allowUnrecognizedUnionMembers: true,
+ allowUnrecognizedEnumValues: true,
+ skipValidation: true,
+ breadcrumbsPrefix: ["response"],
+ })
+ );
+ case 403:
+ throw new DevRev.ForbiddenError(
+ serializers.ErrorForbidden.parseOrThrow(_response.error.body, {
+ unrecognizedObjectKeys: "passthrough",
+ allowUnrecognizedUnionMembers: true,
+ allowUnrecognizedEnumValues: true,
+ skipValidation: true,
+ breadcrumbsPrefix: ["response"],
+ })
+ );
+ case 404:
+ throw new DevRev.NotFoundError(
+ serializers.ErrorNotFound.parseOrThrow(_response.error.body, {
+ unrecognizedObjectKeys: "passthrough",
+ allowUnrecognizedUnionMembers: true,
+ allowUnrecognizedEnumValues: true,
+ skipValidation: true,
+ breadcrumbsPrefix: ["response"],
+ })
+ );
+ case 429:
+ throw new DevRev.TooManyRequestsError(
+ serializers.ErrorTooManyRequests.parseOrThrow(_response.error.body, {
+ unrecognizedObjectKeys: "passthrough",
+ allowUnrecognizedUnionMembers: true,
+ allowUnrecognizedEnumValues: true,
+ skipValidation: true,
+ breadcrumbsPrefix: ["response"],
+ })
+ );
+ case 500:
+ throw new DevRev.InternalServerError(
+ serializers.ErrorInternalServerError.parseOrThrow(_response.error.body, {
+ unrecognizedObjectKeys: "passthrough",
+ allowUnrecognizedUnionMembers: true,
+ allowUnrecognizedEnumValues: true,
+ skipValidation: true,
+ breadcrumbsPrefix: ["response"],
+ })
+ );
+ case 503:
+ throw new DevRev.ServiceUnavailableError(
+ serializers.ErrorServiceUnavailable.parseOrThrow(_response.error.body, {
+ unrecognizedObjectKeys: "passthrough",
+ allowUnrecognizedUnionMembers: true,
+ allowUnrecognizedEnumValues: true,
+ skipValidation: true,
+ breadcrumbsPrefix: ["response"],
+ })
+ );
+ default:
+ throw new errors.DevRevError({
+ statusCode: _response.error.statusCode,
+ body: _response.error.body,
+ });
+ }
+ }
+
+ switch (_response.error.reason) {
+ case "non-json":
+ throw new errors.DevRevError({
+ statusCode: _response.error.statusCode,
+ body: _response.error.rawBody,
+ });
+ case "timeout":
+ throw new errors.DevRevTimeoutError();
+ case "unknown":
+ throw new errors.DevRevError({
+ message: _response.error.errorMessage,
+ });
+ }
+ }
+
+ /**
+ * Updates an account's information.
+ *
+ * @param {DevRev.AccountsUpdateRequest} request
+ * @param {Accounts.RequestOptions} requestOptions - Request-specific configuration.
+ *
+ * @throws {@link DevRev.BadRequestError}
+ * @throws {@link DevRev.UnauthorizedError}
+ * @throws {@link DevRev.ForbiddenError}
+ * @throws {@link DevRev.NotFoundError}
+ * @throws {@link DevRev.ConflictError}
+ * @throws {@link DevRev.TooManyRequestsError}
+ * @throws {@link DevRev.InternalServerError}
+ * @throws {@link DevRev.ServiceUnavailableError}
+ *
+ * @example
+ * await client.accounts.update({
+ * id: "ACC-12345"
+ * })
+ */
+ public async update(
+ request: DevRev.AccountsUpdateRequest,
+ requestOptions?: Accounts.RequestOptions
+ ): Promise {
+ const _response = await (this._options.fetcher ?? core.fetcher)({
+ url: urlJoin(
+ (await core.Supplier.get(this._options.environment)) ?? environments.DevRevEnvironment.Default,
+ "accounts.update"
+ ),
+ method: "POST",
+ headers: {
+ Authorization: await this._getAuthorizationHeader(),
+ "X-Fern-Language": "JavaScript",
+ "X-Fern-SDK-Name": "@devrev/api",
+ "X-Fern-SDK-Version": "0.0.14",
+ "X-Fern-Runtime": core.RUNTIME.type,
+ "X-Fern-Runtime-Version": core.RUNTIME.version,
+ },
+ contentType: "application/json",
+ requestType: "json",
+ body: serializers.AccountsUpdateRequest.jsonOrThrow(request, { unrecognizedObjectKeys: "strip" }),
+ timeoutMs: requestOptions?.timeoutInSeconds != null ? requestOptions.timeoutInSeconds * 1000 : 60000,
+ maxRetries: requestOptions?.maxRetries,
+ abortSignal: requestOptions?.abortSignal,
+ });
+ if (_response.ok) {
+ return serializers.AccountsUpdateResponse.parseOrThrow(_response.body, {
+ unrecognizedObjectKeys: "passthrough",
+ allowUnrecognizedUnionMembers: true,
+ allowUnrecognizedEnumValues: true,
+ skipValidation: true,
+ breadcrumbsPrefix: ["response"],
+ });
+ }
+
+ if (_response.error.reason === "status-code") {
+ switch (_response.error.statusCode) {
+ case 400:
+ throw new DevRev.BadRequestError(
+ serializers.ErrorBadRequest.parseOrThrow(_response.error.body, {
+ unrecognizedObjectKeys: "passthrough",
+ allowUnrecognizedUnionMembers: true,
+ allowUnrecognizedEnumValues: true,
+ skipValidation: true,
+ breadcrumbsPrefix: ["response"],
+ })
+ );
+ case 401:
+ throw new DevRev.UnauthorizedError(
+ serializers.ErrorUnauthorized.parseOrThrow(_response.error.body, {
+ unrecognizedObjectKeys: "passthrough",
+ allowUnrecognizedUnionMembers: true,
+ allowUnrecognizedEnumValues: true,
+ skipValidation: true,
+ breadcrumbsPrefix: ["response"],
+ })
+ );
+ case 403:
+ throw new DevRev.ForbiddenError(
+ serializers.ErrorForbidden.parseOrThrow(_response.error.body, {
+ unrecognizedObjectKeys: "passthrough",
+ allowUnrecognizedUnionMembers: true,
+ allowUnrecognizedEnumValues: true,
+ skipValidation: true,
+ breadcrumbsPrefix: ["response"],
+ })
+ );
+ case 404:
+ throw new DevRev.NotFoundError(
+ serializers.ErrorNotFound.parseOrThrow(_response.error.body, {
+ unrecognizedObjectKeys: "passthrough",
+ allowUnrecognizedUnionMembers: true,
+ allowUnrecognizedEnumValues: true,
+ skipValidation: true,
+ breadcrumbsPrefix: ["response"],
+ })
+ );
+ case 409:
+ throw new DevRev.ConflictError(
+ serializers.ErrorConflict.parseOrThrow(_response.error.body, {
+ unrecognizedObjectKeys: "passthrough",
+ allowUnrecognizedUnionMembers: true,
+ allowUnrecognizedEnumValues: true,
+ skipValidation: true,
+ breadcrumbsPrefix: ["response"],
+ })
+ );
+ case 429:
+ throw new DevRev.TooManyRequestsError(
+ serializers.ErrorTooManyRequests.parseOrThrow(_response.error.body, {
+ unrecognizedObjectKeys: "passthrough",
+ allowUnrecognizedUnionMembers: true,
+ allowUnrecognizedEnumValues: true,
+ skipValidation: true,
+ breadcrumbsPrefix: ["response"],
+ })
+ );
+ case 500:
+ throw new DevRev.InternalServerError(
+ serializers.ErrorInternalServerError.parseOrThrow(_response.error.body, {
+ unrecognizedObjectKeys: "passthrough",
+ allowUnrecognizedUnionMembers: true,
+ allowUnrecognizedEnumValues: true,
+ skipValidation: true,
+ breadcrumbsPrefix: ["response"],
+ })
+ );
+ case 503:
+ throw new DevRev.ServiceUnavailableError(
+ serializers.ErrorServiceUnavailable.parseOrThrow(_response.error.body, {
+ unrecognizedObjectKeys: "passthrough",
+ allowUnrecognizedUnionMembers: true,
+ allowUnrecognizedEnumValues: true,
+ skipValidation: true,
+ breadcrumbsPrefix: ["response"],
+ })
+ );
+ default:
+ throw new errors.DevRevError({
+ statusCode: _response.error.statusCode,
+ body: _response.error.body,
+ });
+ }
+ }
+
+ switch (_response.error.reason) {
+ case "non-json":
+ throw new errors.DevRevError({
+ statusCode: _response.error.statusCode,
+ body: _response.error.rawBody,
+ });
+ case "timeout":
+ throw new errors.DevRevTimeoutError();
+ case "unknown":
+ throw new errors.DevRevError({
+ message: _response.error.errorMessage,
+ });
+ }
+ }
+
+ protected async _getAuthorizationHeader(): Promise {
+ const bearer = (await core.Supplier.get(this._options.token)) ?? process?.env["DEVREV_TOKEN"];
+ if (bearer == null) {
+ throw new errors.DevRevError({
+ message: "Please specify DEVREV_TOKEN when instantiating the client.",
+ });
+ }
+
+ return `Bearer ${bearer}`;
+ }
+}
diff --git a/src/api/resources/accounts/client/index.ts b/src/api/resources/accounts/client/index.ts
new file mode 100644
index 0000000..415726b
--- /dev/null
+++ b/src/api/resources/accounts/client/index.ts
@@ -0,0 +1 @@
+export * from "./requests";
diff --git a/src/api/resources/accounts/client/requests/AccountsCreateRequest.ts b/src/api/resources/accounts/client/requests/AccountsCreateRequest.ts
new file mode 100644
index 0000000..6fc2110
--- /dev/null
+++ b/src/api/resources/accounts/client/requests/AccountsCreateRequest.ts
@@ -0,0 +1,44 @@
+/**
+ * This file was auto-generated by Fern from our API Definition.
+ */
+
+import * as DevRev from "../../../../index";
+
+/**
+ * @example
+ * {
+ * displayName: "display_name"
+ * }
+ */
+export interface AccountsCreateRequest {
+ /** The IDs of the artifacts to associate with the account. */
+ artifacts?: string[];
+ /** Application-defined custom fields. */
+ customFields?: Record;
+ /** Description of the account. */
+ description?: string;
+ /** Name of the account. */
+ displayName: string;
+ /** List of company's domain names. Example - ['devrev.ai']. */
+ domains?: string[];
+ /**
+ * External refs are unique identifiers from your customer system of
+ * records, stored as a list.
+ *
+ */
+ externalRefs?: string[];
+ /** List of Dev users owning this account. */
+ ownedBy?: string[];
+ /** Schema fragment IDs associated with this account SOR. */
+ schemaFragmentIds?: string[];
+ /** Tags associated with the account. */
+ tags?: DevRev.SetTagWithValue[];
+ /** The tier of the account. */
+ tier?: string;
+ /**
+ * List of company websites. Example - ['www.devrev.ai',
+ * 'www.marketplace.devrev.ai'].
+ *
+ */
+ websites?: string[];
+}
diff --git a/src/api/resources/accounts/client/requests/AccountsDeleteRequest.ts b/src/api/resources/accounts/client/requests/AccountsDeleteRequest.ts
new file mode 100644
index 0000000..bedab72
--- /dev/null
+++ b/src/api/resources/accounts/client/requests/AccountsDeleteRequest.ts
@@ -0,0 +1,14 @@
+/**
+ * This file was auto-generated by Fern from our API Definition.
+ */
+
+/**
+ * @example
+ * {
+ * id: "ACC-12345"
+ * }
+ */
+export interface AccountsDeleteRequest {
+ /** The ID of account to delete. */
+ id: string;
+}
diff --git a/src/api/resources/accounts/client/requests/AccountsExportQuery.ts b/src/api/resources/accounts/client/requests/AccountsExportQuery.ts
new file mode 100644
index 0000000..1dbdf40
--- /dev/null
+++ b/src/api/resources/accounts/client/requests/AccountsExportQuery.ts
@@ -0,0 +1,73 @@
+/**
+ * This file was auto-generated by Fern from our API Definition.
+ */
+
+/**
+ * @example
+ * {
+ * createdDateAfter: new Date("2023-01-01T12:00:00.000Z"),
+ * createdDateBefore: new Date("2023-01-01T12:00:00.000Z"),
+ * modifiedDateAfter: new Date("2023-01-01T12:00:00.000Z"),
+ * modifiedDateBefore: new Date("2023-01-01T12:00:00.000Z")
+ * }
+ */
+export interface AccountsExportQuery {
+ /**
+ * Filters for accounts created by the specified user(s).
+ */
+ createdBy?: string | string[];
+ /**
+ * Filters for objects created after the provided timestamp (inclusive).
+ */
+ createdDateAfter?: Date;
+ /**
+ * Filters for objects created before the provided timestamp
+ * (inclusive).
+ */
+ createdDateBefore?: Date;
+ /**
+ * Filters for custom fields.
+ */
+ customFields?: Record;
+ /**
+ * Array of display names of accounts to be filtered.
+ */
+ displayName?: string | string[];
+ /**
+ * Domains for accounts to be filtered.
+ */
+ domains?: string | string[];
+ /**
+ * Array of references of accounts to be filtered.
+ */
+ externalRefs?: string | string[];
+ /**
+ * The number of accounts to return. The default is '50'.
+ */
+ first?: number;
+ /**
+ * Filters for objects created after the provided timestamp (inclusive).
+ */
+ modifiedDateAfter?: Date;
+ /**
+ * Filters for objects created before the provided timestamp
+ * (inclusive).
+ */
+ modifiedDateBefore?: Date;
+ /**
+ * Filters for accounts owned by the specified user(s).
+ */
+ ownedBy?: string | string[];
+ /**
+ * Fields to sort the accounts by and the direction to sort them in.
+ */
+ sortBy?: string | string[];
+ /**
+ * Filters for accounts on specified stages.
+ */
+ stage?: string | string[];
+ /**
+ * List of tags to be filtered.
+ */
+ tags?: string | string[];
+}
diff --git a/src/api/resources/accounts/client/requests/AccountsExportRequest.ts b/src/api/resources/accounts/client/requests/AccountsExportRequest.ts
new file mode 100644
index 0000000..142efd2
--- /dev/null
+++ b/src/api/resources/accounts/client/requests/AccountsExportRequest.ts
@@ -0,0 +1,37 @@
+/**
+ * This file was auto-generated by Fern from our API Definition.
+ */
+
+import * as DevRev from "../../../../index";
+
+/**
+ * @example
+ * {}
+ */
+export interface AccountsExportRequest {
+ /** Filters for accounts created by the specified user(s). */
+ createdBy?: string[];
+ createdDate?: DevRev.DateTimeFilter;
+ /** Filters for custom fields. */
+ customFields?: Record;
+ /** Array of display names of accounts to be filtered. */
+ displayName?: string[];
+ /** Domains for accounts to be filtered. */
+ domains?: string[];
+ /** Array of references of accounts to be filtered. */
+ externalRefs?: string[];
+ /** The number of accounts to return. The default is '50'. */
+ first?: number;
+ modifiedDate?: DevRev.DateTimeFilter;
+ /** Filters for accounts owned by the specified user(s). */
+ ownedBy?: string[];
+ /**
+ * Fields to sort the accounts by and the direction to sort them in.
+ *
+ */
+ sortBy?: string[];
+ /** Filters for accounts on specified stages. */
+ stage?: string[];
+ /** List of tags to be filtered. */
+ tags?: string[];
+}
diff --git a/src/api/resources/accounts/client/requests/AccountsGetQuery.ts b/src/api/resources/accounts/client/requests/AccountsGetQuery.ts
new file mode 100644
index 0000000..56890f6
--- /dev/null
+++ b/src/api/resources/accounts/client/requests/AccountsGetQuery.ts
@@ -0,0 +1,16 @@
+/**
+ * This file was auto-generated by Fern from our API Definition.
+ */
+
+/**
+ * @example
+ * {
+ * id: "ACC-12345"
+ * }
+ */
+export interface AccountsGetQuery {
+ /**
+ * The ID of the account to be retrieved.
+ */
+ id: string;
+}
diff --git a/src/api/resources/accounts/client/requests/AccountsGetRequest.ts b/src/api/resources/accounts/client/requests/AccountsGetRequest.ts
new file mode 100644
index 0000000..af525fd
--- /dev/null
+++ b/src/api/resources/accounts/client/requests/AccountsGetRequest.ts
@@ -0,0 +1,14 @@
+/**
+ * This file was auto-generated by Fern from our API Definition.
+ */
+
+/**
+ * @example
+ * {
+ * id: "ACC-12345"
+ * }
+ */
+export interface AccountsGetRequest {
+ /** The ID of the account to be retrieved. */
+ id: string;
+}
diff --git a/src/api/resources/accounts/client/requests/AccountsListQuery.ts b/src/api/resources/accounts/client/requests/AccountsListQuery.ts
new file mode 100644
index 0000000..95254c4
--- /dev/null
+++ b/src/api/resources/accounts/client/requests/AccountsListQuery.ts
@@ -0,0 +1,86 @@
+/**
+ * This file was auto-generated by Fern from our API Definition.
+ */
+
+import * as DevRev from "../../../../index";
+
+/**
+ * @example
+ * {
+ * createdDateAfter: new Date("2023-01-01T12:00:00.000Z"),
+ * createdDateBefore: new Date("2023-01-01T12:00:00.000Z"),
+ * modifiedDateAfter: new Date("2023-01-01T12:00:00.000Z"),
+ * modifiedDateBefore: new Date("2023-01-01T12:00:00.000Z")
+ * }
+ */
+export interface AccountsListQuery {
+ /**
+ * Filters for accounts created by the specified user(s).
+ */
+ createdBy?: string | string[];
+ /**
+ * Filters for objects created after the provided timestamp (inclusive).
+ */
+ createdDateAfter?: Date;
+ /**
+ * Filters for objects created before the provided timestamp
+ * (inclusive).
+ */
+ createdDateBefore?: Date;
+ /**
+ * The cursor to resume iteration from. If not provided, then iteration
+ * starts from the beginning.
+ */
+ cursor?: string;
+ /**
+ * Filters for custom fields.
+ */
+ customFields?: Record;
+ /**
+ * Array of display names of accounts to be filtered.
+ */
+ displayName?: string | string[];
+ /**
+ * Domains for accounts to be filtered.
+ */
+ domains?: string | string[];
+ /**
+ * Array of references of accounts to be filtered.
+ */
+ externalRefs?: string | string[];
+ /**
+ * The maximum number of accounts to return per page. The default is
+ * '50'.
+ */
+ limit?: number;
+ /**
+ * The iteration mode to use, otherwise if not set, then "after" is
+ * used.
+ */
+ mode?: DevRev.ListMode;
+ /**
+ * Filters for objects created after the provided timestamp (inclusive).
+ */
+ modifiedDateAfter?: Date;
+ /**
+ * Filters for objects created before the provided timestamp
+ * (inclusive).
+ */
+ modifiedDateBefore?: Date;
+ /**
+ * Filters for accounts owned by the specified user(s).
+ */
+ ownedBy?: string | string[];
+ /**
+ * Fields to sort the accounts by and the direction to sort them in.
+ */
+ sortBy?: string | string[];
+ /**
+ * Filters for accounts on specified stages.
+ */
+ stage?: string | string[];
+ /**
+ * List of tags to be filtered.
+ */
+ tags?: string | string[];
+}
diff --git a/src/api/resources/accounts/client/requests/AccountsListRequest.ts b/src/api/resources/accounts/client/requests/AccountsListRequest.ts
new file mode 100644
index 0000000..a809633
--- /dev/null
+++ b/src/api/resources/accounts/client/requests/AccountsListRequest.ts
@@ -0,0 +1,48 @@
+/**
+ * This file was auto-generated by Fern from our API Definition.
+ */
+
+import * as DevRev from "../../../../index";
+
+/**
+ * @example
+ * {}
+ */
+export interface AccountsListRequest {
+ /** Filters for accounts created by the specified user(s). */
+ createdBy?: string[];
+ createdDate?: DevRev.DateTimeFilter;
+ /**
+ * The cursor to resume iteration from. If not provided, then
+ * iteration starts from the beginning.
+ *
+ */
+ cursor?: string;
+ /** Filters for custom fields. */
+ customFields?: Record;
+ /** Array of display names of accounts to be filtered. */
+ displayName?: string[];
+ /** Domains for accounts to be filtered. */
+ domains?: string[];
+ /** Array of references of accounts to be filtered. */
+ externalRefs?: string[];
+ /**
+ * The maximum number of accounts to return per page. The default is
+ * '50'.
+ *
+ */
+ limit?: number;
+ mode?: DevRev.ListMode;
+ modifiedDate?: DevRev.DateTimeFilter;
+ /** Filters for accounts owned by the specified user(s). */
+ ownedBy?: string[];
+ /**
+ * Fields to sort the accounts by and the direction to sort them in.
+ *
+ */
+ sortBy?: string[];
+ /** Filters for accounts on specified stages. */
+ stage?: string[];
+ /** List of tags to be filtered. */
+ tags?: string[];
+}
diff --git a/src/api/resources/accounts/client/requests/AccountsUpdateRequest.ts b/src/api/resources/accounts/client/requests/AccountsUpdateRequest.ts
new file mode 100644
index 0000000..9749430
--- /dev/null
+++ b/src/api/resources/accounts/client/requests/AccountsUpdateRequest.ts
@@ -0,0 +1,38 @@
+/**
+ * This file was auto-generated by Fern from our API Definition.
+ */
+
+import * as DevRev from "../../../../index";
+
+/**
+ * @example
+ * {
+ * id: "ACC-12345"
+ * }
+ */
+export interface AccountsUpdateRequest {
+ artifacts?: DevRev.AccountsUpdateRequestArtifacts;
+ /** Application-defined custom fields. */
+ customFields?: Record;
+ /** Updated description of the account. */
+ description?: string;
+ /** Updated display name for the account. */
+ displayName?: string;
+ /**
+ * Updated list of company's domain names. Example - ['devrev.ai'].
+ *
+ */
+ domains?: string[];
+ /** Updated External Refs of account. */
+ externalRefs?: string[];
+ /** The ID of account to update. */
+ id: string;
+ /** Updated list of the users owning this account. */
+ ownedBy?: string[];
+ /** Schema fragment IDs associated with this account SOR. */
+ schemaFragmentIds?: string[];
+ /** Updated tags list associated with the account. */
+ tags?: DevRev.SetTagWithValue[];
+ /** Updated tier of the account. */
+ tier?: string;
+}
diff --git a/src/api/resources/accounts/client/requests/index.ts b/src/api/resources/accounts/client/requests/index.ts
new file mode 100644
index 0000000..e73dfb9
--- /dev/null
+++ b/src/api/resources/accounts/client/requests/index.ts
@@ -0,0 +1,9 @@
+export { type AccountsCreateRequest } from "./AccountsCreateRequest";
+export { type AccountsDeleteRequest } from "./AccountsDeleteRequest";
+export { type AccountsExportQuery } from "./AccountsExportQuery";
+export { type AccountsExportRequest } from "./AccountsExportRequest";
+export { type AccountsGetQuery } from "./AccountsGetQuery";
+export { type AccountsGetRequest } from "./AccountsGetRequest";
+export { type AccountsListQuery } from "./AccountsListQuery";
+export { type AccountsListRequest } from "./AccountsListRequest";
+export { type AccountsUpdateRequest } from "./AccountsUpdateRequest";
diff --git a/src/api/resources/accounts/index.ts b/src/api/resources/accounts/index.ts
new file mode 100644
index 0000000..5ec7692
--- /dev/null
+++ b/src/api/resources/accounts/index.ts
@@ -0,0 +1 @@
+export * from "./client";
diff --git a/src/api/resources/articles/client/Client.ts b/src/api/resources/articles/client/Client.ts
new file mode 100644
index 0000000..29af369
--- /dev/null
+++ b/src/api/resources/articles/client/Client.ts
@@ -0,0 +1,1464 @@
+/**
+ * This file was auto-generated by Fern from our API Definition.
+ */
+
+import * as environments from "../../../../environments";
+import * as core from "../../../../core";
+import * as DevRev from "../../../index";
+import urlJoin from "url-join";
+import * as serializers from "../../../../serialization/index";
+import * as errors from "../../../../errors/index";
+
+export declare namespace Articles {
+ interface Options {
+ environment?: core.Supplier;
+ token?: 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;
+ }
+}
+
+/**
+ * Articles management APIs.
+ */
+export class Articles {
+ constructor(protected readonly _options: Articles.Options = {}) {}
+
+ /**
+ * Get count of articles matching given filter.
+ *
+ * @param {DevRev.ArticlesCountQuery} request
+ * @param {Articles.RequestOptions} requestOptions - Request-specific configuration.
+ *
+ * @throws {@link DevRev.BadRequestError}
+ * @throws {@link DevRev.UnauthorizedError}
+ * @throws {@link DevRev.ForbiddenError}
+ * @throws {@link DevRev.TooManyRequestsError}
+ * @throws {@link DevRev.InternalServerError}
+ * @throws {@link DevRev.ServiceUnavailableError}
+ *
+ * @example
+ * await client.articles.count()
+ */
+ public async count(
+ request: DevRev.ArticlesCountQuery = {},
+ requestOptions?: Articles.RequestOptions
+ ): Promise {
+ const { ancestor, appliesToParts, articleType, authoredBy, createdBy, modifiedBy, ownedBy, scope } = request;
+ const _queryParams: Record = {};
+ if (ancestor != null) {
+ _queryParams["ancestor"] = ancestor;
+ }
+
+ if (appliesToParts != null) {
+ if (Array.isArray(appliesToParts)) {
+ _queryParams["applies_to_parts"] = appliesToParts.map((item) => item);
+ } else {
+ _queryParams["applies_to_parts"] = appliesToParts;
+ }
+ }
+
+ if (articleType != null) {
+ if (Array.isArray(articleType)) {
+ _queryParams["article_type"] = articleType.map((item) => item);
+ } else {
+ _queryParams["article_type"] = articleType;
+ }
+ }
+
+ if (authoredBy != null) {
+ if (Array.isArray(authoredBy)) {
+ _queryParams["authored_by"] = authoredBy.map((item) => item);
+ } else {
+ _queryParams["authored_by"] = authoredBy;
+ }
+ }
+
+ if (createdBy != null) {
+ if (Array.isArray(createdBy)) {
+ _queryParams["created_by"] = createdBy.map((item) => item);
+ } else {
+ _queryParams["created_by"] = createdBy;
+ }
+ }
+
+ if (modifiedBy != null) {
+ if (Array.isArray(modifiedBy)) {
+ _queryParams["modified_by"] = modifiedBy.map((item) => item);
+ } else {
+ _queryParams["modified_by"] = modifiedBy;
+ }
+ }
+
+ if (ownedBy != null) {
+ if (Array.isArray(ownedBy)) {
+ _queryParams["owned_by"] = ownedBy.map((item) => item);
+ } else {
+ _queryParams["owned_by"] = ownedBy;
+ }
+ }
+
+ if (scope != null) {
+ if (Array.isArray(scope)) {
+ _queryParams["scope"] = scope.map((item) => item.toString());
+ } else {
+ _queryParams["scope"] = scope.toString();
+ }
+ }
+
+ const _response = await (this._options.fetcher ?? core.fetcher)({
+ url: urlJoin(
+ (await core.Supplier.get(this._options.environment)) ?? environments.DevRevEnvironment.Default,
+ "articles.count"
+ ),
+ method: "GET",
+ headers: {
+ Authorization: await this._getAuthorizationHeader(),
+ "X-Fern-Language": "JavaScript",
+ "X-Fern-SDK-Name": "@devrev/api",
+ "X-Fern-SDK-Version": "0.0.14",
+ "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 serializers.ArticlesCountResponse.parseOrThrow(_response.body, {
+ unrecognizedObjectKeys: "passthrough",
+ allowUnrecognizedUnionMembers: true,
+ allowUnrecognizedEnumValues: true,
+ skipValidation: true,
+ breadcrumbsPrefix: ["response"],
+ });
+ }
+
+ if (_response.error.reason === "status-code") {
+ switch (_response.error.statusCode) {
+ case 400:
+ throw new DevRev.BadRequestError(
+ serializers.ErrorBadRequest.parseOrThrow(_response.error.body, {
+ unrecognizedObjectKeys: "passthrough",
+ allowUnrecognizedUnionMembers: true,
+ allowUnrecognizedEnumValues: true,
+ skipValidation: true,
+ breadcrumbsPrefix: ["response"],
+ })
+ );
+ case 401:
+ throw new DevRev.UnauthorizedError(
+ serializers.ErrorUnauthorized.parseOrThrow(_response.error.body, {
+ unrecognizedObjectKeys: "passthrough",
+ allowUnrecognizedUnionMembers: true,
+ allowUnrecognizedEnumValues: true,
+ skipValidation: true,
+ breadcrumbsPrefix: ["response"],
+ })
+ );
+ case 403:
+ throw new DevRev.ForbiddenError(
+ serializers.ErrorForbidden.parseOrThrow(_response.error.body, {
+ unrecognizedObjectKeys: "passthrough",
+ allowUnrecognizedUnionMembers: true,
+ allowUnrecognizedEnumValues: true,
+ skipValidation: true,
+ breadcrumbsPrefix: ["response"],
+ })
+ );
+ case 429:
+ throw new DevRev.TooManyRequestsError(
+ serializers.ErrorTooManyRequests.parseOrThrow(_response.error.body, {
+ unrecognizedObjectKeys: "passthrough",
+ allowUnrecognizedUnionMembers: true,
+ allowUnrecognizedEnumValues: true,
+ skipValidation: true,
+ breadcrumbsPrefix: ["response"],
+ })
+ );
+ case 500:
+ throw new DevRev.InternalServerError(
+ serializers.ErrorInternalServerError.parseOrThrow(_response.error.body, {
+ unrecognizedObjectKeys: "passthrough",
+ allowUnrecognizedUnionMembers: true,
+ allowUnrecognizedEnumValues: true,
+ skipValidation: true,
+ breadcrumbsPrefix: ["response"],
+ })
+ );
+ case 503:
+ throw new DevRev.ServiceUnavailableError(
+ serializers.ErrorServiceUnavailable.parseOrThrow(_response.error.body, {
+ unrecognizedObjectKeys: "passthrough",
+ allowUnrecognizedUnionMembers: true,
+ allowUnrecognizedEnumValues: true,
+ skipValidation: true,
+ breadcrumbsPrefix: ["response"],
+ })
+ );
+ default:
+ throw new errors.DevRevError({
+ statusCode: _response.error.statusCode,
+ body: _response.error.body,
+ });
+ }
+ }
+
+ switch (_response.error.reason) {
+ case "non-json":
+ throw new errors.DevRevError({
+ statusCode: _response.error.statusCode,
+ body: _response.error.rawBody,
+ });
+ case "timeout":
+ throw new errors.DevRevTimeoutError();
+ case "unknown":
+ throw new errors.DevRevError({
+ message: _response.error.errorMessage,
+ });
+ }
+ }
+
+ /**
+ * Get count of articles matching given filter.
+ *
+ * @param {DevRev.ArticlesCountRequest} request
+ * @param {Articles.RequestOptions} requestOptions - Request-specific configuration.
+ *
+ * @throws {@link DevRev.BadRequestError}
+ * @throws {@link DevRev.UnauthorizedError}
+ * @throws {@link DevRev.ForbiddenError}
+ * @throws {@link DevRev.TooManyRequestsError}
+ * @throws {@link DevRev.InternalServerError}
+ * @throws {@link DevRev.ServiceUnavailableError}
+ *
+ * @example
+ * await client.articles.countPost()
+ */
+ public async countPost(
+ request: DevRev.ArticlesCountRequest = {},
+ requestOptions?: Articles.RequestOptions
+ ): Promise {
+ const _response = await (this._options.fetcher ?? core.fetcher)({
+ url: urlJoin(
+ (await core.Supplier.get(this._options.environment)) ?? environments.DevRevEnvironment.Default,
+ "articles.count"
+ ),
+ method: "POST",
+ headers: {
+ Authorization: await this._getAuthorizationHeader(),
+ "X-Fern-Language": "JavaScript",
+ "X-Fern-SDK-Name": "@devrev/api",
+ "X-Fern-SDK-Version": "0.0.14",
+ "X-Fern-Runtime": core.RUNTIME.type,
+ "X-Fern-Runtime-Version": core.RUNTIME.version,
+ },
+ contentType: "application/json",
+ requestType: "json",
+ body: serializers.ArticlesCountRequest.jsonOrThrow(request, { unrecognizedObjectKeys: "strip" }),
+ timeoutMs: requestOptions?.timeoutInSeconds != null ? requestOptions.timeoutInSeconds * 1000 : 60000,
+ maxRetries: requestOptions?.maxRetries,
+ abortSignal: requestOptions?.abortSignal,
+ });
+ if (_response.ok) {
+ return serializers.ArticlesCountResponse.parseOrThrow(_response.body, {
+ unrecognizedObjectKeys: "passthrough",
+ allowUnrecognizedUnionMembers: true,
+ allowUnrecognizedEnumValues: true,
+ skipValidation: true,
+ breadcrumbsPrefix: ["response"],
+ });
+ }
+
+ if (_response.error.reason === "status-code") {
+ switch (_response.error.statusCode) {
+ case 400:
+ throw new DevRev.BadRequestError(
+ serializers.ErrorBadRequest.parseOrThrow(_response.error.body, {
+ unrecognizedObjectKeys: "passthrough",
+ allowUnrecognizedUnionMembers: true,
+ allowUnrecognizedEnumValues: true,
+ skipValidation: true,
+ breadcrumbsPrefix: ["response"],
+ })
+ );
+ case 401:
+ throw new DevRev.UnauthorizedError(
+ serializers.ErrorUnauthorized.parseOrThrow(_response.error.body, {
+ unrecognizedObjectKeys: "passthrough",
+ allowUnrecognizedUnionMembers: true,
+ allowUnrecognizedEnumValues: true,
+ skipValidation: true,
+ breadcrumbsPrefix: ["response"],
+ })
+ );
+ case 403:
+ throw new DevRev.ForbiddenError(
+ serializers.ErrorForbidden.parseOrThrow(_response.error.body, {
+ unrecognizedObjectKeys: "passthrough",
+ allowUnrecognizedUnionMembers: true,
+ allowUnrecognizedEnumValues: true,
+ skipValidation: true,
+ breadcrumbsPrefix: ["response"],
+ })
+ );
+ case 429:
+ throw new DevRev.TooManyRequestsError(
+ serializers.ErrorTooManyRequests.parseOrThrow(_response.error.body, {
+ unrecognizedObjectKeys: "passthrough",
+ allowUnrecognizedUnionMembers: true,
+ allowUnrecognizedEnumValues: true,
+ skipValidation: true,
+ breadcrumbsPrefix: ["response"],
+ })
+ );
+ case 500:
+ throw new DevRev.InternalServerError(
+ serializers.ErrorInternalServerError.parseOrThrow(_response.error.body, {
+ unrecognizedObjectKeys: "passthrough",
+ allowUnrecognizedUnionMembers: true,
+ allowUnrecognizedEnumValues: true,
+ skipValidation: true,
+ breadcrumbsPrefix: ["response"],
+ })
+ );
+ case 503:
+ throw new DevRev.ServiceUnavailableError(
+ serializers.ErrorServiceUnavailable.parseOrThrow(_response.error.body, {
+ unrecognizedObjectKeys: "passthrough",
+ allowUnrecognizedUnionMembers: true,
+ allowUnrecognizedEnumValues: true,
+ skipValidation: true,
+ breadcrumbsPrefix: ["response"],
+ })
+ );
+ default:
+ throw new errors.DevRevError({
+ statusCode: _response.error.statusCode,
+ body: _response.error.body,
+ });
+ }
+ }
+
+ switch (_response.error.reason) {
+ case "non-json":
+ throw new errors.DevRevError({
+ statusCode: _response.error.statusCode,
+ body: _response.error.rawBody,
+ });
+ case "timeout":
+ throw new errors.DevRevTimeoutError();
+ case "unknown":
+ throw new errors.DevRevError({
+ message: _response.error.errorMessage,
+ });
+ }
+ }
+
+ /**
+ * Article is an object which can contain a URL or artifacts in the
+ * resource. It also contains the data regarding the owner, author, status
+ * and published date of the object. This call creates an article.
+ *
+ * @param {DevRev.ArticlesCreateRequest} request
+ * @param {Articles.RequestOptions} requestOptions - Request-specific configuration.
+ *
+ * @throws {@link DevRev.BadRequestError}
+ * @throws {@link DevRev.UnauthorizedError}
+ * @throws {@link DevRev.ForbiddenError}
+ * @throws {@link DevRev.TooManyRequestsError}
+ * @throws {@link DevRev.InternalServerError}
+ * @throws {@link DevRev.ServiceUnavailableError}
+ *
+ * @example
+ * await client.articles.create({
+ * appliesToParts: ["PROD-12345"],
+ * ownedBy: ["DEVU-12345"],
+ * resource: {},
+ * title: "title"
+ * })
+ */
+ public async create(
+ request: DevRev.ArticlesCreateRequest,
+ requestOptions?: Articles.RequestOptions
+ ): Promise {
+ const _response = await (this._options.fetcher ?? core.fetcher)({
+ url: urlJoin(
+ (await core.Supplier.get(this._options.environment)) ?? environments.DevRevEnvironment.Default,
+ "articles.create"
+ ),
+ method: "POST",
+ headers: {
+ Authorization: await this._getAuthorizationHeader(),
+ "X-Fern-Language": "JavaScript",
+ "X-Fern-SDK-Name": "@devrev/api",
+ "X-Fern-SDK-Version": "0.0.14",
+ "X-Fern-Runtime": core.RUNTIME.type,
+ "X-Fern-Runtime-Version": core.RUNTIME.version,
+ },
+ contentType: "application/json",
+ requestType: "json",
+ body: serializers.ArticlesCreateRequest.jsonOrThrow(request, { unrecognizedObjectKeys: "strip" }),
+ timeoutMs: requestOptions?.timeoutInSeconds != null ? requestOptions.timeoutInSeconds * 1000 : 60000,
+ maxRetries: requestOptions?.maxRetries,
+ abortSignal: requestOptions?.abortSignal,
+ });
+ if (_response.ok) {
+ return serializers.ArticlesCreateResponse.parseOrThrow(_response.body, {
+ unrecognizedObjectKeys: "passthrough",
+ allowUnrecognizedUnionMembers: true,
+ allowUnrecognizedEnumValues: true,
+ skipValidation: true,
+ breadcrumbsPrefix: ["response"],
+ });
+ }
+
+ if (_response.error.reason === "status-code") {
+ switch (_response.error.statusCode) {
+ case 400:
+ throw new DevRev.BadRequestError(
+ serializers.ErrorBadRequest.parseOrThrow(_response.error.body, {
+ unrecognizedObjectKeys: "passthrough",
+ allowUnrecognizedUnionMembers: true,
+ allowUnrecognizedEnumValues: true,
+ skipValidation: true,
+ breadcrumbsPrefix: ["response"],
+ })
+ );
+ case 401:
+ throw new DevRev.UnauthorizedError(
+ serializers.ErrorUnauthorized.parseOrThrow(_response.error.body, {
+ unrecognizedObjectKeys: "passthrough",
+ allowUnrecognizedUnionMembers: true,
+ allowUnrecognizedEnumValues: true,
+ skipValidation: true,
+ breadcrumbsPrefix: ["response"],
+ })
+ );
+ case 403:
+ throw new DevRev.ForbiddenError(
+ serializers.ErrorForbidden.parseOrThrow(_response.error.body, {
+ unrecognizedObjectKeys: "passthrough",
+ allowUnrecognizedUnionMembers: true,
+ allowUnrecognizedEnumValues: true,
+ skipValidation: true,
+ breadcrumbsPrefix: ["response"],
+ })
+ );
+ case 429:
+ throw new DevRev.TooManyRequestsError(
+ serializers.ErrorTooManyRequests.parseOrThrow(_response.error.body, {
+ unrecognizedObjectKeys: "passthrough",
+ allowUnrecognizedUnionMembers: true,
+ allowUnrecognizedEnumValues: true,
+ skipValidation: true,
+ breadcrumbsPrefix: ["response"],
+ })
+ );
+ case 500:
+ throw new DevRev.InternalServerError(
+ serializers.ErrorInternalServerError.parseOrThrow(_response.error.body, {
+ unrecognizedObjectKeys: "passthrough",
+ allowUnrecognizedUnionMembers: true,
+ allowUnrecognizedEnumValues: true,
+ skipValidation: true,
+ breadcrumbsPrefix: ["response"],
+ })
+ );
+ case 503:
+ throw new DevRev.ServiceUnavailableError(
+ serializers.ErrorServiceUnavailable.parseOrThrow(_response.error.body, {
+ unrecognizedObjectKeys: "passthrough",
+ allowUnrecognizedUnionMembers: true,
+ allowUnrecognizedEnumValues: true,
+ skipValidation: true,
+ breadcrumbsPrefix: ["response"],
+ })
+ );
+ default:
+ throw new errors.DevRevError({
+ statusCode: _response.error.statusCode,
+ body: _response.error.body,
+ });
+ }
+ }
+
+ switch (_response.error.reason) {
+ case "non-json":
+ throw new errors.DevRevError({
+ statusCode: _response.error.statusCode,
+ body: _response.error.rawBody,
+ });
+ case "timeout":
+ throw new errors.DevRevTimeoutError();
+ case "unknown":
+ throw new errors.DevRevError({
+ message: _response.error.errorMessage,
+ });
+ }
+ }
+
+ /**
+ * Deletes an article.
+ *
+ * @param {DevRev.ArticlesDeleteRequest} request
+ * @param {Articles.RequestOptions} requestOptions - Request-specific configuration.
+ *
+ * @throws {@link DevRev.BadRequestError}
+ * @throws {@link DevRev.UnauthorizedError}
+ * @throws {@link DevRev.ForbiddenError}
+ * @throws {@link DevRev.NotFoundError}
+ * @throws {@link DevRev.TooManyRequestsError}
+ * @throws {@link DevRev.InternalServerError}
+ * @throws {@link DevRev.ServiceUnavailableError}
+ *
+ * @example
+ * await client.articles.delete({
+ * id: "ARTICLE-12345"
+ * })
+ */
+ public async delete(
+ request: DevRev.ArticlesDeleteRequest,
+ requestOptions?: Articles.RequestOptions
+ ): Promise {
+ const _response = await (this._options.fetcher ?? core.fetcher)({
+ url: urlJoin(
+ (await core.Supplier.get(this._options.environment)) ?? environments.DevRevEnvironment.Default,
+ "articles.delete"
+ ),
+ method: "POST",
+ headers: {
+ Authorization: await this._getAuthorizationHeader(),
+ "X-Fern-Language": "JavaScript",
+ "X-Fern-SDK-Name": "@devrev/api",
+ "X-Fern-SDK-Version": "0.0.14",
+ "X-Fern-Runtime": core.RUNTIME.type,
+ "X-Fern-Runtime-Version": core.RUNTIME.version,
+ },
+ contentType: "application/json",
+ requestType: "json",
+ body: serializers.ArticlesDeleteRequest.jsonOrThrow(request, { unrecognizedObjectKeys: "strip" }),
+ timeoutMs: requestOptions?.timeoutInSeconds != null ? requestOptions.timeoutInSeconds * 1000 : 60000,
+ maxRetries: requestOptions?.maxRetries,
+ abortSignal: requestOptions?.abortSignal,
+ });
+ if (_response.ok) {
+ return serializers.ArticlesDeleteResponse.parseOrThrow(_response.body, {
+ unrecognizedObjectKeys: "passthrough",
+ allowUnrecognizedUnionMembers: true,
+ allowUnrecognizedEnumValues: true,
+ skipValidation: true,
+ breadcrumbsPrefix: ["response"],
+ });
+ }
+
+ if (_response.error.reason === "status-code") {
+ switch (_response.error.statusCode) {
+ case 400:
+ throw new DevRev.BadRequestError(
+ serializers.ErrorBadRequest.parseOrThrow(_response.error.body, {
+ unrecognizedObjectKeys: "passthrough",
+ allowUnrecognizedUnionMembers: true,
+ allowUnrecognizedEnumValues: true,
+ skipValidation: true,
+ breadcrumbsPrefix: ["response"],
+ })
+ );
+ case 401:
+ throw new DevRev.UnauthorizedError(
+ serializers.ErrorUnauthorized.parseOrThrow(_response.error.body, {
+ unrecognizedObjectKeys: "passthrough",
+ allowUnrecognizedUnionMembers: true,
+ allowUnrecognizedEnumValues: true,
+ skipValidation: true,
+ breadcrumbsPrefix: ["response"],
+ })
+ );
+ case 403:
+ throw new DevRev.ForbiddenError(
+ serializers.ErrorForbidden.parseOrThrow(_response.error.body, {
+ unrecognizedObjectKeys: "passthrough",
+ allowUnrecognizedUnionMembers: true,
+ allowUnrecognizedEnumValues: true,
+ skipValidation: true,
+ breadcrumbsPrefix: ["response"],
+ })
+ );
+ case 404:
+ throw new DevRev.NotFoundError(
+ serializers.ErrorNotFound.parseOrThrow(_response.error.body, {
+ unrecognizedObjectKeys: "passthrough",
+ allowUnrecognizedUnionMembers: true,
+ allowUnrecognizedEnumValues: true,
+ skipValidation: true,
+ breadcrumbsPrefix: ["response"],
+ })
+ );
+ case 429:
+ throw new DevRev.TooManyRequestsError(
+ serializers.ErrorTooManyRequests.parseOrThrow(_response.error.body, {
+ unrecognizedObjectKeys: "passthrough",
+ allowUnrecognizedUnionMembers: true,
+ allowUnrecognizedEnumValues: true,
+ skipValidation: true,
+ breadcrumbsPrefix: ["response"],
+ })
+ );
+ case 500:
+ throw new DevRev.InternalServerError(
+ serializers.ErrorInternalServerError.parseOrThrow(_response.error.body, {
+ unrecognizedObjectKeys: "passthrough",
+ allowUnrecognizedUnionMembers: true,
+ allowUnrecognizedEnumValues: true,
+ skipValidation: true,
+ breadcrumbsPrefix: ["response"],
+ })
+ );
+ case 503:
+ throw new DevRev.ServiceUnavailableError(
+ serializers.ErrorServiceUnavailable.parseOrThrow(_response.error.body, {
+ unrecognizedObjectKeys: "passthrough",
+ allowUnrecognizedUnionMembers: true,
+ allowUnrecognizedEnumValues: true,
+ skipValidation: true,
+ breadcrumbsPrefix: ["response"],
+ })
+ );
+ default:
+ throw new errors.DevRevError({
+ statusCode: _response.error.statusCode,
+ body: _response.error.body,
+ });
+ }
+ }
+
+ switch (_response.error.reason) {
+ case "non-json":
+ throw new errors.DevRevError({
+ statusCode: _response.error.statusCode,
+ body: _response.error.rawBody,
+ });
+ case "timeout":
+ throw new errors.DevRevTimeoutError();
+ case "unknown":
+ throw new errors.DevRevError({
+ message: _response.error.errorMessage,
+ });
+ }
+ }
+
+ /**
+ * Gets an article.
+ *
+ * @param {DevRev.GetArticleQuery} request
+ * @param {Articles.RequestOptions} requestOptions - Request-specific configuration.
+ *
+ * @throws {@link DevRev.BadRequestError}
+ * @throws {@link DevRev.UnauthorizedError}
+ * @throws {@link DevRev.ForbiddenError}
+ * @throws {@link DevRev.NotFoundError}
+ * @throws {@link DevRev.TooManyRequestsError}
+ * @throws {@link DevRev.InternalServerError}
+ * @throws {@link DevRev.ServiceUnavailableError}
+ *
+ * @example
+ * await client.articles.get({
+ * id: "ARTICLE-12345"
+ * })
+ */
+ public async get(
+ request: DevRev.GetArticleQuery,
+ requestOptions?: Articles.RequestOptions
+ ): Promise {
+ const { id } = request;
+ const _queryParams: Record = {};
+ _queryParams["id"] = id;
+ const _response = await (this._options.fetcher ?? core.fetcher)({
+ url: urlJoin(
+ (await core.Supplier.get(this._options.environment)) ?? environments.DevRevEnvironment.Default,
+ "articles.get"
+ ),
+ method: "GET",
+ headers: {
+ Authorization: await this._getAuthorizationHeader(),
+ "X-Fern-Language": "JavaScript",
+ "X-Fern-SDK-Name": "@devrev/api",
+ "X-Fern-SDK-Version": "0.0.14",
+ "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 serializers.ArticlesGetResponse.parseOrThrow(_response.body, {
+ unrecognizedObjectKeys: "passthrough",
+ allowUnrecognizedUnionMembers: true,
+ allowUnrecognizedEnumValues: true,
+ skipValidation: true,
+ breadcrumbsPrefix: ["response"],
+ });
+ }
+
+ if (_response.error.reason === "status-code") {
+ switch (_response.error.statusCode) {
+ case 400:
+ throw new DevRev.BadRequestError(
+ serializers.ErrorBadRequest.parseOrThrow(_response.error.body, {
+ unrecognizedObjectKeys: "passthrough",
+ allowUnrecognizedUnionMembers: true,
+ allowUnrecognizedEnumValues: true,
+ skipValidation: true,
+ breadcrumbsPrefix: ["response"],
+ })
+ );
+ case 401:
+ throw new DevRev.UnauthorizedError(
+ serializers.ErrorUnauthorized.parseOrThrow(_response.error.body, {
+ unrecognizedObjectKeys: "passthrough",
+ allowUnrecognizedUnionMembers: true,
+ allowUnrecognizedEnumValues: true,
+ skipValidation: true,
+ breadcrumbsPrefix: ["response"],
+ })
+ );
+ case 403:
+ throw new DevRev.ForbiddenError(
+ serializers.ErrorForbidden.parseOrThrow(_response.error.body, {
+ unrecognizedObjectKeys: "passthrough",
+ allowUnrecognizedUnionMembers: true,
+ allowUnrecognizedEnumValues: true,
+ skipValidation: true,
+ breadcrumbsPrefix: ["response"],
+ })
+ );
+ case 404:
+ throw new DevRev.NotFoundError(
+ serializers.ErrorNotFound.parseOrThrow(_response.error.body, {
+ unrecognizedObjectKeys: "passthrough",
+ allowUnrecognizedUnionMembers: true,
+ allowUnrecognizedEnumValues: true,
+ skipValidation: true,
+ breadcrumbsPrefix: ["response"],
+ })
+ );
+ case 429:
+ throw new DevRev.TooManyRequestsError(
+ serializers.ErrorTooManyRequests.parseOrThrow(_response.error.body, {
+ unrecognizedObjectKeys: "passthrough",
+ allowUnrecognizedUnionMembers: true,
+ allowUnrecognizedEnumValues: true,
+ skipValidation: true,
+ breadcrumbsPrefix: ["response"],
+ })
+ );
+ case 500:
+ throw new DevRev.InternalServerError(
+ serializers.ErrorInternalServerError.parseOrThrow(_response.error.body, {
+ unrecognizedObjectKeys: "passthrough",
+ allowUnrecognizedUnionMembers: true,
+ allowUnrecognizedEnumValues: true,
+ skipValidation: true,
+ breadcrumbsPrefix: ["response"],
+ })
+ );
+ case 503:
+ throw new DevRev.ServiceUnavailableError(
+ serializers.ErrorServiceUnavailable.parseOrThrow(_response.error.body, {
+ unrecognizedObjectKeys: "passthrough",
+ allowUnrecognizedUnionMembers: true,
+ allowUnrecognizedEnumValues: true,
+ skipValidation: true,
+ breadcrumbsPrefix: ["response"],
+ })
+ );
+ default:
+ throw new errors.DevRevError({
+ statusCode: _response.error.statusCode,
+ body: _response.error.body,
+ });
+ }
+ }
+
+ switch (_response.error.reason) {
+ case "non-json":
+ throw new errors.DevRevError({
+ statusCode: _response.error.statusCode,
+ body: _response.error.rawBody,
+ });
+ case "timeout":
+ throw new errors.DevRevTimeoutError();
+ case "unknown":
+ throw new errors.DevRevError({
+ message: _response.error.errorMessage,
+ });
+ }
+ }
+
+ /**
+ * Gets an article.
+ *
+ * @param {DevRev.ArticlesGetRequest} request
+ * @param {Articles.RequestOptions} requestOptions - Request-specific configuration.
+ *
+ * @throws {@link DevRev.BadRequestError}
+ * @throws {@link DevRev.UnauthorizedError}
+ * @throws {@link DevRev.ForbiddenError}
+ * @throws {@link DevRev.NotFoundError}
+ * @throws {@link DevRev.TooManyRequestsError}
+ * @throws {@link DevRev.InternalServerError}
+ * @throws {@link DevRev.ServiceUnavailableError}
+ *
+ * @example
+ * await client.articles.getPost({
+ * id: "ARTICLE-12345"
+ * })
+ */
+ public async getPost(
+ request: DevRev.ArticlesGetRequest,
+ requestOptions?: Articles.RequestOptions
+ ): Promise {
+ const _response = await (this._options.fetcher ?? core.fetcher)({
+ url: urlJoin(
+ (await core.Supplier.get(this._options.environment)) ?? environments.DevRevEnvironment.Default,
+ "articles.get"
+ ),
+ method: "POST",
+ headers: {
+ Authorization: await this._getAuthorizationHeader(),
+ "X-Fern-Language": "JavaScript",
+ "X-Fern-SDK-Name": "@devrev/api",
+ "X-Fern-SDK-Version": "0.0.14",
+ "X-Fern-Runtime": core.RUNTIME.type,
+ "X-Fern-Runtime-Version": core.RUNTIME.version,
+ },
+ contentType: "application/json",
+ requestType: "json",
+ body: serializers.ArticlesGetRequest.jsonOrThrow(request, { unrecognizedObjectKeys: "strip" }),
+ timeoutMs: requestOptions?.timeoutInSeconds != null ? requestOptions.timeoutInSeconds * 1000 : 60000,
+ maxRetries: requestOptions?.maxRetries,
+ abortSignal: requestOptions?.abortSignal,
+ });
+ if (_response.ok) {
+ return serializers.ArticlesGetResponse.parseOrThrow(_response.body, {
+ unrecognizedObjectKeys: "passthrough",
+ allowUnrecognizedUnionMembers: true,
+ allowUnrecognizedEnumValues: true,
+ skipValidation: true,
+ breadcrumbsPrefix: ["response"],
+ });
+ }
+
+ if (_response.error.reason === "status-code") {
+ switch (_response.error.statusCode) {
+ case 400:
+ throw new DevRev.BadRequestError(
+ serializers.ErrorBadRequest.parseOrThrow(_response.error.body, {
+ unrecognizedObjectKeys: "passthrough",
+ allowUnrecognizedUnionMembers: true,
+ allowUnrecognizedEnumValues: true,
+ skipValidation: true,
+ breadcrumbsPrefix: ["response"],
+ })
+ );
+ case 401:
+ throw new DevRev.UnauthorizedError(
+ serializers.ErrorUnauthorized.parseOrThrow(_response.error.body, {
+ unrecognizedObjectKeys: "passthrough",
+ allowUnrecognizedUnionMembers: true,
+ allowUnrecognizedEnumValues: true,
+ skipValidation: true,
+ breadcrumbsPrefix: ["response"],
+ })
+ );
+ case 403:
+ throw new DevRev.ForbiddenError(
+ serializers.ErrorForbidden.parseOrThrow(_response.error.body, {
+ unrecognizedObjectKeys: "passthrough",
+ allowUnrecognizedUnionMembers: true,
+ allowUnrecognizedEnumValues: true,
+ skipValidation: true,
+ breadcrumbsPrefix: ["response"],
+ })
+ );
+ case 404:
+ throw new DevRev.NotFoundError(
+ serializers.ErrorNotFound.parseOrThrow(_response.error.body, {
+ unrecognizedObjectKeys: "passthrough",
+ allowUnrecognizedUnionMembers: true,
+ allowUnrecognizedEnumValues: true,
+ skipValidation: true,
+ breadcrumbsPrefix: ["response"],
+ })
+ );
+ case 429:
+ throw new DevRev.TooManyRequestsError(
+ serializers.ErrorTooManyRequests.parseOrThrow(_response.error.body, {
+ unrecognizedObjectKeys: "passthrough",
+ allowUnrecognizedUnionMembers: true,
+ allowUnrecognizedEnumValues: true,
+ skipValidation: true,
+ breadcrumbsPrefix: ["response"],
+ })
+ );
+ case 500:
+ throw new DevRev.InternalServerError(
+ serializers.ErrorInternalServerError.parseOrThrow(_response.error.body, {
+ unrecognizedObjectKeys: "passthrough",
+ allowUnrecognizedUnionMembers: true,
+ allowUnrecognizedEnumValues: true,
+ skipValidation: true,
+ breadcrumbsPrefix: ["response"],
+ })
+ );
+ case 503:
+ throw new DevRev.ServiceUnavailableError(
+ serializers.ErrorServiceUnavailable.parseOrThrow(_response.error.body, {
+ unrecognizedObjectKeys: "passthrough",
+ allowUnrecognizedUnionMembers: true,
+ allowUnrecognizedEnumValues: true,
+ skipValidation: true,
+ breadcrumbsPrefix: ["response"],
+ })
+ );
+ default:
+ throw new errors.DevRevError({
+ statusCode: _response.error.statusCode,
+ body: _response.error.body,
+ });
+ }
+ }
+
+ switch (_response.error.reason) {
+ case "non-json":
+ throw new errors.DevRevError({
+ statusCode: _response.error.statusCode,
+ body: _response.error.rawBody,
+ });
+ case "timeout":
+ throw new errors.DevRevTimeoutError();
+ case "unknown":
+ throw new errors.DevRevError({
+ message: _response.error.errorMessage,
+ });
+ }
+ }
+
+ /**
+ * Lists a collection of articles.
+ *
+ * @param {DevRev.ListArticlesQuery} request
+ * @param {Articles.RequestOptions} requestOptions - Request-specific configuration.
+ *
+ * @throws {@link DevRev.BadRequestError}
+ * @throws {@link DevRev.UnauthorizedError}
+ * @throws {@link DevRev.ForbiddenError}
+ * @throws {@link DevRev.TooManyRequestsError}
+ * @throws {@link DevRev.InternalServerError}
+ * @throws {@link DevRev.ServiceUnavailableError}
+ *
+ * @example
+ * await client.articles.list()
+ */
+ public async list(
+ request: DevRev.ListArticlesQuery = {},
+ requestOptions?: Articles.RequestOptions
+ ): Promise {
+ const { appliesToParts, articleType, authoredBy, createdBy, cursor, limit, mode, modifiedBy, ownedBy, scope } =
+ request;
+ const _queryParams: Record = {};
+ if (appliesToParts != null) {
+ if (Array.isArray(appliesToParts)) {
+ _queryParams["applies_to_parts"] = appliesToParts.map((item) => item);
+ } else {
+ _queryParams["applies_to_parts"] = appliesToParts;
+ }
+ }
+
+ if (articleType != null) {
+ if (Array.isArray(articleType)) {
+ _queryParams["article_type"] = articleType.map((item) => item);
+ } else {
+ _queryParams["article_type"] = articleType;
+ }
+ }
+
+ if (authoredBy != null) {
+ if (Array.isArray(authoredBy)) {
+ _queryParams["authored_by"] = authoredBy.map((item) => item);
+ } else {
+ _queryParams["authored_by"] = authoredBy;
+ }
+ }
+
+ if (createdBy != null) {
+ if (Array.isArray(createdBy)) {
+ _queryParams["created_by"] = createdBy.map((item) => item);
+ } else {
+ _queryParams["created_by"] = createdBy;
+ }
+ }
+
+ if (cursor != null) {
+ _queryParams["cursor"] = cursor;
+ }
+
+ if (limit != null) {
+ _queryParams["limit"] = limit.toString();
+ }
+
+ if (mode != null) {
+ _queryParams["mode"] = mode;
+ }
+
+ if (modifiedBy != null) {
+ if (Array.isArray(modifiedBy)) {
+ _queryParams["modified_by"] = modifiedBy.map((item) => item);
+ } else {
+ _queryParams["modified_by"] = modifiedBy;
+ }
+ }
+
+ if (ownedBy != null) {
+ if (Array.isArray(ownedBy)) {
+ _queryParams["owned_by"] = ownedBy.map((item) => item);
+ } else {
+ _queryParams["owned_by"] = ownedBy;
+ }
+ }
+
+ if (scope != null) {
+ if (Array.isArray(scope)) {
+ _queryParams["scope"] = scope.map((item) => item.toString());
+ } else {
+ _queryParams["scope"] = scope.toString();
+ }
+ }
+
+ const _response = await (this._options.fetcher ?? core.fetcher)({
+ url: urlJoin(
+ (await core.Supplier.get(this._options.environment)) ?? environments.DevRevEnvironment.Default,
+ "articles.list"
+ ),
+ method: "GET",
+ headers: {
+ Authorization: await this._getAuthorizationHeader(),
+ "X-Fern-Language": "JavaScript",
+ "X-Fern-SDK-Name": "@devrev/api",
+ "X-Fern-SDK-Version": "0.0.14",
+ "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 serializers.ArticlesListResponse.parseOrThrow(_response.body, {
+ unrecognizedObjectKeys: "passthrough",
+ allowUnrecognizedUnionMembers: true,
+ allowUnrecognizedEnumValues: true,
+ skipValidation: true,
+ breadcrumbsPrefix: ["response"],
+ });
+ }
+
+ if (_response.error.reason === "status-code") {
+ switch (_response.error.statusCode) {
+ case 400:
+ throw new DevRev.BadRequestError(
+ serializers.ErrorBadRequest.parseOrThrow(_response.error.body, {
+ unrecognizedObjectKeys: "passthrough",
+ allowUnrecognizedUnionMembers: true,
+ allowUnrecognizedEnumValues: true,
+ skipValidation: true,
+ breadcrumbsPrefix: ["response"],
+ })
+ );
+ case 401:
+ throw new DevRev.UnauthorizedError(
+ serializers.ErrorUnauthorized.parseOrThrow(_response.error.body, {
+ unrecognizedObjectKeys: "passthrough",
+ allowUnrecognizedUnionMembers: true,
+ allowUnrecognizedEnumValues: true,
+ skipValidation: true,
+ breadcrumbsPrefix: ["response"],
+ })
+ );
+ case 403:
+ throw new DevRev.ForbiddenError(
+ serializers.ErrorForbidden.parseOrThrow(_response.error.body, {
+ unrecognizedObjectKeys: "passthrough",
+ allowUnrecognizedUnionMembers: true,
+ allowUnrecognizedEnumValues: true,
+ skipValidation: true,
+ breadcrumbsPrefix: ["response"],
+ })
+ );
+ case 429:
+ throw new DevRev.TooManyRequestsError(
+ serializers.ErrorTooManyRequests.parseOrThrow(_response.error.body, {
+ unrecognizedObjectKeys: "passthrough",
+ allowUnrecognizedUnionMembers: true,
+ allowUnrecognizedEnumValues: true,
+ skipValidation: true,
+ breadcrumbsPrefix: ["response"],
+ })
+ );
+ case 500:
+ throw new DevRev.InternalServerError(
+ serializers.ErrorInternalServerError.parseOrThrow(_response.error.body, {
+ unrecognizedObjectKeys: "passthrough",
+ allowUnrecognizedUnionMembers: true,
+ allowUnrecognizedEnumValues: true,
+ skipValidation: true,
+ breadcrumbsPrefix: ["response"],
+ })
+ );
+ case 503:
+ throw new DevRev.ServiceUnavailableError(
+ serializers.ErrorServiceUnavailable.parseOrThrow(_response.error.body, {
+ unrecognizedObjectKeys: "passthrough",
+ allowUnrecognizedUnionMembers: true,
+ allowUnrecognizedEnumValues: true,
+ skipValidation: true,
+ breadcrumbsPrefix: ["response"],
+ })
+ );
+ default:
+ throw new errors.DevRevError({
+ statusCode: _response.error.statusCode,
+ body: _response.error.body,
+ });
+ }
+ }
+
+ switch (_response.error.reason) {
+ case "non-json":
+ throw new errors.DevRevError({
+ statusCode: _response.error.statusCode,
+ body: _response.error.rawBody,
+ });
+ case "timeout":
+ throw new errors.DevRevTimeoutError();
+ case "unknown":
+ throw new errors.DevRevError({
+ message: _response.error.errorMessage,
+ });
+ }
+ }
+
+ /**
+ * Lists a collection of articles.
+ *
+ * @param {DevRev.ArticlesListRequest} request
+ * @param {Articles.RequestOptions} requestOptions - Request-specific configuration.
+ *
+ * @throws {@link DevRev.BadRequestError}
+ * @throws {@link DevRev.UnauthorizedError}
+ * @throws {@link DevRev.ForbiddenError}
+ * @throws {@link DevRev.TooManyRequestsError}
+ * @throws {@link DevRev.InternalServerError}
+ * @throws {@link DevRev.ServiceUnavailableError}
+ *
+ * @example
+ * await client.articles.listPost()
+ */
+ public async listPost(
+ request: DevRev.ArticlesListRequest = {},
+ requestOptions?: Articles.RequestOptions
+ ): Promise {
+ const _response = await (this._options.fetcher ?? core.fetcher)({
+ url: urlJoin(
+ (await core.Supplier.get(this._options.environment)) ?? environments.DevRevEnvironment.Default,
+ "articles.list"
+ ),
+ method: "POST",
+ headers: {
+ Authorization: await this._getAuthorizationHeader(),
+ "X-Fern-Language": "JavaScript",
+ "X-Fern-SDK-Name": "@devrev/api",
+ "X-Fern-SDK-Version": "0.0.14",
+ "X-Fern-Runtime": core.RUNTIME.type,
+ "X-Fern-Runtime-Version": core.RUNTIME.version,
+ },
+ contentType: "application/json",
+ requestType: "json",
+ body: serializers.ArticlesListRequest.jsonOrThrow(request, { unrecognizedObjectKeys: "strip" }),
+ timeoutMs: requestOptions?.timeoutInSeconds != null ? requestOptions.timeoutInSeconds * 1000 : 60000,
+ maxRetries: requestOptions?.maxRetries,
+ abortSignal: requestOptions?.abortSignal,
+ });
+ if (_response.ok) {
+ return serializers.ArticlesListResponse.parseOrThrow(_response.body, {
+ unrecognizedObjectKeys: "passthrough",
+ allowUnrecognizedUnionMembers: true,
+ allowUnrecognizedEnumValues: true,
+ skipValidation: true,
+ breadcrumbsPrefix: ["response"],
+ });
+ }
+
+ if (_response.error.reason === "status-code") {
+ switch (_response.error.statusCode) {
+ case 400:
+ throw new DevRev.BadRequestError(
+ serializers.ErrorBadRequest.parseOrThrow(_response.error.body, {
+ unrecognizedObjectKeys: "passthrough",
+ allowUnrecognizedUnionMembers: true,
+ allowUnrecognizedEnumValues: true,
+ skipValidation: true,
+ breadcrumbsPrefix: ["response"],
+ })
+ );
+ case 401:
+ throw new DevRev.UnauthorizedError(
+ serializers.ErrorUnauthorized.parseOrThrow(_response.error.body, {
+ unrecognizedObjectKeys: "passthrough",
+ allowUnrecognizedUnionMembers: true,
+ allowUnrecognizedEnumValues: true,
+ skipValidation: true,
+ breadcrumbsPrefix: ["response"],
+ })
+ );
+ case 403:
+ throw new DevRev.ForbiddenError(
+ serializers.ErrorForbidden.parseOrThrow(_response.error.body, {
+ unrecognizedObjectKeys: "passthrough",
+ allowUnrecognizedUnionMembers: true,
+ allowUnrecognizedEnumValues: true,
+ skipValidation: true,
+ breadcrumbsPrefix: ["response"],
+ })
+ );
+ case 429:
+ throw new DevRev.TooManyRequestsError(
+ serializers.ErrorTooManyRequests.parseOrThrow(_response.error.body, {
+ unrecognizedObjectKeys: "passthrough",
+ allowUnrecognizedUnionMembers: true,
+ allowUnrecognizedEnumValues: true,
+ skipValidation: true,
+ breadcrumbsPrefix: ["response"],
+ })
+ );
+ case 500:
+ throw new DevRev.InternalServerError(
+ serializers.ErrorInternalServerError.parseOrThrow(_response.error.body, {
+ unrecognizedObjectKeys: "passthrough",
+ allowUnrecognizedUnionMembers: true,
+ allowUnrecognizedEnumValues: true,
+ skipValidation: true,
+ breadcrumbsPrefix: ["response"],
+ })
+ );
+ case 503:
+ throw new DevRev.ServiceUnavailableError(
+ serializers.ErrorServiceUnavailable.parseOrThrow(_response.error.body, {
+ unrecognizedObjectKeys: "passthrough",
+ allowUnrecognizedUnionMembers: true,
+ allowUnrecognizedEnumValues: true,
+ skipValidation: true,
+ breadcrumbsPrefix: ["response"],
+ })
+ );
+ default:
+ throw new errors.DevRevError({
+ statusCode: _response.error.statusCode,
+ body: _response.error.body,
+ });
+ }
+ }
+
+ switch (_response.error.reason) {
+ case "non-json":
+ throw new errors.DevRevError({
+ statusCode: _response.error.statusCode,
+ body: _response.error.rawBody,
+ });
+ case "timeout":
+ throw new errors.DevRevTimeoutError();
+ case "unknown":
+ throw new errors.DevRevError({
+ message: _response.error.errorMessage,
+ });
+ }
+ }
+
+ /**
+ * Updates an article.
+ *
+ * @param {DevRev.ArticlesUpdateRequest} request
+ * @param {Articles.RequestOptions} requestOptions - Request-specific configuration.
+ *
+ * @throws {@link DevRev.BadRequestError}
+ * @throws {@link DevRev.UnauthorizedError}
+ * @throws {@link DevRev.ForbiddenError}
+ * @throws {@link DevRev.NotFoundError}
+ * @throws {@link DevRev.TooManyRequestsError}
+ * @throws {@link DevRev.InternalServerError}
+ * @throws {@link DevRev.ServiceUnavailableError}
+ *
+ * @example
+ * await client.articles.update({
+ * id: "ARTICLE-12345"
+ * })
+ */
+ public async update(
+ request: DevRev.ArticlesUpdateRequest,
+ requestOptions?: Articles.RequestOptions
+ ): Promise {
+ const _response = await (this._options.fetcher ?? core.fetcher)({
+ url: urlJoin(
+ (await core.Supplier.get(this._options.environment)) ?? environments.DevRevEnvironment.Default,
+ "articles.update"
+ ),
+ method: "POST",
+ headers: {
+ Authorization: await this._getAuthorizationHeader(),
+ "X-Fern-Language": "JavaScript",
+ "X-Fern-SDK-Name": "@devrev/api",
+ "X-Fern-SDK-Version": "0.0.14",
+ "X-Fern-Runtime": core.RUNTIME.type,
+ "X-Fern-Runtime-Version": core.RUNTIME.version,
+ },
+ contentType: "application/json",
+ requestType: "json",
+ body: serializers.ArticlesUpdateRequest.jsonOrThrow(request, { unrecognizedObjectKeys: "strip" }),
+ timeoutMs: requestOptions?.timeoutInSeconds != null ? requestOptions.timeoutInSeconds * 1000 : 60000,
+ maxRetries: requestOptions?.maxRetries,
+ abortSignal: requestOptions?.abortSignal,
+ });
+ if (_response.ok) {
+ return serializers.ArticlesUpdateResponse.parseOrThrow(_response.body, {
+ unrecognizedObjectKeys: "passthrough",
+ allowUnrecognizedUnionMembers: true,
+ allowUnrecognizedEnumValues: true,
+ skipValidation: true,
+ breadcrumbsPrefix: ["response"],
+ });
+ }
+
+ if (_response.error.reason === "status-code") {
+ switch (_response.error.statusCode) {
+ case 400:
+ throw new DevRev.BadRequestError(
+ serializers.ErrorBadRequest.parseOrThrow(_response.error.body, {
+ unrecognizedObjectKeys: "passthrough",
+ allowUnrecognizedUnionMembers: true,
+ allowUnrecognizedEnumValues: true,
+ skipValidation: true,
+ breadcrumbsPrefix: ["response"],
+ })
+ );
+ case 401:
+ throw new DevRev.UnauthorizedError(
+ serializers.ErrorUnauthorized.parseOrThrow(_response.error.body, {
+ unrecognizedObjectKeys: "passthrough",
+ allowUnrecognizedUnionMembers: true,
+ allowUnrecognizedEnumValues: true,
+ skipValidation: true,
+ breadcrumbsPrefix: ["response"],
+ })
+ );
+ case 403:
+ throw new DevRev.ForbiddenError(
+ serializers.ErrorForbidden.parseOrThrow(_response.error.body, {
+ unrecognizedObjectKeys: "passthrough",
+ allowUnrecognizedUnionMembers: true,
+ allowUnrecognizedEnumValues: true,
+ skipValidation: true,
+ breadcrumbsPrefix: ["response"],
+ })
+ );
+ case 404:
+ throw new DevRev.NotFoundError(
+ serializers.ErrorNotFound.parseOrThrow(_response.error.body, {
+ unrecognizedObjectKeys: "passthrough",
+ allowUnrecognizedUnionMembers: true,
+ allowUnrecognizedEnumValues: true,
+ skipValidation: true,
+ breadcrumbsPrefix: ["response"],
+ })
+ );
+ case 429:
+ throw new DevRev.TooManyRequestsError(
+ serializers.ErrorTooManyRequests.parseOrThrow(_response.error.body, {
+ unrecognizedObjectKeys: "passthrough",
+ allowUnrecognizedUnionMembers: true,
+ allowUnrecognizedEnumValues: true,
+ skipValidation: true,
+ breadcrumbsPrefix: ["response"],
+ })
+ );
+ case 500:
+ throw new DevRev.InternalServerError(
+ serializers.ErrorInternalServerError.parseOrThrow(_response.error.body, {
+ unrecognizedObjectKeys: "passthrough",
+ allowUnrecognizedUnionMembers: true,
+ allowUnrecognizedEnumValues: true,
+ skipValidation: true,
+ breadcrumbsPrefix: ["response"],
+ })
+ );
+ case 503:
+ throw new DevRev.ServiceUnavailableError(
+ serializers.ErrorServiceUnavailable.parseOrThrow(_response.error.body, {
+ unrecognizedObjectKeys: "passthrough",
+ allowUnrecognizedUnionMembers: true,
+ allowUnrecognizedEnumValues: true,
+ skipValidation: true,
+ breadcrumbsPrefix: ["response"],
+ })
+ );
+ default:
+ throw new errors.DevRevError({
+ statusCode: _response.error.statusCode,
+ body: _response.error.body,
+ });
+ }
+ }
+
+ switch (_response.error.reason) {
+ case "non-json":
+ throw new errors.DevRevError({
+ statusCode: _response.error.statusCode,
+ body: _response.error.rawBody,
+ });
+ case "timeout":
+ throw new errors.DevRevTimeoutError();
+ case "unknown":
+ throw new errors.DevRevError({
+ message: _response.error.errorMessage,
+ });
+ }
+ }
+
+ protected async _getAuthorizationHeader(): Promise {
+ const bearer = (await core.Supplier.get(this._options.token)) ?? process?.env["DEVREV_TOKEN"];
+ if (bearer == null) {
+ throw new errors.DevRevError({
+ message: "Please specify DEVREV_TOKEN when instantiating the client.",
+ });
+ }
+
+ return `Bearer ${bearer}`;
+ }
+}
diff --git a/src/api/resources/articles/client/index.ts b/src/api/resources/articles/client/index.ts
new file mode 100644
index 0000000..415726b
--- /dev/null
+++ b/src/api/resources/articles/client/index.ts
@@ -0,0 +1 @@
+export * from "./requests";
diff --git a/src/api/resources/articles/client/requests/ArticlesCountQuery.ts b/src/api/resources/articles/client/requests/ArticlesCountQuery.ts
new file mode 100644
index 0000000..6c41b7b
--- /dev/null
+++ b/src/api/resources/articles/client/requests/ArticlesCountQuery.ts
@@ -0,0 +1,46 @@
+/**
+ * This file was auto-generated by Fern from our API Definition.
+ */
+
+import * as DevRev from "../../../../index";
+
+/**
+ * @example
+ * {}
+ */
+export interface ArticlesCountQuery {
+ /**
+ * The ancestor directory of the articles.
+ */
+ ancestor?: string;
+ /**
+ * Filters for articles belonging to any of the provided parts.
+ */
+ appliesToParts?: string | string[];
+ /**
+ * Filter for the type of articles. If this is not provided, then
+ * articles that are not content blocks are returned.
+ */
+ articleType?: DevRev.ArticleType | DevRev.ArticleType[];
+ /**
+ * Filters for articles authored by any of the provided users.
+ */
+ authoredBy?: string | string[];
+ /**
+ * Filters for articles created by any of the provided users.
+ */
+ createdBy?: string | string[];
+ /**
+ * Filters for articles modified by any of the provided users.
+ */
+ modifiedBy?: string | string[];
+ /**
+ * Filters for articles owned by any of the provided users.
+ */
+ ownedBy?: string | string[];
+ /**
+ * Filter for the scope of the articles. If this is not provided, then
+ * only external articles are returned.
+ */
+ scope?: number | number[];
+}
diff --git a/src/api/resources/articles/client/requests/ArticlesCountRequest.ts b/src/api/resources/articles/client/requests/ArticlesCountRequest.ts
new file mode 100644
index 0000000..8221fd2
--- /dev/null
+++ b/src/api/resources/articles/client/requests/ArticlesCountRequest.ts
@@ -0,0 +1,50 @@
+/**
+ * This file was auto-generated by Fern from our API Definition.
+ */
+
+import * as DevRev from "../../../../index";
+
+/**
+ * @example
+ * {}
+ */
+export interface ArticlesCountRequest {
+ /** The ancestor directory of the articles. */
+ ancestor?: string;
+ /**
+ * Filters for articles belonging to any of the provided parts.
+ *
+ */
+ appliesToParts?: string[];
+ /**
+ * Filter for the type of articles. If this is not provided, then
+ * articles that are not content blocks are returned.
+ *
+ */
+ articleType?: DevRev.ArticleType[];
+ /**
+ * Filters for articles authored by any of the provided users.
+ *
+ */
+ authoredBy?: string[];
+ /**
+ * Filters for articles created by any of the provided users.
+ *
+ */
+ createdBy?: string[];
+ /**
+ * Filters for articles modified by any of the provided users.
+ *
+ */
+ modifiedBy?: string[];
+ /** Filters for articles owned by any of the provided users. */
+ ownedBy?: string[];
+ /**
+ * Filter for the scope of the articles. If this is not provided, then
+ * only external articles are returned.
+ *
+ */
+ scope?: number[];
+ /** Filter for articles based on intended audience. */
+ sharedWith?: DevRev.SharedWithMembershipFilter[];
+}
diff --git a/src/api/resources/articles/client/requests/ArticlesCreateRequest.ts b/src/api/resources/articles/client/requests/ArticlesCreateRequest.ts
new file mode 100644
index 0000000..a8cbbe3
--- /dev/null
+++ b/src/api/resources/articles/client/requests/ArticlesCreateRequest.ts
@@ -0,0 +1,48 @@
+/**
+ * This file was auto-generated by Fern from our API Definition.
+ */
+
+import * as DevRev from "../../../../index";
+
+/**
+ * @example
+ * {
+ * appliesToParts: ["PROD-12345"],
+ * ownedBy: ["DEVU-12345"],
+ * resource: {},
+ * title: "title"
+ * }
+ */
+export interface ArticlesCreateRequest {
+ accessLevel?: DevRev.AccessLevel;
+ /** The parts that the article applies to. */
+ appliesToParts: string[];
+ articleType?: DevRev.ArticleType;
+ /** The authors of the article. */
+ authoredBy?: string[];
+ /** Description for the article. */
+ description?: string;
+ /** ID of the extracted content artifact. */
+ extractedContent?: string[];
+ /** Language of the article. */
+ language?: string;
+ /** The users that own the article. */
+ ownedBy: string[];
+ /** The parent directory of the article. */
+ parent?: string;
+ /** The published date of the article. */
+ publishedAt?: Date;
+ resource: DevRev.ArticlesCreateRequestResource;
+ /** The scope of the article. */
+ scope?: number;
+ /**
+ * Information about the role the member receives due to the share.
+ *
+ */
+ sharedWith?: DevRev.SetSharedWithMembership[];
+ status?: DevRev.ArticleStatus;
+ /** Tags associated with the article. */
+ tags?: DevRev.SetTagWithValue[];
+ /** Name of the article. */
+ title: string;
+}
diff --git a/src/api/resources/articles/client/requests/ArticlesDeleteRequest.ts b/src/api/resources/articles/client/requests/ArticlesDeleteRequest.ts
new file mode 100644
index 0000000..0446906
--- /dev/null
+++ b/src/api/resources/articles/client/requests/ArticlesDeleteRequest.ts
@@ -0,0 +1,14 @@
+/**
+ * This file was auto-generated by Fern from our API Definition.
+ */
+
+/**
+ * @example
+ * {
+ * id: "ARTICLE-12345"
+ * }
+ */
+export interface ArticlesDeleteRequest {
+ /** The ID of the article to delete. */
+ id: string;
+}
diff --git a/src/api/resources/articles/client/requests/ArticlesGetRequest.ts b/src/api/resources/articles/client/requests/ArticlesGetRequest.ts
new file mode 100644
index 0000000..7378101
--- /dev/null
+++ b/src/api/resources/articles/client/requests/ArticlesGetRequest.ts
@@ -0,0 +1,14 @@
+/**
+ * This file was auto-generated by Fern from our API Definition.
+ */
+
+/**
+ * @example
+ * {
+ * id: "ARTICLE-12345"
+ * }
+ */
+export interface ArticlesGetRequest {
+ /** The ID of the required article. */
+ id: string;
+}
diff --git a/src/api/resources/articles/client/requests/ArticlesListRequest.ts b/src/api/resources/articles/client/requests/ArticlesListRequest.ts
new file mode 100644
index 0000000..dc2efc2
--- /dev/null
+++ b/src/api/resources/articles/client/requests/ArticlesListRequest.ts
@@ -0,0 +1,60 @@
+/**
+ * This file was auto-generated by Fern from our API Definition.
+ */
+
+import * as DevRev from "../../../../index";
+
+/**
+ * @example
+ * {}
+ */
+export interface ArticlesListRequest {
+ /**
+ * Filters for articles belonging to any of the provided parts.
+ *
+ */
+ appliesToParts?: string[];
+ /**
+ * Filter for the type of articles. If this is not provided, then
+ * articles that are not content blocks are returned.
+ *
+ */
+ articleType?: DevRev.ArticleType[];
+ /**
+ * Filters for articles authored by any of the provided users.
+ *
+ */
+ authoredBy?: string[];
+ /**
+ * Filters for articles created by any of the provided users.
+ *
+ */
+ createdBy?: string[];
+ /**
+ * The cursor to resume iteration from. If not provided, then
+ * iteration starts from the beginning.
+ *
+ */
+ cursor?: string;
+ /**
+ * The maximum number of articles to return. The default is '50'.
+ *
+ */
+ limit?: number;
+ mode?: DevRev.ListMode;
+ /**
+ * Filters for articles modified by any of the provided users.
+ *
+ */
+ modifiedBy?: string[];
+ /** Filters for articles owned by any of the provided users. */
+ ownedBy?: string[];
+ /**
+ * Filter for the scope of the articles. If this is not provided, then
+ * only external articles are returned.
+ *
+ */
+ scope?: number[];
+ /** Filter for articles based on intended audience. */
+ sharedWith?: DevRev.SharedWithMembershipFilter[];
+}
diff --git a/src/api/resources/articles/client/requests/ArticlesUpdateRequest.ts b/src/api/resources/articles/client/requests/ArticlesUpdateRequest.ts
new file mode 100644
index 0000000..25ab70b
--- /dev/null
+++ b/src/api/resources/articles/client/requests/ArticlesUpdateRequest.ts
@@ -0,0 +1,45 @@
+/**
+ * This file was auto-generated by Fern from our API Definition.
+ */
+
+import * as DevRev from "../../../../index";
+
+/**
+ * @example
+ * {
+ * id: "ARTICLE-12345"
+ * }
+ */
+export interface ArticlesUpdateRequest {
+ accessLevel?: DevRev.AccessLevel;
+ appliesToParts?: DevRev.ArticlesUpdateRequestAppliesToParts;
+ artifacts?: DevRev.ArticlesUpdateRequestArtifacts;
+ authoredBy?: DevRev.ArticlesUpdateRequestAuthoredBy;
+ /**
+ * Updated description of the article object, or unchanged if not
+ * provided.
+ *
+ */
+ description?: string;
+ extractedContent?: DevRev.ArticlesUpdateRequestExtractedContent;
+ /** The article's ID. */
+ id: string;
+ /** Updates the language of the article. */
+ language?: string;
+ ownedBy?: DevRev.ArticlesUpdateRequestOwnedBy;
+ /** The updated parent directory for the article. */
+ parent?: string;
+ /** Updates the the latest published version. */
+ publishedVersion?: string;
+ reorder?: DevRev.ArticlesUpdateRequestReorder;
+ sharedWith?: DevRev.ArticlesUpdateRequestSharedWith;
+ status?: DevRev.ArticleStatus;
+ tags?: DevRev.ArticlesUpdateRequestTags;
+ /**
+ * Updated title of the article object, or unchanged if not provided.
+ *
+ */
+ title?: string;
+ /** Updates the URL of the external article. */
+ url?: string;
+}
diff --git a/src/api/resources/articles/client/requests/GetArticleQuery.ts b/src/api/resources/articles/client/requests/GetArticleQuery.ts
new file mode 100644
index 0000000..304c72a
--- /dev/null
+++ b/src/api/resources/articles/client/requests/GetArticleQuery.ts
@@ -0,0 +1,16 @@
+/**
+ * This file was auto-generated by Fern from our API Definition.
+ */
+
+/**
+ * @example
+ * {
+ * id: "ARTICLE-12345"
+ * }
+ */
+export interface GetArticleQuery {
+ /**
+ * The ID of the required article.
+ */
+ id: string;
+}
diff --git a/src/api/resources/articles/client/requests/ListArticlesQuery.ts b/src/api/resources/articles/client/requests/ListArticlesQuery.ts
new file mode 100644
index 0000000..0390b27
--- /dev/null
+++ b/src/api/resources/articles/client/requests/ListArticlesQuery.ts
@@ -0,0 +1,56 @@
+/**
+ * This file was auto-generated by Fern from our API Definition.
+ */
+
+import * as DevRev from "../../../../index";
+
+/**
+ * @example
+ * {}
+ */
+export interface ListArticlesQuery {
+ /**
+ * Filters for articles belonging to any of the provided parts.
+ */
+ appliesToParts?: string | string[];
+ /**
+ * Filter for the type of articles. If this is not provided, then
+ * articles that are not content blocks are returned.
+ */
+ articleType?: DevRev.ArticleType | DevRev.ArticleType[];
+ /**
+ * Filters for articles authored by any of the provided users.
+ */
+ authoredBy?: string | string[];
+ /**
+ * Filters for articles created by any of the provided users.
+ */
+ createdBy?: string | string[];
+ /**
+ * The cursor to resume iteration from. If not provided, then iteration
+ * starts from the beginning.
+ */
+ cursor?: string;
+ /**
+ * The maximum number of articles to return. The default is '50'.
+ */
+ limit?: number;
+ /**
+ * The iteration mode to use, otherwise if not set, then "after" is
+ * used.
+ */
+ mode?: DevRev.ListMode;
+ /**
+ * Filters for articles modified by any of the provided users.
+ */
+ modifiedBy?: string | string[];
+ /**
+ * Filters for articles owned by any of the provided users.
+ */
+ ownedBy?: string | string[];
+ /**
+ * Filter for the scope of the articles. If this is not provided, then
+ * only external articles are returned.
+ */
+ scope?: number | number[];
+}
diff --git a/src/api/resources/articles/client/requests/index.ts b/src/api/resources/articles/client/requests/index.ts
new file mode 100644
index 0000000..d85c9c0
--- /dev/null
+++ b/src/api/resources/articles/client/requests/index.ts
@@ -0,0 +1,9 @@
+export { type ArticlesCountQuery } from "./ArticlesCountQuery";
+export { type ArticlesCountRequest } from "./ArticlesCountRequest";
+export { type ArticlesCreateRequest } from "./ArticlesCreateRequest";
+export { type ArticlesDeleteRequest } from "./ArticlesDeleteRequest";
+export { type GetArticleQuery } from "./GetArticleQuery";
+export { type ArticlesGetRequest } from "./ArticlesGetRequest";
+export { type ListArticlesQuery } from "./ListArticlesQuery";
+export { type ArticlesListRequest } from "./ArticlesListRequest";
+export { type ArticlesUpdateRequest } from "./ArticlesUpdateRequest";
diff --git a/src/api/resources/articles/index.ts b/src/api/resources/articles/index.ts
new file mode 100644
index 0000000..5ec7692
--- /dev/null
+++ b/src/api/resources/articles/index.ts
@@ -0,0 +1 @@
+export * from "./client";
diff --git a/src/api/resources/artifacts/client/Client.ts b/src/api/resources/artifacts/client/Client.ts
new file mode 100644
index 0000000..24b0145
--- /dev/null
+++ b/src/api/resources/artifacts/client/Client.ts
@@ -0,0 +1,322 @@
+/**
+ * This file was auto-generated by Fern from our API Definition.
+ */
+
+import * as environments from "../../../../environments";
+import * as core from "../../../../core";
+import * as DevRev from "../../../index";
+import * as serializers from "../../../../serialization/index";
+import urlJoin from "url-join";
+import * as errors from "../../../../errors/index";
+
+export declare namespace Artifacts {
+ interface Options {
+ environment?: core.Supplier;
+ token?: 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;
+ }
+}
+
+/**
+ * Artifact (file) management APIs.
+ */
+export class Artifacts {
+ constructor(protected readonly _options: Artifacts.Options = {}) {}
+
+ /**
+ * Creates an artifact and generates an upload URL for its data.
+ *
+ * @param {DevRev.ArtifactsPrepareRequest} request
+ * @param {Artifacts.RequestOptions} requestOptions - Request-specific configuration.
+ *
+ * @throws {@link DevRev.BadRequestError}
+ * @throws {@link DevRev.UnauthorizedError}
+ * @throws {@link DevRev.ForbiddenError}
+ * @throws {@link DevRev.TooManyRequestsError}
+ * @throws {@link DevRev.InternalServerError}
+ * @throws {@link DevRev.ServiceUnavailableError}
+ *
+ * @example
+ * await client.artifacts.prepare({
+ * fileName: "file_name"
+ * })
+ */
+ public async prepare(
+ request: DevRev.ArtifactsPrepareRequest,
+ requestOptions?: Artifacts.RequestOptions
+ ): Promise {
+ const _response = await (this._options.fetcher ?? core.fetcher)({
+ url: urlJoin(
+ (await core.Supplier.get(this._options.environment)) ?? environments.DevRevEnvironment.Default,
+ "artifacts.prepare"
+ ),
+ method: "POST",
+ headers: {
+ Authorization: await this._getAuthorizationHeader(),
+ "X-Fern-Language": "JavaScript",
+ "X-Fern-SDK-Name": "@devrev/api",
+ "X-Fern-SDK-Version": "0.0.14",
+ "X-Fern-Runtime": core.RUNTIME.type,
+ "X-Fern-Runtime-Version": core.RUNTIME.version,
+ },
+ contentType: "application/json",
+ requestType: "json",
+ body: serializers.ArtifactsPrepareRequest.jsonOrThrow(request, { unrecognizedObjectKeys: "strip" }),
+ timeoutMs: requestOptions?.timeoutInSeconds != null ? requestOptions.timeoutInSeconds * 1000 : 60000,
+ maxRetries: requestOptions?.maxRetries,
+ abortSignal: requestOptions?.abortSignal,
+ });
+ if (_response.ok) {
+ return serializers.ArtifactsPrepareResponse.parseOrThrow(_response.body, {
+ unrecognizedObjectKeys: "passthrough",
+ allowUnrecognizedUnionMembers: true,
+ allowUnrecognizedEnumValues: true,
+ skipValidation: true,
+ breadcrumbsPrefix: ["response"],
+ });
+ }
+
+ if (_response.error.reason === "status-code") {
+ switch (_response.error.statusCode) {
+ case 400:
+ throw new DevRev.BadRequestError(
+ serializers.ErrorBadRequest.parseOrThrow(_response.error.body, {
+ unrecognizedObjectKeys: "passthrough",
+ allowUnrecognizedUnionMembers: true,
+ allowUnrecognizedEnumValues: true,
+ skipValidation: true,
+ breadcrumbsPrefix: ["response"],
+ })
+ );
+ case 401:
+ throw new DevRev.UnauthorizedError(
+ serializers.ErrorUnauthorized.parseOrThrow(_response.error.body, {
+ unrecognizedObjectKeys: "passthrough",
+ allowUnrecognizedUnionMembers: true,
+ allowUnrecognizedEnumValues: true,
+ skipValidation: true,
+ breadcrumbsPrefix: ["response"],
+ })
+ );
+ case 403:
+ throw new DevRev.ForbiddenError(
+ serializers.ErrorForbidden.parseOrThrow(_response.error.body, {
+ unrecognizedObjectKeys: "passthrough",
+ allowUnrecognizedUnionMembers: true,
+ allowUnrecognizedEnumValues: true,
+ skipValidation: true,
+ breadcrumbsPrefix: ["response"],
+ })
+ );
+ case 429:
+ throw new DevRev.TooManyRequestsError(
+ serializers.ErrorTooManyRequests.parseOrThrow(_response.error.body, {
+ unrecognizedObjectKeys: "passthrough",
+ allowUnrecognizedUnionMembers: true,
+ allowUnrecognizedEnumValues: true,
+ skipValidation: true,
+ breadcrumbsPrefix: ["response"],
+ })
+ );
+ case 500:
+ throw new DevRev.InternalServerError(
+ serializers.ErrorInternalServerError.parseOrThrow(_response.error.body, {
+ unrecognizedObjectKeys: "passthrough",
+ allowUnrecognizedUnionMembers: true,
+ allowUnrecognizedEnumValues: true,
+ skipValidation: true,
+ breadcrumbsPrefix: ["response"],
+ })
+ );
+ case 503:
+ throw new DevRev.ServiceUnavailableError(
+ serializers.ErrorServiceUnavailable.parseOrThrow(_response.error.body, {
+ unrecognizedObjectKeys: "passthrough",
+ allowUnrecognizedUnionMembers: true,
+ allowUnrecognizedEnumValues: true,
+ skipValidation: true,
+ breadcrumbsPrefix: ["response"],
+ })
+ );
+ default:
+ throw new errors.DevRevError({
+ statusCode: _response.error.statusCode,
+ body: _response.error.body,
+ });
+ }
+ }
+
+ switch (_response.error.reason) {
+ case "non-json":
+ throw new errors.DevRevError({
+ statusCode: _response.error.statusCode,
+ body: _response.error.rawBody,
+ });
+ case "timeout":
+ throw new errors.DevRevTimeoutError();
+ case "unknown":
+ throw new errors.DevRevError({
+ message: _response.error.errorMessage,
+ });
+ }
+ }
+
+ /**
+ * Prepares a new version for an artifact, returning the URL and form data
+ * to upload the updated file.
+ *
+ * @param {DevRev.ArtifactsVersionsPrepareRequest} request
+ * @param {Artifacts.RequestOptions} requestOptions - Request-specific configuration.
+ *
+ * @throws {@link DevRev.BadRequestError}
+ * @throws {@link DevRev.UnauthorizedError}
+ * @throws {@link DevRev.ForbiddenError}
+ * @throws {@link DevRev.TooManyRequestsError}
+ * @throws {@link DevRev.InternalServerError}
+ * @throws {@link DevRev.ServiceUnavailableError}
+ *
+ * @example
+ * await client.artifacts.versionsPrepare({
+ * id: "ARTIFACT-12345"
+ * })
+ */
+ public async versionsPrepare(
+ request: DevRev.ArtifactsVersionsPrepareRequest,
+ requestOptions?: Artifacts.RequestOptions
+ ): Promise {
+ const _response = await (this._options.fetcher ?? core.fetcher)({
+ url: urlJoin(
+ (await core.Supplier.get(this._options.environment)) ?? environments.DevRevEnvironment.Default,
+ "artifacts.versions.prepare"
+ ),
+ method: "POST",
+ headers: {
+ Authorization: await this._getAuthorizationHeader(),
+ "X-Fern-Language": "JavaScript",
+ "X-Fern-SDK-Name": "@devrev/api",
+ "X-Fern-SDK-Version": "0.0.14",
+ "X-Fern-Runtime": core.RUNTIME.type,
+ "X-Fern-Runtime-Version": core.RUNTIME.version,
+ },
+ contentType: "application/json",
+ requestType: "json",
+ body: serializers.ArtifactsVersionsPrepareRequest.jsonOrThrow(request, { unrecognizedObjectKeys: "strip" }),
+ timeoutMs: requestOptions?.timeoutInSeconds != null ? requestOptions.timeoutInSeconds * 1000 : 60000,
+ maxRetries: requestOptions?.maxRetries,
+ abortSignal: requestOptions?.abortSignal,
+ });
+ if (_response.ok) {
+ return serializers.ArtifactsVersionsPrepareResponse.parseOrThrow(_response.body, {
+ unrecognizedObjectKeys: "passthrough",
+ allowUnrecognizedUnionMembers: true,
+ allowUnrecognizedEnumValues: true,
+ skipValidation: true,
+ breadcrumbsPrefix: ["response"],
+ });
+ }
+
+ if (_response.error.reason === "status-code") {
+ switch (_response.error.statusCode) {
+ case 400:
+ throw new DevRev.BadRequestError(
+ serializers.ErrorBadRequest.parseOrThrow(_response.error.body, {
+ unrecognizedObjectKeys: "passthrough",
+ allowUnrecognizedUnionMembers: true,
+ allowUnrecognizedEnumValues: true,
+ skipValidation: true,
+ breadcrumbsPrefix: ["response"],
+ })
+ );
+ case 401:
+ throw new DevRev.UnauthorizedError(
+ serializers.ErrorUnauthorized.parseOrThrow(_response.error.body, {
+ unrecognizedObjectKeys: "passthrough",
+ allowUnrecognizedUnionMembers: true,
+ allowUnrecognizedEnumValues: true,
+ skipValidation: true,
+ breadcrumbsPrefix: ["response"],
+ })
+ );
+ case 403:
+ throw new DevRev.ForbiddenError(
+ serializers.ErrorForbidden.parseOrThrow(_response.error.body, {
+ unrecognizedObjectKeys: "passthrough",
+ allowUnrecognizedUnionMembers: true,
+ allowUnrecognizedEnumValues: true,
+ skipValidation: true,
+ breadcrumbsPrefix: ["response"],
+ })
+ );
+ case 429:
+ throw new DevRev.TooManyRequestsError(
+ serializers.ErrorTooManyRequests.parseOrThrow(_response.error.body, {
+ unrecognizedObjectKeys: "passthrough",
+ allowUnrecognizedUnionMembers: true,
+ allowUnrecognizedEnumValues: true,
+ skipValidation: true,
+ breadcrumbsPrefix: ["response"],
+ })
+ );
+ case 500:
+ throw new DevRev.InternalServerError(
+ serializers.ErrorInternalServerError.parseOrThrow(_response.error.body, {
+ unrecognizedObjectKeys: "passthrough",
+ allowUnrecognizedUnionMembers: true,
+ allowUnrecognizedEnumValues: true,
+ skipValidation: true,
+ breadcrumbsPrefix: ["response"],
+ })
+ );
+ case 503:
+ throw new DevRev.ServiceUnavailableError(
+ serializers.ErrorServiceUnavailable.parseOrThrow(_response.error.body, {
+ unrecognizedObjectKeys: "passthrough",
+ allowUnrecognizedUnionMembers: true,
+ allowUnrecognizedEnumValues: true,
+ skipValidation: true,
+ breadcrumbsPrefix: ["response"],
+ })
+ );
+ default:
+ throw new errors.DevRevError({
+ statusCode: _response.error.statusCode,
+ body: _response.error.body,
+ });
+ }
+ }
+
+ switch (_response.error.reason) {
+ case "non-json":
+ throw new errors.DevRevError({
+ statusCode: _response.error.statusCode,
+ body: _response.error.rawBody,
+ });
+ case "timeout":
+ throw new errors.DevRevTimeoutError();
+ case "unknown":
+ throw new errors.DevRevError({
+ message: _response.error.errorMessage,
+ });
+ }
+ }
+
+ protected async _getAuthorizationHeader(): Promise {
+ const bearer = (await core.Supplier.get(this._options.token)) ?? process?.env["DEVREV_TOKEN"];
+ if (bearer == null) {
+ throw new errors.DevRevError({
+ message: "Please specify DEVREV_TOKEN when instantiating the client.",
+ });
+ }
+
+ return `Bearer ${bearer}`;
+ }
+}
diff --git a/src/api/resources/artifacts/client/index.ts b/src/api/resources/artifacts/client/index.ts
new file mode 100644
index 0000000..415726b
--- /dev/null
+++ b/src/api/resources/artifacts/client/index.ts
@@ -0,0 +1 @@
+export * from "./requests";
diff --git a/src/api/resources/artifacts/client/requests/ArtifactsPrepareRequest.ts b/src/api/resources/artifacts/client/requests/ArtifactsPrepareRequest.ts
new file mode 100644
index 0000000..b0ec25c
--- /dev/null
+++ b/src/api/resources/artifacts/client/requests/ArtifactsPrepareRequest.ts
@@ -0,0 +1,16 @@
+/**
+ * This file was auto-generated by Fern from our API Definition.
+ */
+
+/**
+ * @example
+ * {
+ * fileName: "file_name"
+ * }
+ */
+export interface ArtifactsPrepareRequest {
+ /** The name of the file that's being uploaded. */
+ fileName: string;
+ /** The type of file that's being uploaded. */
+ fileType?: string;
+}
diff --git a/src/api/resources/artifacts/client/requests/ArtifactsVersionsPrepareRequest.ts b/src/api/resources/artifacts/client/requests/ArtifactsVersionsPrepareRequest.ts
new file mode 100644
index 0000000..a2db975
--- /dev/null
+++ b/src/api/resources/artifacts/client/requests/ArtifactsVersionsPrepareRequest.ts
@@ -0,0 +1,14 @@
+/**
+ * This file was auto-generated by Fern from our API Definition.
+ */
+
+/**
+ * @example
+ * {
+ * id: "ARTIFACT-12345"
+ * }
+ */
+export interface ArtifactsVersionsPrepareRequest {
+ /** The ID of the artifact to prepare a new version for. */
+ id: string;
+}
diff --git a/src/api/resources/artifacts/client/requests/index.ts b/src/api/resources/artifacts/client/requests/index.ts
new file mode 100644
index 0000000..d02a1d5
--- /dev/null
+++ b/src/api/resources/artifacts/client/requests/index.ts
@@ -0,0 +1,2 @@
+export { type ArtifactsPrepareRequest } from "./ArtifactsPrepareRequest";
+export { type ArtifactsVersionsPrepareRequest } from "./ArtifactsVersionsPrepareRequest";
diff --git a/src/api/resources/artifacts/index.ts b/src/api/resources/artifacts/index.ts
new file mode 100644
index 0000000..5ec7692
--- /dev/null
+++ b/src/api/resources/artifacts/index.ts
@@ -0,0 +1 @@
+export * from "./client";
diff --git a/src/api/resources/codeChanges/client/Client.ts b/src/api/resources/codeChanges/client/Client.ts
new file mode 100644
index 0000000..acd332e
--- /dev/null
+++ b/src/api/resources/codeChanges/client/Client.ts
@@ -0,0 +1,1024 @@
+/**
+ * This file was auto-generated by Fern from our API Definition.
+ */
+
+import * as environments from "../../../../environments";
+import * as core from "../../../../core";
+import * as DevRev from "../../../index";
+import * as serializers from "../../../../serialization/index";
+import urlJoin from "url-join";
+import * as errors from "../../../../errors/index";
+
+export declare namespace CodeChanges {
+ interface Options {
+ environment?: core.Supplier;
+ token?: 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;
+ }
+}
+
+/**
+ * Code change interactions.
+ */
+export class CodeChanges {
+ constructor(protected readonly _options: CodeChanges.Options = {}) {}
+
+ /**
+ * Creates a code change object.
+ *
+ * @param {DevRev.CodeChangesCreateRequest} request
+ * @param {CodeChanges.RequestOptions} requestOptions - Request-specific configuration.
+ *
+ * @throws {@link DevRev.BadRequestError}
+ * @throws {@link DevRev.UnauthorizedError}
+ * @throws {@link DevRev.ForbiddenError}
+ * @throws {@link DevRev.TooManyRequestsError}
+ * @throws {@link DevRev.InternalServerError}
+ * @throws {@link DevRev.ServiceUnavailableError}
+ *
+ * @example
+ * await client.codeChanges.create({
+ * "key": "value"
+ * })
+ */
+ public async create(
+ request: DevRev.CodeChangesCreateRequest,
+ requestOptions?: CodeChanges.RequestOptions
+ ): Promise {
+ const _response = await (this._options.fetcher ?? core.fetcher)({
+ url: urlJoin(
+ (await core.Supplier.get(this._options.environment)) ?? environments.DevRevEnvironment.Default,
+ "code-changes.create"
+ ),
+ method: "POST",
+ headers: {
+ Authorization: await this._getAuthorizationHeader(),
+ "X-Fern-Language": "JavaScript",
+ "X-Fern-SDK-Name": "@devrev/api",
+ "X-Fern-SDK-Version": "0.0.14",
+ "X-Fern-Runtime": core.RUNTIME.type,
+ "X-Fern-Runtime-Version": core.RUNTIME.version,
+ },
+ contentType: "application/json",
+ requestType: "json",
+ body: serializers.CodeChangesCreateRequest.jsonOrThrow(request, { unrecognizedObjectKeys: "strip" }),
+ timeoutMs: requestOptions?.timeoutInSeconds != null ? requestOptions.timeoutInSeconds * 1000 : 60000,
+ maxRetries: requestOptions?.maxRetries,
+ abortSignal: requestOptions?.abortSignal,
+ });
+ if (_response.ok) {
+ return serializers.CodeChangesCreateResponse.parseOrThrow(_response.body, {
+ unrecognizedObjectKeys: "passthrough",
+ allowUnrecognizedUnionMembers: true,
+ allowUnrecognizedEnumValues: true,
+ skipValidation: true,
+ breadcrumbsPrefix: ["response"],
+ });
+ }
+
+ if (_response.error.reason === "status-code") {
+ switch (_response.error.statusCode) {
+ case 400:
+ throw new DevRev.BadRequestError(
+ serializers.ErrorBadRequest.parseOrThrow(_response.error.body, {
+ unrecognizedObjectKeys: "passthrough",
+ allowUnrecognizedUnionMembers: true,
+ allowUnrecognizedEnumValues: true,
+ skipValidation: true,
+ breadcrumbsPrefix: ["response"],
+ })
+ );
+ case 401:
+ throw new DevRev.UnauthorizedError(
+ serializers.ErrorUnauthorized.parseOrThrow(_response.error.body, {
+ unrecognizedObjectKeys: "passthrough",
+ allowUnrecognizedUnionMembers: true,
+ allowUnrecognizedEnumValues: true,
+ skipValidation: true,
+ breadcrumbsPrefix: ["response"],
+ })
+ );
+ case 403:
+ throw new DevRev.ForbiddenError(
+ serializers.ErrorForbidden.parseOrThrow(_response.error.body, {
+ unrecognizedObjectKeys: "passthrough",
+ allowUnrecognizedUnionMembers: true,
+ allowUnrecognizedEnumValues: true,
+ skipValidation: true,
+ breadcrumbsPrefix: ["response"],
+ })
+ );
+ case 429:
+ throw new DevRev.TooManyRequestsError(
+ serializers.ErrorTooManyRequests.parseOrThrow(_response.error.body, {
+ unrecognizedObjectKeys: "passthrough",
+ allowUnrecognizedUnionMembers: true,
+ allowUnrecognizedEnumValues: true,
+ skipValidation: true,
+ breadcrumbsPrefix: ["response"],
+ })
+ );
+ case 500:
+ throw new DevRev.InternalServerError(
+ serializers.ErrorInternalServerError.parseOrThrow(_response.error.body, {
+ unrecognizedObjectKeys: "passthrough",
+ allowUnrecognizedUnionMembers: true,
+ allowUnrecognizedEnumValues: true,
+ skipValidation: true,
+ breadcrumbsPrefix: ["response"],
+ })
+ );
+ case 503:
+ throw new DevRev.ServiceUnavailableError(
+ serializers.ErrorServiceUnavailable.parseOrThrow(_response.error.body, {
+ unrecognizedObjectKeys: "passthrough",
+ allowUnrecognizedUnionMembers: true,
+ allowUnrecognizedEnumValues: true,
+ skipValidation: true,
+ breadcrumbsPrefix: ["response"],
+ })
+ );
+ default:
+ throw new errors.DevRevError({
+ statusCode: _response.error.statusCode,
+ body: _response.error.body,
+ });
+ }
+ }
+
+ switch (_response.error.reason) {
+ case "non-json":
+ throw new errors.DevRevError({
+ statusCode: _response.error.statusCode,
+ body: _response.error.rawBody,
+ });
+ case "timeout":
+ throw new errors.DevRevTimeoutError();
+ case "unknown":
+ throw new errors.DevRevError({
+ message: _response.error.errorMessage,
+ });
+ }
+ }
+
+ /**
+ * Deletes a code change object.
+ *
+ * @param {DevRev.CodeChangesDeleteRequest} request
+ * @param {CodeChanges.RequestOptions} requestOptions - Request-specific configuration.
+ *
+ * @throws {@link DevRev.BadRequestError}
+ * @throws {@link DevRev.UnauthorizedError}
+ * @throws {@link DevRev.ForbiddenError}
+ * @throws {@link DevRev.TooManyRequestsError}
+ * @throws {@link DevRev.InternalServerError}
+ * @throws {@link DevRev.ServiceUnavailableError}
+ *
+ * @example
+ * await client.codeChanges.delete({
+ * id: "id"
+ * })
+ */
+ public async delete(
+ request: DevRev.CodeChangesDeleteRequest,
+ requestOptions?: CodeChanges.RequestOptions
+ ): Promise {
+ const _response = await (this._options.fetcher ?? core.fetcher)({
+ url: urlJoin(
+ (await core.Supplier.get(this._options.environment)) ?? environments.DevRevEnvironment.Default,
+ "code-changes.delete"
+ ),
+ method: "POST",
+ headers: {
+ Authorization: await this._getAuthorizationHeader(),
+ "X-Fern-Language": "JavaScript",
+ "X-Fern-SDK-Name": "@devrev/api",
+ "X-Fern-SDK-Version": "0.0.14",
+ "X-Fern-Runtime": core.RUNTIME.type,
+ "X-Fern-Runtime-Version": core.RUNTIME.version,
+ },
+ contentType: "application/json",
+ requestType: "json",
+ body: serializers.CodeChangesDeleteRequest.jsonOrThrow(request, { unrecognizedObjectKeys: "strip" }),
+ timeoutMs: requestOptions?.timeoutInSeconds != null ? requestOptions.timeoutInSeconds * 1000 : 60000,
+ maxRetries: requestOptions?.maxRetries,
+ abortSignal: requestOptions?.abortSignal,
+ });
+ if (_response.ok) {
+ return serializers.CodeChangesDeleteResponse.parseOrThrow(_response.body, {
+ unrecognizedObjectKeys: "passthrough",
+ allowUnrecognizedUnionMembers: true,
+ allowUnrecognizedEnumValues: true,
+ skipValidation: true,
+ breadcrumbsPrefix: ["response"],
+ });
+ }
+
+ if (_response.error.reason === "status-code") {
+ switch (_response.error.statusCode) {
+ case 400:
+ throw new DevRev.BadRequestError(
+ serializers.ErrorBadRequest.parseOrThrow(_response.error.body, {
+ unrecognizedObjectKeys: "passthrough",
+ allowUnrecognizedUnionMembers: true,
+ allowUnrecognizedEnumValues: true,
+ skipValidation: true,
+ breadcrumbsPrefix: ["response"],
+ })
+ );
+ case 401:
+ throw new DevRev.UnauthorizedError(
+ serializers.ErrorUnauthorized.parseOrThrow(_response.error.body, {
+ unrecognizedObjectKeys: "passthrough",
+ allowUnrecognizedUnionMembers: true,
+ allowUnrecognizedEnumValues: true,
+ skipValidation: true,
+ breadcrumbsPrefix: ["response"],
+ })
+ );
+ case 403:
+ throw new DevRev.ForbiddenError(
+ serializers.ErrorForbidden.parseOrThrow(_response.error.body, {
+ unrecognizedObjectKeys: "passthrough",
+ allowUnrecognizedUnionMembers: true,
+ allowUnrecognizedEnumValues: true,
+ skipValidation: true,
+ breadcrumbsPrefix: ["response"],
+ })
+ );
+ case 429:
+ throw new DevRev.TooManyRequestsError(
+ serializers.ErrorTooManyRequests.parseOrThrow(_response.error.body, {
+ unrecognizedObjectKeys: "passthrough",
+ allowUnrecognizedUnionMembers: true,
+ allowUnrecognizedEnumValues: true,
+ skipValidation: true,
+ breadcrumbsPrefix: ["response"],
+ })
+ );
+ case 500:
+ throw new DevRev.InternalServerError(
+ serializers.ErrorInternalServerError.parseOrThrow(_response.error.body, {
+ unrecognizedObjectKeys: "passthrough",
+ allowUnrecognizedUnionMembers: true,
+ allowUnrecognizedEnumValues: true,
+ skipValidation: true,
+ breadcrumbsPrefix: ["response"],
+ })
+ );
+ case 503:
+ throw new DevRev.ServiceUnavailableError(
+ serializers.ErrorServiceUnavailable.parseOrThrow(_response.error.body, {
+ unrecognizedObjectKeys: "passthrough",
+ allowUnrecognizedUnionMembers: true,
+ allowUnrecognizedEnumValues: true,
+ skipValidation: true,
+ breadcrumbsPrefix: ["response"],
+ })
+ );
+ default:
+ throw new errors.DevRevError({
+ statusCode: _response.error.statusCode,
+ body: _response.error.body,
+ });
+ }
+ }
+
+ switch (_response.error.reason) {
+ case "non-json":
+ throw new errors.DevRevError({
+ statusCode: _response.error.statusCode,
+ body: _response.error.rawBody,
+ });
+ case "timeout":
+ throw new errors.DevRevTimeoutError();
+ case "unknown":
+ throw new errors.DevRevError({
+ message: _response.error.errorMessage,
+ });
+ }
+ }
+
+ /**
+ * Gets a code change object.
+ *
+ * @param {DevRev.CodeChangesGetQuery} request
+ * @param {CodeChanges.RequestOptions} requestOptions - Request-specific configuration.
+ *
+ * @throws {@link DevRev.BadRequestError}
+ * @throws {@link DevRev.UnauthorizedError}
+ * @throws {@link DevRev.ForbiddenError}
+ * @throws {@link DevRev.TooManyRequestsError}
+ * @throws {@link DevRev.InternalServerError}
+ * @throws {@link DevRev.ServiceUnavailableError}
+ *
+ * @example
+ * await client.codeChanges.get({
+ * id: "id"
+ * })
+ */
+ public async get(
+ request: DevRev.CodeChangesGetQuery,
+ requestOptions?: CodeChanges.RequestOptions
+ ): Promise {
+ const { id } = request;
+ const _queryParams: Record = {};
+ _queryParams["id"] = id;
+ const _response = await (this._options.fetcher ?? core.fetcher)({
+ url: urlJoin(
+ (await core.Supplier.get(this._options.environment)) ?? environments.DevRevEnvironment.Default,
+ "code-changes.get"
+ ),
+ method: "GET",
+ headers: {
+ Authorization: await this._getAuthorizationHeader(),
+ "X-Fern-Language": "JavaScript",
+ "X-Fern-SDK-Name": "@devrev/api",
+ "X-Fern-SDK-Version": "0.0.14",
+ "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 serializers.CodeChangesGetResponse.parseOrThrow(_response.body, {
+ unrecognizedObjectKeys: "passthrough",
+ allowUnrecognizedUnionMembers: true,
+ allowUnrecognizedEnumValues: true,
+ skipValidation: true,
+ breadcrumbsPrefix: ["response"],
+ });
+ }
+
+ if (_response.error.reason === "status-code") {
+ switch (_response.error.statusCode) {
+ case 400:
+ throw new DevRev.BadRequestError(
+ serializers.ErrorBadRequest.parseOrThrow(_response.error.body, {
+ unrecognizedObjectKeys: "passthrough",
+ allowUnrecognizedUnionMembers: true,
+ allowUnrecognizedEnumValues: true,
+ skipValidation: true,
+ breadcrumbsPrefix: ["response"],
+ })
+ );
+ case 401:
+ throw new DevRev.UnauthorizedError(
+ serializers.ErrorUnauthorized.parseOrThrow(_response.error.body, {
+ unrecognizedObjectKeys: "passthrough",
+ allowUnrecognizedUnionMembers: true,
+ allowUnrecognizedEnumValues: true,
+ skipValidation: true,
+ breadcrumbsPrefix: ["response"],
+ })
+ );
+ case 403:
+ throw new DevRev.ForbiddenError(
+ serializers.ErrorForbidden.parseOrThrow(_response.error.body, {
+ unrecognizedObjectKeys: "passthrough",
+ allowUnrecognizedUnionMembers: true,
+ allowUnrecognizedEnumValues: true,
+ skipValidation: true,
+ breadcrumbsPrefix: ["response"],
+ })
+ );
+ case 429:
+ throw new DevRev.TooManyRequestsError(
+ serializers.ErrorTooManyRequests.parseOrThrow(_response.error.body, {
+ unrecognizedObjectKeys: "passthrough",
+ allowUnrecognizedUnionMembers: true,
+ allowUnrecognizedEnumValues: true,
+ skipValidation: true,
+ breadcrumbsPrefix: ["response"],
+ })
+ );
+ case 500:
+ throw new DevRev.InternalServerError(
+ serializers.ErrorInternalServerError.parseOrThrow(_response.error.body, {
+ unrecognizedObjectKeys: "passthrough",
+ allowUnrecognizedUnionMembers: true,
+ allowUnrecognizedEnumValues: true,
+ skipValidation: true,
+ breadcrumbsPrefix: ["response"],
+ })
+ );
+ case 503:
+ throw new DevRev.ServiceUnavailableError(
+ serializers.ErrorServiceUnavailable.parseOrThrow(_response.error.body, {
+ unrecognizedObjectKeys: "passthrough",
+ allowUnrecognizedUnionMembers: true,
+ allowUnrecognizedEnumValues: true,
+ skipValidation: true,
+ breadcrumbsPrefix: ["response"],
+ })
+ );
+ default:
+ throw new errors.DevRevError({
+ statusCode: _response.error.statusCode,
+ body: _response.error.body,
+ });
+ }
+ }
+
+ switch (_response.error.reason) {
+ case "non-json":
+ throw new errors.DevRevError({
+ statusCode: _response.error.statusCode,
+ body: _response.error.rawBody,
+ });
+ case "timeout":
+ throw new errors.DevRevTimeoutError();
+ case "unknown":
+ throw new errors.DevRevError({
+ message: _response.error.errorMessage,
+ });
+ }
+ }
+
+ /**
+ * Gets a code change object.
+ *
+ * @param {DevRev.CodeChangesGetRequest} request
+ * @param {CodeChanges.RequestOptions} requestOptions - Request-specific configuration.
+ *
+ * @throws {@link DevRev.BadRequestError}
+ * @throws {@link DevRev.UnauthorizedError}
+ * @throws {@link DevRev.ForbiddenError}
+ * @throws {@link DevRev.TooManyRequestsError}
+ * @throws {@link DevRev.InternalServerError}
+ * @throws {@link DevRev.ServiceUnavailableError}
+ *
+ * @example
+ * await client.codeChanges.getPost({
+ * id: "id"
+ * })
+ */
+ public async getPost(
+ request: DevRev.CodeChangesGetRequest,
+ requestOptions?: CodeChanges.RequestOptions
+ ): Promise {
+ const _response = await (this._options.fetcher ?? core.fetcher)({
+ url: urlJoin(
+ (await core.Supplier.get(this._options.environment)) ?? environments.DevRevEnvironment.Default,
+ "code-changes.get"
+ ),
+ method: "POST",
+ headers: {
+ Authorization: await this._getAuthorizationHeader(),
+ "X-Fern-Language": "JavaScript",
+ "X-Fern-SDK-Name": "@devrev/api",
+ "X-Fern-SDK-Version": "0.0.14",
+ "X-Fern-Runtime": core.RUNTIME.type,
+ "X-Fern-Runtime-Version": core.RUNTIME.version,
+ },
+ contentType: "application/json",
+ requestType: "json",
+ body: serializers.CodeChangesGetRequest.jsonOrThrow(request, { unrecognizedObjectKeys: "strip" }),
+ timeoutMs: requestOptions?.timeoutInSeconds != null ? requestOptions.timeoutInSeconds * 1000 : 60000,
+ maxRetries: requestOptions?.maxRetries,
+ abortSignal: requestOptions?.abortSignal,
+ });
+ if (_response.ok) {
+ return serializers.CodeChangesGetResponse.parseOrThrow(_response.body, {
+ unrecognizedObjectKeys: "passthrough",
+ allowUnrecognizedUnionMembers: true,
+ allowUnrecognizedEnumValues: true,
+ skipValidation: true,
+ breadcrumbsPrefix: ["response"],
+ });
+ }
+
+ if (_response.error.reason === "status-code") {
+ switch (_response.error.statusCode) {
+ case 400:
+ throw new DevRev.BadRequestError(
+ serializers.ErrorBadRequest.parseOrThrow(_response.error.body, {
+ unrecognizedObjectKeys: "passthrough",
+ allowUnrecognizedUnionMembers: true,
+ allowUnrecognizedEnumValues: true,
+ skipValidation: true,
+ breadcrumbsPrefix: ["response"],
+ })
+ );
+ case 401:
+ throw new DevRev.UnauthorizedError(
+ serializers.ErrorUnauthorized.parseOrThrow(_response.error.body, {
+ unrecognizedObjectKeys: "passthrough",
+ allowUnrecognizedUnionMembers: true,
+ allowUnrecognizedEnumValues: true,
+ skipValidation: true,
+ breadcrumbsPrefix: ["response"],
+ })
+ );
+ case 403:
+ throw new DevRev.ForbiddenError(
+ serializers.ErrorForbidden.parseOrThrow(_response.error.body, {
+ unrecognizedObjectKeys: "passthrough",
+ allowUnrecognizedUnionMembers: true,
+ allowUnrecognizedEnumValues: true,
+ skipValidation: true,
+ breadcrumbsPrefix: ["response"],
+ })
+ );
+ case 429:
+ throw new DevRev.TooManyRequestsError(
+ serializers.ErrorTooManyRequests.parseOrThrow(_response.error.body, {
+ unrecognizedObjectKeys: "passthrough",
+ allowUnrecognizedUnionMembers: true,
+ allowUnrecognizedEnumValues: true,
+ skipValidation: true,
+ breadcrumbsPrefix: ["response"],
+ })
+ );
+ case 500:
+ throw new DevRev.InternalServerError(
+ serializers.ErrorInternalServerError.parseOrThrow(_response.error.body, {
+ unrecognizedObjectKeys: "passthrough",
+ allowUnrecognizedUnionMembers: true,
+ allowUnrecognizedEnumValues: true,
+ skipValidation: true,
+ breadcrumbsPrefix: ["response"],
+ })
+ );
+ case 503:
+ throw new DevRev.ServiceUnavailableError(
+ serializers.ErrorServiceUnavailable.parseOrThrow(_response.error.body, {
+ unrecognizedObjectKeys: "passthrough",
+ allowUnrecognizedUnionMembers: true,
+ allowUnrecognizedEnumValues: true,
+ skipValidation: true,
+ breadcrumbsPrefix: ["response"],
+ })
+ );
+ default:
+ throw new errors.DevRevError({
+ statusCode: _response.error.statusCode,
+ body: _response.error.body,
+ });
+ }
+ }
+
+ switch (_response.error.reason) {
+ case "non-json":
+ throw new errors.DevRevError({
+ statusCode: _response.error.statusCode,
+ body: _response.error.rawBody,
+ });
+ case "timeout":
+ throw new errors.DevRevTimeoutError();
+ case "unknown":
+ throw new errors.DevRevError({
+ message: _response.error.errorMessage,
+ });
+ }
+ }
+
+ /**
+ * Lists code change objects.
+ *
+ * @param {DevRev.CodeChangesListQuery} request
+ * @param {CodeChanges.RequestOptions} requestOptions - Request-specific configuration.
+ *
+ * @throws {@link DevRev.BadRequestError}
+ * @throws {@link DevRev.UnauthorizedError}
+ * @throws {@link DevRev.ForbiddenError}
+ * @throws {@link DevRev.TooManyRequestsError}
+ * @throws {@link DevRev.InternalServerError}
+ * @throws {@link DevRev.ServiceUnavailableError}
+ *
+ * @example
+ * await client.codeChanges.list()
+ */
+ public async list(
+ request: DevRev.CodeChangesListQuery = {},
+ requestOptions?: CodeChanges.RequestOptions
+ ): Promise {
+ const { cursor, limit, mode } = request;
+ const _queryParams: Record = {};
+ if (cursor != null) {
+ _queryParams["cursor"] = cursor;
+ }
+
+ if (limit != null) {
+ _queryParams["limit"] = limit.toString();
+ }
+
+ if (mode != null) {
+ _queryParams["mode"] = mode;
+ }
+
+ const _response = await (this._options.fetcher ?? core.fetcher)({
+ url: urlJoin(
+ (await core.Supplier.get(this._options.environment)) ?? environments.DevRevEnvironment.Default,
+ "code-changes.list"
+ ),
+ method: "GET",
+ headers: {
+ Authorization: await this._getAuthorizationHeader(),
+ "X-Fern-Language": "JavaScript",
+ "X-Fern-SDK-Name": "@devrev/api",
+ "X-Fern-SDK-Version": "0.0.14",
+ "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 serializers.CodeChangesListResponse.parseOrThrow(_response.body, {
+ unrecognizedObjectKeys: "passthrough",
+ allowUnrecognizedUnionMembers: true,
+ allowUnrecognizedEnumValues: true,
+ skipValidation: true,
+ breadcrumbsPrefix: ["response"],
+ });
+ }
+
+ if (_response.error.reason === "status-code") {
+ switch (_response.error.statusCode) {
+ case 400:
+ throw new DevRev.BadRequestError(
+ serializers.ErrorBadRequest.parseOrThrow(_response.error.body, {
+ unrecognizedObjectKeys: "passthrough",
+ allowUnrecognizedUnionMembers: true,
+ allowUnrecognizedEnumValues: true,
+ skipValidation: true,
+ breadcrumbsPrefix: ["response"],
+ })
+ );
+ case 401:
+ throw new DevRev.UnauthorizedError(
+ serializers.ErrorUnauthorized.parseOrThrow(_response.error.body, {
+ unrecognizedObjectKeys: "passthrough",
+ allowUnrecognizedUnionMembers: true,
+ allowUnrecognizedEnumValues: true,
+ skipValidation: true,
+ breadcrumbsPrefix: ["response"],
+ })
+ );
+ case 403:
+ throw new DevRev.ForbiddenError(
+ serializers.ErrorForbidden.parseOrThrow(_response.error.body, {
+ unrecognizedObjectKeys: "passthrough",
+ allowUnrecognizedUnionMembers: true,
+ allowUnrecognizedEnumValues: true,
+ skipValidation: true,
+ breadcrumbsPrefix: ["response"],
+ })
+ );
+ case 429:
+ throw new DevRev.TooManyRequestsError(
+ serializers.ErrorTooManyRequests.parseOrThrow(_response.error.body, {
+ unrecognizedObjectKeys: "passthrough",
+ allowUnrecognizedUnionMembers: true,
+ allowUnrecognizedEnumValues: true,
+ skipValidation: true,
+ breadcrumbsPrefix: ["response"],
+ })
+ );
+ case 500:
+ throw new DevRev.InternalServerError(
+ serializers.ErrorInternalServerError.parseOrThrow(_response.error.body, {
+ unrecognizedObjectKeys: "passthrough",
+ allowUnrecognizedUnionMembers: true,
+ allowUnrecognizedEnumValues: true,
+ skipValidation: true,
+ breadcrumbsPrefix: ["response"],
+ })
+ );
+ case 503:
+ throw new DevRev.ServiceUnavailableError(
+ serializers.ErrorServiceUnavailable.parseOrThrow(_response.error.body, {
+ unrecognizedObjectKeys: "passthrough",
+ allowUnrecognizedUnionMembers: true,
+ allowUnrecognizedEnumValues: true,
+ skipValidation: true,
+ breadcrumbsPrefix: ["response"],
+ })
+ );
+ default:
+ throw new errors.DevRevError({
+ statusCode: _response.error.statusCode,
+ body: _response.error.body,
+ });
+ }
+ }
+
+ switch (_response.error.reason) {
+ case "non-json":
+ throw new errors.DevRevError({
+ statusCode: _response.error.statusCode,
+ body: _response.error.rawBody,
+ });
+ case "timeout":
+ throw new errors.DevRevTimeoutError();
+ case "unknown":
+ throw new errors.DevRevError({
+ message: _response.error.errorMessage,
+ });
+ }
+ }
+
+ /**
+ * Lists code change objects.
+ *
+ * @param {DevRev.CodeChangesListRequest} request
+ * @param {CodeChanges.RequestOptions} requestOptions - Request-specific configuration.
+ *
+ * @throws {@link DevRev.BadRequestError}
+ * @throws {@link DevRev.UnauthorizedError}
+ * @throws {@link DevRev.ForbiddenError}
+ * @throws {@link DevRev.TooManyRequestsError}
+ * @throws {@link DevRev.InternalServerError}
+ * @throws {@link DevRev.ServiceUnavailableError}
+ *
+ * @example
+ * await client.codeChanges.listPost()
+ */
+ public async listPost(
+ request: DevRev.CodeChangesListRequest = {},
+ requestOptions?: CodeChanges.RequestOptions
+ ): Promise {
+ const _response = await (this._options.fetcher ?? core.fetcher)({
+ url: urlJoin(
+ (await core.Supplier.get(this._options.environment)) ?? environments.DevRevEnvironment.Default,
+ "code-changes.list"
+ ),
+ method: "POST",
+ headers: {
+ Authorization: await this._getAuthorizationHeader(),
+ "X-Fern-Language": "JavaScript",
+ "X-Fern-SDK-Name": "@devrev/api",
+ "X-Fern-SDK-Version": "0.0.14",
+ "X-Fern-Runtime": core.RUNTIME.type,
+ "X-Fern-Runtime-Version": core.RUNTIME.version,
+ },
+ contentType: "application/json",
+ requestType: "json",
+ body: serializers.CodeChangesListRequest.jsonOrThrow(request, { unrecognizedObjectKeys: "strip" }),
+ timeoutMs: requestOptions?.timeoutInSeconds != null ? requestOptions.timeoutInSeconds * 1000 : 60000,
+ maxRetries: requestOptions?.maxRetries,
+ abortSignal: requestOptions?.abortSignal,
+ });
+ if (_response.ok) {
+ return serializers.CodeChangesListResponse.parseOrThrow(_response.body, {
+ unrecognizedObjectKeys: "passthrough",
+ allowUnrecognizedUnionMembers: true,
+ allowUnrecognizedEnumValues: true,
+ skipValidation: true,
+ breadcrumbsPrefix: ["response"],
+ });
+ }
+
+ if (_response.error.reason === "status-code") {
+ switch (_response.error.statusCode) {
+ case 400:
+ throw new DevRev.BadRequestError(
+ serializers.ErrorBadRequest.parseOrThrow(_response.error.body, {
+ unrecognizedObjectKeys: "passthrough",
+ allowUnrecognizedUnionMembers: true,
+ allowUnrecognizedEnumValues: true,
+ skipValidation: true,
+ breadcrumbsPrefix: ["response"],
+ })
+ );
+ case 401:
+ throw new DevRev.UnauthorizedError(
+ serializers.ErrorUnauthorized.parseOrThrow(_response.error.body, {
+ unrecognizedObjectKeys: "passthrough",
+ allowUnrecognizedUnionMembers: true,
+ allowUnrecognizedEnumValues: true,
+ skipValidation: true,
+ breadcrumbsPrefix: ["response"],
+ })
+ );
+ case 403:
+ throw new DevRev.ForbiddenError(
+ serializers.ErrorForbidden.parseOrThrow(_response.error.body, {
+ unrecognizedObjectKeys: "passthrough",
+ allowUnrecognizedUnionMembers: true,
+ allowUnrecognizedEnumValues: true,
+ skipValidation: true,
+ breadcrumbsPrefix: ["response"],
+ })
+ );
+ case 429:
+ throw new DevRev.TooManyRequestsError(
+ serializers.ErrorTooManyRequests.parseOrThrow(_response.error.body, {
+ unrecognizedObjectKeys: "passthrough",
+ allowUnrecognizedUnionMembers: true,
+ allowUnrecognizedEnumValues: true,
+ skipValidation: true,
+ breadcrumbsPrefix: ["response"],
+ })
+ );
+ case 500:
+ throw new DevRev.InternalServerError(
+ serializers.ErrorInternalServerError.parseOrThrow(_response.error.body, {
+ unrecognizedObjectKeys: "passthrough",
+ allowUnrecognizedUnionMembers: true,
+ allowUnrecognizedEnumValues: true,
+ skipValidation: true,
+ breadcrumbsPrefix: ["response"],
+ })
+ );
+ case 503:
+ throw new DevRev.ServiceUnavailableError(
+ serializers.ErrorServiceUnavailable.parseOrThrow(_response.error.body, {
+ unrecognizedObjectKeys: "passthrough",
+ allowUnrecognizedUnionMembers: true,
+ allowUnrecognizedEnumValues: true,
+ skipValidation: true,
+ breadcrumbsPrefix: ["response"],
+ })
+ );
+ default:
+ throw new errors.DevRevError({
+ statusCode: _response.error.statusCode,
+ body: _response.error.body,
+ });
+ }
+ }
+
+ switch (_response.error.reason) {
+ case "non-json":
+ throw new errors.DevRevError({
+ statusCode: _response.error.statusCode,
+ body: _response.error.rawBody,
+ });
+ case "timeout":
+ throw new errors.DevRevTimeoutError();
+ case "unknown":
+ throw new errors.DevRevError({
+ message: _response.error.errorMessage,
+ });
+ }
+ }
+
+ /**
+ * Updates a code change object.
+ *
+ * @param {DevRev.CodeChangesUpdateRequest} request
+ * @param {CodeChanges.RequestOptions} requestOptions - Request-specific configuration.
+ *
+ * @throws {@link DevRev.BadRequestError}
+ * @throws {@link DevRev.UnauthorizedError}
+ * @throws {@link DevRev.ForbiddenError}
+ * @throws {@link DevRev.TooManyRequestsError}
+ * @throws {@link DevRev.InternalServerError}
+ * @throws {@link DevRev.ServiceUnavailableError}
+ *
+ * @example
+ * await client.codeChanges.update({
+ * id: "id"
+ * })
+ */
+ public async update(
+ request: DevRev.CodeChangesUpdateRequest,
+ requestOptions?: CodeChanges.RequestOptions
+ ): Promise {
+ const _response = await (this._options.fetcher ?? core.fetcher)({
+ url: urlJoin(
+ (await core.Supplier.get(this._options.environment)) ?? environments.DevRevEnvironment.Default,
+ "code-changes.update"
+ ),
+ method: "POST",
+ headers: {
+ Authorization: await this._getAuthorizationHeader(),
+ "X-Fern-Language": "JavaScript",
+ "X-Fern-SDK-Name": "@devrev/api",
+ "X-Fern-SDK-Version": "0.0.14",
+ "X-Fern-Runtime": core.RUNTIME.type,
+ "X-Fern-Runtime-Version": core.RUNTIME.version,
+ },
+ contentType: "application/json",
+ requestType: "json",
+ body: serializers.CodeChangesUpdateRequest.jsonOrThrow(request, { unrecognizedObjectKeys: "strip" }),
+ timeoutMs: requestOptions?.timeoutInSeconds != null ? requestOptions.timeoutInSeconds * 1000 : 60000,
+ maxRetries: requestOptions?.maxRetries,
+ abortSignal: requestOptions?.abortSignal,
+ });
+ if (_response.ok) {
+ return serializers.CodeChangesUpdateResponse.parseOrThrow(_response.body, {
+ unrecognizedObjectKeys: "passthrough",
+ allowUnrecognizedUnionMembers: true,
+ allowUnrecognizedEnumValues: true,
+ skipValidation: true,
+ breadcrumbsPrefix: ["response"],
+ });
+ }
+
+ if (_response.error.reason === "status-code") {
+ switch (_response.error.statusCode) {
+ case 400:
+ throw new DevRev.BadRequestError(
+ serializers.ErrorBadRequest.parseOrThrow(_response.error.body, {
+ unrecognizedObjectKeys: "passthrough",
+ allowUnrecognizedUnionMembers: true,
+ allowUnrecognizedEnumValues: true,
+ skipValidation: true,
+ breadcrumbsPrefix: ["response"],
+ })
+ );
+ case 401:
+ throw new DevRev.UnauthorizedError(
+ serializers.ErrorUnauthorized.parseOrThrow(_response.error.body, {
+ unrecognizedObjectKeys: "passthrough",
+ allowUnrecognizedUnionMembers: true,
+ allowUnrecognizedEnumValues: true,
+ skipValidation: true,
+ breadcrumbsPrefix: ["response"],
+ })
+ );
+ case 403:
+ throw new DevRev.ForbiddenError(
+ serializers.ErrorForbidden.parseOrThrow(_response.error.body, {
+ unrecognizedObjectKeys: "passthrough",
+ allowUnrecognizedUnionMembers: true,
+ allowUnrecognizedEnumValues: true,
+ skipValidation: true,
+ breadcrumbsPrefix: ["response"],
+ })
+ );
+ case 429:
+ throw new DevRev.TooManyRequestsError(
+ serializers.ErrorTooManyRequests.parseOrThrow(_response.error.body, {
+ unrecognizedObjectKeys: "passthrough",
+ allowUnrecognizedUnionMembers: true,
+ allowUnrecognizedEnumValues: true,
+ skipValidation: true,
+ breadcrumbsPrefix: ["response"],
+ })
+ );
+ case 500:
+ throw new DevRev.InternalServerError(
+ serializers.ErrorInternalServerError.parseOrThrow(_response.error.body, {
+ unrecognizedObjectKeys: "passthrough",
+ allowUnrecognizedUnionMembers: true,
+ allowUnrecognizedEnumValues: true,
+ skipValidation: true,
+ breadcrumbsPrefix: ["response"],
+ })
+ );
+ case 503:
+ throw new DevRev.ServiceUnavailableError(
+ serializers.ErrorServiceUnavailable.parseOrThrow(_response.error.body, {
+ unrecognizedObjectKeys: "passthrough",
+ allowUnrecognizedUnionMembers: true,
+ allowUnrecognizedEnumValues: true,
+ skipValidation: true,
+ breadcrumbsPrefix: ["response"],
+ })
+ );
+ default:
+ throw new errors.DevRevError({
+ statusCode: _response.error.statusCode,
+ body: _response.error.body,
+ });
+ }
+ }
+
+ switch (_response.error.reason) {
+ case "non-json":
+ throw new errors.DevRevError({
+ statusCode: _response.error.statusCode,
+ body: _response.error.rawBody,
+ });
+ case "timeout":
+ throw new errors.DevRevTimeoutError();
+ case "unknown":
+ throw new errors.DevRevError({
+ message: _response.error.errorMessage,
+ });
+ }
+ }
+
+ protected async _getAuthorizationHeader(): Promise {
+ const bearer = (await core.Supplier.get(this._options.token)) ?? process?.env["DEVREV_TOKEN"];
+ if (bearer == null) {
+ throw new errors.DevRevError({
+ message: "Please specify DEVREV_TOKEN when instantiating the client.",
+ });
+ }
+
+ return `Bearer ${bearer}`;
+ }
+}
diff --git a/src/api/resources/codeChanges/client/index.ts b/src/api/resources/codeChanges/client/index.ts
new file mode 100644
index 0000000..415726b
--- /dev/null
+++ b/src/api/resources/codeChanges/client/index.ts
@@ -0,0 +1 @@
+export * from "./requests";
diff --git a/src/api/resources/codeChanges/client/requests/CodeChangesDeleteRequest.ts b/src/api/resources/codeChanges/client/requests/CodeChangesDeleteRequest.ts
new file mode 100644
index 0000000..b3a0d52
--- /dev/null
+++ b/src/api/resources/codeChanges/client/requests/CodeChangesDeleteRequest.ts
@@ -0,0 +1,14 @@
+/**
+ * This file was auto-generated by Fern from our API Definition.
+ */
+
+/**
+ * @example
+ * {
+ * id: "id"
+ * }
+ */
+export interface CodeChangesDeleteRequest {
+ /** ID of the code change object which is to be deleted. */
+ id: string;
+}
diff --git a/src/api/resources/codeChanges/client/requests/CodeChangesGetQuery.ts b/src/api/resources/codeChanges/client/requests/CodeChangesGetQuery.ts
new file mode 100644
index 0000000..f58ddcb
--- /dev/null
+++ b/src/api/resources/codeChanges/client/requests/CodeChangesGetQuery.ts
@@ -0,0 +1,16 @@
+/**
+ * This file was auto-generated by Fern from our API Definition.
+ */
+
+/**
+ * @example
+ * {
+ * id: "id"
+ * }
+ */
+export interface CodeChangesGetQuery {
+ /**
+ * The code change object ID.
+ */
+ id: string;
+}
diff --git a/src/api/resources/codeChanges/client/requests/CodeChangesGetRequest.ts b/src/api/resources/codeChanges/client/requests/CodeChangesGetRequest.ts
new file mode 100644
index 0000000..e671231
--- /dev/null
+++ b/src/api/resources/codeChanges/client/requests/CodeChangesGetRequest.ts
@@ -0,0 +1,14 @@
+/**
+ * This file was auto-generated by Fern from our API Definition.
+ */
+
+/**
+ * @example
+ * {
+ * id: "id"
+ * }
+ */
+export interface CodeChangesGetRequest {
+ /** The code change object ID. */
+ id: string;
+}
diff --git a/src/api/resources/codeChanges/client/requests/CodeChangesListQuery.ts b/src/api/resources/codeChanges/client/requests/CodeChangesListQuery.ts
new file mode 100644
index 0000000..7be9222
--- /dev/null
+++ b/src/api/resources/codeChanges/client/requests/CodeChangesListQuery.ts
@@ -0,0 +1,27 @@
+/**
+ * This file was auto-generated by Fern from our API Definition.
+ */
+
+import * as DevRev from "../../../../index";
+
+/**
+ * @example
+ * {}
+ */
+export interface CodeChangesListQuery {
+ /**
+ * The cursor to resume iteration from. If not provided, then iteration
+ * starts from the beginning.
+ */
+ cursor?: string;
+ /**
+ * The maximum number of code change objects to return. The default is
+ * '50'.
+ */
+ limit?: number;
+ /**
+ * The iteration mode to use, otherwise if not set, then "after" is
+ * used.
+ */
+ mode?: DevRev.ListMode;
+}
diff --git a/src/api/resources/codeChanges/client/requests/CodeChangesListRequest.ts b/src/api/resources/codeChanges/client/requests/CodeChangesListRequest.ts
new file mode 100644
index 0000000..e6bc72d
--- /dev/null
+++ b/src/api/resources/codeChanges/client/requests/CodeChangesListRequest.ts
@@ -0,0 +1,27 @@
+/**
+ * This file was auto-generated by Fern from our API Definition.
+ */
+
+import * as DevRev from "../../../../index";
+
+/**
+ * @example
+ * {}
+ */
+export interface CodeChangesListRequest {
+ createdDate?: DevRev.DateFilter;
+ /**
+ * The cursor to resume iteration from. If not provided, then
+ * iteration starts from the beginning.
+ *
+ */
+ cursor?: string;
+ /**
+ * The maximum number of code change objects to return. The default is
+ * '50'.
+ *
+ */
+ limit?: number;
+ mode?: DevRev.ListMode;
+ modifiedDate?: DevRev.DateFilter;
+}
diff --git a/src/api/resources/codeChanges/client/requests/CodeChangesUpdateRequest.ts b/src/api/resources/codeChanges/client/requests/CodeChangesUpdateRequest.ts
new file mode 100644
index 0000000..836b7da
--- /dev/null
+++ b/src/api/resources/codeChanges/client/requests/CodeChangesUpdateRequest.ts
@@ -0,0 +1,14 @@
+/**
+ * This file was auto-generated by Fern from our API Definition.
+ */
+
+/**
+ * @example
+ * {
+ * id: "id"
+ * }
+ */
+export interface CodeChangesUpdateRequest {
+ /** The ID of the code change object to be updated. */
+ id: string;
+}
diff --git a/src/api/resources/codeChanges/client/requests/index.ts b/src/api/resources/codeChanges/client/requests/index.ts
new file mode 100644
index 0000000..89e5f9e
--- /dev/null
+++ b/src/api/resources/codeChanges/client/requests/index.ts
@@ -0,0 +1,6 @@
+export { type CodeChangesDeleteRequest } from "./CodeChangesDeleteRequest";
+export { type CodeChangesGetQuery } from "./CodeChangesGetQuery";
+export { type CodeChangesGetRequest } from "./CodeChangesGetRequest";
+export { type CodeChangesListQuery } from "./CodeChangesListQuery";
+export { type CodeChangesListRequest } from "./CodeChangesListRequest";
+export { type CodeChangesUpdateRequest } from "./CodeChangesUpdateRequest";
diff --git a/src/api/resources/codeChanges/index.ts b/src/api/resources/codeChanges/index.ts
new file mode 100644
index 0000000..5ec7692
--- /dev/null
+++ b/src/api/resources/codeChanges/index.ts
@@ -0,0 +1 @@
+export * from "./client";
diff --git a/src/api/resources/conversations/client/Client.ts b/src/api/resources/conversations/client/Client.ts
new file mode 100644
index 0000000..0963e81
--- /dev/null
+++ b/src/api/resources/conversations/client/Client.ts
@@ -0,0 +1,1561 @@
+/**
+ * This file was auto-generated by Fern from our API Definition.
+ */
+
+import * as environments from "../../../../environments";
+import * as core from "../../../../core";
+import * as DevRev from "../../../index";
+import * as serializers from "../../../../serialization/index";
+import urlJoin from "url-join";
+import * as errors from "../../../../errors/index";
+
+export declare namespace Conversations {
+ interface Options {
+ environment?: core.Supplier;
+ token?: 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;
+ }
+}
+
+/**
+ * DevRev conversation interaction.
+ */
+export class Conversations {
+ constructor(protected readonly _options: Conversations.Options = {}) {}
+
+ /**
+ * Creates a conversation.
+ *
+ * @param {DevRev.ConversationsCreateRequest} request
+ * @param {Conversations.RequestOptions} requestOptions - Request-specific configuration.
+ *
+ * @throws {@link DevRev.BadRequestError}
+ * @throws {@link DevRev.UnauthorizedError}
+ * @throws {@link DevRev.ForbiddenError}
+ * @throws {@link DevRev.TooManyRequestsError}
+ * @throws {@link DevRev.InternalServerError}
+ * @throws {@link DevRev.ServiceUnavailableError}
+ *
+ * @example
+ * await client.conversations.create({
+ * type: "support"
+ * })
+ */
+ public async create(
+ request: DevRev.ConversationsCreateRequest,
+ requestOptions?: Conversations.RequestOptions
+ ): Promise {
+ const _response = await (this._options.fetcher ?? core.fetcher)({
+ url: urlJoin(
+ (await core.Supplier.get(this._options.environment)) ?? environments.DevRevEnvironment.Default,
+ "conversations.create"
+ ),
+ method: "POST",
+ headers: {
+ Authorization: await this._getAuthorizationHeader(),
+ "X-Fern-Language": "JavaScript",
+ "X-Fern-SDK-Name": "@devrev/api",
+ "X-Fern-SDK-Version": "0.0.14",
+ "X-Fern-Runtime": core.RUNTIME.type,
+ "X-Fern-Runtime-Version": core.RUNTIME.version,
+ },
+ contentType: "application/json",
+ requestType: "json",
+ body: {
+ ...serializers.ConversationsCreateRequest.jsonOrThrow(request, { unrecognizedObjectKeys: "strip" }),
+ type: "support",
+ },
+ timeoutMs: requestOptions?.timeoutInSeconds != null ? requestOptions.timeoutInSeconds * 1000 : 60000,
+ maxRetries: requestOptions?.maxRetries,
+ abortSignal: requestOptions?.abortSignal,
+ });
+ if (_response.ok) {
+ return serializers.ConversationsCreateResponse.parseOrThrow(_response.body, {
+ unrecognizedObjectKeys: "passthrough",
+ allowUnrecognizedUnionMembers: true,
+ allowUnrecognizedEnumValues: true,
+ skipValidation: true,
+ breadcrumbsPrefix: ["response"],
+ });
+ }
+
+ if (_response.error.reason === "status-code") {
+ switch (_response.error.statusCode) {
+ case 400:
+ throw new DevRev.BadRequestError(
+ serializers.ErrorBadRequest.parseOrThrow(_response.error.body, {
+ unrecognizedObjectKeys: "passthrough",
+ allowUnrecognizedUnionMembers: true,
+ allowUnrecognizedEnumValues: true,
+ skipValidation: true,
+ breadcrumbsPrefix: ["response"],
+ })
+ );
+ case 401:
+ throw new DevRev.UnauthorizedError(
+ serializers.ErrorUnauthorized.parseOrThrow(_response.error.body, {
+ unrecognizedObjectKeys: "passthrough",
+ allowUnrecognizedUnionMembers: true,
+ allowUnrecognizedEnumValues: true,
+ skipValidation: true,
+ breadcrumbsPrefix: ["response"],
+ })
+ );
+ case 403:
+ throw new DevRev.ForbiddenError(
+ serializers.ErrorForbidden.parseOrThrow(_response.error.body, {
+ unrecognizedObjectKeys: "passthrough",
+ allowUnrecognizedUnionMembers: true,
+ allowUnrecognizedEnumValues: true,
+ skipValidation: true,
+ breadcrumbsPrefix: ["response"],
+ })
+ );
+ case 429:
+ throw new DevRev.TooManyRequestsError(
+ serializers.ErrorTooManyRequests.parseOrThrow(_response.error.body, {
+ unrecognizedObjectKeys: "passthrough",
+ allowUnrecognizedUnionMembers: true,
+ allowUnrecognizedEnumValues: true,
+ skipValidation: true,
+ breadcrumbsPrefix: ["response"],
+ })
+ );
+ case 500:
+ throw new DevRev.InternalServerError(
+ serializers.ErrorInternalServerError.parseOrThrow(_response.error.body, {
+ unrecognizedObjectKeys: "passthrough",
+ allowUnrecognizedUnionMembers: true,
+ allowUnrecognizedEnumValues: true,
+ skipValidation: true,
+ breadcrumbsPrefix: ["response"],
+ })
+ );
+ case 503:
+ throw new DevRev.ServiceUnavailableError(
+ serializers.ErrorServiceUnavailable.parseOrThrow(_response.error.body, {
+ unrecognizedObjectKeys: "passthrough",
+ allowUnrecognizedUnionMembers: true,
+ allowUnrecognizedEnumValues: true,
+ skipValidation: true,
+ breadcrumbsPrefix: ["response"],
+ })
+ );
+ default:
+ throw new errors.DevRevError({
+ statusCode: _response.error.statusCode,
+ body: _response.error.body,
+ });
+ }
+ }
+
+ switch (_response.error.reason) {
+ case "non-json":
+ throw new errors.DevRevError({
+ statusCode: _response.error.statusCode,
+ body: _response.error.rawBody,
+ });
+ case "timeout":
+ throw new errors.DevRevTimeoutError();
+ case "unknown":
+ throw new errors.DevRevError({
+ message: _response.error.errorMessage,
+ });
+ }
+ }
+
+ /**
+ * Deletes the requested conversation.
+ *
+ * @param {DevRev.ConversationsDeleteRequest} request
+ * @param {Conversations.RequestOptions} requestOptions - Request-specific configuration.
+ *
+ * @throws {@link DevRev.BadRequestError}
+ * @throws {@link DevRev.UnauthorizedError}
+ * @throws {@link DevRev.ForbiddenError}
+ * @throws {@link DevRev.NotFoundError}
+ * @throws {@link DevRev.TooManyRequestsError}
+ * @throws {@link DevRev.InternalServerError}
+ * @throws {@link DevRev.ServiceUnavailableError}
+ *
+ * @example
+ * await client.conversations.delete({
+ * id: "id"
+ * })
+ */
+ public async delete(
+ request: DevRev.ConversationsDeleteRequest,
+ requestOptions?: Conversations.RequestOptions
+ ): Promise {
+ const _response = await (this._options.fetcher ?? core.fetcher)({
+ url: urlJoin(
+ (await core.Supplier.get(this._options.environment)) ?? environments.DevRevEnvironment.Default,
+ "conversations.delete"
+ ),
+ method: "POST",
+ headers: {
+ Authorization: await this._getAuthorizationHeader(),
+ "X-Fern-Language": "JavaScript",
+ "X-Fern-SDK-Name": "@devrev/api",
+ "X-Fern-SDK-Version": "0.0.14",
+ "X-Fern-Runtime": core.RUNTIME.type,
+ "X-Fern-Runtime-Version": core.RUNTIME.version,
+ },
+ contentType: "application/json",
+ requestType: "json",
+ body: serializers.ConversationsDeleteRequest.jsonOrThrow(request, { unrecognizedObjectKeys: "strip" }),
+ timeoutMs: requestOptions?.timeoutInSeconds != null ? requestOptions.timeoutInSeconds * 1000 : 60000,
+ maxRetries: requestOptions?.maxRetries,
+ abortSignal: requestOptions?.abortSignal,
+ });
+ if (_response.ok) {
+ return serializers.ConversationsDeleteResponse.parseOrThrow(_response.body, {
+ unrecognizedObjectKeys: "passthrough",
+ allowUnrecognizedUnionMembers: true,
+ allowUnrecognizedEnumValues: true,
+ skipValidation: true,
+ breadcrumbsPrefix: ["response"],
+ });
+ }
+
+ if (_response.error.reason === "status-code") {
+ switch (_response.error.statusCode) {
+ case 400:
+ throw new DevRev.BadRequestError(
+ serializers.ErrorBadRequest.parseOrThrow(_response.error.body, {
+ unrecognizedObjectKeys: "passthrough",
+ allowUnrecognizedUnionMembers: true,
+ allowUnrecognizedEnumValues: true,
+ skipValidation: true,
+ breadcrumbsPrefix: ["response"],
+ })
+ );
+ case 401:
+ throw new DevRev.UnauthorizedError(
+ serializers.ErrorUnauthorized.parseOrThrow(_response.error.body, {
+ unrecognizedObjectKeys: "passthrough",
+ allowUnrecognizedUnionMembers: true,
+ allowUnrecognizedEnumValues: true,
+ skipValidation: true,
+ breadcrumbsPrefix: ["response"],
+ })
+ );
+ case 403:
+ throw new DevRev.ForbiddenError(
+ serializers.ErrorForbidden.parseOrThrow(_response.error.body, {
+ unrecognizedObjectKeys: "passthrough",
+ allowUnrecognizedUnionMembers: true,
+ allowUnrecognizedEnumValues: true,
+ skipValidation: true,
+ breadcrumbsPrefix: ["response"],
+ })
+ );
+ case 404:
+ throw new DevRev.NotFoundError(
+ serializers.ErrorNotFound.parseOrThrow(_response.error.body, {
+ unrecognizedObjectKeys: "passthrough",
+ allowUnrecognizedUnionMembers: true,
+ allowUnrecognizedEnumValues: true,
+ skipValidation: true,
+ breadcrumbsPrefix: ["response"],
+ })
+ );
+ case 429:
+ throw new DevRev.TooManyRequestsError(
+ serializers.ErrorTooManyRequests.parseOrThrow(_response.error.body, {
+ unrecognizedObjectKeys: "passthrough",
+ allowUnrecognizedUnionMembers: true,
+ allowUnrecognizedEnumValues: true,
+ skipValidation: true,
+ breadcrumbsPrefix: ["response"],
+ })
+ );
+ case 500:
+ throw new DevRev.InternalServerError(
+ serializers.ErrorInternalServerError.parseOrThrow(_response.error.body, {
+ unrecognizedObjectKeys: "passthrough",
+ allowUnrecognizedUnionMembers: true,
+ allowUnrecognizedEnumValues: true,
+ skipValidation: true,
+ breadcrumbsPrefix: ["response"],
+ })
+ );
+ case 503:
+ throw new DevRev.ServiceUnavailableError(
+ serializers.ErrorServiceUnavailable.parseOrThrow(_response.error.body, {
+ unrecognizedObjectKeys: "passthrough",
+ allowUnrecognizedUnionMembers: true,
+ allowUnrecognizedEnumValues: true,
+ skipValidation: true,
+ breadcrumbsPrefix: ["response"],
+ })
+ );
+ default:
+ throw new errors.DevRevError({
+ statusCode: _response.error.statusCode,
+ body: _response.error.body,
+ });
+ }
+ }
+
+ switch (_response.error.reason) {
+ case "non-json":
+ throw new errors.DevRevError({
+ statusCode: _response.error.statusCode,
+ body: _response.error.rawBody,
+ });
+ case "timeout":
+ throw new errors.DevRevTimeoutError();
+ case "unknown":
+ throw new errors.DevRevError({
+ message: _response.error.errorMessage,
+ });
+ }
+ }
+
+ /**
+ * Exports a collection of conversation items.
+ *
+ * @param {DevRev.ConversationsExportQuery} request
+ * @param {Conversations.RequestOptions} requestOptions - Request-specific configuration.
+ *
+ * @throws {@link DevRev.BadRequestError}
+ * @throws {@link DevRev.UnauthorizedError}
+ * @throws {@link DevRev.ForbiddenError}
+ * @throws {@link DevRev.TooManyRequestsError}
+ * @throws {@link DevRev.InternalServerError}
+ * @throws {@link DevRev.ServiceUnavailableError}
+ *
+ * @example
+ * await client.conversations.export({
+ * tagsV2Id: "TAG-12345"
+ * })
+ */
+ public async export(
+ request: DevRev.ConversationsExportQuery = {},
+ requestOptions?: Conversations.RequestOptions
+ ): Promise {
+ const {
+ appliesToParts,
+ first,
+ group,
+ isCreatorVerified,
+ isSpam,
+ members,
+ ownedBy,
+ revOrg,
+ slaSummaryStage,
+ sourceChannels,
+ stageName,
+ tags,
+ tagsV2Id,
+ tagsV2Value,
+ } = request;
+ const _queryParams: Record = {};
+ if (appliesToParts != null) {
+ if (Array.isArray(appliesToParts)) {
+ _queryParams["applies_to_parts"] = appliesToParts.map((item) => item);
+ } else {
+ _queryParams["applies_to_parts"] = appliesToParts;
+ }
+ }
+
+ if (first != null) {
+ _queryParams["first"] = first.toString();
+ }
+
+ if (group != null) {
+ if (Array.isArray(group)) {
+ _queryParams["group"] = group.map((item) => item);
+ } else {
+ _queryParams["group"] = group;
+ }
+ }
+
+ if (isCreatorVerified != null) {
+ _queryParams["is_creator_verified"] = isCreatorVerified.toString();
+ }
+
+ if (isSpam != null) {
+ _queryParams["is_spam"] = isSpam.toString();
+ }
+
+ if (members != null) {
+ if (Array.isArray(members)) {
+ _queryParams["members"] = members.map((item) => item);
+ } else {
+ _queryParams["members"] = members;
+ }
+ }
+
+ if (ownedBy != null) {
+ if (Array.isArray(ownedBy)) {
+ _queryParams["owned_by"] = ownedBy.map((item) => item);
+ } else {
+ _queryParams["owned_by"] = ownedBy;
+ }
+ }
+
+ if (revOrg != null) {
+ if (Array.isArray(revOrg)) {
+ _queryParams["rev_org"] = revOrg.map((item) => item);
+ } else {
+ _queryParams["rev_org"] = revOrg;
+ }
+ }
+
+ if (slaSummaryStage != null) {
+ if (Array.isArray(slaSummaryStage)) {
+ _queryParams["sla_summary.stage"] = slaSummaryStage.map((item) => item);
+ } else {
+ _queryParams["sla_summary.stage"] = slaSummaryStage;
+ }
+ }
+
+ if (sourceChannels != null) {
+ if (Array.isArray(sourceChannels)) {
+ _queryParams["source_channels"] = sourceChannels.map((item) => item);
+ } else {
+ _queryParams["source_channels"] = sourceChannels;
+ }
+ }
+
+ if (stageName != null) {
+ if (Array.isArray(stageName)) {
+ _queryParams["stage.name"] = stageName.map((item) => item);
+ } else {
+ _queryParams["stage.name"] = stageName;
+ }
+ }
+
+ if (tags != null) {
+ if (Array.isArray(tags)) {
+ _queryParams["tags"] = tags.map((item) => item);
+ } else {
+ _queryParams["tags"] = tags;
+ }
+ }
+
+ if (tagsV2Id != null) {
+ _queryParams["tags_v2.id"] = tagsV2Id;
+ }
+
+ if (tagsV2Value != null) {
+ _queryParams["tags_v2.value"] = tagsV2Value;
+ }
+
+ const _response = await (this._options.fetcher ?? core.fetcher)({
+ url: urlJoin(
+ (await core.Supplier.get(this._options.environment)) ?? environments.DevRevEnvironment.Default,
+ "conversations.export"
+ ),
+ method: "GET",
+ headers: {
+ Authorization: await this._getAuthorizationHeader(),
+ "X-Fern-Language": "JavaScript",
+ "X-Fern-SDK-Name": "@devrev/api",
+ "X-Fern-SDK-Version": "0.0.14",
+ "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 serializers.ConversationsExportResponse.parseOrThrow(_response.body, {
+ unrecognizedObjectKeys: "passthrough",
+ allowUnrecognizedUnionMembers: true,
+ allowUnrecognizedEnumValues: true,
+ skipValidation: true,
+ breadcrumbsPrefix: ["response"],
+ });
+ }
+
+ if (_response.error.reason === "status-code") {
+ switch (_response.error.statusCode) {
+ case 400:
+ throw new DevRev.BadRequestError(
+ serializers.ErrorBadRequest.parseOrThrow(_response.error.body, {
+ unrecognizedObjectKeys: "passthrough",
+ allowUnrecognizedUnionMembers: true,
+ allowUnrecognizedEnumValues: true,
+ skipValidation: true,
+ breadcrumbsPrefix: ["response"],
+ })
+ );
+ case 401:
+ throw new DevRev.UnauthorizedError(
+ serializers.ErrorUnauthorized.parseOrThrow(_response.error.body, {
+ unrecognizedObjectKeys: "passthrough",
+ allowUnrecognizedUnionMembers: true,
+ allowUnrecognizedEnumValues: true,
+ skipValidation: true,
+ breadcrumbsPrefix: ["response"],
+ })
+ );
+ case 403:
+ throw new DevRev.ForbiddenError(
+ serializers.ErrorForbidden.parseOrThrow(_response.error.body, {
+ unrecognizedObjectKeys: "passthrough",
+ allowUnrecognizedUnionMembers: true,
+ allowUnrecognizedEnumValues: true,
+ skipValidation: true,
+ breadcrumbsPrefix: ["response"],
+ })
+ );
+ case 429:
+ throw new DevRev.TooManyRequestsError(
+ serializers.ErrorTooManyRequests.parseOrThrow(_response.error.body, {
+ unrecognizedObjectKeys: "passthrough",
+ allowUnrecognizedUnionMembers: true,
+ allowUnrecognizedEnumValues: true,
+ skipValidation: true,
+ breadcrumbsPrefix: ["response"],
+ })
+ );
+ case 500:
+ throw new DevRev.InternalServerError(
+ serializers.ErrorInternalServerError.parseOrThrow(_response.error.body, {
+ unrecognizedObjectKeys: "passthrough",
+ allowUnrecognizedUnionMembers: true,
+ allowUnrecognizedEnumValues: true,
+ skipValidation: true,
+ breadcrumbsPrefix: ["response"],
+ })
+ );
+ case 503:
+ throw new DevRev.ServiceUnavailableError(
+ serializers.ErrorServiceUnavailable.parseOrThrow(_response.error.body, {
+ unrecognizedObjectKeys: "passthrough",
+ allowUnrecognizedUnionMembers: true,
+ allowUnrecognizedEnumValues: true,
+ skipValidation: true,
+ breadcrumbsPrefix: ["response"],
+ })
+ );
+ default:
+ throw new errors.DevRevError({
+ statusCode: _response.error.statusCode,
+ body: _response.error.body,
+ });
+ }
+ }
+
+ switch (_response.error.reason) {
+ case "non-json":
+ throw new errors.DevRevError({
+ statusCode: _response.error.statusCode,
+ body: _response.error.rawBody,
+ });
+ case "timeout":
+ throw new errors.DevRevTimeoutError();
+ case "unknown":
+ throw new errors.DevRevError({
+ message: _response.error.errorMessage,
+ });
+ }
+ }
+
+ /**
+ * Exports a collection of conversation items.
+ *
+ * @param {DevRev.ConversationsExportRequest} request
+ * @param {Conversations.RequestOptions} requestOptions - Request-specific configuration.
+ *
+ * @throws {@link DevRev.BadRequestError}
+ * @throws {@link DevRev.UnauthorizedError}
+ * @throws {@link DevRev.ForbiddenError}
+ * @throws {@link DevRev.TooManyRequestsError}
+ * @throws {@link DevRev.InternalServerError}
+ * @throws {@link DevRev.ServiceUnavailableError}
+ *
+ * @example
+ * await client.conversations.exportPost()
+ */
+ public async exportPost(
+ request: DevRev.ConversationsExportRequest = {},
+ requestOptions?: Conversations.RequestOptions
+ ): Promise {
+ const _response = await (this._options.fetcher ?? core.fetcher)({
+ url: urlJoin(
+ (await core.Supplier.get(this._options.environment)) ?? environments.DevRevEnvironment.Default,
+ "conversations.export"
+ ),
+ method: "POST",
+ headers: {
+ Authorization: await this._getAuthorizationHeader(),
+ "X-Fern-Language": "JavaScript",
+ "X-Fern-SDK-Name": "@devrev/api",
+ "X-Fern-SDK-Version": "0.0.14",
+ "X-Fern-Runtime": core.RUNTIME.type,
+ "X-Fern-Runtime-Version": core.RUNTIME.version,
+ },
+ contentType: "application/json",
+ requestType: "json",
+ body: serializers.ConversationsExportRequest.jsonOrThrow(request, { unrecognizedObjectKeys: "strip" }),
+ timeoutMs: requestOptions?.timeoutInSeconds != null ? requestOptions.timeoutInSeconds * 1000 : 60000,
+ maxRetries: requestOptions?.maxRetries,
+ abortSignal: requestOptions?.abortSignal,
+ });
+ if (_response.ok) {
+ return serializers.ConversationsExportResponse.parseOrThrow(_response.body, {
+ unrecognizedObjectKeys: "passthrough",
+ allowUnrecognizedUnionMembers: true,
+ allowUnrecognizedEnumValues: true,
+ skipValidation: true,
+ breadcrumbsPrefix: ["response"],
+ });
+ }
+
+ if (_response.error.reason === "status-code") {
+ switch (_response.error.statusCode) {
+ case 400:
+ throw new DevRev.BadRequestError(
+ serializers.ErrorBadRequest.parseOrThrow(_response.error.body, {
+ unrecognizedObjectKeys: "passthrough",
+ allowUnrecognizedUnionMembers: true,
+ allowUnrecognizedEnumValues: true,
+ skipValidation: true,
+ breadcrumbsPrefix: ["response"],
+ })
+ );
+ case 401:
+ throw new DevRev.UnauthorizedError(
+ serializers.ErrorUnauthorized.parseOrThrow(_response.error.body, {
+ unrecognizedObjectKeys: "passthrough",
+ allowUnrecognizedUnionMembers: true,
+ allowUnrecognizedEnumValues: true,
+ skipValidation: true,
+ breadcrumbsPrefix: ["response"],
+ })
+ );
+ case 403:
+ throw new DevRev.ForbiddenError(
+ serializers.ErrorForbidden.parseOrThrow(_response.error.body, {
+ unrecognizedObjectKeys: "passthrough",
+ allowUnrecognizedUnionMembers: true,
+ allowUnrecognizedEnumValues: true,
+ skipValidation: true,
+ breadcrumbsPrefix: ["response"],
+ })
+ );
+ case 429:
+ throw new DevRev.TooManyRequestsError(
+ serializers.ErrorTooManyRequests.parseOrThrow(_response.error.body, {
+ unrecognizedObjectKeys: "passthrough",
+ allowUnrecognizedUnionMembers: true,
+ allowUnrecognizedEnumValues: true,
+ skipValidation: true,
+ breadcrumbsPrefix: ["response"],
+ })
+ );
+ case 500:
+ throw new DevRev.InternalServerError(
+ serializers.ErrorInternalServerError.parseOrThrow(_response.error.body, {
+ unrecognizedObjectKeys: "passthrough",
+ allowUnrecognizedUnionMembers: true,
+ allowUnrecognizedEnumValues: true,
+ skipValidation: true,
+ breadcrumbsPrefix: ["response"],
+ })
+ );
+ case 503:
+ throw new DevRev.ServiceUnavailableError(
+ serializers.ErrorServiceUnavailable.parseOrThrow(_response.error.body, {
+ unrecognizedObjectKeys: "passthrough",
+ allowUnrecognizedUnionMembers: true,
+ allowUnrecognizedEnumValues: true,
+ skipValidation: true,
+ breadcrumbsPrefix: ["response"],
+ })
+ );
+ default:
+ throw new errors.DevRevError({
+ statusCode: _response.error.statusCode,
+ body: _response.error.body,
+ });
+ }
+ }
+
+ switch (_response.error.reason) {
+ case "non-json":
+ throw new errors.DevRevError({
+ statusCode: _response.error.statusCode,
+ body: _response.error.rawBody,
+ });
+ case "timeout":
+ throw new errors.DevRevTimeoutError();
+ case "unknown":
+ throw new errors.DevRevError({
+ message: _response.error.errorMessage,
+ });
+ }
+ }
+
+ /**
+ * Gets the requested conversation's information.
+ *
+ * @param {DevRev.ConversationsGetQuery} request
+ * @param {Conversations.RequestOptions} requestOptions - Request-specific configuration.
+ *
+ * @throws {@link DevRev.BadRequestError}
+ * @throws {@link DevRev.UnauthorizedError}
+ * @throws {@link DevRev.ForbiddenError}
+ * @throws {@link DevRev.NotFoundError}
+ * @throws {@link DevRev.TooManyRequestsError}
+ * @throws {@link DevRev.InternalServerError}
+ * @throws {@link DevRev.ServiceUnavailableError}
+ *
+ * @example
+ * await client.conversations.get({
+ * id: "id"
+ * })
+ */
+ public async get(
+ request: DevRev.ConversationsGetQuery,
+ requestOptions?: Conversations.RequestOptions
+ ): Promise {
+ const { id } = request;
+ const _queryParams: Record = {};
+ _queryParams["id"] = id;
+ const _response = await (this._options.fetcher ?? core.fetcher)({
+ url: urlJoin(
+ (await core.Supplier.get(this._options.environment)) ?? environments.DevRevEnvironment.Default,
+ "conversations.get"
+ ),
+ method: "GET",
+ headers: {
+ Authorization: await this._getAuthorizationHeader(),
+ "X-Fern-Language": "JavaScript",
+ "X-Fern-SDK-Name": "@devrev/api",
+ "X-Fern-SDK-Version": "0.0.14",
+ "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 serializers.ConversationsGetResponse.parseOrThrow(_response.body, {
+ unrecognizedObjectKeys: "passthrough",
+ allowUnrecognizedUnionMembers: true,
+ allowUnrecognizedEnumValues: true,
+ skipValidation: true,
+ breadcrumbsPrefix: ["response"],
+ });
+ }
+
+ if (_response.error.reason === "status-code") {
+ switch (_response.error.statusCode) {
+ case 400:
+ throw new DevRev.BadRequestError(
+ serializers.ErrorBadRequest.parseOrThrow(_response.error.body, {
+ unrecognizedObjectKeys: "passthrough",
+ allowUnrecognizedUnionMembers: true,
+ allowUnrecognizedEnumValues: true,
+ skipValidation: true,
+ breadcrumbsPrefix: ["response"],
+ })
+ );
+ case 401:
+ throw new DevRev.UnauthorizedError(
+ serializers.ErrorUnauthorized.parseOrThrow(_response.error.body, {
+ unrecognizedObjectKeys: "passthrough",
+ allowUnrecognizedUnionMembers: true,
+ allowUnrecognizedEnumValues: true,
+ skipValidation: true,
+ breadcrumbsPrefix: ["response"],
+ })
+ );
+ case 403:
+ throw new DevRev.ForbiddenError(
+ serializers.ErrorForbidden.parseOrThrow(_response.error.body, {
+ unrecognizedObjectKeys: "passthrough",
+ allowUnrecognizedUnionMembers: true,
+ allowUnrecognizedEnumValues: true,
+ skipValidation: true,
+ breadcrumbsPrefix: ["response"],
+ })
+ );
+ case 404:
+ throw new DevRev.NotFoundError(
+ serializers.ErrorNotFound.parseOrThrow(_response.error.body, {
+ unrecognizedObjectKeys: "passthrough",
+ allowUnrecognizedUnionMembers: true,
+ allowUnrecognizedEnumValues: true,
+ skipValidation: true,
+ breadcrumbsPrefix: ["response"],
+ })
+ );
+ case 429:
+ throw new DevRev.TooManyRequestsError(
+ serializers.ErrorTooManyRequests.parseOrThrow(_response.error.body, {
+ unrecognizedObjectKeys: "passthrough",
+ allowUnrecognizedUnionMembers: true,
+ allowUnrecognizedEnumValues: true,
+ skipValidation: true,
+ breadcrumbsPrefix: ["response"],
+ })
+ );
+ case 500:
+ throw new DevRev.InternalServerError(
+ serializers.ErrorInternalServerError.parseOrThrow(_response.error.body, {
+ unrecognizedObjectKeys: "passthrough",
+ allowUnrecognizedUnionMembers: true,
+ allowUnrecognizedEnumValues: true,
+ skipValidation: true,
+ breadcrumbsPrefix: ["response"],
+ })
+ );
+ case 503:
+ throw new DevRev.ServiceUnavailableError(
+ serializers.ErrorServiceUnavailable.parseOrThrow(_response.error.body, {
+ unrecognizedObjectKeys: "passthrough",
+ allowUnrecognizedUnionMembers: true,
+ allowUnrecognizedEnumValues: true,
+ skipValidation: true,
+ breadcrumbsPrefix: ["response"],
+ })
+ );
+ default:
+ throw new errors.DevRevError({
+ statusCode: _response.error.statusCode,
+ body: _response.error.body,
+ });
+ }
+ }
+
+ switch (_response.error.reason) {
+ case "non-json":
+ throw new errors.DevRevError({
+ statusCode: _response.error.statusCode,
+ body: _response.error.rawBody,
+ });
+ case "timeout":
+ throw new errors.DevRevTimeoutError();
+ case "unknown":
+ throw new errors.DevRevError({
+ message: _response.error.errorMessage,
+ });
+ }
+ }
+
+ /**
+ * Gets the requested conversation's information.
+ *
+ * @param {DevRev.ConversationsGetRequest} request
+ * @param {Conversations.RequestOptions} requestOptions - Request-specific configuration.
+ *
+ * @throws {@link DevRev.BadRequestError}
+ * @throws {@link DevRev.UnauthorizedError}
+ * @throws {@link DevRev.ForbiddenError}
+ * @throws {@link DevRev.NotFoundError}
+ * @throws {@link DevRev.TooManyRequestsError}
+ * @throws {@link DevRev.InternalServerError}
+ * @throws {@link DevRev.ServiceUnavailableError}
+ *
+ * @example
+ * await client.conversations.getPost({
+ * id: "id"
+ * })
+ */
+ public async getPost(
+ request: DevRev.ConversationsGetRequest,
+ requestOptions?: Conversations.RequestOptions
+ ): Promise {
+ const _response = await (this._options.fetcher ?? core.fetcher)({
+ url: urlJoin(
+ (await core.Supplier.get(this._options.environment)) ?? environments.DevRevEnvironment.Default,
+ "conversations.get"
+ ),
+ method: "POST",
+ headers: {
+ Authorization: await this._getAuthorizationHeader(),
+ "X-Fern-Language": "JavaScript",
+ "X-Fern-SDK-Name": "@devrev/api",
+ "X-Fern-SDK-Version": "0.0.14",
+ "X-Fern-Runtime": core.RUNTIME.type,
+ "X-Fern-Runtime-Version": core.RUNTIME.version,
+ },
+ contentType: "application/json",
+ requestType: "json",
+ body: serializers.ConversationsGetRequest.jsonOrThrow(request, { unrecognizedObjectKeys: "strip" }),
+ timeoutMs: requestOptions?.timeoutInSeconds != null ? requestOptions.timeoutInSeconds * 1000 : 60000,
+ maxRetries: requestOptions?.maxRetries,
+ abortSignal: requestOptions?.abortSignal,
+ });
+ if (_response.ok) {
+ return serializers.ConversationsGetResponse.parseOrThrow(_response.body, {
+ unrecognizedObjectKeys: "passthrough",
+ allowUnrecognizedUnionMembers: true,
+ allowUnrecognizedEnumValues: true,
+ skipValidation: true,
+ breadcrumbsPrefix: ["response"],
+ });
+ }
+
+ if (_response.error.reason === "status-code") {
+ switch (_response.error.statusCode) {
+ case 400:
+ throw new DevRev.BadRequestError(
+ serializers.ErrorBadRequest.parseOrThrow(_response.error.body, {
+ unrecognizedObjectKeys: "passthrough",
+ allowUnrecognizedUnionMembers: true,
+ allowUnrecognizedEnumValues: true,
+ skipValidation: true,
+ breadcrumbsPrefix: ["response"],
+ })
+ );
+ case 401:
+ throw new DevRev.UnauthorizedError(
+ serializers.ErrorUnauthorized.parseOrThrow(_response.error.body, {
+ unrecognizedObjectKeys: "passthrough",
+ allowUnrecognizedUnionMembers: true,
+ allowUnrecognizedEnumValues: true,
+ skipValidation: true,
+ breadcrumbsPrefix: ["response"],
+ })
+ );
+ case 403:
+ throw new DevRev.ForbiddenError(
+ serializers.ErrorForbidden.parseOrThrow(_response.error.body, {
+ unrecognizedObjectKeys: "passthrough",
+ allowUnrecognizedUnionMembers: true,
+ allowUnrecognizedEnumValues: true,
+ skipValidation: true,
+ breadcrumbsPrefix: ["response"],
+ })
+ );
+ case 404:
+ throw new DevRev.NotFoundError(
+ serializers.ErrorNotFound.parseOrThrow(_response.error.body, {
+ unrecognizedObjectKeys: "passthrough",
+ allowUnrecognizedUnionMembers: true,
+ allowUnrecognizedEnumValues: true,
+ skipValidation: true,
+ breadcrumbsPrefix: ["response"],
+ })
+ );
+ case 429:
+ throw new DevRev.TooManyRequestsError(
+ serializers.ErrorTooManyRequests.parseOrThrow(_response.error.body, {
+ unrecognizedObjectKeys: "passthrough",
+ allowUnrecognizedUnionMembers: true,
+ allowUnrecognizedEnumValues: true,
+ skipValidation: true,
+ breadcrumbsPrefix: ["response"],
+ })
+ );
+ case 500:
+ throw new DevRev.InternalServerError(
+ serializers.ErrorInternalServerError.parseOrThrow(_response.error.body, {
+ unrecognizedObjectKeys: "passthrough",
+ allowUnrecognizedUnionMembers: true,
+ allowUnrecognizedEnumValues: true,
+ skipValidation: true,
+ breadcrumbsPrefix: ["response"],
+ })
+ );
+ case 503:
+ throw new DevRev.ServiceUnavailableError(
+ serializers.ErrorServiceUnavailable.parseOrThrow(_response.error.body, {
+ unrecognizedObjectKeys: "passthrough",
+ allowUnrecognizedUnionMembers: true,
+ allowUnrecognizedEnumValues: true,
+ skipValidation: true,
+ breadcrumbsPrefix: ["response"],
+ })
+ );
+ default:
+ throw new errors.DevRevError({
+ statusCode: _response.error.statusCode,
+ body: _response.error.body,
+ });
+ }
+ }
+
+ switch (_response.error.reason) {
+ case "non-json":
+ throw new errors.DevRevError({
+ statusCode: _response.error.statusCode,
+ body: _response.error.rawBody,
+ });
+ case "timeout":
+ throw new errors.DevRevTimeoutError();
+ case "unknown":
+ throw new errors.DevRevError({
+ message: _response.error.errorMessage,
+ });
+ }
+ }
+
+ /**
+ * Lists the available conversations.
+ *
+ * @param {DevRev.ConversationsListQuery} request
+ * @param {Conversations.RequestOptions} requestOptions - Request-specific configuration.
+ *
+ * @throws {@link DevRev.BadRequestError}
+ * @throws {@link DevRev.UnauthorizedError}
+ * @throws {@link DevRev.ForbiddenError}
+ * @throws {@link DevRev.TooManyRequestsError}
+ * @throws {@link DevRev.InternalServerError}
+ * @throws {@link DevRev.ServiceUnavailableError}
+ *
+ * @example
+ * await client.conversations.list({
+ * tagsV2Id: "TAG-12345"
+ * })
+ */
+ public async list(
+ request: DevRev.ConversationsListQuery = {},
+ requestOptions?: Conversations.RequestOptions
+ ): Promise {
+ const {
+ appliesToParts,
+ cursor,
+ group,
+ isCreatorVerified,
+ isSpam,
+ limit,
+ members,
+ mode,
+ ownedBy,
+ revOrg,
+ slaSummaryStage,
+ sourceChannels,
+ stageName,
+ tags,
+ tagsV2Id,
+ tagsV2Value,
+ } = request;
+ const _queryParams: Record = {};
+ if (appliesToParts != null) {
+ if (Array.isArray(appliesToParts)) {
+ _queryParams["applies_to_parts"] = appliesToParts.map((item) => item);
+ } else {
+ _queryParams["applies_to_parts"] = appliesToParts;
+ }
+ }
+
+ if (cursor != null) {
+ _queryParams["cursor"] = cursor;
+ }
+
+ if (group != null) {
+ if (Array.isArray(group)) {
+ _queryParams["group"] = group.map((item) => item);
+ } else {
+ _queryParams["group"] = group;
+ }
+ }
+
+ if (isCreatorVerified != null) {
+ _queryParams["is_creator_verified"] = isCreatorVerified.toString();
+ }
+
+ if (isSpam != null) {
+ _queryParams["is_spam"] = isSpam.toString();
+ }
+
+ if (limit != null) {
+ _queryParams["limit"] = limit.toString();
+ }
+
+ if (members != null) {
+ if (Array.isArray(members)) {
+ _queryParams["members"] = members.map((item) => item);
+ } else {
+ _queryParams["members"] = members;
+ }
+ }
+
+ if (mode != null) {
+ _queryParams["mode"] = mode;
+ }
+
+ if (ownedBy != null) {
+ if (Array.isArray(ownedBy)) {
+ _queryParams["owned_by"] = ownedBy.map((item) => item);
+ } else {
+ _queryParams["owned_by"] = ownedBy;
+ }
+ }
+
+ if (revOrg != null) {
+ if (Array.isArray(revOrg)) {
+ _queryParams["rev_org"] = revOrg.map((item) => item);
+ } else {
+ _queryParams["rev_org"] = revOrg;
+ }
+ }
+
+ if (slaSummaryStage != null) {
+ if (Array.isArray(slaSummaryStage)) {
+ _queryParams["sla_summary.stage"] = slaSummaryStage.map((item) => item);
+ } else {
+ _queryParams["sla_summary.stage"] = slaSummaryStage;
+ }
+ }
+
+ if (sourceChannels != null) {
+ if (Array.isArray(sourceChannels)) {
+ _queryParams["source_channels"] = sourceChannels.map((item) => item);
+ } else {
+ _queryParams["source_channels"] = sourceChannels;
+ }
+ }
+
+ if (stageName != null) {
+ if (Array.isArray(stageName)) {
+ _queryParams["stage.name"] = stageName.map((item) => item);
+ } else {
+ _queryParams["stage.name"] = stageName;
+ }
+ }
+
+ if (tags != null) {
+ if (Array.isArray(tags)) {
+ _queryParams["tags"] = tags.map((item) => item);
+ } else {
+ _queryParams["tags"] = tags;
+ }
+ }
+
+ if (tagsV2Id != null) {
+ _queryParams["tags_v2.id"] = tagsV2Id;
+ }
+
+ if (tagsV2Value != null) {
+ _queryParams["tags_v2.value"] = tagsV2Value;
+ }
+
+ const _response = await (this._options.fetcher ?? core.fetcher)({
+ url: urlJoin(
+ (await core.Supplier.get(this._options.environment)) ?? environments.DevRevEnvironment.Default,
+ "conversations.list"
+ ),
+ method: "GET",
+ headers: {
+ Authorization: await this._getAuthorizationHeader(),
+ "X-Fern-Language": "JavaScript",
+ "X-Fern-SDK-Name": "@devrev/api",
+ "X-Fern-SDK-Version": "0.0.14",
+ "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 serializers.ConversationsListResponse.parseOrThrow(_response.body, {
+ unrecognizedObjectKeys: "passthrough",
+ allowUnrecognizedUnionMembers: true,
+ allowUnrecognizedEnumValues: true,
+ skipValidation: true,
+ breadcrumbsPrefix: ["response"],
+ });
+ }
+
+ if (_response.error.reason === "status-code") {
+ switch (_response.error.statusCode) {
+ case 400:
+ throw new DevRev.BadRequestError(
+ serializers.ErrorBadRequest.parseOrThrow(_response.error.body, {
+ unrecognizedObjectKeys: "passthrough",
+ allowUnrecognizedUnionMembers: true,
+ allowUnrecognizedEnumValues: true,
+ skipValidation: true,
+ breadcrumbsPrefix: ["response"],
+ })
+ );
+ case 401:
+ throw new DevRev.UnauthorizedError(
+ serializers.ErrorUnauthorized.parseOrThrow(_response.error.body, {
+ unrecognizedObjectKeys: "passthrough",
+ allowUnrecognizedUnionMembers: true,
+ allowUnrecognizedEnumValues: true,
+ skipValidation: true,
+ breadcrumbsPrefix: ["response"],
+ })
+ );
+ case 403:
+ throw new DevRev.ForbiddenError(
+ serializers.ErrorForbidden.parseOrThrow(_response.error.body, {
+ unrecognizedObjectKeys: "passthrough",
+ allowUnrecognizedUnionMembers: true,
+ allowUnrecognizedEnumValues: true,
+ skipValidation: true,
+ breadcrumbsPrefix: ["response"],
+ })
+ );
+ case 429:
+ throw new DevRev.TooManyRequestsError(
+ serializers.ErrorTooManyRequests.parseOrThrow(_response.error.body, {
+ unrecognizedObjectKeys: "passthrough",
+ allowUnrecognizedUnionMembers: true,
+ allowUnrecognizedEnumValues: true,
+ skipValidation: true,
+ breadcrumbsPrefix: ["response"],
+ })
+ );
+ case 500:
+ throw new DevRev.InternalServerError(
+ serializers.ErrorInternalServerError.parseOrThrow(_response.error.body, {
+ unrecognizedObjectKeys: "passthrough",
+ allowUnrecognizedUnionMembers: true,
+ allowUnrecognizedEnumValues: true,
+ skipValidation: true,
+ breadcrumbsPrefix: ["response"],
+ })
+ );
+ case 503:
+ throw new DevRev.ServiceUnavailableError(
+ serializers.ErrorServiceUnavailable.parseOrThrow(_response.error.body, {
+ unrecognizedObjectKeys: "passthrough",
+ allowUnrecognizedUnionMembers: true,
+ allowUnrecognizedEnumValues: true,
+ skipValidation: true,
+ breadcrumbsPrefix: ["response"],
+ })
+ );
+ default:
+ throw new errors.DevRevError({
+ statusCode: _response.error.statusCode,
+ body: _response.error.body,
+ });
+ }
+ }
+
+ switch (_response.error.reason) {
+ case "non-json":
+ throw new errors.DevRevError({
+ statusCode: _response.error.statusCode,
+ body: _response.error.rawBody,
+ });
+ case "timeout":
+ throw new errors.DevRevTimeoutError();
+ case "unknown":
+ throw new errors.DevRevError({
+ message: _response.error.errorMessage,
+ });
+ }
+ }
+
+ /**
+ * Lists the available conversations.
+ *
+ * @param {DevRev.ConversationsListRequest} request
+ * @param {Conversations.RequestOptions} requestOptions - Request-specific configuration.
+ *
+ * @throws {@link DevRev.BadRequestError}
+ * @throws {@link DevRev.UnauthorizedError}
+ * @throws {@link DevRev.ForbiddenError}
+ * @throws {@link DevRev.TooManyRequestsError}
+ * @throws {@link DevRev.InternalServerError}
+ * @throws {@link DevRev.ServiceUnavailableError}
+ *
+ * @example
+ * await client.conversations.listPost()
+ */
+ public async listPost(
+ request: DevRev.ConversationsListRequest = {},
+ requestOptions?: Conversations.RequestOptions
+ ): Promise {
+ const _response = await (this._options.fetcher ?? core.fetcher)({
+ url: urlJoin(
+ (await core.Supplier.get(this._options.environment)) ?? environments.DevRevEnvironment.Default,
+ "conversations.list"
+ ),
+ method: "POST",
+ headers: {
+ Authorization: await this._getAuthorizationHeader(),
+ "X-Fern-Language": "JavaScript",
+ "X-Fern-SDK-Name": "@devrev/api",
+ "X-Fern-SDK-Version": "0.0.14",
+ "X-Fern-Runtime": core.RUNTIME.type,
+ "X-Fern-Runtime-Version": core.RUNTIME.version,
+ },
+ contentType: "application/json",
+ requestType: "json",
+ body: serializers.ConversationsListRequest.jsonOrThrow(request, { unrecognizedObjectKeys: "strip" }),
+ timeoutMs: requestOptions?.timeoutInSeconds != null ? requestOptions.timeoutInSeconds * 1000 : 60000,
+ maxRetries: requestOptions?.maxRetries,
+ abortSignal: requestOptions?.abortSignal,
+ });
+ if (_response.ok) {
+ return serializers.ConversationsListResponse.parseOrThrow(_response.body, {
+ unrecognizedObjectKeys: "passthrough",
+ allowUnrecognizedUnionMembers: true,
+ allowUnrecognizedEnumValues: true,
+ skipValidation: true,
+ breadcrumbsPrefix: ["response"],
+ });
+ }
+
+ if (_response.error.reason === "status-code") {
+ switch (_response.error.statusCode) {
+ case 400:
+ throw new DevRev.BadRequestError(
+ serializers.ErrorBadRequest.parseOrThrow(_response.error.body, {
+ unrecognizedObjectKeys: "passthrough",
+ allowUnrecognizedUnionMembers: true,
+ allowUnrecognizedEnumValues: true,
+ skipValidation: true,
+ breadcrumbsPrefix: ["response"],
+ })
+ );
+ case 401:
+ throw new DevRev.UnauthorizedError(
+ serializers.ErrorUnauthorized.parseOrThrow(_response.error.body, {
+ unrecognizedObjectKeys: "passthrough",
+ allowUnrecognizedUnionMembers: true,
+ allowUnrecognizedEnumValues: true,
+ skipValidation: true,
+ breadcrumbsPrefix: ["response"],
+ })
+ );
+ case 403:
+ throw new DevRev.ForbiddenError(
+ serializers.ErrorForbidden.parseOrThrow(_response.error.body, {
+ unrecognizedObjectKeys: "passthrough",
+ allowUnrecognizedUnionMembers: true,
+ allowUnrecognizedEnumValues: true,
+ skipValidation: true,
+ breadcrumbsPrefix: ["response"],
+ })
+ );
+ case 429:
+ throw new DevRev.TooManyRequestsError(
+ serializers.ErrorTooManyRequests.parseOrThrow(_response.error.body, {
+ unrecognizedObjectKeys: "passthrough",
+ allowUnrecognizedUnionMembers: true,
+ allowUnrecognizedEnumValues: true,
+ skipValidation: true,
+ breadcrumbsPrefix: ["response"],
+ })
+ );
+ case 500:
+ throw new DevRev.InternalServerError(
+ serializers.ErrorInternalServerError.parseOrThrow(_response.error.body, {
+ unrecognizedObjectKeys: "passthrough",
+ allowUnrecognizedUnionMembers: true,
+ allowUnrecognizedEnumValues: true,
+ skipValidation: true,
+ breadcrumbsPrefix: ["response"],
+ })
+ );
+ case 503:
+ throw new DevRev.ServiceUnavailableError(
+ serializers.ErrorServiceUnavailable.parseOrThrow(_response.error.body, {
+ unrecognizedObjectKeys: "passthrough",
+ allowUnrecognizedUnionMembers: true,
+ allowUnrecognizedEnumValues: true,
+ skipValidation: true,
+ breadcrumbsPrefix: ["response"],
+ })
+ );
+ default:
+ throw new errors.DevRevError({
+ statusCode: _response.error.statusCode,
+ body: _response.error.body,
+ });
+ }
+ }
+
+ switch (_response.error.reason) {
+ case "non-json":
+ throw new errors.DevRevError({
+ statusCode: _response.error.statusCode,
+ body: _response.error.rawBody,
+ });
+ case "timeout":
+ throw new errors.DevRevTimeoutError();
+ case "unknown":
+ throw new errors.DevRevError({
+ message: _response.error.errorMessage,
+ });
+ }
+ }
+
+ /**
+ * Updates the requested conversation.
+ *
+ * @param {DevRev.ConversationsUpdateRequest} request
+ * @param {Conversations.RequestOptions} requestOptions - Request-specific configuration.
+ *
+ * @throws {@link DevRev.BadRequestError}
+ * @throws {@link DevRev.UnauthorizedError}
+ * @throws {@link DevRev.ForbiddenError}
+ * @throws {@link DevRev.NotFoundError}
+ * @throws {@link DevRev.TooManyRequestsError}
+ * @throws {@link DevRev.InternalServerError}
+ * @throws {@link DevRev.ServiceUnavailableError}
+ *
+ * @example
+ * await client.conversations.update({
+ * id: "id"
+ * })
+ */
+ public async update(
+ request: DevRev.ConversationsUpdateRequest,
+ requestOptions?: Conversations.RequestOptions
+ ): Promise {
+ const _response = await (this._options.fetcher ?? core.fetcher)({
+ url: urlJoin(
+ (await core.Supplier.get(this._options.environment)) ?? environments.DevRevEnvironment.Default,
+ "conversations.update"
+ ),
+ method: "POST",
+ headers: {
+ Authorization: await this._getAuthorizationHeader(),
+ "X-Fern-Language": "JavaScript",
+ "X-Fern-SDK-Name": "@devrev/api",
+ "X-Fern-SDK-Version": "0.0.14",
+ "X-Fern-Runtime": core.RUNTIME.type,
+ "X-Fern-Runtime-Version": core.RUNTIME.version,
+ },
+ contentType: "application/json",
+ requestType: "json",
+ body: serializers.ConversationsUpdateRequest.jsonOrThrow(request, { unrecognizedObjectKeys: "strip" }),
+ timeoutMs: requestOptions?.timeoutInSeconds != null ? requestOptions.timeoutInSeconds * 1000 : 60000,
+ maxRetries: requestOptions?.maxRetries,
+ abortSignal: requestOptions?.abortSignal,
+ });
+ if (_response.ok) {
+ return serializers.ConversationsUpdateResponse.parseOrThrow(_response.body, {
+ unrecognizedObjectKeys: "passthrough",
+ allowUnrecognizedUnionMembers: true,
+ allowUnrecognizedEnumValues: true,
+ skipValidation: true,
+ breadcrumbsPrefix: ["response"],
+ });
+ }
+
+ if (_response.error.reason === "status-code") {
+ switch (_response.error.statusCode) {
+ case 400:
+ throw new DevRev.BadRequestError(
+ serializers.ErrorBadRequest.parseOrThrow(_response.error.body, {
+ unrecognizedObjectKeys: "passthrough",
+ allowUnrecognizedUnionMembers: true,
+ allowUnrecognizedEnumValues: true,
+ skipValidation: true,
+ breadcrumbsPrefix: ["response"],
+ })
+ );
+ case 401:
+ throw new DevRev.UnauthorizedError(
+ serializers.ErrorUnauthorized.parseOrThrow(_response.error.body, {
+ unrecognizedObjectKeys: "passthrough",
+ allowUnrecognizedUnionMembers: true,
+ allowUnrecognizedEnumValues: true,
+ skipValidation: true,
+ breadcrumbsPrefix: ["response"],
+ })
+ );
+ case 403:
+ throw new DevRev.ForbiddenError(
+ serializers.ErrorForbidden.parseOrThrow(_response.error.body, {
+ unrecognizedObjectKeys: "passthrough",
+ allowUnrecognizedUnionMembers: true,
+ allowUnrecognizedEnumValues: true,
+ skipValidation: true,
+ breadcrumbsPrefix: ["response"],
+ })
+ );
+ case 404:
+ throw new DevRev.NotFoundError(
+ serializers.ErrorNotFound.parseOrThrow(_response.error.body, {
+ unrecognizedObjectKeys: "passthrough",
+ allowUnrecognizedUnionMembers: true,
+ allowUnrecognizedEnumValues: true,
+ skipValidation: true,
+ breadcrumbsPrefix: ["response"],
+ })
+ );
+ case 429:
+ throw new DevRev.TooManyRequestsError(
+ serializers.ErrorTooManyRequests.parseOrThrow(_response.error.body, {
+ unrecognizedObjectKeys: "passthrough",
+ allowUnrecognizedUnionMembers: true,
+ allowUnrecognizedEnumValues: true,
+ skipValidation: true,
+ breadcrumbsPrefix: ["response"],
+ })
+ );
+ case 500:
+ throw new DevRev.InternalServerError(
+ serializers.ErrorInternalServerError.parseOrThrow(_response.error.body, {
+ unrecognizedObjectKeys: "passthrough",
+ allowUnrecognizedUnionMembers: true,
+ allowUnrecognizedEnumValues: true,
+ skipValidation: true,
+ breadcrumbsPrefix: ["response"],
+ })
+ );
+ case 503:
+ throw new DevRev.ServiceUnavailableError(
+ serializers.ErrorServiceUnavailable.parseOrThrow(_response.error.body, {
+ unrecognizedObjectKeys: "passthrough",
+ allowUnrecognizedUnionMembers: true,
+ allowUnrecognizedEnumValues: true,
+ skipValidation: true,
+ breadcrumbsPrefix: ["response"],
+ })
+ );
+ default:
+ throw new errors.DevRevError({
+ statusCode: _response.error.statusCode,
+ body: _response.error.body,
+ });
+ }
+ }
+
+ switch (_response.error.reason) {
+ case "non-json":
+ throw new errors.DevRevError({
+ statusCode: _response.error.statusCode,
+ body: _response.error.rawBody,
+ });
+ case "timeout":
+ throw new errors.DevRevTimeoutError();
+ case "unknown":
+ throw new errors.DevRevError({
+ message: _response.error.errorMessage,
+ });
+ }
+ }
+
+ protected async _getAuthorizationHeader(): Promise {
+ const bearer = (await core.Supplier.get(this._options.token)) ?? process?.env["DEVREV_TOKEN"];
+ if (bearer == null) {
+ throw new errors.DevRevError({
+ message: "Please specify DEVREV_TOKEN when instantiating the client.",
+ });
+ }
+
+ return `Bearer ${bearer}`;
+ }
+}
diff --git a/src/api/resources/conversations/client/index.ts b/src/api/resources/conversations/client/index.ts
new file mode 100644
index 0000000..415726b
--- /dev/null
+++ b/src/api/resources/conversations/client/index.ts
@@ -0,0 +1 @@
+export * from "./requests";
diff --git a/src/api/resources/conversations/client/requests/ConversationsCreateRequest.ts b/src/api/resources/conversations/client/requests/ConversationsCreateRequest.ts
new file mode 100644
index 0000000..78978f1
--- /dev/null
+++ b/src/api/resources/conversations/client/requests/ConversationsCreateRequest.ts
@@ -0,0 +1,37 @@
+/**
+ * This file was auto-generated by Fern from our API Definition.
+ */
+
+import * as DevRev from "../../../../index";
+
+/**
+ * @example
+ * {
+ * type: "support"
+ * }
+ */
+export interface ConversationsCreateRequest {
+ /** Description for the conversation. */
+ description?: string;
+ /** The group that the conversation is associated with. */
+ group?: string;
+ /** Whether the conversation is spam. */
+ isSpam?: boolean;
+ /** The users in the conversation. */
+ members?: string[];
+ /** Initial messages on the conversation. */
+ messages?: DevRev.ConversationsCreateRequestMessage[];
+ metadata?: DevRev.ConversationsCreateRequestMetadata;
+ /** Whether the conversation is from a source channel. */
+ sourceChannel?: string;
+ stage?: DevRev.StageInit;
+ /** Tags associated with the conversation. */
+ tags?: DevRev.SetTagWithValue[];
+ /** The title for the conversation. */
+ title?: string;
+ /**
+ * The IDs of user sessions associated with the conversation.
+ *
+ */
+ userSessions?: string[];
+}
diff --git a/src/api/resources/conversations/client/requests/ConversationsDeleteRequest.ts b/src/api/resources/conversations/client/requests/ConversationsDeleteRequest.ts
new file mode 100644
index 0000000..ded3524
--- /dev/null
+++ b/src/api/resources/conversations/client/requests/ConversationsDeleteRequest.ts
@@ -0,0 +1,14 @@
+/**
+ * This file was auto-generated by Fern from our API Definition.
+ */
+
+/**
+ * @example
+ * {
+ * id: "id"
+ * }
+ */
+export interface ConversationsDeleteRequest {
+ /** The ID of the conversation to delete. */
+ id: string;
+}
diff --git a/src/api/resources/conversations/client/requests/ConversationsExportQuery.ts b/src/api/resources/conversations/client/requests/ConversationsExportQuery.ts
new file mode 100644
index 0000000..626dde1
--- /dev/null
+++ b/src/api/resources/conversations/client/requests/ConversationsExportQuery.ts
@@ -0,0 +1,73 @@
+/**
+ * This file was auto-generated by Fern from our API Definition.
+ */
+
+import * as DevRev from "../../../../index";
+
+/**
+ * @example
+ * {
+ * tagsV2Id: "TAG-12345"
+ * }
+ */
+export interface ConversationsExportQuery {
+ /**
+ * Filters for conversations belonging to any of the provided parts.
+ */
+ appliesToParts?: string | string[];
+ /**
+ * The number of conversation items to return. The default is '50', the
+ * maximum is '5000'.
+ */
+ first?: number;
+ /**
+ * Filters for conversation that belong to the given groups.
+ */
+ group?: string | string[];
+ /**
+ * Filters for conversations that are created by verified users.
+ */
+ isCreatorVerified?: boolean;
+ /**
+ * Filters for conversations that are spam.
+ */
+ isSpam?: boolean;
+ /**
+ * Filters for conversations where these users are participants.
+ */
+ members?: string | string[];
+ /**
+ * Filters for conversations owned by any of these users.
+ */
+ ownedBy?: string | string[];
+ /**
+ * Filters for conversations that are associated with any of the
+ * provided Rev organizations.
+ */
+ revOrg?: string | string[];
+ /**
+ * Filters for records with any of the provided SLA stages.
+ */
+ slaSummaryStage?: DevRev.SlaSummaryStage | DevRev.SlaSummaryStage[];
+ /**
+ * Filters for conversations with any of the provided source channels.
+ */
+ sourceChannels?: string | string[];
+ /**
+ * Filters for records in the provided stage(s) by name.
+ */
+ stageName?: string | string[];
+ /**
+ * Filters for conversations with any of the provided tags.
+ */
+ tags?: string | string[];
+ /**
+ * The ID of the tag.
+ */
+ tagsV2Id?: string;
+ /**
+ * The value for the object's association with the tag. If specified,
+ * the value must be one that's specified in the tag's allowed values.
+ */
+ tagsV2Value?: string;
+}
diff --git a/src/api/resources/conversations/client/requests/ConversationsExportRequest.ts b/src/api/resources/conversations/client/requests/ConversationsExportRequest.ts
new file mode 100644
index 0000000..12de676
--- /dev/null
+++ b/src/api/resources/conversations/client/requests/ConversationsExportRequest.ts
@@ -0,0 +1,62 @@
+/**
+ * This file was auto-generated by Fern from our API Definition.
+ */
+
+import * as DevRev from "../../../../index";
+
+/**
+ * @example
+ * {}
+ */
+export interface ConversationsExportRequest {
+ /**
+ * Filters for conversations belonging to any of the provided parts.
+ *
+ */
+ appliesToParts?: string[];
+ /**
+ * The number of conversation items to return. The default is '50',
+ * the maximum is '5000'.
+ *
+ */
+ first?: number;
+ /**
+ * Filters for conversation that belong to the given groups.
+ *
+ */
+ group?: string[];
+ /**
+ * Filters for conversations that are created by verified users.
+ *
+ */
+ isCreatorVerified?: boolean;
+ /** Filters for conversations that are spam. */
+ isSpam?: boolean;
+ /**
+ * Filters for conversations where these users are participants.
+ *
+ */
+ members?: string[];
+ /** Filters for conversations owned by any of these users. */
+ ownedBy?: string[];
+ /**
+ * Filters for conversations that are associated with any of the
+ * provided Rev organizations.
+ *
+ */
+ revOrg?: string[];
+ slaSummary?: DevRev.SlaSummaryFilter;
+ /**
+ * Filters for conversations with any of the provided source channels.
+ *
+ */
+ sourceChannels?: string[];
+ stage?: DevRev.StageFilter;
+ /** Filters for conversations with any of the provided tags. */
+ tags?: string[];
+ /**
+ * Filters for conversations with any of the provided tags with value.
+ *
+ */
+ tagsV2?: DevRev.TagWithValueFilter[];
+}
diff --git a/src/api/resources/conversations/client/requests/ConversationsGetQuery.ts b/src/api/resources/conversations/client/requests/ConversationsGetQuery.ts
new file mode 100644
index 0000000..718d992
--- /dev/null
+++ b/src/api/resources/conversations/client/requests/ConversationsGetQuery.ts
@@ -0,0 +1,16 @@
+/**
+ * This file was auto-generated by Fern from our API Definition.
+ */
+
+/**
+ * @example
+ * {
+ * id: "id"
+ * }
+ */
+export interface ConversationsGetQuery {
+ /**
+ * The requested conversation's ID.
+ */
+ id: string;
+}
diff --git a/src/api/resources/conversations/client/requests/ConversationsGetRequest.ts b/src/api/resources/conversations/client/requests/ConversationsGetRequest.ts
new file mode 100644
index 0000000..4275c69
--- /dev/null
+++ b/src/api/resources/conversations/client/requests/ConversationsGetRequest.ts
@@ -0,0 +1,14 @@
+/**
+ * This file was auto-generated by Fern from our API Definition.
+ */
+
+/**
+ * @example
+ * {
+ * id: "id"
+ * }
+ */
+export interface ConversationsGetRequest {
+ /** The requested conversation's ID. */
+ id: string;
+}
diff --git a/src/api/resources/conversations/client/requests/ConversationsListQuery.ts b/src/api/resources/conversations/client/requests/ConversationsListQuery.ts
new file mode 100644
index 0000000..02b1f26
--- /dev/null
+++ b/src/api/resources/conversations/client/requests/ConversationsListQuery.ts
@@ -0,0 +1,82 @@
+/**
+ * This file was auto-generated by Fern from our API Definition.
+ */
+
+import * as DevRev from "../../../../index";
+
+/**
+ * @example
+ * {
+ * tagsV2Id: "TAG-12345"
+ * }
+ */
+export interface ConversationsListQuery {
+ /**
+ * Filters for conversations belonging to any of the provided parts.
+ */
+ appliesToParts?: string | string[];
+ /**
+ * The cursor to resume iteration from. If not provided, then iteration
+ * starts from the beginning.
+ */
+ cursor?: string;
+ /**
+ * Filters for conversation that belong to the given groups.
+ */
+ group?: string | string[];
+ /**
+ * Filters for conversations that are created by verified users.
+ */
+ isCreatorVerified?: boolean;
+ /**
+ * Filters for conversations that are spam.
+ */
+ isSpam?: boolean;
+ /**
+ * The maximum number of conversations to return. The default is '50'.
+ */
+ limit?: number;
+ /**
+ * Filters for conversations where these users are participants.
+ */
+ members?: string | string[];
+ /**
+ * The iteration mode to use, otherwise if not set, then "after" is
+ * used.
+ */
+ mode?: DevRev.ListMode;
+ /**
+ * Filters for conversations owned by any of these users.
+ */
+ ownedBy?: string | string[];
+ /**
+ * Filters for conversations that are associated with any of the
+ * provided Rev organizations.
+ */
+ revOrg?: string | string[];
+ /**
+ * Filters for records with any of the provided SLA stages.
+ */
+ slaSummaryStage?: DevRev.SlaSummaryStage | DevRev.SlaSummaryStage[];
+ /**
+ * Filters for conversations with any of the provided source channels.
+ */
+ sourceChannels?: string | string[];
+ /**
+ * Filters for records in the provided stage(s) by name.
+ */
+ stageName?: string | string[];
+ /**
+ * Filters for conversations with any of the provided tags.
+ */
+ tags?: string | string[];
+ /**
+ * The ID of the tag.
+ */
+ tagsV2Id?: string;
+ /**
+ * The value for the object's association with the tag. If specified,
+ * the value must be one that's specified in the tag's allowed values.
+ */
+ tagsV2Value?: string;
+}
diff --git a/src/api/resources/conversations/client/requests/ConversationsListRequest.ts b/src/api/resources/conversations/client/requests/ConversationsListRequest.ts
new file mode 100644
index 0000000..134d443
--- /dev/null
+++ b/src/api/resources/conversations/client/requests/ConversationsListRequest.ts
@@ -0,0 +1,68 @@
+/**
+ * This file was auto-generated by Fern from our API Definition.
+ */
+
+import * as DevRev from "../../../../index";
+
+/**
+ * @example
+ * {}
+ */
+export interface ConversationsListRequest {
+ /**
+ * Filters for conversations belonging to any of the provided parts.
+ *
+ */
+ appliesToParts?: string[];
+ /**
+ * The cursor to resume iteration from. If not provided, then
+ * iteration starts from the beginning.
+ *
+ */
+ cursor?: string;
+ /**
+ * Filters for conversation that belong to the given groups.
+ *
+ */
+ group?: string[];
+ /**
+ * Filters for conversations that are created by verified users.
+ *
+ */
+ isCreatorVerified?: boolean;
+ /** Filters for conversations that are spam. */
+ isSpam?: boolean;
+ /**
+ * The maximum number of conversations to return. The default is '50'.
+ *
+ */
+ limit?: number;
+ /**
+ * Filters for conversations where these users are participants.
+ *
+ */
+ members?: string[];
+ mode?: DevRev.ListMode;
+ /** Filters for conversations owned by any of these users. */
+ ownedBy?: string[];
+ /**
+ * Filters for conversations that are associated with any of the
+ * provided Rev organizations.
+ *
+ */
+ revOrg?: string[];
+ slaSummary?: DevRev.SlaSummaryFilter;
+ /**
+ * Filters for conversations with any of the provided source channels.
+ *
+ */
+ sourceChannels?: string[];
+ stage?: DevRev.StageFilter;
+ /** Filters for conversations with any of the provided tags. */
+ tags?: string[];
+ /**
+ * Filters for conversations with any of the provided tags with value.
+ *
+ */
+ tagsV2?: DevRev.TagWithValueFilter[];
+}
diff --git a/src/api/resources/conversations/client/requests/ConversationsUpdateRequest.ts b/src/api/resources/conversations/client/requests/ConversationsUpdateRequest.ts
new file mode 100644
index 0000000..3c9d4a1
--- /dev/null
+++ b/src/api/resources/conversations/client/requests/ConversationsUpdateRequest.ts
@@ -0,0 +1,31 @@
+/**
+ * This file was auto-generated by Fern from our API Definition.
+ */
+
+import * as DevRev from "../../../../index";
+
+/**
+ * @example
+ * {
+ * id: "id"
+ * }
+ */
+export interface ConversationsUpdateRequest {
+ appliesToParts?: DevRev.ConversationsUpdateRequestAppliesToParts;
+ /** The updated description for the conversation. */
+ description?: string;
+ /** The group that the conversation is associated with. */
+ group?: string;
+ /** The ID of the conversation to update. */
+ id: string;
+ /** Whether the conversation is spam. */
+ isSpam?: boolean;
+ metadata?: DevRev.ConversationsUpdateRequestMetadata;
+ stage?: DevRev.StageUpdate;
+ /** The updated status of the conversation. */
+ status?: string;
+ tags?: DevRev.ConversationsUpdateRequestTags;
+ /** The updated title of the conversation. */
+ title?: string;
+ userSessions?: DevRev.ConversationsUpdateRequestUserSessions;
+}
diff --git a/src/api/resources/conversations/client/requests/index.ts b/src/api/resources/conversations/client/requests/index.ts
new file mode 100644
index 0000000..3116695
--- /dev/null
+++ b/src/api/resources/conversations/client/requests/index.ts
@@ -0,0 +1,9 @@
+export { type ConversationsCreateRequest } from "./ConversationsCreateRequest";
+export { type ConversationsDeleteRequest } from "./ConversationsDeleteRequest";
+export { type ConversationsExportQuery } from "./ConversationsExportQuery";
+export { type ConversationsExportRequest } from "./ConversationsExportRequest";
+export { type ConversationsGetQuery } from "./ConversationsGetQuery";
+export { type ConversationsGetRequest } from "./ConversationsGetRequest";
+export { type ConversationsListQuery } from "./ConversationsListQuery";
+export { type ConversationsListRequest } from "./ConversationsListRequest";
+export { type ConversationsUpdateRequest } from "./ConversationsUpdateRequest";
diff --git a/src/api/resources/conversations/index.ts b/src/api/resources/conversations/index.ts
new file mode 100644
index 0000000..5ec7692
--- /dev/null
+++ b/src/api/resources/conversations/index.ts
@@ -0,0 +1 @@
+export * from "./client";
diff --git a/src/api/resources/customization/client/Client.ts b/src/api/resources/customization/client/Client.ts
new file mode 100644
index 0000000..5ac17a1
--- /dev/null
+++ b/src/api/resources/customization/client/Client.ts
@@ -0,0 +1,3858 @@
+/**
+ * This file was auto-generated by Fern from our API Definition.
+ */
+
+import * as environments from "../../../../environments";
+import * as core from "../../../../core";
+import * as DevRev from "../../../index";
+import urlJoin from "url-join";
+import * as serializers from "../../../../serialization/index";
+import * as errors from "../../../../errors/index";
+
+export declare namespace Customization {
+ interface Options {
+ environment?: core.Supplier;
+ token?: 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;
+ }
+}
+
+/**
+ * DevRev customization.
+ */
+export class Customization {
+ constructor(protected readonly _options: Customization.Options = {}) {}
+
+ /**
+ * Gets the aggregated schema.
+ *
+ * @param {DevRev.AggregatedSchemaGetQuery} request
+ * @param {Customization.RequestOptions} requestOptions - Request-specific configuration.
+ *
+ * @throws {@link DevRev.BadRequestError}
+ * @throws {@link DevRev.UnauthorizedError}
+ * @throws {@link DevRev.ForbiddenError}
+ * @throws {@link DevRev.NotFoundError}
+ * @throws {@link DevRev.TooManyRequestsError}
+ * @throws {@link DevRev.InternalServerError}
+ * @throws {@link DevRev.ServiceUnavailableError}
+ *
+ * @example
+ * await client.customization.aggregatedSchemaGet({
+ * customSchemaFragmentIds: "string",
+ * leafType: "string",
+ * stockSchemaFragmentId: "string"
+ * })
+ */
+ public async aggregatedSchemaGet(
+ request: DevRev.AggregatedSchemaGetQuery = {},
+ requestOptions?: Customization.RequestOptions
+ ): Promise {
+ const { customSchemaFragmentIds, leafType, stockSchemaFragmentId } = request;
+ const _queryParams: Record = {};
+ if (customSchemaFragmentIds != null) {
+ if (Array.isArray(customSchemaFragmentIds)) {
+ _queryParams["custom_schema_fragment_ids"] = customSchemaFragmentIds.map((item) => item);
+ } else {
+ _queryParams["custom_schema_fragment_ids"] = customSchemaFragmentIds;
+ }
+ }
+
+ if (leafType != null) {
+ _queryParams["leaf_type"] = leafType;
+ }
+
+ if (stockSchemaFragmentId != null) {
+ _queryParams["stock_schema_fragment_id"] = stockSchemaFragmentId;
+ }
+
+ const _response = await (this._options.fetcher ?? core.fetcher)({
+ url: urlJoin(
+ (await core.Supplier.get(this._options.environment)) ?? environments.DevRevEnvironment.Default,
+ "schemas.aggregated.get"
+ ),
+ method: "GET",
+ headers: {
+ Authorization: await this._getAuthorizationHeader(),
+ "X-Fern-Language": "JavaScript",
+ "X-Fern-SDK-Name": "@devrev/api",
+ "X-Fern-SDK-Version": "0.0.14",
+ "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 serializers.AggregatedSchemaGetResponse.parseOrThrow(_response.body, {
+ unrecognizedObjectKeys: "passthrough",
+ allowUnrecognizedUnionMembers: true,
+ allowUnrecognizedEnumValues: true,
+ skipValidation: true,
+ breadcrumbsPrefix: ["response"],
+ });
+ }
+
+ if (_response.error.reason === "status-code") {
+ switch (_response.error.statusCode) {
+ case 400:
+ throw new DevRev.BadRequestError(
+ serializers.ErrorBadRequest.parseOrThrow(_response.error.body, {
+ unrecognizedObjectKeys: "passthrough",
+ allowUnrecognizedUnionMembers: true,
+ allowUnrecognizedEnumValues: true,
+ skipValidation: true,
+ breadcrumbsPrefix: ["response"],
+ })
+ );
+ case 401:
+ throw new DevRev.UnauthorizedError(
+ serializers.ErrorUnauthorized.parseOrThrow(_response.error.body, {
+ unrecognizedObjectKeys: "passthrough",
+ allowUnrecognizedUnionMembers: true,
+ allowUnrecognizedEnumValues: true,
+ skipValidation: true,
+ breadcrumbsPrefix: ["response"],
+ })
+ );
+ case 403:
+ throw new DevRev.ForbiddenError(
+ serializers.ErrorForbidden.parseOrThrow(_response.error.body, {
+ unrecognizedObjectKeys: "passthrough",
+ allowUnrecognizedUnionMembers: true,
+ allowUnrecognizedEnumValues: true,
+ skipValidation: true,
+ breadcrumbsPrefix: ["response"],
+ })
+ );
+ case 404:
+ throw new DevRev.NotFoundError(
+ serializers.ErrorNotFound.parseOrThrow(_response.error.body, {
+ unrecognizedObjectKeys: "passthrough",
+ allowUnrecognizedUnionMembers: true,
+ allowUnrecognizedEnumValues: true,
+ skipValidation: true,
+ breadcrumbsPrefix: ["response"],
+ })
+ );
+ case 429:
+ throw new DevRev.TooManyRequestsError(
+ serializers.ErrorTooManyRequests.parseOrThrow(_response.error.body, {
+ unrecognizedObjectKeys: "passthrough",
+ allowUnrecognizedUnionMembers: true,
+ allowUnrecognizedEnumValues: true,
+ skipValidation: true,
+ breadcrumbsPrefix: ["response"],
+ })
+ );
+ case 500:
+ throw new DevRev.InternalServerError(
+ serializers.ErrorInternalServerError.parseOrThrow(_response.error.body, {
+ unrecognizedObjectKeys: "passthrough",
+ allowUnrecognizedUnionMembers: true,
+ allowUnrecognizedEnumValues: true,
+ skipValidation: true,
+ breadcrumbsPrefix: ["response"],
+ })
+ );
+ case 503:
+ throw new DevRev.ServiceUnavailableError(
+ serializers.ErrorServiceUnavailable.parseOrThrow(_response.error.body, {
+ unrecognizedObjectKeys: "passthrough",
+ allowUnrecognizedUnionMembers: true,
+ allowUnrecognizedEnumValues: true,
+ skipValidation: true,
+ breadcrumbsPrefix: ["response"],
+ })
+ );
+ default:
+ throw new errors.DevRevError({
+ statusCode: _response.error.statusCode,
+ body: _response.error.body,
+ });
+ }
+ }
+
+ switch (_response.error.reason) {
+ case "non-json":
+ throw new errors.DevRevError({
+ statusCode: _response.error.statusCode,
+ body: _response.error.rawBody,
+ });
+ case "timeout":
+ throw new errors.DevRevTimeoutError();
+ case "unknown":
+ throw new errors.DevRevError({
+ message: _response.error.errorMessage,
+ });
+ }
+ }
+
+ /**
+ * Gets the aggregated schema.
+ *
+ * @param {DevRev.AggregatedSchemaGetRequest} request
+ * @param {Customization.RequestOptions} requestOptions - Request-specific configuration.
+ *
+ * @throws {@link DevRev.BadRequestError}
+ * @throws {@link DevRev.UnauthorizedError}
+ * @throws {@link DevRev.ForbiddenError}
+ * @throws {@link DevRev.NotFoundError}
+ * @throws {@link DevRev.TooManyRequestsError}
+ * @throws {@link DevRev.InternalServerError}
+ * @throws {@link DevRev.ServiceUnavailableError}
+ *
+ * @example
+ * await client.customization.aggregatedSchemaGetPost({
+ * customSchemaFragmentIds: ["custom_schema_fragment_ids"]
+ * })
+ */
+ public async aggregatedSchemaGetPost(
+ request: DevRev.AggregatedSchemaGetRequest,
+ requestOptions?: Customization.RequestOptions
+ ): Promise {
+ const _response = await (this._options.fetcher ?? core.fetcher)({
+ url: urlJoin(
+ (await core.Supplier.get(this._options.environment)) ?? environments.DevRevEnvironment.Default,
+ "schemas.aggregated.get"
+ ),
+ method: "POST",
+ headers: {
+ Authorization: await this._getAuthorizationHeader(),
+ "X-Fern-Language": "JavaScript",
+ "X-Fern-SDK-Name": "@devrev/api",
+ "X-Fern-SDK-Version": "0.0.14",
+ "X-Fern-Runtime": core.RUNTIME.type,
+ "X-Fern-Runtime-Version": core.RUNTIME.version,
+ },
+ contentType: "application/json",
+ requestType: "json",
+ body: serializers.AggregatedSchemaGetRequest.jsonOrThrow(request, { unrecognizedObjectKeys: "strip" }),
+ timeoutMs: requestOptions?.timeoutInSeconds != null ? requestOptions.timeoutInSeconds * 1000 : 60000,
+ maxRetries: requestOptions?.maxRetries,
+ abortSignal: requestOptions?.abortSignal,
+ });
+ if (_response.ok) {
+ return serializers.AggregatedSchemaGetResponse.parseOrThrow(_response.body, {
+ unrecognizedObjectKeys: "passthrough",
+ allowUnrecognizedUnionMembers: true,
+ allowUnrecognizedEnumValues: true,
+ skipValidation: true,
+ breadcrumbsPrefix: ["response"],
+ });
+ }
+
+ if (_response.error.reason === "status-code") {
+ switch (_response.error.statusCode) {
+ case 400:
+ throw new DevRev.BadRequestError(
+ serializers.ErrorBadRequest.parseOrThrow(_response.error.body, {
+ unrecognizedObjectKeys: "passthrough",
+ allowUnrecognizedUnionMembers: true,
+ allowUnrecognizedEnumValues: true,
+ skipValidation: true,
+ breadcrumbsPrefix: ["response"],
+ })
+ );
+ case 401:
+ throw new DevRev.UnauthorizedError(
+ serializers.ErrorUnauthorized.parseOrThrow(_response.error.body, {
+ unrecognizedObjectKeys: "passthrough",
+ allowUnrecognizedUnionMembers: true,
+ allowUnrecognizedEnumValues: true,
+ skipValidation: true,
+ breadcrumbsPrefix: ["response"],
+ })
+ );
+ case 403:
+ throw new DevRev.ForbiddenError(
+ serializers.ErrorForbidden.parseOrThrow(_response.error.body, {
+ unrecognizedObjectKeys: "passthrough",
+ allowUnrecognizedUnionMembers: true,
+ allowUnrecognizedEnumValues: true,
+ skipValidation: true,
+ breadcrumbsPrefix: ["response"],
+ })
+ );
+ case 404:
+ throw new DevRev.NotFoundError(
+ serializers.ErrorNotFound.parseOrThrow(_response.error.body, {
+ unrecognizedObjectKeys: "passthrough",
+ allowUnrecognizedUnionMembers: true,
+ allowUnrecognizedEnumValues: true,
+ skipValidation: true,
+ breadcrumbsPrefix: ["response"],
+ })
+ );
+ case 429:
+ throw new DevRev.TooManyRequestsError(
+ serializers.ErrorTooManyRequests.parseOrThrow(_response.error.body, {
+ unrecognizedObjectKeys: "passthrough",
+ allowUnrecognizedUnionMembers: true,
+ allowUnrecognizedEnumValues: true,
+ skipValidation: true,
+ breadcrumbsPrefix: ["response"],
+ })
+ );
+ case 500:
+ throw new DevRev.InternalServerError(
+ serializers.ErrorInternalServerError.parseOrThrow(_response.error.body, {
+ unrecognizedObjectKeys: "passthrough",
+ allowUnrecognizedUnionMembers: true,
+ allowUnrecognizedEnumValues: true,
+ skipValidation: true,
+ breadcrumbsPrefix: ["response"],
+ })
+ );
+ case 503:
+ throw new DevRev.ServiceUnavailableError(
+ serializers.ErrorServiceUnavailable.parseOrThrow(_response.error.body, {
+ unrecognizedObjectKeys: "passthrough",
+ allowUnrecognizedUnionMembers: true,
+ allowUnrecognizedEnumValues: true,
+ skipValidation: true,
+ breadcrumbsPrefix: ["response"],
+ })
+ );
+ default:
+ throw new errors.DevRevError({
+ statusCode: _response.error.statusCode,
+ body: _response.error.body,
+ });
+ }
+ }
+
+ switch (_response.error.reason) {
+ case "non-json":
+ throw new errors.DevRevError({
+ statusCode: _response.error.statusCode,
+ body: _response.error.rawBody,
+ });
+ case "timeout":
+ throw new errors.DevRevTimeoutError();
+ case "unknown":
+ throw new errors.DevRevError({
+ message: _response.error.errorMessage,
+ });
+ }
+ }
+
+ /**
+ * Gets a custom schema fragment.
+ *
+ * @param {DevRev.CustomSchemaFragmentsGetQuery} request
+ * @param {Customization.RequestOptions} requestOptions - Request-specific configuration.
+ *
+ * @throws {@link DevRev.BadRequestError}
+ * @throws {@link DevRev.UnauthorizedError}
+ * @throws {@link DevRev.ForbiddenError}
+ * @throws {@link DevRev.NotFoundError}
+ * @throws {@link DevRev.TooManyRequestsError}
+ * @throws {@link DevRev.InternalServerError}
+ * @throws {@link DevRev.ServiceUnavailableError}
+ *
+ * @example
+ * await client.customization.customSchemaFragmentsGet({
+ * id: "string"
+ * })
+ */
+ public async customSchemaFragmentsGet(
+ request: DevRev.CustomSchemaFragmentsGetQuery,
+ requestOptions?: Customization.RequestOptions
+ ): Promise {
+ const { id } = request;
+ const _queryParams: Record = {};
+ _queryParams["id"] = id;
+ const _response = await (this._options.fetcher ?? core.fetcher)({
+ url: urlJoin(
+ (await core.Supplier.get(this._options.environment)) ?? environments.DevRevEnvironment.Default,
+ "schemas.custom.get"
+ ),
+ method: "GET",
+ headers: {
+ Authorization: await this._getAuthorizationHeader(),
+ "X-Fern-Language": "JavaScript",
+ "X-Fern-SDK-Name": "@devrev/api",
+ "X-Fern-SDK-Version": "0.0.14",
+ "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 serializers.CustomSchemaFragmentsGetResponse.parseOrThrow(_response.body, {
+ unrecognizedObjectKeys: "passthrough",
+ allowUnrecognizedUnionMembers: true,
+ allowUnrecognizedEnumValues: true,
+ skipValidation: true,
+ breadcrumbsPrefix: ["response"],
+ });
+ }
+
+ if (_response.error.reason === "status-code") {
+ switch (_response.error.statusCode) {
+ case 400:
+ throw new DevRev.BadRequestError(
+ serializers.ErrorBadRequest.parseOrThrow(_response.error.body, {
+ unrecognizedObjectKeys: "passthrough",
+ allowUnrecognizedUnionMembers: true,
+ allowUnrecognizedEnumValues: true,
+ skipValidation: true,
+ breadcrumbsPrefix: ["response"],
+ })
+ );
+ case 401:
+ throw new DevRev.UnauthorizedError(
+ serializers.ErrorUnauthorized.parseOrThrow(_response.error.body, {
+ unrecognizedObjectKeys: "passthrough",
+ allowUnrecognizedUnionMembers: true,
+ allowUnrecognizedEnumValues: true,
+ skipValidation: true,
+ breadcrumbsPrefix: ["response"],
+ })
+ );
+ case 403:
+ throw new DevRev.ForbiddenError(
+ serializers.ErrorForbidden.parseOrThrow(_response.error.body, {
+ unrecognizedObjectKeys: "passthrough",
+ allowUnrecognizedUnionMembers: true,
+ allowUnrecognizedEnumValues: true,
+ skipValidation: true,
+ breadcrumbsPrefix: ["response"],
+ })
+ );
+ case 404:
+ throw new DevRev.NotFoundError(
+ serializers.ErrorNotFound.parseOrThrow(_response.error.body, {
+ unrecognizedObjectKeys: "passthrough",
+ allowUnrecognizedUnionMembers: true,
+ allowUnrecognizedEnumValues: true,
+ skipValidation: true,
+ breadcrumbsPrefix: ["response"],
+ })
+ );
+ case 429:
+ throw new DevRev.TooManyRequestsError(
+ serializers.ErrorTooManyRequests.parseOrThrow(_response.error.body, {
+ unrecognizedObjectKeys: "passthrough",
+ allowUnrecognizedUnionMembers: true,
+ allowUnrecognizedEnumValues: true,
+ skipValidation: true,
+ breadcrumbsPrefix: ["response"],
+ })
+ );
+ case 500:
+ throw new DevRev.InternalServerError(
+ serializers.ErrorInternalServerError.parseOrThrow(_response.error.body, {
+ unrecognizedObjectKeys: "passthrough",
+ allowUnrecognizedUnionMembers: true,
+ allowUnrecognizedEnumValues: true,
+ skipValidation: true,
+ breadcrumbsPrefix: ["response"],
+ })
+ );
+ case 503:
+ throw new DevRev.ServiceUnavailableError(
+ serializers.ErrorServiceUnavailable.parseOrThrow(_response.error.body, {
+ unrecognizedObjectKeys: "passthrough",
+ allowUnrecognizedUnionMembers: true,
+ allowUnrecognizedEnumValues: true,
+ skipValidation: true,
+ breadcrumbsPrefix: ["response"],
+ })
+ );
+ default:
+ throw new errors.DevRevError({
+ statusCode: _response.error.statusCode,
+ body: _response.error.body,
+ });
+ }
+ }
+
+ switch (_response.error.reason) {
+ case "non-json":
+ throw new errors.DevRevError({
+ statusCode: _response.error.statusCode,
+ body: _response.error.rawBody,
+ });
+ case "timeout":
+ throw new errors.DevRevTimeoutError();
+ case "unknown":
+ throw new errors.DevRevError({
+ message: _response.error.errorMessage,
+ });
+ }
+ }
+
+ /**
+ * Gets a custom schema fragment.
+ *
+ * @param {DevRev.CustomSchemaFragmentsGetRequest} request
+ * @param {Customization.RequestOptions} requestOptions - Request-specific configuration.
+ *
+ * @throws {@link DevRev.BadRequestError}
+ * @throws {@link DevRev.UnauthorizedError}
+ * @throws {@link DevRev.ForbiddenError}
+ * @throws {@link DevRev.NotFoundError}
+ * @throws {@link DevRev.TooManyRequestsError}
+ * @throws {@link DevRev.InternalServerError}
+ * @throws {@link DevRev.ServiceUnavailableError}
+ *
+ * @example
+ * await client.customization.customSchemaFragmentsGetPost({
+ * id: "string"
+ * })
+ */
+ public async customSchemaFragmentsGetPost(
+ request: DevRev.CustomSchemaFragmentsGetRequest,
+ requestOptions?: Customization.RequestOptions
+ ): Promise {
+ const _response = await (this._options.fetcher ?? core.fetcher)({
+ url: urlJoin(
+ (await core.Supplier.get(this._options.environment)) ?? environments.DevRevEnvironment.Default,
+ "schemas.custom.get"
+ ),
+ method: "POST",
+ headers: {
+ Authorization: await this._getAuthorizationHeader(),
+ "X-Fern-Language": "JavaScript",
+ "X-Fern-SDK-Name": "@devrev/api",
+ "X-Fern-SDK-Version": "0.0.14",
+ "X-Fern-Runtime": core.RUNTIME.type,
+ "X-Fern-Runtime-Version": core.RUNTIME.version,
+ },
+ contentType: "application/json",
+ requestType: "json",
+ body: serializers.CustomSchemaFragmentsGetRequest.jsonOrThrow(request, { unrecognizedObjectKeys: "strip" }),
+ timeoutMs: requestOptions?.timeoutInSeconds != null ? requestOptions.timeoutInSeconds * 1000 : 60000,
+ maxRetries: requestOptions?.maxRetries,
+ abortSignal: requestOptions?.abortSignal,
+ });
+ if (_response.ok) {
+ return serializers.CustomSchemaFragmentsGetResponse.parseOrThrow(_response.body, {
+ unrecognizedObjectKeys: "passthrough",
+ allowUnrecognizedUnionMembers: true,
+ allowUnrecognizedEnumValues: true,
+ skipValidation: true,
+ breadcrumbsPrefix: ["response"],
+ });
+ }
+
+ if (_response.error.reason === "status-code") {
+ switch (_response.error.statusCode) {
+ case 400:
+ throw new DevRev.BadRequestError(
+ serializers.ErrorBadRequest.parseOrThrow(_response.error.body, {
+ unrecognizedObjectKeys: "passthrough",
+ allowUnrecognizedUnionMembers: true,
+ allowUnrecognizedEnumValues: true,
+ skipValidation: true,
+ breadcrumbsPrefix: ["response"],
+ })
+ );
+ case 401:
+ throw new DevRev.UnauthorizedError(
+ serializers.ErrorUnauthorized.parseOrThrow(_response.error.body, {
+ unrecognizedObjectKeys: "passthrough",
+ allowUnrecognizedUnionMembers: true,
+ allowUnrecognizedEnumValues: true,
+ skipValidation: true,
+ breadcrumbsPrefix: ["response"],
+ })
+ );
+ case 403:
+ throw new DevRev.ForbiddenError(
+ serializers.ErrorForbidden.parseOrThrow(_response.error.body, {
+ unrecognizedObjectKeys: "passthrough",
+ allowUnrecognizedUnionMembers: true,
+ allowUnrecognizedEnumValues: true,
+ skipValidation: true,
+ breadcrumbsPrefix: ["response"],
+ })
+ );
+ case 404:
+ throw new DevRev.NotFoundError(
+ serializers.ErrorNotFound.parseOrThrow(_response.error.body, {
+ unrecognizedObjectKeys: "passthrough",
+ allowUnrecognizedUnionMembers: true,
+ allowUnrecognizedEnumValues: true,
+ skipValidation: true,
+ breadcrumbsPrefix: ["response"],
+ })
+ );
+ case 429:
+ throw new DevRev.TooManyRequestsError(
+ serializers.ErrorTooManyRequests.parseOrThrow(_response.error.body, {
+ unrecognizedObjectKeys: "passthrough",
+ allowUnrecognizedUnionMembers: true,
+ allowUnrecognizedEnumValues: true,
+ skipValidation: true,
+ breadcrumbsPrefix: ["response"],
+ })
+ );
+ case 500:
+ throw new DevRev.InternalServerError(
+ serializers.ErrorInternalServerError.parseOrThrow(_response.error.body, {
+ unrecognizedObjectKeys: "passthrough",
+ allowUnrecognizedUnionMembers: true,
+ allowUnrecognizedEnumValues: true,
+ skipValidation: true,
+ breadcrumbsPrefix: ["response"],
+ })
+ );
+ case 503:
+ throw new DevRev.ServiceUnavailableError(
+ serializers.ErrorServiceUnavailable.parseOrThrow(_response.error.body, {
+ unrecognizedObjectKeys: "passthrough",
+ allowUnrecognizedUnionMembers: true,
+ allowUnrecognizedEnumValues: true,
+ skipValidation: true,
+ breadcrumbsPrefix: ["response"],
+ })
+ );
+ default:
+ throw new errors.DevRevError({
+ statusCode: _response.error.statusCode,
+ body: _response.error.body,
+ });
+ }
+ }
+
+ switch (_response.error.reason) {
+ case "non-json":
+ throw new errors.DevRevError({
+ statusCode: _response.error.statusCode,
+ body: _response.error.rawBody,
+ });
+ case "timeout":
+ throw new errors.DevRevTimeoutError();
+ case "unknown":
+ throw new errors.DevRevError({
+ message: _response.error.errorMessage,
+ });
+ }
+ }
+
+ /**
+ * Lists custom schema fragments.
+ *
+ * @param {DevRev.CustomSchemaFragmentsListQuery} request
+ * @param {Customization.RequestOptions} requestOptions - Request-specific configuration.
+ *
+ * @throws {@link DevRev.BadRequestError}
+ * @throws {@link DevRev.UnauthorizedError}
+ * @throws {@link DevRev.ForbiddenError}
+ * @throws {@link DevRev.TooManyRequestsError}
+ * @throws {@link DevRev.InternalServerError}
+ * @throws {@link DevRev.ServiceUnavailableError}
+ *
+ * @example
+ * await client.customization.customSchemaFragmentsList()
+ */
+ public async customSchemaFragmentsList(
+ request: DevRev.CustomSchemaFragmentsListQuery = {},
+ requestOptions?: Customization.RequestOptions
+ ): Promise {
+ const { app, cursor, deprecated, leafType, limit, mode, prune, sortBy, subtype, types } = request;
+ const _queryParams: Record = {};
+ if (app != null) {
+ if (Array.isArray(app)) {
+ _queryParams["app"] = app.map((item) => item);
+ } else {
+ _queryParams["app"] = app;
+ }
+ }
+
+ if (cursor != null) {
+ _queryParams["cursor"] = cursor;
+ }
+
+ if (deprecated != null) {
+ _queryParams["deprecated"] = deprecated.toString();
+ }
+
+ if (leafType != null) {
+ if (Array.isArray(leafType)) {
+ _queryParams["leaf_type"] = leafType.map((item) => item);
+ } else {
+ _queryParams["leaf_type"] = leafType;
+ }
+ }
+
+ if (limit != null) {
+ _queryParams["limit"] = limit.toString();
+ }
+
+ if (mode != null) {
+ _queryParams["mode"] = mode;
+ }
+
+ if (prune != null) {
+ if (Array.isArray(prune)) {
+ _queryParams["prune"] = prune.map((item) => item);
+ } else {
+ _queryParams["prune"] = prune;
+ }
+ }
+
+ if (sortBy != null) {
+ if (Array.isArray(sortBy)) {
+ _queryParams["sort_by"] = sortBy.map((item) => item);
+ } else {
+ _queryParams["sort_by"] = sortBy;
+ }
+ }
+
+ if (subtype != null) {
+ if (Array.isArray(subtype)) {
+ _queryParams["subtype"] = subtype.map((item) => item);
+ } else {
+ _queryParams["subtype"] = subtype;
+ }
+ }
+
+ if (types != null) {
+ if (Array.isArray(types)) {
+ _queryParams["types"] = types.map((item) => item);
+ } else {
+ _queryParams["types"] = types;
+ }
+ }
+
+ const _response = await (this._options.fetcher ?? core.fetcher)({
+ url: urlJoin(
+ (await core.Supplier.get(this._options.environment)) ?? environments.DevRevEnvironment.Default,
+ "schemas.custom.list"
+ ),
+ method: "GET",
+ headers: {
+ Authorization: await this._getAuthorizationHeader(),
+ "X-Fern-Language": "JavaScript",
+ "X-Fern-SDK-Name": "@devrev/api",
+ "X-Fern-SDK-Version": "0.0.14",
+ "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 serializers.CustomSchemaFragmentsListResponse.parseOrThrow(_response.body, {
+ unrecognizedObjectKeys: "passthrough",
+ allowUnrecognizedUnionMembers: true,
+ allowUnrecognizedEnumValues: true,
+ skipValidation: true,
+ breadcrumbsPrefix: ["response"],
+ });
+ }
+
+ if (_response.error.reason === "status-code") {
+ switch (_response.error.statusCode) {
+ case 400:
+ throw new DevRev.BadRequestError(
+ serializers.ErrorBadRequest.parseOrThrow(_response.error.body, {
+ unrecognizedObjectKeys: "passthrough",
+ allowUnrecognizedUnionMembers: true,
+ allowUnrecognizedEnumValues: true,
+ skipValidation: true,
+ breadcrumbsPrefix: ["response"],
+ })
+ );
+ case 401:
+ throw new DevRev.UnauthorizedError(
+ serializers.ErrorUnauthorized.parseOrThrow(_response.error.body, {
+ unrecognizedObjectKeys: "passthrough",
+ allowUnrecognizedUnionMembers: true,
+ allowUnrecognizedEnumValues: true,
+ skipValidation: true,
+ breadcrumbsPrefix: ["response"],
+ })
+ );
+ case 403:
+ throw new DevRev.ForbiddenError(
+ serializers.ErrorForbidden.parseOrThrow(_response.error.body, {
+ unrecognizedObjectKeys: "passthrough",
+ allowUnrecognizedUnionMembers: true,
+ allowUnrecognizedEnumValues: true,
+ skipValidation: true,
+ breadcrumbsPrefix: ["response"],
+ })
+ );
+ case 429:
+ throw new DevRev.TooManyRequestsError(
+ serializers.ErrorTooManyRequests.parseOrThrow(_response.error.body, {
+ unrecognizedObjectKeys: "passthrough",
+ allowUnrecognizedUnionMembers: true,
+ allowUnrecognizedEnumValues: true,
+ skipValidation: true,
+ breadcrumbsPrefix: ["response"],
+ })
+ );
+ case 500:
+ throw new DevRev.InternalServerError(
+ serializers.ErrorInternalServerError.parseOrThrow(_response.error.body, {
+ unrecognizedObjectKeys: "passthrough",
+ allowUnrecognizedUnionMembers: true,
+ allowUnrecognizedEnumValues: true,
+ skipValidation: true,
+ breadcrumbsPrefix: ["response"],
+ })
+ );
+ case 503:
+ throw new DevRev.ServiceUnavailableError(
+ serializers.ErrorServiceUnavailable.parseOrThrow(_response.error.body, {
+ unrecognizedObjectKeys: "passthrough",
+ allowUnrecognizedUnionMembers: true,
+ allowUnrecognizedEnumValues: true,
+ skipValidation: true,
+ breadcrumbsPrefix: ["response"],
+ })
+ );
+ default:
+ throw new errors.DevRevError({
+ statusCode: _response.error.statusCode,
+ body: _response.error.body,
+ });
+ }
+ }
+
+ switch (_response.error.reason) {
+ case "non-json":
+ throw new errors.DevRevError({
+ statusCode: _response.error.statusCode,
+ body: _response.error.rawBody,
+ });
+ case "timeout":
+ throw new errors.DevRevTimeoutError();
+ case "unknown":
+ throw new errors.DevRevError({
+ message: _response.error.errorMessage,
+ });
+ }
+ }
+
+ /**
+ * Lists custom schema fragments.
+ *
+ * @param {DevRev.CustomSchemaFragmentsListRequest} request
+ * @param {Customization.RequestOptions} requestOptions - Request-specific configuration.
+ *
+ * @throws {@link DevRev.BadRequestError}
+ * @throws {@link DevRev.UnauthorizedError}
+ * @throws {@link DevRev.ForbiddenError}
+ * @throws {@link DevRev.TooManyRequestsError}
+ * @throws {@link DevRev.InternalServerError}
+ * @throws {@link DevRev.ServiceUnavailableError}
+ *
+ * @example
+ * await client.customization.customSchemaFragmentsListPost()
+ */
+ public async customSchemaFragmentsListPost(
+ request: DevRev.CustomSchemaFragmentsListRequest = {},
+ requestOptions?: Customization.RequestOptions
+ ): Promise {
+ const _response = await (this._options.fetcher ?? core.fetcher)({
+ url: urlJoin(
+ (await core.Supplier.get(this._options.environment)) ?? environments.DevRevEnvironment.Default,
+ "schemas.custom.list"
+ ),
+ method: "POST",
+ headers: {
+ Authorization: await this._getAuthorizationHeader(),
+ "X-Fern-Language": "JavaScript",
+ "X-Fern-SDK-Name": "@devrev/api",
+ "X-Fern-SDK-Version": "0.0.14",
+ "X-Fern-Runtime": core.RUNTIME.type,
+ "X-Fern-Runtime-Version": core.RUNTIME.version,
+ },
+ contentType: "application/json",
+ requestType: "json",
+ body: serializers.CustomSchemaFragmentsListRequest.jsonOrThrow(request, {
+ unrecognizedObjectKeys: "strip",
+ }),
+ timeoutMs: requestOptions?.timeoutInSeconds != null ? requestOptions.timeoutInSeconds * 1000 : 60000,
+ maxRetries: requestOptions?.maxRetries,
+ abortSignal: requestOptions?.abortSignal,
+ });
+ if (_response.ok) {
+ return serializers.CustomSchemaFragmentsListResponse.parseOrThrow(_response.body, {
+ unrecognizedObjectKeys: "passthrough",
+ allowUnrecognizedUnionMembers: true,
+ allowUnrecognizedEnumValues: true,
+ skipValidation: true,
+ breadcrumbsPrefix: ["response"],
+ });
+ }
+
+ if (_response.error.reason === "status-code") {
+ switch (_response.error.statusCode) {
+ case 400:
+ throw new DevRev.BadRequestError(
+ serializers.ErrorBadRequest.parseOrThrow(_response.error.body, {
+ unrecognizedObjectKeys: "passthrough",
+ allowUnrecognizedUnionMembers: true,
+ allowUnrecognizedEnumValues: true,
+ skipValidation: true,
+ breadcrumbsPrefix: ["response"],
+ })
+ );
+ case 401:
+ throw new DevRev.UnauthorizedError(
+ serializers.ErrorUnauthorized.parseOrThrow(_response.error.body, {
+ unrecognizedObjectKeys: "passthrough",
+ allowUnrecognizedUnionMembers: true,
+ allowUnrecognizedEnumValues: true,
+ skipValidation: true,
+ breadcrumbsPrefix: ["response"],
+ })
+ );
+ case 403:
+ throw new DevRev.ForbiddenError(
+ serializers.ErrorForbidden.parseOrThrow(_response.error.body, {
+ unrecognizedObjectKeys: "passthrough",
+ allowUnrecognizedUnionMembers: true,
+ allowUnrecognizedEnumValues: true,
+ skipValidation: true,
+ breadcrumbsPrefix: ["response"],
+ })
+ );
+ case 429:
+ throw new DevRev.TooManyRequestsError(
+ serializers.ErrorTooManyRequests.parseOrThrow(_response.error.body, {
+ unrecognizedObjectKeys: "passthrough",
+ allowUnrecognizedUnionMembers: true,
+ allowUnrecognizedEnumValues: true,
+ skipValidation: true,
+ breadcrumbsPrefix: ["response"],
+ })
+ );
+ case 500:
+ throw new DevRev.InternalServerError(
+ serializers.ErrorInternalServerError.parseOrThrow(_response.error.body, {
+ unrecognizedObjectKeys: "passthrough",
+ allowUnrecognizedUnionMembers: true,
+ allowUnrecognizedEnumValues: true,
+ skipValidation: true,
+ breadcrumbsPrefix: ["response"],
+ })
+ );
+ case 503:
+ throw new DevRev.ServiceUnavailableError(
+ serializers.ErrorServiceUnavailable.parseOrThrow(_response.error.body, {
+ unrecognizedObjectKeys: "passthrough",
+ allowUnrecognizedUnionMembers: true,
+ allowUnrecognizedEnumValues: true,
+ skipValidation: true,
+ breadcrumbsPrefix: ["response"],
+ })
+ );
+ default:
+ throw new errors.DevRevError({
+ statusCode: _response.error.statusCode,
+ body: _response.error.body,
+ });
+ }
+ }
+
+ switch (_response.error.reason) {
+ case "non-json":
+ throw new errors.DevRevError({
+ statusCode: _response.error.statusCode,
+ body: _response.error.rawBody,
+ });
+ case "timeout":
+ throw new errors.DevRevTimeoutError();
+ case "unknown":
+ throw new errors.DevRevError({
+ message: _response.error.errorMessage,
+ });
+ }
+ }
+
+ /**
+ * Creates or updates a custom schema fragment.
+ *
+ * @param {DevRev.CustomSchemaFragmentsSetRequest} request
+ * @param {Customization.RequestOptions} requestOptions - Request-specific configuration.
+ *
+ * @throws {@link DevRev.BadRequestError}
+ * @throws {@link DevRev.UnauthorizedError}
+ * @throws {@link DevRev.ForbiddenError}
+ * @throws {@link DevRev.TooManyRequestsError}
+ * @throws {@link DevRev.InternalServerError}
+ * @throws {@link DevRev.ServiceUnavailableError}
+ *
+ * @example
+ * await client.customization.customSchemaFragmentsSet({
+ * type: "app_fragment",
+ * conditions: [{
+ * "string": {
+ * "key": "value"
+ * }
+ * }],
+ * deletedFields: ["string"],
+ * deprecated: true,
+ * description: "string",
+ * fields: [{
+ * fieldType: "array",
+ * value: {
+ * "key": "value"
+ * }
+ * }],
+ * isCustomLeafType: true,
+ * leafType: "string",
+ * app: "string"
+ * })
+ */
+ public async customSchemaFragmentsSet(
+ request: DevRev.CustomSchemaFragmentsSetRequest,
+ requestOptions?: Customization.RequestOptions
+ ): Promise {
+ const _response = await (this._options.fetcher ?? core.fetcher)({
+ url: urlJoin(
+ (await core.Supplier.get(this._options.environment)) ?? environments.DevRevEnvironment.Default,
+ "schemas.custom.set"
+ ),
+ method: "POST",
+ headers: {
+ Authorization: await this._getAuthorizationHeader(),
+ "X-Fern-Language": "JavaScript",
+ "X-Fern-SDK-Name": "@devrev/api",
+ "X-Fern-SDK-Version": "0.0.14",
+ "X-Fern-Runtime": core.RUNTIME.type,
+ "X-Fern-Runtime-Version": core.RUNTIME.version,
+ },
+ contentType: "application/json",
+ requestType: "json",
+ body: serializers.CustomSchemaFragmentsSetRequest.jsonOrThrow(request, { unrecognizedObjectKeys: "strip" }),
+ timeoutMs: requestOptions?.timeoutInSeconds != null ? requestOptions.timeoutInSeconds * 1000 : 60000,
+ maxRetries: requestOptions?.maxRetries,
+ abortSignal: requestOptions?.abortSignal,
+ });
+ if (_response.ok) {
+ return serializers.CustomSchemaFragmentsSetResponse.parseOrThrow(_response.body, {
+ unrecognizedObjectKeys: "passthrough",
+ allowUnrecognizedUnionMembers: true,
+ allowUnrecognizedEnumValues: true,
+ skipValidation: true,
+ breadcrumbsPrefix: ["response"],
+ });
+ }
+
+ if (_response.error.reason === "status-code") {
+ switch (_response.error.statusCode) {
+ case 400:
+ throw new DevRev.BadRequestError(
+ serializers.ErrorBadRequest.parseOrThrow(_response.error.body, {
+ unrecognizedObjectKeys: "passthrough",
+ allowUnrecognizedUnionMembers: true,
+ allowUnrecognizedEnumValues: true,
+ skipValidation: true,
+ breadcrumbsPrefix: ["response"],
+ })
+ );
+ case 401:
+ throw new DevRev.UnauthorizedError(
+ serializers.ErrorUnauthorized.parseOrThrow(_response.error.body, {
+ unrecognizedObjectKeys: "passthrough",
+ allowUnrecognizedUnionMembers: true,
+ allowUnrecognizedEnumValues: true,
+ skipValidation: true,
+ breadcrumbsPrefix: ["response"],
+ })
+ );
+ case 403:
+ throw new DevRev.ForbiddenError(
+ serializers.ErrorForbidden.parseOrThrow(_response.error.body, {
+ unrecognizedObjectKeys: "passthrough",
+ allowUnrecognizedUnionMembers: true,
+ allowUnrecognizedEnumValues: true,
+ skipValidation: true,
+ breadcrumbsPrefix: ["response"],
+ })
+ );
+ case 429:
+ throw new DevRev.TooManyRequestsError(
+ serializers.ErrorTooManyRequests.parseOrThrow(_response.error.body, {
+ unrecognizedObjectKeys: "passthrough",
+ allowUnrecognizedUnionMembers: true,
+ allowUnrecognizedEnumValues: true,
+ skipValidation: true,
+ breadcrumbsPrefix: ["response"],
+ })
+ );
+ case 500:
+ throw new DevRev.InternalServerError(
+ serializers.ErrorInternalServerError.parseOrThrow(_response.error.body, {
+ unrecognizedObjectKeys: "passthrough",
+ allowUnrecognizedUnionMembers: true,
+ allowUnrecognizedEnumValues: true,
+ skipValidation: true,
+ breadcrumbsPrefix: ["response"],
+ })
+ );
+ case 503:
+ throw new DevRev.ServiceUnavailableError(
+ serializers.ErrorServiceUnavailable.parseOrThrow(_response.error.body, {
+ unrecognizedObjectKeys: "passthrough",
+ allowUnrecognizedUnionMembers: true,
+ allowUnrecognizedEnumValues: true,
+ skipValidation: true,
+ breadcrumbsPrefix: ["response"],
+ })
+ );
+ default:
+ throw new errors.DevRevError({
+ statusCode: _response.error.statusCode,
+ body: _response.error.body,
+ });
+ }
+ }
+
+ switch (_response.error.reason) {
+ case "non-json":
+ throw new errors.DevRevError({
+ statusCode: _response.error.statusCode,
+ body: _response.error.rawBody,
+ });
+ case "timeout":
+ throw new errors.DevRevTimeoutError();
+ case "unknown":
+ throw new errors.DevRevError({
+ message: _response.error.errorMessage,
+ });
+ }
+ }
+
+ /**
+ * Gets a stock schema fragment.
+ *
+ * @param {DevRev.StockSchemaFragmentsGetQuery} request
+ * @param {Customization.RequestOptions} requestOptions - Request-specific configuration.
+ *
+ * @throws {@link DevRev.BadRequestError}
+ * @throws {@link DevRev.UnauthorizedError}
+ * @throws {@link DevRev.ForbiddenError}
+ * @throws {@link DevRev.NotFoundError}
+ * @throws {@link DevRev.TooManyRequestsError}
+ * @throws {@link DevRev.InternalServerError}
+ * @throws {@link DevRev.ServiceUnavailableError}
+ *
+ * @example
+ * await client.customization.stockSchemaFragmentsGet()
+ */
+ public async stockSchemaFragmentsGet(
+ request: DevRev.StockSchemaFragmentsGetQuery = {},
+ requestOptions?: Customization.RequestOptions
+ ): Promise {
+ const { id, leafType } = request;
+ const _queryParams: Record = {};
+ if (id != null) {
+ _queryParams["id"] = id;
+ }
+
+ if (leafType != null) {
+ _queryParams["leaf_type"] = leafType;
+ }
+
+ const _response = await (this._options.fetcher ?? core.fetcher)({
+ url: urlJoin(
+ (await core.Supplier.get(this._options.environment)) ?? environments.DevRevEnvironment.Default,
+ "schemas.stock.get"
+ ),
+ method: "GET",
+ headers: {
+ Authorization: await this._getAuthorizationHeader(),
+ "X-Fern-Language": "JavaScript",
+ "X-Fern-SDK-Name": "@devrev/api",
+ "X-Fern-SDK-Version": "0.0.14",
+ "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 serializers.StockSchemaFragmentsGetResponse.parseOrThrow(_response.body, {
+ unrecognizedObjectKeys: "passthrough",
+ allowUnrecognizedUnionMembers: true,
+ allowUnrecognizedEnumValues: true,
+ skipValidation: true,
+ breadcrumbsPrefix: ["response"],
+ });
+ }
+
+ if (_response.error.reason === "status-code") {
+ switch (_response.error.statusCode) {
+ case 400:
+ throw new DevRev.BadRequestError(
+ serializers.ErrorBadRequest.parseOrThrow(_response.error.body, {
+ unrecognizedObjectKeys: "passthrough",
+ allowUnrecognizedUnionMembers: true,
+ allowUnrecognizedEnumValues: true,
+ skipValidation: true,
+ breadcrumbsPrefix: ["response"],
+ })
+ );
+ case 401:
+ throw new DevRev.UnauthorizedError(
+ serializers.ErrorUnauthorized.parseOrThrow(_response.error.body, {
+ unrecognizedObjectKeys: "passthrough",
+ allowUnrecognizedUnionMembers: true,
+ allowUnrecognizedEnumValues: true,
+ skipValidation: true,
+ breadcrumbsPrefix: ["response"],
+ })
+ );
+ case 403:
+ throw new DevRev.ForbiddenError(
+ serializers.ErrorForbidden.parseOrThrow(_response.error.body, {
+ unrecognizedObjectKeys: "passthrough",
+ allowUnrecognizedUnionMembers: true,
+ allowUnrecognizedEnumValues: true,
+ skipValidation: true,
+ breadcrumbsPrefix: ["response"],
+ })
+ );
+ case 404:
+ throw new DevRev.NotFoundError(
+ serializers.ErrorNotFound.parseOrThrow(_response.error.body, {
+ unrecognizedObjectKeys: "passthrough",
+ allowUnrecognizedUnionMembers: true,
+ allowUnrecognizedEnumValues: true,
+ skipValidation: true,
+ breadcrumbsPrefix: ["response"],
+ })
+ );
+ case 429:
+ throw new DevRev.TooManyRequestsError(
+ serializers.ErrorTooManyRequests.parseOrThrow(_response.error.body, {
+ unrecognizedObjectKeys: "passthrough",
+ allowUnrecognizedUnionMembers: true,
+ allowUnrecognizedEnumValues: true,
+ skipValidation: true,
+ breadcrumbsPrefix: ["response"],
+ })
+ );
+ case 500:
+ throw new DevRev.InternalServerError(
+ serializers.ErrorInternalServerError.parseOrThrow(_response.error.body, {
+ unrecognizedObjectKeys: "passthrough",
+ allowUnrecognizedUnionMembers: true,
+ allowUnrecognizedEnumValues: true,
+ skipValidation: true,
+ breadcrumbsPrefix: ["response"],
+ })
+ );
+ case 503:
+ throw new DevRev.ServiceUnavailableError(
+ serializers.ErrorServiceUnavailable.parseOrThrow(_response.error.body, {
+ unrecognizedObjectKeys: "passthrough",
+ allowUnrecognizedUnionMembers: true,
+ allowUnrecognizedEnumValues: true,
+ skipValidation: true,
+ breadcrumbsPrefix: ["response"],
+ })
+ );
+ default:
+ throw new errors.DevRevError({
+ statusCode: _response.error.statusCode,
+ body: _response.error.body,
+ });
+ }
+ }
+
+ switch (_response.error.reason) {
+ case "non-json":
+ throw new errors.DevRevError({
+ statusCode: _response.error.statusCode,
+ body: _response.error.rawBody,
+ });
+ case "timeout":
+ throw new errors.DevRevTimeoutError();
+ case "unknown":
+ throw new errors.DevRevError({
+ message: _response.error.errorMessage,
+ });
+ }
+ }
+
+ /**
+ * Gets a stock schema fragment.
+ *
+ * @param {DevRev.StockSchemaFragmentsGetRequest} request
+ * @param {Customization.RequestOptions} requestOptions - Request-specific configuration.
+ *
+ * @throws {@link DevRev.BadRequestError}
+ * @throws {@link DevRev.UnauthorizedError}
+ * @throws {@link DevRev.ForbiddenError}
+ * @throws {@link DevRev.NotFoundError}
+ * @throws {@link DevRev.TooManyRequestsError}
+ * @throws {@link DevRev.InternalServerError}
+ * @throws {@link DevRev.ServiceUnavailableError}
+ *
+ * @example
+ * await client.customization.stockSchemaFragmentsGetPost()
+ */
+ public async stockSchemaFragmentsGetPost(
+ request: DevRev.StockSchemaFragmentsGetRequest = {},
+ requestOptions?: Customization.RequestOptions
+ ): Promise {
+ const _response = await (this._options.fetcher ?? core.fetcher)({
+ url: urlJoin(
+ (await core.Supplier.get(this._options.environment)) ?? environments.DevRevEnvironment.Default,
+ "schemas.stock.get"
+ ),
+ method: "POST",
+ headers: {
+ Authorization: await this._getAuthorizationHeader(),
+ "X-Fern-Language": "JavaScript",
+ "X-Fern-SDK-Name": "@devrev/api",
+ "X-Fern-SDK-Version": "0.0.14",
+ "X-Fern-Runtime": core.RUNTIME.type,
+ "X-Fern-Runtime-Version": core.RUNTIME.version,
+ },
+ contentType: "application/json",
+ requestType: "json",
+ body: serializers.StockSchemaFragmentsGetRequest.jsonOrThrow(request, { unrecognizedObjectKeys: "strip" }),
+ timeoutMs: requestOptions?.timeoutInSeconds != null ? requestOptions.timeoutInSeconds * 1000 : 60000,
+ maxRetries: requestOptions?.maxRetries,
+ abortSignal: requestOptions?.abortSignal,
+ });
+ if (_response.ok) {
+ return serializers.StockSchemaFragmentsGetResponse.parseOrThrow(_response.body, {
+ unrecognizedObjectKeys: "passthrough",
+ allowUnrecognizedUnionMembers: true,
+ allowUnrecognizedEnumValues: true,
+ skipValidation: true,
+ breadcrumbsPrefix: ["response"],
+ });
+ }
+
+ if (_response.error.reason === "status-code") {
+ switch (_response.error.statusCode) {
+ case 400:
+ throw new DevRev.BadRequestError(
+ serializers.ErrorBadRequest.parseOrThrow(_response.error.body, {
+ unrecognizedObjectKeys: "passthrough",
+ allowUnrecognizedUnionMembers: true,
+ allowUnrecognizedEnumValues: true,
+ skipValidation: true,
+ breadcrumbsPrefix: ["response"],
+ })
+ );
+ case 401:
+ throw new DevRev.UnauthorizedError(
+ serializers.ErrorUnauthorized.parseOrThrow(_response.error.body, {
+ unrecognizedObjectKeys: "passthrough",
+ allowUnrecognizedUnionMembers: true,
+ allowUnrecognizedEnumValues: true,
+ skipValidation: true,
+ breadcrumbsPrefix: ["response"],
+ })
+ );
+ case 403:
+ throw new DevRev.ForbiddenError(
+ serializers.ErrorForbidden.parseOrThrow(_response.error.body, {
+ unrecognizedObjectKeys: "passthrough",
+ allowUnrecognizedUnionMembers: true,
+ allowUnrecognizedEnumValues: true,
+ skipValidation: true,
+ breadcrumbsPrefix: ["response"],
+ })
+ );
+ case 404:
+ throw new DevRev.NotFoundError(
+ serializers.ErrorNotFound.parseOrThrow(_response.error.body, {
+ unrecognizedObjectKeys: "passthrough",
+ allowUnrecognizedUnionMembers: true,
+ allowUnrecognizedEnumValues: true,
+ skipValidation: true,
+ breadcrumbsPrefix: ["response"],
+ })
+ );
+ case 429:
+ throw new DevRev.TooManyRequestsError(
+ serializers.ErrorTooManyRequests.parseOrThrow(_response.error.body, {
+ unrecognizedObjectKeys: "passthrough",
+ allowUnrecognizedUnionMembers: true,
+ allowUnrecognizedEnumValues: true,
+ skipValidation: true,
+ breadcrumbsPrefix: ["response"],
+ })
+ );
+ case 500:
+ throw new DevRev.InternalServerError(
+ serializers.ErrorInternalServerError.parseOrThrow(_response.error.body, {
+ unrecognizedObjectKeys: "passthrough",
+ allowUnrecognizedUnionMembers: true,
+ allowUnrecognizedEnumValues: true,
+ skipValidation: true,
+ breadcrumbsPrefix: ["response"],
+ })
+ );
+ case 503:
+ throw new DevRev.ServiceUnavailableError(
+ serializers.ErrorServiceUnavailable.parseOrThrow(_response.error.body, {
+ unrecognizedObjectKeys: "passthrough",
+ allowUnrecognizedUnionMembers: true,
+ allowUnrecognizedEnumValues: true,
+ skipValidation: true,
+ breadcrumbsPrefix: ["response"],
+ })
+ );
+ default:
+ throw new errors.DevRevError({
+ statusCode: _response.error.statusCode,
+ body: _response.error.body,
+ });
+ }
+ }
+
+ switch (_response.error.reason) {
+ case "non-json":
+ throw new errors.DevRevError({
+ statusCode: _response.error.statusCode,
+ body: _response.error.rawBody,
+ });
+ case "timeout":
+ throw new errors.DevRevTimeoutError();
+ case "unknown":
+ throw new errors.DevRevError({
+ message: _response.error.errorMessage,
+ });
+ }
+ }
+
+ /**
+ * Lists stock schema fragments.
+ *
+ * @param {DevRev.StockSchemaFragmentsListQuery} request
+ * @param {Customization.RequestOptions} requestOptions - Request-specific configuration.
+ *
+ * @throws {@link DevRev.BadRequestError}
+ * @throws {@link DevRev.UnauthorizedError}
+ * @throws {@link DevRev.ForbiddenError}
+ * @throws {@link DevRev.TooManyRequestsError}
+ * @throws {@link DevRev.InternalServerError}
+ * @throws {@link DevRev.ServiceUnavailableError}
+ *
+ * @example
+ * await client.customization.stockSchemaFragmentsList()
+ */
+ public async stockSchemaFragmentsList(
+ request: DevRev.StockSchemaFragmentsListQuery = {},
+ requestOptions?: Customization.RequestOptions
+ ): Promise {
+ const { cursor, filterPreset, leafType, limit, mode, prune, sortBy } = request;
+ const _queryParams: Record = {};
+ if (cursor != null) {
+ _queryParams["cursor"] = cursor;
+ }
+
+ if (filterPreset != null) {
+ _queryParams["filter_preset"] = filterPreset;
+ }
+
+ if (leafType != null) {
+ if (Array.isArray(leafType)) {
+ _queryParams["leaf_type"] = leafType.map((item) => item);
+ } else {
+ _queryParams["leaf_type"] = leafType;
+ }
+ }
+
+ if (limit != null) {
+ _queryParams["limit"] = limit.toString();
+ }
+
+ if (mode != null) {
+ _queryParams["mode"] = mode;
+ }
+
+ if (prune != null) {
+ if (Array.isArray(prune)) {
+ _queryParams["prune"] = prune.map((item) => item);
+ } else {
+ _queryParams["prune"] = prune;
+ }
+ }
+
+ if (sortBy != null) {
+ if (Array.isArray(sortBy)) {
+ _queryParams["sort_by"] = sortBy.map((item) => item);
+ } else {
+ _queryParams["sort_by"] = sortBy;
+ }
+ }
+
+ const _response = await (this._options.fetcher ?? core.fetcher)({
+ url: urlJoin(
+ (await core.Supplier.get(this._options.environment)) ?? environments.DevRevEnvironment.Default,
+ "schemas.stock.list"
+ ),
+ method: "GET",
+ headers: {
+ Authorization: await this._getAuthorizationHeader(),
+ "X-Fern-Language": "JavaScript",
+ "X-Fern-SDK-Name": "@devrev/api",
+ "X-Fern-SDK-Version": "0.0.14",
+ "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 serializers.StockSchemaFragmentsListResponse.parseOrThrow(_response.body, {
+ unrecognizedObjectKeys: "passthrough",
+ allowUnrecognizedUnionMembers: true,
+ allowUnrecognizedEnumValues: true,
+ skipValidation: true,
+ breadcrumbsPrefix: ["response"],
+ });
+ }
+
+ if (_response.error.reason === "status-code") {
+ switch (_response.error.statusCode) {
+ case 400:
+ throw new DevRev.BadRequestError(
+ serializers.ErrorBadRequest.parseOrThrow(_response.error.body, {
+ unrecognizedObjectKeys: "passthrough",
+ allowUnrecognizedUnionMembers: true,
+ allowUnrecognizedEnumValues: true,
+ skipValidation: true,
+ breadcrumbsPrefix: ["response"],
+ })
+ );
+ case 401:
+ throw new DevRev.UnauthorizedError(
+ serializers.ErrorUnauthorized.parseOrThrow(_response.error.body, {
+ unrecognizedObjectKeys: "passthrough",
+ allowUnrecognizedUnionMembers: true,
+ allowUnrecognizedEnumValues: true,
+ skipValidation: true,
+ breadcrumbsPrefix: ["response"],
+ })
+ );
+ case 403:
+ throw new DevRev.ForbiddenError(
+ serializers.ErrorForbidden.parseOrThrow(_response.error.body, {
+ unrecognizedObjectKeys: "passthrough",
+ allowUnrecognizedUnionMembers: true,
+ allowUnrecognizedEnumValues: true,
+ skipValidation: true,
+ breadcrumbsPrefix: ["response"],
+ })
+ );
+ case 429:
+ throw new DevRev.TooManyRequestsError(
+ serializers.ErrorTooManyRequests.parseOrThrow(_response.error.body, {
+ unrecognizedObjectKeys: "passthrough",
+ allowUnrecognizedUnionMembers: true,
+ allowUnrecognizedEnumValues: true,
+ skipValidation: true,
+ breadcrumbsPrefix: ["response"],
+ })
+ );
+ case 500:
+ throw new DevRev.InternalServerError(
+ serializers.ErrorInternalServerError.parseOrThrow(_response.error.body, {
+ unrecognizedObjectKeys: "passthrough",
+ allowUnrecognizedUnionMembers: true,
+ allowUnrecognizedEnumValues: true,
+ skipValidation: true,
+ breadcrumbsPrefix: ["response"],
+ })
+ );
+ case 503:
+ throw new DevRev.ServiceUnavailableError(
+ serializers.ErrorServiceUnavailable.parseOrThrow(_response.error.body, {
+ unrecognizedObjectKeys: "passthrough",
+ allowUnrecognizedUnionMembers: true,
+ allowUnrecognizedEnumValues: true,
+ skipValidation: true,
+ breadcrumbsPrefix: ["response"],
+ })
+ );
+ default:
+ throw new errors.DevRevError({
+ statusCode: _response.error.statusCode,
+ body: _response.error.body,
+ });
+ }
+ }
+
+ switch (_response.error.reason) {
+ case "non-json":
+ throw new errors.DevRevError({
+ statusCode: _response.error.statusCode,
+ body: _response.error.rawBody,
+ });
+ case "timeout":
+ throw new errors.DevRevTimeoutError();
+ case "unknown":
+ throw new errors.DevRevError({
+ message: _response.error.errorMessage,
+ });
+ }
+ }
+
+ /**
+ * Lists stock schema fragments.
+ *
+ * @param {DevRev.StockSchemaFragmentsListRequest} request
+ * @param {Customization.RequestOptions} requestOptions - Request-specific configuration.
+ *
+ * @throws {@link DevRev.BadRequestError}
+ * @throws {@link DevRev.UnauthorizedError}
+ * @throws {@link DevRev.ForbiddenError}
+ * @throws {@link DevRev.TooManyRequestsError}
+ * @throws {@link DevRev.InternalServerError}
+ * @throws {@link DevRev.ServiceUnavailableError}
+ *
+ * @example
+ * await client.customization.stockSchemaFragmentsListPost()
+ */
+ public async stockSchemaFragmentsListPost(
+ request: DevRev.StockSchemaFragmentsListRequest = {},
+ requestOptions?: Customization.RequestOptions
+ ): Promise {
+ const _response = await (this._options.fetcher ?? core.fetcher)({
+ url: urlJoin(
+ (await core.Supplier.get(this._options.environment)) ?? environments.DevRevEnvironment.Default,
+ "schemas.stock.list"
+ ),
+ method: "POST",
+ headers: {
+ Authorization: await this._getAuthorizationHeader(),
+ "X-Fern-Language": "JavaScript",
+ "X-Fern-SDK-Name": "@devrev/api",
+ "X-Fern-SDK-Version": "0.0.14",
+ "X-Fern-Runtime": core.RUNTIME.type,
+ "X-Fern-Runtime-Version": core.RUNTIME.version,
+ },
+ contentType: "application/json",
+ requestType: "json",
+ body: serializers.StockSchemaFragmentsListRequest.jsonOrThrow(request, { unrecognizedObjectKeys: "strip" }),
+ timeoutMs: requestOptions?.timeoutInSeconds != null ? requestOptions.timeoutInSeconds * 1000 : 60000,
+ maxRetries: requestOptions?.maxRetries,
+ abortSignal: requestOptions?.abortSignal,
+ });
+ if (_response.ok) {
+ return serializers.StockSchemaFragmentsListResponse.parseOrThrow(_response.body, {
+ unrecognizedObjectKeys: "passthrough",
+ allowUnrecognizedUnionMembers: true,
+ allowUnrecognizedEnumValues: true,
+ skipValidation: true,
+ breadcrumbsPrefix: ["response"],
+ });
+ }
+
+ if (_response.error.reason === "status-code") {
+ switch (_response.error.statusCode) {
+ case 400:
+ throw new DevRev.BadRequestError(
+ serializers.ErrorBadRequest.parseOrThrow(_response.error.body, {
+ unrecognizedObjectKeys: "passthrough",
+ allowUnrecognizedUnionMembers: true,
+ allowUnrecognizedEnumValues: true,
+ skipValidation: true,
+ breadcrumbsPrefix: ["response"],
+ })
+ );
+ case 401:
+ throw new DevRev.UnauthorizedError(
+ serializers.ErrorUnauthorized.parseOrThrow(_response.error.body, {
+ unrecognizedObjectKeys: "passthrough",
+ allowUnrecognizedUnionMembers: true,
+ allowUnrecognizedEnumValues: true,
+ skipValidation: true,
+ breadcrumbsPrefix: ["response"],
+ })
+ );
+ case 403:
+ throw new DevRev.ForbiddenError(
+ serializers.ErrorForbidden.parseOrThrow(_response.error.body, {
+ unrecognizedObjectKeys: "passthrough",
+ allowUnrecognizedUnionMembers: true,
+ allowUnrecognizedEnumValues: true,
+ skipValidation: true,
+ breadcrumbsPrefix: ["response"],
+ })
+ );
+ case 429:
+ throw new DevRev.TooManyRequestsError(
+ serializers.ErrorTooManyRequests.parseOrThrow(_response.error.body, {
+ unrecognizedObjectKeys: "passthrough",
+ allowUnrecognizedUnionMembers: true,
+ allowUnrecognizedEnumValues: true,
+ skipValidation: true,
+ breadcrumbsPrefix: ["response"],
+ })
+ );
+ case 500:
+ throw new DevRev.InternalServerError(
+ serializers.ErrorInternalServerError.parseOrThrow(_response.error.body, {
+ unrecognizedObjectKeys: "passthrough",
+ allowUnrecognizedUnionMembers: true,
+ allowUnrecognizedEnumValues: true,
+ skipValidation: true,
+ breadcrumbsPrefix: ["response"],
+ })
+ );
+ case 503:
+ throw new DevRev.ServiceUnavailableError(
+ serializers.ErrorServiceUnavailable.parseOrThrow(_response.error.body, {
+ unrecognizedObjectKeys: "passthrough",
+ allowUnrecognizedUnionMembers: true,
+ allowUnrecognizedEnumValues: true,
+ skipValidation: true,
+ breadcrumbsPrefix: ["response"],
+ })
+ );
+ default:
+ throw new errors.DevRevError({
+ statusCode: _response.error.statusCode,
+ body: _response.error.body,
+ });
+ }
+ }
+
+ switch (_response.error.reason) {
+ case "non-json":
+ throw new errors.DevRevError({
+ statusCode: _response.error.statusCode,
+ body: _response.error.rawBody,
+ });
+ case "timeout":
+ throw new errors.DevRevTimeoutError();
+ case "unknown":
+ throw new errors.DevRevError({
+ message: _response.error.errorMessage,
+ });
+ }
+ }
+
+ /**
+ * Lists subtypes.
+ *
+ * @param {DevRev.SubtypesListQuery} request
+ * @param {Customization.RequestOptions} requestOptions - Request-specific configuration.
+ *
+ * @throws {@link DevRev.BadRequestError}
+ * @throws {@link DevRev.UnauthorizedError}
+ * @throws {@link DevRev.ForbiddenError}
+ * @throws {@link DevRev.TooManyRequestsError}
+ * @throws {@link DevRev.InternalServerError}
+ * @throws {@link DevRev.ServiceUnavailableError}
+ *
+ * @example
+ * await client.customization.subtypesList()
+ */
+ public async subtypesList(
+ request: DevRev.SubtypesListQuery = {},
+ requestOptions?: Customization.RequestOptions
+ ): Promise {
+ const { leafType, leafTypes } = request;
+ const _queryParams: Record = {};
+ if (leafType != null) {
+ _queryParams["leaf_type"] = leafType;
+ }
+
+ if (leafTypes != null) {
+ if (Array.isArray(leafTypes)) {
+ _queryParams["leaf_types"] = leafTypes.map((item) => item);
+ } else {
+ _queryParams["leaf_types"] = leafTypes;
+ }
+ }
+
+ const _response = await (this._options.fetcher ?? core.fetcher)({
+ url: urlJoin(
+ (await core.Supplier.get(this._options.environment)) ?? environments.DevRevEnvironment.Default,
+ "schemas.subtypes.list"
+ ),
+ method: "GET",
+ headers: {
+ Authorization: await this._getAuthorizationHeader(),
+ "X-Fern-Language": "JavaScript",
+ "X-Fern-SDK-Name": "@devrev/api",
+ "X-Fern-SDK-Version": "0.0.14",
+ "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 serializers.SubtypesListResponse.parseOrThrow(_response.body, {
+ unrecognizedObjectKeys: "passthrough",
+ allowUnrecognizedUnionMembers: true,
+ allowUnrecognizedEnumValues: true,
+ skipValidation: true,
+ breadcrumbsPrefix: ["response"],
+ });
+ }
+
+ if (_response.error.reason === "status-code") {
+ switch (_response.error.statusCode) {
+ case 400:
+ throw new DevRev.BadRequestError(
+ serializers.ErrorBadRequest.parseOrThrow(_response.error.body, {
+ unrecognizedObjectKeys: "passthrough",
+ allowUnrecognizedUnionMembers: true,
+ allowUnrecognizedEnumValues: true,
+ skipValidation: true,
+ breadcrumbsPrefix: ["response"],
+ })
+ );
+ case 401:
+ throw new DevRev.UnauthorizedError(
+ serializers.ErrorUnauthorized.parseOrThrow(_response.error.body, {
+ unrecognizedObjectKeys: "passthrough",
+ allowUnrecognizedUnionMembers: true,
+ allowUnrecognizedEnumValues: true,
+ skipValidation: true,
+ breadcrumbsPrefix: ["response"],
+ })
+ );
+ case 403:
+ throw new DevRev.ForbiddenError(
+ serializers.ErrorForbidden.parseOrThrow(_response.error.body, {
+ unrecognizedObjectKeys: "passthrough",
+ allowUnrecognizedUnionMembers: true,
+ allowUnrecognizedEnumValues: true,
+ skipValidation: true,
+ breadcrumbsPrefix: ["response"],
+ })
+ );
+ case 429:
+ throw new DevRev.TooManyRequestsError(
+ serializers.ErrorTooManyRequests.parseOrThrow(_response.error.body, {
+ unrecognizedObjectKeys: "passthrough",
+ allowUnrecognizedUnionMembers: true,
+ allowUnrecognizedEnumValues: true,
+ skipValidation: true,
+ breadcrumbsPrefix: ["response"],
+ })
+ );
+ case 500:
+ throw new DevRev.InternalServerError(
+ serializers.ErrorInternalServerError.parseOrThrow(_response.error.body, {
+ unrecognizedObjectKeys: "passthrough",
+ allowUnrecognizedUnionMembers: true,
+ allowUnrecognizedEnumValues: true,
+ skipValidation: true,
+ breadcrumbsPrefix: ["response"],
+ })
+ );
+ case 503:
+ throw new DevRev.ServiceUnavailableError(
+ serializers.ErrorServiceUnavailable.parseOrThrow(_response.error.body, {
+ unrecognizedObjectKeys: "passthrough",
+ allowUnrecognizedUnionMembers: true,
+ allowUnrecognizedEnumValues: true,
+ skipValidation: true,
+ breadcrumbsPrefix: ["response"],
+ })
+ );
+ default:
+ throw new errors.DevRevError({
+ statusCode: _response.error.statusCode,
+ body: _response.error.body,
+ });
+ }
+ }
+
+ switch (_response.error.reason) {
+ case "non-json":
+ throw new errors.DevRevError({
+ statusCode: _response.error.statusCode,
+ body: _response.error.rawBody,
+ });
+ case "timeout":
+ throw new errors.DevRevTimeoutError();
+ case "unknown":
+ throw new errors.DevRevError({
+ message: _response.error.errorMessage,
+ });
+ }
+ }
+
+ /**
+ * Lists subtypes.
+ *
+ * @param {DevRev.SubtypesListRequest} request
+ * @param {Customization.RequestOptions} requestOptions - Request-specific configuration.
+ *
+ * @throws {@link DevRev.BadRequestError}
+ * @throws {@link DevRev.UnauthorizedError}
+ * @throws {@link DevRev.ForbiddenError}
+ * @throws {@link DevRev.TooManyRequestsError}
+ * @throws {@link DevRev.InternalServerError}
+ * @throws {@link DevRev.ServiceUnavailableError}
+ *
+ * @example
+ * await client.customization.subtypesListPost()
+ */
+ public async subtypesListPost(
+ request: DevRev.SubtypesListRequest = {},
+ requestOptions?: Customization.RequestOptions
+ ): Promise {
+ const _response = await (this._options.fetcher ?? core.fetcher)({
+ url: urlJoin(
+ (await core.Supplier.get(this._options.environment)) ?? environments.DevRevEnvironment.Default,
+ "schemas.subtypes.list"
+ ),
+ method: "POST",
+ headers: {
+ Authorization: await this._getAuthorizationHeader(),
+ "X-Fern-Language": "JavaScript",
+ "X-Fern-SDK-Name": "@devrev/api",
+ "X-Fern-SDK-Version": "0.0.14",
+ "X-Fern-Runtime": core.RUNTIME.type,
+ "X-Fern-Runtime-Version": core.RUNTIME.version,
+ },
+ contentType: "application/json",
+ requestType: "json",
+ body: serializers.SubtypesListRequest.jsonOrThrow(request, { unrecognizedObjectKeys: "strip" }),
+ timeoutMs: requestOptions?.timeoutInSeconds != null ? requestOptions.timeoutInSeconds * 1000 : 60000,
+ maxRetries: requestOptions?.maxRetries,
+ abortSignal: requestOptions?.abortSignal,
+ });
+ if (_response.ok) {
+ return serializers.SubtypesListResponse.parseOrThrow(_response.body, {
+ unrecognizedObjectKeys: "passthrough",
+ allowUnrecognizedUnionMembers: true,
+ allowUnrecognizedEnumValues: true,
+ skipValidation: true,
+ breadcrumbsPrefix: ["response"],
+ });
+ }
+
+ if (_response.error.reason === "status-code") {
+ switch (_response.error.statusCode) {
+ case 400:
+ throw new DevRev.BadRequestError(
+ serializers.ErrorBadRequest.parseOrThrow(_response.error.body, {
+ unrecognizedObjectKeys: "passthrough",
+ allowUnrecognizedUnionMembers: true,
+ allowUnrecognizedEnumValues: true,
+ skipValidation: true,
+ breadcrumbsPrefix: ["response"],
+ })
+ );
+ case 401:
+ throw new DevRev.UnauthorizedError(
+ serializers.ErrorUnauthorized.parseOrThrow(_response.error.body, {
+ unrecognizedObjectKeys: "passthrough",
+ allowUnrecognizedUnionMembers: true,
+ allowUnrecognizedEnumValues: true,
+ skipValidation: true,
+ breadcrumbsPrefix: ["response"],
+ })
+ );
+ case 403:
+ throw new DevRev.ForbiddenError(
+ serializers.ErrorForbidden.parseOrThrow(_response.error.body, {
+ unrecognizedObjectKeys: "passthrough",
+ allowUnrecognizedUnionMembers: true,
+ allowUnrecognizedEnumValues: true,
+ skipValidation: true,
+ breadcrumbsPrefix: ["response"],
+ })
+ );
+ case 429:
+ throw new DevRev.TooManyRequestsError(
+ serializers.ErrorTooManyRequests.parseOrThrow(_response.error.body, {
+ unrecognizedObjectKeys: "passthrough",
+ allowUnrecognizedUnionMembers: true,
+ allowUnrecognizedEnumValues: true,
+ skipValidation: true,
+ breadcrumbsPrefix: ["response"],
+ })
+ );
+ case 500:
+ throw new DevRev.InternalServerError(
+ serializers.ErrorInternalServerError.parseOrThrow(_response.error.body, {
+ unrecognizedObjectKeys: "passthrough",
+ allowUnrecognizedUnionMembers: true,
+ allowUnrecognizedEnumValues: true,
+ skipValidation: true,
+ breadcrumbsPrefix: ["response"],
+ })
+ );
+ case 503:
+ throw new DevRev.ServiceUnavailableError(
+ serializers.ErrorServiceUnavailable.parseOrThrow(_response.error.body, {
+ unrecognizedObjectKeys: "passthrough",
+ allowUnrecognizedUnionMembers: true,
+ allowUnrecognizedEnumValues: true,
+ skipValidation: true,
+ breadcrumbsPrefix: ["response"],
+ })
+ );
+ default:
+ throw new errors.DevRevError({
+ statusCode: _response.error.statusCode,
+ body: _response.error.body,
+ });
+ }
+ }
+
+ switch (_response.error.reason) {
+ case "non-json":
+ throw new errors.DevRevError({
+ statusCode: _response.error.statusCode,
+ body: _response.error.rawBody,
+ });
+ case "timeout":
+ throw new errors.DevRevTimeoutError();
+ case "unknown":
+ throw new errors.DevRevError({
+ message: _response.error.errorMessage,
+ });
+ }
+ }
+
+ /**
+ * Creates a custom stage.
+ *
+ * @param {DevRev.CustomStagesCreateRequest} request
+ * @param {Customization.RequestOptions} requestOptions - Request-specific configuration.
+ *
+ * @throws {@link DevRev.BadRequestError}
+ * @throws {@link DevRev.UnauthorizedError}
+ * @throws {@link DevRev.ForbiddenError}
+ * @throws {@link DevRev.TooManyRequestsError}
+ * @throws {@link DevRev.InternalServerError}
+ * @throws {@link DevRev.ServiceUnavailableError}
+ *
+ * @example
+ * await client.customization.customStagesCreate({
+ * name: "name",
+ * ordinal: 1,
+ * state: "state"
+ * })
+ */
+ public async customStagesCreate(
+ request: DevRev.CustomStagesCreateRequest,
+ requestOptions?: Customization.RequestOptions
+ ): Promise {
+ const _response = await (this._options.fetcher ?? core.fetcher)({
+ url: urlJoin(
+ (await core.Supplier.get(this._options.environment)) ?? environments.DevRevEnvironment.Default,
+ "stages.custom.create"
+ ),
+ method: "POST",
+ headers: {
+ Authorization: await this._getAuthorizationHeader(),
+ "X-Fern-Language": "JavaScript",
+ "X-Fern-SDK-Name": "@devrev/api",
+ "X-Fern-SDK-Version": "0.0.14",
+ "X-Fern-Runtime": core.RUNTIME.type,
+ "X-Fern-Runtime-Version": core.RUNTIME.version,
+ },
+ contentType: "application/json",
+ requestType: "json",
+ body: serializers.CustomStagesCreateRequest.jsonOrThrow(request, { unrecognizedObjectKeys: "strip" }),
+ timeoutMs: requestOptions?.timeoutInSeconds != null ? requestOptions.timeoutInSeconds * 1000 : 60000,
+ maxRetries: requestOptions?.maxRetries,
+ abortSignal: requestOptions?.abortSignal,
+ });
+ if (_response.ok) {
+ return serializers.CustomStagesCreateResponse.parseOrThrow(_response.body, {
+ unrecognizedObjectKeys: "passthrough",
+ allowUnrecognizedUnionMembers: true,
+ allowUnrecognizedEnumValues: true,
+ skipValidation: true,
+ breadcrumbsPrefix: ["response"],
+ });
+ }
+
+ if (_response.error.reason === "status-code") {
+ switch (_response.error.statusCode) {
+ case 400:
+ throw new DevRev.BadRequestError(
+ serializers.ErrorBadRequest.parseOrThrow(_response.error.body, {
+ unrecognizedObjectKeys: "passthrough",
+ allowUnrecognizedUnionMembers: true,
+ allowUnrecognizedEnumValues: true,
+ skipValidation: true,
+ breadcrumbsPrefix: ["response"],
+ })
+ );
+ case 401:
+ throw new DevRev.UnauthorizedError(
+ serializers.ErrorUnauthorized.parseOrThrow(_response.error.body, {
+ unrecognizedObjectKeys: "passthrough",
+ allowUnrecognizedUnionMembers: true,
+ allowUnrecognizedEnumValues: true,
+ skipValidation: true,
+ breadcrumbsPrefix: ["response"],
+ })
+ );
+ case 403:
+ throw new DevRev.ForbiddenError(
+ serializers.ErrorForbidden.parseOrThrow(_response.error.body, {
+ unrecognizedObjectKeys: "passthrough",
+ allowUnrecognizedUnionMembers: true,
+ allowUnrecognizedEnumValues: true,
+ skipValidation: true,
+ breadcrumbsPrefix: ["response"],
+ })
+ );
+ case 429:
+ throw new DevRev.TooManyRequestsError(
+ serializers.ErrorTooManyRequests.parseOrThrow(_response.error.body, {
+ unrecognizedObjectKeys: "passthrough",
+ allowUnrecognizedUnionMembers: true,
+ allowUnrecognizedEnumValues: true,
+ skipValidation: true,
+ breadcrumbsPrefix: ["response"],
+ })
+ );
+ case 500:
+ throw new DevRev.InternalServerError(
+ serializers.ErrorInternalServerError.parseOrThrow(_response.error.body, {
+ unrecognizedObjectKeys: "passthrough",
+ allowUnrecognizedUnionMembers: true,
+ allowUnrecognizedEnumValues: true,
+ skipValidation: true,
+ breadcrumbsPrefix: ["response"],
+ })
+ );
+ case 503:
+ throw new DevRev.ServiceUnavailableError(
+ serializers.ErrorServiceUnavailable.parseOrThrow(_response.error.body, {
+ unrecognizedObjectKeys: "passthrough",
+ allowUnrecognizedUnionMembers: true,
+ allowUnrecognizedEnumValues: true,
+ skipValidation: true,
+ breadcrumbsPrefix: ["response"],
+ })
+ );
+ default:
+ throw new errors.DevRevError({
+ statusCode: _response.error.statusCode,
+ body: _response.error.body,
+ });
+ }
+ }
+
+ switch (_response.error.reason) {
+ case "non-json":
+ throw new errors.DevRevError({
+ statusCode: _response.error.statusCode,
+ body: _response.error.rawBody,
+ });
+ case "timeout":
+ throw new errors.DevRevTimeoutError();
+ case "unknown":
+ throw new errors.DevRevError({
+ message: _response.error.errorMessage,
+ });
+ }
+ }
+
+ /**
+ * Gets a custom stage.
+ *
+ * @param {DevRev.CustomStagesGetQuery} request
+ * @param {Customization.RequestOptions} requestOptions - Request-specific configuration.
+ *
+ * @throws {@link DevRev.BadRequestError}
+ * @throws {@link DevRev.UnauthorizedError}
+ * @throws {@link DevRev.ForbiddenError}
+ * @throws {@link DevRev.NotFoundError}
+ * @throws {@link DevRev.TooManyRequestsError}
+ * @throws {@link DevRev.InternalServerError}
+ * @throws {@link DevRev.ServiceUnavailableError}
+ *
+ * @example
+ * await client.customization.customStagesGet({
+ * id: "id"
+ * })
+ */
+ public async customStagesGet(
+ request: DevRev.CustomStagesGetQuery,
+ requestOptions?: Customization.RequestOptions
+ ): Promise {
+ const { id } = request;
+ const _queryParams: Record = {};
+ _queryParams["id"] = id;
+ const _response = await (this._options.fetcher ?? core.fetcher)({
+ url: urlJoin(
+ (await core.Supplier.get(this._options.environment)) ?? environments.DevRevEnvironment.Default,
+ "stages.custom.get"
+ ),
+ method: "GET",
+ headers: {
+ Authorization: await this._getAuthorizationHeader(),
+ "X-Fern-Language": "JavaScript",
+ "X-Fern-SDK-Name": "@devrev/api",
+ "X-Fern-SDK-Version": "0.0.14",
+ "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 serializers.CustomStagesGetResponse.parseOrThrow(_response.body, {
+ unrecognizedObjectKeys: "passthrough",
+ allowUnrecognizedUnionMembers: true,
+ allowUnrecognizedEnumValues: true,
+ skipValidation: true,
+ breadcrumbsPrefix: ["response"],
+ });
+ }
+
+ if (_response.error.reason === "status-code") {
+ switch (_response.error.statusCode) {
+ case 400:
+ throw new DevRev.BadRequestError(
+ serializers.ErrorBadRequest.parseOrThrow(_response.error.body, {
+ unrecognizedObjectKeys: "passthrough",
+ allowUnrecognizedUnionMembers: true,
+ allowUnrecognizedEnumValues: true,
+ skipValidation: true,
+ breadcrumbsPrefix: ["response"],
+ })
+ );
+ case 401:
+ throw new DevRev.UnauthorizedError(
+ serializers.ErrorUnauthorized.parseOrThrow(_response.error.body, {
+ unrecognizedObjectKeys: "passthrough",
+ allowUnrecognizedUnionMembers: true,
+ allowUnrecognizedEnumValues: true,
+ skipValidation: true,
+ breadcrumbsPrefix: ["response"],
+ })
+ );
+ case 403:
+ throw new DevRev.ForbiddenError(
+ serializers.ErrorForbidden.parseOrThrow(_response.error.body, {
+ unrecognizedObjectKeys: "passthrough",
+ allowUnrecognizedUnionMembers: true,
+ allowUnrecognizedEnumValues: true,
+ skipValidation: true,
+ breadcrumbsPrefix: ["response"],
+ })
+ );
+ case 404:
+ throw new DevRev.NotFoundError(
+ serializers.ErrorNotFound.parseOrThrow(_response.error.body, {
+ unrecognizedObjectKeys: "passthrough",
+ allowUnrecognizedUnionMembers: true,
+ allowUnrecognizedEnumValues: true,
+ skipValidation: true,
+ breadcrumbsPrefix: ["response"],
+ })
+ );
+ case 429:
+ throw new DevRev.TooManyRequestsError(
+ serializers.ErrorTooManyRequests.parseOrThrow(_response.error.body, {
+ unrecognizedObjectKeys: "passthrough",
+ allowUnrecognizedUnionMembers: true,
+ allowUnrecognizedEnumValues: true,
+ skipValidation: true,
+ breadcrumbsPrefix: ["response"],
+ })
+ );
+ case 500:
+ throw new DevRev.InternalServerError(
+ serializers.ErrorInternalServerError.parseOrThrow(_response.error.body, {
+ unrecognizedObjectKeys: "passthrough",
+ allowUnrecognizedUnionMembers: true,
+ allowUnrecognizedEnumValues: true,
+ skipValidation: true,
+ breadcrumbsPrefix: ["response"],
+ })
+ );
+ case 503:
+ throw new DevRev.ServiceUnavailableError(
+ serializers.ErrorServiceUnavailable.parseOrThrow(_response.error.body, {
+ unrecognizedObjectKeys: "passthrough",
+ allowUnrecognizedUnionMembers: true,
+ allowUnrecognizedEnumValues: true,
+ skipValidation: true,
+ breadcrumbsPrefix: ["response"],
+ })
+ );
+ default:
+ throw new errors.DevRevError({
+ statusCode: _response.error.statusCode,
+ body: _response.error.body,
+ });
+ }
+ }
+
+ switch (_response.error.reason) {
+ case "non-json":
+ throw new errors.DevRevError({
+ statusCode: _response.error.statusCode,
+ body: _response.error.rawBody,
+ });
+ case "timeout":
+ throw new errors.DevRevTimeoutError();
+ case "unknown":
+ throw new errors.DevRevError({
+ message: _response.error.errorMessage,
+ });
+ }
+ }
+
+ /**
+ * Gets a custom stage.
+ *
+ * @param {DevRev.CustomStagesGetRequest} request
+ * @param {Customization.RequestOptions} requestOptions - Request-specific configuration.
+ *
+ * @throws {@link DevRev.BadRequestError}
+ * @throws {@link DevRev.UnauthorizedError}
+ * @throws {@link DevRev.ForbiddenError}
+ * @throws {@link DevRev.NotFoundError}
+ * @throws {@link DevRev.TooManyRequestsError}
+ * @throws {@link DevRev.InternalServerError}
+ * @throws {@link DevRev.ServiceUnavailableError}
+ *
+ * @example
+ * await client.customization.customStagesGetPost({
+ * id: "id"
+ * })
+ */
+ public async customStagesGetPost(
+ request: DevRev.CustomStagesGetRequest,
+ requestOptions?: Customization.RequestOptions
+ ): Promise {
+ const _response = await (this._options.fetcher ?? core.fetcher)({
+ url: urlJoin(
+ (await core.Supplier.get(this._options.environment)) ?? environments.DevRevEnvironment.Default,
+ "stages.custom.get"
+ ),
+ method: "POST",
+ headers: {
+ Authorization: await this._getAuthorizationHeader(),
+ "X-Fern-Language": "JavaScript",
+ "X-Fern-SDK-Name": "@devrev/api",
+ "X-Fern-SDK-Version": "0.0.14",
+ "X-Fern-Runtime": core.RUNTIME.type,
+ "X-Fern-Runtime-Version": core.RUNTIME.version,
+ },
+ contentType: "application/json",
+ requestType: "json",
+ body: serializers.CustomStagesGetRequest.jsonOrThrow(request, { unrecognizedObjectKeys: "strip" }),
+ timeoutMs: requestOptions?.timeoutInSeconds != null ? requestOptions.timeoutInSeconds * 1000 : 60000,
+ maxRetries: requestOptions?.maxRetries,
+ abortSignal: requestOptions?.abortSignal,
+ });
+ if (_response.ok) {
+ return serializers.CustomStagesGetResponse.parseOrThrow(_response.body, {
+ unrecognizedObjectKeys: "passthrough",
+ allowUnrecognizedUnionMembers: true,
+ allowUnrecognizedEnumValues: true,
+ skipValidation: true,
+ breadcrumbsPrefix: ["response"],
+ });
+ }
+
+ if (_response.error.reason === "status-code") {
+ switch (_response.error.statusCode) {
+ case 400:
+ throw new DevRev.BadRequestError(
+ serializers.ErrorBadRequest.parseOrThrow(_response.error.body, {
+ unrecognizedObjectKeys: "passthrough",
+ allowUnrecognizedUnionMembers: true,
+ allowUnrecognizedEnumValues: true,
+ skipValidation: true,
+ breadcrumbsPrefix: ["response"],
+ })
+ );
+ case 401:
+ throw new DevRev.UnauthorizedError(
+ serializers.ErrorUnauthorized.parseOrThrow(_response.error.body, {
+ unrecognizedObjectKeys: "passthrough",
+ allowUnrecognizedUnionMembers: true,
+ allowUnrecognizedEnumValues: true,
+ skipValidation: true,
+ breadcrumbsPrefix: ["response"],
+ })
+ );
+ case 403:
+ throw new DevRev.ForbiddenError(
+ serializers.ErrorForbidden.parseOrThrow(_response.error.body, {
+ unrecognizedObjectKeys: "passthrough",
+ allowUnrecognizedUnionMembers: true,
+ allowUnrecognizedEnumValues: true,
+ skipValidation: true,
+ breadcrumbsPrefix: ["response"],
+ })
+ );
+ case 404:
+ throw new DevRev.NotFoundError(
+ serializers.ErrorNotFound.parseOrThrow(_response.error.body, {
+ unrecognizedObjectKeys: "passthrough",
+ allowUnrecognizedUnionMembers: true,
+ allowUnrecognizedEnumValues: true,
+ skipValidation: true,
+ breadcrumbsPrefix: ["response"],
+ })
+ );
+ case 429:
+ throw new DevRev.TooManyRequestsError(
+ serializers.ErrorTooManyRequests.parseOrThrow(_response.error.body, {
+ unrecognizedObjectKeys: "passthrough",
+ allowUnrecognizedUnionMembers: true,
+ allowUnrecognizedEnumValues: true,
+ skipValidation: true,
+ breadcrumbsPrefix: ["response"],
+ })
+ );
+ case 500:
+ throw new DevRev.InternalServerError(
+ serializers.ErrorInternalServerError.parseOrThrow(_response.error.body, {
+ unrecognizedObjectKeys: "passthrough",
+ allowUnrecognizedUnionMembers: true,
+ allowUnrecognizedEnumValues: true,
+ skipValidation: true,
+ breadcrumbsPrefix: ["response"],
+ })
+ );
+ case 503:
+ throw new DevRev.ServiceUnavailableError(
+ serializers.ErrorServiceUnavailable.parseOrThrow(_response.error.body, {
+ unrecognizedObjectKeys: "passthrough",
+ allowUnrecognizedUnionMembers: true,
+ allowUnrecognizedEnumValues: true,
+ skipValidation: true,
+ breadcrumbsPrefix: ["response"],
+ })
+ );
+ default:
+ throw new errors.DevRevError({
+ statusCode: _response.error.statusCode,
+ body: _response.error.body,
+ });
+ }
+ }
+
+ switch (_response.error.reason) {
+ case "non-json":
+ throw new errors.DevRevError({
+ statusCode: _response.error.statusCode,
+ body: _response.error.rawBody,
+ });
+ case "timeout":
+ throw new errors.DevRevTimeoutError();
+ case "unknown":
+ throw new errors.DevRevError({
+ message: _response.error.errorMessage,
+ });
+ }
+ }
+
+ /**
+ * Lists custom stages.
+ *
+ * @param {DevRev.CustomStagesListQuery} request
+ * @param {Customization.RequestOptions} requestOptions - Request-specific configuration.
+ *
+ * @throws {@link DevRev.BadRequestError}
+ * @throws {@link DevRev.UnauthorizedError}
+ * @throws {@link DevRev.ForbiddenError}
+ * @throws {@link DevRev.TooManyRequestsError}
+ * @throws {@link DevRev.InternalServerError}
+ * @throws {@link DevRev.ServiceUnavailableError}
+ *
+ * @example
+ * await client.customization.customStagesList()
+ */
+ public async customStagesList(
+ request: DevRev.CustomStagesListQuery = {},
+ requestOptions?: Customization.RequestOptions
+ ): Promise {
+ const { cursor, limit, name, ordinal, sortBy } = request;
+ const _queryParams: Record = {};
+ if (cursor != null) {
+ _queryParams["cursor"] = cursor;
+ }
+
+ if (limit != null) {
+ _queryParams["limit"] = limit.toString();
+ }
+
+ if (name != null) {
+ if (Array.isArray(name)) {
+ _queryParams["name"] = name.map((item) => item);
+ } else {
+ _queryParams["name"] = name;
+ }
+ }
+
+ if (ordinal != null) {
+ if (Array.isArray(ordinal)) {
+ _queryParams["ordinal"] = ordinal.map((item) => item.toString());
+ } else {
+ _queryParams["ordinal"] = ordinal.toString();
+ }
+ }
+
+ if (sortBy != null) {
+ if (Array.isArray(sortBy)) {
+ _queryParams["sort_by"] = sortBy.map((item) => item);
+ } else {
+ _queryParams["sort_by"] = sortBy;
+ }
+ }
+
+ const _response = await (this._options.fetcher ?? core.fetcher)({
+ url: urlJoin(
+ (await core.Supplier.get(this._options.environment)) ?? environments.DevRevEnvironment.Default,
+ "stages.custom.list"
+ ),
+ method: "GET",
+ headers: {
+ Authorization: await this._getAuthorizationHeader(),
+ "X-Fern-Language": "JavaScript",
+ "X-Fern-SDK-Name": "@devrev/api",
+ "X-Fern-SDK-Version": "0.0.14",
+ "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 serializers.CustomStagesListResponse.parseOrThrow(_response.body, {
+ unrecognizedObjectKeys: "passthrough",
+ allowUnrecognizedUnionMembers: true,
+ allowUnrecognizedEnumValues: true,
+ skipValidation: true,
+ breadcrumbsPrefix: ["response"],
+ });
+ }
+
+ if (_response.error.reason === "status-code") {
+ switch (_response.error.statusCode) {
+ case 400:
+ throw new DevRev.BadRequestError(
+ serializers.ErrorBadRequest.parseOrThrow(_response.error.body, {
+ unrecognizedObjectKeys: "passthrough",
+ allowUnrecognizedUnionMembers: true,
+ allowUnrecognizedEnumValues: true,
+ skipValidation: true,
+ breadcrumbsPrefix: ["response"],
+ })
+ );
+ case 401:
+ throw new DevRev.UnauthorizedError(
+ serializers.ErrorUnauthorized.parseOrThrow(_response.error.body, {
+ unrecognizedObjectKeys: "passthrough",
+ allowUnrecognizedUnionMembers: true,
+ allowUnrecognizedEnumValues: true,
+ skipValidation: true,
+ breadcrumbsPrefix: ["response"],
+ })
+ );
+ case 403:
+ throw new DevRev.ForbiddenError(
+ serializers.ErrorForbidden.parseOrThrow(_response.error.body, {
+ unrecognizedObjectKeys: "passthrough",
+ allowUnrecognizedUnionMembers: true,
+ allowUnrecognizedEnumValues: true,
+ skipValidation: true,
+ breadcrumbsPrefix: ["response"],
+ })
+ );
+ case 429:
+ throw new DevRev.TooManyRequestsError(
+ serializers.ErrorTooManyRequests.parseOrThrow(_response.error.body, {
+ unrecognizedObjectKeys: "passthrough",
+ allowUnrecognizedUnionMembers: true,
+ allowUnrecognizedEnumValues: true,
+ skipValidation: true,
+ breadcrumbsPrefix: ["response"],
+ })
+ );
+ case 500:
+ throw new DevRev.InternalServerError(
+ serializers.ErrorInternalServerError.parseOrThrow(_response.error.body, {
+ unrecognizedObjectKeys: "passthrough",
+ allowUnrecognizedUnionMembers: true,
+ allowUnrecognizedEnumValues: true,
+ skipValidation: true,
+ breadcrumbsPrefix: ["response"],
+ })
+ );
+ case 503:
+ throw new DevRev.ServiceUnavailableError(
+ serializers.ErrorServiceUnavailable.parseOrThrow(_response.error.body, {
+ unrecognizedObjectKeys: "passthrough",
+ allowUnrecognizedUnionMembers: true,
+ allowUnrecognizedEnumValues: true,
+ skipValidation: true,
+ breadcrumbsPrefix: ["response"],
+ })
+ );
+ default:
+ throw new errors.DevRevError({
+ statusCode: _response.error.statusCode,
+ body: _response.error.body,
+ });
+ }
+ }
+
+ switch (_response.error.reason) {
+ case "non-json":
+ throw new errors.DevRevError({
+ statusCode: _response.error.statusCode,
+ body: _response.error.rawBody,
+ });
+ case "timeout":
+ throw new errors.DevRevTimeoutError();
+ case "unknown":
+ throw new errors.DevRevError({
+ message: _response.error.errorMessage,
+ });
+ }
+ }
+
+ /**
+ * Lists custom stages.
+ *
+ * @param {DevRev.CustomStagesListRequest} request
+ * @param {Customization.RequestOptions} requestOptions - Request-specific configuration.
+ *
+ * @throws {@link DevRev.BadRequestError}
+ * @throws {@link DevRev.UnauthorizedError}
+ * @throws {@link DevRev.ForbiddenError}
+ * @throws {@link DevRev.TooManyRequestsError}
+ * @throws {@link DevRev.InternalServerError}
+ * @throws {@link DevRev.ServiceUnavailableError}
+ *
+ * @example
+ * await client.customization.customStagesListPost()
+ */
+ public async customStagesListPost(
+ request: DevRev.CustomStagesListRequest = {},
+ requestOptions?: Customization.RequestOptions
+ ): Promise {
+ const _response = await (this._options.fetcher ?? core.fetcher)({
+ url: urlJoin(
+ (await core.Supplier.get(this._options.environment)) ?? environments.DevRevEnvironment.Default,
+ "stages.custom.list"
+ ),
+ method: "POST",
+ headers: {
+ Authorization: await this._getAuthorizationHeader(),
+ "X-Fern-Language": "JavaScript",
+ "X-Fern-SDK-Name": "@devrev/api",
+ "X-Fern-SDK-Version": "0.0.14",
+ "X-Fern-Runtime": core.RUNTIME.type,
+ "X-Fern-Runtime-Version": core.RUNTIME.version,
+ },
+ contentType: "application/json",
+ requestType: "json",
+ body: serializers.CustomStagesListRequest.jsonOrThrow(request, { unrecognizedObjectKeys: "strip" }),
+ timeoutMs: requestOptions?.timeoutInSeconds != null ? requestOptions.timeoutInSeconds * 1000 : 60000,
+ maxRetries: requestOptions?.maxRetries,
+ abortSignal: requestOptions?.abortSignal,
+ });
+ if (_response.ok) {
+ return serializers.CustomStagesListResponse.parseOrThrow(_response.body, {
+ unrecognizedObjectKeys: "passthrough",
+ allowUnrecognizedUnionMembers: true,
+ allowUnrecognizedEnumValues: true,
+ skipValidation: true,
+ breadcrumbsPrefix: ["response"],
+ });
+ }
+
+ if (_response.error.reason === "status-code") {
+ switch (_response.error.statusCode) {
+ case 400:
+ throw new DevRev.BadRequestError(
+ serializers.ErrorBadRequest.parseOrThrow(_response.error.body, {
+ unrecognizedObjectKeys: "passthrough",
+ allowUnrecognizedUnionMembers: true,
+ allowUnrecognizedEnumValues: true,
+ skipValidation: true,
+ breadcrumbsPrefix: ["response"],
+ })
+ );
+ case 401:
+ throw new DevRev.UnauthorizedError(
+ serializers.ErrorUnauthorized.parseOrThrow(_response.error.body, {
+ unrecognizedObjectKeys: "passthrough",
+ allowUnrecognizedUnionMembers: true,
+ allowUnrecognizedEnumValues: true,
+ skipValidation: true,
+ breadcrumbsPrefix: ["response"],
+ })
+ );
+ case 403:
+ throw new DevRev.ForbiddenError(
+ serializers.ErrorForbidden.parseOrThrow(_response.error.body, {
+ unrecognizedObjectKeys: "passthrough",
+ allowUnrecognizedUnionMembers: true,
+ allowUnrecognizedEnumValues: true,
+ skipValidation: true,
+ breadcrumbsPrefix: ["response"],
+ })
+ );
+ case 429:
+ throw new DevRev.TooManyRequestsError(
+ serializers.ErrorTooManyRequests.parseOrThrow(_response.error.body, {
+ unrecognizedObjectKeys: "passthrough",
+ allowUnrecognizedUnionMembers: true,
+ allowUnrecognizedEnumValues: true,
+ skipValidation: true,
+ breadcrumbsPrefix: ["response"],
+ })
+ );
+ case 500:
+ throw new DevRev.InternalServerError(
+ serializers.ErrorInternalServerError.parseOrThrow(_response.error.body, {
+ unrecognizedObjectKeys: "passthrough",
+ allowUnrecognizedUnionMembers: true,
+ allowUnrecognizedEnumValues: true,
+ skipValidation: true,
+ breadcrumbsPrefix: ["response"],
+ })
+ );
+ case 503:
+ throw new DevRev.ServiceUnavailableError(
+ serializers.ErrorServiceUnavailable.parseOrThrow(_response.error.body, {
+ unrecognizedObjectKeys: "passthrough",
+ allowUnrecognizedUnionMembers: true,
+ allowUnrecognizedEnumValues: true,
+ skipValidation: true,
+ breadcrumbsPrefix: ["response"],
+ })
+ );
+ default:
+ throw new errors.DevRevError({
+ statusCode: _response.error.statusCode,
+ body: _response.error.body,
+ });
+ }
+ }
+
+ switch (_response.error.reason) {
+ case "non-json":
+ throw new errors.DevRevError({
+ statusCode: _response.error.statusCode,
+ body: _response.error.rawBody,
+ });
+ case "timeout":
+ throw new errors.DevRevTimeoutError();
+ case "unknown":
+ throw new errors.DevRevError({
+ message: _response.error.errorMessage,
+ });
+ }
+ }
+
+ /**
+ * Updates a custom stage.
+ *
+ * @param {DevRev.CustomStagesUpdateRequest} request
+ * @param {Customization.RequestOptions} requestOptions - Request-specific configuration.
+ *
+ * @throws {@link DevRev.BadRequestError}
+ * @throws {@link DevRev.UnauthorizedError}
+ * @throws {@link DevRev.ForbiddenError}
+ * @throws {@link DevRev.NotFoundError}
+ * @throws {@link DevRev.TooManyRequestsError}
+ * @throws {@link DevRev.InternalServerError}
+ * @throws {@link DevRev.ServiceUnavailableError}
+ *
+ * @example
+ * await client.customization.customStagesUpdate({
+ * id: "id"
+ * })
+ */
+ public async customStagesUpdate(
+ request: DevRev.CustomStagesUpdateRequest,
+ requestOptions?: Customization.RequestOptions
+ ): Promise {
+ const _response = await (this._options.fetcher ?? core.fetcher)({
+ url: urlJoin(
+ (await core.Supplier.get(this._options.environment)) ?? environments.DevRevEnvironment.Default,
+ "stages.custom.update"
+ ),
+ method: "POST",
+ headers: {
+ Authorization: await this._getAuthorizationHeader(),
+ "X-Fern-Language": "JavaScript",
+ "X-Fern-SDK-Name": "@devrev/api",
+ "X-Fern-SDK-Version": "0.0.14",
+ "X-Fern-Runtime": core.RUNTIME.type,
+ "X-Fern-Runtime-Version": core.RUNTIME.version,
+ },
+ contentType: "application/json",
+ requestType: "json",
+ body: serializers.CustomStagesUpdateRequest.jsonOrThrow(request, { unrecognizedObjectKeys: "strip" }),
+ timeoutMs: requestOptions?.timeoutInSeconds != null ? requestOptions.timeoutInSeconds * 1000 : 60000,
+ maxRetries: requestOptions?.maxRetries,
+ abortSignal: requestOptions?.abortSignal,
+ });
+ if (_response.ok) {
+ return serializers.CustomStagesUpdateResponse.parseOrThrow(_response.body, {
+ unrecognizedObjectKeys: "passthrough",
+ allowUnrecognizedUnionMembers: true,
+ allowUnrecognizedEnumValues: true,
+ skipValidation: true,
+ breadcrumbsPrefix: ["response"],
+ });
+ }
+
+ if (_response.error.reason === "status-code") {
+ switch (_response.error.statusCode) {
+ case 400:
+ throw new DevRev.BadRequestError(
+ serializers.ErrorBadRequest.parseOrThrow(_response.error.body, {
+ unrecognizedObjectKeys: "passthrough",
+ allowUnrecognizedUnionMembers: true,
+ allowUnrecognizedEnumValues: true,
+ skipValidation: true,
+ breadcrumbsPrefix: ["response"],
+ })
+ );
+ case 401:
+ throw new DevRev.UnauthorizedError(
+ serializers.ErrorUnauthorized.parseOrThrow(_response.error.body, {
+ unrecognizedObjectKeys: "passthrough",
+ allowUnrecognizedUnionMembers: true,
+ allowUnrecognizedEnumValues: true,
+ skipValidation: true,
+ breadcrumbsPrefix: ["response"],
+ })
+ );
+ case 403:
+ throw new DevRev.ForbiddenError(
+ serializers.ErrorForbidden.parseOrThrow(_response.error.body, {
+ unrecognizedObjectKeys: "passthrough",
+ allowUnrecognizedUnionMembers: true,
+ allowUnrecognizedEnumValues: true,
+ skipValidation: true,
+ breadcrumbsPrefix: ["response"],
+ })
+ );
+ case 404:
+ throw new DevRev.NotFoundError(
+ serializers.ErrorNotFound.parseOrThrow(_response.error.body, {
+ unrecognizedObjectKeys: "passthrough",
+ allowUnrecognizedUnionMembers: true,
+ allowUnrecognizedEnumValues: true,
+ skipValidation: true,
+ breadcrumbsPrefix: ["response"],
+ })
+ );
+ case 429:
+ throw new DevRev.TooManyRequestsError(
+ serializers.ErrorTooManyRequests.parseOrThrow(_response.error.body, {
+ unrecognizedObjectKeys: "passthrough",
+ allowUnrecognizedUnionMembers: true,
+ allowUnrecognizedEnumValues: true,
+ skipValidation: true,
+ breadcrumbsPrefix: ["response"],
+ })
+ );
+ case 500:
+ throw new DevRev.InternalServerError(
+ serializers.ErrorInternalServerError.parseOrThrow(_response.error.body, {
+ unrecognizedObjectKeys: "passthrough",
+ allowUnrecognizedUnionMembers: true,
+ allowUnrecognizedEnumValues: true,
+ skipValidation: true,
+ breadcrumbsPrefix: ["response"],
+ })
+ );
+ case 503:
+ throw new DevRev.ServiceUnavailableError(
+ serializers.ErrorServiceUnavailable.parseOrThrow(_response.error.body, {
+ unrecognizedObjectKeys: "passthrough",
+ allowUnrecognizedUnionMembers: true,
+ allowUnrecognizedEnumValues: true,
+ skipValidation: true,
+ breadcrumbsPrefix: ["response"],
+ })
+ );
+ default:
+ throw new errors.DevRevError({
+ statusCode: _response.error.statusCode,
+ body: _response.error.body,
+ });
+ }
+ }
+
+ switch (_response.error.reason) {
+ case "non-json":
+ throw new errors.DevRevError({
+ statusCode: _response.error.statusCode,
+ body: _response.error.rawBody,
+ });
+ case "timeout":
+ throw new errors.DevRevTimeoutError();
+ case "unknown":
+ throw new errors.DevRevError({
+ message: _response.error.errorMessage,
+ });
+ }
+ }
+
+ /**
+ * Creates a custom state.
+ *
+ * @param {DevRev.CustomStatesCreateRequest} request
+ * @param {Customization.RequestOptions} requestOptions - Request-specific configuration.
+ *
+ * @throws {@link DevRev.BadRequestError}
+ * @throws {@link DevRev.UnauthorizedError}
+ * @throws {@link DevRev.ForbiddenError}
+ * @throws {@link DevRev.TooManyRequestsError}
+ * @throws {@link DevRev.InternalServerError}
+ * @throws {@link DevRev.ServiceUnavailableError}
+ *
+ * @example
+ * await client.customization.customStatesCreate({
+ * name: "name",
+ * ordinal: 1
+ * })
+ */
+ public async customStatesCreate(
+ request: DevRev.CustomStatesCreateRequest,
+ requestOptions?: Customization.RequestOptions
+ ): Promise {
+ const _response = await (this._options.fetcher ?? core.fetcher)({
+ url: urlJoin(
+ (await core.Supplier.get(this._options.environment)) ?? environments.DevRevEnvironment.Default,
+ "states.custom.create"
+ ),
+ method: "POST",
+ headers: {
+ Authorization: await this._getAuthorizationHeader(),
+ "X-Fern-Language": "JavaScript",
+ "X-Fern-SDK-Name": "@devrev/api",
+ "X-Fern-SDK-Version": "0.0.14",
+ "X-Fern-Runtime": core.RUNTIME.type,
+ "X-Fern-Runtime-Version": core.RUNTIME.version,
+ },
+ contentType: "application/json",
+ requestType: "json",
+ body: serializers.CustomStatesCreateRequest.jsonOrThrow(request, { unrecognizedObjectKeys: "strip" }),
+ timeoutMs: requestOptions?.timeoutInSeconds != null ? requestOptions.timeoutInSeconds * 1000 : 60000,
+ maxRetries: requestOptions?.maxRetries,
+ abortSignal: requestOptions?.abortSignal,
+ });
+ if (_response.ok) {
+ return serializers.CustomStatesCreateResponse.parseOrThrow(_response.body, {
+ unrecognizedObjectKeys: "passthrough",
+ allowUnrecognizedUnionMembers: true,
+ allowUnrecognizedEnumValues: true,
+ skipValidation: true,
+ breadcrumbsPrefix: ["response"],
+ });
+ }
+
+ if (_response.error.reason === "status-code") {
+ switch (_response.error.statusCode) {
+ case 400:
+ throw new DevRev.BadRequestError(
+ serializers.ErrorBadRequest.parseOrThrow(_response.error.body, {
+ unrecognizedObjectKeys: "passthrough",
+ allowUnrecognizedUnionMembers: true,
+ allowUnrecognizedEnumValues: true,
+ skipValidation: true,
+ breadcrumbsPrefix: ["response"],
+ })
+ );
+ case 401:
+ throw new DevRev.UnauthorizedError(
+ serializers.ErrorUnauthorized.parseOrThrow(_response.error.body, {
+ unrecognizedObjectKeys: "passthrough",
+ allowUnrecognizedUnionMembers: true,
+ allowUnrecognizedEnumValues: true,
+ skipValidation: true,
+ breadcrumbsPrefix: ["response"],
+ })
+ );
+ case 403:
+ throw new DevRev.ForbiddenError(
+ serializers.ErrorForbidden.parseOrThrow(_response.error.body, {
+ unrecognizedObjectKeys: "passthrough",
+ allowUnrecognizedUnionMembers: true,
+ allowUnrecognizedEnumValues: true,
+ skipValidation: true,
+ breadcrumbsPrefix: ["response"],
+ })
+ );
+ case 429:
+ throw new DevRev.TooManyRequestsError(
+ serializers.ErrorTooManyRequests.parseOrThrow(_response.error.body, {
+ unrecognizedObjectKeys: "passthrough",
+ allowUnrecognizedUnionMembers: true,
+ allowUnrecognizedEnumValues: true,
+ skipValidation: true,
+ breadcrumbsPrefix: ["response"],
+ })
+ );
+ case 500:
+ throw new DevRev.InternalServerError(
+ serializers.ErrorInternalServerError.parseOrThrow(_response.error.body, {
+ unrecognizedObjectKeys: "passthrough",
+ allowUnrecognizedUnionMembers: true,
+ allowUnrecognizedEnumValues: true,
+ skipValidation: true,
+ breadcrumbsPrefix: ["response"],
+ })
+ );
+ case 503:
+ throw new DevRev.ServiceUnavailableError(
+ serializers.ErrorServiceUnavailable.parseOrThrow(_response.error.body, {
+ unrecognizedObjectKeys: "passthrough",
+ allowUnrecognizedUnionMembers: true,
+ allowUnrecognizedEnumValues: true,
+ skipValidation: true,
+ breadcrumbsPrefix: ["response"],
+ })
+ );
+ default:
+ throw new errors.DevRevError({
+ statusCode: _response.error.statusCode,
+ body: _response.error.body,
+ });
+ }
+ }
+
+ switch (_response.error.reason) {
+ case "non-json":
+ throw new errors.DevRevError({
+ statusCode: _response.error.statusCode,
+ body: _response.error.rawBody,
+ });
+ case "timeout":
+ throw new errors.DevRevTimeoutError();
+ case "unknown":
+ throw new errors.DevRevError({
+ message: _response.error.errorMessage,
+ });
+ }
+ }
+
+ /**
+ * Gets a custom state.
+ *
+ * @param {DevRev.CustomStatesGetQuery} request
+ * @param {Customization.RequestOptions} requestOptions - Request-specific configuration.
+ *
+ * @throws {@link DevRev.BadRequestError}
+ * @throws {@link DevRev.UnauthorizedError}
+ * @throws {@link DevRev.ForbiddenError}
+ * @throws {@link DevRev.NotFoundError}
+ * @throws {@link DevRev.TooManyRequestsError}
+ * @throws {@link DevRev.InternalServerError}
+ * @throws {@link DevRev.ServiceUnavailableError}
+ *
+ * @example
+ * await client.customization.customStatesGet({
+ * id: "id"
+ * })
+ */
+ public async customStatesGet(
+ request: DevRev.CustomStatesGetQuery,
+ requestOptions?: Customization.RequestOptions
+ ): Promise {
+ const { id } = request;
+ const _queryParams: Record = {};
+ _queryParams["id"] = id;
+ const _response = await (this._options.fetcher ?? core.fetcher)({
+ url: urlJoin(
+ (await core.Supplier.get(this._options.environment)) ?? environments.DevRevEnvironment.Default,
+ "states.custom.get"
+ ),
+ method: "GET",
+ headers: {
+ Authorization: await this._getAuthorizationHeader(),
+ "X-Fern-Language": "JavaScript",
+ "X-Fern-SDK-Name": "@devrev/api",
+ "X-Fern-SDK-Version": "0.0.14",
+ "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 serializers.CustomStatesGetResponse.parseOrThrow(_response.body, {
+ unrecognizedObjectKeys: "passthrough",
+ allowUnrecognizedUnionMembers: true,
+ allowUnrecognizedEnumValues: true,
+ skipValidation: true,
+ breadcrumbsPrefix: ["response"],
+ });
+ }
+
+ if (_response.error.reason === "status-code") {
+ switch (_response.error.statusCode) {
+ case 400:
+ throw new DevRev.BadRequestError(
+ serializers.ErrorBadRequest.parseOrThrow(_response.error.body, {
+ unrecognizedObjectKeys: "passthrough",
+ allowUnrecognizedUnionMembers: true,
+ allowUnrecognizedEnumValues: true,
+ skipValidation: true,
+ breadcrumbsPrefix: ["response"],
+ })
+ );
+ case 401:
+ throw new DevRev.UnauthorizedError(
+ serializers.ErrorUnauthorized.parseOrThrow(_response.error.body, {
+ unrecognizedObjectKeys: "passthrough",
+ allowUnrecognizedUnionMembers: true,
+ allowUnrecognizedEnumValues: true,
+ skipValidation: true,
+ breadcrumbsPrefix: ["response"],
+ })
+ );
+ case 403:
+ throw new DevRev.ForbiddenError(
+ serializers.ErrorForbidden.parseOrThrow(_response.error.body, {
+ unrecognizedObjectKeys: "passthrough",
+ allowUnrecognizedUnionMembers: true,
+ allowUnrecognizedEnumValues: true,
+ skipValidation: true,
+ breadcrumbsPrefix: ["response"],
+ })
+ );
+ case 404:
+ throw new DevRev.NotFoundError(
+ serializers.ErrorNotFound.parseOrThrow(_response.error.body, {
+ unrecognizedObjectKeys: "passthrough",
+ allowUnrecognizedUnionMembers: true,
+ allowUnrecognizedEnumValues: true,
+ skipValidation: true,
+ breadcrumbsPrefix: ["response"],
+ })
+ );
+ case 429:
+ throw new DevRev.TooManyRequestsError(
+ serializers.ErrorTooManyRequests.parseOrThrow(_response.error.body, {
+ unrecognizedObjectKeys: "passthrough",
+ allowUnrecognizedUnionMembers: true,
+ allowUnrecognizedEnumValues: true,
+ skipValidation: true,
+ breadcrumbsPrefix: ["response"],
+ })
+ );
+ case 500:
+ throw new DevRev.InternalServerError(
+ serializers.ErrorInternalServerError.parseOrThrow(_response.error.body, {
+ unrecognizedObjectKeys: "passthrough",
+ allowUnrecognizedUnionMembers: true,
+ allowUnrecognizedEnumValues: true,
+ skipValidation: true,
+ breadcrumbsPrefix: ["response"],
+ })
+ );
+ case 503:
+ throw new DevRev.ServiceUnavailableError(
+ serializers.ErrorServiceUnavailable.parseOrThrow(_response.error.body, {
+ unrecognizedObjectKeys: "passthrough",
+ allowUnrecognizedUnionMembers: true,
+ allowUnrecognizedEnumValues: true,
+ skipValidation: true,
+ breadcrumbsPrefix: ["response"],
+ })
+ );
+ default:
+ throw new errors.DevRevError({
+ statusCode: _response.error.statusCode,
+ body: _response.error.body,
+ });
+ }
+ }
+
+ switch (_response.error.reason) {
+ case "non-json":
+ throw new errors.DevRevError({
+ statusCode: _response.error.statusCode,
+ body: _response.error.rawBody,
+ });
+ case "timeout":
+ throw new errors.DevRevTimeoutError();
+ case "unknown":
+ throw new errors.DevRevError({
+ message: _response.error.errorMessage,
+ });
+ }
+ }
+
+ /**
+ * Gets a custom state.
+ *
+ * @param {DevRev.CustomStatesGetRequest} request
+ * @param {Customization.RequestOptions} requestOptions - Request-specific configuration.
+ *
+ * @throws {@link DevRev.BadRequestError}
+ * @throws {@link DevRev.UnauthorizedError}
+ * @throws {@link DevRev.ForbiddenError}
+ * @throws {@link DevRev.NotFoundError}
+ * @throws {@link DevRev.TooManyRequestsError}
+ * @throws {@link DevRev.InternalServerError}
+ * @throws {@link DevRev.ServiceUnavailableError}
+ *
+ * @example
+ * await client.customization.customStatesGetPost({
+ * id: "id"
+ * })
+ */
+ public async customStatesGetPost(
+ request: DevRev.CustomStatesGetRequest,
+ requestOptions?: Customization.RequestOptions
+ ): Promise {
+ const _response = await (this._options.fetcher ?? core.fetcher)({
+ url: urlJoin(
+ (await core.Supplier.get(this._options.environment)) ?? environments.DevRevEnvironment.Default,
+ "states.custom.get"
+ ),
+ method: "POST",
+ headers: {
+ Authorization: await this._getAuthorizationHeader(),
+ "X-Fern-Language": "JavaScript",
+ "X-Fern-SDK-Name": "@devrev/api",
+ "X-Fern-SDK-Version": "0.0.14",
+ "X-Fern-Runtime": core.RUNTIME.type,
+ "X-Fern-Runtime-Version": core.RUNTIME.version,
+ },
+ contentType: "application/json",
+ requestType: "json",
+ body: serializers.CustomStatesGetRequest.jsonOrThrow(request, { unrecognizedObjectKeys: "strip" }),
+ timeoutMs: requestOptions?.timeoutInSeconds != null ? requestOptions.timeoutInSeconds * 1000 : 60000,
+ maxRetries: requestOptions?.maxRetries,
+ abortSignal: requestOptions?.abortSignal,
+ });
+ if (_response.ok) {
+ return serializers.CustomStatesGetResponse.parseOrThrow(_response.body, {
+ unrecognizedObjectKeys: "passthrough",
+ allowUnrecognizedUnionMembers: true,
+ allowUnrecognizedEnumValues: true,
+ skipValidation: true,
+ breadcrumbsPrefix: ["response"],
+ });
+ }
+
+ if (_response.error.reason === "status-code") {
+ switch (_response.error.statusCode) {
+ case 400:
+ throw new DevRev.BadRequestError(
+ serializers.ErrorBadRequest.parseOrThrow(_response.error.body, {
+ unrecognizedObjectKeys: "passthrough",
+ allowUnrecognizedUnionMembers: true,
+ allowUnrecognizedEnumValues: true,
+ skipValidation: true,
+ breadcrumbsPrefix: ["response"],
+ })
+ );
+ case 401:
+ throw new DevRev.UnauthorizedError(
+ serializers.ErrorUnauthorized.parseOrThrow(_response.error.body, {
+ unrecognizedObjectKeys: "passthrough",
+ allowUnrecognizedUnionMembers: true,
+ allowUnrecognizedEnumValues: true,
+ skipValidation: true,
+ breadcrumbsPrefix: ["response"],
+ })
+ );
+ case 403:
+ throw new DevRev.ForbiddenError(
+ serializers.ErrorForbidden.parseOrThrow(_response.error.body, {
+ unrecognizedObjectKeys: "passthrough",
+ allowUnrecognizedUnionMembers: true,
+ allowUnrecognizedEnumValues: true,
+ skipValidation: true,
+ breadcrumbsPrefix: ["response"],
+ })
+ );
+ case 404:
+ throw new DevRev.NotFoundError(
+ serializers.ErrorNotFound.parseOrThrow(_response.error.body, {
+ unrecognizedObjectKeys: "passthrough",
+ allowUnrecognizedUnionMembers: true,
+ allowUnrecognizedEnumValues: true,
+ skipValidation: true,
+ breadcrumbsPrefix: ["response"],
+ })
+ );
+ case 429:
+ throw new DevRev.TooManyRequestsError(
+ serializers.ErrorTooManyRequests.parseOrThrow(_response.error.body, {
+ unrecognizedObjectKeys: "passthrough",
+ allowUnrecognizedUnionMembers: true,
+ allowUnrecognizedEnumValues: true,
+ skipValidation: true,
+ breadcrumbsPrefix: ["response"],
+ })
+ );
+ case 500:
+ throw new DevRev.InternalServerError(
+ serializers.ErrorInternalServerError.parseOrThrow(_response.error.body, {
+ unrecognizedObjectKeys: "passthrough",
+ allowUnrecognizedUnionMembers: true,
+ allowUnrecognizedEnumValues: true,
+ skipValidation: true,
+ breadcrumbsPrefix: ["response"],
+ })
+ );
+ case 503:
+ throw new DevRev.ServiceUnavailableError(
+ serializers.ErrorServiceUnavailable.parseOrThrow(_response.error.body, {
+ unrecognizedObjectKeys: "passthrough",
+ allowUnrecognizedUnionMembers: true,
+ allowUnrecognizedEnumValues: true,
+ skipValidation: true,
+ breadcrumbsPrefix: ["response"],
+ })
+ );
+ default:
+ throw new errors.DevRevError({
+ statusCode: _response.error.statusCode,
+ body: _response.error.body,
+ });
+ }
+ }
+
+ switch (_response.error.reason) {
+ case "non-json":
+ throw new errors.DevRevError({
+ statusCode: _response.error.statusCode,
+ body: _response.error.rawBody,
+ });
+ case "timeout":
+ throw new errors.DevRevTimeoutError();
+ case "unknown":
+ throw new errors.DevRevError({
+ message: _response.error.errorMessage,
+ });
+ }
+ }
+
+ /**
+ * Lists custom states.
+ *
+ * @param {DevRev.CustomStatesListQuery} request
+ * @param {Customization.RequestOptions} requestOptions - Request-specific configuration.
+ *
+ * @throws {@link DevRev.BadRequestError}
+ * @throws {@link DevRev.UnauthorizedError}
+ * @throws {@link DevRev.ForbiddenError}
+ * @throws {@link DevRev.TooManyRequestsError}
+ * @throws {@link DevRev.InternalServerError}
+ * @throws {@link DevRev.ServiceUnavailableError}
+ *
+ * @example
+ * await client.customization.customStatesList()
+ */
+ public async customStatesList(
+ request: DevRev.CustomStatesListQuery = {},
+ requestOptions?: Customization.RequestOptions
+ ): Promise {
+ const { cursor, isFinal, limit, name, ordinal, sortBy } = request;
+ const _queryParams: Record = {};
+ if (cursor != null) {
+ _queryParams["cursor"] = cursor;
+ }
+
+ if (isFinal != null) {
+ _queryParams["is_final"] = isFinal.toString();
+ }
+
+ if (limit != null) {
+ _queryParams["limit"] = limit.toString();
+ }
+
+ if (name != null) {
+ if (Array.isArray(name)) {
+ _queryParams["name"] = name.map((item) => item);
+ } else {
+ _queryParams["name"] = name;
+ }
+ }
+
+ if (ordinal != null) {
+ if (Array.isArray(ordinal)) {
+ _queryParams["ordinal"] = ordinal.map((item) => item.toString());
+ } else {
+ _queryParams["ordinal"] = ordinal.toString();
+ }
+ }
+
+ if (sortBy != null) {
+ if (Array.isArray(sortBy)) {
+ _queryParams["sort_by"] = sortBy.map((item) => item);
+ } else {
+ _queryParams["sort_by"] = sortBy;
+ }
+ }
+
+ const _response = await (this._options.fetcher ?? core.fetcher)({
+ url: urlJoin(
+ (await core.Supplier.get(this._options.environment)) ?? environments.DevRevEnvironment.Default,
+ "states.custom.list"
+ ),
+ method: "GET",
+ headers: {
+ Authorization: await this._getAuthorizationHeader(),
+ "X-Fern-Language": "JavaScript",
+ "X-Fern-SDK-Name": "@devrev/api",
+ "X-Fern-SDK-Version": "0.0.14",
+ "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 serializers.CustomStatesListResponse.parseOrThrow(_response.body, {
+ unrecognizedObjectKeys: "passthrough",
+ allowUnrecognizedUnionMembers: true,
+ allowUnrecognizedEnumValues: true,
+ skipValidation: true,
+ breadcrumbsPrefix: ["response"],
+ });
+ }
+
+ if (_response.error.reason === "status-code") {
+ switch (_response.error.statusCode) {
+ case 400:
+ throw new DevRev.BadRequestError(
+ serializers.ErrorBadRequest.parseOrThrow(_response.error.body, {
+ unrecognizedObjectKeys: "passthrough",
+ allowUnrecognizedUnionMembers: true,
+ allowUnrecognizedEnumValues: true,
+ skipValidation: true,
+ breadcrumbsPrefix: ["response"],
+ })
+ );
+ case 401:
+ throw new DevRev.UnauthorizedError(
+ serializers.ErrorUnauthorized.parseOrThrow(_response.error.body, {
+ unrecognizedObjectKeys: "passthrough",
+ allowUnrecognizedUnionMembers: true,
+ allowUnrecognizedEnumValues: true,
+ skipValidation: true,
+ breadcrumbsPrefix: ["response"],
+ })
+ );
+ case 403:
+ throw new DevRev.ForbiddenError(
+ serializers.ErrorForbidden.parseOrThrow(_response.error.body, {
+ unrecognizedObjectKeys: "passthrough",
+ allowUnrecognizedUnionMembers: true,
+ allowUnrecognizedEnumValues: true,
+ skipValidation: true,
+ breadcrumbsPrefix: ["response"],
+ })
+ );
+ case 429:
+ throw new DevRev.TooManyRequestsError(
+ serializers.ErrorTooManyRequests.parseOrThrow(_response.error.body, {
+ unrecognizedObjectKeys: "passthrough",
+ allowUnrecognizedUnionMembers: true,
+ allowUnrecognizedEnumValues: true,
+ skipValidation: true,
+ breadcrumbsPrefix: ["response"],
+ })
+ );
+ case 500:
+ throw new DevRev.InternalServerError(
+ serializers.ErrorInternalServerError.parseOrThrow(_response.error.body, {
+ unrecognizedObjectKeys: "passthrough",
+ allowUnrecognizedUnionMembers: true,
+ allowUnrecognizedEnumValues: true,
+ skipValidation: true,
+ breadcrumbsPrefix: ["response"],
+ })
+ );
+ case 503:
+ throw new DevRev.ServiceUnavailableError(
+ serializers.ErrorServiceUnavailable.parseOrThrow(_response.error.body, {
+ unrecognizedObjectKeys: "passthrough",
+ allowUnrecognizedUnionMembers: true,
+ allowUnrecognizedEnumValues: true,
+ skipValidation: true,
+ breadcrumbsPrefix: ["response"],
+ })
+ );
+ default:
+ throw new errors.DevRevError({
+ statusCode: _response.error.statusCode,
+ body: _response.error.body,
+ });
+ }
+ }
+
+ switch (_response.error.reason) {
+ case "non-json":
+ throw new errors.DevRevError({
+ statusCode: _response.error.statusCode,
+ body: _response.error.rawBody,
+ });
+ case "timeout":
+ throw new errors.DevRevTimeoutError();
+ case "unknown":
+ throw new errors.DevRevError({
+ message: _response.error.errorMessage,
+ });
+ }
+ }
+
+ /**
+ * Lists custom states.
+ *
+ * @param {DevRev.CustomStatesListRequest} request
+ * @param {Customization.RequestOptions} requestOptions - Request-specific configuration.
+ *
+ * @throws {@link DevRev.BadRequestError}
+ * @throws {@link DevRev.UnauthorizedError}
+ * @throws {@link DevRev.ForbiddenError}
+ * @throws {@link DevRev.TooManyRequestsError}
+ * @throws {@link DevRev.InternalServerError}
+ * @throws {@link DevRev.ServiceUnavailableError}
+ *
+ * @example
+ * await client.customization.customStatesListPost()
+ */
+ public async customStatesListPost(
+ request: DevRev.CustomStatesListRequest = {},
+ requestOptions?: Customization.RequestOptions
+ ): Promise {
+ const _response = await (this._options.fetcher ?? core.fetcher)({
+ url: urlJoin(
+ (await core.Supplier.get(this._options.environment)) ?? environments.DevRevEnvironment.Default,
+ "states.custom.list"
+ ),
+ method: "POST",
+ headers: {
+ Authorization: await this._getAuthorizationHeader(),
+ "X-Fern-Language": "JavaScript",
+ "X-Fern-SDK-Name": "@devrev/api",
+ "X-Fern-SDK-Version": "0.0.14",
+ "X-Fern-Runtime": core.RUNTIME.type,
+ "X-Fern-Runtime-Version": core.RUNTIME.version,
+ },
+ contentType: "application/json",
+ requestType: "json",
+ body: serializers.CustomStatesListRequest.jsonOrThrow(request, { unrecognizedObjectKeys: "strip" }),
+ timeoutMs: requestOptions?.timeoutInSeconds != null ? requestOptions.timeoutInSeconds * 1000 : 60000,
+ maxRetries: requestOptions?.maxRetries,
+ abortSignal: requestOptions?.abortSignal,
+ });
+ if (_response.ok) {
+ return serializers.CustomStatesListResponse.parseOrThrow(_response.body, {
+ unrecognizedObjectKeys: "passthrough",
+ allowUnrecognizedUnionMembers: true,
+ allowUnrecognizedEnumValues: true,
+ skipValidation: true,
+ breadcrumbsPrefix: ["response"],
+ });
+ }
+
+ if (_response.error.reason === "status-code") {
+ switch (_response.error.statusCode) {
+ case 400:
+ throw new DevRev.BadRequestError(
+ serializers.ErrorBadRequest.parseOrThrow(_response.error.body, {
+ unrecognizedObjectKeys: "passthrough",
+ allowUnrecognizedUnionMembers: true,
+ allowUnrecognizedEnumValues: true,
+ skipValidation: true,
+ breadcrumbsPrefix: ["response"],
+ })
+ );
+ case 401:
+ throw new DevRev.UnauthorizedError(
+ serializers.ErrorUnauthorized.parseOrThrow(_response.error.body, {
+ unrecognizedObjectKeys: "passthrough",
+ allowUnrecognizedUnionMembers: true,
+ allowUnrecognizedEnumValues: true,
+ skipValidation: true,
+ breadcrumbsPrefix: ["response"],
+ })
+ );
+ case 403:
+ throw new DevRev.ForbiddenError(
+ serializers.ErrorForbidden.parseOrThrow(_response.error.body, {
+ unrecognizedObjectKeys: "passthrough",
+ allowUnrecognizedUnionMembers: true,
+ allowUnrecognizedEnumValues: true,
+ skipValidation: true,
+ breadcrumbsPrefix: ["response"],
+ })
+ );
+ case 429:
+ throw new DevRev.TooManyRequestsError(
+ serializers.ErrorTooManyRequests.parseOrThrow(_response.error.body, {
+ unrecognizedObjectKeys: "passthrough",
+ allowUnrecognizedUnionMembers: true,
+ allowUnrecognizedEnumValues: true,
+ skipValidation: true,
+ breadcrumbsPrefix: ["response"],
+ })
+ );
+ case 500:
+ throw new DevRev.InternalServerError(
+ serializers.ErrorInternalServerError.parseOrThrow(_response.error.body, {
+ unrecognizedObjectKeys: "passthrough",
+ allowUnrecognizedUnionMembers: true,
+ allowUnrecognizedEnumValues: true,
+ skipValidation: true,
+ breadcrumbsPrefix: ["response"],
+ })
+ );
+ case 503:
+ throw new DevRev.ServiceUnavailableError(
+ serializers.ErrorServiceUnavailable.parseOrThrow(_response.error.body, {
+ unrecognizedObjectKeys: "passthrough",
+ allowUnrecognizedUnionMembers: true,
+ allowUnrecognizedEnumValues: true,
+ skipValidation: true,
+ breadcrumbsPrefix: ["response"],
+ })
+ );
+ default:
+ throw new errors.DevRevError({
+ statusCode: _response.error.statusCode,
+ body: _response.error.body,
+ });
+ }
+ }
+
+ switch (_response.error.reason) {
+ case "non-json":
+ throw new errors.DevRevError({
+ statusCode: _response.error.statusCode,
+ body: _response.error.rawBody,
+ });
+ case "timeout":
+ throw new errors.DevRevTimeoutError();
+ case "unknown":
+ throw new errors.DevRevError({
+ message: _response.error.errorMessage,
+ });
+ }
+ }
+
+ /**
+ * Updates a custom state.
+ *
+ * @param {DevRev.CustomStatesUpdateRequest} request
+ * @param {Customization.RequestOptions} requestOptions - Request-specific configuration.
+ *
+ * @throws {@link DevRev.BadRequestError}
+ * @throws {@link DevRev.UnauthorizedError}
+ * @throws {@link DevRev.ForbiddenError}
+ * @throws {@link DevRev.NotFoundError}
+ * @throws {@link DevRev.TooManyRequestsError}
+ * @throws {@link DevRev.InternalServerError}
+ * @throws {@link DevRev.ServiceUnavailableError}
+ *
+ * @example
+ * await client.customization.customStatesUpdate({
+ * id: "id"
+ * })
+ */
+ public async customStatesUpdate(
+ request: DevRev.CustomStatesUpdateRequest,
+ requestOptions?: Customization.RequestOptions
+ ): Promise {
+ const _response = await (this._options.fetcher ?? core.fetcher)({
+ url: urlJoin(
+ (await core.Supplier.get(this._options.environment)) ?? environments.DevRevEnvironment.Default,
+ "states.custom.update"
+ ),
+ method: "POST",
+ headers: {
+ Authorization: await this._getAuthorizationHeader(),
+ "X-Fern-Language": "JavaScript",
+ "X-Fern-SDK-Name": "@devrev/api",
+ "X-Fern-SDK-Version": "0.0.14",
+ "X-Fern-Runtime": core.RUNTIME.type,
+ "X-Fern-Runtime-Version": core.RUNTIME.version,
+ },
+ contentType: "application/json",
+ requestType: "json",
+ body: serializers.CustomStatesUpdateRequest.jsonOrThrow(request, { unrecognizedObjectKeys: "strip" }),
+ timeoutMs: requestOptions?.timeoutInSeconds != null ? requestOptions.timeoutInSeconds * 1000 : 60000,
+ maxRetries: requestOptions?.maxRetries,
+ abortSignal: requestOptions?.abortSignal,
+ });
+ if (_response.ok) {
+ return serializers.CustomStatesUpdateResponse.parseOrThrow(_response.body, {
+ unrecognizedObjectKeys: "passthrough",
+ allowUnrecognizedUnionMembers: true,
+ allowUnrecognizedEnumValues: true,
+ skipValidation: true,
+ breadcrumbsPrefix: ["response"],
+ });
+ }
+
+ if (_response.error.reason === "status-code") {
+ switch (_response.error.statusCode) {
+ case 400:
+ throw new DevRev.BadRequestError(
+ serializers.ErrorBadRequest.parseOrThrow(_response.error.body, {
+ unrecognizedObjectKeys: "passthrough",
+ allowUnrecognizedUnionMembers: true,
+ allowUnrecognizedEnumValues: true,
+ skipValidation: true,
+ breadcrumbsPrefix: ["response"],
+ })
+ );
+ case 401:
+ throw new DevRev.UnauthorizedError(
+ serializers.ErrorUnauthorized.parseOrThrow(_response.error.body, {
+ unrecognizedObjectKeys: "passthrough",
+ allowUnrecognizedUnionMembers: true,
+ allowUnrecognizedEnumValues: true,
+ skipValidation: true,
+ breadcrumbsPrefix: ["response"],
+ })
+ );
+ case 403:
+ throw new DevRev.ForbiddenError(
+ serializers.ErrorForbidden.parseOrThrow(_response.error.body, {
+ unrecognizedObjectKeys: "passthrough",
+ allowUnrecognizedUnionMembers: true,
+ allowUnrecognizedEnumValues: true,
+ skipValidation: true,
+ breadcrumbsPrefix: ["response"],
+ })
+ );
+ case 404:
+ throw new DevRev.NotFoundError(
+ serializers.ErrorNotFound.parseOrThrow(_response.error.body, {
+ unrecognizedObjectKeys: "passthrough",
+ allowUnrecognizedUnionMembers: true,
+ allowUnrecognizedEnumValues: true,
+ skipValidation: true,
+ breadcrumbsPrefix: ["response"],
+ })
+ );
+ case 429:
+ throw new DevRev.TooManyRequestsError(
+ serializers.ErrorTooManyRequests.parseOrThrow(_response.error.body, {
+ unrecognizedObjectKeys: "passthrough",
+ allowUnrecognizedUnionMembers: true,
+ allowUnrecognizedEnumValues: true,
+ skipValidation: true,
+ breadcrumbsPrefix: ["response"],
+ })
+ );
+ case 500:
+ throw new DevRev.InternalServerError(
+ serializers.ErrorInternalServerError.parseOrThrow(_response.error.body, {
+ unrecognizedObjectKeys: "passthrough",
+ allowUnrecognizedUnionMembers: true,
+ allowUnrecognizedEnumValues: true,
+ skipValidation: true,
+ breadcrumbsPrefix: ["response"],
+ })
+ );
+ case 503:
+ throw new DevRev.ServiceUnavailableError(
+ serializers.ErrorServiceUnavailable.parseOrThrow(_response.error.body, {
+ unrecognizedObjectKeys: "passthrough",
+ allowUnrecognizedUnionMembers: true,
+ allowUnrecognizedEnumValues: true,
+ skipValidation: true,
+ breadcrumbsPrefix: ["response"],
+ })
+ );
+ default:
+ throw new errors.DevRevError({
+ statusCode: _response.error.statusCode,
+ body: _response.error.body,
+ });
+ }
+ }
+
+ switch (_response.error.reason) {
+ case "non-json":
+ throw new errors.DevRevError({
+ statusCode: _response.error.statusCode,
+ body: _response.error.rawBody,
+ });
+ case "timeout":
+ throw new errors.DevRevTimeoutError();
+ case "unknown":
+ throw new errors.DevRevError({
+ message: _response.error.errorMessage,
+ });
+ }
+ }
+
+ protected async _getAuthorizationHeader(): Promise {
+ const bearer = (await core.Supplier.get(this._options.token)) ?? process?.env["DEVREV_TOKEN"];
+ if (bearer == null) {
+ throw new errors.DevRevError({
+ message: "Please specify DEVREV_TOKEN when instantiating the client.",
+ });
+ }
+
+ return `Bearer ${bearer}`;
+ }
+}
diff --git a/src/api/resources/customization/client/index.ts b/src/api/resources/customization/client/index.ts
new file mode 100644
index 0000000..415726b
--- /dev/null
+++ b/src/api/resources/customization/client/index.ts
@@ -0,0 +1 @@
+export * from "./requests";
diff --git a/src/api/resources/customization/client/requests/AggregatedSchemaGetQuery.ts b/src/api/resources/customization/client/requests/AggregatedSchemaGetQuery.ts
new file mode 100644
index 0000000..0b59102
--- /dev/null
+++ b/src/api/resources/customization/client/requests/AggregatedSchemaGetQuery.ts
@@ -0,0 +1,27 @@
+/**
+ * This file was auto-generated by Fern from our API Definition.
+ */
+
+/**
+ * @example
+ * {
+ * customSchemaFragmentIds: "string",
+ * leafType: "string",
+ * stockSchemaFragmentId: "string"
+ * }
+ */
+export interface AggregatedSchemaGetQuery {
+ /**
+ * The list of custom schema fragment DONs which are to be aggregated.
+ */
+ customSchemaFragmentIds?: string | string[];
+ /**
+ * The leaf type. Used for inferring the default stage diagram and
+ * tenant fragment ID.
+ */
+ leafType?: string;
+ /**
+ * The stock schema fragment which is to be aggregated.
+ */
+ stockSchemaFragmentId?: string;
+}
diff --git a/src/api/resources/customization/client/requests/AggregatedSchemaGetRequest.ts b/src/api/resources/customization/client/requests/AggregatedSchemaGetRequest.ts
new file mode 100644
index 0000000..7cbef56
--- /dev/null
+++ b/src/api/resources/customization/client/requests/AggregatedSchemaGetRequest.ts
@@ -0,0 +1,29 @@
+/**
+ * This file was auto-generated by Fern from our API Definition.
+ */
+
+import * as DevRev from "../../../../index";
+
+/**
+ * @example
+ * {
+ * customSchemaFragmentIds: ["custom_schema_fragment_ids"]
+ * }
+ */
+export interface AggregatedSchemaGetRequest {
+ /**
+ * The list of custom schema fragment DONs which are to be aggregated.
+ *
+ */
+ customSchemaFragmentIds: string[];
+ /**
+ * The leaf type. Used for inferring the default stage diagram and
+ * tenant fragment ID.
+ *
+ */
+ leafType?: string;
+ /** Per object schema, if associated with the leaf type. */
+ perObjectSchema?: DevRev.FieldDescriptor[];
+ /** The stock schema fragment which is to be aggregated. */
+ stockSchemaFragmentId?: string;
+}
diff --git a/src/api/resources/customization/client/requests/CustomSchemaFragmentsGetQuery.ts b/src/api/resources/customization/client/requests/CustomSchemaFragmentsGetQuery.ts
new file mode 100644
index 0000000..4eba27e
--- /dev/null
+++ b/src/api/resources/customization/client/requests/CustomSchemaFragmentsGetQuery.ts
@@ -0,0 +1,16 @@
+/**
+ * This file was auto-generated by Fern from our API Definition.
+ */
+
+/**
+ * @example
+ * {
+ * id: "string"
+ * }
+ */
+export interface CustomSchemaFragmentsGetQuery {
+ /**
+ * The ID of the custom schema fragment.
+ */
+ id: string;
+}
diff --git a/src/api/resources/customization/client/requests/CustomSchemaFragmentsGetRequest.ts b/src/api/resources/customization/client/requests/CustomSchemaFragmentsGetRequest.ts
new file mode 100644
index 0000000..25b40eb
--- /dev/null
+++ b/src/api/resources/customization/client/requests/CustomSchemaFragmentsGetRequest.ts
@@ -0,0 +1,14 @@
+/**
+ * This file was auto-generated by Fern from our API Definition.
+ */
+
+/**
+ * @example
+ * {
+ * id: "string"
+ * }
+ */
+export interface CustomSchemaFragmentsGetRequest {
+ /** The ID of the custom schema fragment. */
+ id: string;
+}
diff --git a/src/api/resources/customization/client/requests/CustomSchemaFragmentsListQuery.ts b/src/api/resources/customization/client/requests/CustomSchemaFragmentsListQuery.ts
new file mode 100644
index 0000000..f025b8f
--- /dev/null
+++ b/src/api/resources/customization/client/requests/CustomSchemaFragmentsListQuery.ts
@@ -0,0 +1,55 @@
+/**
+ * This file was auto-generated by Fern from our API Definition.
+ */
+
+import * as DevRev from "../../../../index";
+
+/**
+ * @example
+ * {}
+ */
+export interface CustomSchemaFragmentsListQuery {
+ /**
+ * The list of app names.
+ */
+ app?: string | string[];
+ /**
+ * The cursor to resume iteration from. If not provided, then iteration
+ * starts from the beginning.
+ */
+ cursor?: string;
+ /**
+ * Whether only deprecated fragments should be filtered.
+ */
+ deprecated?: boolean;
+ /**
+ * The list of leaf types.
+ */
+ leafType?: string | string[];
+ /**
+ * The maximum number of items.
+ */
+ limit?: number;
+ /**
+ * The iteration mode to use, otherwise if not set, then "after" is
+ * used.
+ */
+ mode?: DevRev.ListMode;
+ /**
+ * List of fields which are not required in the payload and can be
+ * pruned away.
+ */
+ prune?: DevRev.CustomSchemaFragmentsListRequestPrune | DevRev.CustomSchemaFragmentsListRequestPrune[];
+ /**
+ * The list of fields to sort the items by and how to sort them.
+ */
+ sortBy?: string | string[];
+ /**
+ * The list of subtypes.
+ */
+ subtype?: string | string[];
+ /**
+ * Filters for custom schema fragment of the provided types.
+ */
+ types?: DevRev.CustomSchemaFragmentType | DevRev.CustomSchemaFragmentType[];
+}
diff --git a/src/api/resources/customization/client/requests/CustomSchemaFragmentsListRequest.ts b/src/api/resources/customization/client/requests/CustomSchemaFragmentsListRequest.ts
new file mode 100644
index 0000000..904c586
--- /dev/null
+++ b/src/api/resources/customization/client/requests/CustomSchemaFragmentsListRequest.ts
@@ -0,0 +1,45 @@
+/**
+ * This file was auto-generated by Fern from our API Definition.
+ */
+
+import * as DevRev from "../../../../index";
+
+/**
+ * @example
+ * {}
+ */
+export interface CustomSchemaFragmentsListRequest {
+ /** The list of app names. */
+ app?: string[];
+ /**
+ * The cursor to resume iteration from. If not provided, then
+ * iteration starts from the beginning.
+ *
+ */
+ cursor?: string;
+ /** Whether only deprecated fragments should be filtered. */
+ deprecated?: boolean;
+ /** The list of leaf types. */
+ leafType?: string[];
+ /** The maximum number of items. */
+ limit?: number;
+ mode?: DevRev.ListMode;
+ /**
+ * List of fields which are not required in the payload and can be
+ * pruned away.
+ *
+ */
+ prune?: DevRev.CustomSchemaFragmentsListRequestPrune[];
+ /**
+ * The list of fields to sort the items by and how to sort them.
+ *
+ */
+ sortBy?: string[];
+ /** The list of subtypes. */
+ subtype?: string[];
+ /**
+ * Filters for custom schema fragment of the provided types.
+ *
+ */
+ types?: DevRev.CustomSchemaFragmentType[];
+}
diff --git a/src/api/resources/customization/client/requests/CustomStagesCreateRequest.ts b/src/api/resources/customization/client/requests/CustomStagesCreateRequest.ts
new file mode 100644
index 0000000..70eefa6
--- /dev/null
+++ b/src/api/resources/customization/client/requests/CustomStagesCreateRequest.ts
@@ -0,0 +1,26 @@
+/**
+ * This file was auto-generated by Fern from our API Definition.
+ */
+
+/**
+ * @example
+ * {
+ * name: "name",
+ * ordinal: 1,
+ * state: "state"
+ * }
+ */
+export interface CustomStagesCreateRequest {
+ /**
+ * A reference to the marketplace item from which this stage was
+ * imported.
+ *
+ */
+ marketplaceRef?: string;
+ /** The name of the custom stage. */
+ name: string;
+ /** The ordinal of the custom stage used for ordering. */
+ ordinal: number;
+ /** The state ID. */
+ state: string;
+}
diff --git a/src/api/resources/customization/client/requests/CustomStagesGetQuery.ts b/src/api/resources/customization/client/requests/CustomStagesGetQuery.ts
new file mode 100644
index 0000000..c3a91ef
--- /dev/null
+++ b/src/api/resources/customization/client/requests/CustomStagesGetQuery.ts
@@ -0,0 +1,16 @@
+/**
+ * This file was auto-generated by Fern from our API Definition.
+ */
+
+/**
+ * @example
+ * {
+ * id: "id"
+ * }
+ */
+export interface CustomStagesGetQuery {
+ /**
+ * The ID of the custom stage to get.
+ */
+ id: string;
+}
diff --git a/src/api/resources/customization/client/requests/CustomStagesGetRequest.ts b/src/api/resources/customization/client/requests/CustomStagesGetRequest.ts
new file mode 100644
index 0000000..0396900
--- /dev/null
+++ b/src/api/resources/customization/client/requests/CustomStagesGetRequest.ts
@@ -0,0 +1,14 @@
+/**
+ * This file was auto-generated by Fern from our API Definition.
+ */
+
+/**
+ * @example
+ * {
+ * id: "id"
+ * }
+ */
+export interface CustomStagesGetRequest {
+ /** The ID of the custom stage to get. */
+ id: string;
+}
diff --git a/src/api/resources/customization/client/requests/CustomStagesListQuery.ts b/src/api/resources/customization/client/requests/CustomStagesListQuery.ts
new file mode 100644
index 0000000..4a54015
--- /dev/null
+++ b/src/api/resources/customization/client/requests/CustomStagesListQuery.ts
@@ -0,0 +1,31 @@
+/**
+ * This file was auto-generated by Fern from our API Definition.
+ */
+
+/**
+ * @example
+ * {}
+ */
+export interface CustomStagesListQuery {
+ /**
+ * The cursor to resume iteration from, otherwise if not provided, then
+ * iteration starts from the beginning.
+ */
+ cursor?: string;
+ /**
+ * The maximum number of items.
+ */
+ limit?: number;
+ /**
+ * The list of stage names.
+ */
+ name?: string | string[];
+ /**
+ * The list of stage ordinals.
+ */
+ ordinal?: number | number[];
+ /**
+ * The list of fields to sort the items by and how to sort them.
+ */
+ sortBy?: string | string[];
+}
diff --git a/src/api/resources/customization/client/requests/CustomStagesListRequest.ts b/src/api/resources/customization/client/requests/CustomStagesListRequest.ts
new file mode 100644
index 0000000..fb1f2e5
--- /dev/null
+++ b/src/api/resources/customization/client/requests/CustomStagesListRequest.ts
@@ -0,0 +1,27 @@
+/**
+ * This file was auto-generated by Fern from our API Definition.
+ */
+
+/**
+ * @example
+ * {}
+ */
+export interface CustomStagesListRequest {
+ /**
+ * The cursor to resume iteration from, otherwise if not provided,
+ * then iteration starts from the beginning.
+ *
+ */
+ cursor?: string;
+ /** The maximum number of items. */
+ limit?: number;
+ /** The list of stage names. */
+ name?: string[];
+ /** The list of stage ordinals. */
+ ordinal?: number[];
+ /**
+ * The list of fields to sort the items by and how to sort them.
+ *
+ */
+ sortBy?: string[];
+}
diff --git a/src/api/resources/customization/client/requests/CustomStagesUpdateRequest.ts b/src/api/resources/customization/client/requests/CustomStagesUpdateRequest.ts
new file mode 100644
index 0000000..42ee31f
--- /dev/null
+++ b/src/api/resources/customization/client/requests/CustomStagesUpdateRequest.ts
@@ -0,0 +1,20 @@
+/**
+ * This file was auto-generated by Fern from our API Definition.
+ */
+
+/**
+ * @example
+ * {
+ * id: "id"
+ * }
+ */
+export interface CustomStagesUpdateRequest {
+ /** The ID of the custom stage to update. */
+ id: string;
+ /** The updated name of the custom stage. */
+ name?: string;
+ /** The ordinal of the custom stage. */
+ ordinal?: number;
+ /** The state ID. */
+ stateId?: string;
+}
diff --git a/src/api/resources/customization/client/requests/CustomStatesCreateRequest.ts b/src/api/resources/customization/client/requests/CustomStatesCreateRequest.ts
new file mode 100644
index 0000000..b2936a4
--- /dev/null
+++ b/src/api/resources/customization/client/requests/CustomStatesCreateRequest.ts
@@ -0,0 +1,22 @@
+/**
+ * This file was auto-generated by Fern from our API Definition.
+ */
+
+/**
+ * @example
+ * {
+ * name: "name",
+ * ordinal: 1
+ * }
+ */
+export interface CustomStatesCreateRequest {
+ /** Whether this is a final state. */
+ isFinal?: boolean;
+ /** The name of the custom state. */
+ name: string;
+ /**
+ * Ordinal of the custom state used to identify system states.
+ *
+ */
+ ordinal: number;
+}
diff --git a/src/api/resources/customization/client/requests/CustomStatesGetQuery.ts b/src/api/resources/customization/client/requests/CustomStatesGetQuery.ts
new file mode 100644
index 0000000..247f249
--- /dev/null
+++ b/src/api/resources/customization/client/requests/CustomStatesGetQuery.ts
@@ -0,0 +1,16 @@
+/**
+ * This file was auto-generated by Fern from our API Definition.
+ */
+
+/**
+ * @example
+ * {
+ * id: "id"
+ * }
+ */
+export interface CustomStatesGetQuery {
+ /**
+ * The ID of the custom state to get.
+ */
+ id: string;
+}
diff --git a/src/api/resources/customization/client/requests/CustomStatesGetRequest.ts b/src/api/resources/customization/client/requests/CustomStatesGetRequest.ts
new file mode 100644
index 0000000..8ad737d
--- /dev/null
+++ b/src/api/resources/customization/client/requests/CustomStatesGetRequest.ts
@@ -0,0 +1,14 @@
+/**
+ * This file was auto-generated by Fern from our API Definition.
+ */
+
+/**
+ * @example
+ * {
+ * id: "id"
+ * }
+ */
+export interface CustomStatesGetRequest {
+ /** The ID of the custom state to get. */
+ id: string;
+}
diff --git a/src/api/resources/customization/client/requests/CustomStatesListQuery.ts b/src/api/resources/customization/client/requests/CustomStatesListQuery.ts
new file mode 100644
index 0000000..2937472
--- /dev/null
+++ b/src/api/resources/customization/client/requests/CustomStatesListQuery.ts
@@ -0,0 +1,35 @@
+/**
+ * This file was auto-generated by Fern from our API Definition.
+ */
+
+/**
+ * @example
+ * {}
+ */
+export interface CustomStatesListQuery {
+ /**
+ * The cursor to resume iteration from, otherwise if not provided, then
+ * iteration starts from the beginning.
+ */
+ cursor?: string;
+ /**
+ * Whether only final states should be filtered.
+ */
+ isFinal?: boolean;
+ /**
+ * The maximum number of items.
+ */
+ limit?: number;
+ /**
+ * The list of state names.
+ */
+ name?: string | string[];
+ /**
+ * The list of state ordinals.
+ */
+ ordinal?: number | number[];
+ /**
+ * The list of fields to sort the items by and how to sort them.
+ */
+ sortBy?: string | string[];
+}
diff --git a/src/api/resources/customization/client/requests/CustomStatesListRequest.ts b/src/api/resources/customization/client/requests/CustomStatesListRequest.ts
new file mode 100644
index 0000000..46b8d8d
--- /dev/null
+++ b/src/api/resources/customization/client/requests/CustomStatesListRequest.ts
@@ -0,0 +1,29 @@
+/**
+ * This file was auto-generated by Fern from our API Definition.
+ */
+
+/**
+ * @example
+ * {}
+ */
+export interface CustomStatesListRequest {
+ /**
+ * The cursor to resume iteration from, otherwise if not provided,
+ * then iteration starts from the beginning.
+ *
+ */
+ cursor?: string;
+ /** Whether only final states should be filtered. */
+ isFinal?: boolean;
+ /** The maximum number of items. */
+ limit?: number;
+ /** The list of state names. */
+ name?: string[];
+ /** The list of state ordinals. */
+ ordinal?: number[];
+ /**
+ * The list of fields to sort the items by and how to sort them.
+ *
+ */
+ sortBy?: string[];
+}
diff --git a/src/api/resources/customization/client/requests/CustomStatesUpdateRequest.ts b/src/api/resources/customization/client/requests/CustomStatesUpdateRequest.ts
new file mode 100644
index 0000000..6588792
--- /dev/null
+++ b/src/api/resources/customization/client/requests/CustomStatesUpdateRequest.ts
@@ -0,0 +1,23 @@
+/**
+ * This file was auto-generated by Fern from our API Definition.
+ */
+
+/**
+ * @example
+ * {
+ * id: "id"
+ * }
+ */
+export interface CustomStatesUpdateRequest {
+ /** The ID of the custom state to update. */
+ id: string;
+ /** Whether this is a final state. */
+ isFinal?: boolean;
+ /** The name of the custom state. */
+ name?: string;
+ /**
+ * Ordinal of the custom state used to identify system states.
+ *
+ */
+ ordinal?: number;
+}
diff --git a/src/api/resources/customization/client/requests/StockSchemaFragmentsGetQuery.ts b/src/api/resources/customization/client/requests/StockSchemaFragmentsGetQuery.ts
new file mode 100644
index 0000000..1191fde
--- /dev/null
+++ b/src/api/resources/customization/client/requests/StockSchemaFragmentsGetQuery.ts
@@ -0,0 +1,18 @@
+/**
+ * This file was auto-generated by Fern from our API Definition.
+ */
+
+/**
+ * @example
+ * {}
+ */
+export interface StockSchemaFragmentsGetQuery {
+ /**
+ * The ID of the stock schema fragment.
+ */
+ id?: string;
+ /**
+ * The leaf type this fragment applies to.
+ */
+ leafType?: string;
+}
diff --git a/src/api/resources/customization/client/requests/StockSchemaFragmentsGetRequest.ts b/src/api/resources/customization/client/requests/StockSchemaFragmentsGetRequest.ts
new file mode 100644
index 0000000..f7cf733
--- /dev/null
+++ b/src/api/resources/customization/client/requests/StockSchemaFragmentsGetRequest.ts
@@ -0,0 +1,14 @@
+/**
+ * This file was auto-generated by Fern from our API Definition.
+ */
+
+/**
+ * @example
+ * {}
+ */
+export interface StockSchemaFragmentsGetRequest {
+ /** The ID of the stock schema fragment. */
+ id?: string;
+ /** The leaf type this fragment applies to. */
+ leafType?: string;
+}
diff --git a/src/api/resources/customization/client/requests/StockSchemaFragmentsListQuery.ts b/src/api/resources/customization/client/requests/StockSchemaFragmentsListQuery.ts
new file mode 100644
index 0000000..59b2706
--- /dev/null
+++ b/src/api/resources/customization/client/requests/StockSchemaFragmentsListQuery.ts
@@ -0,0 +1,44 @@
+/**
+ * This file was auto-generated by Fern from our API Definition.
+ */
+
+import * as DevRev from "../../../../index";
+
+/**
+ * @example
+ * {}
+ */
+export interface StockSchemaFragmentsListQuery {
+ /**
+ * The cursor to resume iteration from. If not provided, then iteration
+ * starts from the beginning.
+ */
+ cursor?: string;
+ /**
+ * Filter preset to specify whether to filter only customization enabled
+ * leaf types.
+ */
+ filterPreset?: DevRev.StockSchemaFragmentsListRequestFilterPreset;
+ /**
+ * The list of leaf types.
+ */
+ leafType?: string | string[];
+ /**
+ * The maximum number of items.
+ */
+ limit?: number;
+ /**
+ * The iteration mode to use, otherwise if not set, then "after" is
+ * used.
+ */
+ mode?: DevRev.ListMode;
+ /**
+ * List of fields which are not required in the payload and can be
+ * pruned away.
+ */
+ prune?: DevRev.StockSchemaFragmentsListRequestPrune | DevRev.StockSchemaFragmentsListRequestPrune[];
+ /**
+ * The list of fields to sort the items by and how to sort them.
+ */
+ sortBy?: string | string[];
+}
diff --git a/src/api/resources/customization/client/requests/StockSchemaFragmentsListRequest.ts b/src/api/resources/customization/client/requests/StockSchemaFragmentsListRequest.ts
new file mode 100644
index 0000000..d83c598
--- /dev/null
+++ b/src/api/resources/customization/client/requests/StockSchemaFragmentsListRequest.ts
@@ -0,0 +1,35 @@
+/**
+ * This file was auto-generated by Fern from our API Definition.
+ */
+
+import * as DevRev from "../../../../index";
+
+/**
+ * @example
+ * {}
+ */
+export interface StockSchemaFragmentsListRequest {
+ /**
+ * The cursor to resume iteration from. If not provided, then
+ * iteration starts from the beginning.
+ *
+ */
+ cursor?: string;
+ filterPreset?: DevRev.StockSchemaFragmentsListRequestFilterPreset;
+ /** The list of leaf types. */
+ leafType?: string[];
+ /** The maximum number of items. */
+ limit?: number;
+ mode?: DevRev.ListMode;
+ /**
+ * List of fields which are not required in the payload and can be
+ * pruned away.
+ *
+ */
+ prune?: DevRev.StockSchemaFragmentsListRequestPrune[];
+ /**
+ * The list of fields to sort the items by and how to sort them.
+ *
+ */
+ sortBy?: string[];
+}
diff --git a/src/api/resources/customization/client/requests/SubtypesListQuery.ts b/src/api/resources/customization/client/requests/SubtypesListQuery.ts
new file mode 100644
index 0000000..638f57a
--- /dev/null
+++ b/src/api/resources/customization/client/requests/SubtypesListQuery.ts
@@ -0,0 +1,18 @@
+/**
+ * This file was auto-generated by Fern from our API Definition.
+ */
+
+/**
+ * @example
+ * {}
+ */
+export interface SubtypesListQuery {
+ /**
+ * Leaf type for which subtypes are required.
+ */
+ leafType?: string;
+ /**
+ * List of leaf types for which subtypes are required.
+ */
+ leafTypes?: string | string[];
+}
diff --git a/src/api/resources/customization/client/requests/SubtypesListRequest.ts b/src/api/resources/customization/client/requests/SubtypesListRequest.ts
new file mode 100644
index 0000000..a7e95b6
--- /dev/null
+++ b/src/api/resources/customization/client/requests/SubtypesListRequest.ts
@@ -0,0 +1,14 @@
+/**
+ * This file was auto-generated by Fern from our API Definition.
+ */
+
+/**
+ * @example
+ * {}
+ */
+export interface SubtypesListRequest {
+ /** Leaf type for which subtypes are required. */
+ leafType?: string;
+ /** List of leaf types for which subtypes are required. */
+ leafTypes?: string[];
+}
diff --git a/src/api/resources/customization/client/requests/index.ts b/src/api/resources/customization/client/requests/index.ts
new file mode 100644
index 0000000..3c7df86
--- /dev/null
+++ b/src/api/resources/customization/client/requests/index.ts
@@ -0,0 +1,24 @@
+export { type AggregatedSchemaGetQuery } from "./AggregatedSchemaGetQuery";
+export { type AggregatedSchemaGetRequest } from "./AggregatedSchemaGetRequest";
+export { type CustomSchemaFragmentsGetQuery } from "./CustomSchemaFragmentsGetQuery";
+export { type CustomSchemaFragmentsGetRequest } from "./CustomSchemaFragmentsGetRequest";
+export { type CustomSchemaFragmentsListQuery } from "./CustomSchemaFragmentsListQuery";
+export { type CustomSchemaFragmentsListRequest } from "./CustomSchemaFragmentsListRequest";
+export { type StockSchemaFragmentsGetQuery } from "./StockSchemaFragmentsGetQuery";
+export { type StockSchemaFragmentsGetRequest } from "./StockSchemaFragmentsGetRequest";
+export { type StockSchemaFragmentsListQuery } from "./StockSchemaFragmentsListQuery";
+export { type StockSchemaFragmentsListRequest } from "./StockSchemaFragmentsListRequest";
+export { type SubtypesListQuery } from "./SubtypesListQuery";
+export { type SubtypesListRequest } from "./SubtypesListRequest";
+export { type CustomStagesCreateRequest } from "./CustomStagesCreateRequest";
+export { type CustomStagesGetQuery } from "./CustomStagesGetQuery";
+export { type CustomStagesGetRequest } from "./CustomStagesGetRequest";
+export { type CustomStagesListQuery } from "./CustomStagesListQuery";
+export { type CustomStagesListRequest } from "./CustomStagesListRequest";
+export { type CustomStagesUpdateRequest } from "./CustomStagesUpdateRequest";
+export { type CustomStatesCreateRequest } from "./CustomStatesCreateRequest";
+export { type CustomStatesGetQuery } from "./CustomStatesGetQuery";
+export { type CustomStatesGetRequest } from "./CustomStatesGetRequest";
+export { type CustomStatesListQuery } from "./CustomStatesListQuery";
+export { type CustomStatesListRequest } from "./CustomStatesListRequest";
+export { type CustomStatesUpdateRequest } from "./CustomStatesUpdateRequest";
diff --git a/src/api/resources/customization/index.ts b/src/api/resources/customization/index.ts
new file mode 100644
index 0000000..5ec7692
--- /dev/null
+++ b/src/api/resources/customization/index.ts
@@ -0,0 +1 @@
+export * from "./client";
diff --git a/src/api/resources/devUsers/client/Client.ts b/src/api/resources/devUsers/client/Client.ts
new file mode 100644
index 0000000..b365a6b
--- /dev/null
+++ b/src/api/resources/devUsers/client/Client.ts
@@ -0,0 +1,620 @@
+/**
+ * This file was auto-generated by Fern from our API Definition.
+ */
+
+import * as environments from "../../../../environments";
+import * as core from "../../../../core";
+import * as DevRev from "../../../index";
+import * as serializers from "../../../../serialization/index";
+import urlJoin from "url-join";
+import * as errors from "../../../../errors/index";
+
+export declare namespace DevUsers {
+ interface Options {
+ environment?: core.Supplier;
+ token?: 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;
+ }
+}
+
+/**
+ * Dev user interactions.
+ */
+export class DevUsers {
+ constructor(protected readonly _options: DevUsers.Options = {}) {}
+
+ /**
+ * Links an external/secondary identity to the Dev user.
+ *
+ * @param {DevRev.DevUsersIdentitiesLinkRequest} request
+ * @param {DevUsers.RequestOptions} requestOptions - Request-specific configuration.
+ *
+ * @throws {@link DevRev.BadRequestError}
+ * @throws {@link DevRev.UnauthorizedError}
+ * @throws {@link DevRev.ForbiddenError}
+ * @throws {@link DevRev.NotFoundError}
+ * @throws {@link DevRev.TooManyRequestsError}
+ * @throws {@link DevRev.InternalServerError}
+ * @throws {@link DevRev.ServiceUnavailableError}
+ *
+ * @example
+ * await client.devUsers.identitiesLink({
+ * devUser: "dev_user",
+ * id: "id",
+ * issuer: "issuer"
+ * })
+ */
+ public async identitiesLink(
+ request: DevRev.DevUsersIdentitiesLinkRequest,
+ requestOptions?: DevUsers.RequestOptions
+ ): Promise {
+ const _response = await (this._options.fetcher ?? core.fetcher)({
+ url: urlJoin(
+ (await core.Supplier.get(this._options.environment)) ?? environments.DevRevEnvironment.Default,
+ "dev-users.identities.link"
+ ),
+ method: "POST",
+ headers: {
+ Authorization: await this._getAuthorizationHeader(),
+ "X-Fern-Language": "JavaScript",
+ "X-Fern-SDK-Name": "@devrev/api",
+ "X-Fern-SDK-Version": "0.0.14",
+ "X-Fern-Runtime": core.RUNTIME.type,
+ "X-Fern-Runtime-Version": core.RUNTIME.version,
+ },
+ contentType: "application/json",
+ requestType: "json",
+ body: serializers.DevUsersIdentitiesLinkRequest.jsonOrThrow(request, { unrecognizedObjectKeys: "strip" }),
+ timeoutMs: requestOptions?.timeoutInSeconds != null ? requestOptions.timeoutInSeconds * 1000 : 60000,
+ maxRetries: requestOptions?.maxRetries,
+ abortSignal: requestOptions?.abortSignal,
+ });
+ if (_response.ok) {
+ return serializers.DevUsersIdentitiesLinkResponse.parseOrThrow(_response.body, {
+ unrecognizedObjectKeys: "passthrough",
+ allowUnrecognizedUnionMembers: true,
+ allowUnrecognizedEnumValues: true,
+ skipValidation: true,
+ breadcrumbsPrefix: ["response"],
+ });
+ }
+
+ if (_response.error.reason === "status-code") {
+ switch (_response.error.statusCode) {
+ case 400:
+ throw new DevRev.BadRequestError(
+ serializers.ErrorBadRequest.parseOrThrow(_response.error.body, {
+ unrecognizedObjectKeys: "passthrough",
+ allowUnrecognizedUnionMembers: true,
+ allowUnrecognizedEnumValues: true,
+ skipValidation: true,
+ breadcrumbsPrefix: ["response"],
+ })
+ );
+ case 401:
+ throw new DevRev.UnauthorizedError(
+ serializers.ErrorUnauthorized.parseOrThrow(_response.error.body, {
+ unrecognizedObjectKeys: "passthrough",
+ allowUnrecognizedUnionMembers: true,
+ allowUnrecognizedEnumValues: true,
+ skipValidation: true,
+ breadcrumbsPrefix: ["response"],
+ })
+ );
+ case 403:
+ throw new DevRev.ForbiddenError(
+ serializers.ErrorForbidden.parseOrThrow(_response.error.body, {
+ unrecognizedObjectKeys: "passthrough",
+ allowUnrecognizedUnionMembers: true,
+ allowUnrecognizedEnumValues: true,
+ skipValidation: true,
+ breadcrumbsPrefix: ["response"],
+ })
+ );
+ case 404:
+ throw new DevRev.NotFoundError(
+ serializers.ErrorNotFound.parseOrThrow(_response.error.body, {
+ unrecognizedObjectKeys: "passthrough",
+ allowUnrecognizedUnionMembers: true,
+ allowUnrecognizedEnumValues: true,
+ skipValidation: true,
+ breadcrumbsPrefix: ["response"],
+ })
+ );
+ case 429:
+ throw new DevRev.TooManyRequestsError(
+ serializers.ErrorTooManyRequests.parseOrThrow(_response.error.body, {
+ unrecognizedObjectKeys: "passthrough",
+ allowUnrecognizedUnionMembers: true,
+ allowUnrecognizedEnumValues: true,
+ skipValidation: true,
+ breadcrumbsPrefix: ["response"],
+ })
+ );
+ case 500:
+ throw new DevRev.InternalServerError(
+ serializers.ErrorInternalServerError.parseOrThrow(_response.error.body, {
+ unrecognizedObjectKeys: "passthrough",
+ allowUnrecognizedUnionMembers: true,
+ allowUnrecognizedEnumValues: true,
+ skipValidation: true,
+ breadcrumbsPrefix: ["response"],
+ })
+ );
+ case 503:
+ throw new DevRev.ServiceUnavailableError(
+ serializers.ErrorServiceUnavailable.parseOrThrow(_response.error.body, {
+ unrecognizedObjectKeys: "passthrough",
+ allowUnrecognizedUnionMembers: true,
+ allowUnrecognizedEnumValues: true,
+ skipValidation: true,
+ breadcrumbsPrefix: ["response"],
+ })
+ );
+ default:
+ throw new errors.DevRevError({
+ statusCode: _response.error.statusCode,
+ body: _response.error.body,
+ });
+ }
+ }
+
+ switch (_response.error.reason) {
+ case "non-json":
+ throw new errors.DevRevError({
+ statusCode: _response.error.statusCode,
+ body: _response.error.rawBody,
+ });
+ case "timeout":
+ throw new errors.DevRevTimeoutError();
+ case "unknown":
+ throw new errors.DevRevError({
+ message: _response.error.errorMessage,
+ });
+ }
+ }
+
+ /**
+ * Unlinks an external/secondary identity from the Dev user.
+ *
+ * @param {DevRev.DevUsersIdentitiesUnlinkRequest} request
+ * @param {DevUsers.RequestOptions} requestOptions - Request-specific configuration.
+ *
+ * @throws {@link DevRev.BadRequestError}
+ * @throws {@link DevRev.UnauthorizedError}
+ * @throws {@link DevRev.ForbiddenError}
+ * @throws {@link DevRev.NotFoundError}
+ * @throws {@link DevRev.TooManyRequestsError}
+ * @throws {@link DevRev.InternalServerError}
+ * @throws {@link DevRev.ServiceUnavailableError}
+ *
+ * @example
+ * await client.devUsers.identitiesUnlink({
+ * devUser: "dev_user",
+ * issuer: "issuer"
+ * })
+ */
+ public async identitiesUnlink(
+ request: DevRev.DevUsersIdentitiesUnlinkRequest,
+ requestOptions?: DevUsers.RequestOptions
+ ): Promise {
+ const _response = await (this._options.fetcher ?? core.fetcher)({
+ url: urlJoin(
+ (await core.Supplier.get(this._options.environment)) ?? environments.DevRevEnvironment.Default,
+ "dev-users.identities.unlink"
+ ),
+ method: "POST",
+ headers: {
+ Authorization: await this._getAuthorizationHeader(),
+ "X-Fern-Language": "JavaScript",
+ "X-Fern-SDK-Name": "@devrev/api",
+ "X-Fern-SDK-Version": "0.0.14",
+ "X-Fern-Runtime": core.RUNTIME.type,
+ "X-Fern-Runtime-Version": core.RUNTIME.version,
+ },
+ contentType: "application/json",
+ requestType: "json",
+ body: serializers.DevUsersIdentitiesUnlinkRequest.jsonOrThrow(request, { unrecognizedObjectKeys: "strip" }),
+ timeoutMs: requestOptions?.timeoutInSeconds != null ? requestOptions.timeoutInSeconds * 1000 : 60000,
+ maxRetries: requestOptions?.maxRetries,
+ abortSignal: requestOptions?.abortSignal,
+ });
+ if (_response.ok) {
+ return serializers.DevUsersIdentitiesUnlinkResponse.parseOrThrow(_response.body, {
+ unrecognizedObjectKeys: "passthrough",
+ allowUnrecognizedUnionMembers: true,
+ allowUnrecognizedEnumValues: true,
+ skipValidation: true,
+ breadcrumbsPrefix: ["response"],
+ });
+ }
+
+ if (_response.error.reason === "status-code") {
+ switch (_response.error.statusCode) {
+ case 400:
+ throw new DevRev.BadRequestError(
+ serializers.ErrorBadRequest.parseOrThrow(_response.error.body, {
+ unrecognizedObjectKeys: "passthrough",
+ allowUnrecognizedUnionMembers: true,
+ allowUnrecognizedEnumValues: true,
+ skipValidation: true,
+ breadcrumbsPrefix: ["response"],
+ })
+ );
+ case 401:
+ throw new DevRev.UnauthorizedError(
+ serializers.ErrorUnauthorized.parseOrThrow(_response.error.body, {
+ unrecognizedObjectKeys: "passthrough",
+ allowUnrecognizedUnionMembers: true,
+ allowUnrecognizedEnumValues: true,
+ skipValidation: true,
+ breadcrumbsPrefix: ["response"],
+ })
+ );
+ case 403:
+ throw new DevRev.ForbiddenError(
+ serializers.ErrorForbidden.parseOrThrow(_response.error.body, {
+ unrecognizedObjectKeys: "passthrough",
+ allowUnrecognizedUnionMembers: true,
+ allowUnrecognizedEnumValues: true,
+ skipValidation: true,
+ breadcrumbsPrefix: ["response"],
+ })
+ );
+ case 404:
+ throw new DevRev.NotFoundError(
+ serializers.ErrorNotFound.parseOrThrow(_response.error.body, {
+ unrecognizedObjectKeys: "passthrough",
+ allowUnrecognizedUnionMembers: true,
+ allowUnrecognizedEnumValues: true,
+ skipValidation: true,
+ breadcrumbsPrefix: ["response"],
+ })
+ );
+ case 429:
+ throw new DevRev.TooManyRequestsError(
+ serializers.ErrorTooManyRequests.parseOrThrow(_response.error.body, {
+ unrecognizedObjectKeys: "passthrough",
+ allowUnrecognizedUnionMembers: true,
+ allowUnrecognizedEnumValues: true,
+ skipValidation: true,
+ breadcrumbsPrefix: ["response"],
+ })
+ );
+ case 500:
+ throw new DevRev.InternalServerError(
+ serializers.ErrorInternalServerError.parseOrThrow(_response.error.body, {
+ unrecognizedObjectKeys: "passthrough",
+ allowUnrecognizedUnionMembers: true,
+ allowUnrecognizedEnumValues: true,
+ skipValidation: true,
+ breadcrumbsPrefix: ["response"],
+ })
+ );
+ case 503:
+ throw new DevRev.ServiceUnavailableError(
+ serializers.ErrorServiceUnavailable.parseOrThrow(_response.error.body, {
+ unrecognizedObjectKeys: "passthrough",
+ allowUnrecognizedUnionMembers: true,
+ allowUnrecognizedEnumValues: true,
+ skipValidation: true,
+ breadcrumbsPrefix: ["response"],
+ })
+ );
+ default:
+ throw new errors.DevRevError({
+ statusCode: _response.error.statusCode,
+ body: _response.error.body,
+ });
+ }
+ }
+
+ switch (_response.error.reason) {
+ case "non-json":
+ throw new errors.DevRevError({
+ statusCode: _response.error.statusCode,
+ body: _response.error.rawBody,
+ });
+ case "timeout":
+ throw new errors.DevRevTimeoutError();
+ case "unknown":
+ throw new errors.DevRevError({
+ message: _response.error.errorMessage,
+ });
+ }
+ }
+
+ /**
+ * Updates the authenticated user.
+ *
+ * @param {DevRev.DevUsersSelfUpdateRequest} request
+ * @param {DevUsers.RequestOptions} requestOptions - Request-specific configuration.
+ *
+ * @throws {@link DevRev.BadRequestError}
+ * @throws {@link DevRev.UnauthorizedError}
+ * @throws {@link DevRev.ForbiddenError}
+ * @throws {@link DevRev.TooManyRequestsError}
+ * @throws {@link DevRev.InternalServerError}
+ * @throws {@link DevRev.ServiceUnavailableError}
+ *
+ * @example
+ * await client.devUsers.selfUpdate()
+ */
+ public async selfUpdate(
+ request: DevRev.DevUsersSelfUpdateRequest = {},
+ requestOptions?: DevUsers.RequestOptions
+ ): Promise {
+ const _response = await (this._options.fetcher ?? core.fetcher)({
+ url: urlJoin(
+ (await core.Supplier.get(this._options.environment)) ?? environments.DevRevEnvironment.Default,
+ "dev-users.self.update"
+ ),
+ method: "POST",
+ headers: {
+ Authorization: await this._getAuthorizationHeader(),
+ "X-Fern-Language": "JavaScript",
+ "X-Fern-SDK-Name": "@devrev/api",
+ "X-Fern-SDK-Version": "0.0.14",
+ "X-Fern-Runtime": core.RUNTIME.type,
+ "X-Fern-Runtime-Version": core.RUNTIME.version,
+ },
+ contentType: "application/json",
+ requestType: "json",
+ body: serializers.DevUsersSelfUpdateRequest.jsonOrThrow(request, { unrecognizedObjectKeys: "strip" }),
+ timeoutMs: requestOptions?.timeoutInSeconds != null ? requestOptions.timeoutInSeconds * 1000 : 60000,
+ maxRetries: requestOptions?.maxRetries,
+ abortSignal: requestOptions?.abortSignal,
+ });
+ if (_response.ok) {
+ return serializers.DevUsersUpdateResponse.parseOrThrow(_response.body, {
+ unrecognizedObjectKeys: "passthrough",
+ allowUnrecognizedUnionMembers: true,
+ allowUnrecognizedEnumValues: true,
+ skipValidation: true,
+ breadcrumbsPrefix: ["response"],
+ });
+ }
+
+ if (_response.error.reason === "status-code") {
+ switch (_response.error.statusCode) {
+ case 400:
+ throw new DevRev.BadRequestError(
+ serializers.ErrorBadRequest.parseOrThrow(_response.error.body, {
+ unrecognizedObjectKeys: "passthrough",
+ allowUnrecognizedUnionMembers: true,
+ allowUnrecognizedEnumValues: true,
+ skipValidation: true,
+ breadcrumbsPrefix: ["response"],
+ })
+ );
+ case 401:
+ throw new DevRev.UnauthorizedError(
+ serializers.ErrorUnauthorized.parseOrThrow(_response.error.body, {
+ unrecognizedObjectKeys: "passthrough",
+ allowUnrecognizedUnionMembers: true,
+ allowUnrecognizedEnumValues: true,
+ skipValidation: true,
+ breadcrumbsPrefix: ["response"],
+ })
+ );
+ case 403:
+ throw new DevRev.ForbiddenError(
+ serializers.ErrorForbidden.parseOrThrow(_response.error.body, {
+ unrecognizedObjectKeys: "passthrough",
+ allowUnrecognizedUnionMembers: true,
+ allowUnrecognizedEnumValues: true,
+ skipValidation: true,
+ breadcrumbsPrefix: ["response"],
+ })
+ );
+ case 429:
+ throw new DevRev.TooManyRequestsError(
+ serializers.ErrorTooManyRequests.parseOrThrow(_response.error.body, {
+ unrecognizedObjectKeys: "passthrough",
+ allowUnrecognizedUnionMembers: true,
+ allowUnrecognizedEnumValues: true,
+ skipValidation: true,
+ breadcrumbsPrefix: ["response"],
+ })
+ );
+ case 500:
+ throw new DevRev.InternalServerError(
+ serializers.ErrorInternalServerError.parseOrThrow(_response.error.body, {
+ unrecognizedObjectKeys: "passthrough",
+ allowUnrecognizedUnionMembers: true,
+ allowUnrecognizedEnumValues: true,
+ skipValidation: true,
+ breadcrumbsPrefix: ["response"],
+ })
+ );
+ case 503:
+ throw new DevRev.ServiceUnavailableError(
+ serializers.ErrorServiceUnavailable.parseOrThrow(_response.error.body, {
+ unrecognizedObjectKeys: "passthrough",
+ allowUnrecognizedUnionMembers: true,
+ allowUnrecognizedEnumValues: true,
+ skipValidation: true,
+ breadcrumbsPrefix: ["response"],
+ })
+ );
+ default:
+ throw new errors.DevRevError({
+ statusCode: _response.error.statusCode,
+ body: _response.error.body,
+ });
+ }
+ }
+
+ switch (_response.error.reason) {
+ case "non-json":
+ throw new errors.DevRevError({
+ statusCode: _response.error.statusCode,
+ body: _response.error.rawBody,
+ });
+ case "timeout":
+ throw new errors.DevRevTimeoutError();
+ case "unknown":
+ throw new errors.DevRevError({
+ message: _response.error.errorMessage,
+ });
+ }
+ }
+
+ /**
+ * Updates the user corresponding to the input Id.
+ *
+ * @param {DevRev.DevUsersUpdateRequest} request
+ * @param {DevUsers.RequestOptions} requestOptions - Request-specific configuration.
+ *
+ * @throws {@link DevRev.BadRequestError}
+ * @throws {@link DevRev.UnauthorizedError}
+ * @throws {@link DevRev.ForbiddenError}
+ * @throws {@link DevRev.TooManyRequestsError}
+ * @throws {@link DevRev.InternalServerError}
+ * @throws {@link DevRev.ServiceUnavailableError}
+ *
+ * @example
+ * await client.devUsers.update({
+ * id: "id"
+ * })
+ */
+ public async update(
+ request: DevRev.DevUsersUpdateRequest,
+ requestOptions?: DevUsers.RequestOptions
+ ): Promise {
+ const _response = await (this._options.fetcher ?? core.fetcher)({
+ url: urlJoin(
+ (await core.Supplier.get(this._options.environment)) ?? environments.DevRevEnvironment.Default,
+ "dev-users.update"
+ ),
+ method: "POST",
+ headers: {
+ Authorization: await this._getAuthorizationHeader(),
+ "X-Fern-Language": "JavaScript",
+ "X-Fern-SDK-Name": "@devrev/api",
+ "X-Fern-SDK-Version": "0.0.14",
+ "X-Fern-Runtime": core.RUNTIME.type,
+ "X-Fern-Runtime-Version": core.RUNTIME.version,
+ },
+ contentType: "application/json",
+ requestType: "json",
+ body: serializers.DevUsersUpdateRequest.jsonOrThrow(request, { unrecognizedObjectKeys: "strip" }),
+ timeoutMs: requestOptions?.timeoutInSeconds != null ? requestOptions.timeoutInSeconds * 1000 : 60000,
+ maxRetries: requestOptions?.maxRetries,
+ abortSignal: requestOptions?.abortSignal,
+ });
+ if (_response.ok) {
+ return serializers.DevUsersUpdateResponse.parseOrThrow(_response.body, {
+ unrecognizedObjectKeys: "passthrough",
+ allowUnrecognizedUnionMembers: true,
+ allowUnrecognizedEnumValues: true,
+ skipValidation: true,
+ breadcrumbsPrefix: ["response"],
+ });
+ }
+
+ if (_response.error.reason === "status-code") {
+ switch (_response.error.statusCode) {
+ case 400:
+ throw new DevRev.BadRequestError(
+ serializers.ErrorBadRequest.parseOrThrow(_response.error.body, {
+ unrecognizedObjectKeys: "passthrough",
+ allowUnrecognizedUnionMembers: true,
+ allowUnrecognizedEnumValues: true,
+ skipValidation: true,
+ breadcrumbsPrefix: ["response"],
+ })
+ );
+ case 401:
+ throw new DevRev.UnauthorizedError(
+ serializers.ErrorUnauthorized.parseOrThrow(_response.error.body, {
+ unrecognizedObjectKeys: "passthrough",
+ allowUnrecognizedUnionMembers: true,
+ allowUnrecognizedEnumValues: true,
+ skipValidation: true,
+ breadcrumbsPrefix: ["response"],
+ })
+ );
+ case 403:
+ throw new DevRev.ForbiddenError(
+ serializers.ErrorForbidden.parseOrThrow(_response.error.body, {
+ unrecognizedObjectKeys: "passthrough",
+ allowUnrecognizedUnionMembers: true,
+ allowUnrecognizedEnumValues: true,
+ skipValidation: true,
+ breadcrumbsPrefix: ["response"],
+ })
+ );
+ case 429:
+ throw new DevRev.TooManyRequestsError(
+ serializers.ErrorTooManyRequests.parseOrThrow(_response.error.body, {
+ unrecognizedObjectKeys: "passthrough",
+ allowUnrecognizedUnionMembers: true,
+ allowUnrecognizedEnumValues: true,
+ skipValidation: true,
+ breadcrumbsPrefix: ["response"],
+ })
+ );
+ case 500:
+ throw new DevRev.InternalServerError(
+ serializers.ErrorInternalServerError.parseOrThrow(_response.error.body, {
+ unrecognizedObjectKeys: "passthrough",
+ allowUnrecognizedUnionMembers: true,
+ allowUnrecognizedEnumValues: true,
+ skipValidation: true,
+ breadcrumbsPrefix: ["response"],
+ })
+ );
+ case 503:
+ throw new DevRev.ServiceUnavailableError(
+ serializers.ErrorServiceUnavailable.parseOrThrow(_response.error.body, {
+ unrecognizedObjectKeys: "passthrough",
+ allowUnrecognizedUnionMembers: true,
+ allowUnrecognizedEnumValues: true,
+ skipValidation: true,
+ breadcrumbsPrefix: ["response"],
+ })
+ );
+ default:
+ throw new errors.DevRevError({
+ statusCode: _response.error.statusCode,
+ body: _response.error.body,
+ });
+ }
+ }
+
+ switch (_response.error.reason) {
+ case "non-json":
+ throw new errors.DevRevError({
+ statusCode: _response.error.statusCode,
+ body: _response.error.rawBody,
+ });
+ case "timeout":
+ throw new errors.DevRevTimeoutError();
+ case "unknown":
+ throw new errors.DevRevError({
+ message: _response.error.errorMessage,
+ });
+ }
+ }
+
+ protected async _getAuthorizationHeader(): Promise {
+ const bearer = (await core.Supplier.get(this._options.token)) ?? process?.env["DEVREV_TOKEN"];
+ if (bearer == null) {
+ throw new errors.DevRevError({
+ message: "Please specify DEVREV_TOKEN when instantiating the client.",
+ });
+ }
+
+ return `Bearer ${bearer}`;
+ }
+}
diff --git a/src/api/resources/devUsers/client/index.ts b/src/api/resources/devUsers/client/index.ts
new file mode 100644
index 0000000..415726b
--- /dev/null
+++ b/src/api/resources/devUsers/client/index.ts
@@ -0,0 +1 @@
+export * from "./requests";
diff --git a/src/api/resources/devUsers/client/requests/DevUsersIdentitiesLinkRequest.ts b/src/api/resources/devUsers/client/requests/DevUsersIdentitiesLinkRequest.ts
new file mode 100644
index 0000000..df4916d
--- /dev/null
+++ b/src/api/resources/devUsers/client/requests/DevUsersIdentitiesLinkRequest.ts
@@ -0,0 +1,22 @@
+/**
+ * This file was auto-generated by Fern from our API Definition.
+ */
+
+/**
+ * @example
+ * {
+ * devUser: "dev_user",
+ * id: "id",
+ * issuer: "issuer"
+ * }
+ */
+export interface DevUsersIdentitiesLinkRequest {
+ /** The ID of the Dev user to link the external identity to. */
+ devUser: string;
+ /** Display name of the Dev user in the external source. */
+ displayName?: string;
+ /** Unique ID of the Dev user in the external source. */
+ id: string;
+ /** Issuer of the external identity of the Dev user. */
+ issuer: string;
+}
diff --git a/src/api/resources/devUsers/client/requests/DevUsersIdentitiesUnlinkRequest.ts b/src/api/resources/devUsers/client/requests/DevUsersIdentitiesUnlinkRequest.ts
new file mode 100644
index 0000000..b4b532e
--- /dev/null
+++ b/src/api/resources/devUsers/client/requests/DevUsersIdentitiesUnlinkRequest.ts
@@ -0,0 +1,20 @@
+/**
+ * This file was auto-generated by Fern from our API Definition.
+ */
+
+/**
+ * @example
+ * {
+ * devUser: "dev_user",
+ * issuer: "issuer"
+ * }
+ */
+export interface DevUsersIdentitiesUnlinkRequest {
+ /**
+ * The ID of the Dev user to unlink the external identity from.
+ *
+ */
+ devUser: string;
+ /** Issuer that needs to be unlinked from a Dev user. */
+ issuer: string;
+}
diff --git a/src/api/resources/devUsers/client/requests/DevUsersSelfUpdateRequest.ts b/src/api/resources/devUsers/client/requests/DevUsersSelfUpdateRequest.ts
new file mode 100644
index 0000000..dee7544
--- /dev/null
+++ b/src/api/resources/devUsers/client/requests/DevUsersSelfUpdateRequest.ts
@@ -0,0 +1,17 @@
+/**
+ * This file was auto-generated by Fern from our API Definition.
+ */
+
+import * as DevRev from "../../../../index";
+
+/**
+ * @example
+ * {}
+ */
+export interface DevUsersSelfUpdateRequest {
+ /** The updated display name of the Dev user. */
+ displayName?: string;
+ /** The updated full name of the Dev user. */
+ fullName?: string;
+ jobTitle?: DevRev.DevUserJobTitle;
+}
diff --git a/src/api/resources/devUsers/client/requests/DevUsersUpdateRequest.ts b/src/api/resources/devUsers/client/requests/DevUsersUpdateRequest.ts
new file mode 100644
index 0000000..9e7d7fc
--- /dev/null
+++ b/src/api/resources/devUsers/client/requests/DevUsersUpdateRequest.ts
@@ -0,0 +1,21 @@
+/**
+ * This file was auto-generated by Fern from our API Definition.
+ */
+
+import * as DevRev from "../../../../index";
+
+/**
+ * @example
+ * {
+ * id: "id"
+ * }
+ */
+export interface DevUsersUpdateRequest {
+ /** The updated display name of the Dev user. */
+ displayName?: string;
+ /** The updated full name of the Dev user. */
+ fullName?: string;
+ /** The ID for the Dev user to be updated. */
+ id: string;
+ jobTitle?: DevRev.DevUserJobTitle;
+}
diff --git a/src/api/resources/devUsers/client/requests/index.ts b/src/api/resources/devUsers/client/requests/index.ts
new file mode 100644
index 0000000..3443b35
--- /dev/null
+++ b/src/api/resources/devUsers/client/requests/index.ts
@@ -0,0 +1,4 @@
+export { type DevUsersIdentitiesLinkRequest } from "./DevUsersIdentitiesLinkRequest";
+export { type DevUsersIdentitiesUnlinkRequest } from "./DevUsersIdentitiesUnlinkRequest";
+export { type DevUsersSelfUpdateRequest } from "./DevUsersSelfUpdateRequest";
+export { type DevUsersUpdateRequest } from "./DevUsersUpdateRequest";
diff --git a/src/api/resources/devUsers/index.ts b/src/api/resources/devUsers/index.ts
new file mode 100644
index 0000000..5ec7692
--- /dev/null
+++ b/src/api/resources/devUsers/index.ts
@@ -0,0 +1 @@
+export * from "./client";
diff --git a/src/api/resources/engagements/client/Client.ts b/src/api/resources/engagements/client/Client.ts
new file mode 100644
index 0000000..9ff0817
--- /dev/null
+++ b/src/api/resources/engagements/client/Client.ts
@@ -0,0 +1,1417 @@
+/**
+ * This file was auto-generated by Fern from our API Definition.
+ */
+
+import * as environments from "../../../../environments";
+import * as core from "../../../../core";
+import * as DevRev from "../../../index";
+import urlJoin from "url-join";
+import * as serializers from "../../../../serialization/index";
+import * as errors from "../../../../errors/index";
+
+export declare namespace Engagements {
+ interface Options {
+ environment?: core.Supplier;
+ token?: 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;
+ }
+}
+
+/**
+ * DevRev engagements.
+ */
+export class Engagements {
+ constructor(protected readonly _options: Engagements.Options = {}) {}
+
+ /**
+ * Counts the engagement records.
+ *
+ * @param {DevRev.EngagementsCountQuery} request
+ * @param {Engagements.RequestOptions} requestOptions - Request-specific configuration.
+ *
+ * @throws {@link DevRev.BadRequestError}
+ * @throws {@link DevRev.UnauthorizedError}
+ * @throws {@link DevRev.ForbiddenError}
+ * @throws {@link DevRev.TooManyRequestsError}
+ * @throws {@link DevRev.InternalServerError}
+ * @throws {@link DevRev.ServiceUnavailableError}
+ *
+ * @example
+ * await client.engagements.count()
+ */
+ public async count(
+ request: DevRev.EngagementsCountQuery = {},
+ requestOptions?: Engagements.RequestOptions
+ ): Promise {
+ const { externalRef, members, parent, type: type_ } = request;
+ const _queryParams: Record = {};
+ if (externalRef != null) {
+ if (Array.isArray(externalRef)) {
+ _queryParams["external_ref"] = externalRef.map((item) => item);
+ } else {
+ _queryParams["external_ref"] = externalRef;
+ }
+ }
+
+ if (members != null) {
+ if (Array.isArray(members)) {
+ _queryParams["members"] = members.map((item) => item);
+ } else {
+ _queryParams["members"] = members;
+ }
+ }
+
+ if (parent != null) {
+ if (Array.isArray(parent)) {
+ _queryParams["parent"] = parent.map((item) => item);
+ } else {
+ _queryParams["parent"] = parent;
+ }
+ }
+
+ if (type_ != null) {
+ if (Array.isArray(type_)) {
+ _queryParams["type"] = type_.map((item) => item);
+ } else {
+ _queryParams["type"] = type_;
+ }
+ }
+
+ const _response = await (this._options.fetcher ?? core.fetcher)({
+ url: urlJoin(
+ (await core.Supplier.get(this._options.environment)) ?? environments.DevRevEnvironment.Default,
+ "engagements.count"
+ ),
+ method: "GET",
+ headers: {
+ Authorization: await this._getAuthorizationHeader(),
+ "X-Fern-Language": "JavaScript",
+ "X-Fern-SDK-Name": "@devrev/api",
+ "X-Fern-SDK-Version": "0.0.14",
+ "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 serializers.EngagementsCountResponse.parseOrThrow(_response.body, {
+ unrecognizedObjectKeys: "passthrough",
+ allowUnrecognizedUnionMembers: true,
+ allowUnrecognizedEnumValues: true,
+ skipValidation: true,
+ breadcrumbsPrefix: ["response"],
+ });
+ }
+
+ if (_response.error.reason === "status-code") {
+ switch (_response.error.statusCode) {
+ case 400:
+ throw new DevRev.BadRequestError(
+ serializers.ErrorBadRequest.parseOrThrow(_response.error.body, {
+ unrecognizedObjectKeys: "passthrough",
+ allowUnrecognizedUnionMembers: true,
+ allowUnrecognizedEnumValues: true,
+ skipValidation: true,
+ breadcrumbsPrefix: ["response"],
+ })
+ );
+ case 401:
+ throw new DevRev.UnauthorizedError(
+ serializers.ErrorUnauthorized.parseOrThrow(_response.error.body, {
+ unrecognizedObjectKeys: "passthrough",
+ allowUnrecognizedUnionMembers: true,
+ allowUnrecognizedEnumValues: true,
+ skipValidation: true,
+ breadcrumbsPrefix: ["response"],
+ })
+ );
+ case 403:
+ throw new DevRev.ForbiddenError(
+ serializers.ErrorForbidden.parseOrThrow(_response.error.body, {
+ unrecognizedObjectKeys: "passthrough",
+ allowUnrecognizedUnionMembers: true,
+ allowUnrecognizedEnumValues: true,
+ skipValidation: true,
+ breadcrumbsPrefix: ["response"],
+ })
+ );
+ case 429:
+ throw new DevRev.TooManyRequestsError(
+ serializers.ErrorTooManyRequests.parseOrThrow(_response.error.body, {
+ unrecognizedObjectKeys: "passthrough",
+ allowUnrecognizedUnionMembers: true,
+ allowUnrecognizedEnumValues: true,
+ skipValidation: true,
+ breadcrumbsPrefix: ["response"],
+ })
+ );
+ case 500:
+ throw new DevRev.InternalServerError(
+ serializers.ErrorInternalServerError.parseOrThrow(_response.error.body, {
+ unrecognizedObjectKeys: "passthrough",
+ allowUnrecognizedUnionMembers: true,
+ allowUnrecognizedEnumValues: true,
+ skipValidation: true,
+ breadcrumbsPrefix: ["response"],
+ })
+ );
+ case 503:
+ throw new DevRev.ServiceUnavailableError(
+ serializers.ErrorServiceUnavailable.parseOrThrow(_response.error.body, {
+ unrecognizedObjectKeys: "passthrough",
+ allowUnrecognizedUnionMembers: true,
+ allowUnrecognizedEnumValues: true,
+ skipValidation: true,
+ breadcrumbsPrefix: ["response"],
+ })
+ );
+ default:
+ throw new errors.DevRevError({
+ statusCode: _response.error.statusCode,
+ body: _response.error.body,
+ });
+ }
+ }
+
+ switch (_response.error.reason) {
+ case "non-json":
+ throw new errors.DevRevError({
+ statusCode: _response.error.statusCode,
+ body: _response.error.rawBody,
+ });
+ case "timeout":
+ throw new errors.DevRevTimeoutError();
+ case "unknown":
+ throw new errors.DevRevError({
+ message: _response.error.errorMessage,
+ });
+ }
+ }
+
+ /**
+ * Counts the engagement records.
+ *
+ * @param {DevRev.EngagementsCountRequest} request
+ * @param {Engagements.RequestOptions} requestOptions - Request-specific configuration.
+ *
+ * @throws {@link DevRev.BadRequestError}
+ * @throws {@link DevRev.UnauthorizedError}
+ * @throws {@link DevRev.ForbiddenError}
+ * @throws {@link DevRev.TooManyRequestsError}
+ * @throws {@link DevRev.InternalServerError}
+ * @throws {@link DevRev.ServiceUnavailableError}
+ *
+ * @example
+ * await client.engagements.countPost()
+ */
+ public async countPost(
+ request: DevRev.EngagementsCountRequest = {},
+ requestOptions?: Engagements.RequestOptions
+ ): Promise {
+ const _response = await (this._options.fetcher ?? core.fetcher)({
+ url: urlJoin(
+ (await core.Supplier.get(this._options.environment)) ?? environments.DevRevEnvironment.Default,
+ "engagements.count"
+ ),
+ method: "POST",
+ headers: {
+ Authorization: await this._getAuthorizationHeader(),
+ "X-Fern-Language": "JavaScript",
+ "X-Fern-SDK-Name": "@devrev/api",
+ "X-Fern-SDK-Version": "0.0.14",
+ "X-Fern-Runtime": core.RUNTIME.type,
+ "X-Fern-Runtime-Version": core.RUNTIME.version,
+ },
+ contentType: "application/json",
+ requestType: "json",
+ body: serializers.EngagementsCountRequest.jsonOrThrow(request, { unrecognizedObjectKeys: "strip" }),
+ timeoutMs: requestOptions?.timeoutInSeconds != null ? requestOptions.timeoutInSeconds * 1000 : 60000,
+ maxRetries: requestOptions?.maxRetries,
+ abortSignal: requestOptions?.abortSignal,
+ });
+ if (_response.ok) {
+ return serializers.EngagementsCountResponse.parseOrThrow(_response.body, {
+ unrecognizedObjectKeys: "passthrough",
+ allowUnrecognizedUnionMembers: true,
+ allowUnrecognizedEnumValues: true,
+ skipValidation: true,
+ breadcrumbsPrefix: ["response"],
+ });
+ }
+
+ if (_response.error.reason === "status-code") {
+ switch (_response.error.statusCode) {
+ case 400:
+ throw new DevRev.BadRequestError(
+ serializers.ErrorBadRequest.parseOrThrow(_response.error.body, {
+ unrecognizedObjectKeys: "passthrough",
+ allowUnrecognizedUnionMembers: true,
+ allowUnrecognizedEnumValues: true,
+ skipValidation: true,
+ breadcrumbsPrefix: ["response"],
+ })
+ );
+ case 401:
+ throw new DevRev.UnauthorizedError(
+ serializers.ErrorUnauthorized.parseOrThrow(_response.error.body, {
+ unrecognizedObjectKeys: "passthrough",
+ allowUnrecognizedUnionMembers: true,
+ allowUnrecognizedEnumValues: true,
+ skipValidation: true,
+ breadcrumbsPrefix: ["response"],
+ })
+ );
+ case 403:
+ throw new DevRev.ForbiddenError(
+ serializers.ErrorForbidden.parseOrThrow(_response.error.body, {
+ unrecognizedObjectKeys: "passthrough",
+ allowUnrecognizedUnionMembers: true,
+ allowUnrecognizedEnumValues: true,
+ skipValidation: true,
+ breadcrumbsPrefix: ["response"],
+ })
+ );
+ case 429:
+ throw new DevRev.TooManyRequestsError(
+ serializers.ErrorTooManyRequests.parseOrThrow(_response.error.body, {
+ unrecognizedObjectKeys: "passthrough",
+ allowUnrecognizedUnionMembers: true,
+ allowUnrecognizedEnumValues: true,
+ skipValidation: true,
+ breadcrumbsPrefix: ["response"],
+ })
+ );
+ case 500:
+ throw new DevRev.InternalServerError(
+ serializers.ErrorInternalServerError.parseOrThrow(_response.error.body, {
+ unrecognizedObjectKeys: "passthrough",
+ allowUnrecognizedUnionMembers: true,
+ allowUnrecognizedEnumValues: true,
+ skipValidation: true,
+ breadcrumbsPrefix: ["response"],
+ })
+ );
+ case 503:
+ throw new DevRev.ServiceUnavailableError(
+ serializers.ErrorServiceUnavailable.parseOrThrow(_response.error.body, {
+ unrecognizedObjectKeys: "passthrough",
+ allowUnrecognizedUnionMembers: true,
+ allowUnrecognizedEnumValues: true,
+ skipValidation: true,
+ breadcrumbsPrefix: ["response"],
+ })
+ );
+ default:
+ throw new errors.DevRevError({
+ statusCode: _response.error.statusCode,
+ body: _response.error.body,
+ });
+ }
+ }
+
+ switch (_response.error.reason) {
+ case "non-json":
+ throw new errors.DevRevError({
+ statusCode: _response.error.statusCode,
+ body: _response.error.rawBody,
+ });
+ case "timeout":
+ throw new errors.DevRevTimeoutError();
+ case "unknown":
+ throw new errors.DevRevError({
+ message: _response.error.errorMessage,
+ });
+ }
+ }
+
+ /**
+ * Creates a new engagement record.
+ *
+ * @param {DevRev.EngagementsCreateRequest} request
+ * @param {Engagements.RequestOptions} requestOptions - Request-specific configuration.
+ *
+ * @throws {@link DevRev.BadRequestError}
+ * @throws {@link DevRev.UnauthorizedError}
+ * @throws {@link DevRev.ForbiddenError}
+ * @throws {@link DevRev.TooManyRequestsError}
+ * @throws {@link DevRev.InternalServerError}
+ * @throws {@link DevRev.ServiceUnavailableError}
+ *
+ * @example
+ * await client.engagements.create({
+ * members: ["DEVU-12345"],
+ * parent: "ACC-12345",
+ * scheduledDate: new Date("2023-01-01T12:00:00.000Z"),
+ * title: "title"
+ * })
+ */
+ public async create(
+ request: DevRev.EngagementsCreateRequest,
+ requestOptions?: Engagements.RequestOptions
+ ): Promise {
+ const _response = await (this._options.fetcher ?? core.fetcher)({
+ url: urlJoin(
+ (await core.Supplier.get(this._options.environment)) ?? environments.DevRevEnvironment.Default,
+ "engagements.create"
+ ),
+ method: "POST",
+ headers: {
+ Authorization: await this._getAuthorizationHeader(),
+ "X-Fern-Language": "JavaScript",
+ "X-Fern-SDK-Name": "@devrev/api",
+ "X-Fern-SDK-Version": "0.0.14",
+ "X-Fern-Runtime": core.RUNTIME.type,
+ "X-Fern-Runtime-Version": core.RUNTIME.version,
+ },
+ contentType: "application/json",
+ requestType: "json",
+ body: serializers.EngagementsCreateRequest.jsonOrThrow(request, { unrecognizedObjectKeys: "strip" }),
+ timeoutMs: requestOptions?.timeoutInSeconds != null ? requestOptions.timeoutInSeconds * 1000 : 60000,
+ maxRetries: requestOptions?.maxRetries,
+ abortSignal: requestOptions?.abortSignal,
+ });
+ if (_response.ok) {
+ return serializers.EngagementsCreateResponse.parseOrThrow(_response.body, {
+ unrecognizedObjectKeys: "passthrough",
+ allowUnrecognizedUnionMembers: true,
+ allowUnrecognizedEnumValues: true,
+ skipValidation: true,
+ breadcrumbsPrefix: ["response"],
+ });
+ }
+
+ if (_response.error.reason === "status-code") {
+ switch (_response.error.statusCode) {
+ case 400:
+ throw new DevRev.BadRequestError(
+ serializers.ErrorBadRequest.parseOrThrow(_response.error.body, {
+ unrecognizedObjectKeys: "passthrough",
+ allowUnrecognizedUnionMembers: true,
+ allowUnrecognizedEnumValues: true,
+ skipValidation: true,
+ breadcrumbsPrefix: ["response"],
+ })
+ );
+ case 401:
+ throw new DevRev.UnauthorizedError(
+ serializers.ErrorUnauthorized.parseOrThrow(_response.error.body, {
+ unrecognizedObjectKeys: "passthrough",
+ allowUnrecognizedUnionMembers: true,
+ allowUnrecognizedEnumValues: true,
+ skipValidation: true,
+ breadcrumbsPrefix: ["response"],
+ })
+ );
+ case 403:
+ throw new DevRev.ForbiddenError(
+ serializers.ErrorForbidden.parseOrThrow(_response.error.body, {
+ unrecognizedObjectKeys: "passthrough",
+ allowUnrecognizedUnionMembers: true,
+ allowUnrecognizedEnumValues: true,
+ skipValidation: true,
+ breadcrumbsPrefix: ["response"],
+ })
+ );
+ case 429:
+ throw new DevRev.TooManyRequestsError(
+ serializers.ErrorTooManyRequests.parseOrThrow(_response.error.body, {
+ unrecognizedObjectKeys: "passthrough",
+ allowUnrecognizedUnionMembers: true,
+ allowUnrecognizedEnumValues: true,
+ skipValidation: true,
+ breadcrumbsPrefix: ["response"],
+ })
+ );
+ case 500:
+ throw new DevRev.InternalServerError(
+ serializers.ErrorInternalServerError.parseOrThrow(_response.error.body, {
+ unrecognizedObjectKeys: "passthrough",
+ allowUnrecognizedUnionMembers: true,
+ allowUnrecognizedEnumValues: true,
+ skipValidation: true,
+ breadcrumbsPrefix: ["response"],
+ })
+ );
+ case 503:
+ throw new DevRev.ServiceUnavailableError(
+ serializers.ErrorServiceUnavailable.parseOrThrow(_response.error.body, {
+ unrecognizedObjectKeys: "passthrough",
+ allowUnrecognizedUnionMembers: true,
+ allowUnrecognizedEnumValues: true,
+ skipValidation: true,
+ breadcrumbsPrefix: ["response"],
+ })
+ );
+ default:
+ throw new errors.DevRevError({
+ statusCode: _response.error.statusCode,
+ body: _response.error.body,
+ });
+ }
+ }
+
+ switch (_response.error.reason) {
+ case "non-json":
+ throw new errors.DevRevError({
+ statusCode: _response.error.statusCode,
+ body: _response.error.rawBody,
+ });
+ case "timeout":
+ throw new errors.DevRevTimeoutError();
+ case "unknown":
+ throw new errors.DevRevError({
+ message: _response.error.errorMessage,
+ });
+ }
+ }
+
+ /**
+ * Deletes the engagement record.
+ *
+ * @param {DevRev.EngagementsDeleteRequest} request
+ * @param {Engagements.RequestOptions} requestOptions - Request-specific configuration.
+ *
+ * @throws {@link DevRev.BadRequestError}
+ * @throws {@link DevRev.UnauthorizedError}
+ * @throws {@link DevRev.ForbiddenError}
+ * @throws {@link DevRev.NotFoundError}
+ * @throws {@link DevRev.TooManyRequestsError}
+ * @throws {@link DevRev.InternalServerError}
+ * @throws {@link DevRev.ServiceUnavailableError}
+ *
+ * @example
+ * await client.engagements.delete({
+ * id: "id"
+ * })
+ */
+ public async delete(
+ request: DevRev.EngagementsDeleteRequest,
+ requestOptions?: Engagements.RequestOptions
+ ): Promise {
+ const _response = await (this._options.fetcher ?? core.fetcher)({
+ url: urlJoin(
+ (await core.Supplier.get(this._options.environment)) ?? environments.DevRevEnvironment.Default,
+ "engagements.delete"
+ ),
+ method: "POST",
+ headers: {
+ Authorization: await this._getAuthorizationHeader(),
+ "X-Fern-Language": "JavaScript",
+ "X-Fern-SDK-Name": "@devrev/api",
+ "X-Fern-SDK-Version": "0.0.14",
+ "X-Fern-Runtime": core.RUNTIME.type,
+ "X-Fern-Runtime-Version": core.RUNTIME.version,
+ },
+ contentType: "application/json",
+ requestType: "json",
+ body: serializers.EngagementsDeleteRequest.jsonOrThrow(request, { unrecognizedObjectKeys: "strip" }),
+ timeoutMs: requestOptions?.timeoutInSeconds != null ? requestOptions.timeoutInSeconds * 1000 : 60000,
+ maxRetries: requestOptions?.maxRetries,
+ abortSignal: requestOptions?.abortSignal,
+ });
+ if (_response.ok) {
+ return serializers.EngagementsDeleteResponse.parseOrThrow(_response.body, {
+ unrecognizedObjectKeys: "passthrough",
+ allowUnrecognizedUnionMembers: true,
+ allowUnrecognizedEnumValues: true,
+ skipValidation: true,
+ breadcrumbsPrefix: ["response"],
+ });
+ }
+
+ if (_response.error.reason === "status-code") {
+ switch (_response.error.statusCode) {
+ case 400:
+ throw new DevRev.BadRequestError(
+ serializers.ErrorBadRequest.parseOrThrow(_response.error.body, {
+ unrecognizedObjectKeys: "passthrough",
+ allowUnrecognizedUnionMembers: true,
+ allowUnrecognizedEnumValues: true,
+ skipValidation: true,
+ breadcrumbsPrefix: ["response"],
+ })
+ );
+ case 401:
+ throw new DevRev.UnauthorizedError(
+ serializers.ErrorUnauthorized.parseOrThrow(_response.error.body, {
+ unrecognizedObjectKeys: "passthrough",
+ allowUnrecognizedUnionMembers: true,
+ allowUnrecognizedEnumValues: true,
+ skipValidation: true,
+ breadcrumbsPrefix: ["response"],
+ })
+ );
+ case 403:
+ throw new DevRev.ForbiddenError(
+ serializers.ErrorForbidden.parseOrThrow(_response.error.body, {
+ unrecognizedObjectKeys: "passthrough",
+ allowUnrecognizedUnionMembers: true,
+ allowUnrecognizedEnumValues: true,
+ skipValidation: true,
+ breadcrumbsPrefix: ["response"],
+ })
+ );
+ case 404:
+ throw new DevRev.NotFoundError(
+ serializers.ErrorNotFound.parseOrThrow(_response.error.body, {
+ unrecognizedObjectKeys: "passthrough",
+ allowUnrecognizedUnionMembers: true,
+ allowUnrecognizedEnumValues: true,
+ skipValidation: true,
+ breadcrumbsPrefix: ["response"],
+ })
+ );
+ case 429:
+ throw new DevRev.TooManyRequestsError(
+ serializers.ErrorTooManyRequests.parseOrThrow(_response.error.body, {
+ unrecognizedObjectKeys: "passthrough",
+ allowUnrecognizedUnionMembers: true,
+ allowUnrecognizedEnumValues: true,
+ skipValidation: true,
+ breadcrumbsPrefix: ["response"],
+ })
+ );
+ case 500:
+ throw new DevRev.InternalServerError(
+ serializers.ErrorInternalServerError.parseOrThrow(_response.error.body, {
+ unrecognizedObjectKeys: "passthrough",
+ allowUnrecognizedUnionMembers: true,
+ allowUnrecognizedEnumValues: true,
+ skipValidation: true,
+ breadcrumbsPrefix: ["response"],
+ })
+ );
+ case 503:
+ throw new DevRev.ServiceUnavailableError(
+ serializers.ErrorServiceUnavailable.parseOrThrow(_response.error.body, {
+ unrecognizedObjectKeys: "passthrough",
+ allowUnrecognizedUnionMembers: true,
+ allowUnrecognizedEnumValues: true,
+ skipValidation: true,
+ breadcrumbsPrefix: ["response"],
+ })
+ );
+ default:
+ throw new errors.DevRevError({
+ statusCode: _response.error.statusCode,
+ body: _response.error.body,
+ });
+ }
+ }
+
+ switch (_response.error.reason) {
+ case "non-json":
+ throw new errors.DevRevError({
+ statusCode: _response.error.statusCode,
+ body: _response.error.rawBody,
+ });
+ case "timeout":
+ throw new errors.DevRevTimeoutError();
+ case "unknown":
+ throw new errors.DevRevError({
+ message: _response.error.errorMessage,
+ });
+ }
+ }
+
+ /**
+ * Gets the engagement record.
+ *
+ * @param {DevRev.EngagementsGetQuery} request
+ * @param {Engagements.RequestOptions} requestOptions - Request-specific configuration.
+ *
+ * @throws {@link DevRev.BadRequestError}
+ * @throws {@link DevRev.UnauthorizedError}
+ * @throws {@link DevRev.ForbiddenError}
+ * @throws {@link DevRev.NotFoundError}
+ * @throws {@link DevRev.TooManyRequestsError}
+ * @throws {@link DevRev.InternalServerError}
+ * @throws {@link DevRev.ServiceUnavailableError}
+ *
+ * @example
+ * await client.engagements.get({
+ * id: "id"
+ * })
+ */
+ public async get(
+ request: DevRev.EngagementsGetQuery,
+ requestOptions?: Engagements.RequestOptions
+ ): Promise {
+ const { id } = request;
+ const _queryParams: Record = {};
+ _queryParams["id"] = id;
+ const _response = await (this._options.fetcher ?? core.fetcher)({
+ url: urlJoin(
+ (await core.Supplier.get(this._options.environment)) ?? environments.DevRevEnvironment.Default,
+ "engagements.get"
+ ),
+ method: "GET",
+ headers: {
+ Authorization: await this._getAuthorizationHeader(),
+ "X-Fern-Language": "JavaScript",
+ "X-Fern-SDK-Name": "@devrev/api",
+ "X-Fern-SDK-Version": "0.0.14",
+ "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 serializers.EngagementsGetResponse.parseOrThrow(_response.body, {
+ unrecognizedObjectKeys: "passthrough",
+ allowUnrecognizedUnionMembers: true,
+ allowUnrecognizedEnumValues: true,
+ skipValidation: true,
+ breadcrumbsPrefix: ["response"],
+ });
+ }
+
+ if (_response.error.reason === "status-code") {
+ switch (_response.error.statusCode) {
+ case 400:
+ throw new DevRev.BadRequestError(
+ serializers.ErrorBadRequest.parseOrThrow(_response.error.body, {
+ unrecognizedObjectKeys: "passthrough",
+ allowUnrecognizedUnionMembers: true,
+ allowUnrecognizedEnumValues: true,
+ skipValidation: true,
+ breadcrumbsPrefix: ["response"],
+ })
+ );
+ case 401:
+ throw new DevRev.UnauthorizedError(
+ serializers.ErrorUnauthorized.parseOrThrow(_response.error.body, {
+ unrecognizedObjectKeys: "passthrough",
+ allowUnrecognizedUnionMembers: true,
+ allowUnrecognizedEnumValues: true,
+ skipValidation: true,
+ breadcrumbsPrefix: ["response"],
+ })
+ );
+ case 403:
+ throw new DevRev.ForbiddenError(
+ serializers.ErrorForbidden.parseOrThrow(_response.error.body, {
+ unrecognizedObjectKeys: "passthrough",
+ allowUnrecognizedUnionMembers: true,
+ allowUnrecognizedEnumValues: true,
+ skipValidation: true,
+ breadcrumbsPrefix: ["response"],
+ })
+ );
+ case 404:
+ throw new DevRev.NotFoundError(
+ serializers.ErrorNotFound.parseOrThrow(_response.error.body, {
+ unrecognizedObjectKeys: "passthrough",
+ allowUnrecognizedUnionMembers: true,
+ allowUnrecognizedEnumValues: true,
+ skipValidation: true,
+ breadcrumbsPrefix: ["response"],
+ })
+ );
+ case 429:
+ throw new DevRev.TooManyRequestsError(
+ serializers.ErrorTooManyRequests.parseOrThrow(_response.error.body, {
+ unrecognizedObjectKeys: "passthrough",
+ allowUnrecognizedUnionMembers: true,
+ allowUnrecognizedEnumValues: true,
+ skipValidation: true,
+ breadcrumbsPrefix: ["response"],
+ })
+ );
+ case 500:
+ throw new DevRev.InternalServerError(
+ serializers.ErrorInternalServerError.parseOrThrow(_response.error.body, {
+ unrecognizedObjectKeys: "passthrough",
+ allowUnrecognizedUnionMembers: true,
+ allowUnrecognizedEnumValues: true,
+ skipValidation: true,
+ breadcrumbsPrefix: ["response"],
+ })
+ );
+ case 503:
+ throw new DevRev.ServiceUnavailableError(
+ serializers.ErrorServiceUnavailable.parseOrThrow(_response.error.body, {
+ unrecognizedObjectKeys: "passthrough",
+ allowUnrecognizedUnionMembers: true,
+ allowUnrecognizedEnumValues: true,
+ skipValidation: true,
+ breadcrumbsPrefix: ["response"],
+ })
+ );
+ default:
+ throw new errors.DevRevError({
+ statusCode: _response.error.statusCode,
+ body: _response.error.body,
+ });
+ }
+ }
+
+ switch (_response.error.reason) {
+ case "non-json":
+ throw new errors.DevRevError({
+ statusCode: _response.error.statusCode,
+ body: _response.error.rawBody,
+ });
+ case "timeout":
+ throw new errors.DevRevTimeoutError();
+ case "unknown":
+ throw new errors.DevRevError({
+ message: _response.error.errorMessage,
+ });
+ }
+ }
+
+ /**
+ * Gets the engagement record.
+ *
+ * @param {DevRev.EngagementsGetRequest} request
+ * @param {Engagements.RequestOptions} requestOptions - Request-specific configuration.
+ *
+ * @throws {@link DevRev.BadRequestError}
+ * @throws {@link DevRev.UnauthorizedError}
+ * @throws {@link DevRev.ForbiddenError}
+ * @throws {@link DevRev.NotFoundError}
+ * @throws {@link DevRev.TooManyRequestsError}
+ * @throws {@link DevRev.InternalServerError}
+ * @throws {@link DevRev.ServiceUnavailableError}
+ *
+ * @example
+ * await client.engagements.getPost({
+ * id: "id"
+ * })
+ */
+ public async getPost(
+ request: DevRev.EngagementsGetRequest,
+ requestOptions?: Engagements.RequestOptions
+ ): Promise {
+ const _response = await (this._options.fetcher ?? core.fetcher)({
+ url: urlJoin(
+ (await core.Supplier.get(this._options.environment)) ?? environments.DevRevEnvironment.Default,
+ "engagements.get"
+ ),
+ method: "POST",
+ headers: {
+ Authorization: await this._getAuthorizationHeader(),
+ "X-Fern-Language": "JavaScript",
+ "X-Fern-SDK-Name": "@devrev/api",
+ "X-Fern-SDK-Version": "0.0.14",
+ "X-Fern-Runtime": core.RUNTIME.type,
+ "X-Fern-Runtime-Version": core.RUNTIME.version,
+ },
+ contentType: "application/json",
+ requestType: "json",
+ body: serializers.EngagementsGetRequest.jsonOrThrow(request, { unrecognizedObjectKeys: "strip" }),
+ timeoutMs: requestOptions?.timeoutInSeconds != null ? requestOptions.timeoutInSeconds * 1000 : 60000,
+ maxRetries: requestOptions?.maxRetries,
+ abortSignal: requestOptions?.abortSignal,
+ });
+ if (_response.ok) {
+ return serializers.EngagementsGetResponse.parseOrThrow(_response.body, {
+ unrecognizedObjectKeys: "passthrough",
+ allowUnrecognizedUnionMembers: true,
+ allowUnrecognizedEnumValues: true,
+ skipValidation: true,
+ breadcrumbsPrefix: ["response"],
+ });
+ }
+
+ if (_response.error.reason === "status-code") {
+ switch (_response.error.statusCode) {
+ case 400:
+ throw new DevRev.BadRequestError(
+ serializers.ErrorBadRequest.parseOrThrow(_response.error.body, {
+ unrecognizedObjectKeys: "passthrough",
+ allowUnrecognizedUnionMembers: true,
+ allowUnrecognizedEnumValues: true,
+ skipValidation: true,
+ breadcrumbsPrefix: ["response"],
+ })
+ );
+ case 401:
+ throw new DevRev.UnauthorizedError(
+ serializers.ErrorUnauthorized.parseOrThrow(_response.error.body, {
+ unrecognizedObjectKeys: "passthrough",
+ allowUnrecognizedUnionMembers: true,
+ allowUnrecognizedEnumValues: true,
+ skipValidation: true,
+ breadcrumbsPrefix: ["response"],
+ })
+ );
+ case 403:
+ throw new DevRev.ForbiddenError(
+ serializers.ErrorForbidden.parseOrThrow(_response.error.body, {
+ unrecognizedObjectKeys: "passthrough",
+ allowUnrecognizedUnionMembers: true,
+ allowUnrecognizedEnumValues: true,
+ skipValidation: true,
+ breadcrumbsPrefix: ["response"],
+ })
+ );
+ case 404:
+ throw new DevRev.NotFoundError(
+ serializers.ErrorNotFound.parseOrThrow(_response.error.body, {
+ unrecognizedObjectKeys: "passthrough",
+ allowUnrecognizedUnionMembers: true,
+ allowUnrecognizedEnumValues: true,
+ skipValidation: true,
+ breadcrumbsPrefix: ["response"],
+ })
+ );
+ case 429:
+ throw new DevRev.TooManyRequestsError(
+ serializers.ErrorTooManyRequests.parseOrThrow(_response.error.body, {
+ unrecognizedObjectKeys: "passthrough",
+ allowUnrecognizedUnionMembers: true,
+ allowUnrecognizedEnumValues: true,
+ skipValidation: true,
+ breadcrumbsPrefix: ["response"],
+ })
+ );
+ case 500:
+ throw new DevRev.InternalServerError(
+ serializers.ErrorInternalServerError.parseOrThrow(_response.error.body, {
+ unrecognizedObjectKeys: "passthrough",
+ allowUnrecognizedUnionMembers: true,
+ allowUnrecognizedEnumValues: true,
+ skipValidation: true,
+ breadcrumbsPrefix: ["response"],
+ })
+ );
+ case 503:
+ throw new DevRev.ServiceUnavailableError(
+ serializers.ErrorServiceUnavailable.parseOrThrow(_response.error.body, {
+ unrecognizedObjectKeys: "passthrough",
+ allowUnrecognizedUnionMembers: true,
+ allowUnrecognizedEnumValues: true,
+ skipValidation: true,
+ breadcrumbsPrefix: ["response"],
+ })
+ );
+ default:
+ throw new errors.DevRevError({
+ statusCode: _response.error.statusCode,
+ body: _response.error.body,
+ });
+ }
+ }
+
+ switch (_response.error.reason) {
+ case "non-json":
+ throw new errors.DevRevError({
+ statusCode: _response.error.statusCode,
+ body: _response.error.rawBody,
+ });
+ case "timeout":
+ throw new errors.DevRevTimeoutError();
+ case "unknown":
+ throw new errors.DevRevError({
+ message: _response.error.errorMessage,
+ });
+ }
+ }
+
+ /**
+ * Lists the engagement records.
+ *
+ * @param {DevRev.EngagementsListQuery} request
+ * @param {Engagements.RequestOptions} requestOptions - Request-specific configuration.
+ *
+ * @throws {@link DevRev.BadRequestError}
+ * @throws {@link DevRev.UnauthorizedError}
+ * @throws {@link DevRev.ForbiddenError}
+ * @throws {@link DevRev.TooManyRequestsError}
+ * @throws {@link DevRev.InternalServerError}
+ * @throws {@link DevRev.ServiceUnavailableError}
+ *
+ * @example
+ * await client.engagements.list()
+ */
+ public async list(
+ request: DevRev.EngagementsListQuery = {},
+ requestOptions?: Engagements.RequestOptions
+ ): Promise {
+ const { cursor, externalRef, limit, members, mode, parent, sortBy, type: type_ } = request;
+ const _queryParams: Record = {};
+ if (cursor != null) {
+ _queryParams["cursor"] = cursor;
+ }
+
+ if (externalRef != null) {
+ if (Array.isArray(externalRef)) {
+ _queryParams["external_ref"] = externalRef.map((item) => item);
+ } else {
+ _queryParams["external_ref"] = externalRef;
+ }
+ }
+
+ if (limit != null) {
+ _queryParams["limit"] = limit.toString();
+ }
+
+ if (members != null) {
+ if (Array.isArray(members)) {
+ _queryParams["members"] = members.map((item) => item);
+ } else {
+ _queryParams["members"] = members;
+ }
+ }
+
+ if (mode != null) {
+ _queryParams["mode"] = mode;
+ }
+
+ if (parent != null) {
+ if (Array.isArray(parent)) {
+ _queryParams["parent"] = parent.map((item) => item);
+ } else {
+ _queryParams["parent"] = parent;
+ }
+ }
+
+ if (sortBy != null) {
+ if (Array.isArray(sortBy)) {
+ _queryParams["sort_by"] = sortBy.map((item) => item);
+ } else {
+ _queryParams["sort_by"] = sortBy;
+ }
+ }
+
+ if (type_ != null) {
+ if (Array.isArray(type_)) {
+ _queryParams["type"] = type_.map((item) => item);
+ } else {
+ _queryParams["type"] = type_;
+ }
+ }
+
+ const _response = await (this._options.fetcher ?? core.fetcher)({
+ url: urlJoin(
+ (await core.Supplier.get(this._options.environment)) ?? environments.DevRevEnvironment.Default,
+ "engagements.list"
+ ),
+ method: "GET",
+ headers: {
+ Authorization: await this._getAuthorizationHeader(),
+ "X-Fern-Language": "JavaScript",
+ "X-Fern-SDK-Name": "@devrev/api",
+ "X-Fern-SDK-Version": "0.0.14",
+ "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 serializers.EngagementsListResponse.parseOrThrow(_response.body, {
+ unrecognizedObjectKeys: "passthrough",
+ allowUnrecognizedUnionMembers: true,
+ allowUnrecognizedEnumValues: true,
+ skipValidation: true,
+ breadcrumbsPrefix: ["response"],
+ });
+ }
+
+ if (_response.error.reason === "status-code") {
+ switch (_response.error.statusCode) {
+ case 400:
+ throw new DevRev.BadRequestError(
+ serializers.ErrorBadRequest.parseOrThrow(_response.error.body, {
+ unrecognizedObjectKeys: "passthrough",
+ allowUnrecognizedUnionMembers: true,
+ allowUnrecognizedEnumValues: true,
+ skipValidation: true,
+ breadcrumbsPrefix: ["response"],
+ })
+ );
+ case 401:
+ throw new DevRev.UnauthorizedError(
+ serializers.ErrorUnauthorized.parseOrThrow(_response.error.body, {
+ unrecognizedObjectKeys: "passthrough",
+ allowUnrecognizedUnionMembers: true,
+ allowUnrecognizedEnumValues: true,
+ skipValidation: true,
+ breadcrumbsPrefix: ["response"],
+ })
+ );
+ case 403:
+ throw new DevRev.ForbiddenError(
+ serializers.ErrorForbidden.parseOrThrow(_response.error.body, {
+ unrecognizedObjectKeys: "passthrough",
+ allowUnrecognizedUnionMembers: true,
+ allowUnrecognizedEnumValues: true,
+ skipValidation: true,
+ breadcrumbsPrefix: ["response"],
+ })
+ );
+ case 429:
+ throw new DevRev.TooManyRequestsError(
+ serializers.ErrorTooManyRequests.parseOrThrow(_response.error.body, {
+ unrecognizedObjectKeys: "passthrough",
+ allowUnrecognizedUnionMembers: true,
+ allowUnrecognizedEnumValues: true,
+ skipValidation: true,
+ breadcrumbsPrefix: ["response"],
+ })
+ );
+ case 500:
+ throw new DevRev.InternalServerError(
+ serializers.ErrorInternalServerError.parseOrThrow(_response.error.body, {
+ unrecognizedObjectKeys: "passthrough",
+ allowUnrecognizedUnionMembers: true,
+ allowUnrecognizedEnumValues: true,
+ skipValidation: true,
+ breadcrumbsPrefix: ["response"],
+ })
+ );
+ case 503:
+ throw new DevRev.ServiceUnavailableError(
+ serializers.ErrorServiceUnavailable.parseOrThrow(_response.error.body, {
+ unrecognizedObjectKeys: "passthrough",
+ allowUnrecognizedUnionMembers: true,
+ allowUnrecognizedEnumValues: true,
+ skipValidation: true,
+ breadcrumbsPrefix: ["response"],
+ })
+ );
+ default:
+ throw new errors.DevRevError({
+ statusCode: _response.error.statusCode,
+ body: _response.error.body,
+ });
+ }
+ }
+
+ switch (_response.error.reason) {
+ case "non-json":
+ throw new errors.DevRevError({
+ statusCode: _response.error.statusCode,
+ body: _response.error.rawBody,
+ });
+ case "timeout":
+ throw new errors.DevRevTimeoutError();
+ case "unknown":
+ throw new errors.DevRevError({
+ message: _response.error.errorMessage,
+ });
+ }
+ }
+
+ /**
+ * Lists the engagement records.
+ *
+ * @param {DevRev.EngagementsListRequest} request
+ * @param {Engagements.RequestOptions} requestOptions - Request-specific configuration.
+ *
+ * @throws {@link DevRev.BadRequestError}
+ * @throws {@link DevRev.UnauthorizedError}
+ * @throws {@link DevRev.ForbiddenError}
+ * @throws {@link DevRev.TooManyRequestsError}
+ * @throws {@link DevRev.InternalServerError}
+ * @throws {@link DevRev.ServiceUnavailableError}
+ *
+ * @example
+ * await client.engagements.listPost()
+ */
+ public async listPost(
+ request: DevRev.EngagementsListRequest = {},
+ requestOptions?: Engagements.RequestOptions
+ ): Promise {
+ const _response = await (this._options.fetcher ?? core.fetcher)({
+ url: urlJoin(
+ (await core.Supplier.get(this._options.environment)) ?? environments.DevRevEnvironment.Default,
+ "engagements.list"
+ ),
+ method: "POST",
+ headers: {
+ Authorization: await this._getAuthorizationHeader(),
+ "X-Fern-Language": "JavaScript",
+ "X-Fern-SDK-Name": "@devrev/api",
+ "X-Fern-SDK-Version": "0.0.14",
+ "X-Fern-Runtime": core.RUNTIME.type,
+ "X-Fern-Runtime-Version": core.RUNTIME.version,
+ },
+ contentType: "application/json",
+ requestType: "json",
+ body: serializers.EngagementsListRequest.jsonOrThrow(request, { unrecognizedObjectKeys: "strip" }),
+ timeoutMs: requestOptions?.timeoutInSeconds != null ? requestOptions.timeoutInSeconds * 1000 : 60000,
+ maxRetries: requestOptions?.maxRetries,
+ abortSignal: requestOptions?.abortSignal,
+ });
+ if (_response.ok) {
+ return serializers.EngagementsListResponse.parseOrThrow(_response.body, {
+ unrecognizedObjectKeys: "passthrough",
+ allowUnrecognizedUnionMembers: true,
+ allowUnrecognizedEnumValues: true,
+ skipValidation: true,
+ breadcrumbsPrefix: ["response"],
+ });
+ }
+
+ if (_response.error.reason === "status-code") {
+ switch (_response.error.statusCode) {
+ case 400:
+ throw new DevRev.BadRequestError(
+ serializers.ErrorBadRequest.parseOrThrow(_response.error.body, {
+ unrecognizedObjectKeys: "passthrough",
+ allowUnrecognizedUnionMembers: true,
+ allowUnrecognizedEnumValues: true,
+ skipValidation: true,
+ breadcrumbsPrefix: ["response"],
+ })
+ );
+ case 401:
+ throw new DevRev.UnauthorizedError(
+ serializers.ErrorUnauthorized.parseOrThrow(_response.error.body, {
+ unrecognizedObjectKeys: "passthrough",
+ allowUnrecognizedUnionMembers: true,
+ allowUnrecognizedEnumValues: true,
+ skipValidation: true,
+ breadcrumbsPrefix: ["response"],
+ })
+ );
+ case 403:
+ throw new DevRev.ForbiddenError(
+ serializers.ErrorForbidden.parseOrThrow(_response.error.body, {
+ unrecognizedObjectKeys: "passthrough",
+ allowUnrecognizedUnionMembers: true,
+ allowUnrecognizedEnumValues: true,
+ skipValidation: true,
+ breadcrumbsPrefix: ["response"],
+ })
+ );
+ case 429:
+ throw new DevRev.TooManyRequestsError(
+ serializers.ErrorTooManyRequests.parseOrThrow(_response.error.body, {
+ unrecognizedObjectKeys: "passthrough",
+ allowUnrecognizedUnionMembers: true,
+ allowUnrecognizedEnumValues: true,
+ skipValidation: true,
+ breadcrumbsPrefix: ["response"],
+ })
+ );
+ case 500:
+ throw new DevRev.InternalServerError(
+ serializers.ErrorInternalServerError.parseOrThrow(_response.error.body, {
+ unrecognizedObjectKeys: "passthrough",
+ allowUnrecognizedUnionMembers: true,
+ allowUnrecognizedEnumValues: true,
+ skipValidation: true,
+ breadcrumbsPrefix: ["response"],
+ })
+ );
+ case 503:
+ throw new DevRev.ServiceUnavailableError(
+ serializers.ErrorServiceUnavailable.parseOrThrow(_response.error.body, {
+ unrecognizedObjectKeys: "passthrough",
+ allowUnrecognizedUnionMembers: true,
+ allowUnrecognizedEnumValues: true,
+ skipValidation: true,
+ breadcrumbsPrefix: ["response"],
+ })
+ );
+ default:
+ throw new errors.DevRevError({
+ statusCode: _response.error.statusCode,
+ body: _response.error.body,
+ });
+ }
+ }
+
+ switch (_response.error.reason) {
+ case "non-json":
+ throw new errors.DevRevError({
+ statusCode: _response.error.statusCode,
+ body: _response.error.rawBody,
+ });
+ case "timeout":
+ throw new errors.DevRevTimeoutError();
+ case "unknown":
+ throw new errors.DevRevError({
+ message: _response.error.errorMessage,
+ });
+ }
+ }
+
+ /**
+ * Updates the engagement record.
+ *
+ * @param {DevRev.EngagementsUpdateRequest} request
+ * @param {Engagements.RequestOptions} requestOptions - Request-specific configuration.
+ *
+ * @throws {@link DevRev.BadRequestError}
+ * @throws {@link DevRev.UnauthorizedError}
+ * @throws {@link DevRev.ForbiddenError}
+ * @throws {@link DevRev.NotFoundError}
+ * @throws {@link DevRev.TooManyRequestsError}
+ * @throws {@link DevRev.InternalServerError}
+ * @throws {@link DevRev.ServiceUnavailableError}
+ *
+ * @example
+ * await client.engagements.update({
+ * id: "id"
+ * })
+ */
+ public async update(
+ request: DevRev.EngagementsUpdateRequest,
+ requestOptions?: Engagements.RequestOptions
+ ): Promise {
+ const _response = await (this._options.fetcher ?? core.fetcher)({
+ url: urlJoin(
+ (await core.Supplier.get(this._options.environment)) ?? environments.DevRevEnvironment.Default,
+ "engagements.update"
+ ),
+ method: "POST",
+ headers: {
+ Authorization: await this._getAuthorizationHeader(),
+ "X-Fern-Language": "JavaScript",
+ "X-Fern-SDK-Name": "@devrev/api",
+ "X-Fern-SDK-Version": "0.0.14",
+ "X-Fern-Runtime": core.RUNTIME.type,
+ "X-Fern-Runtime-Version": core.RUNTIME.version,
+ },
+ contentType: "application/json",
+ requestType: "json",
+ body: serializers.EngagementsUpdateRequest.jsonOrThrow(request, { unrecognizedObjectKeys: "strip" }),
+ timeoutMs: requestOptions?.timeoutInSeconds != null ? requestOptions.timeoutInSeconds * 1000 : 60000,
+ maxRetries: requestOptions?.maxRetries,
+ abortSignal: requestOptions?.abortSignal,
+ });
+ if (_response.ok) {
+ return serializers.EngagementsUpdateResponse.parseOrThrow(_response.body, {
+ unrecognizedObjectKeys: "passthrough",
+ allowUnrecognizedUnionMembers: true,
+ allowUnrecognizedEnumValues: true,
+ skipValidation: true,
+ breadcrumbsPrefix: ["response"],
+ });
+ }
+
+ if (_response.error.reason === "status-code") {
+ switch (_response.error.statusCode) {
+ case 400:
+ throw new DevRev.BadRequestError(
+ serializers.ErrorBadRequest.parseOrThrow(_response.error.body, {
+ unrecognizedObjectKeys: "passthrough",
+ allowUnrecognizedUnionMembers: true,
+ allowUnrecognizedEnumValues: true,
+ skipValidation: true,
+ breadcrumbsPrefix: ["response"],
+ })
+ );
+ case 401:
+ throw new DevRev.UnauthorizedError(
+ serializers.ErrorUnauthorized.parseOrThrow(_response.error.body, {
+ unrecognizedObjectKeys: "passthrough",
+ allowUnrecognizedUnionMembers: true,
+ allowUnrecognizedEnumValues: true,
+ skipValidation: true,
+ breadcrumbsPrefix: ["response"],
+ })
+ );
+ case 403:
+ throw new DevRev.ForbiddenError(
+ serializers.ErrorForbidden.parseOrThrow(_response.error.body, {
+ unrecognizedObjectKeys: "passthrough",
+ allowUnrecognizedUnionMembers: true,
+ allowUnrecognizedEnumValues: true,
+ skipValidation: true,
+ breadcrumbsPrefix: ["response"],
+ })
+ );
+ case 404:
+ throw new DevRev.NotFoundError(
+ serializers.ErrorNotFound.parseOrThrow(_response.error.body, {
+ unrecognizedObjectKeys: "passthrough",
+ allowUnrecognizedUnionMembers: true,
+ allowUnrecognizedEnumValues: true,
+ skipValidation: true,
+ breadcrumbsPrefix: ["response"],
+ })
+ );
+ case 429:
+ throw new DevRev.TooManyRequestsError(
+ serializers.ErrorTooManyRequests.parseOrThrow(_response.error.body, {
+ unrecognizedObjectKeys: "passthrough",
+ allowUnrecognizedUnionMembers: true,
+ allowUnrecognizedEnumValues: true,
+ skipValidation: true,
+ breadcrumbsPrefix: ["response"],
+ })
+ );
+ case 500:
+ throw new DevRev.InternalServerError(
+ serializers.ErrorInternalServerError.parseOrThrow(_response.error.body, {
+ unrecognizedObjectKeys: "passthrough",
+ allowUnrecognizedUnionMembers: true,
+ allowUnrecognizedEnumValues: true,
+ skipValidation: true,
+ breadcrumbsPrefix: ["response"],
+ })
+ );
+ case 503:
+ throw new DevRev.ServiceUnavailableError(
+ serializers.ErrorServiceUnavailable.parseOrThrow(_response.error.body, {
+ unrecognizedObjectKeys: "passthrough",
+ allowUnrecognizedUnionMembers: true,
+ allowUnrecognizedEnumValues: true,
+ skipValidation: true,
+ breadcrumbsPrefix: ["response"],
+ })
+ );
+ default:
+ throw new errors.DevRevError({
+ statusCode: _response.error.statusCode,
+ body: _response.error.body,
+ });
+ }
+ }
+
+ switch (_response.error.reason) {
+ case "non-json":
+ throw new errors.DevRevError({
+ statusCode: _response.error.statusCode,
+ body: _response.error.rawBody,
+ });
+ case "timeout":
+ throw new errors.DevRevTimeoutError();
+ case "unknown":
+ throw new errors.DevRevError({
+ message: _response.error.errorMessage,
+ });
+ }
+ }
+
+ protected async _getAuthorizationHeader(): Promise {
+ const bearer = (await core.Supplier.get(this._options.token)) ?? process?.env["DEVREV_TOKEN"];
+ if (bearer == null) {
+ throw new errors.DevRevError({
+ message: "Please specify DEVREV_TOKEN when instantiating the client.",
+ });
+ }
+
+ return `Bearer ${bearer}`;
+ }
+}
diff --git a/src/api/resources/engagements/client/index.ts b/src/api/resources/engagements/client/index.ts
new file mode 100644
index 0000000..415726b
--- /dev/null
+++ b/src/api/resources/engagements/client/index.ts
@@ -0,0 +1 @@
+export * from "./requests";
diff --git a/src/api/resources/engagements/client/requests/EngagementsCountQuery.ts b/src/api/resources/engagements/client/requests/EngagementsCountQuery.ts
new file mode 100644
index 0000000..7e54bf1
--- /dev/null
+++ b/src/api/resources/engagements/client/requests/EngagementsCountQuery.ts
@@ -0,0 +1,28 @@
+/**
+ * This file was auto-generated by Fern from our API Definition.
+ */
+
+import * as DevRev from "../../../../index";
+
+/**
+ * @example
+ * {}
+ */
+export interface EngagementsCountQuery {
+ /**
+ * Filters for meetings with the provided external_refs.
+ */
+ externalRef?: string | string[];
+ /**
+ * Filters for engagement of the provided members.
+ */
+ members?: string | string[];
+ /**
+ * Filters for engagements with the provided parent.
+ */
+ parent?: string | string[];
+ /**
+ * Filters for engagement of the provided types.
+ */
+ type?: DevRev.EngagementType | DevRev.EngagementType[];
+}
diff --git a/src/api/resources/engagements/client/requests/EngagementsCountRequest.ts b/src/api/resources/engagements/client/requests/EngagementsCountRequest.ts
new file mode 100644
index 0000000..b31adc4
--- /dev/null
+++ b/src/api/resources/engagements/client/requests/EngagementsCountRequest.ts
@@ -0,0 +1,20 @@
+/**
+ * This file was auto-generated by Fern from our API Definition.
+ */
+
+import * as DevRev from "../../../../index";
+
+/**
+ * @example
+ * {}
+ */
+export interface EngagementsCountRequest {
+ /** Filters for engagement of the provided types. */
+ type?: DevRev.EngagementType[];
+ /** Filters for meetings with the provided external_refs. */
+ externalRef?: string[];
+ /** Filters for engagement of the provided members. */
+ members?: string[];
+ /** Filters for engagements with the provided parent. */
+ parent?: string[];
+}
diff --git a/src/api/resources/engagements/client/requests/EngagementsCreateRequest.ts b/src/api/resources/engagements/client/requests/EngagementsCreateRequest.ts
new file mode 100644
index 0000000..ff8d60f
--- /dev/null
+++ b/src/api/resources/engagements/client/requests/EngagementsCreateRequest.ts
@@ -0,0 +1,43 @@
+/**
+ * This file was auto-generated by Fern from our API Definition.
+ */
+
+import * as DevRev from "../../../../index";
+
+/**
+ * @example
+ * {
+ * members: ["DEVU-12345"],
+ * parent: "ACC-12345",
+ * scheduledDate: new Date("2023-01-01T12:00:00.000Z"),
+ * title: "title"
+ * }
+ */
+export interface EngagementsCreateRequest {
+ /**
+ * The IDs of the artifacts to associate with the engagement.
+ *
+ */
+ artifacts?: string[];
+ /** The description of the engagement. */
+ description?: string;
+ engagementType?: DevRev.EngagementsCreateRequestEngagementType;
+ /** External Reference for the engagement. */
+ externalRef?: string;
+ /** External URL for the engagement. */
+ externalUrl?: string;
+ /** IDs of the users that were part of the engagement. */
+ members: string[];
+ /**
+ * The parent object ID in which the engagement was created.
+ * Currently, only accounts and opportunities are supported.
+ *
+ */
+ parent: string;
+ /** The date and time when the engagement was scheduled. */
+ scheduledDate: Date;
+ /** Tags associated with the engagement. */
+ tags?: DevRev.SetTagWithValue[];
+ /** The title of the engagement. */
+ title: string;
+}
diff --git a/src/api/resources/engagements/client/requests/EngagementsDeleteRequest.ts b/src/api/resources/engagements/client/requests/EngagementsDeleteRequest.ts
new file mode 100644
index 0000000..f631cc8
--- /dev/null
+++ b/src/api/resources/engagements/client/requests/EngagementsDeleteRequest.ts
@@ -0,0 +1,14 @@
+/**
+ * This file was auto-generated by Fern from our API Definition.
+ */
+
+/**
+ * @example
+ * {
+ * id: "id"
+ * }
+ */
+export interface EngagementsDeleteRequest {
+ /** The engagement ID. */
+ id: string;
+}
diff --git a/src/api/resources/engagements/client/requests/EngagementsGetQuery.ts b/src/api/resources/engagements/client/requests/EngagementsGetQuery.ts
new file mode 100644
index 0000000..f8ad771
--- /dev/null
+++ b/src/api/resources/engagements/client/requests/EngagementsGetQuery.ts
@@ -0,0 +1,16 @@
+/**
+ * This file was auto-generated by Fern from our API Definition.
+ */
+
+/**
+ * @example
+ * {
+ * id: "id"
+ * }
+ */
+export interface EngagementsGetQuery {
+ /**
+ * The engagement ID.
+ */
+ id: string;
+}
diff --git a/src/api/resources/engagements/client/requests/EngagementsGetRequest.ts b/src/api/resources/engagements/client/requests/EngagementsGetRequest.ts
new file mode 100644
index 0000000..44f0360
--- /dev/null
+++ b/src/api/resources/engagements/client/requests/EngagementsGetRequest.ts
@@ -0,0 +1,14 @@
+/**
+ * This file was auto-generated by Fern from our API Definition.
+ */
+
+/**
+ * @example
+ * {
+ * id: "id"
+ * }
+ */
+export interface EngagementsGetRequest {
+ /** The engagement ID. */
+ id: string;
+}
diff --git a/src/api/resources/engagements/client/requests/EngagementsListQuery.ts b/src/api/resources/engagements/client/requests/EngagementsListQuery.ts
new file mode 100644
index 0000000..a7acf49
--- /dev/null
+++ b/src/api/resources/engagements/client/requests/EngagementsListQuery.ts
@@ -0,0 +1,46 @@
+/**
+ * This file was auto-generated by Fern from our API Definition.
+ */
+
+import * as DevRev from "../../../../index";
+
+/**
+ * @example
+ * {}
+ */
+export interface EngagementsListQuery {
+ /**
+ * The cursor to resume iteration from. If not provided, then iteration
+ * starts from the beginning.
+ */
+ cursor?: string;
+ /**
+ * Filters for meetings with the provided external_refs.
+ */
+ externalRef?: string | string[];
+ /**
+ * The maximum number of engagements to return.
+ */
+ limit?: number;
+ /**
+ * Filters for engagement of the provided members.
+ */
+ members?: string | string[];
+ /**
+ * The iteration mode to use, otherwise if not set, then "after" is
+ * used.
+ */
+ mode?: DevRev.ListMode;
+ /**
+ * Filters for engagements with the provided parent.
+ */
+ parent?: string | string[];
+ /**
+ * Fields to sort the engagements by and the direction to sort them.
+ */
+ sortBy?: string | string[];
+ /**
+ * Filters for engagement of the provided types.
+ */
+ type?: DevRev.EngagementType | DevRev.EngagementType[];
+}
diff --git a/src/api/resources/engagements/client/requests/EngagementsListRequest.ts b/src/api/resources/engagements/client/requests/EngagementsListRequest.ts
new file mode 100644
index 0000000..c7db7b4
--- /dev/null
+++ b/src/api/resources/engagements/client/requests/EngagementsListRequest.ts
@@ -0,0 +1,34 @@
+/**
+ * This file was auto-generated by Fern from our API Definition.
+ */
+
+import * as DevRev from "../../../../index";
+
+/**
+ * @example
+ * {}
+ */
+export interface EngagementsListRequest {
+ /** Filters for engagement of the provided types. */
+ type?: DevRev.EngagementType[];
+ /**
+ * The cursor to resume iteration from. If not provided, then
+ * iteration starts from the beginning.
+ *
+ */
+ cursor?: string;
+ /** Filters for meetings with the provided external_refs. */
+ externalRef?: string[];
+ /** The maximum number of engagements to return. */
+ limit?: number;
+ /** Filters for engagement of the provided members. */
+ members?: string[];
+ mode?: DevRev.ListMode;
+ /** Filters for engagements with the provided parent. */
+ parent?: string[];
+ /**
+ * Fields to sort the engagements by and the direction to sort them.
+ *
+ */
+ sortBy?: string[];
+}
diff --git a/src/api/resources/engagements/client/requests/EngagementsUpdateRequest.ts b/src/api/resources/engagements/client/requests/EngagementsUpdateRequest.ts
new file mode 100644
index 0000000..d96f521
--- /dev/null
+++ b/src/api/resources/engagements/client/requests/EngagementsUpdateRequest.ts
@@ -0,0 +1,32 @@
+/**
+ * This file was auto-generated by Fern from our API Definition.
+ */
+
+import * as DevRev from "../../../../index";
+
+/**
+ * @example
+ * {
+ * id: "id"
+ * }
+ */
+export interface EngagementsUpdateRequest {
+ artifacts?: DevRev.EngagementsUpdateRequestArtifactIds;
+ /** Updates the description of the engagement. */
+ description?: string;
+ /** External Reference for the engagement. */
+ externalRef?: string;
+ /** Updates the external URL for the engagement. */
+ externalUrl?: string;
+ /** The engagement ID. */
+ id: string;
+ members?: DevRev.EngagementsUpdateRequestMembers;
+ /**
+ * Updates the date and time when the engagement was scheduled.
+ *
+ */
+ scheduledDate?: Date;
+ tags?: DevRev.EngagementsUpdateRequestTags;
+ /** Updates the title of the engagement. */
+ title?: string;
+}
diff --git a/src/api/resources/engagements/client/requests/index.ts b/src/api/resources/engagements/client/requests/index.ts
new file mode 100644
index 0000000..5c99fd2
--- /dev/null
+++ b/src/api/resources/engagements/client/requests/index.ts
@@ -0,0 +1,9 @@
+export { type EngagementsCountQuery } from "./EngagementsCountQuery";
+export { type EngagementsCountRequest } from "./EngagementsCountRequest";
+export { type EngagementsCreateRequest } from "./EngagementsCreateRequest";
+export { type EngagementsDeleteRequest } from "./EngagementsDeleteRequest";
+export { type EngagementsGetQuery } from "./EngagementsGetQuery";
+export { type EngagementsGetRequest } from "./EngagementsGetRequest";
+export { type EngagementsListQuery } from "./EngagementsListQuery";
+export { type EngagementsListRequest } from "./EngagementsListRequest";
+export { type EngagementsUpdateRequest } from "./EngagementsUpdateRequest";
diff --git a/src/api/resources/engagements/index.ts b/src/api/resources/engagements/index.ts
new file mode 100644
index 0000000..5ec7692
--- /dev/null
+++ b/src/api/resources/engagements/index.ts
@@ -0,0 +1 @@
+export * from "./client";
diff --git a/src/api/resources/eventSource/client/Client.ts b/src/api/resources/eventSource/client/Client.ts
new file mode 100644
index 0000000..f957eaa
--- /dev/null
+++ b/src/api/resources/eventSource/client/Client.ts
@@ -0,0 +1,788 @@
+/**
+ * This file was auto-generated by Fern from our API Definition.
+ */
+
+import * as environments from "../../../../environments";
+import * as core from "../../../../core";
+import * as DevRev from "../../../index";
+import urlJoin from "url-join";
+import * as serializers from "../../../../serialization/index";
+import * as errors from "../../../../errors/index";
+
+export declare namespace EventSource {
+ interface Options {
+ environment?: core.Supplier;
+ token?: 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;
+ }
+}
+
+/**
+ * Event source interactions.
+ */
+export class EventSource {
+ constructor(protected readonly _options: EventSource.Options = {}) {}
+
+ /**
+ * Gets an event source.
+ *
+ * @param {DevRev.EventSourcesGetQuery} request
+ * @param {EventSource.RequestOptions} requestOptions - Request-specific configuration.
+ *
+ * @throws {@link DevRev.BadRequestError}
+ * @throws {@link DevRev.UnauthorizedError}
+ * @throws {@link DevRev.ForbiddenError}
+ * @throws {@link DevRev.NotFoundError}
+ * @throws {@link DevRev.TooManyRequestsError}
+ * @throws {@link DevRev.InternalServerError}
+ * @throws {@link DevRev.ServiceUnavailableError}
+ *
+ * @example
+ * await client.eventSource.get({
+ * id: "id"
+ * })
+ */
+ public async get(
+ request: DevRev.EventSourcesGetQuery,
+ requestOptions?: EventSource.RequestOptions
+ ): Promise {
+ const { id } = request;
+ const _queryParams: Record = {};
+ _queryParams["id"] = id;
+ const _response = await (this._options.fetcher ?? core.fetcher)({
+ url: urlJoin(
+ (await core.Supplier.get(this._options.environment)) ?? environments.DevRevEnvironment.Default,
+ "event-sources.get"
+ ),
+ method: "GET",
+ headers: {
+ Authorization: await this._getAuthorizationHeader(),
+ "X-Fern-Language": "JavaScript",
+ "X-Fern-SDK-Name": "@devrev/api",
+ "X-Fern-SDK-Version": "0.0.14",
+ "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 serializers.EventSourceGetResponse.parseOrThrow(_response.body, {
+ unrecognizedObjectKeys: "passthrough",
+ allowUnrecognizedUnionMembers: true,
+ allowUnrecognizedEnumValues: true,
+ skipValidation: true,
+ breadcrumbsPrefix: ["response"],
+ });
+ }
+
+ if (_response.error.reason === "status-code") {
+ switch (_response.error.statusCode) {
+ case 400:
+ throw new DevRev.BadRequestError(
+ serializers.ErrorBadRequest.parseOrThrow(_response.error.body, {
+ unrecognizedObjectKeys: "passthrough",
+ allowUnrecognizedUnionMembers: true,
+ allowUnrecognizedEnumValues: true,
+ skipValidation: true,
+ breadcrumbsPrefix: ["response"],
+ })
+ );
+ case 401:
+ throw new DevRev.UnauthorizedError(
+ serializers.ErrorUnauthorized.parseOrThrow(_response.error.body, {
+ unrecognizedObjectKeys: "passthrough",
+ allowUnrecognizedUnionMembers: true,
+ allowUnrecognizedEnumValues: true,
+ skipValidation: true,
+ breadcrumbsPrefix: ["response"],
+ })
+ );
+ case 403:
+ throw new DevRev.ForbiddenError(
+ serializers.ErrorForbidden.parseOrThrow(_response.error.body, {
+ unrecognizedObjectKeys: "passthrough",
+ allowUnrecognizedUnionMembers: true,
+ allowUnrecognizedEnumValues: true,
+ skipValidation: true,
+ breadcrumbsPrefix: ["response"],
+ })
+ );
+ case 404:
+ throw new DevRev.NotFoundError(
+ serializers.ErrorNotFound.parseOrThrow(_response.error.body, {
+ unrecognizedObjectKeys: "passthrough",
+ allowUnrecognizedUnionMembers: true,
+ allowUnrecognizedEnumValues: true,
+ skipValidation: true,
+ breadcrumbsPrefix: ["response"],
+ })
+ );
+ case 429:
+ throw new DevRev.TooManyRequestsError(
+ serializers.ErrorTooManyRequests.parseOrThrow(_response.error.body, {
+ unrecognizedObjectKeys: "passthrough",
+ allowUnrecognizedUnionMembers: true,
+ allowUnrecognizedEnumValues: true,
+ skipValidation: true,
+ breadcrumbsPrefix: ["response"],
+ })
+ );
+ case 500:
+ throw new DevRev.InternalServerError(
+ serializers.ErrorInternalServerError.parseOrThrow(_response.error.body, {
+ unrecognizedObjectKeys: "passthrough",
+ allowUnrecognizedUnionMembers: true,
+ allowUnrecognizedEnumValues: true,
+ skipValidation: true,
+ breadcrumbsPrefix: ["response"],
+ })
+ );
+ case 503:
+ throw new DevRev.ServiceUnavailableError(
+ serializers.ErrorServiceUnavailable.parseOrThrow(_response.error.body, {
+ unrecognizedObjectKeys: "passthrough",
+ allowUnrecognizedUnionMembers: true,
+ allowUnrecognizedEnumValues: true,
+ skipValidation: true,
+ breadcrumbsPrefix: ["response"],
+ })
+ );
+ default:
+ throw new errors.DevRevError({
+ statusCode: _response.error.statusCode,
+ body: _response.error.body,
+ });
+ }
+ }
+
+ switch (_response.error.reason) {
+ case "non-json":
+ throw new errors.DevRevError({
+ statusCode: _response.error.statusCode,
+ body: _response.error.rawBody,
+ });
+ case "timeout":
+ throw new errors.DevRevTimeoutError();
+ case "unknown":
+ throw new errors.DevRevError({
+ message: _response.error.errorMessage,
+ });
+ }
+ }
+
+ /**
+ * Gets an event source.
+ *
+ * @param {DevRev.EventSourceGetRequest} request
+ * @param {EventSource.RequestOptions} requestOptions - Request-specific configuration.
+ *
+ * @throws {@link DevRev.BadRequestError}
+ * @throws {@link DevRev.UnauthorizedError}
+ * @throws {@link DevRev.ForbiddenError}
+ * @throws {@link DevRev.NotFoundError}
+ * @throws {@link DevRev.TooManyRequestsError}
+ * @throws {@link DevRev.InternalServerError}
+ * @throws {@link DevRev.ServiceUnavailableError}
+ *
+ * @example
+ * await client.eventSource.getPost({
+ * id: "id"
+ * })
+ */
+ public async getPost(
+ request: DevRev.EventSourceGetRequest,
+ requestOptions?: EventSource.RequestOptions
+ ): Promise {
+ const _response = await (this._options.fetcher ?? core.fetcher)({
+ url: urlJoin(
+ (await core.Supplier.get(this._options.environment)) ?? environments.DevRevEnvironment.Default,
+ "event-sources.get"
+ ),
+ method: "POST",
+ headers: {
+ Authorization: await this._getAuthorizationHeader(),
+ "X-Fern-Language": "JavaScript",
+ "X-Fern-SDK-Name": "@devrev/api",
+ "X-Fern-SDK-Version": "0.0.14",
+ "X-Fern-Runtime": core.RUNTIME.type,
+ "X-Fern-Runtime-Version": core.RUNTIME.version,
+ },
+ contentType: "application/json",
+ requestType: "json",
+ body: serializers.EventSourceGetRequest.jsonOrThrow(request, { unrecognizedObjectKeys: "strip" }),
+ timeoutMs: requestOptions?.timeoutInSeconds != null ? requestOptions.timeoutInSeconds * 1000 : 60000,
+ maxRetries: requestOptions?.maxRetries,
+ abortSignal: requestOptions?.abortSignal,
+ });
+ if (_response.ok) {
+ return serializers.EventSourceGetResponse.parseOrThrow(_response.body, {
+ unrecognizedObjectKeys: "passthrough",
+ allowUnrecognizedUnionMembers: true,
+ allowUnrecognizedEnumValues: true,
+ skipValidation: true,
+ breadcrumbsPrefix: ["response"],
+ });
+ }
+
+ if (_response.error.reason === "status-code") {
+ switch (_response.error.statusCode) {
+ case 400:
+ throw new DevRev.BadRequestError(
+ serializers.ErrorBadRequest.parseOrThrow(_response.error.body, {
+ unrecognizedObjectKeys: "passthrough",
+ allowUnrecognizedUnionMembers: true,
+ allowUnrecognizedEnumValues: true,
+ skipValidation: true,
+ breadcrumbsPrefix: ["response"],
+ })
+ );
+ case 401:
+ throw new DevRev.UnauthorizedError(
+ serializers.ErrorUnauthorized.parseOrThrow(_response.error.body, {
+ unrecognizedObjectKeys: "passthrough",
+ allowUnrecognizedUnionMembers: true,
+ allowUnrecognizedEnumValues: true,
+ skipValidation: true,
+ breadcrumbsPrefix: ["response"],
+ })
+ );
+ case 403:
+ throw new DevRev.ForbiddenError(
+ serializers.ErrorForbidden.parseOrThrow(_response.error.body, {
+ unrecognizedObjectKeys: "passthrough",
+ allowUnrecognizedUnionMembers: true,
+ allowUnrecognizedEnumValues: true,
+ skipValidation: true,
+ breadcrumbsPrefix: ["response"],
+ })
+ );
+ case 404:
+ throw new DevRev.NotFoundError(
+ serializers.ErrorNotFound.parseOrThrow(_response.error.body, {
+ unrecognizedObjectKeys: "passthrough",
+ allowUnrecognizedUnionMembers: true,
+ allowUnrecognizedEnumValues: true,
+ skipValidation: true,
+ breadcrumbsPrefix: ["response"],
+ })
+ );
+ case 429:
+ throw new DevRev.TooManyRequestsError(
+ serializers.ErrorTooManyRequests.parseOrThrow(_response.error.body, {
+ unrecognizedObjectKeys: "passthrough",
+ allowUnrecognizedUnionMembers: true,
+ allowUnrecognizedEnumValues: true,
+ skipValidation: true,
+ breadcrumbsPrefix: ["response"],
+ })
+ );
+ case 500:
+ throw new DevRev.InternalServerError(
+ serializers.ErrorInternalServerError.parseOrThrow(_response.error.body, {
+ unrecognizedObjectKeys: "passthrough",
+ allowUnrecognizedUnionMembers: true,
+ allowUnrecognizedEnumValues: true,
+ skipValidation: true,
+ breadcrumbsPrefix: ["response"],
+ })
+ );
+ case 503:
+ throw new DevRev.ServiceUnavailableError(
+ serializers.ErrorServiceUnavailable.parseOrThrow(_response.error.body, {
+ unrecognizedObjectKeys: "passthrough",
+ allowUnrecognizedUnionMembers: true,
+ allowUnrecognizedEnumValues: true,
+ skipValidation: true,
+ breadcrumbsPrefix: ["response"],
+ })
+ );
+ default:
+ throw new errors.DevRevError({
+ statusCode: _response.error.statusCode,
+ body: _response.error.body,
+ });
+ }
+ }
+
+ switch (_response.error.reason) {
+ case "non-json":
+ throw new errors.DevRevError({
+ statusCode: _response.error.statusCode,
+ body: _response.error.rawBody,
+ });
+ case "timeout":
+ throw new errors.DevRevTimeoutError();
+ case "unknown":
+ throw new errors.DevRevError({
+ message: _response.error.errorMessage,
+ });
+ }
+ }
+
+ /**
+ * Schedules an event to be published to the specified event source.
+ *
+ * @param {DevRev.EventSourcesScheduleEventRequest} request
+ * @param {EventSource.RequestOptions} requestOptions - Request-specific configuration.
+ *
+ * @throws {@link DevRev.BadRequestError}
+ * @throws {@link DevRev.UnauthorizedError}
+ * @throws {@link DevRev.ForbiddenError}
+ * @throws {@link DevRev.NotFoundError}
+ * @throws {@link DevRev.TooManyRequestsError}
+ * @throws {@link DevRev.InternalServerError}
+ * @throws {@link DevRev.ServiceUnavailableError}
+ *
+ * @example
+ * await client.eventSource.scheduleEvent({
+ * eventType: "event_type",
+ * id: "id",
+ * payload: "payload"
+ * })
+ */
+ public async scheduleEvent(
+ request: DevRev.EventSourcesScheduleEventRequest,
+ requestOptions?: EventSource.RequestOptions
+ ): Promise {
+ const _response = await (this._options.fetcher ?? core.fetcher)({
+ url: urlJoin(
+ (await core.Supplier.get(this._options.environment)) ?? environments.DevRevEnvironment.Default,
+ "event-sources.schedule"
+ ),
+ method: "POST",
+ headers: {
+ Authorization: await this._getAuthorizationHeader(),
+ "X-Fern-Language": "JavaScript",
+ "X-Fern-SDK-Name": "@devrev/api",
+ "X-Fern-SDK-Version": "0.0.14",
+ "X-Fern-Runtime": core.RUNTIME.type,
+ "X-Fern-Runtime-Version": core.RUNTIME.version,
+ },
+ contentType: "application/json",
+ requestType: "json",
+ body: serializers.EventSourcesScheduleEventRequest.jsonOrThrow(request, {
+ unrecognizedObjectKeys: "strip",
+ }),
+ timeoutMs: requestOptions?.timeoutInSeconds != null ? requestOptions.timeoutInSeconds * 1000 : 60000,
+ maxRetries: requestOptions?.maxRetries,
+ abortSignal: requestOptions?.abortSignal,
+ });
+ if (_response.ok) {
+ return serializers.EventSourcesScheduleEventResponse.parseOrThrow(_response.body, {
+ unrecognizedObjectKeys: "passthrough",
+ allowUnrecognizedUnionMembers: true,
+ allowUnrecognizedEnumValues: true,
+ skipValidation: true,
+ breadcrumbsPrefix: ["response"],
+ });
+ }
+
+ if (_response.error.reason === "status-code") {
+ switch (_response.error.statusCode) {
+ case 400:
+ throw new DevRev.BadRequestError(
+ serializers.ErrorBadRequest.parseOrThrow(_response.error.body, {
+ unrecognizedObjectKeys: "passthrough",
+ allowUnrecognizedUnionMembers: true,
+ allowUnrecognizedEnumValues: true,
+ skipValidation: true,
+ breadcrumbsPrefix: ["response"],
+ })
+ );
+ case 401:
+ throw new DevRev.UnauthorizedError(
+ serializers.ErrorUnauthorized.parseOrThrow(_response.error.body, {
+ unrecognizedObjectKeys: "passthrough",
+ allowUnrecognizedUnionMembers: true,
+ allowUnrecognizedEnumValues: true,
+ skipValidation: true,
+ breadcrumbsPrefix: ["response"],
+ })
+ );
+ case 403:
+ throw new DevRev.ForbiddenError(
+ serializers.ErrorForbidden.parseOrThrow(_response.error.body, {
+ unrecognizedObjectKeys: "passthrough",
+ allowUnrecognizedUnionMembers: true,
+ allowUnrecognizedEnumValues: true,
+ skipValidation: true,
+ breadcrumbsPrefix: ["response"],
+ })
+ );
+ case 404:
+ throw new DevRev.NotFoundError(
+ serializers.ErrorNotFound.parseOrThrow(_response.error.body, {
+ unrecognizedObjectKeys: "passthrough",
+ allowUnrecognizedUnionMembers: true,
+ allowUnrecognizedEnumValues: true,
+ skipValidation: true,
+ breadcrumbsPrefix: ["response"],
+ })
+ );
+ case 429:
+ throw new DevRev.TooManyRequestsError(
+ serializers.ErrorTooManyRequests.parseOrThrow(_response.error.body, {
+ unrecognizedObjectKeys: "passthrough",
+ allowUnrecognizedUnionMembers: true,
+ allowUnrecognizedEnumValues: true,
+ skipValidation: true,
+ breadcrumbsPrefix: ["response"],
+ })
+ );
+ case 500:
+ throw new DevRev.InternalServerError(
+ serializers.ErrorInternalServerError.parseOrThrow(_response.error.body, {
+ unrecognizedObjectKeys: "passthrough",
+ allowUnrecognizedUnionMembers: true,
+ allowUnrecognizedEnumValues: true,
+ skipValidation: true,
+ breadcrumbsPrefix: ["response"],
+ })
+ );
+ case 503:
+ throw new DevRev.ServiceUnavailableError(
+ serializers.ErrorServiceUnavailable.parseOrThrow(_response.error.body, {
+ unrecognizedObjectKeys: "passthrough",
+ allowUnrecognizedUnionMembers: true,
+ allowUnrecognizedEnumValues: true,
+ skipValidation: true,
+ breadcrumbsPrefix: ["response"],
+ })
+ );
+ default:
+ throw new errors.DevRevError({
+ statusCode: _response.error.statusCode,
+ body: _response.error.body,
+ });
+ }
+ }
+
+ switch (_response.error.reason) {
+ case "non-json":
+ throw new errors.DevRevError({
+ statusCode: _response.error.statusCode,
+ body: _response.error.rawBody,
+ });
+ case "timeout":
+ throw new errors.DevRevTimeoutError();
+ case "unknown":
+ throw new errors.DevRevError({
+ message: _response.error.errorMessage,
+ });
+ }
+ }
+
+ /**
+ * Deletes an event scheduled for the specified event source.
+ *
+ * @param {DevRev.EventSourcesDeleteScheduledEventRequest} request
+ * @param {EventSource.RequestOptions} requestOptions - Request-specific configuration.
+ *
+ * @throws {@link DevRev.BadRequestError}
+ * @throws {@link DevRev.UnauthorizedError}
+ * @throws {@link DevRev.ForbiddenError}
+ * @throws {@link DevRev.NotFoundError}
+ * @throws {@link DevRev.TooManyRequestsError}
+ * @throws {@link DevRev.InternalServerError}
+ * @throws {@link DevRev.ServiceUnavailableError}
+ *
+ * @example
+ * await client.eventSource.deleteScheduledEvent({
+ * eventKey: "event_key",
+ * id: "id"
+ * })
+ */
+ public async deleteScheduledEvent(
+ request: DevRev.EventSourcesDeleteScheduledEventRequest,
+ requestOptions?: EventSource.RequestOptions
+ ): Promise {
+ const _response = await (this._options.fetcher ?? core.fetcher)({
+ url: urlJoin(
+ (await core.Supplier.get(this._options.environment)) ?? environments.DevRevEnvironment.Default,
+ "event-sources.unschedule"
+ ),
+ method: "POST",
+ headers: {
+ Authorization: await this._getAuthorizationHeader(),
+ "X-Fern-Language": "JavaScript",
+ "X-Fern-SDK-Name": "@devrev/api",
+ "X-Fern-SDK-Version": "0.0.14",
+ "X-Fern-Runtime": core.RUNTIME.type,
+ "X-Fern-Runtime-Version": core.RUNTIME.version,
+ },
+ contentType: "application/json",
+ requestType: "json",
+ body: serializers.EventSourcesDeleteScheduledEventRequest.jsonOrThrow(request, {
+ unrecognizedObjectKeys: "strip",
+ }),
+ 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 DevRev.BadRequestError(
+ serializers.ErrorBadRequest.parseOrThrow(_response.error.body, {
+ unrecognizedObjectKeys: "passthrough",
+ allowUnrecognizedUnionMembers: true,
+ allowUnrecognizedEnumValues: true,
+ skipValidation: true,
+ breadcrumbsPrefix: ["response"],
+ })
+ );
+ case 401:
+ throw new DevRev.UnauthorizedError(
+ serializers.ErrorUnauthorized.parseOrThrow(_response.error.body, {
+ unrecognizedObjectKeys: "passthrough",
+ allowUnrecognizedUnionMembers: true,
+ allowUnrecognizedEnumValues: true,
+ skipValidation: true,
+ breadcrumbsPrefix: ["response"],
+ })
+ );
+ case 403:
+ throw new DevRev.ForbiddenError(
+ serializers.ErrorForbidden.parseOrThrow(_response.error.body, {
+ unrecognizedObjectKeys: "passthrough",
+ allowUnrecognizedUnionMembers: true,
+ allowUnrecognizedEnumValues: true,
+ skipValidation: true,
+ breadcrumbsPrefix: ["response"],
+ })
+ );
+ case 404:
+ throw new DevRev.NotFoundError(
+ serializers.ErrorNotFound.parseOrThrow(_response.error.body, {
+ unrecognizedObjectKeys: "passthrough",
+ allowUnrecognizedUnionMembers: true,
+ allowUnrecognizedEnumValues: true,
+ skipValidation: true,
+ breadcrumbsPrefix: ["response"],
+ })
+ );
+ case 429:
+ throw new DevRev.TooManyRequestsError(
+ serializers.ErrorTooManyRequests.parseOrThrow(_response.error.body, {
+ unrecognizedObjectKeys: "passthrough",
+ allowUnrecognizedUnionMembers: true,
+ allowUnrecognizedEnumValues: true,
+ skipValidation: true,
+ breadcrumbsPrefix: ["response"],
+ })
+ );
+ case 500:
+ throw new DevRev.InternalServerError(
+ serializers.ErrorInternalServerError.parseOrThrow(_response.error.body, {
+ unrecognizedObjectKeys: "passthrough",
+ allowUnrecognizedUnionMembers: true,
+ allowUnrecognizedEnumValues: true,
+ skipValidation: true,
+ breadcrumbsPrefix: ["response"],
+ })
+ );
+ case 503:
+ throw new DevRev.ServiceUnavailableError(
+ serializers.ErrorServiceUnavailable.parseOrThrow(_response.error.body, {
+ unrecognizedObjectKeys: "passthrough",
+ allowUnrecognizedUnionMembers: true,
+ allowUnrecognizedEnumValues: true,
+ skipValidation: true,
+ breadcrumbsPrefix: ["response"],
+ })
+ );
+ default:
+ throw new errors.DevRevError({
+ statusCode: _response.error.statusCode,
+ body: _response.error.body,
+ });
+ }
+ }
+
+ switch (_response.error.reason) {
+ case "non-json":
+ throw new errors.DevRevError({
+ statusCode: _response.error.statusCode,
+ body: _response.error.rawBody,
+ });
+ case "timeout":
+ throw new errors.DevRevTimeoutError();
+ case "unknown":
+ throw new errors.DevRevError({
+ message: _response.error.errorMessage,
+ });
+ }
+ }
+
+ /**
+ * Allows publishing of events (example from plug widget).
+ *
+ * @param {DevRev.TrackEventsPublishRequest} request
+ * @param {EventSource.RequestOptions} requestOptions - Request-specific configuration.
+ *
+ * @throws {@link DevRev.BadRequestError}
+ * @throws {@link DevRev.UnauthorizedError}
+ * @throws {@link DevRev.ForbiddenError}
+ * @throws {@link DevRev.TooManyRequestsError}
+ * @throws {@link DevRev.InternalServerError}
+ * @throws {@link DevRev.ServiceUnavailableError}
+ *
+ * @example
+ * await client.eventSource.trackEventsPublish({
+ * eventsList: [{
+ * name: "name",
+ * payload: {
+ * "key": "value"
+ * }
+ * }]
+ * })
+ */
+ public async trackEventsPublish(
+ request: DevRev.TrackEventsPublishRequest,
+ requestOptions?: EventSource.RequestOptions
+ ): Promise {
+ const _response = await (this._options.fetcher ?? core.fetcher)({
+ url: urlJoin(
+ (await core.Supplier.get(this._options.environment)) ?? environments.DevRevEnvironment.Default,
+ "track-events.publish"
+ ),
+ method: "POST",
+ headers: {
+ Authorization: await this._getAuthorizationHeader(),
+ "X-Fern-Language": "JavaScript",
+ "X-Fern-SDK-Name": "@devrev/api",
+ "X-Fern-SDK-Version": "0.0.14",
+ "X-Fern-Runtime": core.RUNTIME.type,
+ "X-Fern-Runtime-Version": core.RUNTIME.version,
+ },
+ contentType: "application/json",
+ requestType: "json",
+ body: serializers.TrackEventsPublishRequest.jsonOrThrow(request, { unrecognizedObjectKeys: "strip" }),
+ timeoutMs: requestOptions?.timeoutInSeconds != null ? requestOptions.timeoutInSeconds * 1000 : 60000,
+ maxRetries: requestOptions?.maxRetries,
+ abortSignal: requestOptions?.abortSignal,
+ });
+ if (_response.ok) {
+ return serializers.TrackEventsPublishResponse.parseOrThrow(_response.body, {
+ unrecognizedObjectKeys: "passthrough",
+ allowUnrecognizedUnionMembers: true,
+ allowUnrecognizedEnumValues: true,
+ skipValidation: true,
+ breadcrumbsPrefix: ["response"],
+ });
+ }
+
+ if (_response.error.reason === "status-code") {
+ switch (_response.error.statusCode) {
+ case 400:
+ throw new DevRev.BadRequestError(
+ serializers.ErrorBadRequest.parseOrThrow(_response.error.body, {
+ unrecognizedObjectKeys: "passthrough",
+ allowUnrecognizedUnionMembers: true,
+ allowUnrecognizedEnumValues: true,
+ skipValidation: true,
+ breadcrumbsPrefix: ["response"],
+ })
+ );
+ case 401:
+ throw new DevRev.UnauthorizedError(
+ serializers.ErrorUnauthorized.parseOrThrow(_response.error.body, {
+ unrecognizedObjectKeys: "passthrough",
+ allowUnrecognizedUnionMembers: true,
+ allowUnrecognizedEnumValues: true,
+ skipValidation: true,
+ breadcrumbsPrefix: ["response"],
+ })
+ );
+ case 403:
+ throw new DevRev.ForbiddenError(
+ serializers.ErrorForbidden.parseOrThrow(_response.error.body, {
+ unrecognizedObjectKeys: "passthrough",
+ allowUnrecognizedUnionMembers: true,
+ allowUnrecognizedEnumValues: true,
+ skipValidation: true,
+ breadcrumbsPrefix: ["response"],
+ })
+ );
+ case 429:
+ throw new DevRev.TooManyRequestsError(
+ serializers.ErrorTooManyRequests.parseOrThrow(_response.error.body, {
+ unrecognizedObjectKeys: "passthrough",
+ allowUnrecognizedUnionMembers: true,
+ allowUnrecognizedEnumValues: true,
+ skipValidation: true,
+ breadcrumbsPrefix: ["response"],
+ })
+ );
+ case 500:
+ throw new DevRev.InternalServerError(
+ serializers.ErrorInternalServerError.parseOrThrow(_response.error.body, {
+ unrecognizedObjectKeys: "passthrough",
+ allowUnrecognizedUnionMembers: true,
+ allowUnrecognizedEnumValues: true,
+ skipValidation: true,
+ breadcrumbsPrefix: ["response"],
+ })
+ );
+ case 503:
+ throw new DevRev.ServiceUnavailableError(
+ serializers.ErrorServiceUnavailable.parseOrThrow(_response.error.body, {
+ unrecognizedObjectKeys: "passthrough",
+ allowUnrecognizedUnionMembers: true,
+ allowUnrecognizedEnumValues: true,
+ skipValidation: true,
+ breadcrumbsPrefix: ["response"],
+ })
+ );
+ default:
+ throw new errors.DevRevError({
+ statusCode: _response.error.statusCode,
+ body: _response.error.body,
+ });
+ }
+ }
+
+ switch (_response.error.reason) {
+ case "non-json":
+ throw new errors.DevRevError({
+ statusCode: _response.error.statusCode,
+ body: _response.error.rawBody,
+ });
+ case "timeout":
+ throw new errors.DevRevTimeoutError();
+ case "unknown":
+ throw new errors.DevRevError({
+ message: _response.error.errorMessage,
+ });
+ }
+ }
+
+ protected async _getAuthorizationHeader(): Promise {
+ const bearer = (await core.Supplier.get(this._options.token)) ?? process?.env["DEVREV_TOKEN"];
+ if (bearer == null) {
+ throw new errors.DevRevError({
+ message: "Please specify DEVREV_TOKEN when instantiating the client.",
+ });
+ }
+
+ return `Bearer ${bearer}`;
+ }
+}
diff --git a/src/api/resources/eventSource/client/index.ts b/src/api/resources/eventSource/client/index.ts
new file mode 100644
index 0000000..415726b
--- /dev/null
+++ b/src/api/resources/eventSource/client/index.ts
@@ -0,0 +1 @@
+export * from "./requests";
diff --git a/src/api/resources/eventSource/client/requests/EventSourceGetRequest.ts b/src/api/resources/eventSource/client/requests/EventSourceGetRequest.ts
new file mode 100644
index 0000000..3fc7e2d
--- /dev/null
+++ b/src/api/resources/eventSource/client/requests/EventSourceGetRequest.ts
@@ -0,0 +1,14 @@
+/**
+ * This file was auto-generated by Fern from our API Definition.
+ */
+
+/**
+ * @example
+ * {
+ * id: "id"
+ * }
+ */
+export interface EventSourceGetRequest {
+ /** The event source's ID. */
+ id: string;
+}
diff --git a/src/api/resources/eventSource/client/requests/EventSourcesDeleteScheduledEventRequest.ts b/src/api/resources/eventSource/client/requests/EventSourcesDeleteScheduledEventRequest.ts
new file mode 100644
index 0000000..1cbcb0b
--- /dev/null
+++ b/src/api/resources/eventSource/client/requests/EventSourcesDeleteScheduledEventRequest.ts
@@ -0,0 +1,17 @@
+/**
+ * This file was auto-generated by Fern from our API Definition.
+ */
+
+/**
+ * @example
+ * {
+ * eventKey: "event_key",
+ * id: "id"
+ * }
+ */
+export interface EventSourcesDeleteScheduledEventRequest {
+ /** The event key for the event which we want to delete. */
+ eventKey: string;
+ /** The event source's ID. */
+ id: string;
+}
diff --git a/src/api/resources/eventSource/client/requests/EventSourcesGetQuery.ts b/src/api/resources/eventSource/client/requests/EventSourcesGetQuery.ts
new file mode 100644
index 0000000..5d3c3a1
--- /dev/null
+++ b/src/api/resources/eventSource/client/requests/EventSourcesGetQuery.ts
@@ -0,0 +1,16 @@
+/**
+ * This file was auto-generated by Fern from our API Definition.
+ */
+
+/**
+ * @example
+ * {
+ * id: "id"
+ * }
+ */
+export interface EventSourcesGetQuery {
+ /**
+ * The event source's ID.
+ */
+ id: string;
+}
diff --git a/src/api/resources/eventSource/client/requests/EventSourcesScheduleEventRequest.ts b/src/api/resources/eventSource/client/requests/EventSourcesScheduleEventRequest.ts
new file mode 100644
index 0000000..e40454b
--- /dev/null
+++ b/src/api/resources/eventSource/client/requests/EventSourcesScheduleEventRequest.ts
@@ -0,0 +1,40 @@
+/**
+ * This file was auto-generated by Fern from our API Definition.
+ */
+
+/**
+ * @example
+ * {
+ * eventType: "event_type",
+ * id: "id",
+ * payload: "payload"
+ * }
+ */
+export interface EventSourcesScheduleEventRequest {
+ /**
+ * A unique key for this event (scoped to an event source) used for
+ * updating/getting/deleting scheduled events.
+ *
+ */
+ eventKey?: string;
+ /** The type of the event. */
+ eventType: string;
+ /** The event source's ID. */
+ id: string;
+ /** The raw payload of the event. */
+ payload: string;
+ /**
+ * The timestamp at which the event should be published. The event is
+ * guaranteed to be published after this. If omitted, the event is
+ * published immediately.
+ *
+ */
+ publishAt?: Date;
+ /**
+ * Whether or not to update an existing scheduled event with the same
+ * event key. If this is false, and an event is already scheduled with
+ * the same event key, then HTTP 409 Conflict is returned.
+ *
+ */
+ updateIfExists?: boolean;
+}
diff --git a/src/api/resources/eventSource/client/requests/TrackEventsPublishRequest.ts b/src/api/resources/eventSource/client/requests/TrackEventsPublishRequest.ts
new file mode 100644
index 0000000..8d34a58
--- /dev/null
+++ b/src/api/resources/eventSource/client/requests/TrackEventsPublishRequest.ts
@@ -0,0 +1,20 @@
+/**
+ * This file was auto-generated by Fern from our API Definition.
+ */
+
+import * as DevRev from "../../../../index";
+
+/**
+ * @example
+ * {
+ * eventsList: [{
+ * name: "name",
+ * payload: {
+ * "key": "value"
+ * }
+ * }]
+ * }
+ */
+export interface TrackEventsPublishRequest {
+ eventsList: DevRev.TrackEvent[];
+}
diff --git a/src/api/resources/eventSource/client/requests/index.ts b/src/api/resources/eventSource/client/requests/index.ts
new file mode 100644
index 0000000..c1ed9d7
--- /dev/null
+++ b/src/api/resources/eventSource/client/requests/index.ts
@@ -0,0 +1,5 @@
+export { type EventSourcesGetQuery } from "./EventSourcesGetQuery";
+export { type EventSourceGetRequest } from "./EventSourceGetRequest";
+export { type EventSourcesScheduleEventRequest } from "./EventSourcesScheduleEventRequest";
+export { type EventSourcesDeleteScheduledEventRequest } from "./EventSourcesDeleteScheduledEventRequest";
+export { type TrackEventsPublishRequest } from "./TrackEventsPublishRequest";
diff --git a/src/api/resources/eventSource/index.ts b/src/api/resources/eventSource/index.ts
new file mode 100644
index 0000000..5ec7692
--- /dev/null
+++ b/src/api/resources/eventSource/index.ts
@@ -0,0 +1 @@
+export * from "./client";
diff --git a/src/api/resources/groups/client/Client.ts b/src/api/resources/groups/client/Client.ts
new file mode 100644
index 0000000..6fefbff
--- /dev/null
+++ b/src/api/resources/groups/client/Client.ts
@@ -0,0 +1,1539 @@
+/**
+ * This file was auto-generated by Fern from our API Definition.
+ */
+
+import * as environments from "../../../../environments";
+import * as core from "../../../../core";
+import * as DevRev from "../../../index";
+import * as serializers from "../../../../serialization/index";
+import urlJoin from "url-join";
+import * as errors from "../../../../errors/index";
+
+export declare namespace Groups {
+ interface Options {
+ environment?: core.Supplier;
+ token?: 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;
+ }
+}
+
+/**
+ * Manages groups in a Dev organization.
+ */
+export class Groups {
+ constructor(protected readonly _options: Groups.Options = {}) {}
+
+ /**
+ * Creates a new group. A group is a collection of users.
+ *
+ * @param {DevRev.GroupsCreateRequest} request
+ * @param {Groups.RequestOptions} requestOptions - Request-specific configuration.
+ *
+ * @throws {@link DevRev.BadRequestError}
+ * @throws {@link DevRev.UnauthorizedError}
+ * @throws {@link DevRev.ForbiddenError}
+ * @throws {@link DevRev.TooManyRequestsError}
+ * @throws {@link DevRev.InternalServerError}
+ * @throws {@link DevRev.ServiceUnavailableError}
+ *
+ * @example
+ * await client.groups.create({
+ * description: "description",
+ * name: "name"
+ * })
+ */
+ public async create(
+ request: DevRev.GroupsCreateRequest,
+ requestOptions?: Groups.RequestOptions
+ ): Promise {
+ const _response = await (this._options.fetcher ?? core.fetcher)({
+ url: urlJoin(
+ (await core.Supplier.get(this._options.environment)) ?? environments.DevRevEnvironment.Default,
+ "groups.create"
+ ),
+ method: "POST",
+ headers: {
+ Authorization: await this._getAuthorizationHeader(),
+ "X-Fern-Language": "JavaScript",
+ "X-Fern-SDK-Name": "@devrev/api",
+ "X-Fern-SDK-Version": "0.0.14",
+ "X-Fern-Runtime": core.RUNTIME.type,
+ "X-Fern-Runtime-Version": core.RUNTIME.version,
+ },
+ contentType: "application/json",
+ requestType: "json",
+ body: serializers.GroupsCreateRequest.jsonOrThrow(request, { unrecognizedObjectKeys: "strip" }),
+ timeoutMs: requestOptions?.timeoutInSeconds != null ? requestOptions.timeoutInSeconds * 1000 : 60000,
+ maxRetries: requestOptions?.maxRetries,
+ abortSignal: requestOptions?.abortSignal,
+ });
+ if (_response.ok) {
+ return serializers.GroupsCreateResponse.parseOrThrow(_response.body, {
+ unrecognizedObjectKeys: "passthrough",
+ allowUnrecognizedUnionMembers: true,
+ allowUnrecognizedEnumValues: true,
+ skipValidation: true,
+ breadcrumbsPrefix: ["response"],
+ });
+ }
+
+ if (_response.error.reason === "status-code") {
+ switch (_response.error.statusCode) {
+ case 400:
+ throw new DevRev.BadRequestError(
+ serializers.ErrorBadRequest.parseOrThrow(_response.error.body, {
+ unrecognizedObjectKeys: "passthrough",
+ allowUnrecognizedUnionMembers: true,
+ allowUnrecognizedEnumValues: true,
+ skipValidation: true,
+ breadcrumbsPrefix: ["response"],
+ })
+ );
+ case 401:
+ throw new DevRev.UnauthorizedError(
+ serializers.ErrorUnauthorized.parseOrThrow(_response.error.body, {
+ unrecognizedObjectKeys: "passthrough",
+ allowUnrecognizedUnionMembers: true,
+ allowUnrecognizedEnumValues: true,
+ skipValidation: true,
+ breadcrumbsPrefix: ["response"],
+ })
+ );
+ case 403:
+ throw new DevRev.ForbiddenError(
+ serializers.ErrorForbidden.parseOrThrow(_response.error.body, {
+ unrecognizedObjectKeys: "passthrough",
+ allowUnrecognizedUnionMembers: true,
+ allowUnrecognizedEnumValues: true,
+ skipValidation: true,
+ breadcrumbsPrefix: ["response"],
+ })
+ );
+ case 429:
+ throw new DevRev.TooManyRequestsError(
+ serializers.ErrorTooManyRequests.parseOrThrow(_response.error.body, {
+ unrecognizedObjectKeys: "passthrough",
+ allowUnrecognizedUnionMembers: true,
+ allowUnrecognizedEnumValues: true,
+ skipValidation: true,
+ breadcrumbsPrefix: ["response"],
+ })
+ );
+ case 500:
+ throw new DevRev.InternalServerError(
+ serializers.ErrorInternalServerError.parseOrThrow(_response.error.body, {
+ unrecognizedObjectKeys: "passthrough",
+ allowUnrecognizedUnionMembers: true,
+ allowUnrecognizedEnumValues: true,
+ skipValidation: true,
+ breadcrumbsPrefix: ["response"],
+ })
+ );
+ case 503:
+ throw new DevRev.ServiceUnavailableError(
+ serializers.ErrorServiceUnavailable.parseOrThrow(_response.error.body, {
+ unrecognizedObjectKeys: "passthrough",
+ allowUnrecognizedUnionMembers: true,
+ allowUnrecognizedEnumValues: true,
+ skipValidation: true,
+ breadcrumbsPrefix: ["response"],
+ })
+ );
+ default:
+ throw new errors.DevRevError({
+ statusCode: _response.error.statusCode,
+ body: _response.error.body,
+ });
+ }
+ }
+
+ switch (_response.error.reason) {
+ case "non-json":
+ throw new errors.DevRevError({
+ statusCode: _response.error.statusCode,
+ body: _response.error.rawBody,
+ });
+ case "timeout":
+ throw new errors.DevRevTimeoutError();
+ case "unknown":
+ throw new errors.DevRevError({
+ message: _response.error.errorMessage,
+ });
+ }
+ }
+
+ /**
+ * Gets the requested group.
+ *
+ * @param {DevRev.GroupsGetQuery} request
+ * @param {Groups.RequestOptions} requestOptions - Request-specific configuration.
+ *
+ * @throws {@link DevRev.BadRequestError}
+ * @throws {@link DevRev.UnauthorizedError}
+ * @throws {@link DevRev.ForbiddenError}
+ * @throws {@link DevRev.NotFoundError}
+ * @throws {@link DevRev.TooManyRequestsError}
+ * @throws {@link DevRev.InternalServerError}
+ * @throws {@link DevRev.ServiceUnavailableError}
+ *
+ * @example
+ * await client.groups.get({
+ * id: "id"
+ * })
+ */
+ public async get(
+ request: DevRev.GroupsGetQuery,
+ requestOptions?: Groups.RequestOptions
+ ): Promise {
+ const { id } = request;
+ const _queryParams: Record = {};
+ _queryParams["id"] = id;
+ const _response = await (this._options.fetcher ?? core.fetcher)({
+ url: urlJoin(
+ (await core.Supplier.get(this._options.environment)) ?? environments.DevRevEnvironment.Default,
+ "groups.get"
+ ),
+ method: "GET",
+ headers: {
+ Authorization: await this._getAuthorizationHeader(),
+ "X-Fern-Language": "JavaScript",
+ "X-Fern-SDK-Name": "@devrev/api",
+ "X-Fern-SDK-Version": "0.0.14",
+ "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 serializers.GroupsGetResponse.parseOrThrow(_response.body, {
+ unrecognizedObjectKeys: "passthrough",
+ allowUnrecognizedUnionMembers: true,
+ allowUnrecognizedEnumValues: true,
+ skipValidation: true,
+ breadcrumbsPrefix: ["response"],
+ });
+ }
+
+ if (_response.error.reason === "status-code") {
+ switch (_response.error.statusCode) {
+ case 400:
+ throw new DevRev.BadRequestError(
+ serializers.ErrorBadRequest.parseOrThrow(_response.error.body, {
+ unrecognizedObjectKeys: "passthrough",
+ allowUnrecognizedUnionMembers: true,
+ allowUnrecognizedEnumValues: true,
+ skipValidation: true,
+ breadcrumbsPrefix: ["response"],
+ })
+ );
+ case 401:
+ throw new DevRev.UnauthorizedError(
+ serializers.ErrorUnauthorized.parseOrThrow(_response.error.body, {
+ unrecognizedObjectKeys: "passthrough",
+ allowUnrecognizedUnionMembers: true,
+ allowUnrecognizedEnumValues: true,
+ skipValidation: true,
+ breadcrumbsPrefix: ["response"],
+ })
+ );
+ case 403:
+ throw new DevRev.ForbiddenError(
+ serializers.ErrorForbidden.parseOrThrow(_response.error.body, {
+ unrecognizedObjectKeys: "passthrough",
+ allowUnrecognizedUnionMembers: true,
+ allowUnrecognizedEnumValues: true,
+ skipValidation: true,
+ breadcrumbsPrefix: ["response"],
+ })
+ );
+ case 404:
+ throw new DevRev.NotFoundError(
+ serializers.ErrorNotFound.parseOrThrow(_response.error.body, {
+ unrecognizedObjectKeys: "passthrough",
+ allowUnrecognizedUnionMembers: true,
+ allowUnrecognizedEnumValues: true,
+ skipValidation: true,
+ breadcrumbsPrefix: ["response"],
+ })
+ );
+ case 429:
+ throw new DevRev.TooManyRequestsError(
+ serializers.ErrorTooManyRequests.parseOrThrow(_response.error.body, {
+ unrecognizedObjectKeys: "passthrough",
+ allowUnrecognizedUnionMembers: true,
+ allowUnrecognizedEnumValues: true,
+ skipValidation: true,
+ breadcrumbsPrefix: ["response"],
+ })
+ );
+ case 500:
+ throw new DevRev.InternalServerError(
+ serializers.ErrorInternalServerError.parseOrThrow(_response.error.body, {
+ unrecognizedObjectKeys: "passthrough",
+ allowUnrecognizedUnionMembers: true,
+ allowUnrecognizedEnumValues: true,
+ skipValidation: true,
+ breadcrumbsPrefix: ["response"],
+ })
+ );
+ case 503:
+ throw new DevRev.ServiceUnavailableError(
+ serializers.ErrorServiceUnavailable.parseOrThrow(_response.error.body, {
+ unrecognizedObjectKeys: "passthrough",
+ allowUnrecognizedUnionMembers: true,
+ allowUnrecognizedEnumValues: true,
+ skipValidation: true,
+ breadcrumbsPrefix: ["response"],
+ })
+ );
+ default:
+ throw new errors.DevRevError({
+ statusCode: _response.error.statusCode,
+ body: _response.error.body,
+ });
+ }
+ }
+
+ switch (_response.error.reason) {
+ case "non-json":
+ throw new errors.DevRevError({
+ statusCode: _response.error.statusCode,
+ body: _response.error.rawBody,
+ });
+ case "timeout":
+ throw new errors.DevRevTimeoutError();
+ case "unknown":
+ throw new errors.DevRevError({
+ message: _response.error.errorMessage,
+ });
+ }
+ }
+
+ /**
+ * Gets the requested group.
+ *
+ * @param {DevRev.GroupsGetRequest} request
+ * @param {Groups.RequestOptions} requestOptions - Request-specific configuration.
+ *
+ * @throws {@link DevRev.BadRequestError}
+ * @throws {@link DevRev.UnauthorizedError}
+ * @throws {@link DevRev.ForbiddenError}
+ * @throws {@link DevRev.NotFoundError}
+ * @throws {@link DevRev.TooManyRequestsError}
+ * @throws {@link DevRev.InternalServerError}
+ * @throws {@link DevRev.ServiceUnavailableError}
+ *
+ * @example
+ * await client.groups.getPost({
+ * id: "id"
+ * })
+ */
+ public async getPost(
+ request: DevRev.GroupsGetRequest,
+ requestOptions?: Groups.RequestOptions
+ ): Promise {
+ const _response = await (this._options.fetcher ?? core.fetcher)({
+ url: urlJoin(
+ (await core.Supplier.get(this._options.environment)) ?? environments.DevRevEnvironment.Default,
+ "groups.get"
+ ),
+ method: "POST",
+ headers: {
+ Authorization: await this._getAuthorizationHeader(),
+ "X-Fern-Language": "JavaScript",
+ "X-Fern-SDK-Name": "@devrev/api",
+ "X-Fern-SDK-Version": "0.0.14",
+ "X-Fern-Runtime": core.RUNTIME.type,
+ "X-Fern-Runtime-Version": core.RUNTIME.version,
+ },
+ contentType: "application/json",
+ requestType: "json",
+ body: serializers.GroupsGetRequest.jsonOrThrow(request, { unrecognizedObjectKeys: "strip" }),
+ timeoutMs: requestOptions?.timeoutInSeconds != null ? requestOptions.timeoutInSeconds * 1000 : 60000,
+ maxRetries: requestOptions?.maxRetries,
+ abortSignal: requestOptions?.abortSignal,
+ });
+ if (_response.ok) {
+ return serializers.GroupsGetResponse.parseOrThrow(_response.body, {
+ unrecognizedObjectKeys: "passthrough",
+ allowUnrecognizedUnionMembers: true,
+ allowUnrecognizedEnumValues: true,
+ skipValidation: true,
+ breadcrumbsPrefix: ["response"],
+ });
+ }
+
+ if (_response.error.reason === "status-code") {
+ switch (_response.error.statusCode) {
+ case 400:
+ throw new DevRev.BadRequestError(
+ serializers.ErrorBadRequest.parseOrThrow(_response.error.body, {
+ unrecognizedObjectKeys: "passthrough",
+ allowUnrecognizedUnionMembers: true,
+ allowUnrecognizedEnumValues: true,
+ skipValidation: true,
+ breadcrumbsPrefix: ["response"],
+ })
+ );
+ case 401:
+ throw new DevRev.UnauthorizedError(
+ serializers.ErrorUnauthorized.parseOrThrow(_response.error.body, {
+ unrecognizedObjectKeys: "passthrough",
+ allowUnrecognizedUnionMembers: true,
+ allowUnrecognizedEnumValues: true,
+ skipValidation: true,
+ breadcrumbsPrefix: ["response"],
+ })
+ );
+ case 403:
+ throw new DevRev.ForbiddenError(
+ serializers.ErrorForbidden.parseOrThrow(_response.error.body, {
+ unrecognizedObjectKeys: "passthrough",
+ allowUnrecognizedUnionMembers: true,
+ allowUnrecognizedEnumValues: true,
+ skipValidation: true,
+ breadcrumbsPrefix: ["response"],
+ })
+ );
+ case 404:
+ throw new DevRev.NotFoundError(
+ serializers.ErrorNotFound.parseOrThrow(_response.error.body, {
+ unrecognizedObjectKeys: "passthrough",
+ allowUnrecognizedUnionMembers: true,
+ allowUnrecognizedEnumValues: true,
+ skipValidation: true,
+ breadcrumbsPrefix: ["response"],
+ })
+ );
+ case 429:
+ throw new DevRev.TooManyRequestsError(
+ serializers.ErrorTooManyRequests.parseOrThrow(_response.error.body, {
+ unrecognizedObjectKeys: "passthrough",
+ allowUnrecognizedUnionMembers: true,
+ allowUnrecognizedEnumValues: true,
+ skipValidation: true,
+ breadcrumbsPrefix: ["response"],
+ })
+ );
+ case 500:
+ throw new DevRev.InternalServerError(
+ serializers.ErrorInternalServerError.parseOrThrow(_response.error.body, {
+ unrecognizedObjectKeys: "passthrough",
+ allowUnrecognizedUnionMembers: true,
+ allowUnrecognizedEnumValues: true,
+ skipValidation: true,
+ breadcrumbsPrefix: ["response"],
+ })
+ );
+ case 503:
+ throw new DevRev.ServiceUnavailableError(
+ serializers.ErrorServiceUnavailable.parseOrThrow(_response.error.body, {
+ unrecognizedObjectKeys: "passthrough",
+ allowUnrecognizedUnionMembers: true,
+ allowUnrecognizedEnumValues: true,
+ skipValidation: true,
+ breadcrumbsPrefix: ["response"],
+ })
+ );
+ default:
+ throw new errors.DevRevError({
+ statusCode: _response.error.statusCode,
+ body: _response.error.body,
+ });
+ }
+ }
+
+ switch (_response.error.reason) {
+ case "non-json":
+ throw new errors.DevRevError({
+ statusCode: _response.error.statusCode,
+ body: _response.error.rawBody,
+ });
+ case "timeout":
+ throw new errors.DevRevTimeoutError();
+ case "unknown":
+ throw new errors.DevRevError({
+ message: _response.error.errorMessage,
+ });
+ }
+ }
+
+ /**
+ * Lists the available groups.
+ *
+ * @param {DevRev.GroupsListQuery} request
+ * @param {Groups.RequestOptions} requestOptions - Request-specific configuration.
+ *
+ * @throws {@link DevRev.BadRequestError}
+ * @throws {@link DevRev.UnauthorizedError}
+ * @throws {@link DevRev.ForbiddenError}
+ * @throws {@link DevRev.TooManyRequestsError}
+ * @throws {@link DevRev.InternalServerError}
+ * @throws {@link DevRev.ServiceUnavailableError}
+ *
+ * @example
+ * await client.groups.list()
+ */
+ public async list(
+ request: DevRev.GroupsListQuery = {},
+ requestOptions?: Groups.RequestOptions
+ ): Promise {
+ const { cursor, groupType, isDefault, limit, memberType, mode, sortBy } = request;
+ const _queryParams: Record = {};
+ if (cursor != null) {
+ _queryParams["cursor"] = cursor;
+ }
+
+ if (groupType != null) {
+ if (Array.isArray(groupType)) {
+ _queryParams["group_type"] = groupType.map((item) => item);
+ } else {
+ _queryParams["group_type"] = groupType;
+ }
+ }
+
+ if (isDefault != null) {
+ _queryParams["is_default"] = isDefault.toString();
+ }
+
+ if (limit != null) {
+ _queryParams["limit"] = limit.toString();
+ }
+
+ if (memberType != null) {
+ if (Array.isArray(memberType)) {
+ _queryParams["member_type"] = memberType.map((item) => item);
+ } else {
+ _queryParams["member_type"] = memberType;
+ }
+ }
+
+ if (mode != null) {
+ _queryParams["mode"] = mode;
+ }
+
+ if (sortBy != null) {
+ if (Array.isArray(sortBy)) {
+ _queryParams["sort_by"] = sortBy.map((item) => item);
+ } else {
+ _queryParams["sort_by"] = sortBy;
+ }
+ }
+
+ const _response = await (this._options.fetcher ?? core.fetcher)({
+ url: urlJoin(
+ (await core.Supplier.get(this._options.environment)) ?? environments.DevRevEnvironment.Default,
+ "groups.list"
+ ),
+ method: "GET",
+ headers: {
+ Authorization: await this._getAuthorizationHeader(),
+ "X-Fern-Language": "JavaScript",
+ "X-Fern-SDK-Name": "@devrev/api",
+ "X-Fern-SDK-Version": "0.0.14",
+ "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 serializers.GroupsListResponse.parseOrThrow(_response.body, {
+ unrecognizedObjectKeys: "passthrough",
+ allowUnrecognizedUnionMembers: true,
+ allowUnrecognizedEnumValues: true,
+ skipValidation: true,
+ breadcrumbsPrefix: ["response"],
+ });
+ }
+
+ if (_response.error.reason === "status-code") {
+ switch (_response.error.statusCode) {
+ case 400:
+ throw new DevRev.BadRequestError(
+ serializers.ErrorBadRequest.parseOrThrow(_response.error.body, {
+ unrecognizedObjectKeys: "passthrough",
+ allowUnrecognizedUnionMembers: true,
+ allowUnrecognizedEnumValues: true,
+ skipValidation: true,
+ breadcrumbsPrefix: ["response"],
+ })
+ );
+ case 401:
+ throw new DevRev.UnauthorizedError(
+ serializers.ErrorUnauthorized.parseOrThrow(_response.error.body, {
+ unrecognizedObjectKeys: "passthrough",
+ allowUnrecognizedUnionMembers: true,
+ allowUnrecognizedEnumValues: true,
+ skipValidation: true,
+ breadcrumbsPrefix: ["response"],
+ })
+ );
+ case 403:
+ throw new DevRev.ForbiddenError(
+ serializers.ErrorForbidden.parseOrThrow(_response.error.body, {
+ unrecognizedObjectKeys: "passthrough",
+ allowUnrecognizedUnionMembers: true,
+ allowUnrecognizedEnumValues: true,
+ skipValidation: true,
+ breadcrumbsPrefix: ["response"],
+ })
+ );
+ case 429:
+ throw new DevRev.TooManyRequestsError(
+ serializers.ErrorTooManyRequests.parseOrThrow(_response.error.body, {
+ unrecognizedObjectKeys: "passthrough",
+ allowUnrecognizedUnionMembers: true,
+ allowUnrecognizedEnumValues: true,
+ skipValidation: true,
+ breadcrumbsPrefix: ["response"],
+ })
+ );
+ case 500:
+ throw new DevRev.InternalServerError(
+ serializers.ErrorInternalServerError.parseOrThrow(_response.error.body, {
+ unrecognizedObjectKeys: "passthrough",
+ allowUnrecognizedUnionMembers: true,
+ allowUnrecognizedEnumValues: true,
+ skipValidation: true,
+ breadcrumbsPrefix: ["response"],
+ })
+ );
+ case 503:
+ throw new DevRev.ServiceUnavailableError(
+ serializers.ErrorServiceUnavailable.parseOrThrow(_response.error.body, {
+ unrecognizedObjectKeys: "passthrough",
+ allowUnrecognizedUnionMembers: true,
+ allowUnrecognizedEnumValues: true,
+ skipValidation: true,
+ breadcrumbsPrefix: ["response"],
+ })
+ );
+ default:
+ throw new errors.DevRevError({
+ statusCode: _response.error.statusCode,
+ body: _response.error.body,
+ });
+ }
+ }
+
+ switch (_response.error.reason) {
+ case "non-json":
+ throw new errors.DevRevError({
+ statusCode: _response.error.statusCode,
+ body: _response.error.rawBody,
+ });
+ case "timeout":
+ throw new errors.DevRevTimeoutError();
+ case "unknown":
+ throw new errors.DevRevError({
+ message: _response.error.errorMessage,
+ });
+ }
+ }
+
+ /**
+ * Lists the available groups.
+ *
+ * @param {DevRev.GroupsListRequest} request
+ * @param {Groups.RequestOptions} requestOptions - Request-specific configuration.
+ *
+ * @throws {@link DevRev.BadRequestError}
+ * @throws {@link DevRev.UnauthorizedError}
+ * @throws {@link DevRev.ForbiddenError}
+ * @throws {@link DevRev.TooManyRequestsError}
+ * @throws {@link DevRev.InternalServerError}
+ * @throws {@link DevRev.ServiceUnavailableError}
+ *
+ * @example
+ * await client.groups.listPost()
+ */
+ public async listPost(
+ request: DevRev.GroupsListRequest = {},
+ requestOptions?: Groups.RequestOptions
+ ): Promise {
+ const _response = await (this._options.fetcher ?? core.fetcher)({
+ url: urlJoin(
+ (await core.Supplier.get(this._options.environment)) ?? environments.DevRevEnvironment.Default,
+ "groups.list"
+ ),
+ method: "POST",
+ headers: {
+ Authorization: await this._getAuthorizationHeader(),
+ "X-Fern-Language": "JavaScript",
+ "X-Fern-SDK-Name": "@devrev/api",
+ "X-Fern-SDK-Version": "0.0.14",
+ "X-Fern-Runtime": core.RUNTIME.type,
+ "X-Fern-Runtime-Version": core.RUNTIME.version,
+ },
+ contentType: "application/json",
+ requestType: "json",
+ body: serializers.GroupsListRequest.jsonOrThrow(request, { unrecognizedObjectKeys: "strip" }),
+ timeoutMs: requestOptions?.timeoutInSeconds != null ? requestOptions.timeoutInSeconds * 1000 : 60000,
+ maxRetries: requestOptions?.maxRetries,
+ abortSignal: requestOptions?.abortSignal,
+ });
+ if (_response.ok) {
+ return serializers.GroupsListResponse.parseOrThrow(_response.body, {
+ unrecognizedObjectKeys: "passthrough",
+ allowUnrecognizedUnionMembers: true,
+ allowUnrecognizedEnumValues: true,
+ skipValidation: true,
+ breadcrumbsPrefix: ["response"],
+ });
+ }
+
+ if (_response.error.reason === "status-code") {
+ switch (_response.error.statusCode) {
+ case 400:
+ throw new DevRev.BadRequestError(
+ serializers.ErrorBadRequest.parseOrThrow(_response.error.body, {
+ unrecognizedObjectKeys: "passthrough",
+ allowUnrecognizedUnionMembers: true,
+ allowUnrecognizedEnumValues: true,
+ skipValidation: true,
+ breadcrumbsPrefix: ["response"],
+ })
+ );
+ case 401:
+ throw new DevRev.UnauthorizedError(
+ serializers.ErrorUnauthorized.parseOrThrow(_response.error.body, {
+ unrecognizedObjectKeys: "passthrough",
+ allowUnrecognizedUnionMembers: true,
+ allowUnrecognizedEnumValues: true,
+ skipValidation: true,
+ breadcrumbsPrefix: ["response"],
+ })
+ );
+ case 403:
+ throw new DevRev.ForbiddenError(
+ serializers.ErrorForbidden.parseOrThrow(_response.error.body, {
+ unrecognizedObjectKeys: "passthrough",
+ allowUnrecognizedUnionMembers: true,
+ allowUnrecognizedEnumValues: true,
+ skipValidation: true,
+ breadcrumbsPrefix: ["response"],
+ })
+ );
+ case 429:
+ throw new DevRev.TooManyRequestsError(
+ serializers.ErrorTooManyRequests.parseOrThrow(_response.error.body, {
+ unrecognizedObjectKeys: "passthrough",
+ allowUnrecognizedUnionMembers: true,
+ allowUnrecognizedEnumValues: true,
+ skipValidation: true,
+ breadcrumbsPrefix: ["response"],
+ })
+ );
+ case 500:
+ throw new DevRev.InternalServerError(
+ serializers.ErrorInternalServerError.parseOrThrow(_response.error.body, {
+ unrecognizedObjectKeys: "passthrough",
+ allowUnrecognizedUnionMembers: true,
+ allowUnrecognizedEnumValues: true,
+ skipValidation: true,
+ breadcrumbsPrefix: ["response"],
+ })
+ );
+ case 503:
+ throw new DevRev.ServiceUnavailableError(
+ serializers.ErrorServiceUnavailable.parseOrThrow(_response.error.body, {
+ unrecognizedObjectKeys: "passthrough",
+ allowUnrecognizedUnionMembers: true,
+ allowUnrecognizedEnumValues: true,
+ skipValidation: true,
+ breadcrumbsPrefix: ["response"],
+ })
+ );
+ default:
+ throw new errors.DevRevError({
+ statusCode: _response.error.statusCode,
+ body: _response.error.body,
+ });
+ }
+ }
+
+ switch (_response.error.reason) {
+ case "non-json":
+ throw new errors.DevRevError({
+ statusCode: _response.error.statusCode,
+ body: _response.error.rawBody,
+ });
+ case "timeout":
+ throw new errors.DevRevTimeoutError();
+ case "unknown":
+ throw new errors.DevRevError({
+ message: _response.error.errorMessage,
+ });
+ }
+ }
+
+ /**
+ * Adds a member to a group.
+ *
+ * @param {DevRev.GroupMembersAddRequest} request
+ * @param {Groups.RequestOptions} requestOptions - Request-specific configuration.
+ *
+ * @throws {@link DevRev.BadRequestError}
+ * @throws {@link DevRev.UnauthorizedError}
+ * @throws {@link DevRev.ForbiddenError}
+ * @throws {@link DevRev.NotFoundError}
+ * @throws {@link DevRev.TooManyRequestsError}
+ * @throws {@link DevRev.InternalServerError}
+ * @throws {@link DevRev.ServiceUnavailableError}
+ *
+ * @example
+ * await client.groups.groupMembersAdd({
+ * group: "group",
+ * member: "DEVU-12345"
+ * })
+ */
+ public async groupMembersAdd(
+ request: DevRev.GroupMembersAddRequest,
+ requestOptions?: Groups.RequestOptions
+ ): Promise {
+ const _response = await (this._options.fetcher ?? core.fetcher)({
+ url: urlJoin(
+ (await core.Supplier.get(this._options.environment)) ?? environments.DevRevEnvironment.Default,
+ "groups.members.add"
+ ),
+ method: "POST",
+ headers: {
+ Authorization: await this._getAuthorizationHeader(),
+ "X-Fern-Language": "JavaScript",
+ "X-Fern-SDK-Name": "@devrev/api",
+ "X-Fern-SDK-Version": "0.0.14",
+ "X-Fern-Runtime": core.RUNTIME.type,
+ "X-Fern-Runtime-Version": core.RUNTIME.version,
+ },
+ contentType: "application/json",
+ requestType: "json",
+ body: serializers.GroupMembersAddRequest.jsonOrThrow(request, { unrecognizedObjectKeys: "strip" }),
+ timeoutMs: requestOptions?.timeoutInSeconds != null ? requestOptions.timeoutInSeconds * 1000 : 60000,
+ maxRetries: requestOptions?.maxRetries,
+ abortSignal: requestOptions?.abortSignal,
+ });
+ if (_response.ok) {
+ return serializers.GroupMembersAddResponse.parseOrThrow(_response.body, {
+ unrecognizedObjectKeys: "passthrough",
+ allowUnrecognizedUnionMembers: true,
+ allowUnrecognizedEnumValues: true,
+ skipValidation: true,
+ breadcrumbsPrefix: ["response"],
+ });
+ }
+
+ if (_response.error.reason === "status-code") {
+ switch (_response.error.statusCode) {
+ case 400:
+ throw new DevRev.BadRequestError(
+ serializers.ErrorBadRequest.parseOrThrow(_response.error.body, {
+ unrecognizedObjectKeys: "passthrough",
+ allowUnrecognizedUnionMembers: true,
+ allowUnrecognizedEnumValues: true,
+ skipValidation: true,
+ breadcrumbsPrefix: ["response"],
+ })
+ );
+ case 401:
+ throw new DevRev.UnauthorizedError(
+ serializers.ErrorUnauthorized.parseOrThrow(_response.error.body, {
+ unrecognizedObjectKeys: "passthrough",
+ allowUnrecognizedUnionMembers: true,
+ allowUnrecognizedEnumValues: true,
+ skipValidation: true,
+ breadcrumbsPrefix: ["response"],
+ })
+ );
+ case 403:
+ throw new DevRev.ForbiddenError(
+ serializers.ErrorForbidden.parseOrThrow(_response.error.body, {
+ unrecognizedObjectKeys: "passthrough",
+ allowUnrecognizedUnionMembers: true,
+ allowUnrecognizedEnumValues: true,
+ skipValidation: true,
+ breadcrumbsPrefix: ["response"],
+ })
+ );
+ case 404:
+ throw new DevRev.NotFoundError(
+ serializers.ErrorNotFound.parseOrThrow(_response.error.body, {
+ unrecognizedObjectKeys: "passthrough",
+ allowUnrecognizedUnionMembers: true,
+ allowUnrecognizedEnumValues: true,
+ skipValidation: true,
+ breadcrumbsPrefix: ["response"],
+ })
+ );
+ case 429:
+ throw new DevRev.TooManyRequestsError(
+ serializers.ErrorTooManyRequests.parseOrThrow(_response.error.body, {
+ unrecognizedObjectKeys: "passthrough",
+ allowUnrecognizedUnionMembers: true,
+ allowUnrecognizedEnumValues: true,
+ skipValidation: true,
+ breadcrumbsPrefix: ["response"],
+ })
+ );
+ case 500:
+ throw new DevRev.InternalServerError(
+ serializers.ErrorInternalServerError.parseOrThrow(_response.error.body, {
+ unrecognizedObjectKeys: "passthrough",
+ allowUnrecognizedUnionMembers: true,
+ allowUnrecognizedEnumValues: true,
+ skipValidation: true,
+ breadcrumbsPrefix: ["response"],
+ })
+ );
+ case 503:
+ throw new DevRev.ServiceUnavailableError(
+ serializers.ErrorServiceUnavailable.parseOrThrow(_response.error.body, {
+ unrecognizedObjectKeys: "passthrough",
+ allowUnrecognizedUnionMembers: true,
+ allowUnrecognizedEnumValues: true,
+ skipValidation: true,
+ breadcrumbsPrefix: ["response"],
+ })
+ );
+ default:
+ throw new errors.DevRevError({
+ statusCode: _response.error.statusCode,
+ body: _response.error.body,
+ });
+ }
+ }
+
+ switch (_response.error.reason) {
+ case "non-json":
+ throw new errors.DevRevError({
+ statusCode: _response.error.statusCode,
+ body: _response.error.rawBody,
+ });
+ case "timeout":
+ throw new errors.DevRevTimeoutError();
+ case "unknown":
+ throw new errors.DevRevError({
+ message: _response.error.errorMessage,
+ });
+ }
+ }
+
+ /**
+ * Lists the members in a group.
+ *
+ * @param {DevRev.GroupMembersListQuery} request
+ * @param {Groups.RequestOptions} requestOptions - Request-specific configuration.
+ *
+ * @throws {@link DevRev.BadRequestError}
+ * @throws {@link DevRev.UnauthorizedError}
+ * @throws {@link DevRev.ForbiddenError}
+ * @throws {@link DevRev.TooManyRequestsError}
+ * @throws {@link DevRev.InternalServerError}
+ * @throws {@link DevRev.ServiceUnavailableError}
+ *
+ * @example
+ * await client.groups.groupMembersList({
+ * group: "group"
+ * })
+ */
+ public async groupMembersList(
+ request: DevRev.GroupMembersListQuery,
+ requestOptions?: Groups.RequestOptions
+ ): Promise {
+ const { group, cursor, limit, mode } = request;
+ const _queryParams: Record = {};
+ _queryParams["group"] = group;
+ if (cursor != null) {
+ _queryParams["cursor"] = cursor;
+ }
+
+ if (limit != null) {
+ _queryParams["limit"] = limit.toString();
+ }
+
+ if (mode != null) {
+ _queryParams["mode"] = mode;
+ }
+
+ const _response = await (this._options.fetcher ?? core.fetcher)({
+ url: urlJoin(
+ (await core.Supplier.get(this._options.environment)) ?? environments.DevRevEnvironment.Default,
+ "groups.members.list"
+ ),
+ method: "GET",
+ headers: {
+ Authorization: await this._getAuthorizationHeader(),
+ "X-Fern-Language": "JavaScript",
+ "X-Fern-SDK-Name": "@devrev/api",
+ "X-Fern-SDK-Version": "0.0.14",
+ "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 serializers.GroupMembersListResponse.parseOrThrow(_response.body, {
+ unrecognizedObjectKeys: "passthrough",
+ allowUnrecognizedUnionMembers: true,
+ allowUnrecognizedEnumValues: true,
+ skipValidation: true,
+ breadcrumbsPrefix: ["response"],
+ });
+ }
+
+ if (_response.error.reason === "status-code") {
+ switch (_response.error.statusCode) {
+ case 400:
+ throw new DevRev.BadRequestError(
+ serializers.ErrorBadRequest.parseOrThrow(_response.error.body, {
+ unrecognizedObjectKeys: "passthrough",
+ allowUnrecognizedUnionMembers: true,
+ allowUnrecognizedEnumValues: true,
+ skipValidation: true,
+ breadcrumbsPrefix: ["response"],
+ })
+ );
+ case 401:
+ throw new DevRev.UnauthorizedError(
+ serializers.ErrorUnauthorized.parseOrThrow(_response.error.body, {
+ unrecognizedObjectKeys: "passthrough",
+ allowUnrecognizedUnionMembers: true,
+ allowUnrecognizedEnumValues: true,
+ skipValidation: true,
+ breadcrumbsPrefix: ["response"],
+ })
+ );
+ case 403:
+ throw new DevRev.ForbiddenError(
+ serializers.ErrorForbidden.parseOrThrow(_response.error.body, {
+ unrecognizedObjectKeys: "passthrough",
+ allowUnrecognizedUnionMembers: true,
+ allowUnrecognizedEnumValues: true,
+ skipValidation: true,
+ breadcrumbsPrefix: ["response"],
+ })
+ );
+ case 429:
+ throw new DevRev.TooManyRequestsError(
+ serializers.ErrorTooManyRequests.parseOrThrow(_response.error.body, {
+ unrecognizedObjectKeys: "passthrough",
+ allowUnrecognizedUnionMembers: true,
+ allowUnrecognizedEnumValues: true,
+ skipValidation: true,
+ breadcrumbsPrefix: ["response"],
+ })
+ );
+ case 500:
+ throw new DevRev.InternalServerError(
+ serializers.ErrorInternalServerError.parseOrThrow(_response.error.body, {
+ unrecognizedObjectKeys: "passthrough",
+ allowUnrecognizedUnionMembers: true,
+ allowUnrecognizedEnumValues: true,
+ skipValidation: true,
+ breadcrumbsPrefix: ["response"],
+ })
+ );
+ case 503:
+ throw new DevRev.ServiceUnavailableError(
+ serializers.ErrorServiceUnavailable.parseOrThrow(_response.error.body, {
+ unrecognizedObjectKeys: "passthrough",
+ allowUnrecognizedUnionMembers: true,
+ allowUnrecognizedEnumValues: true,
+ skipValidation: true,
+ breadcrumbsPrefix: ["response"],
+ })
+ );
+ default:
+ throw new errors.DevRevError({
+ statusCode: _response.error.statusCode,
+ body: _response.error.body,
+ });
+ }
+ }
+
+ switch (_response.error.reason) {
+ case "non-json":
+ throw new errors.DevRevError({
+ statusCode: _response.error.statusCode,
+ body: _response.error.rawBody,
+ });
+ case "timeout":
+ throw new errors.DevRevTimeoutError();
+ case "unknown":
+ throw new errors.DevRevError({
+ message: _response.error.errorMessage,
+ });
+ }
+ }
+
+ /**
+ * Lists the members in a group.
+ *
+ * @param {DevRev.GroupMembersListRequest} request
+ * @param {Groups.RequestOptions} requestOptions - Request-specific configuration.
+ *
+ * @throws {@link DevRev.BadRequestError}
+ * @throws {@link DevRev.UnauthorizedError}
+ * @throws {@link DevRev.ForbiddenError}
+ * @throws {@link DevRev.TooManyRequestsError}
+ * @throws {@link DevRev.InternalServerError}
+ * @throws {@link DevRev.ServiceUnavailableError}
+ *
+ * @example
+ * await client.groups.groupMembersListPost({
+ * group: "group"
+ * })
+ */
+ public async groupMembersListPost(
+ request: DevRev.GroupMembersListRequest,
+ requestOptions?: Groups.RequestOptions
+ ): Promise {
+ const _response = await (this._options.fetcher ?? core.fetcher)({
+ url: urlJoin(
+ (await core.Supplier.get(this._options.environment)) ?? environments.DevRevEnvironment.Default,
+ "groups.members.list"
+ ),
+ method: "POST",
+ headers: {
+ Authorization: await this._getAuthorizationHeader(),
+ "X-Fern-Language": "JavaScript",
+ "X-Fern-SDK-Name": "@devrev/api",
+ "X-Fern-SDK-Version": "0.0.14",
+ "X-Fern-Runtime": core.RUNTIME.type,
+ "X-Fern-Runtime-Version": core.RUNTIME.version,
+ },
+ contentType: "application/json",
+ requestType: "json",
+ body: serializers.GroupMembersListRequest.jsonOrThrow(request, { unrecognizedObjectKeys: "strip" }),
+ timeoutMs: requestOptions?.timeoutInSeconds != null ? requestOptions.timeoutInSeconds * 1000 : 60000,
+ maxRetries: requestOptions?.maxRetries,
+ abortSignal: requestOptions?.abortSignal,
+ });
+ if (_response.ok) {
+ return serializers.GroupMembersListResponse.parseOrThrow(_response.body, {
+ unrecognizedObjectKeys: "passthrough",
+ allowUnrecognizedUnionMembers: true,
+ allowUnrecognizedEnumValues: true,
+ skipValidation: true,
+ breadcrumbsPrefix: ["response"],
+ });
+ }
+
+ if (_response.error.reason === "status-code") {
+ switch (_response.error.statusCode) {
+ case 400:
+ throw new DevRev.BadRequestError(
+ serializers.ErrorBadRequest.parseOrThrow(_response.error.body, {
+ unrecognizedObjectKeys: "passthrough",
+ allowUnrecognizedUnionMembers: true,
+ allowUnrecognizedEnumValues: true,
+ skipValidation: true,
+ breadcrumbsPrefix: ["response"],
+ })
+ );
+ case 401:
+ throw new DevRev.UnauthorizedError(
+ serializers.ErrorUnauthorized.parseOrThrow(_response.error.body, {
+ unrecognizedObjectKeys: "passthrough",
+ allowUnrecognizedUnionMembers: true,
+ allowUnrecognizedEnumValues: true,
+ skipValidation: true,
+ breadcrumbsPrefix: ["response"],
+ })
+ );
+ case 403:
+ throw new DevRev.ForbiddenError(
+ serializers.ErrorForbidden.parseOrThrow(_response.error.body, {
+ unrecognizedObjectKeys: "passthrough",
+ allowUnrecognizedUnionMembers: true,
+ allowUnrecognizedEnumValues: true,
+ skipValidation: true,
+ breadcrumbsPrefix: ["response"],
+ })
+ );
+ case 429:
+ throw new DevRev.TooManyRequestsError(
+ serializers.ErrorTooManyRequests.parseOrThrow(_response.error.body, {
+ unrecognizedObjectKeys: "passthrough",
+ allowUnrecognizedUnionMembers: true,
+ allowUnrecognizedEnumValues: true,
+ skipValidation: true,
+ breadcrumbsPrefix: ["response"],
+ })
+ );
+ case 500:
+ throw new DevRev.InternalServerError(
+ serializers.ErrorInternalServerError.parseOrThrow(_response.error.body, {
+ unrecognizedObjectKeys: "passthrough",
+ allowUnrecognizedUnionMembers: true,
+ allowUnrecognizedEnumValues: true,
+ skipValidation: true,
+ breadcrumbsPrefix: ["response"],
+ })
+ );
+ case 503:
+ throw new DevRev.ServiceUnavailableError(
+ serializers.ErrorServiceUnavailable.parseOrThrow(_response.error.body, {
+ unrecognizedObjectKeys: "passthrough",
+ allowUnrecognizedUnionMembers: true,
+ allowUnrecognizedEnumValues: true,
+ skipValidation: true,
+ breadcrumbsPrefix: ["response"],
+ })
+ );
+ default:
+ throw new errors.DevRevError({
+ statusCode: _response.error.statusCode,
+ body: _response.error.body,
+ });
+ }
+ }
+
+ switch (_response.error.reason) {
+ case "non-json":
+ throw new errors.DevRevError({
+ statusCode: _response.error.statusCode,
+ body: _response.error.rawBody,
+ });
+ case "timeout":
+ throw new errors.DevRevTimeoutError();
+ case "unknown":
+ throw new errors.DevRevError({
+ message: _response.error.errorMessage,
+ });
+ }
+ }
+
+ /**
+ * Removes a member from a group.
+ *
+ * @param {DevRev.GroupMembersRemoveRequest} request
+ * @param {Groups.RequestOptions} requestOptions - Request-specific configuration.
+ *
+ * @throws {@link DevRev.BadRequestError}
+ * @throws {@link DevRev.UnauthorizedError}
+ * @throws {@link DevRev.ForbiddenError}
+ * @throws {@link DevRev.NotFoundError}
+ * @throws {@link DevRev.TooManyRequestsError}
+ * @throws {@link DevRev.InternalServerError}
+ * @throws {@link DevRev.ServiceUnavailableError}
+ *
+ * @example
+ * await client.groups.groupMembersRemove({
+ * group: "group",
+ * member: "DEVU-12345"
+ * })
+ */
+ public async groupMembersRemove(
+ request: DevRev.GroupMembersRemoveRequest,
+ requestOptions?: Groups.RequestOptions
+ ): Promise {
+ const _response = await (this._options.fetcher ?? core.fetcher)({
+ url: urlJoin(
+ (await core.Supplier.get(this._options.environment)) ?? environments.DevRevEnvironment.Default,
+ "groups.members.remove"
+ ),
+ method: "POST",
+ headers: {
+ Authorization: await this._getAuthorizationHeader(),
+ "X-Fern-Language": "JavaScript",
+ "X-Fern-SDK-Name": "@devrev/api",
+ "X-Fern-SDK-Version": "0.0.14",
+ "X-Fern-Runtime": core.RUNTIME.type,
+ "X-Fern-Runtime-Version": core.RUNTIME.version,
+ },
+ contentType: "application/json",
+ requestType: "json",
+ body: serializers.GroupMembersRemoveRequest.jsonOrThrow(request, { unrecognizedObjectKeys: "strip" }),
+ timeoutMs: requestOptions?.timeoutInSeconds != null ? requestOptions.timeoutInSeconds * 1000 : 60000,
+ maxRetries: requestOptions?.maxRetries,
+ abortSignal: requestOptions?.abortSignal,
+ });
+ if (_response.ok) {
+ return serializers.GroupMembersRemoveResponse.parseOrThrow(_response.body, {
+ unrecognizedObjectKeys: "passthrough",
+ allowUnrecognizedUnionMembers: true,
+ allowUnrecognizedEnumValues: true,
+ skipValidation: true,
+ breadcrumbsPrefix: ["response"],
+ });
+ }
+
+ if (_response.error.reason === "status-code") {
+ switch (_response.error.statusCode) {
+ case 400:
+ throw new DevRev.BadRequestError(
+ serializers.ErrorBadRequest.parseOrThrow(_response.error.body, {
+ unrecognizedObjectKeys: "passthrough",
+ allowUnrecognizedUnionMembers: true,
+ allowUnrecognizedEnumValues: true,
+ skipValidation: true,
+ breadcrumbsPrefix: ["response"],
+ })
+ );
+ case 401:
+ throw new DevRev.UnauthorizedError(
+ serializers.ErrorUnauthorized.parseOrThrow(_response.error.body, {
+ unrecognizedObjectKeys: "passthrough",
+ allowUnrecognizedUnionMembers: true,
+ allowUnrecognizedEnumValues: true,
+ skipValidation: true,
+ breadcrumbsPrefix: ["response"],
+ })
+ );
+ case 403:
+ throw new DevRev.ForbiddenError(
+ serializers.ErrorForbidden.parseOrThrow(_response.error.body, {
+ unrecognizedObjectKeys: "passthrough",
+ allowUnrecognizedUnionMembers: true,
+ allowUnrecognizedEnumValues: true,
+ skipValidation: true,
+ breadcrumbsPrefix: ["response"],
+ })
+ );
+ case 404:
+ throw new DevRev.NotFoundError(
+ serializers.ErrorNotFound.parseOrThrow(_response.error.body, {
+ unrecognizedObjectKeys: "passthrough",
+ allowUnrecognizedUnionMembers: true,
+ allowUnrecognizedEnumValues: true,
+ skipValidation: true,
+ breadcrumbsPrefix: ["response"],
+ })
+ );
+ case 429:
+ throw new DevRev.TooManyRequestsError(
+ serializers.ErrorTooManyRequests.parseOrThrow(_response.error.body, {
+ unrecognizedObjectKeys: "passthrough",
+ allowUnrecognizedUnionMembers: true,
+ allowUnrecognizedEnumValues: true,
+ skipValidation: true,
+ breadcrumbsPrefix: ["response"],
+ })
+ );
+ case 500:
+ throw new DevRev.InternalServerError(
+ serializers.ErrorInternalServerError.parseOrThrow(_response.error.body, {
+ unrecognizedObjectKeys: "passthrough",
+ allowUnrecognizedUnionMembers: true,
+ allowUnrecognizedEnumValues: true,
+ skipValidation: true,
+ breadcrumbsPrefix: ["response"],
+ })
+ );
+ case 503:
+ throw new DevRev.ServiceUnavailableError(
+ serializers.ErrorServiceUnavailable.parseOrThrow(_response.error.body, {
+ unrecognizedObjectKeys: "passthrough",
+ allowUnrecognizedUnionMembers: true,
+ allowUnrecognizedEnumValues: true,
+ skipValidation: true,
+ breadcrumbsPrefix: ["response"],
+ })
+ );
+ default:
+ throw new errors.DevRevError({
+ statusCode: _response.error.statusCode,
+ body: _response.error.body,
+ });
+ }
+ }
+
+ switch (_response.error.reason) {
+ case "non-json":
+ throw new errors.DevRevError({
+ statusCode: _response.error.statusCode,
+ body: _response.error.rawBody,
+ });
+ case "timeout":
+ throw new errors.DevRevTimeoutError();
+ case "unknown":
+ throw new errors.DevRevError({
+ message: _response.error.errorMessage,
+ });
+ }
+ }
+
+ /**
+ * Updates the requested group.
+ *
+ * @param {DevRev.GroupsUpdateRequest} request
+ * @param {Groups.RequestOptions} requestOptions - Request-specific configuration.
+ *
+ * @throws {@link DevRev.BadRequestError}
+ * @throws {@link DevRev.UnauthorizedError}
+ * @throws {@link DevRev.ForbiddenError}
+ * @throws {@link DevRev.NotFoundError}
+ * @throws {@link DevRev.TooManyRequestsError}
+ * @throws {@link DevRev.InternalServerError}
+ * @throws {@link DevRev.ServiceUnavailableError}
+ *
+ * @example
+ * await client.groups.update({
+ * id: "id"
+ * })
+ */
+ public async update(
+ request: DevRev.GroupsUpdateRequest,
+ requestOptions?: Groups.RequestOptions
+ ): Promise {
+ const _response = await (this._options.fetcher ?? core.fetcher)({
+ url: urlJoin(
+ (await core.Supplier.get(this._options.environment)) ?? environments.DevRevEnvironment.Default,
+ "groups.update"
+ ),
+ method: "POST",
+ headers: {
+ Authorization: await this._getAuthorizationHeader(),
+ "X-Fern-Language": "JavaScript",
+ "X-Fern-SDK-Name": "@devrev/api",
+ "X-Fern-SDK-Version": "0.0.14",
+ "X-Fern-Runtime": core.RUNTIME.type,
+ "X-Fern-Runtime-Version": core.RUNTIME.version,
+ },
+ contentType: "application/json",
+ requestType: "json",
+ body: serializers.GroupsUpdateRequest.jsonOrThrow(request, { unrecognizedObjectKeys: "strip" }),
+ timeoutMs: requestOptions?.timeoutInSeconds != null ? requestOptions.timeoutInSeconds * 1000 : 60000,
+ maxRetries: requestOptions?.maxRetries,
+ abortSignal: requestOptions?.abortSignal,
+ });
+ if (_response.ok) {
+ return serializers.GroupsUpdateResponse.parseOrThrow(_response.body, {
+ unrecognizedObjectKeys: "passthrough",
+ allowUnrecognizedUnionMembers: true,
+ allowUnrecognizedEnumValues: true,
+ skipValidation: true,
+ breadcrumbsPrefix: ["response"],
+ });
+ }
+
+ if (_response.error.reason === "status-code") {
+ switch (_response.error.statusCode) {
+ case 400:
+ throw new DevRev.BadRequestError(
+ serializers.ErrorBadRequest.parseOrThrow(_response.error.body, {
+ unrecognizedObjectKeys: "passthrough",
+ allowUnrecognizedUnionMembers: true,
+ allowUnrecognizedEnumValues: true,
+ skipValidation: true,
+ breadcrumbsPrefix: ["response"],
+ })
+ );
+ case 401:
+ throw new DevRev.UnauthorizedError(
+ serializers.ErrorUnauthorized.parseOrThrow(_response.error.body, {
+ unrecognizedObjectKeys: "passthrough",
+ allowUnrecognizedUnionMembers: true,
+ allowUnrecognizedEnumValues: true,
+ skipValidation: true,
+ breadcrumbsPrefix: ["response"],
+ })
+ );
+ case 403:
+ throw new DevRev.ForbiddenError(
+ serializers.ErrorForbidden.parseOrThrow(_response.error.body, {
+ unrecognizedObjectKeys: "passthrough",
+ allowUnrecognizedUnionMembers: true,
+ allowUnrecognizedEnumValues: true,
+ skipValidation: true,
+ breadcrumbsPrefix: ["response"],
+ })
+ );
+ case 404:
+ throw new DevRev.NotFoundError(
+ serializers.ErrorNotFound.parseOrThrow(_response.error.body, {
+ unrecognizedObjectKeys: "passthrough",
+ allowUnrecognizedUnionMembers: true,
+ allowUnrecognizedEnumValues: true,
+ skipValidation: true,
+ breadcrumbsPrefix: ["response"],
+ })
+ );
+ case 429:
+ throw new DevRev.TooManyRequestsError(
+ serializers.ErrorTooManyRequests.parseOrThrow(_response.error.body, {
+ unrecognizedObjectKeys: "passthrough",
+ allowUnrecognizedUnionMembers: true,
+ allowUnrecognizedEnumValues: true,
+ skipValidation: true,
+ breadcrumbsPrefix: ["response"],
+ })
+ );
+ case 500:
+ throw new DevRev.InternalServerError(
+ serializers.ErrorInternalServerError.parseOrThrow(_response.error.body, {
+ unrecognizedObjectKeys: "passthrough",
+ allowUnrecognizedUnionMembers: true,
+ allowUnrecognizedEnumValues: true,
+ skipValidation: true,
+ breadcrumbsPrefix: ["response"],
+ })
+ );
+ case 503:
+ throw new DevRev.ServiceUnavailableError(
+ serializers.ErrorServiceUnavailable.parseOrThrow(_response.error.body, {
+ unrecognizedObjectKeys: "passthrough",
+ allowUnrecognizedUnionMembers: true,
+ allowUnrecognizedEnumValues: true,
+ skipValidation: true,
+ breadcrumbsPrefix: ["response"],
+ })
+ );
+ default:
+ throw new errors.DevRevError({
+ statusCode: _response.error.statusCode,
+ body: _response.error.body,
+ });
+ }
+ }
+
+ switch (_response.error.reason) {
+ case "non-json":
+ throw new errors.DevRevError({
+ statusCode: _response.error.statusCode,
+ body: _response.error.rawBody,
+ });
+ case "timeout":
+ throw new errors.DevRevTimeoutError();
+ case "unknown":
+ throw new errors.DevRevError({
+ message: _response.error.errorMessage,
+ });
+ }
+ }
+
+ protected async _getAuthorizationHeader(): Promise {
+ const bearer = (await core.Supplier.get(this._options.token)) ?? process?.env["DEVREV_TOKEN"];
+ if (bearer == null) {
+ throw new errors.DevRevError({
+ message: "Please specify DEVREV_TOKEN when instantiating the client.",
+ });
+ }
+
+ return `Bearer ${bearer}`;
+ }
+}
diff --git a/src/api/resources/groups/client/index.ts b/src/api/resources/groups/client/index.ts
new file mode 100644
index 0000000..415726b
--- /dev/null
+++ b/src/api/resources/groups/client/index.ts
@@ -0,0 +1 @@
+export * from "./requests";
diff --git a/src/api/resources/groups/client/requests/GroupMembersAddRequest.ts b/src/api/resources/groups/client/requests/GroupMembersAddRequest.ts
new file mode 100644
index 0000000..2420b82
--- /dev/null
+++ b/src/api/resources/groups/client/requests/GroupMembersAddRequest.ts
@@ -0,0 +1,17 @@
+/**
+ * This file was auto-generated by Fern from our API Definition.
+ */
+
+/**
+ * @example
+ * {
+ * group: "group",
+ * member: "DEVU-12345"
+ * }
+ */
+export interface GroupMembersAddRequest {
+ /** ID of the group where the member is being added. */
+ group: string;
+ /** ID of the member to be added. */
+ member: string;
+}
diff --git a/src/api/resources/groups/client/requests/GroupMembersListQuery.ts b/src/api/resources/groups/client/requests/GroupMembersListQuery.ts
new file mode 100644
index 0000000..9792bc3
--- /dev/null
+++ b/src/api/resources/groups/client/requests/GroupMembersListQuery.ts
@@ -0,0 +1,33 @@
+/**
+ * This file was auto-generated by Fern from our API Definition.
+ */
+
+import * as DevRev from "../../../../index";
+
+/**
+ * @example
+ * {
+ * group: "group"
+ * }
+ */
+export interface GroupMembersListQuery {
+ /**
+ * ID of the group for which to list members.
+ */
+ group: string;
+ /**
+ * The cursor to resume iteration from. If not provided, then iteration
+ * starts from the beginning.
+ */
+ cursor?: string;
+ /**
+ * The maximum number of members to return. If not set, then the default
+ * is '50'.
+ */
+ limit?: number;
+ /**
+ * The iteration mode to use, otherwise if not set, then "after" is
+ * used.
+ */
+ mode?: DevRev.ListMode;
+}
diff --git a/src/api/resources/groups/client/requests/GroupMembersListRequest.ts b/src/api/resources/groups/client/requests/GroupMembersListRequest.ts
new file mode 100644
index 0000000..ce0fd68
--- /dev/null
+++ b/src/api/resources/groups/client/requests/GroupMembersListRequest.ts
@@ -0,0 +1,29 @@
+/**
+ * This file was auto-generated by Fern from our API Definition.
+ */
+
+import * as DevRev from "../../../../index";
+
+/**
+ * @example
+ * {
+ * group: "group"
+ * }
+ */
+export interface GroupMembersListRequest {
+ /**
+ * The cursor to resume iteration from. If not provided, then
+ * iteration starts from the beginning.
+ *
+ */
+ cursor?: string;
+ /** ID of the group for which to list members. */
+ group: string;
+ /**
+ * The maximum number of members to return. If not set, then the
+ * default is '50'.
+ *
+ */
+ limit?: number;
+ mode?: DevRev.ListMode;
+}
diff --git a/src/api/resources/groups/client/requests/GroupMembersRemoveRequest.ts b/src/api/resources/groups/client/requests/GroupMembersRemoveRequest.ts
new file mode 100644
index 0000000..7f691a3
--- /dev/null
+++ b/src/api/resources/groups/client/requests/GroupMembersRemoveRequest.ts
@@ -0,0 +1,17 @@
+/**
+ * This file was auto-generated by Fern from our API Definition.
+ */
+
+/**
+ * @example
+ * {
+ * group: "group",
+ * member: "DEVU-12345"
+ * }
+ */
+export interface GroupMembersRemoveRequest {
+ /** ID of the group where the member is being removed. */
+ group: string;
+ /** ID of the member to be removed. */
+ member: string;
+}
diff --git a/src/api/resources/groups/client/requests/GroupsCreateRequest.ts b/src/api/resources/groups/client/requests/GroupsCreateRequest.ts
new file mode 100644
index 0000000..d53a8cc
--- /dev/null
+++ b/src/api/resources/groups/client/requests/GroupsCreateRequest.ts
@@ -0,0 +1,24 @@
+/**
+ * This file was auto-generated by Fern from our API Definition.
+ */
+
+import * as DevRev from "../../../../index";
+
+/**
+ * @example
+ * {
+ * description: "description",
+ * name: "name"
+ * }
+ */
+export interface GroupsCreateRequest {
+ type?: DevRev.GroupType;
+ /** Description of the group. */
+ description: string;
+ dynamicGroupInfo?: DevRev.DynamicGroupInfo;
+ memberType?: DevRev.GroupMemberType;
+ /** Unique name of the group. */
+ name: string;
+ /** Owner of the group. */
+ owner?: string;
+}
diff --git a/src/api/resources/groups/client/requests/GroupsGetQuery.ts b/src/api/resources/groups/client/requests/GroupsGetQuery.ts
new file mode 100644
index 0000000..bbefb5d
--- /dev/null
+++ b/src/api/resources/groups/client/requests/GroupsGetQuery.ts
@@ -0,0 +1,16 @@
+/**
+ * This file was auto-generated by Fern from our API Definition.
+ */
+
+/**
+ * @example
+ * {
+ * id: "id"
+ * }
+ */
+export interface GroupsGetQuery {
+ /**
+ * The ID of the group to get.
+ */
+ id: string;
+}
diff --git a/src/api/resources/groups/client/requests/GroupsGetRequest.ts b/src/api/resources/groups/client/requests/GroupsGetRequest.ts
new file mode 100644
index 0000000..8b5b582
--- /dev/null
+++ b/src/api/resources/groups/client/requests/GroupsGetRequest.ts
@@ -0,0 +1,14 @@
+/**
+ * This file was auto-generated by Fern from our API Definition.
+ */
+
+/**
+ * @example
+ * {
+ * id: "id"
+ * }
+ */
+export interface GroupsGetRequest {
+ /** The ID of the group to get. */
+ id: string;
+}
diff --git a/src/api/resources/groups/client/requests/GroupsListQuery.ts b/src/api/resources/groups/client/requests/GroupsListQuery.ts
new file mode 100644
index 0000000..6186c83
--- /dev/null
+++ b/src/api/resources/groups/client/requests/GroupsListQuery.ts
@@ -0,0 +1,42 @@
+/**
+ * This file was auto-generated by Fern from our API Definition.
+ */
+
+import * as DevRev from "../../../../index";
+
+/**
+ * @example
+ * {}
+ */
+export interface GroupsListQuery {
+ /**
+ * The cursor to resume iteration from. If not provided, then iteration
+ * starts from the beginning.
+ */
+ cursor?: string;
+ /**
+ * Filters the groups based on the group type.
+ */
+ groupType?: DevRev.GroupType | DevRev.GroupType[];
+ /**
+ * Whether to fetch default or custom groups.
+ */
+ isDefault?: boolean;
+ /**
+ * The maximum number of groups to return. The default is '50'.
+ */
+ limit?: number;
+ /**
+ * Filters the groups on basis of member type.
+ */
+ memberType?: DevRev.GroupMemberType | DevRev.GroupMemberType[];
+ /**
+ * The iteration mode to use, otherwise if not set, then "after" is
+ * used.
+ */
+ mode?: DevRev.ListMode;
+ /**
+ * Comma-separated fields to sort the groups by.
+ */
+ sortBy?: string | string[];
+}
diff --git a/src/api/resources/groups/client/requests/GroupsListRequest.ts b/src/api/resources/groups/client/requests/GroupsListRequest.ts
new file mode 100644
index 0000000..0b8ee68
--- /dev/null
+++ b/src/api/resources/groups/client/requests/GroupsListRequest.ts
@@ -0,0 +1,32 @@
+/**
+ * This file was auto-generated by Fern from our API Definition.
+ */
+
+import * as DevRev from "../../../../index";
+
+/**
+ * @example
+ * {}
+ */
+export interface GroupsListRequest {
+ /**
+ * The cursor to resume iteration from. If not provided, then
+ * iteration starts from the beginning.
+ *
+ */
+ cursor?: string;
+ /** Filters the groups based on the group type. */
+ groupType?: DevRev.GroupType[];
+ /** Whether to fetch default or custom groups. */
+ isDefault?: boolean;
+ /**
+ * The maximum number of groups to return. The default is '50'.
+ *
+ */
+ limit?: number;
+ /** Filters the groups on basis of member type. */
+ memberType?: DevRev.GroupMemberType[];
+ mode?: DevRev.ListMode;
+ /** Comma-separated fields to sort the groups by. */
+ sortBy?: string[];
+}
diff --git a/src/api/resources/groups/client/requests/GroupsUpdateRequest.ts b/src/api/resources/groups/client/requests/GroupsUpdateRequest.ts
new file mode 100644
index 0000000..98f8a9b
--- /dev/null
+++ b/src/api/resources/groups/client/requests/GroupsUpdateRequest.ts
@@ -0,0 +1,23 @@
+/**
+ * This file was auto-generated by Fern from our API Definition.
+ */
+
+import * as DevRev from "../../../../index";
+
+/**
+ * @example
+ * {
+ * id: "id"
+ * }
+ */
+export interface GroupsUpdateRequest {
+ /** The updated group's description. */
+ description?: string;
+ dynamicGroupInfo?: DevRev.GroupsUpdateRequestDynamicGroupInfo;
+ /** The ID of the group to update. */
+ id: string;
+ /** The updated group's name. */
+ name?: string;
+ /** The updated group's owner. */
+ owner?: string;
+}
diff --git a/src/api/resources/groups/client/requests/index.ts b/src/api/resources/groups/client/requests/index.ts
new file mode 100644
index 0000000..80276a8
--- /dev/null
+++ b/src/api/resources/groups/client/requests/index.ts
@@ -0,0 +1,10 @@
+export { type GroupsCreateRequest } from "./GroupsCreateRequest";
+export { type GroupsGetQuery } from "./GroupsGetQuery";
+export { type GroupsGetRequest } from "./GroupsGetRequest";
+export { type GroupsListQuery } from "./GroupsListQuery";
+export { type GroupsListRequest } from "./GroupsListRequest";
+export { type GroupMembersAddRequest } from "./GroupMembersAddRequest";
+export { type GroupMembersListQuery } from "./GroupMembersListQuery";
+export { type GroupMembersListRequest } from "./GroupMembersListRequest";
+export { type GroupMembersRemoveRequest } from "./GroupMembersRemoveRequest";
+export { type GroupsUpdateRequest } from "./GroupsUpdateRequest";
diff --git a/src/api/resources/groups/index.ts b/src/api/resources/groups/index.ts
new file mode 100644
index 0000000..5ec7692
--- /dev/null
+++ b/src/api/resources/groups/index.ts
@@ -0,0 +1 @@
+export * from "./client";
diff --git a/src/api/resources/index.ts b/src/api/resources/index.ts
new file mode 100644
index 0000000..6a4f613
--- /dev/null
+++ b/src/api/resources/index.ts
@@ -0,0 +1,51 @@
+export * as accounts from "./accounts";
+export * as articles from "./articles";
+export * as artifacts from "./artifacts";
+export * as codeChanges from "./codeChanges";
+export * as conversations from "./conversations";
+export * as devUsers from "./devUsers";
+export * as engagements from "./engagements";
+export * as eventSource from "./eventSource";
+export * as groups from "./groups";
+export * as links from "./links";
+export * as slas from "./slas";
+export * as productUsage from "./productUsage";
+export * as schedules from "./schedules";
+export * as parts from "./parts";
+export * as questionAnswers from "./questionAnswers";
+export * as revOrgs from "./revOrgs";
+export * as revUsers from "./revUsers";
+export * as customization from "./customization";
+export * as search from "./search";
+export * as serviceAccounts from "./serviceAccounts";
+export * as snapIns from "./snapIns";
+export * as snapWidgets from "./snapWidgets";
+export * as surveys from "./surveys";
+export * as sysUsers from "./sysUsers";
+export * as timelineEntries from "./timelineEntries";
+export * as works from "./works";
+export * from "./accounts/client/requests";
+export * from "./articles/client/requests";
+export * from "./artifacts/client/requests";
+export * from "./codeChanges/client/requests";
+export * from "./conversations/client/requests";
+export * from "./devUsers/client/requests";
+export * from "./engagements/client/requests";
+export * from "./eventSource/client/requests";
+export * from "./groups/client/requests";
+export * from "./links/client/requests";
+export * from "./slas/client/requests";
+export * from "./productUsage/client/requests";
+export * from "./schedules/client/requests";
+export * from "./parts/client/requests";
+export * from "./questionAnswers/client/requests";
+export * from "./revOrgs/client/requests";
+export * from "./revUsers/client/requests";
+export * from "./customization/client/requests";
+export * from "./search/client/requests";
+export * from "./serviceAccounts/client/requests";
+export * from "./snapIns/client/requests";
+export * from "./surveys/client/requests";
+export * from "./sysUsers/client/requests";
+export * from "./timelineEntries/client/requests";
+export * from "./works/client/requests";
diff --git a/src/api/resources/links/client/Client.ts b/src/api/resources/links/client/Client.ts
new file mode 100644
index 0000000..0894942
--- /dev/null
+++ b/src/api/resources/links/client/Client.ts
@@ -0,0 +1,954 @@
+/**
+ * This file was auto-generated by Fern from our API Definition.
+ */
+
+import * as environments from "../../../../environments";
+import * as core from "../../../../core";
+import * as DevRev from "../../../index";
+import * as serializers from "../../../../serialization/index";
+import urlJoin from "url-join";
+import * as errors from "../../../../errors/index";
+
+export declare namespace Links {
+ interface Options {
+ environment?: core.Supplier;
+ token?: 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;
+ }
+}
+
+/**
+ * DevRev link interactions.
+ */
+export class Links {
+ constructor(protected readonly _options: Links.Options = {}) {}
+
+ /**
+ * Creates a link between two objects to indicate a relationship.
+ *
+ * @param {DevRev.LinksCreateRequest} request
+ * @param {Links.RequestOptions} requestOptions - Request-specific configuration.
+ *
+ * @throws {@link DevRev.BadRequestError}
+ * @throws {@link DevRev.UnauthorizedError}
+ * @throws {@link DevRev.ForbiddenError}
+ * @throws {@link DevRev.TooManyRequestsError}
+ * @throws {@link DevRev.InternalServerError}
+ * @throws {@link DevRev.ServiceUnavailableError}
+ *
+ * @example
+ * await client.links.create({
+ * linkType: DevRev.LinkType.CustomLink,
+ * source: "string",
+ * target: "string"
+ * })
+ */
+ public async create(
+ request: DevRev.LinksCreateRequest,
+ requestOptions?: Links.RequestOptions
+ ): Promise {
+ const _response = await (this._options.fetcher ?? core.fetcher)({
+ url: urlJoin(
+ (await core.Supplier.get(this._options.environment)) ?? environments.DevRevEnvironment.Default,
+ "links.create"
+ ),
+ method: "POST",
+ headers: {
+ Authorization: await this._getAuthorizationHeader(),
+ "X-Fern-Language": "JavaScript",
+ "X-Fern-SDK-Name": "@devrev/api",
+ "X-Fern-SDK-Version": "0.0.14",
+ "X-Fern-Runtime": core.RUNTIME.type,
+ "X-Fern-Runtime-Version": core.RUNTIME.version,
+ },
+ contentType: "application/json",
+ requestType: "json",
+ body: serializers.LinksCreateRequest.jsonOrThrow(request, { unrecognizedObjectKeys: "strip" }),
+ timeoutMs: requestOptions?.timeoutInSeconds != null ? requestOptions.timeoutInSeconds * 1000 : 60000,
+ maxRetries: requestOptions?.maxRetries,
+ abortSignal: requestOptions?.abortSignal,
+ });
+ if (_response.ok) {
+ return serializers.LinksCreateResponse.parseOrThrow(_response.body, {
+ unrecognizedObjectKeys: "passthrough",
+ allowUnrecognizedUnionMembers: true,
+ allowUnrecognizedEnumValues: true,
+ skipValidation: true,
+ breadcrumbsPrefix: ["response"],
+ });
+ }
+
+ if (_response.error.reason === "status-code") {
+ switch (_response.error.statusCode) {
+ case 400:
+ throw new DevRev.BadRequestError(
+ serializers.ErrorBadRequest.parseOrThrow(_response.error.body, {
+ unrecognizedObjectKeys: "passthrough",
+ allowUnrecognizedUnionMembers: true,
+ allowUnrecognizedEnumValues: true,
+ skipValidation: true,
+ breadcrumbsPrefix: ["response"],
+ })
+ );
+ case 401:
+ throw new DevRev.UnauthorizedError(
+ serializers.ErrorUnauthorized.parseOrThrow(_response.error.body, {
+ unrecognizedObjectKeys: "passthrough",
+ allowUnrecognizedUnionMembers: true,
+ allowUnrecognizedEnumValues: true,
+ skipValidation: true,
+ breadcrumbsPrefix: ["response"],
+ })
+ );
+ case 403:
+ throw new DevRev.ForbiddenError(
+ serializers.ErrorForbidden.parseOrThrow(_response.error.body, {
+ unrecognizedObjectKeys: "passthrough",
+ allowUnrecognizedUnionMembers: true,
+ allowUnrecognizedEnumValues: true,
+ skipValidation: true,
+ breadcrumbsPrefix: ["response"],
+ })
+ );
+ case 429:
+ throw new DevRev.TooManyRequestsError(
+ serializers.ErrorTooManyRequests.parseOrThrow(_response.error.body, {
+ unrecognizedObjectKeys: "passthrough",
+ allowUnrecognizedUnionMembers: true,
+ allowUnrecognizedEnumValues: true,
+ skipValidation: true,
+ breadcrumbsPrefix: ["response"],
+ })
+ );
+ case 500:
+ throw new DevRev.InternalServerError(
+ serializers.ErrorInternalServerError.parseOrThrow(_response.error.body, {
+ unrecognizedObjectKeys: "passthrough",
+ allowUnrecognizedUnionMembers: true,
+ allowUnrecognizedEnumValues: true,
+ skipValidation: true,
+ breadcrumbsPrefix: ["response"],
+ })
+ );
+ case 503:
+ throw new DevRev.ServiceUnavailableError(
+ serializers.ErrorServiceUnavailable.parseOrThrow(_response.error.body, {
+ unrecognizedObjectKeys: "passthrough",
+ allowUnrecognizedUnionMembers: true,
+ allowUnrecognizedEnumValues: true,
+ skipValidation: true,
+ breadcrumbsPrefix: ["response"],
+ })
+ );
+ default:
+ throw new errors.DevRevError({
+ statusCode: _response.error.statusCode,
+ body: _response.error.body,
+ });
+ }
+ }
+
+ switch (_response.error.reason) {
+ case "non-json":
+ throw new errors.DevRevError({
+ statusCode: _response.error.statusCode,
+ body: _response.error.rawBody,
+ });
+ case "timeout":
+ throw new errors.DevRevTimeoutError();
+ case "unknown":
+ throw new errors.DevRevError({
+ message: _response.error.errorMessage,
+ });
+ }
+ }
+
+ /**
+ * Deletes a link.
+ *
+ * @param {DevRev.LinksDeleteRequest} request
+ * @param {Links.RequestOptions} requestOptions - Request-specific configuration.
+ *
+ * @throws {@link DevRev.BadRequestError}
+ * @throws {@link DevRev.UnauthorizedError}
+ * @throws {@link DevRev.ForbiddenError}
+ * @throws {@link DevRev.NotFoundError}
+ * @throws {@link DevRev.TooManyRequestsError}
+ * @throws {@link DevRev.InternalServerError}
+ * @throws {@link DevRev.ServiceUnavailableError}
+ *
+ * @example
+ * await client.links.delete({
+ * id: "id"
+ * })
+ */
+ public async delete(
+ request: DevRev.LinksDeleteRequest,
+ requestOptions?: Links.RequestOptions
+ ): Promise {
+ const _response = await (this._options.fetcher ?? core.fetcher)({
+ url: urlJoin(
+ (await core.Supplier.get(this._options.environment)) ?? environments.DevRevEnvironment.Default,
+ "links.delete"
+ ),
+ method: "POST",
+ headers: {
+ Authorization: await this._getAuthorizationHeader(),
+ "X-Fern-Language": "JavaScript",
+ "X-Fern-SDK-Name": "@devrev/api",
+ "X-Fern-SDK-Version": "0.0.14",
+ "X-Fern-Runtime": core.RUNTIME.type,
+ "X-Fern-Runtime-Version": core.RUNTIME.version,
+ },
+ contentType: "application/json",
+ requestType: "json",
+ body: serializers.LinksDeleteRequest.jsonOrThrow(request, { unrecognizedObjectKeys: "strip" }),
+ timeoutMs: requestOptions?.timeoutInSeconds != null ? requestOptions.timeoutInSeconds * 1000 : 60000,
+ maxRetries: requestOptions?.maxRetries,
+ abortSignal: requestOptions?.abortSignal,
+ });
+ if (_response.ok) {
+ return serializers.LinksDeleteResponse.parseOrThrow(_response.body, {
+ unrecognizedObjectKeys: "passthrough",
+ allowUnrecognizedUnionMembers: true,
+ allowUnrecognizedEnumValues: true,
+ skipValidation: true,
+ breadcrumbsPrefix: ["response"],
+ });
+ }
+
+ if (_response.error.reason === "status-code") {
+ switch (_response.error.statusCode) {
+ case 400:
+ throw new DevRev.BadRequestError(
+ serializers.ErrorBadRequest.parseOrThrow(_response.error.body, {
+ unrecognizedObjectKeys: "passthrough",
+ allowUnrecognizedUnionMembers: true,
+ allowUnrecognizedEnumValues: true,
+ skipValidation: true,
+ breadcrumbsPrefix: ["response"],
+ })
+ );
+ case 401:
+ throw new DevRev.UnauthorizedError(
+ serializers.ErrorUnauthorized.parseOrThrow(_response.error.body, {
+ unrecognizedObjectKeys: "passthrough",
+ allowUnrecognizedUnionMembers: true,
+ allowUnrecognizedEnumValues: true,
+ skipValidation: true,
+ breadcrumbsPrefix: ["response"],
+ })
+ );
+ case 403:
+ throw new DevRev.ForbiddenError(
+ serializers.ErrorForbidden.parseOrThrow(_response.error.body, {
+ unrecognizedObjectKeys: "passthrough",
+ allowUnrecognizedUnionMembers: true,
+ allowUnrecognizedEnumValues: true,
+ skipValidation: true,
+ breadcrumbsPrefix: ["response"],
+ })
+ );
+ case 404:
+ throw new DevRev.NotFoundError(
+ serializers.ErrorNotFound.parseOrThrow(_response.error.body, {
+ unrecognizedObjectKeys: "passthrough",
+ allowUnrecognizedUnionMembers: true,
+ allowUnrecognizedEnumValues: true,
+ skipValidation: true,
+ breadcrumbsPrefix: ["response"],
+ })
+ );
+ case 429:
+ throw new DevRev.TooManyRequestsError(
+ serializers.ErrorTooManyRequests.parseOrThrow(_response.error.body, {
+ unrecognizedObjectKeys: "passthrough",
+ allowUnrecognizedUnionMembers: true,
+ allowUnrecognizedEnumValues: true,
+ skipValidation: true,
+ breadcrumbsPrefix: ["response"],
+ })
+ );
+ case 500:
+ throw new DevRev.InternalServerError(
+ serializers.ErrorInternalServerError.parseOrThrow(_response.error.body, {
+ unrecognizedObjectKeys: "passthrough",
+ allowUnrecognizedUnionMembers: true,
+ allowUnrecognizedEnumValues: true,
+ skipValidation: true,
+ breadcrumbsPrefix: ["response"],
+ })
+ );
+ case 503:
+ throw new DevRev.ServiceUnavailableError(
+ serializers.ErrorServiceUnavailable.parseOrThrow(_response.error.body, {
+ unrecognizedObjectKeys: "passthrough",
+ allowUnrecognizedUnionMembers: true,
+ allowUnrecognizedEnumValues: true,
+ skipValidation: true,
+ breadcrumbsPrefix: ["response"],
+ })
+ );
+ default:
+ throw new errors.DevRevError({
+ statusCode: _response.error.statusCode,
+ body: _response.error.body,
+ });
+ }
+ }
+
+ switch (_response.error.reason) {
+ case "non-json":
+ throw new errors.DevRevError({
+ statusCode: _response.error.statusCode,
+ body: _response.error.rawBody,
+ });
+ case "timeout":
+ throw new errors.DevRevTimeoutError();
+ case "unknown":
+ throw new errors.DevRevError({
+ message: _response.error.errorMessage,
+ });
+ }
+ }
+
+ /**
+ * Gets the requested link's information.
+ *
+ * @param {DevRev.LinksGetQuery} request
+ * @param {Links.RequestOptions} requestOptions - Request-specific configuration.
+ *
+ * @throws {@link DevRev.BadRequestError}
+ * @throws {@link DevRev.UnauthorizedError}
+ * @throws {@link DevRev.ForbiddenError}
+ * @throws {@link DevRev.NotFoundError}
+ * @throws {@link DevRev.TooManyRequestsError}
+ * @throws {@link DevRev.InternalServerError}
+ * @throws {@link DevRev.ServiceUnavailableError}
+ *
+ * @example
+ * await client.links.get({
+ * id: "string"
+ * })
+ */
+ public async get(
+ request: DevRev.LinksGetQuery,
+ requestOptions?: Links.RequestOptions
+ ): Promise {
+ const { id } = request;
+ const _queryParams: Record = {};
+ _queryParams["id"] = id;
+ const _response = await (this._options.fetcher ?? core.fetcher)({
+ url: urlJoin(
+ (await core.Supplier.get(this._options.environment)) ?? environments.DevRevEnvironment.Default,
+ "links.get"
+ ),
+ method: "GET",
+ headers: {
+ Authorization: await this._getAuthorizationHeader(),
+ "X-Fern-Language": "JavaScript",
+ "X-Fern-SDK-Name": "@devrev/api",
+ "X-Fern-SDK-Version": "0.0.14",
+ "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 serializers.LinksGetResponse.parseOrThrow(_response.body, {
+ unrecognizedObjectKeys: "passthrough",
+ allowUnrecognizedUnionMembers: true,
+ allowUnrecognizedEnumValues: true,
+ skipValidation: true,
+ breadcrumbsPrefix: ["response"],
+ });
+ }
+
+ if (_response.error.reason === "status-code") {
+ switch (_response.error.statusCode) {
+ case 400:
+ throw new DevRev.BadRequestError(
+ serializers.ErrorBadRequest.parseOrThrow(_response.error.body, {
+ unrecognizedObjectKeys: "passthrough",
+ allowUnrecognizedUnionMembers: true,
+ allowUnrecognizedEnumValues: true,
+ skipValidation: true,
+ breadcrumbsPrefix: ["response"],
+ })
+ );
+ case 401:
+ throw new DevRev.UnauthorizedError(
+ serializers.ErrorUnauthorized.parseOrThrow(_response.error.body, {
+ unrecognizedObjectKeys: "passthrough",
+ allowUnrecognizedUnionMembers: true,
+ allowUnrecognizedEnumValues: true,
+ skipValidation: true,
+ breadcrumbsPrefix: ["response"],
+ })
+ );
+ case 403:
+ throw new DevRev.ForbiddenError(
+ serializers.ErrorForbidden.parseOrThrow(_response.error.body, {
+ unrecognizedObjectKeys: "passthrough",
+ allowUnrecognizedUnionMembers: true,
+ allowUnrecognizedEnumValues: true,
+ skipValidation: true,
+ breadcrumbsPrefix: ["response"],
+ })
+ );
+ case 404:
+ throw new DevRev.NotFoundError(
+ serializers.ErrorNotFound.parseOrThrow(_response.error.body, {
+ unrecognizedObjectKeys: "passthrough",
+ allowUnrecognizedUnionMembers: true,
+ allowUnrecognizedEnumValues: true,
+ skipValidation: true,
+ breadcrumbsPrefix: ["response"],
+ })
+ );
+ case 429:
+ throw new DevRev.TooManyRequestsError(
+ serializers.ErrorTooManyRequests.parseOrThrow(_response.error.body, {
+ unrecognizedObjectKeys: "passthrough",
+ allowUnrecognizedUnionMembers: true,
+ allowUnrecognizedEnumValues: true,
+ skipValidation: true,
+ breadcrumbsPrefix: ["response"],
+ })
+ );
+ case 500:
+ throw new DevRev.InternalServerError(
+ serializers.ErrorInternalServerError.parseOrThrow(_response.error.body, {
+ unrecognizedObjectKeys: "passthrough",
+ allowUnrecognizedUnionMembers: true,
+ allowUnrecognizedEnumValues: true,
+ skipValidation: true,
+ breadcrumbsPrefix: ["response"],
+ })
+ );
+ case 503:
+ throw new DevRev.ServiceUnavailableError(
+ serializers.ErrorServiceUnavailable.parseOrThrow(_response.error.body, {
+ unrecognizedObjectKeys: "passthrough",
+ allowUnrecognizedUnionMembers: true,
+ allowUnrecognizedEnumValues: true,
+ skipValidation: true,
+ breadcrumbsPrefix: ["response"],
+ })
+ );
+ default:
+ throw new errors.DevRevError({
+ statusCode: _response.error.statusCode,
+ body: _response.error.body,
+ });
+ }
+ }
+
+ switch (_response.error.reason) {
+ case "non-json":
+ throw new errors.DevRevError({
+ statusCode: _response.error.statusCode,
+ body: _response.error.rawBody,
+ });
+ case "timeout":
+ throw new errors.DevRevTimeoutError();
+ case "unknown":
+ throw new errors.DevRevError({
+ message: _response.error.errorMessage,
+ });
+ }
+ }
+
+ /**
+ * Gets the requested link's information.
+ *
+ * @param {DevRev.LinksGetRequest} request
+ * @param {Links.RequestOptions} requestOptions - Request-specific configuration.
+ *
+ * @throws {@link DevRev.BadRequestError}
+ * @throws {@link DevRev.UnauthorizedError}
+ * @throws {@link DevRev.ForbiddenError}
+ * @throws {@link DevRev.NotFoundError}
+ * @throws {@link DevRev.TooManyRequestsError}
+ * @throws {@link DevRev.InternalServerError}
+ * @throws {@link DevRev.ServiceUnavailableError}
+ *
+ * @example
+ * await client.links.getPost({
+ * id: "string"
+ * })
+ */
+ public async getPost(
+ request: DevRev.LinksGetRequest,
+ requestOptions?: Links.RequestOptions
+ ): Promise {
+ const _response = await (this._options.fetcher ?? core.fetcher)({
+ url: urlJoin(
+ (await core.Supplier.get(this._options.environment)) ?? environments.DevRevEnvironment.Default,
+ "links.get"
+ ),
+ method: "POST",
+ headers: {
+ Authorization: await this._getAuthorizationHeader(),
+ "X-Fern-Language": "JavaScript",
+ "X-Fern-SDK-Name": "@devrev/api",
+ "X-Fern-SDK-Version": "0.0.14",
+ "X-Fern-Runtime": core.RUNTIME.type,
+ "X-Fern-Runtime-Version": core.RUNTIME.version,
+ },
+ contentType: "application/json",
+ requestType: "json",
+ body: serializers.LinksGetRequest.jsonOrThrow(request, { unrecognizedObjectKeys: "strip" }),
+ timeoutMs: requestOptions?.timeoutInSeconds != null ? requestOptions.timeoutInSeconds * 1000 : 60000,
+ maxRetries: requestOptions?.maxRetries,
+ abortSignal: requestOptions?.abortSignal,
+ });
+ if (_response.ok) {
+ return serializers.LinksGetResponse.parseOrThrow(_response.body, {
+ unrecognizedObjectKeys: "passthrough",
+ allowUnrecognizedUnionMembers: true,
+ allowUnrecognizedEnumValues: true,
+ skipValidation: true,
+ breadcrumbsPrefix: ["response"],
+ });
+ }
+
+ if (_response.error.reason === "status-code") {
+ switch (_response.error.statusCode) {
+ case 400:
+ throw new DevRev.BadRequestError(
+ serializers.ErrorBadRequest.parseOrThrow(_response.error.body, {
+ unrecognizedObjectKeys: "passthrough",
+ allowUnrecognizedUnionMembers: true,
+ allowUnrecognizedEnumValues: true,
+ skipValidation: true,
+ breadcrumbsPrefix: ["response"],
+ })
+ );
+ case 401:
+ throw new DevRev.UnauthorizedError(
+ serializers.ErrorUnauthorized.parseOrThrow(_response.error.body, {
+ unrecognizedObjectKeys: "passthrough",
+ allowUnrecognizedUnionMembers: true,
+ allowUnrecognizedEnumValues: true,
+ skipValidation: true,
+ breadcrumbsPrefix: ["response"],
+ })
+ );
+ case 403:
+ throw new DevRev.ForbiddenError(
+ serializers.ErrorForbidden.parseOrThrow(_response.error.body, {
+ unrecognizedObjectKeys: "passthrough",
+ allowUnrecognizedUnionMembers: true,
+ allowUnrecognizedEnumValues: true,
+ skipValidation: true,
+ breadcrumbsPrefix: ["response"],
+ })
+ );
+ case 404:
+ throw new DevRev.NotFoundError(
+ serializers.ErrorNotFound.parseOrThrow(_response.error.body, {
+ unrecognizedObjectKeys: "passthrough",
+ allowUnrecognizedUnionMembers: true,
+ allowUnrecognizedEnumValues: true,
+ skipValidation: true,
+ breadcrumbsPrefix: ["response"],
+ })
+ );
+ case 429:
+ throw new DevRev.TooManyRequestsError(
+ serializers.ErrorTooManyRequests.parseOrThrow(_response.error.body, {
+ unrecognizedObjectKeys: "passthrough",
+ allowUnrecognizedUnionMembers: true,
+ allowUnrecognizedEnumValues: true,
+ skipValidation: true,
+ breadcrumbsPrefix: ["response"],
+ })
+ );
+ case 500:
+ throw new DevRev.InternalServerError(
+ serializers.ErrorInternalServerError.parseOrThrow(_response.error.body, {
+ unrecognizedObjectKeys: "passthrough",
+ allowUnrecognizedUnionMembers: true,
+ allowUnrecognizedEnumValues: true,
+ skipValidation: true,
+ breadcrumbsPrefix: ["response"],
+ })
+ );
+ case 503:
+ throw new DevRev.ServiceUnavailableError(
+ serializers.ErrorServiceUnavailable.parseOrThrow(_response.error.body, {
+ unrecognizedObjectKeys: "passthrough",
+ allowUnrecognizedUnionMembers: true,
+ allowUnrecognizedEnumValues: true,
+ skipValidation: true,
+ breadcrumbsPrefix: ["response"],
+ })
+ );
+ default:
+ throw new errors.DevRevError({
+ statusCode: _response.error.statusCode,
+ body: _response.error.body,
+ });
+ }
+ }
+
+ switch (_response.error.reason) {
+ case "non-json":
+ throw new errors.DevRevError({
+ statusCode: _response.error.statusCode,
+ body: _response.error.rawBody,
+ });
+ case "timeout":
+ throw new errors.DevRevTimeoutError();
+ case "unknown":
+ throw new errors.DevRevError({
+ message: _response.error.errorMessage,
+ });
+ }
+ }
+
+ /**
+ * Lists the available links.
+ *
+ * @param {DevRev.LinksListQuery} request
+ * @param {Links.RequestOptions} requestOptions - Request-specific configuration.
+ *
+ * @throws {@link DevRev.BadRequestError}
+ * @throws {@link DevRev.UnauthorizedError}
+ * @throws {@link DevRev.ForbiddenError}
+ * @throws {@link DevRev.TooManyRequestsError}
+ * @throws {@link DevRev.InternalServerError}
+ * @throws {@link DevRev.ServiceUnavailableError}
+ *
+ * @example
+ * await client.links.list({
+ * object: "object"
+ * })
+ */
+ public async list(
+ request: DevRev.LinksListQuery,
+ requestOptions?: Links.RequestOptions
+ ): Promise {
+ const { object, cursor, direction, limit, linkType, mode, objectTypes, types } = request;
+ const _queryParams: Record = {};
+ _queryParams["object"] = object;
+ if (cursor != null) {
+ _queryParams["cursor"] = cursor;
+ }
+
+ if (direction != null) {
+ _queryParams["direction"] = direction;
+ }
+
+ if (limit != null) {
+ _queryParams["limit"] = limit.toString();
+ }
+
+ if (linkType != null) {
+ if (Array.isArray(linkType)) {
+ _queryParams["link_type"] = linkType.map((item) => item);
+ } else {
+ _queryParams["link_type"] = linkType;
+ }
+ }
+
+ if (mode != null) {
+ _queryParams["mode"] = mode;
+ }
+
+ if (objectTypes != null) {
+ if (Array.isArray(objectTypes)) {
+ _queryParams["object_types"] = objectTypes.map((item) => item);
+ } else {
+ _queryParams["object_types"] = objectTypes;
+ }
+ }
+
+ if (types != null) {
+ if (Array.isArray(types)) {
+ _queryParams["types"] = types.map((item) => item);
+ } else {
+ _queryParams["types"] = types;
+ }
+ }
+
+ const _response = await (this._options.fetcher ?? core.fetcher)({
+ url: urlJoin(
+ (await core.Supplier.get(this._options.environment)) ?? environments.DevRevEnvironment.Default,
+ "links.list"
+ ),
+ method: "GET",
+ headers: {
+ Authorization: await this._getAuthorizationHeader(),
+ "X-Fern-Language": "JavaScript",
+ "X-Fern-SDK-Name": "@devrev/api",
+ "X-Fern-SDK-Version": "0.0.14",
+ "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 serializers.LinksListResponse.parseOrThrow(_response.body, {
+ unrecognizedObjectKeys: "passthrough",
+ allowUnrecognizedUnionMembers: true,
+ allowUnrecognizedEnumValues: true,
+ skipValidation: true,
+ breadcrumbsPrefix: ["response"],
+ });
+ }
+
+ if (_response.error.reason === "status-code") {
+ switch (_response.error.statusCode) {
+ case 400:
+ throw new DevRev.BadRequestError(
+ serializers.ErrorBadRequest.parseOrThrow(_response.error.body, {
+ unrecognizedObjectKeys: "passthrough",
+ allowUnrecognizedUnionMembers: true,
+ allowUnrecognizedEnumValues: true,
+ skipValidation: true,
+ breadcrumbsPrefix: ["response"],
+ })
+ );
+ case 401:
+ throw new DevRev.UnauthorizedError(
+ serializers.ErrorUnauthorized.parseOrThrow(_response.error.body, {
+ unrecognizedObjectKeys: "passthrough",
+ allowUnrecognizedUnionMembers: true,
+ allowUnrecognizedEnumValues: true,
+ skipValidation: true,
+ breadcrumbsPrefix: ["response"],
+ })
+ );
+ case 403:
+ throw new DevRev.ForbiddenError(
+ serializers.ErrorForbidden.parseOrThrow(_response.error.body, {
+ unrecognizedObjectKeys: "passthrough",
+ allowUnrecognizedUnionMembers: true,
+ allowUnrecognizedEnumValues: true,
+ skipValidation: true,
+ breadcrumbsPrefix: ["response"],
+ })
+ );
+ case 429:
+ throw new DevRev.TooManyRequestsError(
+ serializers.ErrorTooManyRequests.parseOrThrow(_response.error.body, {
+ unrecognizedObjectKeys: "passthrough",
+ allowUnrecognizedUnionMembers: true,
+ allowUnrecognizedEnumValues: true,
+ skipValidation: true,
+ breadcrumbsPrefix: ["response"],
+ })
+ );
+ case 500:
+ throw new DevRev.InternalServerError(
+ serializers.ErrorInternalServerError.parseOrThrow(_response.error.body, {
+ unrecognizedObjectKeys: "passthrough",
+ allowUnrecognizedUnionMembers: true,
+ allowUnrecognizedEnumValues: true,
+ skipValidation: true,
+ breadcrumbsPrefix: ["response"],
+ })
+ );
+ case 503:
+ throw new DevRev.ServiceUnavailableError(
+ serializers.ErrorServiceUnavailable.parseOrThrow(_response.error.body, {
+ unrecognizedObjectKeys: "passthrough",
+ allowUnrecognizedUnionMembers: true,
+ allowUnrecognizedEnumValues: true,
+ skipValidation: true,
+ breadcrumbsPrefix: ["response"],
+ })
+ );
+ default:
+ throw new errors.DevRevError({
+ statusCode: _response.error.statusCode,
+ body: _response.error.body,
+ });
+ }
+ }
+
+ switch (_response.error.reason) {
+ case "non-json":
+ throw new errors.DevRevError({
+ statusCode: _response.error.statusCode,
+ body: _response.error.rawBody,
+ });
+ case "timeout":
+ throw new errors.DevRevTimeoutError();
+ case "unknown":
+ throw new errors.DevRevError({
+ message: _response.error.errorMessage,
+ });
+ }
+ }
+
+ /**
+ * Lists the available links.
+ *
+ * @param {DevRev.LinksListRequest} request
+ * @param {Links.RequestOptions} requestOptions - Request-specific configuration.
+ *
+ * @throws {@link DevRev.BadRequestError}
+ * @throws {@link DevRev.UnauthorizedError}
+ * @throws {@link DevRev.ForbiddenError}
+ * @throws {@link DevRev.TooManyRequestsError}
+ * @throws {@link DevRev.InternalServerError}
+ * @throws {@link DevRev.ServiceUnavailableError}
+ *
+ * @example
+ * await client.links.listPost({
+ * object: "object"
+ * })
+ */
+ public async listPost(
+ request: DevRev.LinksListRequest,
+ requestOptions?: Links.RequestOptions
+ ): Promise {
+ const _response = await (this._options.fetcher ?? core.fetcher)({
+ url: urlJoin(
+ (await core.Supplier.get(this._options.environment)) ?? environments.DevRevEnvironment.Default,
+ "links.list"
+ ),
+ method: "POST",
+ headers: {
+ Authorization: await this._getAuthorizationHeader(),
+ "X-Fern-Language": "JavaScript",
+ "X-Fern-SDK-Name": "@devrev/api",
+ "X-Fern-SDK-Version": "0.0.14",
+ "X-Fern-Runtime": core.RUNTIME.type,
+ "X-Fern-Runtime-Version": core.RUNTIME.version,
+ },
+ contentType: "application/json",
+ requestType: "json",
+ body: serializers.LinksListRequest.jsonOrThrow(request, { unrecognizedObjectKeys: "strip" }),
+ timeoutMs: requestOptions?.timeoutInSeconds != null ? requestOptions.timeoutInSeconds * 1000 : 60000,
+ maxRetries: requestOptions?.maxRetries,
+ abortSignal: requestOptions?.abortSignal,
+ });
+ if (_response.ok) {
+ return serializers.LinksListResponse.parseOrThrow(_response.body, {
+ unrecognizedObjectKeys: "passthrough",
+ allowUnrecognizedUnionMembers: true,
+ allowUnrecognizedEnumValues: true,
+ skipValidation: true,
+ breadcrumbsPrefix: ["response"],
+ });
+ }
+
+ if (_response.error.reason === "status-code") {
+ switch (_response.error.statusCode) {
+ case 400:
+ throw new DevRev.BadRequestError(
+ serializers.ErrorBadRequest.parseOrThrow(_response.error.body, {
+ unrecognizedObjectKeys: "passthrough",
+ allowUnrecognizedUnionMembers: true,
+ allowUnrecognizedEnumValues: true,
+ skipValidation: true,
+ breadcrumbsPrefix: ["response"],
+ })
+ );
+ case 401:
+ throw new DevRev.UnauthorizedError(
+ serializers.ErrorUnauthorized.parseOrThrow(_response.error.body, {
+ unrecognizedObjectKeys: "passthrough",
+ allowUnrecognizedUnionMembers: true,
+ allowUnrecognizedEnumValues: true,
+ skipValidation: true,
+ breadcrumbsPrefix: ["response"],
+ })
+ );
+ case 403:
+ throw new DevRev.ForbiddenError(
+ serializers.ErrorForbidden.parseOrThrow(_response.error.body, {
+ unrecognizedObjectKeys: "passthrough",
+ allowUnrecognizedUnionMembers: true,
+ allowUnrecognizedEnumValues: true,
+ skipValidation: true,
+ breadcrumbsPrefix: ["response"],
+ })
+ );
+ case 429:
+ throw new DevRev.TooManyRequestsError(
+ serializers.ErrorTooManyRequests.parseOrThrow(_response.error.body, {
+ unrecognizedObjectKeys: "passthrough",
+ allowUnrecognizedUnionMembers: true,
+ allowUnrecognizedEnumValues: true,
+ skipValidation: true,
+ breadcrumbsPrefix: ["response"],
+ })
+ );
+ case 500:
+ throw new DevRev.InternalServerError(
+ serializers.ErrorInternalServerError.parseOrThrow(_response.error.body, {
+ unrecognizedObjectKeys: "passthrough",
+ allowUnrecognizedUnionMembers: true,
+ allowUnrecognizedEnumValues: true,
+ skipValidation: true,
+ breadcrumbsPrefix: ["response"],
+ })
+ );
+ case 503:
+ throw new DevRev.ServiceUnavailableError(
+ serializers.ErrorServiceUnavailable.parseOrThrow(_response.error.body, {
+ unrecognizedObjectKeys: "passthrough",
+ allowUnrecognizedUnionMembers: true,
+ allowUnrecognizedEnumValues: true,
+ skipValidation: true,
+ breadcrumbsPrefix: ["response"],
+ })
+ );
+ default:
+ throw new errors.DevRevError({
+ statusCode: _response.error.statusCode,
+ body: _response.error.body,
+ });
+ }
+ }
+
+ switch (_response.error.reason) {
+ case "non-json":
+ throw new errors.DevRevError({
+ statusCode: _response.error.statusCode,
+ body: _response.error.rawBody,
+ });
+ case "timeout":
+ throw new errors.DevRevTimeoutError();
+ case "unknown":
+ throw new errors.DevRevError({
+ message: _response.error.errorMessage,
+ });
+ }
+ }
+
+ protected async _getAuthorizationHeader(): Promise {
+ const bearer = (await core.Supplier.get(this._options.token)) ?? process?.env["DEVREV_TOKEN"];
+ if (bearer == null) {
+ throw new errors.DevRevError({
+ message: "Please specify DEVREV_TOKEN when instantiating the client.",
+ });
+ }
+
+ return `Bearer ${bearer}`;
+ }
+}
diff --git a/src/api/resources/links/client/index.ts b/src/api/resources/links/client/index.ts
new file mode 100644
index 0000000..415726b
--- /dev/null
+++ b/src/api/resources/links/client/index.ts
@@ -0,0 +1 @@
+export * from "./requests";
diff --git a/src/api/resources/links/client/requests/LinksCreateRequest.ts b/src/api/resources/links/client/requests/LinksCreateRequest.ts
new file mode 100644
index 0000000..740be41
--- /dev/null
+++ b/src/api/resources/links/client/requests/LinksCreateRequest.ts
@@ -0,0 +1,21 @@
+/**
+ * This file was auto-generated by Fern from our API Definition.
+ */
+
+import * as DevRev from "../../../../index";
+
+/**
+ * @example
+ * {
+ * linkType: DevRev.LinkType.CustomLink,
+ * source: "string",
+ * target: "string"
+ * }
+ */
+export interface LinksCreateRequest {
+ linkType: DevRev.LinkType;
+ /** The ID of the source object. */
+ source: string;
+ /** The ID of the target object. */
+ target: string;
+}
diff --git a/src/api/resources/links/client/requests/LinksDeleteRequest.ts b/src/api/resources/links/client/requests/LinksDeleteRequest.ts
new file mode 100644
index 0000000..e3e5a0a
--- /dev/null
+++ b/src/api/resources/links/client/requests/LinksDeleteRequest.ts
@@ -0,0 +1,14 @@
+/**
+ * This file was auto-generated by Fern from our API Definition.
+ */
+
+/**
+ * @example
+ * {
+ * id: "id"
+ * }
+ */
+export interface LinksDeleteRequest {
+ /** The ID of the link to delete. */
+ id: string;
+}
diff --git a/src/api/resources/links/client/requests/LinksGetQuery.ts b/src/api/resources/links/client/requests/LinksGetQuery.ts
new file mode 100644
index 0000000..536e54f
--- /dev/null
+++ b/src/api/resources/links/client/requests/LinksGetQuery.ts
@@ -0,0 +1,16 @@
+/**
+ * This file was auto-generated by Fern from our API Definition.
+ */
+
+/**
+ * @example
+ * {
+ * id: "string"
+ * }
+ */
+export interface LinksGetQuery {
+ /**
+ * The requested link's ID.
+ */
+ id: string;
+}
diff --git a/src/api/resources/links/client/requests/LinksGetRequest.ts b/src/api/resources/links/client/requests/LinksGetRequest.ts
new file mode 100644
index 0000000..666d0a6
--- /dev/null
+++ b/src/api/resources/links/client/requests/LinksGetRequest.ts
@@ -0,0 +1,14 @@
+/**
+ * This file was auto-generated by Fern from our API Definition.
+ */
+
+/**
+ * @example
+ * {
+ * id: "string"
+ * }
+ */
+export interface LinksGetRequest {
+ /** The requested link's ID. */
+ id: string;
+}
diff --git a/src/api/resources/links/client/requests/LinksListQuery.ts b/src/api/resources/links/client/requests/LinksListQuery.ts
new file mode 100644
index 0000000..a353545
--- /dev/null
+++ b/src/api/resources/links/client/requests/LinksListQuery.ts
@@ -0,0 +1,53 @@
+/**
+ * This file was auto-generated by Fern from our API Definition.
+ */
+
+import * as DevRev from "../../../../index";
+
+/**
+ * @example
+ * {
+ * object: "object"
+ * }
+ */
+export interface LinksListQuery {
+ /**
+ * The ID of the object to list the links for.
+ */
+ object: string;
+ /**
+ * The cursor to resume iteration from. If not provided, then iteration
+ * starts from the beginning.
+ */
+ cursor?: string;
+ /**
+ * The direction of the links to list, otherwise if not present, then
+ * links in both directions (source and target) are included.
+ */
+ direction?: DevRev.LinksDirection;
+ /**
+ * The maximum number of links to return. If not set, then the default
+ * is '50'.
+ */
+ limit?: number;
+ /**
+ * The link type(s) to filter for, otherwise if not present, all link
+ * types are included.
+ */
+ linkType?: DevRev.LinkType | DevRev.LinkType[];
+ /**
+ * The iteration mode to use, otherwise if not set, then "after" is
+ * used.
+ */
+ mode?: DevRev.ListMode;
+ /**
+ * The object types to filter for, otherwise if not present, all object
+ * types are included.
+ */
+ objectTypes?: DevRev.LinkEndpointType | DevRev.LinkEndpointType[];
+ /**
+ * The link types to filter for, otherwise if not present, all link
+ * types are included.
+ */
+ types?: DevRev.LinkType | DevRev.LinkType[];
+}
diff --git a/src/api/resources/links/client/requests/LinksListRequest.ts b/src/api/resources/links/client/requests/LinksListRequest.ts
new file mode 100644
index 0000000..b3b5c16
--- /dev/null
+++ b/src/api/resources/links/client/requests/LinksListRequest.ts
@@ -0,0 +1,48 @@
+/**
+ * This file was auto-generated by Fern from our API Definition.
+ */
+
+import * as DevRev from "../../../../index";
+
+/**
+ * @example
+ * {
+ * object: "object"
+ * }
+ */
+export interface LinksListRequest {
+ /**
+ * The cursor to resume iteration from. If not provided, then
+ * iteration starts from the beginning.
+ *
+ */
+ cursor?: string;
+ direction?: DevRev.LinksDirection;
+ /**
+ * The maximum number of links to return. If not set, then the default
+ * is '50'.
+ *
+ */
+ limit?: number;
+ /**
+ * The link type(s) to filter for, otherwise if not present, all link
+ * types are included.
+ *
+ */
+ linkType?: DevRev.LinkType[];
+ mode?: DevRev.ListMode;
+ /** The ID of the object to list the links for. */
+ object: string;
+ /**
+ * The object types to filter for, otherwise if not present, all
+ * object types are included.
+ *
+ */
+ objectTypes?: DevRev.LinkEndpointType[];
+ /**
+ * The link types to filter for, otherwise if not present, all link
+ * types are included.
+ *
+ */
+ types?: DevRev.LinkType[];
+}
diff --git a/src/api/resources/links/client/requests/index.ts b/src/api/resources/links/client/requests/index.ts
new file mode 100644
index 0000000..e1f9ed6
--- /dev/null
+++ b/src/api/resources/links/client/requests/index.ts
@@ -0,0 +1,6 @@
+export { type LinksCreateRequest } from "./LinksCreateRequest";
+export { type LinksDeleteRequest } from "./LinksDeleteRequest";
+export { type LinksGetQuery } from "./LinksGetQuery";
+export { type LinksGetRequest } from "./LinksGetRequest";
+export { type LinksListQuery } from "./LinksListQuery";
+export { type LinksListRequest } from "./LinksListRequest";
diff --git a/src/api/resources/links/index.ts b/src/api/resources/links/index.ts
new file mode 100644
index 0000000..5ec7692
--- /dev/null
+++ b/src/api/resources/links/index.ts
@@ -0,0 +1 @@
+export * from "./client";
diff --git a/src/api/resources/parts/client/Client.ts b/src/api/resources/parts/client/Client.ts
new file mode 100644
index 0000000..f2944f2
--- /dev/null
+++ b/src/api/resources/parts/client/Client.ts
@@ -0,0 +1,1138 @@
+/**
+ * This file was auto-generated by Fern from our API Definition.
+ */
+
+import * as environments from "../../../../environments";
+import * as core from "../../../../core";
+import * as DevRev from "../../../index";
+import * as serializers from "../../../../serialization/index";
+import urlJoin from "url-join";
+import * as errors from "../../../../errors/index";
+
+export declare namespace Parts {
+ interface Options {
+ environment?: core.Supplier;
+ token?: 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;
+ }
+}
+
+/**
+ * DevRev part interactions.
+ */
+export class Parts {
+ constructor(protected readonly _options: Parts.Options = {}) {}
+
+ /**
+ * Creates new [part](https://devrev.ai/docs/product/parts).
+ *
+ * @param {DevRev.PartsCreateRequest} request
+ * @param {Parts.RequestOptions} requestOptions - Request-specific configuration.
+ *
+ * @throws {@link DevRev.BadRequestError}
+ * @throws {@link DevRev.UnauthorizedError}
+ * @throws {@link DevRev.ForbiddenError}
+ * @throws {@link DevRev.TooManyRequestsError}
+ * @throws {@link DevRev.InternalServerError}
+ * @throws {@link DevRev.ServiceUnavailableError}
+ *
+ * @example
+ * await client.parts.create({
+ * type: "capability",
+ * artifacts: ["string"],
+ * customFields: {
+ * "string": {
+ * "key": "value"
+ * }
+ * },
+ * customSchemaFragments: ["string"],
+ * description: "string",
+ * name: "string",
+ * ownedBy: ["string"],
+ * parentPart: ["string"]
+ * })
+ */
+ public async create(
+ request: DevRev.PartsCreateRequest,
+ requestOptions?: Parts.RequestOptions
+ ): Promise {
+ const _response = await (this._options.fetcher ?? core.fetcher)({
+ url: urlJoin(
+ (await core.Supplier.get(this._options.environment)) ?? environments.DevRevEnvironment.Default,
+ "parts.create"
+ ),
+ method: "POST",
+ headers: {
+ Authorization: await this._getAuthorizationHeader(),
+ "X-Fern-Language": "JavaScript",
+ "X-Fern-SDK-Name": "@devrev/api",
+ "X-Fern-SDK-Version": "0.0.14",
+ "X-Fern-Runtime": core.RUNTIME.type,
+ "X-Fern-Runtime-Version": core.RUNTIME.version,
+ },
+ contentType: "application/json",
+ requestType: "json",
+ body: serializers.PartsCreateRequest.jsonOrThrow(request, { unrecognizedObjectKeys: "strip" }),
+ timeoutMs: requestOptions?.timeoutInSeconds != null ? requestOptions.timeoutInSeconds * 1000 : 60000,
+ maxRetries: requestOptions?.maxRetries,
+ abortSignal: requestOptions?.abortSignal,
+ });
+ if (_response.ok) {
+ return serializers.PartsCreateResponse.parseOrThrow(_response.body, {
+ unrecognizedObjectKeys: "passthrough",
+ allowUnrecognizedUnionMembers: true,
+ allowUnrecognizedEnumValues: true,
+ skipValidation: true,
+ breadcrumbsPrefix: ["response"],
+ });
+ }
+
+ if (_response.error.reason === "status-code") {
+ switch (_response.error.statusCode) {
+ case 400:
+ throw new DevRev.BadRequestError(
+ serializers.ErrorBadRequest.parseOrThrow(_response.error.body, {
+ unrecognizedObjectKeys: "passthrough",
+ allowUnrecognizedUnionMembers: true,
+ allowUnrecognizedEnumValues: true,
+ skipValidation: true,
+ breadcrumbsPrefix: ["response"],
+ })
+ );
+ case 401:
+ throw new DevRev.UnauthorizedError(
+ serializers.ErrorUnauthorized.parseOrThrow(_response.error.body, {
+ unrecognizedObjectKeys: "passthrough",
+ allowUnrecognizedUnionMembers: true,
+ allowUnrecognizedEnumValues: true,
+ skipValidation: true,
+ breadcrumbsPrefix: ["response"],
+ })
+ );
+ case 403:
+ throw new DevRev.ForbiddenError(
+ serializers.ErrorForbidden.parseOrThrow(_response.error.body, {
+ unrecognizedObjectKeys: "passthrough",
+ allowUnrecognizedUnionMembers: true,
+ allowUnrecognizedEnumValues: true,
+ skipValidation: true,
+ breadcrumbsPrefix: ["response"],
+ })
+ );
+ case 429:
+ throw new DevRev.TooManyRequestsError(
+ serializers.ErrorTooManyRequests.parseOrThrow(_response.error.body, {
+ unrecognizedObjectKeys: "passthrough",
+ allowUnrecognizedUnionMembers: true,
+ allowUnrecognizedEnumValues: true,
+ skipValidation: true,
+ breadcrumbsPrefix: ["response"],
+ })
+ );
+ case 500:
+ throw new DevRev.InternalServerError(
+ serializers.ErrorInternalServerError.parseOrThrow(_response.error.body, {
+ unrecognizedObjectKeys: "passthrough",
+ allowUnrecognizedUnionMembers: true,
+ allowUnrecognizedEnumValues: true,
+ skipValidation: true,
+ breadcrumbsPrefix: ["response"],
+ })
+ );
+ case 503:
+ throw new DevRev.ServiceUnavailableError(
+ serializers.ErrorServiceUnavailable.parseOrThrow(_response.error.body, {
+ unrecognizedObjectKeys: "passthrough",
+ allowUnrecognizedUnionMembers: true,
+ allowUnrecognizedEnumValues: true,
+ skipValidation: true,
+ breadcrumbsPrefix: ["response"],
+ })
+ );
+ default:
+ throw new errors.DevRevError({
+ statusCode: _response.error.statusCode,
+ body: _response.error.body,
+ });
+ }
+ }
+
+ switch (_response.error.reason) {
+ case "non-json":
+ throw new errors.DevRevError({
+ statusCode: _response.error.statusCode,
+ body: _response.error.rawBody,
+ });
+ case "timeout":
+ throw new errors.DevRevTimeoutError();
+ case "unknown":
+ throw new errors.DevRevError({
+ message: _response.error.errorMessage,
+ });
+ }
+ }
+
+ /**
+ * Deletes a [part](https://devrev.ai/docs/product/parts).
+ *
+ * @param {DevRev.PartsDeleteRequest} request
+ * @param {Parts.RequestOptions} requestOptions - Request-specific configuration.
+ *
+ * @throws {@link DevRev.BadRequestError}
+ * @throws {@link DevRev.UnauthorizedError}
+ * @throws {@link DevRev.ForbiddenError}
+ * @throws {@link DevRev.NotFoundError}
+ * @throws {@link DevRev.TooManyRequestsError}
+ * @throws {@link DevRev.InternalServerError}
+ * @throws {@link DevRev.ServiceUnavailableError}
+ *
+ * @example
+ * await client.parts.delete({
+ * id: "PROD-12345"
+ * })
+ */
+ public async delete(
+ request: DevRev.PartsDeleteRequest,
+ requestOptions?: Parts.RequestOptions
+ ): Promise {
+ const _response = await (this._options.fetcher ?? core.fetcher)({
+ url: urlJoin(
+ (await core.Supplier.get(this._options.environment)) ?? environments.DevRevEnvironment.Default,
+ "parts.delete"
+ ),
+ method: "POST",
+ headers: {
+ Authorization: await this._getAuthorizationHeader(),
+ "X-Fern-Language": "JavaScript",
+ "X-Fern-SDK-Name": "@devrev/api",
+ "X-Fern-SDK-Version": "0.0.14",
+ "X-Fern-Runtime": core.RUNTIME.type,
+ "X-Fern-Runtime-Version": core.RUNTIME.version,
+ },
+ contentType: "application/json",
+ requestType: "json",
+ body: serializers.PartsDeleteRequest.jsonOrThrow(request, { unrecognizedObjectKeys: "strip" }),
+ timeoutMs: requestOptions?.timeoutInSeconds != null ? requestOptions.timeoutInSeconds * 1000 : 60000,
+ maxRetries: requestOptions?.maxRetries,
+ abortSignal: requestOptions?.abortSignal,
+ });
+ if (_response.ok) {
+ return serializers.PartsDeleteResponse.parseOrThrow(_response.body, {
+ unrecognizedObjectKeys: "passthrough",
+ allowUnrecognizedUnionMembers: true,
+ allowUnrecognizedEnumValues: true,
+ skipValidation: true,
+ breadcrumbsPrefix: ["response"],
+ });
+ }
+
+ if (_response.error.reason === "status-code") {
+ switch (_response.error.statusCode) {
+ case 400:
+ throw new DevRev.BadRequestError(
+ serializers.ErrorBadRequest.parseOrThrow(_response.error.body, {
+ unrecognizedObjectKeys: "passthrough",
+ allowUnrecognizedUnionMembers: true,
+ allowUnrecognizedEnumValues: true,
+ skipValidation: true,
+ breadcrumbsPrefix: ["response"],
+ })
+ );
+ case 401:
+ throw new DevRev.UnauthorizedError(
+ serializers.ErrorUnauthorized.parseOrThrow(_response.error.body, {
+ unrecognizedObjectKeys: "passthrough",
+ allowUnrecognizedUnionMembers: true,
+ allowUnrecognizedEnumValues: true,
+ skipValidation: true,
+ breadcrumbsPrefix: ["response"],
+ })
+ );
+ case 403:
+ throw new DevRev.ForbiddenError(
+ serializers.ErrorForbidden.parseOrThrow(_response.error.body, {
+ unrecognizedObjectKeys: "passthrough",
+ allowUnrecognizedUnionMembers: true,
+ allowUnrecognizedEnumValues: true,
+ skipValidation: true,
+ breadcrumbsPrefix: ["response"],
+ })
+ );
+ case 404:
+ throw new DevRev.NotFoundError(
+ serializers.ErrorNotFound.parseOrThrow(_response.error.body, {
+ unrecognizedObjectKeys: "passthrough",
+ allowUnrecognizedUnionMembers: true,
+ allowUnrecognizedEnumValues: true,
+ skipValidation: true,
+ breadcrumbsPrefix: ["response"],
+ })
+ );
+ case 429:
+ throw new DevRev.TooManyRequestsError(
+ serializers.ErrorTooManyRequests.parseOrThrow(_response.error.body, {
+ unrecognizedObjectKeys: "passthrough",
+ allowUnrecognizedUnionMembers: true,
+ allowUnrecognizedEnumValues: true,
+ skipValidation: true,
+ breadcrumbsPrefix: ["response"],
+ })
+ );
+ case 500:
+ throw new DevRev.InternalServerError(
+ serializers.ErrorInternalServerError.parseOrThrow(_response.error.body, {
+ unrecognizedObjectKeys: "passthrough",
+ allowUnrecognizedUnionMembers: true,
+ allowUnrecognizedEnumValues: true,
+ skipValidation: true,
+ breadcrumbsPrefix: ["response"],
+ })
+ );
+ case 503:
+ throw new DevRev.ServiceUnavailableError(
+ serializers.ErrorServiceUnavailable.parseOrThrow(_response.error.body, {
+ unrecognizedObjectKeys: "passthrough",
+ allowUnrecognizedUnionMembers: true,
+ allowUnrecognizedEnumValues: true,
+ skipValidation: true,
+ breadcrumbsPrefix: ["response"],
+ })
+ );
+ default:
+ throw new errors.DevRevError({
+ statusCode: _response.error.statusCode,
+ body: _response.error.body,
+ });
+ }
+ }
+
+ switch (_response.error.reason) {
+ case "non-json":
+ throw new errors.DevRevError({
+ statusCode: _response.error.statusCode,
+ body: _response.error.rawBody,
+ });
+ case "timeout":
+ throw new errors.DevRevTimeoutError();
+ case "unknown":
+ throw new errors.DevRevError({
+ message: _response.error.errorMessage,
+ });
+ }
+ }
+
+ /**
+ * Gets a [part's](https://devrev.ai/docs/product/parts) information.
+ *
+ * @param {DevRev.PartsGetQuery} request
+ * @param {Parts.RequestOptions} requestOptions - Request-specific configuration.
+ *
+ * @throws {@link DevRev.BadRequestError}
+ * @throws {@link DevRev.UnauthorizedError}
+ * @throws {@link DevRev.ForbiddenError}
+ * @throws {@link DevRev.NotFoundError}
+ * @throws {@link DevRev.TooManyRequestsError}
+ * @throws {@link DevRev.InternalServerError}
+ * @throws {@link DevRev.ServiceUnavailableError}
+ *
+ * @example
+ * await client.parts.get({
+ * id: "string"
+ * })
+ */
+ public async get(
+ request: DevRev.PartsGetQuery,
+ requestOptions?: Parts.RequestOptions
+ ): Promise {
+ const { id } = request;
+ const _queryParams: Record = {};
+ _queryParams["id"] = id;
+ const _response = await (this._options.fetcher ?? core.fetcher)({
+ url: urlJoin(
+ (await core.Supplier.get(this._options.environment)) ?? environments.DevRevEnvironment.Default,
+ "parts.get"
+ ),
+ method: "GET",
+ headers: {
+ Authorization: await this._getAuthorizationHeader(),
+ "X-Fern-Language": "JavaScript",
+ "X-Fern-SDK-Name": "@devrev/api",
+ "X-Fern-SDK-Version": "0.0.14",
+ "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 serializers.PartsGetResponse.parseOrThrow(_response.body, {
+ unrecognizedObjectKeys: "passthrough",
+ allowUnrecognizedUnionMembers: true,
+ allowUnrecognizedEnumValues: true,
+ skipValidation: true,
+ breadcrumbsPrefix: ["response"],
+ });
+ }
+
+ if (_response.error.reason === "status-code") {
+ switch (_response.error.statusCode) {
+ case 400:
+ throw new DevRev.BadRequestError(
+ serializers.ErrorBadRequest.parseOrThrow(_response.error.body, {
+ unrecognizedObjectKeys: "passthrough",
+ allowUnrecognizedUnionMembers: true,
+ allowUnrecognizedEnumValues: true,
+ skipValidation: true,
+ breadcrumbsPrefix: ["response"],
+ })
+ );
+ case 401:
+ throw new DevRev.UnauthorizedError(
+ serializers.ErrorUnauthorized.parseOrThrow(_response.error.body, {
+ unrecognizedObjectKeys: "passthrough",
+ allowUnrecognizedUnionMembers: true,
+ allowUnrecognizedEnumValues: true,
+ skipValidation: true,
+ breadcrumbsPrefix: ["response"],
+ })
+ );
+ case 403:
+ throw new DevRev.ForbiddenError(
+ serializers.ErrorForbidden.parseOrThrow(_response.error.body, {
+ unrecognizedObjectKeys: "passthrough",
+ allowUnrecognizedUnionMembers: true,
+ allowUnrecognizedEnumValues: true,
+ skipValidation: true,
+ breadcrumbsPrefix: ["response"],
+ })
+ );
+ case 404:
+ throw new DevRev.NotFoundError(
+ serializers.ErrorNotFound.parseOrThrow(_response.error.body, {
+ unrecognizedObjectKeys: "passthrough",
+ allowUnrecognizedUnionMembers: true,
+ allowUnrecognizedEnumValues: true,
+ skipValidation: true,
+ breadcrumbsPrefix: ["response"],
+ })
+ );
+ case 429:
+ throw new DevRev.TooManyRequestsError(
+ serializers.ErrorTooManyRequests.parseOrThrow(_response.error.body, {
+ unrecognizedObjectKeys: "passthrough",
+ allowUnrecognizedUnionMembers: true,
+ allowUnrecognizedEnumValues: true,
+ skipValidation: true,
+ breadcrumbsPrefix: ["response"],
+ })
+ );
+ case 500:
+ throw new DevRev.InternalServerError(
+ serializers.ErrorInternalServerError.parseOrThrow(_response.error.body, {
+ unrecognizedObjectKeys: "passthrough",
+ allowUnrecognizedUnionMembers: true,
+ allowUnrecognizedEnumValues: true,
+ skipValidation: true,
+ breadcrumbsPrefix: ["response"],
+ })
+ );
+ case 503:
+ throw new DevRev.ServiceUnavailableError(
+ serializers.ErrorServiceUnavailable.parseOrThrow(_response.error.body, {
+ unrecognizedObjectKeys: "passthrough",
+ allowUnrecognizedUnionMembers: true,
+ allowUnrecognizedEnumValues: true,
+ skipValidation: true,
+ breadcrumbsPrefix: ["response"],
+ })
+ );
+ default:
+ throw new errors.DevRevError({
+ statusCode: _response.error.statusCode,
+ body: _response.error.body,
+ });
+ }
+ }
+
+ switch (_response.error.reason) {
+ case "non-json":
+ throw new errors.DevRevError({
+ statusCode: _response.error.statusCode,
+ body: _response.error.rawBody,
+ });
+ case "timeout":
+ throw new errors.DevRevTimeoutError();
+ case "unknown":
+ throw new errors.DevRevError({
+ message: _response.error.errorMessage,
+ });
+ }
+ }
+
+ /**
+ * Gets a [part's](https://devrev.ai/docs/product/parts) information.
+ *
+ * @param {DevRev.PartsGetRequest} request
+ * @param {Parts.RequestOptions} requestOptions - Request-specific configuration.
+ *
+ * @throws {@link DevRev.BadRequestError}
+ * @throws {@link DevRev.UnauthorizedError}
+ * @throws {@link DevRev.ForbiddenError}
+ * @throws {@link DevRev.NotFoundError}
+ * @throws {@link DevRev.TooManyRequestsError}
+ * @throws {@link DevRev.InternalServerError}
+ * @throws {@link DevRev.ServiceUnavailableError}
+ *
+ * @example
+ * await client.parts.getPost({
+ * id: "string"
+ * })
+ */
+ public async getPost(
+ request: DevRev.PartsGetRequest,
+ requestOptions?: Parts.RequestOptions
+ ): Promise {
+ const _response = await (this._options.fetcher ?? core.fetcher)({
+ url: urlJoin(
+ (await core.Supplier.get(this._options.environment)) ?? environments.DevRevEnvironment.Default,
+ "parts.get"
+ ),
+ method: "POST",
+ headers: {
+ Authorization: await this._getAuthorizationHeader(),
+ "X-Fern-Language": "JavaScript",
+ "X-Fern-SDK-Name": "@devrev/api",
+ "X-Fern-SDK-Version": "0.0.14",
+ "X-Fern-Runtime": core.RUNTIME.type,
+ "X-Fern-Runtime-Version": core.RUNTIME.version,
+ },
+ contentType: "application/json",
+ requestType: "json",
+ body: serializers.PartsGetRequest.jsonOrThrow(request, { unrecognizedObjectKeys: "strip" }),
+ timeoutMs: requestOptions?.timeoutInSeconds != null ? requestOptions.timeoutInSeconds * 1000 : 60000,
+ maxRetries: requestOptions?.maxRetries,
+ abortSignal: requestOptions?.abortSignal,
+ });
+ if (_response.ok) {
+ return serializers.PartsGetResponse.parseOrThrow(_response.body, {
+ unrecognizedObjectKeys: "passthrough",
+ allowUnrecognizedUnionMembers: true,
+ allowUnrecognizedEnumValues: true,
+ skipValidation: true,
+ breadcrumbsPrefix: ["response"],
+ });
+ }
+
+ if (_response.error.reason === "status-code") {
+ switch (_response.error.statusCode) {
+ case 400:
+ throw new DevRev.BadRequestError(
+ serializers.ErrorBadRequest.parseOrThrow(_response.error.body, {
+ unrecognizedObjectKeys: "passthrough",
+ allowUnrecognizedUnionMembers: true,
+ allowUnrecognizedEnumValues: true,
+ skipValidation: true,
+ breadcrumbsPrefix: ["response"],
+ })
+ );
+ case 401:
+ throw new DevRev.UnauthorizedError(
+ serializers.ErrorUnauthorized.parseOrThrow(_response.error.body, {
+ unrecognizedObjectKeys: "passthrough",
+ allowUnrecognizedUnionMembers: true,
+ allowUnrecognizedEnumValues: true,
+ skipValidation: true,
+ breadcrumbsPrefix: ["response"],
+ })
+ );
+ case 403:
+ throw new DevRev.ForbiddenError(
+ serializers.ErrorForbidden.parseOrThrow(_response.error.body, {
+ unrecognizedObjectKeys: "passthrough",
+ allowUnrecognizedUnionMembers: true,
+ allowUnrecognizedEnumValues: true,
+ skipValidation: true,
+ breadcrumbsPrefix: ["response"],
+ })
+ );
+ case 404:
+ throw new DevRev.NotFoundError(
+ serializers.ErrorNotFound.parseOrThrow(_response.error.body, {
+ unrecognizedObjectKeys: "passthrough",
+ allowUnrecognizedUnionMembers: true,
+ allowUnrecognizedEnumValues: true,
+ skipValidation: true,
+ breadcrumbsPrefix: ["response"],
+ })
+ );
+ case 429:
+ throw new DevRev.TooManyRequestsError(
+ serializers.ErrorTooManyRequests.parseOrThrow(_response.error.body, {
+ unrecognizedObjectKeys: "passthrough",
+ allowUnrecognizedUnionMembers: true,
+ allowUnrecognizedEnumValues: true,
+ skipValidation: true,
+ breadcrumbsPrefix: ["response"],
+ })
+ );
+ case 500:
+ throw new DevRev.InternalServerError(
+ serializers.ErrorInternalServerError.parseOrThrow(_response.error.body, {
+ unrecognizedObjectKeys: "passthrough",
+ allowUnrecognizedUnionMembers: true,
+ allowUnrecognizedEnumValues: true,
+ skipValidation: true,
+ breadcrumbsPrefix: ["response"],
+ })
+ );
+ case 503:
+ throw new DevRev.ServiceUnavailableError(
+ serializers.ErrorServiceUnavailable.parseOrThrow(_response.error.body, {
+ unrecognizedObjectKeys: "passthrough",
+ allowUnrecognizedUnionMembers: true,
+ allowUnrecognizedEnumValues: true,
+ skipValidation: true,
+ breadcrumbsPrefix: ["response"],
+ })
+ );
+ default:
+ throw new errors.DevRevError({
+ statusCode: _response.error.statusCode,
+ body: _response.error.body,
+ });
+ }
+ }
+
+ switch (_response.error.reason) {
+ case "non-json":
+ throw new errors.DevRevError({
+ statusCode: _response.error.statusCode,
+ body: _response.error.rawBody,
+ });
+ case "timeout":
+ throw new errors.DevRevTimeoutError();
+ case "unknown":
+ throw new errors.DevRevError({
+ message: _response.error.errorMessage,
+ });
+ }
+ }
+
+ /**
+ * Lists a collection of [parts](https://devrev.ai/docs/product/parts).
+ *
+ * @param {DevRev.PartsListQuery} request
+ * @param {Parts.RequestOptions} requestOptions - Request-specific configuration.
+ *
+ * @throws {@link DevRev.BadRequestError}
+ * @throws {@link DevRev.UnauthorizedError}
+ * @throws {@link DevRev.ForbiddenError}
+ * @throws {@link DevRev.TooManyRequestsError}
+ * @throws {@link DevRev.InternalServerError}
+ * @throws {@link DevRev.ServiceUnavailableError}
+ *
+ * @example
+ * await client.parts.list()
+ */
+ public async list(
+ request: DevRev.PartsListQuery = {},
+ requestOptions?: Parts.RequestOptions
+ ): Promise {
+ const {
+ createdBy,
+ cursor,
+ limit,
+ mode,
+ name,
+ ownedBy,
+ parentPartLevel,
+ parentPartParts,
+ type: type_,
+ } = request;
+ const _queryParams: Record = {};
+ if (createdBy != null) {
+ if (Array.isArray(createdBy)) {
+ _queryParams["created_by"] = createdBy.map((item) => item);
+ } else {
+ _queryParams["created_by"] = createdBy;
+ }
+ }
+
+ if (cursor != null) {
+ _queryParams["cursor"] = cursor;
+ }
+
+ if (limit != null) {
+ _queryParams["limit"] = limit.toString();
+ }
+
+ if (mode != null) {
+ _queryParams["mode"] = mode;
+ }
+
+ if (name != null) {
+ if (Array.isArray(name)) {
+ _queryParams["name"] = name.map((item) => item);
+ } else {
+ _queryParams["name"] = name;
+ }
+ }
+
+ if (ownedBy != null) {
+ if (Array.isArray(ownedBy)) {
+ _queryParams["owned_by"] = ownedBy.map((item) => item);
+ } else {
+ _queryParams["owned_by"] = ownedBy;
+ }
+ }
+
+ if (parentPartLevel != null) {
+ _queryParams["parent_part.level"] = parentPartLevel.toString();
+ }
+
+ if (parentPartParts != null) {
+ if (Array.isArray(parentPartParts)) {
+ _queryParams["parent_part.parts"] = parentPartParts.map((item) => item);
+ } else {
+ _queryParams["parent_part.parts"] = parentPartParts;
+ }
+ }
+
+ if (type_ != null) {
+ if (Array.isArray(type_)) {
+ _queryParams["type"] = type_.map((item) => item);
+ } else {
+ _queryParams["type"] = type_;
+ }
+ }
+
+ const _response = await (this._options.fetcher ?? core.fetcher)({
+ url: urlJoin(
+ (await core.Supplier.get(this._options.environment)) ?? environments.DevRevEnvironment.Default,
+ "parts.list"
+ ),
+ method: "GET",
+ headers: {
+ Authorization: await this._getAuthorizationHeader(),
+ "X-Fern-Language": "JavaScript",
+ "X-Fern-SDK-Name": "@devrev/api",
+ "X-Fern-SDK-Version": "0.0.14",
+ "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 serializers.PartsListResponse.parseOrThrow(_response.body, {
+ unrecognizedObjectKeys: "passthrough",
+ allowUnrecognizedUnionMembers: true,
+ allowUnrecognizedEnumValues: true,
+ skipValidation: true,
+ breadcrumbsPrefix: ["response"],
+ });
+ }
+
+ if (_response.error.reason === "status-code") {
+ switch (_response.error.statusCode) {
+ case 400:
+ throw new DevRev.BadRequestError(
+ serializers.ErrorBadRequest.parseOrThrow(_response.error.body, {
+ unrecognizedObjectKeys: "passthrough",
+ allowUnrecognizedUnionMembers: true,
+ allowUnrecognizedEnumValues: true,
+ skipValidation: true,
+ breadcrumbsPrefix: ["response"],
+ })
+ );
+ case 401:
+ throw new DevRev.UnauthorizedError(
+ serializers.ErrorUnauthorized.parseOrThrow(_response.error.body, {
+ unrecognizedObjectKeys: "passthrough",
+ allowUnrecognizedUnionMembers: true,
+ allowUnrecognizedEnumValues: true,
+ skipValidation: true,
+ breadcrumbsPrefix: ["response"],
+ })
+ );
+ case 403:
+ throw new DevRev.ForbiddenError(
+ serializers.ErrorForbidden.parseOrThrow(_response.error.body, {
+ unrecognizedObjectKeys: "passthrough",
+ allowUnrecognizedUnionMembers: true,
+ allowUnrecognizedEnumValues: true,
+ skipValidation: true,
+ breadcrumbsPrefix: ["response"],
+ })
+ );
+ case 429:
+ throw new DevRev.TooManyRequestsError(
+ serializers.ErrorTooManyRequests.parseOrThrow(_response.error.body, {
+ unrecognizedObjectKeys: "passthrough",
+ allowUnrecognizedUnionMembers: true,
+ allowUnrecognizedEnumValues: true,
+ skipValidation: true,
+ breadcrumbsPrefix: ["response"],
+ })
+ );
+ case 500:
+ throw new DevRev.InternalServerError(
+ serializers.ErrorInternalServerError.parseOrThrow(_response.error.body, {
+ unrecognizedObjectKeys: "passthrough",
+ allowUnrecognizedUnionMembers: true,
+ allowUnrecognizedEnumValues: true,
+ skipValidation: true,
+ breadcrumbsPrefix: ["response"],
+ })
+ );
+ case 503:
+ throw new DevRev.ServiceUnavailableError(
+ serializers.ErrorServiceUnavailable.parseOrThrow(_response.error.body, {
+ unrecognizedObjectKeys: "passthrough",
+ allowUnrecognizedUnionMembers: true,
+ allowUnrecognizedEnumValues: true,
+ skipValidation: true,
+ breadcrumbsPrefix: ["response"],
+ })
+ );
+ default:
+ throw new errors.DevRevError({
+ statusCode: _response.error.statusCode,
+ body: _response.error.body,
+ });
+ }
+ }
+
+ switch (_response.error.reason) {
+ case "non-json":
+ throw new errors.DevRevError({
+ statusCode: _response.error.statusCode,
+ body: _response.error.rawBody,
+ });
+ case "timeout":
+ throw new errors.DevRevTimeoutError();
+ case "unknown":
+ throw new errors.DevRevError({
+ message: _response.error.errorMessage,
+ });
+ }
+ }
+
+ /**
+ * Lists a collection of [parts](https://devrev.ai/docs/product/parts).
+ *
+ * @param {DevRev.PartsListRequest} request
+ * @param {Parts.RequestOptions} requestOptions - Request-specific configuration.
+ *
+ * @throws {@link DevRev.BadRequestError}
+ * @throws {@link DevRev.UnauthorizedError}
+ * @throws {@link DevRev.ForbiddenError}
+ * @throws {@link DevRev.TooManyRequestsError}
+ * @throws {@link DevRev.InternalServerError}
+ * @throws {@link DevRev.ServiceUnavailableError}
+ *
+ * @example
+ * await client.parts.listPost()
+ */
+ public async listPost(
+ request: DevRev.PartsListRequest = {},
+ requestOptions?: Parts.RequestOptions
+ ): Promise {
+ const _response = await (this._options.fetcher ?? core.fetcher)({
+ url: urlJoin(
+ (await core.Supplier.get(this._options.environment)) ?? environments.DevRevEnvironment.Default,
+ "parts.list"
+ ),
+ method: "POST",
+ headers: {
+ Authorization: await this._getAuthorizationHeader(),
+ "X-Fern-Language": "JavaScript",
+ "X-Fern-SDK-Name": "@devrev/api",
+ "X-Fern-SDK-Version": "0.0.14",
+ "X-Fern-Runtime": core.RUNTIME.type,
+ "X-Fern-Runtime-Version": core.RUNTIME.version,
+ },
+ contentType: "application/json",
+ requestType: "json",
+ body: serializers.PartsListRequest.jsonOrThrow(request, { unrecognizedObjectKeys: "strip" }),
+ timeoutMs: requestOptions?.timeoutInSeconds != null ? requestOptions.timeoutInSeconds * 1000 : 60000,
+ maxRetries: requestOptions?.maxRetries,
+ abortSignal: requestOptions?.abortSignal,
+ });
+ if (_response.ok) {
+ return serializers.PartsListResponse.parseOrThrow(_response.body, {
+ unrecognizedObjectKeys: "passthrough",
+ allowUnrecognizedUnionMembers: true,
+ allowUnrecognizedEnumValues: true,
+ skipValidation: true,
+ breadcrumbsPrefix: ["response"],
+ });
+ }
+
+ if (_response.error.reason === "status-code") {
+ switch (_response.error.statusCode) {
+ case 400:
+ throw new DevRev.BadRequestError(
+ serializers.ErrorBadRequest.parseOrThrow(_response.error.body, {
+ unrecognizedObjectKeys: "passthrough",
+ allowUnrecognizedUnionMembers: true,
+ allowUnrecognizedEnumValues: true,
+ skipValidation: true,
+ breadcrumbsPrefix: ["response"],
+ })
+ );
+ case 401:
+ throw new DevRev.UnauthorizedError(
+ serializers.ErrorUnauthorized.parseOrThrow(_response.error.body, {
+ unrecognizedObjectKeys: "passthrough",
+ allowUnrecognizedUnionMembers: true,
+ allowUnrecognizedEnumValues: true,
+ skipValidation: true,
+ breadcrumbsPrefix: ["response"],
+ })
+ );
+ case 403:
+ throw new DevRev.ForbiddenError(
+ serializers.ErrorForbidden.parseOrThrow(_response.error.body, {
+ unrecognizedObjectKeys: "passthrough",
+ allowUnrecognizedUnionMembers: true,
+ allowUnrecognizedEnumValues: true,
+ skipValidation: true,
+ breadcrumbsPrefix: ["response"],
+ })
+ );
+ case 429:
+ throw new DevRev.TooManyRequestsError(
+ serializers.ErrorTooManyRequests.parseOrThrow(_response.error.body, {
+ unrecognizedObjectKeys: "passthrough",
+ allowUnrecognizedUnionMembers: true,
+ allowUnrecognizedEnumValues: true,
+ skipValidation: true,
+ breadcrumbsPrefix: ["response"],
+ })
+ );
+ case 500:
+ throw new DevRev.InternalServerError(
+ serializers.ErrorInternalServerError.parseOrThrow(_response.error.body, {
+ unrecognizedObjectKeys: "passthrough",
+ allowUnrecognizedUnionMembers: true,
+ allowUnrecognizedEnumValues: true,
+ skipValidation: true,
+ breadcrumbsPrefix: ["response"],
+ })
+ );
+ case 503:
+ throw new DevRev.ServiceUnavailableError(
+ serializers.ErrorServiceUnavailable.parseOrThrow(_response.error.body, {
+ unrecognizedObjectKeys: "passthrough",
+ allowUnrecognizedUnionMembers: true,
+ allowUnrecognizedEnumValues: true,
+ skipValidation: true,
+ breadcrumbsPrefix: ["response"],
+ })
+ );
+ default:
+ throw new errors.DevRevError({
+ statusCode: _response.error.statusCode,
+ body: _response.error.body,
+ });
+ }
+ }
+
+ switch (_response.error.reason) {
+ case "non-json":
+ throw new errors.DevRevError({
+ statusCode: _response.error.statusCode,
+ body: _response.error.rawBody,
+ });
+ case "timeout":
+ throw new errors.DevRevTimeoutError();
+ case "unknown":
+ throw new errors.DevRevError({
+ message: _response.error.errorMessage,
+ });
+ }
+ }
+
+ /**
+ * Updates a [part's](https://devrev.ai/docs/product/parts) information.
+ *
+ * @param {DevRev.PartsUpdateRequest} request
+ * @param {Parts.RequestOptions} requestOptions - Request-specific configuration.
+ *
+ * @throws {@link DevRev.BadRequestError}
+ * @throws {@link DevRev.UnauthorizedError}
+ * @throws {@link DevRev.ForbiddenError}
+ * @throws {@link DevRev.NotFoundError}
+ * @throws {@link DevRev.TooManyRequestsError}
+ * @throws {@link DevRev.InternalServerError}
+ * @throws {@link DevRev.ServiceUnavailableError}
+ *
+ * @example
+ * await client.parts.update({
+ * type: "capability",
+ * value: {
+ * "string": {
+ * "key": "value"
+ * }
+ * }
+ * })
+ */
+ public async update(
+ request: DevRev.PartsUpdateRequest,
+ requestOptions?: Parts.RequestOptions
+ ): Promise {
+ const _response = await (this._options.fetcher ?? core.fetcher)({
+ url: urlJoin(
+ (await core.Supplier.get(this._options.environment)) ?? environments.DevRevEnvironment.Default,
+ "parts.update"
+ ),
+ method: "POST",
+ headers: {
+ Authorization: await this._getAuthorizationHeader(),
+ "X-Fern-Language": "JavaScript",
+ "X-Fern-SDK-Name": "@devrev/api",
+ "X-Fern-SDK-Version": "0.0.14",
+ "X-Fern-Runtime": core.RUNTIME.type,
+ "X-Fern-Runtime-Version": core.RUNTIME.version,
+ },
+ contentType: "application/json",
+ requestType: "json",
+ body: serializers.PartsUpdateRequest.jsonOrThrow(request, { unrecognizedObjectKeys: "strip" }),
+ timeoutMs: requestOptions?.timeoutInSeconds != null ? requestOptions.timeoutInSeconds * 1000 : 60000,
+ maxRetries: requestOptions?.maxRetries,
+ abortSignal: requestOptions?.abortSignal,
+ });
+ if (_response.ok) {
+ return serializers.PartsUpdateResponse.parseOrThrow(_response.body, {
+ unrecognizedObjectKeys: "passthrough",
+ allowUnrecognizedUnionMembers: true,
+ allowUnrecognizedEnumValues: true,
+ skipValidation: true,
+ breadcrumbsPrefix: ["response"],
+ });
+ }
+
+ if (_response.error.reason === "status-code") {
+ switch (_response.error.statusCode) {
+ case 400:
+ throw new DevRev.BadRequestError(
+ serializers.ErrorBadRequest.parseOrThrow(_response.error.body, {
+ unrecognizedObjectKeys: "passthrough",
+ allowUnrecognizedUnionMembers: true,
+ allowUnrecognizedEnumValues: true,
+ skipValidation: true,
+ breadcrumbsPrefix: ["response"],
+ })
+ );
+ case 401:
+ throw new DevRev.UnauthorizedError(
+ serializers.ErrorUnauthorized.parseOrThrow(_response.error.body, {
+ unrecognizedObjectKeys: "passthrough",
+ allowUnrecognizedUnionMembers: true,
+ allowUnrecognizedEnumValues: true,
+ skipValidation: true,
+ breadcrumbsPrefix: ["response"],
+ })
+ );
+ case 403:
+ throw new DevRev.ForbiddenError(
+ serializers.ErrorForbidden.parseOrThrow(_response.error.body, {
+ unrecognizedObjectKeys: "passthrough",
+ allowUnrecognizedUnionMembers: true,
+ allowUnrecognizedEnumValues: true,
+ skipValidation: true,
+ breadcrumbsPrefix: ["response"],
+ })
+ );
+ case 404:
+ throw new DevRev.NotFoundError(
+ serializers.ErrorNotFound.parseOrThrow(_response.error.body, {
+ unrecognizedObjectKeys: "passthrough",
+ allowUnrecognizedUnionMembers: true,
+ allowUnrecognizedEnumValues: true,
+ skipValidation: true,
+ breadcrumbsPrefix: ["response"],
+ })
+ );
+ case 429:
+ throw new DevRev.TooManyRequestsError(
+ serializers.ErrorTooManyRequests.parseOrThrow(_response.error.body, {
+ unrecognizedObjectKeys: "passthrough",
+ allowUnrecognizedUnionMembers: true,
+ allowUnrecognizedEnumValues: true,
+ skipValidation: true,
+ breadcrumbsPrefix: ["response"],
+ })
+ );
+ case 500:
+ throw new DevRev.InternalServerError(
+ serializers.ErrorInternalServerError.parseOrThrow(_response.error.body, {
+ unrecognizedObjectKeys: "passthrough",
+ allowUnrecognizedUnionMembers: true,
+ allowUnrecognizedEnumValues: true,
+ skipValidation: true,
+ breadcrumbsPrefix: ["response"],
+ })
+ );
+ case 503:
+ throw new DevRev.ServiceUnavailableError(
+ serializers.ErrorServiceUnavailable.parseOrThrow(_response.error.body, {
+ unrecognizedObjectKeys: "passthrough",
+ allowUnrecognizedUnionMembers: true,
+ allowUnrecognizedEnumValues: true,
+ skipValidation: true,
+ breadcrumbsPrefix: ["response"],
+ })
+ );
+ default:
+ throw new errors.DevRevError({
+ statusCode: _response.error.statusCode,
+ body: _response.error.body,
+ });
+ }
+ }
+
+ switch (_response.error.reason) {
+ case "non-json":
+ throw new errors.DevRevError({
+ statusCode: _response.error.statusCode,
+ body: _response.error.rawBody,
+ });
+ case "timeout":
+ throw new errors.DevRevTimeoutError();
+ case "unknown":
+ throw new errors.DevRevError({
+ message: _response.error.errorMessage,
+ });
+ }
+ }
+
+ protected async _getAuthorizationHeader(): Promise {
+ const bearer = (await core.Supplier.get(this._options.token)) ?? process?.env["DEVREV_TOKEN"];
+ if (bearer == null) {
+ throw new errors.DevRevError({
+ message: "Please specify DEVREV_TOKEN when instantiating the client.",
+ });
+ }
+
+ return `Bearer ${bearer}`;
+ }
+}
diff --git a/src/api/resources/parts/client/index.ts b/src/api/resources/parts/client/index.ts
new file mode 100644
index 0000000..415726b
--- /dev/null
+++ b/src/api/resources/parts/client/index.ts
@@ -0,0 +1 @@
+export * from "./requests";
diff --git a/src/api/resources/parts/client/requests/PartsDeleteRequest.ts b/src/api/resources/parts/client/requests/PartsDeleteRequest.ts
new file mode 100644
index 0000000..a71d2f8
--- /dev/null
+++ b/src/api/resources/parts/client/requests/PartsDeleteRequest.ts
@@ -0,0 +1,14 @@
+/**
+ * This file was auto-generated by Fern from our API Definition.
+ */
+
+/**
+ * @example
+ * {
+ * id: "PROD-12345"
+ * }
+ */
+export interface PartsDeleteRequest {
+ /** The ID of the part to delete. */
+ id: string;
+}
diff --git a/src/api/resources/parts/client/requests/PartsGetQuery.ts b/src/api/resources/parts/client/requests/PartsGetQuery.ts
new file mode 100644
index 0000000..6b9fbe2
--- /dev/null
+++ b/src/api/resources/parts/client/requests/PartsGetQuery.ts
@@ -0,0 +1,16 @@
+/**
+ * This file was auto-generated by Fern from our API Definition.
+ */
+
+/**
+ * @example
+ * {
+ * id: "string"
+ * }
+ */
+export interface PartsGetQuery {
+ /**
+ * The ID of the part to retrieve.
+ */
+ id: string;
+}
diff --git a/src/api/resources/parts/client/requests/PartsGetRequest.ts b/src/api/resources/parts/client/requests/PartsGetRequest.ts
new file mode 100644
index 0000000..2609dde
--- /dev/null
+++ b/src/api/resources/parts/client/requests/PartsGetRequest.ts
@@ -0,0 +1,14 @@
+/**
+ * This file was auto-generated by Fern from our API Definition.
+ */
+
+/**
+ * @example
+ * {
+ * id: "string"
+ * }
+ */
+export interface PartsGetRequest {
+ /** The ID of the part to retrieve. */
+ id: string;
+}
diff --git a/src/api/resources/parts/client/requests/PartsListQuery.ts b/src/api/resources/parts/client/requests/PartsListQuery.ts
new file mode 100644
index 0000000..8ec6d59
--- /dev/null
+++ b/src/api/resources/parts/client/requests/PartsListQuery.ts
@@ -0,0 +1,51 @@
+/**
+ * This file was auto-generated by Fern from our API Definition.
+ */
+
+import * as DevRev from "../../../../index";
+
+/**
+ * @example
+ * {}
+ */
+export interface PartsListQuery {
+ /**
+ * Filters for parts created by any of these users.
+ */
+ createdBy?: string | string[];
+ /**
+ * The cursor to resume iteration from. If not provided, then iteration
+ * starts from the beginning.
+ */
+ cursor?: string;
+ /**
+ * The maximum number of parts to return. The default is '50'.
+ */
+ limit?: number;
+ /**
+ * The iteration mode to use, otherwise if not set, then "after" is
+ * used.
+ */
+ mode?: DevRev.ListMode;
+ /**
+ * Filters for parts of the provided name(s).
+ */
+ name?: string | string[];
+ /**
+ * Filters for parts owned by any of these users.
+ */
+ ownedBy?: string | string[];
+ /**
+ * Number of levels to fetch the part hierarchy up to.
+ */
+ parentPartLevel?: number;
+ /**
+ * Part IDs to fetch the hierarchy for. Required if any parent_part.\*
+ * fields are provided.
+ */
+ parentPartParts?: string | string[];
+ /**
+ * Filters for parts of the provided type(s).
+ */
+ type?: DevRev.PartType | DevRev.PartType[];
+}
diff --git a/src/api/resources/parts/client/requests/PartsListRequest.ts b/src/api/resources/parts/client/requests/PartsListRequest.ts
new file mode 100644
index 0000000..251c035
--- /dev/null
+++ b/src/api/resources/parts/client/requests/PartsListRequest.ts
@@ -0,0 +1,33 @@
+/**
+ * This file was auto-generated by Fern from our API Definition.
+ */
+
+import * as DevRev from "../../../../index";
+
+/**
+ * @example
+ * {}
+ */
+export interface PartsListRequest {
+ /** Filters for parts of the provided type(s). */
+ type?: DevRev.PartType[];
+ /** Filters for parts created by any of these users. */
+ createdBy?: string[];
+ /**
+ * The cursor to resume iteration from. If not provided, then
+ * iteration starts from the beginning.
+ *
+ */
+ cursor?: string;
+ /**
+ * The maximum number of parts to return. The default is '50'.
+ *
+ */
+ limit?: number;
+ mode?: DevRev.ListMode;
+ /** Filters for parts of the provided name(s). */
+ name?: string[];
+ /** Filters for parts owned by any of these users. */
+ ownedBy?: string[];
+ parentPart?: DevRev.ParentPartFilter;
+}
diff --git a/src/api/resources/parts/client/requests/index.ts b/src/api/resources/parts/client/requests/index.ts
new file mode 100644
index 0000000..9624a9e
--- /dev/null
+++ b/src/api/resources/parts/client/requests/index.ts
@@ -0,0 +1,5 @@
+export { type PartsDeleteRequest } from "./PartsDeleteRequest";
+export { type PartsGetQuery } from "./PartsGetQuery";
+export { type PartsGetRequest } from "./PartsGetRequest";
+export { type PartsListQuery } from "./PartsListQuery";
+export { type PartsListRequest } from "./PartsListRequest";
diff --git a/src/api/resources/parts/index.ts b/src/api/resources/parts/index.ts
new file mode 100644
index 0000000..5ec7692
--- /dev/null
+++ b/src/api/resources/parts/index.ts
@@ -0,0 +1 @@
+export * from "./client";
diff --git a/src/api/resources/productUsage/client/Client.ts b/src/api/resources/productUsage/client/Client.ts
new file mode 100644
index 0000000..74cdc4c
--- /dev/null
+++ b/src/api/resources/productUsage/client/Client.ts
@@ -0,0 +1,1604 @@
+/**
+ * This file was auto-generated by Fern from our API Definition.
+ */
+
+import * as environments from "../../../../environments";
+import * as core from "../../../../core";
+import * as DevRev from "../../../index";
+import * as serializers from "../../../../serialization/index";
+import urlJoin from "url-join";
+import * as errors from "../../../../errors/index";
+
+export declare namespace ProductUsage {
+ interface Options {
+ environment?: core.Supplier;
+ token?: 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;
+ }
+}
+
+/**
+ * Product Usage APIs
+ */
+export class ProductUsage {
+ constructor(protected readonly _options: ProductUsage.Options = {}) {}
+
+ /**
+ * Ingest endpoint for DevRev metrics data from clients.
+ *
+ * @param {DevRev.MetricsDataIngestRequest} request
+ * @param {ProductUsage.RequestOptions} requestOptions - Request-specific configuration.
+ *
+ * @throws {@link DevRev.BadRequestError}
+ * @throws {@link DevRev.UnauthorizedError}
+ * @throws {@link DevRev.ForbiddenError}
+ * @throws {@link DevRev.TooManyRequestsError}
+ * @throws {@link DevRev.InternalServerError}
+ * @throws {@link DevRev.ServiceUnavailableError}
+ *
+ * @example
+ * await client.productUsage.metricsDevrevIngest({
+ * metrics: [{
+ * accountRef: "account_ref",
+ * dataPoints: [{
+ * timestamp: new Date("2023-01-01T12:00:00.000Z"),
+ * value: 1.1
+ * }],
+ * name: "name"
+ * }]
+ * })
+ */
+ public async metricsDevrevIngest(
+ request: DevRev.MetricsDataIngestRequest,
+ requestOptions?: ProductUsage.RequestOptions
+ ): Promise {
+ const _response = await (this._options.fetcher ?? core.fetcher)({
+ url: urlJoin(
+ (await core.Supplier.get(this._options.environment)) ?? environments.DevRevEnvironment.Default,
+ "metrics.devrev.ingest"
+ ),
+ method: "POST",
+ headers: {
+ Authorization: await this._getAuthorizationHeader(),
+ "X-Fern-Language": "JavaScript",
+ "X-Fern-SDK-Name": "@devrev/api",
+ "X-Fern-SDK-Version": "0.0.14",
+ "X-Fern-Runtime": core.RUNTIME.type,
+ "X-Fern-Runtime-Version": core.RUNTIME.version,
+ },
+ contentType: "application/json",
+ requestType: "json",
+ body: serializers.MetricsDataIngestRequest.jsonOrThrow(request, { unrecognizedObjectKeys: "strip" }),
+ 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 DevRev.BadRequestError(
+ serializers.ErrorBadRequest.parseOrThrow(_response.error.body, {
+ unrecognizedObjectKeys: "passthrough",
+ allowUnrecognizedUnionMembers: true,
+ allowUnrecognizedEnumValues: true,
+ skipValidation: true,
+ breadcrumbsPrefix: ["response"],
+ })
+ );
+ case 401:
+ throw new DevRev.UnauthorizedError(
+ serializers.ErrorUnauthorized.parseOrThrow(_response.error.body, {
+ unrecognizedObjectKeys: "passthrough",
+ allowUnrecognizedUnionMembers: true,
+ allowUnrecognizedEnumValues: true,
+ skipValidation: true,
+ breadcrumbsPrefix: ["response"],
+ })
+ );
+ case 403:
+ throw new DevRev.ForbiddenError(
+ serializers.ErrorForbidden.parseOrThrow(_response.error.body, {
+ unrecognizedObjectKeys: "passthrough",
+ allowUnrecognizedUnionMembers: true,
+ allowUnrecognizedEnumValues: true,
+ skipValidation: true,
+ breadcrumbsPrefix: ["response"],
+ })
+ );
+ case 429:
+ throw new DevRev.TooManyRequestsError(
+ serializers.ErrorTooManyRequests.parseOrThrow(_response.error.body, {
+ unrecognizedObjectKeys: "passthrough",
+ allowUnrecognizedUnionMembers: true,
+ allowUnrecognizedEnumValues: true,
+ skipValidation: true,
+ breadcrumbsPrefix: ["response"],
+ })
+ );
+ case 500:
+ throw new DevRev.InternalServerError(
+ serializers.ErrorInternalServerError.parseOrThrow(_response.error.body, {
+ unrecognizedObjectKeys: "passthrough",
+ allowUnrecognizedUnionMembers: true,
+ allowUnrecognizedEnumValues: true,
+ skipValidation: true,
+ breadcrumbsPrefix: ["response"],
+ })
+ );
+ case 503:
+ throw new DevRev.ServiceUnavailableError(
+ serializers.ErrorServiceUnavailable.parseOrThrow(_response.error.body, {
+ unrecognizedObjectKeys: "passthrough",
+ allowUnrecognizedUnionMembers: true,
+ allowUnrecognizedEnumValues: true,
+ skipValidation: true,
+ breadcrumbsPrefix: ["response"],
+ })
+ );
+ default:
+ throw new errors.DevRevError({
+ statusCode: _response.error.statusCode,
+ body: _response.error.body,
+ });
+ }
+ }
+
+ switch (_response.error.reason) {
+ case "non-json":
+ throw new errors.DevRevError({
+ statusCode: _response.error.statusCode,
+ body: _response.error.rawBody,
+ });
+ case "timeout":
+ throw new errors.DevRevTimeoutError();
+ case "unknown":
+ throw new errors.DevRevError({
+ message: _response.error.errorMessage,
+ });
+ }
+ }
+
+ /**
+ * Counts the number of Unit of Measurements based on the given filters.
+ *
+ * @param {DevRev.UomsCountQuery} request
+ * @param {ProductUsage.RequestOptions} requestOptions - Request-specific configuration.
+ *
+ * @throws {@link DevRev.BadRequestError}
+ * @throws {@link DevRev.UnauthorizedError}
+ * @throws {@link DevRev.ForbiddenError}
+ * @throws {@link DevRev.TooManyRequestsError}
+ * @throws {@link DevRev.InternalServerError}
+ * @throws {@link DevRev.ServiceUnavailableError}
+ *
+ * @example
+ * await client.productUsage.uomsCount()
+ */
+ public async uomsCount(
+ request: DevRev.UomsCountQuery = {},
+ requestOptions?: ProductUsage.RequestOptions
+ ): Promise {
+ const { aggregationTypes, ids, metricNames, partIds, productIds, unitTypes } = request;
+ const _queryParams: Record = {};
+ if (aggregationTypes != null) {
+ if (Array.isArray(aggregationTypes)) {
+ _queryParams["aggregation_types"] = aggregationTypes.map((item) => item);
+ } else {
+ _queryParams["aggregation_types"] = aggregationTypes;
+ }
+ }
+
+ if (ids != null) {
+ if (Array.isArray(ids)) {
+ _queryParams["ids"] = ids.map((item) => item);
+ } else {
+ _queryParams["ids"] = ids;
+ }
+ }
+
+ if (metricNames != null) {
+ if (Array.isArray(metricNames)) {
+ _queryParams["metric_names"] = metricNames.map((item) => item);
+ } else {
+ _queryParams["metric_names"] = metricNames;
+ }
+ }
+
+ if (partIds != null) {
+ if (Array.isArray(partIds)) {
+ _queryParams["part_ids"] = partIds.map((item) => item);
+ } else {
+ _queryParams["part_ids"] = partIds;
+ }
+ }
+
+ if (productIds != null) {
+ if (Array.isArray(productIds)) {
+ _queryParams["product_ids"] = productIds.map((item) => item);
+ } else {
+ _queryParams["product_ids"] = productIds;
+ }
+ }
+
+ if (unitTypes != null) {
+ if (Array.isArray(unitTypes)) {
+ _queryParams["unit_types"] = unitTypes.map((item) => item);
+ } else {
+ _queryParams["unit_types"] = unitTypes;
+ }
+ }
+
+ const _response = await (this._options.fetcher ?? core.fetcher)({
+ url: urlJoin(
+ (await core.Supplier.get(this._options.environment)) ?? environments.DevRevEnvironment.Default,
+ "uoms.count"
+ ),
+ method: "GET",
+ headers: {
+ Authorization: await this._getAuthorizationHeader(),
+ "X-Fern-Language": "JavaScript",
+ "X-Fern-SDK-Name": "@devrev/api",
+ "X-Fern-SDK-Version": "0.0.14",
+ "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 serializers.UomsCountResponse.parseOrThrow(_response.body, {
+ unrecognizedObjectKeys: "passthrough",
+ allowUnrecognizedUnionMembers: true,
+ allowUnrecognizedEnumValues: true,
+ skipValidation: true,
+ breadcrumbsPrefix: ["response"],
+ });
+ }
+
+ if (_response.error.reason === "status-code") {
+ switch (_response.error.statusCode) {
+ case 400:
+ throw new DevRev.BadRequestError(
+ serializers.ErrorBadRequest.parseOrThrow(_response.error.body, {
+ unrecognizedObjectKeys: "passthrough",
+ allowUnrecognizedUnionMembers: true,
+ allowUnrecognizedEnumValues: true,
+ skipValidation: true,
+ breadcrumbsPrefix: ["response"],
+ })
+ );
+ case 401:
+ throw new DevRev.UnauthorizedError(
+ serializers.ErrorUnauthorized.parseOrThrow(_response.error.body, {
+ unrecognizedObjectKeys: "passthrough",
+ allowUnrecognizedUnionMembers: true,
+ allowUnrecognizedEnumValues: true,
+ skipValidation: true,
+ breadcrumbsPrefix: ["response"],
+ })
+ );
+ case 403:
+ throw new DevRev.ForbiddenError(
+ serializers.ErrorForbidden.parseOrThrow(_response.error.body, {
+ unrecognizedObjectKeys: "passthrough",
+ allowUnrecognizedUnionMembers: true,
+ allowUnrecognizedEnumValues: true,
+ skipValidation: true,
+ breadcrumbsPrefix: ["response"],
+ })
+ );
+ case 429:
+ throw new DevRev.TooManyRequestsError(
+ serializers.ErrorTooManyRequests.parseOrThrow(_response.error.body, {
+ unrecognizedObjectKeys: "passthrough",
+ allowUnrecognizedUnionMembers: true,
+ allowUnrecognizedEnumValues: true,
+ skipValidation: true,
+ breadcrumbsPrefix: ["response"],
+ })
+ );
+ case 500:
+ throw new DevRev.InternalServerError(
+ serializers.ErrorInternalServerError.parseOrThrow(_response.error.body, {
+ unrecognizedObjectKeys: "passthrough",
+ allowUnrecognizedUnionMembers: true,
+ allowUnrecognizedEnumValues: true,
+ skipValidation: true,
+ breadcrumbsPrefix: ["response"],
+ })
+ );
+ case 503:
+ throw new DevRev.ServiceUnavailableError(
+ serializers.ErrorServiceUnavailable.parseOrThrow(_response.error.body, {
+ unrecognizedObjectKeys: "passthrough",
+ allowUnrecognizedUnionMembers: true,
+ allowUnrecognizedEnumValues: true,
+ skipValidation: true,
+ breadcrumbsPrefix: ["response"],
+ })
+ );
+ default:
+ throw new errors.DevRevError({
+ statusCode: _response.error.statusCode,
+ body: _response.error.body,
+ });
+ }
+ }
+
+ switch (_response.error.reason) {
+ case "non-json":
+ throw new errors.DevRevError({
+ statusCode: _response.error.statusCode,
+ body: _response.error.rawBody,
+ });
+ case "timeout":
+ throw new errors.DevRevTimeoutError();
+ case "unknown":
+ throw new errors.DevRevError({
+ message: _response.error.errorMessage,
+ });
+ }
+ }
+
+ /**
+ * Counts the number of Unit of Measurements based on the given filters.
+ *
+ * @param {DevRev.UomsCountRequest} request
+ * @param {ProductUsage.RequestOptions} requestOptions - Request-specific configuration.
+ *
+ * @throws {@link DevRev.BadRequestError}
+ * @throws {@link DevRev.UnauthorizedError}
+ * @throws {@link DevRev.ForbiddenError}
+ * @throws {@link DevRev.TooManyRequestsError}
+ * @throws {@link DevRev.InternalServerError}
+ * @throws {@link DevRev.ServiceUnavailableError}
+ *
+ * @example
+ * await client.productUsage.uomsCountPost()
+ */
+ public async uomsCountPost(
+ request: DevRev.UomsCountRequest = {},
+ requestOptions?: ProductUsage.RequestOptions
+ ): Promise {
+ const _response = await (this._options.fetcher ?? core.fetcher)({
+ url: urlJoin(
+ (await core.Supplier.get(this._options.environment)) ?? environments.DevRevEnvironment.Default,
+ "uoms.count"
+ ),
+ method: "POST",
+ headers: {
+ Authorization: await this._getAuthorizationHeader(),
+ "X-Fern-Language": "JavaScript",
+ "X-Fern-SDK-Name": "@devrev/api",
+ "X-Fern-SDK-Version": "0.0.14",
+ "X-Fern-Runtime": core.RUNTIME.type,
+ "X-Fern-Runtime-Version": core.RUNTIME.version,
+ },
+ contentType: "application/json",
+ requestType: "json",
+ body: serializers.UomsCountRequest.jsonOrThrow(request, { unrecognizedObjectKeys: "strip" }),
+ timeoutMs: requestOptions?.timeoutInSeconds != null ? requestOptions.timeoutInSeconds * 1000 : 60000,
+ maxRetries: requestOptions?.maxRetries,
+ abortSignal: requestOptions?.abortSignal,
+ });
+ if (_response.ok) {
+ return serializers.UomsCountResponse.parseOrThrow(_response.body, {
+ unrecognizedObjectKeys: "passthrough",
+ allowUnrecognizedUnionMembers: true,
+ allowUnrecognizedEnumValues: true,
+ skipValidation: true,
+ breadcrumbsPrefix: ["response"],
+ });
+ }
+
+ if (_response.error.reason === "status-code") {
+ switch (_response.error.statusCode) {
+ case 400:
+ throw new DevRev.BadRequestError(
+ serializers.ErrorBadRequest.parseOrThrow(_response.error.body, {
+ unrecognizedObjectKeys: "passthrough",
+ allowUnrecognizedUnionMembers: true,
+ allowUnrecognizedEnumValues: true,
+ skipValidation: true,
+ breadcrumbsPrefix: ["response"],
+ })
+ );
+ case 401:
+ throw new DevRev.UnauthorizedError(
+ serializers.ErrorUnauthorized.parseOrThrow(_response.error.body, {
+ unrecognizedObjectKeys: "passthrough",
+ allowUnrecognizedUnionMembers: true,
+ allowUnrecognizedEnumValues: true,
+ skipValidation: true,
+ breadcrumbsPrefix: ["response"],
+ })
+ );
+ case 403:
+ throw new DevRev.ForbiddenError(
+ serializers.ErrorForbidden.parseOrThrow(_response.error.body, {
+ unrecognizedObjectKeys: "passthrough",
+ allowUnrecognizedUnionMembers: true,
+ allowUnrecognizedEnumValues: true,
+ skipValidation: true,
+ breadcrumbsPrefix: ["response"],
+ })
+ );
+ case 429:
+ throw new DevRev.TooManyRequestsError(
+ serializers.ErrorTooManyRequests.parseOrThrow(_response.error.body, {
+ unrecognizedObjectKeys: "passthrough",
+ allowUnrecognizedUnionMembers: true,
+ allowUnrecognizedEnumValues: true,
+ skipValidation: true,
+ breadcrumbsPrefix: ["response"],
+ })
+ );
+ case 500:
+ throw new DevRev.InternalServerError(
+ serializers.ErrorInternalServerError.parseOrThrow(_response.error.body, {
+ unrecognizedObjectKeys: "passthrough",
+ allowUnrecognizedUnionMembers: true,
+ allowUnrecognizedEnumValues: true,
+ skipValidation: true,
+ breadcrumbsPrefix: ["response"],
+ })
+ );
+ case 503:
+ throw new DevRev.ServiceUnavailableError(
+ serializers.ErrorServiceUnavailable.parseOrThrow(_response.error.body, {
+ unrecognizedObjectKeys: "passthrough",
+ allowUnrecognizedUnionMembers: true,
+ allowUnrecognizedEnumValues: true,
+ skipValidation: true,
+ breadcrumbsPrefix: ["response"],
+ })
+ );
+ default:
+ throw new errors.DevRevError({
+ statusCode: _response.error.statusCode,
+ body: _response.error.body,
+ });
+ }
+ }
+
+ switch (_response.error.reason) {
+ case "non-json":
+ throw new errors.DevRevError({
+ statusCode: _response.error.statusCode,
+ body: _response.error.rawBody,
+ });
+ case "timeout":
+ throw new errors.DevRevTimeoutError();
+ case "unknown":
+ throw new errors.DevRevError({
+ message: _response.error.errorMessage,
+ });
+ }
+ }
+
+ /**
+ * Creates a Unit of Measurement on a part.
+ *
+ * @param {DevRev.UomsCreateRequest} request
+ * @param {ProductUsage.RequestOptions} requestOptions - Request-specific configuration.
+ *
+ * @throws {@link DevRev.BadRequestError}
+ * @throws {@link DevRev.UnauthorizedError}
+ * @throws {@link DevRev.ForbiddenError}
+ * @throws {@link DevRev.TooManyRequestsError}
+ * @throws {@link DevRev.InternalServerError}
+ * @throws {@link DevRev.ServiceUnavailableError}
+ *
+ * @example
+ * await client.productUsage.uomsCreate({
+ * aggregationDetail: {
+ * aggregationType: DevRev.AggregationDetailAggregationType.Duration,
+ * uniqueDimension: "string"
+ * },
+ * description: "string",
+ * dimensions: ["string"],
+ * metricName: "string",
+ * name: "string",
+ * partId: "string",
+ * productId: "string",
+ * unit: {
+ * type: DevRev.UnitType.Boolean,
+ * name: "string"
+ * }
+ * })
+ */
+ public async uomsCreate(
+ request: DevRev.UomsCreateRequest,
+ requestOptions?: ProductUsage.RequestOptions
+ ): Promise {
+ const _response = await (this._options.fetcher ?? core.fetcher)({
+ url: urlJoin(
+ (await core.Supplier.get(this._options.environment)) ?? environments.DevRevEnvironment.Default,
+ "uoms.create"
+ ),
+ method: "POST",
+ headers: {
+ Authorization: await this._getAuthorizationHeader(),
+ "X-Fern-Language": "JavaScript",
+ "X-Fern-SDK-Name": "@devrev/api",
+ "X-Fern-SDK-Version": "0.0.14",
+ "X-Fern-Runtime": core.RUNTIME.type,
+ "X-Fern-Runtime-Version": core.RUNTIME.version,
+ },
+ contentType: "application/json",
+ requestType: "json",
+ body: serializers.UomsCreateRequest.jsonOrThrow(request, { unrecognizedObjectKeys: "strip" }),
+ timeoutMs: requestOptions?.timeoutInSeconds != null ? requestOptions.timeoutInSeconds * 1000 : 60000,
+ maxRetries: requestOptions?.maxRetries,
+ abortSignal: requestOptions?.abortSignal,
+ });
+ if (_response.ok) {
+ return serializers.UomsCreateResponse.parseOrThrow(_response.body, {
+ unrecognizedObjectKeys: "passthrough",
+ allowUnrecognizedUnionMembers: true,
+ allowUnrecognizedEnumValues: true,
+ skipValidation: true,
+ breadcrumbsPrefix: ["response"],
+ });
+ }
+
+ if (_response.error.reason === "status-code") {
+ switch (_response.error.statusCode) {
+ case 400:
+ throw new DevRev.BadRequestError(
+ serializers.ErrorBadRequest.parseOrThrow(_response.error.body, {
+ unrecognizedObjectKeys: "passthrough",
+ allowUnrecognizedUnionMembers: true,
+ allowUnrecognizedEnumValues: true,
+ skipValidation: true,
+ breadcrumbsPrefix: ["response"],
+ })
+ );
+ case 401:
+ throw new DevRev.UnauthorizedError(
+ serializers.ErrorUnauthorized.parseOrThrow(_response.error.body, {
+ unrecognizedObjectKeys: "passthrough",
+ allowUnrecognizedUnionMembers: true,
+ allowUnrecognizedEnumValues: true,
+ skipValidation: true,
+ breadcrumbsPrefix: ["response"],
+ })
+ );
+ case 403:
+ throw new DevRev.ForbiddenError(
+ serializers.ErrorForbidden.parseOrThrow(_response.error.body, {
+ unrecognizedObjectKeys: "passthrough",
+ allowUnrecognizedUnionMembers: true,
+ allowUnrecognizedEnumValues: true,
+ skipValidation: true,
+ breadcrumbsPrefix: ["response"],
+ })
+ );
+ case 429:
+ throw new DevRev.TooManyRequestsError(
+ serializers.ErrorTooManyRequests.parseOrThrow(_response.error.body, {
+ unrecognizedObjectKeys: "passthrough",
+ allowUnrecognizedUnionMembers: true,
+ allowUnrecognizedEnumValues: true,
+ skipValidation: true,
+ breadcrumbsPrefix: ["response"],
+ })
+ );
+ case 500:
+ throw new DevRev.InternalServerError(
+ serializers.ErrorInternalServerError.parseOrThrow(_response.error.body, {
+ unrecognizedObjectKeys: "passthrough",
+ allowUnrecognizedUnionMembers: true,
+ allowUnrecognizedEnumValues: true,
+ skipValidation: true,
+ breadcrumbsPrefix: ["response"],
+ })
+ );
+ case 503:
+ throw new DevRev.ServiceUnavailableError(
+ serializers.ErrorServiceUnavailable.parseOrThrow(_response.error.body, {
+ unrecognizedObjectKeys: "passthrough",
+ allowUnrecognizedUnionMembers: true,
+ allowUnrecognizedEnumValues: true,
+ skipValidation: true,
+ breadcrumbsPrefix: ["response"],
+ })
+ );
+ default:
+ throw new errors.DevRevError({
+ statusCode: _response.error.statusCode,
+ body: _response.error.body,
+ });
+ }
+ }
+
+ switch (_response.error.reason) {
+ case "non-json":
+ throw new errors.DevRevError({
+ statusCode: _response.error.statusCode,
+ body: _response.error.rawBody,
+ });
+ case "timeout":
+ throw new errors.DevRevTimeoutError();
+ case "unknown":
+ throw new errors.DevRevError({
+ message: _response.error.errorMessage,
+ });
+ }
+ }
+
+ /**
+ * Deletes a Unit of Measurement.
+ *
+ * @param {DevRev.UomsDeleteRequest} request
+ * @param {ProductUsage.RequestOptions} requestOptions - Request-specific configuration.
+ *
+ * @throws {@link DevRev.BadRequestError}
+ * @throws {@link DevRev.UnauthorizedError}
+ * @throws {@link DevRev.ForbiddenError}
+ * @throws {@link DevRev.NotFoundError}
+ * @throws {@link DevRev.TooManyRequestsError}
+ * @throws {@link DevRev.InternalServerError}
+ * @throws {@link DevRev.ServiceUnavailableError}
+ *
+ * @example
+ * await client.productUsage.uomsDelete({
+ * id: "id"
+ * })
+ */
+ public async uomsDelete(
+ request: DevRev.UomsDeleteRequest,
+ requestOptions?: ProductUsage.RequestOptions
+ ): Promise {
+ const _response = await (this._options.fetcher ?? core.fetcher)({
+ url: urlJoin(
+ (await core.Supplier.get(this._options.environment)) ?? environments.DevRevEnvironment.Default,
+ "uoms.delete"
+ ),
+ method: "POST",
+ headers: {
+ Authorization: await this._getAuthorizationHeader(),
+ "X-Fern-Language": "JavaScript",
+ "X-Fern-SDK-Name": "@devrev/api",
+ "X-Fern-SDK-Version": "0.0.14",
+ "X-Fern-Runtime": core.RUNTIME.type,
+ "X-Fern-Runtime-Version": core.RUNTIME.version,
+ },
+ contentType: "application/json",
+ requestType: "json",
+ body: serializers.UomsDeleteRequest.jsonOrThrow(request, { unrecognizedObjectKeys: "strip" }),
+ 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 DevRev.BadRequestError(
+ serializers.ErrorBadRequest.parseOrThrow(_response.error.body, {
+ unrecognizedObjectKeys: "passthrough",
+ allowUnrecognizedUnionMembers: true,
+ allowUnrecognizedEnumValues: true,
+ skipValidation: true,
+ breadcrumbsPrefix: ["response"],
+ })
+ );
+ case 401:
+ throw new DevRev.UnauthorizedError(
+ serializers.ErrorUnauthorized.parseOrThrow(_response.error.body, {
+ unrecognizedObjectKeys: "passthrough",
+ allowUnrecognizedUnionMembers: true,
+ allowUnrecognizedEnumValues: true,
+ skipValidation: true,
+ breadcrumbsPrefix: ["response"],
+ })
+ );
+ case 403:
+ throw new DevRev.ForbiddenError(
+ serializers.ErrorForbidden.parseOrThrow(_response.error.body, {
+ unrecognizedObjectKeys: "passthrough",
+ allowUnrecognizedUnionMembers: true,
+ allowUnrecognizedEnumValues: true,
+ skipValidation: true,
+ breadcrumbsPrefix: ["response"],
+ })
+ );
+ case 404:
+ throw new DevRev.NotFoundError(
+ serializers.ErrorNotFound.parseOrThrow(_response.error.body, {
+ unrecognizedObjectKeys: "passthrough",
+ allowUnrecognizedUnionMembers: true,
+ allowUnrecognizedEnumValues: true,
+ skipValidation: true,
+ breadcrumbsPrefix: ["response"],
+ })
+ );
+ case 429:
+ throw new DevRev.TooManyRequestsError(
+ serializers.ErrorTooManyRequests.parseOrThrow(_response.error.body, {
+ unrecognizedObjectKeys: "passthrough",
+ allowUnrecognizedUnionMembers: true,
+ allowUnrecognizedEnumValues: true,
+ skipValidation: true,
+ breadcrumbsPrefix: ["response"],
+ })
+ );
+ case 500:
+ throw new DevRev.InternalServerError(
+ serializers.ErrorInternalServerError.parseOrThrow(_response.error.body, {
+ unrecognizedObjectKeys: "passthrough",
+ allowUnrecognizedUnionMembers: true,
+ allowUnrecognizedEnumValues: true,
+ skipValidation: true,
+ breadcrumbsPrefix: ["response"],
+ })
+ );
+ case 503:
+ throw new DevRev.ServiceUnavailableError(
+ serializers.ErrorServiceUnavailable.parseOrThrow(_response.error.body, {
+ unrecognizedObjectKeys: "passthrough",
+ allowUnrecognizedUnionMembers: true,
+ allowUnrecognizedEnumValues: true,
+ skipValidation: true,
+ breadcrumbsPrefix: ["response"],
+ })
+ );
+ default:
+ throw new errors.DevRevError({
+ statusCode: _response.error.statusCode,
+ body: _response.error.body,
+ });
+ }
+ }
+
+ switch (_response.error.reason) {
+ case "non-json":
+ throw new errors.DevRevError({
+ statusCode: _response.error.statusCode,
+ body: _response.error.rawBody,
+ });
+ case "timeout":
+ throw new errors.DevRevTimeoutError();
+ case "unknown":
+ throw new errors.DevRevError({
+ message: _response.error.errorMessage,
+ });
+ }
+ }
+
+ /**
+ * Gets a Unit of Measurement.
+ *
+ * @param {DevRev.UomsGetQuery} request
+ * @param {ProductUsage.RequestOptions} requestOptions - Request-specific configuration.
+ *
+ * @throws {@link DevRev.BadRequestError}
+ * @throws {@link DevRev.UnauthorizedError}
+ * @throws {@link DevRev.ForbiddenError}
+ * @throws {@link DevRev.NotFoundError}
+ * @throws {@link DevRev.TooManyRequestsError}
+ * @throws {@link DevRev.InternalServerError}
+ * @throws {@link DevRev.ServiceUnavailableError}
+ *
+ * @example
+ * await client.productUsage.uomsGet({
+ * id: "string"
+ * })
+ */
+ public async uomsGet(
+ request: DevRev.UomsGetQuery,
+ requestOptions?: ProductUsage.RequestOptions
+ ): Promise {
+ const { id } = request;
+ const _queryParams: Record = {};
+ _queryParams["id"] = id;
+ const _response = await (this._options.fetcher ?? core.fetcher)({
+ url: urlJoin(
+ (await core.Supplier.get(this._options.environment)) ?? environments.DevRevEnvironment.Default,
+ "uoms.get"
+ ),
+ method: "GET",
+ headers: {
+ Authorization: await this._getAuthorizationHeader(),
+ "X-Fern-Language": "JavaScript",
+ "X-Fern-SDK-Name": "@devrev/api",
+ "X-Fern-SDK-Version": "0.0.14",
+ "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 serializers.UomsGetResponse.parseOrThrow(_response.body, {
+ unrecognizedObjectKeys: "passthrough",
+ allowUnrecognizedUnionMembers: true,
+ allowUnrecognizedEnumValues: true,
+ skipValidation: true,
+ breadcrumbsPrefix: ["response"],
+ });
+ }
+
+ if (_response.error.reason === "status-code") {
+ switch (_response.error.statusCode) {
+ case 400:
+ throw new DevRev.BadRequestError(
+ serializers.ErrorBadRequest.parseOrThrow(_response.error.body, {
+ unrecognizedObjectKeys: "passthrough",
+ allowUnrecognizedUnionMembers: true,
+ allowUnrecognizedEnumValues: true,
+ skipValidation: true,
+ breadcrumbsPrefix: ["response"],
+ })
+ );
+ case 401:
+ throw new DevRev.UnauthorizedError(
+ serializers.ErrorUnauthorized.parseOrThrow(_response.error.body, {
+ unrecognizedObjectKeys: "passthrough",
+ allowUnrecognizedUnionMembers: true,
+ allowUnrecognizedEnumValues: true,
+ skipValidation: true,
+ breadcrumbsPrefix: ["response"],
+ })
+ );
+ case 403:
+ throw new DevRev.ForbiddenError(
+ serializers.ErrorForbidden.parseOrThrow(_response.error.body, {
+ unrecognizedObjectKeys: "passthrough",
+ allowUnrecognizedUnionMembers: true,
+ allowUnrecognizedEnumValues: true,
+ skipValidation: true,
+ breadcrumbsPrefix: ["response"],
+ })
+ );
+ case 404:
+ throw new DevRev.NotFoundError(
+ serializers.ErrorNotFound.parseOrThrow(_response.error.body, {
+ unrecognizedObjectKeys: "passthrough",
+ allowUnrecognizedUnionMembers: true,
+ allowUnrecognizedEnumValues: true,
+ skipValidation: true,
+ breadcrumbsPrefix: ["response"],
+ })
+ );
+ case 429:
+ throw new DevRev.TooManyRequestsError(
+ serializers.ErrorTooManyRequests.parseOrThrow(_response.error.body, {
+ unrecognizedObjectKeys: "passthrough",
+ allowUnrecognizedUnionMembers: true,
+ allowUnrecognizedEnumValues: true,
+ skipValidation: true,
+ breadcrumbsPrefix: ["response"],
+ })
+ );
+ case 500:
+ throw new DevRev.InternalServerError(
+ serializers.ErrorInternalServerError.parseOrThrow(_response.error.body, {
+ unrecognizedObjectKeys: "passthrough",
+ allowUnrecognizedUnionMembers: true,
+ allowUnrecognizedEnumValues: true,
+ skipValidation: true,
+ breadcrumbsPrefix: ["response"],
+ })
+ );
+ case 503:
+ throw new DevRev.ServiceUnavailableError(
+ serializers.ErrorServiceUnavailable.parseOrThrow(_response.error.body, {
+ unrecognizedObjectKeys: "passthrough",
+ allowUnrecognizedUnionMembers: true,
+ allowUnrecognizedEnumValues: true,
+ skipValidation: true,
+ breadcrumbsPrefix: ["response"],
+ })
+ );
+ default:
+ throw new errors.DevRevError({
+ statusCode: _response.error.statusCode,
+ body: _response.error.body,
+ });
+ }
+ }
+
+ switch (_response.error.reason) {
+ case "non-json":
+ throw new errors.DevRevError({
+ statusCode: _response.error.statusCode,
+ body: _response.error.rawBody,
+ });
+ case "timeout":
+ throw new errors.DevRevTimeoutError();
+ case "unknown":
+ throw new errors.DevRevError({
+ message: _response.error.errorMessage,
+ });
+ }
+ }
+
+ /**
+ * Gets a Unit of Measurement.
+ *
+ * @param {DevRev.UomsGetRequest} request
+ * @param {ProductUsage.RequestOptions} requestOptions - Request-specific configuration.
+ *
+ * @throws {@link DevRev.BadRequestError}
+ * @throws {@link DevRev.UnauthorizedError}
+ * @throws {@link DevRev.ForbiddenError}
+ * @throws {@link DevRev.NotFoundError}
+ * @throws {@link DevRev.TooManyRequestsError}
+ * @throws {@link DevRev.InternalServerError}
+ * @throws {@link DevRev.ServiceUnavailableError}
+ *
+ * @example
+ * await client.productUsage.uomsGetPost({
+ * id: "string"
+ * })
+ */
+ public async uomsGetPost(
+ request: DevRev.UomsGetRequest,
+ requestOptions?: ProductUsage.RequestOptions
+ ): Promise {
+ const _response = await (this._options.fetcher ?? core.fetcher)({
+ url: urlJoin(
+ (await core.Supplier.get(this._options.environment)) ?? environments.DevRevEnvironment.Default,
+ "uoms.get"
+ ),
+ method: "POST",
+ headers: {
+ Authorization: await this._getAuthorizationHeader(),
+ "X-Fern-Language": "JavaScript",
+ "X-Fern-SDK-Name": "@devrev/api",
+ "X-Fern-SDK-Version": "0.0.14",
+ "X-Fern-Runtime": core.RUNTIME.type,
+ "X-Fern-Runtime-Version": core.RUNTIME.version,
+ },
+ contentType: "application/json",
+ requestType: "json",
+ body: serializers.UomsGetRequest.jsonOrThrow(request, { unrecognizedObjectKeys: "strip" }),
+ timeoutMs: requestOptions?.timeoutInSeconds != null ? requestOptions.timeoutInSeconds * 1000 : 60000,
+ maxRetries: requestOptions?.maxRetries,
+ abortSignal: requestOptions?.abortSignal,
+ });
+ if (_response.ok) {
+ return serializers.UomsGetResponse.parseOrThrow(_response.body, {
+ unrecognizedObjectKeys: "passthrough",
+ allowUnrecognizedUnionMembers: true,
+ allowUnrecognizedEnumValues: true,
+ skipValidation: true,
+ breadcrumbsPrefix: ["response"],
+ });
+ }
+
+ if (_response.error.reason === "status-code") {
+ switch (_response.error.statusCode) {
+ case 400:
+ throw new DevRev.BadRequestError(
+ serializers.ErrorBadRequest.parseOrThrow(_response.error.body, {
+ unrecognizedObjectKeys: "passthrough",
+ allowUnrecognizedUnionMembers: true,
+ allowUnrecognizedEnumValues: true,
+ skipValidation: true,
+ breadcrumbsPrefix: ["response"],
+ })
+ );
+ case 401:
+ throw new DevRev.UnauthorizedError(
+ serializers.ErrorUnauthorized.parseOrThrow(_response.error.body, {
+ unrecognizedObjectKeys: "passthrough",
+ allowUnrecognizedUnionMembers: true,
+ allowUnrecognizedEnumValues: true,
+ skipValidation: true,
+ breadcrumbsPrefix: ["response"],
+ })
+ );
+ case 403:
+ throw new DevRev.ForbiddenError(
+ serializers.ErrorForbidden.parseOrThrow(_response.error.body, {
+ unrecognizedObjectKeys: "passthrough",
+ allowUnrecognizedUnionMembers: true,
+ allowUnrecognizedEnumValues: true,
+ skipValidation: true,
+ breadcrumbsPrefix: ["response"],
+ })
+ );
+ case 404:
+ throw new DevRev.NotFoundError(
+ serializers.ErrorNotFound.parseOrThrow(_response.error.body, {
+ unrecognizedObjectKeys: "passthrough",
+ allowUnrecognizedUnionMembers: true,
+ allowUnrecognizedEnumValues: true,
+ skipValidation: true,
+ breadcrumbsPrefix: ["response"],
+ })
+ );
+ case 429:
+ throw new DevRev.TooManyRequestsError(
+ serializers.ErrorTooManyRequests.parseOrThrow(_response.error.body, {
+ unrecognizedObjectKeys: "passthrough",
+ allowUnrecognizedUnionMembers: true,
+ allowUnrecognizedEnumValues: true,
+ skipValidation: true,
+ breadcrumbsPrefix: ["response"],
+ })
+ );
+ case 500:
+ throw new DevRev.InternalServerError(
+ serializers.ErrorInternalServerError.parseOrThrow(_response.error.body, {
+ unrecognizedObjectKeys: "passthrough",
+ allowUnrecognizedUnionMembers: true,
+ allowUnrecognizedEnumValues: true,
+ skipValidation: true,
+ breadcrumbsPrefix: ["response"],
+ })
+ );
+ case 503:
+ throw new DevRev.ServiceUnavailableError(
+ serializers.ErrorServiceUnavailable.parseOrThrow(_response.error.body, {
+ unrecognizedObjectKeys: "passthrough",
+ allowUnrecognizedUnionMembers: true,
+ allowUnrecognizedEnumValues: true,
+ skipValidation: true,
+ breadcrumbsPrefix: ["response"],
+ })
+ );
+ default:
+ throw new errors.DevRevError({
+ statusCode: _response.error.statusCode,
+ body: _response.error.body,
+ });
+ }
+ }
+
+ switch (_response.error.reason) {
+ case "non-json":
+ throw new errors.DevRevError({
+ statusCode: _response.error.statusCode,
+ body: _response.error.rawBody,
+ });
+ case "timeout":
+ throw new errors.DevRevTimeoutError();
+ case "unknown":
+ throw new errors.DevRevError({
+ message: _response.error.errorMessage,
+ });
+ }
+ }
+
+ /**
+ * Gets the Unit of Measurements based on the given filters.
+ *
+ * @param {DevRev.UomsListQuery} request
+ * @param {ProductUsage.RequestOptions} requestOptions - Request-specific configuration.
+ *
+ * @throws {@link DevRev.BadRequestError}
+ * @throws {@link DevRev.UnauthorizedError}
+ * @throws {@link DevRev.ForbiddenError}
+ * @throws {@link DevRev.TooManyRequestsError}
+ * @throws {@link DevRev.InternalServerError}
+ * @throws {@link DevRev.ServiceUnavailableError}
+ *
+ * @example
+ * await client.productUsage.uomsList()
+ */
+ public async uomsList(
+ request: DevRev.UomsListQuery = {},
+ requestOptions?: ProductUsage.RequestOptions
+ ): Promise {
+ const { aggregationTypes, cursor, ids, limit, metricNames, mode, partIds, productIds, sortBy, unitTypes } =
+ request;
+ const _queryParams: Record = {};
+ if (aggregationTypes != null) {
+ if (Array.isArray(aggregationTypes)) {
+ _queryParams["aggregation_types"] = aggregationTypes.map((item) => item);
+ } else {
+ _queryParams["aggregation_types"] = aggregationTypes;
+ }
+ }
+
+ if (cursor != null) {
+ _queryParams["cursor"] = cursor;
+ }
+
+ if (ids != null) {
+ if (Array.isArray(ids)) {
+ _queryParams["ids"] = ids.map((item) => item);
+ } else {
+ _queryParams["ids"] = ids;
+ }
+ }
+
+ if (limit != null) {
+ _queryParams["limit"] = limit.toString();
+ }
+
+ if (metricNames != null) {
+ if (Array.isArray(metricNames)) {
+ _queryParams["metric_names"] = metricNames.map((item) => item);
+ } else {
+ _queryParams["metric_names"] = metricNames;
+ }
+ }
+
+ if (mode != null) {
+ _queryParams["mode"] = mode;
+ }
+
+ if (partIds != null) {
+ if (Array.isArray(partIds)) {
+ _queryParams["part_ids"] = partIds.map((item) => item);
+ } else {
+ _queryParams["part_ids"] = partIds;
+ }
+ }
+
+ if (productIds != null) {
+ if (Array.isArray(productIds)) {
+ _queryParams["product_ids"] = productIds.map((item) => item);
+ } else {
+ _queryParams["product_ids"] = productIds;
+ }
+ }
+
+ if (sortBy != null) {
+ if (Array.isArray(sortBy)) {
+ _queryParams["sort_by"] = sortBy.map((item) => item);
+ } else {
+ _queryParams["sort_by"] = sortBy;
+ }
+ }
+
+ if (unitTypes != null) {
+ if (Array.isArray(unitTypes)) {
+ _queryParams["unit_types"] = unitTypes.map((item) => item);
+ } else {
+ _queryParams["unit_types"] = unitTypes;
+ }
+ }
+
+ const _response = await (this._options.fetcher ?? core.fetcher)({
+ url: urlJoin(
+ (await core.Supplier.get(this._options.environment)) ?? environments.DevRevEnvironment.Default,
+ "uoms.list"
+ ),
+ method: "GET",
+ headers: {
+ Authorization: await this._getAuthorizationHeader(),
+ "X-Fern-Language": "JavaScript",
+ "X-Fern-SDK-Name": "@devrev/api",
+ "X-Fern-SDK-Version": "0.0.14",
+ "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 serializers.UomsListResponse.parseOrThrow(_response.body, {
+ unrecognizedObjectKeys: "passthrough",
+ allowUnrecognizedUnionMembers: true,
+ allowUnrecognizedEnumValues: true,
+ skipValidation: true,
+ breadcrumbsPrefix: ["response"],
+ });
+ }
+
+ if (_response.error.reason === "status-code") {
+ switch (_response.error.statusCode) {
+ case 400:
+ throw new DevRev.BadRequestError(
+ serializers.ErrorBadRequest.parseOrThrow(_response.error.body, {
+ unrecognizedObjectKeys: "passthrough",
+ allowUnrecognizedUnionMembers: true,
+ allowUnrecognizedEnumValues: true,
+ skipValidation: true,
+ breadcrumbsPrefix: ["response"],
+ })
+ );
+ case 401:
+ throw new DevRev.UnauthorizedError(
+ serializers.ErrorUnauthorized.parseOrThrow(_response.error.body, {
+ unrecognizedObjectKeys: "passthrough",
+ allowUnrecognizedUnionMembers: true,
+ allowUnrecognizedEnumValues: true,
+ skipValidation: true,
+ breadcrumbsPrefix: ["response"],
+ })
+ );
+ case 403:
+ throw new DevRev.ForbiddenError(
+ serializers.ErrorForbidden.parseOrThrow(_response.error.body, {
+ unrecognizedObjectKeys: "passthrough",
+ allowUnrecognizedUnionMembers: true,
+ allowUnrecognizedEnumValues: true,
+ skipValidation: true,
+ breadcrumbsPrefix: ["response"],
+ })
+ );
+ case 429:
+ throw new DevRev.TooManyRequestsError(
+ serializers.ErrorTooManyRequests.parseOrThrow(_response.error.body, {
+ unrecognizedObjectKeys: "passthrough",
+ allowUnrecognizedUnionMembers: true,
+ allowUnrecognizedEnumValues: true,
+ skipValidation: true,
+ breadcrumbsPrefix: ["response"],
+ })
+ );
+ case 500:
+ throw new DevRev.InternalServerError(
+ serializers.ErrorInternalServerError.parseOrThrow(_response.error.body, {
+ unrecognizedObjectKeys: "passthrough",
+ allowUnrecognizedUnionMembers: true,
+ allowUnrecognizedEnumValues: true,
+ skipValidation: true,
+ breadcrumbsPrefix: ["response"],
+ })
+ );
+ case 503:
+ throw new DevRev.ServiceUnavailableError(
+ serializers.ErrorServiceUnavailable.parseOrThrow(_response.error.body, {
+ unrecognizedObjectKeys: "passthrough",
+ allowUnrecognizedUnionMembers: true,
+ allowUnrecognizedEnumValues: true,
+ skipValidation: true,
+ breadcrumbsPrefix: ["response"],
+ })
+ );
+ default:
+ throw new errors.DevRevError({
+ statusCode: _response.error.statusCode,
+ body: _response.error.body,
+ });
+ }
+ }
+
+ switch (_response.error.reason) {
+ case "non-json":
+ throw new errors.DevRevError({
+ statusCode: _response.error.statusCode,
+ body: _response.error.rawBody,
+ });
+ case "timeout":
+ throw new errors.DevRevTimeoutError();
+ case "unknown":
+ throw new errors.DevRevError({
+ message: _response.error.errorMessage,
+ });
+ }
+ }
+
+ /**
+ * Gets the Unit of Measurements based on the given filters.
+ *
+ * @param {DevRev.UomsListRequest} request
+ * @param {ProductUsage.RequestOptions} requestOptions - Request-specific configuration.
+ *
+ * @throws {@link DevRev.BadRequestError}
+ * @throws {@link DevRev.UnauthorizedError}
+ * @throws {@link DevRev.ForbiddenError}
+ * @throws {@link DevRev.TooManyRequestsError}
+ * @throws {@link DevRev.InternalServerError}
+ * @throws {@link DevRev.ServiceUnavailableError}
+ *
+ * @example
+ * await client.productUsage.uomsListPost()
+ */
+ public async uomsListPost(
+ request: DevRev.UomsListRequest = {},
+ requestOptions?: ProductUsage.RequestOptions
+ ): Promise {
+ const _response = await (this._options.fetcher ?? core.fetcher)({
+ url: urlJoin(
+ (await core.Supplier.get(this._options.environment)) ?? environments.DevRevEnvironment.Default,
+ "uoms.list"
+ ),
+ method: "POST",
+ headers: {
+ Authorization: await this._getAuthorizationHeader(),
+ "X-Fern-Language": "JavaScript",
+ "X-Fern-SDK-Name": "@devrev/api",
+ "X-Fern-SDK-Version": "0.0.14",
+ "X-Fern-Runtime": core.RUNTIME.type,
+ "X-Fern-Runtime-Version": core.RUNTIME.version,
+ },
+ contentType: "application/json",
+ requestType: "json",
+ body: serializers.UomsListRequest.jsonOrThrow(request, { unrecognizedObjectKeys: "strip" }),
+ timeoutMs: requestOptions?.timeoutInSeconds != null ? requestOptions.timeoutInSeconds * 1000 : 60000,
+ maxRetries: requestOptions?.maxRetries,
+ abortSignal: requestOptions?.abortSignal,
+ });
+ if (_response.ok) {
+ return serializers.UomsListResponse.parseOrThrow(_response.body, {
+ unrecognizedObjectKeys: "passthrough",
+ allowUnrecognizedUnionMembers: true,
+ allowUnrecognizedEnumValues: true,
+ skipValidation: true,
+ breadcrumbsPrefix: ["response"],
+ });
+ }
+
+ if (_response.error.reason === "status-code") {
+ switch (_response.error.statusCode) {
+ case 400:
+ throw new DevRev.BadRequestError(
+ serializers.ErrorBadRequest.parseOrThrow(_response.error.body, {
+ unrecognizedObjectKeys: "passthrough",
+ allowUnrecognizedUnionMembers: true,
+ allowUnrecognizedEnumValues: true,
+ skipValidation: true,
+ breadcrumbsPrefix: ["response"],
+ })
+ );
+ case 401:
+ throw new DevRev.UnauthorizedError(
+ serializers.ErrorUnauthorized.parseOrThrow(_response.error.body, {
+ unrecognizedObjectKeys: "passthrough",
+ allowUnrecognizedUnionMembers: true,
+ allowUnrecognizedEnumValues: true,
+ skipValidation: true,
+ breadcrumbsPrefix: ["response"],
+ })
+ );
+ case 403:
+ throw new DevRev.ForbiddenError(
+ serializers.ErrorForbidden.parseOrThrow(_response.error.body, {
+ unrecognizedObjectKeys: "passthrough",
+ allowUnrecognizedUnionMembers: true,
+ allowUnrecognizedEnumValues: true,
+ skipValidation: true,
+ breadcrumbsPrefix: ["response"],
+ })
+ );
+ case 429:
+ throw new DevRev.TooManyRequestsError(
+ serializers.ErrorTooManyRequests.parseOrThrow(_response.error.body, {
+ unrecognizedObjectKeys: "passthrough",
+ allowUnrecognizedUnionMembers: true,
+ allowUnrecognizedEnumValues: true,
+ skipValidation: true,
+ breadcrumbsPrefix: ["response"],
+ })
+ );
+ case 500:
+ throw new DevRev.InternalServerError(
+ serializers.ErrorInternalServerError.parseOrThrow(_response.error.body, {
+ unrecognizedObjectKeys: "passthrough",
+ allowUnrecognizedUnionMembers: true,
+ allowUnrecognizedEnumValues: true,
+ skipValidation: true,
+ breadcrumbsPrefix: ["response"],
+ })
+ );
+ case 503:
+ throw new DevRev.ServiceUnavailableError(
+ serializers.ErrorServiceUnavailable.parseOrThrow(_response.error.body, {
+ unrecognizedObjectKeys: "passthrough",
+ allowUnrecognizedUnionMembers: true,
+ allowUnrecognizedEnumValues: true,
+ skipValidation: true,
+ breadcrumbsPrefix: ["response"],
+ })
+ );
+ default:
+ throw new errors.DevRevError({
+ statusCode: _response.error.statusCode,
+ body: _response.error.body,
+ });
+ }
+ }
+
+ switch (_response.error.reason) {
+ case "non-json":
+ throw new errors.DevRevError({
+ statusCode: _response.error.statusCode,
+ body: _response.error.rawBody,
+ });
+ case "timeout":
+ throw new errors.DevRevTimeoutError();
+ case "unknown":
+ throw new errors.DevRevError({
+ message: _response.error.errorMessage,
+ });
+ }
+ }
+
+ /**
+ * Updates a Unit of Measurement.
+ *
+ * @param {DevRev.UomsUpdateRequest} request
+ * @param {ProductUsage.RequestOptions} requestOptions - Request-specific configuration.
+ *
+ * @throws {@link DevRev.BadRequestError}
+ * @throws {@link DevRev.UnauthorizedError}
+ * @throws {@link DevRev.ForbiddenError}
+ * @throws {@link DevRev.NotFoundError}
+ * @throws {@link DevRev.TooManyRequestsError}
+ * @throws {@link DevRev.InternalServerError}
+ * @throws {@link DevRev.ServiceUnavailableError}
+ *
+ * @example
+ * await client.productUsage.uomsUpdate({
+ * aggregationType: DevRev.AggregationDetailAggregationType.Duration,
+ * description: "string",
+ * dimensions: {
+ * add: ["string"],
+ * remove: ["string"]
+ * },
+ * id: "string",
+ * isEnabled: true,
+ * name: "string",
+ * partId: "string",
+ * productId: "string",
+ * unit: "string"
+ * })
+ */
+ public async uomsUpdate(
+ request: DevRev.UomsUpdateRequest,
+ requestOptions?: ProductUsage.RequestOptions
+ ): Promise {
+ const _response = await (this._options.fetcher ?? core.fetcher)({
+ url: urlJoin(
+ (await core.Supplier.get(this._options.environment)) ?? environments.DevRevEnvironment.Default,
+ "uoms.update"
+ ),
+ method: "POST",
+ headers: {
+ Authorization: await this._getAuthorizationHeader(),
+ "X-Fern-Language": "JavaScript",
+ "X-Fern-SDK-Name": "@devrev/api",
+ "X-Fern-SDK-Version": "0.0.14",
+ "X-Fern-Runtime": core.RUNTIME.type,
+ "X-Fern-Runtime-Version": core.RUNTIME.version,
+ },
+ contentType: "application/json",
+ requestType: "json",
+ body: serializers.UomsUpdateRequest.jsonOrThrow(request, { unrecognizedObjectKeys: "strip" }),
+ timeoutMs: requestOptions?.timeoutInSeconds != null ? requestOptions.timeoutInSeconds * 1000 : 60000,
+ maxRetries: requestOptions?.maxRetries,
+ abortSignal: requestOptions?.abortSignal,
+ });
+ if (_response.ok) {
+ return serializers.UomsUpdateResponse.parseOrThrow(_response.body, {
+ unrecognizedObjectKeys: "passthrough",
+ allowUnrecognizedUnionMembers: true,
+ allowUnrecognizedEnumValues: true,
+ skipValidation: true,
+ breadcrumbsPrefix: ["response"],
+ });
+ }
+
+ if (_response.error.reason === "status-code") {
+ switch (_response.error.statusCode) {
+ case 400:
+ throw new DevRev.BadRequestError(
+ serializers.ErrorBadRequest.parseOrThrow(_response.error.body, {
+ unrecognizedObjectKeys: "passthrough",
+ allowUnrecognizedUnionMembers: true,
+ allowUnrecognizedEnumValues: true,
+ skipValidation: true,
+ breadcrumbsPrefix: ["response"],
+ })
+ );
+ case 401:
+ throw new DevRev.UnauthorizedError(
+ serializers.ErrorUnauthorized.parseOrThrow(_response.error.body, {
+ unrecognizedObjectKeys: "passthrough",
+ allowUnrecognizedUnionMembers: true,
+ allowUnrecognizedEnumValues: true,
+ skipValidation: true,
+ breadcrumbsPrefix: ["response"],
+ })
+ );
+ case 403:
+ throw new DevRev.ForbiddenError(
+ serializers.ErrorForbidden.parseOrThrow(_response.error.body, {
+ unrecognizedObjectKeys: "passthrough",
+ allowUnrecognizedUnionMembers: true,
+ allowUnrecognizedEnumValues: true,
+ skipValidation: true,
+ breadcrumbsPrefix: ["response"],
+ })
+ );
+ case 404:
+ throw new DevRev.NotFoundError(
+ serializers.ErrorNotFound.parseOrThrow(_response.error.body, {
+ unrecognizedObjectKeys: "passthrough",
+ allowUnrecognizedUnionMembers: true,
+ allowUnrecognizedEnumValues: true,
+ skipValidation: true,
+ breadcrumbsPrefix: ["response"],
+ })
+ );
+ case 429:
+ throw new DevRev.TooManyRequestsError(
+ serializers.ErrorTooManyRequests.parseOrThrow(_response.error.body, {
+ unrecognizedObjectKeys: "passthrough",
+ allowUnrecognizedUnionMembers: true,
+ allowUnrecognizedEnumValues: true,
+ skipValidation: true,
+ breadcrumbsPrefix: ["response"],
+ })
+ );
+ case 500:
+ throw new DevRev.InternalServerError(
+ serializers.ErrorInternalServerError.parseOrThrow(_response.error.body, {
+ unrecognizedObjectKeys: "passthrough",
+ allowUnrecognizedUnionMembers: true,
+ allowUnrecognizedEnumValues: true,
+ skipValidation: true,
+ breadcrumbsPrefix: ["response"],
+ })
+ );
+ case 503:
+ throw new DevRev.ServiceUnavailableError(
+ serializers.ErrorServiceUnavailable.parseOrThrow(_response.error.body, {
+ unrecognizedObjectKeys: "passthrough",
+ allowUnrecognizedUnionMembers: true,
+ allowUnrecognizedEnumValues: true,
+ skipValidation: true,
+ breadcrumbsPrefix: ["response"],
+ })
+ );
+ default:
+ throw new errors.DevRevError({
+ statusCode: _response.error.statusCode,
+ body: _response.error.body,
+ });
+ }
+ }
+
+ switch (_response.error.reason) {
+ case "non-json":
+ throw new errors.DevRevError({
+ statusCode: _response.error.statusCode,
+ body: _response.error.rawBody,
+ });
+ case "timeout":
+ throw new errors.DevRevTimeoutError();
+ case "unknown":
+ throw new errors.DevRevError({
+ message: _response.error.errorMessage,
+ });
+ }
+ }
+
+ protected async _getAuthorizationHeader(): Promise {
+ const bearer = (await core.Supplier.get(this._options.token)) ?? process?.env["DEVREV_TOKEN"];
+ if (bearer == null) {
+ throw new errors.DevRevError({
+ message: "Please specify DEVREV_TOKEN when instantiating the client.",
+ });
+ }
+
+ return `Bearer ${bearer}`;
+ }
+}
diff --git a/src/api/resources/productUsage/client/index.ts b/src/api/resources/productUsage/client/index.ts
new file mode 100644
index 0000000..415726b
--- /dev/null
+++ b/src/api/resources/productUsage/client/index.ts
@@ -0,0 +1 @@
+export * from "./requests";
diff --git a/src/api/resources/productUsage/client/requests/MetricsDataIngestRequest.ts b/src/api/resources/productUsage/client/requests/MetricsDataIngestRequest.ts
new file mode 100644
index 0000000..538d4ec
--- /dev/null
+++ b/src/api/resources/productUsage/client/requests/MetricsDataIngestRequest.ts
@@ -0,0 +1,23 @@
+/**
+ * This file was auto-generated by Fern from our API Definition.
+ */
+
+import * as DevRev from "../../../../index";
+
+/**
+ * @example
+ * {
+ * metrics: [{
+ * accountRef: "account_ref",
+ * dataPoints: [{
+ * timestamp: new Date("2023-01-01T12:00:00.000Z"),
+ * value: 1.1
+ * }],
+ * name: "name"
+ * }]
+ * }
+ */
+export interface MetricsDataIngestRequest {
+ /** Metrics data received from Dev orgs. */
+ metrics: DevRev.MetricsData[];
+}
diff --git a/src/api/resources/productUsage/client/requests/UomsCountQuery.ts b/src/api/resources/productUsage/client/requests/UomsCountQuery.ts
new file mode 100644
index 0000000..9596e58
--- /dev/null
+++ b/src/api/resources/productUsage/client/requests/UomsCountQuery.ts
@@ -0,0 +1,37 @@
+/**
+ * This file was auto-generated by Fern from our API Definition.
+ */
+
+import * as DevRev from "../../../../index";
+
+/**
+ * @example
+ * {}
+ */
+export interface UomsCountQuery {
+ /**
+ * List of aggregation types for filtering list of UOMs.
+ */
+ aggregationTypes?: DevRev.AggregationDetailAggregationType | DevRev.AggregationDetailAggregationType[];
+ /**
+ * List of Unit of Measurement (UOM) DONs to be used in filtering
+ * complete list of UOMs defined in a Dev Org.
+ */
+ ids?: string | string[];
+ /**
+ * List of metric names for filtering list of UOMs.
+ */
+ metricNames?: string | string[];
+ /**
+ * List of part IDs for filtering list of UOMs.
+ */
+ partIds?: string | string[];
+ /**
+ * List of product IDs for filtering list of UOMs.
+ */
+ productIds?: string | string[];
+ /**
+ * List of unit types for filtering list of UOMs.
+ */
+ unitTypes?: DevRev.UnitType | DevRev.UnitType[];
+}
diff --git a/src/api/resources/productUsage/client/requests/UomsCountRequest.ts b/src/api/resources/productUsage/client/requests/UomsCountRequest.ts
new file mode 100644
index 0000000..9a0909a
--- /dev/null
+++ b/src/api/resources/productUsage/client/requests/UomsCountRequest.ts
@@ -0,0 +1,28 @@
+/**
+ * This file was auto-generated by Fern from our API Definition.
+ */
+
+import * as DevRev from "../../../../index";
+
+/**
+ * @example
+ * {}
+ */
+export interface UomsCountRequest {
+ /** List of aggregation types for filtering list of UOMs. */
+ aggregationTypes?: DevRev.AggregationDetailAggregationType[];
+ /**
+ * List of Unit of Measurement (UOM) DONs to be used in filtering
+ * complete list of UOMs defined in a Dev Org.
+ *
+ */
+ ids?: string[];
+ /** List of metric names for filtering list of UOMs. */
+ metricNames?: string[];
+ /** List of part IDs for filtering list of UOMs. */
+ partIds?: string[];
+ /** List of product IDs for filtering list of UOMs. */
+ productIds?: string[];
+ /** List of unit types for filtering list of UOMs. */
+ unitTypes?: DevRev.UnitType[];
+}
diff --git a/src/api/resources/productUsage/client/requests/UomsCreateRequest.ts b/src/api/resources/productUsage/client/requests/UomsCreateRequest.ts
new file mode 100644
index 0000000..1550cc3
--- /dev/null
+++ b/src/api/resources/productUsage/client/requests/UomsCreateRequest.ts
@@ -0,0 +1,72 @@
+/**
+ * This file was auto-generated by Fern from our API Definition.
+ */
+
+import * as DevRev from "../../../../index";
+
+/**
+ * @example
+ * {
+ * aggregationDetail: {
+ * aggregationType: DevRev.AggregationDetailAggregationType.Duration,
+ * uniqueDimension: "string"
+ * },
+ * description: "string",
+ * dimensions: ["string"],
+ * metricName: "string",
+ * name: "string",
+ * partId: "string",
+ * productId: "string",
+ * unit: {
+ * type: DevRev.UnitType.Boolean,
+ * name: "string"
+ * }
+ * }
+ */
+export interface UomsCreateRequest {
+ aggregationDetail: DevRev.AggregationDetail;
+ /** Description of the Unit of Measurement (UOM). */
+ description?: string;
+ /**
+ * The list of dimensions that can be emitted as part of metrics data.
+ * Dimensions consist of list of key-value pairs. For example, if the
+ * UOM is 'number_of_api_calls', then dimensions can be ['api_name',
+ * 'api_version'].Dimension keys can only contain alphanumeric
+ * characters (A-Z, a-z, and 0-9) and underscores (_). Dimension keys
+ * cannot start with a number and is case-insensitive.Dimension keys
+ * must be unique and it is not allowed to have more than one value
+ * with the same key.Metrics data ingested in DevRev metrics format
+ * will be grouped and aggregated based on the dimensions specified in
+ * UOM.
+ *
+ */
+ dimensions?: string[];
+ /**
+ * Name of the Unit of Measurement (UOM). Unit of Measurement is a
+ * unit of measure defined over a part offered by a Dev Org. A single
+ * part can have multiple unit of measurements defined over it. For
+ * example, a part can be 'video call', one UOM defined on this can be
+ * 'number_of_calls', other UOM can be 'call_duration' etc.Metric name
+ * should be unique across all UOMs in a Dev Org.Metric name can only
+ * contain alphanumeric characters (A-Z, a-z, and 0-9) and underscores
+ * (_). Metric name cannot start with a number and is
+ * case-insensitive.
+ *
+ */
+ metricName: string;
+ /** Human readable name of the Unit of Measurement (UOM). */
+ name: string;
+ /**
+ * The part ID for which the Unit of Measurement (UOM) is defined.
+ * When defined, ingested metrics data will be associated with part
+ * and product specified in UOM.
+ *
+ */
+ partId?: string;
+ /**
+ * The product ID for which the Unit of Measurement (UOM) is defined.
+ *
+ */
+ productId: string;
+ unit: DevRev.Unit;
+}
diff --git a/src/api/resources/productUsage/client/requests/UomsDeleteRequest.ts b/src/api/resources/productUsage/client/requests/UomsDeleteRequest.ts
new file mode 100644
index 0000000..6ed65d2
--- /dev/null
+++ b/src/api/resources/productUsage/client/requests/UomsDeleteRequest.ts
@@ -0,0 +1,14 @@
+/**
+ * This file was auto-generated by Fern from our API Definition.
+ */
+
+/**
+ * @example
+ * {
+ * id: "id"
+ * }
+ */
+export interface UomsDeleteRequest {
+ /** The Unit of Measurement (UOM)'s DON. */
+ id: string;
+}
diff --git a/src/api/resources/productUsage/client/requests/UomsGetQuery.ts b/src/api/resources/productUsage/client/requests/UomsGetQuery.ts
new file mode 100644
index 0000000..625b98f
--- /dev/null
+++ b/src/api/resources/productUsage/client/requests/UomsGetQuery.ts
@@ -0,0 +1,16 @@
+/**
+ * This file was auto-generated by Fern from our API Definition.
+ */
+
+/**
+ * @example
+ * {
+ * id: "string"
+ * }
+ */
+export interface UomsGetQuery {
+ /**
+ * The Unit of Measurement (UOM)'s DON.
+ */
+ id: string;
+}
diff --git a/src/api/resources/productUsage/client/requests/UomsGetRequest.ts b/src/api/resources/productUsage/client/requests/UomsGetRequest.ts
new file mode 100644
index 0000000..9e8f6b4
--- /dev/null
+++ b/src/api/resources/productUsage/client/requests/UomsGetRequest.ts
@@ -0,0 +1,14 @@
+/**
+ * This file was auto-generated by Fern from our API Definition.
+ */
+
+/**
+ * @example
+ * {
+ * id: "string"
+ * }
+ */
+export interface UomsGetRequest {
+ /** The Unit of Measurement (UOM)'s DON. */
+ id: string;
+}
diff --git a/src/api/resources/productUsage/client/requests/UomsListQuery.ts b/src/api/resources/productUsage/client/requests/UomsListQuery.ts
new file mode 100644
index 0000000..0289b79
--- /dev/null
+++ b/src/api/resources/productUsage/client/requests/UomsListQuery.ts
@@ -0,0 +1,57 @@
+/**
+ * This file was auto-generated by Fern from our API Definition.
+ */
+
+import * as DevRev from "../../../../index";
+
+/**
+ * @example
+ * {}
+ */
+export interface UomsListQuery {
+ /**
+ * List of aggregation types for filtering list of UOMs.
+ */
+ aggregationTypes?: DevRev.AggregationDetailAggregationType | DevRev.AggregationDetailAggregationType[];
+ /**
+ * The cursor to resume iteration from. If not provided, then iteration
+ * starts from the beginning.
+ */
+ cursor?: string;
+ /**
+ * List of Unit of Measurement (UOM) DONs to be used in filtering
+ * complete list of UOMs defined in a Dev Org.
+ */
+ ids?: string | string[];
+ /**
+ * The maximum number of UOMs to be returned in a response. The default
+ * is '50'.
+ */
+ limit?: number;
+ /**
+ * List of metric names for filtering list of UOMs.
+ */
+ metricNames?: string | string[];
+ /**
+ * The iteration mode to use, otherwise if not set, then "after" is
+ * used.
+ */
+ mode?: DevRev.ListMode;
+ /**
+ * List of part IDs for filtering list of UOMs.
+ */
+ partIds?: string | string[];
+ /**
+ * List of product IDs for filtering list of UOMs.
+ */
+ productIds?: string | string[];
+ /**
+ * Fields to sort the Unit Of Measuments (UOMs) by and the direction to
+ * sort them.
+ */
+ sortBy?: string | string[];
+ /**
+ * List of unit types for filtering list of UOMs.
+ */
+ unitTypes?: DevRev.UnitType | DevRev.UnitType[];
+}
diff --git a/src/api/resources/productUsage/client/requests/UomsListRequest.ts b/src/api/resources/productUsage/client/requests/UomsListRequest.ts
new file mode 100644
index 0000000..05c34a6
--- /dev/null
+++ b/src/api/resources/productUsage/client/requests/UomsListRequest.ts
@@ -0,0 +1,47 @@
+/**
+ * This file was auto-generated by Fern from our API Definition.
+ */
+
+import * as DevRev from "../../../../index";
+
+/**
+ * @example
+ * {}
+ */
+export interface UomsListRequest {
+ /** List of aggregation types for filtering list of UOMs. */
+ aggregationTypes?: DevRev.AggregationDetailAggregationType[];
+ /**
+ * The cursor to resume iteration from. If not provided, then
+ * iteration starts from the beginning.
+ *
+ */
+ cursor?: string;
+ /**
+ * List of Unit of Measurement (UOM) DONs to be used in filtering
+ * complete list of UOMs defined in a Dev Org.
+ *
+ */
+ ids?: string[];
+ /**
+ * The maximum number of UOMs to be returned in a response. The
+ * default is '50'.
+ *
+ */
+ limit?: number;
+ /** List of metric names for filtering list of UOMs. */
+ metricNames?: string[];
+ mode?: DevRev.ListMode;
+ /** List of part IDs for filtering list of UOMs. */
+ partIds?: string[];
+ /** List of product IDs for filtering list of UOMs. */
+ productIds?: string[];
+ /**
+ * Fields to sort the Unit Of Measuments (UOMs) by and the direction
+ * to sort them.
+ *
+ */
+ sortBy?: string[];
+ /** List of unit types for filtering list of UOMs. */
+ unitTypes?: DevRev.UnitType[];
+}
diff --git a/src/api/resources/productUsage/client/requests/UomsUpdateRequest.ts b/src/api/resources/productUsage/client/requests/UomsUpdateRequest.ts
new file mode 100644
index 0000000..5cf61ba
--- /dev/null
+++ b/src/api/resources/productUsage/client/requests/UomsUpdateRequest.ts
@@ -0,0 +1,53 @@
+/**
+ * This file was auto-generated by Fern from our API Definition.
+ */
+
+import * as DevRev from "../../../../index";
+
+/**
+ * @example
+ * {
+ * aggregationType: DevRev.AggregationDetailAggregationType.Duration,
+ * description: "string",
+ * dimensions: {
+ * add: ["string"],
+ * remove: ["string"]
+ * },
+ * id: "string",
+ * isEnabled: true,
+ * name: "string",
+ * partId: "string",
+ * productId: "string",
+ * unit: "string"
+ * }
+ */
+export interface UomsUpdateRequest {
+ aggregationType?: DevRev.AggregationDetailAggregationType;
+ /** Description of the Unit of Measurement (UOM). */
+ description?: string;
+ dimensions?: DevRev.UomsUpdateRequestDimensions;
+ /** The Unit of Measurement (UOM)'s DON. */
+ id: string;
+ /**
+ * Flag used to enable/disable the Unit of Measurement (UOM). When
+ * disabled, any metricsrecords ingested against this UOM will be
+ * dropped.
+ *
+ */
+ isEnabled?: boolean;
+ /** Human readable name of the Unit of Measurement (UOM). */
+ name?: string;
+ /**
+ * The part ID such as feature or capability for which the Unit of
+ * Measurement (UOM) is defined.
+ *
+ */
+ partId?: string;
+ /**
+ * The product ID for which the Unit of Measurement (UOM) is defined.
+ *
+ */
+ productId?: string;
+ /** Unit name of the Unit of Measurement (UOM). */
+ unit?: string;
+}
diff --git a/src/api/resources/productUsage/client/requests/index.ts b/src/api/resources/productUsage/client/requests/index.ts
new file mode 100644
index 0000000..fd4c376
--- /dev/null
+++ b/src/api/resources/productUsage/client/requests/index.ts
@@ -0,0 +1,10 @@
+export { type MetricsDataIngestRequest } from "./MetricsDataIngestRequest";
+export { type UomsCountQuery } from "./UomsCountQuery";
+export { type UomsCountRequest } from "./UomsCountRequest";
+export { type UomsCreateRequest } from "./UomsCreateRequest";
+export { type UomsDeleteRequest } from "./UomsDeleteRequest";
+export { type UomsGetQuery } from "./UomsGetQuery";
+export { type UomsGetRequest } from "./UomsGetRequest";
+export { type UomsListQuery } from "./UomsListQuery";
+export { type UomsListRequest } from "./UomsListRequest";
+export { type UomsUpdateRequest } from "./UomsUpdateRequest";
diff --git a/src/api/resources/productUsage/index.ts b/src/api/resources/productUsage/index.ts
new file mode 100644
index 0000000..5ec7692
--- /dev/null
+++ b/src/api/resources/productUsage/index.ts
@@ -0,0 +1 @@
+export * from "./client";
diff --git a/src/api/resources/questionAnswers/client/Client.ts b/src/api/resources/questionAnswers/client/Client.ts
new file mode 100644
index 0000000..88f3056
--- /dev/null
+++ b/src/api/resources/questionAnswers/client/Client.ts
@@ -0,0 +1,1095 @@
+/**
+ * This file was auto-generated by Fern from our API Definition.
+ */
+
+import * as environments from "../../../../environments";
+import * as core from "../../../../core";
+import * as DevRev from "../../../index";
+import * as serializers from "../../../../serialization/index";
+import urlJoin from "url-join";
+import * as errors from "../../../../errors/index";
+
+export declare namespace QuestionAnswers {
+ interface Options {
+ environment?: core.Supplier;
+ token?: 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;
+ }
+}
+
+export class QuestionAnswers {
+ constructor(protected readonly _options: QuestionAnswers.Options = {}) {}
+
+ /**
+ * Creates a question-answer.
+ *
+ * @param {DevRev.QuestionAnswersCreateRequest} request
+ * @param {QuestionAnswers.RequestOptions} requestOptions - Request-specific configuration.
+ *
+ * @throws {@link DevRev.BadRequestError}
+ * @throws {@link DevRev.UnauthorizedError}
+ * @throws {@link DevRev.ForbiddenError}
+ * @throws {@link DevRev.TooManyRequestsError}
+ * @throws {@link DevRev.InternalServerError}
+ * @throws {@link DevRev.ServiceUnavailableError}
+ *
+ * @example
+ * await client.questionAnswers.create({
+ * answer: "answer",
+ * appliesToParts: ["PROD-12345"],
+ * ownedBy: ["DEVU-12345"],
+ * question: "question",
+ * status: DevRev.QuestionAnswerStatus.Archived
+ * })
+ */
+ public async create(
+ request: DevRev.QuestionAnswersCreateRequest,
+ requestOptions?: QuestionAnswers.RequestOptions
+ ): Promise {
+ const _response = await (this._options.fetcher ?? core.fetcher)({
+ url: urlJoin(
+ (await core.Supplier.get(this._options.environment)) ?? environments.DevRevEnvironment.Default,
+ "question-answers.create"
+ ),
+ method: "POST",
+ headers: {
+ Authorization: await this._getAuthorizationHeader(),
+ "X-Fern-Language": "JavaScript",
+ "X-Fern-SDK-Name": "@devrev/api",
+ "X-Fern-SDK-Version": "0.0.14",
+ "X-Fern-Runtime": core.RUNTIME.type,
+ "X-Fern-Runtime-Version": core.RUNTIME.version,
+ },
+ contentType: "application/json",
+ requestType: "json",
+ body: serializers.QuestionAnswersCreateRequest.jsonOrThrow(request, { unrecognizedObjectKeys: "strip" }),
+ timeoutMs: requestOptions?.timeoutInSeconds != null ? requestOptions.timeoutInSeconds * 1000 : 60000,
+ maxRetries: requestOptions?.maxRetries,
+ abortSignal: requestOptions?.abortSignal,
+ });
+ if (_response.ok) {
+ return serializers.QuestionAnswersCreateResponse.parseOrThrow(_response.body, {
+ unrecognizedObjectKeys: "passthrough",
+ allowUnrecognizedUnionMembers: true,
+ allowUnrecognizedEnumValues: true,
+ skipValidation: true,
+ breadcrumbsPrefix: ["response"],
+ });
+ }
+
+ if (_response.error.reason === "status-code") {
+ switch (_response.error.statusCode) {
+ case 400:
+ throw new DevRev.BadRequestError(
+ serializers.ErrorBadRequest.parseOrThrow(_response.error.body, {
+ unrecognizedObjectKeys: "passthrough",
+ allowUnrecognizedUnionMembers: true,
+ allowUnrecognizedEnumValues: true,
+ skipValidation: true,
+ breadcrumbsPrefix: ["response"],
+ })
+ );
+ case 401:
+ throw new DevRev.UnauthorizedError(
+ serializers.ErrorUnauthorized.parseOrThrow(_response.error.body, {
+ unrecognizedObjectKeys: "passthrough",
+ allowUnrecognizedUnionMembers: true,
+ allowUnrecognizedEnumValues: true,
+ skipValidation: true,
+ breadcrumbsPrefix: ["response"],
+ })
+ );
+ case 403:
+ throw new DevRev.ForbiddenError(
+ serializers.ErrorForbidden.parseOrThrow(_response.error.body, {
+ unrecognizedObjectKeys: "passthrough",
+ allowUnrecognizedUnionMembers: true,
+ allowUnrecognizedEnumValues: true,
+ skipValidation: true,
+ breadcrumbsPrefix: ["response"],
+ })
+ );
+ case 429:
+ throw new DevRev.TooManyRequestsError(
+ serializers.ErrorTooManyRequests.parseOrThrow(_response.error.body, {
+ unrecognizedObjectKeys: "passthrough",
+ allowUnrecognizedUnionMembers: true,
+ allowUnrecognizedEnumValues: true,
+ skipValidation: true,
+ breadcrumbsPrefix: ["response"],
+ })
+ );
+ case 500:
+ throw new DevRev.InternalServerError(
+ serializers.ErrorInternalServerError.parseOrThrow(_response.error.body, {
+ unrecognizedObjectKeys: "passthrough",
+ allowUnrecognizedUnionMembers: true,
+ allowUnrecognizedEnumValues: true,
+ skipValidation: true,
+ breadcrumbsPrefix: ["response"],
+ })
+ );
+ case 503:
+ throw new DevRev.ServiceUnavailableError(
+ serializers.ErrorServiceUnavailable.parseOrThrow(_response.error.body, {
+ unrecognizedObjectKeys: "passthrough",
+ allowUnrecognizedUnionMembers: true,
+ allowUnrecognizedEnumValues: true,
+ skipValidation: true,
+ breadcrumbsPrefix: ["response"],
+ })
+ );
+ default:
+ throw new errors.DevRevError({
+ statusCode: _response.error.statusCode,
+ body: _response.error.body,
+ });
+ }
+ }
+
+ switch (_response.error.reason) {
+ case "non-json":
+ throw new errors.DevRevError({
+ statusCode: _response.error.statusCode,
+ body: _response.error.rawBody,
+ });
+ case "timeout":
+ throw new errors.DevRevTimeoutError();
+ case "unknown":
+ throw new errors.DevRevError({
+ message: _response.error.errorMessage,
+ });
+ }
+ }
+
+ /**
+ * Deletes a question-answer.
+ *
+ * @param {DevRev.QuestionAnswersDeleteRequest} request
+ * @param {QuestionAnswers.RequestOptions} requestOptions - Request-specific configuration.
+ *
+ * @throws {@link DevRev.BadRequestError}
+ * @throws {@link DevRev.UnauthorizedError}
+ * @throws {@link DevRev.ForbiddenError}
+ * @throws {@link DevRev.NotFoundError}
+ * @throws {@link DevRev.TooManyRequestsError}
+ * @throws {@link DevRev.InternalServerError}
+ * @throws {@link DevRev.ServiceUnavailableError}
+ *
+ * @example
+ * await client.questionAnswers.delete({
+ * id: "id"
+ * })
+ */
+ public async delete(
+ request: DevRev.QuestionAnswersDeleteRequest,
+ requestOptions?: QuestionAnswers.RequestOptions
+ ): Promise {
+ const _response = await (this._options.fetcher ?? core.fetcher)({
+ url: urlJoin(
+ (await core.Supplier.get(this._options.environment)) ?? environments.DevRevEnvironment.Default,
+ "question-answers.delete"
+ ),
+ method: "POST",
+ headers: {
+ Authorization: await this._getAuthorizationHeader(),
+ "X-Fern-Language": "JavaScript",
+ "X-Fern-SDK-Name": "@devrev/api",
+ "X-Fern-SDK-Version": "0.0.14",
+ "X-Fern-Runtime": core.RUNTIME.type,
+ "X-Fern-Runtime-Version": core.RUNTIME.version,
+ },
+ contentType: "application/json",
+ requestType: "json",
+ body: serializers.QuestionAnswersDeleteRequest.jsonOrThrow(request, { unrecognizedObjectKeys: "strip" }),
+ 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 DevRev.BadRequestError(
+ serializers.ErrorBadRequest.parseOrThrow(_response.error.body, {
+ unrecognizedObjectKeys: "passthrough",
+ allowUnrecognizedUnionMembers: true,
+ allowUnrecognizedEnumValues: true,
+ skipValidation: true,
+ breadcrumbsPrefix: ["response"],
+ })
+ );
+ case 401:
+ throw new DevRev.UnauthorizedError(
+ serializers.ErrorUnauthorized.parseOrThrow(_response.error.body, {
+ unrecognizedObjectKeys: "passthrough",
+ allowUnrecognizedUnionMembers: true,
+ allowUnrecognizedEnumValues: true,
+ skipValidation: true,
+ breadcrumbsPrefix: ["response"],
+ })
+ );
+ case 403:
+ throw new DevRev.ForbiddenError(
+ serializers.ErrorForbidden.parseOrThrow(_response.error.body, {
+ unrecognizedObjectKeys: "passthrough",
+ allowUnrecognizedUnionMembers: true,
+ allowUnrecognizedEnumValues: true,
+ skipValidation: true,
+ breadcrumbsPrefix: ["response"],
+ })
+ );
+ case 404:
+ throw new DevRev.NotFoundError(
+ serializers.ErrorNotFound.parseOrThrow(_response.error.body, {
+ unrecognizedObjectKeys: "passthrough",
+ allowUnrecognizedUnionMembers: true,
+ allowUnrecognizedEnumValues: true,
+ skipValidation: true,
+ breadcrumbsPrefix: ["response"],
+ })
+ );
+ case 429:
+ throw new DevRev.TooManyRequestsError(
+ serializers.ErrorTooManyRequests.parseOrThrow(_response.error.body, {
+ unrecognizedObjectKeys: "passthrough",
+ allowUnrecognizedUnionMembers: true,
+ allowUnrecognizedEnumValues: true,
+ skipValidation: true,
+ breadcrumbsPrefix: ["response"],
+ })
+ );
+ case 500:
+ throw new DevRev.InternalServerError(
+ serializers.ErrorInternalServerError.parseOrThrow(_response.error.body, {
+ unrecognizedObjectKeys: "passthrough",
+ allowUnrecognizedUnionMembers: true,
+ allowUnrecognizedEnumValues: true,
+ skipValidation: true,
+ breadcrumbsPrefix: ["response"],
+ })
+ );
+ case 503:
+ throw new DevRev.ServiceUnavailableError(
+ serializers.ErrorServiceUnavailable.parseOrThrow(_response.error.body, {
+ unrecognizedObjectKeys: "passthrough",
+ allowUnrecognizedUnionMembers: true,
+ allowUnrecognizedEnumValues: true,
+ skipValidation: true,
+ breadcrumbsPrefix: ["response"],
+ })
+ );
+ default:
+ throw new errors.DevRevError({
+ statusCode: _response.error.statusCode,
+ body: _response.error.body,
+ });
+ }
+ }
+
+ switch (_response.error.reason) {
+ case "non-json":
+ throw new errors.DevRevError({
+ statusCode: _response.error.statusCode,
+ body: _response.error.rawBody,
+ });
+ case "timeout":
+ throw new errors.DevRevTimeoutError();
+ case "unknown":
+ throw new errors.DevRevError({
+ message: _response.error.errorMessage,
+ });
+ }
+ }
+
+ /**
+ * Gets a question-answer.
+ *
+ * @param {DevRev.GetQuestionAnswerQuery} request
+ * @param {QuestionAnswers.RequestOptions} requestOptions - Request-specific configuration.
+ *
+ * @throws {@link DevRev.BadRequestError}
+ * @throws {@link DevRev.UnauthorizedError}
+ * @throws {@link DevRev.ForbiddenError}
+ * @throws {@link DevRev.NotFoundError}
+ * @throws {@link DevRev.TooManyRequestsError}
+ * @throws {@link DevRev.InternalServerError}
+ * @throws {@link DevRev.ServiceUnavailableError}
+ *
+ * @example
+ * await client.questionAnswers.get({
+ * id: "id"
+ * })
+ */
+ public async get(
+ request: DevRev.GetQuestionAnswerQuery,
+ requestOptions?: QuestionAnswers.RequestOptions
+ ): Promise {
+ const { id } = request;
+ const _queryParams: Record = {};
+ _queryParams["id"] = id;
+ const _response = await (this._options.fetcher ?? core.fetcher)({
+ url: urlJoin(
+ (await core.Supplier.get(this._options.environment)) ?? environments.DevRevEnvironment.Default,
+ "question-answers.get"
+ ),
+ method: "GET",
+ headers: {
+ Authorization: await this._getAuthorizationHeader(),
+ "X-Fern-Language": "JavaScript",
+ "X-Fern-SDK-Name": "@devrev/api",
+ "X-Fern-SDK-Version": "0.0.14",
+ "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 serializers.QuestionAnswersGetResponse.parseOrThrow(_response.body, {
+ unrecognizedObjectKeys: "passthrough",
+ allowUnrecognizedUnionMembers: true,
+ allowUnrecognizedEnumValues: true,
+ skipValidation: true,
+ breadcrumbsPrefix: ["response"],
+ });
+ }
+
+ if (_response.error.reason === "status-code") {
+ switch (_response.error.statusCode) {
+ case 400:
+ throw new DevRev.BadRequestError(
+ serializers.ErrorBadRequest.parseOrThrow(_response.error.body, {
+ unrecognizedObjectKeys: "passthrough",
+ allowUnrecognizedUnionMembers: true,
+ allowUnrecognizedEnumValues: true,
+ skipValidation: true,
+ breadcrumbsPrefix: ["response"],
+ })
+ );
+ case 401:
+ throw new DevRev.UnauthorizedError(
+ serializers.ErrorUnauthorized.parseOrThrow(_response.error.body, {
+ unrecognizedObjectKeys: "passthrough",
+ allowUnrecognizedUnionMembers: true,
+ allowUnrecognizedEnumValues: true,
+ skipValidation: true,
+ breadcrumbsPrefix: ["response"],
+ })
+ );
+ case 403:
+ throw new DevRev.ForbiddenError(
+ serializers.ErrorForbidden.parseOrThrow(_response.error.body, {
+ unrecognizedObjectKeys: "passthrough",
+ allowUnrecognizedUnionMembers: true,
+ allowUnrecognizedEnumValues: true,
+ skipValidation: true,
+ breadcrumbsPrefix: ["response"],
+ })
+ );
+ case 404:
+ throw new DevRev.NotFoundError(
+ serializers.ErrorNotFound.parseOrThrow(_response.error.body, {
+ unrecognizedObjectKeys: "passthrough",
+ allowUnrecognizedUnionMembers: true,
+ allowUnrecognizedEnumValues: true,
+ skipValidation: true,
+ breadcrumbsPrefix: ["response"],
+ })
+ );
+ case 429:
+ throw new DevRev.TooManyRequestsError(
+ serializers.ErrorTooManyRequests.parseOrThrow(_response.error.body, {
+ unrecognizedObjectKeys: "passthrough",
+ allowUnrecognizedUnionMembers: true,
+ allowUnrecognizedEnumValues: true,
+ skipValidation: true,
+ breadcrumbsPrefix: ["response"],
+ })
+ );
+ case 500:
+ throw new DevRev.InternalServerError(
+ serializers.ErrorInternalServerError.parseOrThrow(_response.error.body, {
+ unrecognizedObjectKeys: "passthrough",
+ allowUnrecognizedUnionMembers: true,
+ allowUnrecognizedEnumValues: true,
+ skipValidation: true,
+ breadcrumbsPrefix: ["response"],
+ })
+ );
+ case 503:
+ throw new DevRev.ServiceUnavailableError(
+ serializers.ErrorServiceUnavailable.parseOrThrow(_response.error.body, {
+ unrecognizedObjectKeys: "passthrough",
+ allowUnrecognizedUnionMembers: true,
+ allowUnrecognizedEnumValues: true,
+ skipValidation: true,
+ breadcrumbsPrefix: ["response"],
+ })
+ );
+ default:
+ throw new errors.DevRevError({
+ statusCode: _response.error.statusCode,
+ body: _response.error.body,
+ });
+ }
+ }
+
+ switch (_response.error.reason) {
+ case "non-json":
+ throw new errors.DevRevError({
+ statusCode: _response.error.statusCode,
+ body: _response.error.rawBody,
+ });
+ case "timeout":
+ throw new errors.DevRevTimeoutError();
+ case "unknown":
+ throw new errors.DevRevError({
+ message: _response.error.errorMessage,
+ });
+ }
+ }
+
+ /**
+ * Gets a question-answer.
+ *
+ * @param {DevRev.QuestionAnswersGetRequest} request
+ * @param {QuestionAnswers.RequestOptions} requestOptions - Request-specific configuration.
+ *
+ * @throws {@link DevRev.BadRequestError}
+ * @throws {@link DevRev.UnauthorizedError}
+ * @throws {@link DevRev.ForbiddenError}
+ * @throws {@link DevRev.NotFoundError}
+ * @throws {@link DevRev.TooManyRequestsError}
+ * @throws {@link DevRev.InternalServerError}
+ * @throws {@link DevRev.ServiceUnavailableError}
+ *
+ * @example
+ * await client.questionAnswers.getPost({
+ * id: "id"
+ * })
+ */
+ public async getPost(
+ request: DevRev.QuestionAnswersGetRequest,
+ requestOptions?: QuestionAnswers.RequestOptions
+ ): Promise {
+ const _response = await (this._options.fetcher ?? core.fetcher)({
+ url: urlJoin(
+ (await core.Supplier.get(this._options.environment)) ?? environments.DevRevEnvironment.Default,
+ "question-answers.get"
+ ),
+ method: "POST",
+ headers: {
+ Authorization: await this._getAuthorizationHeader(),
+ "X-Fern-Language": "JavaScript",
+ "X-Fern-SDK-Name": "@devrev/api",
+ "X-Fern-SDK-Version": "0.0.14",
+ "X-Fern-Runtime": core.RUNTIME.type,
+ "X-Fern-Runtime-Version": core.RUNTIME.version,
+ },
+ contentType: "application/json",
+ requestType: "json",
+ body: serializers.QuestionAnswersGetRequest.jsonOrThrow(request, { unrecognizedObjectKeys: "strip" }),
+ timeoutMs: requestOptions?.timeoutInSeconds != null ? requestOptions.timeoutInSeconds * 1000 : 60000,
+ maxRetries: requestOptions?.maxRetries,
+ abortSignal: requestOptions?.abortSignal,
+ });
+ if (_response.ok) {
+ return serializers.QuestionAnswersGetResponse.parseOrThrow(_response.body, {
+ unrecognizedObjectKeys: "passthrough",
+ allowUnrecognizedUnionMembers: true,
+ allowUnrecognizedEnumValues: true,
+ skipValidation: true,
+ breadcrumbsPrefix: ["response"],
+ });
+ }
+
+ if (_response.error.reason === "status-code") {
+ switch (_response.error.statusCode) {
+ case 400:
+ throw new DevRev.BadRequestError(
+ serializers.ErrorBadRequest.parseOrThrow(_response.error.body, {
+ unrecognizedObjectKeys: "passthrough",
+ allowUnrecognizedUnionMembers: true,
+ allowUnrecognizedEnumValues: true,
+ skipValidation: true,
+ breadcrumbsPrefix: ["response"],
+ })
+ );
+ case 401:
+ throw new DevRev.UnauthorizedError(
+ serializers.ErrorUnauthorized.parseOrThrow(_response.error.body, {
+ unrecognizedObjectKeys: "passthrough",
+ allowUnrecognizedUnionMembers: true,
+ allowUnrecognizedEnumValues: true,
+ skipValidation: true,
+ breadcrumbsPrefix: ["response"],
+ })
+ );
+ case 403:
+ throw new DevRev.ForbiddenError(
+ serializers.ErrorForbidden.parseOrThrow(_response.error.body, {
+ unrecognizedObjectKeys: "passthrough",
+ allowUnrecognizedUnionMembers: true,
+ allowUnrecognizedEnumValues: true,
+ skipValidation: true,
+ breadcrumbsPrefix: ["response"],
+ })
+ );
+ case 404:
+ throw new DevRev.NotFoundError(
+ serializers.ErrorNotFound.parseOrThrow(_response.error.body, {
+ unrecognizedObjectKeys: "passthrough",
+ allowUnrecognizedUnionMembers: true,
+ allowUnrecognizedEnumValues: true,
+ skipValidation: true,
+ breadcrumbsPrefix: ["response"],
+ })
+ );
+ case 429:
+ throw new DevRev.TooManyRequestsError(
+ serializers.ErrorTooManyRequests.parseOrThrow(_response.error.body, {
+ unrecognizedObjectKeys: "passthrough",
+ allowUnrecognizedUnionMembers: true,
+ allowUnrecognizedEnumValues: true,
+ skipValidation: true,
+ breadcrumbsPrefix: ["response"],
+ })
+ );
+ case 500:
+ throw new DevRev.InternalServerError(
+ serializers.ErrorInternalServerError.parseOrThrow(_response.error.body, {
+ unrecognizedObjectKeys: "passthrough",
+ allowUnrecognizedUnionMembers: true,
+ allowUnrecognizedEnumValues: true,
+ skipValidation: true,
+ breadcrumbsPrefix: ["response"],
+ })
+ );
+ case 503:
+ throw new DevRev.ServiceUnavailableError(
+ serializers.ErrorServiceUnavailable.parseOrThrow(_response.error.body, {
+ unrecognizedObjectKeys: "passthrough",
+ allowUnrecognizedUnionMembers: true,
+ allowUnrecognizedEnumValues: true,
+ skipValidation: true,
+ breadcrumbsPrefix: ["response"],
+ })
+ );
+ default:
+ throw new errors.DevRevError({
+ statusCode: _response.error.statusCode,
+ body: _response.error.body,
+ });
+ }
+ }
+
+ switch (_response.error.reason) {
+ case "non-json":
+ throw new errors.DevRevError({
+ statusCode: _response.error.statusCode,
+ body: _response.error.rawBody,
+ });
+ case "timeout":
+ throw new errors.DevRevTimeoutError();
+ case "unknown":
+ throw new errors.DevRevError({
+ message: _response.error.errorMessage,
+ });
+ }
+ }
+
+ /**
+ * Lists a collection of question-answers.
+ *
+ * @param {DevRev.ListQuestionAnswersQuery} request
+ * @param {QuestionAnswers.RequestOptions} requestOptions - Request-specific configuration.
+ *
+ * @throws {@link DevRev.BadRequestError}
+ * @throws {@link DevRev.UnauthorizedError}
+ * @throws {@link DevRev.ForbiddenError}
+ * @throws {@link DevRev.TooManyRequestsError}
+ * @throws {@link DevRev.InternalServerError}
+ * @throws {@link DevRev.ServiceUnavailableError}
+ *
+ * @example
+ * await client.questionAnswers.list()
+ */
+ public async list(
+ request: DevRev.ListQuestionAnswersQuery = {},
+ requestOptions?: QuestionAnswers.RequestOptions
+ ): Promise {
+ const { appliesToArticles, appliesToParts, createdBy, cursor, limit, mode, ownedBy } = request;
+ const _queryParams: Record = {};
+ if (appliesToArticles != null) {
+ if (Array.isArray(appliesToArticles)) {
+ _queryParams["applies_to_articles"] = appliesToArticles.map((item) => item);
+ } else {
+ _queryParams["applies_to_articles"] = appliesToArticles;
+ }
+ }
+
+ if (appliesToParts != null) {
+ if (Array.isArray(appliesToParts)) {
+ _queryParams["applies_to_parts"] = appliesToParts.map((item) => item);
+ } else {
+ _queryParams["applies_to_parts"] = appliesToParts;
+ }
+ }
+
+ if (createdBy != null) {
+ if (Array.isArray(createdBy)) {
+ _queryParams["created_by"] = createdBy.map((item) => item);
+ } else {
+ _queryParams["created_by"] = createdBy;
+ }
+ }
+
+ if (cursor != null) {
+ _queryParams["cursor"] = cursor;
+ }
+
+ if (limit != null) {
+ _queryParams["limit"] = limit.toString();
+ }
+
+ if (mode != null) {
+ _queryParams["mode"] = mode;
+ }
+
+ if (ownedBy != null) {
+ if (Array.isArray(ownedBy)) {
+ _queryParams["owned_by"] = ownedBy.map((item) => item);
+ } else {
+ _queryParams["owned_by"] = ownedBy;
+ }
+ }
+
+ const _response = await (this._options.fetcher ?? core.fetcher)({
+ url: urlJoin(
+ (await core.Supplier.get(this._options.environment)) ?? environments.DevRevEnvironment.Default,
+ "question-answers.list"
+ ),
+ method: "GET",
+ headers: {
+ Authorization: await this._getAuthorizationHeader(),
+ "X-Fern-Language": "JavaScript",
+ "X-Fern-SDK-Name": "@devrev/api",
+ "X-Fern-SDK-Version": "0.0.14",
+ "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 serializers.QuestionAnswersListResponse.parseOrThrow(_response.body, {
+ unrecognizedObjectKeys: "passthrough",
+ allowUnrecognizedUnionMembers: true,
+ allowUnrecognizedEnumValues: true,
+ skipValidation: true,
+ breadcrumbsPrefix: ["response"],
+ });
+ }
+
+ if (_response.error.reason === "status-code") {
+ switch (_response.error.statusCode) {
+ case 400:
+ throw new DevRev.BadRequestError(
+ serializers.ErrorBadRequest.parseOrThrow(_response.error.body, {
+ unrecognizedObjectKeys: "passthrough",
+ allowUnrecognizedUnionMembers: true,
+ allowUnrecognizedEnumValues: true,
+ skipValidation: true,
+ breadcrumbsPrefix: ["response"],
+ })
+ );
+ case 401:
+ throw new DevRev.UnauthorizedError(
+ serializers.ErrorUnauthorized.parseOrThrow(_response.error.body, {
+ unrecognizedObjectKeys: "passthrough",
+ allowUnrecognizedUnionMembers: true,
+ allowUnrecognizedEnumValues: true,
+ skipValidation: true,
+ breadcrumbsPrefix: ["response"],
+ })
+ );
+ case 403:
+ throw new DevRev.ForbiddenError(
+ serializers.ErrorForbidden.parseOrThrow(_response.error.body, {
+ unrecognizedObjectKeys: "passthrough",
+ allowUnrecognizedUnionMembers: true,
+ allowUnrecognizedEnumValues: true,
+ skipValidation: true,
+ breadcrumbsPrefix: ["response"],
+ })
+ );
+ case 429:
+ throw new DevRev.TooManyRequestsError(
+ serializers.ErrorTooManyRequests.parseOrThrow(_response.error.body, {
+ unrecognizedObjectKeys: "passthrough",
+ allowUnrecognizedUnionMembers: true,
+ allowUnrecognizedEnumValues: true,
+ skipValidation: true,
+ breadcrumbsPrefix: ["response"],
+ })
+ );
+ case 500:
+ throw new DevRev.InternalServerError(
+ serializers.ErrorInternalServerError.parseOrThrow(_response.error.body, {
+ unrecognizedObjectKeys: "passthrough",
+ allowUnrecognizedUnionMembers: true,
+ allowUnrecognizedEnumValues: true,
+ skipValidation: true,
+ breadcrumbsPrefix: ["response"],
+ })
+ );
+ case 503:
+ throw new DevRev.ServiceUnavailableError(
+ serializers.ErrorServiceUnavailable.parseOrThrow(_response.error.body, {
+ unrecognizedObjectKeys: "passthrough",
+ allowUnrecognizedUnionMembers: true,
+ allowUnrecognizedEnumValues: true,
+ skipValidation: true,
+ breadcrumbsPrefix: ["response"],
+ })
+ );
+ default:
+ throw new errors.DevRevError({
+ statusCode: _response.error.statusCode,
+ body: _response.error.body,
+ });
+ }
+ }
+
+ switch (_response.error.reason) {
+ case "non-json":
+ throw new errors.DevRevError({
+ statusCode: _response.error.statusCode,
+ body: _response.error.rawBody,
+ });
+ case "timeout":
+ throw new errors.DevRevTimeoutError();
+ case "unknown":
+ throw new errors.DevRevError({
+ message: _response.error.errorMessage,
+ });
+ }
+ }
+
+ /**
+ * Lists a collection of question-answers.
+ *
+ * @param {DevRev.QuestionAnswersListRequest} request
+ * @param {QuestionAnswers.RequestOptions} requestOptions - Request-specific configuration.
+ *
+ * @throws {@link DevRev.BadRequestError}
+ * @throws {@link DevRev.UnauthorizedError}
+ * @throws {@link DevRev.ForbiddenError}
+ * @throws {@link DevRev.TooManyRequestsError}
+ * @throws {@link DevRev.InternalServerError}
+ * @throws {@link DevRev.ServiceUnavailableError}
+ *
+ * @example
+ * await client.questionAnswers.listPost()
+ */
+ public async listPost(
+ request: DevRev.QuestionAnswersListRequest = {},
+ requestOptions?: QuestionAnswers.RequestOptions
+ ): Promise {
+ const _response = await (this._options.fetcher ?? core.fetcher)({
+ url: urlJoin(
+ (await core.Supplier.get(this._options.environment)) ?? environments.DevRevEnvironment.Default,
+ "question-answers.list"
+ ),
+ method: "POST",
+ headers: {
+ Authorization: await this._getAuthorizationHeader(),
+ "X-Fern-Language": "JavaScript",
+ "X-Fern-SDK-Name": "@devrev/api",
+ "X-Fern-SDK-Version": "0.0.14",
+ "X-Fern-Runtime": core.RUNTIME.type,
+ "X-Fern-Runtime-Version": core.RUNTIME.version,
+ },
+ contentType: "application/json",
+ requestType: "json",
+ body: serializers.QuestionAnswersListRequest.jsonOrThrow(request, { unrecognizedObjectKeys: "strip" }),
+ timeoutMs: requestOptions?.timeoutInSeconds != null ? requestOptions.timeoutInSeconds * 1000 : 60000,
+ maxRetries: requestOptions?.maxRetries,
+ abortSignal: requestOptions?.abortSignal,
+ });
+ if (_response.ok) {
+ return serializers.QuestionAnswersListResponse.parseOrThrow(_response.body, {
+ unrecognizedObjectKeys: "passthrough",
+ allowUnrecognizedUnionMembers: true,
+ allowUnrecognizedEnumValues: true,
+ skipValidation: true,
+ breadcrumbsPrefix: ["response"],
+ });
+ }
+
+ if (_response.error.reason === "status-code") {
+ switch (_response.error.statusCode) {
+ case 400:
+ throw new DevRev.BadRequestError(
+ serializers.ErrorBadRequest.parseOrThrow(_response.error.body, {
+ unrecognizedObjectKeys: "passthrough",
+ allowUnrecognizedUnionMembers: true,
+ allowUnrecognizedEnumValues: true,
+ skipValidation: true,
+ breadcrumbsPrefix: ["response"],
+ })
+ );
+ case 401:
+ throw new DevRev.UnauthorizedError(
+ serializers.ErrorUnauthorized.parseOrThrow(_response.error.body, {
+ unrecognizedObjectKeys: "passthrough",
+ allowUnrecognizedUnionMembers: true,
+ allowUnrecognizedEnumValues: true,
+ skipValidation: true,
+ breadcrumbsPrefix: ["response"],
+ })
+ );
+ case 403:
+ throw new DevRev.ForbiddenError(
+ serializers.ErrorForbidden.parseOrThrow(_response.error.body, {
+ unrecognizedObjectKeys: "passthrough",
+ allowUnrecognizedUnionMembers: true,
+ allowUnrecognizedEnumValues: true,
+ skipValidation: true,
+ breadcrumbsPrefix: ["response"],
+ })
+ );
+ case 429:
+ throw new DevRev.TooManyRequestsError(
+ serializers.ErrorTooManyRequests.parseOrThrow(_response.error.body, {
+ unrecognizedObjectKeys: "passthrough",
+ allowUnrecognizedUnionMembers: true,
+ allowUnrecognizedEnumValues: true,
+ skipValidation: true,
+ breadcrumbsPrefix: ["response"],
+ })
+ );
+ case 500:
+ throw new DevRev.InternalServerError(
+ serializers.ErrorInternalServerError.parseOrThrow(_response.error.body, {
+ unrecognizedObjectKeys: "passthrough",
+ allowUnrecognizedUnionMembers: true,
+ allowUnrecognizedEnumValues: true,
+ skipValidation: true,
+ breadcrumbsPrefix: ["response"],
+ })
+ );
+ case 503:
+ throw new DevRev.ServiceUnavailableError(
+ serializers.ErrorServiceUnavailable.parseOrThrow(_response.error.body, {
+ unrecognizedObjectKeys: "passthrough",
+ allowUnrecognizedUnionMembers: true,
+ allowUnrecognizedEnumValues: true,
+ skipValidation: true,
+ breadcrumbsPrefix: ["response"],
+ })
+ );
+ default:
+ throw new errors.DevRevError({
+ statusCode: _response.error.statusCode,
+ body: _response.error.body,
+ });
+ }
+ }
+
+ switch (_response.error.reason) {
+ case "non-json":
+ throw new errors.DevRevError({
+ statusCode: _response.error.statusCode,
+ body: _response.error.rawBody,
+ });
+ case "timeout":
+ throw new errors.DevRevTimeoutError();
+ case "unknown":
+ throw new errors.DevRevError({
+ message: _response.error.errorMessage,
+ });
+ }
+ }
+
+ /**
+ * Updates a question-answer.
+ *
+ * @param {DevRev.QuestionAnswersUpdateRequest} request
+ * @param {QuestionAnswers.RequestOptions} requestOptions - Request-specific configuration.
+ *
+ * @throws {@link DevRev.BadRequestError}
+ * @throws {@link DevRev.UnauthorizedError}
+ * @throws {@link DevRev.ForbiddenError}
+ * @throws {@link DevRev.NotFoundError}
+ * @throws {@link DevRev.TooManyRequestsError}
+ * @throws {@link DevRev.InternalServerError}
+ * @throws {@link DevRev.ServiceUnavailableError}
+ *
+ * @example
+ * await client.questionAnswers.update({
+ * id: "id"
+ * })
+ */
+ public async update(
+ request: DevRev.QuestionAnswersUpdateRequest,
+ requestOptions?: QuestionAnswers.RequestOptions
+ ): Promise {
+ const _response = await (this._options.fetcher ?? core.fetcher)({
+ url: urlJoin(
+ (await core.Supplier.get(this._options.environment)) ?? environments.DevRevEnvironment.Default,
+ "question-answers.update"
+ ),
+ method: "POST",
+ headers: {
+ Authorization: await this._getAuthorizationHeader(),
+ "X-Fern-Language": "JavaScript",
+ "X-Fern-SDK-Name": "@devrev/api",
+ "X-Fern-SDK-Version": "0.0.14",
+ "X-Fern-Runtime": core.RUNTIME.type,
+ "X-Fern-Runtime-Version": core.RUNTIME.version,
+ },
+ contentType: "application/json",
+ requestType: "json",
+ body: serializers.QuestionAnswersUpdateRequest.jsonOrThrow(request, { unrecognizedObjectKeys: "strip" }),
+ timeoutMs: requestOptions?.timeoutInSeconds != null ? requestOptions.timeoutInSeconds * 1000 : 60000,
+ maxRetries: requestOptions?.maxRetries,
+ abortSignal: requestOptions?.abortSignal,
+ });
+ if (_response.ok) {
+ return serializers.QuestionAnswersUpdateResponse.parseOrThrow(_response.body, {
+ unrecognizedObjectKeys: "passthrough",
+ allowUnrecognizedUnionMembers: true,
+ allowUnrecognizedEnumValues: true,
+ skipValidation: true,
+ breadcrumbsPrefix: ["response"],
+ });
+ }
+
+ if (_response.error.reason === "status-code") {
+ switch (_response.error.statusCode) {
+ case 400:
+ throw new DevRev.BadRequestError(
+ serializers.ErrorBadRequest.parseOrThrow(_response.error.body, {
+ unrecognizedObjectKeys: "passthrough",
+ allowUnrecognizedUnionMembers: true,
+ allowUnrecognizedEnumValues: true,
+ skipValidation: true,
+ breadcrumbsPrefix: ["response"],
+ })
+ );
+ case 401:
+ throw new DevRev.UnauthorizedError(
+ serializers.ErrorUnauthorized.parseOrThrow(_response.error.body, {
+ unrecognizedObjectKeys: "passthrough",
+ allowUnrecognizedUnionMembers: true,
+ allowUnrecognizedEnumValues: true,
+ skipValidation: true,
+ breadcrumbsPrefix: ["response"],
+ })
+ );
+ case 403:
+ throw new DevRev.ForbiddenError(
+ serializers.ErrorForbidden.parseOrThrow(_response.error.body, {
+ unrecognizedObjectKeys: "passthrough",
+ allowUnrecognizedUnionMembers: true,
+ allowUnrecognizedEnumValues: true,
+ skipValidation: true,
+ breadcrumbsPrefix: ["response"],
+ })
+ );
+ case 404:
+ throw new DevRev.NotFoundError(
+ serializers.ErrorNotFound.parseOrThrow(_response.error.body, {
+ unrecognizedObjectKeys: "passthrough",
+ allowUnrecognizedUnionMembers: true,
+ allowUnrecognizedEnumValues: true,
+ skipValidation: true,
+ breadcrumbsPrefix: ["response"],
+ })
+ );
+ case 429:
+ throw new DevRev.TooManyRequestsError(
+ serializers.ErrorTooManyRequests.parseOrThrow(_response.error.body, {
+ unrecognizedObjectKeys: "passthrough",
+ allowUnrecognizedUnionMembers: true,
+ allowUnrecognizedEnumValues: true,
+ skipValidation: true,
+ breadcrumbsPrefix: ["response"],
+ })
+ );
+ case 500:
+ throw new DevRev.InternalServerError(
+ serializers.ErrorInternalServerError.parseOrThrow(_response.error.body, {
+ unrecognizedObjectKeys: "passthrough",
+ allowUnrecognizedUnionMembers: true,
+ allowUnrecognizedEnumValues: true,
+ skipValidation: true,
+ breadcrumbsPrefix: ["response"],
+ })
+ );
+ case 503:
+ throw new DevRev.ServiceUnavailableError(
+ serializers.ErrorServiceUnavailable.parseOrThrow(_response.error.body, {
+ unrecognizedObjectKeys: "passthrough",
+ allowUnrecognizedUnionMembers: true,
+ allowUnrecognizedEnumValues: true,
+ skipValidation: true,
+ breadcrumbsPrefix: ["response"],
+ })
+ );
+ default:
+ throw new errors.DevRevError({
+ statusCode: _response.error.statusCode,
+ body: _response.error.body,
+ });
+ }
+ }
+
+ switch (_response.error.reason) {
+ case "non-json":
+ throw new errors.DevRevError({
+ statusCode: _response.error.statusCode,
+ body: _response.error.rawBody,
+ });
+ case "timeout":
+ throw new errors.DevRevTimeoutError();
+ case "unknown":
+ throw new errors.DevRevError({
+ message: _response.error.errorMessage,
+ });
+ }
+ }
+
+ protected async _getAuthorizationHeader(): Promise {
+ const bearer = (await core.Supplier.get(this._options.token)) ?? process?.env["DEVREV_TOKEN"];
+ if (bearer == null) {
+ throw new errors.DevRevError({
+ message: "Please specify DEVREV_TOKEN when instantiating the client.",
+ });
+ }
+
+ return `Bearer ${bearer}`;
+ }
+}
diff --git a/src/api/resources/questionAnswers/client/index.ts b/src/api/resources/questionAnswers/client/index.ts
new file mode 100644
index 0000000..415726b
--- /dev/null
+++ b/src/api/resources/questionAnswers/client/index.ts
@@ -0,0 +1 @@
+export * from "./requests";
diff --git a/src/api/resources/questionAnswers/client/requests/GetQuestionAnswerQuery.ts b/src/api/resources/questionAnswers/client/requests/GetQuestionAnswerQuery.ts
new file mode 100644
index 0000000..99b354e
--- /dev/null
+++ b/src/api/resources/questionAnswers/client/requests/GetQuestionAnswerQuery.ts
@@ -0,0 +1,16 @@
+/**
+ * This file was auto-generated by Fern from our API Definition.
+ */
+
+/**
+ * @example
+ * {
+ * id: "id"
+ * }
+ */
+export interface GetQuestionAnswerQuery {
+ /**
+ * The ID of the required question-answer.
+ */
+ id: string;
+}
diff --git a/src/api/resources/questionAnswers/client/requests/ListQuestionAnswersQuery.ts b/src/api/resources/questionAnswers/client/requests/ListQuestionAnswersQuery.ts
new file mode 100644
index 0000000..03f71b1
--- /dev/null
+++ b/src/api/resources/questionAnswers/client/requests/ListQuestionAnswersQuery.ts
@@ -0,0 +1,44 @@
+/**
+ * This file was auto-generated by Fern from our API Definition.
+ */
+
+import * as DevRev from "../../../../index";
+
+/**
+ * @example
+ * {}
+ */
+export interface ListQuestionAnswersQuery {
+ /**
+ * Filters for question-answer belonging to any of the provided
+ * articles.
+ */
+ appliesToArticles?: string | string[];
+ /**
+ * Filters for question-answer belonging to any of the provided parts.
+ */
+ appliesToParts?: string | string[];
+ /**
+ * Filters for question-answers created by any of the provided users.
+ */
+ createdBy?: string | string[];
+ /**
+ * The cursor to resume iteration from. If not provided, then iteration
+ * starts from the beginning.
+ */
+ cursor?: string;
+ /**
+ * The maximum number of question-answers to return. The default is
+ * '50'.
+ */
+ limit?: number;
+ /**
+ * The iteration mode to use, otherwise if not set, then "after" is
+ * used.
+ */
+ mode?: DevRev.ListMode;
+ /**
+ * Filters for question-answers owned by any of the provided users.
+ */
+ ownedBy?: string | string[];
+}
diff --git a/src/api/resources/questionAnswers/client/requests/QuestionAnswersCreateRequest.ts b/src/api/resources/questionAnswers/client/requests/QuestionAnswersCreateRequest.ts
new file mode 100644
index 0000000..76d116c
--- /dev/null
+++ b/src/api/resources/questionAnswers/client/requests/QuestionAnswersCreateRequest.ts
@@ -0,0 +1,58 @@
+/**
+ * This file was auto-generated by Fern from our API Definition.
+ */
+
+import * as DevRev from "../../../../index";
+
+/**
+ * @example
+ * {
+ * answer: "answer",
+ * appliesToParts: ["PROD-12345"],
+ * ownedBy: ["DEVU-12345"],
+ * question: "question",
+ * status: DevRev.QuestionAnswerStatus.Archived
+ * }
+ */
+export interface QuestionAnswersCreateRequest {
+ accessLevel?: DevRev.AccessLevel;
+ /** Answer of the question-answer. */
+ answer: string;
+ /** The articles that the question-answer applies to. */
+ appliesToArticles?: string[];
+ /** The parts that the question-answer applies to. */
+ appliesToParts: string[];
+ /** The users that own the question-answer. */
+ ownedBy: string[];
+ /** Question of the question-answer. */
+ question: string;
+ /**
+ * Information about the role the member receives due to the share.
+ *
+ */
+ sharedWith?: DevRev.SetSharedWithMembership[];
+ /** The source of the question-answer. */
+ sources?: string[];
+ status: DevRev.QuestionAnswerStatus;
+ /**
+ * Alternative answer for the question-answer sugested by Q/A
+ * Discovery.
+ *
+ */
+ suggestedAnswer?: string;
+ /**
+ * Whether the question-answer was suggeste to be deleted by Q/A
+ * Discovery.
+ *
+ */
+ suggestedForDeletion?: boolean;
+ /** Tags associated with the question-answer. */
+ tags?: DevRev.SetTagWithValue[];
+ /** Topic of the question-answer. */
+ topic?: string;
+ /**
+ * Whether the question-answer was verified by a user or not.
+ *
+ */
+ verified?: boolean;
+}
diff --git a/src/api/resources/questionAnswers/client/requests/QuestionAnswersDeleteRequest.ts b/src/api/resources/questionAnswers/client/requests/QuestionAnswersDeleteRequest.ts
new file mode 100644
index 0000000..d47ec77
--- /dev/null
+++ b/src/api/resources/questionAnswers/client/requests/QuestionAnswersDeleteRequest.ts
@@ -0,0 +1,16 @@
+/**
+ * This file was auto-generated by Fern from our API Definition.
+ */
+
+/**
+ * @example
+ * {
+ * id: "id"
+ * }
+ */
+export interface QuestionAnswersDeleteRequest {
+ /** The ID of the question-answer. */
+ id: string;
+ /** The ID of the question-answer. */
+ questionAnswerId?: string;
+}
diff --git a/src/api/resources/questionAnswers/client/requests/QuestionAnswersGetRequest.ts b/src/api/resources/questionAnswers/client/requests/QuestionAnswersGetRequest.ts
new file mode 100644
index 0000000..18a16ed
--- /dev/null
+++ b/src/api/resources/questionAnswers/client/requests/QuestionAnswersGetRequest.ts
@@ -0,0 +1,14 @@
+/**
+ * This file was auto-generated by Fern from our API Definition.
+ */
+
+/**
+ * @example
+ * {
+ * id: "id"
+ * }
+ */
+export interface QuestionAnswersGetRequest {
+ /** The ID of the required question-answer. */
+ id: string;
+}
diff --git a/src/api/resources/questionAnswers/client/requests/QuestionAnswersListRequest.ts b/src/api/resources/questionAnswers/client/requests/QuestionAnswersListRequest.ts
new file mode 100644
index 0000000..7debdc4
--- /dev/null
+++ b/src/api/resources/questionAnswers/client/requests/QuestionAnswersListRequest.ts
@@ -0,0 +1,46 @@
+/**
+ * This file was auto-generated by Fern from our API Definition.
+ */
+
+import * as DevRev from "../../../../index";
+
+/**
+ * @example
+ * {}
+ */
+export interface QuestionAnswersListRequest {
+ /**
+ * Filters for question-answer belonging to any of the provided
+ * articles.
+ *
+ */
+ appliesToArticles?: string[];
+ /**
+ * Filters for question-answer belonging to any of the provided parts.
+ *
+ */
+ appliesToParts?: string[];
+ /**
+ * Filters for question-answers created by any of the provided users.
+ *
+ */
+ createdBy?: string[];
+ /**
+ * The cursor to resume iteration from. If not provided, then
+ * iteration starts from the beginning.
+ *
+ */
+ cursor?: string;
+ /**
+ * The maximum number of question-answers to return. The default is
+ * '50'.
+ *
+ */
+ limit?: number;
+ mode?: DevRev.ListMode;
+ /**
+ * Filters for question-answers owned by any of the provided users.
+ *
+ */
+ ownedBy?: string[];
+}
diff --git a/src/api/resources/questionAnswers/client/requests/QuestionAnswersUpdateRequest.ts b/src/api/resources/questionAnswers/client/requests/QuestionAnswersUpdateRequest.ts
new file mode 100644
index 0000000..4b8222b
--- /dev/null
+++ b/src/api/resources/questionAnswers/client/requests/QuestionAnswersUpdateRequest.ts
@@ -0,0 +1,59 @@
+/**
+ * This file was auto-generated by Fern from our API Definition.
+ */
+
+import * as DevRev from "../../../../index";
+
+/**
+ * @example
+ * {
+ * id: "id"
+ * }
+ */
+export interface QuestionAnswersUpdateRequest {
+ accessLevel?: DevRev.AccessLevel;
+ /**
+ * Updated answer of the question-answer object, or unchanged if not
+ * provided.
+ *
+ */
+ answer?: string;
+ appliesToArticles?: DevRev.QuestionAnswersUpdateRequestAppliesToArticles;
+ appliesToParts?: DevRev.QuestionAnswersUpdateRequestAppliesToParts;
+ /** The question-answer's ID. */
+ id: string;
+ ownedBy?: DevRev.QuestionAnswersUpdateRequestOwnedBy;
+ /**
+ * Updated question of the question-answer object, or unchanged if not
+ * provided.
+ *
+ */
+ question?: string;
+ sharedWith?: DevRev.QuestionAnswersUpdateRequestSharedWith;
+ sources?: DevRev.QuestionAnswersUpdateRequestSources;
+ status?: DevRev.QuestionAnswerStatus;
+ /**
+ * Updated suggested_answer of the question-answer object, or
+ * unchanged if not provided.
+ *
+ */
+ suggestedAnswer?: string;
+ /**
+ * Updated suggested_for_deletion of the question-answer object, or
+ * unchanged if not provided.
+ *
+ */
+ suggestedForDeletion?: boolean;
+ tags?: DevRev.QuestionAnswersUpdateRequestTags;
+ /**
+ * Updated topic of the question-answer object, or unchanged if not
+ * provided.
+ *
+ */
+ topic?: string;
+ /**
+ * Updates whether the question-answer was verified by a user or not.
+ *
+ */
+ verified?: boolean;
+}
diff --git a/src/api/resources/questionAnswers/client/requests/index.ts b/src/api/resources/questionAnswers/client/requests/index.ts
new file mode 100644
index 0000000..9eaba04
--- /dev/null
+++ b/src/api/resources/questionAnswers/client/requests/index.ts
@@ -0,0 +1,7 @@
+export { type QuestionAnswersCreateRequest } from "./QuestionAnswersCreateRequest";
+export { type QuestionAnswersDeleteRequest } from "./QuestionAnswersDeleteRequest";
+export { type GetQuestionAnswerQuery } from "./GetQuestionAnswerQuery";
+export { type QuestionAnswersGetRequest } from "./QuestionAnswersGetRequest";
+export { type ListQuestionAnswersQuery } from "./ListQuestionAnswersQuery";
+export { type QuestionAnswersListRequest } from "./QuestionAnswersListRequest";
+export { type QuestionAnswersUpdateRequest } from "./QuestionAnswersUpdateRequest";
diff --git a/src/api/resources/questionAnswers/index.ts b/src/api/resources/questionAnswers/index.ts
new file mode 100644
index 0000000..5ec7692
--- /dev/null
+++ b/src/api/resources/questionAnswers/index.ts
@@ -0,0 +1 @@
+export * from "./client";
diff --git a/src/api/resources/revOrgs/client/Client.ts b/src/api/resources/revOrgs/client/Client.ts
new file mode 100644
index 0000000..4b5967a
--- /dev/null
+++ b/src/api/resources/revOrgs/client/Client.ts
@@ -0,0 +1,1071 @@
+/**
+ * This file was auto-generated by Fern from our API Definition.
+ */
+
+import * as environments from "../../../../environments";
+import * as core from "../../../../core";
+import * as DevRev from "../../../index";
+import * as serializers from "../../../../serialization/index";
+import urlJoin from "url-join";
+import * as errors from "../../../../errors/index";
+
+export declare namespace RevOrgs {
+ interface Options {
+ environment?: core.Supplier;
+ token?: 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;
+ }
+}
+
+/**
+ * Rev organization interactions.
+ */
+export class RevOrgs {
+ constructor(protected readonly _options: RevOrgs.Options = {}) {}
+
+ /**
+ * Creates a Rev organization in the authenticated user's Dev
+ * organization.
+ *
+ * @param {DevRev.RevOrgsCreateRequest} request
+ * @param {RevOrgs.RequestOptions} requestOptions - Request-specific configuration.
+ *
+ * @throws {@link DevRev.BadRequestError}
+ * @throws {@link DevRev.UnauthorizedError}
+ * @throws {@link DevRev.ForbiddenError}
+ * @throws {@link DevRev.ConflictError}
+ * @throws {@link DevRev.TooManyRequestsError}
+ * @throws {@link DevRev.InternalServerError}
+ * @throws {@link DevRev.ServiceUnavailableError}
+ *
+ * @example
+ * await client.revOrgs.create({
+ * displayName: "display_name"
+ * })
+ */
+ public async create(
+ request: DevRev.RevOrgsCreateRequest,
+ requestOptions?: RevOrgs.RequestOptions
+ ): Promise {
+ const _response = await (this._options.fetcher ?? core.fetcher)({
+ url: urlJoin(
+ (await core.Supplier.get(this._options.environment)) ?? environments.DevRevEnvironment.Default,
+ "rev-orgs.create"
+ ),
+ method: "POST",
+ headers: {
+ Authorization: await this._getAuthorizationHeader(),
+ "X-Fern-Language": "JavaScript",
+ "X-Fern-SDK-Name": "@devrev/api",
+ "X-Fern-SDK-Version": "0.0.14",
+ "X-Fern-Runtime": core.RUNTIME.type,
+ "X-Fern-Runtime-Version": core.RUNTIME.version,
+ },
+ contentType: "application/json",
+ requestType: "json",
+ body: serializers.RevOrgsCreateRequest.jsonOrThrow(request, { unrecognizedObjectKeys: "strip" }),
+ timeoutMs: requestOptions?.timeoutInSeconds != null ? requestOptions.timeoutInSeconds * 1000 : 60000,
+ maxRetries: requestOptions?.maxRetries,
+ abortSignal: requestOptions?.abortSignal,
+ });
+ if (_response.ok) {
+ return serializers.RevOrgsCreateResponse.parseOrThrow(_response.body, {
+ unrecognizedObjectKeys: "passthrough",
+ allowUnrecognizedUnionMembers: true,
+ allowUnrecognizedEnumValues: true,
+ skipValidation: true,
+ breadcrumbsPrefix: ["response"],
+ });
+ }
+
+ if (_response.error.reason === "status-code") {
+ switch (_response.error.statusCode) {
+ case 400:
+ throw new DevRev.BadRequestError(
+ serializers.ErrorBadRequest.parseOrThrow(_response.error.body, {
+ unrecognizedObjectKeys: "passthrough",
+ allowUnrecognizedUnionMembers: true,
+ allowUnrecognizedEnumValues: true,
+ skipValidation: true,
+ breadcrumbsPrefix: ["response"],
+ })
+ );
+ case 401:
+ throw new DevRev.UnauthorizedError(
+ serializers.ErrorUnauthorized.parseOrThrow(_response.error.body, {
+ unrecognizedObjectKeys: "passthrough",
+ allowUnrecognizedUnionMembers: true,
+ allowUnrecognizedEnumValues: true,
+ skipValidation: true,
+ breadcrumbsPrefix: ["response"],
+ })
+ );
+ case 403:
+ throw new DevRev.ForbiddenError(
+ serializers.ErrorForbidden.parseOrThrow(_response.error.body, {
+ unrecognizedObjectKeys: "passthrough",
+ allowUnrecognizedUnionMembers: true,
+ allowUnrecognizedEnumValues: true,
+ skipValidation: true,
+ breadcrumbsPrefix: ["response"],
+ })
+ );
+ case 409:
+ throw new DevRev.ConflictError(
+ serializers.ErrorConflict.parseOrThrow(_response.error.body, {
+ unrecognizedObjectKeys: "passthrough",
+ allowUnrecognizedUnionMembers: true,
+ allowUnrecognizedEnumValues: true,
+ skipValidation: true,
+ breadcrumbsPrefix: ["response"],
+ })
+ );
+ case 429:
+ throw new DevRev.TooManyRequestsError(
+ serializers.ErrorTooManyRequests.parseOrThrow(_response.error.body, {
+ unrecognizedObjectKeys: "passthrough",
+ allowUnrecognizedUnionMembers: true,
+ allowUnrecognizedEnumValues: true,
+ skipValidation: true,
+ breadcrumbsPrefix: ["response"],
+ })
+ );
+ case 500:
+ throw new DevRev.InternalServerError(
+ serializers.ErrorInternalServerError.parseOrThrow(_response.error.body, {
+ unrecognizedObjectKeys: "passthrough",
+ allowUnrecognizedUnionMembers: true,
+ allowUnrecognizedEnumValues: true,
+ skipValidation: true,
+ breadcrumbsPrefix: ["response"],
+ })
+ );
+ case 503:
+ throw new DevRev.ServiceUnavailableError(
+ serializers.ErrorServiceUnavailable.parseOrThrow(_response.error.body, {
+ unrecognizedObjectKeys: "passthrough",
+ allowUnrecognizedUnionMembers: true,
+ allowUnrecognizedEnumValues: true,
+ skipValidation: true,
+ breadcrumbsPrefix: ["response"],
+ })
+ );
+ default:
+ throw new errors.DevRevError({
+ statusCode: _response.error.statusCode,
+ body: _response.error.body,
+ });
+ }
+ }
+
+ switch (_response.error.reason) {
+ case "non-json":
+ throw new errors.DevRevError({
+ statusCode: _response.error.statusCode,
+ body: _response.error.rawBody,
+ });
+ case "timeout":
+ throw new errors.DevRevTimeoutError();
+ case "unknown":
+ throw new errors.DevRevError({
+ message: _response.error.errorMessage,
+ });
+ }
+ }
+
+ /**
+ * Retrieves the Rev organization's information.
+ *
+ * @param {DevRev.RevOrgsGetQuery} request
+ * @param {RevOrgs.RequestOptions} requestOptions - Request-specific configuration.
+ *
+ * @throws {@link DevRev.BadRequestError}
+ * @throws {@link DevRev.UnauthorizedError}
+ * @throws {@link DevRev.ForbiddenError}
+ * @throws {@link DevRev.NotFoundError}
+ * @throws {@link DevRev.TooManyRequestsError}
+ * @throws {@link DevRev.InternalServerError}
+ * @throws {@link DevRev.ServiceUnavailableError}
+ *
+ * @example
+ * await client.revOrgs.get({
+ * account: "ACC-12345",
+ * id: "REV-AbCdEfGh"
+ * })
+ */
+ public async get(
+ request: DevRev.RevOrgsGetQuery = {},
+ requestOptions?: RevOrgs.RequestOptions
+ ): Promise {
+ const { account, id } = request;
+ const _queryParams: Record = {};
+ if (account != null) {
+ _queryParams["account"] = account;
+ }
+
+ if (id != null) {
+ _queryParams["id"] = id;
+ }
+
+ const _response = await (this._options.fetcher ?? core.fetcher)({
+ url: urlJoin(
+ (await core.Supplier.get(this._options.environment)) ?? environments.DevRevEnvironment.Default,
+ "rev-orgs.get"
+ ),
+ method: "GET",
+ headers: {
+ Authorization: await this._getAuthorizationHeader(),
+ "X-Fern-Language": "JavaScript",
+ "X-Fern-SDK-Name": "@devrev/api",
+ "X-Fern-SDK-Version": "0.0.14",
+ "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 serializers.RevOrgsGetResponse.parseOrThrow(_response.body, {
+ unrecognizedObjectKeys: "passthrough",
+ allowUnrecognizedUnionMembers: true,
+ allowUnrecognizedEnumValues: true,
+ skipValidation: true,
+ breadcrumbsPrefix: ["response"],
+ });
+ }
+
+ if (_response.error.reason === "status-code") {
+ switch (_response.error.statusCode) {
+ case 400:
+ throw new DevRev.BadRequestError(
+ serializers.ErrorBadRequest.parseOrThrow(_response.error.body, {
+ unrecognizedObjectKeys: "passthrough",
+ allowUnrecognizedUnionMembers: true,
+ allowUnrecognizedEnumValues: true,
+ skipValidation: true,
+ breadcrumbsPrefix: ["response"],
+ })
+ );
+ case 401:
+ throw new DevRev.UnauthorizedError(
+ serializers.ErrorUnauthorized.parseOrThrow(_response.error.body, {
+ unrecognizedObjectKeys: "passthrough",
+ allowUnrecognizedUnionMembers: true,
+ allowUnrecognizedEnumValues: true,
+ skipValidation: true,
+ breadcrumbsPrefix: ["response"],
+ })
+ );
+ case 403:
+ throw new DevRev.ForbiddenError(
+ serializers.ErrorForbidden.parseOrThrow(_response.error.body, {
+ unrecognizedObjectKeys: "passthrough",
+ allowUnrecognizedUnionMembers: true,
+ allowUnrecognizedEnumValues: true,
+ skipValidation: true,
+ breadcrumbsPrefix: ["response"],
+ })
+ );
+ case 404:
+ throw new DevRev.NotFoundError(
+ serializers.ErrorNotFound.parseOrThrow(_response.error.body, {
+ unrecognizedObjectKeys: "passthrough",
+ allowUnrecognizedUnionMembers: true,
+ allowUnrecognizedEnumValues: true,
+ skipValidation: true,
+ breadcrumbsPrefix: ["response"],
+ })
+ );
+ case 429:
+ throw new DevRev.TooManyRequestsError(
+ serializers.ErrorTooManyRequests.parseOrThrow(_response.error.body, {
+ unrecognizedObjectKeys: "passthrough",
+ allowUnrecognizedUnionMembers: true,
+ allowUnrecognizedEnumValues: true,
+ skipValidation: true,
+ breadcrumbsPrefix: ["response"],
+ })
+ );
+ case 500:
+ throw new DevRev.InternalServerError(
+ serializers.ErrorInternalServerError.parseOrThrow(_response.error.body, {
+ unrecognizedObjectKeys: "passthrough",
+ allowUnrecognizedUnionMembers: true,
+ allowUnrecognizedEnumValues: true,
+ skipValidation: true,
+ breadcrumbsPrefix: ["response"],
+ })
+ );
+ case 503:
+ throw new DevRev.ServiceUnavailableError(
+ serializers.ErrorServiceUnavailable.parseOrThrow(_response.error.body, {
+ unrecognizedObjectKeys: "passthrough",
+ allowUnrecognizedUnionMembers: true,
+ allowUnrecognizedEnumValues: true,
+ skipValidation: true,
+ breadcrumbsPrefix: ["response"],
+ })
+ );
+ default:
+ throw new errors.DevRevError({
+ statusCode: _response.error.statusCode,
+ body: _response.error.body,
+ });
+ }
+ }
+
+ switch (_response.error.reason) {
+ case "non-json":
+ throw new errors.DevRevError({
+ statusCode: _response.error.statusCode,
+ body: _response.error.rawBody,
+ });
+ case "timeout":
+ throw new errors.DevRevTimeoutError();
+ case "unknown":
+ throw new errors.DevRevError({
+ message: _response.error.errorMessage,
+ });
+ }
+ }
+
+ /**
+ * Retrieves the Rev organization's information.
+ *
+ * @param {DevRev.RevOrgsGetRequest} request
+ * @param {RevOrgs.RequestOptions} requestOptions - Request-specific configuration.
+ *
+ * @throws {@link DevRev.BadRequestError}
+ * @throws {@link DevRev.UnauthorizedError}
+ * @throws {@link DevRev.ForbiddenError}
+ * @throws {@link DevRev.NotFoundError}
+ * @throws {@link DevRev.TooManyRequestsError}
+ * @throws {@link DevRev.InternalServerError}
+ * @throws {@link DevRev.ServiceUnavailableError}
+ *
+ * @example
+ * await client.revOrgs.getPost()
+ */
+ public async getPost(
+ request: DevRev.RevOrgsGetRequest = {},
+ requestOptions?: RevOrgs.RequestOptions
+ ): Promise {
+ const _response = await (this._options.fetcher ?? core.fetcher)({
+ url: urlJoin(
+ (await core.Supplier.get(this._options.environment)) ?? environments.DevRevEnvironment.Default,
+ "rev-orgs.get"
+ ),
+ method: "POST",
+ headers: {
+ Authorization: await this._getAuthorizationHeader(),
+ "X-Fern-Language": "JavaScript",
+ "X-Fern-SDK-Name": "@devrev/api",
+ "X-Fern-SDK-Version": "0.0.14",
+ "X-Fern-Runtime": core.RUNTIME.type,
+ "X-Fern-Runtime-Version": core.RUNTIME.version,
+ },
+ contentType: "application/json",
+ requestType: "json",
+ body: serializers.RevOrgsGetRequest.jsonOrThrow(request, { unrecognizedObjectKeys: "strip" }),
+ timeoutMs: requestOptions?.timeoutInSeconds != null ? requestOptions.timeoutInSeconds * 1000 : 60000,
+ maxRetries: requestOptions?.maxRetries,
+ abortSignal: requestOptions?.abortSignal,
+ });
+ if (_response.ok) {
+ return serializers.RevOrgsGetResponse.parseOrThrow(_response.body, {
+ unrecognizedObjectKeys: "passthrough",
+ allowUnrecognizedUnionMembers: true,
+ allowUnrecognizedEnumValues: true,
+ skipValidation: true,
+ breadcrumbsPrefix: ["response"],
+ });
+ }
+
+ if (_response.error.reason === "status-code") {
+ switch (_response.error.statusCode) {
+ case 400:
+ throw new DevRev.BadRequestError(
+ serializers.ErrorBadRequest.parseOrThrow(_response.error.body, {
+ unrecognizedObjectKeys: "passthrough",
+ allowUnrecognizedUnionMembers: true,
+ allowUnrecognizedEnumValues: true,
+ skipValidation: true,
+ breadcrumbsPrefix: ["response"],
+ })
+ );
+ case 401:
+ throw new DevRev.UnauthorizedError(
+ serializers.ErrorUnauthorized.parseOrThrow(_response.error.body, {
+ unrecognizedObjectKeys: "passthrough",
+ allowUnrecognizedUnionMembers: true,
+ allowUnrecognizedEnumValues: true,
+ skipValidation: true,
+ breadcrumbsPrefix: ["response"],
+ })
+ );
+ case 403:
+ throw new DevRev.ForbiddenError(
+ serializers.ErrorForbidden.parseOrThrow(_response.error.body, {
+ unrecognizedObjectKeys: "passthrough",
+ allowUnrecognizedUnionMembers: true,
+ allowUnrecognizedEnumValues: true,
+ skipValidation: true,
+ breadcrumbsPrefix: ["response"],
+ })
+ );
+ case 404:
+ throw new DevRev.NotFoundError(
+ serializers.ErrorNotFound.parseOrThrow(_response.error.body, {
+ unrecognizedObjectKeys: "passthrough",
+ allowUnrecognizedUnionMembers: true,
+ allowUnrecognizedEnumValues: true,
+ skipValidation: true,
+ breadcrumbsPrefix: ["response"],
+ })
+ );
+ case 429:
+ throw new DevRev.TooManyRequestsError(
+ serializers.ErrorTooManyRequests.parseOrThrow(_response.error.body, {
+ unrecognizedObjectKeys: "passthrough",
+ allowUnrecognizedUnionMembers: true,
+ allowUnrecognizedEnumValues: true,
+ skipValidation: true,
+ breadcrumbsPrefix: ["response"],
+ })
+ );
+ case 500:
+ throw new DevRev.InternalServerError(
+ serializers.ErrorInternalServerError.parseOrThrow(_response.error.body, {
+ unrecognizedObjectKeys: "passthrough",
+ allowUnrecognizedUnionMembers: true,
+ allowUnrecognizedEnumValues: true,
+ skipValidation: true,
+ breadcrumbsPrefix: ["response"],
+ })
+ );
+ case 503:
+ throw new DevRev.ServiceUnavailableError(
+ serializers.ErrorServiceUnavailable.parseOrThrow(_response.error.body, {
+ unrecognizedObjectKeys: "passthrough",
+ allowUnrecognizedUnionMembers: true,
+ allowUnrecognizedEnumValues: true,
+ skipValidation: true,
+ breadcrumbsPrefix: ["response"],
+ })
+ );
+ default:
+ throw new errors.DevRevError({
+ statusCode: _response.error.statusCode,
+ body: _response.error.body,
+ });
+ }
+ }
+
+ switch (_response.error.reason) {
+ case "non-json":
+ throw new errors.DevRevError({
+ statusCode: _response.error.statusCode,
+ body: _response.error.rawBody,
+ });
+ case "timeout":
+ throw new errors.DevRevTimeoutError();
+ case "unknown":
+ throw new errors.DevRevError({
+ message: _response.error.errorMessage,
+ });
+ }
+ }
+
+ /**
+ * Gets the list of Rev organizations' information belonging to the
+ * authenticated user's Dev Organization which the user is also authorized
+ * to access.
+ *
+ * @param {DevRev.RevOrgsListQuery} request
+ * @param {RevOrgs.RequestOptions} requestOptions - Request-specific configuration.
+ *
+ * @throws {@link DevRev.BadRequestError}
+ * @throws {@link DevRev.UnauthorizedError}
+ * @throws {@link DevRev.ForbiddenError}
+ * @throws {@link DevRev.NotFoundError}
+ * @throws {@link DevRev.TooManyRequestsError}
+ * @throws {@link DevRev.InternalServerError}
+ * @throws {@link DevRev.ServiceUnavailableError}
+ *
+ * @example
+ * await client.revOrgs.list({
+ * createdDateAfter: new Date("2023-01-01T12:00:00.000Z"),
+ * createdDateBefore: new Date("2023-01-01T12:00:00.000Z"),
+ * modifiedDateAfter: new Date("2023-01-01T12:00:00.000Z"),
+ * modifiedDateBefore: new Date("2023-01-01T12:00:00.000Z")
+ * })
+ */
+ public async list(
+ request: DevRev.RevOrgsListQuery = {},
+ requestOptions?: RevOrgs.RequestOptions
+ ): Promise {
+ const {
+ account,
+ createdBy,
+ createdDateAfter,
+ createdDateBefore,
+ cursor,
+ customFieldFilter,
+ customFields,
+ displayName,
+ externalRef,
+ limit,
+ mode,
+ modifiedDateAfter,
+ modifiedDateBefore,
+ sortBy,
+ tags,
+ } = request;
+ const _queryParams: Record = {};
+ if (account != null) {
+ if (Array.isArray(account)) {
+ _queryParams["account"] = account.map((item) => item);
+ } else {
+ _queryParams["account"] = account;
+ }
+ }
+
+ if (createdBy != null) {
+ if (Array.isArray(createdBy)) {
+ _queryParams["created_by"] = createdBy.map((item) => item);
+ } else {
+ _queryParams["created_by"] = createdBy;
+ }
+ }
+
+ if (createdDateAfter != null) {
+ _queryParams["created_date.after"] = createdDateAfter.toISOString();
+ }
+
+ if (createdDateBefore != null) {
+ _queryParams["created_date.before"] = createdDateBefore.toISOString();
+ }
+
+ if (cursor != null) {
+ _queryParams["cursor"] = cursor;
+ }
+
+ if (customFieldFilter != null) {
+ if (Array.isArray(customFieldFilter)) {
+ _queryParams["custom_field_filter"] = customFieldFilter.map((item) => item);
+ } else {
+ _queryParams["custom_field_filter"] = customFieldFilter;
+ }
+ }
+
+ if (customFields != null) {
+ _queryParams["custom_fields"] = JSON.stringify(customFields);
+ }
+
+ if (displayName != null) {
+ if (Array.isArray(displayName)) {
+ _queryParams["display_name"] = displayName.map((item) => item);
+ } else {
+ _queryParams["display_name"] = displayName;
+ }
+ }
+
+ if (externalRef != null) {
+ if (Array.isArray(externalRef)) {
+ _queryParams["external_ref"] = externalRef.map((item) => item);
+ } else {
+ _queryParams["external_ref"] = externalRef;
+ }
+ }
+
+ if (limit != null) {
+ _queryParams["limit"] = limit.toString();
+ }
+
+ if (mode != null) {
+ _queryParams["mode"] = mode;
+ }
+
+ if (modifiedDateAfter != null) {
+ _queryParams["modified_date.after"] = modifiedDateAfter.toISOString();
+ }
+
+ if (modifiedDateBefore != null) {
+ _queryParams["modified_date.before"] = modifiedDateBefore.toISOString();
+ }
+
+ if (sortBy != null) {
+ if (Array.isArray(sortBy)) {
+ _queryParams["sort_by"] = sortBy.map((item) => item);
+ } else {
+ _queryParams["sort_by"] = sortBy;
+ }
+ }
+
+ if (tags != null) {
+ if (Array.isArray(tags)) {
+ _queryParams["tags"] = tags.map((item) => item);
+ } else {
+ _queryParams["tags"] = tags;
+ }
+ }
+
+ const _response = await (this._options.fetcher ?? core.fetcher)({
+ url: urlJoin(
+ (await core.Supplier.get(this._options.environment)) ?? environments.DevRevEnvironment.Default,
+ "rev-orgs.list"
+ ),
+ method: "GET",
+ headers: {
+ Authorization: await this._getAuthorizationHeader(),
+ "X-Fern-Language": "JavaScript",
+ "X-Fern-SDK-Name": "@devrev/api",
+ "X-Fern-SDK-Version": "0.0.14",
+ "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 serializers.RevOrgsListResponse.parseOrThrow(_response.body, {
+ unrecognizedObjectKeys: "passthrough",
+ allowUnrecognizedUnionMembers: true,
+ allowUnrecognizedEnumValues: true,
+ skipValidation: true,
+ breadcrumbsPrefix: ["response"],
+ });
+ }
+
+ if (_response.error.reason === "status-code") {
+ switch (_response.error.statusCode) {
+ case 400:
+ throw new DevRev.BadRequestError(
+ serializers.ErrorBadRequest.parseOrThrow(_response.error.body, {
+ unrecognizedObjectKeys: "passthrough",
+ allowUnrecognizedUnionMembers: true,
+ allowUnrecognizedEnumValues: true,
+ skipValidation: true,
+ breadcrumbsPrefix: ["response"],
+ })
+ );
+ case 401:
+ throw new DevRev.UnauthorizedError(
+ serializers.ErrorUnauthorized.parseOrThrow(_response.error.body, {
+ unrecognizedObjectKeys: "passthrough",
+ allowUnrecognizedUnionMembers: true,
+ allowUnrecognizedEnumValues: true,
+ skipValidation: true,
+ breadcrumbsPrefix: ["response"],
+ })
+ );
+ case 403:
+ throw new DevRev.ForbiddenError(
+ serializers.ErrorForbidden.parseOrThrow(_response.error.body, {
+ unrecognizedObjectKeys: "passthrough",
+ allowUnrecognizedUnionMembers: true,
+ allowUnrecognizedEnumValues: true,
+ skipValidation: true,
+ breadcrumbsPrefix: ["response"],
+ })
+ );
+ case 404:
+ throw new DevRev.NotFoundError(
+ serializers.ErrorNotFound.parseOrThrow(_response.error.body, {
+ unrecognizedObjectKeys: "passthrough",
+ allowUnrecognizedUnionMembers: true,
+ allowUnrecognizedEnumValues: true,
+ skipValidation: true,
+ breadcrumbsPrefix: ["response"],
+ })
+ );
+ case 429:
+ throw new DevRev.TooManyRequestsError(
+ serializers.ErrorTooManyRequests.parseOrThrow(_response.error.body, {
+ unrecognizedObjectKeys: "passthrough",
+ allowUnrecognizedUnionMembers: true,
+ allowUnrecognizedEnumValues: true,
+ skipValidation: true,
+ breadcrumbsPrefix: ["response"],
+ })
+ );
+ case 500:
+ throw new DevRev.InternalServerError(
+ serializers.ErrorInternalServerError.parseOrThrow(_response.error.body, {
+ unrecognizedObjectKeys: "passthrough",
+ allowUnrecognizedUnionMembers: true,
+ allowUnrecognizedEnumValues: true,
+ skipValidation: true,
+ breadcrumbsPrefix: ["response"],
+ })
+ );
+ case 503:
+ throw new DevRev.ServiceUnavailableError(
+ serializers.ErrorServiceUnavailable.parseOrThrow(_response.error.body, {
+ unrecognizedObjectKeys: "passthrough",
+ allowUnrecognizedUnionMembers: true,
+ allowUnrecognizedEnumValues: true,
+ skipValidation: true,
+ breadcrumbsPrefix: ["response"],
+ })
+ );
+ default:
+ throw new errors.DevRevError({
+ statusCode: _response.error.statusCode,
+ body: _response.error.body,
+ });
+ }
+ }
+
+ switch (_response.error.reason) {
+ case "non-json":
+ throw new errors.DevRevError({
+ statusCode: _response.error.statusCode,
+ body: _response.error.rawBody,
+ });
+ case "timeout":
+ throw new errors.DevRevTimeoutError();
+ case "unknown":
+ throw new errors.DevRevError({
+ message: _response.error.errorMessage,
+ });
+ }
+ }
+
+ /**
+ * Gets the list of Rev organizations' information belonging to the
+ * authenticated user's Dev Organization which the user is also authorized
+ * to access.
+ *
+ * @param {DevRev.RevOrgsListRequest} request
+ * @param {RevOrgs.RequestOptions} requestOptions - Request-specific configuration.
+ *
+ * @throws {@link DevRev.BadRequestError}
+ * @throws {@link DevRev.UnauthorizedError}
+ * @throws {@link DevRev.ForbiddenError}
+ * @throws {@link DevRev.NotFoundError}
+ * @throws {@link DevRev.TooManyRequestsError}
+ * @throws {@link DevRev.InternalServerError}
+ * @throws {@link DevRev.ServiceUnavailableError}
+ *
+ * @example
+ * await client.revOrgs.listPost()
+ */
+ public async listPost(
+ request: DevRev.RevOrgsListRequest = {},
+ requestOptions?: RevOrgs.RequestOptions
+ ): Promise {
+ const _response = await (this._options.fetcher ?? core.fetcher)({
+ url: urlJoin(
+ (await core.Supplier.get(this._options.environment)) ?? environments.DevRevEnvironment.Default,
+ "rev-orgs.list"
+ ),
+ method: "POST",
+ headers: {
+ Authorization: await this._getAuthorizationHeader(),
+ "X-Fern-Language": "JavaScript",
+ "X-Fern-SDK-Name": "@devrev/api",
+ "X-Fern-SDK-Version": "0.0.14",
+ "X-Fern-Runtime": core.RUNTIME.type,
+ "X-Fern-Runtime-Version": core.RUNTIME.version,
+ },
+ contentType: "application/json",
+ requestType: "json",
+ body: serializers.RevOrgsListRequest.jsonOrThrow(request, { unrecognizedObjectKeys: "strip" }),
+ timeoutMs: requestOptions?.timeoutInSeconds != null ? requestOptions.timeoutInSeconds * 1000 : 60000,
+ maxRetries: requestOptions?.maxRetries,
+ abortSignal: requestOptions?.abortSignal,
+ });
+ if (_response.ok) {
+ return serializers.RevOrgsListResponse.parseOrThrow(_response.body, {
+ unrecognizedObjectKeys: "passthrough",
+ allowUnrecognizedUnionMembers: true,
+ allowUnrecognizedEnumValues: true,
+ skipValidation: true,
+ breadcrumbsPrefix: ["response"],
+ });
+ }
+
+ if (_response.error.reason === "status-code") {
+ switch (_response.error.statusCode) {
+ case 400:
+ throw new DevRev.BadRequestError(
+ serializers.ErrorBadRequest.parseOrThrow(_response.error.body, {
+ unrecognizedObjectKeys: "passthrough",
+ allowUnrecognizedUnionMembers: true,
+ allowUnrecognizedEnumValues: true,
+ skipValidation: true,
+ breadcrumbsPrefix: ["response"],
+ })
+ );
+ case 401:
+ throw new DevRev.UnauthorizedError(
+ serializers.ErrorUnauthorized.parseOrThrow(_response.error.body, {
+ unrecognizedObjectKeys: "passthrough",
+ allowUnrecognizedUnionMembers: true,
+ allowUnrecognizedEnumValues: true,
+ skipValidation: true,
+ breadcrumbsPrefix: ["response"],
+ })
+ );
+ case 403:
+ throw new DevRev.ForbiddenError(
+ serializers.ErrorForbidden.parseOrThrow(_response.error.body, {
+ unrecognizedObjectKeys: "passthrough",
+ allowUnrecognizedUnionMembers: true,
+ allowUnrecognizedEnumValues: true,
+ skipValidation: true,
+ breadcrumbsPrefix: ["response"],
+ })
+ );
+ case 404:
+ throw new DevRev.NotFoundError(
+ serializers.ErrorNotFound.parseOrThrow(_response.error.body, {
+ unrecognizedObjectKeys: "passthrough",
+ allowUnrecognizedUnionMembers: true,
+ allowUnrecognizedEnumValues: true,
+ skipValidation: true,
+ breadcrumbsPrefix: ["response"],
+ })
+ );
+ case 429:
+ throw new DevRev.TooManyRequestsError(
+ serializers.ErrorTooManyRequests.parseOrThrow(_response.error.body, {
+ unrecognizedObjectKeys: "passthrough",
+ allowUnrecognizedUnionMembers: true,
+ allowUnrecognizedEnumValues: true,
+ skipValidation: true,
+ breadcrumbsPrefix: ["response"],
+ })
+ );
+ case 500:
+ throw new DevRev.InternalServerError(
+ serializers.ErrorInternalServerError.parseOrThrow(_response.error.body, {
+ unrecognizedObjectKeys: "passthrough",
+ allowUnrecognizedUnionMembers: true,
+ allowUnrecognizedEnumValues: true,
+ skipValidation: true,
+ breadcrumbsPrefix: ["response"],
+ })
+ );
+ case 503:
+ throw new DevRev.ServiceUnavailableError(
+ serializers.ErrorServiceUnavailable.parseOrThrow(_response.error.body, {
+ unrecognizedObjectKeys: "passthrough",
+ allowUnrecognizedUnionMembers: true,
+ allowUnrecognizedEnumValues: true,
+ skipValidation: true,
+ breadcrumbsPrefix: ["response"],
+ })
+ );
+ default:
+ throw new errors.DevRevError({
+ statusCode: _response.error.statusCode,
+ body: _response.error.body,
+ });
+ }
+ }
+
+ switch (_response.error.reason) {
+ case "non-json":
+ throw new errors.DevRevError({
+ statusCode: _response.error.statusCode,
+ body: _response.error.rawBody,
+ });
+ case "timeout":
+ throw new errors.DevRevTimeoutError();
+ case "unknown":
+ throw new errors.DevRevError({
+ message: _response.error.errorMessage,
+ });
+ }
+ }
+
+ /**
+ * Updates the Rev organization's information.
+ *
+ * @param {DevRev.RevOrgsUpdateRequest} request
+ * @param {RevOrgs.RequestOptions} requestOptions - Request-specific configuration.
+ *
+ * @throws {@link DevRev.BadRequestError}
+ * @throws {@link DevRev.UnauthorizedError}
+ * @throws {@link DevRev.ForbiddenError}
+ * @throws {@link DevRev.NotFoundError}
+ * @throws {@link DevRev.ConflictError}
+ * @throws {@link DevRev.TooManyRequestsError}
+ * @throws {@link DevRev.InternalServerError}
+ * @throws {@link DevRev.ServiceUnavailableError}
+ *
+ * @example
+ * await client.revOrgs.update({
+ * id: "REV-AbCdEfGh"
+ * })
+ */
+ public async update(
+ request: DevRev.RevOrgsUpdateRequest,
+ requestOptions?: RevOrgs.RequestOptions
+ ): Promise {
+ const _response = await (this._options.fetcher ?? core.fetcher)({
+ url: urlJoin(
+ (await core.Supplier.get(this._options.environment)) ?? environments.DevRevEnvironment.Default,
+ "rev-orgs.update"
+ ),
+ method: "POST",
+ headers: {
+ Authorization: await this._getAuthorizationHeader(),
+ "X-Fern-Language": "JavaScript",
+ "X-Fern-SDK-Name": "@devrev/api",
+ "X-Fern-SDK-Version": "0.0.14",
+ "X-Fern-Runtime": core.RUNTIME.type,
+ "X-Fern-Runtime-Version": core.RUNTIME.version,
+ },
+ contentType: "application/json",
+ requestType: "json",
+ body: serializers.RevOrgsUpdateRequest.jsonOrThrow(request, { unrecognizedObjectKeys: "strip" }),
+ timeoutMs: requestOptions?.timeoutInSeconds != null ? requestOptions.timeoutInSeconds * 1000 : 60000,
+ maxRetries: requestOptions?.maxRetries,
+ abortSignal: requestOptions?.abortSignal,
+ });
+ if (_response.ok) {
+ return serializers.RevOrgsUpdateResponse.parseOrThrow(_response.body, {
+ unrecognizedObjectKeys: "passthrough",
+ allowUnrecognizedUnionMembers: true,
+ allowUnrecognizedEnumValues: true,
+ skipValidation: true,
+ breadcrumbsPrefix: ["response"],
+ });
+ }
+
+ if (_response.error.reason === "status-code") {
+ switch (_response.error.statusCode) {
+ case 400:
+ throw new DevRev.BadRequestError(
+ serializers.ErrorBadRequest.parseOrThrow(_response.error.body, {
+ unrecognizedObjectKeys: "passthrough",
+ allowUnrecognizedUnionMembers: true,
+ allowUnrecognizedEnumValues: true,
+ skipValidation: true,
+ breadcrumbsPrefix: ["response"],
+ })
+ );
+ case 401:
+ throw new DevRev.UnauthorizedError(
+ serializers.ErrorUnauthorized.parseOrThrow(_response.error.body, {
+ unrecognizedObjectKeys: "passthrough",
+ allowUnrecognizedUnionMembers: true,
+ allowUnrecognizedEnumValues: true,
+ skipValidation: true,
+ breadcrumbsPrefix: ["response"],
+ })
+ );
+ case 403:
+ throw new DevRev.ForbiddenError(
+ serializers.ErrorForbidden.parseOrThrow(_response.error.body, {
+ unrecognizedObjectKeys: "passthrough",
+ allowUnrecognizedUnionMembers: true,
+ allowUnrecognizedEnumValues: true,
+ skipValidation: true,
+ breadcrumbsPrefix: ["response"],
+ })
+ );
+ case 404:
+ throw new DevRev.NotFoundError(
+ serializers.ErrorNotFound.parseOrThrow(_response.error.body, {
+ unrecognizedObjectKeys: "passthrough",
+ allowUnrecognizedUnionMembers: true,
+ allowUnrecognizedEnumValues: true,
+ skipValidation: true,
+ breadcrumbsPrefix: ["response"],
+ })
+ );
+ case 409:
+ throw new DevRev.ConflictError(
+ serializers.ErrorConflict.parseOrThrow(_response.error.body, {
+ unrecognizedObjectKeys: "passthrough",
+ allowUnrecognizedUnionMembers: true,
+ allowUnrecognizedEnumValues: true,
+ skipValidation: true,
+ breadcrumbsPrefix: ["response"],
+ })
+ );
+ case 429:
+ throw new DevRev.TooManyRequestsError(
+ serializers.ErrorTooManyRequests.parseOrThrow(_response.error.body, {
+ unrecognizedObjectKeys: "passthrough",
+ allowUnrecognizedUnionMembers: true,
+ allowUnrecognizedEnumValues: true,
+ skipValidation: true,
+ breadcrumbsPrefix: ["response"],
+ })
+ );
+ case 500:
+ throw new DevRev.InternalServerError(
+ serializers.ErrorInternalServerError.parseOrThrow(_response.error.body, {
+ unrecognizedObjectKeys: "passthrough",
+ allowUnrecognizedUnionMembers: true,
+ allowUnrecognizedEnumValues: true,
+ skipValidation: true,
+ breadcrumbsPrefix: ["response"],
+ })
+ );
+ case 503:
+ throw new DevRev.ServiceUnavailableError(
+ serializers.ErrorServiceUnavailable.parseOrThrow(_response.error.body, {
+ unrecognizedObjectKeys: "passthrough",
+ allowUnrecognizedUnionMembers: true,
+ allowUnrecognizedEnumValues: true,
+ skipValidation: true,
+ breadcrumbsPrefix: ["response"],
+ })
+ );
+ default:
+ throw new errors.DevRevError({
+ statusCode: _response.error.statusCode,
+ body: _response.error.body,
+ });
+ }
+ }
+
+ switch (_response.error.reason) {
+ case "non-json":
+ throw new errors.DevRevError({
+ statusCode: _response.error.statusCode,
+ body: _response.error.rawBody,
+ });
+ case "timeout":
+ throw new errors.DevRevTimeoutError();
+ case "unknown":
+ throw new errors.DevRevError({
+ message: _response.error.errorMessage,
+ });
+ }
+ }
+
+ protected async _getAuthorizationHeader(): Promise {
+ const bearer = (await core.Supplier.get(this._options.token)) ?? process?.env["DEVREV_TOKEN"];
+ if (bearer == null) {
+ throw new errors.DevRevError({
+ message: "Please specify DEVREV_TOKEN when instantiating the client.",
+ });
+ }
+
+ return `Bearer ${bearer}`;
+ }
+}
diff --git a/src/api/resources/revOrgs/client/index.ts b/src/api/resources/revOrgs/client/index.ts
new file mode 100644
index 0000000..415726b
--- /dev/null
+++ b/src/api/resources/revOrgs/client/index.ts
@@ -0,0 +1 @@
+export * from "./requests";
diff --git a/src/api/resources/revOrgs/client/requests/RevOrgsCreateRequest.ts b/src/api/resources/revOrgs/client/requests/RevOrgsCreateRequest.ts
new file mode 100644
index 0000000..c756ad4
--- /dev/null
+++ b/src/api/resources/revOrgs/client/requests/RevOrgsCreateRequest.ts
@@ -0,0 +1,46 @@
+/**
+ * This file was auto-generated by Fern from our API Definition.
+ */
+
+import * as DevRev from "../../../../index";
+
+/**
+ * @example
+ * {
+ * displayName: "display_name"
+ * }
+ */
+export interface RevOrgsCreateRequest {
+ /** Account Id to associate with this Rev organization. */
+ account?: string;
+ /**
+ * The IDs of the artifacts to associate with the Rev organization.
+ *
+ */
+ artifacts?: string[];
+ /** Application-defined custom fields. */
+ customFields?: Record;
+ /**
+ * Schema fragment IDs associated with this Rev organization.
+ *
+ */
+ customSchemaFragments?: string[];
+ /** Description of the Rev organization. */
+ description?: string;
+ /** Name of the Rev organization. */
+ displayName: string;
+ /** Company's domain name. Example - 'devrev.ai'. */
+ domain?: string;
+ environment?: DevRev.OrgEnvironment;
+ /**
+ * External ref is a custom unique identifier which is a reference to
+ * an unique id for this organization's data in some system of
+ * records.
+ *
+ */
+ externalRef?: string;
+ /** Tags associated with the Rev organization. */
+ tags?: DevRev.SetTagWithValue[];
+ /** The tier of the RevOrg. */
+ tier?: string;
+}
diff --git a/src/api/resources/revOrgs/client/requests/RevOrgsGetQuery.ts b/src/api/resources/revOrgs/client/requests/RevOrgsGetQuery.ts
new file mode 100644
index 0000000..aa697c2
--- /dev/null
+++ b/src/api/resources/revOrgs/client/requests/RevOrgsGetQuery.ts
@@ -0,0 +1,22 @@
+/**
+ * This file was auto-generated by Fern from our API Definition.
+ */
+
+/**
+ * @example
+ * {
+ * account: "ACC-12345",
+ * id: "REV-AbCdEfGh"
+ * }
+ */
+export interface RevOrgsGetQuery {
+ /**
+ * The ID of account for which default Rev organization is to be
+ * fetched.
+ */
+ account?: string;
+ /**
+ * The ID of the required Rev organization.
+ */
+ id?: string;
+}
diff --git a/src/api/resources/revOrgs/client/requests/RevOrgsGetRequest.ts b/src/api/resources/revOrgs/client/requests/RevOrgsGetRequest.ts
new file mode 100644
index 0000000..91643b2
--- /dev/null
+++ b/src/api/resources/revOrgs/client/requests/RevOrgsGetRequest.ts
@@ -0,0 +1,18 @@
+/**
+ * This file was auto-generated by Fern from our API Definition.
+ */
+
+/**
+ * @example
+ * {}
+ */
+export interface RevOrgsGetRequest {
+ /**
+ * The ID of account for which default Rev organization is to be
+ * fetched.
+ *
+ */
+ account?: string;
+ /** The ID of the required Rev organization. */
+ id?: string;
+}
diff --git a/src/api/resources/revOrgs/client/requests/RevOrgsListQuery.ts b/src/api/resources/revOrgs/client/requests/RevOrgsListQuery.ts
new file mode 100644
index 0000000..2ef4af0
--- /dev/null
+++ b/src/api/resources/revOrgs/client/requests/RevOrgsListQuery.ts
@@ -0,0 +1,83 @@
+/**
+ * This file was auto-generated by Fern from our API Definition.
+ */
+
+import * as DevRev from "../../../../index";
+
+/**
+ * @example
+ * {
+ * createdDateAfter: new Date("2023-01-01T12:00:00.000Z"),
+ * createdDateBefore: new Date("2023-01-01T12:00:00.000Z"),
+ * modifiedDateAfter: new Date("2023-01-01T12:00:00.000Z"),
+ * modifiedDateBefore: new Date("2023-01-01T12:00:00.000Z")
+ * }
+ */
+export interface RevOrgsListQuery {
+ /**
+ * Filters by account.
+ */
+ account?: string | string[];
+ /**
+ * Filters by creator.
+ */
+ createdBy?: string | string[];
+ /**
+ * Filters for objects created after the provided timestamp (inclusive).
+ */
+ createdDateAfter?: Date;
+ /**
+ * Filters for objects created before the provided timestamp
+ * (inclusive).
+ */
+ createdDateBefore?: Date;
+ /**
+ * The cursor to resume iteration from. If not provided, then iteration
+ * starts from the beginning.
+ */
+ cursor?: string;
+ /**
+ * Filters on custom fields. Input will be of the format
+ * (custom_field_filter=field_name1:val1,val2,val3&custom_field_filter=field_name2:val1,val2).
+ */
+ customFieldFilter?: string | string[];
+ /**
+ * Filters for custom fields.
+ */
+ customFields?: Record;
+ /**
+ * Array of display names of Rev orgs to be filtered.
+ */
+ displayName?: string | string[];
+ /**
+ * List of external refs to filter Rev organizations for.
+ */
+ externalRef?: string | string[];
+ /**
+ * The maximum number of Rev organizations to be retrieved per page.
+ */
+ limit?: number;
+ /**
+ * The iteration mode to use, otherwise if not set, then "after" is
+ * used.
+ */
+ mode?: DevRev.ListMode;
+ /**
+ * Filters for objects created after the provided timestamp (inclusive).
+ */
+ modifiedDateAfter?: Date;
+ /**
+ * Filters for objects created before the provided timestamp
+ * (inclusive).
+ */
+ modifiedDateBefore?: Date;
+ /**
+ * Fields to sort the Rev organizations by and the direction to sort
+ * them.
+ */
+ sortBy?: string | string[];
+ /**
+ * List of tags to be filtered.
+ */
+ tags?: string | string[];
+}
diff --git a/src/api/resources/revOrgs/client/requests/RevOrgsListRequest.ts b/src/api/resources/revOrgs/client/requests/RevOrgsListRequest.ts
new file mode 100644
index 0000000..1affa9a
--- /dev/null
+++ b/src/api/resources/revOrgs/client/requests/RevOrgsListRequest.ts
@@ -0,0 +1,50 @@
+/**
+ * This file was auto-generated by Fern from our API Definition.
+ */
+
+import * as DevRev from "../../../../index";
+
+/**
+ * @example
+ * {}
+ */
+export interface RevOrgsListRequest {
+ /** Filters by account. */
+ account?: string[];
+ /** Filters by creator. */
+ createdBy?: string[];
+ createdDate?: DevRev.DateTimeFilter;
+ /**
+ * The cursor to resume iteration from. If not provided, then
+ * iteration starts from the beginning.
+ *
+ */
+ cursor?: string;
+ /**
+ * Filters on custom fields. Input will be of the format
+ * (custom_field_filter=field_name1:val1,val2,val3&custom_field_filter=field_name2:val1,val2).
+ *
+ */
+ customFieldFilter?: string[];
+ /** Filters for custom fields. */
+ customFields?: Record;
+ /** Array of display names of Rev orgs to be filtered. */
+ displayName?: string[];
+ /** List of external refs to filter Rev organizations for. */
+ externalRef?: string[];
+ /**
+ * The maximum number of Rev organizations to be retrieved per page.
+ *
+ */
+ limit?: number;
+ mode?: DevRev.ListMode;
+ modifiedDate?: DevRev.DateTimeFilter;
+ /**
+ * Fields to sort the Rev organizations by and the direction to sort
+ * them.
+ *
+ */
+ sortBy?: string[];
+ /** List of tags to be filtered. */
+ tags?: string[];
+}
diff --git a/src/api/resources/revOrgs/client/requests/RevOrgsUpdateRequest.ts b/src/api/resources/revOrgs/client/requests/RevOrgsUpdateRequest.ts
new file mode 100644
index 0000000..50084f0
--- /dev/null
+++ b/src/api/resources/revOrgs/client/requests/RevOrgsUpdateRequest.ts
@@ -0,0 +1,42 @@
+/**
+ * This file was auto-generated by Fern from our API Definition.
+ */
+
+import * as DevRev from "../../../../index";
+
+/**
+ * @example
+ * {
+ * id: "REV-AbCdEfGh"
+ * }
+ */
+export interface RevOrgsUpdateRequest {
+ /** New account ID to associate with this Rev organization. */
+ account?: string;
+ artifacts?: DevRev.RevOrgsUpdateRequestArtifacts;
+ /**
+ * Schema fragment IDs associated with this Rev organization.
+ *
+ */
+ customSchemaFragments?: string[];
+ /** Description of the Rev organization. */
+ description?: string;
+ /** Customer chosen name for the Rev organization. */
+ displayName?: string;
+ /** Company's domain name. Example - 'devrev.ai'. */
+ domain?: string;
+ environment?: DevRev.OrgEnvironment;
+ /**
+ * External ref is a custom unique identifier which is a reference to
+ * an unique id for this organization's data in some system of
+ * records.
+ *
+ */
+ externalRef?: string;
+ /** The ID of Rev organization to update. */
+ id: string;
+ /** Tags associated with the Rev organization. */
+ tags?: DevRev.SetTagWithValue[];
+ /** The tier of the RevOrg. */
+ tier?: string;
+}
diff --git a/src/api/resources/revOrgs/client/requests/index.ts b/src/api/resources/revOrgs/client/requests/index.ts
new file mode 100644
index 0000000..874f31c
--- /dev/null
+++ b/src/api/resources/revOrgs/client/requests/index.ts
@@ -0,0 +1,6 @@
+export { type RevOrgsCreateRequest } from "./RevOrgsCreateRequest";
+export { type RevOrgsGetQuery } from "./RevOrgsGetQuery";
+export { type RevOrgsGetRequest } from "./RevOrgsGetRequest";
+export { type RevOrgsListQuery } from "./RevOrgsListQuery";
+export { type RevOrgsListRequest } from "./RevOrgsListRequest";
+export { type RevOrgsUpdateRequest } from "./RevOrgsUpdateRequest";
diff --git a/src/api/resources/revOrgs/index.ts b/src/api/resources/revOrgs/index.ts
new file mode 100644
index 0000000..5ec7692
--- /dev/null
+++ b/src/api/resources/revOrgs/index.ts
@@ -0,0 +1 @@
+export * from "./client";
diff --git a/src/api/resources/revUsers/client/Client.ts b/src/api/resources/revUsers/client/Client.ts
new file mode 100644
index 0000000..e13553f
--- /dev/null
+++ b/src/api/resources/revUsers/client/Client.ts
@@ -0,0 +1,1509 @@
+/**
+ * This file was auto-generated by Fern from our API Definition.
+ */
+
+import * as environments from "../../../../environments";
+import * as core from "../../../../core";
+import * as DevRev from "../../../index";
+import * as serializers from "../../../../serialization/index";
+import urlJoin from "url-join";
+import * as errors from "../../../../errors/index";
+
+export declare namespace RevUsers {
+ interface Options {
+ environment?: core.Supplier;
+ token?: 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;
+ }
+}
+
+/**
+ * Rev user interactions.
+ */
+export class RevUsers {
+ constructor(protected readonly _options: RevUsers.Options = {}) {}
+
+ /**
+ * Creates a Rev user for a Rev organization. Rev user can be a customer
+ * or a lead of an organization.
+ *
+ * @param {DevRev.RevUsersCreateRequest} request
+ * @param {RevUsers.RequestOptions} requestOptions - Request-specific configuration.
+ *
+ * @throws {@link DevRev.BadRequestError}
+ * @throws {@link DevRev.UnauthorizedError}
+ * @throws {@link DevRev.ForbiddenError}
+ * @throws {@link DevRev.ConflictError}
+ * @throws {@link DevRev.TooManyRequestsError}
+ * @throws {@link DevRev.InternalServerError}
+ * @throws {@link DevRev.ServiceUnavailableError}
+ *
+ * @example
+ * await client.revUsers.create()
+ */
+ public async create(
+ request: DevRev.RevUsersCreateRequest = {},
+ requestOptions?: RevUsers.RequestOptions
+ ): Promise {
+ const _response = await (this._options.fetcher ?? core.fetcher)({
+ url: urlJoin(
+ (await core.Supplier.get(this._options.environment)) ?? environments.DevRevEnvironment.Default,
+ "rev-users.create"
+ ),
+ method: "POST",
+ headers: {
+ Authorization: await this._getAuthorizationHeader(),
+ "X-Fern-Language": "JavaScript",
+ "X-Fern-SDK-Name": "@devrev/api",
+ "X-Fern-SDK-Version": "0.0.14",
+ "X-Fern-Runtime": core.RUNTIME.type,
+ "X-Fern-Runtime-Version": core.RUNTIME.version,
+ },
+ contentType: "application/json",
+ requestType: "json",
+ body: serializers.RevUsersCreateRequest.jsonOrThrow(request, { unrecognizedObjectKeys: "strip" }),
+ timeoutMs: requestOptions?.timeoutInSeconds != null ? requestOptions.timeoutInSeconds * 1000 : 60000,
+ maxRetries: requestOptions?.maxRetries,
+ abortSignal: requestOptions?.abortSignal,
+ });
+ if (_response.ok) {
+ return serializers.RevUsersCreateResponse.parseOrThrow(_response.body, {
+ unrecognizedObjectKeys: "passthrough",
+ allowUnrecognizedUnionMembers: true,
+ allowUnrecognizedEnumValues: true,
+ skipValidation: true,
+ breadcrumbsPrefix: ["response"],
+ });
+ }
+
+ if (_response.error.reason === "status-code") {
+ switch (_response.error.statusCode) {
+ case 400:
+ throw new DevRev.BadRequestError(
+ serializers.ErrorBadRequest.parseOrThrow(_response.error.body, {
+ unrecognizedObjectKeys: "passthrough",
+ allowUnrecognizedUnionMembers: true,
+ allowUnrecognizedEnumValues: true,
+ skipValidation: true,
+ breadcrumbsPrefix: ["response"],
+ })
+ );
+ case 401:
+ throw new DevRev.UnauthorizedError(
+ serializers.ErrorUnauthorized.parseOrThrow(_response.error.body, {
+ unrecognizedObjectKeys: "passthrough",
+ allowUnrecognizedUnionMembers: true,
+ allowUnrecognizedEnumValues: true,
+ skipValidation: true,
+ breadcrumbsPrefix: ["response"],
+ })
+ );
+ case 403:
+ throw new DevRev.ForbiddenError(
+ serializers.ErrorForbidden.parseOrThrow(_response.error.body, {
+ unrecognizedObjectKeys: "passthrough",
+ allowUnrecognizedUnionMembers: true,
+ allowUnrecognizedEnumValues: true,
+ skipValidation: true,
+ breadcrumbsPrefix: ["response"],
+ })
+ );
+ case 409:
+ throw new DevRev.ConflictError(
+ serializers.ErrorConflict.parseOrThrow(_response.error.body, {
+ unrecognizedObjectKeys: "passthrough",
+ allowUnrecognizedUnionMembers: true,
+ allowUnrecognizedEnumValues: true,
+ skipValidation: true,
+ breadcrumbsPrefix: ["response"],
+ })
+ );
+ case 429:
+ throw new DevRev.TooManyRequestsError(
+ serializers.ErrorTooManyRequests.parseOrThrow(_response.error.body, {
+ unrecognizedObjectKeys: "passthrough",
+ allowUnrecognizedUnionMembers: true,
+ allowUnrecognizedEnumValues: true,
+ skipValidation: true,
+ breadcrumbsPrefix: ["response"],
+ })
+ );
+ case 500:
+ throw new DevRev.InternalServerError(
+ serializers.ErrorInternalServerError.parseOrThrow(_response.error.body, {
+ unrecognizedObjectKeys: "passthrough",
+ allowUnrecognizedUnionMembers: true,
+ allowUnrecognizedEnumValues: true,
+ skipValidation: true,
+ breadcrumbsPrefix: ["response"],
+ })
+ );
+ case 503:
+ throw new DevRev.ServiceUnavailableError(
+ serializers.ErrorServiceUnavailable.parseOrThrow(_response.error.body, {
+ unrecognizedObjectKeys: "passthrough",
+ allowUnrecognizedUnionMembers: true,
+ allowUnrecognizedEnumValues: true,
+ skipValidation: true,
+ breadcrumbsPrefix: ["response"],
+ })
+ );
+ default:
+ throw new errors.DevRevError({
+ statusCode: _response.error.statusCode,
+ body: _response.error.body,
+ });
+ }
+ }
+
+ switch (_response.error.reason) {
+ case "non-json":
+ throw new errors.DevRevError({
+ statusCode: _response.error.statusCode,
+ body: _response.error.rawBody,
+ });
+ case "timeout":
+ throw new errors.DevRevTimeoutError();
+ case "unknown":
+ throw new errors.DevRevError({
+ message: _response.error.errorMessage,
+ });
+ }
+ }
+
+ /**
+ * Deletes a Rev user.
+ *
+ * @param {DevRev.RevUsersDeleteRequest} request
+ * @param {RevUsers.RequestOptions} requestOptions - Request-specific configuration.
+ *
+ * @throws {@link DevRev.BadRequestError}
+ * @throws {@link DevRev.UnauthorizedError}
+ * @throws {@link DevRev.ForbiddenError}
+ * @throws {@link DevRev.NotFoundError}
+ * @throws {@link DevRev.TooManyRequestsError}
+ * @throws {@link DevRev.InternalServerError}
+ * @throws {@link DevRev.ServiceUnavailableError}
+ *
+ * @example
+ * await client.revUsers.delete({
+ * id: "id"
+ * })
+ */
+ public async delete(
+ request: DevRev.RevUsersDeleteRequest,
+ requestOptions?: RevUsers.RequestOptions
+ ): Promise {
+ const _response = await (this._options.fetcher ?? core.fetcher)({
+ url: urlJoin(
+ (await core.Supplier.get(this._options.environment)) ?? environments.DevRevEnvironment.Default,
+ "rev-users.delete"
+ ),
+ method: "POST",
+ headers: {
+ Authorization: await this._getAuthorizationHeader(),
+ "X-Fern-Language": "JavaScript",
+ "X-Fern-SDK-Name": "@devrev/api",
+ "X-Fern-SDK-Version": "0.0.14",
+ "X-Fern-Runtime": core.RUNTIME.type,
+ "X-Fern-Runtime-Version": core.RUNTIME.version,
+ },
+ contentType: "application/json",
+ requestType: "json",
+ body: serializers.RevUsersDeleteRequest.jsonOrThrow(request, { unrecognizedObjectKeys: "strip" }),
+ timeoutMs: requestOptions?.timeoutInSeconds != null ? requestOptions.timeoutInSeconds * 1000 : 60000,
+ maxRetries: requestOptions?.maxRetries,
+ abortSignal: requestOptions?.abortSignal,
+ });
+ if (_response.ok) {
+ return serializers.RevUsersDeleteResponse.parseOrThrow(_response.body, {
+ unrecognizedObjectKeys: "passthrough",
+ allowUnrecognizedUnionMembers: true,
+ allowUnrecognizedEnumValues: true,
+ skipValidation: true,
+ breadcrumbsPrefix: ["response"],
+ });
+ }
+
+ if (_response.error.reason === "status-code") {
+ switch (_response.error.statusCode) {
+ case 400:
+ throw new DevRev.BadRequestError(
+ serializers.ErrorBadRequest.parseOrThrow(_response.error.body, {
+ unrecognizedObjectKeys: "passthrough",
+ allowUnrecognizedUnionMembers: true,
+ allowUnrecognizedEnumValues: true,
+ skipValidation: true,
+ breadcrumbsPrefix: ["response"],
+ })
+ );
+ case 401:
+ throw new DevRev.UnauthorizedError(
+ serializers.ErrorUnauthorized.parseOrThrow(_response.error.body, {
+ unrecognizedObjectKeys: "passthrough",
+ allowUnrecognizedUnionMembers: true,
+ allowUnrecognizedEnumValues: true,
+ skipValidation: true,
+ breadcrumbsPrefix: ["response"],
+ })
+ );
+ case 403:
+ throw new DevRev.ForbiddenError(
+ serializers.ErrorForbidden.parseOrThrow(_response.error.body, {
+ unrecognizedObjectKeys: "passthrough",
+ allowUnrecognizedUnionMembers: true,
+ allowUnrecognizedEnumValues: true,
+ skipValidation: true,
+ breadcrumbsPrefix: ["response"],
+ })
+ );
+ case 404:
+ throw new DevRev.NotFoundError(
+ serializers.ErrorNotFound.parseOrThrow(_response.error.body, {
+ unrecognizedObjectKeys: "passthrough",
+ allowUnrecognizedUnionMembers: true,
+ allowUnrecognizedEnumValues: true,
+ skipValidation: true,
+ breadcrumbsPrefix: ["response"],
+ })
+ );
+ case 429:
+ throw new DevRev.TooManyRequestsError(
+ serializers.ErrorTooManyRequests.parseOrThrow(_response.error.body, {
+ unrecognizedObjectKeys: "passthrough",
+ allowUnrecognizedUnionMembers: true,
+ allowUnrecognizedEnumValues: true,
+ skipValidation: true,
+ breadcrumbsPrefix: ["response"],
+ })
+ );
+ case 500:
+ throw new DevRev.InternalServerError(
+ serializers.ErrorInternalServerError.parseOrThrow(_response.error.body, {
+ unrecognizedObjectKeys: "passthrough",
+ allowUnrecognizedUnionMembers: true,
+ allowUnrecognizedEnumValues: true,
+ skipValidation: true,
+ breadcrumbsPrefix: ["response"],
+ })
+ );
+ case 503:
+ throw new DevRev.ServiceUnavailableError(
+ serializers.ErrorServiceUnavailable.parseOrThrow(_response.error.body, {
+ unrecognizedObjectKeys: "passthrough",
+ allowUnrecognizedUnionMembers: true,
+ allowUnrecognizedEnumValues: true,
+ skipValidation: true,
+ breadcrumbsPrefix: ["response"],
+ })
+ );
+ default:
+ throw new errors.DevRevError({
+ statusCode: _response.error.statusCode,
+ body: _response.error.body,
+ });
+ }
+ }
+
+ switch (_response.error.reason) {
+ case "non-json":
+ throw new errors.DevRevError({
+ statusCode: _response.error.statusCode,
+ body: _response.error.rawBody,
+ });
+ case "timeout":
+ throw new errors.DevRevTimeoutError();
+ case "unknown":
+ throw new errors.DevRevError({
+ message: _response.error.errorMessage,
+ });
+ }
+ }
+
+ /**
+ * Returns the Rev user of a Rev organization by its ID.
+ *
+ * @param {DevRev.RevUsersGetQuery} request
+ * @param {RevUsers.RequestOptions} requestOptions - Request-specific configuration.
+ *
+ * @throws {@link DevRev.BadRequestError}
+ * @throws {@link DevRev.UnauthorizedError}
+ * @throws {@link DevRev.ForbiddenError}
+ * @throws {@link DevRev.NotFoundError}
+ * @throws {@link DevRev.TooManyRequestsError}
+ * @throws {@link DevRev.InternalServerError}
+ * @throws {@link DevRev.ServiceUnavailableError}
+ *
+ * @example
+ * await client.revUsers.get({
+ * id: "id"
+ * })
+ */
+ public async get(
+ request: DevRev.RevUsersGetQuery,
+ requestOptions?: RevUsers.RequestOptions
+ ): Promise {
+ const { id } = request;
+ const _queryParams: Record = {};
+ _queryParams["id"] = id;
+ const _response = await (this._options.fetcher ?? core.fetcher)({
+ url: urlJoin(
+ (await core.Supplier.get(this._options.environment)) ?? environments.DevRevEnvironment.Default,
+ "rev-users.get"
+ ),
+ method: "GET",
+ headers: {
+ Authorization: await this._getAuthorizationHeader(),
+ "X-Fern-Language": "JavaScript",
+ "X-Fern-SDK-Name": "@devrev/api",
+ "X-Fern-SDK-Version": "0.0.14",
+ "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 serializers.RevUsersGetResponse.parseOrThrow(_response.body, {
+ unrecognizedObjectKeys: "passthrough",
+ allowUnrecognizedUnionMembers: true,
+ allowUnrecognizedEnumValues: true,
+ skipValidation: true,
+ breadcrumbsPrefix: ["response"],
+ });
+ }
+
+ if (_response.error.reason === "status-code") {
+ switch (_response.error.statusCode) {
+ case 400:
+ throw new DevRev.BadRequestError(
+ serializers.ErrorBadRequest.parseOrThrow(_response.error.body, {
+ unrecognizedObjectKeys: "passthrough",
+ allowUnrecognizedUnionMembers: true,
+ allowUnrecognizedEnumValues: true,
+ skipValidation: true,
+ breadcrumbsPrefix: ["response"],
+ })
+ );
+ case 401:
+ throw new DevRev.UnauthorizedError(
+ serializers.ErrorUnauthorized.parseOrThrow(_response.error.body, {
+ unrecognizedObjectKeys: "passthrough",
+ allowUnrecognizedUnionMembers: true,
+ allowUnrecognizedEnumValues: true,
+ skipValidation: true,
+ breadcrumbsPrefix: ["response"],
+ })
+ );
+ case 403:
+ throw new DevRev.ForbiddenError(
+ serializers.ErrorForbidden.parseOrThrow(_response.error.body, {
+ unrecognizedObjectKeys: "passthrough",
+ allowUnrecognizedUnionMembers: true,
+ allowUnrecognizedEnumValues: true,
+ skipValidation: true,
+ breadcrumbsPrefix: ["response"],
+ })
+ );
+ case 404:
+ throw new DevRev.NotFoundError(
+ serializers.ErrorNotFound.parseOrThrow(_response.error.body, {
+ unrecognizedObjectKeys: "passthrough",
+ allowUnrecognizedUnionMembers: true,
+ allowUnrecognizedEnumValues: true,
+ skipValidation: true,
+ breadcrumbsPrefix: ["response"],
+ })
+ );
+ case 429:
+ throw new DevRev.TooManyRequestsError(
+ serializers.ErrorTooManyRequests.parseOrThrow(_response.error.body, {
+ unrecognizedObjectKeys: "passthrough",
+ allowUnrecognizedUnionMembers: true,
+ allowUnrecognizedEnumValues: true,
+ skipValidation: true,
+ breadcrumbsPrefix: ["response"],
+ })
+ );
+ case 500:
+ throw new DevRev.InternalServerError(
+ serializers.ErrorInternalServerError.parseOrThrow(_response.error.body, {
+ unrecognizedObjectKeys: "passthrough",
+ allowUnrecognizedUnionMembers: true,
+ allowUnrecognizedEnumValues: true,
+ skipValidation: true,
+ breadcrumbsPrefix: ["response"],
+ })
+ );
+ case 503:
+ throw new DevRev.ServiceUnavailableError(
+ serializers.ErrorServiceUnavailable.parseOrThrow(_response.error.body, {
+ unrecognizedObjectKeys: "passthrough",
+ allowUnrecognizedUnionMembers: true,
+ allowUnrecognizedEnumValues: true,
+ skipValidation: true,
+ breadcrumbsPrefix: ["response"],
+ })
+ );
+ default:
+ throw new errors.DevRevError({
+ statusCode: _response.error.statusCode,
+ body: _response.error.body,
+ });
+ }
+ }
+
+ switch (_response.error.reason) {
+ case "non-json":
+ throw new errors.DevRevError({
+ statusCode: _response.error.statusCode,
+ body: _response.error.rawBody,
+ });
+ case "timeout":
+ throw new errors.DevRevTimeoutError();
+ case "unknown":
+ throw new errors.DevRevError({
+ message: _response.error.errorMessage,
+ });
+ }
+ }
+
+ /**
+ * Returns the Rev user of a Rev organization by its ID.
+ *
+ * @param {DevRev.RevUsersGetRequest} request
+ * @param {RevUsers.RequestOptions} requestOptions - Request-specific configuration.
+ *
+ * @throws {@link DevRev.BadRequestError}
+ * @throws {@link DevRev.UnauthorizedError}
+ * @throws {@link DevRev.ForbiddenError}
+ * @throws {@link DevRev.NotFoundError}
+ * @throws {@link DevRev.TooManyRequestsError}
+ * @throws {@link DevRev.InternalServerError}
+ * @throws {@link DevRev.ServiceUnavailableError}
+ *
+ * @example
+ * await client.revUsers.getPost({
+ * id: "id"
+ * })
+ */
+ public async getPost(
+ request: DevRev.RevUsersGetRequest,
+ requestOptions?: RevUsers.RequestOptions
+ ): Promise {
+ const _response = await (this._options.fetcher ?? core.fetcher)({
+ url: urlJoin(
+ (await core.Supplier.get(this._options.environment)) ?? environments.DevRevEnvironment.Default,
+ "rev-users.get"
+ ),
+ method: "POST",
+ headers: {
+ Authorization: await this._getAuthorizationHeader(),
+ "X-Fern-Language": "JavaScript",
+ "X-Fern-SDK-Name": "@devrev/api",
+ "X-Fern-SDK-Version": "0.0.14",
+ "X-Fern-Runtime": core.RUNTIME.type,
+ "X-Fern-Runtime-Version": core.RUNTIME.version,
+ },
+ contentType: "application/json",
+ requestType: "json",
+ body: serializers.RevUsersGetRequest.jsonOrThrow(request, { unrecognizedObjectKeys: "strip" }),
+ timeoutMs: requestOptions?.timeoutInSeconds != null ? requestOptions.timeoutInSeconds * 1000 : 60000,
+ maxRetries: requestOptions?.maxRetries,
+ abortSignal: requestOptions?.abortSignal,
+ });
+ if (_response.ok) {
+ return serializers.RevUsersGetResponse.parseOrThrow(_response.body, {
+ unrecognizedObjectKeys: "passthrough",
+ allowUnrecognizedUnionMembers: true,
+ allowUnrecognizedEnumValues: true,
+ skipValidation: true,
+ breadcrumbsPrefix: ["response"],
+ });
+ }
+
+ if (_response.error.reason === "status-code") {
+ switch (_response.error.statusCode) {
+ case 400:
+ throw new DevRev.BadRequestError(
+ serializers.ErrorBadRequest.parseOrThrow(_response.error.body, {
+ unrecognizedObjectKeys: "passthrough",
+ allowUnrecognizedUnionMembers: true,
+ allowUnrecognizedEnumValues: true,
+ skipValidation: true,
+ breadcrumbsPrefix: ["response"],
+ })
+ );
+ case 401:
+ throw new DevRev.UnauthorizedError(
+ serializers.ErrorUnauthorized.parseOrThrow(_response.error.body, {
+ unrecognizedObjectKeys: "passthrough",
+ allowUnrecognizedUnionMembers: true,
+ allowUnrecognizedEnumValues: true,
+ skipValidation: true,
+ breadcrumbsPrefix: ["response"],
+ })
+ );
+ case 403:
+ throw new DevRev.ForbiddenError(
+ serializers.ErrorForbidden.parseOrThrow(_response.error.body, {
+ unrecognizedObjectKeys: "passthrough",
+ allowUnrecognizedUnionMembers: true,
+ allowUnrecognizedEnumValues: true,
+ skipValidation: true,
+ breadcrumbsPrefix: ["response"],
+ })
+ );
+ case 404:
+ throw new DevRev.NotFoundError(
+ serializers.ErrorNotFound.parseOrThrow(_response.error.body, {
+ unrecognizedObjectKeys: "passthrough",
+ allowUnrecognizedUnionMembers: true,
+ allowUnrecognizedEnumValues: true,
+ skipValidation: true,
+ breadcrumbsPrefix: ["response"],
+ })
+ );
+ case 429:
+ throw new DevRev.TooManyRequestsError(
+ serializers.ErrorTooManyRequests.parseOrThrow(_response.error.body, {
+ unrecognizedObjectKeys: "passthrough",
+ allowUnrecognizedUnionMembers: true,
+ allowUnrecognizedEnumValues: true,
+ skipValidation: true,
+ breadcrumbsPrefix: ["response"],
+ })
+ );
+ case 500:
+ throw new DevRev.InternalServerError(
+ serializers.ErrorInternalServerError.parseOrThrow(_response.error.body, {
+ unrecognizedObjectKeys: "passthrough",
+ allowUnrecognizedUnionMembers: true,
+ allowUnrecognizedEnumValues: true,
+ skipValidation: true,
+ breadcrumbsPrefix: ["response"],
+ })
+ );
+ case 503:
+ throw new DevRev.ServiceUnavailableError(
+ serializers.ErrorServiceUnavailable.parseOrThrow(_response.error.body, {
+ unrecognizedObjectKeys: "passthrough",
+ allowUnrecognizedUnionMembers: true,
+ allowUnrecognizedEnumValues: true,
+ skipValidation: true,
+ breadcrumbsPrefix: ["response"],
+ })
+ );
+ default:
+ throw new errors.DevRevError({
+ statusCode: _response.error.statusCode,
+ body: _response.error.body,
+ });
+ }
+ }
+
+ switch (_response.error.reason) {
+ case "non-json":
+ throw new errors.DevRevError({
+ statusCode: _response.error.statusCode,
+ body: _response.error.rawBody,
+ });
+ case "timeout":
+ throw new errors.DevRevTimeoutError();
+ case "unknown":
+ throw new errors.DevRevError({
+ message: _response.error.errorMessage,
+ });
+ }
+ }
+
+ /**
+ * Links a rev user to a rev org.
+ *
+ * @param {DevRev.LinkRevUserToRevOrgRequest} request
+ * @param {RevUsers.RequestOptions} requestOptions - Request-specific configuration.
+ *
+ * @throws {@link DevRev.BadRequestError}
+ * @throws {@link DevRev.UnauthorizedError}
+ * @throws {@link DevRev.ForbiddenError}
+ * @throws {@link DevRev.NotFoundError}
+ * @throws {@link DevRev.TooManyRequestsError}
+ * @throws {@link DevRev.InternalServerError}
+ * @throws {@link DevRev.ServiceUnavailableError}
+ *
+ * @example
+ * await client.revUsers.linkRevUserToRevOrg()
+ */
+ public async linkRevUserToRevOrg(
+ request: DevRev.LinkRevUserToRevOrgRequest = {},
+ requestOptions?: RevUsers.RequestOptions
+ ): Promise {
+ const _response = await (this._options.fetcher ?? core.fetcher)({
+ url: urlJoin(
+ (await core.Supplier.get(this._options.environment)) ?? environments.DevRevEnvironment.Default,
+ "rev-users.link"
+ ),
+ method: "POST",
+ headers: {
+ Authorization: await this._getAuthorizationHeader(),
+ "X-Fern-Language": "JavaScript",
+ "X-Fern-SDK-Name": "@devrev/api",
+ "X-Fern-SDK-Version": "0.0.14",
+ "X-Fern-Runtime": core.RUNTIME.type,
+ "X-Fern-Runtime-Version": core.RUNTIME.version,
+ },
+ contentType: "application/json",
+ requestType: "json",
+ body: serializers.LinkRevUserToRevOrgRequest.jsonOrThrow(request, { unrecognizedObjectKeys: "strip" }),
+ timeoutMs: requestOptions?.timeoutInSeconds != null ? requestOptions.timeoutInSeconds * 1000 : 60000,
+ maxRetries: requestOptions?.maxRetries,
+ abortSignal: requestOptions?.abortSignal,
+ });
+ if (_response.ok) {
+ return serializers.LinkRevUserToRevOrgResponse.parseOrThrow(_response.body, {
+ unrecognizedObjectKeys: "passthrough",
+ allowUnrecognizedUnionMembers: true,
+ allowUnrecognizedEnumValues: true,
+ skipValidation: true,
+ breadcrumbsPrefix: ["response"],
+ });
+ }
+
+ if (_response.error.reason === "status-code") {
+ switch (_response.error.statusCode) {
+ case 400:
+ throw new DevRev.BadRequestError(
+ serializers.ErrorBadRequest.parseOrThrow(_response.error.body, {
+ unrecognizedObjectKeys: "passthrough",
+ allowUnrecognizedUnionMembers: true,
+ allowUnrecognizedEnumValues: true,
+ skipValidation: true,
+ breadcrumbsPrefix: ["response"],
+ })
+ );
+ case 401:
+ throw new DevRev.UnauthorizedError(
+ serializers.ErrorUnauthorized.parseOrThrow(_response.error.body, {
+ unrecognizedObjectKeys: "passthrough",
+ allowUnrecognizedUnionMembers: true,
+ allowUnrecognizedEnumValues: true,
+ skipValidation: true,
+ breadcrumbsPrefix: ["response"],
+ })
+ );
+ case 403:
+ throw new DevRev.ForbiddenError(
+ serializers.ErrorForbidden.parseOrThrow(_response.error.body, {
+ unrecognizedObjectKeys: "passthrough",
+ allowUnrecognizedUnionMembers: true,
+ allowUnrecognizedEnumValues: true,
+ skipValidation: true,
+ breadcrumbsPrefix: ["response"],
+ })
+ );
+ case 404:
+ throw new DevRev.NotFoundError(
+ serializers.ErrorNotFound.parseOrThrow(_response.error.body, {
+ unrecognizedObjectKeys: "passthrough",
+ allowUnrecognizedUnionMembers: true,
+ allowUnrecognizedEnumValues: true,
+ skipValidation: true,
+ breadcrumbsPrefix: ["response"],
+ })
+ );
+ case 429:
+ throw new DevRev.TooManyRequestsError(
+ serializers.ErrorTooManyRequests.parseOrThrow(_response.error.body, {
+ unrecognizedObjectKeys: "passthrough",
+ allowUnrecognizedUnionMembers: true,
+ allowUnrecognizedEnumValues: true,
+ skipValidation: true,
+ breadcrumbsPrefix: ["response"],
+ })
+ );
+ case 500:
+ throw new DevRev.InternalServerError(
+ serializers.ErrorInternalServerError.parseOrThrow(_response.error.body, {
+ unrecognizedObjectKeys: "passthrough",
+ allowUnrecognizedUnionMembers: true,
+ allowUnrecognizedEnumValues: true,
+ skipValidation: true,
+ breadcrumbsPrefix: ["response"],
+ })
+ );
+ case 503:
+ throw new DevRev.ServiceUnavailableError(
+ serializers.ErrorServiceUnavailable.parseOrThrow(_response.error.body, {
+ unrecognizedObjectKeys: "passthrough",
+ allowUnrecognizedUnionMembers: true,
+ allowUnrecognizedEnumValues: true,
+ skipValidation: true,
+ breadcrumbsPrefix: ["response"],
+ })
+ );
+ default:
+ throw new errors.DevRevError({
+ statusCode: _response.error.statusCode,
+ body: _response.error.body,
+ });
+ }
+ }
+
+ switch (_response.error.reason) {
+ case "non-json":
+ throw new errors.DevRevError({
+ statusCode: _response.error.statusCode,
+ body: _response.error.rawBody,
+ });
+ case "timeout":
+ throw new errors.DevRevTimeoutError();
+ case "unknown":
+ throw new errors.DevRevError({
+ message: _response.error.errorMessage,
+ });
+ }
+ }
+
+ /**
+ * Returns a list of all Rev Users belonging to the authenticated user's
+ * Dev Organization.
+ *
+ * @param {DevRev.RevUsersListQuery} request
+ * @param {RevUsers.RequestOptions} requestOptions - Request-specific configuration.
+ *
+ * @throws {@link DevRev.BadRequestError}
+ * @throws {@link DevRev.UnauthorizedError}
+ * @throws {@link DevRev.ForbiddenError}
+ * @throws {@link DevRev.NotFoundError}
+ * @throws {@link DevRev.TooManyRequestsError}
+ * @throws {@link DevRev.InternalServerError}
+ * @throws {@link DevRev.ServiceUnavailableError}
+ *
+ * @example
+ * await client.revUsers.list({
+ * createdDateAfter: new Date("2023-01-01T12:00:00.000Z"),
+ * createdDateBefore: new Date("2023-01-01T12:00:00.000Z"),
+ * modifiedDateAfter: new Date("2023-01-01T12:00:00.000Z"),
+ * modifiedDateBefore: new Date("2023-01-01T12:00:00.000Z")
+ * })
+ */
+ public async list(
+ request: DevRev.RevUsersListQuery = {},
+ requestOptions?: RevUsers.RequestOptions
+ ): Promise {
+ const {
+ createdBy,
+ createdDateAfter,
+ createdDateBefore,
+ cursor,
+ customFields,
+ email,
+ externalRef,
+ isVerified,
+ limit,
+ mode,
+ modifiedDateAfter,
+ modifiedDateBefore,
+ phoneNumbers,
+ revOrg,
+ sortBy,
+ tags,
+ } = request;
+ const _queryParams: Record = {};
+ if (createdBy != null) {
+ if (Array.isArray(createdBy)) {
+ _queryParams["created_by"] = createdBy.map((item) => item);
+ } else {
+ _queryParams["created_by"] = createdBy;
+ }
+ }
+
+ if (createdDateAfter != null) {
+ _queryParams["created_date.after"] = createdDateAfter.toISOString();
+ }
+
+ if (createdDateBefore != null) {
+ _queryParams["created_date.before"] = createdDateBefore.toISOString();
+ }
+
+ if (cursor != null) {
+ _queryParams["cursor"] = cursor;
+ }
+
+ if (customFields != null) {
+ _queryParams["custom_fields"] = JSON.stringify(customFields);
+ }
+
+ if (email != null) {
+ if (Array.isArray(email)) {
+ _queryParams["email"] = email.map((item) => item);
+ } else {
+ _queryParams["email"] = email;
+ }
+ }
+
+ if (externalRef != null) {
+ if (Array.isArray(externalRef)) {
+ _queryParams["external_ref"] = externalRef.map((item) => item);
+ } else {
+ _queryParams["external_ref"] = externalRef;
+ }
+ }
+
+ if (isVerified != null) {
+ _queryParams["is_verified"] = isVerified.toString();
+ }
+
+ if (limit != null) {
+ _queryParams["limit"] = limit.toString();
+ }
+
+ if (mode != null) {
+ _queryParams["mode"] = mode;
+ }
+
+ if (modifiedDateAfter != null) {
+ _queryParams["modified_date.after"] = modifiedDateAfter.toISOString();
+ }
+
+ if (modifiedDateBefore != null) {
+ _queryParams["modified_date.before"] = modifiedDateBefore.toISOString();
+ }
+
+ if (phoneNumbers != null) {
+ if (Array.isArray(phoneNumbers)) {
+ _queryParams["phone_numbers"] = phoneNumbers.map((item) => item);
+ } else {
+ _queryParams["phone_numbers"] = phoneNumbers;
+ }
+ }
+
+ if (revOrg != null) {
+ if (Array.isArray(revOrg)) {
+ _queryParams["rev_org"] = revOrg.map((item) => item);
+ } else {
+ _queryParams["rev_org"] = revOrg;
+ }
+ }
+
+ if (sortBy != null) {
+ if (Array.isArray(sortBy)) {
+ _queryParams["sort_by"] = sortBy.map((item) => item);
+ } else {
+ _queryParams["sort_by"] = sortBy;
+ }
+ }
+
+ if (tags != null) {
+ if (Array.isArray(tags)) {
+ _queryParams["tags"] = tags.map((item) => item);
+ } else {
+ _queryParams["tags"] = tags;
+ }
+ }
+
+ const _response = await (this._options.fetcher ?? core.fetcher)({
+ url: urlJoin(
+ (await core.Supplier.get(this._options.environment)) ?? environments.DevRevEnvironment.Default,
+ "rev-users.list"
+ ),
+ method: "GET",
+ headers: {
+ Authorization: await this._getAuthorizationHeader(),
+ "X-Fern-Language": "JavaScript",
+ "X-Fern-SDK-Name": "@devrev/api",
+ "X-Fern-SDK-Version": "0.0.14",
+ "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 serializers.RevUsersListResponse.parseOrThrow(_response.body, {
+ unrecognizedObjectKeys: "passthrough",
+ allowUnrecognizedUnionMembers: true,
+ allowUnrecognizedEnumValues: true,
+ skipValidation: true,
+ breadcrumbsPrefix: ["response"],
+ });
+ }
+
+ if (_response.error.reason === "status-code") {
+ switch (_response.error.statusCode) {
+ case 400:
+ throw new DevRev.BadRequestError(
+ serializers.ErrorBadRequest.parseOrThrow(_response.error.body, {
+ unrecognizedObjectKeys: "passthrough",
+ allowUnrecognizedUnionMembers: true,
+ allowUnrecognizedEnumValues: true,
+ skipValidation: true,
+ breadcrumbsPrefix: ["response"],
+ })
+ );
+ case 401:
+ throw new DevRev.UnauthorizedError(
+ serializers.ErrorUnauthorized.parseOrThrow(_response.error.body, {
+ unrecognizedObjectKeys: "passthrough",
+ allowUnrecognizedUnionMembers: true,
+ allowUnrecognizedEnumValues: true,
+ skipValidation: true,
+ breadcrumbsPrefix: ["response"],
+ })
+ );
+ case 403:
+ throw new DevRev.ForbiddenError(
+ serializers.ErrorForbidden.parseOrThrow(_response.error.body, {
+ unrecognizedObjectKeys: "passthrough",
+ allowUnrecognizedUnionMembers: true,
+ allowUnrecognizedEnumValues: true,
+ skipValidation: true,
+ breadcrumbsPrefix: ["response"],
+ })
+ );
+ case 404:
+ throw new DevRev.NotFoundError(
+ serializers.ErrorNotFound.parseOrThrow(_response.error.body, {
+ unrecognizedObjectKeys: "passthrough",
+ allowUnrecognizedUnionMembers: true,
+ allowUnrecognizedEnumValues: true,
+ skipValidation: true,
+ breadcrumbsPrefix: ["response"],
+ })
+ );
+ case 429:
+ throw new DevRev.TooManyRequestsError(
+ serializers.ErrorTooManyRequests.parseOrThrow(_response.error.body, {
+ unrecognizedObjectKeys: "passthrough",
+ allowUnrecognizedUnionMembers: true,
+ allowUnrecognizedEnumValues: true,
+ skipValidation: true,
+ breadcrumbsPrefix: ["response"],
+ })
+ );
+ case 500:
+ throw new DevRev.InternalServerError(
+ serializers.ErrorInternalServerError.parseOrThrow(_response.error.body, {
+ unrecognizedObjectKeys: "passthrough",
+ allowUnrecognizedUnionMembers: true,
+ allowUnrecognizedEnumValues: true,
+ skipValidation: true,
+ breadcrumbsPrefix: ["response"],
+ })
+ );
+ case 503:
+ throw new DevRev.ServiceUnavailableError(
+ serializers.ErrorServiceUnavailable.parseOrThrow(_response.error.body, {
+ unrecognizedObjectKeys: "passthrough",
+ allowUnrecognizedUnionMembers: true,
+ allowUnrecognizedEnumValues: true,
+ skipValidation: true,
+ breadcrumbsPrefix: ["response"],
+ })
+ );
+ default:
+ throw new errors.DevRevError({
+ statusCode: _response.error.statusCode,
+ body: _response.error.body,
+ });
+ }
+ }
+
+ switch (_response.error.reason) {
+ case "non-json":
+ throw new errors.DevRevError({
+ statusCode: _response.error.statusCode,
+ body: _response.error.rawBody,
+ });
+ case "timeout":
+ throw new errors.DevRevTimeoutError();
+ case "unknown":
+ throw new errors.DevRevError({
+ message: _response.error.errorMessage,
+ });
+ }
+ }
+
+ /**
+ * Returns a list of all Rev Users belonging to the authenticated user's
+ * Dev Organization.
+ *
+ * @param {DevRev.RevUsersListRequest} request
+ * @param {RevUsers.RequestOptions} requestOptions - Request-specific configuration.
+ *
+ * @throws {@link DevRev.BadRequestError}
+ * @throws {@link DevRev.UnauthorizedError}
+ * @throws {@link DevRev.ForbiddenError}
+ * @throws {@link DevRev.NotFoundError}
+ * @throws {@link DevRev.TooManyRequestsError}
+ * @throws {@link DevRev.InternalServerError}
+ * @throws {@link DevRev.ServiceUnavailableError}
+ *
+ * @example
+ * await client.revUsers.listPost()
+ */
+ public async listPost(
+ request: DevRev.RevUsersListRequest = {},
+ requestOptions?: RevUsers.RequestOptions
+ ): Promise {
+ const _response = await (this._options.fetcher ?? core.fetcher)({
+ url: urlJoin(
+ (await core.Supplier.get(this._options.environment)) ?? environments.DevRevEnvironment.Default,
+ "rev-users.list"
+ ),
+ method: "POST",
+ headers: {
+ Authorization: await this._getAuthorizationHeader(),
+ "X-Fern-Language": "JavaScript",
+ "X-Fern-SDK-Name": "@devrev/api",
+ "X-Fern-SDK-Version": "0.0.14",
+ "X-Fern-Runtime": core.RUNTIME.type,
+ "X-Fern-Runtime-Version": core.RUNTIME.version,
+ },
+ contentType: "application/json",
+ requestType: "json",
+ body: serializers.RevUsersListRequest.jsonOrThrow(request, { unrecognizedObjectKeys: "strip" }),
+ timeoutMs: requestOptions?.timeoutInSeconds != null ? requestOptions.timeoutInSeconds * 1000 : 60000,
+ maxRetries: requestOptions?.maxRetries,
+ abortSignal: requestOptions?.abortSignal,
+ });
+ if (_response.ok) {
+ return serializers.RevUsersListResponse.parseOrThrow(_response.body, {
+ unrecognizedObjectKeys: "passthrough",
+ allowUnrecognizedUnionMembers: true,
+ allowUnrecognizedEnumValues: true,
+ skipValidation: true,
+ breadcrumbsPrefix: ["response"],
+ });
+ }
+
+ if (_response.error.reason === "status-code") {
+ switch (_response.error.statusCode) {
+ case 400:
+ throw new DevRev.BadRequestError(
+ serializers.ErrorBadRequest.parseOrThrow(_response.error.body, {
+ unrecognizedObjectKeys: "passthrough",
+ allowUnrecognizedUnionMembers: true,
+ allowUnrecognizedEnumValues: true,
+ skipValidation: true,
+ breadcrumbsPrefix: ["response"],
+ })
+ );
+ case 401:
+ throw new DevRev.UnauthorizedError(
+ serializers.ErrorUnauthorized.parseOrThrow(_response.error.body, {
+ unrecognizedObjectKeys: "passthrough",
+ allowUnrecognizedUnionMembers: true,
+ allowUnrecognizedEnumValues: true,
+ skipValidation: true,
+ breadcrumbsPrefix: ["response"],
+ })
+ );
+ case 403:
+ throw new DevRev.ForbiddenError(
+ serializers.ErrorForbidden.parseOrThrow(_response.error.body, {
+ unrecognizedObjectKeys: "passthrough",
+ allowUnrecognizedUnionMembers: true,
+ allowUnrecognizedEnumValues: true,
+ skipValidation: true,
+ breadcrumbsPrefix: ["response"],
+ })
+ );
+ case 404:
+ throw new DevRev.NotFoundError(
+ serializers.ErrorNotFound.parseOrThrow(_response.error.body, {
+ unrecognizedObjectKeys: "passthrough",
+ allowUnrecognizedUnionMembers: true,
+ allowUnrecognizedEnumValues: true,
+ skipValidation: true,
+ breadcrumbsPrefix: ["response"],
+ })
+ );
+ case 429:
+ throw new DevRev.TooManyRequestsError(
+ serializers.ErrorTooManyRequests.parseOrThrow(_response.error.body, {
+ unrecognizedObjectKeys: "passthrough",
+ allowUnrecognizedUnionMembers: true,
+ allowUnrecognizedEnumValues: true,
+ skipValidation: true,
+ breadcrumbsPrefix: ["response"],
+ })
+ );
+ case 500:
+ throw new DevRev.InternalServerError(
+ serializers.ErrorInternalServerError.parseOrThrow(_response.error.body, {
+ unrecognizedObjectKeys: "passthrough",
+ allowUnrecognizedUnionMembers: true,
+ allowUnrecognizedEnumValues: true,
+ skipValidation: true,
+ breadcrumbsPrefix: ["response"],
+ })
+ );
+ case 503:
+ throw new DevRev.ServiceUnavailableError(
+ serializers.ErrorServiceUnavailable.parseOrThrow(_response.error.body, {
+ unrecognizedObjectKeys: "passthrough",
+ allowUnrecognizedUnionMembers: true,
+ allowUnrecognizedEnumValues: true,
+ skipValidation: true,
+ breadcrumbsPrefix: ["response"],
+ })
+ );
+ default:
+ throw new errors.DevRevError({
+ statusCode: _response.error.statusCode,
+ body: _response.error.body,
+ });
+ }
+ }
+
+ switch (_response.error.reason) {
+ case "non-json":
+ throw new errors.DevRevError({
+ statusCode: _response.error.statusCode,
+ body: _response.error.rawBody,
+ });
+ case "timeout":
+ throw new errors.DevRevTimeoutError();
+ case "unknown":
+ throw new errors.DevRevError({
+ message: _response.error.errorMessage,
+ });
+ }
+ }
+
+ /**
+ * Unlinks a rev user from a rev org.
+ *
+ * @param {DevRev.UnlinkRevUserFromRevOrgRequest} request
+ * @param {RevUsers.RequestOptions} requestOptions - Request-specific configuration.
+ *
+ * @throws {@link DevRev.BadRequestError}
+ * @throws {@link DevRev.UnauthorizedError}
+ * @throws {@link DevRev.ForbiddenError}
+ * @throws {@link DevRev.NotFoundError}
+ * @throws {@link DevRev.TooManyRequestsError}
+ * @throws {@link DevRev.InternalServerError}
+ * @throws {@link DevRev.ServiceUnavailableError}
+ *
+ * @example
+ * await client.revUsers.unlinkRevUserFromRevOrg()
+ */
+ public async unlinkRevUserFromRevOrg(
+ request: DevRev.UnlinkRevUserFromRevOrgRequest = {},
+ requestOptions?: RevUsers.RequestOptions
+ ): Promise {
+ const _response = await (this._options.fetcher ?? core.fetcher)({
+ url: urlJoin(
+ (await core.Supplier.get(this._options.environment)) ?? environments.DevRevEnvironment.Default,
+ "rev-users.unlink"
+ ),
+ method: "POST",
+ headers: {
+ Authorization: await this._getAuthorizationHeader(),
+ "X-Fern-Language": "JavaScript",
+ "X-Fern-SDK-Name": "@devrev/api",
+ "X-Fern-SDK-Version": "0.0.14",
+ "X-Fern-Runtime": core.RUNTIME.type,
+ "X-Fern-Runtime-Version": core.RUNTIME.version,
+ },
+ contentType: "application/json",
+ requestType: "json",
+ body: serializers.UnlinkRevUserFromRevOrgRequest.jsonOrThrow(request, { unrecognizedObjectKeys: "strip" }),
+ timeoutMs: requestOptions?.timeoutInSeconds != null ? requestOptions.timeoutInSeconds * 1000 : 60000,
+ maxRetries: requestOptions?.maxRetries,
+ abortSignal: requestOptions?.abortSignal,
+ });
+ if (_response.ok) {
+ return serializers.UnlinkRevUserFromRevOrgResponse.parseOrThrow(_response.body, {
+ unrecognizedObjectKeys: "passthrough",
+ allowUnrecognizedUnionMembers: true,
+ allowUnrecognizedEnumValues: true,
+ skipValidation: true,
+ breadcrumbsPrefix: ["response"],
+ });
+ }
+
+ if (_response.error.reason === "status-code") {
+ switch (_response.error.statusCode) {
+ case 400:
+ throw new DevRev.BadRequestError(
+ serializers.ErrorBadRequest.parseOrThrow(_response.error.body, {
+ unrecognizedObjectKeys: "passthrough",
+ allowUnrecognizedUnionMembers: true,
+ allowUnrecognizedEnumValues: true,
+ skipValidation: true,
+ breadcrumbsPrefix: ["response"],
+ })
+ );
+ case 401:
+ throw new DevRev.UnauthorizedError(
+ serializers.ErrorUnauthorized.parseOrThrow(_response.error.body, {
+ unrecognizedObjectKeys: "passthrough",
+ allowUnrecognizedUnionMembers: true,
+ allowUnrecognizedEnumValues: true,
+ skipValidation: true,
+ breadcrumbsPrefix: ["response"],
+ })
+ );
+ case 403:
+ throw new DevRev.ForbiddenError(
+ serializers.ErrorForbidden.parseOrThrow(_response.error.body, {
+ unrecognizedObjectKeys: "passthrough",
+ allowUnrecognizedUnionMembers: true,
+ allowUnrecognizedEnumValues: true,
+ skipValidation: true,
+ breadcrumbsPrefix: ["response"],
+ })
+ );
+ case 404:
+ throw new DevRev.NotFoundError(
+ serializers.ErrorNotFound.parseOrThrow(_response.error.body, {
+ unrecognizedObjectKeys: "passthrough",
+ allowUnrecognizedUnionMembers: true,
+ allowUnrecognizedEnumValues: true,
+ skipValidation: true,
+ breadcrumbsPrefix: ["response"],
+ })
+ );
+ case 429:
+ throw new DevRev.TooManyRequestsError(
+ serializers.ErrorTooManyRequests.parseOrThrow(_response.error.body, {
+ unrecognizedObjectKeys: "passthrough",
+ allowUnrecognizedUnionMembers: true,
+ allowUnrecognizedEnumValues: true,
+ skipValidation: true,
+ breadcrumbsPrefix: ["response"],
+ })
+ );
+ case 500:
+ throw new DevRev.InternalServerError(
+ serializers.ErrorInternalServerError.parseOrThrow(_response.error.body, {
+ unrecognizedObjectKeys: "passthrough",
+ allowUnrecognizedUnionMembers: true,
+ allowUnrecognizedEnumValues: true,
+ skipValidation: true,
+ breadcrumbsPrefix: ["response"],
+ })
+ );
+ case 503:
+ throw new DevRev.ServiceUnavailableError(
+ serializers.ErrorServiceUnavailable.parseOrThrow(_response.error.body, {
+ unrecognizedObjectKeys: "passthrough",
+ allowUnrecognizedUnionMembers: true,
+ allowUnrecognizedEnumValues: true,
+ skipValidation: true,
+ breadcrumbsPrefix: ["response"],
+ })
+ );
+ default:
+ throw new errors.DevRevError({
+ statusCode: _response.error.statusCode,
+ body: _response.error.body,
+ });
+ }
+ }
+
+ switch (_response.error.reason) {
+ case "non-json":
+ throw new errors.DevRevError({
+ statusCode: _response.error.statusCode,
+ body: _response.error.rawBody,
+ });
+ case "timeout":
+ throw new errors.DevRevTimeoutError();
+ case "unknown":
+ throw new errors.DevRevError({
+ message: _response.error.errorMessage,
+ });
+ }
+ }
+
+ /**
+ * Updates a Rev user.
+ *
+ * @param {DevRev.RevUsersUpdateRequest} request
+ * @param {RevUsers.RequestOptions} requestOptions - Request-specific configuration.
+ *
+ * @throws {@link DevRev.BadRequestError}
+ * @throws {@link DevRev.UnauthorizedError}
+ * @throws {@link DevRev.ForbiddenError}
+ * @throws {@link DevRev.NotFoundError}
+ * @throws {@link DevRev.ConflictError}
+ * @throws {@link DevRev.TooManyRequestsError}
+ * @throws {@link DevRev.InternalServerError}
+ * @throws {@link DevRev.ServiceUnavailableError}
+ *
+ * @example
+ * await client.revUsers.update({
+ * id: "id"
+ * })
+ */
+ public async update(
+ request: DevRev.RevUsersUpdateRequest,
+ requestOptions?: RevUsers.RequestOptions
+ ): Promise {
+ const _response = await (this._options.fetcher ?? core.fetcher)({
+ url: urlJoin(
+ (await core.Supplier.get(this._options.environment)) ?? environments.DevRevEnvironment.Default,
+ "rev-users.update"
+ ),
+ method: "POST",
+ headers: {
+ Authorization: await this._getAuthorizationHeader(),
+ "X-Fern-Language": "JavaScript",
+ "X-Fern-SDK-Name": "@devrev/api",
+ "X-Fern-SDK-Version": "0.0.14",
+ "X-Fern-Runtime": core.RUNTIME.type,
+ "X-Fern-Runtime-Version": core.RUNTIME.version,
+ },
+ contentType: "application/json",
+ requestType: "json",
+ body: serializers.RevUsersUpdateRequest.jsonOrThrow(request, { unrecognizedObjectKeys: "strip" }),
+ timeoutMs: requestOptions?.timeoutInSeconds != null ? requestOptions.timeoutInSeconds * 1000 : 60000,
+ maxRetries: requestOptions?.maxRetries,
+ abortSignal: requestOptions?.abortSignal,
+ });
+ if (_response.ok) {
+ return serializers.RevUsersUpdateResponse.parseOrThrow(_response.body, {
+ unrecognizedObjectKeys: "passthrough",
+ allowUnrecognizedUnionMembers: true,
+ allowUnrecognizedEnumValues: true,
+ skipValidation: true,
+ breadcrumbsPrefix: ["response"],
+ });
+ }
+
+ if (_response.error.reason === "status-code") {
+ switch (_response.error.statusCode) {
+ case 400:
+ throw new DevRev.BadRequestError(
+ serializers.ErrorBadRequest.parseOrThrow(_response.error.body, {
+ unrecognizedObjectKeys: "passthrough",
+ allowUnrecognizedUnionMembers: true,
+ allowUnrecognizedEnumValues: true,
+ skipValidation: true,
+ breadcrumbsPrefix: ["response"],
+ })
+ );
+ case 401:
+ throw new DevRev.UnauthorizedError(
+ serializers.ErrorUnauthorized.parseOrThrow(_response.error.body, {
+ unrecognizedObjectKeys: "passthrough",
+ allowUnrecognizedUnionMembers: true,
+ allowUnrecognizedEnumValues: true,
+ skipValidation: true,
+ breadcrumbsPrefix: ["response"],
+ })
+ );
+ case 403:
+ throw new DevRev.ForbiddenError(
+ serializers.ErrorForbidden.parseOrThrow(_response.error.body, {
+ unrecognizedObjectKeys: "passthrough",
+ allowUnrecognizedUnionMembers: true,
+ allowUnrecognizedEnumValues: true,
+ skipValidation: true,
+ breadcrumbsPrefix: ["response"],
+ })
+ );
+ case 404:
+ throw new DevRev.NotFoundError(
+ serializers.ErrorNotFound.parseOrThrow(_response.error.body, {
+ unrecognizedObjectKeys: "passthrough",
+ allowUnrecognizedUnionMembers: true,
+ allowUnrecognizedEnumValues: true,
+ skipValidation: true,
+ breadcrumbsPrefix: ["response"],
+ })
+ );
+ case 409:
+ throw new DevRev.ConflictError(
+ serializers.ErrorConflict.parseOrThrow(_response.error.body, {
+ unrecognizedObjectKeys: "passthrough",
+ allowUnrecognizedUnionMembers: true,
+ allowUnrecognizedEnumValues: true,
+ skipValidation: true,
+ breadcrumbsPrefix: ["response"],
+ })
+ );
+ case 429:
+ throw new DevRev.TooManyRequestsError(
+ serializers.ErrorTooManyRequests.parseOrThrow(_response.error.body, {
+ unrecognizedObjectKeys: "passthrough",
+ allowUnrecognizedUnionMembers: true,
+ allowUnrecognizedEnumValues: true,
+ skipValidation: true,
+ breadcrumbsPrefix: ["response"],
+ })
+ );
+ case 500:
+ throw new DevRev.InternalServerError(
+ serializers.ErrorInternalServerError.parseOrThrow(_response.error.body, {
+ unrecognizedObjectKeys: "passthrough",
+ allowUnrecognizedUnionMembers: true,
+ allowUnrecognizedEnumValues: true,
+ skipValidation: true,
+ breadcrumbsPrefix: ["response"],
+ })
+ );
+ case 503:
+ throw new DevRev.ServiceUnavailableError(
+ serializers.ErrorServiceUnavailable.parseOrThrow(_response.error.body, {
+ unrecognizedObjectKeys: "passthrough",
+ allowUnrecognizedUnionMembers: true,
+ allowUnrecognizedEnumValues: true,
+ skipValidation: true,
+ breadcrumbsPrefix: ["response"],
+ })
+ );
+ default:
+ throw new errors.DevRevError({
+ statusCode: _response.error.statusCode,
+ body: _response.error.body,
+ });
+ }
+ }
+
+ switch (_response.error.reason) {
+ case "non-json":
+ throw new errors.DevRevError({
+ statusCode: _response.error.statusCode,
+ body: _response.error.rawBody,
+ });
+ case "timeout":
+ throw new errors.DevRevTimeoutError();
+ case "unknown":
+ throw new errors.DevRevError({
+ message: _response.error.errorMessage,
+ });
+ }
+ }
+
+ protected async _getAuthorizationHeader(): Promise {
+ const bearer = (await core.Supplier.get(this._options.token)) ?? process?.env["DEVREV_TOKEN"];
+ if (bearer == null) {
+ throw new errors.DevRevError({
+ message: "Please specify DEVREV_TOKEN when instantiating the client.",
+ });
+ }
+
+ return `Bearer ${bearer}`;
+ }
+}
diff --git a/src/api/resources/revUsers/client/index.ts b/src/api/resources/revUsers/client/index.ts
new file mode 100644
index 0000000..415726b
--- /dev/null
+++ b/src/api/resources/revUsers/client/index.ts
@@ -0,0 +1 @@
+export * from "./requests";
diff --git a/src/api/resources/revUsers/client/requests/LinkRevUserToRevOrgRequest.ts b/src/api/resources/revUsers/client/requests/LinkRevUserToRevOrgRequest.ts
new file mode 100644
index 0000000..fa081cf
--- /dev/null
+++ b/src/api/resources/revUsers/client/requests/LinkRevUserToRevOrgRequest.ts
@@ -0,0 +1,26 @@
+/**
+ * This file was auto-generated by Fern from our API Definition.
+ */
+
+/**
+ * @example
+ * {}
+ */
+export interface LinkRevUserToRevOrgRequest {
+ /** The ID of the Rev user. */
+ id?: string;
+ /** The ID of the Rev organization to link the Rev user to. */
+ revOrg?: string;
+ /**
+ * The don of the rev org to link the rev user to. This is deprecated,
+ * use rev_org instead.
+ *
+ */
+ revOrgDon?: string;
+ /**
+ * The don of the rev user to link. This is deprecated, use id
+ * instead.
+ *
+ */
+ userDon?: string;
+}
diff --git a/src/api/resources/revUsers/client/requests/RevUsersCreateRequest.ts b/src/api/resources/revUsers/client/requests/RevUsersCreateRequest.ts
new file mode 100644
index 0000000..bce84a6
--- /dev/null
+++ b/src/api/resources/revUsers/client/requests/RevUsersCreateRequest.ts
@@ -0,0 +1,51 @@
+/**
+ * This file was auto-generated by Fern from our API Definition.
+ */
+
+import * as DevRev from "../../../../index";
+
+/**
+ * @example
+ * {}
+ */
+export interface RevUsersCreateRequest {
+ /**
+ * The ID of the account to which the created Rev user is associated.
+ *
+ */
+ account?: string;
+ /** The IDs of the artifacts to associate with the Rev user. */
+ artifacts?: string[];
+ /** Application-defined custom fields. */
+ customFields?: Record;
+ /** The schema fragment IDs associated with the Rev user. */
+ customSchemaFragments?: string[];
+ /** Description of the Rev user. */
+ description?: string;
+ /**
+ * The user's display name. The name is non-unique and mutable.
+ *
+ */
+ displayName?: string;
+ /** Email address of the Rev user. */
+ email?: string;
+ /**
+ * External ref is a mutable unique identifier for a user within the
+ * Dev organization from your primary customer record. If none is
+ * available, a good alternative is the email address/phone number
+ * which could uniquely identify the user. If none is specified, a
+ * system-generated identifier will be assigned to the user.
+ *
+ */
+ externalRef?: string;
+ /** Phone numbers, in E.164 format, of the Rev user. */
+ phoneNumbers?: string[];
+ /**
+ * The ID of the Rev organization to which the created Rev user is
+ * associated.
+ *
+ */
+ revOrg?: string;
+ /** Tags associated with the Rev user. */
+ tags?: DevRev.SetTagWithValue[];
+}
diff --git a/src/api/resources/revUsers/client/requests/RevUsersDeleteRequest.ts b/src/api/resources/revUsers/client/requests/RevUsersDeleteRequest.ts
new file mode 100644
index 0000000..dca41d2
--- /dev/null
+++ b/src/api/resources/revUsers/client/requests/RevUsersDeleteRequest.ts
@@ -0,0 +1,14 @@
+/**
+ * This file was auto-generated by Fern from our API Definition.
+ */
+
+/**
+ * @example
+ * {
+ * id: "id"
+ * }
+ */
+export interface RevUsersDeleteRequest {
+ /** The ID of Rev user to delete. */
+ id: string;
+}
diff --git a/src/api/resources/revUsers/client/requests/RevUsersGetQuery.ts b/src/api/resources/revUsers/client/requests/RevUsersGetQuery.ts
new file mode 100644
index 0000000..e76ce89
--- /dev/null
+++ b/src/api/resources/revUsers/client/requests/RevUsersGetQuery.ts
@@ -0,0 +1,16 @@
+/**
+ * This file was auto-generated by Fern from our API Definition.
+ */
+
+/**
+ * @example
+ * {
+ * id: "id"
+ * }
+ */
+export interface RevUsersGetQuery {
+ /**
+ * The ID of Rev user to be retrieved.
+ */
+ id: string;
+}
diff --git a/src/api/resources/revUsers/client/requests/RevUsersGetRequest.ts b/src/api/resources/revUsers/client/requests/RevUsersGetRequest.ts
new file mode 100644
index 0000000..249d92f
--- /dev/null
+++ b/src/api/resources/revUsers/client/requests/RevUsersGetRequest.ts
@@ -0,0 +1,14 @@
+/**
+ * This file was auto-generated by Fern from our API Definition.
+ */
+
+/**
+ * @example
+ * {
+ * id: "id"
+ * }
+ */
+export interface RevUsersGetRequest {
+ /** The ID of Rev user to be retrieved. */
+ id: string;
+}
diff --git a/src/api/resources/revUsers/client/requests/RevUsersListQuery.ts b/src/api/resources/revUsers/client/requests/RevUsersListQuery.ts
new file mode 100644
index 0000000..ec18a2c
--- /dev/null
+++ b/src/api/resources/revUsers/client/requests/RevUsersListQuery.ts
@@ -0,0 +1,85 @@
+/**
+ * This file was auto-generated by Fern from our API Definition.
+ */
+
+import * as DevRev from "../../../../index";
+
+/**
+ * @example
+ * {
+ * createdDateAfter: new Date("2023-01-01T12:00:00.000Z"),
+ * createdDateBefore: new Date("2023-01-01T12:00:00.000Z"),
+ * modifiedDateAfter: new Date("2023-01-01T12:00:00.000Z"),
+ * modifiedDateBefore: new Date("2023-01-01T12:00:00.000Z")
+ * }
+ */
+export interface RevUsersListQuery {
+ /**
+ * Filters for Rev users that were created by the specified user(s).
+ */
+ createdBy?: string | string[];
+ /**
+ * Filters for objects created after the provided timestamp (inclusive).
+ */
+ createdDateAfter?: Date;
+ /**
+ * Filters for objects created before the provided timestamp
+ * (inclusive).
+ */
+ createdDateBefore?: Date;
+ /**
+ * The cursor to resume iteration from. If not provided, then iteration
+ * starts from the beginning.
+ */
+ cursor?: string;
+ /**
+ * Filters for custom fields.
+ */
+ customFields?: Record;
+ /**
+ * List of emails of Rev users to be filtered.
+ */
+ email?: string | string[];
+ /**
+ * List of external refs to filter Rev users for.
+ */
+ externalRef?: string | string[];
+ /**
+ * Value of is_verified field to filter the Rev users.
+ */
+ isVerified?: boolean;
+ /**
+ * The maximum number of Rev users to return. The default is '50'.
+ */
+ limit?: number;
+ /**
+ * The iteration mode to use, otherwise if not set, then "after" is
+ * used.
+ */
+ mode?: DevRev.ListMode;
+ /**
+ * Filters for objects created after the provided timestamp (inclusive).
+ */
+ modifiedDateAfter?: Date;
+ /**
+ * Filters for objects created before the provided timestamp
+ * (inclusive).
+ */
+ modifiedDateBefore?: Date;
+ /**
+ * List of phone numbers, in E.164 format, to filter Rev users on.
+ */
+ phoneNumbers?: string | string[];
+ /**
+ * List of IDs of Rev organizations to be filtered.
+ */
+ revOrg?: string | string[];
+ /**
+ * Fields to sort the Rev users by and the direction to sort them.
+ */
+ sortBy?: string | string[];
+ /**
+ * List of tags to be filtered.
+ */
+ tags?: string | string[];
+}
diff --git a/src/api/resources/revUsers/client/requests/RevUsersListRequest.ts b/src/api/resources/revUsers/client/requests/RevUsersListRequest.ts
new file mode 100644
index 0000000..7c4cfe7
--- /dev/null
+++ b/src/api/resources/revUsers/client/requests/RevUsersListRequest.ts
@@ -0,0 +1,53 @@
+/**
+ * This file was auto-generated by Fern from our API Definition.
+ */
+
+import * as DevRev from "../../../../index";
+
+/**
+ * @example
+ * {}
+ */
+export interface RevUsersListRequest {
+ /**
+ * Filters for Rev users that were created by the specified user(s).
+ *
+ */
+ createdBy?: string[];
+ createdDate?: DevRev.DateTimeFilter;
+ /**
+ * The cursor to resume iteration from. If not provided, then
+ * iteration starts from the beginning.
+ *
+ */
+ cursor?: string;
+ /** Filters for custom fields. */
+ customFields?: Record;
+ /** List of emails of Rev users to be filtered. */
+ email?: string[];
+ /** List of external refs to filter Rev users for. */
+ externalRef?: string[];
+ /** Value of is_verified field to filter the Rev users. */
+ isVerified?: boolean;
+ /**
+ * The maximum number of Rev users to return. The default is '50'.
+ *
+ */
+ limit?: number;
+ mode?: DevRev.ListMode;
+ modifiedDate?: DevRev.DateTimeFilter;
+ /**
+ * List of phone numbers, in E.164 format, to filter Rev users on.
+ *
+ */
+ phoneNumbers?: string[];
+ /** List of IDs of Rev organizations to be filtered. */
+ revOrg?: string[];
+ /**
+ * Fields to sort the Rev users by and the direction to sort them.
+ *
+ */
+ sortBy?: string[];
+ /** List of tags to be filtered. */
+ tags?: string[];
+}
diff --git a/src/api/resources/revUsers/client/requests/RevUsersUpdateRequest.ts b/src/api/resources/revUsers/client/requests/RevUsersUpdateRequest.ts
new file mode 100644
index 0000000..80c4b4c
--- /dev/null
+++ b/src/api/resources/revUsers/client/requests/RevUsersUpdateRequest.ts
@@ -0,0 +1,32 @@
+/**
+ * This file was auto-generated by Fern from our API Definition.
+ */
+
+import * as DevRev from "../../../../index";
+
+/**
+ * @example
+ * {
+ * id: "id"
+ * }
+ */
+export interface RevUsersUpdateRequest {
+ artifacts?: DevRev.RevUsersUpdateRequestArtifacts;
+ /** Application-defined custom fields. */
+ customFields?: Record;
+ customSchemaFragments?: DevRev.RevUsersUpdateRequestCustomSchemaFragments;
+ /** Updated description of the Rev user. */
+ description?: string;
+ /** Updated display name of the Rev user. */
+ displayName?: string;
+ /** Updated email address of the Rev user. */
+ email?: string;
+ /** Updated external ref value of the Rev user. */
+ externalRef?: string;
+ /** The ID of Rev user to update. */
+ id: string;
+ /** The phone numbers, in E.164 format, of the Rev user. */
+ phoneNumbers?: string[];
+ /** Tags associated with the Rev user. */
+ tags?: DevRev.SetTagWithValue[];
+}
diff --git a/src/api/resources/revUsers/client/requests/UnlinkRevUserFromRevOrgRequest.ts b/src/api/resources/revUsers/client/requests/UnlinkRevUserFromRevOrgRequest.ts
new file mode 100644
index 0000000..594a638
--- /dev/null
+++ b/src/api/resources/revUsers/client/requests/UnlinkRevUserFromRevOrgRequest.ts
@@ -0,0 +1,29 @@
+/**
+ * This file was auto-generated by Fern from our API Definition.
+ */
+
+/**
+ * @example
+ * {}
+ */
+export interface UnlinkRevUserFromRevOrgRequest {
+ /** The ID of the Rev user. */
+ id?: string;
+ /**
+ * The ID of the Rev organization to unlink the Rev user from.
+ *
+ */
+ revOrg?: string;
+ /**
+ * The don of the rev org to unlink the rev user from. This is
+ * deprecated, use rev_org instead.
+ *
+ */
+ revOrgDon?: string;
+ /**
+ * The don of the rev user to unlink. This is deprecated, use id
+ * instead.
+ *
+ */
+ userDon?: string;
+}
diff --git a/src/api/resources/revUsers/client/requests/index.ts b/src/api/resources/revUsers/client/requests/index.ts
new file mode 100644
index 0000000..20d2e2c
--- /dev/null
+++ b/src/api/resources/revUsers/client/requests/index.ts
@@ -0,0 +1,9 @@
+export { type RevUsersCreateRequest } from "./RevUsersCreateRequest";
+export { type RevUsersDeleteRequest } from "./RevUsersDeleteRequest";
+export { type RevUsersGetQuery } from "./RevUsersGetQuery";
+export { type RevUsersGetRequest } from "./RevUsersGetRequest";
+export { type LinkRevUserToRevOrgRequest } from "./LinkRevUserToRevOrgRequest";
+export { type RevUsersListQuery } from "./RevUsersListQuery";
+export { type RevUsersListRequest } from "./RevUsersListRequest";
+export { type UnlinkRevUserFromRevOrgRequest } from "./UnlinkRevUserFromRevOrgRequest";
+export { type RevUsersUpdateRequest } from "./RevUsersUpdateRequest";
diff --git a/src/api/resources/revUsers/index.ts b/src/api/resources/revUsers/index.ts
new file mode 100644
index 0000000..5ec7692
--- /dev/null
+++ b/src/api/resources/revUsers/index.ts
@@ -0,0 +1 @@
+export * from "./client";
diff --git a/src/api/resources/schedules/client/Client.ts b/src/api/resources/schedules/client/Client.ts
new file mode 100644
index 0000000..f810fc2
--- /dev/null
+++ b/src/api/resources/schedules/client/Client.ts
@@ -0,0 +1,1972 @@
+/**
+ * This file was auto-generated by Fern from our API Definition.
+ */
+
+import * as environments from "../../../../environments";
+import * as core from "../../../../core";
+import * as DevRev from "../../../index";
+import * as serializers from "../../../../serialization/index";
+import urlJoin from "url-join";
+import * as errors from "../../../../errors/index";
+
+export declare namespace Schedules {
+ interface Options {
+ environment?: core.Supplier;
+ token?: 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;
+ }
+}
+
+/**
+ * Management APIs for availability schedules.
+ */
+export class Schedules {
+ constructor(protected readonly _options: Schedules.Options = {}) {}
+
+ /**
+ * Creates an organization schedule fragment.
+ *
+ * @param {DevRev.OrgScheduleFragmentsCreateRequest} request
+ * @param {Schedules.RequestOptions} requestOptions - Request-specific configuration.
+ *
+ * @throws {@link DevRev.BadRequestError}
+ * @throws {@link DevRev.UnauthorizedError}
+ * @throws {@link DevRev.ForbiddenError}
+ * @throws {@link DevRev.TooManyRequestsError}
+ * @throws {@link DevRev.InternalServerError}
+ * @throws {@link DevRev.ServiceUnavailableError}
+ *
+ * @example
+ * await client.schedules.orgScheduleFragmentsCreate({
+ * from: new Date("2023-01-01T12:00:00.000Z"),
+ * intervals: [{
+ * from: new Date("2023-01-01T12:00:00.000Z"),
+ * name: "name"
+ * }],
+ * name: "name",
+ * to: new Date("2023-01-01T12:00:00.000Z")
+ * })
+ */
+ public async orgScheduleFragmentsCreate(
+ request: DevRev.OrgScheduleFragmentsCreateRequest,
+ requestOptions?: Schedules.RequestOptions
+ ): Promise {
+ const _response = await (this._options.fetcher ?? core.fetcher)({
+ url: urlJoin(
+ (await core.Supplier.get(this._options.environment)) ?? environments.DevRevEnvironment.Default,
+ "org-schedule-fragments.create"
+ ),
+ method: "POST",
+ headers: {
+ Authorization: await this._getAuthorizationHeader(),
+ "X-Fern-Language": "JavaScript",
+ "X-Fern-SDK-Name": "@devrev/api",
+ "X-Fern-SDK-Version": "0.0.14",
+ "X-Fern-Runtime": core.RUNTIME.type,
+ "X-Fern-Runtime-Version": core.RUNTIME.version,
+ },
+ contentType: "application/json",
+ requestType: "json",
+ body: serializers.OrgScheduleFragmentsCreateRequest.jsonOrThrow(request, {
+ unrecognizedObjectKeys: "strip",
+ }),
+ timeoutMs: requestOptions?.timeoutInSeconds != null ? requestOptions.timeoutInSeconds * 1000 : 60000,
+ maxRetries: requestOptions?.maxRetries,
+ abortSignal: requestOptions?.abortSignal,
+ });
+ if (_response.ok) {
+ return serializers.OrgScheduleFragmentsCreateResponse.parseOrThrow(_response.body, {
+ unrecognizedObjectKeys: "passthrough",
+ allowUnrecognizedUnionMembers: true,
+ allowUnrecognizedEnumValues: true,
+ skipValidation: true,
+ breadcrumbsPrefix: ["response"],
+ });
+ }
+
+ if (_response.error.reason === "status-code") {
+ switch (_response.error.statusCode) {
+ case 400:
+ throw new DevRev.BadRequestError(
+ serializers.ErrorBadRequest.parseOrThrow(_response.error.body, {
+ unrecognizedObjectKeys: "passthrough",
+ allowUnrecognizedUnionMembers: true,
+ allowUnrecognizedEnumValues: true,
+ skipValidation: true,
+ breadcrumbsPrefix: ["response"],
+ })
+ );
+ case 401:
+ throw new DevRev.UnauthorizedError(
+ serializers.ErrorUnauthorized.parseOrThrow(_response.error.body, {
+ unrecognizedObjectKeys: "passthrough",
+ allowUnrecognizedUnionMembers: true,
+ allowUnrecognizedEnumValues: true,
+ skipValidation: true,
+ breadcrumbsPrefix: ["response"],
+ })
+ );
+ case 403:
+ throw new DevRev.ForbiddenError(
+ serializers.ErrorForbidden.parseOrThrow(_response.error.body, {
+ unrecognizedObjectKeys: "passthrough",
+ allowUnrecognizedUnionMembers: true,
+ allowUnrecognizedEnumValues: true,
+ skipValidation: true,
+ breadcrumbsPrefix: ["response"],
+ })
+ );
+ case 429:
+ throw new DevRev.TooManyRequestsError(
+ serializers.ErrorTooManyRequests.parseOrThrow(_response.error.body, {
+ unrecognizedObjectKeys: "passthrough",
+ allowUnrecognizedUnionMembers: true,
+ allowUnrecognizedEnumValues: true,
+ skipValidation: true,
+ breadcrumbsPrefix: ["response"],
+ })
+ );
+ case 500:
+ throw new DevRev.InternalServerError(
+ serializers.ErrorInternalServerError.parseOrThrow(_response.error.body, {
+ unrecognizedObjectKeys: "passthrough",
+ allowUnrecognizedUnionMembers: true,
+ allowUnrecognizedEnumValues: true,
+ skipValidation: true,
+ breadcrumbsPrefix: ["response"],
+ })
+ );
+ case 503:
+ throw new DevRev.ServiceUnavailableError(
+ serializers.ErrorServiceUnavailable.parseOrThrow(_response.error.body, {
+ unrecognizedObjectKeys: "passthrough",
+ allowUnrecognizedUnionMembers: true,
+ allowUnrecognizedEnumValues: true,
+ skipValidation: true,
+ breadcrumbsPrefix: ["response"],
+ })
+ );
+ default:
+ throw new errors.DevRevError({
+ statusCode: _response.error.statusCode,
+ body: _response.error.body,
+ });
+ }
+ }
+
+ switch (_response.error.reason) {
+ case "non-json":
+ throw new errors.DevRevError({
+ statusCode: _response.error.statusCode,
+ body: _response.error.rawBody,
+ });
+ case "timeout":
+ throw new errors.DevRevTimeoutError();
+ case "unknown":
+ throw new errors.DevRevError({
+ message: _response.error.errorMessage,
+ });
+ }
+ }
+
+ /**
+ * Gets an organization schedule fragment.
+ *
+ * @param {DevRev.OrgScheduleFragmentsGetQuery} request
+ * @param {Schedules.RequestOptions} requestOptions - Request-specific configuration.
+ *
+ * @throws {@link DevRev.BadRequestError}
+ * @throws {@link DevRev.UnauthorizedError}
+ * @throws {@link DevRev.ForbiddenError}
+ * @throws {@link DevRev.TooManyRequestsError}
+ * @throws {@link DevRev.InternalServerError}
+ * @throws {@link DevRev.ServiceUnavailableError}
+ *
+ * @example
+ * await client.schedules.orgScheduleFragmentsGet({
+ * id: "id"
+ * })
+ */
+ public async orgScheduleFragmentsGet(
+ request: DevRev.OrgScheduleFragmentsGetQuery,
+ requestOptions?: Schedules.RequestOptions
+ ): Promise {
+ const { id } = request;
+ const _queryParams: Record = {};
+ _queryParams["id"] = id;
+ const _response = await (this._options.fetcher ?? core.fetcher)({
+ url: urlJoin(
+ (await core.Supplier.get(this._options.environment)) ?? environments.DevRevEnvironment.Default,
+ "org-schedule-fragments.get"
+ ),
+ method: "GET",
+ headers: {
+ Authorization: await this._getAuthorizationHeader(),
+ "X-Fern-Language": "JavaScript",
+ "X-Fern-SDK-Name": "@devrev/api",
+ "X-Fern-SDK-Version": "0.0.14",
+ "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 serializers.OrgScheduleFragmentsGetResponse.parseOrThrow(_response.body, {
+ unrecognizedObjectKeys: "passthrough",
+ allowUnrecognizedUnionMembers: true,
+ allowUnrecognizedEnumValues: true,
+ skipValidation: true,
+ breadcrumbsPrefix: ["response"],
+ });
+ }
+
+ if (_response.error.reason === "status-code") {
+ switch (_response.error.statusCode) {
+ case 400:
+ throw new DevRev.BadRequestError(
+ serializers.ErrorBadRequest.parseOrThrow(_response.error.body, {
+ unrecognizedObjectKeys: "passthrough",
+ allowUnrecognizedUnionMembers: true,
+ allowUnrecognizedEnumValues: true,
+ skipValidation: true,
+ breadcrumbsPrefix: ["response"],
+ })
+ );
+ case 401:
+ throw new DevRev.UnauthorizedError(
+ serializers.ErrorUnauthorized.parseOrThrow(_response.error.body, {
+ unrecognizedObjectKeys: "passthrough",
+ allowUnrecognizedUnionMembers: true,
+ allowUnrecognizedEnumValues: true,
+ skipValidation: true,
+ breadcrumbsPrefix: ["response"],
+ })
+ );
+ case 403:
+ throw new DevRev.ForbiddenError(
+ serializers.ErrorForbidden.parseOrThrow(_response.error.body, {
+ unrecognizedObjectKeys: "passthrough",
+ allowUnrecognizedUnionMembers: true,
+ allowUnrecognizedEnumValues: true,
+ skipValidation: true,
+ breadcrumbsPrefix: ["response"],
+ })
+ );
+ case 429:
+ throw new DevRev.TooManyRequestsError(
+ serializers.ErrorTooManyRequests.parseOrThrow(_response.error.body, {
+ unrecognizedObjectKeys: "passthrough",
+ allowUnrecognizedUnionMembers: true,
+ allowUnrecognizedEnumValues: true,
+ skipValidation: true,
+ breadcrumbsPrefix: ["response"],
+ })
+ );
+ case 500:
+ throw new DevRev.InternalServerError(
+ serializers.ErrorInternalServerError.parseOrThrow(_response.error.body, {
+ unrecognizedObjectKeys: "passthrough",
+ allowUnrecognizedUnionMembers: true,
+ allowUnrecognizedEnumValues: true,
+ skipValidation: true,
+ breadcrumbsPrefix: ["response"],
+ })
+ );
+ case 503:
+ throw new DevRev.ServiceUnavailableError(
+ serializers.ErrorServiceUnavailable.parseOrThrow(_response.error.body, {
+ unrecognizedObjectKeys: "passthrough",
+ allowUnrecognizedUnionMembers: true,
+ allowUnrecognizedEnumValues: true,
+ skipValidation: true,
+ breadcrumbsPrefix: ["response"],
+ })
+ );
+ default:
+ throw new errors.DevRevError({
+ statusCode: _response.error.statusCode,
+ body: _response.error.body,
+ });
+ }
+ }
+
+ switch (_response.error.reason) {
+ case "non-json":
+ throw new errors.DevRevError({
+ statusCode: _response.error.statusCode,
+ body: _response.error.rawBody,
+ });
+ case "timeout":
+ throw new errors.DevRevTimeoutError();
+ case "unknown":
+ throw new errors.DevRevError({
+ message: _response.error.errorMessage,
+ });
+ }
+ }
+
+ /**
+ * Gets an organization schedule fragment.
+ *
+ * @param {DevRev.OrgScheduleFragmentsGetRequest} request
+ * @param {Schedules.RequestOptions} requestOptions - Request-specific configuration.
+ *
+ * @throws {@link DevRev.BadRequestError}
+ * @throws {@link DevRev.UnauthorizedError}
+ * @throws {@link DevRev.ForbiddenError}
+ * @throws {@link DevRev.TooManyRequestsError}
+ * @throws {@link DevRev.InternalServerError}
+ * @throws {@link DevRev.ServiceUnavailableError}
+ *
+ * @example
+ * await client.schedules.orgScheduleFragmentsGetPost({
+ * id: "id"
+ * })
+ */
+ public async orgScheduleFragmentsGetPost(
+ request: DevRev.OrgScheduleFragmentsGetRequest,
+ requestOptions?: Schedules.RequestOptions
+ ): Promise {
+ const _response = await (this._options.fetcher ?? core.fetcher)({
+ url: urlJoin(
+ (await core.Supplier.get(this._options.environment)) ?? environments.DevRevEnvironment.Default,
+ "org-schedule-fragments.get"
+ ),
+ method: "POST",
+ headers: {
+ Authorization: await this._getAuthorizationHeader(),
+ "X-Fern-Language": "JavaScript",
+ "X-Fern-SDK-Name": "@devrev/api",
+ "X-Fern-SDK-Version": "0.0.14",
+ "X-Fern-Runtime": core.RUNTIME.type,
+ "X-Fern-Runtime-Version": core.RUNTIME.version,
+ },
+ contentType: "application/json",
+ requestType: "json",
+ body: serializers.OrgScheduleFragmentsGetRequest.jsonOrThrow(request, { unrecognizedObjectKeys: "strip" }),
+ timeoutMs: requestOptions?.timeoutInSeconds != null ? requestOptions.timeoutInSeconds * 1000 : 60000,
+ maxRetries: requestOptions?.maxRetries,
+ abortSignal: requestOptions?.abortSignal,
+ });
+ if (_response.ok) {
+ return serializers.OrgScheduleFragmentsGetResponse.parseOrThrow(_response.body, {
+ unrecognizedObjectKeys: "passthrough",
+ allowUnrecognizedUnionMembers: true,
+ allowUnrecognizedEnumValues: true,
+ skipValidation: true,
+ breadcrumbsPrefix: ["response"],
+ });
+ }
+
+ if (_response.error.reason === "status-code") {
+ switch (_response.error.statusCode) {
+ case 400:
+ throw new DevRev.BadRequestError(
+ serializers.ErrorBadRequest.parseOrThrow(_response.error.body, {
+ unrecognizedObjectKeys: "passthrough",
+ allowUnrecognizedUnionMembers: true,
+ allowUnrecognizedEnumValues: true,
+ skipValidation: true,
+ breadcrumbsPrefix: ["response"],
+ })
+ );
+ case 401:
+ throw new DevRev.UnauthorizedError(
+ serializers.ErrorUnauthorized.parseOrThrow(_response.error.body, {
+ unrecognizedObjectKeys: "passthrough",
+ allowUnrecognizedUnionMembers: true,
+ allowUnrecognizedEnumValues: true,
+ skipValidation: true,
+ breadcrumbsPrefix: ["response"],
+ })
+ );
+ case 403:
+ throw new DevRev.ForbiddenError(
+ serializers.ErrorForbidden.parseOrThrow(_response.error.body, {
+ unrecognizedObjectKeys: "passthrough",
+ allowUnrecognizedUnionMembers: true,
+ allowUnrecognizedEnumValues: true,
+ skipValidation: true,
+ breadcrumbsPrefix: ["response"],
+ })
+ );
+ case 429:
+ throw new DevRev.TooManyRequestsError(
+ serializers.ErrorTooManyRequests.parseOrThrow(_response.error.body, {
+ unrecognizedObjectKeys: "passthrough",
+ allowUnrecognizedUnionMembers: true,
+ allowUnrecognizedEnumValues: true,
+ skipValidation: true,
+ breadcrumbsPrefix: ["response"],
+ })
+ );
+ case 500:
+ throw new DevRev.InternalServerError(
+ serializers.ErrorInternalServerError.parseOrThrow(_response.error.body, {
+ unrecognizedObjectKeys: "passthrough",
+ allowUnrecognizedUnionMembers: true,
+ allowUnrecognizedEnumValues: true,
+ skipValidation: true,
+ breadcrumbsPrefix: ["response"],
+ })
+ );
+ case 503:
+ throw new DevRev.ServiceUnavailableError(
+ serializers.ErrorServiceUnavailable.parseOrThrow(_response.error.body, {
+ unrecognizedObjectKeys: "passthrough",
+ allowUnrecognizedUnionMembers: true,
+ allowUnrecognizedEnumValues: true,
+ skipValidation: true,
+ breadcrumbsPrefix: ["response"],
+ })
+ );
+ default:
+ throw new errors.DevRevError({
+ statusCode: _response.error.statusCode,
+ body: _response.error.body,
+ });
+ }
+ }
+
+ switch (_response.error.reason) {
+ case "non-json":
+ throw new errors.DevRevError({
+ statusCode: _response.error.statusCode,
+ body: _response.error.rawBody,
+ });
+ case "timeout":
+ throw new errors.DevRevTimeoutError();
+ case "unknown":
+ throw new errors.DevRevError({
+ message: _response.error.errorMessage,
+ });
+ }
+ }
+
+ /**
+ * Changes stage of an organization schedule fragment.
+ *
+ * @param {DevRev.OrgScheduleFragmentsTransitionRequest} request
+ * @param {Schedules.RequestOptions} requestOptions - Request-specific configuration.
+ *
+ * @throws {@link DevRev.BadRequestError}
+ * @throws {@link DevRev.UnauthorizedError}
+ * @throws {@link DevRev.ForbiddenError}
+ * @throws {@link DevRev.TooManyRequestsError}
+ * @throws {@link DevRev.InternalServerError}
+ * @throws {@link DevRev.ServiceUnavailableError}
+ *
+ * @example
+ * await client.schedules.orgScheduleFragmentsTransition({
+ * id: "id",
+ * status: DevRev.OrgScheduleFragmentStatus.Archived
+ * })
+ */
+ public async orgScheduleFragmentsTransition(
+ request: DevRev.OrgScheduleFragmentsTransitionRequest,
+ requestOptions?: Schedules.RequestOptions
+ ): Promise {
+ const _response = await (this._options.fetcher ?? core.fetcher)({
+ url: urlJoin(
+ (await core.Supplier.get(this._options.environment)) ?? environments.DevRevEnvironment.Default,
+ "org-schedule-fragments.transition"
+ ),
+ method: "POST",
+ headers: {
+ Authorization: await this._getAuthorizationHeader(),
+ "X-Fern-Language": "JavaScript",
+ "X-Fern-SDK-Name": "@devrev/api",
+ "X-Fern-SDK-Version": "0.0.14",
+ "X-Fern-Runtime": core.RUNTIME.type,
+ "X-Fern-Runtime-Version": core.RUNTIME.version,
+ },
+ contentType: "application/json",
+ requestType: "json",
+ body: serializers.OrgScheduleFragmentsTransitionRequest.jsonOrThrow(request, {
+ unrecognizedObjectKeys: "strip",
+ }),
+ timeoutMs: requestOptions?.timeoutInSeconds != null ? requestOptions.timeoutInSeconds * 1000 : 60000,
+ maxRetries: requestOptions?.maxRetries,
+ abortSignal: requestOptions?.abortSignal,
+ });
+ if (_response.ok) {
+ return serializers.OrgScheduleFragmentsTransitionResponse.parseOrThrow(_response.body, {
+ unrecognizedObjectKeys: "passthrough",
+ allowUnrecognizedUnionMembers: true,
+ allowUnrecognizedEnumValues: true,
+ skipValidation: true,
+ breadcrumbsPrefix: ["response"],
+ });
+ }
+
+ if (_response.error.reason === "status-code") {
+ switch (_response.error.statusCode) {
+ case 400:
+ throw new DevRev.BadRequestError(
+ serializers.ErrorBadRequest.parseOrThrow(_response.error.body, {
+ unrecognizedObjectKeys: "passthrough",
+ allowUnrecognizedUnionMembers: true,
+ allowUnrecognizedEnumValues: true,
+ skipValidation: true,
+ breadcrumbsPrefix: ["response"],
+ })
+ );
+ case 401:
+ throw new DevRev.UnauthorizedError(
+ serializers.ErrorUnauthorized.parseOrThrow(_response.error.body, {
+ unrecognizedObjectKeys: "passthrough",
+ allowUnrecognizedUnionMembers: true,
+ allowUnrecognizedEnumValues: true,
+ skipValidation: true,
+ breadcrumbsPrefix: ["response"],
+ })
+ );
+ case 403:
+ throw new DevRev.ForbiddenError(
+ serializers.ErrorForbidden.parseOrThrow(_response.error.body, {
+ unrecognizedObjectKeys: "passthrough",
+ allowUnrecognizedUnionMembers: true,
+ allowUnrecognizedEnumValues: true,
+ skipValidation: true,
+ breadcrumbsPrefix: ["response"],
+ })
+ );
+ case 429:
+ throw new DevRev.TooManyRequestsError(
+ serializers.ErrorTooManyRequests.parseOrThrow(_response.error.body, {
+ unrecognizedObjectKeys: "passthrough",
+ allowUnrecognizedUnionMembers: true,
+ allowUnrecognizedEnumValues: true,
+ skipValidation: true,
+ breadcrumbsPrefix: ["response"],
+ })
+ );
+ case 500:
+ throw new DevRev.InternalServerError(
+ serializers.ErrorInternalServerError.parseOrThrow(_response.error.body, {
+ unrecognizedObjectKeys: "passthrough",
+ allowUnrecognizedUnionMembers: true,
+ allowUnrecognizedEnumValues: true,
+ skipValidation: true,
+ breadcrumbsPrefix: ["response"],
+ })
+ );
+ case 503:
+ throw new DevRev.ServiceUnavailableError(
+ serializers.ErrorServiceUnavailable.parseOrThrow(_response.error.body, {
+ unrecognizedObjectKeys: "passthrough",
+ allowUnrecognizedUnionMembers: true,
+ allowUnrecognizedEnumValues: true,
+ skipValidation: true,
+ breadcrumbsPrefix: ["response"],
+ })
+ );
+ default:
+ throw new errors.DevRevError({
+ statusCode: _response.error.statusCode,
+ body: _response.error.body,
+ });
+ }
+ }
+
+ switch (_response.error.reason) {
+ case "non-json":
+ throw new errors.DevRevError({
+ statusCode: _response.error.statusCode,
+ body: _response.error.rawBody,
+ });
+ case "timeout":
+ throw new errors.DevRevTimeoutError();
+ case "unknown":
+ throw new errors.DevRevError({
+ message: _response.error.errorMessage,
+ });
+ }
+ }
+
+ /**
+ * Creates an organization schedule with a default weekly organization
+ * schedule and a list of organization schedule fragments.
+ *
+ * @param {DevRev.OrgSchedulesCreateRequest} request
+ * @param {Schedules.RequestOptions} requestOptions - Request-specific configuration.
+ *
+ * @throws {@link DevRev.BadRequestError}
+ * @throws {@link DevRev.UnauthorizedError}
+ * @throws {@link DevRev.ForbiddenError}
+ * @throws {@link DevRev.TooManyRequestsError}
+ * @throws {@link DevRev.InternalServerError}
+ * @throws {@link DevRev.ServiceUnavailableError}
+ *
+ * @example
+ * await client.schedules.create({
+ * name: "name",
+ * timezone: "timezone"
+ * })
+ */
+ public async create(
+ request: DevRev.OrgSchedulesCreateRequest,
+ requestOptions?: Schedules.RequestOptions
+ ): Promise {
+ const _response = await (this._options.fetcher ?? core.fetcher)({
+ url: urlJoin(
+ (await core.Supplier.get(this._options.environment)) ?? environments.DevRevEnvironment.Default,
+ "org-schedules.create"
+ ),
+ method: "POST",
+ headers: {
+ Authorization: await this._getAuthorizationHeader(),
+ "X-Fern-Language": "JavaScript",
+ "X-Fern-SDK-Name": "@devrev/api",
+ "X-Fern-SDK-Version": "0.0.14",
+ "X-Fern-Runtime": core.RUNTIME.type,
+ "X-Fern-Runtime-Version": core.RUNTIME.version,
+ },
+ contentType: "application/json",
+ requestType: "json",
+ body: serializers.OrgSchedulesCreateRequest.jsonOrThrow(request, { unrecognizedObjectKeys: "strip" }),
+ timeoutMs: requestOptions?.timeoutInSeconds != null ? requestOptions.timeoutInSeconds * 1000 : 60000,
+ maxRetries: requestOptions?.maxRetries,
+ abortSignal: requestOptions?.abortSignal,
+ });
+ if (_response.ok) {
+ return serializers.OrgSchedulesCreateResponse.parseOrThrow(_response.body, {
+ unrecognizedObjectKeys: "passthrough",
+ allowUnrecognizedUnionMembers: true,
+ allowUnrecognizedEnumValues: true,
+ skipValidation: true,
+ breadcrumbsPrefix: ["response"],
+ });
+ }
+
+ if (_response.error.reason === "status-code") {
+ switch (_response.error.statusCode) {
+ case 400:
+ throw new DevRev.BadRequestError(
+ serializers.ErrorBadRequest.parseOrThrow(_response.error.body, {
+ unrecognizedObjectKeys: "passthrough",
+ allowUnrecognizedUnionMembers: true,
+ allowUnrecognizedEnumValues: true,
+ skipValidation: true,
+ breadcrumbsPrefix: ["response"],
+ })
+ );
+ case 401:
+ throw new DevRev.UnauthorizedError(
+ serializers.ErrorUnauthorized.parseOrThrow(_response.error.body, {
+ unrecognizedObjectKeys: "passthrough",
+ allowUnrecognizedUnionMembers: true,
+ allowUnrecognizedEnumValues: true,
+ skipValidation: true,
+ breadcrumbsPrefix: ["response"],
+ })
+ );
+ case 403:
+ throw new DevRev.ForbiddenError(
+ serializers.ErrorForbidden.parseOrThrow(_response.error.body, {
+ unrecognizedObjectKeys: "passthrough",
+ allowUnrecognizedUnionMembers: true,
+ allowUnrecognizedEnumValues: true,
+ skipValidation: true,
+ breadcrumbsPrefix: ["response"],
+ })
+ );
+ case 429:
+ throw new DevRev.TooManyRequestsError(
+ serializers.ErrorTooManyRequests.parseOrThrow(_response.error.body, {
+ unrecognizedObjectKeys: "passthrough",
+ allowUnrecognizedUnionMembers: true,
+ allowUnrecognizedEnumValues: true,
+ skipValidation: true,
+ breadcrumbsPrefix: ["response"],
+ })
+ );
+ case 500:
+ throw new DevRev.InternalServerError(
+ serializers.ErrorInternalServerError.parseOrThrow(_response.error.body, {
+ unrecognizedObjectKeys: "passthrough",
+ allowUnrecognizedUnionMembers: true,
+ allowUnrecognizedEnumValues: true,
+ skipValidation: true,
+ breadcrumbsPrefix: ["response"],
+ })
+ );
+ case 503:
+ throw new DevRev.ServiceUnavailableError(
+ serializers.ErrorServiceUnavailable.parseOrThrow(_response.error.body, {
+ unrecognizedObjectKeys: "passthrough",
+ allowUnrecognizedUnionMembers: true,
+ allowUnrecognizedEnumValues: true,
+ skipValidation: true,
+ breadcrumbsPrefix: ["response"],
+ })
+ );
+ default:
+ throw new errors.DevRevError({
+ statusCode: _response.error.statusCode,
+ body: _response.error.body,
+ });
+ }
+ }
+
+ switch (_response.error.reason) {
+ case "non-json":
+ throw new errors.DevRevError({
+ statusCode: _response.error.statusCode,
+ body: _response.error.rawBody,
+ });
+ case "timeout":
+ throw new errors.DevRevTimeoutError();
+ case "unknown":
+ throw new errors.DevRevError({
+ message: _response.error.errorMessage,
+ });
+ }
+ }
+
+ /**
+ * Gets an organization schedule.
+ *
+ * @param {DevRev.OrgSchedulesGetQuery} request
+ * @param {Schedules.RequestOptions} requestOptions - Request-specific configuration.
+ *
+ * @throws {@link DevRev.BadRequestError}
+ * @throws {@link DevRev.UnauthorizedError}
+ * @throws {@link DevRev.ForbiddenError}
+ * @throws {@link DevRev.TooManyRequestsError}
+ * @throws {@link DevRev.InternalServerError}
+ * @throws {@link DevRev.ServiceUnavailableError}
+ *
+ * @example
+ * await client.schedules.get({
+ * id: "id"
+ * })
+ */
+ public async get(
+ request: DevRev.OrgSchedulesGetQuery,
+ requestOptions?: Schedules.RequestOptions
+ ): Promise {
+ const { id } = request;
+ const _queryParams: Record = {};
+ _queryParams["id"] = id;
+ const _response = await (this._options.fetcher ?? core.fetcher)({
+ url: urlJoin(
+ (await core.Supplier.get(this._options.environment)) ?? environments.DevRevEnvironment.Default,
+ "org-schedules.get"
+ ),
+ method: "GET",
+ headers: {
+ Authorization: await this._getAuthorizationHeader(),
+ "X-Fern-Language": "JavaScript",
+ "X-Fern-SDK-Name": "@devrev/api",
+ "X-Fern-SDK-Version": "0.0.14",
+ "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 serializers.OrgSchedulesGetResponse.parseOrThrow(_response.body, {
+ unrecognizedObjectKeys: "passthrough",
+ allowUnrecognizedUnionMembers: true,
+ allowUnrecognizedEnumValues: true,
+ skipValidation: true,
+ breadcrumbsPrefix: ["response"],
+ });
+ }
+
+ if (_response.error.reason === "status-code") {
+ switch (_response.error.statusCode) {
+ case 400:
+ throw new DevRev.BadRequestError(
+ serializers.ErrorBadRequest.parseOrThrow(_response.error.body, {
+ unrecognizedObjectKeys: "passthrough",
+ allowUnrecognizedUnionMembers: true,
+ allowUnrecognizedEnumValues: true,
+ skipValidation: true,
+ breadcrumbsPrefix: ["response"],
+ })
+ );
+ case 401:
+ throw new DevRev.UnauthorizedError(
+ serializers.ErrorUnauthorized.parseOrThrow(_response.error.body, {
+ unrecognizedObjectKeys: "passthrough",
+ allowUnrecognizedUnionMembers: true,
+ allowUnrecognizedEnumValues: true,
+ skipValidation: true,
+ breadcrumbsPrefix: ["response"],
+ })
+ );
+ case 403:
+ throw new DevRev.ForbiddenError(
+ serializers.ErrorForbidden.parseOrThrow(_response.error.body, {
+ unrecognizedObjectKeys: "passthrough",
+ allowUnrecognizedUnionMembers: true,
+ allowUnrecognizedEnumValues: true,
+ skipValidation: true,
+ breadcrumbsPrefix: ["response"],
+ })
+ );
+ case 429:
+ throw new DevRev.TooManyRequestsError(
+ serializers.ErrorTooManyRequests.parseOrThrow(_response.error.body, {
+ unrecognizedObjectKeys: "passthrough",
+ allowUnrecognizedUnionMembers: true,
+ allowUnrecognizedEnumValues: true,
+ skipValidation: true,
+ breadcrumbsPrefix: ["response"],
+ })
+ );
+ case 500:
+ throw new DevRev.InternalServerError(
+ serializers.ErrorInternalServerError.parseOrThrow(_response.error.body, {
+ unrecognizedObjectKeys: "passthrough",
+ allowUnrecognizedUnionMembers: true,
+ allowUnrecognizedEnumValues: true,
+ skipValidation: true,
+ breadcrumbsPrefix: ["response"],
+ })
+ );
+ case 503:
+ throw new DevRev.ServiceUnavailableError(
+ serializers.ErrorServiceUnavailable.parseOrThrow(_response.error.body, {
+ unrecognizedObjectKeys: "passthrough",
+ allowUnrecognizedUnionMembers: true,
+ allowUnrecognizedEnumValues: true,
+ skipValidation: true,
+ breadcrumbsPrefix: ["response"],
+ })
+ );
+ default:
+ throw new errors.DevRevError({
+ statusCode: _response.error.statusCode,
+ body: _response.error.body,
+ });
+ }
+ }
+
+ switch (_response.error.reason) {
+ case "non-json":
+ throw new errors.DevRevError({
+ statusCode: _response.error.statusCode,
+ body: _response.error.rawBody,
+ });
+ case "timeout":
+ throw new errors.DevRevTimeoutError();
+ case "unknown":
+ throw new errors.DevRevError({
+ message: _response.error.errorMessage,
+ });
+ }
+ }
+
+ /**
+ * Gets an organization schedule.
+ *
+ * @param {DevRev.OrgSchedulesGetRequest} request
+ * @param {Schedules.RequestOptions} requestOptions - Request-specific configuration.
+ *
+ * @throws {@link DevRev.BadRequestError}
+ * @throws {@link DevRev.UnauthorizedError}
+ * @throws {@link DevRev.ForbiddenError}
+ * @throws {@link DevRev.TooManyRequestsError}
+ * @throws {@link DevRev.InternalServerError}
+ * @throws {@link DevRev.ServiceUnavailableError}
+ *
+ * @example
+ * await client.schedules.getPost({
+ * id: "id"
+ * })
+ */
+ public async getPost(
+ request: DevRev.OrgSchedulesGetRequest,
+ requestOptions?: Schedules.RequestOptions
+ ): Promise {
+ const _response = await (this._options.fetcher ?? core.fetcher)({
+ url: urlJoin(
+ (await core.Supplier.get(this._options.environment)) ?? environments.DevRevEnvironment.Default,
+ "org-schedules.get"
+ ),
+ method: "POST",
+ headers: {
+ Authorization: await this._getAuthorizationHeader(),
+ "X-Fern-Language": "JavaScript",
+ "X-Fern-SDK-Name": "@devrev/api",
+ "X-Fern-SDK-Version": "0.0.14",
+ "X-Fern-Runtime": core.RUNTIME.type,
+ "X-Fern-Runtime-Version": core.RUNTIME.version,
+ },
+ contentType: "application/json",
+ requestType: "json",
+ body: serializers.OrgSchedulesGetRequest.jsonOrThrow(request, { unrecognizedObjectKeys: "strip" }),
+ timeoutMs: requestOptions?.timeoutInSeconds != null ? requestOptions.timeoutInSeconds * 1000 : 60000,
+ maxRetries: requestOptions?.maxRetries,
+ abortSignal: requestOptions?.abortSignal,
+ });
+ if (_response.ok) {
+ return serializers.OrgSchedulesGetResponse.parseOrThrow(_response.body, {
+ unrecognizedObjectKeys: "passthrough",
+ allowUnrecognizedUnionMembers: true,
+ allowUnrecognizedEnumValues: true,
+ skipValidation: true,
+ breadcrumbsPrefix: ["response"],
+ });
+ }
+
+ if (_response.error.reason === "status-code") {
+ switch (_response.error.statusCode) {
+ case 400:
+ throw new DevRev.BadRequestError(
+ serializers.ErrorBadRequest.parseOrThrow(_response.error.body, {
+ unrecognizedObjectKeys: "passthrough",
+ allowUnrecognizedUnionMembers: true,
+ allowUnrecognizedEnumValues: true,
+ skipValidation: true,
+ breadcrumbsPrefix: ["response"],
+ })
+ );
+ case 401:
+ throw new DevRev.UnauthorizedError(
+ serializers.ErrorUnauthorized.parseOrThrow(_response.error.body, {
+ unrecognizedObjectKeys: "passthrough",
+ allowUnrecognizedUnionMembers: true,
+ allowUnrecognizedEnumValues: true,
+ skipValidation: true,
+ breadcrumbsPrefix: ["response"],
+ })
+ );
+ case 403:
+ throw new DevRev.ForbiddenError(
+ serializers.ErrorForbidden.parseOrThrow(_response.error.body, {
+ unrecognizedObjectKeys: "passthrough",
+ allowUnrecognizedUnionMembers: true,
+ allowUnrecognizedEnumValues: true,
+ skipValidation: true,
+ breadcrumbsPrefix: ["response"],
+ })
+ );
+ case 429:
+ throw new DevRev.TooManyRequestsError(
+ serializers.ErrorTooManyRequests.parseOrThrow(_response.error.body, {
+ unrecognizedObjectKeys: "passthrough",
+ allowUnrecognizedUnionMembers: true,
+ allowUnrecognizedEnumValues: true,
+ skipValidation: true,
+ breadcrumbsPrefix: ["response"],
+ })
+ );
+ case 500:
+ throw new DevRev.InternalServerError(
+ serializers.ErrorInternalServerError.parseOrThrow(_response.error.body, {
+ unrecognizedObjectKeys: "passthrough",
+ allowUnrecognizedUnionMembers: true,
+ allowUnrecognizedEnumValues: true,
+ skipValidation: true,
+ breadcrumbsPrefix: ["response"],
+ })
+ );
+ case 503:
+ throw new DevRev.ServiceUnavailableError(
+ serializers.ErrorServiceUnavailable.parseOrThrow(_response.error.body, {
+ unrecognizedObjectKeys: "passthrough",
+ allowUnrecognizedUnionMembers: true,
+ allowUnrecognizedEnumValues: true,
+ skipValidation: true,
+ breadcrumbsPrefix: ["response"],
+ })
+ );
+ default:
+ throw new errors.DevRevError({
+ statusCode: _response.error.statusCode,
+ body: _response.error.body,
+ });
+ }
+ }
+
+ switch (_response.error.reason) {
+ case "non-json":
+ throw new errors.DevRevError({
+ statusCode: _response.error.statusCode,
+ body: _response.error.rawBody,
+ });
+ case "timeout":
+ throw new errors.DevRevTimeoutError();
+ case "unknown":
+ throw new errors.DevRevError({
+ message: _response.error.errorMessage,
+ });
+ }
+ }
+
+ /**
+ * Gets list of organization schedules.
+ *
+ * @param {DevRev.OrgSchedulesListQuery} request
+ * @param {Schedules.RequestOptions} requestOptions - Request-specific configuration.
+ *
+ * @throws {@link DevRev.BadRequestError}
+ * @throws {@link DevRev.UnauthorizedError}
+ * @throws {@link DevRev.ForbiddenError}
+ * @throws {@link DevRev.TooManyRequestsError}
+ * @throws {@link DevRev.InternalServerError}
+ * @throws {@link DevRev.ServiceUnavailableError}
+ *
+ * @example
+ * await client.schedules.list()
+ */
+ public async list(
+ request: DevRev.OrgSchedulesListQuery = {},
+ requestOptions?: Schedules.RequestOptions
+ ): Promise {
+ const { createdById, cursor, limit, mode, status } = request;
+ const _queryParams: Record = {};
+ if (createdById != null) {
+ if (Array.isArray(createdById)) {
+ _queryParams["created_by_id"] = createdById.map((item) => item);
+ } else {
+ _queryParams["created_by_id"] = createdById;
+ }
+ }
+
+ if (cursor != null) {
+ _queryParams["cursor"] = cursor;
+ }
+
+ if (limit != null) {
+ _queryParams["limit"] = limit.toString();
+ }
+
+ if (mode != null) {
+ _queryParams["mode"] = mode;
+ }
+
+ if (status != null) {
+ if (Array.isArray(status)) {
+ _queryParams["status"] = status.map((item) => item);
+ } else {
+ _queryParams["status"] = status;
+ }
+ }
+
+ const _response = await (this._options.fetcher ?? core.fetcher)({
+ url: urlJoin(
+ (await core.Supplier.get(this._options.environment)) ?? environments.DevRevEnvironment.Default,
+ "org-schedules.list"
+ ),
+ method: "GET",
+ headers: {
+ Authorization: await this._getAuthorizationHeader(),
+ "X-Fern-Language": "JavaScript",
+ "X-Fern-SDK-Name": "@devrev/api",
+ "X-Fern-SDK-Version": "0.0.14",
+ "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 serializers.OrgSchedulesListResponse.parseOrThrow(_response.body, {
+ unrecognizedObjectKeys: "passthrough",
+ allowUnrecognizedUnionMembers: true,
+ allowUnrecognizedEnumValues: true,
+ skipValidation: true,
+ breadcrumbsPrefix: ["response"],
+ });
+ }
+
+ if (_response.error.reason === "status-code") {
+ switch (_response.error.statusCode) {
+ case 400:
+ throw new DevRev.BadRequestError(
+ serializers.ErrorBadRequest.parseOrThrow(_response.error.body, {
+ unrecognizedObjectKeys: "passthrough",
+ allowUnrecognizedUnionMembers: true,
+ allowUnrecognizedEnumValues: true,
+ skipValidation: true,
+ breadcrumbsPrefix: ["response"],
+ })
+ );
+ case 401:
+ throw new DevRev.UnauthorizedError(
+ serializers.ErrorUnauthorized.parseOrThrow(_response.error.body, {
+ unrecognizedObjectKeys: "passthrough",
+ allowUnrecognizedUnionMembers: true,
+ allowUnrecognizedEnumValues: true,
+ skipValidation: true,
+ breadcrumbsPrefix: ["response"],
+ })
+ );
+ case 403:
+ throw new DevRev.ForbiddenError(
+ serializers.ErrorForbidden.parseOrThrow(_response.error.body, {
+ unrecognizedObjectKeys: "passthrough",
+ allowUnrecognizedUnionMembers: true,
+ allowUnrecognizedEnumValues: true,
+ skipValidation: true,
+ breadcrumbsPrefix: ["response"],
+ })
+ );
+ case 429:
+ throw new DevRev.TooManyRequestsError(
+ serializers.ErrorTooManyRequests.parseOrThrow(_response.error.body, {
+ unrecognizedObjectKeys: "passthrough",
+ allowUnrecognizedUnionMembers: true,
+ allowUnrecognizedEnumValues: true,
+ skipValidation: true,
+ breadcrumbsPrefix: ["response"],
+ })
+ );
+ case 500:
+ throw new DevRev.InternalServerError(
+ serializers.ErrorInternalServerError.parseOrThrow(_response.error.body, {
+ unrecognizedObjectKeys: "passthrough",
+ allowUnrecognizedUnionMembers: true,
+ allowUnrecognizedEnumValues: true,
+ skipValidation: true,
+ breadcrumbsPrefix: ["response"],
+ })
+ );
+ case 503:
+ throw new DevRev.ServiceUnavailableError(
+ serializers.ErrorServiceUnavailable.parseOrThrow(_response.error.body, {
+ unrecognizedObjectKeys: "passthrough",
+ allowUnrecognizedUnionMembers: true,
+ allowUnrecognizedEnumValues: true,
+ skipValidation: true,
+ breadcrumbsPrefix: ["response"],
+ })
+ );
+ default:
+ throw new errors.DevRevError({
+ statusCode: _response.error.statusCode,
+ body: _response.error.body,
+ });
+ }
+ }
+
+ switch (_response.error.reason) {
+ case "non-json":
+ throw new errors.DevRevError({
+ statusCode: _response.error.statusCode,
+ body: _response.error.rawBody,
+ });
+ case "timeout":
+ throw new errors.DevRevTimeoutError();
+ case "unknown":
+ throw new errors.DevRevError({
+ message: _response.error.errorMessage,
+ });
+ }
+ }
+
+ /**
+ * Gets list of organization schedules.
+ *
+ * @param {DevRev.OrgSchedulesListRequest} request
+ * @param {Schedules.RequestOptions} requestOptions - Request-specific configuration.
+ *
+ * @throws {@link DevRev.BadRequestError}
+ * @throws {@link DevRev.UnauthorizedError}
+ * @throws {@link DevRev.ForbiddenError}
+ * @throws {@link DevRev.TooManyRequestsError}
+ * @throws {@link DevRev.InternalServerError}
+ * @throws {@link DevRev.ServiceUnavailableError}
+ *
+ * @example
+ * await client.schedules.listPost()
+ */
+ public async listPost(
+ request: DevRev.OrgSchedulesListRequest = {},
+ requestOptions?: Schedules.RequestOptions
+ ): Promise {
+ const _response = await (this._options.fetcher ?? core.fetcher)({
+ url: urlJoin(
+ (await core.Supplier.get(this._options.environment)) ?? environments.DevRevEnvironment.Default,
+ "org-schedules.list"
+ ),
+ method: "POST",
+ headers: {
+ Authorization: await this._getAuthorizationHeader(),
+ "X-Fern-Language": "JavaScript",
+ "X-Fern-SDK-Name": "@devrev/api",
+ "X-Fern-SDK-Version": "0.0.14",
+ "X-Fern-Runtime": core.RUNTIME.type,
+ "X-Fern-Runtime-Version": core.RUNTIME.version,
+ },
+ contentType: "application/json",
+ requestType: "json",
+ body: serializers.OrgSchedulesListRequest.jsonOrThrow(request, { unrecognizedObjectKeys: "strip" }),
+ timeoutMs: requestOptions?.timeoutInSeconds != null ? requestOptions.timeoutInSeconds * 1000 : 60000,
+ maxRetries: requestOptions?.maxRetries,
+ abortSignal: requestOptions?.abortSignal,
+ });
+ if (_response.ok) {
+ return serializers.OrgSchedulesListResponse.parseOrThrow(_response.body, {
+ unrecognizedObjectKeys: "passthrough",
+ allowUnrecognizedUnionMembers: true,
+ allowUnrecognizedEnumValues: true,
+ skipValidation: true,
+ breadcrumbsPrefix: ["response"],
+ });
+ }
+
+ if (_response.error.reason === "status-code") {
+ switch (_response.error.statusCode) {
+ case 400:
+ throw new DevRev.BadRequestError(
+ serializers.ErrorBadRequest.parseOrThrow(_response.error.body, {
+ unrecognizedObjectKeys: "passthrough",
+ allowUnrecognizedUnionMembers: true,
+ allowUnrecognizedEnumValues: true,
+ skipValidation: true,
+ breadcrumbsPrefix: ["response"],
+ })
+ );
+ case 401:
+ throw new DevRev.UnauthorizedError(
+ serializers.ErrorUnauthorized.parseOrThrow(_response.error.body, {
+ unrecognizedObjectKeys: "passthrough",
+ allowUnrecognizedUnionMembers: true,
+ allowUnrecognizedEnumValues: true,
+ skipValidation: true,
+ breadcrumbsPrefix: ["response"],
+ })
+ );
+ case 403:
+ throw new DevRev.ForbiddenError(
+ serializers.ErrorForbidden.parseOrThrow(_response.error.body, {
+ unrecognizedObjectKeys: "passthrough",
+ allowUnrecognizedUnionMembers: true,
+ allowUnrecognizedEnumValues: true,
+ skipValidation: true,
+ breadcrumbsPrefix: ["response"],
+ })
+ );
+ case 429:
+ throw new DevRev.TooManyRequestsError(
+ serializers.ErrorTooManyRequests.parseOrThrow(_response.error.body, {
+ unrecognizedObjectKeys: "passthrough",
+ allowUnrecognizedUnionMembers: true,
+ allowUnrecognizedEnumValues: true,
+ skipValidation: true,
+ breadcrumbsPrefix: ["response"],
+ })
+ );
+ case 500:
+ throw new DevRev.InternalServerError(
+ serializers.ErrorInternalServerError.parseOrThrow(_response.error.body, {
+ unrecognizedObjectKeys: "passthrough",
+ allowUnrecognizedUnionMembers: true,
+ allowUnrecognizedEnumValues: true,
+ skipValidation: true,
+ breadcrumbsPrefix: ["response"],
+ })
+ );
+ case 503:
+ throw new DevRev.ServiceUnavailableError(
+ serializers.ErrorServiceUnavailable.parseOrThrow(_response.error.body, {
+ unrecognizedObjectKeys: "passthrough",
+ allowUnrecognizedUnionMembers: true,
+ allowUnrecognizedEnumValues: true,
+ skipValidation: true,
+ breadcrumbsPrefix: ["response"],
+ })
+ );
+ default:
+ throw new errors.DevRevError({
+ statusCode: _response.error.statusCode,
+ body: _response.error.body,
+ });
+ }
+ }
+
+ switch (_response.error.reason) {
+ case "non-json":
+ throw new errors.DevRevError({
+ statusCode: _response.error.statusCode,
+ body: _response.error.rawBody,
+ });
+ case "timeout":
+ throw new errors.DevRevTimeoutError();
+ case "unknown":
+ throw new errors.DevRevError({
+ message: _response.error.errorMessage,
+ });
+ }
+ }
+
+ /**
+ * Sets next organization schedule fragment which must begin the day the
+ * last existing fragment ends.
+ *
+ * @param {DevRev.OrgSchedulesSetFutureRequest} request
+ * @param {Schedules.RequestOptions} requestOptions - Request-specific configuration.
+ *
+ * @throws {@link DevRev.BadRequestError}
+ * @throws {@link DevRev.UnauthorizedError}
+ * @throws {@link DevRev.ForbiddenError}
+ * @throws {@link DevRev.TooManyRequestsError}
+ * @throws {@link DevRev.InternalServerError}
+ * @throws {@link DevRev.ServiceUnavailableError}
+ *
+ * @example
+ * await client.schedules.setFuture({
+ * id: "id",
+ * orgScheduleFragmentId: "org_schedule_fragment_id"
+ * })
+ */
+ public async setFuture(
+ request: DevRev.OrgSchedulesSetFutureRequest,
+ requestOptions?: Schedules.RequestOptions
+ ): Promise {
+ const _response = await (this._options.fetcher ?? core.fetcher)({
+ url: urlJoin(
+ (await core.Supplier.get(this._options.environment)) ?? environments.DevRevEnvironment.Default,
+ "org-schedules.set-future"
+ ),
+ method: "POST",
+ headers: {
+ Authorization: await this._getAuthorizationHeader(),
+ "X-Fern-Language": "JavaScript",
+ "X-Fern-SDK-Name": "@devrev/api",
+ "X-Fern-SDK-Version": "0.0.14",
+ "X-Fern-Runtime": core.RUNTIME.type,
+ "X-Fern-Runtime-Version": core.RUNTIME.version,
+ },
+ contentType: "application/json",
+ requestType: "json",
+ body: serializers.OrgSchedulesSetFutureRequest.jsonOrThrow(request, { unrecognizedObjectKeys: "strip" }),
+ timeoutMs: requestOptions?.timeoutInSeconds != null ? requestOptions.timeoutInSeconds * 1000 : 60000,
+ maxRetries: requestOptions?.maxRetries,
+ abortSignal: requestOptions?.abortSignal,
+ });
+ if (_response.ok) {
+ return serializers.OrgSchedulesSetFutureResponse.parseOrThrow(_response.body, {
+ unrecognizedObjectKeys: "passthrough",
+ allowUnrecognizedUnionMembers: true,
+ allowUnrecognizedEnumValues: true,
+ skipValidation: true,
+ breadcrumbsPrefix: ["response"],
+ });
+ }
+
+ if (_response.error.reason === "status-code") {
+ switch (_response.error.statusCode) {
+ case 400:
+ throw new DevRev.BadRequestError(
+ serializers.ErrorBadRequest.parseOrThrow(_response.error.body, {
+ unrecognizedObjectKeys: "passthrough",
+ allowUnrecognizedUnionMembers: true,
+ allowUnrecognizedEnumValues: true,
+ skipValidation: true,
+ breadcrumbsPrefix: ["response"],
+ })
+ );
+ case 401:
+ throw new DevRev.UnauthorizedError(
+ serializers.ErrorUnauthorized.parseOrThrow(_response.error.body, {
+ unrecognizedObjectKeys: "passthrough",
+ allowUnrecognizedUnionMembers: true,
+ allowUnrecognizedEnumValues: true,
+ skipValidation: true,
+ breadcrumbsPrefix: ["response"],
+ })
+ );
+ case 403:
+ throw new DevRev.ForbiddenError(
+ serializers.ErrorForbidden.parseOrThrow(_response.error.body, {
+ unrecognizedObjectKeys: "passthrough",
+ allowUnrecognizedUnionMembers: true,
+ allowUnrecognizedEnumValues: true,
+ skipValidation: true,
+ breadcrumbsPrefix: ["response"],
+ })
+ );
+ case 429:
+ throw new DevRev.TooManyRequestsError(
+ serializers.ErrorTooManyRequests.parseOrThrow(_response.error.body, {
+ unrecognizedObjectKeys: "passthrough",
+ allowUnrecognizedUnionMembers: true,
+ allowUnrecognizedEnumValues: true,
+ skipValidation: true,
+ breadcrumbsPrefix: ["response"],
+ })
+ );
+ case 500:
+ throw new DevRev.InternalServerError(
+ serializers.ErrorInternalServerError.parseOrThrow(_response.error.body, {
+ unrecognizedObjectKeys: "passthrough",
+ allowUnrecognizedUnionMembers: true,
+ allowUnrecognizedEnumValues: true,
+ skipValidation: true,
+ breadcrumbsPrefix: ["response"],
+ })
+ );
+ case 503:
+ throw new DevRev.ServiceUnavailableError(
+ serializers.ErrorServiceUnavailable.parseOrThrow(_response.error.body, {
+ unrecognizedObjectKeys: "passthrough",
+ allowUnrecognizedUnionMembers: true,
+ allowUnrecognizedEnumValues: true,
+ skipValidation: true,
+ breadcrumbsPrefix: ["response"],
+ })
+ );
+ default:
+ throw new errors.DevRevError({
+ statusCode: _response.error.statusCode,
+ body: _response.error.body,
+ });
+ }
+ }
+
+ switch (_response.error.reason) {
+ case "non-json":
+ throw new errors.DevRevError({
+ statusCode: _response.error.statusCode,
+ body: _response.error.rawBody,
+ });
+ case "timeout":
+ throw new errors.DevRevTimeoutError();
+ case "unknown":
+ throw new errors.DevRevError({
+ message: _response.error.errorMessage,
+ });
+ }
+ }
+
+ /**
+ * Publishes or archives an organization schedule.
+ *
+ * @param {DevRev.OrgSchedulesTransitionRequest} request
+ * @param {Schedules.RequestOptions} requestOptions - Request-specific configuration.
+ *
+ * @throws {@link DevRev.BadRequestError}
+ * @throws {@link DevRev.UnauthorizedError}
+ * @throws {@link DevRev.ForbiddenError}
+ * @throws {@link DevRev.TooManyRequestsError}
+ * @throws {@link DevRev.InternalServerError}
+ * @throws {@link DevRev.ServiceUnavailableError}
+ *
+ * @example
+ * await client.schedules.transition({
+ * id: "id",
+ * status: DevRev.OrgScheduleStatus.Archived
+ * })
+ */
+ public async transition(
+ request: DevRev.OrgSchedulesTransitionRequest,
+ requestOptions?: Schedules.RequestOptions
+ ): Promise