#
tokens: 41189/50000 21/22 files (page 1/2)
lines: on (toggle) GitHub
raw markdown copy reset
This is page 1 of 2. Use http://codebase.md/orellazri/coda-mcp?lines=true&page={x} to view the full context.

# Directory Structure

```
├── .github
│   └── workflows
│       ├── release-docker.yaml
│       └── release-npm.yaml
├── .gitignore
├── .prettierrc
├── Dockerfile
├── eslint.config.js
├── LICENSE
├── openapi-ts.config.ts
├── package.json
├── pnpm-lock.yaml
├── pnpm-workspace.yaml
├── README.md
├── release.sh
├── src
│   ├── client
│   │   ├── client.gen.ts
│   │   ├── helpers.ts
│   │   ├── index.ts
│   │   ├── sdk.gen.ts
│   │   └── types.gen.ts
│   ├── config.ts
│   ├── index.ts
│   ├── server.test.ts
│   └── server.ts
├── tsconfig.json
└── vitest.config.js
```

# Files

--------------------------------------------------------------------------------
/.gitignore:
--------------------------------------------------------------------------------

```
1 | node_modules/
2 | dist/
3 | coverage/
4 | .DS_Store
5 | .env
6 | .claude/
7 | 
```

--------------------------------------------------------------------------------
/.prettierrc:
--------------------------------------------------------------------------------

```
1 | {
2 |   "singleQuote": false,
3 |   "trailingComma": "all",
4 |   "printWidth": 120,
5 |   "tabWidth": 2
6 | }
7 | 
```

--------------------------------------------------------------------------------
/README.md:
--------------------------------------------------------------------------------

```markdown
 1 | # Coda MCP Server
 2 | 
 3 | This project implements a Model Context Protocol (MCP) server that acts as a bridge to interact with the [Coda](https://coda.io/) API. It allows an MCP client (like an AI assistant) to perform actions on Coda pages, such as listing, creating, reading, updating, duplicating, and renaming.
 4 | 
 5 | ## Features
 6 | 
 7 | The server exposes the following tools to the MCP client:
 8 | 
 9 | - **`coda_list_documents`**: Lists all documents available to the user.
10 | - **`coda_list_pages`**: Lists all pages within the configured Coda document with pagination support.
11 | - **`coda_create_page`**: Creates a new page in the document, optionally under a specified parent page (creating a subpage) and populating it with initial markdown content.
12 | - **`coda_get_page_content`**: Retrieves the content of a specified page (by ID or name) as markdown.
13 | - **`coda_replace_page_content`**: Replaces the content of a specified page with new markdown content.
14 | - **`coda_append_page_content`**: Appends new markdown content to the end of a specified page.
15 | - **`coda_duplicate_page`**: Creates a copy of an existing page with a new name.
16 | - **`coda_rename_page`**: Renames an existing page.
17 | - **`coda_peek_page`**: Peek into the beginning of a page and return a limited number of lines.
18 | - **`coda_resolve_link`**: Resolve metadata given a browser link to a Coda object.
19 | 
20 | ## Usage
21 | 
22 | Add the MCP server to Cursor/Claude Desktop/etc. like so:
23 | 
24 | ```json
25 | {
26 |   "mcpServers": {
27 |     "coda": {
28 |       "command": "npx",
29 |       "args": ["-y", "coda-mcp@latest"],
30 |       "env": {
31 |         "API_KEY": "..."
32 |       }
33 |     }
34 |   }
35 | }
36 | ```
37 | 
38 | Required environment variables:
39 | 
40 | - `API_KEY`: Your Coda API key. You can generate one from your Coda account settings.
41 | 
42 | This MCP server is also available with Docker, like so:
43 | 
44 | ```json
45 | {
46 |   "mcpServers": {
47 |     "coda": {
48 |       "command": "docker",
49 |       "args": ["run", "-i", "--rm", "-e", "API_KEY", "reaperberri/coda-mcp:latest"],
50 |       "env": {
51 |         "API_KEY": "..."
52 |       }
53 |     }
54 |   }
55 | }
56 | ```
57 | 
58 | ## Local Setup
59 | 
60 | 1.  **Prerequisites:**
61 | 
62 |     - Node.js
63 |     - pnpm
64 | 
65 | 2.  **Clone the repository:**
66 | 
67 |     ```bash
68 |     git clone <repository-url>
69 |     cd coda-mcp
70 |     ```
71 | 
72 | 3.  **Install dependencies:**
73 | 
74 |     ```bash
75 |     pnpm install
76 |     ```
77 | 
78 | 4.  **Build the project:**
79 |     ```bash
80 |     pnpm build
81 |     ```
82 |     This compiles the TypeScript code to JavaScript in the `dist/` directory.
83 | 
84 | ## Running the Server
85 | 
86 | The MCP server communicates over standard input/output (stdio). To run it, set the environment variables and run the compiled JavaScript file - `dist/index.js`.
87 | 
```

--------------------------------------------------------------------------------
/pnpm-workspace.yaml:
--------------------------------------------------------------------------------

```yaml
1 | onlyBuiltDependencies:
2 |   - esbuild
3 | 
```

--------------------------------------------------------------------------------
/src/config.ts:
--------------------------------------------------------------------------------

```typescript
1 | type Config = {
2 |   apiKey: string;
3 | };
4 | 
5 | export const config: Config = {
6 |   apiKey: process.env.API_KEY!,
7 | };
8 | 
```

--------------------------------------------------------------------------------
/src/client/index.ts:
--------------------------------------------------------------------------------

```typescript
1 | // This file is auto-generated by @hey-api/openapi-ts
2 | export * from "./types.gen";
3 | export * from "./sdk.gen";
4 | 
```

--------------------------------------------------------------------------------
/vitest.config.js:
--------------------------------------------------------------------------------

```javascript
 1 | import { defineConfig } from "vitest/config";
 2 | 
 3 | export default defineConfig({
 4 |   test: {
 5 |     coverage: {
 6 |       include: ["src/server.ts"],
 7 |     },
 8 |   },
 9 | });
10 | 
```

--------------------------------------------------------------------------------
/openapi-ts.config.ts:
--------------------------------------------------------------------------------

```typescript
 1 | import { defineConfig } from "@hey-api/openapi-ts";
 2 | 
 3 | export default defineConfig({
 4 |   input: "https://coda.io/apis/v1/openapi.yaml",
 5 |   output: {
 6 |     format: "prettier",
 7 |     path: "src/client",
 8 |   },
 9 |   plugins: ["@hey-api/client-axios"],
10 | });
11 | 
```

--------------------------------------------------------------------------------
/Dockerfile:
--------------------------------------------------------------------------------

```dockerfile
 1 | FROM node:23-alpine AS base
 2 | 
 3 | ENV PNPM_HOME="/pnpm"
 4 | ENV PATH="$PNPM_HOME:$PATH"
 5 | RUN corepack enable
 6 | 
 7 | WORKDIR /app
 8 | 
 9 | COPY package.json pnpm-lock.yaml pnpm-workspace.yaml ./
10 | RUN --mount=type=cache,id=pnpm,target=/pnpm/store pnpm install --frozen-lockfile
11 | 
12 | COPY . /app
13 | 
14 | RUN pnpm run build
15 | 
16 | RUN addgroup -g 1001 -S appgroup && \
17 |     adduser -S appuser -u 1001 -G appgroup
18 | RUN chown -R appuser:appgroup /app
19 | USER appuser
20 | 
21 | CMD ["node", "dist/index.js"]
22 | 
```

--------------------------------------------------------------------------------
/tsconfig.json:
--------------------------------------------------------------------------------

```json
 1 | {
 2 |   "$schema": "https://json.schemastore.org/tsconfig",
 3 |   "display": "Node 23",
 4 |   "_version": "23.0.0",
 5 | 
 6 |   "compilerOptions": {
 7 |     "lib": ["es2024"],
 8 |     "module": "nodenext",
 9 |     "target": "es2024",
10 | 
11 |     "strict": true,
12 |     "esModuleInterop": true,
13 |     "skipLibCheck": true,
14 |     "moduleResolution": "node16",
15 |     "resolveJsonModule": true,
16 | 
17 |     "rootDir": "src",
18 |     "outDir": "dist"
19 |   },
20 |   "exclude": ["node_modules", "dist", "openapi-ts.config.ts"]
21 | }
22 | 
```

--------------------------------------------------------------------------------
/eslint.config.js:
--------------------------------------------------------------------------------

```javascript
 1 | import js from "@eslint/js";
 2 | import { defineConfig } from "eslint/config";
 3 | import globals from "globals";
 4 | import tseslint from "typescript-eslint";
 5 | 
 6 | export default defineConfig([
 7 |   { files: ["**/*.{js,mjs,cjs,ts}"], plugins: { js }, extends: ["js/recommended"] },
 8 |   { files: ["**/*.{js,mjs,cjs,ts}"], languageOptions: { globals: globals.browser } },
 9 |   tseslint.configs.recommended,
10 |   {
11 |     ignores: ["dist", "src/api/openapi.ts"],
12 |   },
13 |   {
14 |     rules: {
15 |       "@typescript-eslint/no-explicit-any": "off",
16 |     },
17 |   },
18 | ]);
19 | 
```

--------------------------------------------------------------------------------
/src/index.ts:
--------------------------------------------------------------------------------

```typescript
 1 | #!/usr/bin/env node
 2 | 
 3 | import { StdioServerTransport } from "@modelcontextprotocol/sdk/server/stdio.js";
 4 | import { client } from "./client/client.gen";
 5 | import { config } from "./config";
 6 | import { server } from "./server";
 7 | 
 8 | async function main() {
 9 |   // Initialize Axios Client
10 |   client.setConfig({
11 |     baseURL: "https://coda.io/apis/v1",
12 |     headers: {
13 |       Authorization: `Bearer ${config.apiKey}`,
14 |     },
15 |   });
16 | 
17 |   // Initialize MCP Server
18 |   const transport = new StdioServerTransport();
19 |   await server.connect(transport);
20 |   console.error("Coda MCP server running on stdio");
21 | }
22 | 
23 | main().catch((error) => {
24 |   console.error("Fatal error in main():", error);
25 |   process.exit(1);
26 | });
27 | 
```

--------------------------------------------------------------------------------
/release.sh:
--------------------------------------------------------------------------------

```bash
 1 | #!/bin/bash
 2 | 
 3 | # Get current version
 4 | CURRENT_VERSION=$(pnpm dlx json -f package.json version)
 5 | echo "Current version: $CURRENT_VERSION"
 6 | 
 7 | # Prompt for the new version tag
 8 | echo "Enter the new version tag (without 'v' prefix, e.g. 1.0.1):"
 9 | read VERSION
10 | 
11 | # Validate version format
12 | if ! [[ $VERSION =~ ^[0-9]+\.[0-9]+\.[0-9]+$ ]]; then
13 |   echo "Error: Version must be in format X.Y.Z (e.g. 1.0.1)"
14 |   exit 1
15 | fi
16 | 
17 | # Update package.json version
18 | pnpm dlx json -I -f package.json -e "this.version='$VERSION'"
19 | 
20 | # Commit the change
21 | git add package.json
22 | git commit -m "chore: bump version to $VERSION"
23 | 
24 | # Create and push the tag
25 | git tag "v$VERSION"
26 | git push origin main
27 | git push --tags
28 | 
29 | echo "✅ Version bumped to $VERSION and tag v$VERSION pushed!" 
30 | 
```

--------------------------------------------------------------------------------
/.github/workflows/release-npm.yaml:
--------------------------------------------------------------------------------

```yaml
 1 | name: Release and Publish to npm
 2 | 
 3 | on:
 4 |   push:
 5 |     tags:
 6 |       - "v*"
 7 | 
 8 | permissions:
 9 |   contents: write
10 |   id-token: write
11 | 
12 | jobs:
13 |   release:
14 |     runs-on: ubuntu-latest
15 |     steps:
16 |       - name: Checkout
17 |         uses: actions/checkout@v4
18 |         with:
19 |           fetch-depth: 0
20 | 
21 |       - name: Set up pnpm
22 |         uses: pnpm/action-setup@v4
23 | 
24 |       - name: Set up Node.js
25 |         uses: actions/setup-node@v4
26 |         with:
27 |           node-version: "23.x"
28 |           registry-url: "https://registry.npmjs.org/"
29 |           cache: "pnpm"
30 | 
31 |       - name: Install dependencies
32 |         run: pnpm install
33 | 
34 |       - name: Build project
35 |         run: pnpm build
36 | 
37 |       - name: Publish package to npm registry
38 |         run: pnpm publish --provenance --access public --no-git-checks
39 |         env:
40 |           NODE_AUTH_TOKEN: ${{ secrets.NPM_TOKEN }}
41 | 
```

--------------------------------------------------------------------------------
/src/client/client.gen.ts:
--------------------------------------------------------------------------------

```typescript
 1 | // This file is auto-generated by @hey-api/openapi-ts
 2 | 
 3 | import type { ClientOptions } from "./types.gen";
 4 | import {
 5 |   type Config,
 6 |   type ClientOptions as DefaultClientOptions,
 7 |   createClient,
 8 |   createConfig,
 9 | } from "@hey-api/client-axios";
10 | 
11 | /**
12 |  * The `createClientConfig()` function will be called on client initialization
13 |  * and the returned object will become the client's initial configuration.
14 |  *
15 |  * You may want to initialize your client this way instead of calling
16 |  * `setConfig()`. This is useful for example if you're using Next.js
17 |  * to ensure your client always has the correct values.
18 |  */
19 | export type CreateClientConfig<T extends DefaultClientOptions = ClientOptions> = (
20 |   override?: Config<DefaultClientOptions & T>,
21 | ) => Config<Required<DefaultClientOptions> & T>;
22 | 
23 | export const client = createClient(
24 |   createConfig<ClientOptions>({
25 |     baseURL: "https://coda.io/apis/v1",
26 |   }),
27 | );
28 | 
```

--------------------------------------------------------------------------------
/package.json:
--------------------------------------------------------------------------------

```json
 1 | {
 2 |   "name": "coda-mcp",
 3 |   "version": "1.5.1",
 4 |   "description": "MCP Server for Coda",
 5 |   "repository": {
 6 |     "url": "https://github.com/orellazri/coda-mcp"
 7 |   },
 8 |   "bin": {
 9 |     "coda": "./dist/index.js"
10 |   },
11 |   "files": [
12 |     "dist"
13 |   ],
14 |   "scripts": {
15 |     "build": "tsc && chmod 755 dist/index.js",
16 |     "lint": "eslint .",
17 |     "format": "prettier --write .",
18 |     "test": "vitest run --coverage",
19 |     "test:watch": "vitest",
20 |     "openapi-ts": "openapi-ts",
21 |     "inspect": "pnpm dlx @modelcontextprotocol/inspector dist/index.js"
22 |   },
23 |   "dependencies": {
24 |     "@hey-api/client-axios": "^0.7.0",
25 |     "@modelcontextprotocol/sdk": "^1.11.2",
26 |     "axios": "^1.9.0",
27 |     "zod": "^3.24.4"
28 |   },
29 |   "devDependencies": {
30 |     "@eslint/js": "^9.26.0",
31 |     "@hey-api/openapi-ts": "^0.67.3",
32 |     "@types/node": "^22.15.17",
33 |     "@vitest/coverage-v8": "3.1.4",
34 |     "eslint": "^9.26.0",
35 |     "globals": "^16.1.0",
36 |     "mcp-testing-kit": "^0.2.0",
37 |     "prettier": "^3.5.3",
38 |     "typescript": "^5.8.3",
39 |     "typescript-eslint": "^8.32.1",
40 |     "vitest": "^3.1.4"
41 |   },
42 |   "packageManager": "[email protected]"
43 | }
44 | 
```

--------------------------------------------------------------------------------
/src/client/helpers.ts:
--------------------------------------------------------------------------------

```typescript
 1 | import axios from "axios";
 2 | import { beginPageContentExport, getPageContentExportStatus } from "./sdk.gen";
 3 | 
 4 | export async function getPageContent(docId: string, pageIdOrName: string) {
 5 |   let requestId: string | undefined;
 6 |   try {
 7 |     // Begin page export
 8 |     const beginExportResp = await beginPageContentExport({
 9 |       path: {
10 |         docId,
11 |         pageIdOrName,
12 |       },
13 |       body: {
14 |         outputFormat: "markdown",
15 |       },
16 |       throwOnError: true,
17 |     });
18 | 
19 |     if (!beginExportResp.data) {
20 |       throw new Error("Failed to begin page content export");
21 |     }
22 | 
23 |     requestId = beginExportResp.data.id;
24 |   } catch (error) {
25 |     throw new Error(`Failed to get page content: ${error}`);
26 |   }
27 | 
28 |   // Poll for export status
29 |   let retries = 0;
30 |   const maxRetries = 5;
31 |   let downloadLink: string | undefined;
32 | 
33 |   while (retries < maxRetries) {
34 |     // Wait for 5 seconds
35 |     await new Promise((resolve) => setTimeout(resolve, 5000));
36 | 
37 |     try {
38 |       const exportStatusResp = await getPageContentExportStatus({
39 |         path: {
40 |           docId,
41 |           pageIdOrName,
42 |           requestId,
43 |         },
44 |         throwOnError: true,
45 |       });
46 | 
47 |       if (exportStatusResp.data?.status === "complete") {
48 |         downloadLink = exportStatusResp.data.downloadLink;
49 |         break;
50 |       }
51 |     } catch (error) {
52 |       throw new Error(`Failed to get page content export status: ${error}`);
53 |     }
54 | 
55 |     retries++;
56 |     if (retries >= maxRetries) {
57 |       throw new Error(`Page content export did not complete after ${maxRetries} retries.`);
58 |     }
59 |   }
60 | 
61 |   if (!downloadLink) {
62 |     throw new Error("Failed to get page content export status");
63 |   }
64 | 
65 |   try {
66 |     const downloadResponse = await axios.get<string>(downloadLink, {
67 |       responseType: "text",
68 |     });
69 | 
70 |     const markdownContent = downloadResponse.data;
71 | 
72 |     return markdownContent;
73 |   } catch {
74 |     throw new Error(`Failed to download exported page content from ${downloadLink}. `);
75 |   }
76 | }
77 | 
```

--------------------------------------------------------------------------------
/.github/workflows/release-docker.yaml:
--------------------------------------------------------------------------------

```yaml
 1 | name: Release and Publish to Docker Hub
 2 | 
 3 | on:
 4 |   push:
 5 |     tags:
 6 |       - "v*"
 7 | 
 8 | permissions:
 9 |   contents: write
10 |   id-token: write
11 | 
12 | jobs:
13 |   release:
14 |     runs-on: ubuntu-latest
15 |     steps:
16 |       - name: Checkout
17 |         uses: actions/checkout@v4
18 |         with:
19 |           fetch-depth: 0
20 | 
21 |       - name: Set up Docker Buildx
22 |         uses: docker/setup-buildx-action@v2
23 | 
24 |       - name: Log in to Docker Hub
25 |         uses: docker/login-action@f4ef78c080cd8ba55a85445d5b36e214a81df20a
26 |         with:
27 |           username: ${{ secrets.DOCKERHUB_USERNAME }}
28 |           password: ${{ secrets.DOCKERHUB_PASSWORD }}
29 | 
30 |       - name: Build and Push Docker image
31 |         run: |
32 |           VERSION_TAG=${GITHUB_REF#refs/tags/v}
33 |           docker buildx build --push --platform linux/amd64,linux/arm64/v8 \
34 |             --tag reaperberri/coda-mcp:latest \
35 |             --tag reaperberri/coda-mcp:${VERSION_TAG} .
36 | 
37 |       - name: Build Changelog
38 |         uses: mikepenz/release-changelog-builder-action@v5
39 |         with:
40 |           mode: "COMMIT"
41 |           configurationJson: |
42 |             {
43 |               "template": "#{{CHANGELOG}}",
44 |               "categories": [
45 |                 {
46 |                     "title": "## Feature",
47 |                     "labels": ["feat", "feature"]
48 |                 },
49 |                 {
50 |                     "title": "## Fix",
51 |                     "labels": ["fix", "bug"]
52 |                 },
53 |                 {
54 |                     "title": "## Other",
55 |                     "labels": []
56 |                 }
57 |               ],
58 |               "label_extractor": [
59 |                 {
60 |                   "pattern": "^(build|chore|ci|docs|feat|fix|perf|refactor|revert|style|test){1}(\\([\\w\\-\\.]+\\))?(!)?: ([\\w ])+([\\s\\S]*)",
61 |                   "on_property": "title",
62 |                   "target": "$1"
63 |                 }
64 |               ]
65 |             }
66 |         env:
67 |           GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
68 | 
69 |       - name: Create Release
70 |         uses: mikepenz/[email protected]
71 |         with:
72 |           body: ${{steps.github_release.outputs.changelog}}
73 | 
```

