Skip to content

armgit / macro

Public Imported from GitHub
0

Macro is a unified workspace for teams: email, chat, docs, tasks, agents, calls, and CRM — @-linked together with shared AI memory.

feat: add user_api_key hex crate and DSS routes (#6061)

Will Hutchinson27ae8b9ea745
diff --git a/.github/workspace-dep-closures.json b/.github/workspace-dep-closures.json
index 34619042db..01ae531300 100644
--- a/.github/workspace-dep-closures.json
+++ b/.github/workspace-dep-closures.json
@@ -2795,6 +2795,7 @@
"crates/task_dedup",
"crates/teams",
"crates/unfurl",
+ "crates/user_api_key",
"crates/user_quota",
"crates/webhook",
"crates/webhook_signature",
@@ -7846,6 +7847,21 @@
"crates/workspace-hack",
"services/upload_extractor_lambda_trigger"
],
+ "user_api_key": [
+ "crates/bot_id",
+ "crates/bot_token",
+ "crates/cowlike",
+ "crates/macro_auth",
+ "crates/macro_authorization",
+ "crates/macro_env",
+ "crates/macro_env_var",
+ "crates/macro_user_id",
+ "crates/model-error-response",
+ "crates/model_user",
+ "crates/remote_env_var",
+ "crates/user_api_key",
+ "crates/workspace-hack"
+ ],
"user_link_cleanup_handler": [
"crates/agent",
"crates/ai_toolset",
diff --git a/.sqlx/query-3e7026d3b162fdaa70f9650a45148ff90343bd3d17ca5715eff25fe8315ec8e1.json b/.sqlx/query-3e7026d3b162fdaa70f9650a45148ff90343bd3d17ca5715eff25fe8315ec8e1.json
new file mode 100644
index 0000000000..4852037f3d
--- /dev/null
+++ b/.sqlx/query-3e7026d3b162fdaa70f9650a45148ff90343bd3d17ca5715eff25fe8315ec8e1.json
@@ -0,0 +1,15 @@
+{
+ "db_name": "PostgreSQL",
+ "query": "\n DELETE FROM \"UserApiKey\"\n WHERE user_id = $1 AND id = $2\n ",
+ "describe": {
+ "columns": [],
+ "parameters": {
+ "Left": [
+ "Text",
+ "Uuid"
+ ]
+ },
+ "nullable": []
+ },
+ "hash": "3e7026d3b162fdaa70f9650a45148ff90343bd3d17ca5715eff25fe8315ec8e1"
+}
diff --git a/.sqlx/query-6fbfd0102ede6268fb3289d4f93eef6505d272859a0a1f09c392e6a1407ac454.json b/.sqlx/query-6fbfd0102ede6268fb3289d4f93eef6505d272859a0a1f09c392e6a1407ac454.json
new file mode 100644
index 0000000000..a9a352953d
--- /dev/null
+++ b/.sqlx/query-6fbfd0102ede6268fb3289d4f93eef6505d272859a0a1f09c392e6a1407ac454.json
@@ -0,0 +1,37 @@
+{
+ "db_name": "PostgreSQL",
+ "query": "\n INSERT INTO \"UserApiKey\" (id, name, user_id, hash)\n VALUES ($1, $2, $3, $4)\n RETURNING id, name, created_at\n ",
+ "describe": {
+ "columns": [
+ {
+ "ordinal": 0,
+ "name": "id",
+ "type_info": "Uuid"
+ },
+ {
+ "ordinal": 1,
+ "name": "name",
+ "type_info": "Text"
+ },
+ {
+ "ordinal": 2,
+ "name": "created_at",
+ "type_info": "Timestamptz"
+ }
+ ],
+ "parameters": {
+ "Left": [
+ "Uuid",
+ "Text",
+ "Text",
+ "Bytea"
+ ]
+ },
+ "nullable": [
+ false,
+ false,
+ false
+ ]
+ },
+ "hash": "6fbfd0102ede6268fb3289d4f93eef6505d272859a0a1f09c392e6a1407ac454"
+}
diff --git a/.sqlx/query-823971630e4fc6d877137efe0ebbde52a2217988eb9ee2f8f7ffbd7c2673c0ef.json b/.sqlx/query-823971630e4fc6d877137efe0ebbde52a2217988eb9ee2f8f7ffbd7c2673c0ef.json
new file mode 100644
index 0000000000..fd0675b565
--- /dev/null
+++ b/.sqlx/query-823971630e4fc6d877137efe0ebbde52a2217988eb9ee2f8f7ffbd7c2673c0ef.json
@@ -0,0 +1,22 @@
+{
+ "db_name": "PostgreSQL",
+ "query": "\n SELECT user_id\n FROM \"UserApiKey\"\n WHERE hash = $1\n ",
+ "describe": {
+ "columns": [
+ {
+ "ordinal": 0,
+ "name": "user_id",
+ "type_info": "Text"
+ }
+ ],
+ "parameters": {
+ "Left": [
+ "Bytea"
+ ]
+ },
+ "nullable": [
+ false
+ ]
+ },
+ "hash": "823971630e4fc6d877137efe0ebbde52a2217988eb9ee2f8f7ffbd7c2673c0ef"
+}
diff --git a/.sqlx/query-bfc52f6c1718181466f4aca134e44d1e38ff4e1af69a97a558a94cd6756e5ca4.json b/.sqlx/query-bfc52f6c1718181466f4aca134e44d1e38ff4e1af69a97a558a94cd6756e5ca4.json
new file mode 100644
index 0000000000..3b4b166e88
--- /dev/null
+++ b/.sqlx/query-bfc52f6c1718181466f4aca134e44d1e38ff4e1af69a97a558a94cd6756e5ca4.json
@@ -0,0 +1,22 @@
+{
+ "db_name": "PostgreSQL",
+ "query": "SELECT COUNT(*) as \"count!\" FROM \"UserApiKey\" WHERE user_id = $1",
+ "describe": {
+ "columns": [
+ {
+ "ordinal": 0,
+ "name": "count!",
+ "type_info": "Int8"
+ }
+ ],
+ "parameters": {
+ "Left": [
+ "Text"
+ ]
+ },
+ "nullable": [
+ null
+ ]
+ },
+ "hash": "bfc52f6c1718181466f4aca134e44d1e38ff4e1af69a97a558a94cd6756e5ca4"
+}
diff --git a/.sqlx/query-cfdaf34794b6c52ff8a329fe8d3748a115525a1f4f68aa0f0e051c0b19aae50d.json b/.sqlx/query-cfdaf34794b6c52ff8a329fe8d3748a115525a1f4f68aa0f0e051c0b19aae50d.json
new file mode 100644
index 0000000000..cc2f97ac1a
--- /dev/null
+++ b/.sqlx/query-cfdaf34794b6c52ff8a329fe8d3748a115525a1f4f68aa0f0e051c0b19aae50d.json
@@ -0,0 +1,34 @@
+{
+ "db_name": "PostgreSQL",
+ "query": "\n SELECT id, name, created_at\n FROM \"UserApiKey\"\n WHERE user_id = $1\n ORDER BY created_at DESC, id DESC\n ",
+ "describe": {
+ "columns": [
+ {
+ "ordinal": 0,
+ "name": "id",
+ "type_info": "Uuid"
+ },
+ {
+ "ordinal": 1,
+ "name": "name",
+ "type_info": "Text"
+ },
+ {
+ "ordinal": 2,
+ "name": "created_at",
+ "type_info": "Timestamptz"
+ }
+ ],
+ "parameters": {
+ "Left": [
+ "Text"
+ ]
+ },
+ "nullable": [
+ false,
+ false,
+ false
+ ]
+ },
+ "hash": "cfdaf34794b6c52ff8a329fe8d3748a115525a1f4f68aa0f0e051c0b19aae50d"
+}
diff --git a/Cargo.lock b/Cargo.lock
index fe54235272..6eb61a21e1 100644
--- a/Cargo.lock
+++ b/Cargo.lock
@@ -5168,6 +5168,7 @@ dependencies = [
"tracing",
"unicode-segmentation",
"urlencoding",
+ "user_api_key",
"utoipa",
"utoipa-swagger-ui",
"uuid",
@@ -17061,6 +17062,31 @@ version = "2.1.3"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "daf8dba3b7eb870caf1ddeed7bc9d2a049f3cfdfae7cb521b087cc33ae4c49da"
+[[package]]
+name = "user_api_key"
+version = "0.1.0"
+dependencies = [
+ "axum",
+ "chrono",
+ "hex",
+ "macro_authorization",
+ "macro_db_migrator",
+ "macro_user_id",
+ "model-error-response",
+ "rand 0.9.4",
+ "rootcause",
+ "serde",
+ "serde_json",
+ "sha2 0.10.9",
+ "sqlx",
+ "thiserror 2.0.18",
+ "tokio",
+ "tracing",
+ "utoipa",
+ "uuid",
+ "workspace-hack",
+]
+
[[package]]
name = "user_link_cleanup_handler"
version = "0.1.0"
diff --git a/Cargo.toml b/Cargo.toml
index 2234ec3238..7a196047c4 100644
--- a/Cargo.toml
+++ b/Cargo.toml
@@ -72,6 +72,7 @@ members = [
"crates/system_skills",
"crates/task_dedup",
"crates/unfurl",
+ "crates/user_api_key",
"crates/webhook_signature",
"crates/worker-rs-otel",
"crates/workspace-hack",
diff --git a/apps/web/src/lib/service-clients/service-storage/generated/schemas/createUserApiKeyRequest.ts b/apps/web/src/lib/service-clients/service-storage/generated/schemas/createUserApiKeyRequest.ts
new file mode 100644
index 0000000000..6d79eab70e
--- /dev/null
+++ b/apps/web/src/lib/service-clients/service-storage/generated/schemas/createUserApiKeyRequest.ts
@@ -0,0 +1,14 @@
+/**
+ * Generated by orval v7.21.0 🍺
+ * Do not edit manually.
+ * document_storage_service
+ * OpenAPI spec version: 0.1.0
+ */
+
+/**
+ * Request body for minting a key.
+ */
+export interface CreateUserApiKeyRequest {
+ /** User-facing name for the key. */
+ name: string;
+}
diff --git a/apps/web/src/lib/service-clients/service-storage/generated/schemas/createdUserApiKey.ts b/apps/web/src/lib/service-clients/service-storage/generated/schemas/createdUserApiKey.ts
new file mode 100644
index 0000000000..639828d710
--- /dev/null
+++ b/apps/web/src/lib/service-clients/service-storage/generated/schemas/createdUserApiKey.ts
@@ -0,0 +1,21 @@
+/**
+ * Generated by orval v7.21.0 🍺
+ * Do not edit manually.
+ * document_storage_service
+ * OpenAPI spec version: 0.1.0
+ */
+import type { UserApiKeyId } from './userApiKeyId';
+
+/**
+ * A newly minted key: safe metadata plus the secret, shown only once.
+ */
+export interface CreatedUserApiKey {
+ /** When the key was created. */
+ createdAt: string;
+ /** Opaque identifier used to address the key after create. */
+ id: UserApiKeyId;
+ /** The newly minted secret. Shown only on create. */
+ key: string;
+ /** User-facing name. */
+ name: string;
+}
diff --git a/apps/web/src/lib/service-clients/service-storage/generated/schemas/index.ts b/apps/web/src/lib/service-clients/service-storage/generated/schemas/index.ts
index 91005c6ea2..59cf12bfa4 100644
--- a/apps/web/src/lib/service-clients/service-storage/generated/schemas/index.ts
+++ b/apps/web/src/lib/service-clients/service-storage/generated/schemas/index.ts
@@ -348,6 +348,7 @@ export * from './createDocumentRequestTeamId';
export * from './createDocumentResponseData';
export * from './createDocumentResponseDataAllOf';
export * from './createDocumentResponseDataAllOfFileType';
+export * from './createdUserApiKey';
export * from './createEntityMentionRequest';
export * from './createEntityMentionResponse';
export * from './createEntityMentionResponseUserId';
@@ -394,6 +395,7 @@ export * from './createUnthreadedPdfAnchorRequest';
export * from './createUnthreadedPdfAnchorRequestOneOf';
export * from './createUnthreadedPdfAnchorRequestOneOfAllOf';
export * from './createUnthreadedPdfAnchorRequestOneOfAllOfAnchorType';
+export * from './createUserApiKeyRequest';
export * from './createViewRequest';
export * from './createWebhookRequest';
export * from './createWebhookRequestHeaders';
@@ -1201,6 +1203,9 @@ export * from './uploadFolderHandler200DataOneOf';
export * from './uploadFolderRequest';
export * from './uploadFolderRequestParentId';
export * from './upsertUserDocumentViewLocationRequest';
+export * from './userApiKeyId';
+export * from './userApiKeyInfo';
+export * from './userApiKeysList';
export * from './userDocumentsResponse';
export * from './userDocumentsResponseNextOffset';
export * from './userDocumentViewLocation';
diff --git a/apps/web/src/lib/service-clients/service-storage/generated/schemas/userApiKeyId.ts b/apps/web/src/lib/service-clients/service-storage/generated/schemas/userApiKeyId.ts
new file mode 100644
index 0000000000..7e92059dc4
--- /dev/null
+++ b/apps/web/src/lib/service-clients/service-storage/generated/schemas/userApiKeyId.ts
@@ -0,0 +1,11 @@
+/**
+ * Generated by orval v7.21.0 🍺
+ * Do not edit manually.
+ * document_storage_service
+ * OpenAPI spec version: 0.1.0
+ */
+
+/**
+ * Opaque identifier for a stored user API key.
+ */
+export type UserApiKeyId = string;
diff --git a/apps/web/src/lib/service-clients/service-storage/generated/schemas/userApiKeyInfo.ts b/apps/web/src/lib/service-clients/service-storage/generated/schemas/userApiKeyInfo.ts
new file mode 100644
index 0000000000..688037409b
--- /dev/null
+++ b/apps/web/src/lib/service-clients/service-storage/generated/schemas/userApiKeyInfo.ts
@@ -0,0 +1,19 @@
+/**
+ * Generated by orval v7.21.0 🍺
+ * Do not edit manually.
+ * document_storage_service
+ * OpenAPI spec version: 0.1.0
+ */
+import type { UserApiKeyId } from './userApiKeyId';
+
+/**
+ * Safe metadata for a stored key. Never contains the secret or its hash.
+ */
+export interface UserApiKeyInfo {
+ /** When the key was created. */
+ createdAt: string;
+ /** Opaque identifier used to address the key after create. */
+ id: UserApiKeyId;
+ /** User-facing name. */
+ name: string;
+}
diff --git a/apps/web/src/lib/service-clients/service-storage/generated/schemas/userApiKeysList.ts b/apps/web/src/lib/service-clients/service-storage/generated/schemas/userApiKeysList.ts
new file mode 100644
index 0000000000..98ee9d533a
--- /dev/null
+++ b/apps/web/src/lib/service-clients/service-storage/generated/schemas/userApiKeysList.ts
@@ -0,0 +1,15 @@
+/**
+ * Generated by orval v7.21.0 🍺
+ * Do not edit manually.
+ * document_storage_service
+ * OpenAPI spec version: 0.1.0
+ */
+import type { UserApiKeyInfo } from './userApiKeyInfo';
+
+/**
+ * The caller's API keys as id, name, and created_at.
+ */
+export interface UserApiKeysList {
+ /** The caller's keys. Never includes the raw secret or hash. */
+ keys: UserApiKeyInfo[];
+}
diff --git a/apps/web/src/lib/service-clients/service-storage/generated/zod.ts b/apps/web/src/lib/service-clients/service-storage/generated/zod.ts
index c60ca23c70..e722c4b2ae 100644
--- a/apps/web/src/lib/service-clients/service-storage/generated/zod.ts
+++ b/apps/web/src/lib/service-clients/service-storage/generated/zod.ts
@@ -27012,6 +27012,47 @@ export const editThreadV2Response = zod.object({
error: zod.boolean().describe('Indicates if an error occurred'),
});
+/**
+ * @summary List the caller's API keys.
+ */
+export const listUserApiKeysResponse = zod
+ .object({
+ keys: zod
+ .array(
+ zod
+ .object({
+ createdAt: zod.iso
+ .datetime({})
+ .describe('When the key was created.'),
+ id: zod
+ .uuid()
+ .describe('Opaque identifier for a stored user API key.'),
+ name: zod.string().describe('User-facing name.'),
+ })
+ .describe(
+ 'Safe metadata for a stored key. Never contains the secret or its hash.'
+ )
+ )
+ .describe("The caller's keys. Never includes the raw secret or hash."),
+ })
+ .describe("The caller's API keys as id, name, and created_at.");
+
+/**
+ * @summary Mint a new API key for the caller.
+ */
+export const createUserApiKeyBody = zod
+ .object({
+ name: zod.string().describe('User-facing name for the key.'),
+ })
+ .describe('Request body for minting a key.');
+
+/**
+ * @summary Delete one of the caller's API keys.
+ */
+export const deleteUserApiKeyParams = zod.object({
+ id: zod.uuid().describe('Opaque key identifier.'),
+});
+
/**
* @summary Gets a UserPdfDocumentLocation entry
*/
diff --git a/apps/web/src/lib/service-clients/service-storage/openapi.json b/apps/web/src/lib/service-clients/service-storage/openapi.json
index 9e299d9e03..12d504ca64 100644
--- a/apps/web/src/lib/service-clients/service-storage/openapi.json
+++ b/apps/web/src/lib/service-clients/service-storage/openapi.json
@@ -10798,6 +10798,155 @@
}
}
},
+ "/user-api-keys": {
+ "get": {
+ "tags": ["user-api-keys"],
+ "summary": "List the caller's API keys.",
+ "operationId": "list_user_api_keys",
+ "responses": {
+ "200": {
+ "description": "",
+ "content": {
+ "application/json": {
+ "schema": {
+ "$ref": "#/components/schemas/UserApiKeysList"
+ }
+ }
+ }
+ },
+ "401": {
+ "description": "",
+ "content": {
+ "application/json": {
+ "schema": {
+ "$ref": "#/components/schemas/ErrorResponse"
+ }
+ }
+ }
+ },
+ "500": {
+ "description": "",
+ "content": {
+ "application/json": {
+ "schema": {
+ "$ref": "#/components/schemas/ErrorResponse"
+ }
+ }
+ }
+ }
+ }
+ },
+ "post": {
+ "tags": ["user-api-keys"],
+ "summary": "Mint a new API key for the caller.",
+ "operationId": "create_user_api_key",
+ "requestBody": {
+ "content": {
+ "application/json": {
+ "schema": {
+ "$ref": "#/components/schemas/CreateUserApiKeyRequest"
+ }
+ }
+ },
+ "required": true
+ },
+ "responses": {
+ "201": {
+ "description": "",
+ "content": {
+ "application/json": {
+ "schema": {
+ "$ref": "#/components/schemas/CreatedUserApiKey"
+ }
+ }
+ }
+ },
+ "400": {
+ "description": "",
+ "content": {
+ "application/json": {
+ "schema": {
+ "$ref": "#/components/schemas/ErrorResponse"
+ }
+ }
+ }
+ },
+ "401": {
+ "description": "",
+ "content": {
+ "application/json": {
+ "schema": {
+ "$ref": "#/components/schemas/ErrorResponse"
+ }
+ }
+ }
+ },
+ "500": {
+ "description": "",
+ "content": {
+ "application/json": {
+ "schema": {
+ "$ref": "#/components/schemas/ErrorResponse"
+ }
+ }
+ }
+ }
+ }
+ }
+ },
+ "/user-api-keys/{id}": {
+ "delete": {
+ "tags": ["user-api-keys"],
+ "summary": "Delete one of the caller's API keys.",
+ "operationId": "delete_user_api_key",
+ "parameters": [
+ {
+ "name": "id",
+ "in": "path",
+ "description": "Opaque key identifier.",
+ "required": true,
+ "schema": {
+ "$ref": "#/components/schemas/UserApiKeyId"
+ }
+ }
+ ],
+ "responses": {
+ "204": {
+ "description": "API key deleted"
+ },
+ "401": {
+ "description": "",
+ "content": {
+ "application/json": {
+ "schema": {
+ "$ref": "#/components/schemas/ErrorResponse"
+ }
+ }
+ }
+ },
+ "404": {
+ "description": "",
+ "content": {
+ "application/json": {
+ "schema": {
+ "$ref": "#/components/schemas/ErrorResponse"
+ }
+ }
+ }
+ },
+ "500": {
+ "description": "",
+ "content": {
+ "application/json": {
+ "schema": {
+ "$ref": "#/components/schemas/ErrorResponse"
+ }
+ }
+ }
+ }
+ }
+ }
+ },
"/user_document_view_location/{document_id}": {
"get": {
"tags": [
@@ -16100,6 +16249,17 @@
}
]
},
+ "CreateUserApiKeyRequest": {
+ "type": "object",
+ "description": "Request body for minting a key.",
+ "required": ["name"],
+ "properties": {
+ "name": {
+ "type": "string",
+ "description": "User-facing name for the key."
+ }
+ }
+ },
"CreateViewRequest": {
"type": "object",
"required": ["name", "config"],
@@ -16228,6 +16388,30 @@
}
}
},
+ "CreatedUserApiKey": {
+ "type": "object",
+ "description": "A newly minted key: safe metadata plus the secret, shown only once.",
+ "required": ["id", "name", "createdAt", "key"],
+ "properties": {
+ "createdAt": {
+ "type": "string",
+ "format": "date-time",
+ "description": "When the key was created."
+ },
+ "id": {
+ "$ref": "#/components/schemas/UserApiKeyId",
+ "description": "Opaque identifier used to address the key after create."
+ },
+ "key": {
+ "type": "string",
+ "description": "The newly minted secret. Shown only on create."
+ },
+ "name": {
+ "type": "string",
+ "description": "User-facing name."
+ }
+ }
+ },
"CrmComment": {
"type": "object",
"description": "A single comment within a [`CrmThread`].",
@@ -24698,6 +24882,45 @@
}
}
},
+ "UserApiKeyId": {
+ "type": "string",
+ "format": "uuid",
+ "description": "Opaque identifier for a stored user API key."
+ },
+ "UserApiKeyInfo": {
+ "type": "object",
+ "description": "Safe metadata for a stored key. Never contains the secret or its hash.",
+ "required": ["id", "name", "createdAt"],
+ "properties": {
+ "createdAt": {
+ "type": "string",
+ "format": "date-time",
+ "description": "When the key was created."
+ },
+ "id": {
+ "$ref": "#/components/schemas/UserApiKeyId",
+ "description": "Opaque identifier used to address the key after create."
+ },
+ "name": {
+ "type": "string",
+ "description": "User-facing name."
+ }
+ }
+ },
+ "UserApiKeysList": {
+ "type": "object",
+ "description": "The caller's API keys as id, name, and created_at.",
+ "required": ["keys"],
+ "properties": {
+ "keys": {
+ "type": "array",
+ "items": {
+ "$ref": "#/components/schemas/UserApiKeyInfo"
+ },
+ "description": "The caller's keys. Never includes the raw secret or hash."
+ }
+ }
+ },
"UserDocumentViewLocation": {
"type": "object",
"description": "The last place a user viewed a particular document at",
diff --git a/crates/macro_db_client/migrations/20260831172113_user_api_key_id_name_hash.sql b/crates/macro_db_client/migrations/20260831172113_user_api_key_id_name_hash.sql
new file mode 100644
index 0000000000..ce0274cd84
--- /dev/null
+++ b/crates/macro_db_client/migrations/20260831172113_user_api_key_id_name_hash.sql
@@ -0,0 +1,44 @@
+-- User API keys: opaque UUIDv7 id, user-facing name, SHA-256 hash, created_at.
+-- New rows get id from application code (CS-01). Existing rows are backfilled
+-- from the legacy plaintext `key` column, which is then dropped.
+ALTER TABLE "UserApiKey"
+ ADD COLUMN id UUID,
+ ADD COLUMN name TEXT,
+ ADD COLUMN hash BYTEA,
+ ADD COLUMN created_at TIMESTAMPTZ NOT NULL DEFAULT now();
+
+UPDATE "UserApiKey"
+SET
+ id = encode(
+ substring(digest(convert_to(key, 'UTF8'), 'sha256') FROM 1 FOR 16),
+ 'hex'
+ )::uuid,
+ name = 'Unnamed',
+ hash = digest(convert_to(key, 'UTF8'), 'sha256')
+WHERE id IS NULL
+ OR name IS NULL
+ OR hash IS NULL;
+
+ALTER TABLE "UserApiKey"
+ ALTER COLUMN id SET NOT NULL,
+ ALTER COLUMN name SET NOT NULL,
+ ALTER COLUMN hash SET NOT NULL;
+
+ALTER TABLE "UserApiKey" DROP CONSTRAINT "UserApiKey_pkey";
+
+DROP INDEX IF EXISTS "UserApiKey_key_key";
+DROP INDEX IF EXISTS "UserApiKey_key_idx";
+
+ALTER TABLE "UserApiKey"
+ DROP COLUMN key;
+
+ALTER TABLE "UserApiKey" ADD CONSTRAINT "UserApiKey_pkey" PRIMARY KEY (id);
+
+CREATE UNIQUE INDEX "UserApiKey_hash_key" ON "UserApiKey" (hash);
+
+-- List filters by user_id and orders by created_at DESC, id DESC. Count
+-- filters by user_id. This composite covers both; the old user_id-only
+-- index is redundant.
+DROP INDEX IF EXISTS "UserApiKey_user_id_idx";
+CREATE INDEX "UserApiKey_user_id_created_at_id_idx"
+ ON "UserApiKey" (user_id, created_at DESC, id DESC);
diff --git a/crates/user_api_key/Cargo.toml b/crates/user_api_key/Cargo.toml
new file mode 100644
index 0000000000..2f91d210ce
--- /dev/null
+++ b/crates/user_api_key/Cargo.toml
@@ -0,0 +1,42 @@
+[package]
+edition = "2024"
+name = "user_api_key"
+publish = false
+version = "0.1.0"
+
+[features]
+default = []
+inbound = [
+ "dep:axum",
+ "dep:macro_authorization",
+ "dep:model-error-response",
+ "dep:utoipa",
+ "ports",
+]
+outbound = ["ports"]
+ports = ["dep:tracing"]
+postgres = ["dep:sqlx", "outbound"]
+
+[dependencies]
+axum = { workspace = true, optional = true }
+chrono = { workspace = true, features = ["serde"] }
+hex = { workspace = true }
+macro_authorization = { path = "../macro_authorization", optional = true, default-features = false, features = ["axum"] }
+macro_user_id = { path = "../macro_user_id" }
+model-error-response = { path = "../model-error-response", optional = true }
+rand = { workspace = true }
+rootcause = { workspace = true }
+serde = { workspace = true }
+sha2 = { workspace = true }
+sqlx = { workspace = true, optional = true }
+thiserror = { workspace = true }
+tracing = { workspace = true, optional = true }
+utoipa = { workspace = true, optional = true }
+uuid = { workspace = true, features = ["serde", "v7"] }
+workspace-hack = { version = "0.1", path = "../workspace-hack" }
+
+[dev-dependencies]
+macro_db_migrator = { path = "../macro_db_migrator" }
+serde_json = { workspace = true }
+tokio = { workspace = true, features = ["macros", "rt-multi-thread"] }
+uuid = { workspace = true, features = ["v7"] }
diff --git a/crates/user_api_key/src/domain.rs b/crates/user_api_key/src/domain.rs
new file mode 100644
index 0000000000..34c19bbe93
--- /dev/null
+++ b/crates/user_api_key/src/domain.rs
@@ -0,0 +1,7 @@
+//! Domain layer for user API keys.
+
+pub mod models;
+#[cfg(feature = "ports")]
+pub mod ports;
+#[cfg(feature = "ports")]
+pub mod service;
diff --git a/crates/user_api_key/src/domain/models.rs b/crates/user_api_key/src/domain/models.rs
new file mode 100644
index 0000000000..35594b424c
--- /dev/null
+++ b/crates/user_api_key/src/domain/models.rs
@@ -0,0 +1,198 @@
+//! Domain models for user API keys.
+
+use std::fmt;
+use std::str::FromStr;
+
+use chrono::{DateTime, Utc};
+use rand::RngCore;
+use serde::{Deserialize, Serialize};
+use sha2::{Digest, Sha256};
+use uuid::Uuid;
+
+/// Prefix written onto every newly minted key.
+pub const KEY_PREFIX: &str = "mak_";
+
+/// Entropy used when minting a key (32 bytes → 64 hex characters).
+const KEY_SECRET_BYTES: usize = 32;
+
+/// Maximum length of a user-facing key name.
+pub const MAX_KEY_NAME_LEN: usize = 100;
+
+/// Opaque identifier for a stored user API key.
+#[derive(Debug, Clone, Copy, PartialEq, Eq, Hash, Serialize, Deserialize)]
+#[cfg_attr(feature = "inbound", derive(utoipa::ToSchema))]
+#[serde(transparent)]
+pub struct UserApiKeyId(Uuid);
+
+impl UserApiKeyId {
+ /// Mint a new UUIDv7 identifier.
+ pub fn generate() -> Self {
+ Self(Uuid::now_v7())
+ }
+
+ /// Wrap an already-persisted id.
+ pub fn from_uuid(id: Uuid) -> Self {
+ Self(id)
+ }
+
+ /// The inner UUID.
+ pub fn as_uuid(&self) -> Uuid {
+ self.0
+ }
+}
+
+impl fmt::Display for UserApiKeyId {
+ fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result {
+ write!(f, "{}", self.0)
+ }
+}
+
+impl FromStr for UserApiKeyId {
+ type Err = uuid::Error;
+
+ fn from_str(s: &str) -> Result<Self, Self::Err> {
+ Ok(Self(Uuid::parse_str(s)?))
+ }
+}
+
+/// SHA-256 of a raw user API key's UTF-8 bytes.
+///
+/// Same SHA-256 UTF-8 digest used for bot tokens: persist this, never the secret.
+pub fn hash_key(key: &str) -> [u8; 32] {
+ Sha256::digest(key.as_bytes()).into()
+}
+
+/// A user API key secret.
+///
+/// [`Debug`] redacts to `mak_…` plus the last four characters so
+/// `#[tracing::instrument]` cannot leak the full secret.
+#[derive(Clone, PartialEq, Eq, Hash, Serialize, Deserialize)]
+#[serde(transparent)]
+pub struct UserApiKey(String);
+
+impl UserApiKey {
+ /// Mint a new `mak_` + 64-hex-character key from OS CSPRNG bytes.
+ pub fn generate() -> Self {
+ let mut secret = [0_u8; KEY_SECRET_BYTES];
+ rand::rng().fill_bytes(&mut secret);
+ Self(format!("{KEY_PREFIX}{}", hex::encode(secret)))
+ }
+
+ /// Wrap an already-persisted or caller-supplied secret.
+ ///
+ /// Does not validate format: legacy rows may predate the `mak_` prefix.
+ pub fn from_raw(raw: impl Into<String>) -> Self {
+ Self(raw.into())
+ }
+
+ /// The only way to read the full secret.
+ pub fn expose(&self) -> &str {
+ &self.0
+ }
+
+ /// SHA-256 of the secret, for persistence and lookup.
+ pub fn hash(&self) -> [u8; 32] {
+ hash_key(self.expose())
+ }
+}
+
+impl AsRef<str> for UserApiKey {
+ fn as_ref(&self) -> &str {
+ self.expose()
+ }
+}
+
+impl fmt::Debug for UserApiKey {
+ fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result {
+ let raw = self.expose();
+ let suffix = raw.get(raw.len().saturating_sub(4)..).unwrap_or("");
+ write!(f, "mak_…{suffix}")
+ }
+}
+
+/// Safe metadata for a stored key. Never contains the secret or its hash.
+#[derive(Debug, Clone, Serialize, Deserialize)]
+#[cfg_attr(feature = "inbound", derive(utoipa::ToSchema))]
+#[serde(rename_all = "camelCase")]
+pub struct UserApiKeyInfo {
+ /// Opaque identifier used to address the key after create.
+ pub id: UserApiKeyId,
+ /// User-facing name.
+ pub name: String,
+ /// When the key was created.
+ pub created_at: DateTime<Utc>,
+}
+
+/// A newly minted key: safe metadata plus the secret, shown only once.
+#[derive(Clone, Serialize, Deserialize)]
+#[cfg_attr(feature = "inbound", derive(utoipa::ToSchema))]
+#[serde(rename_all = "camelCase")]
+pub struct CreatedUserApiKey {
+ /// Opaque identifier used to address the key after create.
+ pub id: UserApiKeyId,
+ /// User-facing name.
+ pub name: String,
+ /// When the key was created.
+ pub created_at: DateTime<Utc>,
+ /// The newly minted secret. Shown only on create.
+ pub key: String,
+}
+
+impl fmt::Debug for CreatedUserApiKey {
+ fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result {
+ f.debug_struct("CreatedUserApiKey")
+ .field("id", &self.id)
+ .field("name", &self.name)
+ .field("created_at", &self.created_at)
+ .field("key", &UserApiKey::from_raw(&self.key))
+ .finish()
+ }
+}
+
+impl CreatedUserApiKey {
+ /// Build a create response from persisted metadata and the raw secret.
+ pub fn new(info: UserApiKeyInfo, key: &UserApiKey) -> Self {
+ Self {
+ id: info.id,
+ name: info.name,
+ created_at: info.created_at,
+ key: key.expose().to_string(),
+ }
+ }
+}
+
+/// Normalize and validate a user-facing key name.
+pub fn normalize_key_name(name: &str) -> Result<String, UserApiKeyError> {
+ let name = name.trim();
+ if name.is_empty() {
+ return Err(UserApiKeyError::BadRequest(
+ "api key name must not be empty".to_string(),
+ ));
+ }
+ if name.chars().count() > MAX_KEY_NAME_LEN {
+ return Err(UserApiKeyError::BadRequest(format!(
+ "api key name must be at most {MAX_KEY_NAME_LEN} characters"
+ )));
+ }
+ Ok(name.to_string())
+}
+
+/// Errors returned by the user API key service.
+#[derive(Debug, thiserror::Error)]
+pub enum UserApiKeyError {
+ /// The key does not exist in the caller's collection.
+ #[error("api key not found")]
+ NotFound,
+ /// The request was invalid.
+ #[error("{0}")]
+ BadRequest(String),
+ /// Any other internal error.
+ #[error("internal user api key error: {0:?}")]
+ Internal(rootcause::Report),
+}
+
+impl From<rootcause::Report> for UserApiKeyError {
+ fn from(report: rootcause::Report) -> Self {
+ UserApiKeyError::Internal(report)
+ }
+}
diff --git a/crates/user_api_key/src/domain/ports.rs b/crates/user_api_key/src/domain/ports.rs
new file mode 100644
index 0000000000..4a4b87f9d4
--- /dev/null
+++ b/crates/user_api_key/src/domain/ports.rs
@@ -0,0 +1,78 @@
+//! Ports (trait contracts) for the user API key domain.
+
+use macro_user_id::user_id::MacroUserIdStr;
+
+use crate::domain::models::{
+ CreatedUserApiKey, UserApiKey, UserApiKeyError, UserApiKeyId, UserApiKeyInfo,
+};
+
+/// Outbound persistence port for user API keys.
+///
+/// Every mutating and listing method is scoped to a user: a key belonging to
+/// someone else simply misses rather than erroring.
+pub trait UserApiKeysRepo: Send + Sync + 'static {
+ /// The error type returned by repository operations.
+ type Err: std::error::Error + Send + Sync + 'static;
+
+ /// Persist a newly minted key for the user. `hash` is SHA-256 of the secret.
+ fn insert_key(
+ &self,
+ user_id: &MacroUserIdStr<'_>,
+ id: UserApiKeyId,
+ name: &str,
+ hash: &[u8; 32],
+ ) -> impl Future<Output = Result<UserApiKeyInfo, Self::Err>> + Send;
+
+ /// Count the keys currently in the user's collection.
+ fn count_keys(
+ &self,
+ user_id: &MacroUserIdStr<'_>,
+ ) -> impl Future<Output = Result<i64, Self::Err>> + Send;
+
+ /// List the user's keys as id, name, and created_at, newest first.
+ fn list_keys(
+ &self,
+ user_id: &MacroUserIdStr<'_>,
+ ) -> impl Future<Output = Result<Vec<UserApiKeyInfo>, Self::Err>> + Send;
+
+ /// Remove one of the user's keys by id. Returns `true` when a row was removed.
+ fn delete_key(
+ &self,
+ user_id: &MacroUserIdStr<'_>,
+ id: UserApiKeyId,
+ ) -> impl Future<Output = Result<bool, Self::Err>> + Send;
+
+ /// Owner of a key, for the future authenticate-by-key use case.
+ ///
+ /// Looks up by SHA-256 of the presented secret. Not exposed through
+ /// [UserApiKeyService] in this slice.
+ fn find_user_id_by_key(
+ &self,
+ key: &UserApiKey,
+ ) -> impl Future<Output = Result<Option<MacroUserIdStr<'static>>, Self::Err>> + Send;
+}
+
+/// Inbound service port: the user API key API used by drivers (HTTP).
+pub trait UserApiKeyService: Send + Sync + 'static {
+ /// Mint a new key for the user. The full secret is returned here and
+ /// nowhere else.
+ fn create_key(
+ &self,
+ user_id: &MacroUserIdStr<'_>,
+ name: &str,
+ ) -> impl Future<Output = Result<CreatedUserApiKey, UserApiKeyError>> + Send;
+
+ /// List the user's keys as id, name, and created_at.
+ fn list_keys(
+ &self,
+ user_id: &MacroUserIdStr<'_>,
+ ) -> impl Future<Output = Result<Vec<UserApiKeyInfo>, UserApiKeyError>> + Send;
+
+ /// Delete one of the user's keys by opaque id. [UserApiKeyError::NotFound]
+ /// when the key does not exist in the caller's collection.
+ fn delete_key(
+ &self,
+ user_id: &MacroUserIdStr<'_>,
+ id: UserApiKeyId,
+ ) -> impl Future<Output = Result<(), UserApiKeyError>> + Send;
+}
diff --git a/crates/user_api_key/src/domain/service.rs b/crates/user_api_key/src/domain/service.rs
new file mode 100644
index 0000000000..9921ce0524
--- /dev/null
+++ b/crates/user_api_key/src/domain/service.rs
@@ -0,0 +1,94 @@
+//! User API key service implementation.
+
+#[cfg(test)]
+mod test;
+
+use macro_user_id::user_id::MacroUserIdStr;
+
+use crate::domain::models::{
+ CreatedUserApiKey, UserApiKey, UserApiKeyError, UserApiKeyId, UserApiKeyInfo,
+ normalize_key_name,
+};
+use crate::domain::ports::{UserApiKeyService, UserApiKeysRepo};
+
+/// Upper bound on keys per user.
+pub const MAX_KEYS_PER_USER: usize = 20;
+
+/// Concrete user API key service backed by a [UserApiKeysRepo].
+#[derive(Debug, Clone)]
+pub struct UserApiKeyServiceImpl<R> {
+ repo: R,
+}
+
+impl<R> UserApiKeyServiceImpl<R>
+where
+ R: UserApiKeysRepo,
+{
+ /// Create a user API key service backed by the provided repository.
+ pub fn new(repo: R) -> Self {
+ Self { repo }
+ }
+}
+
+impl<R> UserApiKeyService for UserApiKeyServiceImpl<R>
+where
+ R: UserApiKeysRepo,
+{
+ #[tracing::instrument(err, skip_all)]
+ async fn create_key(
+ &self,
+ user_id: &MacroUserIdStr<'_>,
+ name: &str,
+ ) -> Result<CreatedUserApiKey, UserApiKeyError> {
+ let name = normalize_key_name(name)?;
+ let count = self
+ .repo
+ .count_keys(user_id)
+ .await
+ .map_err(|e| rootcause::Report::new(e).into_dynamic())?;
+ if count as usize >= MAX_KEYS_PER_USER {
+ return Err(UserApiKeyError::BadRequest(format!(
+ "cannot have more than {MAX_KEYS_PER_USER} api keys"
+ )));
+ }
+ let id = UserApiKeyId::generate();
+ let key = UserApiKey::generate();
+ let hash = key.hash();
+ let info = self
+ .repo
+ .insert_key(user_id, id, &name, &hash)
+ .await
+ .map_err(|e| rootcause::Report::new(e).into_dynamic())?;
+ Ok(CreatedUserApiKey::new(info, &key))
+ }
+
+ #[tracing::instrument(err, skip_all)]
+ async fn list_keys(
+ &self,
+ user_id: &MacroUserIdStr<'_>,
+ ) -> Result<Vec<UserApiKeyInfo>, UserApiKeyError> {
+ Ok(self
+ .repo
+ .list_keys(user_id)
+ .await
+ .map_err(|e| rootcause::Report::new(e).into_dynamic())?)
+ }
+
+ #[tracing::instrument(err, skip_all)]
+ async fn delete_key(
+ &self,
+ user_id: &MacroUserIdStr<'_>,
+ id: UserApiKeyId,
+ ) -> Result<(), UserApiKeyError> {
+ let removed = self
+ .repo
+ .delete_key(user_id, id)
+ .await
+ .map_err(|e| rootcause::Report::new(e).into_dynamic())?;
+ if removed {
+ Ok(())
+ } else {
+ Err(UserApiKeyError::NotFound)
+ }
+ }
+}
diff --git a/crates/user_api_key/src/domain/service/test.rs b/crates/user_api_key/src/domain/service/test.rs
new file mode 100644
index 0000000000..af2a193693
--- /dev/null
+++ b/crates/user_api_key/src/domain/service/test.rs
@@ -0,0 +1,372 @@
+use std::collections::HashMap;
+use std::sync::{Arc, Mutex};
+
+use chrono::Utc;
+use macro_user_id::user_id::MacroUserIdStr;
+
+use super::{MAX_KEYS_PER_USER, UserApiKeyServiceImpl};
+use sha2::Digest;
+
+use crate::domain::models::{
+ CreatedUserApiKey, MAX_KEY_NAME_LEN, UserApiKey, UserApiKeyError, UserApiKeyId, UserApiKeyInfo,
+ hash_key,
+};
+use crate::domain::ports::{UserApiKeyService, UserApiKeysRepo};
+
+const USER_A: &str = "macro|[email protected]";
+const USER_B: &str = "macro|[email protected]";
+
+fn user(id: &str) -> MacroUserIdStr<'_> {
+ MacroUserIdStr::parse_from_str(id).expect("valid user id")
+}
+
+#[derive(Clone)]
+struct StoredKey {
+ id: UserApiKeyId,
+ name: String,
+ created_at: chrono::DateTime<Utc>,
+ hash: [u8; 32],
+}
+
+#[derive(Clone, Default)]
+struct FakeUserApiKeysRepo {
+ keys: Arc<Mutex<HashMap<String, Vec<StoredKey>>>>,
+ fail: bool,
+}
+
+#[derive(Debug, thiserror::Error)]
+#[error("fake user api key repository error")]
+struct FakeRepoError;
+
+impl FakeUserApiKeysRepo {
+ fn with_count(user_id: &str, count: usize) -> Self {
+ let repo = Self::default();
+ {
+ let mut keys = repo.keys.lock().expect("keys lock poisoned");
+ let set = keys.entry(user_id.to_string()).or_default();
+ for i in 0..count {
+ set.push(StoredKey {
+ id: UserApiKeyId::generate(),
+ name: format!("seed-{i}"),
+ created_at: Utc::now(),
+ hash: hash_key(&format!("seed-key-{i}")),
+ });
+ }
+ }
+ repo
+ }
+
+ fn stored_hashes_for(&self, user_id: &str) -> Vec<[u8; 32]> {
+ self.keys
+ .lock()
+ .expect("keys lock poisoned")
+ .get(user_id)
+ .map(|keys| keys.iter().map(|k| k.hash).collect())
+ .unwrap_or_default()
+ }
+}
+
+impl UserApiKeysRepo for FakeUserApiKeysRepo {
+ type Err = FakeRepoError;
+
+ async fn insert_key(
+ &self,
+ user_id: &MacroUserIdStr<'_>,
+ id: UserApiKeyId,
+ name: &str,
+ hash: &[u8; 32],
+ ) -> Result<UserApiKeyInfo, Self::Err> {
+ if self.fail {
+ return Err(FakeRepoError);
+ }
+ let info = UserApiKeyInfo {
+ id,
+ name: name.to_string(),
+ created_at: Utc::now(),
+ };
+ self.keys
+ .lock()
+ .expect("keys lock poisoned")
+ .entry(user_id.as_ref().to_string())
+ .or_default()
+ .push(StoredKey {
+ id,
+ name: name.to_string(),
+ created_at: info.created_at,
+ hash: *hash,
+ });
+ Ok(info)
+ }
+
+ async fn count_keys(&self, user_id: &MacroUserIdStr<'_>) -> Result<i64, Self::Err> {
+ if self.fail {
+ return Err(FakeRepoError);
+ }
+ Ok(self.stored_hashes_for(user_id.as_ref()).len() as i64)
+ }
+
+ async fn list_keys(
+ &self,
+ user_id: &MacroUserIdStr<'_>,
+ ) -> Result<Vec<UserApiKeyInfo>, Self::Err> {
+ if self.fail {
+ return Err(FakeRepoError);
+ }
+ Ok(self
+ .keys
+ .lock()
+ .expect("keys lock poisoned")
+ .get(user_id.as_ref())
+ .map(|keys| {
+ keys.iter()
+ .map(|k| UserApiKeyInfo {
+ id: k.id,
+ name: k.name.clone(),
+ created_at: k.created_at,
+ })
+ .collect()
+ })
+ .unwrap_or_default())
+ }
+
+ async fn delete_key(
+ &self,
+ user_id: &MacroUserIdStr<'_>,
+ id: UserApiKeyId,
+ ) -> Result<bool, Self::Err> {
+ if self.fail {
+ return Err(FakeRepoError);
+ }
+ let mut keys = self.keys.lock().expect("keys lock poisoned");
+ let Some(set) = keys.get_mut(user_id.as_ref()) else {
+ return Ok(false);
+ };
+ let before = set.len();
+ set.retain(|stored| stored.id != id);
+ Ok(set.len() < before)
+ }
+
+ async fn find_user_id_by_key(
+ &self,
+ key: &UserApiKey,
+ ) -> Result<Option<MacroUserIdStr<'static>>, Self::Err> {
+ if self.fail {
+ return Err(FakeRepoError);
+ }
+ let hash = key.hash();
+ let keys = self.keys.lock().expect("keys lock poisoned");
+ for (user_id, set) in keys.iter() {
+ if set.iter().any(|stored| stored.hash == hash) {
+ return Ok(Some(
+ MacroUserIdStr::try_from(user_id.clone()).expect("valid user id"),
+ ));
+ }
+ }
+ Ok(None)
+ }
+}
+
+fn looks_like_generated_key(key: &str) -> bool {
+ key.starts_with("mak_")
+ && key.len() == "mak_".len() + 64
+ && key[4..].chars().all(|ch| ch.is_ascii_hexdigit())
+}
+
+#[tokio::test]
+async fn create_key_returns_secret_once_and_stores_hash() {
+ let repo = FakeUserApiKeysRepo::default();
+ let service = UserApiKeyServiceImpl::new(repo.clone());
+
+ let created = service
+ .create_key(&user(USER_A), " Laptop ")
+ .await
+ .expect("create should succeed");
+ assert_eq!(created.name, "Laptop");
+ assert!(created.created_at <= Utc::now());
+ assert!(looks_like_generated_key(&created.key));
+ assert!(
+ repo.stored_hashes_for(USER_A)
+ .contains(&UserApiKey::from_raw(&created.key).hash())
+ );
+}
+
+#[tokio::test]
+async fn create_key_returns_distinct_secrets() {
+ let service = UserApiKeyServiceImpl::new(FakeUserApiKeysRepo::default());
+
+ let first = service
+ .create_key(&user(USER_A), "one")
+ .await
+ .expect("first create");
+ let second = service
+ .create_key(&user(USER_A), "two")
+ .await
+ .expect("second create");
+ assert_ne!(first.key, second.key);
+ assert_ne!(first.id, second.id);
+}
+
+#[tokio::test]
+async fn create_key_rejects_empty_or_too_long_name() {
+ let service = UserApiKeyServiceImpl::new(FakeUserApiKeysRepo::default());
+
+ let empty = service
+ .create_key(&user(USER_A), " ")
+ .await
+ .expect_err("empty name should reject");
+ assert!(matches!(empty, UserApiKeyError::BadRequest(_)));
+
+ let too_long = "x".repeat(MAX_KEY_NAME_LEN + 1);
+ let err = service
+ .create_key(&user(USER_A), &too_long)
+ .await
+ .expect_err("long name should reject");
+ assert!(matches!(err, UserApiKeyError::BadRequest(_)));
+}
+
+#[tokio::test]
+async fn create_key_rejects_at_cap() {
+ let service =
+ UserApiKeyServiceImpl::new(FakeUserApiKeysRepo::with_count(USER_A, MAX_KEYS_PER_USER));
+
+ let err = service
+ .create_key(&user(USER_A), "overflow")
+ .await
+ .expect_err("cap should reject");
+ match err {
+ UserApiKeyError::BadRequest(message) => {
+ assert!(message.contains(&MAX_KEYS_PER_USER.to_string()));
+ }
+ other => panic!("expected BadRequest, got {other:?}"),
+ }
+}
+
+#[tokio::test]
+async fn list_keys_returns_id_name_and_created_at() {
+ let service = UserApiKeyServiceImpl::new(FakeUserApiKeysRepo::default());
+
+ let created_a = service
+ .create_key(&user(USER_A), "A key")
+ .await
+ .expect("create for A");
+ let created_b = service
+ .create_key(&user(USER_B), "B key")
+ .await
+ .expect("create for B");
+
+ let a_keys = service.list_keys(&user(USER_A)).await.expect("list A");
+ let b_keys = service.list_keys(&user(USER_B)).await.expect("list B");
+ assert_eq!(a_keys.len(), 1);
+ assert_eq!(b_keys.len(), 1);
+ assert_eq!(a_keys[0].id, created_a.id);
+ assert_eq!(a_keys[0].name, "A key");
+ assert_eq!(a_keys[0].created_at, created_a.created_at);
+ assert_ne!(a_keys[0].id, created_b.id);
+ let listed = serde_json::to_string(&a_keys[0]).expect("list json");
+ assert!(!listed.contains(&created_a.key));
+ assert!(!listed.contains("hash"));
+}
+
+#[tokio::test]
+async fn delete_key_removes_by_id() {
+ let service = UserApiKeyServiceImpl::new(FakeUserApiKeysRepo::default());
+ let created = service
+ .create_key(&user(USER_A), "to-delete")
+ .await
+ .expect("create should succeed");
+
+ service
+ .delete_key(&user(USER_A), created.id)
+ .await
+ .expect("delete should succeed");
+
+ let err = service
+ .delete_key(&user(USER_A), created.id)
+ .await
+ .expect_err("second delete should miss");
+ assert!(matches!(err, UserApiKeyError::NotFound));
+}
+
+#[tokio::test]
+async fn delete_key_does_not_remove_another_users_id() {
+ let service = UserApiKeyServiceImpl::new(FakeUserApiKeysRepo::default());
+ let created = service
+ .create_key(&user(USER_A), "owned-by-a")
+ .await
+ .expect("create for A");
+
+ let err = service
+ .delete_key(&user(USER_B), created.id)
+ .await
+ .expect_err("B must not delete A's key");
+ assert!(matches!(err, UserApiKeyError::NotFound));
+}
+
+#[tokio::test]
+async fn repo_failure_is_internal() {
+ let service = UserApiKeyServiceImpl::new(FakeUserApiKeysRepo {
+ fail: true,
+ ..FakeUserApiKeysRepo::default()
+ });
+
+ let err = service
+ .create_key(&user(USER_A), "fail")
+ .await
+ .expect_err("failure should surface");
+ assert!(matches!(err, UserApiKeyError::Internal(_)));
+}
+
+#[test]
+fn debug_does_not_contain_full_secret() {
+ let key = UserApiKey::from_raw(
+ "mak_0123456789abcdef0123456789abcdef0123456789abcdef0123456789abcdef",
+ );
+ let debug = format!("{key:?}");
+ assert!(!debug.contains(key.expose()));
+ assert!(debug.starts_with("mak_…"));
+ assert!(debug.ends_with("cdef"));
+}
+
+#[test]
+fn hash_key_matches_sha256_of_utf8_bytes() {
+ let key = UserApiKey::from_raw("mak_secret");
+ let expected: [u8; 32] = sha2::Sha256::digest(b"mak_secret").into();
+ assert_eq!(key.hash(), expected);
+ assert_ne!(hash_key("mak_secret"), hash_key("mak_other"));
+}
+
+#[test]
+fn list_metadata_json_is_id_name_and_created_at() {
+ let key = UserApiKey::from_raw(
+ "mak_0123456789abcdef0123456789abcdef0123456789abcdef0123456789abcdef",
+ );
+ let info = UserApiKeyInfo {
+ id: UserApiKeyId::generate(),
+ name: "CI".to_string(),
+ created_at: Utc::now(),
+ };
+ let json = serde_json::to_value(&info).expect("serialize info");
+ assert!(json.get("key").is_none());
+ assert!(json.get("hash").is_none());
+ assert!(json.get("prefix").is_none());
+ assert!(json.get("id").is_some());
+ assert_eq!(json.get("name").and_then(|v| v.as_str()), Some("CI"));
+ assert!(json.get("createdAt").is_some());
+ assert!(
+ !serde_json::to_string(&info)
+ .expect("info string")
+ .contains(key.expose())
+ );
+
+ let created = CreatedUserApiKey::new(info, &key);
+ let created_json = serde_json::to_value(&created).expect("serialize created");
+ assert_eq!(
+ created_json.get("key").and_then(|v| v.as_str()),
+ Some(key.expose())
+ );
+ assert_eq!(
+ created_json.get("name").and_then(|v| v.as_str()),
+ Some("CI")
+ );
+ assert!(created_json.get("createdAt").is_some());
+}
diff --git a/crates/user_api_key/src/inbound.rs b/crates/user_api_key/src/inbound.rs
new file mode 100644
index 0000000000..f1c9980d31
--- /dev/null
+++ b/crates/user_api_key/src/inbound.rs
@@ -0,0 +1,3 @@
+//! Inbound (driving) adapters for user API keys.
+
+pub mod axum_router;
diff --git a/crates/user_api_key/src/inbound/axum_router.rs b/crates/user_api_key/src/inbound/axum_router.rs
new file mode 100644
index 0000000000..d6c1468585
--- /dev/null
+++ b/crates/user_api_key/src/inbound/axum_router.rs
@@ -0,0 +1,214 @@
+//! Axum router for user API key endpoints.
+
+use std::sync::Arc;
+
+use axum::{
+ Json, Router,
+ extract::{FromRef, Path, State},
+ http::StatusCode,
+ response::IntoResponse,
+ routing::{delete, get, post},
+};
+use macro_authorization::{
+ MacroAuthorizationExtractor, MacroAuthorizationService, MacroAuthorizationState, UserOrInternal,
+};
+use model_error_response::ErrorResponse;
+use serde::{Deserialize, Serialize};
+
+use crate::domain::{
+ models::{CreatedUserApiKey, UserApiKeyError, UserApiKeyId, UserApiKeyInfo},
+ ports::UserApiKeyService,
+};
+
+/// Router state for user API key endpoints.
+pub struct UserApiKeyRouterState<S, Auth> {
+ service: Arc<S>,
+ authorization_state: MacroAuthorizationState<Auth>,
+}
+
+impl<S, Auth> Clone for UserApiKeyRouterState<S, Auth> {
+ fn clone(&self) -> Self {
+ Self {
+ service: self.service.clone(),
+ authorization_state: self.authorization_state.clone(),
+ }
+ }
+}
+
+impl<S, Auth> UserApiKeyRouterState<S, Auth>
+where
+ S: UserApiKeyService,
+{
+ /// Create router state from a shared service and authorization state.
+ pub fn new(service: Arc<S>, authorization_state: MacroAuthorizationState<Auth>) -> Self {
+ Self {
+ service,
+ authorization_state,
+ }
+ }
+}
+
+impl<S, Auth> FromRef<UserApiKeyRouterState<S, Auth>> for MacroAuthorizationState<Auth> {
+ fn from_ref(state: &UserApiKeyRouterState<S, Auth>) -> Self {
+ state.authorization_state.clone()
+ }
+}
+
+/// Build the user API key router.
+///
+/// Routes:
+/// - `POST /` — mint a key for the caller.
+/// - `GET /` — list the caller's keys as id, name, and created_at.
+/// - `DELETE /{id}` — delete one of the caller's keys by opaque id.
+pub fn user_api_key_router<S, Auth, T>(state: UserApiKeyRouterState<S, Auth>) -> Router<T>
+where
+ S: UserApiKeyService,
+ Auth: MacroAuthorizationService,
+ T: Send + Sync + 'static,
+{
+ Router::new()
+ .route("/", post(create_user_api_key_handler::<S, Auth>))
+ .route("/", get(list_user_api_keys_handler::<S, Auth>))
+ .route("/{id}", delete(delete_user_api_key_handler::<S, Auth>))
+ .with_state(state)
+}
+
+/// Request body for minting a key.
+#[derive(Debug, Deserialize, utoipa::ToSchema)]
+#[serde(rename_all = "camelCase")]
+pub struct CreateUserApiKeyRequest {
+ /// User-facing name for the key.
+ pub name: String,
+}
+
+/// The caller's API keys as id, name, and created_at.
+#[derive(Debug, Serialize, utoipa::ToSchema)]
+#[serde(rename_all = "camelCase")]
+pub struct UserApiKeysList {
+ /// The caller's keys. Never includes the raw secret or hash.
+ pub keys: Vec<UserApiKeyInfo>,
+}
+
+/// Path params for deleting a key.
+#[derive(Debug, Deserialize, utoipa::IntoParams)]
+#[into_params(parameter_in = Path)]
+pub struct DeleteUserApiKeyParams {
+ /// Opaque key identifier.
+ pub id: UserApiKeyId,
+}
+
+/// Mint a new API key for the caller.
+#[utoipa::path(
+ post,
+ tag = "user-api-keys",
+ operation_id = "create_user_api_key",
+ path = "/user-api-keys",
+ request_body = CreateUserApiKeyRequest,
+ responses(
+ (status = 201, body = CreatedUserApiKey),
+ (status = 400, body = ErrorResponse),
+ (status = 401, body = ErrorResponse),
+ (status = 500, body = ErrorResponse),
+ )
+)]
+#[tracing::instrument(err, skip_all)]
+pub async fn create_user_api_key_handler<S, Auth>(
+ State(state): State<UserApiKeyRouterState<S, Auth>>,
+ user: MacroAuthorizationExtractor<Auth, UserOrInternal>,
+ Json(body): Json<CreateUserApiKeyRequest>,
+) -> Result<(StatusCode, Json<CreatedUserApiKey>), UserApiKeyError>
+where
+ S: UserApiKeyService,
+ Auth: MacroAuthorizationService,
+{
+ let created = state
+ .service
+ .create_key(&user.authorization.user.macro_user_id, &body.name)
+ .await?;
+ Ok((StatusCode::CREATED, Json(created)))
+}
+
+/// List the caller's API keys.
+#[utoipa::path(
+ get,
+ tag = "user-api-keys",
+ operation_id = "list_user_api_keys",
+ path = "/user-api-keys",
+ responses(
+ (status = 200, body = UserApiKeysList),
+ (status = 401, body = ErrorResponse),
+ (status = 500, body = ErrorResponse),
+ )
+)]
+#[tracing::instrument(err, skip_all)]
+pub async fn list_user_api_keys_handler<S, Auth>(
+ State(state): State<UserApiKeyRouterState<S, Auth>>,
+ user: MacroAuthorizationExtractor<Auth, UserOrInternal>,
+) -> Result<Json<UserApiKeysList>, UserApiKeyError>
+where
+ S: UserApiKeyService,
+ Auth: MacroAuthorizationService,
+{
+ let keys = state
+ .service
+ .list_keys(&user.authorization.user.macro_user_id)
+ .await?;
+ Ok(Json(UserApiKeysList { keys }))
+}
+
+/// Delete one of the caller's API keys.
+#[utoipa::path(
+ delete,
+ tag = "user-api-keys",
+ operation_id = "delete_user_api_key",
+ path = "/user-api-keys/{id}",
+ params(DeleteUserApiKeyParams),
+ responses(
+ (status = 204, description = "API key deleted"),
+ (status = 401, body = ErrorResponse),
+ (status = 404, body = ErrorResponse),
+ (status = 500, body = ErrorResponse),
+ )
+)]
+#[tracing::instrument(err, skip_all)]
+pub async fn delete_user_api_key_handler<S, Auth>(
+ State(state): State<UserApiKeyRouterState<S, Auth>>,
+ user: MacroAuthorizationExtractor<Auth, UserOrInternal>,
+ Path(params): Path<DeleteUserApiKeyParams>,
+) -> Result<StatusCode, UserApiKeyError>
+where
+ S: UserApiKeyService,
+ Auth: MacroAuthorizationService,
+{
+ state
+ .service
+ .delete_key(&user.authorization.user.macro_user_id, params.id)
+ .await?;
+ Ok(StatusCode::NO_CONTENT)
+}
+
+impl IntoResponse for UserApiKeyError {
+ fn into_response(self) -> axum::response::Response {
+ let status_code = match &self {
+ UserApiKeyError::NotFound => StatusCode::NOT_FOUND,
+ UserApiKeyError::BadRequest(_) => StatusCode::BAD_REQUEST,
+ UserApiKeyError::Internal(_) => StatusCode::INTERNAL_SERVER_ERROR,
+ };
+
+ let message = match &self {
+ UserApiKeyError::Internal(_) => {
+ tracing::error!(error=?self, "user api key internal server error");
+ "internal server error".to_string()
+ }
+ error => error.to_string(),
+ };
+
+ (
+ status_code,
+ Json(ErrorResponse {
+ message: message.into(),
+ }),
+ )
+ .into_response()
+ }
+}
diff --git a/crates/user_api_key/src/lib.rs b/crates/user_api_key/src/lib.rs
new file mode 100644
index 0000000000..956c42b60c
--- /dev/null
+++ b/crates/user_api_key/src/lib.rs
@@ -0,0 +1,21 @@
+#![deny(missing_docs)]
+//! User API keys: create, list, and delete a caller's keys, following the
+//! hexagonal architecture pattern.
+//!
+//! Keys are user-owned rows in `"UserApiKey"`. This crate owns that table's
+//! lifecycle. Authenticating a request *with* a key is a later slice; the
+//! repository port already exposes a lookup-by-key method for that use case.
+//!
+//! # Architecture
+//!
+//! - **domain**: domain models, ports, and the service implementation.
+//! - **inbound**: driving adapters (Axum HTTP router).
+//! - **outbound**: driven adapters (Postgres repository).
+
+pub mod domain;
+
+#[cfg(feature = "inbound")]
+pub mod inbound;
+
+#[cfg(feature = "outbound")]
+pub mod outbound;
diff --git a/crates/user_api_key/src/outbound.rs b/crates/user_api_key/src/outbound.rs
new file mode 100644
index 0000000000..76396404be
--- /dev/null
+++ b/crates/user_api_key/src/outbound.rs
@@ -0,0 +1,4 @@
+//! Outbound (driven) adapters for user API keys.
+
+#[cfg(feature = "postgres")]
+pub mod pg_user_api_keys_repo;
diff --git a/crates/user_api_key/src/outbound/pg_user_api_keys_repo.rs b/crates/user_api_key/src/outbound/pg_user_api_keys_repo.rs
new file mode 100644
index 0000000000..bec185804f
--- /dev/null
+++ b/crates/user_api_key/src/outbound/pg_user_api_keys_repo.rs
@@ -0,0 +1,153 @@
+//! PostgreSQL implementation of the [`UserApiKeysRepo`] port.
+
+#[cfg(test)]
+mod tests;
+
+use chrono::{DateTime, Utc};
+use macro_user_id::user_id::MacroUserIdStr;
+use sqlx::PgPool;
+use uuid::Uuid;
+
+use crate::domain::models::{UserApiKey, UserApiKeyId, UserApiKeyInfo};
+use crate::domain::ports::UserApiKeysRepo;
+
+/// Postgres-backed user API key repository.
+#[derive(Debug, Clone)]
+pub struct PgUserApiKeysRepo {
+ pool: PgPool,
+}
+
+impl PgUserApiKeysRepo {
+ /// Create a repository backed by the provided pool.
+ pub fn new(pool: PgPool) -> Self {
+ Self { pool }
+ }
+}
+
+/// Errors produced by the Postgres user API key repository.
+#[derive(Debug, thiserror::Error)]
+pub enum UserApiKeysRepoErr {
+ /// Underlying database error.
+ #[error(transparent)]
+ Db(#[from] sqlx::Error),
+ /// A stored owner is not a parseable macro user id.
+ #[error("invalid user id stored for api key")]
+ InvalidUserId,
+}
+
+struct UserApiKeyInfoRow {
+ id: Uuid,
+ name: String,
+ created_at: DateTime<Utc>,
+}
+
+impl From<UserApiKeyInfoRow> for UserApiKeyInfo {
+ fn from(row: UserApiKeyInfoRow) -> Self {
+ Self {
+ id: UserApiKeyId::from_uuid(row.id),
+ name: row.name,
+ created_at: row.created_at,
+ }
+ }
+}
+
+impl UserApiKeysRepo for PgUserApiKeysRepo {
+ type Err = UserApiKeysRepoErr;
+
+ #[tracing::instrument(err, skip_all)]
+ async fn insert_key(
+ &self,
+ user_id: &MacroUserIdStr<'_>,
+ id: UserApiKeyId,
+ name: &str,
+ hash: &[u8; 32],
+ ) -> Result<UserApiKeyInfo, Self::Err> {
+ let row = sqlx::query_as!(
+ UserApiKeyInfoRow,
+ r#"
+ INSERT INTO "UserApiKey" (id, name, user_id, hash)
+ VALUES ($1, $2, $3, $4)
+ RETURNING id, name, created_at
+ "#,
+ id.as_uuid(),
+ name,
+ user_id.as_ref(),
+ &hash[..],
+ )
+ .fetch_one(&self.pool)
+ .await?;
+ Ok(row.into())
+ }
+
+ #[tracing::instrument(err, skip_all)]
+ async fn count_keys(&self, user_id: &MacroUserIdStr<'_>) -> Result<i64, Self::Err> {
+ let count = sqlx::query_scalar!(
+ r#"SELECT COUNT(*) as "count!" FROM "UserApiKey" WHERE user_id = $1"#,
+ user_id.as_ref(),
+ )
+ .fetch_one(&self.pool)
+ .await?;
+ Ok(count)
+ }
+
+ #[tracing::instrument(err, skip_all)]
+ async fn list_keys(
+ &self,
+ user_id: &MacroUserIdStr<'_>,
+ ) -> Result<Vec<UserApiKeyInfo>, Self::Err> {
+ let rows = sqlx::query_as!(
+ UserApiKeyInfoRow,
+ r#"
+ SELECT id, name, created_at
+ FROM "UserApiKey"
+ WHERE user_id = $1
+ ORDER BY created_at DESC, id DESC
+ "#,
+ user_id.as_ref(),
+ )
+ .fetch_all(&self.pool)
+ .await?;
+ Ok(rows.into_iter().map(UserApiKeyInfo::from).collect())
+ }
+
+ #[tracing::instrument(err, skip_all)]
+ async fn delete_key(
+ &self,
+ user_id: &MacroUserIdStr<'_>,
+ id: UserApiKeyId,
+ ) -> Result<bool, Self::Err> {
+ let result = sqlx::query!(
+ r#"
+ DELETE FROM "UserApiKey"
+ WHERE user_id = $1 AND id = $2
+ "#,
+ user_id.as_ref(),
+ id.as_uuid(),
+ )
+ .execute(&self.pool)
+ .await?;
+ Ok(result.rows_affected() > 0)
+ }
+
+ #[tracing::instrument(err, skip_all)]
+ async fn find_user_id_by_key(
+ &self,
+ key: &UserApiKey,
+ ) -> Result<Option<MacroUserIdStr<'static>>, Self::Err> {
+ let hash = key.hash();
+ let row = sqlx::query!(
+ r#"
+ SELECT user_id
+ FROM "UserApiKey"
+ WHERE hash = $1
+ "#,
+ &hash[..],
+ )
+ .fetch_optional(&self.pool)
+ .await?;
+ row.map(|row| {
+ MacroUserIdStr::try_from(row.user_id).map_err(|_| UserApiKeysRepoErr::InvalidUserId)
+ })
+ .transpose()
+ }
+}
diff --git a/crates/user_api_key/src/outbound/pg_user_api_keys_repo/tests.rs b/crates/user_api_key/src/outbound/pg_user_api_keys_repo/tests.rs
new file mode 100644
index 0000000000..444ffe8d37
--- /dev/null
+++ b/crates/user_api_key/src/outbound/pg_user_api_keys_repo/tests.rs
@@ -0,0 +1,212 @@
+use macro_db_migrator::MACRO_DB_MIGRATIONS;
+use macro_user_id::user_id::MacroUserIdStr;
+use sqlx::PgPool;
+use uuid::Uuid;
+
+use super::PgUserApiKeysRepo;
+use crate::domain::models::UserApiKey;
+use crate::domain::models::UserApiKeyId;
+use crate::domain::ports::UserApiKeysRepo;
+
+const USER_A: &str = "macro|[email protected]";
+const USER_B: &str = "macro|[email protected]";
+
+fn user(id: &str) -> MacroUserIdStr<'_> {
+ MacroUserIdStr::parse_from_str(id).expect("valid user id")
+}
+
+async fn insert_user(pool: &PgPool, id: &str) {
+ let macro_user_id = Uuid::now_v7();
+ sqlx::query(
+ r#"INSERT INTO macro_user (id, username, email, stripe_customer_id) VALUES ($1, $2, $2, $2)"#,
+ )
+ .bind(macro_user_id)
+ .bind(id)
+ .execute(pool)
+ .await
+ .expect("macro_user should insert");
+ sqlx::query(r#"INSERT INTO "User" (id, email, macro_user_id) VALUES ($1, $1, $2)"#)
+ .bind(id)
+ .bind(macro_user_id)
+ .execute(pool)
+ .await
+ .expect("user should insert");
+}
+
+#[sqlx::test(migrator = "MACRO_DB_MIGRATIONS")]
+async fn insert_and_list_return_id_name_and_created_at_scoped_per_user(pool: PgPool) {
+ insert_user(&pool, USER_A).await;
+ insert_user(&pool, USER_B).await;
+ let repo = PgUserApiKeysRepo::new(pool.clone());
+ let key = UserApiKey::from_raw(
+ "mak_aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa",
+ );
+ let id = UserApiKeyId::generate();
+
+ let inserted = repo
+ .insert_key(&user(USER_A), id, "Laptop", &key.hash())
+ .await
+ .expect("insert should succeed");
+ assert_eq!(inserted.id, id);
+ assert_eq!(inserted.name, "Laptop");
+ assert!(inserted.created_at <= chrono::Utc::now());
+
+ let a_keys = repo.list_keys(&user(USER_A)).await.expect("list A");
+ let b_keys = repo.list_keys(&user(USER_B)).await.expect("list B");
+ assert_eq!(a_keys.len(), 1);
+ assert_eq!(a_keys[0].id, id);
+ assert_eq!(a_keys[0].name, "Laptop");
+ assert_eq!(a_keys[0].created_at, inserted.created_at);
+ assert!(b_keys.is_empty());
+
+ let stored_hash: Vec<u8> = sqlx::query_scalar(r#"SELECT hash FROM "UserApiKey" WHERE id = $1"#)
+ .bind(id.as_uuid())
+ .fetch_one(&pool)
+ .await
+ .expect("hash should persist");
+ assert_eq!(stored_hash, key.hash());
+
+ let key_column_exists: bool = sqlx::query_scalar(
+ r#"
+ SELECT EXISTS (
+ SELECT 1
+ FROM information_schema.columns
+ WHERE table_name = 'UserApiKey' AND column_name = 'key'
+ )
+ "#,
+ )
+ .fetch_one(&pool)
+ .await
+ .expect("column probe should run");
+ assert!(!key_column_exists);
+}
+
+#[sqlx::test(migrator = "MACRO_DB_MIGRATIONS")]
+async fn count_keys_counts_only_caller_rows(pool: PgPool) {
+ insert_user(&pool, USER_A).await;
+ insert_user(&pool, USER_B).await;
+ let repo = PgUserApiKeysRepo::new(pool);
+
+ repo.insert_key(
+ &user(USER_A),
+ UserApiKeyId::generate(),
+ "a-1",
+ &UserApiKey::from_raw("key-a-1").hash(),
+ )
+ .await
+ .expect("insert A");
+ repo.insert_key(
+ &user(USER_A),
+ UserApiKeyId::generate(),
+ "a-2",
+ &UserApiKey::from_raw("key-a-2").hash(),
+ )
+ .await
+ .expect("insert A again");
+ repo.insert_key(
+ &user(USER_B),
+ UserApiKeyId::generate(),
+ "b-1",
+ &UserApiKey::from_raw("key-b-1").hash(),
+ )
+ .await
+ .expect("insert B");
+
+ assert_eq!(
+ repo.count_keys(&user(USER_A))
+ .await
+ .expect("count A should run"),
+ 2
+ );
+ assert_eq!(
+ repo.count_keys(&user(USER_B))
+ .await
+ .expect("count B should run"),
+ 1
+ );
+}
+
+#[sqlx::test(migrator = "MACRO_DB_MIGRATIONS")]
+async fn delete_key_is_scoped_to_owner(pool: PgPool) {
+ insert_user(&pool, USER_A).await;
+ insert_user(&pool, USER_B).await;
+ let repo = PgUserApiKeysRepo::new(pool);
+ let key = UserApiKey::from_raw("shared-looking-but-owned-by-a");
+ let id = UserApiKeyId::generate();
+
+ repo.insert_key(&user(USER_A), id, "owned", &key.hash())
+ .await
+ .expect("insert should succeed");
+
+ assert!(
+ !repo
+ .delete_key(&user(USER_B), id)
+ .await
+ .expect("delete as B should run")
+ );
+ assert!(
+ !repo
+ .delete_key(&user(USER_A), UserApiKeyId::generate())
+ .await
+ .expect("delete unknown should run")
+ );
+ assert!(
+ repo.delete_key(&user(USER_A), id)
+ .await
+ .expect("delete as A should run")
+ );
+ assert!(
+ repo.list_keys(&user(USER_A))
+ .await
+ .expect("list A")
+ .is_empty()
+ );
+}
+
+#[sqlx::test(migrator = "MACRO_DB_MIGRATIONS")]
+async fn find_user_id_by_key_looks_up_hash(pool: PgPool) {
+ insert_user(&pool, USER_A).await;
+ let repo = PgUserApiKeysRepo::new(pool);
+ let key = UserApiKey::from_raw("lookup-key");
+
+ repo.insert_key(
+ &user(USER_A),
+ UserApiKeyId::generate(),
+ "lookup",
+ &key.hash(),
+ )
+ .await
+ .expect("insert should succeed");
+
+ let owner = repo
+ .find_user_id_by_key(&key)
+ .await
+ .expect("lookup should run")
+ .expect("owner should exist");
+ assert_eq!(owner.as_ref(), USER_A);
+
+ assert!(
+ repo.find_user_id_by_key(&UserApiKey::from_raw("missing"))
+ .await
+ .expect("missing lookup should run")
+ .is_none()
+ );
+}
+
+#[sqlx::test(migrator = "MACRO_DB_MIGRATIONS")]
+async fn insert_same_hash_for_second_user_is_rejected(pool: PgPool) {
+ insert_user(&pool, USER_A).await;
+ insert_user(&pool, USER_B).await;
+ let repo = PgUserApiKeysRepo::new(pool);
+ let key = UserApiKey::from_raw("globally-unique-key");
+ let hash = key.hash();
+
+ repo.insert_key(&user(USER_A), UserApiKeyId::generate(), "a", &hash)
+ .await
+ .expect("first insert should succeed");
+ let err = repo
+ .insert_key(&user(USER_B), UserApiKeyId::generate(), "b", &hash)
+ .await
+ .expect_err("duplicate hash should fail");
+ assert!(matches!(err, super::UserApiKeysRepoErr::Db(_)));
+}
diff --git a/packages/sdk/generated/storage/index.ts b/packages/sdk/generated/storage/index.ts
index 2a7c9b3afe..6e42fff34f 100644
--- a/packages/sdk/generated/storage/index.ts
+++ b/packages/sdk/generated/storage/index.ts
@@ -1,4 +1,4 @@
// This file is auto-generated by @hey-api/openapi-ts
export { type Options, Sdk } from './sdk.gen';
-export type { AccessLevel, ActiveCallsResponse, ActiveCallSummary, ActivityType, AddFavoriteData, AddFavoriteError, AddFavoriteErrors, AddFavoriteRequest, AddFavoriteResponse, AddFavoriteResponses, AddParticipantsData, AddParticipantsError, AddParticipantsErrors, AddParticipantsRequest, AddParticipantsResponses, AddPinHandlerData, AddPinHandlerError, AddPinHandlerErrors, AddPinHandlerResponse, AddPinHandlerResponses, AddPinRequest, Anchor, AnchorId, AnchorRequest, AnchorResponse, AnnotationIncrementalUpdate, ApiActivity, ApiAttachmentChannelReference, ApiAttachmentEntityReference, ApiAttachmentGenericReference, ApiChannelAttachment, ApiChannelAttachmentsPage, ApiChannelContextMessage, ApiChannelDetail, ApiChannelListMessage, ApiChannelListPage, ApiChannelListParticipant, ApiChannelListType, ApiChannelMessage, ApiChannelMessageKind, ApiChannelMessagesPage, ApiChannelParticipant, ApiChannelWithLatest, ApiCountedReaction, ApiEntityFilterAst, ApiGroupByField, ApiGroupMeta, ApiMessageAttachment, ApiMessageSender, ApiMessageSenderType, ApiParticipantListRole, ApiParticipantRole, ApiPropertyEntityType, ApiResolvedChannelMessage, ApiThreadInfo, ApiThreadReply, AttendeeResponseStatus, BasicDocument, BasicDocumentSubType, BomPart, Bot, BotChannel, BotChannelType, BotId, BotKind, BotOwner, BotToken, BranchNameResponse, BTreeMap, BulkWakeupRequest, BulkWakeupResponse, BulkWakeupSyncServiceDocumentsData, BulkWakeupSyncServiceDocumentsErrors, BulkWakeupSyncServiceDocumentsResponse, BulkWakeupSyncServiceDocumentsResponses, CalendarAttendee, CalendarEvent, CalendarEventFilters, CalendarMentionEvent, CalendarMentionPreviewItem, CalendarMentionPreviewKind, CalendarMentionPreviewRequest, CalendarMentionPreviewRequestItem, CalendarMentionPreviewResponse, CalendarOccurrence, CalendarOccurrenceItem, CalendarOccurrenceResponse, CalendarSyncStatus, CallActiveResponse, CallFilters, CallRecord, CallRecordParticipant, CallRecordPreview, CallRecordPreviewData, CallRecordTranscriptSegment, CallStatus, CallTokenResponse, CallWebhookData, CallWebhookError, CallWebhookErrors, CallWebhookResponses, Channel, ChannelCreatedMetadata, ChannelDeletedMetadata, ChannelEventAttachment, ChannelFilters, ChannelJoinCodeResponse, ChannelMentionedMetadata, ChannelMessage, ChannelMessageAttachmentCreatedMetadata, ChannelMessageAttachmentRemovedMetadata, ChannelMessageDeletedMetadata, ChannelMessageFilters, ChannelMessagePatchedMetadata, ChannelMessagePostedMetadata, ChannelParticipant, ChannelParticipantAddedMetadata, ChannelParticipantRemovedMetadata, ChannelPreview, ChannelPreviewData, ChannelSender, ChannelSharePermission, ChannelThreadFilters, ChannelTopicEvent, ChannelType, ChannelUpdatedMetadata, ChannelWebhookRequest, ChannelWebhookResponse, ChannelWithParticipants, Chat, ChatFilters, CheckActiveCallData, CheckActiveCallError, CheckActiveCallErrors, CheckActiveCallResponse, CheckActiveCallResponses, ClientOptions, CloudStorageItemType, CollabSurfaceResponse, CollabSurfaceTokenResponse, Comment, CommentThread, ConferenceProvider, CopyDocumentData, CopyDocumentError, CopyDocumentErrors, CopyDocumentQueryParams, CopyDocumentRequest, CopyDocumentResponse, CopyDocumentResponse2, CopyDocumentResponses, CreateAnchorData, CreateAnchorError, CreateAnchorErrors, CreateAnchorResponse, CreateAnchorResponses, CreateBotRequest, CreateBulkDocumentResponse, CreateBulkDocumentResponseData, CreateChannelData, CreateChannelError, CreateChannelErrors, CreateChannelRequest, CreateChannelResponse, CreateChannelResponse2, CreateChannelResponses, CreateChannelScopedBotData, CreateChannelScopedBotError, CreateChannelScopedBotErrors, CreateChannelScopedBotRequest, CreateChannelScopedBotResponse, CreateChannelScopedBotResponse2, CreateChannelScopedBotResponses, CreateCollabSurfaceTokenData, CreateCollabSurfaceTokenError, CreateCollabSurfaceTokenErrors, CreateCollabSurfaceTokenResponse, CreateCollabSurfaceTokenResponses, CreateCommentData, CreateCommentError, CreateCommentErrors, CreateCommentRequest, CreateCommentResponse, CreateCommentResponse2, CreateCommentResponses, CreateCrmCommentData, CreateCrmCommentError, CreateCrmCommentErrors, CreateCrmCommentRequest, CreateCrmCommentResponse, CreateCrmCommentResponses, CreateCrmCompanyData, CreateCrmCompanyError, CreateCrmCompanyErrors, CreateCrmCompanyRequest, CreateCrmCompanyResponse, CreateCrmCompanyResponses, CreateCrmContactData, CreateCrmContactError, CreateCrmContactErrors, CreateCrmContactRequest, CreateCrmContactResponse, CreateCrmContactResponses, CreateDocumentData, CreateDocumentError, CreateDocumentErrors, CreateDocumentRequest, CreateDocumentResponse, CreateDocumentResponseData, CreateDocumentResponses, CreateEntityMentionData, CreateEntityMentionError, CreateEntityMentionErrors, CreateEntityMentionRequest, CreateEntityMentionResponse, CreateEntityMentionResponse2, CreateEntityMentionResponses, CreateInstructionsDocumentResponse, CreateInstructionsHandlerData, CreateInstructionsHandlerError, CreateInstructionsHandlerErrors, CreateInstructionsHandlerResponse, CreateInstructionsHandlerResponses, CreateMarkdownDocumentRequest, CreateMarkdownDocumentResponse, CreateMarkdownHandlerData, CreateMarkdownHandlerError, CreateMarkdownHandlerErrors, CreateMarkdownHandlerResponse, CreateMarkdownHandlerResponses, CreateProjectHandlerData, CreateProjectHandlerError, CreateProjectHandlerErrors, CreateProjectHandlerResponse, CreateProjectHandlerResponses, CreateProjectRequest, CreateProjectResponse, CreateReminderData, CreateReminderError, CreateReminderErrors, CreateReminderRequest, CreateReminderResponse, CreateReminderResponses, CreateSkillHandlerData, CreateSkillHandlerError, CreateSkillHandlerErrors, CreateSkillHandlerResponse, CreateSkillHandlerResponses, CreateSkillRequest, CreateSkillResponse, CreateSnippetHandlerData, CreateSnippetHandlerError, CreateSnippetHandlerErrors, CreateSnippetHandlerResponse, CreateSnippetHandlerResponses, CreateSnippetRequest, CreateSnippetResponse, CreateTaskHandlerData, CreateTaskHandlerError, CreateTaskHandlerErrors, CreateTaskHandlerResponse, CreateTaskHandlerResponses, CreateTaskRequest, CreateTaskResponse, CreateUnthreadedAnchorRequest, CreateUnthreadedAnchorResponse, CreateUnthreadedPdfAnchorRequest, CreateViewHandlerData, CreateViewHandlerError, CreateViewHandlerErrors, CreateViewHandlerResponse, CreateViewHandlerResponses, CreateViewRequest, CreateWebhookData, CreateWebhookError, CreateWebhookErrors, CreateWebhookRequest, CreateWebhookResponse, CreateWebhookResponse2, CreateWebhookResponses, CrmComment, CrmCommentEntityType, CrmCommentThread, CrmCompanyFilters, CrmCompanyResponse, CrmContactResponse, CrmDomainResponse, CrmPermissionRole, CrmTeamSettingsResponse, CrmThread, CustomSpeakerAssignment, DataType, DeleteAnchorData, DeleteAnchorError, DeleteAnchorErrors, DeleteAnchorInfo, DeleteAnchorResponse, DeleteAnchorResponses, DeleteCallRecordData, DeleteCallRecordError, DeleteCallRecordErrors, DeleteCallRecordResponse, DeleteCallRecordResponses, DeleteChannelData, DeleteChannelError, DeleteChannelErrors, DeleteChannelResponse, DeleteChannelResponses, DeleteCollabSurfaceData, DeleteCollabSurfaceError, DeleteCollabSurfaceErrors, DeleteCollabSurfaceResponse, DeleteCollabSurfaceResponses, DeleteCommentData, DeleteCommentError, DeleteCommentErrors, DeleteCommentRequest, DeleteCommentResponse, DeleteCommentResponse2, DeleteCommentResponses, DeleteCrmCommentData, DeleteCrmCommentError, DeleteCrmCommentErrors, DeleteCrmCommentResponse, DeleteCrmCommentResponses, DeleteCrmCommentResult, DeleteDocumentData, DeleteDocumentError, DeleteDocumentErrors, DeleteDocumentResponse, DeleteDocumentResponses, DeleteEntityMentionData, DeleteEntityMentionError, DeleteEntityMentionErrors, DeleteEntityMentionResponse, DeleteEntityMentionResponse2, DeleteEntityMentionResponses, DeleteHistoryHandlerData, DeleteHistoryHandlerError, DeleteHistoryHandlerErrors, DeleteHistoryHandlerResponse, DeleteHistoryHandlerResponses, DeleteMessageData, DeleteMessageError, DeleteMessageErrors, DeleteMessageQuery, DeleteMessageResponse, DeleteMessageResponses, DeleteProjectHandlerData, DeleteProjectHandlerError, DeleteProjectHandlerErrors, DeleteProjectHandlerResponse, DeleteProjectHandlerResponses, DeleteReminderData, DeleteReminderError, DeleteReminderErrors, DeleteReminderResponse, DeleteReminderResponses, DeleteThreadInfo, DeleteUnthreadedAnchorRequest, DeleteUnthreadedAnchorResponse, DeleteUnthreadedPdfAnchorRequest, DeleteUserDocumentViewLocationData, DeleteUserDocumentViewLocationError, DeleteUserDocumentViewLocationErrors, DeleteUserDocumentViewLocationResponse, DeleteUserDocumentViewLocationResponses, DeleteViewHandlerData, DeleteViewHandlerError, DeleteViewHandlerErrors, DeleteViewHandlerResponses, DeleteWebhookData, DeleteWebhookError, DeleteWebhookErrors, DeleteWebhookResponse, DeleteWebhookResponses, DocumentBasic, DocumentContent, DocumentContentLocation, DocumentContentState, DocumentContentUploadedMetadata, DocumentCopiedMetadata, DocumentCreatedMetadata, DocumentDeletedMetadata, DocumentFilters, DocumentInteractionMetadata, DocumentMetadata, DocumentMetadataWithContent, DocumentPermissionsToken, DocumentPermissionsTokenRequest, DocumentPermissionsTokenResponse, DocumentPreview, DocumentPreviewData, DocumentPreviewDataSubType, DocumentPurgedMetadata, DocumentResponse, DocumentResponseMetadata, DocumentResponseMetadataWithContent, DocumentStorageServiceApiVersion, DocumentSubType, DocumentSyncContentUpdatedMetadata, DocumentTeamShareResponse, DocumentTopicEvent, DocumentUpdatedMetadata, EditAnchorData, EditAnchorError, EditAnchorErrors, EditAnchorRequest, EditAnchorResponse, EditAnchorResponse2, EditAnchorResponses, EditCallRecordData, EditCallRecordError, EditCallRecordErrors, EditCallRecordRequest, EditCallRecordResponse, EditCallRecordResponses, EditCallTranscriptData, EditCallTranscriptError, EditCallTranscriptErrors, EditCallTranscriptRequest, EditCallTranscriptResponse, EditCallTranscriptResponses, EditCommentData, EditCommentError, EditCommentErrors, EditCommentRequest, EditCommentResponse, EditCommentResponse2, EditCommentResponses, EditCrmCommentData, EditCrmCommentError, EditCrmCommentErrors, EditCrmCommentRequest, EditCrmCommentResponse, EditCrmCommentResponses, EditDocumentData, EditDocumentError, EditDocumentErrors, EditDocumentResponse, EditDocumentResponse2, EditDocumentResponses, EditDocumentServiceArgs, EditPdfAnchorRequest, EditPdfPlaceableCommentAnchorRequest, EditProjectV2Data, EditProjectV2Error, EditProjectV2Errors, EditProjectV2Response, EditProjectV2Responses, EditThreadV2Data, EditThreadV2Error, EditThreadV2Errors, EditThreadV2Response, EditThreadV2Responses, EmailFilters, EmptyResponse, EnsureCollabSurfaceData, EnsureCollabSurfaceError, EnsureCollabSurfaceErrors, EnsureCollabSurfaceRequest, EnsureCollabSurfaceResponse, EnsureCollabSurfaceResponses, EntityFilters, EntityPermission, EntityPermissionResponse, EntityReference, EntityType, ErrorResponse, EventReminderOverride, EventReminders, EventStatus, EventTime, EventTransparency, EventType, EventVisibility, ExcludedDefaultView, ExcludeDefaultViewHandlerData, ExcludeDefaultViewHandlerError, ExcludeDefaultViewHandlerErrors, ExcludeDefaultViewHandlerResponses, ExcludeDefaultViewRequest, ExportDocumentData, ExportDocumentError, ExportDocumentErrors, ExportDocumentResponse, ExportDocumentResponse2, ExportDocumentResponses, Favorite, FavoriteEntityRef, FavoritesList, FileSystemNodeWithIds, FileType, FileTypeUpdate, FolderItem, ForeignEntity, ForeignEntityFilters, GenericErrorResponse, GenericResponse, GenericSuccessResponse, GetActiveCallsData, GetActiveCallsError, GetActiveCallsErrors, GetActiveCallsResponse, GetActiveCallsResponses, GetActivityData, GetActivityError, GetActivityErrors, GetActivityResponse, GetActivityResponses, GetAttachmentReferencesData, GetAttachmentReferencesError, GetAttachmentReferencesErrors, GetAttachmentReferencesResponse, GetAttachmentReferencesResponse2, GetAttachmentReferencesResponses, GetBatchCallRecordPreviewData, GetBatchCallRecordPreviewError, GetBatchCallRecordPreviewErrors, GetBatchCallRecordPreviewRequest, GetBatchCallRecordPreviewResponse, GetBatchCallRecordPreviewResponse2, GetBatchCallRecordPreviewResponses, GetBatchChannelPreviewData, GetBatchChannelPreviewError, GetBatchChannelPreviewErrors, GetBatchChannelPreviewRequest, GetBatchChannelPreviewResponse, GetBatchChannelPreviewResponse2, GetBatchChannelPreviewResponses, GetBatchPreviewHandlerData, GetBatchPreviewHandlerError, GetBatchPreviewHandlerErrors, GetBatchPreviewHandlerResponse, GetBatchPreviewHandlerResponses, GetBatchPreviewRequest, GetBatchPreviewResponse, GetBatchProjectPreviewData, GetBatchProjectPreviewError, GetBatchProjectPreviewErrors, GetBatchProjectPreviewRequest, GetBatchProjectPreviewResponse, GetBatchProjectPreviewResponse2, GetBatchProjectPreviewResponses, GetCallRecordData, GetCallRecordError, GetCallRecordErrors, GetCallRecordResponse, GetCallRecordResponses, GetChannelAttachmentsData, GetChannelAttachmentsError, GetChannelAttachmentsErrors, GetChannelAttachmentsResponse, GetChannelAttachmentsResponses, GetChannelData, GetChannelError, GetChannelErrors, GetChannelJoinLinkData, GetChannelJoinLinkError, GetChannelJoinLinkErrors, GetChannelJoinLinkResponse, GetChannelJoinLinkResponses, GetChannelMessagesData, GetChannelMessagesError, GetChannelMessagesErrors, GetChannelMessagesResponse, GetChannelMessagesResponses, GetChannelParticipantsData, GetChannelParticipantsError, GetChannelParticipantsErrors, GetChannelParticipantsResponse, GetChannelParticipantsResponses, GetChannelResponse, GetChannelResponses, GetChannelsData, GetChannelsError, GetChannelsErrors, GetChannelsResponse, GetChannelsResponses, GetCollabSurfaceData, GetCollabSurfaceError, GetCollabSurfaceErrors, GetCollabSurfaceResponse, GetCollabSurfaceResponses, GetCompanyData, GetCompanyError, GetCompanyErrors, GetCompanyResponse, GetCompanyResponses, GetContactByEmailData, GetContactByEmailError, GetContactByEmailErrors, GetContactByEmailResponse, GetContactByEmailResponse2, GetContactByEmailResponses, GetContactData, GetContactError, GetContactErrors, GetContactResponse, GetContactResponses, GetCrmTeamSettingsData, GetCrmTeamSettingsError, GetCrmTeamSettingsErrors, GetCrmTeamSettingsResponse, GetCrmTeamSettingsResponses, GetDocumentAnchorsData, GetDocumentAnchorsError, GetDocumentAnchorsErrors, GetDocumentAnchorsResponse, GetDocumentAnchorsResponses, GetDocumentBranchNameData, GetDocumentBranchNameError, GetDocumentBranchNameErrors, GetDocumentBranchNameResponse, GetDocumentBranchNameResponses, GetDocumentByTeamSlugData, GetDocumentByTeamSlugError, GetDocumentByTeamSlugErrors, GetDocumentByTeamSlugResponse, GetDocumentByTeamSlugResponses, GetDocumentCommentsData, GetDocumentCommentsError, GetDocumentCommentsErrors, GetDocumentCommentsResponse, GetDocumentCommentsResponses, GetDocumentData, GetDocumentError, GetDocumentErrors, GetDocumentGithubPullRequestsData, GetDocumentGithubPullRequestsError, GetDocumentGithubPullRequestsErrors, GetDocumentGithubPullRequestsResponse, GetDocumentGithubPullRequestsResponses, GetDocumentKeyResponse, GetDocumentKeyResponseData, GetDocumentListHandlerData, GetDocumentListHandlerError, GetDocumentListHandlerErrors, GetDocumentListHandlerResponse, GetDocumentListHandlerResponses, GetDocumentListResult, GetDocumentLocationV3Data, GetDocumentLocationV3Error, GetDocumentLocationV3Errors, GetDocumentLocationV3Response, GetDocumentLocationV3Responses, GetDocumentPermissionsResponseDataV2, GetDocumentPermissionsTokenData, GetDocumentPermissionsTokenError, GetDocumentPermissionsTokenErrors, GetDocumentPermissionsTokenResponse, GetDocumentPermissionsTokenResponses, GetDocumentPermissionsV2Data, GetDocumentPermissionsV2Error, GetDocumentPermissionsV2Errors, GetDocumentPermissionsV2Response, GetDocumentPermissionsV2Responses, GetDocumentProcessingResult, GetDocumentProcessingResultData, GetDocumentProcessingResultError, GetDocumentProcessingResultErrors, GetDocumentProcessingResultResponse, GetDocumentProcessingResultResponse2, GetDocumentProcessingResultResponses, GetDocumentResponse, GetDocumentResponse2, GetDocumentResponseData, GetDocumentResponses, GetDocumentSearchResponse, GetDocumentShortIdData, GetDocumentShortIdError, GetDocumentShortIdErrors, GetDocumentShortIdResponse, GetDocumentShortIdResponses, GetDocumentsResponse, GetDocumentTeamShareData, GetDocumentTeamShareError, GetDocumentTeamShareErrors, GetDocumentTeamShareResponse, GetDocumentTeamShareResponses, GetDocumentUserAccessLevelResponse, GetDocumentVersionData, GetDocumentVersionError, GetDocumentVersionErrors, GetDocumentVersionResponse, GetDocumentVersionResponses, GetDocumentViewsHandlerData, GetDocumentViewsHandlerError, GetDocumentViewsHandlerErrors, GetDocumentViewsHandlerResponse, GetDocumentViewsHandlerResponses, GetEntityPermissionData, GetEntityPermissionErrors, GetEntityPermissionResponse, GetEntityPermissionResponses, GetForeignEntityData, GetForeignEntityError, GetForeignEntityErrors, GetForeignEntityResponse, GetForeignEntityResponses, GetHistoryHandlerData, GetHistoryHandlerError, GetHistoryHandlerErrors, GetHistoryHandlerResponse, GetHistoryHandlerResponses, GetInstructionsDocumentResponse, GetInstructionsHandlerData, GetInstructionsHandlerError, GetInstructionsHandlerErrors, GetInstructionsHandlerResponse, GetInstructionsHandlerResponses, GetItemsSoupData, GetItemsSoupError, GetItemsSoupErrors, GetItemsSoupResponse, GetItemsSoupResponses, GetLocationHandlerData, GetLocationHandlerError, GetLocationHandlerErrors, GetLocationHandlerResponse, GetLocationHandlerResponses, GetMessageWithContextData, GetMessageWithContextError, GetMessageWithContextErrors, GetMessageWithContextResponse, GetMessageWithContextResponse2, GetMessageWithContextResponses, GetOrCreateAction, GetOrCreateCallData, GetOrCreateCallError, GetOrCreateCallErrors, GetOrCreateCallResponse, GetOrCreateCallResponses, GetOrCreateChannelResponse, GetOrCreateDmData, GetOrCreateDmError, GetOrCreateDmErrors, GetOrCreateDmRequest, GetOrCreateDmResponse, GetOrCreateDmResponses, GetOrCreatePrivateData, GetOrCreatePrivateError, GetOrCreatePrivateErrors, GetOrCreatePrivateRequest, GetOrCreatePrivateResponse, GetOrCreatePrivateResponses, GetPendingProjectsHandlerData, GetPendingProjectsHandlerError, GetPendingProjectsHandlerErrors, GetPendingProjectsHandlerResponse, GetPendingProjectsHandlerResponses, GetPinsHandlerData, GetPinsHandlerError, GetPinsHandlerErrors, GetPinsHandlerResponse, GetPinsHandlerResponses, GetPinsResponse, GetProjectContentHandlerData, GetProjectContentHandlerError, GetProjectContentHandlerErrors, GetProjectContentHandlerResponse, GetProjectContentHandlerResponses, GetProjectContentResponse, GetProjectHandlerData, GetProjectHandlerError, GetProjectHandlerErrors, GetProjectHandlerResponse, GetProjectHandlerResponses, GetProjectPermissionsV2Data, GetProjectPermissionsV2Error, GetProjectPermissionsV2Errors, GetProjectPermissionsV2Response, GetProjectPermissionsV2Responses, GetProjectResponse, GetProjectResponseData, GetProjectsHandlerData, GetProjectsHandlerError, GetProjectsHandlerErrors, GetProjectsHandlerResponse, GetProjectsHandlerResponses, GetProjectsResponse, GetProjectUserAccessLevelData, GetProjectUserAccessLevelError, GetProjectUserAccessLevelErrors, GetProjectUserAccessLevelResponse, GetProjectUserAccessLevelResponses, GetReminderData, GetReminderError, GetReminderErrors, GetReminderResponse, GetReminderResponses, GetRingStatusData, GetRingStatusError, GetRingStatusErrors, GetRingStatusResponse, GetRingStatusResponses, GetSelfBotData, GetSelfBotError, GetSelfBotErrors, GetSelfBotResponse, GetSelfBotResponses, GetSystemSkillsHandlerData, GetSystemSkillsHandlerError, GetSystemSkillsHandlerErrors, GetSystemSkillsHandlerResponse, GetSystemSkillsHandlerResponses, GetThreadRepliesData, GetThreadRepliesError, GetThreadRepliesErrors, GetThreadRepliesResponse, GetThreadRepliesResponses, GetUserDocumentsHandlerData, GetUserDocumentsHandlerError, GetUserDocumentsHandlerErrors, GetUserDocumentsHandlerResponse, GetUserDocumentsHandlerResponses, GetUserDocumentViewLocationData, GetUserDocumentViewLocationError, GetUserDocumentViewLocationErrors, GetUserDocumentViewLocationResponse, GetUserDocumentViewLocationResponses, GetUserHistoryResponse, GetViewsHandlerData, GetViewsHandlerError, GetViewsHandlerErrors, GetViewsHandlerResponse, GetViewsHandlerResponses, GetWebhookData, GetWebhookError, GetWebhookErrors, GetWebhookResponse, GetWebhookResponses, GithubPullRequest, GithubPullRequestCheckRun, GithubPullRequestComment, GithubPullRequestsResponse, GroupedInitialParams, GroupedPageParams, GroupedSoupGroupPage, GroupedSoupInitialPage, GroupedSoupPage, GroupedSoupSort, HandlerData, HandlerError, HandlerErrors, HandlerResponse, HandlerResponses, HashMap, HealthHandlerData, HealthHandlerResponse, HealthHandlerResponses, HighlightType, IngestTranscriptData, IngestTranscriptError, IngestTranscriptErrors, IngestTranscriptResponses, InitializeUserDocumentsData, InitializeUserDocumentsError, InitializeUserDocumentsErrors, InitializeUserDocumentsResponse, InitializeUserDocumentsResponses, InstallSyncData, InstallSyncErrors, InteractionReason, Item, ItemWithUserAccessLevel, JobProcessingResultHandlerData, JobProcessingResultHandlerError, JobProcessingResultHandlerErrors, JobProcessingResultHandlerResponse, JobProcessingResultHandlerResponses, JoinChannelByCodeData, JoinChannelByCodeError, JoinChannelByCodeErrors, JoinChannelByCodeResponses, JoinChannelData, JoinChannelError, JoinChannelErrors, JoinChannelResponses, LatestMessage, LeaveCallResponse, LeaveChannelData, LeaveChannelError, LeaveChannelErrors, LeaveChannelResponses, LeaveOrEndCallData, LeaveOrEndCallError, LeaveOrEndCallErrors, LeaveOrEndCallResponse, LeaveOrEndCallResponses, LinkShare, ListBotChannelsData, ListBotChannelsError, ListBotChannelsErrors, ListBotChannelsResponse, ListBotChannelsResponses, ListCompanyContactsData, ListCompanyContactsError, ListCompanyContactsErrors, ListCompanyContactsResponse, ListCompanyContactsResponses, ListCrmCommentsData, ListCrmCommentsError, ListCrmCommentsErrors, ListCrmCommentsResponse, ListCrmCommentsResponses, ListFavoritesData, ListFavoritesError, ListFavoritesErrors, ListFavoritesResponse, ListFavoritesResponses, ListOccurrencesData, ListOccurrencesErrors, ListOccurrencesResponse, ListOccurrencesResponses, ListRemindersData, ListRemindersError, ListRemindersErrors, ListRemindersResponse, ListRemindersResponses, ListWebhooksData, ListWebhooksError, ListWebhooksErrors, ListWebhooksResponse, ListWebhooksResponse2, ListWebhooksResponses, LocationResponseData, LocationResponseV3, MacroUserIdStr, MentionPreviewsData, MentionPreviewsErrors, MentionPreviewsResponse, MentionPreviewsResponses, Mentions, NewChannelAttachment, NotificationFilters, Params, ParticipantRole, PatchBotRequest, PatchChannelData, PatchChannelError, PatchChannelErrors, PatchChannelRequest, PatchChannelResponse, PatchChannelResponses, PatchMessageData, PatchMessageError, PatchMessageErrors, PatchMessageRequest, PatchMessageResponse, PatchMessageResponses, PatchProjectRequestV2, PatchThreadRequestV2, PatchViewHandlerData, PatchViewHandlerError, PatchViewHandlerErrors, PatchViewHandlerResponses, PatchWebhookData, PatchWebhookError, PatchWebhookErrors, PatchWebhookRequest, PatchWebhookResponse, PatchWebhookResponses, PdfAnchor, PdfAnchorId, PdfAnchorRequest, PdfHighlightAnchor, PdfHighlightAnchorRequest, PdfHighlightRect, PdfHighlightRectAnchorRequest, PdfPlaceableCommentAnchor, PdfPlaceableCommentAnchorRequest, PermanentlyDeleteDocumentData, PermanentlyDeleteDocumentError, PermanentlyDeleteDocumentErrors, PermanentlyDeleteDocumentResponse, PermanentlyDeleteDocumentResponses, PermanentlyDeleteProjectData, PermanentlyDeleteProjectError, PermanentlyDeleteProjectErrors, PermanentlyDeleteProjectResponse, PermanentlyDeleteProjectResponses, PinnedItem, PinRequest, PostActivityData, PostActivityError, PostActivityErrors, PostActivityRequest, PostActivityResponse, PostActivityResponses, PostChannelBotWebhookData, PostChannelBotWebhookError, PostChannelBotWebhookErrors, PostChannelBotWebhookResponse, PostChannelBotWebhookResponses, PostChannelMessagesData, PostChannelMessagesError, PostChannelMessagesErrors, PostChannelMessagesResponse, PostChannelMessagesResponses, PostGroupedSoupAstGroupPageRequest, PostGroupedSoupAstInitialRequest, PostGroupedSoupAstRequest, PostItemsSoupAstData, PostItemsSoupAstError, PostItemsSoupAstErrors, PostItemsSoupAstGroupedData, PostItemsSoupAstGroupedError, PostItemsSoupAstGroupedErrors, PostItemsSoupAstGroupedResponse, PostItemsSoupAstGroupedResponses, PostItemsSoupAstResponse, PostItemsSoupAstResponses, PostItemsSoupData, PostItemsSoupError, PostItemsSoupErrors, PostItemsSoupResponse, PostItemsSoupResponses, PostMessageData, PostMessageError, PostMessageErrors, PostMessageRequest, PostMessageResponse, PostMessageResponse2, PostMessageResponses, PostReactionData, PostReactionError, PostReactionErrors, PostReactionRequest, PostReactionResponse, PostReactionResponses, PostSoupAstRequest, PostSoupRequest, PostTypingData, PostTypingError, PostTypingErrors, PostTypingRequest, PostTypingResponse, PostTypingResponses, PresaveDocumentHandlerData, PresaveDocumentHandlerError, PresaveDocumentHandlerErrors, PresaveDocumentHandlerResponse, PresaveDocumentHandlerResponses, PreSaveDocumentRequest, PreSaveDocumentResponse, PreSaveDocumentResponseData, PresignedUrl, Project, ProjectDeleteResponseData, ProjectDocumentStatus, ProjectFilters, ProjectPreview, ProjectPreviewData, PropertyDefinition, PropertyFilter, PropertyInput, PropertyOwner, PropertyValue, PutCrmTeamSettingsData, PutCrmTeamSettingsError, PutCrmTeamSettingsErrors, PutCrmTeamSettingsResponse, PutCrmTeamSettingsResponses, ReactionAction, RecentlyDeletedData, RecentlyDeletedError, RecentlyDeletedErrors, RecentlyDeletedResponse, RecentlyDeletedResponseData, RecentlyDeletedResponses, Reminder, ReminderFilters, ReminderSchedule, RemindersList, RemoveBotFromChannelByBotData, RemoveBotFromChannelByBotError, RemoveBotFromChannelByBotErrors, RemoveBotFromChannelByBotResponse, RemoveBotFromChannelByBotResponses, RemoveFavoriteByEntityData, RemoveFavoriteByEntityError, RemoveFavoriteByEntityErrors, RemoveFavoriteByEntityResponses, RemoveParticipantsData, RemoveParticipantsError, RemoveParticipantsErrors, RemoveParticipantsRequest, RemoveParticipantsResponses, RemovePinHandlerData, RemovePinHandlerError, RemovePinHandlerErrors, RemovePinHandlerResponse, RemovePinHandlerResponses, ReorderFavoritesData, ReorderFavoritesError, ReorderFavoritesErrors, ReorderFavoritesRequest, ReorderFavoritesResponses, ReorderPinRequest, ReorderPinsHandlerData, ReorderPinsHandlerError, ReorderPinsHandlerErrors, ReorderPinsHandlerResponse, ReorderPinsHandlerResponses, ResolveChannelMessageData, ResolveChannelMessageError, ResolveChannelMessageErrors, ResolveChannelMessageResponse, ResolveChannelMessageResponses, RevertDeleteDocumentData, RevertDeleteDocumentError, RevertDeleteDocumentErrors, RevertDeleteDocumentResponse, RevertDeleteDocumentResponses, RevertDeleteProjectData, RevertDeleteProjectError, RevertDeleteProjectErrors, RevertDeleteProjectResponse, RevertDeleteProjectResponses, RingStatus, RingStatusResponse, S3ObjectInfo, SaveBomPart, SaveDocumentHandlerData, SaveDocumentHandlerError, SaveDocumentHandlerErrors, SaveDocumentHandlerResponse, SaveDocumentHandlerResponses, SaveDocumentRequest, SaveDocumentResponse, SaveDocumentResponseData, SetCompanyHiddenData, SetCompanyHiddenError, SetCompanyHiddenErrors, SetCompanyHiddenRequest, SetCompanyHiddenResponse, SetCompanyHiddenResponses, SetCompanyNameRequest, SetContactHiddenData, SetContactHiddenError, SetContactHiddenErrors, SetContactHiddenRequest, SetContactHiddenResponse, SetContactHiddenResponses, SetContactNameRequest, SetCrmCompanyNameData, SetCrmCompanyNameError, SetCrmCompanyNameErrors, SetCrmCompanyNameResponse, SetCrmCompanyNameResponses, SetCrmContactNameData, SetCrmContactNameError, SetCrmContactNameErrors, SetCrmContactNameResponse, SetCrmContactNameResponses, SetDocumentTeamShareData, SetDocumentTeamShareError, SetDocumentTeamShareErrors, SetDocumentTeamShareRequest, SetDocumentTeamShareResponse, SetDocumentTeamShareResponses, SetEmailSyncData, SetEmailSyncError, SetEmailSyncErrors, SetEmailSyncRequest, SetEmailSyncResponse, SetEmailSyncResponses, SetPropertyValue, SharedEmailFilter, SharePermissionV2, ShortIdResponse, SimpleMention, SimpleSaveData, SimpleSaveError, SimpleSaveErrors, SimpleSaveResponse, SimpleSaveResponses, SoupApiItem, SoupApiSort, SoupApiSortDirection, SoupAttachment, SoupCalendarEventSoupPropertiesField, SoupCalendarEventTime, SoupCallRecordParticipant, SoupCallRecordSoupPropertiesField, SoupChannel, SoupChannelThread, SoupChatSoupPropertiesField, SoupContact, SoupCountedReaction, SoupCrmCompanySoupPropertiesField, SoupCrmDomain, SoupDocumentSoupPropertiesField, SoupDocumentSubType, SoupEmailThreadPreview, SoupEnrichedEmailThreadPreviewSoupPropertiesField, SoupForeignEntity, SoupItem, SoupLabel, SoupLabelListVisibility, SoupLabelType, SoupMessageAttachment, SoupMessageListVisibility, SoupMessageSender, SoupMessageSenderType, SoupPage, SoupProjectSoupPropertiesField, SoupPropertiesField, SoupProperty, SoupReminderReference, SoupReminderSchedule, SoupReminderSoupPropertiesField, SoupThreadInfo, SoupThreadReply, StarterDocumentsResponse, String, SuccessResponse, SurfaceState, SyncServiceVersionId, SystemSkillSummary, TagFilterMode, TaskFilters, TeamRole, Thread, ThreadResponse, ToggleShareWithTeamData, ToggleShareWithTeamError, ToggleShareWithTeamErrors, ToggleShareWithTeamResponse, ToggleShareWithTeamResponses, TranscriptSegmentRequest, TypedSuccessResponse, TypedSuccessResponseGetDocumentResponseData, TypingAction, UnthreadedPdfUuidRequest, UpdateChannelSharePermission, UpdateCrmTeamSettingsRequest, UpdateOperation, UpdateReminderData, UpdateReminderError, UpdateReminderErrors, UpdateReminderRequest, UpdateReminderResponse, UpdateReminderResponses, UpdateSharePermissionRequestV2, UploadDocumentStatus, UploadExtractFolderHandlerData, UploadExtractFolderHandlerError, UploadExtractFolderHandlerErrors, UploadExtractFolderHandlerResponse, UploadExtractFolderHandlerResponses, UploadExtractFolderRequest, UploadFolderHandlerData, UploadFolderHandlerError, UploadFolderHandlerErrors, UploadFolderHandlerResponse, UploadFolderHandlerResponses, UploadFolderRequest, UpsertHistoryHandlerData, UpsertHistoryHandlerError, UpsertHistoryHandlerErrors, UpsertHistoryHandlerResponse, UpsertHistoryHandlerResponses, UpsertUserDocumentViewLocationData, UpsertUserDocumentViewLocationError, UpsertUserDocumentViewLocationErrors, UpsertUserDocumentViewLocationRequest, UpsertUserDocumentViewLocationResponse, UpsertUserDocumentViewLocationResponses, UserDocumentsResponse, UserDocumentViewLocation, UserDocumentViewLocationResponse, UserPinsResponse, UserViewsResponse, ValidateDocumentPermissionsTokenData, ValidateDocumentPermissionsTokenError, ValidateDocumentPermissionsTokenErrors, ValidateDocumentPermissionsTokenResponse, ValidateDocumentPermissionsTokenResponses, ValidateWebhookData, ValidateWebhookError, ValidateWebhookErrors, ValidateWebhookResponse, ValidateWebhookResponse2, ValidateWebhookResponses, Vec, View, ViewPatch, ViewsResponse, Webhook, WebhookEvent, WebhookFilter, WebhookScope, WebhookStatus, WebhookValidationTestEvent, WithCallId, WithChannelId, WithDocumentId, WithProjectId } from './types.gen';
+export type { AccessLevel, ActiveCallsResponse, ActiveCallSummary, ActivityType, AddFavoriteData, AddFavoriteError, AddFavoriteErrors, AddFavoriteRequest, AddFavoriteResponse, AddFavoriteResponses, AddParticipantsData, AddParticipantsError, AddParticipantsErrors, AddParticipantsRequest, AddParticipantsResponses, AddPinHandlerData, AddPinHandlerError, AddPinHandlerErrors, AddPinHandlerResponse, AddPinHandlerResponses, AddPinRequest, Anchor, AnchorId, AnchorRequest, AnchorResponse, AnnotationIncrementalUpdate, ApiActivity, ApiAttachmentChannelReference, ApiAttachmentEntityReference, ApiAttachmentGenericReference, ApiChannelAttachment, ApiChannelAttachmentsPage, ApiChannelContextMessage, ApiChannelDetail, ApiChannelListMessage, ApiChannelListPage, ApiChannelListParticipant, ApiChannelListType, ApiChannelMessage, ApiChannelMessageKind, ApiChannelMessagesPage, ApiChannelParticipant, ApiChannelWithLatest, ApiCountedReaction, ApiEntityFilterAst, ApiGroupByField, ApiGroupMeta, ApiMessageAttachment, ApiMessageSender, ApiMessageSenderType, ApiParticipantListRole, ApiParticipantRole, ApiPropertyEntityType, ApiResolvedChannelMessage, ApiThreadInfo, ApiThreadReply, AttendeeResponseStatus, BasicDocument, BasicDocumentSubType, BomPart, Bot, BotChannel, BotChannelType, BotId, BotKind, BotOwner, BotToken, BranchNameResponse, BTreeMap, BulkWakeupRequest, BulkWakeupResponse, BulkWakeupSyncServiceDocumentsData, BulkWakeupSyncServiceDocumentsErrors, BulkWakeupSyncServiceDocumentsResponse, BulkWakeupSyncServiceDocumentsResponses, CalendarAttendee, CalendarEvent, CalendarEventFilters, CalendarMentionEvent, CalendarMentionPreviewItem, CalendarMentionPreviewKind, CalendarMentionPreviewRequest, CalendarMentionPreviewRequestItem, CalendarMentionPreviewResponse, CalendarOccurrence, CalendarOccurrenceItem, CalendarOccurrenceResponse, CalendarSyncStatus, CallActiveResponse, CallFilters, CallRecord, CallRecordParticipant, CallRecordPreview, CallRecordPreviewData, CallRecordTranscriptSegment, CallStatus, CallTokenResponse, CallWebhookData, CallWebhookError, CallWebhookErrors, CallWebhookResponses, Channel, ChannelCreatedMetadata, ChannelDeletedMetadata, ChannelEventAttachment, ChannelFilters, ChannelJoinCodeResponse, ChannelMentionedMetadata, ChannelMessage, ChannelMessageAttachmentCreatedMetadata, ChannelMessageAttachmentRemovedMetadata, ChannelMessageDeletedMetadata, ChannelMessageFilters, ChannelMessagePatchedMetadata, ChannelMessagePostedMetadata, ChannelParticipant, ChannelParticipantAddedMetadata, ChannelParticipantRemovedMetadata, ChannelPreview, ChannelPreviewData, ChannelSender, ChannelSharePermission, ChannelThreadFilters, ChannelTopicEvent, ChannelType, ChannelUpdatedMetadata, ChannelWebhookRequest, ChannelWebhookResponse, ChannelWithParticipants, Chat, ChatFilters, CheckActiveCallData, CheckActiveCallError, CheckActiveCallErrors, CheckActiveCallResponse, CheckActiveCallResponses, ClientOptions, CloudStorageItemType, CollabSurfaceResponse, CollabSurfaceTokenResponse, Comment, CommentThread, ConferenceProvider, CopyDocumentData, CopyDocumentError, CopyDocumentErrors, CopyDocumentQueryParams, CopyDocumentRequest, CopyDocumentResponse, CopyDocumentResponse2, CopyDocumentResponses, CreateAnchorData, CreateAnchorError, CreateAnchorErrors, CreateAnchorResponse, CreateAnchorResponses, CreateBotRequest, CreateBulkDocumentResponse, CreateBulkDocumentResponseData, CreateChannelData, CreateChannelError, CreateChannelErrors, CreateChannelRequest, CreateChannelResponse, CreateChannelResponse2, CreateChannelResponses, CreateChannelScopedBotData, CreateChannelScopedBotError, CreateChannelScopedBotErrors, CreateChannelScopedBotRequest, CreateChannelScopedBotResponse, CreateChannelScopedBotResponse2, CreateChannelScopedBotResponses, CreateCollabSurfaceTokenData, CreateCollabSurfaceTokenError, CreateCollabSurfaceTokenErrors, CreateCollabSurfaceTokenResponse, CreateCollabSurfaceTokenResponses, CreateCommentData, CreateCommentError, CreateCommentErrors, CreateCommentRequest, CreateCommentResponse, CreateCommentResponse2, CreateCommentResponses, CreateCrmCommentData, CreateCrmCommentError, CreateCrmCommentErrors, CreateCrmCommentRequest, CreateCrmCommentResponse, CreateCrmCommentResponses, CreateCrmCompanyData, CreateCrmCompanyError, CreateCrmCompanyErrors, CreateCrmCompanyRequest, CreateCrmCompanyResponse, CreateCrmCompanyResponses, CreateCrmContactData, CreateCrmContactError, CreateCrmContactErrors, CreateCrmContactRequest, CreateCrmContactResponse, CreateCrmContactResponses, CreateDocumentData, CreateDocumentError, CreateDocumentErrors, CreateDocumentRequest, CreateDocumentResponse, CreateDocumentResponseData, CreateDocumentResponses, CreatedUserApiKey, CreateEntityMentionData, CreateEntityMentionError, CreateEntityMentionErrors, CreateEntityMentionRequest, CreateEntityMentionResponse, CreateEntityMentionResponse2, CreateEntityMentionResponses, CreateInstructionsDocumentResponse, CreateInstructionsHandlerData, CreateInstructionsHandlerError, CreateInstructionsHandlerErrors, CreateInstructionsHandlerResponse, CreateInstructionsHandlerResponses, CreateMarkdownDocumentRequest, CreateMarkdownDocumentResponse, CreateMarkdownHandlerData, CreateMarkdownHandlerError, CreateMarkdownHandlerErrors, CreateMarkdownHandlerResponse, CreateMarkdownHandlerResponses, CreateProjectHandlerData, CreateProjectHandlerError, CreateProjectHandlerErrors, CreateProjectHandlerResponse, CreateProjectHandlerResponses, CreateProjectRequest, CreateProjectResponse, CreateReminderData, CreateReminderError, CreateReminderErrors, CreateReminderRequest, CreateReminderResponse, CreateReminderResponses, CreateSkillHandlerData, CreateSkillHandlerError, CreateSkillHandlerErrors, CreateSkillHandlerResponse, CreateSkillHandlerResponses, CreateSkillRequest, CreateSkillResponse, CreateSnippetHandlerData, CreateSnippetHandlerError, CreateSnippetHandlerErrors, CreateSnippetHandlerResponse, CreateSnippetHandlerResponses, CreateSnippetRequest, CreateSnippetResponse, CreateTaskHandlerData, CreateTaskHandlerError, CreateTaskHandlerErrors, CreateTaskHandlerResponse, CreateTaskHandlerResponses, CreateTaskRequest, CreateTaskResponse, CreateUnthreadedAnchorRequest, CreateUnthreadedAnchorResponse, CreateUnthreadedPdfAnchorRequest, CreateUserApiKeyData, CreateUserApiKeyError, CreateUserApiKeyErrors, CreateUserApiKeyRequest, CreateUserApiKeyResponse, CreateUserApiKeyResponses, CreateViewHandlerData, CreateViewHandlerError, CreateViewHandlerErrors, CreateViewHandlerResponse, CreateViewHandlerResponses, CreateViewRequest, CreateWebhookData, CreateWebhookError, CreateWebhookErrors, CreateWebhookRequest, CreateWebhookResponse, CreateWebhookResponse2, CreateWebhookResponses, CrmComment, CrmCommentEntityType, CrmCommentThread, CrmCompanyFilters, CrmCompanyResponse, CrmContactResponse, CrmDomainResponse, CrmPermissionRole, CrmTeamSettingsResponse, CrmThread, CustomSpeakerAssignment, DataType, DeleteAnchorData, DeleteAnchorError, DeleteAnchorErrors, DeleteAnchorInfo, DeleteAnchorResponse, DeleteAnchorResponses, DeleteCallRecordData, DeleteCallRecordError, DeleteCallRecordErrors, DeleteCallRecordResponse, DeleteCallRecordResponses, DeleteChannelData, DeleteChannelError, DeleteChannelErrors, DeleteChannelResponse, DeleteChannelResponses, DeleteCollabSurfaceData, DeleteCollabSurfaceError, DeleteCollabSurfaceErrors, DeleteCollabSurfaceResponse, DeleteCollabSurfaceResponses, DeleteCommentData, DeleteCommentError, DeleteCommentErrors, DeleteCommentRequest, DeleteCommentResponse, DeleteCommentResponse2, DeleteCommentResponses, DeleteCrmCommentData, DeleteCrmCommentError, DeleteCrmCommentErrors, DeleteCrmCommentResponse, DeleteCrmCommentResponses, DeleteCrmCommentResult, DeleteDocumentData, DeleteDocumentError, DeleteDocumentErrors, DeleteDocumentResponse, DeleteDocumentResponses, DeleteEntityMentionData, DeleteEntityMentionError, DeleteEntityMentionErrors, DeleteEntityMentionResponse, DeleteEntityMentionResponse2, DeleteEntityMentionResponses, DeleteHistoryHandlerData, DeleteHistoryHandlerError, DeleteHistoryHandlerErrors, DeleteHistoryHandlerResponse, DeleteHistoryHandlerResponses, DeleteMessageData, DeleteMessageError, DeleteMessageErrors, DeleteMessageQuery, DeleteMessageResponse, DeleteMessageResponses, DeleteProjectHandlerData, DeleteProjectHandlerError, DeleteProjectHandlerErrors, DeleteProjectHandlerResponse, DeleteProjectHandlerResponses, DeleteReminderData, DeleteReminderError, DeleteReminderErrors, DeleteReminderResponse, DeleteReminderResponses, DeleteThreadInfo, DeleteUnthreadedAnchorRequest, DeleteUnthreadedAnchorResponse, DeleteUnthreadedPdfAnchorRequest, DeleteUserApiKeyData, DeleteUserApiKeyError, DeleteUserApiKeyErrors, DeleteUserApiKeyResponse, DeleteUserApiKeyResponses, DeleteUserDocumentViewLocationData, DeleteUserDocumentViewLocationError, DeleteUserDocumentViewLocationErrors, DeleteUserDocumentViewLocationResponse, DeleteUserDocumentViewLocationResponses, DeleteViewHandlerData, DeleteViewHandlerError, DeleteViewHandlerErrors, DeleteViewHandlerResponses, DeleteWebhookData, DeleteWebhookError, DeleteWebhookErrors, DeleteWebhookResponse, DeleteWebhookResponses, DocumentBasic, DocumentContent, DocumentContentLocation, DocumentContentState, DocumentContentUploadedMetadata, DocumentCopiedMetadata, DocumentCreatedMetadata, DocumentDeletedMetadata, DocumentFilters, DocumentInteractionMetadata, DocumentMetadata, DocumentMetadataWithContent, DocumentPermissionsToken, DocumentPermissionsTokenRequest, DocumentPermissionsTokenResponse, DocumentPreview, DocumentPreviewData, DocumentPreviewDataSubType, DocumentPurgedMetadata, DocumentResponse, DocumentResponseMetadata, DocumentResponseMetadataWithContent, DocumentStorageServiceApiVersion, DocumentSubType, DocumentSyncContentUpdatedMetadata, DocumentTeamShareResponse, DocumentTopicEvent, DocumentUpdatedMetadata, EditAnchorData, EditAnchorError, EditAnchorErrors, EditAnchorRequest, EditAnchorResponse, EditAnchorResponse2, EditAnchorResponses, EditCallRecordData, EditCallRecordError, EditCallRecordErrors, EditCallRecordRequest, EditCallRecordResponse, EditCallRecordResponses, EditCallTranscriptData, EditCallTranscriptError, EditCallTranscriptErrors, EditCallTranscriptRequest, EditCallTranscriptResponse, EditCallTranscriptResponses, EditCommentData, EditCommentError, EditCommentErrors, EditCommentRequest, EditCommentResponse, EditCommentResponse2, EditCommentResponses, EditCrmCommentData, EditCrmCommentError, EditCrmCommentErrors, EditCrmCommentRequest, EditCrmCommentResponse, EditCrmCommentResponses, EditDocumentData, EditDocumentError, EditDocumentErrors, EditDocumentResponse, EditDocumentResponse2, EditDocumentResponses, EditDocumentServiceArgs, EditPdfAnchorRequest, EditPdfPlaceableCommentAnchorRequest, EditProjectV2Data, EditProjectV2Error, EditProjectV2Errors, EditProjectV2Response, EditProjectV2Responses, EditThreadV2Data, EditThreadV2Error, EditThreadV2Errors, EditThreadV2Response, EditThreadV2Responses, EmailFilters, EmptyResponse, EnsureCollabSurfaceData, EnsureCollabSurfaceError, EnsureCollabSurfaceErrors, EnsureCollabSurfaceRequest, EnsureCollabSurfaceResponse, EnsureCollabSurfaceResponses, EntityFilters, EntityPermission, EntityPermissionResponse, EntityReference, EntityType, ErrorResponse, EventReminderOverride, EventReminders, EventStatus, EventTime, EventTransparency, EventType, EventVisibility, ExcludedDefaultView, ExcludeDefaultViewHandlerData, ExcludeDefaultViewHandlerError, ExcludeDefaultViewHandlerErrors, ExcludeDefaultViewHandlerResponses, ExcludeDefaultViewRequest, ExportDocumentData, ExportDocumentError, ExportDocumentErrors, ExportDocumentResponse, ExportDocumentResponse2, ExportDocumentResponses, Favorite, FavoriteEntityRef, FavoritesList, FileSystemNodeWithIds, FileType, FileTypeUpdate, FolderItem, ForeignEntity, ForeignEntityFilters, GenericErrorResponse, GenericResponse, GenericSuccessResponse, GetActiveCallsData, GetActiveCallsError, GetActiveCallsErrors, GetActiveCallsResponse, GetActiveCallsResponses, GetActivityData, GetActivityError, GetActivityErrors, GetActivityResponse, GetActivityResponses, GetAttachmentReferencesData, GetAttachmentReferencesError, GetAttachmentReferencesErrors, GetAttachmentReferencesResponse, GetAttachmentReferencesResponse2, GetAttachmentReferencesResponses, GetBatchCallRecordPreviewData, GetBatchCallRecordPreviewError, GetBatchCallRecordPreviewErrors, GetBatchCallRecordPreviewRequest, GetBatchCallRecordPreviewResponse, GetBatchCallRecordPreviewResponse2, GetBatchCallRecordPreviewResponses, GetBatchChannelPreviewData, GetBatchChannelPreviewError, GetBatchChannelPreviewErrors, GetBatchChannelPreviewRequest, GetBatchChannelPreviewResponse, GetBatchChannelPreviewResponse2, GetBatchChannelPreviewResponses, GetBatchPreviewHandlerData, GetBatchPreviewHandlerError, GetBatchPreviewHandlerErrors, GetBatchPreviewHandlerResponse, GetBatchPreviewHandlerResponses, GetBatchPreviewRequest, GetBatchPreviewResponse, GetBatchProjectPreviewData, GetBatchProjectPreviewError, GetBatchProjectPreviewErrors, GetBatchProjectPreviewRequest, GetBatchProjectPreviewResponse, GetBatchProjectPreviewResponse2, GetBatchProjectPreviewResponses, GetCallRecordData, GetCallRecordError, GetCallRecordErrors, GetCallRecordResponse, GetCallRecordResponses, GetChannelAttachmentsData, GetChannelAttachmentsError, GetChannelAttachmentsErrors, GetChannelAttachmentsResponse, GetChannelAttachmentsResponses, GetChannelData, GetChannelError, GetChannelErrors, GetChannelJoinLinkData, GetChannelJoinLinkError, GetChannelJoinLinkErrors, GetChannelJoinLinkResponse, GetChannelJoinLinkResponses, GetChannelMessagesData, GetChannelMessagesError, GetChannelMessagesErrors, GetChannelMessagesResponse, GetChannelMessagesResponses, GetChannelParticipantsData, GetChannelParticipantsError, GetChannelParticipantsErrors, GetChannelParticipantsResponse, GetChannelParticipantsResponses, GetChannelResponse, GetChannelResponses, GetChannelsData, GetChannelsError, GetChannelsErrors, GetChannelsResponse, GetChannelsResponses, GetCollabSurfaceData, GetCollabSurfaceError, GetCollabSurfaceErrors, GetCollabSurfaceResponse, GetCollabSurfaceResponses, GetCompanyData, GetCompanyError, GetCompanyErrors, GetCompanyResponse, GetCompanyResponses, GetContactByEmailData, GetContactByEmailError, GetContactByEmailErrors, GetContactByEmailResponse, GetContactByEmailResponse2, GetContactByEmailResponses, GetContactData, GetContactError, GetContactErrors, GetContactResponse, GetContactResponses, GetCrmTeamSettingsData, GetCrmTeamSettingsError, GetCrmTeamSettingsErrors, GetCrmTeamSettingsResponse, GetCrmTeamSettingsResponses, GetDocumentAnchorsData, GetDocumentAnchorsError, GetDocumentAnchorsErrors, GetDocumentAnchorsResponse, GetDocumentAnchorsResponses, GetDocumentBranchNameData, GetDocumentBranchNameError, GetDocumentBranchNameErrors, GetDocumentBranchNameResponse, GetDocumentBranchNameResponses, GetDocumentByTeamSlugData, GetDocumentByTeamSlugError, GetDocumentByTeamSlugErrors, GetDocumentByTeamSlugResponse, GetDocumentByTeamSlugResponses, GetDocumentCommentsData, GetDocumentCommentsError, GetDocumentCommentsErrors, GetDocumentCommentsResponse, GetDocumentCommentsResponses, GetDocumentData, GetDocumentError, GetDocumentErrors, GetDocumentGithubPullRequestsData, GetDocumentGithubPullRequestsError, GetDocumentGithubPullRequestsErrors, GetDocumentGithubPullRequestsResponse, GetDocumentGithubPullRequestsResponses, GetDocumentKeyResponse, GetDocumentKeyResponseData, GetDocumentListHandlerData, GetDocumentListHandlerError, GetDocumentListHandlerErrors, GetDocumentListHandlerResponse, GetDocumentListHandlerResponses, GetDocumentListResult, GetDocumentLocationV3Data, GetDocumentLocationV3Error, GetDocumentLocationV3Errors, GetDocumentLocationV3Response, GetDocumentLocationV3Responses, GetDocumentPermissionsResponseDataV2, GetDocumentPermissionsTokenData, GetDocumentPermissionsTokenError, GetDocumentPermissionsTokenErrors, GetDocumentPermissionsTokenResponse, GetDocumentPermissionsTokenResponses, GetDocumentPermissionsV2Data, GetDocumentPermissionsV2Error, GetDocumentPermissionsV2Errors, GetDocumentPermissionsV2Response, GetDocumentPermissionsV2Responses, GetDocumentProcessingResult, GetDocumentProcessingResultData, GetDocumentProcessingResultError, GetDocumentProcessingResultErrors, GetDocumentProcessingResultResponse, GetDocumentProcessingResultResponse2, GetDocumentProcessingResultResponses, GetDocumentResponse, GetDocumentResponse2, GetDocumentResponseData, GetDocumentResponses, GetDocumentSearchResponse, GetDocumentShortIdData, GetDocumentShortIdError, GetDocumentShortIdErrors, GetDocumentShortIdResponse, GetDocumentShortIdResponses, GetDocumentsResponse, GetDocumentTeamShareData, GetDocumentTeamShareError, GetDocumentTeamShareErrors, GetDocumentTeamShareResponse, GetDocumentTeamShareResponses, GetDocumentUserAccessLevelResponse, GetDocumentVersionData, GetDocumentVersionError, GetDocumentVersionErrors, GetDocumentVersionResponse, GetDocumentVersionResponses, GetDocumentViewsHandlerData, GetDocumentViewsHandlerError, GetDocumentViewsHandlerErrors, GetDocumentViewsHandlerResponse, GetDocumentViewsHandlerResponses, GetEntityPermissionData, GetEntityPermissionErrors, GetEntityPermissionResponse, GetEntityPermissionResponses, GetForeignEntityData, GetForeignEntityError, GetForeignEntityErrors, GetForeignEntityResponse, GetForeignEntityResponses, GetHistoryHandlerData, GetHistoryHandlerError, GetHistoryHandlerErrors, GetHistoryHandlerResponse, GetHistoryHandlerResponses, GetInstructionsDocumentResponse, GetInstructionsHandlerData, GetInstructionsHandlerError, GetInstructionsHandlerErrors, GetInstructionsHandlerResponse, GetInstructionsHandlerResponses, GetItemsSoupData, GetItemsSoupError, GetItemsSoupErrors, GetItemsSoupResponse, GetItemsSoupResponses, GetLocationHandlerData, GetLocationHandlerError, GetLocationHandlerErrors, GetLocationHandlerResponse, GetLocationHandlerResponses, GetMessageWithContextData, GetMessageWithContextError, GetMessageWithContextErrors, GetMessageWithContextResponse, GetMessageWithContextResponse2, GetMessageWithContextResponses, GetOrCreateAction, GetOrCreateCallData, GetOrCreateCallError, GetOrCreateCallErrors, GetOrCreateCallResponse, GetOrCreateCallResponses, GetOrCreateChannelResponse, GetOrCreateDmData, GetOrCreateDmError, GetOrCreateDmErrors, GetOrCreateDmRequest, GetOrCreateDmResponse, GetOrCreateDmResponses, GetOrCreatePrivateData, GetOrCreatePrivateError, GetOrCreatePrivateErrors, GetOrCreatePrivateRequest, GetOrCreatePrivateResponse, GetOrCreatePrivateResponses, GetPendingProjectsHandlerData, GetPendingProjectsHandlerError, GetPendingProjectsHandlerErrors, GetPendingProjectsHandlerResponse, GetPendingProjectsHandlerResponses, GetPinsHandlerData, GetPinsHandlerError, GetPinsHandlerErrors, GetPinsHandlerResponse, GetPinsHandlerResponses, GetPinsResponse, GetProjectContentHandlerData, GetProjectContentHandlerError, GetProjectContentHandlerErrors, GetProjectContentHandlerResponse, GetProjectContentHandlerResponses, GetProjectContentResponse, GetProjectHandlerData, GetProjectHandlerError, GetProjectHandlerErrors, GetProjectHandlerResponse, GetProjectHandlerResponses, GetProjectPermissionsV2Data, GetProjectPermissionsV2Error, GetProjectPermissionsV2Errors, GetProjectPermissionsV2Response, GetProjectPermissionsV2Responses, GetProjectResponse, GetProjectResponseData, GetProjectsHandlerData, GetProjectsHandlerError, GetProjectsHandlerErrors, GetProjectsHandlerResponse, GetProjectsHandlerResponses, GetProjectsResponse, GetProjectUserAccessLevelData, GetProjectUserAccessLevelError, GetProjectUserAccessLevelErrors, GetProjectUserAccessLevelResponse, GetProjectUserAccessLevelResponses, GetReminderData, GetReminderError, GetReminderErrors, GetReminderResponse, GetReminderResponses, GetRingStatusData, GetRingStatusError, GetRingStatusErrors, GetRingStatusResponse, GetRingStatusResponses, GetSelfBotData, GetSelfBotError, GetSelfBotErrors, GetSelfBotResponse, GetSelfBotResponses, GetSystemSkillsHandlerData, GetSystemSkillsHandlerError, GetSystemSkillsHandlerErrors, GetSystemSkillsHandlerResponse, GetSystemSkillsHandlerResponses, GetThreadRepliesData, GetThreadRepliesError, GetThreadRepliesErrors, GetThreadRepliesResponse, GetThreadRepliesResponses, GetUserDocumentsHandlerData, GetUserDocumentsHandlerError, GetUserDocumentsHandlerErrors, GetUserDocumentsHandlerResponse, GetUserDocumentsHandlerResponses, GetUserDocumentViewLocationData, GetUserDocumentViewLocationError, GetUserDocumentViewLocationErrors, GetUserDocumentViewLocationResponse, GetUserDocumentViewLocationResponses, GetUserHistoryResponse, GetViewsHandlerData, GetViewsHandlerError, GetViewsHandlerErrors, GetViewsHandlerResponse, GetViewsHandlerResponses, GetWebhookData, GetWebhookError, GetWebhookErrors, GetWebhookResponse, GetWebhookResponses, GithubPullRequest, GithubPullRequestCheckRun, GithubPullRequestComment, GithubPullRequestsResponse, GroupedInitialParams, GroupedPageParams, GroupedSoupGroupPage, GroupedSoupInitialPage, GroupedSoupPage, GroupedSoupSort, HandlerData, HandlerError, HandlerErrors, HandlerResponse, HandlerResponses, HashMap, HealthHandlerData, HealthHandlerResponse, HealthHandlerResponses, HighlightType, IngestTranscriptData, IngestTranscriptError, IngestTranscriptErrors, IngestTranscriptResponses, InitializeUserDocumentsData, InitializeUserDocumentsError, InitializeUserDocumentsErrors, InitializeUserDocumentsResponse, InitializeUserDocumentsResponses, InstallSyncData, InstallSyncErrors, InteractionReason, Item, ItemWithUserAccessLevel, JobProcessingResultHandlerData, JobProcessingResultHandlerError, JobProcessingResultHandlerErrors, JobProcessingResultHandlerResponse, JobProcessingResultHandlerResponses, JoinChannelByCodeData, JoinChannelByCodeError, JoinChannelByCodeErrors, JoinChannelByCodeResponses, JoinChannelData, JoinChannelError, JoinChannelErrors, JoinChannelResponses, LatestMessage, LeaveCallResponse, LeaveChannelData, LeaveChannelError, LeaveChannelErrors, LeaveChannelResponses, LeaveOrEndCallData, LeaveOrEndCallError, LeaveOrEndCallErrors, LeaveOrEndCallResponse, LeaveOrEndCallResponses, LinkShare, ListBotChannelsData, ListBotChannelsError, ListBotChannelsErrors, ListBotChannelsResponse, ListBotChannelsResponses, ListCompanyContactsData, ListCompanyContactsError, ListCompanyContactsErrors, ListCompanyContactsResponse, ListCompanyContactsResponses, ListCrmCommentsData, ListCrmCommentsError, ListCrmCommentsErrors, ListCrmCommentsResponse, ListCrmCommentsResponses, ListFavoritesData, ListFavoritesError, ListFavoritesErrors, ListFavoritesResponse, ListFavoritesResponses, ListOccurrencesData, ListOccurrencesErrors, ListOccurrencesResponse, ListOccurrencesResponses, ListRemindersData, ListRemindersError, ListRemindersErrors, ListRemindersResponse, ListRemindersResponses, ListUserApiKeysData, ListUserApiKeysError, ListUserApiKeysErrors, ListUserApiKeysResponse, ListUserApiKeysResponses, ListWebhooksData, ListWebhooksError, ListWebhooksErrors, ListWebhooksResponse, ListWebhooksResponse2, ListWebhooksResponses, LocationResponseData, LocationResponseV3, MacroUserIdStr, MentionPreviewsData, MentionPreviewsErrors, MentionPreviewsResponse, MentionPreviewsResponses, Mentions, NewChannelAttachment, NotificationFilters, Params, ParticipantRole, PatchBotRequest, PatchChannelData, PatchChannelError, PatchChannelErrors, PatchChannelRequest, PatchChannelResponse, PatchChannelResponses, PatchMessageData, PatchMessageError, PatchMessageErrors, PatchMessageRequest, PatchMessageResponse, PatchMessageResponses, PatchProjectRequestV2, PatchThreadRequestV2, PatchViewHandlerData, PatchViewHandlerError, PatchViewHandlerErrors, PatchViewHandlerResponses, PatchWebhookData, PatchWebhookError, PatchWebhookErrors, PatchWebhookRequest, PatchWebhookResponse, PatchWebhookResponses, PdfAnchor, PdfAnchorId, PdfAnchorRequest, PdfHighlightAnchor, PdfHighlightAnchorRequest, PdfHighlightRect, PdfHighlightRectAnchorRequest, PdfPlaceableCommentAnchor, PdfPlaceableCommentAnchorRequest, PermanentlyDeleteDocumentData, PermanentlyDeleteDocumentError, PermanentlyDeleteDocumentErrors, PermanentlyDeleteDocumentResponse, PermanentlyDeleteDocumentResponses, PermanentlyDeleteProjectData, PermanentlyDeleteProjectError, PermanentlyDeleteProjectErrors, PermanentlyDeleteProjectResponse, PermanentlyDeleteProjectResponses, PinnedItem, PinRequest, PostActivityData, PostActivityError, PostActivityErrors, PostActivityRequest, PostActivityResponse, PostActivityResponses, PostChannelBotWebhookData, PostChannelBotWebhookError, PostChannelBotWebhookErrors, PostChannelBotWebhookResponse, PostChannelBotWebhookResponses, PostChannelMessagesData, PostChannelMessagesError, PostChannelMessagesErrors, PostChannelMessagesResponse, PostChannelMessagesResponses, PostGroupedSoupAstGroupPageRequest, PostGroupedSoupAstInitialRequest, PostGroupedSoupAstRequest, PostItemsSoupAstData, PostItemsSoupAstError, PostItemsSoupAstErrors, PostItemsSoupAstGroupedData, PostItemsSoupAstGroupedError, PostItemsSoupAstGroupedErrors, PostItemsSoupAstGroupedResponse, PostItemsSoupAstGroupedResponses, PostItemsSoupAstResponse, PostItemsSoupAstResponses, PostItemsSoupData, PostItemsSoupError, PostItemsSoupErrors, PostItemsSoupResponse, PostItemsSoupResponses, PostMessageData, PostMessageError, PostMessageErrors, PostMessageRequest, PostMessageResponse, PostMessageResponse2, PostMessageResponses, PostReactionData, PostReactionError, PostReactionErrors, PostReactionRequest, PostReactionResponse, PostReactionResponses, PostSoupAstRequest, PostSoupRequest, PostTypingData, PostTypingError, PostTypingErrors, PostTypingRequest, PostTypingResponse, PostTypingResponses, PresaveDocumentHandlerData, PresaveDocumentHandlerError, PresaveDocumentHandlerErrors, PresaveDocumentHandlerResponse, PresaveDocumentHandlerResponses, PreSaveDocumentRequest, PreSaveDocumentResponse, PreSaveDocumentResponseData, PresignedUrl, Project, ProjectDeleteResponseData, ProjectDocumentStatus, ProjectFilters, ProjectPreview, ProjectPreviewData, PropertyDefinition, PropertyFilter, PropertyInput, PropertyOwner, PropertyValue, PutCrmTeamSettingsData, PutCrmTeamSettingsError, PutCrmTeamSettingsErrors, PutCrmTeamSettingsResponse, PutCrmTeamSettingsResponses, ReactionAction, RecentlyDeletedData, RecentlyDeletedError, RecentlyDeletedErrors, RecentlyDeletedResponse, RecentlyDeletedResponseData, RecentlyDeletedResponses, Reminder, ReminderFilters, ReminderSchedule, RemindersList, RemoveBotFromChannelByBotData, RemoveBotFromChannelByBotError, RemoveBotFromChannelByBotErrors, RemoveBotFromChannelByBotResponse, RemoveBotFromChannelByBotResponses, RemoveFavoriteByEntityData, RemoveFavoriteByEntityError, RemoveFavoriteByEntityErrors, RemoveFavoriteByEntityResponses, RemoveParticipantsData, RemoveParticipantsError, RemoveParticipantsErrors, RemoveParticipantsRequest, RemoveParticipantsResponses, RemovePinHandlerData, RemovePinHandlerError, RemovePinHandlerErrors, RemovePinHandlerResponse, RemovePinHandlerResponses, ReorderFavoritesData, ReorderFavoritesError, ReorderFavoritesErrors, ReorderFavoritesRequest, ReorderFavoritesResponses, ReorderPinRequest, ReorderPinsHandlerData, ReorderPinsHandlerError, ReorderPinsHandlerErrors, ReorderPinsHandlerResponse, ReorderPinsHandlerResponses, ResolveChannelMessageData, ResolveChannelMessageError, ResolveChannelMessageErrors, ResolveChannelMessageResponse, ResolveChannelMessageResponses, RevertDeleteDocumentData, RevertDeleteDocumentError, RevertDeleteDocumentErrors, RevertDeleteDocumentResponse, RevertDeleteDocumentResponses, RevertDeleteProjectData, RevertDeleteProjectError, RevertDeleteProjectErrors, RevertDeleteProjectResponse, RevertDeleteProjectResponses, RingStatus, RingStatusResponse, S3ObjectInfo, SaveBomPart, SaveDocumentHandlerData, SaveDocumentHandlerError, SaveDocumentHandlerErrors, SaveDocumentHandlerResponse, SaveDocumentHandlerResponses, SaveDocumentRequest, SaveDocumentResponse, SaveDocumentResponseData, SetCompanyHiddenData, SetCompanyHiddenError, SetCompanyHiddenErrors, SetCompanyHiddenRequest, SetCompanyHiddenResponse, SetCompanyHiddenResponses, SetCompanyNameRequest, SetContactHiddenData, SetContactHiddenError, SetContactHiddenErrors, SetContactHiddenRequest, SetContactHiddenResponse, SetContactHiddenResponses, SetContactNameRequest, SetCrmCompanyNameData, SetCrmCompanyNameError, SetCrmCompanyNameErrors, SetCrmCompanyNameResponse, SetCrmCompanyNameResponses, SetCrmContactNameData, SetCrmContactNameError, SetCrmContactNameErrors, SetCrmContactNameResponse, SetCrmContactNameResponses, SetDocumentTeamShareData, SetDocumentTeamShareError, SetDocumentTeamShareErrors, SetDocumentTeamShareRequest, SetDocumentTeamShareResponse, SetDocumentTeamShareResponses, SetEmailSyncData, SetEmailSyncError, SetEmailSyncErrors, SetEmailSyncRequest, SetEmailSyncResponse, SetEmailSyncResponses, SetPropertyValue, SharedEmailFilter, SharePermissionV2, ShortIdResponse, SimpleMention, SimpleSaveData, SimpleSaveError, SimpleSaveErrors, SimpleSaveResponse, SimpleSaveResponses, SoupApiItem, SoupApiSort, SoupApiSortDirection, SoupAttachment, SoupCalendarEventSoupPropertiesField, SoupCalendarEventTime, SoupCallRecordParticipant, SoupCallRecordSoupPropertiesField, SoupChannel, SoupChannelThread, SoupChatSoupPropertiesField, SoupContact, SoupCountedReaction, SoupCrmCompanySoupPropertiesField, SoupCrmDomain, SoupDocumentSoupPropertiesField, SoupDocumentSubType, SoupEmailThreadPreview, SoupEnrichedEmailThreadPreviewSoupPropertiesField, SoupForeignEntity, SoupItem, SoupLabel, SoupLabelListVisibility, SoupLabelType, SoupMessageAttachment, SoupMessageListVisibility, SoupMessageSender, SoupMessageSenderType, SoupPage, SoupProjectSoupPropertiesField, SoupPropertiesField, SoupProperty, SoupReminderReference, SoupReminderSchedule, SoupReminderSoupPropertiesField, SoupThreadInfo, SoupThreadReply, StarterDocumentsResponse, String, SuccessResponse, SurfaceState, SyncServiceVersionId, SystemSkillSummary, TagFilterMode, TaskFilters, TeamRole, Thread, ThreadResponse, ToggleShareWithTeamData, ToggleShareWithTeamError, ToggleShareWithTeamErrors, ToggleShareWithTeamResponse, ToggleShareWithTeamResponses, TranscriptSegmentRequest, TypedSuccessResponse, TypedSuccessResponseGetDocumentResponseData, TypingAction, UnthreadedPdfUuidRequest, UpdateChannelSharePermission, UpdateCrmTeamSettingsRequest, UpdateOperation, UpdateReminderData, UpdateReminderError, UpdateReminderErrors, UpdateReminderRequest, UpdateReminderResponse, UpdateReminderResponses, UpdateSharePermissionRequestV2, UploadDocumentStatus, UploadExtractFolderHandlerData, UploadExtractFolderHandlerError, UploadExtractFolderHandlerErrors, UploadExtractFolderHandlerResponse, UploadExtractFolderHandlerResponses, UploadExtractFolderRequest, UploadFolderHandlerData, UploadFolderHandlerError, UploadFolderHandlerErrors, UploadFolderHandlerResponse, UploadFolderHandlerResponses, UploadFolderRequest, UpsertHistoryHandlerData, UpsertHistoryHandlerError, UpsertHistoryHandlerErrors, UpsertHistoryHandlerResponse, UpsertHistoryHandlerResponses, UpsertUserDocumentViewLocationData, UpsertUserDocumentViewLocationError, UpsertUserDocumentViewLocationErrors, UpsertUserDocumentViewLocationRequest, UpsertUserDocumentViewLocationResponse, UpsertUserDocumentViewLocationResponses, UserApiKeyId, UserApiKeyInfo, UserApiKeysList, UserDocumentsResponse, UserDocumentViewLocation, UserDocumentViewLocationResponse, UserPinsResponse, UserViewsResponse, ValidateDocumentPermissionsTokenData, ValidateDocumentPermissionsTokenError, ValidateDocumentPermissionsTokenErrors, ValidateDocumentPermissionsTokenResponse, ValidateDocumentPermissionsTokenResponses, ValidateWebhookData, ValidateWebhookError, ValidateWebhookErrors, ValidateWebhookResponse, ValidateWebhookResponse2, ValidateWebhookResponses, Vec, View, ViewPatch, ViewsResponse, Webhook, WebhookEvent, WebhookFilter, WebhookScope, WebhookStatus, WebhookValidationTestEvent, WithCallId, WithChannelId, WithDocumentId, WithProjectId } from './types.gen';
diff --git a/packages/sdk/generated/storage/sdk.gen.ts b/packages/sdk/generated/storage/sdk.gen.ts
index 942e4628ea..fe15bc6368 100644
--- a/packages/sdk/generated/storage/sdk.gen.ts
+++ b/packages/sdk/generated/storage/sdk.gen.ts
@@ -2,7 +2,7 @@
import type { Client, ClientMeta, Options as Options2, RequestResult, TDataShape } from './client';
import { client } from './client.gen';
-import type { AddFavoriteData, AddFavoriteErrors, AddFavoriteResponses, AddParticipantsData, AddParticipantsErrors, AddParticipantsResponses, AddPinHandlerData, AddPinHandlerErrors, AddPinHandlerResponses, BulkWakeupSyncServiceDocumentsData, BulkWakeupSyncServiceDocumentsErrors, BulkWakeupSyncServiceDocumentsResponses, CallWebhookData, CallWebhookErrors, CallWebhookResponses, CheckActiveCallData, CheckActiveCallErrors, CheckActiveCallResponses, CopyDocumentData, CopyDocumentErrors, CopyDocumentResponses, CreateAnchorData, CreateAnchorErrors, CreateAnchorResponses, CreateChannelData, CreateChannelErrors, CreateChannelResponses, CreateChannelScopedBotData, CreateChannelScopedBotErrors, CreateChannelScopedBotResponses, CreateCollabSurfaceTokenData, CreateCollabSurfaceTokenErrors, CreateCollabSurfaceTokenResponses, CreateCommentData, CreateCommentErrors, CreateCommentResponses, CreateCrmCommentData, CreateCrmCommentErrors, CreateCrmCommentResponses, CreateCrmCompanyData, CreateCrmCompanyErrors, CreateCrmCompanyResponses, CreateCrmContactData, CreateCrmContactErrors, CreateCrmContactResponses, CreateDocumentData, CreateDocumentErrors, CreateDocumentResponses, CreateEntityMentionData, CreateEntityMentionErrors, CreateEntityMentionResponses, CreateInstructionsHandlerData, CreateInstructionsHandlerErrors, CreateInstructionsHandlerResponses, CreateMarkdownHandlerData, CreateMarkdownHandlerErrors, CreateMarkdownHandlerResponses, CreateProjectHandlerData, CreateProjectHandlerErrors, CreateProjectHandlerResponses, CreateReminderData, CreateReminderErrors, CreateReminderResponses, CreateSkillHandlerData, CreateSkillHandlerErrors, CreateSkillHandlerResponses, CreateSnippetHandlerData, CreateSnippetHandlerErrors, CreateSnippetHandlerResponses, CreateTaskHandlerData, CreateTaskHandlerErrors, CreateTaskHandlerResponses, CreateViewHandlerData, CreateViewHandlerErrors, CreateViewHandlerResponses, CreateWebhookData, CreateWebhookErrors, CreateWebhookResponses, DeleteAnchorData, DeleteAnchorErrors, DeleteAnchorResponses, DeleteCallRecordData, DeleteCallRecordErrors, DeleteCallRecordResponses, DeleteChannelData, DeleteChannelErrors, DeleteChannelResponses, DeleteCollabSurfaceData, DeleteCollabSurfaceErrors, DeleteCollabSurfaceResponses, DeleteCommentData, DeleteCommentErrors, DeleteCommentResponses, DeleteCrmCommentData, DeleteCrmCommentErrors, DeleteCrmCommentResponses, DeleteDocumentData, DeleteDocumentErrors, DeleteDocumentResponses, DeleteEntityMentionData, DeleteEntityMentionErrors, DeleteEntityMentionResponses, DeleteHistoryHandlerData, DeleteHistoryHandlerErrors, DeleteHistoryHandlerResponses, DeleteMessageData, DeleteMessageErrors, DeleteMessageResponses, DeleteProjectHandlerData, DeleteProjectHandlerErrors, DeleteProjectHandlerResponses, DeleteReminderData, DeleteReminderErrors, DeleteReminderResponses, DeleteUserDocumentViewLocationData, DeleteUserDocumentViewLocationErrors, DeleteUserDocumentViewLocationResponses, DeleteViewHandlerData, DeleteViewHandlerErrors, DeleteViewHandlerResponses, DeleteWebhookData, DeleteWebhookErrors, DeleteWebhookResponses, EditAnchorData, EditAnchorErrors, EditAnchorResponses, EditCallRecordData, EditCallRecordErrors, EditCallRecordResponses, EditCallTranscriptData, EditCallTranscriptErrors, EditCallTranscriptResponses, EditCommentData, EditCommentErrors, EditCommentResponses, EditCrmCommentData, EditCrmCommentErrors, EditCrmCommentResponses, EditDocumentData, EditDocumentErrors, EditDocumentResponses, EditProjectV2Data, EditProjectV2Errors, EditProjectV2Responses, EditThreadV2Data, EditThreadV2Errors, EditThreadV2Responses, EnsureCollabSurfaceData, EnsureCollabSurfaceErrors, EnsureCollabSurfaceResponses, ExcludeDefaultViewHandlerData, ExcludeDefaultViewHandlerErrors, ExcludeDefaultViewHandlerResponses, ExportDocumentData, ExportDocumentErrors, ExportDocumentResponses, GetActiveCallsData, GetActiveCallsErrors, GetActiveCallsResponses, GetActivityData, GetActivityErrors, GetActivityResponses, GetAttachmentReferencesData, GetAttachmentReferencesErrors, GetAttachmentReferencesResponses, GetBatchCallRecordPreviewData, GetBatchCallRecordPreviewErrors, GetBatchCallRecordPreviewResponses, GetBatchChannelPreviewData, GetBatchChannelPreviewErrors, GetBatchChannelPreviewResponses, GetBatchPreviewHandlerData, GetBatchPreviewHandlerErrors, GetBatchPreviewHandlerResponses, GetBatchProjectPreviewData, GetBatchProjectPreviewErrors, GetBatchProjectPreviewResponses, GetCallRecordData, GetCallRecordErrors, GetCallRecordResponses, GetChannelAttachmentsData, GetChannelAttachmentsErrors, GetChannelAttachmentsResponses, GetChannelData, GetChannelErrors, GetChannelJoinLinkData, GetChannelJoinLinkErrors, GetChannelJoinLinkResponses, GetChannelMessagesData, GetChannelMessagesErrors, GetChannelMessagesResponses, GetChannelParticipantsData, GetChannelParticipantsErrors, GetChannelParticipantsResponses, GetChannelResponses, GetChannelsData, GetChannelsErrors, GetChannelsResponses, GetCollabSurfaceData, GetCollabSurfaceErrors, GetCollabSurfaceResponses, GetCompanyData, GetCompanyErrors, GetCompanyResponses, GetContactByEmailData, GetContactByEmailErrors, GetContactByEmailResponses, GetContactData, GetContactErrors, GetContactResponses, GetCrmTeamSettingsData, GetCrmTeamSettingsErrors, GetCrmTeamSettingsResponses, GetDocumentAnchorsData, GetDocumentAnchorsErrors, GetDocumentAnchorsResponses, GetDocumentBranchNameData, GetDocumentBranchNameErrors, GetDocumentBranchNameResponses, GetDocumentByTeamSlugData, GetDocumentByTeamSlugErrors, GetDocumentByTeamSlugResponses, GetDocumentCommentsData, GetDocumentCommentsErrors, GetDocumentCommentsResponses, GetDocumentData, GetDocumentErrors, GetDocumentGithubPullRequestsData, GetDocumentGithubPullRequestsErrors, GetDocumentGithubPullRequestsResponses, GetDocumentListHandlerData, GetDocumentListHandlerErrors, GetDocumentListHandlerResponses, GetDocumentLocationV3Data, GetDocumentLocationV3Errors, GetDocumentLocationV3Responses, GetDocumentPermissionsTokenData, GetDocumentPermissionsTokenErrors, GetDocumentPermissionsTokenResponses, GetDocumentPermissionsV2Data, GetDocumentPermissionsV2Errors, GetDocumentPermissionsV2Responses, GetDocumentProcessingResultData, GetDocumentProcessingResultErrors, GetDocumentProcessingResultResponses, GetDocumentResponses, GetDocumentShortIdData, GetDocumentShortIdErrors, GetDocumentShortIdResponses, GetDocumentTeamShareData, GetDocumentTeamShareErrors, GetDocumentTeamShareResponses, GetDocumentVersionData, GetDocumentVersionErrors, GetDocumentVersionResponses, GetDocumentViewsHandlerData, GetDocumentViewsHandlerErrors, GetDocumentViewsHandlerResponses, GetEntityPermissionData, GetEntityPermissionErrors, GetEntityPermissionResponses, GetForeignEntityData, GetForeignEntityErrors, GetForeignEntityResponses, GetHistoryHandlerData, GetHistoryHandlerErrors, GetHistoryHandlerResponses, GetInstructionsHandlerData, GetInstructionsHandlerErrors, GetInstructionsHandlerResponses, GetItemsSoupData, GetItemsSoupErrors, GetItemsSoupResponses, GetLocationHandlerData, GetLocationHandlerErrors, GetLocationHandlerResponses, GetMessageWithContextData, GetMessageWithContextErrors, GetMessageWithContextResponses, GetOrCreateCallData, GetOrCreateCallErrors, GetOrCreateCallResponses, GetOrCreateDmData, GetOrCreateDmErrors, GetOrCreateDmResponses, GetOrCreatePrivateData, GetOrCreatePrivateErrors, GetOrCreatePrivateResponses, GetPendingProjectsHandlerData, GetPendingProjectsHandlerErrors, GetPendingProjectsHandlerResponses, GetPinsHandlerData, GetPinsHandlerErrors, GetPinsHandlerResponses, GetProjectContentHandlerData, GetProjectContentHandlerErrors, GetProjectContentHandlerResponses, GetProjectHandlerData, GetProjectHandlerErrors, GetProjectHandlerResponses, GetProjectPermissionsV2Data, GetProjectPermissionsV2Errors, GetProjectPermissionsV2Responses, GetProjectsHandlerData, GetProjectsHandlerErrors, GetProjectsHandlerResponses, GetProjectUserAccessLevelData, GetProjectUserAccessLevelErrors, GetProjectUserAccessLevelResponses, GetReminderData, GetReminderErrors, GetReminderResponses, GetRingStatusData, GetRingStatusErrors, GetRingStatusResponses, GetSelfBotData, GetSelfBotErrors, GetSelfBotResponses, GetSystemSkillsHandlerData, GetSystemSkillsHandlerErrors, GetSystemSkillsHandlerResponses, GetThreadRepliesData, GetThreadRepliesErrors, GetThreadRepliesResponses, GetUserDocumentsHandlerData, GetUserDocumentsHandlerErrors, GetUserDocumentsHandlerResponses, GetUserDocumentViewLocationData, GetUserDocumentViewLocationErrors, GetUserDocumentViewLocationResponses, GetViewsHandlerData, GetViewsHandlerErrors, GetViewsHandlerResponses, GetWebhookData, GetWebhookErrors, GetWebhookResponses, HandlerData, HandlerErrors, HandlerResponses, HealthHandlerData, HealthHandlerResponses, IngestTranscriptData, IngestTranscriptErrors, IngestTranscriptResponses, InitializeUserDocumentsData, InitializeUserDocumentsErrors, InitializeUserDocumentsResponses, InstallSyncData, InstallSyncErrors, JobProcessingResultHandlerData, JobProcessingResultHandlerErrors, JobProcessingResultHandlerResponses, JoinChannelByCodeData, JoinChannelByCodeErrors, JoinChannelByCodeResponses, JoinChannelData, JoinChannelErrors, JoinChannelResponses, LeaveChannelData, LeaveChannelErrors, LeaveChannelResponses, LeaveOrEndCallData, LeaveOrEndCallErrors, LeaveOrEndCallResponses, ListBotChannelsData, ListBotChannelsErrors, ListBotChannelsResponses, ListCompanyContactsData, ListCompanyContactsErrors, ListCompanyContactsResponses, ListCrmCommentsData, ListCrmCommentsErrors, ListCrmCommentsResponses, ListFavoritesData, ListFavoritesErrors, ListFavoritesResponses, ListOccurrencesData, ListOccurrencesErrors, ListOccurrencesResponses, ListRemindersData, ListRemindersErrors, ListRemindersResponses, ListWebhooksData, ListWebhooksErrors, ListWebhooksResponses, MentionPreviewsData, MentionPreviewsErrors, MentionPreviewsResponses, PatchChannelData, PatchChannelErrors, PatchChannelResponses, PatchMessageData, PatchMessageErrors, PatchMessageResponses, PatchViewHandlerData, PatchViewHandlerErrors, PatchViewHandlerResponses, PatchWebhookData, PatchWebhookErrors, PatchWebhookResponses, PermanentlyDeleteDocumentData, PermanentlyDeleteDocumentErrors, PermanentlyDeleteDocumentResponses, PermanentlyDeleteProjectData, PermanentlyDeleteProjectErrors, PermanentlyDeleteProjectResponses, PostActivityData, PostActivityErrors, PostActivityResponses, PostChannelBotWebhookData, PostChannelBotWebhookErrors, PostChannelBotWebhookResponses, PostChannelMessagesData, PostChannelMessagesErrors, PostChannelMessagesResponses, PostItemsSoupAstData, PostItemsSoupAstErrors, PostItemsSoupAstGroupedData, PostItemsSoupAstGroupedErrors, PostItemsSoupAstGroupedResponses, PostItemsSoupAstResponses, PostItemsSoupData, PostItemsSoupErrors, PostItemsSoupResponses, PostMessageData, PostMessageErrors, PostMessageResponses, PostReactionData, PostReactionErrors, PostReactionResponses, PostTypingData, PostTypingErrors, PostTypingResponses, PresaveDocumentHandlerData, PresaveDocumentHandlerErrors, PresaveDocumentHandlerResponses, PutCrmTeamSettingsData, PutCrmTeamSettingsErrors, PutCrmTeamSettingsResponses, RecentlyDeletedData, RecentlyDeletedErrors, RecentlyDeletedResponses, RemoveBotFromChannelByBotData, RemoveBotFromChannelByBotErrors, RemoveBotFromChannelByBotResponses, RemoveFavoriteByEntityData, RemoveFavoriteByEntityErrors, RemoveFavoriteByEntityResponses, RemoveParticipantsData, RemoveParticipantsErrors, RemoveParticipantsResponses, RemovePinHandlerData, RemovePinHandlerErrors, RemovePinHandlerResponses, ReorderFavoritesData, ReorderFavoritesErrors, ReorderFavoritesResponses, ReorderPinsHandlerData, ReorderPinsHandlerErrors, ReorderPinsHandlerResponses, ResolveChannelMessageData, ResolveChannelMessageErrors, ResolveChannelMessageResponses, RevertDeleteDocumentData, RevertDeleteDocumentErrors, RevertDeleteDocumentResponses, RevertDeleteProjectData, RevertDeleteProjectErrors, RevertDeleteProjectResponses, SaveDocumentHandlerData, SaveDocumentHandlerErrors, SaveDocumentHandlerResponses, SetCompanyHiddenData, SetCompanyHiddenErrors, SetCompanyHiddenResponses, SetContactHiddenData, SetContactHiddenErrors, SetContactHiddenResponses, SetCrmCompanyNameData, SetCrmCompanyNameErrors, SetCrmCompanyNameResponses, SetCrmContactNameData, SetCrmContactNameErrors, SetCrmContactNameResponses, SetDocumentTeamShareData, SetDocumentTeamShareErrors, SetDocumentTeamShareResponses, SetEmailSyncData, SetEmailSyncErrors, SetEmailSyncResponses, SimpleSaveData, SimpleSaveErrors, SimpleSaveResponses, ToggleShareWithTeamData, ToggleShareWithTeamErrors, ToggleShareWithTeamResponses, UpdateReminderData, UpdateReminderErrors, UpdateReminderResponses, UploadExtractFolderHandlerData, UploadExtractFolderHandlerErrors, UploadExtractFolderHandlerResponses, UploadFolderHandlerData, UploadFolderHandlerErrors, UploadFolderHandlerResponses, UpsertHistoryHandlerData, UpsertHistoryHandlerErrors, UpsertHistoryHandlerResponses, UpsertUserDocumentViewLocationData, UpsertUserDocumentViewLocationErrors, UpsertUserDocumentViewLocationResponses, ValidateDocumentPermissionsTokenData, ValidateDocumentPermissionsTokenErrors, ValidateDocumentPermissionsTokenResponses, ValidateWebhookData, ValidateWebhookErrors, ValidateWebhookResponses } from './types.gen';
+import type { AddFavoriteData, AddFavoriteErrors, AddFavoriteResponses, AddParticipantsData, AddParticipantsErrors, AddParticipantsResponses, AddPinHandlerData, AddPinHandlerErrors, AddPinHandlerResponses, BulkWakeupSyncServiceDocumentsData, BulkWakeupSyncServiceDocumentsErrors, BulkWakeupSyncServiceDocumentsResponses, CallWebhookData, CallWebhookErrors, CallWebhookResponses, CheckActiveCallData, CheckActiveCallErrors, CheckActiveCallResponses, CopyDocumentData, CopyDocumentErrors, CopyDocumentResponses, CreateAnchorData, CreateAnchorErrors, CreateAnchorResponses, CreateChannelData, CreateChannelErrors, CreateChannelResponses, CreateChannelScopedBotData, CreateChannelScopedBotErrors, CreateChannelScopedBotResponses, CreateCollabSurfaceTokenData, CreateCollabSurfaceTokenErrors, CreateCollabSurfaceTokenResponses, CreateCommentData, CreateCommentErrors, CreateCommentResponses, CreateCrmCommentData, CreateCrmCommentErrors, CreateCrmCommentResponses, CreateCrmCompanyData, CreateCrmCompanyErrors, CreateCrmCompanyResponses, CreateCrmContactData, CreateCrmContactErrors, CreateCrmContactResponses, CreateDocumentData, CreateDocumentErrors, CreateDocumentResponses, CreateEntityMentionData, CreateEntityMentionErrors, CreateEntityMentionResponses, CreateInstructionsHandlerData, CreateInstructionsHandlerErrors, CreateInstructionsHandlerResponses, CreateMarkdownHandlerData, CreateMarkdownHandlerErrors, CreateMarkdownHandlerResponses, CreateProjectHandlerData, CreateProjectHandlerErrors, CreateProjectHandlerResponses, CreateReminderData, CreateReminderErrors, CreateReminderResponses, CreateSkillHandlerData, CreateSkillHandlerErrors, CreateSkillHandlerResponses, CreateSnippetHandlerData, CreateSnippetHandlerErrors, CreateSnippetHandlerResponses, CreateTaskHandlerData, CreateTaskHandlerErrors, CreateTaskHandlerResponses, CreateUserApiKeyData, CreateUserApiKeyErrors, CreateUserApiKeyResponses, CreateViewHandlerData, CreateViewHandlerErrors, CreateViewHandlerResponses, CreateWebhookData, CreateWebhookErrors, CreateWebhookResponses, DeleteAnchorData, DeleteAnchorErrors, DeleteAnchorResponses, DeleteCallRecordData, DeleteCallRecordErrors, DeleteCallRecordResponses, DeleteChannelData, DeleteChannelErrors, DeleteChannelResponses, DeleteCollabSurfaceData, DeleteCollabSurfaceErrors, DeleteCollabSurfaceResponses, DeleteCommentData, DeleteCommentErrors, DeleteCommentResponses, DeleteCrmCommentData, DeleteCrmCommentErrors, DeleteCrmCommentResponses, DeleteDocumentData, DeleteDocumentErrors, DeleteDocumentResponses, DeleteEntityMentionData, DeleteEntityMentionErrors, DeleteEntityMentionResponses, DeleteHistoryHandlerData, DeleteHistoryHandlerErrors, DeleteHistoryHandlerResponses, DeleteMessageData, DeleteMessageErrors, DeleteMessageResponses, DeleteProjectHandlerData, DeleteProjectHandlerErrors, DeleteProjectHandlerResponses, DeleteReminderData, DeleteReminderErrors, DeleteReminderResponses, DeleteUserApiKeyData, DeleteUserApiKeyErrors, DeleteUserApiKeyResponses, DeleteUserDocumentViewLocationData, DeleteUserDocumentViewLocationErrors, DeleteUserDocumentViewLocationResponses, DeleteViewHandlerData, DeleteViewHandlerErrors, DeleteViewHandlerResponses, DeleteWebhookData, DeleteWebhookErrors, DeleteWebhookResponses, EditAnchorData, EditAnchorErrors, EditAnchorResponses, EditCallRecordData, EditCallRecordErrors, EditCallRecordResponses, EditCallTranscriptData, EditCallTranscriptErrors, EditCallTranscriptResponses, EditCommentData, EditCommentErrors, EditCommentResponses, EditCrmCommentData, EditCrmCommentErrors, EditCrmCommentResponses, EditDocumentData, EditDocumentErrors, EditDocumentResponses, EditProjectV2Data, EditProjectV2Errors, EditProjectV2Responses, EditThreadV2Data, EditThreadV2Errors, EditThreadV2Responses, EnsureCollabSurfaceData, EnsureCollabSurfaceErrors, EnsureCollabSurfaceResponses, ExcludeDefaultViewHandlerData, ExcludeDefaultViewHandlerErrors, ExcludeDefaultViewHandlerResponses, ExportDocumentData, ExportDocumentErrors, ExportDocumentResponses, GetActiveCallsData, GetActiveCallsErrors, GetActiveCallsResponses, GetActivityData, GetActivityErrors, GetActivityResponses, GetAttachmentReferencesData, GetAttachmentReferencesErrors, GetAttachmentReferencesResponses, GetBatchCallRecordPreviewData, GetBatchCallRecordPreviewErrors, GetBatchCallRecordPreviewResponses, GetBatchChannelPreviewData, GetBatchChannelPreviewErrors, GetBatchChannelPreviewResponses, GetBatchPreviewHandlerData, GetBatchPreviewHandlerErrors, GetBatchPreviewHandlerResponses, GetBatchProjectPreviewData, GetBatchProjectPreviewErrors, GetBatchProjectPreviewResponses, GetCallRecordData, GetCallRecordErrors, GetCallRecordResponses, GetChannelAttachmentsData, GetChannelAttachmentsErrors, GetChannelAttachmentsResponses, GetChannelData, GetChannelErrors, GetChannelJoinLinkData, GetChannelJoinLinkErrors, GetChannelJoinLinkResponses, GetChannelMessagesData, GetChannelMessagesErrors, GetChannelMessagesResponses, GetChannelParticipantsData, GetChannelParticipantsErrors, GetChannelParticipantsResponses, GetChannelResponses, GetChannelsData, GetChannelsErrors, GetChannelsResponses, GetCollabSurfaceData, GetCollabSurfaceErrors, GetCollabSurfaceResponses, GetCompanyData, GetCompanyErrors, GetCompanyResponses, GetContactByEmailData, GetContactByEmailErrors, GetContactByEmailResponses, GetContactData, GetContactErrors, GetContactResponses, GetCrmTeamSettingsData, GetCrmTeamSettingsErrors, GetCrmTeamSettingsResponses, GetDocumentAnchorsData, GetDocumentAnchorsErrors, GetDocumentAnchorsResponses, GetDocumentBranchNameData, GetDocumentBranchNameErrors, GetDocumentBranchNameResponses, GetDocumentByTeamSlugData, GetDocumentByTeamSlugErrors, GetDocumentByTeamSlugResponses, GetDocumentCommentsData, GetDocumentCommentsErrors, GetDocumentCommentsResponses, GetDocumentData, GetDocumentErrors, GetDocumentGithubPullRequestsData, GetDocumentGithubPullRequestsErrors, GetDocumentGithubPullRequestsResponses, GetDocumentListHandlerData, GetDocumentListHandlerErrors, GetDocumentListHandlerResponses, GetDocumentLocationV3Data, GetDocumentLocationV3Errors, GetDocumentLocationV3Responses, GetDocumentPermissionsTokenData, GetDocumentPermissionsTokenErrors, GetDocumentPermissionsTokenResponses, GetDocumentPermissionsV2Data, GetDocumentPermissionsV2Errors, GetDocumentPermissionsV2Responses, GetDocumentProcessingResultData, GetDocumentProcessingResultErrors, GetDocumentProcessingResultResponses, GetDocumentResponses, GetDocumentShortIdData, GetDocumentShortIdErrors, GetDocumentShortIdResponses, GetDocumentTeamShareData, GetDocumentTeamShareErrors, GetDocumentTeamShareResponses, GetDocumentVersionData, GetDocumentVersionErrors, GetDocumentVersionResponses, GetDocumentViewsHandlerData, GetDocumentViewsHandlerErrors, GetDocumentViewsHandlerResponses, GetEntityPermissionData, GetEntityPermissionErrors, GetEntityPermissionResponses, GetForeignEntityData, GetForeignEntityErrors, GetForeignEntityResponses, GetHistoryHandlerData, GetHistoryHandlerErrors, GetHistoryHandlerResponses, GetInstructionsHandlerData, GetInstructionsHandlerErrors, GetInstructionsHandlerResponses, GetItemsSoupData, GetItemsSoupErrors, GetItemsSoupResponses, GetLocationHandlerData, GetLocationHandlerErrors, GetLocationHandlerResponses, GetMessageWithContextData, GetMessageWithContextErrors, GetMessageWithContextResponses, GetOrCreateCallData, GetOrCreateCallErrors, GetOrCreateCallResponses, GetOrCreateDmData, GetOrCreateDmErrors, GetOrCreateDmResponses, GetOrCreatePrivateData, GetOrCreatePrivateErrors, GetOrCreatePrivateResponses, GetPendingProjectsHandlerData, GetPendingProjectsHandlerErrors, GetPendingProjectsHandlerResponses, GetPinsHandlerData, GetPinsHandlerErrors, GetPinsHandlerResponses, GetProjectContentHandlerData, GetProjectContentHandlerErrors, GetProjectContentHandlerResponses, GetProjectHandlerData, GetProjectHandlerErrors, GetProjectHandlerResponses, GetProjectPermissionsV2Data, GetProjectPermissionsV2Errors, GetProjectPermissionsV2Responses, GetProjectsHandlerData, GetProjectsHandlerErrors, GetProjectsHandlerResponses, GetProjectUserAccessLevelData, GetProjectUserAccessLevelErrors, GetProjectUserAccessLevelResponses, GetReminderData, GetReminderErrors, GetReminderResponses, GetRingStatusData, GetRingStatusErrors, GetRingStatusResponses, GetSelfBotData, GetSelfBotErrors, GetSelfBotResponses, GetSystemSkillsHandlerData, GetSystemSkillsHandlerErrors, GetSystemSkillsHandlerResponses, GetThreadRepliesData, GetThreadRepliesErrors, GetThreadRepliesResponses, GetUserDocumentsHandlerData, GetUserDocumentsHandlerErrors, GetUserDocumentsHandlerResponses, GetUserDocumentViewLocationData, GetUserDocumentViewLocationErrors, GetUserDocumentViewLocationResponses, GetViewsHandlerData, GetViewsHandlerErrors, GetViewsHandlerResponses, GetWebhookData, GetWebhookErrors, GetWebhookResponses, HandlerData, HandlerErrors, HandlerResponses, HealthHandlerData, HealthHandlerResponses, IngestTranscriptData, IngestTranscriptErrors, IngestTranscriptResponses, InitializeUserDocumentsData, InitializeUserDocumentsErrors, InitializeUserDocumentsResponses, InstallSyncData, InstallSyncErrors, JobProcessingResultHandlerData, JobProcessingResultHandlerErrors, JobProcessingResultHandlerResponses, JoinChannelByCodeData, JoinChannelByCodeErrors, JoinChannelByCodeResponses, JoinChannelData, JoinChannelErrors, JoinChannelResponses, LeaveChannelData, LeaveChannelErrors, LeaveChannelResponses, LeaveOrEndCallData, LeaveOrEndCallErrors, LeaveOrEndCallResponses, ListBotChannelsData, ListBotChannelsErrors, ListBotChannelsResponses, ListCompanyContactsData, ListCompanyContactsErrors, ListCompanyContactsResponses, ListCrmCommentsData, ListCrmCommentsErrors, ListCrmCommentsResponses, ListFavoritesData, ListFavoritesErrors, ListFavoritesResponses, ListOccurrencesData, ListOccurrencesErrors, ListOccurrencesResponses, ListRemindersData, ListRemindersErrors, ListRemindersResponses, ListUserApiKeysData, ListUserApiKeysErrors, ListUserApiKeysResponses, ListWebhooksData, ListWebhooksErrors, ListWebhooksResponses, MentionPreviewsData, MentionPreviewsErrors, MentionPreviewsResponses, PatchChannelData, PatchChannelErrors, PatchChannelResponses, PatchMessageData, PatchMessageErrors, PatchMessageResponses, PatchViewHandlerData, PatchViewHandlerErrors, PatchViewHandlerResponses, PatchWebhookData, PatchWebhookErrors, PatchWebhookResponses, PermanentlyDeleteDocumentData, PermanentlyDeleteDocumentErrors, PermanentlyDeleteDocumentResponses, PermanentlyDeleteProjectData, PermanentlyDeleteProjectErrors, PermanentlyDeleteProjectResponses, PostActivityData, PostActivityErrors, PostActivityResponses, PostChannelBotWebhookData, PostChannelBotWebhookErrors, PostChannelBotWebhookResponses, PostChannelMessagesData, PostChannelMessagesErrors, PostChannelMessagesResponses, PostItemsSoupAstData, PostItemsSoupAstErrors, PostItemsSoupAstGroupedData, PostItemsSoupAstGroupedErrors, PostItemsSoupAstGroupedResponses, PostItemsSoupAstResponses, PostItemsSoupData, PostItemsSoupErrors, PostItemsSoupResponses, PostMessageData, PostMessageErrors, PostMessageResponses, PostReactionData, PostReactionErrors, PostReactionResponses, PostTypingData, PostTypingErrors, PostTypingResponses, PresaveDocumentHandlerData, PresaveDocumentHandlerErrors, PresaveDocumentHandlerResponses, PutCrmTeamSettingsData, PutCrmTeamSettingsErrors, PutCrmTeamSettingsResponses, RecentlyDeletedData, RecentlyDeletedErrors, RecentlyDeletedResponses, RemoveBotFromChannelByBotData, RemoveBotFromChannelByBotErrors, RemoveBotFromChannelByBotResponses, RemoveFavoriteByEntityData, RemoveFavoriteByEntityErrors, RemoveFavoriteByEntityResponses, RemoveParticipantsData, RemoveParticipantsErrors, RemoveParticipantsResponses, RemovePinHandlerData, RemovePinHandlerErrors, RemovePinHandlerResponses, ReorderFavoritesData, ReorderFavoritesErrors, ReorderFavoritesResponses, ReorderPinsHandlerData, ReorderPinsHandlerErrors, ReorderPinsHandlerResponses, ResolveChannelMessageData, ResolveChannelMessageErrors, ResolveChannelMessageResponses, RevertDeleteDocumentData, RevertDeleteDocumentErrors, RevertDeleteDocumentResponses, RevertDeleteProjectData, RevertDeleteProjectErrors, RevertDeleteProjectResponses, SaveDocumentHandlerData, SaveDocumentHandlerErrors, SaveDocumentHandlerResponses, SetCompanyHiddenData, SetCompanyHiddenErrors, SetCompanyHiddenResponses, SetContactHiddenData, SetContactHiddenErrors, SetContactHiddenResponses, SetCrmCompanyNameData, SetCrmCompanyNameErrors, SetCrmCompanyNameResponses, SetCrmContactNameData, SetCrmContactNameErrors, SetCrmContactNameResponses, SetDocumentTeamShareData, SetDocumentTeamShareErrors, SetDocumentTeamShareResponses, SetEmailSyncData, SetEmailSyncErrors, SetEmailSyncResponses, SimpleSaveData, SimpleSaveErrors, SimpleSaveResponses, ToggleShareWithTeamData, ToggleShareWithTeamErrors, ToggleShareWithTeamResponses, UpdateReminderData, UpdateReminderErrors, UpdateReminderResponses, UploadExtractFolderHandlerData, UploadExtractFolderHandlerErrors, UploadExtractFolderHandlerResponses, UploadFolderHandlerData, UploadFolderHandlerErrors, UploadFolderHandlerResponses, UpsertHistoryHandlerData, UpsertHistoryHandlerErrors, UpsertHistoryHandlerResponses, UpsertUserDocumentViewLocationData, UpsertUserDocumentViewLocationErrors, UpsertUserDocumentViewLocationResponses, ValidateDocumentPermissionsTokenData, ValidateDocumentPermissionsTokenErrors, ValidateDocumentPermissionsTokenResponses, ValidateWebhookData, ValidateWebhookErrors, ValidateWebhookResponses } from './types.gen';
export type Options<TData extends TDataShape = TDataShape, ThrowOnError extends boolean = boolean, TResponse = unknown> = Options2<TData, ThrowOnError, TResponse> & {
/**
@@ -1808,6 +1808,34 @@ export class Sdk extends HeyApiClient {
});
}
+ /**
+ * List the caller's API keys.
+ */
+ public listUserApiKeys<ThrowOnError extends boolean = false>(options?: Options<ListUserApiKeysData, ThrowOnError>): RequestResult<ListUserApiKeysResponses, ListUserApiKeysErrors, ThrowOnError> {
+ return (options?.client ?? this.client).get<ListUserApiKeysResponses, ListUserApiKeysErrors, ThrowOnError>({ url: '/user-api-keys', ...options });
+ }
+
+ /**
+ * Mint a new API key for the caller.
+ */
+ public createUserApiKey<ThrowOnError extends boolean = false>(options: Options<CreateUserApiKeyData, ThrowOnError>): RequestResult<CreateUserApiKeyResponses, CreateUserApiKeyErrors, ThrowOnError> {
+ return (options.client ?? this.client).post<CreateUserApiKeyResponses, CreateUserApiKeyErrors, ThrowOnError>({
+ url: '/user-api-keys',
+ ...options,
+ headers: {
+ 'Content-Type': 'application/json',
+ ...options.headers
+ }
+ });
+ }
+
+ /**
+ * Delete one of the caller's API keys.
+ */
+ public deleteUserApiKey<ThrowOnError extends boolean = false>(options: Options<DeleteUserApiKeyData, ThrowOnError>): RequestResult<DeleteUserApiKeyResponses, DeleteUserApiKeyErrors, ThrowOnError> {
+ return (options.client ?? this.client).delete<DeleteUserApiKeyResponses, DeleteUserApiKeyErrors, ThrowOnError>({ url: '/user-api-keys/{id}', ...options });
+ }
+
/**
* Deletes a document location for the user
*/
diff --git a/packages/sdk/generated/storage/types.gen.ts b/packages/sdk/generated/storage/types.gen.ts
index 12b050eb48..56e04a30d9 100644
--- a/packages/sdk/generated/storage/types.gen.ts
+++ b/packages/sdk/generated/storage/types.gen.ts
@@ -3237,6 +3237,16 @@ export type CreateUnthreadedPdfAnchorRequest = PdfHighlightAnchorRequest & {
anchorType: 'highlight';
};
+/**
+ * Request body for minting a key.
+ */
+export type CreateUserApiKeyRequest = {
+ /**
+ * User-facing name for the key.
+ */
+ name: string;
+};
+
export type CreateViewRequest = {
config: unknown;
name: string;
@@ -3337,6 +3347,28 @@ export type CreateWebhookResponse = {
workspace_id: string;
};
+/**
+ * A newly minted key: safe metadata plus the secret, shown only once.
+ */
+export type CreatedUserApiKey = {
+ /**
+ * When the key was created.
+ */
+ createdAt: string;
+ /**
+ * Opaque identifier used to address the key after create.
+ */
+ id: UserApiKeyId;
+ /**
+ * The newly minted secret. Shown only on create.
+ */
+ key: string;
+ /**
+ * User-facing name.
+ */
+ name: string;
+};
+
/**
* A single comment within a [`CrmThread`].
*/
@@ -8307,6 +8339,39 @@ export type UpsertUserDocumentViewLocationRequest = {
location: string;
};
+/**
+ * Opaque identifier for a stored user API key.
+ */
+export type UserApiKeyId = string;
+
+/**
+ * Safe metadata for a stored key. Never contains the secret or its hash.
+ */
+export type UserApiKeyInfo = {
+ /**
+ * When the key was created.
+ */
+ createdAt: string;
+ /**
+ * Opaque identifier used to address the key after create.
+ */
+ id: UserApiKeyId;
+ /**
+ * User-facing name.
+ */
+ name: string;
+};
+
+/**
+ * The caller's API keys as id, name, and created_at.
+ */
+export type UserApiKeysList = {
+ /**
+ * The caller's keys. Never includes the raw secret or hash.
+ */
+ keys: Array<UserApiKeyInfo>;
+};
+
/**
* The last place a user viewed a particular document at
*/
@@ -13053,6 +13118,76 @@ export type EditThreadV2Responses = {
export type EditThreadV2Response = EditThreadV2Responses[keyof EditThreadV2Responses];
+export type ListUserApiKeysData = {
+ body?: never;
+ path?: never;
+ query?: never;
+ url: '/user-api-keys';
+};
+
+export type ListUserApiKeysErrors = {
+ 401: ErrorResponse;
+ 500: ErrorResponse;
+};
+
+export type ListUserApiKeysError = ListUserApiKeysErrors[keyof ListUserApiKeysErrors];
+
+export type ListUserApiKeysResponses = {
+ 200: UserApiKeysList;
+};
+
+export type ListUserApiKeysResponse = ListUserApiKeysResponses[keyof ListUserApiKeysResponses];
+
+export type CreateUserApiKeyData = {
+ body: CreateUserApiKeyRequest;
+ path?: never;
+ query?: never;
+ url: '/user-api-keys';
+};
+
+export type CreateUserApiKeyErrors = {
+ 400: ErrorResponse;
+ 401: ErrorResponse;
+ 500: ErrorResponse;
+};
+
+export type CreateUserApiKeyError = CreateUserApiKeyErrors[keyof CreateUserApiKeyErrors];
+
+export type CreateUserApiKeyResponses = {
+ 201: CreatedUserApiKey;
+};
+
+export type CreateUserApiKeyResponse = CreateUserApiKeyResponses[keyof CreateUserApiKeyResponses];
+
+export type DeleteUserApiKeyData = {
+ body?: never;
+ path: {
+ /**
+ * Opaque key identifier.
+ */
+ id: UserApiKeyId;
+ };
+ query?: never;
+ url: '/user-api-keys/{id}';
+};
+
+export type DeleteUserApiKeyErrors = {
+ 401: ErrorResponse;
+ 404: ErrorResponse;
+ 500: ErrorResponse;
+};
+
+export type DeleteUserApiKeyError = DeleteUserApiKeyErrors[keyof DeleteUserApiKeyErrors];
+
+export type DeleteUserApiKeyResponses = {
+ /**
+ * API key deleted
+ */
+ 204: void;
+};
+
+export type DeleteUserApiKeyResponse = DeleteUserApiKeyResponses[keyof DeleteUserApiKeyResponses];
+
export type DeleteUserDocumentViewLocationData = {
body?: never;
path: {
diff --git a/packages/sdk/specs/storage.json b/packages/sdk/specs/storage.json
index 9e299d9e03..12d504ca64 100644
--- a/packages/sdk/specs/storage.json
+++ b/packages/sdk/specs/storage.json
@@ -10798,6 +10798,155 @@
}
}
},
+ "/user-api-keys": {
+ "get": {
+ "tags": ["user-api-keys"],
+ "summary": "List the caller's API keys.",
+ "operationId": "list_user_api_keys",
+ "responses": {
+ "200": {
+ "description": "",
+ "content": {
+ "application/json": {
+ "schema": {
+ "$ref": "#/components/schemas/UserApiKeysList"
+ }
+ }
+ }
+ },
+ "401": {
+ "description": "",
+ "content": {
+ "application/json": {
+ "schema": {
+ "$ref": "#/components/schemas/ErrorResponse"
+ }
+ }
+ }
+ },
+ "500": {
+ "description": "",
+ "content": {
+ "application/json": {
+ "schema": {
+ "$ref": "#/components/schemas/ErrorResponse"
+ }
+ }
+ }
+ }
+ }
+ },
+ "post": {
+ "tags": ["user-api-keys"],
+ "summary": "Mint a new API key for the caller.",
+ "operationId": "create_user_api_key",
+ "requestBody": {
+ "content": {
+ "application/json": {
+ "schema": {
+ "$ref": "#/components/schemas/CreateUserApiKeyRequest"
+ }
+ }
+ },
+ "required": true
+ },
+ "responses": {
+ "201": {
+ "description": "",
+ "content": {
+ "application/json": {
+ "schema": {
+ "$ref": "#/components/schemas/CreatedUserApiKey"
+ }
+ }
+ }
+ },
+ "400": {
+ "description": "",
+ "content": {
+ "application/json": {
+ "schema": {
+ "$ref": "#/components/schemas/ErrorResponse"
+ }
+ }
+ }
+ },
+ "401": {
+ "description": "",
+ "content": {
+ "application/json": {
+ "schema": {
+ "$ref": "#/components/schemas/ErrorResponse"
+ }
+ }
+ }
+ },
+ "500": {
+ "description": "",
+ "content": {
+ "application/json": {
+ "schema": {
+ "$ref": "#/components/schemas/ErrorResponse"
+ }
+ }
+ }
+ }
+ }
+ }
+ },
+ "/user-api-keys/{id}": {
+ "delete": {
+ "tags": ["user-api-keys"],
+ "summary": "Delete one of the caller's API keys.",
+ "operationId": "delete_user_api_key",
+ "parameters": [
+ {
+ "name": "id",
+ "in": "path",
+ "description": "Opaque key identifier.",
+ "required": true,
+ "schema": {
+ "$ref": "#/components/schemas/UserApiKeyId"
+ }
+ }
+ ],
+ "responses": {
+ "204": {
+ "description": "API key deleted"
+ },
+ "401": {
+ "description": "",
+ "content": {
+ "application/json": {
+ "schema": {
+ "$ref": "#/components/schemas/ErrorResponse"
+ }
+ }
+ }
+ },
+ "404": {
+ "description": "",
+ "content": {
+ "application/json": {
+ "schema": {
+ "$ref": "#/components/schemas/ErrorResponse"
+ }
+ }
+ }
+ },
+ "500": {
+ "description": "",
+ "content": {
+ "application/json": {
+ "schema": {
+ "$ref": "#/components/schemas/ErrorResponse"
+ }
+ }
+ }
+ }
+ }
+ }
+ },
"/user_document_view_location/{document_id}": {
"get": {
"tags": [
@@ -16100,6 +16249,17 @@
}
]
},
+ "CreateUserApiKeyRequest": {
+ "type": "object",
+ "description": "Request body for minting a key.",
+ "required": ["name"],
+ "properties": {
+ "name": {
+ "type": "string",
+ "description": "User-facing name for the key."
+ }
+ }
+ },
"CreateViewRequest": {
"type": "object",
"required": ["name", "config"],
@@ -16228,6 +16388,30 @@
}
}
},
+ "CreatedUserApiKey": {
+ "type": "object",
+ "description": "A newly minted key: safe metadata plus the secret, shown only once.",
+ "required": ["id", "name", "createdAt", "key"],
+ "properties": {
+ "createdAt": {
+ "type": "string",
+ "format": "date-time",
+ "description": "When the key was created."
+ },
+ "id": {
+ "$ref": "#/components/schemas/UserApiKeyId",
+ "description": "Opaque identifier used to address the key after create."
+ },
+ "key": {
+ "type": "string",
+ "description": "The newly minted secret. Shown only on create."
+ },
+ "name": {
+ "type": "string",
+ "description": "User-facing name."
+ }
+ }
+ },
"CrmComment": {
"type": "object",
"description": "A single comment within a [`CrmThread`].",
@@ -24698,6 +24882,45 @@
}
}
},
+ "UserApiKeyId": {
+ "type": "string",
+ "format": "uuid",
+ "description": "Opaque identifier for a stored user API key."
+ },
+ "UserApiKeyInfo": {
+ "type": "object",
+ "description": "Safe metadata for a stored key. Never contains the secret or its hash.",
+ "required": ["id", "name", "createdAt"],
+ "properties": {
+ "createdAt": {
+ "type": "string",
+ "format": "date-time",
+ "description": "When the key was created."
+ },
+ "id": {
+ "$ref": "#/components/schemas/UserApiKeyId",
+ "description": "Opaque identifier used to address the key after create."
+ },
+ "name": {
+ "type": "string",
+ "description": "User-facing name."
+ }
+ }
+ },
+ "UserApiKeysList": {
+ "type": "object",
+ "description": "The caller's API keys as id, name, and created_at.",
+ "required": ["keys"],
+ "properties": {
+ "keys": {
+ "type": "array",
+ "items": {
+ "$ref": "#/components/schemas/UserApiKeyInfo"
+ },
+ "description": "The caller's keys. Never includes the raw secret or hash."
+ }
+ }
+ },
"UserDocumentViewLocation": {
"type": "object",
"description": "The last place a user viewed a particular document at",
diff --git a/packages/sdk/src/coverage/skipped.ts b/packages/sdk/src/coverage/skipped.ts
index 75dbad1d67..f647a45e32 100644
--- a/packages/sdk/src/coverage/skipped.ts
+++ b/packages/sdk/src/coverage/skipped.ts
@@ -313,9 +313,11 @@ export const storageBacklog = [
'createDocument',
'createEntityMention',
'createReminder',
+ 'createUserApiKey',
'deleteAnchor',
'deleteEntityMention',
'deleteReminder',
+ 'deleteUserApiKey',
'editAnchor',
'editCallTranscript',
'editThreadV2',
@@ -331,6 +333,7 @@ export const storageBacklog = [
'getReminder',
'listOccurrences',
'listReminders',
+ 'listUserApiKeys',
'postActivity',
'presaveDocumentHandler',
'saveDocumentHandler',
diff --git a/services/document_storage_service/Cargo.toml b/services/document_storage_service/Cargo.toml
index b839cb5ea9..23755fd520 100644
--- a/services/document_storage_service/Cargo.toml
+++ b/services/document_storage_service/Cargo.toml
@@ -216,6 +216,10 @@ tower-http = { workspace = true, features = ["compression-gzip"] }
tracing = { workspace = true }
unicode-segmentation = { workspace = true }
urlencoding = { workspace = true }
+user_api_key = { path = "../../crates/user_api_key", features = [
+ "inbound",
+ "postgres",
+] }
utoipa = { workspace = true, features = ["axum_extras"] }
utoipa-swagger-ui = { workspace = true, features = ["axum"] }
uuid = { workspace = true }
diff --git a/services/document_storage_service/src/api.rs b/services/document_storage_service/src/api.rs
index 7ad9f0d63f..c6b65cf161 100644
--- a/services/document_storage_service/src/api.rs
+++ b/services/document_storage_service/src/api.rs
@@ -225,6 +225,12 @@ fn api_router(state: ApiContext) -> Router {
"/favorites",
favorites::inbound::axum_router::favorites_router(state.favorites_state.clone()),
)
+ .nest(
+ "/user-api-keys",
+ user_api_key::inbound::axum_router::user_api_key_router(
+ state.user_api_key_state.clone(),
+ ),
+ )
.nest(
"/reminders",
reminders::inbound::axum_router::reminders_router(state.reminders_state.clone()),
diff --git a/services/document_storage_service/src/api/context.rs b/services/document_storage_service/src/api/context.rs
index 4ed3129a42..819c94304e 100644
--- a/services/document_storage_service/src/api/context.rs
+++ b/services/document_storage_service/src/api/context.rs
@@ -62,6 +62,10 @@ use favorites::{
outbound::pg_favorites_repo::PgFavoritesRepo,
};
use macro_event_broker::{KafkaEventPublisher, MacroEventBrokerService};
+use user_api_key::{
+ domain::service::UserApiKeyServiceImpl, inbound::axum_router::UserApiKeyRouterState,
+ outbound::pg_user_api_keys_repo::PgUserApiKeysRepo,
+};
use collab_surface::{
domain::service::CollabSurfaceServiceImpl, inbound::axum_router::CollabSurfaceRouterState,
@@ -437,6 +441,13 @@ pub(crate) type FavoritesServiceType = FavoritesServiceImpl<PgFavoritesRepo>;
pub(crate) type DssFavoritesState =
FavoritesRouterState<FavoritesServiceType, EntityAccessService, AuthorizationService>;
+/// Type alias for the user API key service.
+pub(crate) type UserApiKeyServiceType = UserApiKeyServiceImpl<PgUserApiKeysRepo>;
+
+/// Type alias for the user API key router state.
+pub(crate) type DssUserApiKeyState =
+ UserApiKeyRouterState<UserApiKeyServiceType, AuthorizationService>;
+
/// Type alias for the reminders service.
pub(crate) type RemindersServiceType = RemindersServiceImpl<PgRemindersRepo>;
@@ -502,6 +513,7 @@ pub(crate) struct ApiContext {
pub graphql_entity_mutation_service: Arc<DssEntityMutationService>,
pub favorites_state: DssFavoritesState,
pub favorites_service: Arc<FavoritesServiceType>,
+ pub user_api_key_state: DssUserApiKeyState,
pub reminders_state: DssRemindersState,
pub collab_surface_state: DssCollabSurfaceState,
pub foreign_entity_state: DssForeignEntityState,
diff --git a/services/document_storage_service/src/api/swagger.rs b/services/document_storage_service/src/api/swagger.rs
index d94dc18659..a0b2006ef2 100644
--- a/services/document_storage_service/src/api/swagger.rs
+++ b/services/document_storage_service/src/api/swagger.rs
@@ -135,6 +135,8 @@ use soup::inbound::axum_router::{
PostGroupedSoupAstRequest, PostSoupAstRequest, PostSoupRequest, SoupApiItem, SoupApiSort,
SoupPage,
};
+use user_api_key::domain::models::{CreatedUserApiKey, UserApiKeyInfo};
+use user_api_key::inbound::axum_router::{CreateUserApiKeyRequest, UserApiKeysList};
use utoipa::OpenApi;
#[derive(OpenApi)]
@@ -310,6 +312,11 @@ use utoipa::OpenApi;
favorites::inbound::axum_router::remove_favorite_by_entity_handler,
favorites::inbound::axum_router::reorder_favorites_handler,
+ // user api keys
+ user_api_key::inbound::axum_router::create_user_api_key_handler,
+ user_api_key::inbound::axum_router::list_user_api_keys_handler,
+ user_api_key::inbound::axum_router::delete_user_api_key_handler,
+
// reminders
reminders::inbound::axum_router::list_reminders_handler,
reminders::inbound::axum_router::create_reminder_handler,
@@ -456,6 +463,10 @@ use utoipa::OpenApi;
ForeignEntity,
Favorite,
FavoritesList,
+ CreatedUserApiKey,
+ CreateUserApiKeyRequest,
+ UserApiKeyInfo,
+ UserApiKeysList,
AddFavoriteRequest,
FavoriteEntityRef,
ReorderFavoritesRequest,
diff --git a/services/document_storage_service/src/main.rs b/services/document_storage_service/src/main.rs
index 46f3264773..36d149616c 100644
--- a/services/document_storage_service/src/main.rs
+++ b/services/document_storage_service/src/main.rs
@@ -150,6 +150,10 @@ use task_dedup::{
},
};
use tokio_util::{sync::CancellationToken, task::TaskTracker};
+use user_api_key::{
+ domain::service::UserApiKeyServiceImpl, inbound::axum_router::UserApiKeyRouterState,
+ outbound::pg_user_api_keys_repo::PgUserApiKeysRepo,
+};
mod api;
mod config;
@@ -1164,6 +1168,9 @@ async fn run() -> anyhow::Result<()> {
});
let favorites_service = Arc::new(FavoritesServiceImpl::new(PgFavoritesRepo::new(db.clone())));
+ let user_api_key_service = Arc::new(UserApiKeyServiceImpl::new(PgUserApiKeysRepo::new(
+ db.clone(),
+ )));
let calendar_state = CalendarRouterState::new(
Arc::new(calendar_events::domain::service::CalendarService::new(
calendar_events::outbound::pg::PgCalendarRepository::new(readonly_db.clone()),
@@ -1268,6 +1275,10 @@ async fn run() -> anyhow::Result<()> {
authorization_state.clone(),
),
favorites_service,
+ user_api_key_state: UserApiKeyRouterState::new(
+ user_api_key_service,
+ authorization_state.clone(),
+ ),
reminders_state: RemindersRouterState::new(
Arc::new(reminders_service),
entity_access_service.clone(),
diff --git a/tooling/just/rust.just b/tooling/just/rust.just
index df653d461c..49127fe9e5 100644
--- a/tooling/just/rust.just
+++ b/tooling/just/rust.just
@@ -86,6 +86,7 @@ setup_test_envs:
echo "DATABASE_URL={{ DATABASE_URL }}" >> ./crates/frecency/.env
echo "DATABASE_URL={{ DATABASE_URL }}" >> ./crates/favorites/.env
echo "DATABASE_URL={{ DATABASE_URL }}" >> ./crates/reminders/.env
+ echo "DATABASE_URL={{ DATABASE_URL }}" >> ./crates/user_api_key/.env
echo "DATABASE_URL={{ DATABASE_URL }}" >> ./crates/soup/.env
echo "DATABASE_URL={{ DATABASE_URL }}" >> ./crates/email/.env
echo "DATABASE_URL={{ DATABASE_URL }}" >> ./crates/system_properties/.env