--------------------------------------------------------------------------------
/src/server.ts:
--------------------------------------------------------------------------------

```typescript
  1 | import { McpServer } from "@modelcontextprotocol/sdk/server/mcp.js";
  2 | import { CallToolResult } from "@modelcontextprotocol/sdk/types.js";
  3 | import z from "zod";
  4 | import packageJson from "../package.json";
  5 | import { getPageContent } from "./client/helpers";
  6 | import { createPage, listDocs, listPages, resolveBrowserLink, updatePage } from "./client/sdk.gen";
  7 | 
  8 | export const server = new McpServer({
  9 |   name: "coda",
 10 |   version: packageJson.version,
 11 |   capabilities: {
 12 |     resources: {},
 13 |     tools: {},
 14 |   },
 15 | });
 16 | 
 17 | server.tool(
 18 |   "coda_list_documents",
 19 |   "List or search available documents",
 20 |   {
 21 |     query: z.string().optional().describe("The query to search for documents by - optional"),
 22 |   },
 23 |   async ({ query }): Promise<CallToolResult> => {
 24 |     try {
 25 |       const resp = await listDocs({ query: { query }, throwOnError: true });
 26 | 
 27 |       return { content: [{ type: "text", text: JSON.stringify(resp.data) }] };
 28 |     } catch (error) {
 29 |       return { content: [{ type: "text", text: `Failed to list documents: ${error}` }], isError: true };
 30 |     }
 31 |   },
 32 | );
 33 | 
 34 | server.tool(
 35 |   "coda_list_pages",
 36 |   "List pages in the current document with pagination",
 37 |   {
 38 |     docId: z.string().describe("The ID of the document to list pages from"),
 39 |     limit: z.number().int().positive().optional().describe("The number of pages to return - optional, defaults to 25"),
 40 |     nextPageToken: z
 41 |       .string()
 42 |       .optional()
 43 |       .describe(
 44 |         "The token need to get the next page of results, returned from a previous call to this tool - optional",
 45 |       ),
 46 |   },
 47 |   async ({ docId, limit, nextPageToken }): Promise<CallToolResult> => {
 48 |     try {
 49 |       const listLimit = nextPageToken ? undefined : limit;
 50 | 
 51 |       const resp = await listPages({
 52 |         path: { docId },
 53 |         query: { limit: listLimit, pageToken: nextPageToken ?? undefined },
 54 |         throwOnError: true,
 55 |       });
 56 | 
 57 |       return {
 58 |         content: [{ type: "text", text: JSON.stringify(resp.data) }],
 59 |       };
 60 |     } catch (error) {
 61 |       return {
 62 |         content: [{ type: "text", text: `Failed to list pages: ${error}` }],
 63 |         isError: true,
 64 |       };
 65 |     }
 66 |   },
 67 | );
 68 | 
 69 | server.tool(
 70 |   "coda_create_page",
 71 |   "Create a page in the current document",
 72 |   {
 73 |     docId: z.string().describe("The ID of the document to create the page in"),
 74 |     name: z.string().describe("The name of the page to create"),
 75 |     content: z.string().optional().describe("The markdown content of the page to create - optional"),
 76 |     parentPageId: z.string().optional().describe("The ID of the parent page to create this page under - optional"),
 77 |   },
 78 |   async ({ docId, name, content, parentPageId }): Promise<CallToolResult> => {
 79 |     try {
 80 |       const resp = await createPage({
 81 |         path: { docId },
 82 |         body: {
 83 |           name,
 84 |           parentPageId: parentPageId ?? undefined,
 85 |           pageContent: {
 86 |             type: "canvas",
 87 |             canvasContent: { format: "markdown", content: content ?? " " },
 88 |           },
 89 |         },
 90 |         throwOnError: true,
 91 |       });
 92 | 
 93 |       return {
 94 |         content: [{ type: "text", text: JSON.stringify(resp.data) }],
 95 |       };
 96 |     } catch (error) {
 97 |       return { content: [{ type: "text", text: `Failed to create page: ${error}` }], isError: true };
 98 |     }
 99 |   },
100 | );
101 | 
102 | server.tool(
103 |   "coda_get_page_content",
104 |   "Get the content of a page as markdown",
105 |   {
106 |     docId: z.string().describe("The ID of the document that contains the page to get the content of"),
107 |     pageIdOrName: z.string().describe("The ID or name of the page to get the content of"),
108 |   },
109 |   async ({ docId, pageIdOrName }): Promise<CallToolResult> => {
110 |     try {
111 |       const content = await getPageContent(docId, pageIdOrName);
112 | 
113 |       if (content === undefined) {
114 |         throw new Error("Unknown error has occurred");
115 |       }
116 | 
117 |       return { content: [{ type: "text", text: content }] };
118 |     } catch (error) {
119 |       return { content: [{ type: "text", text: `Failed to get page content: ${error}` }], isError: true };
120 |     }
121 |   },
122 | );
123 | 
124 | server.tool(
125 |   "coda_peek_page",
126 |   "Peek into the beginning of a page and return a limited number of lines",
127 |   {
128 |     docId: z.string().describe("The ID of the document that contains the page to peek into"),
129 |     pageIdOrName: z.string().describe("The ID or name of the page to peek into"),
130 |     numLines: z
131 |       .number()
132 |       .int()
133 |       .positive()
134 |       .describe("The number of lines to return from the start of the page - usually 30 lines is enough"),
135 |   },
136 |   async ({ docId, pageIdOrName, numLines }): Promise<CallToolResult> => {
137 |     try {
138 |       const content = await getPageContent(docId, pageIdOrName);
139 | 
140 |       if (!content) {
141 |         throw new Error("Unknown error has occurred");
142 |       }
143 | 
144 |       const preview = content.split(/\r?\n/).slice(0, numLines).join("\n");
145 | 
146 |       return { content: [{ type: "text", text: preview }] };
147 |     } catch (error) {
148 |       return {
149 |         content: [{ type: "text", text: `Failed to peek page: ${error}` }],
150 |         isError: true,
151 |       };
152 |     }
153 |   },
154 | );
155 | 
156 | server.tool(
157 |   "coda_replace_page_content",
158 |   "Replace the content of a page with new markdown content",
159 |   {
160 |     docId: z.string().describe("The ID of the document that contains the page to replace the content of"),
161 |     pageIdOrName: z.string().describe("The ID or name of the page to replace the content of"),
162 |     content: z.string().describe("The markdown content to replace the page with"),
163 |   },
164 |   async ({ docId, pageIdOrName, content }): Promise<CallToolResult> => {
165 |     try {
166 |       const resp = await updatePage({
167 |         path: {
168 |           docId,
169 |           pageIdOrName,
170 |         },
171 |         body: {
172 |           // @ts-expect-error auto-generated client types
173 |           contentUpdate: {
174 |             insertionMode: "replace",
175 |             canvasContent: { format: "markdown", content },
176 |           },
177 |         },
178 |         throwOnError: true,
179 |       });
180 | 
181 |       return { content: [{ type: "text", text: JSON.stringify(resp.data) }] };
182 |     } catch (error) {
183 |       return { content: [{ type: "text", text: `Failed to replace page content: ${error}` }], isError: true };
184 |     }
185 |   },
186 | );
187 | 
188 | server.tool(
189 |   "coda_append_page_content",
190 |   "Append new markdown content to the end of a page",
191 |   {
192 |     docId: z.string().describe("The ID of the document that contains the page to append the content to"),
193 |     pageIdOrName: z.string().describe("The ID or name of the page to append the content to"),
194 |     content: z.string().describe("The markdown content to append to the page"),
195 |   },
196 |   async ({ docId, pageIdOrName, content }): Promise<CallToolResult> => {
197 |     try {
198 |       const resp = await updatePage({
199 |         path: {
200 |           docId,
201 |           pageIdOrName,
202 |         },
203 |         body: {
204 |           // @ts-expect-error auto-generated client types
205 |           contentUpdate: {
206 |             insertionMode: "append",
207 |             canvasContent: { format: "markdown", content },
208 |           },
209 |         },
210 |         throwOnError: true,
211 |       });
212 | 
213 |       return { content: [{ type: "text", text: JSON.stringify(resp.data) }] };
214 |     } catch (error) {
215 |       return { content: [{ type: "text", text: `Failed to append page content: ${error}` }], isError: true };
216 |     }
217 |   },
218 | );
219 | 
220 | server.tool(
221 |   "coda_duplicate_page",
222 |   "Duplicate a page in the current document",
223 |   {
224 |     docId: z.string().describe("The ID of the document that contains the page to duplicate"),
225 |     pageIdOrName: z.string().describe("The ID or name of the page to duplicate"),
226 |     newName: z.string().describe("The name of the new page"),
227 |   },
228 |   async ({ docId, pageIdOrName, newName }): Promise<CallToolResult> => {
229 |     try {
230 |       const pageContent = await getPageContent(docId, pageIdOrName);
231 |       const createResp = await createPage({
232 |         path: { docId },
233 |         body: {
234 |           name: newName,
235 |           pageContent: { type: "canvas", canvasContent: { format: "markdown", content: pageContent } },
236 |         },
237 |         throwOnError: true,
238 |       });
239 | 
240 |       return { content: [{ type: "text", text: JSON.stringify(createResp.data) }] };
241 |     } catch (error) {
242 |       return { content: [{ type: "text", text: `Failed to duplicate page: ${error}` }], isError: true };
243 |     }
244 |   },
245 | );
246 | 
247 | server.tool(
248 |   "coda_rename_page",
249 |   "Rename a page in the current document",
250 |   {
251 |     docId: z.string().describe("The ID of the document that contains the page to rename"),
252 |     pageIdOrName: z.string().describe("The ID or name of the page to rename"),
253 |     newName: z.string().describe("The new name of the page"),
254 |   },
255 |   async ({ docId, pageIdOrName, newName }): Promise<CallToolResult> => {
256 |     try {
257 |       const resp = await updatePage({
258 |         path: { docId, pageIdOrName },
259 |         body: {
260 |           name: newName,
261 |         },
262 |         throwOnError: true,
263 |       });
264 | 
265 |       return { content: [{ type: "text", text: JSON.stringify(resp.data) }] };
266 |     } catch (error) {
267 |       return { content: [{ type: "text", text: `Failed to rename page: ${error}` }], isError: true };
268 |     }
269 |   },
270 | );
271 | 
272 | server.tool(
273 |   "coda_resolve_link",
274 |   "Resolve metadata given a browser link to a Coda object",
275 |   {
276 |     url: z.string().describe("The URL to resolve"),
277 |   },
278 |   async ({ url }): Promise<CallToolResult> => {
279 |     try {
280 |       const resp = await resolveBrowserLink({
281 |         query: { url },
282 |         throwOnError: true,
283 |       });
284 | 
285 |       return { content: [{ type: "text", text: JSON.stringify(resp.data) }] };
286 |     } catch (error) {
287 |       return { content: [{ type: "text", text: `Failed to resolve link: ${error}` }], isError: true };
288 |     }
289 |   },
290 | );
291 | 
```

--------------------------------------------------------------------------------
/src/server.test.ts:
--------------------------------------------------------------------------------

```typescript
  1 | import { close, connect } from "mcp-testing-kit";
  2 | import { afterEach, describe, expect, it, vi } from "vitest";
  3 | import * as helpers from "./client/helpers";
  4 | import * as sdk from "./client/sdk.gen";
  5 | import { server as mcpServer } from "./server";
  6 | 
  7 | vi.mock("./client/sdk.gen");
  8 | vi.mock("./client/helpers");
  9 | vi.mock("axios");
 10 | 
 11 | describe("MCP Server", () => {
 12 |   afterEach(async () => {
 13 |     await close(mcpServer.server);
 14 |     vi.clearAllMocks();
 15 |   });
 16 | 
 17 |   it("should have all tools", async () => {
 18 |     const client = await connect(mcpServer.server);
 19 |     const result = await client.listTools();
 20 |     expect(result.tools).toEqual([
 21 |       expect.objectContaining({ name: "coda_list_documents" }),
 22 |       expect.objectContaining({ name: "coda_list_pages" }),
 23 |       expect.objectContaining({ name: "coda_create_page" }),
 24 |       expect.objectContaining({ name: "coda_get_page_content" }),
 25 |       expect.objectContaining({ name: "coda_peek_page" }),
 26 |       expect.objectContaining({ name: "coda_replace_page_content" }),
 27 |       expect.objectContaining({ name: "coda_append_page_content" }),
 28 |       expect.objectContaining({ name: "coda_duplicate_page" }),
 29 |       expect.objectContaining({ name: "coda_rename_page" }),
 30 |       expect.objectContaining({ name: "coda_resolve_link" }),
 31 |     ]);
 32 |   });
 33 | });
 34 | 
 35 | describe("coda_list_documents", () => {
 36 |   it("should list documents without query", async () => {
 37 |     vi.mocked(sdk.listDocs).mockResolvedValue({
 38 |       data: {
 39 |         items: [
 40 |           { id: "123", name: "Test Document" },
 41 |           { id: "456", name: "Another Document" },
 42 |         ],
 43 |       },
 44 |     } as any);
 45 | 
 46 |     const client = await connect(mcpServer.server);
 47 |     const result = await client.callTool("coda_list_documents", { query: "" });
 48 |     expect(result.content).toEqual([
 49 |       {
 50 |         type: "text",
 51 |         text: JSON.stringify({
 52 |           items: [
 53 |             { id: "123", name: "Test Document" },
 54 |             { id: "456", name: "Another Document" },
 55 |           ],
 56 |         }),
 57 |       },
 58 |     ]);
 59 |   });
 60 | 
 61 |   it("should list documents with query", async () => {
 62 |     vi.mocked(sdk.listDocs).mockResolvedValue({
 63 |       data: {
 64 |         items: [{ id: "123", name: "Test Document" }],
 65 |       },
 66 |     } as any);
 67 | 
 68 |     const client = await connect(mcpServer.server);
 69 |     const result = await client.callTool("coda_list_documents", { query: "test" });
 70 |     expect(result.content).toEqual([
 71 |       {
 72 |         type: "text",
 73 |         text: JSON.stringify({
 74 |           items: [{ id: "123", name: "Test Document" }],
 75 |         }),
 76 |       },
 77 |     ]);
 78 |   });
 79 | 
 80 |   it("should show error if list documents throws", async () => {
 81 |     vi.mocked(sdk.listDocs).mockRejectedValue(new Error("foo"));
 82 | 
 83 |     const client = await connect(mcpServer.server);
 84 |     const result = await client.callTool("coda_list_documents", { query: "test" });
 85 |     expect(result.content).toEqual([{ type: "text", text: "Failed to list documents: Error: foo" }]);
 86 |   });
 87 | });
 88 | 
 89 | describe("coda_list_pages", () => {
 90 |   it("should list pages successfully without limit or nextPageToken", async () => {
 91 |     vi.mocked(sdk.listPages).mockResolvedValue({
 92 |       data: {
 93 |         items: [
 94 |           { id: "page-123", name: "Test Page 1" },
 95 |           { id: "page-456", name: "Test Page 2" },
 96 |         ],
 97 |       },
 98 |     } as any);
 99 | 
100 |     const client = await connect(mcpServer.server);
101 |     const result = await client.callTool("coda_list_pages", { docId: "doc-123" });
102 |     expect(result.content).toEqual([
103 |       {
104 |         type: "text",
105 |         text: JSON.stringify({
106 |           items: [
107 |             { id: "page-123", name: "Test Page 1" },
108 |             { id: "page-456", name: "Test Page 2" },
109 |           ],
110 |         }),
111 |       },
112 |     ]);
113 |     expect(sdk.listPages).toHaveBeenCalledWith({
114 |       path: { docId: "doc-123" },
115 |       query: { limit: undefined, pageToken: undefined },
116 |       throwOnError: true,
117 |     });
118 |   });
119 | 
120 |   it("should list pages with limit", async () => {
121 |     vi.mocked(sdk.listPages).mockResolvedValue({
122 |       data: {
123 |         items: [
124 |           { id: "page-123", name: "Test Page 1" },
125 |           { id: "page-456", name: "Test Page 2" },
126 |         ],
127 |         nextPageToken: "token-123",
128 |       },
129 |     } as any);
130 | 
131 |     const client = await connect(mcpServer.server);
132 |     const result = await client.callTool("coda_list_pages", { docId: "doc-123", limit: 10 });
133 |     expect(result.content).toEqual([
134 |       {
135 |         type: "text",
136 |         text: JSON.stringify({
137 |           items: [
138 |             { id: "page-123", name: "Test Page 1" },
139 |             { id: "page-456", name: "Test Page 2" },
140 |           ],
141 |           nextPageToken: "token-123",
142 |         }),
143 |       },
144 |     ]);
145 |     expect(sdk.listPages).toHaveBeenCalledWith({
146 |       path: { docId: "doc-123" },
147 |       query: { limit: 10, pageToken: undefined },
148 |       throwOnError: true,
149 |     });
150 |   });
151 | 
152 |   it("should list pages with nextPageToken", async () => {
153 |     vi.mocked(sdk.listPages).mockResolvedValue({
154 |       data: {
155 |         items: [
156 |           { id: "page-789", name: "Test Page 3" },
157 |           { id: "page-101", name: "Test Page 4" },
158 |         ],
159 |       },
160 |     } as any);
161 | 
162 |     const client = await connect(mcpServer.server);
163 |     const result = await client.callTool("coda_list_pages", {
164 |       docId: "doc-123",
165 |       nextPageToken: "token-123",
166 |     });
167 |     expect(result.content).toEqual([
168 |       {
169 |         type: "text",
170 |         text: JSON.stringify({
171 |           items: [
172 |             { id: "page-789", name: "Test Page 3" },
173 |             { id: "page-101", name: "Test Page 4" },
174 |           ],
175 |         }),
176 |       },
177 |     ]);
178 |     expect(sdk.listPages).toHaveBeenCalledWith({
179 |       path: { docId: "doc-123" },
180 |       query: { limit: undefined, pageToken: "token-123" },
181 |       throwOnError: true,
182 |     });
183 |   });
184 | 
185 |   it("should prioritize nextPageToken over limit", async () => {
186 |     vi.mocked(sdk.listPages).mockResolvedValue({
187 |       data: {
188 |         items: [{ id: "page-789", name: "Test Page 3" }],
189 |       },
190 |     } as any);
191 | 
192 |     const client = await connect(mcpServer.server);
193 |     const result = await client.callTool("coda_list_pages", {
194 |       docId: "doc-123",
195 |       limit: 5,
196 |       nextPageToken: "token-123",
197 |     });
198 |     expect(result.content).toEqual([
199 |       {
200 |         type: "text",
201 |         text: JSON.stringify({
202 |           items: [{ id: "page-789", name: "Test Page 3" }],
203 |         }),
204 |       },
205 |     ]);
206 |     // When nextPageToken is provided, limit should be undefined
207 |     expect(sdk.listPages).toHaveBeenCalledWith({
208 |       path: { docId: "doc-123" },
209 |       query: { limit: undefined, pageToken: "token-123" },
210 |       throwOnError: true,
211 |     });
212 |   });
213 | 
214 |   it("should show error if list pages throws", async () => {
215 |     vi.mocked(sdk.listPages).mockRejectedValue(new Error("Access denied"));
216 | 
217 |     const client = await connect(mcpServer.server);
218 |     const result = await client.callTool("coda_list_pages", { docId: "doc-123" });
219 |     expect(result.content).toEqual([{ type: "text", text: "Failed to list pages: Error: Access denied" }]);
220 |   });
221 | });
222 | 
223 | describe("coda_create_page", () => {
224 |   it("should create page with content", async () => {
225 |     vi.mocked(sdk.createPage).mockResolvedValue({
226 |       data: {
227 |         id: "page-new",
228 |         requestId: "req-123",
229 |       },
230 |     } as any);
231 | 
232 |     const client = await connect(mcpServer.server);
233 |     const result = await client.callTool("coda_create_page", {
234 |       docId: "doc-123",
235 |       name: "New Page",
236 |       content: "# Hello World",
237 |     });
238 |     expect(result.content).toEqual([
239 |       {
240 |         type: "text",
241 |         text: JSON.stringify({
242 |           id: "page-new",
243 |           requestId: "req-123",
244 |         }),
245 |       },
246 |     ]);
247 |     expect(sdk.createPage).toHaveBeenCalledWith({
248 |       path: { docId: "doc-123" },
249 |       body: {
250 |         name: "New Page",
251 |         pageContent: {
252 |           type: "canvas",
253 |           canvasContent: { format: "markdown", content: "# Hello World" },
254 |         },
255 |       },
256 |       throwOnError: true,
257 |     });
258 |   });
259 | 
260 |   it("should create page without content", async () => {
261 |     vi.mocked(sdk.createPage).mockResolvedValue({
262 |       data: {
263 |         id: "page-new",
264 |         requestId: "req-124",
265 |       },
266 |     } as any);
267 | 
268 |     const client = await connect(mcpServer.server);
269 |     await client.callTool("coda_create_page", {
270 |       docId: "doc-123",
271 |       name: "Empty Page",
272 |     });
273 |     expect(sdk.createPage).toHaveBeenCalledWith({
274 |       path: { docId: "doc-123" },
275 |       body: {
276 |         name: "Empty Page",
277 |         pageContent: {
278 |           type: "canvas",
279 |           canvasContent: { format: "markdown", content: " " },
280 |         },
281 |       },
282 |       throwOnError: true,
283 |     });
284 |   });
285 | 
286 |   it("should create page with parent page id and content", async () => {
287 |     vi.mocked(sdk.createPage).mockResolvedValue({
288 |       data: {
289 |         id: "page-sub",
290 |         requestId: "req-125",
291 |       },
292 |     } as any);
293 | 
294 |     const client = await connect(mcpServer.server);
295 |     const result = await client.callTool("coda_create_page", {
296 |       docId: "doc-123",
297 |       name: "Subpage",
298 |       parentPageId: "page-456",
299 |       content: "## Subheading",
300 |     });
301 |     expect(result.content).toEqual([
302 |       {
303 |         type: "text",
304 |         text: JSON.stringify({ id: "page-sub", requestId: "req-125" }),
305 |       },
306 |     ]);
307 |     expect(sdk.createPage).toHaveBeenCalledWith({
308 |       path: { docId: "doc-123" },
309 |       body: {
310 |         name: "Subpage",
311 |         parentPageId: "page-456",
312 |         pageContent: {
313 |           type: "canvas",
314 |           canvasContent: { format: "markdown", content: "## Subheading" },
315 |         },
316 |       },
317 |       throwOnError: true,
318 |     });
319 |   });
320 | 
321 |   it("should show error if create page throws", async () => {
322 |     vi.mocked(sdk.createPage).mockRejectedValue(new Error("Insufficient permissions"));
323 | 
324 |     const client = await connect(mcpServer.server);
325 |     const result = await client.callTool("coda_create_page", {
326 |       docId: "doc-123",
327 |       name: "New Page",
328 |     });
329 |     expect(result.content).toEqual([{ type: "text", text: "Failed to create page: Error: Insufficient permissions" }]);
330 |   });
331 | });
332 | 
333 | describe("coda_get_page_content", () => {
334 |   it("should get page content successfully", async () => {
335 |     vi.mocked(helpers.getPageContent).mockResolvedValue("# Page Title\n\nThis is the content.");
336 | 
337 |     const client = await connect(mcpServer.server);
338 |     const result = await client.callTool("coda_get_page_content", {
339 |       docId: "doc-123",
340 |       pageIdOrName: "page-456",
341 |     });
342 |     expect(result.content).toEqual([
343 |       {
344 |         type: "text",
345 |         text: "# Page Title\n\nThis is the content.",
346 |       },
347 |     ]);
348 |     expect(helpers.getPageContent).toHaveBeenCalledWith("doc-123", "page-456");
349 |   });
350 | 
351 |   it("should handle empty page content", async () => {
352 |     vi.mocked(helpers.getPageContent).mockResolvedValue("");
353 | 
354 |     const client = await connect(mcpServer.server);
355 |     const result = await client.callTool("coda_get_page_content", {
356 |       docId: "doc-123",
357 |       pageIdOrName: "page-456",
358 |     });
359 |     expect(result.content).toEqual([
360 |       {
361 |         type: "text",
362 |         text: "",
363 |       },
364 |     ]);
365 |   });
366 | 
367 |   it("should show error if getPageContent returns undefined", async () => {
368 |     vi.mocked(helpers.getPageContent).mockResolvedValue(undefined as any);
369 | 
370 |     const client = await connect(mcpServer.server);
371 |     const result = await client.callTool("coda_get_page_content", {
372 |       docId: "doc-123",
373 |       pageIdOrName: "page-456",
374 |     });
375 |     expect(result.content).toEqual([
376 |       { type: "text", text: "Failed to get page content: Error: Unknown error has occurred" },
377 |     ]);
378 |   });
379 | 
380 |   it("should show error if getPageContent throws", async () => {
381 |     vi.mocked(helpers.getPageContent).mockRejectedValue(new Error("Export failed"));
382 | 
383 |     const client = await connect(mcpServer.server);
384 |     const result = await client.callTool("coda_get_page_content", {
385 |       docId: "doc-123",
386 |       pageIdOrName: "page-456",
387 |     });
388 |     expect(result.content).toEqual([{ type: "text", text: "Failed to get page content: Error: Export failed" }]);
389 |   });
390 | });
391 | 
392 | describe("coda_peek_page", () => {
393 |   it("should peek page content successfully", async () => {
394 |     vi.mocked(helpers.getPageContent).mockResolvedValue("# Title\nLine 1\nLine 2\nLine 3");
395 | 
396 |     const client = await connect(mcpServer.server);
397 |     const result = await client.callTool("coda_peek_page", {
398 |       docId: "doc-123",
399 |       pageIdOrName: "page-456",
400 |       numLines: 2,
401 |     });
402 |     expect(result.content).toEqual([
403 |       {
404 |         type: "text",
405 |         text: "# Title\nLine 1",
406 |       },
407 |     ]);
408 |     expect(helpers.getPageContent).toHaveBeenCalledWith("doc-123", "page-456");
409 |   });
410 | 
411 |   it("should show error if getPageContent returns undefined", async () => {
412 |     vi.mocked(helpers.getPageContent).mockResolvedValue(undefined as any);
413 | 
414 |     const client = await connect(mcpServer.server);
415 |     const result = await client.callTool("coda_peek_page", {
416 |       docId: "doc-123",
417 |       pageIdOrName: "page-456",
418 |       numLines: 1,
419 |     });
420 |     expect(result.content).toEqual([{ type: "text", text: "Failed to peek page: Error: Unknown error has occurred" }]);
421 |   });
422 | 
423 |   it("should show error if getPageContent throws", async () => {
424 |     vi.mocked(helpers.getPageContent).mockRejectedValue(new Error("Export failed"));
425 | 
426 |     const client = await connect(mcpServer.server);
427 |     const result = await client.callTool("coda_peek_page", {
428 |       docId: "doc-123",
429 |       pageIdOrName: "page-456",
430 |       numLines: 3,
431 |     });
432 |     expect(result.content).toEqual([{ type: "text", text: "Failed to peek page: Error: Export failed" }]);
433 |   });
434 | });
435 | 
436 | describe("coda_replace_page_content", () => {
437 |   it("should replace page content successfully", async () => {
438 |     vi.mocked(sdk.updatePage).mockResolvedValue({
439 |       data: {
440 |         id: "page-456",
441 |         requestId: "req-125",
442 |       },
443 |     } as any);
444 | 
445 |     const client = await connect(mcpServer.server);
446 |     const result = await client.callTool("coda_replace_page_content", {
447 |       docId: "doc-123",
448 |       pageIdOrName: "page-456",
449 |       content: "# New Content\n\nReplaced content.",
450 |     });
451 |     expect(result.content).toEqual([
452 |       {
453 |         type: "text",
454 |         text: JSON.stringify({
455 |           id: "page-456",
456 |           requestId: "req-125",
457 |         }),
458 |       },
459 |     ]);
460 |     expect(sdk.updatePage).toHaveBeenCalledWith({
461 |       path: { docId: "doc-123", pageIdOrName: "page-456" },
462 |       body: {
463 |         contentUpdate: {
464 |           insertionMode: "replace",
465 |           canvasContent: { format: "markdown", content: "# New Content\n\nReplaced content." },
466 |         },
467 |       },
468 |       throwOnError: true,
469 |     });
470 |   });
471 | 
472 |   it("should show error if replace page content throws", async () => {
473 |     vi.mocked(sdk.updatePage).mockRejectedValue(new Error("Update failed"));
474 | 
475 |     const client = await connect(mcpServer.server);
476 |     const result = await client.callTool("coda_replace_page_content", {
477 |       docId: "doc-123",
478 |       pageIdOrName: "page-456",
479 |       content: "# New Content",
480 |     });
481 |     expect(result.content).toEqual([{ type: "text", text: "Failed to replace page content: Error: Update failed" }]);
482 |   });
483 | });
484 | 
485 | describe("coda_append_page_content", () => {
486 |   it("should append page content successfully", async () => {
487 |     vi.mocked(sdk.updatePage).mockResolvedValue({
488 |       data: {
489 |         id: "page-456",
490 |         requestId: "req-126",
491 |       },
492 |     } as any);
493 | 
494 |     const client = await connect(mcpServer.server);
495 |     const result = await client.callTool("coda_append_page_content", {
496 |       docId: "doc-123",
497 |       pageIdOrName: "page-456",
498 |       content: "\n\n## Appended Section\n\nNew content.",
499 |     });
500 |     expect(result.content).toEqual([
501 |       {
502 |         type: "text",
503 |         text: JSON.stringify({
504 |           id: "page-456",
505 |           requestId: "req-126",
506 |         }),
507 |       },
508 |     ]);
509 |     expect(sdk.updatePage).toHaveBeenCalledWith({
510 |       path: { docId: "doc-123", pageIdOrName: "page-456" },
511 |       body: {
512 |         contentUpdate: {
513 |           insertionMode: "append",
514 |           canvasContent: { format: "markdown", content: "\n\n## Appended Section\n\nNew content." },
515 |         },
516 |       },
517 |       throwOnError: true,
518 |     });
519 |   });
520 | 
521 |   it("should show error if append page content throws", async () => {
522 |     vi.mocked(sdk.updatePage).mockRejectedValue(new Error("Append failed"));
523 | 
524 |     const client = await connect(mcpServer.server);
525 |     const result = await client.callTool("coda_append_page_content", {
526 |       docId: "doc-123",
527 |       pageIdOrName: "page-456",
528 |       content: "Additional content",
529 |     });
530 |     expect(result.content).toEqual([{ type: "text", text: "Failed to append page content: Error: Append failed" }]);
531 |   });
532 | });
533 | 
534 | describe("coda_duplicate_page", () => {
535 |   it("should duplicate page successfully", async () => {
536 |     vi.mocked(helpers.getPageContent).mockResolvedValue("# Original Page\n\nOriginal content.");
537 |     vi.mocked(sdk.createPage).mockResolvedValue({
538 |       data: {
539 |         id: "page-duplicate",
540 |         requestId: "req-127",
541 |       },
542 |     } as any);
543 | 
544 |     const client = await connect(mcpServer.server);
545 |     const result = await client.callTool("coda_duplicate_page", {
546 |       docId: "doc-123",
547 |       pageIdOrName: "page-456",
548 |       newName: "Duplicated Page",
549 |     });
550 |     expect(result.content).toEqual([
551 |       {
552 |         type: "text",
553 |         text: JSON.stringify({
554 |           id: "page-duplicate",
555 |           requestId: "req-127",
556 |         }),
557 |       },
558 |     ]);
559 |     expect(helpers.getPageContent).toHaveBeenCalledWith("doc-123", "page-456");
560 |     expect(sdk.createPage).toHaveBeenCalledWith({
561 |       path: { docId: "doc-123" },
562 |       body: {
563 |         name: "Duplicated Page",
564 |         pageContent: {
565 |           type: "canvas",
566 |           canvasContent: { format: "markdown", content: "# Original Page\n\nOriginal content." },
567 |         },
568 |       },
569 |       throwOnError: true,
570 |     });
571 |   });
572 | 
573 |   it("should show error if getPageContent fails during duplication", async () => {
574 |     vi.mocked(helpers.getPageContent).mockRejectedValue(new Error("Content fetch failed"));
575 | 
576 |     const client = await connect(mcpServer.server);
577 |     const result = await client.callTool("coda_duplicate_page", {
578 |       docId: "doc-123",
579 |       pageIdOrName: "page-456",
580 |       newName: "Duplicated Page",
581 |     });
582 |     expect(result.content).toEqual([{ type: "text", text: "Failed to duplicate page: Error: Content fetch failed" }]);
583 |   });
584 | 
585 |   it("should show error if createPage fails during duplication", async () => {
586 |     vi.mocked(helpers.getPageContent).mockResolvedValue("# Original Page");
587 |     vi.mocked(sdk.createPage).mockRejectedValue(new Error("Create failed"));
588 | 
589 |     const client = await connect(mcpServer.server);
590 |     const result = await client.callTool("coda_duplicate_page", {
591 |       docId: "doc-123",
592 |       pageIdOrName: "page-456",
593 |       newName: "Duplicated Page",
594 |     });
595 |     expect(result.content).toEqual([{ type: "text", text: "Failed to duplicate page: Error: Create failed" }]);
596 |   });
597 | });
598 | 
599 | describe("coda_rename_page", () => {
600 |   it("should rename page successfully", async () => {
601 |     vi.mocked(sdk.updatePage).mockResolvedValue({
602 |       data: {
603 |         id: "page-456",
604 |         requestId: "req-128",
605 |       },
606 |     } as any);
607 | 
608 |     const client = await connect(mcpServer.server);
609 |     const result = await client.callTool("coda_rename_page", {
610 |       docId: "doc-123",
611 |       pageIdOrName: "page-456",
612 |       newName: "Renamed Page",
613 |     });
614 |     expect(result.content).toEqual([
615 |       {
616 |         type: "text",
617 |         text: JSON.stringify({
618 |           id: "page-456",
619 |           requestId: "req-128",
620 |         }),
621 |       },
622 |     ]);
623 |     expect(sdk.updatePage).toHaveBeenCalledWith({
624 |       path: { docId: "doc-123", pageIdOrName: "page-456" },
625 |       body: {
626 |         name: "Renamed Page",
627 |       },
628 |       throwOnError: true,
629 |     });
630 |   });
631 | 
632 |   it("should show error if rename page throws", async () => {
633 |     vi.mocked(sdk.updatePage).mockRejectedValue(new Error("Rename failed"));
634 | 
635 |     const client = await connect(mcpServer.server);
636 |     const result = await client.callTool("coda_rename_page", {
637 |       docId: "doc-123",
638 |       pageIdOrName: "page-456",
639 |       newName: "Renamed Page",
640 |     });
641 |     expect(result.content).toEqual([{ type: "text", text: "Failed to rename page: Error: Rename failed" }]);
642 |   });
643 | });
644 | 
645 | describe("coda_resolve_link", () => {
646 |   it("should resolve browser link successfully", async () => {
647 |     vi.mocked(sdk.resolveBrowserLink).mockResolvedValue({
648 |       data: {
649 |         resource: {
650 |           id: "doc-123",
651 |           type: "doc",
652 |           name: "Test Document",
653 |           href: "https://coda.io/d/doc-123",
654 |         },
655 |         browserLink: "https://coda.io/d/doc-123/Test-Page_ptest123",
656 |       },
657 |     } as any);
658 | 
659 |     const client = await connect(mcpServer.server);
660 |     const result = await client.callTool("coda_resolve_link", {
661 |       url: "https://coda.io/d/doc-123/Test-Page_ptest123",
662 |     });
663 |     expect(result.content).toEqual([
664 |       {
665 |         type: "text",
666 |         text: JSON.stringify({
667 |           resource: {
668 |             id: "doc-123",
669 |             type: "doc",
670 |             name: "Test Document",
671 |             href: "https://coda.io/d/doc-123",
672 |           },
673 |           browserLink: "https://coda.io/d/doc-123/Test-Page_ptest123",
674 |         }),
675 |       },
676 |     ]);
677 |     expect(sdk.resolveBrowserLink).toHaveBeenCalledWith({
678 |       query: { url: "https://coda.io/d/doc-123/Test-Page_ptest123" },
679 |       throwOnError: true,
680 |     });
681 |   });
682 | 
683 |   it("should resolve page link successfully", async () => {
684 |     vi.mocked(sdk.resolveBrowserLink).mockResolvedValue({
685 |       data: {
686 |         resource: {
687 |           id: "page-456",
688 |           type: "page",
689 |           name: "Test Page",
690 |           href: "https://coda.io/d/doc-123/Test-Page_ptest456",
691 |         },
692 |         browserLink: "https://coda.io/d/doc-123/Test-Page_ptest456",
693 |       },
694 |     } as any);
695 | 
696 |     const client = await connect(mcpServer.server);
697 |     const result = await client.callTool("coda_resolve_link", {
698 |       url: "https://coda.io/d/doc-123/Test-Page_ptest456",
699 |     });
700 |     expect(result.content).toEqual([
701 |       {
702 |         type: "text",
703 |         text: JSON.stringify({
704 |           resource: {
705 |             id: "page-456",
706 |             type: "page",
707 |             name: "Test Page",
708 |             href: "https://coda.io/d/doc-123/Test-Page_ptest456",
709 |           },
710 |           browserLink: "https://coda.io/d/doc-123/Test-Page_ptest456",
711 |         }),
712 |       },
713 |     ]);
714 |     expect(sdk.resolveBrowserLink).toHaveBeenCalledWith({
715 |       query: { url: "https://coda.io/d/doc-123/Test-Page_ptest456" },
716 |       throwOnError: true,
717 |     });
718 |   });
719 | 
720 |   it("should resolve table link successfully", async () => {
721 |     vi.mocked(sdk.resolveBrowserLink).mockResolvedValue({
722 |       data: {
723 |         resource: {
724 |           id: "table-789",
725 |           type: "table",
726 |           name: "Test Table",
727 |           href: "https://coda.io/d/doc-123/Test-Table_ttable789",
728 |         },
729 |         browserLink: "https://coda.io/d/doc-123/Test-Table_ttable789",
730 |       },
731 |     } as any);
732 | 
733 |     const client = await connect(mcpServer.server);
734 |     const result = await client.callTool("coda_resolve_link", {
735 |       url: "https://coda.io/d/doc-123/Test-Table_ttable789",
736 |     });
737 |     expect(result.content).toEqual([
738 |       {
739 |         type: "text",
740 |         text: JSON.stringify({
741 |           resource: {
742 |             id: "table-789",
743 |             type: "table",
744 |             name: "Test Table",
745 |             href: "https://coda.io/d/doc-123/Test-Table_ttable789",
746 |           },
747 |           browserLink: "https://coda.io/d/doc-123/Test-Table_ttable789",
748 |         }),
749 |       },
750 |     ]);
751 |   });
752 | 
753 |   it("should handle empty URL parameter", async () => {
754 |     vi.mocked(sdk.resolveBrowserLink).mockResolvedValue({
755 |       data: {
756 |         resource: null,
757 |         browserLink: "",
758 |       },
759 |     } as any);
760 | 
761 |     const client = await connect(mcpServer.server);
762 |     const result = await client.callTool("coda_resolve_link", {
763 |       url: "",
764 |     });
765 |     expect(result.content).toEqual([
766 |       {
767 |         type: "text",
768 |         text: JSON.stringify({
769 |           resource: null,
770 |           browserLink: "",
771 |         }),
772 |       },
773 |     ]);
774 |     expect(sdk.resolveBrowserLink).toHaveBeenCalledWith({
775 |       query: { url: "" },
776 |       throwOnError: true,
777 |     });
778 |   });
779 | 
780 |   it("should show error if resolve link throws due to invalid URL", async () => {
781 |     vi.mocked(sdk.resolveBrowserLink).mockRejectedValue(new Error("Invalid URL format"));
782 | 
783 |     const client = await connect(mcpServer.server);
784 |     const result = await client.callTool("coda_resolve_link", {
785 |       url: "not-a-valid-url",
786 |     });
787 |     expect(result.content).toEqual([{ type: "text", text: "Failed to resolve link: Error: Invalid URL format" }]);
788 |     expect(result.isError).toBe(true);
789 |   });
790 | 
791 |   it("should show error if resolve link throws due to access denied", async () => {
792 |     vi.mocked(sdk.resolveBrowserLink).mockRejectedValue(new Error("Access denied"));
793 | 
794 |     const client = await connect(mcpServer.server);
795 |     const result = await client.callTool("coda_resolve_link", {
796 |       url: "https://coda.io/d/private-doc-123",
797 |     });
798 |     expect(result.content).toEqual([{ type: "text", text: "Failed to resolve link: Error: Access denied" }]);
799 |     expect(result.isError).toBe(true);
800 |   });
801 | 
802 |   it("should show error if resolve link throws due to not found", async () => {
803 |     vi.mocked(sdk.resolveBrowserLink).mockRejectedValue(new Error("Resource not found"));
804 | 
805 |     const client = await connect(mcpServer.server);
806 |     const result = await client.callTool("coda_resolve_link", {
807 |       url: "https://coda.io/d/nonexistent-doc-456",
808 |     });
809 |     expect(result.content).toEqual([{ type: "text", text: "Failed to resolve link: Error: Resource not found" }]);
810 |     expect(result.isError).toBe(true);
811 |   });
812 | });
813 | 
```

--------------------------------------------------------------------------------
/src/client/sdk.gen.ts:
--------------------------------------------------------------------------------

```typescript
   1 | // This file is auto-generated by @hey-api/openapi-ts
   2 | 
   3 | import type { Options as ClientOptions, TDataShape, Client } from "@hey-api/client-axios";
   4 | import type {
   5 |   ListCategoriesData,
   6 |   ListCategoriesResponse,
   7 |   ListCategoriesError,
   8 |   ListDocsData,
   9 |   ListDocsResponse,
  10 |   ListDocsError,
  11 |   CreateDocData,
  12 |   CreateDocResponse,
  13 |   CreateDocError,
  14 |   DeleteDocData,
  15 |   DeleteDocResponse,
  16 |   DeleteDocError,
  17 |   GetDocData,
  18 |   GetDocResponse,
  19 |   GetDocError,
  20 |   UpdateDocData,
  21 |   UpdateDocResponse,
  22 |   UpdateDocError,
  23 |   GetSharingMetadataData,
  24 |   GetSharingMetadataResponse,
  25 |   GetSharingMetadataError,
  26 |   GetPermissionsData,
  27 |   GetPermissionsResponse,
  28 |   GetPermissionsError,
  29 |   AddPermissionData,
  30 |   AddPermissionResponse,
  31 |   AddPermissionError,
  32 |   DeletePermissionData,
  33 |   DeletePermissionResponse,
  34 |   DeletePermissionError,
  35 |   SearchPrincipalsData,
  36 |   SearchPrincipalsResponse2,
  37 |   SearchPrincipalsError,
  38 |   GetAclSettingsData,
  39 |   GetAclSettingsResponse,
  40 |   GetAclSettingsError,
  41 |   UpdateAclSettingsData,
  42 |   UpdateAclSettingsResponse,
  43 |   UpdateAclSettingsError,
  44 |   UnpublishDocData,
  45 |   UnpublishDocResponse,
  46 |   UnpublishDocError,
  47 |   PublishDocData,
  48 |   PublishDocResponse,
  49 |   PublishDocError,
  50 |   ListPagesData,
  51 |   ListPagesResponse,
  52 |   ListPagesError,
  53 |   CreatePageData,
  54 |   CreatePageResponse,
  55 |   CreatePageError,
  56 |   DeletePageData,
  57 |   DeletePageResponse,
  58 |   DeletePageError,
  59 |   GetPageData,
  60 |   GetPageResponse,
  61 |   GetPageError,
  62 |   UpdatePageData,
  63 |   UpdatePageResponse,
  64 |   UpdatePageError,
  65 |   BeginPageContentExportData,
  66 |   BeginPageContentExportResponse2,
  67 |   BeginPageContentExportError,
  68 |   GetPageContentExportStatusData,
  69 |   GetPageContentExportStatusResponse,
  70 |   GetPageContentExportStatusError,
  71 |   ListTablesData,
  72 |   ListTablesResponse,
  73 |   ListTablesError,
  74 |   GetTableData,
  75 |   GetTableResponse,
  76 |   GetTableError,
  77 |   ListColumnsData,
  78 |   ListColumnsResponse,
  79 |   ListColumnsError,
  80 |   DeleteRowsData,
  81 |   DeleteRowsResponse,
  82 |   DeleteRowsError,
  83 |   ListRowsData,
  84 |   ListRowsResponse,
  85 |   ListRowsError,
  86 |   UpsertRowsData,
  87 |   UpsertRowsResponse,
  88 |   UpsertRowsError,
  89 |   DeleteRowData,
  90 |   DeleteRowResponse,
  91 |   DeleteRowError,
  92 |   GetRowData,
  93 |   GetRowResponse,
  94 |   GetRowError,
  95 |   UpdateRowData,
  96 |   UpdateRowResponse,
  97 |   UpdateRowError,
  98 |   PushButtonData,
  99 |   PushButtonResponse,
 100 |   PushButtonError,
 101 |   GetColumnData,
 102 |   GetColumnResponse,
 103 |   GetColumnError,
 104 |   ListFormulasData,
 105 |   ListFormulasResponse,
 106 |   ListFormulasError,
 107 |   GetFormulaData,
 108 |   GetFormulaResponse,
 109 |   GetFormulaError,
 110 |   ListControlsData,
 111 |   ListControlsResponse,
 112 |   ListControlsError,
 113 |   GetControlData,
 114 |   GetControlResponse,
 115 |   GetControlError,
 116 |   ListCustomDocDomainsData,
 117 |   ListCustomDocDomainsResponse,
 118 |   ListCustomDocDomainsError,
 119 |   AddCustomDocDomainData,
 120 |   AddCustomDocDomainResponse2,
 121 |   AddCustomDocDomainError,
 122 |   DeleteCustomDocDomainData,
 123 |   DeleteCustomDocDomainResponse2,
 124 |   DeleteCustomDocDomainError,
 125 |   UpdateCustomDocDomainData,
 126 |   UpdateCustomDocDomainResponse2,
 127 |   UpdateCustomDocDomainError,
 128 |   GetCustomDocDomainProviderData,
 129 |   GetCustomDocDomainProviderResponse,
 130 |   GetCustomDocDomainProviderError,
 131 |   WhoamiData,
 132 |   WhoamiResponse,
 133 |   WhoamiError,
 134 |   ResolveBrowserLinkData,
 135 |   ResolveBrowserLinkResponse,
 136 |   ResolveBrowserLinkError,
 137 |   GetMutationStatusData,
 138 |   GetMutationStatusResponse,
 139 |   GetMutationStatusError,
 140 |   TriggerWebhookAutomationData,
 141 |   TriggerWebhookAutomationResponse,
 142 |   TriggerWebhookAutomationError,
 143 |   ListDocAnalyticsData,
 144 |   ListDocAnalyticsResponse,
 145 |   ListDocAnalyticsError,
 146 |   ListPageAnalyticsData,
 147 |   ListPageAnalyticsResponse,
 148 |   ListPageAnalyticsError,
 149 |   ListDocAnalyticsSummaryData,
 150 |   ListDocAnalyticsSummaryResponse,
 151 |   ListDocAnalyticsSummaryError,
 152 |   ListPackAnalyticsData,
 153 |   ListPackAnalyticsResponse,
 154 |   ListPackAnalyticsError,
 155 |   ListPackAnalyticsSummaryData,
 156 |   ListPackAnalyticsSummaryResponse,
 157 |   ListPackAnalyticsSummaryError,
 158 |   ListPackFormulaAnalyticsData,
 159 |   ListPackFormulaAnalyticsResponse,
 160 |   ListPackFormulaAnalyticsError,
 161 |   GetAnalyticsLastUpdatedData,
 162 |   GetAnalyticsLastUpdatedResponse,
 163 |   GetAnalyticsLastUpdatedError,
 164 |   ListWorkspaceMembersData,
 165 |   ListWorkspaceMembersResponse,
 166 |   ListWorkspaceMembersError,
 167 |   ChangeUserRoleData,
 168 |   ChangeUserRoleResponse,
 169 |   ChangeUserRoleError,
 170 |   ListWorkspaceRoleActivityData,
 171 |   ListWorkspaceRoleActivityResponse,
 172 |   ListWorkspaceRoleActivityError,
 173 |   ListPacksData,
 174 |   ListPacksResponse,
 175 |   ListPacksError,
 176 |   CreatePackData,
 177 |   CreatePackResponse2,
 178 |   CreatePackError,
 179 |   DeletePackData,
 180 |   DeletePackResponse2,
 181 |   DeletePackError,
 182 |   GetPackData,
 183 |   GetPackResponse,
 184 |   GetPackError,
 185 |   UpdatePackData,
 186 |   UpdatePackResponse,
 187 |   UpdatePackError,
 188 |   GetPackConfigurationSchemaData,
 189 |   GetPackConfigurationSchemaResponse,
 190 |   GetPackConfigurationSchemaError,
 191 |   ListPackVersionsData,
 192 |   ListPackVersionsResponse,
 193 |   ListPackVersionsError,
 194 |   GetNextPackVersionData,
 195 |   GetNextPackVersionResponse,
 196 |   GetNextPackVersionError,
 197 |   GetPackVersionDiffsData,
 198 |   GetPackVersionDiffsResponse,
 199 |   GetPackVersionDiffsError,
 200 |   RegisterPackVersionData,
 201 |   RegisterPackVersionResponse,
 202 |   RegisterPackVersionError,
 203 |   PackVersionUploadCompleteData,
 204 |   PackVersionUploadCompleteResponse,
 205 |   PackVersionUploadCompleteError,
 206 |   ListPackReleasesData,
 207 |   ListPackReleasesResponse,
 208 |   ListPackReleasesError,
 209 |   CreatePackReleaseData,
 210 |   CreatePackReleaseResponse,
 211 |   CreatePackReleaseError,
 212 |   UpdatePackReleaseData,
 213 |   UpdatePackReleaseResponse,
 214 |   UpdatePackReleaseError,
 215 |   GetPackOauthConfigData,
 216 |   GetPackOauthConfigResponse,
 217 |   GetPackOauthConfigError,
 218 |   SetPackOauthConfigData,
 219 |   SetPackOauthConfigResponse,
 220 |   SetPackOauthConfigError,
 221 |   GetPackSystemConnectionData,
 222 |   GetPackSystemConnectionResponse,
 223 |   GetPackSystemConnectionError,
 224 |   PatchPackSystemConnectionData,
 225 |   PatchPackSystemConnectionResponse,
 226 |   PatchPackSystemConnectionError,
 227 |   SetPackSystemConnectionData,
 228 |   SetPackSystemConnectionResponse,
 229 |   SetPackSystemConnectionError,
 230 |   GetPackPermissionsData,
 231 |   GetPackPermissionsResponse,
 232 |   GetPackPermissionsError,
 233 |   AddPackPermissionData,
 234 |   AddPackPermissionResponse2,
 235 |   AddPackPermissionError,
 236 |   DeletePackPermissionData,
 237 |   DeletePackPermissionResponse2,
 238 |   DeletePackPermissionError,
 239 |   ListPackMakersData,
 240 |   ListPackMakersResponse2,
 241 |   ListPackMakersError,
 242 |   AddPackMakerData,
 243 |   AddPackMakerResponse2,
 244 |   AddPackMakerError,
 245 |   DeletePackMakerData,
 246 |   DeletePackMakerResponse2,
 247 |   DeletePackMakerError,
 248 |   ListPackCategoriesData,
 249 |   ListPackCategoriesResponse2,
 250 |   ListPackCategoriesError,
 251 |   AddPackCategoryData,
 252 |   AddPackCategoryResponse2,
 253 |   AddPackCategoryError,
 254 |   DeletePackCategoryData,
 255 |   DeletePackCategoryResponse2,
 256 |   DeletePackCategoryError,
 257 |   UploadPackAssetData,
 258 |   UploadPackAssetResponse,
 259 |   UploadPackAssetError,
 260 |   UploadPackSourceCodeData,
 261 |   UploadPackSourceCodeResponse,
 262 |   UploadPackSourceCodeError,
 263 |   PackAssetUploadCompleteData,
 264 |   PackAssetUploadCompleteResponse2,
 265 |   PackAssetUploadCompleteError,
 266 |   PackSourceCodeUploadCompleteData,
 267 |   PackSourceCodeUploadCompleteResponse2,
 268 |   PackSourceCodeUploadCompleteError,
 269 |   GetPackSourceCodeData,
 270 |   GetPackSourceCodeResponse,
 271 |   GetPackSourceCodeError,
 272 |   ListPackListingsData,
 273 |   ListPackListingsResponse,
 274 |   ListPackListingsError,
 275 |   GetPackListingData,
 276 |   GetPackListingResponse,
 277 |   GetPackListingError,
 278 |   ListPackLogsData,
 279 |   ListPackLogsResponse,
 280 |   ListPackLogsError,
 281 |   ListIngestionLogsData,
 282 |   ListIngestionLogsResponse,
 283 |   ListIngestionLogsError,
 284 |   ListGroupedPackLogsData,
 285 |   ListGroupedPackLogsResponse,
 286 |   ListGroupedPackLogsError,
 287 |   ListGroupedIngestionLogsData,
 288 |   ListGroupedIngestionLogsResponse,
 289 |   ListGroupedIngestionLogsError,
 290 |   ListIngestionExecutionsData,
 291 |   ListIngestionExecutionsResponse,
 292 |   ListIngestionExecutionsError,
 293 |   ListIngestionExecutionAttemptsData,
 294 |   ListIngestionExecutionAttemptsResponse,
 295 |   ListIngestionExecutionAttemptsError,
 296 |   GetPackLogDetailsData,
 297 |   GetPackLogDetailsResponse,
 298 |   GetPackLogDetailsError,
 299 |   ListPackFeaturedDocsData,
 300 |   ListPackFeaturedDocsResponse,
 301 |   ListPackFeaturedDocsError,
 302 |   UpdatePackFeaturedDocsData,
 303 |   UpdatePackFeaturedDocsResponse2,
 304 |   UpdatePackFeaturedDocsError,
 305 |   AddGoLinkData,
 306 |   AddGoLinkResponse,
 307 |   AddGoLinkError,
 308 | } from "./types.gen";
 309 | import { client as _heyApiClient } from "./client.gen";
 310 | 
 311 | export type Options<TData extends TDataShape = TDataShape, ThrowOnError extends boolean = boolean> = ClientOptions<
 312 |   TData,
 313 |   ThrowOnError
 314 | > & {
 315 |   /**
 316 |    * You can provide a client instance returned by `createClient()` instead of
 317 |    * individual options. This might be also useful if you want to implement a
 318 |    * custom client.
 319 |    */
 320 |   client?: Client;
 321 |   /**
 322 |    * You can pass arbitrary values through the `meta` object. This can be
 323 |    * used to access values that aren't defined as part of the SDK function.
 324 |    */
 325 |   meta?: Record<string, unknown>;
 326 | };
 327 | 
 328 | /**
 329 |  * Get doc categories
 330 |  * Gets all available doc categories.
 331 |  */
 332 | export const listCategories = <ThrowOnError extends boolean = false>(
 333 |   options?: Options<ListCategoriesData, ThrowOnError>,
 334 | ) => {
 335 |   return (options?.client ?? _heyApiClient).get<ListCategoriesResponse, ListCategoriesError, ThrowOnError>({
 336 |     security: [
 337 |       {
 338 |         scheme: "bearer",
 339 |         type: "http",
 340 |       },
 341 |     ],
 342 |     url: "/categories",
 343 |     ...options,
 344 |   });
 345 | };
 346 | 
 347 | /**
 348 |  * List available docs
 349 |  * Returns a list of Coda docs accessible by the user, and which they have opened at least once. These are returned in the same order as on the docs page: reverse chronological by the latest event relevant to the user (last viewed, edited, or shared).
 350 |  *
 351 |  */
 352 | export const listDocs = <ThrowOnError extends boolean = false>(options?: Options<ListDocsData, ThrowOnError>) => {
 353 |   return (options?.client ?? _heyApiClient).get<ListDocsResponse, ListDocsError, ThrowOnError>({
 354 |     security: [
 355 |       {
 356 |         scheme: "bearer",
 357 |         type: "http",
 358 |       },
 359 |     ],
 360 |     url: "/docs",
 361 |     ...options,
 362 |   });
 363 | };
 364 | 
 365 | /**
 366 |  * Create doc
 367 |  * Creates a new Coda doc, optionally copying an existing doc. Note that creating a doc requires you to be a Doc Maker in the applicable workspace (or be auto-promoted to one).
 368 |  *
 369 |  */
 370 | export const createDoc = <ThrowOnError extends boolean = false>(options: Options<CreateDocData, ThrowOnError>) => {
 371 |   return (options.client ?? _heyApiClient).post<CreateDocResponse, CreateDocError, ThrowOnError>({
 372 |     security: [
 373 |       {
 374 |         scheme: "bearer",
 375 |         type: "http",
 376 |       },
 377 |     ],
 378 |     url: "/docs",
 379 |     ...options,
 380 |     headers: {
 381 |       "Content-Type": "application/json",
 382 |       ...options?.headers,
 383 |     },
 384 |   });
 385 | };
 386 | 
 387 | /**
 388 |  * Delete doc
 389 |  * Deletes a doc.
 390 |  */
 391 | export const deleteDoc = <ThrowOnError extends boolean = false>(options: Options<DeleteDocData, ThrowOnError>) => {
 392 |   return (options.client ?? _heyApiClient).delete<DeleteDocResponse, DeleteDocError, ThrowOnError>({
 393 |     security: [
 394 |       {
 395 |         scheme: "bearer",
 396 |         type: "http",
 397 |       },
 398 |     ],
 399 |     url: "/docs/{docId}",
 400 |     ...options,
 401 |   });
 402 | };
 403 | 
 404 | /**
 405 |  * Get info about a doc
 406 |  * Returns metadata for the specified doc.
 407 |  */
 408 | export const getDoc = <ThrowOnError extends boolean = false>(options: Options<GetDocData, ThrowOnError>) => {
 409 |   return (options.client ?? _heyApiClient).get<GetDocResponse, GetDocError, ThrowOnError>({
 410 |     security: [
 411 |       {
 412 |         scheme: "bearer",
 413 |         type: "http",
 414 |       },
 415 |     ],
 416 |     url: "/docs/{docId}",
 417 |     ...options,
 418 |   });
 419 | };
 420 | 
 421 | /**
 422 |  * Update doc
 423 |  * Updates metadata for a doc. Note that updating a doc title requires you to be a Doc Maker in the applicable workspace.
 424 |  */
 425 | export const updateDoc = <ThrowOnError extends boolean = false>(options: Options<UpdateDocData, ThrowOnError>) => {
 426 |   return (options.client ?? _heyApiClient).patch<UpdateDocResponse, UpdateDocError, ThrowOnError>({
 427 |     security: [
 428 |       {
 429 |         scheme: "bearer",
 430 |         type: "http",
 431 |       },
 432 |     ],
 433 |     url: "/docs/{docId}",
 434 |     ...options,
 435 |     headers: {
 436 |       "Content-Type": "application/json",
 437 |       ...options?.headers,
 438 |     },
 439 |   });
 440 | };
 441 | 
 442 | /**
 443 |  * Get sharing metadata
 444 |  * Returns metadata associated with sharing for this Coda doc.
 445 |  */
 446 | export const getSharingMetadata = <ThrowOnError extends boolean = false>(
 447 |   options: Options<GetSharingMetadataData, ThrowOnError>,
 448 | ) => {
 449 |   return (options.client ?? _heyApiClient).get<GetSharingMetadataResponse, GetSharingMetadataError, ThrowOnError>({
 450 |     security: [
 451 |       {
 452 |         scheme: "bearer",
 453 |         type: "http",
 454 |       },
 455 |     ],
 456 |     url: "/docs/{docId}/acl/metadata",
 457 |     ...options,
 458 |   });
 459 | };
 460 | 
 461 | /**
 462 |  * List permissions
 463 |  * Returns a list of permissions for this Coda doc.
 464 |  */
 465 | export const getPermissions = <ThrowOnError extends boolean = false>(
 466 |   options: Options<GetPermissionsData, ThrowOnError>,
 467 | ) => {
 468 |   return (options.client ?? _heyApiClient).get<GetPermissionsResponse, GetPermissionsError, ThrowOnError>({
 469 |     security: [
 470 |       {
 471 |         scheme: "bearer",
 472 |         type: "http",
 473 |       },
 474 |     ],
 475 |     url: "/docs/{docId}/acl/permissions",
 476 |     ...options,
 477 |   });
 478 | };
 479 | 
 480 | /**
 481 |  * Add permission
 482 |  * Adds a new permission to the doc.
 483 |  *
 484 |  */
 485 | export const addPermission = <ThrowOnError extends boolean = false>(
 486 |   options: Options<AddPermissionData, ThrowOnError>,
 487 | ) => {
 488 |   return (options.client ?? _heyApiClient).post<AddPermissionResponse, AddPermissionError, ThrowOnError>({
 489 |     security: [
 490 |       {
 491 |         scheme: "bearer",
 492 |         type: "http",
 493 |       },
 494 |     ],
 495 |     url: "/docs/{docId}/acl/permissions",
 496 |     ...options,
 497 |     headers: {
 498 |       "Content-Type": "application/json",
 499 |       ...options?.headers,
 500 |     },
 501 |   });
 502 | };
 503 | 
 504 | /**
 505 |  * Delete permission
 506 |  * Deletes an existing permission.
 507 |  *
 508 |  */
 509 | export const deletePermission = <ThrowOnError extends boolean = false>(
 510 |   options: Options<DeletePermissionData, ThrowOnError>,
 511 | ) => {
 512 |   return (options.client ?? _heyApiClient).delete<DeletePermissionResponse, DeletePermissionError, ThrowOnError>({
 513 |     security: [
 514 |       {
 515 |         scheme: "bearer",
 516 |         type: "http",
 517 |       },
 518 |     ],
 519 |     url: "/docs/{docId}/acl/permissions/{permissionId}",
 520 |     ...options,
 521 |   });
 522 | };
 523 | 
 524 | /**
 525 |  * Search principals
 526 |  * Searches for user and group principals matching the query that this doc can be shared with.
 527 |  * At most 20 results will be returned for both users and groups. If no query is given then no results are returned.
 528 |  *
 529 |  */
 530 | export const searchPrincipals = <ThrowOnError extends boolean = false>(
 531 |   options: Options<SearchPrincipalsData, ThrowOnError>,
 532 | ) => {
 533 |   return (options.client ?? _heyApiClient).get<SearchPrincipalsResponse2, SearchPrincipalsError, ThrowOnError>({
 534 |     security: [
 535 |       {
 536 |         scheme: "bearer",
 537 |         type: "http",
 538 |       },
 539 |     ],
 540 |     url: "/docs/{docId}/acl/principals/search",
 541 |     ...options,
 542 |   });
 543 | };
 544 | 
 545 | /**
 546 |  * Get ACL settings
 547 |  * Returns settings associated with ACLs for this Coda doc.
 548 |  */
 549 | export const getAclSettings = <ThrowOnError extends boolean = false>(
 550 |   options: Options<GetAclSettingsData, ThrowOnError>,
 551 | ) => {
 552 |   return (options.client ?? _heyApiClient).get<GetAclSettingsResponse, GetAclSettingsError, ThrowOnError>({
 553 |     security: [
 554 |       {
 555 |         scheme: "bearer",
 556 |         type: "http",
 557 |       },
 558 |     ],
 559 |     url: "/docs/{docId}/acl/settings",
 560 |     ...options,
 561 |   });
 562 | };
 563 | 
 564 | /**
 565 |  * Update ACL settings
 566 |  * Update settings associated with ACLs for this Coda doc.
 567 |  */
 568 | export const updateAclSettings = <ThrowOnError extends boolean = false>(
 569 |   options: Options<UpdateAclSettingsData, ThrowOnError>,
 570 | ) => {
 571 |   return (options.client ?? _heyApiClient).patch<UpdateAclSettingsResponse, UpdateAclSettingsError, ThrowOnError>({
 572 |     security: [
 573 |       {
 574 |         scheme: "bearer",
 575 |         type: "http",
 576 |       },
 577 |     ],
 578 |     url: "/docs/{docId}/acl/settings",
 579 |     ...options,
 580 |     headers: {
 581 |       "Content-Type": "application/json",
 582 |       ...options?.headers,
 583 |     },
 584 |   });
 585 | };
 586 | 
 587 | /**
 588 |  * Unpublish doc
 589 |  * Unpublishes a doc.
 590 |  */
 591 | export const unpublishDoc = <ThrowOnError extends boolean = false>(
 592 |   options: Options<UnpublishDocData, ThrowOnError>,
 593 | ) => {
 594 |   return (options.client ?? _heyApiClient).delete<UnpublishDocResponse, UnpublishDocError, ThrowOnError>({
 595 |     security: [
 596 |       {
 597 |         scheme: "bearer",
 598 |         type: "http",
 599 |       },
 600 |     ],
 601 |     url: "/docs/{docId}/publish",
 602 |     ...options,
 603 |   });
 604 | };
 605 | 
 606 | /**
 607 |  * Publish doc
 608 |  * Update publish settings for a doc.
 609 |  */
 610 | export const publishDoc = <ThrowOnError extends boolean = false>(options: Options<PublishDocData, ThrowOnError>) => {
 611 |   return (options.client ?? _heyApiClient).put<PublishDocResponse, PublishDocError, ThrowOnError>({
 612 |     security: [
 613 |       {
 614 |         scheme: "bearer",
 615 |         type: "http",
 616 |       },
 617 |     ],
 618 |     url: "/docs/{docId}/publish",
 619 |     ...options,
 620 |     headers: {
 621 |       "Content-Type": "application/json",
 622 |       ...options?.headers,
 623 |     },
 624 |   });
 625 | };
 626 | 
 627 | /**
 628 |  * List pages
 629 |  * Returns a list of pages in a Coda doc.
 630 |  */
 631 | export const listPages = <ThrowOnError extends boolean = false>(options: Options<ListPagesData, ThrowOnError>) => {
 632 |   return (options.client ?? _heyApiClient).get<ListPagesResponse, ListPagesError, ThrowOnError>({
 633 |     security: [
 634 |       {
 635 |         scheme: "bearer",
 636 |         type: "http",
 637 |       },
 638 |     ],
 639 |     url: "/docs/{docId}/pages",
 640 |     ...options,
 641 |   });
 642 | };
 643 | 
 644 | /**
 645 |  * Create a page
 646 |  * Create a new page in a doc. Note that creating a page requires you to be a Doc Maker in the applicable workspace.
 647 |  *
 648 |  */
 649 | export const createPage = <ThrowOnError extends boolean = false>(options: Options<CreatePageData, ThrowOnError>) => {
 650 |   return (options.client ?? _heyApiClient).post<CreatePageResponse, CreatePageError, ThrowOnError>({
 651 |     security: [
 652 |       {
 653 |         scheme: "bearer",
 654 |         type: "http",
 655 |       },
 656 |     ],
 657 |     url: "/docs/{docId}/pages",
 658 |     ...options,
 659 |     headers: {
 660 |       "Content-Type": "application/json",
 661 |       ...options?.headers,
 662 |     },
 663 |   });
 664 | };
 665 | 
 666 | /**
 667 |  * Delete a page
 668 |  * Deletes the specified page.
 669 |  */
 670 | export const deletePage = <ThrowOnError extends boolean = false>(options: Options<DeletePageData, ThrowOnError>) => {
 671 |   return (options.client ?? _heyApiClient).delete<DeletePageResponse, DeletePageError, ThrowOnError>({
 672 |     security: [
 673 |       {
 674 |         scheme: "bearer",
 675 |         type: "http",
 676 |       },
 677 |     ],
 678 |     url: "/docs/{docId}/pages/{pageIdOrName}",
 679 |     ...options,
 680 |   });
 681 | };
 682 | 
 683 | /**
 684 |  * Get a page
 685 |  * Returns details about a page.
 686 |  */
 687 | export const getPage = <ThrowOnError extends boolean = false>(options: Options<GetPageData, ThrowOnError>) => {
 688 |   return (options.client ?? _heyApiClient).get<GetPageResponse, GetPageError, ThrowOnError>({
 689 |     security: [
 690 |       {
 691 |         scheme: "bearer",
 692 |         type: "http",
 693 |       },
 694 |     ],
 695 |     url: "/docs/{docId}/pages/{pageIdOrName}",
 696 |     ...options,
 697 |   });
 698 | };
 699 | 
 700 | /**
 701 |  * Update a page
 702 |  * Update properties for a page. Note that updating a page title or icon requires you to be a Doc Maker in the applicable workspace.
 703 |  *
 704 |  */
 705 | export const updatePage = <ThrowOnError extends boolean = false>(options: Options<UpdatePageData, ThrowOnError>) => {
 706 |   return (options.client ?? _heyApiClient).put<UpdatePageResponse, UpdatePageError, ThrowOnError>({
 707 |     security: [
 708 |       {
 709 |         scheme: "bearer",
 710 |         type: "http",
 711 |       },
 712 |     ],
 713 |     url: "/docs/{docId}/pages/{pageIdOrName}",
 714 |     ...options,
 715 |     headers: {
 716 |       "Content-Type": "application/json",
 717 |       ...options?.headers,
 718 |     },
 719 |   });
 720 | };
 721 | 
 722 | /**
 723 |  * Begin content export
 724 |  * Initiate an export of content for the given page.
 725 |  */
 726 | export const beginPageContentExport = <ThrowOnError extends boolean = false>(
 727 |   options: Options<BeginPageContentExportData, ThrowOnError>,
 728 | ) => {
 729 |   return (options.client ?? _heyApiClient).post<
 730 |     BeginPageContentExportResponse2,
 731 |     BeginPageContentExportError,
 732 |     ThrowOnError
 733 |   >({
 734 |     security: [
 735 |       {
 736 |         scheme: "bearer",
 737 |         type: "http",
 738 |       },
 739 |     ],
 740 |     url: "/docs/{docId}/pages/{pageIdOrName}/export",
 741 |     ...options,
 742 |     headers: {
 743 |       "Content-Type": "application/json",
 744 |       ...options?.headers,
 745 |     },
 746 |   });
 747 | };
 748 | 
 749 | /**
 750 |  * Content export status
 751 |  * Check the status of a page content export
 752 |  */
 753 | export const getPageContentExportStatus = <ThrowOnError extends boolean = false>(
 754 |   options: Options<GetPageContentExportStatusData, ThrowOnError>,
 755 | ) => {
 756 |   return (options.client ?? _heyApiClient).get<
 757 |     GetPageContentExportStatusResponse,
 758 |     GetPageContentExportStatusError,
 759 |     ThrowOnError
 760 |   >({
 761 |     security: [
 762 |       {
 763 |         scheme: "bearer",
 764 |         type: "http",
 765 |       },
 766 |     ],
 767 |     url: "/docs/{docId}/pages/{pageIdOrName}/export/{requestId}",
 768 |     ...options,
 769 |   });
 770 | };
 771 | 
 772 | /**
 773 |  * List tables
 774 |  * Returns a list of tables in a Coda doc.
 775 |  */
 776 | export const listTables = <ThrowOnError extends boolean = false>(options: Options<ListTablesData, ThrowOnError>) => {
 777 |   return (options.client ?? _heyApiClient).get<ListTablesResponse, ListTablesError, ThrowOnError>({
 778 |     security: [
 779 |       {
 780 |         scheme: "bearer",
 781 |         type: "http",
 782 |       },
 783 |     ],
 784 |     querySerializer: {
 785 |       array: {
 786 |         explode: false,
 787 |         style: "form",
 788 |       },
 789 |     },
 790 |     url: "/docs/{docId}/tables",
 791 |     ...options,
 792 |   });
 793 | };
 794 | 
 795 | /**
 796 |  * Get a table
 797 |  * Returns details about a specific table or view.
 798 |  */
 799 | export const getTable = <ThrowOnError extends boolean = false>(options: Options<GetTableData, ThrowOnError>) => {
 800 |   return (options.client ?? _heyApiClient).get<GetTableResponse, GetTableError, ThrowOnError>({
 801 |     security: [
 802 |       {
 803 |         scheme: "bearer",
 804 |         type: "http",
 805 |       },
 806 |     ],
 807 |     url: "/docs/{docId}/tables/{tableIdOrName}",
 808 |     ...options,
 809 |   });
 810 | };
 811 | 
 812 | /**
 813 |  * List columns
 814 |  * Returns a list of columns in a table.
 815 |  */
 816 | export const listColumns = <ThrowOnError extends boolean = false>(options: Options<ListColumnsData, ThrowOnError>) => {
 817 |   return (options.client ?? _heyApiClient).get<ListColumnsResponse, ListColumnsError, ThrowOnError>({
 818 |     security: [
 819 |       {
 820 |         scheme: "bearer",
 821 |         type: "http",
 822 |       },
 823 |     ],
 824 |     url: "/docs/{docId}/tables/{tableIdOrName}/columns",
 825 |     ...options,
 826 |   });
 827 | };
 828 | 
 829 | /**
 830 |  * Delete multiple rows
 831 |  * Deletes the specified rows from the table or view. This endpoint will always return a 202. Row deletions are generally processed within several seconds.
 832 |  *
 833 |  */
 834 | export const deleteRows = <ThrowOnError extends boolean = false>(options: Options<DeleteRowsData, ThrowOnError>) => {
 835 |   return (options.client ?? _heyApiClient).delete<DeleteRowsResponse, DeleteRowsError, ThrowOnError>({
 836 |     security: [
 837 |       {
 838 |         scheme: "bearer",
 839 |         type: "http",
 840 |       },
 841 |     ],
 842 |     url: "/docs/{docId}/tables/{tableIdOrName}/rows",
 843 |     ...options,
 844 |     headers: {
 845 |       "Content-Type": "application/json",
 846 |       ...options?.headers,
 847 |     },
 848 |   });
 849 | };
 850 | 
 851 | /**
 852 |  * List table rows
 853 |  * Returns a list of rows in a table.
 854 |  * ### Value results
 855 |  * The `valueFormat` parameter dictates in what format the API should return values for individual cells.
 856 |  * * `simple` (default): Returns cell values as the following JSON values: `string`, `number`, or `boolean`. Array values (like multiselects) are returned as comma-delimited strings.
 857 |  * * `simpleWithArrays`: Singleton values are returned as `simple`. Array values are returned as JSON arrays and the values within are `simple` values (including nested arrays).
 858 |  * * `rich`: If applicable, returns many values with further encoding, allowing API users to have lossless access to data in Coda.
 859 |  * * For `text` values, returns data in Markdown syntax. If the text field is simple text (e.g. has no formatting),
 860 |  * the field will be fully escaped with triple-ticks. E.g
 861 |  * `
 862 |  * ```This is plain text```
 863 |  * `
 864 |  * * For `currency`, `lookup`, `image`, `person` and `hyperlink` values, the value will be encoded in [JSON-LD](https://json-ld.org/) format.
 865 |  *
 866 |  * ```
 867 |  * // Currency
 868 |  * {
 869 |  * "@context": "http://schema.org",
 870 |  * "@type": "MonetaryAmount",
 871 |  * "currency": "USD",
 872 |  * "amount": 42.42
 873 |  * }
 874 |  *
 875 |  * // Lookup
 876 |  * {
 877 |  * "@context": "http://schema.org",
 878 |  * "@type": "StructuredValue",
 879 |  * "additionalType": "row",
 880 |  * "name": "Row Name",
 881 |  * "rowId": "i-123456789",
 882 |  * "tableId": "grid-123456789",
 883 |  * "tableUrl": "https://coda.io/d/_d123456789/grid-123456789",
 884 |  * "url": "https://coda.io/d/_d123456789/grid-123456789#_r42",
 885 |  * }
 886 |  *
 887 |  * // Hyperlink
 888 |  * {
 889 |  * "@context": "http://schema.org",
 890 |  * "@type": "WebPage",
 891 |  * "name": "Coda",
 892 |  * "url": "https://coda.io"
 893 |  * }
 894 |  *
 895 |  * // Image
 896 |  * {
 897 |  * "@context": "http://schema.org",
 898 |  * "@type": "ImageObject",
 899 |  * "name": "Coda logo",
 900 |  * "url": "https://coda.io/logo.jpg"
 901 |  * }
 902 |  *
 903 |  * // People
 904 |  * {
 905 |  * "@context": "http://schema.org",
 906 |  * "@type": "Person",
 907 |  * "name": "Art Vandalay",
 908 |  * "email": "[email protected]"
 909 |  * }
 910 |  * ```
 911 |  *
 912 |  */
 913 | export const listRows = <ThrowOnError extends boolean = false>(options: Options<ListRowsData, ThrowOnError>) => {
 914 |   return (options.client ?? _heyApiClient).get<ListRowsResponse, ListRowsError, ThrowOnError>({
 915 |     security: [
 916 |       {
 917 |         scheme: "bearer",
 918 |         type: "http",
 919 |       },
 920 |     ],
 921 |     url: "/docs/{docId}/tables/{tableIdOrName}/rows",
 922 |     ...options,
 923 |   });
 924 | };
 925 | 
 926 | /**
 927 |  * Insert/upsert rows
 928 |  * Inserts rows into a table, optionally updating existing rows if any upsert key columns are provided. This endpoint will always return a 202, so long as the doc and table exist and are accessible (and the update is structurally valid). Row inserts/upserts are generally processed within several seconds. Note: this endpoint only works for base tables, not views.
 929 |  * When upserting, if multiple rows match the specified key column(s), they will all be updated with the specified value.
 930 |  *
 931 |  */
 932 | export const upsertRows = <ThrowOnError extends boolean = false>(options: Options<UpsertRowsData, ThrowOnError>) => {
 933 |   return (options.client ?? _heyApiClient).post<UpsertRowsResponse, UpsertRowsError, ThrowOnError>({
 934 |     security: [
 935 |       {
 936 |         scheme: "bearer",
 937 |         type: "http",
 938 |       },
 939 |     ],
 940 |     url: "/docs/{docId}/tables/{tableIdOrName}/rows",
 941 |     ...options,
 942 |     headers: {
 943 |       "Content-Type": "application/json",
 944 |       ...options?.headers,
 945 |     },
 946 |   });
 947 | };
 948 | 
 949 | /**
 950 |  * Delete row
 951 |  * Deletes the specified row from the table or view. This endpoint will always return a 202, so long as the row exists and is accessible (and the update is structurally valid). Row deletions are generally processed within several seconds. When deleting using a name as opposed to an ID, an arbitrary row will be removed.
 952 |  *
 953 |  */
 954 | export const deleteRow = <ThrowOnError extends boolean = false>(options: Options<DeleteRowData, ThrowOnError>) => {
 955 |   return (options.client ?? _heyApiClient).delete<DeleteRowResponse, DeleteRowError, ThrowOnError>({
 956 |     security: [
 957 |       {
 958 |         scheme: "bearer",
 959 |         type: "http",
 960 |       },
 961 |     ],
 962 |     url: "/docs/{docId}/tables/{tableIdOrName}/rows/{rowIdOrName}",
 963 |     ...options,
 964 |   });
 965 | };
 966 | 
 967 | /**
 968 |  * Get a row
 969 |  * Returns details about a row in a table.
 970 |  */
 971 | export const getRow = <ThrowOnError extends boolean = false>(options: Options<GetRowData, ThrowOnError>) => {
 972 |   return (options.client ?? _heyApiClient).get<GetRowResponse, GetRowError, ThrowOnError>({
 973 |     security: [
 974 |       {
 975 |         scheme: "bearer",
 976 |         type: "http",
 977 |       },
 978 |     ],
 979 |     url: "/docs/{docId}/tables/{tableIdOrName}/rows/{rowIdOrName}",
 980 |     ...options,
 981 |   });
 982 | };
 983 | 
 984 | /**
 985 |  * Update row
 986 |  * Updates the specified row in the table. This endpoint will always return a 202, so long as the row exists and is accessible (and the update is structurally valid). Row updates are generally processed within several seconds. When updating using a name as opposed to an ID, an arbitrary row will be affected.
 987 |  *
 988 |  */
 989 | export const updateRow = <ThrowOnError extends boolean = false>(options: Options<UpdateRowData, ThrowOnError>) => {
 990 |   return (options.client ?? _heyApiClient).put<UpdateRowResponse, UpdateRowError, ThrowOnError>({
 991 |     security: [
 992 |       {
 993 |         scheme: "bearer",
 994 |         type: "http",
 995 |       },
 996 |     ],
 997 |     url: "/docs/{docId}/tables/{tableIdOrName}/rows/{rowIdOrName}",
 998 |     ...options,
 999 |     headers: {
1000 |       "Content-Type": "application/json",
1001 |       ...options?.headers,
1002 |     },
1003 |   });
1004 | };
1005 | 
1006 | /**
1007 |  * Push a button
1008 |  * Pushes a button on a row in a table.
1009 |  * Authorization note: This action is available to API tokens that are authorized to write to the table. However, the underlying button can perform any action on the document, including writing to other tables and performing Pack actions.
1010 |  *
1011 |  */
1012 | export const pushButton = <ThrowOnError extends boolean = false>(options: Options<PushButtonData, ThrowOnError>) => {
1013 |   return (options.client ?? _heyApiClient).post<PushButtonResponse, PushButtonError, ThrowOnError>({
1014 |     security: [
1015 |       {
1016 |         scheme: "bearer",
1017 |         type: "http",
1018 |       },
1019 |     ],
1020 |     url: "/docs/{docId}/tables/{tableIdOrName}/rows/{rowIdOrName}/buttons/{columnIdOrName}",
1021 |     ...options,
1022 |   });
1023 | };
1024 | 
1025 | /**
1026 |  * Get a column
1027 |  * Returns details about a column in a table.
1028 |  */
1029 | export const getColumn = <ThrowOnError extends boolean = false>(options: Options<GetColumnData, ThrowOnError>) => {
1030 |   return (options.client ?? _heyApiClient).get<GetColumnResponse, GetColumnError, ThrowOnError>({
1031 |     security: [
1032 |       {
1033 |         scheme: "bearer",
1034 |         type: "http",
1035 |       },
1036 |     ],
1037 |     url: "/docs/{docId}/tables/{tableIdOrName}/columns/{columnIdOrName}",
1038 |     ...options,
1039 |   });
1040 | };
1041 | 
1042 | /**
1043 |  * List formulas
1044 |  * Returns a list of named formulas in a Coda doc.
1045 |  */
1046 | export const listFormulas = <ThrowOnError extends boolean = false>(
1047 |   options: Options<ListFormulasData, ThrowOnError>,
1048 | ) => {
1049 |   return (options.client ?? _heyApiClient).get<ListFormulasResponse, ListFormulasError, ThrowOnError>({
1050 |     security: [
1051 |       {
1052 |         scheme: "bearer",
1053 |         type: "http",
1054 |       },
1055 |     ],
1056 |     url: "/docs/{docId}/formulas",
1057 |     ...options,
1058 |   });
1059 | };
1060 | 
1061 | /**
1062 |  * Get a formula
1063 |  * Returns info on a formula.
1064 |  */
1065 | export const getFormula = <ThrowOnError extends boolean = false>(options: Options<GetFormulaData, ThrowOnError>) => {
1066 |   return (options.client ?? _heyApiClient).get<GetFormulaResponse, GetFormulaError, ThrowOnError>({
1067 |     security: [
1068 |       {
1069 |         scheme: "bearer",
1070 |         type: "http",
1071 |       },
1072 |     ],
1073 |     url: "/docs/{docId}/formulas/{formulaIdOrName}",
1074 |     ...options,
1075 |   });
1076 | };
1077 | 
1078 | /**
1079 |  * List controls
1080 |  * Returns a list of controls in a Coda doc.
1081 |  */
1082 | export const listControls = <ThrowOnError extends boolean = false>(
1083 |   options: Options<ListControlsData, ThrowOnError>,
1084 | ) => {
1085 |   return (options.client ?? _heyApiClient).get<ListControlsResponse, ListControlsError, ThrowOnError>({
1086 |     security: [
1087 |       {
1088 |         scheme: "bearer",
1089 |         type: "http",
1090 |       },
1091 |     ],
1092 |     url: "/docs/{docId}/controls",
1093 |     ...options,
1094 |   });
1095 | };
1096 | 
1097 | /**
1098 |  * Get a control
1099 |  * Returns info on a control.
1100 |  */
1101 | export const getControl = <ThrowOnError extends boolean = false>(options: Options<GetControlData, ThrowOnError>) => {
1102 |   return (options.client ?? _heyApiClient).get<GetControlResponse, GetControlError, ThrowOnError>({
1103 |     security: [
1104 |       {
1105 |         scheme: "bearer",
1106 |         type: "http",
1107 |       },
1108 |     ],
1109 |     url: "/docs/{docId}/controls/{controlIdOrName}",
1110 |     ...options,
1111 |   });
1112 | };
1113 | 
1114 | /**
1115 |  * List custom doc domains
1116 |  * List all custom domains for a published doc.
1117 |  */
1118 | export const listCustomDocDomains = <ThrowOnError extends boolean = false>(
1119 |   options: Options<ListCustomDocDomainsData, ThrowOnError>,
1120 | ) => {
1121 |   return (options.client ?? _heyApiClient).get<ListCustomDocDomainsResponse, ListCustomDocDomainsError, ThrowOnError>({
1122 |     security: [
1123 |       {
1124 |         scheme: "bearer",
1125 |         type: "http",
1126 |       },
1127 |     ],
1128 |     url: "/docs/${docId}/domains",
1129 |     ...options,
1130 |   });
1131 | };
1132 | 
1133 | /**
1134 |  * Add custom domain
1135 |  * Add a custom domain to a published doc.
1136 |  */
1137 | export const addCustomDocDomain = <ThrowOnError extends boolean = false>(
1138 |   options: Options<AddCustomDocDomainData, ThrowOnError>,
1139 | ) => {
1140 |   return (options.client ?? _heyApiClient).post<AddCustomDocDomainResponse2, AddCustomDocDomainError, ThrowOnError>({
1141 |     security: [
1142 |       {
1143 |         scheme: "bearer",
1144 |         type: "http",
1145 |       },
1146 |     ],
1147 |     url: "/docs/${docId}/domains",
1148 |     ...options,
1149 |     headers: {
1150 |       "Content-Type": "application/json",
1151 |       ...options?.headers,
1152 |     },
1153 |   });
1154 | };
1155 | 
1156 | /**
1157 |  * Deletes a custom domain
1158 |  * Deletes a custom domain from a published doc.
1159 |  */
1160 | export const deleteCustomDocDomain = <ThrowOnError extends boolean = false>(
1161 |   options: Options<DeleteCustomDocDomainData, ThrowOnError>,
1162 | ) => {
1163 |   return (options.client ?? _heyApiClient).delete<
1164 |     DeleteCustomDocDomainResponse2,
1165 |     DeleteCustomDocDomainError,
1166 |     ThrowOnError
1167 |   >({
1168 |     security: [
1169 |       {
1170 |         scheme: "bearer",
1171 |         type: "http",
1172 |       },
1173 |     ],
1174 |     url: "/docs/{docId}/domains/{customDocDomain}",
1175 |     ...options,
1176 |   });
1177 | };
1178 | 
1179 | /**
1180 |  * Updates a custom domain
1181 |  * Updates properties of a document's custom domain.
1182 |  */
1183 | export const updateCustomDocDomain = <ThrowOnError extends boolean = false>(
1184 |   options: Options<UpdateCustomDocDomainData, ThrowOnError>,
1185 | ) => {
1186 |   return (options.client ?? _heyApiClient).patch<
1187 |     UpdateCustomDocDomainResponse2,
1188 |     UpdateCustomDocDomainError,
1189 |     ThrowOnError
1190 |   >({
1191 |     security: [
1192 |       {
1193 |         scheme: "bearer",
1194 |         type: "http",
1195 |       },
1196 |     ],
1197 |     url: "/docs/{docId}/domains/{customDocDomain}",
1198 |     ...options,
1199 |     headers: {
1200 |       "Content-Type": "application/json",
1201 |       ...options?.headers,
1202 |     },
1203 |   });
1204 | };
1205 | 
1206 | /**
1207 |  * Gets custom doc domains providers
1208 |  * Gets the provider (ie. GoDaddy) of a custom domain.
1209 |  */
1210 | export const getCustomDocDomainProvider = <ThrowOnError extends boolean = false>(
1211 |   options: Options<GetCustomDocDomainProviderData, ThrowOnError>,
1212 | ) => {
1213 |   return (options.client ?? _heyApiClient).get<
1214 |     GetCustomDocDomainProviderResponse,
1215 |     GetCustomDocDomainProviderError,
1216 |     ThrowOnError
1217 |   >({
1218 |     security: [
1219 |       {
1220 |         scheme: "bearer",
1221 |         type: "http",
1222 |       },
1223 |     ],
1224 |     url: "/domains/provider/{customDocDomain}",
1225 |     ...options,
1226 |   });
1227 | };
1228 | 
1229 | /**
1230 |  * Get user info
1231 |  * Returns basic info about the current user.
1232 |  */
1233 | export const whoami = <ThrowOnError extends boolean = false>(options?: Options<WhoamiData, ThrowOnError>) => {
1234 |   return (options?.client ?? _heyApiClient).get<WhoamiResponse, WhoamiError, ThrowOnError>({
1235 |     security: [
1236 |       {
1237 |         scheme: "bearer",
1238 |         type: "http",
1239 |       },
1240 |     ],
1241 |     url: "/whoami",
1242 |     ...options,
1243 |   });
1244 | };
1245 | 
1246 | /**
1247 |  * Resolve browser link
1248 |  * Given a browser link to a Coda object, attempts to find it and return metadata that can be used to get more info on it. Returns a 400 if the URL does not appear to be a Coda URL or a 404 if the resource cannot be located with the current credentials.
1249 |  *
1250 |  */
1251 | export const resolveBrowserLink = <ThrowOnError extends boolean = false>(
1252 |   options: Options<ResolveBrowserLinkData, ThrowOnError>,
1253 | ) => {
1254 |   return (options.client ?? _heyApiClient).get<ResolveBrowserLinkResponse, ResolveBrowserLinkError, ThrowOnError>({
1255 |     security: [
1256 |       {
1257 |         scheme: "bearer",
1258 |         type: "http",
1259 |       },
1260 |     ],
1261 |     url: "/resolveBrowserLink",
1262 |     ...options,
1263 |   });
1264 | };
1265 | 
1266 | /**
1267 |  * Get mutation status
1268 |  * Get the status for an asynchronous mutation to know whether or not it has been completed. Each API endpoint that mutates a document will return a request id that you can pass to this endpoint to check the completion status. Status information is not guaranteed to be available for more than one day after the mutation was completed. It is intended to be used shortly after the request was made.
1269 |  *
1270 |  */
1271 | export const getMutationStatus = <ThrowOnError extends boolean = false>(
1272 |   options: Options<GetMutationStatusData, ThrowOnError>,
1273 | ) => {
1274 |   return (options.client ?? _heyApiClient).get<GetMutationStatusResponse, GetMutationStatusError, ThrowOnError>({
1275 |     security: [
1276 |       {
1277 |         scheme: "bearer",
1278 |         type: "http",
1279 |       },
1280 |     ],
1281 |     url: "/mutationStatus/{requestId}",
1282 |     ...options,
1283 |   });
1284 | };
1285 | 
1286 | /**
1287 |  * Trigger automation
1288 |  * Triggers webhook-invoked automation
1289 |  */
1290 | export const triggerWebhookAutomation = <ThrowOnError extends boolean = false>(
1291 |   options: Options<TriggerWebhookAutomationData, ThrowOnError>,
1292 | ) => {
1293 |   return (options.client ?? _heyApiClient).post<
1294 |     TriggerWebhookAutomationResponse,
1295 |     TriggerWebhookAutomationError,
1296 |     ThrowOnError
1297 |   >({
1298 |     security: [
1299 |       {
1300 |         scheme: "bearer",
1301 |         type: "http",
1302 |       },
1303 |     ],
1304 |     url: "/docs/{docId}/hooks/automation/{ruleId}",
1305 |     ...options,
1306 |     headers: {
1307 |       "Content-Type": "application/json",
1308 |       ...options?.headers,
1309 |     },
1310 |   });
1311 | };
1312 | 
1313 | /**
1314 |  * List doc analytics
1315 |  * Returns analytics data for available docs per day.
1316 |  *
1317 |  */
1318 | export const listDocAnalytics = <ThrowOnError extends boolean = false>(
1319 |   options?: Options<ListDocAnalyticsData, ThrowOnError>,
1320 | ) => {
1321 |   return (options?.client ?? _heyApiClient).get<ListDocAnalyticsResponse, ListDocAnalyticsError, ThrowOnError>({
1322 |     security: [
1323 |       {
1324 |         scheme: "bearer",
1325 |         type: "http",
1326 |       },
1327 |     ],
1328 |     querySerializer: {
1329 |       array: {
1330 |         explode: false,
1331 |         style: "form",
1332 |       },
1333 |     },
1334 |     url: "/analytics/docs",
1335 |     ...options,
1336 |   });
1337 | };
1338 | 
1339 | /**
1340 |  * List page analytics
1341 |  * Returns analytics data for a given doc within the day.
1342 |  * This method will return a 401 if the given doc is not in an Enterprise workspace.
1343 |  *
1344 |  */
1345 | export const listPageAnalytics = <ThrowOnError extends boolean = false>(
1346 |   options: Options<ListPageAnalyticsData, ThrowOnError>,
1347 | ) => {
1348 |   return (options.client ?? _heyApiClient).get<ListPageAnalyticsResponse, ListPageAnalyticsError, ThrowOnError>({
1349 |     security: [
1350 |       {
1351 |         scheme: "bearer",
1352 |         type: "http",
1353 |       },
1354 |     ],
1355 |     url: "/analytics/docs/{docId}/pages",
1356 |     ...options,
1357 |   });
1358 | };
1359 | 
1360 | /**
1361 |  * Get doc analytics summary
1362 |  * Returns summarized analytics data for available docs.
1363 |  *
1364 |  */
1365 | export const listDocAnalyticsSummary = <ThrowOnError extends boolean = false>(
1366 |   options?: Options<ListDocAnalyticsSummaryData, ThrowOnError>,
1367 | ) => {
1368 |   return (options?.client ?? _heyApiClient).get<
1369 |     ListDocAnalyticsSummaryResponse,
1370 |     ListDocAnalyticsSummaryError,
1371 |     ThrowOnError
1372 |   >({
1373 |     security: [
1374 |       {
1375 |         scheme: "bearer",
1376 |         type: "http",
1377 |       },
1378 |     ],
1379 |     url: "/analytics/docs/summary",
1380 |     ...options,
1381 |   });
1382 | };
1383 | 
1384 | /**
1385 |  * List Pack analytics
1386 |  * Returns analytics data for Packs the user can edit.
1387 |  *
1388 |  */
1389 | export const listPackAnalytics = <ThrowOnError extends boolean = false>(
1390 |   options?: Options<ListPackAnalyticsData, ThrowOnError>,
1391 | ) => {
1392 |   return (options?.client ?? _heyApiClient).get<ListPackAnalyticsResponse, ListPackAnalyticsError, ThrowOnError>({
1393 |     security: [
1394 |       {
1395 |         scheme: "bearer",
1396 |         type: "http",
1397 |       },
1398 |     ],
1399 |     querySerializer: {
1400 |       array: {
1401 |         explode: false,
1402 |         style: "form",
1403 |       },
1404 |     },
1405 |     url: "/analytics/packs",
1406 |     ...options,
1407 |   });
1408 | };
1409 | 
1410 | /**
1411 |  * Get Pack analytics summary
1412 |  * Returns summarized analytics data for Packs the user can edit.
1413 |  *
1414 |  */
1415 | export const listPackAnalyticsSummary = <ThrowOnError extends boolean = false>(
1416 |   options?: Options<ListPackAnalyticsSummaryData, ThrowOnError>,
1417 | ) => {
1418 |   return (options?.client ?? _heyApiClient).get<
1419 |     ListPackAnalyticsSummaryResponse,
1420 |     ListPackAnalyticsSummaryError,
1421 |     ThrowOnError
1422 |   >({
1423 |     security: [
1424 |       {
1425 |         scheme: "bearer",
1426 |         type: "http",
1427 |       },
1428 |     ],
1429 |     querySerializer: {
1430 |       array: {
1431 |         explode: false,
1432 |         style: "form",
1433 |       },
1434 |     },
1435 |     url: "/analytics/packs/summary",
1436 |     ...options,
1437 |   });
1438 | };
1439 | 
1440 | /**
1441 |  * List Pack formula analytics
1442 |  * Returns analytics data for Pack formulas.
1443 |  *
1444 |  */
1445 | export const listPackFormulaAnalytics = <ThrowOnError extends boolean = false>(
1446 |   options: Options<ListPackFormulaAnalyticsData, ThrowOnError>,
1447 | ) => {
1448 |   return (options.client ?? _heyApiClient).get<
1449 |     ListPackFormulaAnalyticsResponse,
1450 |     ListPackFormulaAnalyticsError,
1451 |     ThrowOnError
1452 |   >({
1453 |     security: [
1454 |       {
1455 |         scheme: "bearer",
1456 |         type: "http",
1457 |       },
1458 |     ],
1459 |     querySerializer: {
1460 |       array: {
1461 |         explode: false,
1462 |         style: "form",
1463 |       },
1464 |     },
1465 |     url: "/analytics/packs/{packId}/formulas",
1466 |     ...options,
1467 |   });
1468 | };
1469 | 
1470 | /**
1471 |  * Get analytics last updated day
1472 |  * Returns days based on Pacific Standard Time when analytics were last updated.
1473 |  *
1474 |  */
1475 | export const getAnalyticsLastUpdated = <ThrowOnError extends boolean = false>(
1476 |   options?: Options<GetAnalyticsLastUpdatedData, ThrowOnError>,
1477 | ) => {
1478 |   return (options?.client ?? _heyApiClient).get<
1479 |     GetAnalyticsLastUpdatedResponse,
1480 |     GetAnalyticsLastUpdatedError,
1481 |     ThrowOnError
1482 |   >({
1483 |     security: [
1484 |       {
1485 |         scheme: "bearer",
1486 |         type: "http",
1487 |       },
1488 |     ],
1489 |     url: "/analytics/updated",
1490 |     ...options,
1491 |   });
1492 | };
1493 | 
1494 | /**
1495 |  * List workspace users
1496 |  * Returns a list of members in the given workspace. This list will be ordered with the requesting user first and then ordered by role.
1497 |  *
1498 |  */
1499 | export const listWorkspaceMembers = <ThrowOnError extends boolean = false>(
1500 |   options: Options<ListWorkspaceMembersData, ThrowOnError>,
1501 | ) => {
1502 |   return (options.client ?? _heyApiClient).get<ListWorkspaceMembersResponse, ListWorkspaceMembersError, ThrowOnError>({
1503 |     security: [
1504 |       {
1505 |         scheme: "bearer",
1506 |         type: "http",
1507 |       },
1508 |     ],
1509 |     querySerializer: {
1510 |       array: {
1511 |         explode: false,
1512 |         style: "form",
1513 |       },
1514 |     },
1515 |     url: "/workspaces/{workspaceId}/users",
1516 |     ...options,
1517 |   });
1518 | };
1519 | 
1520 | /**
1521 |  * Updates user role
1522 |  * Updates the workspace user role of a user that matches the parameters. Only succeeds if the requesting user has admin permissions in the workspace.
1523 |  *
1524 |  */
1525 | export const changeUserRole = <ThrowOnError extends boolean = false>(
1526 |   options: Options<ChangeUserRoleData, ThrowOnError>,
1527 | ) => {
1528 |   return (options.client ?? _heyApiClient).post<ChangeUserRoleResponse, ChangeUserRoleError, ThrowOnError>({
1529 |     security: [
1530 |       {
1531 |         scheme: "bearer",
1532 |         type: "http",
1533 |       },
1534 |     ],
1535 |     url: "/workspaces/{workspaceId}/users/role",
1536 |     ...options,
1537 |     headers: {
1538 |       "Content-Type": "application/json",
1539 |       ...options?.headers,
1540 |     },
1541 |   });
1542 | };
1543 | 
1544 | /**
1545 |  * List workspace roles
1546 |  * Returns a list of the counts of users over time by role for the workspace.
1547 |  *
1548 |  */
1549 | export const listWorkspaceRoleActivity = <ThrowOnError extends boolean = false>(
1550 |   options: Options<ListWorkspaceRoleActivityData, ThrowOnError>,
1551 | ) => {
1552 |   return (options.client ?? _heyApiClient).get<
1553 |     ListWorkspaceRoleActivityResponse,
1554 |     ListWorkspaceRoleActivityError,
1555 |     ThrowOnError
1556 |   >({
1557 |     security: [
1558 |       {
1559 |         scheme: "bearer",
1560 |         type: "http",
1561 |       },
1562 |     ],
1563 |     url: "/workspaces/{workspaceId}/roles",
1564 |     ...options,
1565 |   });
1566 | };
1567 | 
1568 | /**
1569 |  * List Packs
1570 |  * Get the list of accessible Packs.
1571 |  *
1572 |  */
1573 | export const listPacks = <ThrowOnError extends boolean = false>(options?: Options<ListPacksData, ThrowOnError>) => {
1574 |   return (options?.client ?? _heyApiClient).get<ListPacksResponse, ListPacksError, ThrowOnError>({
1575 |     security: [
1576 |       {
1577 |         scheme: "bearer",
1578 |         type: "http",
1579 |       },
1580 |     ],
1581 |     querySerializer: {
1582 |       array: {
1583 |         explode: false,
1584 |         style: "form",
1585 |       },
1586 |     },
1587 |     url: "/packs",
1588 |     ...options,
1589 |   });
1590 | };
1591 | 
1592 | /**
1593 |  * Create Pack
1594 |  * Creates a new Pack, essentially registering a new Pack ID. The contents of the Pack will be uploaded separately.
1595 |  *
1596 |  */
1597 | export const createPack = <ThrowOnError extends boolean = false>(options: Options<CreatePackData, ThrowOnError>) => {
1598 |   return (options.client ?? _heyApiClient).post<CreatePackResponse2, CreatePackError, ThrowOnError>({
1599 |     security: [
1600 |       {
1601 |         scheme: "bearer",
1602 |         type: "http",
1603 |       },
1604 |     ],
1605 |     url: "/packs",
1606 |     ...options,
1607 |     headers: {
1608 |       "Content-Type": "application/json",
1609 |       ...options?.headers,
1610 |     },
1611 |   });
1612 | };
1613 | 
1614 | /**
1615 |  * Delete Pack
1616 |  * Delete a given Pack.
1617 |  *
1618 |  */
1619 | export const deletePack = <ThrowOnError extends boolean = false>(options: Options<DeletePackData, ThrowOnError>) => {
1620 |   return (options.client ?? _heyApiClient).delete<DeletePackResponse2, DeletePackError, ThrowOnError>({
1621 |     security: [
1622 |       {
1623 |         scheme: "bearer",
1624 |         type: "http",
1625 |       },
1626 |     ],
1627 |     url: "/packs/{packId}",
1628 |     ...options,
1629 |   });
1630 | };
1631 | 
1632 | /**
1633 |  * Get a single Pack
1634 |  * Returns a single Pack.
1635 |  *
1636 |  */
1637 | export const getPack = <ThrowOnError extends boolean = false>(options: Options<GetPackData, ThrowOnError>) => {
1638 |   return (options.client ?? _heyApiClient).get<GetPackResponse, GetPackError, ThrowOnError>({
1639 |     security: [
1640 |       {
1641 |         scheme: "bearer",
1642 |         type: "http",
1643 |       },
1644 |     ],
1645 |     url: "/packs/{packId}",
1646 |     ...options,
1647 |   });
1648 | };
1649 | 
1650 | /**
1651 |  * Update Pack
1652 |  * Update an existing Pack for non-versioned fields.
1653 |  *
1654 |  */
1655 | export const updatePack = <ThrowOnError extends boolean = false>(options: Options<UpdatePackData, ThrowOnError>) => {
1656 |   return (options.client ?? _heyApiClient).patch<UpdatePackResponse, UpdatePackError, ThrowOnError>({
1657 |     security: [
1658 |       {
1659 |         scheme: "bearer",
1660 |         type: "http",
1661 |       },
1662 |     ],
1663 |     url: "/packs/{packId}",
1664 |     ...options,
1665 |     headers: {
1666 |       "Content-Type": "application/json",
1667 |       ...options?.headers,
1668 |     },
1669 |   });
1670 | };
1671 | 
1672 | /**
1673 |  * Gets the JSON Schema for Pack configuration.
1674 |  * Returns a JSON Schema applicable for customizing the pack using Pack configurations.
1675 |  *
1676 |  */
1677 | export const getPackConfigurationSchema = <ThrowOnError extends boolean = false>(
1678 |   options: Options<GetPackConfigurationSchemaData, ThrowOnError>,
1679 | ) => {
1680 |   return (options.client ?? _heyApiClient).get<
1681 |     GetPackConfigurationSchemaResponse,
1682 |     GetPackConfigurationSchemaError,
1683 |     ThrowOnError
1684 |   >({
1685 |     security: [
1686 |       {
1687 |         scheme: "bearer",
1688 |         type: "http",
1689 |       },
1690 |     ],
1691 |     url: "/packs/{packId}/configurations/schema",
1692 |     ...options,
1693 |   });
1694 | };
1695 | 
1696 | /**
1697 |  * List the versions for a Pack.
1698 |  * Get the list of versions of a Pack.
1699 |  *
1700 |  */
1701 | export const listPackVersions = <ThrowOnError extends boolean = false>(
1702 |   options: Options<ListPackVersionsData, ThrowOnError>,
1703 | ) => {
1704 |   return (options.client ?? _heyApiClient).get<ListPackVersionsResponse, ListPackVersionsError, ThrowOnError>({
1705 |     security: [
1706 |       {
1707 |         scheme: "bearer",
1708 |         type: "http",
1709 |       },
1710 |     ],
1711 |     url: "/packs/{packId}/versions",
1712 |     ...options,
1713 |   });
1714 | };
1715 | 
1716 | /**
1717 |  * Get the next valid version for a Pack.
1718 |  * Get the next valid version based on the proposed metadata.
1719 |  *
1720 |  */
1721 | export const getNextPackVersion = <ThrowOnError extends boolean = false>(
1722 |   options: Options<GetNextPackVersionData, ThrowOnError>,
1723 | ) => {
1724 |   return (options.client ?? _heyApiClient).post<GetNextPackVersionResponse, GetNextPackVersionError, ThrowOnError>({
1725 |     security: [
1726 |       {
1727 |         scheme: "bearer",
1728 |         type: "http",
1729 |       },
1730 |     ],
1731 |     url: "/packs/{packId}/nextVersion",
1732 |     ...options,
1733 |     headers: {
1734 |       "Content-Type": "application/json",
1735 |       ...options?.headers,
1736 |     },
1737 |   });
1738 | };
1739 | 
1740 | /**
1741 |  * Get the difference between two pack versions.
1742 |  * Gets information about the difference between the specified previous version and next version of a Pack.
1743 |  *
1744 |  */
1745 | export const getPackVersionDiffs = <ThrowOnError extends boolean = false>(
1746 |   options: Options<GetPackVersionDiffsData, ThrowOnError>,
1747 | ) => {
1748 |   return (options.client ?? _heyApiClient).get<GetPackVersionDiffsResponse, GetPackVersionDiffsError, ThrowOnError>({
1749 |     security: [
1750 |       {
1751 |         scheme: "bearer",
1752 |         type: "http",
1753 |       },
1754 |     ],
1755 |     url: "/packs/{packId}/versions/{basePackVersion}/diff/{targetPackVersion}",
1756 |     ...options,
1757 |   });
1758 | };
1759 | 
1760 | /**
1761 |  * Register Pack version
1762 |  * Registers a new Pack version. This simply returns a signed URL to use for uploading the Pack version definition. Following the completion of the upload, POST to /apis/v1/packs/{packId}/versions/{packVersion} trigger the rest of the creation process.
1763 |  *
1764 |  */
1765 | export const registerPackVersion = <ThrowOnError extends boolean = false>(
1766 |   options: Options<RegisterPackVersionData, ThrowOnError>,
1767 | ) => {
1768 |   return (options.client ?? _heyApiClient).post<RegisterPackVersionResponse, RegisterPackVersionError, ThrowOnError>({
1769 |     security: [
1770 |       {
1771 |         scheme: "bearer",
1772 |         type: "http",
1773 |       },
1774 |     ],
1775 |     url: "/packs/{packId}/versions/{packVersion}/register",
1776 |     ...options,
1777 |     headers: {
1778 |       "Content-Type": "application/json",
1779 |       ...options?.headers,
1780 |     },
1781 |   });
1782 | };
1783 | 
1784 | /**
1785 |  * Pack version upload complete
1786 |  * Note the completion of the upload of a Pack version bundle in order to create that Pack version.
1787 |  *
1788 |  */
1789 | export const packVersionUploadComplete = <ThrowOnError extends boolean = false>(
1790 |   options: Options<PackVersionUploadCompleteData, ThrowOnError>,
1791 | ) => {
1792 |   return (options.client ?? _heyApiClient).post<
1793 |     PackVersionUploadCompleteResponse,
1794 |     PackVersionUploadCompleteError,
1795 |     ThrowOnError
1796 |   >({
1797 |     security: [
1798 |       {
1799 |         scheme: "bearer",
1800 |         type: "http",
1801 |       },
1802 |     ],
1803 |     url: "/packs/{packId}/versions/{packVersion}/uploadComplete",
1804 |     ...options,
1805 |     headers: {
1806 |       "Content-Type": "application/json",
1807 |       ...options?.headers,
1808 |     },
1809 |   });
1810 | };
1811 | 
1812 | /**
1813 |  * List the releases for a Pack.
1814 |  * Get the list of releases of a Pack.
1815 |  *
1816 |  */
1817 | export const listPackReleases = <ThrowOnError extends boolean = false>(
1818 |   options: Options<ListPackReleasesData, ThrowOnError>,
1819 | ) => {
1820 |   return (options.client ?? _heyApiClient).get<ListPackReleasesResponse, ListPackReleasesError, ThrowOnError>({
1821 |     security: [
1822 |       {
1823 |         scheme: "bearer",
1824 |         type: "http",
1825 |       },
1826 |     ],
1827 |     url: "/packs/{packId}/releases",
1828 |     ...options,
1829 |   });
1830 | };
1831 | 
1832 | /**
1833 |  * Create a new Pack release.
1834 |  * Creates a new Pack release based on an existing Pack version.
1835 |  *
1836 |  */
1837 | export const createPackRelease = <ThrowOnError extends boolean = false>(
1838 |   options: Options<CreatePackReleaseData, ThrowOnError>,
1839 | ) => {
1840 |   return (options.client ?? _heyApiClient).post<CreatePackReleaseResponse, CreatePackReleaseError, ThrowOnError>({
1841 |     security: [
1842 |       {
1843 |         scheme: "bearer",
1844 |         type: "http",
1845 |       },
1846 |     ],
1847 |     url: "/packs/{packId}/releases",
1848 |     ...options,
1849 |     headers: {
1850 |       "Content-Type": "application/json",
1851 |       ...options?.headers,
1852 |     },
1853 |   });
1854 | };
1855 | 
1856 | /**
1857 |  * Update an existing Pack release.
1858 |  * Update details of a Pack release.
1859 |  *
1860 |  */
1861 | export const updatePackRelease = <ThrowOnError extends boolean = false>(
1862 |   options: Options<UpdatePackReleaseData, ThrowOnError>,
1863 | ) => {
1864 |   return (options.client ?? _heyApiClient).put<UpdatePackReleaseResponse, UpdatePackReleaseError, ThrowOnError>({
1865 |     security: [
1866 |       {
1867 |         scheme: "bearer",
1868 |         type: "http",
1869 |       },
1870 |     ],
1871 |     url: "/packs/{packId}/releases/{packReleaseId}",
1872 |     ...options,
1873 |     headers: {
1874 |       "Content-Type": "application/json",
1875 |       ...options?.headers,
1876 |     },
1877 |   });
1878 | };
1879 | 
1880 | /**
1881 |  * Retrieve the OAuth configuration of the Pack.
1882 |  * Retrieve the OAuth configuration of the Pack for display purpose. Secrets will be returned with masks.
1883 |  *
1884 |  */
1885 | export const getPackOauthConfig = <ThrowOnError extends boolean = false>(
1886 |   options: Options<GetPackOauthConfigData, ThrowOnError>,
1887 | ) => {
1888 |   return (options.client ?? _heyApiClient).get<GetPackOauthConfigResponse, GetPackOauthConfigError, ThrowOnError>({
1889 |     security: [
1890 |       {
1891 |         scheme: "bearer",
1892 |         type: "http",
1893 |       },
1894 |     ],
1895 |     url: "/packs/{packId}/oauthConfig",
1896 |     ...options,
1897 |   });
1898 | };
1899 | 
1900 | /**
1901 |  * Set the OAuth configurations of the Pack.
1902 |  * Set the OAuth configurations of the Pack, including client id and secret.
1903 |  *
1904 |  */
1905 | export const setPackOauthConfig = <ThrowOnError extends boolean = false>(
1906 |   options: Options<SetPackOauthConfigData, ThrowOnError>,
1907 | ) => {
1908 |   return (options.client ?? _heyApiClient).put<SetPackOauthConfigResponse, SetPackOauthConfigError, ThrowOnError>({
1909 |     security: [
1910 |       {
1911 |         scheme: "bearer",
1912 |         type: "http",
1913 |       },
1914 |     ],
1915 |     url: "/packs/{packId}/oauthConfig",
1916 |     ...options,
1917 |     headers: {
1918 |       "Content-Type": "application/json",
1919 |       ...options?.headers,
1920 |     },
1921 |   });
1922 | };
1923 | 
1924 | /**
1925 |  * Retrieve the system connection metadata of the Pack.
1926 |  * Retrieve the system connection metadata of the Pack.
1927 |  *
1928 |  */
1929 | export const getPackSystemConnection = <ThrowOnError extends boolean = false>(
1930 |   options: Options<GetPackSystemConnectionData, ThrowOnError>,
1931 | ) => {
1932 |   return (options.client ?? _heyApiClient).get<
1933 |     GetPackSystemConnectionResponse,
1934 |     GetPackSystemConnectionError,
1935 |     ThrowOnError
1936 |   >({
1937 |     security: [
1938 |       {
1939 |         scheme: "bearer",
1940 |         type: "http",
1941 |       },
1942 |     ],
1943 |     url: "/packs/{packId}/systemConnection",
1944 |     ...options,
1945 |   });
1946 | };
1947 | 
1948 | /**
1949 |  * Patch the system connection credentials of the Pack.
1950 |  * Patch the system connection credentials of the Pack.
1951 |  *
1952 |  */
1953 | export const patchPackSystemConnection = <ThrowOnError extends boolean = false>(
1954 |   options: Options<PatchPackSystemConnectionData, ThrowOnError>,
1955 | ) => {
1956 |   return (options.client ?? _heyApiClient).patch<
1957 |     PatchPackSystemConnectionResponse,
1958 |     PatchPackSystemConnectionError,
1959 |     ThrowOnError
1960 |   >({
1961 |     security: [
1962 |       {
1963 |         scheme: "bearer",
1964 |         type: "http",
1965 |       },
1966 |     ],
1967 |     url: "/packs/{packId}/systemConnection",
1968 |     ...options,
1969 |     headers: {
1970 |       "Content-Type": "application/json",
1971 |       ...options?.headers,
1972 |     },
1973 |   });
1974 | };
1975 | 
1976 | /**
1977 |  * Set the system connection credentials of the Pack.
1978 |  * Set the system connection credentials of the Pack.
1979 |  *
1980 |  */
1981 | export const setPackSystemConnection = <ThrowOnError extends boolean = false>(
1982 |   options: Options<SetPackSystemConnectionData, ThrowOnError>,
1983 | ) => {
1984 |   return (options.client ?? _heyApiClient).put<
1985 |     SetPackSystemConnectionResponse,
1986 |     SetPackSystemConnectionError,
1987 |     ThrowOnError
1988 |   >({
1989 |     security: [
1990 |       {
1991 |         scheme: "bearer",
1992 |         type: "http",
1993 |       },
1994 |     ],
1995 |     url: "/packs/{packId}/systemConnection",
1996 |     ...options,
1997 |     headers: {
1998 |       "Content-Type": "application/json",
1999 |       ...options?.headers,
2000 |     },
2001 |   });
2002 | };
2003 | 
2004 | /**
2005 |  * List permissions for a Pack
2006 |  * Get user, workspace, and/or global permissions for a given Pack.
2007 |  *
2008 |  */
2009 | export const getPackPermissions = <ThrowOnError extends boolean = false>(
2010 |   options: Options<GetPackPermissionsData, ThrowOnError>,
2011 | ) => {
2012 |   return (options.client ?? _heyApiClient).get<GetPackPermissionsResponse, GetPackPermissionsError, ThrowOnError>({
2013 |     security: [
2014 |       {
2015 |         scheme: "bearer",
2016 |         type: "http",
2017 |       },
2018 |     ],
2019 |     url: "/packs/{packId}/permissions",
2020 |     ...options,
2021 |   });
2022 | };
2023 | 
2024 | /**
2025 |  * Add a permission for Pack
2026 |  * Create or modify user, workspace, or global permissions for a given Pack.
2027 |  *
2028 |  */
2029 | export const addPackPermission = <ThrowOnError extends boolean = false>(
2030 |   options: Options<AddPackPermissionData, ThrowOnError>,
2031 | ) => {
2032 |   return (options.client ?? _heyApiClient).post<AddPackPermissionResponse2, AddPackPermissionError, ThrowOnError>({
2033 |     security: [
2034 |       {
2035 |         scheme: "bearer",
2036 |         type: "http",
2037 |       },
2038 |     ],
2039 |     url: "/packs/{packId}/permissions",
2040 |     ...options,
2041 |     headers: {
2042 |       "Content-Type": "application/json",
2043 |       ...options?.headers,
2044 |     },
2045 |   });
2046 | };
2047 | 
2048 | /**
2049 |  * Delete a permission for Pack
2050 |  * Delete user, workspace, or global permissions for a given Pack.
2051 |  *
2052 |  */
2053 | export const deletePackPermission = <ThrowOnError extends boolean = false>(
2054 |   options: Options<DeletePackPermissionData, ThrowOnError>,
2055 | ) => {
2056 |   return (options.client ?? _heyApiClient).delete<
2057 |     DeletePackPermissionResponse2,
2058 |     DeletePackPermissionError,
2059 |     ThrowOnError
2060 |   >({
2061 |     security: [
2062 |       {
2063 |         scheme: "bearer",
2064 |         type: "http",
2065 |       },
2066 |     ],
2067 |     url: "/packs/{packId}/permissions/{permissionId}",
2068 |     ...options,
2069 |   });
2070 | };
2071 | 
2072 | /**
2073 |  * List makers for Pack
2074 |  * List makers for a given pack.
2075 |  *
2076 |  */
2077 | export const listPackMakers = <ThrowOnError extends boolean = false>(
2078 |   options: Options<ListPackMakersData, ThrowOnError>,
2079 | ) => {
2080 |   return (options.client ?? _heyApiClient).get<ListPackMakersResponse2, ListPackMakersError, ThrowOnError>({
2081 |     security: [
2082 |       {
2083 |         scheme: "bearer",
2084 |         type: "http",
2085 |       },
2086 |     ],
2087 |     url: "/packs/{packId}/makers",
2088 |     ...options,
2089 |   });
2090 | };
2091 | 
2092 | /**
2093 |  * Add a maker for Pack
2094 |  * Set a maker for a given Pack. Used to display makers for a pack in the corresponding packs page.
2095 |  *
2096 |  */
2097 | export const addPackMaker = <ThrowOnError extends boolean = false>(
2098 |   options: Options<AddPackMakerData, ThrowOnError>,
2099 | ) => {
2100 |   return (options.client ?? _heyApiClient).post<AddPackMakerResponse2, AddPackMakerError, ThrowOnError>({
2101 |     security: [
2102 |       {
2103 |         scheme: "bearer",
2104 |         type: "http",
2105 |       },
2106 |     ],
2107 |     url: "/packs/{packId}/maker",
2108 |     ...options,
2109 |     headers: {
2110 |       "Content-Type": "application/json",
2111 |       ...options?.headers,
2112 |     },
2113 |   });
2114 | };
2115 | 
2116 | /**
2117 |  * Delete a maker for Pack
2118 |  * Delete a maker for a given Pack, who will not be displayed in the corresponding packs page.
2119 |  *
2120 |  */
2121 | export const deletePackMaker = <ThrowOnError extends boolean = false>(
2122 |   options: Options<DeletePackMakerData, ThrowOnError>,
2123 | ) => {
2124 |   return (options.client ?? _heyApiClient).delete<DeletePackMakerResponse2, DeletePackMakerError, ThrowOnError>({
2125 |     security: [
2126 |       {
2127 |         scheme: "bearer",
2128 |         type: "http",
2129 |       },
2130 |     ],
2131 |     url: "/packs/{packId}/maker/{loginId}",
2132 |     ...options,
2133 |   });
2134 | };
2135 | 
2136 | /**
2137 |  * List categories for Pack
2138 |  * List publishing categories for a given pack.
2139 |  *
2140 |  */
2141 | export const listPackCategories = <ThrowOnError extends boolean = false>(
2142 |   options: Options<ListPackCategoriesData, ThrowOnError>,
2143 | ) => {
2144 |   return (options.client ?? _heyApiClient).get<ListPackCategoriesResponse2, ListPackCategoriesError, ThrowOnError>({
2145 |     security: [
2146 |       {
2147 |         scheme: "bearer",
2148 |         type: "http",
2149 |       },
2150 |     ],
2151 |     url: "/packs/{packId}/categories",
2152 |     ...options,
2153 |   });
2154 | };
2155 | 
2156 | /**
2157 |  * Add a category for Pack
2158 |  * Add a publishing category for a given pack.
2159 |  *
2160 |  */
2161 | export const addPackCategory = <ThrowOnError extends boolean = false>(
2162 |   options: Options<AddPackCategoryData, ThrowOnError>,
2163 | ) => {
2164 |   return (options.client ?? _heyApiClient).post<AddPackCategoryResponse2, AddPackCategoryError, ThrowOnError>({
2165 |     security: [
2166 |       {
2167 |         scheme: "bearer",
2168 |         type: "http",
2169 |       },
2170 |     ],
2171 |     url: "/packs/{packId}/category",
2172 |     ...options,
2173 |     headers: {
2174 |       "Content-Type": "application/json",
2175 |       ...options?.headers,
2176 |     },
2177 |   });
2178 | };
2179 | 
2180 | /**
2181 |  * Delete a category for Pack
2182 |  * Delete a publishing category for a given pack.
2183 |  *
2184 |  */
2185 | export const deletePackCategory = <ThrowOnError extends boolean = false>(
2186 |   options: Options<DeletePackCategoryData, ThrowOnError>,
2187 | ) => {
2188 |   return (options.client ?? _heyApiClient).delete<DeletePackCategoryResponse2, DeletePackCategoryError, ThrowOnError>({
2189 |     security: [
2190 |       {
2191 |         scheme: "bearer",
2192 |         type: "http",
2193 |       },
2194 |     ],
2195 |     url: "/packs/{packId}/category/{categoryName}",
2196 |     ...options,
2197 |   });
2198 | };
2199 | 
2200 | /**
2201 |  * Upload a Pack asset.
2202 |  * Request a signed s3 URL to upload your Pack asset.
2203 |  *
2204 |  */
2205 | export const uploadPackAsset = <ThrowOnError extends boolean = false>(
2206 |   options: Options<UploadPackAssetData, ThrowOnError>,
2207 | ) => {
2208 |   return (options.client ?? _heyApiClient).post<UploadPackAssetResponse, UploadPackAssetError, ThrowOnError>({
2209 |     security: [
2210 |       {
2211 |         scheme: "bearer",
2212 |         type: "http",
2213 |       },
2214 |     ],
2215 |     url: "/packs/{packId}/uploadAsset",
2216 |     ...options,
2217 |     headers: {
2218 |       "Content-Type": "application/json",
2219 |       ...options?.headers,
2220 |     },
2221 |   });
2222 | };
2223 | 
2224 | /**
2225 |  * Upload Pack source code.
2226 |  * Request a signed s3 URL to upload your Pack source code.
2227 |  *
2228 |  */
2229 | export const uploadPackSourceCode = <ThrowOnError extends boolean = false>(
2230 |   options: Options<UploadPackSourceCodeData, ThrowOnError>,
2231 | ) => {
2232 |   return (options.client ?? _heyApiClient).post<UploadPackSourceCodeResponse, UploadPackSourceCodeError, ThrowOnError>({
2233 |     security: [
2234 |       {
2235 |         scheme: "bearer",
2236 |         type: "http",
2237 |       },
2238 |     ],
2239 |     url: "/packs/{packId}/uploadSourceCode",
2240 |     ...options,
2241 |     headers: {
2242 |       "Content-Type": "application/json",
2243 |       ...options?.headers,
2244 |     },
2245 |   });
2246 | };
2247 | 
2248 | /**
2249 |  * Pack asset upload complete
2250 |  * Note the completion of the upload of a Pack asset.
2251 |  *
2252 |  */
2253 | export const packAssetUploadComplete = <ThrowOnError extends boolean = false>(
2254 |   options: Options<PackAssetUploadCompleteData, ThrowOnError>,
2255 | ) => {
2256 |   return (options.client ?? _heyApiClient).post<
2257 |     PackAssetUploadCompleteResponse2,
2258 |     PackAssetUploadCompleteError,
2259 |     ThrowOnError
2260 |   >({
2261 |     security: [
2262 |       {
2263 |         scheme: "bearer",
2264 |         type: "http",
2265 |       },
2266 |     ],
2267 |     url: "/packs/{packId}/assets/{packAssetId}/assetType/{packAssetType}/uploadComplete",
2268 |     ...options,
2269 |   });
2270 | };
2271 | 
2272 | /**
2273 |  * Pack source code upload complete
2274 |  * Note the completion of the upload of a Pack source code.
2275 |  *
2276 |  */
2277 | export const packSourceCodeUploadComplete = <ThrowOnError extends boolean = false>(
2278 |   options: Options<PackSourceCodeUploadCompleteData, ThrowOnError>,
2279 | ) => {
2280 |   return (options.client ?? _heyApiClient).post<
2281 |     PackSourceCodeUploadCompleteResponse2,
2282 |     PackSourceCodeUploadCompleteError,
2283 |     ThrowOnError
2284 |   >({
2285 |     security: [
2286 |       {
2287 |         scheme: "bearer",
2288 |         type: "http",
2289 |       },
2290 |     ],
2291 |     url: "/packs/{packId}/versions/{packVersion}/sourceCode/uploadComplete",
2292 |     ...options,
2293 |     headers: {
2294 |       "Content-Type": "application/json",
2295 |       ...options?.headers,
2296 |     },
2297 |   });
2298 | };
2299 | 
2300 | /**
2301 |  * get the source code for a Pack version.
2302 |  * Get temporary links used to download the source code for the given packId and version
2303 |  *
2304 |  */
2305 | export const getPackSourceCode = <ThrowOnError extends boolean = false>(
2306 |   options: Options<GetPackSourceCodeData, ThrowOnError>,
2307 | ) => {
2308 |   return (options.client ?? _heyApiClient).get<GetPackSourceCodeResponse, GetPackSourceCodeError, ThrowOnError>({
2309 |     security: [
2310 |       {
2311 |         scheme: "bearer",
2312 |         type: "http",
2313 |       },
2314 |     ],
2315 |     url: "/packs/{packId}/versions/{packVersion}/sourceCode",
2316 |     ...options,
2317 |   });
2318 | };
2319 | 
2320 | /**
2321 |  * List the Pack listings accessible to a user.
2322 |  * Get listings of public Packs and Packs created by you.
2323 |  *
2324 |  */
2325 | export const listPackListings = <ThrowOnError extends boolean = false>(
2326 |   options?: Options<ListPackListingsData, ThrowOnError>,
2327 | ) => {
2328 |   return (options?.client ?? _heyApiClient).get<ListPackListingsResponse, ListPackListingsError, ThrowOnError>({
2329 |     security: [
2330 |       {
2331 |         scheme: "bearer",
2332 |         type: "http",
2333 |       },
2334 |     ],
2335 |     querySerializer: {
2336 |       array: {
2337 |         explode: false,
2338 |         style: "form",
2339 |       },
2340 |     },
2341 |     url: "/packs/listings",
2342 |     ...options,
2343 |   });
2344 | };
2345 | 
2346 | /**
2347 |  * Get detailed listing information for a Pack.
2348 |  * Get detailed listing information for a Pack.
2349 |  *
2350 |  */
2351 | export const getPackListing = <ThrowOnError extends boolean = false>(
2352 |   options: Options<GetPackListingData, ThrowOnError>,
2353 | ) => {
2354 |   return (options.client ?? _heyApiClient).get<GetPackListingResponse, GetPackListingError, ThrowOnError>({
2355 |     security: [
2356 |       {
2357 |         scheme: "bearer",
2358 |         type: "http",
2359 |       },
2360 |     ],
2361 |     url: "/packs/{packId}/listing",
2362 |     ...options,
2363 |   });
2364 | };
2365 | 
2366 | /**
2367 |  * Retrieve the logs of a Pack.
2368 |  * Retrieve the logs of a Pack for debugging purpose.
2369 |  *
2370 |  */
2371 | export const listPackLogs = <ThrowOnError extends boolean = false>(
2372 |   options: Options<ListPackLogsData, ThrowOnError>,
2373 | ) => {
2374 |   return (options.client ?? _heyApiClient).get<ListPackLogsResponse, ListPackLogsError, ThrowOnError>({
2375 |     security: [
2376 |       {
2377 |         scheme: "bearer",
2378 |         type: "http",
2379 |       },
2380 |     ],
2381 |     querySerializer: {
2382 |       array: {
2383 |         explode: false,
2384 |         style: "form",
2385 |       },
2386 |     },
2387 |     url: "/packs/{packId}/docs/{docId}/logs",
2388 |     ...options,
2389 |   });
2390 | };
2391 | 
2392 | /**
2393 |  * Retrieve the logs of a Ingestion.
2394 |  * Retrieve the logs of a Ingestion for debugging purpose.
2395 |  */
2396 | export const listIngestionLogs = <ThrowOnError extends boolean = false>(
2397 |   options: Options<ListIngestionLogsData, ThrowOnError>,
2398 | ) => {
2399 |   return (options.client ?? _heyApiClient).get<ListIngestionLogsResponse, ListIngestionLogsError, ThrowOnError>({
2400 |     security: [
2401 |       {
2402 |         scheme: "bearer",
2403 |         type: "http",
2404 |       },
2405 |     ],
2406 |     querySerializer: {
2407 |       array: {
2408 |         explode: false,
2409 |         style: "form",
2410 |       },
2411 |     },
2412 |     url: "/packs/{packId}/organizationId/{organizationId}/rootIngestionId/{rootIngestionId}/logs",
2413 |     ...options,
2414 |   });
2415 | };
2416 | 
2417 | /**
2418 |  * Retrieve the grouped logs of a Pack.
2419 |  * Retrieve the grouped logs of a Pack for debugging purpose.
2420 |  *
2421 |  */
2422 | export const listGroupedPackLogs = <ThrowOnError extends boolean = false>(
2423 |   options: Options<ListGroupedPackLogsData, ThrowOnError>,
2424 | ) => {
2425 |   return (options.client ?? _heyApiClient).get<ListGroupedPackLogsResponse, ListGroupedPackLogsError, ThrowOnError>({
2426 |     security: [
2427 |       {
2428 |         scheme: "bearer",
2429 |         type: "http",
2430 |       },
2431 |     ],
2432 |     url: "/packs/{packId}/docs/{docId}/groupedLogs",
2433 |     ...options,
2434 |   });
2435 | };
2436 | 
2437 | /**
2438 |  * Retrieve the grouped logs of a Pack for a specific ingestionExecutionId.
2439 |  * Retrieve the grouped logs of a Pack for debugging purpose.
2440 |  *
2441 |  */
2442 | export const listGroupedIngestionLogs = <ThrowOnError extends boolean = false>(
2443 |   options: Options<ListGroupedIngestionLogsData, ThrowOnError>,
2444 | ) => {
2445 |   return (options.client ?? _heyApiClient).get<
2446 |     ListGroupedIngestionLogsResponse,
2447 |     ListGroupedIngestionLogsError,
2448 |     ThrowOnError
2449 |   >({
2450 |     security: [
2451 |       {
2452 |         scheme: "bearer",
2453 |         type: "http",
2454 |       },
2455 |     ],
2456 |     url: "/packs/{packId}/organizationId/{organizationId}/rootIngestionId/{rootIngestionId}/groupedLogs",
2457 |     ...options,
2458 |   });
2459 | };
2460 | 
2461 | /**
2462 |  * Retrieve a list of ingestion execution ids for the given root ingestion id.
2463 |  * Retrieve the ingestion execution ids of a root ingestion for debugging purpose.
2464 |  *
2465 |  */
2466 | export const listIngestionExecutions = <ThrowOnError extends boolean = false>(
2467 |   options: Options<ListIngestionExecutionsData, ThrowOnError>,
2468 | ) => {
2469 |   return (options.client ?? _heyApiClient).get<
2470 |     ListIngestionExecutionsResponse,
2471 |     ListIngestionExecutionsError,
2472 |     ThrowOnError
2473 |   >({
2474 |     security: [
2475 |       {
2476 |         scheme: "bearer",
2477 |         type: "http",
2478 |       },
2479 |     ],
2480 |     url: "/packs/{packId}/organizationId/{organizationId}/rootIngestionId/{rootIngestionId}/ingestionExecutions",
2481 |     ...options,
2482 |   });
2483 | };
2484 | 
2485 | /**
2486 |  * Retrieve a list of ingestion execution ids for the given root ingestion id.
2487 |  * Retrieve the ingestion execution ids of a root ingestion for debugging purpose.
2488 |  *
2489 |  */
2490 | export const listIngestionExecutionAttempts = <ThrowOnError extends boolean = false>(
2491 |   options: Options<ListIngestionExecutionAttemptsData, ThrowOnError>,
2492 | ) => {
2493 |   return (options.client ?? _heyApiClient).get<
2494 |     ListIngestionExecutionAttemptsResponse,
2495 |     ListIngestionExecutionAttemptsError,
2496 |     ThrowOnError
2497 |   >({
2498 |     security: [
2499 |       {
2500 |         scheme: "bearer",
2501 |         type: "http",
2502 |       },
2503 |     ],
2504 |     url: "/packs/{packId}/organizationId/{organizationId}/rootIngestionId/{rootIngestionId}/ingestionExecutionId/{ingestionExecutionId}/attempts",
2505 |     ...options,
2506 |   });
2507 | };
2508 | 
2509 | /**
2510 |  * Retrieve the information for a specific log.
2511 |  * Retrieve the ingestion execution ids of a root ingestion for debugging purpose.
2512 |  *
2513 |  */
2514 | export const getPackLogDetails = <ThrowOnError extends boolean = false>(
2515 |   options: Options<GetPackLogDetailsData, ThrowOnError>,
2516 | ) => {
2517 |   return (options.client ?? _heyApiClient).get<GetPackLogDetailsResponse, GetPackLogDetailsError, ThrowOnError>({
2518 |     security: [
2519 |       {
2520 |         scheme: "bearer",
2521 |         type: "http",
2522 |       },
2523 |     ],
2524 |     url: "/packs/{packId}/organizationId/{organizationId}/rootIngestionId/{rootIngestionId}/logs/{logId}",
2525 |     ...options,
2526 |   });
2527 | };
2528 | 
2529 | /**
2530 |  * List featured docs for a Pack
2531 |  * Returns a list of featured doc ids for a Pack.
2532 |  *
2533 |  */
2534 | export const listPackFeaturedDocs = <ThrowOnError extends boolean = false>(
2535 |   options: Options<ListPackFeaturedDocsData, ThrowOnError>,
2536 | ) => {
2537 |   return (options.client ?? _heyApiClient).get<ListPackFeaturedDocsResponse, ListPackFeaturedDocsError, ThrowOnError>({
2538 |     security: [
2539 |       {
2540 |         scheme: "bearer",
2541 |         type: "http",
2542 |       },
2543 |     ],
2544 |     url: "/packs/{packId}/featuredDocs",
2545 |     ...options,
2546 |   });
2547 | };
2548 | 
2549 | /**
2550 |  * Update featured docs for a Pack
2551 |  * Create or replace the featured docs for a Pack.
2552 |  *
2553 |  */
2554 | export const updatePackFeaturedDocs = <ThrowOnError extends boolean = false>(
2555 |   options: Options<UpdatePackFeaturedDocsData, ThrowOnError>,
2556 | ) => {
2557 |   return (options.client ?? _heyApiClient).put<
2558 |     UpdatePackFeaturedDocsResponse2,
2559 |     UpdatePackFeaturedDocsError,
2560 |     ThrowOnError
2561 |   >({
2562 |     security: [
2563 |       {
2564 |         scheme: "bearer",
2565 |         type: "http",
2566 |       },
2567 |     ],
2568 |     url: "/packs/{packId}/featuredDocs",
2569 |     ...options,
2570 |     headers: {
2571 |       "Content-Type": "application/json",
2572 |       ...options?.headers,
2573 |     },
2574 |   });
2575 | };
2576 | 
2577 | /**
2578 |  * Add a go link
2579 |  * Adds a new go link for the organization.
2580 |  */
2581 | export const addGoLink = <ThrowOnError extends boolean = false>(options: Options<AddGoLinkData, ThrowOnError>) => {
2582 |   return (options.client ?? _heyApiClient).post<AddGoLinkResponse, AddGoLinkError, ThrowOnError>({
2583 |     security: [
2584 |       {
2585 |         scheme: "bearer",
2586 |         type: "http",
2587 |       },
2588 |     ],
2589 |     url: "/organizations/{organizationId}/goLinks",
2590 |     ...options,
2591 |     headers: {
2592 |       "Content-Type": "application/json",
2593 |       ...options?.headers,
2594 |     },
2595 |   });
2596 | };
2597 | 
```
Page 1/2FirstPrevNextLast