diff --git a/CHANGELOG.md b/CHANGELOG.md index f637183..49bad3c 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -5,6 +5,12 @@ All notable changes to this project will be documented in this file. The format is based on [Keep a Changelog](http://keepachangelog.com/) and this project adheres to [Semantic Versioning](http://semver.org/). +## [0.0.13] — 2024-11-07 + +### Added + +- Ability to clone session for a user to achieve more [loom-like](https://github.com/socketteer/loom/) behavior + ## [0.0.12] — 2024-10-21 ### Added diff --git a/README.md b/README.md index 04ec956..748cb63 100644 --- a/README.md +++ b/README.md @@ -1,6 +1,6 @@ # 🫡 Honcho -![Static Badge](https://img.shields.io/badge/Version-0.0.12-blue) +![Static Badge](https://img.shields.io/badge/Version-0.0.13-blue) [![Discord](https://img.shields.io/discord/1016845111637839922?style=flat&logo=discord&logoColor=23ffffff&label=Plastic%20Labs&labelColor=235865F2)](https://discord.gg/plasticlabs) [![arXiv](https://img.shields.io/badge/arXiv-2310.06983-b31b1b.svg)](https://arxiv.org/abs/2310.06983) ![GitHub License](https://img.shields.io/github/license/plastic-labs/honcho) diff --git a/docs/api-reference/endpoint/sessions/clone-session.mdx b/docs/api-reference/endpoint/sessions/clone-session.mdx new file mode 100644 index 0000000..871d995 --- /dev/null +++ b/docs/api-reference/endpoint/sessions/clone-session.mdx @@ -0,0 +1,3 @@ +--- +openapi: get /v1/apps/{app_id}/users/{user_id}/sessions/{session_id}/clone +--- \ No newline at end of file diff --git a/docs/api-reference/endpoint/sessions/get-chat-stream.mdx b/docs/api-reference/endpoint/sessions/get-chat-stream.mdx new file mode 100644 index 0000000..4963b36 --- /dev/null +++ b/docs/api-reference/endpoint/sessions/get-chat-stream.mdx @@ -0,0 +1,3 @@ +--- +openapi: post /v1/apps/{app_id}/users/{user_id}/sessions/{session_id}/chat/stream +--- \ No newline at end of file diff --git a/docs/mint.json b/docs/mint.json index 3397a40..b874e4e 100644 --- a/docs/mint.json +++ b/docs/mint.json @@ -109,7 +109,8 @@ "api-reference/endpoint/sessions/update-session", "api-reference/endpoint/sessions/delete-session", "api-reference/endpoint/sessions/chat", - "api-reference/endpoint/sessions/chat-stream" + "api-reference/endpoint/sessions/chat-stream", + "api-reference/endpoint/sessions/clone-session" ] }, { @@ -159,7 +160,7 @@ "github": "https://github.com/plastic-labs", "linkedin": "https://www.linkedin.com/company/plasticlabs" }, - "openapi": ["/openapi.json"], + "openapi": ["/openapi.yml"], "analytics": { "posthog": { "apiKey": "phc_1yrzzcgywqXGcerkkI4g7C0YfyPMcAKNOOvGcjTCiUk" diff --git a/docs/openapi.json b/docs/openapi.json deleted file mode 100644 index a9553ec..0000000 --- a/docs/openapi.json +++ /dev/null @@ -1,3235 +0,0 @@ -{ - "openapi": "3.1.0", - "info": { - "title": "Honcho API", - "summary": "An API for adding personalization to AI Apps", - "description": "This API is used to store data and get insights about users for AI\n applications", - "contact": { - "name": "Plastic Labs", - "url": "https://plasticlabs.ai/", - "email": "hello@plasticlabs.ai" - }, - "version": "0.0.12" - }, - "servers": [ - { - "url": "http://127.0.0.1:8000", - "description": "Local Development Server" - }, - { "url": "https:/demo.honcho.dev", "description": "Demo Server" } - ], - "paths": { - "/v1/apps/{app_id}": { - "get": { - "tags": ["apps"], - "summary": "Get App", - "description": "Get an App by ID\n\nArgs:\n app_id (str): The ID of the app\n\nReturns:\n schemas.App: App object", - "operationId": "get_app_v1_apps__app_id__get", - "security": [{ "HTTPBearer": [] }, {}], - "parameters": [ - { - "name": "app_id", - "in": "path", - "required": true, - "schema": { "type": "string", "title": "App Id" } - } - ], - "responses": { - "200": { - "description": "Successful Response", - "content": { - "application/json": { - "schema": { "$ref": "#/components/schemas/App" } - } - } - }, - "422": { - "description": "Validation Error", - "content": { - "application/json": { - "schema": { "$ref": "#/components/schemas/HTTPValidationError" } - } - } - } - }, - "x-codeSamples": [ - { - "lang": "JavaScript", - "source": "import Honcho from 'honcho';\n\nconst client = new Honcho({\n apiKey: process.env['HONCHO_API_KEY'], // This is the default and can be omitted\n});\n\nasync function main() {\n const app = await client.apps.get('app_id');\n\n console.log(app.id);\n}\n\nmain();" - }, - { - "lang": "Python", - "source": "import os\nfrom honcho import Honcho\n\nclient = Honcho(\n # This is the default and can be omitted\n api_key=os.environ.get(\"HONCHO_API_KEY\"),\n)\napp = client.apps.get(\n \"app_id\",\n)\nprint(app.id)" - } - ] - }, - "put": { - "tags": ["apps"], - "summary": "Update App", - "description": "Update an App\n\nArgs:\n app_id (str): The ID of the app to update\n app (schemas.AppUpdate): The App object containing any new metadata\n\nReturns:\n schemas.App: The App object of the updated App", - "operationId": "update_app_v1_apps__app_id__put", - "security": [{ "HTTPBearer": [] }, {}], - "parameters": [ - { - "name": "app_id", - "in": "path", - "required": true, - "schema": { "type": "string", "title": "App Id" } - } - ], - "requestBody": { - "required": true, - "content": { - "application/json": { - "schema": { "$ref": "#/components/schemas/AppUpdate" } - } - } - }, - "responses": { - "200": { - "description": "Successful Response", - "content": { - "application/json": { - "schema": { "$ref": "#/components/schemas/App" } - } - } - }, - "422": { - "description": "Validation Error", - "content": { - "application/json": { - "schema": { "$ref": "#/components/schemas/HTTPValidationError" } - } - } - } - }, - "x-codeSamples": [ - { - "lang": "JavaScript", - "source": "import Honcho from 'honcho';\n\nconst client = new Honcho({\n apiKey: process.env['HONCHO_API_KEY'], // This is the default and can be omitted\n});\n\nasync function main() {\n const app = await client.apps.update('app_id');\n\n console.log(app.id);\n}\n\nmain();" - }, - { - "lang": "Python", - "source": "import os\nfrom honcho import Honcho\n\nclient = Honcho(\n # This is the default and can be omitted\n api_key=os.environ.get(\"HONCHO_API_KEY\"),\n)\napp = client.apps.update(\n app_id=\"app_id\",\n)\nprint(app.id)" - } - ] - } - }, - "/v1/apps/name/{name}": { - "get": { - "tags": ["apps"], - "summary": "Get App By Name", - "description": "Get an App by Name\n\nArgs:\n app_name (str): The name of the app\n\nReturns:\n schemas.App: App object", - "operationId": "get_app_by_name_v1_apps_name__name__get", - "security": [{ "HTTPBearer": [] }, {}], - "parameters": [ - { - "name": "name", - "in": "path", - "required": true, - "schema": { "type": "string", "title": "Name" } - } - ], - "responses": { - "200": { - "description": "Successful Response", - "content": { - "application/json": { - "schema": { "$ref": "#/components/schemas/App" } - } - } - }, - "422": { - "description": "Validation Error", - "content": { - "application/json": { - "schema": { "$ref": "#/components/schemas/HTTPValidationError" } - } - } - } - }, - "x-codeSamples": [ - { - "lang": "JavaScript", - "source": "import Honcho from 'honcho';\n\nconst client = new Honcho({\n apiKey: process.env['HONCHO_API_KEY'], // This is the default and can be omitted\n});\n\nasync function main() {\n const app = await client.apps.getByName('name');\n\n console.log(app.id);\n}\n\nmain();" - }, - { - "lang": "Python", - "source": "import os\nfrom honcho import Honcho\n\nclient = Honcho(\n # This is the default and can be omitted\n api_key=os.environ.get(\"HONCHO_API_KEY\"),\n)\napp = client.apps.get_by_name(\n \"name\",\n)\nprint(app.id)" - } - ] - } - }, - "/v1/apps": { - "post": { - "tags": ["apps"], - "summary": "Create App", - "description": "Create an App\n\nArgs:\n app (schemas.AppCreate): The App object containing any metadata\n\nReturns:\n schemas.App: Created App object", - "operationId": "create_app_v1_apps_post", - "requestBody": { - "content": { - "application/json": { - "schema": { "$ref": "#/components/schemas/AppCreate" } - } - }, - "required": true - }, - "responses": { - "200": { - "description": "Successful Response", - "content": { - "application/json": { - "schema": { "$ref": "#/components/schemas/App" } - } - } - }, - "422": { - "description": "Validation Error", - "content": { - "application/json": { - "schema": { "$ref": "#/components/schemas/HTTPValidationError" } - } - } - } - }, - "security": [{ "HTTPBearer": [] }, {}], - "x-codeSamples": [ - { - "lang": "JavaScript", - "source": "import Honcho from 'honcho';\n\nconst client = new Honcho({\n apiKey: process.env['HONCHO_API_KEY'], // This is the default and can be omitted\n});\n\nasync function main() {\n const app = await client.apps.create({ name: 'name' });\n\n console.log(app.id);\n}\n\nmain();" - }, - { - "lang": "Python", - "source": "import os\nfrom honcho import Honcho\n\nclient = Honcho(\n # This is the default and can be omitted\n api_key=os.environ.get(\"HONCHO_API_KEY\"),\n)\napp = client.apps.create(\n name=\"name\",\n)\nprint(app.id)" - } - ] - } - }, - "/v1/apps/get_or_create/{name}": { - "get": { - "tags": ["apps"], - "summary": "Get Or Create App", - "description": "Get or Create an App\n\nArgs:\n app_name (str): The name of the app\n\nReturns:\n schemas.App: App object", - "operationId": "get_or_create_app_v1_apps_get_or_create__name__get", - "security": [{ "HTTPBearer": [] }, {}], - "parameters": [ - { - "name": "name", - "in": "path", - "required": true, - "schema": { "type": "string", "title": "Name" } - } - ], - "responses": { - "200": { - "description": "Successful Response", - "content": { - "application/json": { - "schema": { "$ref": "#/components/schemas/App" } - } - } - }, - "422": { - "description": "Validation Error", - "content": { - "application/json": { - "schema": { "$ref": "#/components/schemas/HTTPValidationError" } - } - } - } - }, - "x-codeSamples": [ - { - "lang": "JavaScript", - "source": "import Honcho from 'honcho';\n\nconst client = new Honcho({\n apiKey: process.env['HONCHO_API_KEY'], // This is the default and can be omitted\n});\n\nasync function main() {\n const app = await client.apps.getOrCreate('name');\n\n console.log(app.id);\n}\n\nmain();" - }, - { - "lang": "Python", - "source": "import os\nfrom honcho import Honcho\n\nclient = Honcho(\n # This is the default and can be omitted\n api_key=os.environ.get(\"HONCHO_API_KEY\"),\n)\napp = client.apps.get_or_create(\n \"name\",\n)\nprint(app.id)" - } - ] - } - }, - "/v1/apps/{app_id}/users": { - "post": { - "tags": ["users"], - "summary": "Create User", - "description": "Create a User\n\nArgs:\n app_id (str): The ID of the app representing the client application using\n honcho\n user (schemas.UserCreate): The User object containing any metadata\n\nReturns:\n schemas.User: Created User object", - "operationId": "create_user_v1_apps__app_id__users_post", - "security": [{ "HTTPBearer": [] }, {}], - "parameters": [ - { - "name": "app_id", - "in": "path", - "required": true, - "schema": { "type": "string", "title": "App Id" } - } - ], - "requestBody": { - "required": true, - "content": { - "application/json": { - "schema": { "$ref": "#/components/schemas/UserCreate" } - } - } - }, - "responses": { - "200": { - "description": "Successful Response", - "content": { - "application/json": { - "schema": { "$ref": "#/components/schemas/User" } - } - } - }, - "422": { - "description": "Validation Error", - "content": { - "application/json": { - "schema": { "$ref": "#/components/schemas/HTTPValidationError" } - } - } - } - }, - "x-codeSamples": [ - { - "lang": "JavaScript", - "source": "import Honcho from 'honcho';\n\nconst client = new Honcho({\n apiKey: process.env['HONCHO_API_KEY'], // This is the default and can be omitted\n});\n\nasync function main() {\n const user = await client.apps.users.create('app_id', { name: 'name' });\n\n console.log(user.id);\n}\n\nmain();" - }, - { - "lang": "Python", - "source": "import os\nfrom honcho import Honcho\n\nclient = Honcho(\n # This is the default and can be omitted\n api_key=os.environ.get(\"HONCHO_API_KEY\"),\n)\nuser = client.apps.users.create(\n app_id=\"app_id\",\n name=\"name\",\n)\nprint(user.id)" - } - ] - } - }, - "/v1/apps/{app_id}/users/list": { - "post": { - "tags": ["users"], - "summary": "Get Users", - "description": "Get All Users for an App\n\nArgs:\n app_id (str): The ID of the app representing the client\n application using honcho\n\nReturns:\n list[schemas.User]: List of User objects", - "operationId": "get_users_v1_apps__app_id__users_list_post", - "security": [{ "HTTPBearer": [] }, {}], - "parameters": [ - { - "name": "app_id", - "in": "path", - "required": true, - "schema": { "type": "string", "title": "App Id" } - }, - { - "name": "reverse", - "in": "query", - "required": false, - "schema": { - "type": "boolean", - "default": false, - "title": "Reverse" - } - }, - { - "name": "page", - "in": "query", - "required": false, - "schema": { - "type": "integer", - "minimum": 1, - "description": "Page number", - "default": 1, - "title": "Page" - }, - "description": "Page number" - }, - { - "name": "size", - "in": "query", - "required": false, - "schema": { - "type": "integer", - "maximum": 100, - "minimum": 1, - "description": "Page size", - "default": 50, - "title": "Size" - }, - "description": "Page size" - } - ], - "requestBody": { - "required": true, - "content": { - "application/json": { - "schema": { "$ref": "#/components/schemas/UserGet" } - } - } - }, - "responses": { - "200": { - "description": "Successful Response", - "content": { - "application/json": { - "schema": { "$ref": "#/components/schemas/Page_User_" } - } - } - }, - "422": { - "description": "Validation Error", - "content": { - "application/json": { - "schema": { "$ref": "#/components/schemas/HTTPValidationError" } - } - } - } - }, - "x-codeSamples": [ - { - "lang": "JavaScript", - "source": "import Honcho from 'honcho';\n\nconst client = new Honcho({\n apiKey: process.env['HONCHO_API_KEY'], // This is the default and can be omitted\n});\n\nasync function main() {\n // Automatically fetches more pages as needed.\n for await (const user of client.apps.users.list('app_id')) {\n console.log(user.id);\n }\n}\n\nmain();" - }, - { - "lang": "Python", - "source": "import os\nfrom honcho import Honcho\n\nclient = Honcho(\n # This is the default and can be omitted\n api_key=os.environ.get(\"HONCHO_API_KEY\"),\n)\npage = client.apps.users.list(\n app_id=\"app_id\",\n)\npage = page.items[0]\nprint(page.id)" - } - ] - } - }, - "/v1/apps/{app_id}/users/name/{name}": { - "get": { - "tags": ["users"], - "summary": "Get User By Name", - "description": "Get a User\n\nArgs:\n app_id (str): The ID of the app representing the client application using\n honcho\n user_id (str): The User ID representing the user, managed by the user\n\nReturns:\n schemas.User: User object", - "operationId": "get_user_by_name_v1_apps__app_id__users_name__name__get", - "security": [{ "HTTPBearer": [] }, {}], - "parameters": [ - { - "name": "app_id", - "in": "path", - "required": true, - "schema": { "type": "string", "title": "App Id" } - }, - { - "name": "name", - "in": "path", - "required": true, - "schema": { "type": "string", "title": "Name" } - } - ], - "responses": { - "200": { - "description": "Successful Response", - "content": { - "application/json": { - "schema": { "$ref": "#/components/schemas/User" } - } - } - }, - "422": { - "description": "Validation Error", - "content": { - "application/json": { - "schema": { "$ref": "#/components/schemas/HTTPValidationError" } - } - } - } - }, - "x-codeSamples": [ - { - "lang": "JavaScript", - "source": "import Honcho from 'honcho';\n\nconst client = new Honcho({\n apiKey: process.env['HONCHO_API_KEY'], // This is the default and can be omitted\n});\n\nasync function main() {\n const user = await client.apps.users.getByName('app_id', 'name');\n\n console.log(user.id);\n}\n\nmain();" - }, - { - "lang": "Python", - "source": "import os\nfrom honcho import Honcho\n\nclient = Honcho(\n # This is the default and can be omitted\n api_key=os.environ.get(\"HONCHO_API_KEY\"),\n)\nuser = client.apps.users.get_by_name(\n name=\"name\",\n app_id=\"app_id\",\n)\nprint(user.id)" - } - ] - } - }, - "/v1/apps/{app_id}/users/{user_id}": { - "get": { - "tags": ["users"], - "summary": "Get User", - "description": "Get a User\n\nArgs:\n app_id (str): The ID of the app representing the client application using\n honcho\n user_id (str): The User ID representing the user, managed by the user\n\nReturns:\n schemas.User: User object", - "operationId": "get_user_v1_apps__app_id__users__user_id__get", - "security": [{ "HTTPBearer": [] }, {}], - "parameters": [ - { - "name": "app_id", - "in": "path", - "required": true, - "schema": { "type": "string", "title": "App Id" } - }, - { - "name": "user_id", - "in": "path", - "required": true, - "schema": { "type": "string", "title": "User Id" } - } - ], - "responses": { - "200": { - "description": "Successful Response", - "content": { - "application/json": { - "schema": { "$ref": "#/components/schemas/User" } - } - } - }, - "422": { - "description": "Validation Error", - "content": { - "application/json": { - "schema": { "$ref": "#/components/schemas/HTTPValidationError" } - } - } - } - }, - "x-codeSamples": [ - { - "lang": "JavaScript", - "source": "import Honcho from 'honcho';\n\nconst client = new Honcho({\n apiKey: process.env['HONCHO_API_KEY'], // This is the default and can be omitted\n});\n\nasync function main() {\n const user = await client.apps.users.get('app_id', 'user_id');\n\n console.log(user.id);\n}\n\nmain();" - }, - { - "lang": "Python", - "source": "import os\nfrom honcho import Honcho\n\nclient = Honcho(\n # This is the default and can be omitted\n api_key=os.environ.get(\"HONCHO_API_KEY\"),\n)\nuser = client.apps.users.get(\n user_id=\"user_id\",\n app_id=\"app_id\",\n)\nprint(user.id)" - } - ] - }, - "put": { - "tags": ["users"], - "summary": "Update User", - "description": "Update a User\n\nArgs:\n app_id (str): The ID of the app representing the client application using\n honcho\n user_id (str): The User ID representing the user, managed by the user\n user (schemas.UserCreate): The User object containing any metadata\n\nReturns:\n schemas.User: Updated User object", - "operationId": "update_user_v1_apps__app_id__users__user_id__put", - "security": [{ "HTTPBearer": [] }, {}], - "parameters": [ - { - "name": "app_id", - "in": "path", - "required": true, - "schema": { "type": "string", "title": "App Id" } - }, - { - "name": "user_id", - "in": "path", - "required": true, - "schema": { "type": "string", "title": "User Id" } - } - ], - "requestBody": { - "required": true, - "content": { - "application/json": { - "schema": { "$ref": "#/components/schemas/UserUpdate" } - } - } - }, - "responses": { - "200": { - "description": "Successful Response", - "content": { - "application/json": { - "schema": { "$ref": "#/components/schemas/User" } - } - } - }, - "422": { - "description": "Validation Error", - "content": { - "application/json": { - "schema": { "$ref": "#/components/schemas/HTTPValidationError" } - } - } - } - }, - "x-codeSamples": [ - { - "lang": "JavaScript", - "source": "import Honcho from 'honcho';\n\nconst client = new Honcho({\n apiKey: process.env['HONCHO_API_KEY'], // This is the default and can be omitted\n});\n\nasync function main() {\n const user = await client.apps.users.update('app_id', 'user_id');\n\n console.log(user.id);\n}\n\nmain();" - }, - { - "lang": "Python", - "source": "import os\nfrom honcho import Honcho\n\nclient = Honcho(\n # This is the default and can be omitted\n api_key=os.environ.get(\"HONCHO_API_KEY\"),\n)\nuser = client.apps.users.update(\n user_id=\"user_id\",\n app_id=\"app_id\",\n)\nprint(user.id)" - } - ] - } - }, - "/v1/apps/{app_id}/users/get_or_create/{name}": { - "get": { - "tags": ["users"], - "summary": "Get Or Create User", - "description": "Get or Create a User\n\nArgs:\n app_id (str): The ID of the app representing the client application using\n honcho\n user_id (str): The User ID representing the user, managed by the user\n\nReturns:\n schemas.User: User object", - "operationId": "get_or_create_user_v1_apps__app_id__users_get_or_create__name__get", - "security": [{ "HTTPBearer": [] }, {}], - "parameters": [ - { - "name": "app_id", - "in": "path", - "required": true, - "schema": { "type": "string", "title": "App Id" } - }, - { - "name": "name", - "in": "path", - "required": true, - "schema": { "type": "string", "title": "Name" } - } - ], - "responses": { - "200": { - "description": "Successful Response", - "content": { - "application/json": { - "schema": { "$ref": "#/components/schemas/User" } - } - } - }, - "422": { - "description": "Validation Error", - "content": { - "application/json": { - "schema": { "$ref": "#/components/schemas/HTTPValidationError" } - } - } - } - }, - "x-codeSamples": [ - { - "lang": "JavaScript", - "source": "import Honcho from 'honcho';\n\nconst client = new Honcho({\n apiKey: process.env['HONCHO_API_KEY'], // This is the default and can be omitted\n});\n\nasync function main() {\n const user = await client.apps.users.getOrCreate('app_id', 'name');\n\n console.log(user.id);\n}\n\nmain();" - }, - { - "lang": "Python", - "source": "import os\nfrom honcho import Honcho\n\nclient = Honcho(\n # This is the default and can be omitted\n api_key=os.environ.get(\"HONCHO_API_KEY\"),\n)\nuser = client.apps.users.get_or_create(\n name=\"name\",\n app_id=\"app_id\",\n)\nprint(user.id)" - } - ] - } - }, - "/v1/apps/{app_id}/users/{user_id}/sessions/list": { - "post": { - "tags": ["sessions"], - "summary": "Get Sessions", - "description": "Get All Sessions for a User\n\nArgs:\n app_id (str): The ID of the app representing the client application using\n honcho\n user_id (str): The User ID representing the user, managed by the user\n\nReturns:\n list[schemas.Session]: List of Session objects", - "operationId": "get_sessions_v1_apps__app_id__users__user_id__sessions_list_post", - "security": [{ "HTTPBearer": [] }, {}], - "parameters": [ - { - "name": "app_id", - "in": "path", - "required": true, - "schema": { "type": "string", "title": "App Id" } - }, - { - "name": "user_id", - "in": "path", - "required": true, - "schema": { "type": "string", "title": "User Id" } - }, - { - "name": "reverse", - "in": "query", - "required": false, - "schema": { - "anyOf": [{ "type": "boolean" }, { "type": "null" }], - "default": false, - "title": "Reverse" - } - }, - { - "name": "page", - "in": "query", - "required": false, - "schema": { - "type": "integer", - "minimum": 1, - "description": "Page number", - "default": 1, - "title": "Page" - }, - "description": "Page number" - }, - { - "name": "size", - "in": "query", - "required": false, - "schema": { - "type": "integer", - "maximum": 100, - "minimum": 1, - "description": "Page size", - "default": 50, - "title": "Size" - }, - "description": "Page size" - } - ], - "requestBody": { - "required": true, - "content": { - "application/json": { - "schema": { "$ref": "#/components/schemas/SessionGet" } - } - } - }, - "responses": { - "200": { - "description": "Successful Response", - "content": { - "application/json": { - "schema": { "$ref": "#/components/schemas/Page_Session_" } - } - } - }, - "422": { - "description": "Validation Error", - "content": { - "application/json": { - "schema": { "$ref": "#/components/schemas/HTTPValidationError" } - } - } - } - }, - "x-codeSamples": [ - { - "lang": "JavaScript", - "source": "import Honcho from 'honcho';\n\nconst client = new Honcho({\n apiKey: process.env['HONCHO_API_KEY'], // This is the default and can be omitted\n});\n\nasync function main() {\n // Automatically fetches more pages as needed.\n for await (const session of client.apps.users.sessions.list('app_id', 'user_id')) {\n console.log(session.id);\n }\n}\n\nmain();" - }, - { - "lang": "Python", - "source": "import os\nfrom honcho import Honcho\n\nclient = Honcho(\n # This is the default and can be omitted\n api_key=os.environ.get(\"HONCHO_API_KEY\"),\n)\npage = client.apps.users.sessions.list(\n user_id=\"user_id\",\n app_id=\"app_id\",\n)\npage = page.items[0]\nprint(page.id)" - } - ] - } - }, - "/v1/apps/{app_id}/users/{user_id}/sessions": { - "post": { - "tags": ["sessions"], - "summary": "Create Session", - "description": "Create a Session for a User\n\nArgs:\n app_id (str): The ID of the app representing the client\n application using honcho\n user_id (str): The User ID representing the user, managed by the user\n session (schemas.SessionCreate): The Session object containing any\n metadata\n\nReturns:\n schemas.Session: The Session object of the new Session", - "operationId": "create_session_v1_apps__app_id__users__user_id__sessions_post", - "security": [{ "HTTPBearer": [] }, {}], - "parameters": [ - { - "name": "app_id", - "in": "path", - "required": true, - "schema": { "type": "string", "title": "App Id" } - }, - { - "name": "user_id", - "in": "path", - "required": true, - "schema": { "type": "string", "title": "User Id" } - } - ], - "requestBody": { - "required": true, - "content": { - "application/json": { - "schema": { "$ref": "#/components/schemas/SessionCreate" } - } - } - }, - "responses": { - "200": { - "description": "Successful Response", - "content": { - "application/json": { - "schema": { "$ref": "#/components/schemas/Session" } - } - } - }, - "422": { - "description": "Validation Error", - "content": { - "application/json": { - "schema": { "$ref": "#/components/schemas/HTTPValidationError" } - } - } - } - }, - "x-codeSamples": [ - { - "lang": "JavaScript", - "source": "import Honcho from 'honcho';\n\nconst client = new Honcho({\n apiKey: process.env['HONCHO_API_KEY'], // This is the default and can be omitted\n});\n\nasync function main() {\n const session = await client.apps.users.sessions.create('app_id', 'user_id');\n\n console.log(session.id);\n}\n\nmain();" - }, - { - "lang": "Python", - "source": "import os\nfrom honcho import Honcho\n\nclient = Honcho(\n # This is the default and can be omitted\n api_key=os.environ.get(\"HONCHO_API_KEY\"),\n)\nsession = client.apps.users.sessions.create(\n user_id=\"user_id\",\n app_id=\"app_id\",\n)\nprint(session.id)" - } - ] - } - }, - "/v1/apps/{app_id}/users/{user_id}/sessions/{session_id}": { - "put": { - "tags": ["sessions"], - "summary": "Update Session", - "description": "Update the metadata of a Session\n\nArgs:\n app_id (str): The ID of the app representing the client application using\n honcho\n user_id (str): The User ID representing the user, managed by the user\n session_id (str): The ID of the Session to update\n session (schemas.SessionUpdate): The Session object containing any new metadata\n\nReturns:\n schemas.Session: The Session object of the updated Session", - "operationId": "update_session_v1_apps__app_id__users__user_id__sessions__session_id__put", - "security": [{ "HTTPBearer": [] }, {}], - "parameters": [ - { - "name": "app_id", - "in": "path", - "required": true, - "schema": { "type": "string", "title": "App Id" } - }, - { - "name": "user_id", - "in": "path", - "required": true, - "schema": { "type": "string", "title": "User Id" } - }, - { - "name": "session_id", - "in": "path", - "required": true, - "schema": { "type": "string", "title": "Session Id" } - } - ], - "requestBody": { - "required": true, - "content": { - "application/json": { - "schema": { "$ref": "#/components/schemas/SessionUpdate" } - } - } - }, - "responses": { - "200": { - "description": "Successful Response", - "content": { - "application/json": { - "schema": { "$ref": "#/components/schemas/Session" } - } - } - }, - "422": { - "description": "Validation Error", - "content": { - "application/json": { - "schema": { "$ref": "#/components/schemas/HTTPValidationError" } - } - } - } - }, - "x-codeSamples": [ - { - "lang": "JavaScript", - "source": "import Honcho from 'honcho';\n\nconst client = new Honcho({\n apiKey: process.env['HONCHO_API_KEY'], // This is the default and can be omitted\n});\n\nasync function main() {\n const session = await client.apps.users.sessions.update('app_id', 'user_id', 'session_id');\n\n console.log(session.id);\n}\n\nmain();" - }, - { - "lang": "Python", - "source": "import os\nfrom honcho import Honcho\n\nclient = Honcho(\n # This is the default and can be omitted\n api_key=os.environ.get(\"HONCHO_API_KEY\"),\n)\nsession = client.apps.users.sessions.update(\n session_id=\"session_id\",\n app_id=\"app_id\",\n user_id=\"user_id\",\n)\nprint(session.id)" - } - ] - }, - "delete": { - "tags": ["sessions"], - "summary": "Delete Session", - "description": "Delete a session by marking it as inactive\n\nArgs:\n app_id (str): The ID of the app representing the client application using\n honcho\n user_id (str): The User ID representing the user, managed by the user\n session_id (str): The ID of the Session to delete\n\nReturns:\n dict: A message indicating that the session was deleted\n\nRaises:\n HTTPException: If the session is not found", - "operationId": "delete_session_v1_apps__app_id__users__user_id__sessions__session_id__delete", - "security": [{ "HTTPBearer": [] }, {}], - "parameters": [ - { - "name": "app_id", - "in": "path", - "required": true, - "schema": { "type": "string", "title": "App Id" } - }, - { - "name": "user_id", - "in": "path", - "required": true, - "schema": { "type": "string", "title": "User Id" } - }, - { - "name": "session_id", - "in": "path", - "required": true, - "schema": { "type": "string", "title": "Session Id" } - } - ], - "responses": { - "200": { - "description": "Successful Response", - "content": { "application/json": { "schema": {} } } - }, - "422": { - "description": "Validation Error", - "content": { - "application/json": { - "schema": { "$ref": "#/components/schemas/HTTPValidationError" } - } - } - } - }, - "x-codeSamples": [ - { - "lang": "JavaScript", - "source": "import Honcho from 'honcho';\n\nconst client = new Honcho({\n apiKey: process.env['HONCHO_API_KEY'], // This is the default and can be omitted\n});\n\nasync function main() {\n const session = await client.apps.users.sessions.delete('app_id', 'user_id', 'session_id');\n\n console.log(session);\n}\n\nmain();" - }, - { - "lang": "Python", - "source": "import os\nfrom honcho import Honcho\n\nclient = Honcho(\n # This is the default and can be omitted\n api_key=os.environ.get(\"HONCHO_API_KEY\"),\n)\nsession = client.apps.users.sessions.delete(\n session_id=\"session_id\",\n app_id=\"app_id\",\n user_id=\"user_id\",\n)\nprint(session)" - } - ] - }, - "get": { - "tags": ["sessions"], - "summary": "Get Session", - "description": "Get a specific session for a user by ID\n\nArgs:\n app_id (str): The ID of the app representing the client application using\n honcho\n user_id (str): The User ID representing the user, managed by the user\n session_id (str): The ID of the Session to retrieve\n\nReturns:\n schemas.Session: The Session object of the requested Session\n\nRaises:\n HTTPException: If the session is not found", - "operationId": "get_session_v1_apps__app_id__users__user_id__sessions__session_id__get", - "security": [{ "HTTPBearer": [] }, {}], - "parameters": [ - { - "name": "app_id", - "in": "path", - "required": true, - "schema": { "type": "string", "title": "App Id" } - }, - { - "name": "user_id", - "in": "path", - "required": true, - "schema": { "type": "string", "title": "User Id" } - }, - { - "name": "session_id", - "in": "path", - "required": true, - "schema": { "type": "string", "title": "Session Id" } - } - ], - "responses": { - "200": { - "description": "Successful Response", - "content": { - "application/json": { - "schema": { "$ref": "#/components/schemas/Session" } - } - } - }, - "422": { - "description": "Validation Error", - "content": { - "application/json": { - "schema": { "$ref": "#/components/schemas/HTTPValidationError" } - } - } - } - }, - "x-codeSamples": [ - { - "lang": "JavaScript", - "source": "import Honcho from 'honcho';\n\nconst client = new Honcho({\n apiKey: process.env['HONCHO_API_KEY'], // This is the default and can be omitted\n});\n\nasync function main() {\n const session = await client.apps.users.sessions.get('app_id', 'user_id', 'session_id');\n\n console.log(session.id);\n}\n\nmain();" - }, - { - "lang": "Python", - "source": "import os\nfrom honcho import Honcho\n\nclient = Honcho(\n # This is the default and can be omitted\n api_key=os.environ.get(\"HONCHO_API_KEY\"),\n)\nsession = client.apps.users.sessions.get(\n session_id=\"session_id\",\n app_id=\"app_id\",\n user_id=\"user_id\",\n)\nprint(session.id)" - } - ] - } - }, - "/v1/apps/{app_id}/users/{user_id}/sessions/{session_id}/chat": { - "post": { - "tags": ["sessions"], - "summary": "Chat", - "operationId": "chat_v1_apps__app_id__users__user_id__sessions__session_id__chat_post", - "security": [{ "HTTPBearer": [] }, {}], - "parameters": [ - { - "name": "app_id", - "in": "path", - "required": true, - "schema": { "type": "string", "title": "App Id" } - }, - { - "name": "user_id", - "in": "path", - "required": true, - "schema": { "type": "string", "title": "User Id" } - }, - { - "name": "session_id", - "in": "path", - "required": true, - "schema": { "type": "string", "title": "Session Id" } - } - ], - "requestBody": { - "required": true, - "content": { - "application/json": { - "schema": { "$ref": "#/components/schemas/AgentQuery" } - } - } - }, - "responses": { - "200": { - "description": "Successful Response", - "content": { - "application/json": { - "schema": { "$ref": "#/components/schemas/AgentChat" } - } - } - }, - "422": { - "description": "Validation Error", - "content": { - "application/json": { - "schema": { "$ref": "#/components/schemas/HTTPValidationError" } - } - } - } - }, - "x-codeSamples": [ - { - "lang": "JavaScript", - "source": "import Honcho from 'honcho';\n\nconst client = new Honcho({\n apiKey: process.env['HONCHO_API_KEY'], // This is the default and can be omitted\n});\n\nasync function main() {\n const agentChat = await client.apps.users.sessions.chat('app_id', 'user_id', 'session_id', {\n queries: 'string',\n });\n\n console.log(agentChat.content);\n}\n\nmain();" - }, - { - "lang": "Python", - "source": "import os\nfrom honcho import Honcho\n\nclient = Honcho(\n # This is the default and can be omitted\n api_key=os.environ.get(\"HONCHO_API_KEY\"),\n)\nagent_chat = client.apps.users.sessions.chat(\n session_id=\"session_id\",\n app_id=\"app_id\",\n user_id=\"user_id\",\n queries=\"string\",\n)\nprint(agent_chat.content)" - } - ] - } - }, - "/v1/apps/{app_id}/users/{user_id}/sessions/{session_id}/chat/stream": { - "post": { - "tags": ["sessions"], - "summary": "Get Chat Stream", - "operationId": "get_chat_stream_v1_apps__app_id__users__user_id__sessions__session_id__chat_stream_post", - "security": [{ "HTTPBearer": [] }, {}], - "parameters": [ - { - "name": "app_id", - "in": "path", - "required": true, - "schema": { "type": "string", "title": "App Id" } - }, - { - "name": "user_id", - "in": "path", - "required": true, - "schema": { "type": "string", "title": "User Id" } - }, - { - "name": "session_id", - "in": "path", - "required": true, - "schema": { "type": "string", "title": "Session Id" } - } - ], - "requestBody": { - "required": true, - "content": { - "application/json": { - "schema": { "$ref": "#/components/schemas/AgentQuery" } - } - } - }, - "responses": { - "200": { - "description": "Chat stream", - "content": { - "application/json": { "schema": {} }, - "text/event-stream": { - "schema": { "type": "string", "format": "binary" } - } - } - }, - "422": { - "description": "Validation Error", - "content": { - "application/json": { - "schema": { "$ref": "#/components/schemas/HTTPValidationError" } - } - } - } - }, - "x-codeSamples": [ - { - "lang": "JavaScript", - "source": "import Honcho from 'honcho';\n\nconst client = new Honcho({\n apiKey: process.env['HONCHO_API_KEY'], // This is the default and can be omitted\n});\n\nasync function main() {\n const response = await client.apps.users.sessions.stream('app_id', 'user_id', 'session_id', {\n queries: 'string',\n });\n\n console.log(response);\n}\n\nmain();" - }, - { - "lang": "Python", - "source": "import os\nfrom honcho import Honcho\n\nclient = Honcho(\n # This is the default and can be omitted\n api_key=os.environ.get(\"HONCHO_API_KEY\"),\n)\nresponse = client.apps.users.sessions.stream(\n session_id=\"session_id\",\n app_id=\"app_id\",\n user_id=\"user_id\",\n queries=\"string\",\n)\nprint(response)" - } - ] - } - }, - "/v1/apps/{app_id}/users/{user_id}/sessions/{session_id}/messages": { - "post": { - "tags": ["messages"], - "summary": "Create Message For Session", - "description": "Adds a message to a session\n\nArgs:\n app_id (str): The ID of the app representing the client application using honcho\n user_id (str): The User ID representing the user, managed by the user\n session_id (int): The ID of the Session to add the message to\n message (schemas.MessageCreate): The Message object to add containing the message content and type\n\nReturns:\n schemas.Message: The Message object of the added message\n\nRaises:\n HTTPException: If the session is not found", - "operationId": "create_message_for_session_v1_apps__app_id__users__user_id__sessions__session_id__messages_post", - "security": [{ "HTTPBearer": [] }, {}], - "parameters": [ - { - "name": "app_id", - "in": "path", - "required": true, - "schema": { "type": "string", "title": "App Id" } - }, - { - "name": "user_id", - "in": "path", - "required": true, - "schema": { "type": "string", "title": "User Id" } - }, - { - "name": "session_id", - "in": "path", - "required": true, - "schema": { "type": "string", "title": "Session Id" } - } - ], - "requestBody": { - "required": true, - "content": { - "application/json": { - "schema": { "$ref": "#/components/schemas/MessageCreate" } - } - } - }, - "responses": { - "200": { - "description": "Successful Response", - "content": { - "application/json": { - "schema": { "$ref": "#/components/schemas/Message" } - } - } - }, - "422": { - "description": "Validation Error", - "content": { - "application/json": { - "schema": { "$ref": "#/components/schemas/HTTPValidationError" } - } - } - } - }, - "x-codeSamples": [ - { - "lang": "JavaScript", - "source": "import Honcho from 'honcho';\n\nconst client = new Honcho({\n apiKey: process.env['HONCHO_API_KEY'], // This is the default and can be omitted\n});\n\nasync function main() {\n const message = await client.apps.users.sessions.messages.create('app_id', 'user_id', 'session_id', {\n content: 'content',\n is_user: true,\n });\n\n console.log(message.id);\n}\n\nmain();" - }, - { - "lang": "Python", - "source": "import os\nfrom honcho import Honcho\n\nclient = Honcho(\n # This is the default and can be omitted\n api_key=os.environ.get(\"HONCHO_API_KEY\"),\n)\nmessage = client.apps.users.sessions.messages.create(\n session_id=\"session_id\",\n app_id=\"app_id\",\n user_id=\"user_id\",\n content=\"content\",\n is_user=True,\n)\nprint(message.id)" - } - ] - } - }, - "/v1/apps/{app_id}/users/{user_id}/sessions/{session_id}/messages/list": { - "post": { - "tags": ["messages"], - "summary": "Get Messages", - "description": "Get all messages for a session\n\nArgs:\n app_id (str): The ID of the app representing the client application using\n honcho\n user_id (str): The User ID representing the user, managed by the user\n session_id (int): The ID of the Session to retrieve\n reverse (bool): Whether to reverse the order of the messages\n\nReturns:\n list[schemas.Message]: List of Message objects\n\nRaises:\n HTTPException: If the session is not found", - "operationId": "get_messages_v1_apps__app_id__users__user_id__sessions__session_id__messages_list_post", - "security": [{ "HTTPBearer": [] }, {}], - "parameters": [ - { - "name": "app_id", - "in": "path", - "required": true, - "schema": { "type": "string", "title": "App Id" } - }, - { - "name": "user_id", - "in": "path", - "required": true, - "schema": { "type": "string", "title": "User Id" } - }, - { - "name": "session_id", - "in": "path", - "required": true, - "schema": { "type": "string", "title": "Session Id" } - }, - { - "name": "reverse", - "in": "query", - "required": false, - "schema": { - "anyOf": [{ "type": "boolean" }, { "type": "null" }], - "default": false, - "title": "Reverse" - } - }, - { - "name": "page", - "in": "query", - "required": false, - "schema": { - "type": "integer", - "minimum": 1, - "description": "Page number", - "default": 1, - "title": "Page" - }, - "description": "Page number" - }, - { - "name": "size", - "in": "query", - "required": false, - "schema": { - "type": "integer", - "maximum": 100, - "minimum": 1, - "description": "Page size", - "default": 50, - "title": "Size" - }, - "description": "Page size" - } - ], - "requestBody": { - "required": true, - "content": { - "application/json": { - "schema": { "$ref": "#/components/schemas/MessageGet" } - } - } - }, - "responses": { - "200": { - "description": "Successful Response", - "content": { - "application/json": { - "schema": { "$ref": "#/components/schemas/Page_Message_" } - } - } - }, - "422": { - "description": "Validation Error", - "content": { - "application/json": { - "schema": { "$ref": "#/components/schemas/HTTPValidationError" } - } - } - } - }, - "x-codeSamples": [ - { - "lang": "JavaScript", - "source": "import Honcho from 'honcho';\n\nconst client = new Honcho({\n apiKey: process.env['HONCHO_API_KEY'], // This is the default and can be omitted\n});\n\nasync function main() {\n // Automatically fetches more pages as needed.\n for await (const message of client.apps.users.sessions.messages.list('app_id', 'user_id', 'session_id')) {\n console.log(message.id);\n }\n}\n\nmain();" - }, - { - "lang": "Python", - "source": "import os\nfrom honcho import Honcho\n\nclient = Honcho(\n # This is the default and can be omitted\n api_key=os.environ.get(\"HONCHO_API_KEY\"),\n)\npage = client.apps.users.sessions.messages.list(\n session_id=\"session_id\",\n app_id=\"app_id\",\n user_id=\"user_id\",\n)\npage = page.items[0]\nprint(page.id)" - } - ] - } - }, - "/v1/apps/{app_id}/users/{user_id}/sessions/{session_id}/messages/{message_id}": { - "get": { - "tags": ["messages"], - "summary": "Get Message", - "operationId": "get_message_v1_apps__app_id__users__user_id__sessions__session_id__messages__message_id__get", - "security": [{ "HTTPBearer": [] }, {}], - "parameters": [ - { - "name": "app_id", - "in": "path", - "required": true, - "schema": { "type": "string", "title": "App Id" } - }, - { - "name": "user_id", - "in": "path", - "required": true, - "schema": { "type": "string", "title": "User Id" } - }, - { - "name": "session_id", - "in": "path", - "required": true, - "schema": { "type": "string", "title": "Session Id" } - }, - { - "name": "message_id", - "in": "path", - "required": true, - "schema": { "type": "string", "title": "Message Id" } - } - ], - "responses": { - "200": { - "description": "Successful Response", - "content": { - "application/json": { - "schema": { "$ref": "#/components/schemas/Message" } - } - } - }, - "422": { - "description": "Validation Error", - "content": { - "application/json": { - "schema": { "$ref": "#/components/schemas/HTTPValidationError" } - } - } - } - }, - "x-codeSamples": [ - { - "lang": "JavaScript", - "source": "import Honcho from 'honcho';\n\nconst client = new Honcho({\n apiKey: process.env['HONCHO_API_KEY'], // This is the default and can be omitted\n});\n\nasync function main() {\n const message = await client.apps.users.sessions.messages.get(\n 'app_id',\n 'user_id',\n 'session_id',\n 'message_id',\n );\n\n console.log(message.id);\n}\n\nmain();" - }, - { - "lang": "Python", - "source": "import os\nfrom honcho import Honcho\n\nclient = Honcho(\n # This is the default and can be omitted\n api_key=os.environ.get(\"HONCHO_API_KEY\"),\n)\nmessage = client.apps.users.sessions.messages.get(\n message_id=\"message_id\",\n app_id=\"app_id\",\n user_id=\"user_id\",\n session_id=\"session_id\",\n)\nprint(message.id)" - } - ] - }, - "put": { - "tags": ["messages"], - "summary": "Update Message", - "description": "Update's the metadata of a message", - "operationId": "update_message_v1_apps__app_id__users__user_id__sessions__session_id__messages__message_id__put", - "security": [{ "HTTPBearer": [] }, {}], - "parameters": [ - { - "name": "app_id", - "in": "path", - "required": true, - "schema": { "type": "string", "title": "App Id" } - }, - { - "name": "user_id", - "in": "path", - "required": true, - "schema": { "type": "string", "title": "User Id" } - }, - { - "name": "session_id", - "in": "path", - "required": true, - "schema": { "type": "string", "title": "Session Id" } - }, - { - "name": "message_id", - "in": "path", - "required": true, - "schema": { "type": "string", "title": "Message Id" } - } - ], - "requestBody": { - "required": true, - "content": { - "application/json": { - "schema": { "$ref": "#/components/schemas/MessageUpdate" } - } - } - }, - "responses": { - "200": { - "description": "Successful Response", - "content": { - "application/json": { - "schema": { "$ref": "#/components/schemas/Message" } - } - } - }, - "422": { - "description": "Validation Error", - "content": { - "application/json": { - "schema": { "$ref": "#/components/schemas/HTTPValidationError" } - } - } - } - }, - "x-codeSamples": [ - { - "lang": "JavaScript", - "source": "import Honcho from 'honcho';\n\nconst client = new Honcho({\n apiKey: process.env['HONCHO_API_KEY'], // This is the default and can be omitted\n});\n\nasync function main() {\n const message = await client.apps.users.sessions.messages.update(\n 'app_id',\n 'user_id',\n 'session_id',\n 'message_id',\n );\n\n console.log(message.id);\n}\n\nmain();" - }, - { - "lang": "Python", - "source": "import os\nfrom honcho import Honcho\n\nclient = Honcho(\n # This is the default and can be omitted\n api_key=os.environ.get(\"HONCHO_API_KEY\"),\n)\nmessage = client.apps.users.sessions.messages.update(\n message_id=\"message_id\",\n app_id=\"app_id\",\n user_id=\"user_id\",\n session_id=\"session_id\",\n)\nprint(message.id)" - } - ] - } - }, - "/v1/apps/{app_id}/users/{user_id}/sessions/{session_id}/metamessages": { - "post": { - "tags": ["metamessages"], - "summary": "Create Metamessage", - "description": "Adds a message to a session\n\nArgs:\n app_id (str): The ID of the app representing the client application using\n honcho\n user_id (str): The User ID representing the user, managed by the user\n session_id (int): The ID of the Session to add the message to\n metamessage (schemas.MeteamessageCreate): The metamessage creation object\n\nReturns:\n schemas.Metamessage: The Metamessage object of the added metamessage\n\nRaises:\n HTTPException: If the session is not found", - "operationId": "create_metamessage_v1_apps__app_id__users__user_id__sessions__session_id__metamessages_post", - "security": [{ "HTTPBearer": [] }, {}], - "parameters": [ - { - "name": "app_id", - "in": "path", - "required": true, - "schema": { "type": "string", "title": "App Id" } - }, - { - "name": "user_id", - "in": "path", - "required": true, - "schema": { "type": "string", "title": "User Id" } - }, - { - "name": "session_id", - "in": "path", - "required": true, - "schema": { "type": "string", "title": "Session Id" } - } - ], - "requestBody": { - "required": true, - "content": { - "application/json": { - "schema": { "$ref": "#/components/schemas/MetamessageCreate" } - } - } - }, - "responses": { - "200": { - "description": "Successful Response", - "content": { - "application/json": { - "schema": { "$ref": "#/components/schemas/Metamessage" } - } - } - }, - "422": { - "description": "Validation Error", - "content": { - "application/json": { - "schema": { "$ref": "#/components/schemas/HTTPValidationError" } - } - } - } - }, - "x-codeSamples": [ - { - "lang": "JavaScript", - "source": "import Honcho from 'honcho';\n\nconst client = new Honcho({\n apiKey: process.env['HONCHO_API_KEY'], // This is the default and can be omitted\n});\n\nasync function main() {\n const metamessage = await client.apps.users.sessions.metamessages.create(\n 'app_id',\n 'user_id',\n 'session_id',\n { content: 'content', message_id: 'message_id', metamessage_type: 'metamessage_type' },\n );\n\n console.log(metamessage.id);\n}\n\nmain();" - }, - { - "lang": "Python", - "source": "import os\nfrom honcho import Honcho\n\nclient = Honcho(\n # This is the default and can be omitted\n api_key=os.environ.get(\"HONCHO_API_KEY\"),\n)\nmetamessage = client.apps.users.sessions.metamessages.create(\n session_id=\"session_id\",\n app_id=\"app_id\",\n user_id=\"user_id\",\n content=\"content\",\n message_id=\"message_id\",\n metamessage_type=\"metamessage_type\",\n)\nprint(metamessage.id)" - } - ] - } - }, - "/v1/apps/{app_id}/users/{user_id}/sessions/{session_id}/metamessages/list": { - "post": { - "tags": ["metamessages"], - "summary": "Get Metamessages", - "description": "Get all messages for a session\n\nArgs:\n app_id (str): The ID of the app representing the client application using\n honcho\n user_id (str): The User ID representing the user, managed by the user\n session_id (int): The ID of the Session to retrieve\n reverse (bool): Whether to reverse the order of the metamessages\n\nReturns:\n list[schemas.Message]: List of Message objects\n\nRaises:\n HTTPException: If the session is not found", - "operationId": "get_metamessages_v1_apps__app_id__users__user_id__sessions__session_id__metamessages_list_post", - "security": [{ "HTTPBearer": [] }, {}], - "parameters": [ - { - "name": "app_id", - "in": "path", - "required": true, - "schema": { "type": "string", "title": "App Id" } - }, - { - "name": "user_id", - "in": "path", - "required": true, - "schema": { "type": "string", "title": "User Id" } - }, - { - "name": "session_id", - "in": "path", - "required": true, - "schema": { "type": "string", "title": "Session Id" } - }, - { - "name": "reverse", - "in": "query", - "required": false, - "schema": { - "anyOf": [{ "type": "boolean" }, { "type": "null" }], - "default": false, - "title": "Reverse" - } - }, - { - "name": "page", - "in": "query", - "required": false, - "schema": { - "type": "integer", - "minimum": 1, - "description": "Page number", - "default": 1, - "title": "Page" - }, - "description": "Page number" - }, - { - "name": "size", - "in": "query", - "required": false, - "schema": { - "type": "integer", - "maximum": 100, - "minimum": 1, - "description": "Page size", - "default": 50, - "title": "Size" - }, - "description": "Page size" - } - ], - "requestBody": { - "required": true, - "content": { - "application/json": { - "schema": { "$ref": "#/components/schemas/MetamessageGet" } - } - } - }, - "responses": { - "200": { - "description": "Successful Response", - "content": { - "application/json": { - "schema": { "$ref": "#/components/schemas/Page_Metamessage_" } - } - } - }, - "422": { - "description": "Validation Error", - "content": { - "application/json": { - "schema": { "$ref": "#/components/schemas/HTTPValidationError" } - } - } - } - }, - "x-codeSamples": [ - { - "lang": "JavaScript", - "source": "import Honcho from 'honcho';\n\nconst client = new Honcho({\n apiKey: process.env['HONCHO_API_KEY'], // This is the default and can be omitted\n});\n\nasync function main() {\n // Automatically fetches more pages as needed.\n for await (const metamessage of client.apps.users.sessions.metamessages.list(\n 'app_id',\n 'user_id',\n 'session_id',\n )) {\n console.log(metamessage.id);\n }\n}\n\nmain();" - }, - { - "lang": "Python", - "source": "import os\nfrom honcho import Honcho\n\nclient = Honcho(\n # This is the default and can be omitted\n api_key=os.environ.get(\"HONCHO_API_KEY\"),\n)\npage = client.apps.users.sessions.metamessages.list(\n session_id=\"session_id\",\n app_id=\"app_id\",\n user_id=\"user_id\",\n)\npage = page.items[0]\nprint(page.id)" - } - ] - } - }, - "/v1/apps/{app_id}/users/{user_id}/sessions/{session_id}/metamessages/{metamessage_id}": { - "get": { - "tags": ["metamessages"], - "summary": "Get Metamessage", - "description": "Get a specific Metamessage by ID\n\nArgs:\n app_id (str): The ID of the app representing the client application using\n honcho\n user_id (str): The User ID representing the user, managed by the user\n session_id (int): The ID of the Session to retrieve\n\nReturns:\n schemas.Session: The Session object of the requested Session\n\nRaises:\n HTTPException: If the session is not found", - "operationId": "get_metamessage_v1_apps__app_id__users__user_id__sessions__session_id__metamessages__metamessage_id__get", - "security": [{ "HTTPBearer": [] }, {}], - "parameters": [ - { - "name": "app_id", - "in": "path", - "required": true, - "schema": { "type": "string", "title": "App Id" } - }, - { - "name": "user_id", - "in": "path", - "required": true, - "schema": { "type": "string", "title": "User Id" } - }, - { - "name": "session_id", - "in": "path", - "required": true, - "schema": { "type": "string", "title": "Session Id" } - }, - { - "name": "metamessage_id", - "in": "path", - "required": true, - "schema": { "type": "string", "title": "Metamessage Id" } - }, - { - "name": "message_id", - "in": "query", - "required": true, - "schema": { "type": "string", "title": "Message Id" } - } - ], - "responses": { - "200": { - "description": "Successful Response", - "content": { - "application/json": { - "schema": { "$ref": "#/components/schemas/Metamessage" } - } - } - }, - "422": { - "description": "Validation Error", - "content": { - "application/json": { - "schema": { "$ref": "#/components/schemas/HTTPValidationError" } - } - } - } - }, - "x-codeSamples": [ - { - "lang": "JavaScript", - "source": "import Honcho from 'honcho';\n\nconst client = new Honcho({\n apiKey: process.env['HONCHO_API_KEY'], // This is the default and can be omitted\n});\n\nasync function main() {\n const metamessage = await client.apps.users.sessions.metamessages.get(\n 'app_id',\n 'user_id',\n 'session_id',\n 'metamessage_id',\n { message_id: 'message_id' },\n );\n\n console.log(metamessage.id);\n}\n\nmain();" - }, - { - "lang": "Python", - "source": "import os\nfrom honcho import Honcho\n\nclient = Honcho(\n # This is the default and can be omitted\n api_key=os.environ.get(\"HONCHO_API_KEY\"),\n)\nmetamessage = client.apps.users.sessions.metamessages.get(\n metamessage_id=\"metamessage_id\",\n app_id=\"app_id\",\n user_id=\"user_id\",\n session_id=\"session_id\",\n message_id=\"message_id\",\n)\nprint(metamessage.id)" - } - ] - }, - "put": { - "tags": ["metamessages"], - "summary": "Update Metamessage", - "description": "Update's the metadata of a metamessage", - "operationId": "update_metamessage_v1_apps__app_id__users__user_id__sessions__session_id__metamessages__metamessage_id__put", - "security": [{ "HTTPBearer": [] }, {}], - "parameters": [ - { - "name": "app_id", - "in": "path", - "required": true, - "schema": { "type": "string", "title": "App Id" } - }, - { - "name": "user_id", - "in": "path", - "required": true, - "schema": { "type": "string", "title": "User Id" } - }, - { - "name": "session_id", - "in": "path", - "required": true, - "schema": { "type": "string", "title": "Session Id" } - }, - { - "name": "metamessage_id", - "in": "path", - "required": true, - "schema": { "type": "string", "title": "Metamessage Id" } - } - ], - "requestBody": { - "required": true, - "content": { - "application/json": { - "schema": { "$ref": "#/components/schemas/MetamessageUpdate" } - } - } - }, - "responses": { - "200": { - "description": "Successful Response", - "content": { - "application/json": { - "schema": { "$ref": "#/components/schemas/Metamessage" } - } - } - }, - "422": { - "description": "Validation Error", - "content": { - "application/json": { - "schema": { "$ref": "#/components/schemas/HTTPValidationError" } - } - } - } - }, - "x-codeSamples": [ - { - "lang": "JavaScript", - "source": "import Honcho from 'honcho';\n\nconst client = new Honcho({\n apiKey: process.env['HONCHO_API_KEY'], // This is the default and can be omitted\n});\n\nasync function main() {\n const metamessage = await client.apps.users.sessions.metamessages.update(\n 'app_id',\n 'user_id',\n 'session_id',\n 'metamessage_id',\n { message_id: 'message_id' },\n );\n\n console.log(metamessage.id);\n}\n\nmain();" - }, - { - "lang": "Python", - "source": "import os\nfrom honcho import Honcho\n\nclient = Honcho(\n # This is the default and can be omitted\n api_key=os.environ.get(\"HONCHO_API_KEY\"),\n)\nmetamessage = client.apps.users.sessions.metamessages.update(\n metamessage_id=\"metamessage_id\",\n app_id=\"app_id\",\n user_id=\"user_id\",\n session_id=\"session_id\",\n message_id=\"message_id\",\n)\nprint(metamessage.id)" - } - ] - } - }, - "/v1/apps/{app_id}/users/{user_id}/metamessages/list": { - "post": { - "tags": ["metamessages"], - "summary": "Get Metamessages By User", - "description": "Paginate through the user metamessages for a user\n\nArgs:\n app_id (str): The ID of the app representing the client application using honcho\n user_id (str): The User ID representing the user, managed by the user\n reverse (bool): Whether to reverse the order of the metamessages\n\nReturns:\n list[schemas.Message]: List of Message objects\n\nRaises:\n HTTPException: If the session is not found", - "operationId": "get_metamessages_by_user_v1_apps__app_id__users__user_id__metamessages_list_post", - "security": [{ "HTTPBearer": [] }, {}], - "parameters": [ - { - "name": "app_id", - "in": "path", - "required": true, - "schema": { "type": "string", "title": "App Id" } - }, - { - "name": "user_id", - "in": "path", - "required": true, - "schema": { "type": "string", "title": "User Id" } - }, - { - "name": "reverse", - "in": "query", - "required": false, - "schema": { - "anyOf": [{ "type": "boolean" }, { "type": "null" }], - "default": false, - "title": "Reverse" - } - }, - { - "name": "page", - "in": "query", - "required": false, - "schema": { - "type": "integer", - "minimum": 1, - "description": "Page number", - "default": 1, - "title": "Page" - }, - "description": "Page number" - }, - { - "name": "size", - "in": "query", - "required": false, - "schema": { - "type": "integer", - "maximum": 100, - "minimum": 1, - "description": "Page size", - "default": 50, - "title": "Size" - }, - "description": "Page size" - } - ], - "requestBody": { - "required": true, - "content": { - "application/json": { - "schema": { - "$ref": "#/components/schemas/MetamessageGetUserLevel" - } - } - } - }, - "responses": { - "200": { - "description": "Successful Response", - "content": { - "application/json": { - "schema": { "$ref": "#/components/schemas/Page_Metamessage_" } - } - } - }, - "422": { - "description": "Validation Error", - "content": { - "application/json": { - "schema": { "$ref": "#/components/schemas/HTTPValidationError" } - } - } - } - }, - "x-codeSamples": [ - { - "lang": "JavaScript", - "source": "import Honcho from 'honcho';\n\nconst client = new Honcho({\n apiKey: process.env['HONCHO_API_KEY'], // This is the default and can be omitted\n});\n\nasync function main() {\n // Automatically fetches more pages as needed.\n for await (const metamessage of client.apps.users.metamessages.list('app_id', 'user_id')) {\n console.log(metamessage.id);\n }\n}\n\nmain();" - }, - { - "lang": "Python", - "source": "import os\nfrom honcho import Honcho\n\nclient = Honcho(\n # This is the default and can be omitted\n api_key=os.environ.get(\"HONCHO_API_KEY\"),\n)\npage = client.apps.users.metamessages.list(\n user_id=\"user_id\",\n app_id=\"app_id\",\n)\npage = page.items[0]\nprint(page.id)" - } - ] - } - }, - "/v1/apps/{app_id}/users/{user_id}/collections/list": { - "post": { - "tags": ["collections"], - "summary": "Get Collections", - "description": "Get All Collections for a User\n\nArgs:\n app_id (str): The ID of the app representing the client\n application using honcho\n user_id (str): The User ID representing the user, managed by the user\n\nReturns:\n list[schemas.Collection]: List of Collection objects", - "operationId": "get_collections_v1_apps__app_id__users__user_id__collections_list_post", - "security": [{ "HTTPBearer": [] }, {}], - "parameters": [ - { - "name": "app_id", - "in": "path", - "required": true, - "schema": { "type": "string", "title": "App Id" } - }, - { - "name": "user_id", - "in": "path", - "required": true, - "schema": { "type": "string", "title": "User Id" } - }, - { - "name": "reverse", - "in": "query", - "required": false, - "schema": { - "anyOf": [{ "type": "boolean" }, { "type": "null" }], - "default": false, - "title": "Reverse" - } - }, - { - "name": "page", - "in": "query", - "required": false, - "schema": { - "type": "integer", - "minimum": 1, - "description": "Page number", - "default": 1, - "title": "Page" - }, - "description": "Page number" - }, - { - "name": "size", - "in": "query", - "required": false, - "schema": { - "type": "integer", - "maximum": 100, - "minimum": 1, - "description": "Page size", - "default": 50, - "title": "Size" - }, - "description": "Page size" - } - ], - "requestBody": { - "required": true, - "content": { - "application/json": { - "schema": { "$ref": "#/components/schemas/CollectionGet" } - } - } - }, - "responses": { - "200": { - "description": "Successful Response", - "content": { - "application/json": { - "schema": { "$ref": "#/components/schemas/Page_Collection_" } - } - } - }, - "422": { - "description": "Validation Error", - "content": { - "application/json": { - "schema": { "$ref": "#/components/schemas/HTTPValidationError" } - } - } - } - }, - "x-codeSamples": [ - { - "lang": "JavaScript", - "source": "import Honcho from 'honcho';\n\nconst client = new Honcho({\n apiKey: process.env['HONCHO_API_KEY'], // This is the default and can be omitted\n});\n\nasync function main() {\n // Automatically fetches more pages as needed.\n for await (const collection of client.apps.users.collections.list('app_id', 'user_id')) {\n console.log(collection.id);\n }\n}\n\nmain();" - }, - { - "lang": "Python", - "source": "import os\nfrom honcho import Honcho\n\nclient = Honcho(\n # This is the default and can be omitted\n api_key=os.environ.get(\"HONCHO_API_KEY\"),\n)\npage = client.apps.users.collections.list(\n user_id=\"user_id\",\n app_id=\"app_id\",\n)\npage = page.items[0]\nprint(page.id)" - } - ] - } - }, - "/v1/apps/{app_id}/users/{user_id}/collections/name/{name}": { - "get": { - "tags": ["collections"], - "summary": "Get Collection By Name", - "operationId": "get_collection_by_name_v1_apps__app_id__users__user_id__collections_name__name__get", - "security": [{ "HTTPBearer": [] }, {}], - "parameters": [ - { - "name": "app_id", - "in": "path", - "required": true, - "schema": { "type": "string", "title": "App Id" } - }, - { - "name": "user_id", - "in": "path", - "required": true, - "schema": { "type": "string", "title": "User Id" } - }, - { - "name": "name", - "in": "path", - "required": true, - "schema": { "type": "string", "title": "Name" } - } - ], - "responses": { - "200": { - "description": "Successful Response", - "content": { - "application/json": { - "schema": { "$ref": "#/components/schemas/Collection" } - } - } - }, - "422": { - "description": "Validation Error", - "content": { - "application/json": { - "schema": { "$ref": "#/components/schemas/HTTPValidationError" } - } - } - } - }, - "x-codeSamples": [ - { - "lang": "JavaScript", - "source": "import Honcho from 'honcho';\n\nconst client = new Honcho({\n apiKey: process.env['HONCHO_API_KEY'], // This is the default and can be omitted\n});\n\nasync function main() {\n const collection = await client.apps.users.collections.getByName('app_id', 'user_id', 'name');\n\n console.log(collection.id);\n}\n\nmain();" - }, - { - "lang": "Python", - "source": "import os\nfrom honcho import Honcho\n\nclient = Honcho(\n # This is the default and can be omitted\n api_key=os.environ.get(\"HONCHO_API_KEY\"),\n)\ncollection = client.apps.users.collections.get_by_name(\n name=\"name\",\n app_id=\"app_id\",\n user_id=\"user_id\",\n)\nprint(collection.id)" - } - ] - } - }, - "/v1/apps/{app_id}/users/{user_id}/collections/{collection_id}": { - "get": { - "tags": ["collections"], - "summary": "Get Collection By Id", - "operationId": "get_collection_by_id_v1_apps__app_id__users__user_id__collections__collection_id__get", - "security": [{ "HTTPBearer": [] }, {}], - "parameters": [ - { - "name": "app_id", - "in": "path", - "required": true, - "schema": { "type": "string", "title": "App Id" } - }, - { - "name": "user_id", - "in": "path", - "required": true, - "schema": { "type": "string", "title": "User Id" } - }, - { - "name": "collection_id", - "in": "path", - "required": true, - "schema": { "type": "string", "title": "Collection Id" } - } - ], - "responses": { - "200": { - "description": "Successful Response", - "content": { - "application/json": { - "schema": { "$ref": "#/components/schemas/Collection" } - } - } - }, - "422": { - "description": "Validation Error", - "content": { - "application/json": { - "schema": { "$ref": "#/components/schemas/HTTPValidationError" } - } - } - } - }, - "x-codeSamples": [ - { - "lang": "JavaScript", - "source": "import Honcho from 'honcho';\n\nconst client = new Honcho({\n apiKey: process.env['HONCHO_API_KEY'], // This is the default and can be omitted\n});\n\nasync function main() {\n const collection = await client.apps.users.collections.get('app_id', 'user_id', 'collection_id');\n\n console.log(collection.id);\n}\n\nmain();" - }, - { - "lang": "Python", - "source": "import os\nfrom honcho import Honcho\n\nclient = Honcho(\n # This is the default and can be omitted\n api_key=os.environ.get(\"HONCHO_API_KEY\"),\n)\ncollection = client.apps.users.collections.get(\n collection_id=\"collection_id\",\n app_id=\"app_id\",\n user_id=\"user_id\",\n)\nprint(collection.id)" - } - ] - }, - "put": { - "tags": ["collections"], - "summary": "Update Collection", - "operationId": "update_collection_v1_apps__app_id__users__user_id__collections__collection_id__put", - "security": [{ "HTTPBearer": [] }, {}], - "parameters": [ - { - "name": "app_id", - "in": "path", - "required": true, - "schema": { "type": "string", "title": "App Id" } - }, - { - "name": "user_id", - "in": "path", - "required": true, - "schema": { "type": "string", "title": "User Id" } - }, - { - "name": "collection_id", - "in": "path", - "required": true, - "schema": { "type": "string", "title": "Collection Id" } - } - ], - "requestBody": { - "required": true, - "content": { - "application/json": { - "schema": { "$ref": "#/components/schemas/CollectionUpdate" } - } - } - }, - "responses": { - "200": { - "description": "Successful Response", - "content": { - "application/json": { - "schema": { "$ref": "#/components/schemas/Collection" } - } - } - }, - "422": { - "description": "Validation Error", - "content": { - "application/json": { - "schema": { "$ref": "#/components/schemas/HTTPValidationError" } - } - } - } - }, - "x-codeSamples": [ - { - "lang": "JavaScript", - "source": "import Honcho from 'honcho';\n\nconst client = new Honcho({\n apiKey: process.env['HONCHO_API_KEY'], // This is the default and can be omitted\n});\n\nasync function main() {\n const collection = await client.apps.users.collections.update('app_id', 'user_id', 'collection_id');\n\n console.log(collection.id);\n}\n\nmain();" - }, - { - "lang": "Python", - "source": "import os\nfrom honcho import Honcho\n\nclient = Honcho(\n # This is the default and can be omitted\n api_key=os.environ.get(\"HONCHO_API_KEY\"),\n)\ncollection = client.apps.users.collections.update(\n collection_id=\"collection_id\",\n app_id=\"app_id\",\n user_id=\"user_id\",\n)\nprint(collection.id)" - } - ] - }, - "delete": { - "tags": ["collections"], - "summary": "Delete Collection", - "operationId": "delete_collection_v1_apps__app_id__users__user_id__collections__collection_id__delete", - "security": [{ "HTTPBearer": [] }, {}], - "parameters": [ - { - "name": "app_id", - "in": "path", - "required": true, - "schema": { "type": "string", "title": "App Id" } - }, - { - "name": "user_id", - "in": "path", - "required": true, - "schema": { "type": "string", "title": "User Id" } - }, - { - "name": "collection_id", - "in": "path", - "required": true, - "schema": { "type": "string", "title": "Collection Id" } - } - ], - "responses": { - "200": { - "description": "Successful Response", - "content": { "application/json": { "schema": {} } } - }, - "422": { - "description": "Validation Error", - "content": { - "application/json": { - "schema": { "$ref": "#/components/schemas/HTTPValidationError" } - } - } - } - }, - "x-codeSamples": [ - { - "lang": "JavaScript", - "source": "import Honcho from 'honcho';\n\nconst client = new Honcho({\n apiKey: process.env['HONCHO_API_KEY'], // This is the default and can be omitted\n});\n\nasync function main() {\n const collection = await client.apps.users.collections.delete('app_id', 'user_id', 'collection_id');\n\n console.log(collection);\n}\n\nmain();" - }, - { - "lang": "Python", - "source": "import os\nfrom honcho import Honcho\n\nclient = Honcho(\n # This is the default and can be omitted\n api_key=os.environ.get(\"HONCHO_API_KEY\"),\n)\ncollection = client.apps.users.collections.delete(\n collection_id=\"collection_id\",\n app_id=\"app_id\",\n user_id=\"user_id\",\n)\nprint(collection)" - } - ] - } - }, - "/v1/apps/{app_id}/users/{user_id}/collections": { - "post": { - "tags": ["collections"], - "summary": "Create Collection", - "operationId": "create_collection_v1_apps__app_id__users__user_id__collections_post", - "security": [{ "HTTPBearer": [] }, {}], - "parameters": [ - { - "name": "app_id", - "in": "path", - "required": true, - "schema": { "type": "string", "title": "App Id" } - }, - { - "name": "user_id", - "in": "path", - "required": true, - "schema": { "type": "string", "title": "User Id" } - } - ], - "requestBody": { - "required": true, - "content": { - "application/json": { - "schema": { "$ref": "#/components/schemas/CollectionCreate" } - } - } - }, - "responses": { - "200": { - "description": "Successful Response", - "content": { - "application/json": { - "schema": { "$ref": "#/components/schemas/Collection" } - } - } - }, - "422": { - "description": "Validation Error", - "content": { - "application/json": { - "schema": { "$ref": "#/components/schemas/HTTPValidationError" } - } - } - } - }, - "x-codeSamples": [ - { - "lang": "JavaScript", - "source": "import Honcho from 'honcho';\n\nconst client = new Honcho({\n apiKey: process.env['HONCHO_API_KEY'], // This is the default and can be omitted\n});\n\nasync function main() {\n const collection = await client.apps.users.collections.create('app_id', 'user_id', { name: 'name' });\n\n console.log(collection.id);\n}\n\nmain();" - }, - { - "lang": "Python", - "source": "import os\nfrom honcho import Honcho\n\nclient = Honcho(\n # This is the default and can be omitted\n api_key=os.environ.get(\"HONCHO_API_KEY\"),\n)\ncollection = client.apps.users.collections.create(\n user_id=\"user_id\",\n app_id=\"app_id\",\n name=\"name\",\n)\nprint(collection.id)" - } - ] - } - }, - "/v1/apps/{app_id}/users/{user_id}/collections/{collection_id}/documents/list": { - "post": { - "tags": ["documents"], - "summary": "Get Documents", - "operationId": "get_documents_v1_apps__app_id__users__user_id__collections__collection_id__documents_list_post", - "security": [{ "HTTPBearer": [] }, {}], - "parameters": [ - { - "name": "app_id", - "in": "path", - "required": true, - "schema": { "type": "string", "title": "App Id" } - }, - { - "name": "user_id", - "in": "path", - "required": true, - "schema": { "type": "string", "title": "User Id" } - }, - { - "name": "collection_id", - "in": "path", - "required": true, - "schema": { "type": "string", "title": "Collection Id" } - }, - { - "name": "reverse", - "in": "query", - "required": false, - "schema": { - "anyOf": [{ "type": "boolean" }, { "type": "null" }], - "default": false, - "title": "Reverse" - } - }, - { - "name": "page", - "in": "query", - "required": false, - "schema": { - "type": "integer", - "minimum": 1, - "description": "Page number", - "default": 1, - "title": "Page" - }, - "description": "Page number" - }, - { - "name": "size", - "in": "query", - "required": false, - "schema": { - "type": "integer", - "maximum": 100, - "minimum": 1, - "description": "Page size", - "default": 50, - "title": "Size" - }, - "description": "Page size" - } - ], - "requestBody": { - "required": true, - "content": { - "application/json": { - "schema": { "$ref": "#/components/schemas/DocumentGet" } - } - } - }, - "responses": { - "200": { - "description": "Successful Response", - "content": { - "application/json": { - "schema": { "$ref": "#/components/schemas/Page_Document_" } - } - } - }, - "422": { - "description": "Validation Error", - "content": { - "application/json": { - "schema": { "$ref": "#/components/schemas/HTTPValidationError" } - } - } - } - }, - "x-codeSamples": [ - { - "lang": "JavaScript", - "source": "import Honcho from 'honcho';\n\nconst client = new Honcho({\n apiKey: process.env['HONCHO_API_KEY'], // This is the default and can be omitted\n});\n\nasync function main() {\n // Automatically fetches more pages as needed.\n for await (const document of client.apps.users.collections.documents.list(\n 'app_id',\n 'user_id',\n 'collection_id',\n )) {\n console.log(document.id);\n }\n}\n\nmain();" - }, - { - "lang": "Python", - "source": "import os\nfrom honcho import Honcho\n\nclient = Honcho(\n # This is the default and can be omitted\n api_key=os.environ.get(\"HONCHO_API_KEY\"),\n)\npage = client.apps.users.collections.documents.list(\n collection_id=\"collection_id\",\n app_id=\"app_id\",\n user_id=\"user_id\",\n)\npage = page.items[0]\nprint(page.id)" - } - ] - } - }, - "/v1/apps/{app_id}/users/{user_id}/collections/{collection_id}/documents/{document_id}": { - "get": { - "tags": ["documents"], - "summary": "Get Document", - "operationId": "get_document_v1_apps__app_id__users__user_id__collections__collection_id__documents__document_id__get", - "security": [{ "HTTPBearer": [] }, {}], - "parameters": [ - { - "name": "app_id", - "in": "path", - "required": true, - "schema": { "type": "string", "title": "App Id" } - }, - { - "name": "user_id", - "in": "path", - "required": true, - "schema": { "type": "string", "title": "User Id" } - }, - { - "name": "collection_id", - "in": "path", - "required": true, - "schema": { "type": "string", "title": "Collection Id" } - }, - { - "name": "document_id", - "in": "path", - "required": true, - "schema": { "type": "string", "title": "Document Id" } - } - ], - "responses": { - "200": { - "description": "Successful Response", - "content": { - "application/json": { - "schema": { "$ref": "#/components/schemas/Document" } - } - } - }, - "422": { - "description": "Validation Error", - "content": { - "application/json": { - "schema": { "$ref": "#/components/schemas/HTTPValidationError" } - } - } - } - }, - "x-codeSamples": [ - { - "lang": "JavaScript", - "source": "import Honcho from 'honcho';\n\nconst client = new Honcho({\n apiKey: process.env['HONCHO_API_KEY'], // This is the default and can be omitted\n});\n\nasync function main() {\n const document = await client.apps.users.collections.documents.get(\n 'app_id',\n 'user_id',\n 'collection_id',\n 'document_id',\n );\n\n console.log(document.id);\n}\n\nmain();" - }, - { - "lang": "Python", - "source": "import os\nfrom honcho import Honcho\n\nclient = Honcho(\n # This is the default and can be omitted\n api_key=os.environ.get(\"HONCHO_API_KEY\"),\n)\ndocument = client.apps.users.collections.documents.get(\n document_id=\"document_id\",\n app_id=\"app_id\",\n user_id=\"user_id\",\n collection_id=\"collection_id\",\n)\nprint(document.id)" - } - ] - }, - "put": { - "tags": ["documents"], - "summary": "Update Document", - "operationId": "update_document_v1_apps__app_id__users__user_id__collections__collection_id__documents__document_id__put", - "security": [{ "HTTPBearer": [] }, {}], - "parameters": [ - { - "name": "app_id", - "in": "path", - "required": true, - "schema": { "type": "string", "title": "App Id" } - }, - { - "name": "user_id", - "in": "path", - "required": true, - "schema": { "type": "string", "title": "User Id" } - }, - { - "name": "collection_id", - "in": "path", - "required": true, - "schema": { "type": "string", "title": "Collection Id" } - }, - { - "name": "document_id", - "in": "path", - "required": true, - "schema": { "type": "string", "title": "Document Id" } - } - ], - "requestBody": { - "required": true, - "content": { - "application/json": { - "schema": { "$ref": "#/components/schemas/DocumentUpdate" } - } - } - }, - "responses": { - "200": { - "description": "Successful Response", - "content": { - "application/json": { - "schema": { "$ref": "#/components/schemas/Document" } - } - } - }, - "422": { - "description": "Validation Error", - "content": { - "application/json": { - "schema": { "$ref": "#/components/schemas/HTTPValidationError" } - } - } - } - }, - "x-codeSamples": [ - { - "lang": "JavaScript", - "source": "import Honcho from 'honcho';\n\nconst client = new Honcho({\n apiKey: process.env['HONCHO_API_KEY'], // This is the default and can be omitted\n});\n\nasync function main() {\n const document = await client.apps.users.collections.documents.update(\n 'app_id',\n 'user_id',\n 'collection_id',\n 'document_id',\n );\n\n console.log(document.id);\n}\n\nmain();" - }, - { - "lang": "Python", - "source": "import os\nfrom honcho import Honcho\n\nclient = Honcho(\n # This is the default and can be omitted\n api_key=os.environ.get(\"HONCHO_API_KEY\"),\n)\ndocument = client.apps.users.collections.documents.update(\n document_id=\"document_id\",\n app_id=\"app_id\",\n user_id=\"user_id\",\n collection_id=\"collection_id\",\n)\nprint(document.id)" - } - ] - }, - "delete": { - "tags": ["documents"], - "summary": "Delete Document", - "operationId": "delete_document_v1_apps__app_id__users__user_id__collections__collection_id__documents__document_id__delete", - "security": [{ "HTTPBearer": [] }, {}], - "parameters": [ - { - "name": "app_id", - "in": "path", - "required": true, - "schema": { "type": "string", "title": "App Id" } - }, - { - "name": "user_id", - "in": "path", - "required": true, - "schema": { "type": "string", "title": "User Id" } - }, - { - "name": "collection_id", - "in": "path", - "required": true, - "schema": { "type": "string", "title": "Collection Id" } - }, - { - "name": "document_id", - "in": "path", - "required": true, - "schema": { "type": "string", "title": "Document Id" } - } - ], - "responses": { - "200": { - "description": "Successful Response", - "content": { "application/json": { "schema": {} } } - }, - "422": { - "description": "Validation Error", - "content": { - "application/json": { - "schema": { "$ref": "#/components/schemas/HTTPValidationError" } - } - } - } - }, - "x-codeSamples": [ - { - "lang": "JavaScript", - "source": "import Honcho from 'honcho';\n\nconst client = new Honcho({\n apiKey: process.env['HONCHO_API_KEY'], // This is the default and can be omitted\n});\n\nasync function main() {\n const document = await client.apps.users.collections.documents.delete(\n 'app_id',\n 'user_id',\n 'collection_id',\n 'document_id',\n );\n\n console.log(document);\n}\n\nmain();" - }, - { - "lang": "Python", - "source": "import os\nfrom honcho import Honcho\n\nclient = Honcho(\n # This is the default and can be omitted\n api_key=os.environ.get(\"HONCHO_API_KEY\"),\n)\ndocument = client.apps.users.collections.documents.delete(\n document_id=\"document_id\",\n app_id=\"app_id\",\n user_id=\"user_id\",\n collection_id=\"collection_id\",\n)\nprint(document)" - } - ] - } - }, - "/v1/apps/{app_id}/users/{user_id}/collections/{collection_id}/documents/query": { - "get": { - "tags": ["documents"], - "summary": "Query Documents", - "operationId": "query_documents_v1_apps__app_id__users__user_id__collections__collection_id__documents_query_get", - "security": [{ "HTTPBearer": [] }, {}], - "parameters": [ - { - "name": "app_id", - "in": "path", - "required": true, - "schema": { "type": "string", "title": "App Id" } - }, - { - "name": "user_id", - "in": "path", - "required": true, - "schema": { "type": "string", "title": "User Id" } - }, - { - "name": "collection_id", - "in": "path", - "required": true, - "schema": { "type": "string", "title": "Collection Id" } - }, - { - "name": "query", - "in": "query", - "required": true, - "schema": { "type": "string", "title": "Query" } - }, - { - "name": "top_k", - "in": "query", - "required": false, - "schema": { "type": "integer", "default": 5, "title": "Top K" } - }, - { - "name": "filter", - "in": "query", - "required": false, - "schema": { - "anyOf": [{ "type": "string" }, { "type": "null" }], - "title": "Filter" - } - } - ], - "responses": { - "200": { - "description": "Successful Response", - "content": { - "application/json": { - "schema": { - "type": "array", - "items": { "$ref": "#/components/schemas/Document" }, - "title": "Response Query Documents V1 Apps App Id Users User Id Collections Collection Id Documents Query Get" - } - } - } - }, - "422": { - "description": "Validation Error", - "content": { - "application/json": { - "schema": { "$ref": "#/components/schemas/HTTPValidationError" } - } - } - } - }, - "x-codeSamples": [ - { - "lang": "JavaScript", - "source": "import Honcho from 'honcho';\n\nconst client = new Honcho({\n apiKey: process.env['HONCHO_API_KEY'], // This is the default and can be omitted\n});\n\nasync function main() {\n const documents = await client.apps.users.collections.documents.query(\n 'app_id',\n 'user_id',\n 'collection_id',\n { query: 'query' },\n );\n\n console.log(documents);\n}\n\nmain();" - }, - { - "lang": "Python", - "source": "import os\nfrom honcho import Honcho\n\nclient = Honcho(\n # This is the default and can be omitted\n api_key=os.environ.get(\"HONCHO_API_KEY\"),\n)\ndocuments = client.apps.users.collections.documents.query(\n collection_id=\"collection_id\",\n app_id=\"app_id\",\n user_id=\"user_id\",\n query=\"query\",\n)\nprint(documents)" - } - ] - } - }, - "/v1/apps/{app_id}/users/{user_id}/collections/{collection_id}/documents": { - "post": { - "tags": ["documents"], - "summary": "Create Document", - "operationId": "create_document_v1_apps__app_id__users__user_id__collections__collection_id__documents_post", - "security": [{ "HTTPBearer": [] }, {}], - "parameters": [ - { - "name": "app_id", - "in": "path", - "required": true, - "schema": { "type": "string", "title": "App Id" } - }, - { - "name": "user_id", - "in": "path", - "required": true, - "schema": { "type": "string", "title": "User Id" } - }, - { - "name": "collection_id", - "in": "path", - "required": true, - "schema": { "type": "string", "title": "Collection Id" } - } - ], - "requestBody": { - "required": true, - "content": { - "application/json": { - "schema": { "$ref": "#/components/schemas/DocumentCreate" } - } - } - }, - "responses": { - "200": { - "description": "Successful Response", - "content": { - "application/json": { - "schema": { "$ref": "#/components/schemas/Document" } - } - } - }, - "422": { - "description": "Validation Error", - "content": { - "application/json": { - "schema": { "$ref": "#/components/schemas/HTTPValidationError" } - } - } - } - }, - "x-codeSamples": [ - { - "lang": "JavaScript", - "source": "import Honcho from 'honcho';\n\nconst client = new Honcho({\n apiKey: process.env['HONCHO_API_KEY'], // This is the default and can be omitted\n});\n\nasync function main() {\n const document = await client.apps.users.collections.documents.create(\n 'app_id',\n 'user_id',\n 'collection_id',\n { content: 'content' },\n );\n\n console.log(document.id);\n}\n\nmain();" - }, - { - "lang": "Python", - "source": "import os\nfrom honcho import Honcho\n\nclient = Honcho(\n # This is the default and can be omitted\n api_key=os.environ.get(\"HONCHO_API_KEY\"),\n)\ndocument = client.apps.users.collections.documents.create(\n collection_id=\"collection_id\",\n app_id=\"app_id\",\n user_id=\"user_id\",\n content=\"content\",\n)\nprint(document.id)" - } - ] - } - } - }, - "components": { - "schemas": { - "AgentChat": { - "properties": { "content": { "type": "string", "title": "Content" } }, - "type": "object", - "required": ["content"], - "title": "AgentChat" - }, - "AgentQuery": { - "properties": { - "queries": { - "anyOf": [ - { "type": "string" }, - { "items": { "type": "string" }, "type": "array" } - ], - "title": "Queries" - } - }, - "type": "object", - "required": ["queries"], - "title": "AgentQuery" - }, - "AgentQuery": { - "properties": { - "queries": { - "anyOf": [ - { - "type": "string" - }, - { - "items": { - "type": "string" - }, - "type": "array" - } - ], - "title": "Queries" - } - }, - "type": "object", - "required": ["queries"], - "title": "AgentQuery" - }, - "App": { - "properties": { - "id": { "type": "string", "title": "Id" }, - "name": { "type": "string", "title": "Name" }, - "metadata": { - "type": "object", - "title": "Metadata", - "additionalProperties": true - }, - "created_at": { - "type": "string", - "format": "date-time", - "title": "Created At" - } - }, - "type": "object", - "required": ["id", "name", "metadata", "created_at"], - "title": "App", - "exclude": ["h_metadata", "public_id"] - }, - "AppCreate": { - "properties": { - "name": { "type": "string", "title": "Name" }, - "metadata": { - "type": "object", - "title": "Metadata", - "default": {}, - "additionalProperties": true - } - }, - "type": "object", - "required": ["name"], - "title": "AppCreate" - }, - "AppUpdate": { - "properties": { - "name": { - "anyOf": [{ "type": "string" }, { "type": "null" }], - "title": "Name" - }, - "metadata": { - "anyOf": [ - { "type": "object", "additionalProperties": true }, - { "type": "null" } - ], - "title": "Metadata" - } - }, - "type": "object", - "title": "AppUpdate" - }, - "Collection": { - "properties": { - "id": { "type": "string", "title": "Id" }, - "name": { "type": "string", "title": "Name" }, - "user_id": { "type": "string", "title": "User Id" }, - "metadata": { - "type": "object", - "title": "Metadata", - "additionalProperties": true - }, - "created_at": { - "type": "string", - "format": "date-time", - "title": "Created At" - } - }, - "type": "object", - "required": ["id", "name", "user_id", "metadata", "created_at"], - "title": "Collection", - "exclude": ["h_metadata", "public_id"] - }, - "CollectionCreate": { - "properties": { - "name": { "type": "string", "title": "Name" }, - "metadata": { - "anyOf": [ - { "type": "object", "additionalProperties": true }, - { "type": "null" } - ], - "title": "Metadata", - "default": {} - } - }, - "type": "object", - "required": ["name"], - "title": "CollectionCreate" - }, - "CollectionGet": { - "properties": { - "filter": { - "anyOf": [ - { "type": "object", "additionalProperties": true }, - { "type": "null" } - ], - "title": "Filter" - } - }, - "type": "object", - "title": "CollectionGet" - }, - "CollectionUpdate": { - "properties": { - "name": { - "anyOf": [{ "type": "string" }, { "type": "null" }], - "title": "Name" - }, - "metadata": { - "anyOf": [ - { "type": "object", "additionalProperties": true }, - { "type": "null" } - ], - "title": "Metadata" - } - }, - "type": "object", - "title": "CollectionUpdate" - }, - "Document": { - "properties": { - "id": { "type": "string", "title": "Id" }, - "content": { "type": "string", "title": "Content" }, - "metadata": { - "type": "object", - "title": "Metadata", - "additionalProperties": true - }, - "created_at": { - "type": "string", - "format": "date-time", - "title": "Created At" - }, - "collection_id": { "type": "string", "title": "Collection Id" } - }, - "type": "object", - "required": [ - "id", - "content", - "metadata", - "created_at", - "collection_id" - ], - "title": "Document", - "exclude": ["h_metadata", "public_id"] - }, - "DocumentCreate": { - "properties": { - "content": { "type": "string", "title": "Content" }, - "metadata": { - "anyOf": [ - { "type": "object", "additionalProperties": true }, - { "type": "null" } - ], - "title": "Metadata", - "default": {} - } - }, - "type": "object", - "required": ["content"], - "title": "DocumentCreate" - }, - "DocumentGet": { - "properties": { - "filter": { - "anyOf": [ - { "type": "object", "additionalProperties": true }, - { "type": "null" } - ], - "title": "Filter" - } - }, - "type": "object", - "title": "DocumentGet" - }, - "DocumentUpdate": { - "properties": { - "metadata": { - "anyOf": [ - { "type": "object", "additionalProperties": true }, - { "type": "null" } - ], - "title": "Metadata" - }, - "content": { - "anyOf": [{ "type": "string" }, { "type": "null" }], - "title": "Content" - } - }, - "type": "object", - "title": "DocumentUpdate" - }, - "HTTPValidationError": { - "properties": { - "detail": { - "items": { "$ref": "#/components/schemas/ValidationError" }, - "type": "array", - "title": "Detail" - } - }, - "type": "object", - "title": "HTTPValidationError" - }, - "Message": { - "properties": { - "id": { "type": "string", "title": "Id" }, - "content": { "type": "string", "title": "Content" }, - "is_user": { "type": "boolean", "title": "Is User" }, - "session_id": { "type": "string", "title": "Session Id" }, - "metadata": { - "type": "object", - "title": "Metadata", - "additionalProperties": true - }, - "created_at": { - "type": "string", - "format": "date-time", - "title": "Created At" - } - }, - "type": "object", - "required": [ - "id", - "content", - "is_user", - "session_id", - "metadata", - "created_at" - ], - "title": "Message", - "exclude": ["h_metadata", "public_id"] - }, - "MessageCreate": { - "properties": { - "content": { "type": "string", "title": "Content" }, - "is_user": { "type": "boolean", "title": "Is User" }, - "metadata": { - "type": "object", - "title": "Metadata", - "default": {}, - "additionalProperties": true - } - }, - "type": "object", - "required": ["content", "is_user"], - "title": "MessageCreate" - }, - "MessageGet": { - "properties": { - "filter": { - "anyOf": [ - { "type": "object", "additionalProperties": true }, - { "type": "null" } - ], - "title": "Filter" - } - }, - "type": "object", - "title": "MessageGet" - }, - "MessageUpdate": { - "properties": { - "metadata": { - "anyOf": [ - { "type": "object", "additionalProperties": true }, - { "type": "null" } - ], - "title": "Metadata" - } - }, - "type": "object", - "title": "MessageUpdate" - }, - "Metamessage": { - "properties": { - "id": { "type": "string", "title": "Id" }, - "metamessage_type": { "type": "string", "title": "Metamessage Type" }, - "content": { "type": "string", "title": "Content" }, - "message_id": { "type": "string", "title": "Message Id" }, - "metadata": { - "type": "object", - "title": "Metadata", - "additionalProperties": true - }, - "created_at": { - "type": "string", - "format": "date-time", - "title": "Created At" - } - }, - "type": "object", - "required": [ - "id", - "metamessage_type", - "content", - "message_id", - "metadata", - "created_at" - ], - "title": "Metamessage", - "exclude": ["h_metadata", "public_id"] - }, - "MetamessageCreate": { - "properties": { - "metamessage_type": { "type": "string", "title": "Metamessage Type" }, - "content": { "type": "string", "title": "Content" }, - "message_id": { "type": "string", "title": "Message Id" }, - "metadata": { - "anyOf": [ - { "type": "object", "additionalProperties": true }, - { "type": "null" } - ], - "title": "Metadata", - "default": {} - } - }, - "type": "object", - "required": ["metamessage_type", "content", "message_id"], - "title": "MetamessageCreate" - }, - "MetamessageGet": { - "properties": { - "metamessage_type": { - "anyOf": [{ "type": "string" }, { "type": "null" }], - "title": "Metamessage Type" - }, - "message_id": { - "anyOf": [{ "type": "string" }, { "type": "null" }], - "title": "Message Id" - }, - "filter": { - "anyOf": [ - { "type": "object", "additionalProperties": true }, - { "type": "null" } - ], - "title": "Filter" - } - }, - "type": "object", - "title": "MetamessageGet" - }, - "MetamessageGetUserLevel": { - "properties": { - "filter": { - "anyOf": [ - { "type": "object", "additionalProperties": true }, - { "type": "null" } - ], - "title": "Filter" - }, - "metamessage_type": { - "anyOf": [{ "type": "string" }, { "type": "null" }], - "title": "Metamessage Type" - } - }, - "type": "object", - "title": "MetamessageGetUserLevel" - }, - "MetamessageUpdate": { - "properties": { - "message_id": { "type": "string", "title": "Message Id" }, - "metamessage_type": { - "anyOf": [{ "type": "string" }, { "type": "null" }], - "title": "Metamessage Type" - }, - "metadata": { - "anyOf": [ - { "type": "object", "additionalProperties": true }, - { "type": "null" } - ], - "title": "Metadata" - } - }, - "type": "object", - "required": ["message_id"], - "title": "MetamessageUpdate" - }, - "Page_Collection_": { - "properties": { - "items": { - "items": { "$ref": "#/components/schemas/Collection" }, - "type": "array", - "title": "Items" - }, - "total": { "type": "integer", "minimum": 0, "title": "Total" }, - "page": { "type": "integer", "minimum": 1, "title": "Page" }, - "size": { "type": "integer", "minimum": 1, "title": "Size" }, - "pages": { "type": "integer", "minimum": 0, "title": "Pages" } - }, - "type": "object", - "required": ["items", "total", "page", "size"], - "title": "Page[Collection]" - }, - "Page_Document_": { - "properties": { - "items": { - "items": { "$ref": "#/components/schemas/Document" }, - "type": "array", - "title": "Items" - }, - "total": { "type": "integer", "minimum": 0, "title": "Total" }, - "page": { "type": "integer", "minimum": 1, "title": "Page" }, - "size": { "type": "integer", "minimum": 1, "title": "Size" }, - "pages": { "type": "integer", "minimum": 0, "title": "Pages" } - }, - "type": "object", - "required": ["items", "total", "page", "size"], - "title": "Page[Document]" - }, - "Page_Message_": { - "properties": { - "items": { - "items": { "$ref": "#/components/schemas/Message" }, - "type": "array", - "title": "Items" - }, - "total": { "type": "integer", "minimum": 0, "title": "Total" }, - "page": { "type": "integer", "minimum": 1, "title": "Page" }, - "size": { "type": "integer", "minimum": 1, "title": "Size" }, - "pages": { "type": "integer", "minimum": 0, "title": "Pages" } - }, - "type": "object", - "required": ["items", "total", "page", "size"], - "title": "Page[Message]" - }, - "Page_Metamessage_": { - "properties": { - "items": { - "items": { "$ref": "#/components/schemas/Metamessage" }, - "type": "array", - "title": "Items" - }, - "total": { "type": "integer", "minimum": 0, "title": "Total" }, - "page": { "type": "integer", "minimum": 1, "title": "Page" }, - "size": { "type": "integer", "minimum": 1, "title": "Size" }, - "pages": { "type": "integer", "minimum": 0, "title": "Pages" } - }, - "type": "object", - "required": ["items", "total", "page", "size"], - "title": "Page[Metamessage]" - }, - "Page_Session_": { - "properties": { - "items": { - "items": { "$ref": "#/components/schemas/Session" }, - "type": "array", - "title": "Items" - }, - "total": { "type": "integer", "minimum": 0, "title": "Total" }, - "page": { "type": "integer", "minimum": 1, "title": "Page" }, - "size": { "type": "integer", "minimum": 1, "title": "Size" }, - "pages": { "type": "integer", "minimum": 0, "title": "Pages" } - }, - "type": "object", - "required": ["items", "total", "page", "size"], - "title": "Page[Session]" - }, - "Page_User_": { - "properties": { - "items": { - "items": { "$ref": "#/components/schemas/User" }, - "type": "array", - "title": "Items" - }, - "total": { "type": "integer", "minimum": 0, "title": "Total" }, - "page": { "type": "integer", "minimum": 1, "title": "Page" }, - "size": { "type": "integer", "minimum": 1, "title": "Size" }, - "pages": { "type": "integer", "minimum": 0, "title": "Pages" } - }, - "type": "object", - "required": ["items", "total", "page", "size"], - "title": "Page[User]" - }, - "Session": { - "properties": { - "id": { "type": "string", "title": "Id" }, - "is_active": { "type": "boolean", "title": "Is Active" }, - "user_id": { "type": "string", "title": "User Id" }, - "metadata": { - "type": "object", - "title": "Metadata", - "additionalProperties": true - }, - "created_at": { - "type": "string", - "format": "date-time", - "title": "Created At" - } - }, - "type": "object", - "required": ["id", "is_active", "user_id", "metadata", "created_at"], - "title": "Session", - "exclude": ["h_metadata", "public_id"] - }, - "SessionCreate": { - "properties": { - "metadata": { - "type": "object", - "title": "Metadata", - "default": {}, - "additionalProperties": true - } - }, - "type": "object", - "title": "SessionCreate" - }, - "SessionGet": { - "properties": { - "filter": { - "anyOf": [ - { "type": "object", "additionalProperties": true }, - { "type": "null" } - ], - "title": "Filter" - }, - "is_active": { - "type": "boolean", - "title": "Is Active", - "default": false - } - }, - "type": "object", - "title": "SessionGet" - }, - "SessionUpdate": { - "properties": { - "metadata": { - "anyOf": [ - { "type": "object", "additionalProperties": true }, - { "type": "null" } - ], - "title": "Metadata" - } - }, - "type": "object", - "title": "SessionUpdate" - }, - "User": { - "properties": { - "id": { "type": "string", "title": "Id" }, - "name": { "type": "string", "title": "Name" }, - "app_id": { "type": "string", "title": "App Id" }, - "created_at": { - "type": "string", - "format": "date-time", - "title": "Created At" - }, - "metadata": { - "type": "object", - "title": "Metadata", - "additionalProperties": true - } - }, - "type": "object", - "required": ["id", "name", "app_id", "created_at", "metadata"], - "title": "User", - "exclude": ["h_metadata", "public_id"] - }, - "UserCreate": { - "properties": { - "name": { "type": "string", "title": "Name" }, - "metadata": { - "type": "object", - "title": "Metadata", - "default": {}, - "additionalProperties": true - } - }, - "type": "object", - "required": ["name"], - "title": "UserCreate" - }, - "UserGet": { - "properties": { - "filter": { - "anyOf": [ - { "type": "object", "additionalProperties": true }, - { "type": "null" } - ], - "title": "Filter" - } - }, - "type": "object", - "title": "UserGet" - }, - "UserUpdate": { - "properties": { - "name": { - "anyOf": [{ "type": "string" }, { "type": "null" }], - "title": "Name" - }, - "metadata": { - "anyOf": [ - { "type": "object", "additionalProperties": true }, - { "type": "null" } - ], - "title": "Metadata" - } - }, - "type": "object", - "title": "UserUpdate" - }, - "ValidationError": { - "properties": { - "loc": { - "items": { "anyOf": [{ "type": "string" }, { "type": "integer" }] }, - "type": "array", - "title": "Location" - }, - "msg": { "type": "string", "title": "Message" }, - "type": { "type": "string", "title": "Error Type" } - }, - "type": "object", - "required": ["loc", "msg", "type"], - "title": "ValidationError" - } - }, - "securitySchemes": { "HTTPBearer": { "type": "http", "scheme": "bearer" } } - } -} - diff --git a/docs/openapi.json] b/docs/openapi.json] deleted file mode 100644 index bc5b847..0000000 --- a/docs/openapi.json] +++ /dev/null @@ -1,4358 +0,0 @@ -{ - "openapi": "3.1.0", - "info": { - "title": "Honcho API", - "summary": "An API for adding personalization to AI Apps", - "description": "This API is used to store data and get insights about users for AI\n applications", - "contact": { - "name": "Plastic Labs", - "url": "https://plasticlabs.ai/", - "email": "hello@plasticlabs.ai" - }, - "version": "0.0.12" - }, - "servers": [ - { - "url": "http://127.0.0.1:8000", - "description": "Local Development Server" - }, - { - "url": "https:/demo.honcho.dev", - "description": "Demo Server" - } - ], - "paths": { - "/v1/apps/{app_id}": { - "get": { - "tags": ["apps"], - "summary": "Get App", - "description": "Get an App by ID\n\nArgs:\n app_id (str): The ID of the app\n\nReturns:\n schemas.App: App object", - "operationId": "get_app_v1_apps__app_id__get", - "security": [ - { - "HTTPBearer": [] - }, - {} - ], - "parameters": [ - { - "name": "app_id", - "in": "path", - "required": true, - "schema": { - "type": "string", - "title": "App Id" - } - } - ], - "responses": { - "200": { - "description": "Successful Response", - "content": { - "application/json": { - "schema": { - "$ref": "#/components/schemas/App" - } - } - } - }, - "422": { - "description": "Validation Error", - "content": { - "application/json": { - "schema": { - "$ref": "#/components/schemas/HTTPValidationError" - } - } - } - } - }, - "x-codeSamples": [ - { - "lang": "JavaScript", - "source": "import Honcho from 'honcho';\n\nconst client = new Honcho({\n apiKey: process.env['HONCHO_API_KEY'], // This is the default and can be omitted\n});\n\nasync function main() {\n const app = await client.apps.get('app_id');\n\n console.log(app.id);\n}\n\nmain();" - }, - { - "lang": "Python", - "source": "import os\nfrom honcho import Honcho\n\nclient = Honcho(\n # This is the default and can be omitted\n api_key=os.environ.get(\"HONCHO_API_KEY\"),\n)\napp = client.apps.get(\n \"app_id\",\n)\nprint(app.id)" - } - ] - }, - "put": { - "tags": ["apps"], - "summary": "Update App", - "description": "Update an App\n\nArgs:\n app_id (str): The ID of the app to update\n app (schemas.AppUpdate): The App object containing any new metadata\n\nReturns:\n schemas.App: The App object of the updated App", - "operationId": "update_app_v1_apps__app_id__put", - "security": [ - { - "HTTPBearer": [] - }, - {} - ], - "parameters": [ - { - "name": "app_id", - "in": "path", - "required": true, - "schema": { - "type": "string", - "title": "App Id" - } - } - ], - "requestBody": { - "required": true, - "content": { - "application/json": { - "schema": { - "$ref": "#/components/schemas/AppUpdate" - } - } - } - }, - "responses": { - "200": { - "description": "Successful Response", - "content": { - "application/json": { - "schema": { - "$ref": "#/components/schemas/App" - } - } - } - }, - "422": { - "description": "Validation Error", - "content": { - "application/json": { - "schema": { - "$ref": "#/components/schemas/HTTPValidationError" - } - } - } - } - }, - "x-codeSamples": [ - { - "lang": "JavaScript", - "source": "import Honcho from 'honcho';\n\nconst client = new Honcho({\n apiKey: process.env['HONCHO_API_KEY'], // This is the default and can be omitted\n});\n\nasync function main() {\n const app = await client.apps.update('app_id');\n\n console.log(app.id);\n}\n\nmain();" - }, - { - "lang": "Python", - "source": "import os\nfrom honcho import Honcho\n\nclient = Honcho(\n # This is the default and can be omitted\n api_key=os.environ.get(\"HONCHO_API_KEY\"),\n)\napp = client.apps.update(\n app_id=\"app_id\",\n)\nprint(app.id)" - } - ] - } - }, - "/v1/apps/name/{name}": { - "get": { - "tags": ["apps"], - "summary": "Get App By Name", - "description": "Get an App by Name\n\nArgs:\n app_name (str): The name of the app\n\nReturns:\n schemas.App: App object", - "operationId": "get_app_by_name_v1_apps_name__name__get", - "security": [ - { - "HTTPBearer": [] - }, - {} - ], - "parameters": [ - { - "name": "name", - "in": "path", - "required": true, - "schema": { - "type": "string", - "title": "Name" - } - } - ], - "responses": { - "200": { - "description": "Successful Response", - "content": { - "application/json": { - "schema": { - "$ref": "#/components/schemas/App" - } - } - } - }, - "422": { - "description": "Validation Error", - "content": { - "application/json": { - "schema": { - "$ref": "#/components/schemas/HTTPValidationError" - } - } - } - } - }, - "x-codeSamples": [ - { - "lang": "JavaScript", - "source": "import Honcho from 'honcho';\n\nconst client = new Honcho({\n apiKey: process.env['HONCHO_API_KEY'], // This is the default and can be omitted\n});\n\nasync function main() {\n const app = await client.apps.getByName('name');\n\n console.log(app.id);\n}\n\nmain();" - }, - { - "lang": "Python", - "source": "import os\nfrom honcho import Honcho\n\nclient = Honcho(\n # This is the default and can be omitted\n api_key=os.environ.get(\"HONCHO_API_KEY\"),\n)\napp = client.apps.get_by_name(\n \"name\",\n)\nprint(app.id)" - } - ] - } - }, - "/v1/apps": { - "post": { - "tags": ["apps"], - "summary": "Create App", - "description": "Create an App\n\nArgs:\n app (schemas.AppCreate): The App object containing any metadata\n\nReturns:\n schemas.App: Created App object", - "operationId": "create_app_v1_apps_post", - "requestBody": { - "content": { - "application/json": { - "schema": { - "$ref": "#/components/schemas/AppCreate" - } - } - }, - "required": true - }, - "responses": { - "200": { - "description": "Successful Response", - "content": { - "application/json": { - "schema": { - "$ref": "#/components/schemas/App" - } - } - } - }, - "422": { - "description": "Validation Error", - "content": { - "application/json": { - "schema": { - "$ref": "#/components/schemas/HTTPValidationError" - } - } - } - } - }, - "security": [ - { - "HTTPBearer": [] - }, - {} - ], - "x-codeSamples": [ - { - "lang": "JavaScript", - "source": "import Honcho from 'honcho';\n\nconst client = new Honcho({\n apiKey: process.env['HONCHO_API_KEY'], // This is the default and can be omitted\n});\n\nasync function main() {\n const app = await client.apps.create({ name: 'name' });\n\n console.log(app.id);\n}\n\nmain();" - }, - { - "lang": "Python", - "source": "import os\nfrom honcho import Honcho\n\nclient = Honcho(\n # This is the default and can be omitted\n api_key=os.environ.get(\"HONCHO_API_KEY\"),\n)\napp = client.apps.create(\n name=\"name\",\n)\nprint(app.id)" - } - ] - } - }, - "/v1/apps/get_or_create/{name}": { - "get": { - "tags": ["apps"], - "summary": "Get Or Create App", - "description": "Get or Create an App\n\nArgs:\n app_name (str): The name of the app\n\nReturns:\n schemas.App: App object", - "operationId": "get_or_create_app_v1_apps_get_or_create__name__get", - "security": [ - { - "HTTPBearer": [] - }, - {} - ], - "parameters": [ - { - "name": "name", - "in": "path", - "required": true, - "schema": { - "type": "string", - "title": "Name" - } - } - ], - "responses": { - "200": { - "description": "Successful Response", - "content": { - "application/json": { - "schema": { - "$ref": "#/components/schemas/App" - } - } - } - }, - "422": { - "description": "Validation Error", - "content": { - "application/json": { - "schema": { - "$ref": "#/components/schemas/HTTPValidationError" - } - } - } - } - }, - "x-codeSamples": [ - { - "lang": "JavaScript", - "source": "import Honcho from 'honcho';\n\nconst client = new Honcho({\n apiKey: process.env['HONCHO_API_KEY'], // This is the default and can be omitted\n});\n\nasync function main() {\n const app = await client.apps.getOrCreate('name');\n\n console.log(app.id);\n}\n\nmain();" - }, - { - "lang": "Python", - "source": "import os\nfrom honcho import Honcho\n\nclient = Honcho(\n # This is the default and can be omitted\n api_key=os.environ.get(\"HONCHO_API_KEY\"),\n)\napp = client.apps.get_or_create(\n \"name\",\n)\nprint(app.id)" - } - ] - } - }, - "/v1/apps/{app_id}/users": { - "post": { - "tags": ["users"], - "summary": "Create User", - "description": "Create a User\n\nArgs:\n app_id (str): The ID of the app representing the client application using\n honcho\n user (schemas.UserCreate): The User object containing any metadata\n\nReturns:\n schemas.User: Created User object", - "operationId": "create_user_v1_apps__app_id__users_post", - "security": [ - { - "HTTPBearer": [] - }, - {} - ], - "parameters": [ - { - "name": "app_id", - "in": "path", - "required": true, - "schema": { - "type": "string", - "title": "App Id" - } - } - ], - "requestBody": { - "required": true, - "content": { - "application/json": { - "schema": { - "$ref": "#/components/schemas/UserCreate" - } - } - } - }, - "responses": { - "200": { - "description": "Successful Response", - "content": { - "application/json": { - "schema": { - "$ref": "#/components/schemas/User" - } - } - } - }, - "422": { - "description": "Validation Error", - "content": { - "application/json": { - "schema": { - "$ref": "#/components/schemas/HTTPValidationError" - } - } - } - } - }, - "x-codeSamples": [ - { - "lang": "JavaScript", - "source": "import Honcho from 'honcho';\n\nconst client = new Honcho({\n apiKey: process.env['HONCHO_API_KEY'], // This is the default and can be omitted\n});\n\nasync function main() {\n const user = await client.apps.users.create('app_id', { name: 'name' });\n\n console.log(user.id);\n}\n\nmain();" - }, - { - "lang": "Python", - "source": "import os\nfrom honcho import Honcho\n\nclient = Honcho(\n # This is the default and can be omitted\n api_key=os.environ.get(\"HONCHO_API_KEY\"),\n)\nuser = client.apps.users.create(\n app_id=\"app_id\",\n name=\"name\",\n)\nprint(user.id)" - } - ] - } - }, - "/v1/apps/{app_id}/users/list": { - "post": { - "tags": ["users"], - "summary": "Get Users", - "description": "Get All Users for an App\n\nArgs:\n app_id (str): The ID of the app representing the client\n application using honcho\n\nReturns:\n list[schemas.User]: List of User objects", - "operationId": "get_users_v1_apps__app_id__users_list_post", - "security": [ - { - "HTTPBearer": [] - }, - {} - ], - "parameters": [ - { - "name": "app_id", - "in": "path", - "required": true, - "schema": { - "type": "string", - "title": "App Id" - } - }, - { - "name": "reverse", - "in": "query", - "required": false, - "schema": { - "type": "boolean", - "default": false, - "title": "Reverse" - } - }, - { - "name": "page", - "in": "query", - "required": false, - "schema": { - "type": "integer", - "minimum": 1, - "description": "Page number", - "default": 1, - "title": "Page" - }, - "description": "Page number" - }, - { - "name": "size", - "in": "query", - "required": false, - "schema": { - "type": "integer", - "maximum": 100, - "minimum": 1, - "description": "Page size", - "default": 50, - "title": "Size" - }, - "description": "Page size" - } - ], - "requestBody": { - "required": true, - "content": { - "application/json": { - "schema": { - "$ref": "#/components/schemas/UserGet" - } - } - } - }, - "responses": { - "200": { - "description": "Successful Response", - "content": { - "application/json": { - "schema": { - "$ref": "#/components/schemas/Page_User_" - } - } - } - }, - "422": { - "description": "Validation Error", - "content": { - "application/json": { - "schema": { - "$ref": "#/components/schemas/HTTPValidationError" - } - } - } - } - }, - "x-codeSamples": [ - { - "lang": "JavaScript", - "source": "import Honcho from 'honcho';\n\nconst client = new Honcho({\n apiKey: process.env['HONCHO_API_KEY'], // This is the default and can be omitted\n});\n\nasync function main() {\n // Automatically fetches more pages as needed.\n for await (const user of client.apps.users.list('app_id')) {\n console.log(user.id);\n }\n}\n\nmain();" - }, - { - "lang": "Python", - "source": "import os\nfrom honcho import Honcho\n\nclient = Honcho(\n # This is the default and can be omitted\n api_key=os.environ.get(\"HONCHO_API_KEY\"),\n)\npage = client.apps.users.list(\n app_id=\"app_id\",\n)\npage = page.items[0]\nprint(page.id)" - } - ] - } - }, - "/v1/apps/{app_id}/users/name/{name}": { - "get": { - "tags": ["users"], - "summary": "Get User By Name", - "description": "Get a User\n\nArgs:\n app_id (str): The ID of the app representing the client application using\n honcho\n user_id (str): The User ID representing the user, managed by the user\n\nReturns:\n schemas.User: User object", - "operationId": "get_user_by_name_v1_apps__app_id__users_name__name__get", - "security": [ - { - "HTTPBearer": [] - }, - {} - ], - "parameters": [ - { - "name": "app_id", - "in": "path", - "required": true, - "schema": { - "type": "string", - "title": "App Id" - } - }, - { - "name": "name", - "in": "path", - "required": true, - "schema": { - "type": "string", - "title": "Name" - } - } - ], - "responses": { - "200": { - "description": "Successful Response", - "content": { - "application/json": { - "schema": { - "$ref": "#/components/schemas/User" - } - } - } - }, - "422": { - "description": "Validation Error", - "content": { - "application/json": { - "schema": { - "$ref": "#/components/schemas/HTTPValidationError" - } - } - } - } - }, - "x-codeSamples": [ - { - "lang": "JavaScript", - "source": "import Honcho from 'honcho';\n\nconst client = new Honcho({\n apiKey: process.env['HONCHO_API_KEY'], // This is the default and can be omitted\n});\n\nasync function main() {\n const user = await client.apps.users.getByName('app_id', 'name');\n\n console.log(user.id);\n}\n\nmain();" - }, - { - "lang": "Python", - "source": "import os\nfrom honcho import Honcho\n\nclient = Honcho(\n # This is the default and can be omitted\n api_key=os.environ.get(\"HONCHO_API_KEY\"),\n)\nuser = client.apps.users.get_by_name(\n name=\"name\",\n app_id=\"app_id\",\n)\nprint(user.id)" - } - ] - } - }, - "/v1/apps/{app_id}/users/{user_id}": { - "get": { - "tags": ["users"], - "summary": "Get User", - "description": "Get a User\n\nArgs:\n app_id (str): The ID of the app representing the client application using\n honcho\n user_id (str): The User ID representing the user, managed by the user\n\nReturns:\n schemas.User: User object", - "operationId": "get_user_v1_apps__app_id__users__user_id__get", - "security": [ - { - "HTTPBearer": [] - }, - {} - ], - "parameters": [ - { - "name": "app_id", - "in": "path", - "required": true, - "schema": { - "type": "string", - "title": "App Id" - } - }, - { - "name": "user_id", - "in": "path", - "required": true, - "schema": { - "type": "string", - "title": "User Id" - } - } - ], - "responses": { - "200": { - "description": "Successful Response", - "content": { - "application/json": { - "schema": { - "$ref": "#/components/schemas/User" - } - } - } - }, - "422": { - "description": "Validation Error", - "content": { - "application/json": { - "schema": { - "$ref": "#/components/schemas/HTTPValidationError" - } - } - } - } - }, - "x-codeSamples": [ - { - "lang": "JavaScript", - "source": "import Honcho from 'honcho';\n\nconst client = new Honcho({\n apiKey: process.env['HONCHO_API_KEY'], // This is the default and can be omitted\n});\n\nasync function main() {\n const user = await client.apps.users.get('app_id', 'user_id');\n\n console.log(user.id);\n}\n\nmain();" - }, - { - "lang": "Python", - "source": "import os\nfrom honcho import Honcho\n\nclient = Honcho(\n # This is the default and can be omitted\n api_key=os.environ.get(\"HONCHO_API_KEY\"),\n)\nuser = client.apps.users.get(\n user_id=\"user_id\",\n app_id=\"app_id\",\n)\nprint(user.id)" - } - ] - }, - "put": { - "tags": ["users"], - "summary": "Update User", - "description": "Update a User\n\nArgs:\n app_id (str): The ID of the app representing the client application using\n honcho\n user_id (str): The User ID representing the user, managed by the user\n user (schemas.UserCreate): The User object containing any metadata\n\nReturns:\n schemas.User: Updated User object", - "operationId": "update_user_v1_apps__app_id__users__user_id__put", - "security": [ - { - "HTTPBearer": [] - }, - {} - ], - "parameters": [ - { - "name": "app_id", - "in": "path", - "required": true, - "schema": { - "type": "string", - "title": "App Id" - } - }, - { - "name": "user_id", - "in": "path", - "required": true, - "schema": { - "type": "string", - "title": "User Id" - } - } - ], - "requestBody": { - "required": true, - "content": { - "application/json": { - "schema": { - "$ref": "#/components/schemas/UserUpdate" - } - } - } - }, - "responses": { - "200": { - "description": "Successful Response", - "content": { - "application/json": { - "schema": { - "$ref": "#/components/schemas/User" - } - } - } - }, - "422": { - "description": "Validation Error", - "content": { - "application/json": { - "schema": { - "$ref": "#/components/schemas/HTTPValidationError" - } - } - } - } - }, - "x-codeSamples": [ - { - "lang": "JavaScript", - "source": "import Honcho from 'honcho';\n\nconst client = new Honcho({\n apiKey: process.env['HONCHO_API_KEY'], // This is the default and can be omitted\n});\n\nasync function main() {\n const user = await client.apps.users.update('app_id', 'user_id');\n\n console.log(user.id);\n}\n\nmain();" - }, - { - "lang": "Python", - "source": "import os\nfrom honcho import Honcho\n\nclient = Honcho(\n # This is the default and can be omitted\n api_key=os.environ.get(\"HONCHO_API_KEY\"),\n)\nuser = client.apps.users.update(\n user_id=\"user_id\",\n app_id=\"app_id\",\n)\nprint(user.id)" - } - ] - } - }, - "/v1/apps/{app_id}/users/get_or_create/{name}": { - "get": { - "tags": ["users"], - "summary": "Get Or Create User", - "description": "Get or Create a User\n\nArgs:\n app_id (str): The ID of the app representing the client application using\n honcho\n user_id (str): The User ID representing the user, managed by the user\n\nReturns:\n schemas.User: User object", - "operationId": "get_or_create_user_v1_apps__app_id__users_get_or_create__name__get", - "security": [ - { - "HTTPBearer": [] - }, - {} - ], - "parameters": [ - { - "name": "app_id", - "in": "path", - "required": true, - "schema": { - "type": "string", - "title": "App Id" - } - }, - { - "name": "name", - "in": "path", - "required": true, - "schema": { - "type": "string", - "title": "Name" - } - } - ], - "responses": { - "200": { - "description": "Successful Response", - "content": { - "application/json": { - "schema": { - "$ref": "#/components/schemas/User" - } - } - } - }, - "422": { - "description": "Validation Error", - "content": { - "application/json": { - "schema": { - "$ref": "#/components/schemas/HTTPValidationError" - } - } - } - } - }, - "x-codeSamples": [ - { - "lang": "JavaScript", - "source": "import Honcho from 'honcho';\n\nconst client = new Honcho({\n apiKey: process.env['HONCHO_API_KEY'], // This is the default and can be omitted\n});\n\nasync function main() {\n const user = await client.apps.users.getOrCreate('app_id', 'name');\n\n console.log(user.id);\n}\n\nmain();" - }, - { - "lang": "Python", - "source": "import os\nfrom honcho import Honcho\n\nclient = Honcho(\n # This is the default and can be omitted\n api_key=os.environ.get(\"HONCHO_API_KEY\"),\n)\nuser = client.apps.users.get_or_create(\n name=\"name\",\n app_id=\"app_id\",\n)\nprint(user.id)" - } - ] - } - }, - "/v1/apps/{app_id}/users/{user_id}/sessions/list": { - "post": { - "tags": ["sessions"], - "summary": "Get Sessions", - "description": "Get All Sessions for a User\n\nArgs:\n app_id (str): The ID of the app representing the client application using\n honcho\n user_id (str): The User ID representing the user, managed by the user\n\nReturns:\n list[schemas.Session]: List of Session objects", - "operationId": "get_sessions_v1_apps__app_id__users__user_id__sessions_list_post", - "security": [ - { - "HTTPBearer": [] - }, - {} - ], - "parameters": [ - { - "name": "app_id", - "in": "path", - "required": true, - "schema": { - "type": "string", - "title": "App Id" - } - }, - { - "name": "user_id", - "in": "path", - "required": true, - "schema": { - "type": "string", - "title": "User Id" - } - }, - { - "name": "reverse", - "in": "query", - "required": false, - "schema": { - "anyOf": [ - { - "type": "boolean" - }, - { - "type": "null" - } - ], - "default": false, - "title": "Reverse" - } - }, - { - "name": "page", - "in": "query", - "required": false, - "schema": { - "type": "integer", - "minimum": 1, - "description": "Page number", - "default": 1, - "title": "Page" - }, - "description": "Page number" - }, - { - "name": "size", - "in": "query", - "required": false, - "schema": { - "type": "integer", - "maximum": 100, - "minimum": 1, - "description": "Page size", - "default": 50, - "title": "Size" - }, - "description": "Page size" - } - ], - "requestBody": { - "required": true, - "content": { - "application/json": { - "schema": { - "$ref": "#/components/schemas/SessionGet" - } - } - } - }, - "responses": { - "200": { - "description": "Successful Response", - "content": { - "application/json": { - "schema": { - "$ref": "#/components/schemas/Page_Session_" - } - } - } - }, - "422": { - "description": "Validation Error", - "content": { - "application/json": { - "schema": { - "$ref": "#/components/schemas/HTTPValidationError" - } - } - } - } - }, - "x-codeSamples": [ - { - "lang": "JavaScript", - "source": "import Honcho from 'honcho';\n\nconst client = new Honcho({\n apiKey: process.env['HONCHO_API_KEY'], // This is the default and can be omitted\n});\n\nasync function main() {\n // Automatically fetches more pages as needed.\n for await (const session of client.apps.users.sessions.list('app_id', 'user_id')) {\n console.log(session.id);\n }\n}\n\nmain();" - }, - { - "lang": "Python", - "source": "import os\nfrom honcho import Honcho\n\nclient = Honcho(\n # This is the default and can be omitted\n api_key=os.environ.get(\"HONCHO_API_KEY\"),\n)\npage = client.apps.users.sessions.list(\n user_id=\"user_id\",\n app_id=\"app_id\",\n)\npage = page.items[0]\nprint(page.id)" - } - ] - } - }, - "/v1/apps/{app_id}/users/{user_id}/sessions": { - "post": { - "tags": ["sessions"], - "summary": "Create Session", - "description": "Create a Session for a User\n\nArgs:\n app_id (str): The ID of the app representing the client\n application using honcho\n user_id (str): The User ID representing the user, managed by the user\n session (schemas.SessionCreate): The Session object containing any\n metadata\n\nReturns:\n schemas.Session: The Session object of the new Session", - "operationId": "create_session_v1_apps__app_id__users__user_id__sessions_post", - "security": [ - { - "HTTPBearer": [] - }, - {} - ], - "parameters": [ - { - "name": "app_id", - "in": "path", - "required": true, - "schema": { - "type": "string", - "title": "App Id" - } - }, - { - "name": "user_id", - "in": "path", - "required": true, - "schema": { - "type": "string", - "title": "User Id" - } - } - ], - "requestBody": { - "required": true, - "content": { - "application/json": { - "schema": { - "$ref": "#/components/schemas/SessionCreate" - } - } - } - }, - "responses": { - "200": { - "description": "Successful Response", - "content": { - "application/json": { - "schema": { - "$ref": "#/components/schemas/Session" - } - } - } - }, - "422": { - "description": "Validation Error", - "content": { - "application/json": { - "schema": { - "$ref": "#/components/schemas/HTTPValidationError" - } - } - } - } - }, - "x-codeSamples": [ - { - "lang": "JavaScript", - "source": "import Honcho from 'honcho';\n\nconst client = new Honcho({\n apiKey: process.env['HONCHO_API_KEY'], // This is the default and can be omitted\n});\n\nasync function main() {\n const session = await client.apps.users.sessions.create('app_id', 'user_id');\n\n console.log(session.id);\n}\n\nmain();" - }, - { - "lang": "Python", - "source": "import os\nfrom honcho import Honcho\n\nclient = Honcho(\n # This is the default and can be omitted\n api_key=os.environ.get(\"HONCHO_API_KEY\"),\n)\nsession = client.apps.users.sessions.create(\n user_id=\"user_id\",\n app_id=\"app_id\",\n)\nprint(session.id)" - } - ] - } - }, - "/v1/apps/{app_id}/users/{user_id}/sessions/{session_id}": { - "put": { - "tags": ["sessions"], - "summary": "Update Session", - "description": "Update the metadata of a Session\n\nArgs:\n app_id (str): The ID of the app representing the client application using\n honcho\n user_id (str): The User ID representing the user, managed by the user\n session_id (str): The ID of the Session to update\n session (schemas.SessionUpdate): The Session object containing any new metadata\n\nReturns:\n schemas.Session: The Session object of the updated Session", - "operationId": "update_session_v1_apps__app_id__users__user_id__sessions__session_id__put", - "security": [ - { - "HTTPBearer": [] - }, - {} - ], - "parameters": [ - { - "name": "app_id", - "in": "path", - "required": true, - "schema": { - "type": "string", - "title": "App Id" - } - }, - { - "name": "user_id", - "in": "path", - "required": true, - "schema": { - "type": "string", - "title": "User Id" - } - }, - { - "name": "session_id", - "in": "path", - "required": true, - "schema": { - "type": "string", - "title": "Session Id" - } - } - ], - "requestBody": { - "required": true, - "content": { - "application/json": { - "schema": { - "$ref": "#/components/schemas/SessionUpdate" - } - } - } - }, - "responses": { - "200": { - "description": "Successful Response", - "content": { - "application/json": { - "schema": { - "$ref": "#/components/schemas/Session" - } - } - } - }, - "422": { - "description": "Validation Error", - "content": { - "application/json": { - "schema": { - "$ref": "#/components/schemas/HTTPValidationError" - } - } - } - } - }, - "x-codeSamples": [ - { - "lang": "JavaScript", - "source": "import Honcho from 'honcho';\n\nconst client = new Honcho({\n apiKey: process.env['HONCHO_API_KEY'], // This is the default and can be omitted\n});\n\nasync function main() {\n const session = await client.apps.users.sessions.update('app_id', 'user_id', 'session_id');\n\n console.log(session.id);\n}\n\nmain();" - }, - { - "lang": "Python", - "source": "import os\nfrom honcho import Honcho\n\nclient = Honcho(\n # This is the default and can be omitted\n api_key=os.environ.get(\"HONCHO_API_KEY\"),\n)\nsession = client.apps.users.sessions.update(\n session_id=\"session_id\",\n app_id=\"app_id\",\n user_id=\"user_id\",\n)\nprint(session.id)" - } - ] - }, - "delete": { - "tags": ["sessions"], - "summary": "Delete Session", - "description": "Delete a session by marking it as inactive\n\nArgs:\n app_id (str): The ID of the app representing the client application using\n honcho\n user_id (str): The User ID representing the user, managed by the user\n session_id (str): The ID of the Session to delete\n\nReturns:\n dict: A message indicating that the session was deleted\n\nRaises:\n HTTPException: If the session is not found", - "operationId": "delete_session_v1_apps__app_id__users__user_id__sessions__session_id__delete", - "security": [ - { - "HTTPBearer": [] - }, - {} - ], - "parameters": [ - { - "name": "app_id", - "in": "path", - "required": true, - "schema": { - "type": "string", - "title": "App Id" - } - }, - { - "name": "user_id", - "in": "path", - "required": true, - "schema": { - "type": "string", - "title": "User Id" - } - }, - { - "name": "session_id", - "in": "path", - "required": true, - "schema": { - "type": "string", - "title": "Session Id" - } - } - ], - "responses": { - "200": { - "description": "Successful Response", - "content": { - "application/json": { - "schema": {} - } - } - }, - "422": { - "description": "Validation Error", - "content": { - "application/json": { - "schema": { - "$ref": "#/components/schemas/HTTPValidationError" - } - } - } - } - }, - "x-codeSamples": [ - { - "lang": "JavaScript", - "source": "import Honcho from 'honcho';\n\nconst client = new Honcho({\n apiKey: process.env['HONCHO_API_KEY'], // This is the default and can be omitted\n});\n\nasync function main() {\n const session = await client.apps.users.sessions.delete('app_id', 'user_id', 'session_id');\n\n console.log(session);\n}\n\nmain();" - }, - { - "lang": "Python", - "source": "import os\nfrom honcho import Honcho\n\nclient = Honcho(\n # This is the default and can be omitted\n api_key=os.environ.get(\"HONCHO_API_KEY\"),\n)\nsession = client.apps.users.sessions.delete(\n session_id=\"session_id\",\n app_id=\"app_id\",\n user_id=\"user_id\",\n)\nprint(session)" - } - ] - }, - "get": { - "tags": ["sessions"], - "summary": "Get Session", - "description": "Get a specific session for a user by ID\n\nArgs:\n app_id (str): The ID of the app representing the client application using\n honcho\n user_id (str): The User ID representing the user, managed by the user\n session_id (str): The ID of the Session to retrieve\n\nReturns:\n schemas.Session: The Session object of the requested Session\n\nRaises:\n HTTPException: If the session is not found", - "operationId": "get_session_v1_apps__app_id__users__user_id__sessions__session_id__get", - "security": [ - { - "HTTPBearer": [] - }, - {} - ], - "parameters": [ - { - "name": "app_id", - "in": "path", - "required": true, - "schema": { - "type": "string", - "title": "App Id" - } - }, - { - "name": "user_id", - "in": "path", - "required": true, - "schema": { - "type": "string", - "title": "User Id" - } - }, - { - "name": "session_id", - "in": "path", - "required": true, - "schema": { - "type": "string", - "title": "Session Id" - } - } - ], - "responses": { - "200": { - "description": "Successful Response", - "content": { - "application/json": { - "schema": { - "$ref": "#/components/schemas/Session" - } - } - } - }, - "422": { - "description": "Validation Error", - "content": { - "application/json": { - "schema": { - "$ref": "#/components/schemas/HTTPValidationError" - } - } - } - } - }, - "x-codeSamples": [ - { - "lang": "JavaScript", - "source": "import Honcho from 'honcho';\n\nconst client = new Honcho({\n apiKey: process.env['HONCHO_API_KEY'], // This is the default and can be omitted\n});\n\nasync function main() {\n const session = await client.apps.users.sessions.get('app_id', 'user_id', 'session_id');\n\n console.log(session.id);\n}\n\nmain();" - }, - { - "lang": "Python", - "source": "import os\nfrom honcho import Honcho\n\nclient = Honcho(\n # This is the default and can be omitted\n api_key=os.environ.get(\"HONCHO_API_KEY\"),\n)\nsession = client.apps.users.sessions.get(\n session_id=\"session_id\",\n app_id=\"app_id\",\n user_id=\"user_id\",\n)\nprint(session.id)" - } - ] - } - }, - "/v1/apps/{app_id}/users/{user_id}/sessions/{session_id}/chat": { - "post": { - "tags": ["sessions"], - "summary": "Chat", - "operationId": "chat_v1_apps__app_id__users__user_id__sessions__session_id__chat_post", - "security": [ - { - "HTTPBearer": [] - }, - {} - ], - "parameters": [ - { - "name": "app_id", - "in": "path", - "required": true, - "schema": { - "type": "string", - "title": "App Id" - } - }, - { - "name": "user_id", - "in": "path", - "required": true, - "schema": { - "type": "string", - "title": "User Id" - } - }, - { - "name": "session_id", - "in": "path", - "required": true, - "schema": { - "type": "string", - "title": "Session Id" - } - } - ], - "requestBody": { - "required": true, - "content": { - "application/json": { - "schema": { - "$ref": "#/components/schemas/AgentQuery" - } - } - } - }, - "responses": { - "200": { - "description": "Successful Response", - "content": { - "application/json": { - "schema": { - "$ref": "#/components/schemas/AgentChat" - } - } - } - }, - "422": { - "description": "Validation Error", - "content": { - "application/json": { - "schema": { - "$ref": "#/components/schemas/HTTPValidationError" - } - } - } - } - }, - "x-codeSamples": [ - { - "lang": "JavaScript", - "source": "import Honcho from 'honcho';\n\nconst client = new Honcho({\n apiKey: process.env['HONCHO_API_KEY'], // This is the default and can be omitted\n});\n\nasync function main() {\n const agentChat = await client.apps.users.sessions.chat('app_id', 'user_id', 'session_id', {\n queries: 'string',\n });\n\n console.log(agentChat.content);\n}\n\nmain();" - }, - { - "lang": "Python", - "source": "import os\nfrom honcho import Honcho\n\nclient = Honcho(\n # This is the default and can be omitted\n api_key=os.environ.get(\"HONCHO_API_KEY\"),\n)\nagent_chat = client.apps.users.sessions.chat(\n session_id=\"session_id\",\n app_id=\"app_id\",\n user_id=\"user_id\",\n queries=\"string\",\n)\nprint(agent_chat.content)" - } - ] - } - }, - "/v1/apps/{app_id}/users/{user_id}/sessions/{session_id}/chat/stream": { - "post": { - "tags": ["sessions"], - "summary": "Get Chat Stream", - "operationId": "get_chat_stream_v1_apps__app_id__users__user_id__sessions__session_id__chat_stream_post", - "security": [ - { - "HTTPBearer": [] - }, - {} - ], - "parameters": [ - { - "name": "app_id", - "in": "path", - "required": true, - "schema": { - "type": "string", - "title": "App Id" - } - }, - { - "name": "user_id", - "in": "path", - "required": true, - "schema": { - "type": "string", - "title": "User Id" - } - }, - { - "name": "session_id", - "in": "path", - "required": true, - "schema": { - "type": "string", - "title": "Session Id" - } - } - ], - "requestBody": { - "required": true, - "content": { - "application/json": { - "schema": { - "$ref": "#/components/schemas/AgentQuery" - } - } - } - }, - "responses": { - "200": { - "description": "Chat stream", - "content": { - "application/json": { - "schema": {} - }, - "text/event-stream": { - "schema": { - "type": "string", - "format": "binary" - } - } - } - }, - "422": { - "description": "Validation Error", - "content": { - "application/json": { - "schema": { - "$ref": "#/components/schemas/HTTPValidationError" - } - } - } - } - }, - "x-codeSamples": [ - { - "lang": "JavaScript", - "source": "import Honcho from 'honcho';\n\nconst client = new Honcho({\n apiKey: process.env['HONCHO_API_KEY'], // This is the default and can be omitted\n});\n\nasync function main() {\n const response = await client.apps.users.sessions.stream('app_id', 'user_id', 'session_id', {\n queries: 'string',\n });\n\n console.log(response);\n}\n\nmain();" - }, - { - "lang": "Python", - "source": "import os\nfrom honcho import Honcho\n\nclient = Honcho(\n # This is the default and can be omitted\n api_key=os.environ.get(\"HONCHO_API_KEY\"),\n)\nresponse = client.apps.users.sessions.stream(\n session_id=\"session_id\",\n app_id=\"app_id\",\n user_id=\"user_id\",\n queries=\"string\",\n)\nprint(response)" - } - ] - } - }, - "/v1/apps/{app_id}/users/{user_id}/sessions/{session_id}/messages": { - "post": { - "tags": ["messages"], - "summary": "Create Message For Session", - "description": "Adds a message to a session\n\nArgs:\n app_id (str): The ID of the app representing the client application using honcho\n user_id (str): The User ID representing the user, managed by the user\n session_id (int): The ID of the Session to add the message to\n message (schemas.MessageCreate): The Message object to add containing the message content and type\n\nReturns:\n schemas.Message: The Message object of the added message\n\nRaises:\n HTTPException: If the session is not found", - "operationId": "create_message_for_session_v1_apps__app_id__users__user_id__sessions__session_id__messages_post", - "security": [ - { - "HTTPBearer": [] - }, - {} - ], - "parameters": [ - { - "name": "app_id", - "in": "path", - "required": true, - "schema": { - "type": "string", - "title": "App Id" - } - }, - { - "name": "user_id", - "in": "path", - "required": true, - "schema": { - "type": "string", - "title": "User Id" - } - }, - { - "name": "session_id", - "in": "path", - "required": true, - "schema": { - "type": "string", - "title": "Session Id" - } - } - ], - "requestBody": { - "required": true, - "content": { - "application/json": { - "schema": { - "$ref": "#/components/schemas/MessageCreate" - } - } - } - }, - "responses": { - "200": { - "description": "Successful Response", - "content": { - "application/json": { - "schema": { - "$ref": "#/components/schemas/Message" - } - } - } - }, - "422": { - "description": "Validation Error", - "content": { - "application/json": { - "schema": { - "$ref": "#/components/schemas/HTTPValidationError" - } - } - } - } - }, - "x-codeSamples": [ - { - "lang": "JavaScript", - "source": "import Honcho from 'honcho';\n\nconst client = new Honcho({\n apiKey: process.env['HONCHO_API_KEY'], // This is the default and can be omitted\n});\n\nasync function main() {\n const message = await client.apps.users.sessions.messages.create('app_id', 'user_id', 'session_id', {\n content: 'content',\n is_user: true,\n });\n\n console.log(message.id);\n}\n\nmain();" - }, - { - "lang": "Python", - "source": "import os\nfrom honcho import Honcho\n\nclient = Honcho(\n # This is the default and can be omitted\n api_key=os.environ.get(\"HONCHO_API_KEY\"),\n)\nmessage = client.apps.users.sessions.messages.create(\n session_id=\"session_id\",\n app_id=\"app_id\",\n user_id=\"user_id\",\n content=\"content\",\n is_user=True,\n)\nprint(message.id)" - } - ] - } - }, - "/v1/apps/{app_id}/users/{user_id}/sessions/{session_id}/messages/list": { - "post": { - "tags": ["messages"], - "summary": "Get Messages", - "description": "Get all messages for a session\n\nArgs:\n app_id (str): The ID of the app representing the client application using\n honcho\n user_id (str): The User ID representing the user, managed by the user\n session_id (int): The ID of the Session to retrieve\n reverse (bool): Whether to reverse the order of the messages\n\nReturns:\n list[schemas.Message]: List of Message objects\n\nRaises:\n HTTPException: If the session is not found", - "operationId": "get_messages_v1_apps__app_id__users__user_id__sessions__session_id__messages_list_post", - "security": [ - { - "HTTPBearer": [] - }, - {} - ], - "parameters": [ - { - "name": "app_id", - "in": "path", - "required": true, - "schema": { - "type": "string", - "title": "App Id" - } - }, - { - "name": "user_id", - "in": "path", - "required": true, - "schema": { - "type": "string", - "title": "User Id" - } - }, - { - "name": "session_id", - "in": "path", - "required": true, - "schema": { - "type": "string", - "title": "Session Id" - } - }, - { - "name": "reverse", - "in": "query", - "required": false, - "schema": { - "anyOf": [ - { - "type": "boolean" - }, - { - "type": "null" - } - ], - "default": false, - "title": "Reverse" - } - }, - { - "name": "page", - "in": "query", - "required": false, - "schema": { - "type": "integer", - "minimum": 1, - "description": "Page number", - "default": 1, - "title": "Page" - }, - "description": "Page number" - }, - { - "name": "size", - "in": "query", - "required": false, - "schema": { - "type": "integer", - "maximum": 100, - "minimum": 1, - "description": "Page size", - "default": 50, - "title": "Size" - }, - "description": "Page size" - } - ], - "requestBody": { - "required": true, - "content": { - "application/json": { - "schema": { - "$ref": "#/components/schemas/MessageGet" - } - } - } - }, - "responses": { - "200": { - "description": "Successful Response", - "content": { - "application/json": { - "schema": { - "$ref": "#/components/schemas/Page_Message_" - } - } - } - }, - "422": { - "description": "Validation Error", - "content": { - "application/json": { - "schema": { - "$ref": "#/components/schemas/HTTPValidationError" - } - } - } - } - }, - "x-codeSamples": [ - { - "lang": "JavaScript", - "source": "import Honcho from 'honcho';\n\nconst client = new Honcho({\n apiKey: process.env['HONCHO_API_KEY'], // This is the default and can be omitted\n});\n\nasync function main() {\n // Automatically fetches more pages as needed.\n for await (const message of client.apps.users.sessions.messages.list('app_id', 'user_id', 'session_id')) {\n console.log(message.id);\n }\n}\n\nmain();" - }, - { - "lang": "Python", - "source": "import os\nfrom honcho import Honcho\n\nclient = Honcho(\n # This is the default and can be omitted\n api_key=os.environ.get(\"HONCHO_API_KEY\"),\n)\npage = client.apps.users.sessions.messages.list(\n session_id=\"session_id\",\n app_id=\"app_id\",\n user_id=\"user_id\",\n)\npage = page.items[0]\nprint(page.id)" - } - ] - } - }, - "/v1/apps/{app_id}/users/{user_id}/sessions/{session_id}/messages/{message_id}": { - "get": { - "tags": ["messages"], - "summary": "Get Message", - "operationId": "get_message_v1_apps__app_id__users__user_id__sessions__session_id__messages__message_id__get", - "security": [ - { - "HTTPBearer": [] - }, - {} - ], - "parameters": [ - { - "name": "app_id", - "in": "path", - "required": true, - "schema": { - "type": "string", - "title": "App Id" - } - }, - { - "name": "user_id", - "in": "path", - "required": true, - "schema": { - "type": "string", - "title": "User Id" - } - }, - { - "name": "session_id", - "in": "path", - "required": true, - "schema": { - "type": "string", - "title": "Session Id" - } - }, - { - "name": "message_id", - "in": "path", - "required": true, - "schema": { - "type": "string", - "title": "Message Id" - } - } - ], - "responses": { - "200": { - "description": "Successful Response", - "content": { - "application/json": { - "schema": { - "$ref": "#/components/schemas/Message" - } - } - } - }, - "422": { - "description": "Validation Error", - "content": { - "application/json": { - "schema": { - "$ref": "#/components/schemas/HTTPValidationError" - } - } - } - } - }, - "x-codeSamples": [ - { - "lang": "JavaScript", - "source": "import Honcho from 'honcho';\n\nconst client = new Honcho({\n apiKey: process.env['HONCHO_API_KEY'], // This is the default and can be omitted\n});\n\nasync function main() {\n const message = await client.apps.users.sessions.messages.get(\n 'app_id',\n 'user_id',\n 'session_id',\n 'message_id',\n );\n\n console.log(message.id);\n}\n\nmain();" - }, - { - "lang": "Python", - "source": "import os\nfrom honcho import Honcho\n\nclient = Honcho(\n # This is the default and can be omitted\n api_key=os.environ.get(\"HONCHO_API_KEY\"),\n)\nmessage = client.apps.users.sessions.messages.get(\n message_id=\"message_id\",\n app_id=\"app_id\",\n user_id=\"user_id\",\n session_id=\"session_id\",\n)\nprint(message.id)" - } - ] - }, - "put": { - "tags": ["messages"], - "summary": "Update Message", - "description": "Update's the metadata of a message", - "operationId": "update_message_v1_apps__app_id__users__user_id__sessions__session_id__messages__message_id__put", - "security": [ - { - "HTTPBearer": [] - }, - {} - ], - "parameters": [ - { - "name": "app_id", - "in": "path", - "required": true, - "schema": { - "type": "string", - "title": "App Id" - } - }, - { - "name": "user_id", - "in": "path", - "required": true, - "schema": { - "type": "string", - "title": "User Id" - } - }, - { - "name": "session_id", - "in": "path", - "required": true, - "schema": { - "type": "string", - "title": "Session Id" - } - }, - { - "name": "message_id", - "in": "path", - "required": true, - "schema": { - "type": "string", - "title": "Message Id" - } - } - ], - "requestBody": { - "required": true, - "content": { - "application/json": { - "schema": { - "$ref": "#/components/schemas/MessageUpdate" - } - } - } - }, - "responses": { - "200": { - "description": "Successful Response", - "content": { - "application/json": { - "schema": { - "$ref": "#/components/schemas/Message" - } - } - } - }, - "422": { - "description": "Validation Error", - "content": { - "application/json": { - "schema": { - "$ref": "#/components/schemas/HTTPValidationError" - } - } - } - } - }, - "x-codeSamples": [ - { - "lang": "JavaScript", - "source": "import Honcho from 'honcho';\n\nconst client = new Honcho({\n apiKey: process.env['HONCHO_API_KEY'], // This is the default and can be omitted\n});\n\nasync function main() {\n const message = await client.apps.users.sessions.messages.update(\n 'app_id',\n 'user_id',\n 'session_id',\n 'message_id',\n );\n\n console.log(message.id);\n}\n\nmain();" - }, - { - "lang": "Python", - "source": "import os\nfrom honcho import Honcho\n\nclient = Honcho(\n # This is the default and can be omitted\n api_key=os.environ.get(\"HONCHO_API_KEY\"),\n)\nmessage = client.apps.users.sessions.messages.update(\n message_id=\"message_id\",\n app_id=\"app_id\",\n user_id=\"user_id\",\n session_id=\"session_id\",\n)\nprint(message.id)" - } - ] - } - }, - "/v1/apps/{app_id}/users/{user_id}/sessions/{session_id}/metamessages": { - "post": { - "tags": ["metamessages"], - "summary": "Create Metamessage", - "description": "Adds a message to a session\n\nArgs:\n app_id (str): The ID of the app representing the client application using\n honcho\n user_id (str): The User ID representing the user, managed by the user\n session_id (int): The ID of the Session to add the message to\n metamessage (schemas.MeteamessageCreate): The metamessage creation object\n\nReturns:\n schemas.Metamessage: The Metamessage object of the added metamessage\n\nRaises:\n HTTPException: If the session is not found", - "operationId": "create_metamessage_v1_apps__app_id__users__user_id__sessions__session_id__metamessages_post", - "security": [ - { - "HTTPBearer": [] - }, - {} - ], - "parameters": [ - { - "name": "app_id", - "in": "path", - "required": true, - "schema": { - "type": "string", - "title": "App Id" - } - }, - { - "name": "user_id", - "in": "path", - "required": true, - "schema": { - "type": "string", - "title": "User Id" - } - }, - { - "name": "session_id", - "in": "path", - "required": true, - "schema": { - "type": "string", - "title": "Session Id" - } - } - ], - "requestBody": { - "required": true, - "content": { - "application/json": { - "schema": { - "$ref": "#/components/schemas/MetamessageCreate" - } - } - } - }, - "responses": { - "200": { - "description": "Successful Response", - "content": { - "application/json": { - "schema": { - "$ref": "#/components/schemas/Metamessage" - } - } - } - }, - "422": { - "description": "Validation Error", - "content": { - "application/json": { - "schema": { - "$ref": "#/components/schemas/HTTPValidationError" - } - } - } - } - }, - "x-codeSamples": [ - { - "lang": "JavaScript", - "source": "import Honcho from 'honcho';\n\nconst client = new Honcho({\n apiKey: process.env['HONCHO_API_KEY'], // This is the default and can be omitted\n});\n\nasync function main() {\n const metamessage = await client.apps.users.sessions.metamessages.create(\n 'app_id',\n 'user_id',\n 'session_id',\n { content: 'content', message_id: 'message_id', metamessage_type: 'metamessage_type' },\n );\n\n console.log(metamessage.id);\n}\n\nmain();" - }, - { - "lang": "Python", - "source": "import os\nfrom honcho import Honcho\n\nclient = Honcho(\n # This is the default and can be omitted\n api_key=os.environ.get(\"HONCHO_API_KEY\"),\n)\nmetamessage = client.apps.users.sessions.metamessages.create(\n session_id=\"session_id\",\n app_id=\"app_id\",\n user_id=\"user_id\",\n content=\"content\",\n message_id=\"message_id\",\n metamessage_type=\"metamessage_type\",\n)\nprint(metamessage.id)" - } - ] - } - }, - "/v1/apps/{app_id}/users/{user_id}/sessions/{session_id}/metamessages/list": { - "post": { - "tags": ["metamessages"], - "summary": "Get Metamessages", - "description": "Get all messages for a session\n\nArgs:\n app_id (str): The ID of the app representing the client application using\n honcho\n user_id (str): The User ID representing the user, managed by the user\n session_id (int): The ID of the Session to retrieve\n reverse (bool): Whether to reverse the order of the metamessages\n\nReturns:\n list[schemas.Message]: List of Message objects\n\nRaises:\n HTTPException: If the session is not found", - "operationId": "get_metamessages_v1_apps__app_id__users__user_id__sessions__session_id__metamessages_list_post", - "security": [ - { - "HTTPBearer": [] - }, - {} - ], - "parameters": [ - { - "name": "app_id", - "in": "path", - "required": true, - "schema": { - "type": "string", - "title": "App Id" - } - }, - { - "name": "user_id", - "in": "path", - "required": true, - "schema": { - "type": "string", - "title": "User Id" - } - }, - { - "name": "session_id", - "in": "path", - "required": true, - "schema": { - "type": "string", - "title": "Session Id" - } - }, - { - "name": "reverse", - "in": "query", - "required": false, - "schema": { - "anyOf": [ - { - "type": "boolean" - }, - { - "type": "null" - } - ], - "default": false, - "title": "Reverse" - } - }, - { - "name": "page", - "in": "query", - "required": false, - "schema": { - "type": "integer", - "minimum": 1, - "description": "Page number", - "default": 1, - "title": "Page" - }, - "description": "Page number" - }, - { - "name": "size", - "in": "query", - "required": false, - "schema": { - "type": "integer", - "maximum": 100, - "minimum": 1, - "description": "Page size", - "default": 50, - "title": "Size" - }, - "description": "Page size" - } - ], - "requestBody": { - "required": true, - "content": { - "application/json": { - "schema": { - "$ref": "#/components/schemas/MetamessageGet" - } - } - } - }, - "responses": { - "200": { - "description": "Successful Response", - "content": { - "application/json": { - "schema": { - "$ref": "#/components/schemas/Page_Metamessage_" - } - } - } - }, - "422": { - "description": "Validation Error", - "content": { - "application/json": { - "schema": { - "$ref": "#/components/schemas/HTTPValidationError" - } - } - } - } - }, - "x-codeSamples": [ - { - "lang": "JavaScript", - "source": "import Honcho from 'honcho';\n\nconst client = new Honcho({\n apiKey: process.env['HONCHO_API_KEY'], // This is the default and can be omitted\n});\n\nasync function main() {\n // Automatically fetches more pages as needed.\n for await (const metamessage of client.apps.users.sessions.metamessages.list(\n 'app_id',\n 'user_id',\n 'session_id',\n )) {\n console.log(metamessage.id);\n }\n}\n\nmain();" - }, - { - "lang": "Python", - "source": "import os\nfrom honcho import Honcho\n\nclient = Honcho(\n # This is the default and can be omitted\n api_key=os.environ.get(\"HONCHO_API_KEY\"),\n)\npage = client.apps.users.sessions.metamessages.list(\n session_id=\"session_id\",\n app_id=\"app_id\",\n user_id=\"user_id\",\n)\npage = page.items[0]\nprint(page.id)" - } - ] - } - }, - "/v1/apps/{app_id}/users/{user_id}/sessions/{session_id}/metamessages/{metamessage_id}": { - "get": { - "tags": ["metamessages"], - "summary": "Get Metamessage", - "description": "Get a specific Metamessage by ID\n\nArgs:\n app_id (str): The ID of the app representing the client application using\n honcho\n user_id (str): The User ID representing the user, managed by the user\n session_id (int): The ID of the Session to retrieve\n\nReturns:\n schemas.Session: The Session object of the requested Session\n\nRaises:\n HTTPException: If the session is not found", - "operationId": "get_metamessage_v1_apps__app_id__users__user_id__sessions__session_id__metamessages__metamessage_id__get", - "security": [ - { - "HTTPBearer": [] - }, - {} - ], - "parameters": [ - { - "name": "app_id", - "in": "path", - "required": true, - "schema": { - "type": "string", - "title": "App Id" - } - }, - { - "name": "user_id", - "in": "path", - "required": true, - "schema": { - "type": "string", - "title": "User Id" - } - }, - { - "name": "session_id", - "in": "path", - "required": true, - "schema": { - "type": "string", - "title": "Session Id" - } - }, - { - "name": "metamessage_id", - "in": "path", - "required": true, - "schema": { - "type": "string", - "title": "Metamessage Id" - } - }, - { - "name": "message_id", - "in": "query", - "required": true, - "schema": { - "type": "string", - "title": "Message Id" - } - } - ], - "responses": { - "200": { - "description": "Successful Response", - "content": { - "application/json": { - "schema": { - "$ref": "#/components/schemas/Metamessage" - } - } - } - }, - "422": { - "description": "Validation Error", - "content": { - "application/json": { - "schema": { - "$ref": "#/components/schemas/HTTPValidationError" - } - } - } - } - }, - "x-codeSamples": [ - { - "lang": "JavaScript", - "source": "import Honcho from 'honcho';\n\nconst client = new Honcho({\n apiKey: process.env['HONCHO_API_KEY'], // This is the default and can be omitted\n});\n\nasync function main() {\n const metamessage = await client.apps.users.sessions.metamessages.get(\n 'app_id',\n 'user_id',\n 'session_id',\n 'metamessage_id',\n { message_id: 'message_id' },\n );\n\n console.log(metamessage.id);\n}\n\nmain();" - }, - { - "lang": "Python", - "source": "import os\nfrom honcho import Honcho\n\nclient = Honcho(\n # This is the default and can be omitted\n api_key=os.environ.get(\"HONCHO_API_KEY\"),\n)\nmetamessage = client.apps.users.sessions.metamessages.get(\n metamessage_id=\"metamessage_id\",\n app_id=\"app_id\",\n user_id=\"user_id\",\n session_id=\"session_id\",\n message_id=\"message_id\",\n)\nprint(metamessage.id)" - } - ] - }, - "put": { - "tags": ["metamessages"], - "summary": "Update Metamessage", - "description": "Update's the metadata of a metamessage", - "operationId": "update_metamessage_v1_apps__app_id__users__user_id__sessions__session_id__metamessages__metamessage_id__put", - "security": [ - { - "HTTPBearer": [] - }, - {} - ], - "parameters": [ - { - "name": "app_id", - "in": "path", - "required": true, - "schema": { - "type": "string", - "title": "App Id" - } - }, - { - "name": "user_id", - "in": "path", - "required": true, - "schema": { - "type": "string", - "title": "User Id" - } - }, - { - "name": "session_id", - "in": "path", - "required": true, - "schema": { - "type": "string", - "title": "Session Id" - } - }, - { - "name": "metamessage_id", - "in": "path", - "required": true, - "schema": { - "type": "string", - "title": "Metamessage Id" - } - } - ], - "requestBody": { - "required": true, - "content": { - "application/json": { - "schema": { - "$ref": "#/components/schemas/MetamessageUpdate" - } - } - } - }, - "responses": { - "200": { - "description": "Successful Response", - "content": { - "application/json": { - "schema": { - "$ref": "#/components/schemas/Metamessage" - } - } - } - }, - "422": { - "description": "Validation Error", - "content": { - "application/json": { - "schema": { - "$ref": "#/components/schemas/HTTPValidationError" - } - } - } - } - }, - "x-codeSamples": [ - { - "lang": "JavaScript", - "source": "import Honcho from 'honcho';\n\nconst client = new Honcho({\n apiKey: process.env['HONCHO_API_KEY'], // This is the default and can be omitted\n});\n\nasync function main() {\n const metamessage = await client.apps.users.sessions.metamessages.update(\n 'app_id',\n 'user_id',\n 'session_id',\n 'metamessage_id',\n { message_id: 'message_id' },\n );\n\n console.log(metamessage.id);\n}\n\nmain();" - }, - { - "lang": "Python", - "source": "import os\nfrom honcho import Honcho\n\nclient = Honcho(\n # This is the default and can be omitted\n api_key=os.environ.get(\"HONCHO_API_KEY\"),\n)\nmetamessage = client.apps.users.sessions.metamessages.update(\n metamessage_id=\"metamessage_id\",\n app_id=\"app_id\",\n user_id=\"user_id\",\n session_id=\"session_id\",\n message_id=\"message_id\",\n)\nprint(metamessage.id)" - } - ] - } - }, - "/v1/apps/{app_id}/users/{user_id}/metamessages/list": { - "post": { - "tags": ["metamessages"], - "summary": "Get Metamessages By User", - "description": "Paginate through the user metamessages for a user\n\nArgs:\n app_id (str): The ID of the app representing the client application using honcho\n user_id (str): The User ID representing the user, managed by the user\n reverse (bool): Whether to reverse the order of the metamessages\n\nReturns:\n list[schemas.Message]: List of Message objects\n\nRaises:\n HTTPException: If the session is not found", - "operationId": "get_metamessages_by_user_v1_apps__app_id__users__user_id__metamessages_list_post", - "security": [ - { - "HTTPBearer": [] - }, - {} - ], - "parameters": [ - { - "name": "app_id", - "in": "path", - "required": true, - "schema": { - "type": "string", - "title": "App Id" - } - }, - { - "name": "user_id", - "in": "path", - "required": true, - "schema": { - "type": "string", - "title": "User Id" - } - }, - { - "name": "reverse", - "in": "query", - "required": false, - "schema": { - "anyOf": [ - { - "type": "boolean" - }, - { - "type": "null" - } - ], - "default": false, - "title": "Reverse" - } - }, - { - "name": "page", - "in": "query", - "required": false, - "schema": { - "type": "integer", - "minimum": 1, - "description": "Page number", - "default": 1, - "title": "Page" - }, - "description": "Page number" - }, - { - "name": "size", - "in": "query", - "required": false, - "schema": { - "type": "integer", - "maximum": 100, - "minimum": 1, - "description": "Page size", - "default": 50, - "title": "Size" - }, - "description": "Page size" - } - ], - "requestBody": { - "required": true, - "content": { - "application/json": { - "schema": { - "$ref": "#/components/schemas/MetamessageGetUserLevel" - } - } - } - }, - "responses": { - "200": { - "description": "Successful Response", - "content": { - "application/json": { - "schema": { - "$ref": "#/components/schemas/Page_Metamessage_" - } - } - } - }, - "422": { - "description": "Validation Error", - "content": { - "application/json": { - "schema": { - "$ref": "#/components/schemas/HTTPValidationError" - } - } - } - } - }, - "x-codeSamples": [ - { - "lang": "JavaScript", - "source": "import Honcho from 'honcho';\n\nconst client = new Honcho({\n apiKey: process.env['HONCHO_API_KEY'], // This is the default and can be omitted\n});\n\nasync function main() {\n // Automatically fetches more pages as needed.\n for await (const metamessage of client.apps.users.metamessages.list('app_id', 'user_id')) {\n console.log(metamessage.id);\n }\n}\n\nmain();" - }, - { - "lang": "Python", - "source": "import os\nfrom honcho import Honcho\n\nclient = Honcho(\n # This is the default and can be omitted\n api_key=os.environ.get(\"HONCHO_API_KEY\"),\n)\npage = client.apps.users.metamessages.list(\n user_id=\"user_id\",\n app_id=\"app_id\",\n)\npage = page.items[0]\nprint(page.id)" - } - ] - } - }, - "/v1/apps/{app_id}/users/{user_id}/collections/list": { - "post": { - "tags": ["collections"], - "summary": "Get Collections", - "description": "Get All Collections for a User\n\nArgs:\n app_id (str): The ID of the app representing the client\n application using honcho\n user_id (str): The User ID representing the user, managed by the user\n\nReturns:\n list[schemas.Collection]: List of Collection objects", - "operationId": "get_collections_v1_apps__app_id__users__user_id__collections_list_post", - "security": [ - { - "HTTPBearer": [] - }, - {} - ], - "parameters": [ - { - "name": "app_id", - "in": "path", - "required": true, - "schema": { - "type": "string", - "title": "App Id" - } - }, - { - "name": "user_id", - "in": "path", - "required": true, - "schema": { - "type": "string", - "title": "User Id" - } - }, - { - "name": "reverse", - "in": "query", - "required": false, - "schema": { - "anyOf": [ - { - "type": "boolean" - }, - { - "type": "null" - } - ], - "default": false, - "title": "Reverse" - } - }, - { - "name": "page", - "in": "query", - "required": false, - "schema": { - "type": "integer", - "minimum": 1, - "description": "Page number", - "default": 1, - "title": "Page" - }, - "description": "Page number" - }, - { - "name": "size", - "in": "query", - "required": false, - "schema": { - "type": "integer", - "maximum": 100, - "minimum": 1, - "description": "Page size", - "default": 50, - "title": "Size" - }, - "description": "Page size" - } - ], - "requestBody": { - "required": true, - "content": { - "application/json": { - "schema": { - "$ref": "#/components/schemas/CollectionGet" - } - } - } - }, - "responses": { - "200": { - "description": "Successful Response", - "content": { - "application/json": { - "schema": { - "$ref": "#/components/schemas/Page_Collection_" - } - } - } - }, - "422": { - "description": "Validation Error", - "content": { - "application/json": { - "schema": { - "$ref": "#/components/schemas/HTTPValidationError" - } - } - } - } - }, - "x-codeSamples": [ - { - "lang": "JavaScript", - "source": "import Honcho from 'honcho';\n\nconst client = new Honcho({\n apiKey: process.env['HONCHO_API_KEY'], // This is the default and can be omitted\n});\n\nasync function main() {\n // Automatically fetches more pages as needed.\n for await (const collection of client.apps.users.collections.list('app_id', 'user_id')) {\n console.log(collection.id);\n }\n}\n\nmain();" - }, - { - "lang": "Python", - "source": "import os\nfrom honcho import Honcho\n\nclient = Honcho(\n # This is the default and can be omitted\n api_key=os.environ.get(\"HONCHO_API_KEY\"),\n)\npage = client.apps.users.collections.list(\n user_id=\"user_id\",\n app_id=\"app_id\",\n)\npage = page.items[0]\nprint(page.id)" - } - ] - } - }, - "/v1/apps/{app_id}/users/{user_id}/collections/name/{name}": { - "get": { - "tags": ["collections"], - "summary": "Get Collection By Name", - "operationId": "get_collection_by_name_v1_apps__app_id__users__user_id__collections_name__name__get", - "security": [ - { - "HTTPBearer": [] - }, - {} - ], - "parameters": [ - { - "name": "app_id", - "in": "path", - "required": true, - "schema": { - "type": "string", - "title": "App Id" - } - }, - { - "name": "user_id", - "in": "path", - "required": true, - "schema": { - "type": "string", - "title": "User Id" - } - }, - { - "name": "name", - "in": "path", - "required": true, - "schema": { - "type": "string", - "title": "Name" - } - } - ], - "responses": { - "200": { - "description": "Successful Response", - "content": { - "application/json": { - "schema": { - "$ref": "#/components/schemas/Collection" - } - } - } - }, - "422": { - "description": "Validation Error", - "content": { - "application/json": { - "schema": { - "$ref": "#/components/schemas/HTTPValidationError" - } - } - } - } - }, - "x-codeSamples": [ - { - "lang": "JavaScript", - "source": "import Honcho from 'honcho';\n\nconst client = new Honcho({\n apiKey: process.env['HONCHO_API_KEY'], // This is the default and can be omitted\n});\n\nasync function main() {\n const collection = await client.apps.users.collections.getByName('app_id', 'user_id', 'name');\n\n console.log(collection.id);\n}\n\nmain();" - }, - { - "lang": "Python", - "source": "import os\nfrom honcho import Honcho\n\nclient = Honcho(\n # This is the default and can be omitted\n api_key=os.environ.get(\"HONCHO_API_KEY\"),\n)\ncollection = client.apps.users.collections.get_by_name(\n name=\"name\",\n app_id=\"app_id\",\n user_id=\"user_id\",\n)\nprint(collection.id)" - } - ] - } - }, - "/v1/apps/{app_id}/users/{user_id}/collections/{collection_id}": { - "get": { - "tags": ["collections"], - "summary": "Get Collection By Id", - "operationId": "get_collection_by_id_v1_apps__app_id__users__user_id__collections__collection_id__get", - "security": [ - { - "HTTPBearer": [] - }, - {} - ], - "parameters": [ - { - "name": "app_id", - "in": "path", - "required": true, - "schema": { - "type": "string", - "title": "App Id" - } - }, - { - "name": "user_id", - "in": "path", - "required": true, - "schema": { - "type": "string", - "title": "User Id" - } - }, - { - "name": "collection_id", - "in": "path", - "required": true, - "schema": { - "type": "string", - "title": "Collection Id" - } - } - ], - "responses": { - "200": { - "description": "Successful Response", - "content": { - "application/json": { - "schema": { - "$ref": "#/components/schemas/Collection" - } - } - } - }, - "422": { - "description": "Validation Error", - "content": { - "application/json": { - "schema": { - "$ref": "#/components/schemas/HTTPValidationError" - } - } - } - } - }, - "x-codeSamples": [ - { - "lang": "JavaScript", - "source": "import Honcho from 'honcho';\n\nconst client = new Honcho({\n apiKey: process.env['HONCHO_API_KEY'], // This is the default and can be omitted\n});\n\nasync function main() {\n const collection = await client.apps.users.collections.get('app_id', 'user_id', 'collection_id');\n\n console.log(collection.id);\n}\n\nmain();" - }, - { - "lang": "Python", - "source": "import os\nfrom honcho import Honcho\n\nclient = Honcho(\n # This is the default and can be omitted\n api_key=os.environ.get(\"HONCHO_API_KEY\"),\n)\ncollection = client.apps.users.collections.get(\n collection_id=\"collection_id\",\n app_id=\"app_id\",\n user_id=\"user_id\",\n)\nprint(collection.id)" - } - ] - }, - "put": { - "tags": ["collections"], - "summary": "Update Collection", - "operationId": "update_collection_v1_apps__app_id__users__user_id__collections__collection_id__put", - "security": [ - { - "HTTPBearer": [] - }, - {} - ], - "parameters": [ - { - "name": "app_id", - "in": "path", - "required": true, - "schema": { - "type": "string", - "title": "App Id" - } - }, - { - "name": "user_id", - "in": "path", - "required": true, - "schema": { - "type": "string", - "title": "User Id" - } - }, - { - "name": "collection_id", - "in": "path", - "required": true, - "schema": { - "type": "string", - "title": "Collection Id" - } - } - ], - "requestBody": { - "required": true, - "content": { - "application/json": { - "schema": { - "$ref": "#/components/schemas/CollectionUpdate" - } - } - } - }, - "responses": { - "200": { - "description": "Successful Response", - "content": { - "application/json": { - "schema": { - "$ref": "#/components/schemas/Collection" - } - } - } - }, - "422": { - "description": "Validation Error", - "content": { - "application/json": { - "schema": { - "$ref": "#/components/schemas/HTTPValidationError" - } - } - } - } - }, - "x-codeSamples": [ - { - "lang": "JavaScript", - "source": "import Honcho from 'honcho';\n\nconst client = new Honcho({\n apiKey: process.env['HONCHO_API_KEY'], // This is the default and can be omitted\n});\n\nasync function main() {\n const collection = await client.apps.users.collections.update('app_id', 'user_id', 'collection_id');\n\n console.log(collection.id);\n}\n\nmain();" - }, - { - "lang": "Python", - "source": "import os\nfrom honcho import Honcho\n\nclient = Honcho(\n # This is the default and can be omitted\n api_key=os.environ.get(\"HONCHO_API_KEY\"),\n)\ncollection = client.apps.users.collections.update(\n collection_id=\"collection_id\",\n app_id=\"app_id\",\n user_id=\"user_id\",\n)\nprint(collection.id)" - } - ] - }, - "delete": { - "tags": ["collections"], - "summary": "Delete Collection", - "operationId": "delete_collection_v1_apps__app_id__users__user_id__collections__collection_id__delete", - "security": [ - { - "HTTPBearer": [] - }, - {} - ], - "parameters": [ - { - "name": "app_id", - "in": "path", - "required": true, - "schema": { - "type": "string", - "title": "App Id" - } - }, - { - "name": "user_id", - "in": "path", - "required": true, - "schema": { - "type": "string", - "title": "User Id" - } - }, - { - "name": "collection_id", - "in": "path", - "required": true, - "schema": { - "type": "string", - "title": "Collection Id" - } - } - ], - "responses": { - "200": { - "description": "Successful Response", - "content": { - "application/json": { - "schema": {} - } - } - }, - "422": { - "description": "Validation Error", - "content": { - "application/json": { - "schema": { - "$ref": "#/components/schemas/HTTPValidationError" - } - } - } - } - }, - "x-codeSamples": [ - { - "lang": "JavaScript", - "source": "import Honcho from 'honcho';\n\nconst client = new Honcho({\n apiKey: process.env['HONCHO_API_KEY'], // This is the default and can be omitted\n});\n\nasync function main() {\n const collection = await client.apps.users.collections.delete('app_id', 'user_id', 'collection_id');\n\n console.log(collection);\n}\n\nmain();" - }, - { - "lang": "Python", - "source": "import os\nfrom honcho import Honcho\n\nclient = Honcho(\n # This is the default and can be omitted\n api_key=os.environ.get(\"HONCHO_API_KEY\"),\n)\ncollection = client.apps.users.collections.delete(\n collection_id=\"collection_id\",\n app_id=\"app_id\",\n user_id=\"user_id\",\n)\nprint(collection)" - } - ] - } - }, - "/v1/apps/{app_id}/users/{user_id}/collections": { - "post": { - "tags": ["collections"], - "summary": "Create Collection", - "operationId": "create_collection_v1_apps__app_id__users__user_id__collections_post", - "security": [ - { - "HTTPBearer": [] - }, - {} - ], - "parameters": [ - { - "name": "app_id", - "in": "path", - "required": true, - "schema": { - "type": "string", - "title": "App Id" - } - }, - { - "name": "user_id", - "in": "path", - "required": true, - "schema": { - "type": "string", - "title": "User Id" - } - } - ], - "requestBody": { - "required": true, - "content": { - "application/json": { - "schema": { - "$ref": "#/components/schemas/CollectionCreate" - } - } - } - }, - "responses": { - "200": { - "description": "Successful Response", - "content": { - "application/json": { - "schema": { - "$ref": "#/components/schemas/Collection" - } - } - } - }, - "422": { - "description": "Validation Error", - "content": { - "application/json": { - "schema": { - "$ref": "#/components/schemas/HTTPValidationError" - } - } - } - } - }, - "x-codeSamples": [ - { - "lang": "JavaScript", - "source": "import Honcho from 'honcho';\n\nconst client = new Honcho({\n apiKey: process.env['HONCHO_API_KEY'], // This is the default and can be omitted\n});\n\nasync function main() {\n const collection = await client.apps.users.collections.create('app_id', 'user_id', { name: 'name' });\n\n console.log(collection.id);\n}\n\nmain();" - }, - { - "lang": "Python", - "source": "import os\nfrom honcho import Honcho\n\nclient = Honcho(\n # This is the default and can be omitted\n api_key=os.environ.get(\"HONCHO_API_KEY\"),\n)\ncollection = client.apps.users.collections.create(\n user_id=\"user_id\",\n app_id=\"app_id\",\n name=\"name\",\n)\nprint(collection.id)" - } - ] - } - }, - "/v1/apps/{app_id}/users/{user_id}/collections/{collection_id}/documents/list": { - "post": { - "tags": ["documents"], - "summary": "Get Documents", - "operationId": "get_documents_v1_apps__app_id__users__user_id__collections__collection_id__documents_list_post", - "security": [ - { - "HTTPBearer": [] - }, - {} - ], - "parameters": [ - { - "name": "app_id", - "in": "path", - "required": true, - "schema": { - "type": "string", - "title": "App Id" - } - }, - { - "name": "user_id", - "in": "path", - "required": true, - "schema": { - "type": "string", - "title": "User Id" - } - }, - { - "name": "collection_id", - "in": "path", - "required": true, - "schema": { - "type": "string", - "title": "Collection Id" - } - }, - { - "name": "reverse", - "in": "query", - "required": false, - "schema": { - "anyOf": [ - { - "type": "boolean" - }, - { - "type": "null" - } - ], - "default": false, - "title": "Reverse" - } - }, - { - "name": "page", - "in": "query", - "required": false, - "schema": { - "type": "integer", - "minimum": 1, - "description": "Page number", - "default": 1, - "title": "Page" - }, - "description": "Page number" - }, - { - "name": "size", - "in": "query", - "required": false, - "schema": { - "type": "integer", - "maximum": 100, - "minimum": 1, - "description": "Page size", - "default": 50, - "title": "Size" - }, - "description": "Page size" - } - ], - "requestBody": { - "required": true, - "content": { - "application/json": { - "schema": { - "$ref": "#/components/schemas/DocumentGet" - } - } - } - }, - "responses": { - "200": { - "description": "Successful Response", - "content": { - "application/json": { - "schema": { - "$ref": "#/components/schemas/Page_Document_" - } - } - } - }, - "422": { - "description": "Validation Error", - "content": { - "application/json": { - "schema": { - "$ref": "#/components/schemas/HTTPValidationError" - } - } - } - } - }, - "x-codeSamples": [ - { - "lang": "JavaScript", - "source": "import Honcho from 'honcho';\n\nconst client = new Honcho({\n apiKey: process.env['HONCHO_API_KEY'], // This is the default and can be omitted\n});\n\nasync function main() {\n // Automatically fetches more pages as needed.\n for await (const document of client.apps.users.collections.documents.list(\n 'app_id',\n 'user_id',\n 'collection_id',\n )) {\n console.log(document.id);\n }\n}\n\nmain();" - }, - { - "lang": "Python", - "source": "import os\nfrom honcho import Honcho\n\nclient = Honcho(\n # This is the default and can be omitted\n api_key=os.environ.get(\"HONCHO_API_KEY\"),\n)\npage = client.apps.users.collections.documents.list(\n collection_id=\"collection_id\",\n app_id=\"app_id\",\n user_id=\"user_id\",\n)\npage = page.items[0]\nprint(page.id)" - } - ] - } - }, - "/v1/apps/{app_id}/users/{user_id}/collections/{collection_id}/documents/{document_id}": { - "get": { - "tags": ["documents"], - "summary": "Get Document", - "operationId": "get_document_v1_apps__app_id__users__user_id__collections__collection_id__documents__document_id__get", - "security": [ - { - "HTTPBearer": [] - }, - {} - ], - "parameters": [ - { - "name": "app_id", - "in": "path", - "required": true, - "schema": { - "type": "string", - "title": "App Id" - } - }, - { - "name": "user_id", - "in": "path", - "required": true, - "schema": { - "type": "string", - "title": "User Id" - } - }, - { - "name": "collection_id", - "in": "path", - "required": true, - "schema": { - "type": "string", - "title": "Collection Id" - } - }, - { - "name": "document_id", - "in": "path", - "required": true, - "schema": { - "type": "string", - "title": "Document Id" - } - } - ], - "responses": { - "200": { - "description": "Successful Response", - "content": { - "application/json": { - "schema": { - "$ref": "#/components/schemas/Document" - } - } - } - }, - "422": { - "description": "Validation Error", - "content": { - "application/json": { - "schema": { - "$ref": "#/components/schemas/HTTPValidationError" - } - } - } - } - }, - "x-codeSamples": [ - { - "lang": "JavaScript", - "source": "import Honcho from 'honcho';\n\nconst client = new Honcho({\n apiKey: process.env['HONCHO_API_KEY'], // This is the default and can be omitted\n});\n\nasync function main() {\n const document = await client.apps.users.collections.documents.get(\n 'app_id',\n 'user_id',\n 'collection_id',\n 'document_id',\n );\n\n console.log(document.id);\n}\n\nmain();" - }, - { - "lang": "Python", - "source": "import os\nfrom honcho import Honcho\n\nclient = Honcho(\n # This is the default and can be omitted\n api_key=os.environ.get(\"HONCHO_API_KEY\"),\n)\ndocument = client.apps.users.collections.documents.get(\n document_id=\"document_id\",\n app_id=\"app_id\",\n user_id=\"user_id\",\n collection_id=\"collection_id\",\n)\nprint(document.id)" - } - ] - }, - "put": { - "tags": ["documents"], - "summary": "Update Document", - "operationId": "update_document_v1_apps__app_id__users__user_id__collections__collection_id__documents__document_id__put", - "security": [ - { - "HTTPBearer": [] - }, - {} - ], - "parameters": [ - { - "name": "app_id", - "in": "path", - "required": true, - "schema": { - "type": "string", - "title": "App Id" - } - }, - { - "name": "user_id", - "in": "path", - "required": true, - "schema": { - "type": "string", - "title": "User Id" - } - }, - { - "name": "collection_id", - "in": "path", - "required": true, - "schema": { - "type": "string", - "title": "Collection Id" - } - }, - { - "name": "document_id", - "in": "path", - "required": true, - "schema": { - "type": "string", - "title": "Document Id" - } - } - ], - "requestBody": { - "required": true, - "content": { - "application/json": { - "schema": { - "$ref": "#/components/schemas/DocumentUpdate" - } - } - } - }, - "responses": { - "200": { - "description": "Successful Response", - "content": { - "application/json": { - "schema": { - "$ref": "#/components/schemas/Document" - } - } - } - }, - "422": { - "description": "Validation Error", - "content": { - "application/json": { - "schema": { - "$ref": "#/components/schemas/HTTPValidationError" - } - } - } - } - }, - "x-codeSamples": [ - { - "lang": "JavaScript", - "source": "import Honcho from 'honcho';\n\nconst client = new Honcho({\n apiKey: process.env['HONCHO_API_KEY'], // This is the default and can be omitted\n});\n\nasync function main() {\n const document = await client.apps.users.collections.documents.update(\n 'app_id',\n 'user_id',\n 'collection_id',\n 'document_id',\n );\n\n console.log(document.id);\n}\n\nmain();" - }, - { - "lang": "Python", - "source": "import os\nfrom honcho import Honcho\n\nclient = Honcho(\n # This is the default and can be omitted\n api_key=os.environ.get(\"HONCHO_API_KEY\"),\n)\ndocument = client.apps.users.collections.documents.update(\n document_id=\"document_id\",\n app_id=\"app_id\",\n user_id=\"user_id\",\n collection_id=\"collection_id\",\n)\nprint(document.id)" - } - ] - }, - "delete": { - "tags": ["documents"], - "summary": "Delete Document", - "operationId": "delete_document_v1_apps__app_id__users__user_id__collections__collection_id__documents__document_id__delete", - "security": [ - { - "HTTPBearer": [] - }, - {} - ], - "parameters": [ - { - "name": "app_id", - "in": "path", - "required": true, - "schema": { - "type": "string", - "title": "App Id" - } - }, - { - "name": "user_id", - "in": "path", - "required": true, - "schema": { - "type": "string", - "title": "User Id" - } - }, - { - "name": "collection_id", - "in": "path", - "required": true, - "schema": { - "type": "string", - "title": "Collection Id" - } - }, - { - "name": "document_id", - "in": "path", - "required": true, - "schema": { - "type": "string", - "title": "Document Id" - } - } - ], - "responses": { - "200": { - "description": "Successful Response", - "content": { - "application/json": { - "schema": {} - } - } - }, - "422": { - "description": "Validation Error", - "content": { - "application/json": { - "schema": { - "$ref": "#/components/schemas/HTTPValidationError" - } - } - } - } - }, - "x-codeSamples": [ - { - "lang": "JavaScript", - "source": "import Honcho from 'honcho';\n\nconst client = new Honcho({\n apiKey: process.env['HONCHO_API_KEY'], // This is the default and can be omitted\n});\n\nasync function main() {\n const document = await client.apps.users.collections.documents.delete(\n 'app_id',\n 'user_id',\n 'collection_id',\n 'document_id',\n );\n\n console.log(document);\n}\n\nmain();" - }, - { - "lang": "Python", - "source": "import os\nfrom honcho import Honcho\n\nclient = Honcho(\n # This is the default and can be omitted\n api_key=os.environ.get(\"HONCHO_API_KEY\"),\n)\ndocument = client.apps.users.collections.documents.delete(\n document_id=\"document_id\",\n app_id=\"app_id\",\n user_id=\"user_id\",\n collection_id=\"collection_id\",\n)\nprint(document)" - } - ] - } - }, - "/v1/apps/{app_id}/users/{user_id}/collections/{collection_id}/documents/query": { - "get": { - "tags": ["documents"], - "summary": "Query Documents", - "operationId": "query_documents_v1_apps__app_id__users__user_id__collections__collection_id__documents_query_get", - "security": [ - { - "HTTPBearer": [] - }, - {} - ], - "parameters": [ - { - "name": "app_id", - "in": "path", - "required": true, - "schema": { - "type": "string", - "title": "App Id" - } - }, - { - "name": "user_id", - "in": "path", - "required": true, - "schema": { - "type": "string", - "title": "User Id" - } - }, - { - "name": "collection_id", - "in": "path", - "required": true, - "schema": { - "type": "string", - "title": "Collection Id" - } - }, - { - "name": "query", - "in": "query", - "required": true, - "schema": { - "type": "string", - "title": "Query" - } - }, - { - "name": "top_k", - "in": "query", - "required": false, - "schema": { - "type": "integer", - "default": 5, - "title": "Top K" - } - }, - { - "name": "filter", - "in": "query", - "required": false, - "schema": { - "anyOf": [ - { - "type": "string" - }, - { - "type": "null" - } - ], - "title": "Filter" - } - } - ], - "responses": { - "200": { - "description": "Successful Response", - "content": { - "application/json": { - "schema": { - "type": "array", - "items": { - "$ref": "#/components/schemas/Document" - }, - "title": "Response Query Documents V1 Apps App Id Users User Id Collections Collection Id Documents Query Get" - } - } - } - }, - "422": { - "description": "Validation Error", - "content": { - "application/json": { - "schema": { - "$ref": "#/components/schemas/HTTPValidationError" - } - } - } - } - }, - "x-codeSamples": [ - { - "lang": "JavaScript", - "source": "import Honcho from 'honcho';\n\nconst client = new Honcho({\n apiKey: process.env['HONCHO_API_KEY'], // This is the default and can be omitted\n});\n\nasync function main() {\n const documents = await client.apps.users.collections.documents.query(\n 'app_id',\n 'user_id',\n 'collection_id',\n { query: 'query' },\n );\n\n console.log(documents);\n}\n\nmain();" - }, - { - "lang": "Python", - "source": "import os\nfrom honcho import Honcho\n\nclient = Honcho(\n # This is the default and can be omitted\n api_key=os.environ.get(\"HONCHO_API_KEY\"),\n)\ndocuments = client.apps.users.collections.documents.query(\n collection_id=\"collection_id\",\n app_id=\"app_id\",\n user_id=\"user_id\",\n query=\"query\",\n)\nprint(documents)" - } - ] - } - }, - "/v1/apps/{app_id}/users/{user_id}/collections/{collection_id}/documents": { - "post": { - "tags": ["documents"], - "summary": "Create Document", - "operationId": "create_document_v1_apps__app_id__users__user_id__collections__collection_id__documents_post", - "security": [ - { - "HTTPBearer": [] - }, - {} - ], - "parameters": [ - { - "name": "app_id", - "in": "path", - "required": true, - "schema": { - "type": "string", - "title": "App Id" - } - }, - { - "name": "user_id", - "in": "path", - "required": true, - "schema": { - "type": "string", - "title": "User Id" - } - }, - { - "name": "collection_id", - "in": "path", - "required": true, - "schema": { - "type": "string", - "title": "Collection Id" - } - } - ], - "requestBody": { - "required": true, - "content": { - "application/json": { - "schema": { - "$ref": "#/components/schemas/DocumentCreate" - } - } - } - }, - "responses": { - "200": { - "description": "Successful Response", - "content": { - "application/json": { - "schema": { - "$ref": "#/components/schemas/Document" - } - } - } - }, - "422": { - "description": "Validation Error", - "content": { - "application/json": { - "schema": { - "$ref": "#/components/schemas/HTTPValidationError" - } - } - } - } - }, - "x-codeSamples": [ - { - "lang": "JavaScript", - "source": "import Honcho from 'honcho';\n\nconst client = new Honcho({\n apiKey: process.env['HONCHO_API_KEY'], // This is the default and can be omitted\n});\n\nasync function main() {\n const document = await client.apps.users.collections.documents.create(\n 'app_id',\n 'user_id',\n 'collection_id',\n { content: 'content' },\n );\n\n console.log(document.id);\n}\n\nmain();" - }, - { - "lang": "Python", - "source": "import os\nfrom honcho import Honcho\n\nclient = Honcho(\n # This is the default and can be omitted\n api_key=os.environ.get(\"HONCHO_API_KEY\"),\n)\ndocument = client.apps.users.collections.documents.create(\n collection_id=\"collection_id\",\n app_id=\"app_id\",\n user_id=\"user_id\",\n content=\"content\",\n)\nprint(document.id)" - } - ] - } - } - }, - "components": { - "schemas": { - "AgentChat": { - "properties": { - "content": { - "type": "string", - "title": "Content" - } - }, - "type": "object", - "required": ["content"], - "title": "AgentChat" - }, - "AgentQuery": { - "properties": { - "queries": { - "anyOf": [ - { - "type": "string" - }, - { - "items": { - "type": "string" - }, - "type": "array" - } - ], - "title": "Queries" - } - }, - "type": "object", - "required": ["queries"], - "title": "AgentQuery" - }, - "App": { - "properties": { - "id": { - "type": "string", - "title": "Id" - }, - "name": { - "type": "string", - "title": "Name" - }, - "metadata": { - "type": "object", - "title": "Metadata", - "additionalProperties": true - }, - "created_at": { - "type": "string", - "format": "date-time", - "title": "Created At" - } - }, - "type": "object", - "required": ["id", "name", "metadata", "created_at"], - "title": "App", - "exclude": ["h_metadata", "public_id"] - }, - "AppCreate": { - "properties": { - "name": { - "type": "string", - "title": "Name" - }, - "metadata": { - "type": "object", - "title": "Metadata", - "default": {}, - "additionalProperties": true - } - }, - "type": "object", - "required": ["name"], - "title": "AppCreate" - }, - "AppUpdate": { - "properties": { - "name": { - "anyOf": [ - { - "type": "string" - }, - { - "type": "null" - } - ], - "title": "Name" - }, - "metadata": { - "anyOf": [ - { - "type": "object", - "additionalProperties": true - }, - { - "type": "null" - } - ], - "title": "Metadata" - } - }, - "type": "object", - "title": "AppUpdate" - }, - "Collection": { - "properties": { - "id": { - "type": "string", - "title": "Id" - }, - "name": { - "type": "string", - "title": "Name" - }, - "user_id": { - "type": "string", - "title": "User Id" - }, - "metadata": { - "type": "object", - "title": "Metadata", - "additionalProperties": true - }, - "created_at": { - "type": "string", - "format": "date-time", - "title": "Created At" - } - }, - "type": "object", - "required": ["id", "name", "user_id", "metadata", "created_at"], - "title": "Collection", - "exclude": ["h_metadata", "public_id"] - }, - "CollectionCreate": { - "properties": { - "name": { - "type": "string", - "title": "Name" - }, - "metadata": { - "anyOf": [ - { - "type": "object", - "additionalProperties": true - }, - { - "type": "null" - } - ], - "title": "Metadata", - "default": {} - } - }, - "type": "object", - "required": ["name"], - "title": "CollectionCreate" - }, - "CollectionGet": { - "properties": { - "filter": { - "anyOf": [ - { - "type": "object", - "additionalProperties": true - }, - { - "type": "null" - } - ], - "title": "Filter" - } - }, - "type": "object", - "title": "CollectionGet" - }, - "CollectionUpdate": { - "properties": { - "name": { - "anyOf": [ - { - "type": "string" - }, - { - "type": "null" - } - ], - "title": "Name" - }, - "metadata": { - "anyOf": [ - { - "type": "object", - "additionalProperties": true - }, - { - "type": "null" - } - ], - "title": "Metadata" - } - }, - "type": "object", - "title": "CollectionUpdate" - }, - "Document": { - "properties": { - "id": { - "type": "string", - "title": "Id" - }, - "content": { - "type": "string", - "title": "Content" - }, - "metadata": { - "type": "object", - "title": "Metadata", - "additionalProperties": true - }, - "created_at": { - "type": "string", - "format": "date-time", - "title": "Created At" - }, - "collection_id": { - "type": "string", - "title": "Collection Id" - } - }, - "type": "object", - "required": [ - "id", - "content", - "metadata", - "created_at", - "collection_id" - ], - "title": "Document", - "exclude": ["h_metadata", "public_id"] - }, - "DocumentCreate": { - "properties": { - "content": { - "type": "string", - "title": "Content" - }, - "metadata": { - "anyOf": [ - { - "type": "object", - "additionalProperties": true - }, - { - "type": "null" - } - ], - "title": "Metadata", - "default": {} - } - }, - "type": "object", - "required": ["content"], - "title": "DocumentCreate" - }, - "DocumentGet": { - "properties": { - "filter": { - "anyOf": [ - { - "type": "object", - "additionalProperties": true - }, - { - "type": "null" - } - ], - "title": "Filter" - } - }, - "type": "object", - "title": "DocumentGet" - }, - "DocumentUpdate": { - "properties": { - "metadata": { - "anyOf": [ - { - "type": "object", - "additionalProperties": true - }, - { - "type": "null" - } - ], - "title": "Metadata" - }, - "content": { - "anyOf": [ - { - "type": "string" - }, - { - "type": "null" - } - ], - "title": "Content" - } - }, - "type": "object", - "title": "DocumentUpdate" - }, - "HTTPValidationError": { - "properties": { - "detail": { - "items": { - "$ref": "#/components/schemas/ValidationError" - }, - "type": "array", - "title": "Detail" - } - }, - "type": "object", - "title": "HTTPValidationError" - }, - "Message": { - "properties": { - "id": { - "type": "string", - "title": "Id" - }, - "content": { - "type": "string", - "title": "Content" - }, - "is_user": { - "type": "boolean", - "title": "Is User" - }, - "session_id": { - "type": "string", - "title": "Session Id" - }, - "metadata": { - "type": "object", - "title": "Metadata", - "additionalProperties": true - }, - "created_at": { - "type": "string", - "format": "date-time", - "title": "Created At" - } - }, - "type": "object", - "required": [ - "id", - "content", - "is_user", - "session_id", - "metadata", - "created_at" - ], - "title": "Message", - "exclude": ["h_metadata", "public_id"] - }, - "MessageCreate": { - "properties": { - "content": { - "type": "string", - "title": "Content" - }, - "is_user": { - "type": "boolean", - "title": "Is User" - }, - "metadata": { - "type": "object", - "title": "Metadata", - "default": {}, - "additionalProperties": true - } - }, - "type": "object", - "required": ["content", "is_user"], - "title": "MessageCreate" - }, - "MessageGet": { - "properties": { - "filter": { - "anyOf": [ - { - "type": "object", - "additionalProperties": true - }, - { - "type": "null" - } - ], - "title": "Filter" - } - }, - "type": "object", - "title": "MessageGet" - }, - "MessageUpdate": { - "properties": { - "metadata": { - "anyOf": [ - { - "type": "object", - "additionalProperties": true - }, - { - "type": "null" - } - ], - "title": "Metadata" - } - }, - "type": "object", - "title": "MessageUpdate" - }, - "Metamessage": { - "properties": { - "id": { - "type": "string", - "title": "Id" - }, - "metamessage_type": { - "type": "string", - "title": "Metamessage Type" - }, - "content": { - "type": "string", - "title": "Content" - }, - "message_id": { - "type": "string", - "title": "Message Id" - }, - "metadata": { - "type": "object", - "title": "Metadata", - "additionalProperties": true - }, - "created_at": { - "type": "string", - "format": "date-time", - "title": "Created At" - } - }, - "type": "object", - "required": [ - "id", - "metamessage_type", - "content", - "message_id", - "metadata", - "created_at" - ], - "title": "Metamessage", - "exclude": ["h_metadata", "public_id"] - }, - "MetamessageCreate": { - "properties": { - "metamessage_type": { - "type": "string", - "title": "Metamessage Type" - }, - "content": { - "type": "string", - "title": "Content" - }, - "message_id": { - "type": "string", - "title": "Message Id" - }, - "metadata": { - "anyOf": [ - { - "type": "object", - "additionalProperties": true - }, - { - "type": "null" - } - ], - "title": "Metadata", - "default": {} - } - }, - "type": "object", - "required": ["metamessage_type", "content", "message_id"], - "title": "MetamessageCreate" - }, - "MetamessageGet": { - "properties": { - "metamessage_type": { - "anyOf": [ - { - "type": "string" - }, - { - "type": "null" - } - ], - "title": "Metamessage Type" - }, - "message_id": { - "anyOf": [ - { - "type": "string" - }, - { - "type": "null" - } - ], - "title": "Message Id" - }, - "filter": { - "anyOf": [ - { - "type": "object", - "additionalProperties": true - }, - { - "type": "null" - } - ], - "title": "Filter" - } - }, - "type": "object", - "title": "MetamessageGet" - }, - "MetamessageGetUserLevel": { - "properties": { - "filter": { - "anyOf": [ - { - "type": "object", - "additionalProperties": true - }, - { - "type": "null" - } - ], - "title": "Filter" - }, - "metamessage_type": { - "anyOf": [ - { - "type": "string" - }, - { - "type": "null" - } - ], - "title": "Metamessage Type" - } - }, - "type": "object", - "title": "MetamessageGetUserLevel" - }, - "MetamessageUpdate": { - "properties": { - "message_id": { - "type": "string", - "title": "Message Id" - }, - "metamessage_type": { - "anyOf": [ - { - "type": "string" - }, - { - "type": "null" - } - ], - "title": "Metamessage Type" - }, - "metadata": { - "anyOf": [ - { - "type": "object", - "additionalProperties": true - }, - { - "type": "null" - } - ], - "title": "Metadata" - } - }, - "type": "object", - "required": ["message_id"], - "title": "MetamessageUpdate" - }, - "Page_Collection_": { - "properties": { - "items": { - "items": { - "$ref": "#/components/schemas/Collection" - }, - "type": "array", - "title": "Items" - }, - "total": { - "type": "integer", - "minimum": 0, - "title": "Total" - }, - "page": { - "type": "integer", - "minimum": 1, - "title": "Page" - }, - "size": { - "type": "integer", - "minimum": 1, - "title": "Size" - }, - "pages": { - "type": "integer", - "minimum": 0, - "title": "Pages" - } - }, - "type": "object", - "required": ["items", "total", "page", "size"], - "title": "Page[Collection]" - }, - "Page_Document_": { - "properties": { - "items": { - "items": { - "$ref": "#/components/schemas/Document" - }, - "type": "array", - "title": "Items" - }, - "total": { - "type": "integer", - "minimum": 0, - "title": "Total" - }, - "page": { - "type": "integer", - "minimum": 1, - "title": "Page" - }, - "size": { - "type": "integer", - "minimum": 1, - "title": "Size" - }, - "pages": { - "type": "integer", - "minimum": 0, - "title": "Pages" - } - }, - "type": "object", - "required": ["items", "total", "page", "size"], - "title": "Page[Document]" - }, - "Page_Message_": { - "properties": { - "items": { - "items": { - "$ref": "#/components/schemas/Message" - }, - "type": "array", - "title": "Items" - }, - "total": { - "type": "integer", - "minimum": 0, - "title": "Total" - }, - "page": { - "type": "integer", - "minimum": 1, - "title": "Page" - }, - "size": { - "type": "integer", - "minimum": 1, - "title": "Size" - }, - "pages": { - "type": "integer", - "minimum": 0, - "title": "Pages" - } - }, - "type": "object", - "required": ["items", "total", "page", "size"], - "title": "Page[Message]" - }, - "Page_Metamessage_": { - "properties": { - "items": { - "items": { - "$ref": "#/components/schemas/Metamessage" - }, - "type": "array", - "title": "Items" - }, - "total": { - "type": "integer", - "minimum": 0, - "title": "Total" - }, - "page": { - "type": "integer", - "minimum": 1, - "title": "Page" - }, - "size": { - "type": "integer", - "minimum": 1, - "title": "Size" - }, - "pages": { - "type": "integer", - "minimum": 0, - "title": "Pages" - } - }, - "type": "object", - "required": ["items", "total", "page", "size"], - "title": "Page[Metamessage]" - }, - "Page_Session_": { - "properties": { - "items": { - "items": { - "$ref": "#/components/schemas/Session" - }, - "type": "array", - "title": "Items" - }, - "total": { - "type": "integer", - "minimum": 0, - "title": "Total" - }, - "page": { - "type": "integer", - "minimum": 1, - "title": "Page" - }, - "size": { - "type": "integer", - "minimum": 1, - "title": "Size" - }, - "pages": { - "type": "integer", - "minimum": 0, - "title": "Pages" - } - }, - "type": "object", - "required": ["items", "total", "page", "size"], - "title": "Page[Session]" - }, - "Page_User_": { - "properties": { - "items": { - "items": { - "$ref": "#/components/schemas/User" - }, - "type": "array", - "title": "Items" - }, - "total": { - "type": "integer", - "minimum": 0, - "title": "Total" - }, - "page": { - "type": "integer", - "minimum": 1, - "title": "Page" - }, - "size": { - "type": "integer", - "minimum": 1, - "title": "Size" - }, - "pages": { - "type": "integer", - "minimum": 0, - "title": "Pages" - } - }, - "type": "object", - "required": ["items", "total", "page", "size"], - "title": "Page[User]" - }, - "Session": { - "properties": { - "id": { - "type": "string", - "title": "Id" - }, - "is_active": { - "type": "boolean", - "title": "Is Active" - }, - "user_id": { - "type": "string", - "title": "User Id" - }, - "metadata": { - "type": "object", - "title": "Metadata", - "additionalProperties": true - }, - "created_at": { - "type": "string", - "format": "date-time", - "title": "Created At" - } - }, - "type": "object", - "required": ["id", "is_active", "user_id", "metadata", "created_at"], - "title": "Session", - "exclude": ["h_metadata", "public_id"] - }, - "SessionCreate": { - "properties": { - "metadata": { - "type": "object", - "title": "Metadata", - "default": {}, - "additionalProperties": true - } - }, - "type": "object", - "title": "SessionCreate" - }, - "SessionGet": { - "properties": { - "filter": { - "anyOf": [ - { - "type": "object", - "additionalProperties": true - }, - { - "type": "null" - } - ], - "title": "Filter" - }, - "is_active": { - "type": "boolean", - "title": "Is Active", - "default": false - } - }, - "type": "object", - "title": "SessionGet" - }, - "SessionUpdate": { - "properties": { - "metadata": { - "anyOf": [ - { - "type": "object", - "additionalProperties": true - }, - { - "type": "null" - } - ], - "title": "Metadata" - } - }, - "type": "object", - "title": "SessionUpdate" - }, - "User": { - "properties": { - "id": { - "type": "string", - "title": "Id" - }, - "name": { - "type": "string", - "title": "Name" - }, - "app_id": { - "type": "string", - "title": "App Id" - }, - "created_at": { - "type": "string", - "format": "date-time", - "title": "Created At" - }, - "metadata": { - "type": "object", - "title": "Metadata", - "additionalProperties": true - } - }, - "type": "object", - "required": ["id", "name", "app_id", "created_at", "metadata"], - "title": "User", - "exclude": ["h_metadata", "public_id"] - }, - "UserCreate": { - "properties": { - "name": { - "type": "string", - "title": "Name" - }, - "metadata": { - "type": "object", - "title": "Metadata", - "default": {}, - "additionalProperties": true - } - }, - "type": "object", - "required": ["name"], - "title": "UserCreate" - }, - "UserGet": { - "properties": { - "filter": { - "anyOf": [ - { - "type": "object", - "additionalProperties": true - }, - { - "type": "null" - } - ], - "title": "Filter" - } - }, - "type": "object", - "title": "UserGet" - }, - "UserUpdate": { - "properties": { - "name": { - "anyOf": [ - { - "type": "string" - }, - { - "type": "null" - } - ], - "title": "Name" - }, - "metadata": { - "anyOf": [ - { - "type": "object", - "additionalProperties": true - }, - { - "type": "null" - } - ], - "title": "Metadata" - } - }, - "type": "object", - "title": "UserUpdate" - }, - "ValidationError": { - "properties": { - "loc": { - "items": { - "anyOf": [ - { - "type": "string" - }, - { - "type": "integer" - } - ] - }, - "type": "array", - "title": "Location" - }, - "msg": { - "type": "string", - "title": "Message" - }, - "type": { - "type": "string", - "title": "Error Type" - } - }, - "type": "object", - "required": ["loc", "msg", "type"], - "title": "ValidationError" - } - }, - "securitySchemes": { - "HTTPBearer": { - "type": "http", - "scheme": "bearer" - } - } - } -} diff --git a/docs/openapi.yml b/docs/openapi.yml new file mode 100644 index 0000000..98e0ba1 --- /dev/null +++ b/docs/openapi.yml @@ -0,0 +1,4273 @@ +openapi: 3.1.0 +info: + title: Honcho API + summary: An API for adding personalization to AI Apps + description: |- + This API is used to store data and get insights about users for AI + applications + contact: + name: Plastic Labs + url: https://plasticlabs.ai/ + email: hello@plasticlabs.ai + version: 0.0.13 +servers: + - url: http://127.0.0.1:8000 + description: Local Development Server + - url: https:/demo.honcho.dev + description: Demo Server +paths: + /v1/apps/{app_id}: + get: + tags: + - apps + summary: Get App + description: |- + Get an App by ID + + Args: + app_id (str): The ID of the app + + Returns: + schemas.App: App object + operationId: get_app_v1_apps__app_id__get + security: + - HTTPBearer: [] + - {} + parameters: + - name: app_id + in: path + required: true + schema: + type: string + title: App Id + responses: + '200': + description: Successful Response + content: + application/json: + schema: + $ref: '#/components/schemas/App' + '422': + description: Validation Error + content: + application/json: + schema: + $ref: '#/components/schemas/HTTPValidationError' + x-codeSamples: + - lang: JavaScript + source: |- + import Honcho from 'honcho'; + + const client = new Honcho({ + apiKey: process.env['HONCHO_API_KEY'], // This is the default and can be omitted + }); + + async function main() { + const app = await client.apps.get('app_id'); + + console.log(app.id); + } + + main(); + - lang: Python + source: |- + import os + from honcho import Honcho + + client = Honcho( + # This is the default and can be omitted + api_key=os.environ.get("HONCHO_API_KEY"), + ) + app = client.apps.get( + "app_id", + ) + print(app.id) + put: + tags: + - apps + summary: Update App + description: |- + Update an App + + Args: + app_id (str): The ID of the app to update + app (schemas.AppUpdate): The App object containing any new metadata + + Returns: + schemas.App: The App object of the updated App + operationId: update_app_v1_apps__app_id__put + security: + - HTTPBearer: [] + - {} + parameters: + - name: app_id + in: path + required: true + schema: + type: string + title: App Id + requestBody: + required: true + content: + application/json: + schema: + $ref: '#/components/schemas/AppUpdate' + responses: + '200': + description: Successful Response + content: + application/json: + schema: + $ref: '#/components/schemas/App' + '422': + description: Validation Error + content: + application/json: + schema: + $ref: '#/components/schemas/HTTPValidationError' + x-codeSamples: + - lang: JavaScript + source: |- + import Honcho from 'honcho'; + + const client = new Honcho({ + apiKey: process.env['HONCHO_API_KEY'], // This is the default and can be omitted + }); + + async function main() { + const app = await client.apps.update('app_id'); + + console.log(app.id); + } + + main(); + - lang: Python + source: |- + import os + from honcho import Honcho + + client = Honcho( + # This is the default and can be omitted + api_key=os.environ.get("HONCHO_API_KEY"), + ) + app = client.apps.update( + app_id="app_id", + ) + print(app.id) + /v1/apps/name/{name}: + get: + tags: + - apps + summary: Get App By Name + description: |- + Get an App by Name + + Args: + app_name (str): The name of the app + + Returns: + schemas.App: App object + operationId: get_app_by_name_v1_apps_name__name__get + security: + - HTTPBearer: [] + - {} + parameters: + - name: name + in: path + required: true + schema: + type: string + title: Name + responses: + '200': + description: Successful Response + content: + application/json: + schema: + $ref: '#/components/schemas/App' + '422': + description: Validation Error + content: + application/json: + schema: + $ref: '#/components/schemas/HTTPValidationError' + x-codeSamples: + - lang: JavaScript + source: |- + import Honcho from 'honcho'; + + const client = new Honcho({ + apiKey: process.env['HONCHO_API_KEY'], // This is the default and can be omitted + }); + + async function main() { + const app = await client.apps.getByName('name'); + + console.log(app.id); + } + + main(); + - lang: Python + source: |- + import os + from honcho import Honcho + + client = Honcho( + # This is the default and can be omitted + api_key=os.environ.get("HONCHO_API_KEY"), + ) + app = client.apps.get_by_name( + "name", + ) + print(app.id) + /v1/apps: + post: + tags: + - apps + summary: Create App + description: |- + Create an App + + Args: + app (schemas.AppCreate): The App object containing any metadata + + Returns: + schemas.App: Created App object + operationId: create_app_v1_apps_post + requestBody: + content: + application/json: + schema: + $ref: '#/components/schemas/AppCreate' + required: true + responses: + '200': + description: Successful Response + content: + application/json: + schema: + $ref: '#/components/schemas/App' + '422': + description: Validation Error + content: + application/json: + schema: + $ref: '#/components/schemas/HTTPValidationError' + security: + - HTTPBearer: [] + - {} + x-codeSamples: + - lang: JavaScript + source: |- + import Honcho from 'honcho'; + + const client = new Honcho({ + apiKey: process.env['HONCHO_API_KEY'], // This is the default and can be omitted + }); + + async function main() { + const app = await client.apps.create({ name: 'name' }); + + console.log(app.id); + } + + main(); + - lang: Python + source: |- + import os + from honcho import Honcho + + client = Honcho( + # This is the default and can be omitted + api_key=os.environ.get("HONCHO_API_KEY"), + ) + app = client.apps.create( + name="name", + ) + print(app.id) + /v1/apps/get_or_create/{name}: + get: + tags: + - apps + summary: Get Or Create App + description: |- + Get or Create an App + + Args: + app_name (str): The name of the app + + Returns: + schemas.App: App object + operationId: get_or_create_app_v1_apps_get_or_create__name__get + security: + - HTTPBearer: [] + - {} + parameters: + - name: name + in: path + required: true + schema: + type: string + title: Name + responses: + '200': + description: Successful Response + content: + application/json: + schema: + $ref: '#/components/schemas/App' + '422': + description: Validation Error + content: + application/json: + schema: + $ref: '#/components/schemas/HTTPValidationError' + x-codeSamples: + - lang: JavaScript + source: |- + import Honcho from 'honcho'; + + const client = new Honcho({ + apiKey: process.env['HONCHO_API_KEY'], // This is the default and can be omitted + }); + + async function main() { + const app = await client.apps.getOrCreate('name'); + + console.log(app.id); + } + + main(); + - lang: Python + source: |- + import os + from honcho import Honcho + + client = Honcho( + # This is the default and can be omitted + api_key=os.environ.get("HONCHO_API_KEY"), + ) + app = client.apps.get_or_create( + "name", + ) + print(app.id) + /v1/apps/{app_id}/users: + post: + tags: + - users + summary: Create User + description: |- + Create a User + + Args: + app_id (str): The ID of the app representing the client application using + honcho + user (schemas.UserCreate): The User object containing any metadata + + Returns: + schemas.User: Created User object + operationId: create_user_v1_apps__app_id__users_post + security: + - HTTPBearer: [] + - {} + parameters: + - name: app_id + in: path + required: true + schema: + type: string + title: App Id + requestBody: + required: true + content: + application/json: + schema: + $ref: '#/components/schemas/UserCreate' + responses: + '200': + description: Successful Response + content: + application/json: + schema: + $ref: '#/components/schemas/User' + '422': + description: Validation Error + content: + application/json: + schema: + $ref: '#/components/schemas/HTTPValidationError' + x-codeSamples: + - lang: JavaScript + source: |- + import Honcho from 'honcho'; + + const client = new Honcho({ + apiKey: process.env['HONCHO_API_KEY'], // This is the default and can be omitted + }); + + async function main() { + const user = await client.apps.users.create('app_id', { name: 'name' }); + + console.log(user.id); + } + + main(); + - lang: Python + source: |- + import os + from honcho import Honcho + + client = Honcho( + # This is the default and can be omitted + api_key=os.environ.get("HONCHO_API_KEY"), + ) + user = client.apps.users.create( + app_id="app_id", + name="name", + ) + print(user.id) + /v1/apps/{app_id}/users/list: + post: + tags: + - users + summary: Get Users + description: |- + Get All Users for an App + + Args: + app_id (str): The ID of the app representing the client + application using honcho + + Returns: + list[schemas.User]: List of User objects + operationId: get_users_v1_apps__app_id__users_list_post + security: + - HTTPBearer: [] + - {} + parameters: + - name: app_id + in: path + required: true + schema: + type: string + title: App Id + - name: reverse + in: query + required: false + schema: + type: boolean + default: false + title: Reverse + - name: page + in: query + required: false + schema: + type: integer + minimum: 1 + description: Page number + default: 1 + title: Page + description: Page number + - name: size + in: query + required: false + schema: + type: integer + maximum: 100 + minimum: 1 + description: Page size + default: 50 + title: Size + description: Page size + requestBody: + required: true + content: + application/json: + schema: + $ref: '#/components/schemas/UserGet' + responses: + '200': + description: Successful Response + content: + application/json: + schema: + $ref: '#/components/schemas/Page_User_' + '422': + description: Validation Error + content: + application/json: + schema: + $ref: '#/components/schemas/HTTPValidationError' + x-codeSamples: + - lang: JavaScript + source: |- + import Honcho from 'honcho'; + + const client = new Honcho({ + apiKey: process.env['HONCHO_API_KEY'], // This is the default and can be omitted + }); + + async function main() { + // Automatically fetches more pages as needed. + for await (const user of client.apps.users.list('app_id')) { + console.log(user.id); + } + } + + main(); + - lang: Python + source: |- + import os + from honcho import Honcho + + client = Honcho( + # This is the default and can be omitted + api_key=os.environ.get("HONCHO_API_KEY"), + ) + page = client.apps.users.list( + app_id="app_id", + ) + page = page.items[0] + print(page.id) + /v1/apps/{app_id}/users/name/{name}: + get: + tags: + - users + summary: Get User By Name + description: |- + Get a User + + Args: + app_id (str): The ID of the app representing the client application using + honcho + user_id (str): The User ID representing the user, managed by the user + + Returns: + schemas.User: User object + operationId: get_user_by_name_v1_apps__app_id__users_name__name__get + security: + - HTTPBearer: [] + - {} + parameters: + - name: app_id + in: path + required: true + schema: + type: string + title: App Id + - name: name + in: path + required: true + schema: + type: string + title: Name + responses: + '200': + description: Successful Response + content: + application/json: + schema: + $ref: '#/components/schemas/User' + '422': + description: Validation Error + content: + application/json: + schema: + $ref: '#/components/schemas/HTTPValidationError' + x-codeSamples: + - lang: JavaScript + source: |- + import Honcho from 'honcho'; + + const client = new Honcho({ + apiKey: process.env['HONCHO_API_KEY'], // This is the default and can be omitted + }); + + async function main() { + const user = await client.apps.users.getByName('app_id', 'name'); + + console.log(user.id); + } + + main(); + - lang: Python + source: |- + import os + from honcho import Honcho + + client = Honcho( + # This is the default and can be omitted + api_key=os.environ.get("HONCHO_API_KEY"), + ) + user = client.apps.users.get_by_name( + name="name", + app_id="app_id", + ) + print(user.id) + /v1/apps/{app_id}/users/{user_id}: + get: + tags: + - users + summary: Get User + description: |- + Get a User + + Args: + app_id (str): The ID of the app representing the client application using + honcho + user_id (str): The User ID representing the user, managed by the user + + Returns: + schemas.User: User object + operationId: get_user_v1_apps__app_id__users__user_id__get + security: + - HTTPBearer: [] + - {} + parameters: + - name: app_id + in: path + required: true + schema: + type: string + title: App Id + - name: user_id + in: path + required: true + schema: + type: string + title: User Id + responses: + '200': + description: Successful Response + content: + application/json: + schema: + $ref: '#/components/schemas/User' + '422': + description: Validation Error + content: + application/json: + schema: + $ref: '#/components/schemas/HTTPValidationError' + x-codeSamples: + - lang: JavaScript + source: |- + import Honcho from 'honcho'; + + const client = new Honcho({ + apiKey: process.env['HONCHO_API_KEY'], // This is the default and can be omitted + }); + + async function main() { + const user = await client.apps.users.get('app_id', 'user_id'); + + console.log(user.id); + } + + main(); + - lang: Python + source: |- + import os + from honcho import Honcho + + client = Honcho( + # This is the default and can be omitted + api_key=os.environ.get("HONCHO_API_KEY"), + ) + user = client.apps.users.get( + user_id="user_id", + app_id="app_id", + ) + print(user.id) + put: + tags: + - users + summary: Update User + description: |- + Update a User + + Args: + app_id (str): The ID of the app representing the client application using + honcho + user_id (str): The User ID representing the user, managed by the user + user (schemas.UserCreate): The User object containing any metadata + + Returns: + schemas.User: Updated User object + operationId: update_user_v1_apps__app_id__users__user_id__put + security: + - HTTPBearer: [] + - {} + parameters: + - name: app_id + in: path + required: true + schema: + type: string + title: App Id + - name: user_id + in: path + required: true + schema: + type: string + title: User Id + requestBody: + required: true + content: + application/json: + schema: + $ref: '#/components/schemas/UserUpdate' + responses: + '200': + description: Successful Response + content: + application/json: + schema: + $ref: '#/components/schemas/User' + '422': + description: Validation Error + content: + application/json: + schema: + $ref: '#/components/schemas/HTTPValidationError' + x-codeSamples: + - lang: JavaScript + source: |- + import Honcho from 'honcho'; + + const client = new Honcho({ + apiKey: process.env['HONCHO_API_KEY'], // This is the default and can be omitted + }); + + async function main() { + const user = await client.apps.users.update('app_id', 'user_id'); + + console.log(user.id); + } + + main(); + - lang: Python + source: |- + import os + from honcho import Honcho + + client = Honcho( + # This is the default and can be omitted + api_key=os.environ.get("HONCHO_API_KEY"), + ) + user = client.apps.users.update( + user_id="user_id", + app_id="app_id", + ) + print(user.id) + /v1/apps/{app_id}/users/get_or_create/{name}: + get: + tags: + - users + summary: Get Or Create User + description: |- + Get or Create a User + + Args: + app_id (str): The ID of the app representing the client application using + honcho + user_id (str): The User ID representing the user, managed by the user + + Returns: + schemas.User: User object + operationId: get_or_create_user_v1_apps__app_id__users_get_or_create__name__get + security: + - HTTPBearer: [] + - {} + parameters: + - name: app_id + in: path + required: true + schema: + type: string + title: App Id + - name: name + in: path + required: true + schema: + type: string + title: Name + responses: + '200': + description: Successful Response + content: + application/json: + schema: + $ref: '#/components/schemas/User' + '422': + description: Validation Error + content: + application/json: + schema: + $ref: '#/components/schemas/HTTPValidationError' + x-codeSamples: + - lang: JavaScript + source: |- + import Honcho from 'honcho'; + + const client = new Honcho({ + apiKey: process.env['HONCHO_API_KEY'], // This is the default and can be omitted + }); + + async function main() { + const user = await client.apps.users.getOrCreate('app_id', 'name'); + + console.log(user.id); + } + + main(); + - lang: Python + source: |- + import os + from honcho import Honcho + + client = Honcho( + # This is the default and can be omitted + api_key=os.environ.get("HONCHO_API_KEY"), + ) + user = client.apps.users.get_or_create( + name="name", + app_id="app_id", + ) + print(user.id) + /v1/apps/{app_id}/users/{user_id}/sessions/list: + post: + tags: + - sessions + summary: Get Sessions + description: |- + Get All Sessions for a User + + Args: + app_id (str): The ID of the app representing the client application using + honcho + user_id (str): The User ID representing the user, managed by the user + + Returns: + list[schemas.Session]: List of Session objects + operationId: get_sessions_v1_apps__app_id__users__user_id__sessions_list_post + security: + - HTTPBearer: [] + - {} + parameters: + - name: app_id + in: path + required: true + schema: + type: string + title: App Id + - name: user_id + in: path + required: true + schema: + type: string + title: User Id + - name: reverse + in: query + required: false + schema: + anyOf: + - type: boolean + - type: 'null' + default: false + title: Reverse + - name: page + in: query + required: false + schema: + type: integer + minimum: 1 + description: Page number + default: 1 + title: Page + description: Page number + - name: size + in: query + required: false + schema: + type: integer + maximum: 100 + minimum: 1 + description: Page size + default: 50 + title: Size + description: Page size + requestBody: + required: true + content: + application/json: + schema: + $ref: '#/components/schemas/SessionGet' + responses: + '200': + description: Successful Response + content: + application/json: + schema: + $ref: '#/components/schemas/Page_Session_' + '422': + description: Validation Error + content: + application/json: + schema: + $ref: '#/components/schemas/HTTPValidationError' + x-codeSamples: + - lang: JavaScript + source: |- + import Honcho from 'honcho'; + + const client = new Honcho({ + apiKey: process.env['HONCHO_API_KEY'], // This is the default and can be omitted + }); + + async function main() { + // Automatically fetches more pages as needed. + for await (const session of client.apps.users.sessions.list('app_id', 'user_id')) { + console.log(session.id); + } + } + + main(); + - lang: Python + source: |- + import os + from honcho import Honcho + + client = Honcho( + # This is the default and can be omitted + api_key=os.environ.get("HONCHO_API_KEY"), + ) + page = client.apps.users.sessions.list( + user_id="user_id", + app_id="app_id", + ) + page = page.items[0] + print(page.id) + /v1/apps/{app_id}/users/{user_id}/sessions: + post: + tags: + - sessions + summary: Create Session + description: |- + Create a Session for a User + + Args: + app_id (str): The ID of the app representing the client + application using honcho + user_id (str): The User ID representing the user, managed by the user + session (schemas.SessionCreate): The Session object containing any + metadata + + Returns: + schemas.Session: The Session object of the new Session + operationId: create_session_v1_apps__app_id__users__user_id__sessions_post + security: + - HTTPBearer: [] + - {} + parameters: + - name: app_id + in: path + required: true + schema: + type: string + title: App Id + - name: user_id + in: path + required: true + schema: + type: string + title: User Id + requestBody: + required: true + content: + application/json: + schema: + $ref: '#/components/schemas/SessionCreate' + responses: + '200': + description: Successful Response + content: + application/json: + schema: + $ref: '#/components/schemas/Session' + '422': + description: Validation Error + content: + application/json: + schema: + $ref: '#/components/schemas/HTTPValidationError' + x-codeSamples: + - lang: JavaScript + source: |- + import Honcho from 'honcho'; + + const client = new Honcho({ + apiKey: process.env['HONCHO_API_KEY'], // This is the default and can be omitted + }); + + async function main() { + const session = await client.apps.users.sessions.create('app_id', 'user_id'); + + console.log(session.id); + } + + main(); + - lang: Python + source: |- + import os + from honcho import Honcho + + client = Honcho( + # This is the default and can be omitted + api_key=os.environ.get("HONCHO_API_KEY"), + ) + session = client.apps.users.sessions.create( + user_id="user_id", + app_id="app_id", + ) + print(session.id) + /v1/apps/{app_id}/users/{user_id}/sessions/{session_id}: + put: + tags: + - sessions + summary: Update Session + description: |- + Update the metadata of a Session + + Args: + app_id (str): The ID of the app representing the client application using + honcho + user_id (str): The User ID representing the user, managed by the user + session_id (str): The ID of the Session to update + session (schemas.SessionUpdate): The Session object containing any new metadata + + Returns: + schemas.Session: The Session object of the updated Session + operationId: update_session_v1_apps__app_id__users__user_id__sessions__session_id__put + security: + - HTTPBearer: [] + - {} + parameters: + - name: app_id + in: path + required: true + schema: + type: string + title: App Id + - name: user_id + in: path + required: true + schema: + type: string + title: User Id + - name: session_id + in: path + required: true + schema: + type: string + title: Session Id + requestBody: + required: true + content: + application/json: + schema: + $ref: '#/components/schemas/SessionUpdate' + responses: + '200': + description: Successful Response + content: + application/json: + schema: + $ref: '#/components/schemas/Session' + '422': + description: Validation Error + content: + application/json: + schema: + $ref: '#/components/schemas/HTTPValidationError' + x-codeSamples: + - lang: JavaScript + source: |- + import Honcho from 'honcho'; + + const client = new Honcho({ + apiKey: process.env['HONCHO_API_KEY'], // This is the default and can be omitted + }); + + async function main() { + const session = await client.apps.users.sessions.update('app_id', 'user_id', 'session_id'); + + console.log(session.id); + } + + main(); + - lang: Python + source: |- + import os + from honcho import Honcho + + client = Honcho( + # This is the default and can be omitted + api_key=os.environ.get("HONCHO_API_KEY"), + ) + session = client.apps.users.sessions.update( + session_id="session_id", + app_id="app_id", + user_id="user_id", + ) + print(session.id) + delete: + tags: + - sessions + summary: Delete Session + description: |- + Delete a session by marking it as inactive + + Args: + app_id (str): The ID of the app representing the client application using + honcho + user_id (str): The User ID representing the user, managed by the user + session_id (str): The ID of the Session to delete + + Returns: + dict: A message indicating that the session was deleted + + Raises: + HTTPException: If the session is not found + operationId: delete_session_v1_apps__app_id__users__user_id__sessions__session_id__delete + security: + - HTTPBearer: [] + - {} + parameters: + - name: app_id + in: path + required: true + schema: + type: string + title: App Id + - name: user_id + in: path + required: true + schema: + type: string + title: User Id + - name: session_id + in: path + required: true + schema: + type: string + title: Session Id + responses: + '200': + description: Successful Response + content: + application/json: + schema: {} + '422': + description: Validation Error + content: + application/json: + schema: + $ref: '#/components/schemas/HTTPValidationError' + x-codeSamples: + - lang: JavaScript + source: |- + import Honcho from 'honcho'; + + const client = new Honcho({ + apiKey: process.env['HONCHO_API_KEY'], // This is the default and can be omitted + }); + + async function main() { + const session = await client.apps.users.sessions.delete('app_id', 'user_id', 'session_id'); + + console.log(session); + } + + main(); + - lang: Python + source: |- + import os + from honcho import Honcho + + client = Honcho( + # This is the default and can be omitted + api_key=os.environ.get("HONCHO_API_KEY"), + ) + session = client.apps.users.sessions.delete( + session_id="session_id", + app_id="app_id", + user_id="user_id", + ) + print(session) + get: + tags: + - sessions + summary: Get Session + description: |- + Get a specific session for a user by ID + + Args: + app_id (str): The ID of the app representing the client application using + honcho + user_id (str): The User ID representing the user, managed by the user + session_id (str): The ID of the Session to retrieve + + Returns: + schemas.Session: The Session object of the requested Session + + Raises: + HTTPException: If the session is not found + operationId: get_session_v1_apps__app_id__users__user_id__sessions__session_id__get + security: + - HTTPBearer: [] + - {} + parameters: + - name: app_id + in: path + required: true + schema: + type: string + title: App Id + - name: user_id + in: path + required: true + schema: + type: string + title: User Id + - name: session_id + in: path + required: true + schema: + type: string + title: Session Id + responses: + '200': + description: Successful Response + content: + application/json: + schema: + $ref: '#/components/schemas/Session' + '422': + description: Validation Error + content: + application/json: + schema: + $ref: '#/components/schemas/HTTPValidationError' + x-codeSamples: + - lang: JavaScript + source: |- + import Honcho from 'honcho'; + + const client = new Honcho({ + apiKey: process.env['HONCHO_API_KEY'], // This is the default and can be omitted + }); + + async function main() { + const session = await client.apps.users.sessions.get('app_id', 'user_id', 'session_id'); + + console.log(session.id); + } + + main(); + - lang: Python + source: |- + import os + from honcho import Honcho + + client = Honcho( + # This is the default and can be omitted + api_key=os.environ.get("HONCHO_API_KEY"), + ) + session = client.apps.users.sessions.get( + session_id="session_id", + app_id="app_id", + user_id="user_id", + ) + print(session.id) + /v1/apps/{app_id}/users/{user_id}/sessions/{session_id}/chat: + post: + tags: + - sessions + summary: Chat + operationId: chat_v1_apps__app_id__users__user_id__sessions__session_id__chat_post + security: + - HTTPBearer: [] + - {} + parameters: + - name: app_id + in: path + required: true + schema: + type: string + title: App Id + - name: user_id + in: path + required: true + schema: + type: string + title: User Id + - name: session_id + in: path + required: true + schema: + type: string + title: Session Id + requestBody: + required: true + content: + application/json: + schema: + $ref: '#/components/schemas/AgentQuery' + responses: + '200': + description: Successful Response + content: + application/json: + schema: + $ref: '#/components/schemas/AgentChat' + '422': + description: Validation Error + content: + application/json: + schema: + $ref: '#/components/schemas/HTTPValidationError' + x-codeSamples: + - lang: JavaScript + source: |- + import Honcho from 'honcho'; + + const client = new Honcho({ + apiKey: process.env['HONCHO_API_KEY'], // This is the default and can be omitted + }); + + async function main() { + const agentChat = await client.apps.users.sessions.chat('app_id', 'user_id', 'session_id', { + queries: 'string', + }); + + console.log(agentChat.content); + } + + main(); + - lang: Python + source: |- + import os + from honcho import Honcho + + client = Honcho( + # This is the default and can be omitted + api_key=os.environ.get("HONCHO_API_KEY"), + ) + agent_chat = client.apps.users.sessions.chat( + session_id="session_id", + app_id="app_id", + user_id="user_id", + queries="string", + ) + print(agent_chat.content) + /v1/apps/{app_id}/users/{user_id}/sessions/{session_id}/chat/stream: + post: + tags: + - sessions + summary: Get Chat Stream + operationId: get_chat_stream_v1_apps__app_id__users__user_id__sessions__session_id__chat_stream_post + security: + - HTTPBearer: [] + - {} + parameters: + - name: app_id + in: path + required: true + schema: + type: string + title: App Id + - name: user_id + in: path + required: true + schema: + type: string + title: User Id + - name: session_id + in: path + required: true + schema: + type: string + title: Session Id + requestBody: + required: true + content: + application/json: + schema: + $ref: '#/components/schemas/AgentQuery' + responses: + '200': + description: Chat stream + content: + application/json: + schema: {} + text/event-stream: + schema: + type: string + format: binary + '422': + description: Validation Error + content: + application/json: + schema: + $ref: '#/components/schemas/HTTPValidationError' + x-codeSamples: + - lang: JavaScript + source: |- + import Honcho from 'honcho'; + + const client = new Honcho({ + apiKey: process.env['HONCHO_API_KEY'], // This is the default and can be omitted + }); + + async function main() { + const response = await client.apps.users.sessions.stream('app_id', 'user_id', 'session_id', { + queries: 'string', + }); + + console.log(response); + } + + main(); + - lang: Python + source: |- + import os + from honcho import Honcho + + client = Honcho( + # This is the default and can be omitted + api_key=os.environ.get("HONCHO_API_KEY"), + ) + response = client.apps.users.sessions.stream( + session_id="session_id", + app_id="app_id", + user_id="user_id", + queries="string", + ) + print(response) + /v1/apps/{app_id}/users/{user_id}/sessions/{session_id}/clone: + get: + tags: + - sessions + summary: Clone Session + operationId: clone_session_v1_apps__app_id__users__user_id__sessions__session_id__clone_get + security: + - HTTPBearer: [] + - {} + parameters: + - name: app_id + in: path + required: true + schema: + type: string + title: App Id + - name: user_id + in: path + required: true + schema: + type: string + title: User Id + - name: session_id + in: path + required: true + schema: + type: string + title: Session Id + - name: message_id + in: query + required: false + schema: + anyOf: + - type: string + - type: 'null' + title: Message Id + - name: deep_copy + in: query + required: false + schema: + type: boolean + default: false + title: Deep Copy + responses: + '200': + description: Successful Response + content: + application/json: + schema: + $ref: '#/components/schemas/Session' + '422': + description: Validation Error + content: + application/json: + schema: + $ref: '#/components/schemas/HTTPValidationError' + x-codeSamples: + - lang: JavaScript + source: |- + import Honcho from 'honcho'; + + const client = new Honcho({ + apiKey: process.env['HONCHO_API_KEY'], // This is the default and can be omitted + }); + + async function main() { + const session = await client.apps.users.sessions.clone('app_id', 'user_id', 'session_id'); + + console.log(session.id); + } + + main(); + - lang: Python + source: |- + import os + from honcho import Honcho + + client = Honcho( + # This is the default and can be omitted + api_key=os.environ.get("HONCHO_API_KEY"), + ) + session = client.apps.users.sessions.clone( + session_id="session_id", + app_id="app_id", + user_id="user_id", + ) + print(session.id) + /v1/apps/{app_id}/users/{user_id}/sessions/{session_id}/messages: + post: + tags: + - messages + summary: Create Message For Session + description: |- + Adds a message to a session + + Args: + app_id (str): The ID of the app representing the client application using honcho + user_id (str): The User ID representing the user, managed by the user + session_id (int): The ID of the Session to add the message to + message (schemas.MessageCreate): The Message object to add containing the message content and type + + Returns: + schemas.Message: The Message object of the added message + + Raises: + HTTPException: If the session is not found + operationId: create_message_for_session_v1_apps__app_id__users__user_id__sessions__session_id__messages_post + security: + - HTTPBearer: [] + - {} + parameters: + - name: app_id + in: path + required: true + schema: + type: string + title: App Id + - name: user_id + in: path + required: true + schema: + type: string + title: User Id + - name: session_id + in: path + required: true + schema: + type: string + title: Session Id + requestBody: + required: true + content: + application/json: + schema: + $ref: '#/components/schemas/MessageCreate' + responses: + '200': + description: Successful Response + content: + application/json: + schema: + $ref: '#/components/schemas/Message' + '422': + description: Validation Error + content: + application/json: + schema: + $ref: '#/components/schemas/HTTPValidationError' + x-codeSamples: + - lang: JavaScript + source: |- + import Honcho from 'honcho'; + + const client = new Honcho({ + apiKey: process.env['HONCHO_API_KEY'], // This is the default and can be omitted + }); + + async function main() { + const message = await client.apps.users.sessions.messages.create('app_id', 'user_id', 'session_id', { + content: 'content', + is_user: true, + }); + + console.log(message.id); + } + + main(); + - lang: Python + source: |- + import os + from honcho import Honcho + + client = Honcho( + # This is the default and can be omitted + api_key=os.environ.get("HONCHO_API_KEY"), + ) + message = client.apps.users.sessions.messages.create( + session_id="session_id", + app_id="app_id", + user_id="user_id", + content="content", + is_user=True, + ) + print(message.id) + /v1/apps/{app_id}/users/{user_id}/sessions/{session_id}/messages/list: + post: + tags: + - messages + summary: Get Messages + description: |- + Get all messages for a session + + Args: + app_id (str): The ID of the app representing the client application using + honcho + user_id (str): The User ID representing the user, managed by the user + session_id (int): The ID of the Session to retrieve + reverse (bool): Whether to reverse the order of the messages + + Returns: + list[schemas.Message]: List of Message objects + + Raises: + HTTPException: If the session is not found + operationId: get_messages_v1_apps__app_id__users__user_id__sessions__session_id__messages_list_post + security: + - HTTPBearer: [] + - {} + parameters: + - name: app_id + in: path + required: true + schema: + type: string + title: App Id + - name: user_id + in: path + required: true + schema: + type: string + title: User Id + - name: session_id + in: path + required: true + schema: + type: string + title: Session Id + - name: reverse + in: query + required: false + schema: + anyOf: + - type: boolean + - type: 'null' + default: false + title: Reverse + - name: page + in: query + required: false + schema: + type: integer + minimum: 1 + description: Page number + default: 1 + title: Page + description: Page number + - name: size + in: query + required: false + schema: + type: integer + maximum: 100 + minimum: 1 + description: Page size + default: 50 + title: Size + description: Page size + requestBody: + required: true + content: + application/json: + schema: + $ref: '#/components/schemas/MessageGet' + responses: + '200': + description: Successful Response + content: + application/json: + schema: + $ref: '#/components/schemas/Page_Message_' + '422': + description: Validation Error + content: + application/json: + schema: + $ref: '#/components/schemas/HTTPValidationError' + x-codeSamples: + - lang: JavaScript + source: |- + import Honcho from 'honcho'; + + const client = new Honcho({ + apiKey: process.env['HONCHO_API_KEY'], // This is the default and can be omitted + }); + + async function main() { + // Automatically fetches more pages as needed. + for await (const message of client.apps.users.sessions.messages.list('app_id', 'user_id', 'session_id')) { + console.log(message.id); + } + } + + main(); + - lang: Python + source: |- + import os + from honcho import Honcho + + client = Honcho( + # This is the default and can be omitted + api_key=os.environ.get("HONCHO_API_KEY"), + ) + page = client.apps.users.sessions.messages.list( + session_id="session_id", + app_id="app_id", + user_id="user_id", + ) + page = page.items[0] + print(page.id) + /v1/apps/{app_id}/users/{user_id}/sessions/{session_id}/messages/{message_id}: + get: + tags: + - messages + summary: Get Message + operationId: get_message_v1_apps__app_id__users__user_id__sessions__session_id__messages__message_id__get + security: + - HTTPBearer: [] + - {} + parameters: + - name: app_id + in: path + required: true + schema: + type: string + title: App Id + - name: user_id + in: path + required: true + schema: + type: string + title: User Id + - name: session_id + in: path + required: true + schema: + type: string + title: Session Id + - name: message_id + in: path + required: true + schema: + type: string + title: Message Id + responses: + '200': + description: Successful Response + content: + application/json: + schema: + $ref: '#/components/schemas/Message' + '422': + description: Validation Error + content: + application/json: + schema: + $ref: '#/components/schemas/HTTPValidationError' + x-codeSamples: + - lang: JavaScript + source: |- + import Honcho from 'honcho'; + + const client = new Honcho({ + apiKey: process.env['HONCHO_API_KEY'], // This is the default and can be omitted + }); + + async function main() { + const message = await client.apps.users.sessions.messages.get( + 'app_id', + 'user_id', + 'session_id', + 'message_id', + ); + + console.log(message.id); + } + + main(); + - lang: Python + source: |- + import os + from honcho import Honcho + + client = Honcho( + # This is the default and can be omitted + api_key=os.environ.get("HONCHO_API_KEY"), + ) + message = client.apps.users.sessions.messages.get( + message_id="message_id", + app_id="app_id", + user_id="user_id", + session_id="session_id", + ) + print(message.id) + put: + tags: + - messages + summary: Update Message + description: Update's the metadata of a message + operationId: update_message_v1_apps__app_id__users__user_id__sessions__session_id__messages__message_id__put + security: + - HTTPBearer: [] + - {} + parameters: + - name: app_id + in: path + required: true + schema: + type: string + title: App Id + - name: user_id + in: path + required: true + schema: + type: string + title: User Id + - name: session_id + in: path + required: true + schema: + type: string + title: Session Id + - name: message_id + in: path + required: true + schema: + type: string + title: Message Id + requestBody: + required: true + content: + application/json: + schema: + $ref: '#/components/schemas/MessageUpdate' + responses: + '200': + description: Successful Response + content: + application/json: + schema: + $ref: '#/components/schemas/Message' + '422': + description: Validation Error + content: + application/json: + schema: + $ref: '#/components/schemas/HTTPValidationError' + x-codeSamples: + - lang: JavaScript + source: |- + import Honcho from 'honcho'; + + const client = new Honcho({ + apiKey: process.env['HONCHO_API_KEY'], // This is the default and can be omitted + }); + + async function main() { + const message = await client.apps.users.sessions.messages.update( + 'app_id', + 'user_id', + 'session_id', + 'message_id', + ); + + console.log(message.id); + } + + main(); + - lang: Python + source: |- + import os + from honcho import Honcho + + client = Honcho( + # This is the default and can be omitted + api_key=os.environ.get("HONCHO_API_KEY"), + ) + message = client.apps.users.sessions.messages.update( + message_id="message_id", + app_id="app_id", + user_id="user_id", + session_id="session_id", + ) + print(message.id) + /v1/apps/{app_id}/users/{user_id}/sessions/{session_id}/metamessages: + post: + tags: + - metamessages + summary: Create Metamessage + description: |- + Adds a message to a session + + Args: + app_id (str): The ID of the app representing the client application using + honcho + user_id (str): The User ID representing the user, managed by the user + session_id (int): The ID of the Session to add the message to + metamessage (schemas.MeteamessageCreate): The metamessage creation object + + Returns: + schemas.Metamessage: The Metamessage object of the added metamessage + + Raises: + HTTPException: If the session is not found + operationId: create_metamessage_v1_apps__app_id__users__user_id__sessions__session_id__metamessages_post + security: + - HTTPBearer: [] + - {} + parameters: + - name: app_id + in: path + required: true + schema: + type: string + title: App Id + - name: user_id + in: path + required: true + schema: + type: string + title: User Id + - name: session_id + in: path + required: true + schema: + type: string + title: Session Id + requestBody: + required: true + content: + application/json: + schema: + $ref: '#/components/schemas/MetamessageCreate' + responses: + '200': + description: Successful Response + content: + application/json: + schema: + $ref: '#/components/schemas/Metamessage' + '422': + description: Validation Error + content: + application/json: + schema: + $ref: '#/components/schemas/HTTPValidationError' + x-codeSamples: + - lang: JavaScript + source: |- + import Honcho from 'honcho'; + + const client = new Honcho({ + apiKey: process.env['HONCHO_API_KEY'], // This is the default and can be omitted + }); + + async function main() { + const metamessage = await client.apps.users.sessions.metamessages.create( + 'app_id', + 'user_id', + 'session_id', + { content: 'content', message_id: 'message_id', metamessage_type: 'metamessage_type' }, + ); + + console.log(metamessage.id); + } + + main(); + - lang: Python + source: |- + import os + from honcho import Honcho + + client = Honcho( + # This is the default and can be omitted + api_key=os.environ.get("HONCHO_API_KEY"), + ) + metamessage = client.apps.users.sessions.metamessages.create( + session_id="session_id", + app_id="app_id", + user_id="user_id", + content="content", + message_id="message_id", + metamessage_type="metamessage_type", + ) + print(metamessage.id) + /v1/apps/{app_id}/users/{user_id}/sessions/{session_id}/metamessages/list: + post: + tags: + - metamessages + summary: Get Metamessages + description: |- + Get all messages for a session + + Args: + app_id (str): The ID of the app representing the client application using + honcho + user_id (str): The User ID representing the user, managed by the user + session_id (int): The ID of the Session to retrieve + reverse (bool): Whether to reverse the order of the metamessages + + Returns: + list[schemas.Message]: List of Message objects + + Raises: + HTTPException: If the session is not found + operationId: get_metamessages_v1_apps__app_id__users__user_id__sessions__session_id__metamessages_list_post + security: + - HTTPBearer: [] + - {} + parameters: + - name: app_id + in: path + required: true + schema: + type: string + title: App Id + - name: user_id + in: path + required: true + schema: + type: string + title: User Id + - name: session_id + in: path + required: true + schema: + type: string + title: Session Id + - name: reverse + in: query + required: false + schema: + anyOf: + - type: boolean + - type: 'null' + default: false + title: Reverse + - name: page + in: query + required: false + schema: + type: integer + minimum: 1 + description: Page number + default: 1 + title: Page + description: Page number + - name: size + in: query + required: false + schema: + type: integer + maximum: 100 + minimum: 1 + description: Page size + default: 50 + title: Size + description: Page size + requestBody: + required: true + content: + application/json: + schema: + $ref: '#/components/schemas/MetamessageGet' + responses: + '200': + description: Successful Response + content: + application/json: + schema: + $ref: '#/components/schemas/Page_Metamessage_' + '422': + description: Validation Error + content: + application/json: + schema: + $ref: '#/components/schemas/HTTPValidationError' + x-codeSamples: + - lang: JavaScript + source: |- + import Honcho from 'honcho'; + + const client = new Honcho({ + apiKey: process.env['HONCHO_API_KEY'], // This is the default and can be omitted + }); + + async function main() { + // Automatically fetches more pages as needed. + for await (const metamessage of client.apps.users.sessions.metamessages.list( + 'app_id', + 'user_id', + 'session_id', + )) { + console.log(metamessage.id); + } + } + + main(); + - lang: Python + source: |- + import os + from honcho import Honcho + + client = Honcho( + # This is the default and can be omitted + api_key=os.environ.get("HONCHO_API_KEY"), + ) + page = client.apps.users.sessions.metamessages.list( + session_id="session_id", + app_id="app_id", + user_id="user_id", + ) + page = page.items[0] + print(page.id) + /v1/apps/{app_id}/users/{user_id}/sessions/{session_id}/metamessages/{metamessage_id}: + get: + tags: + - metamessages + summary: Get Metamessage + description: |- + Get a specific Metamessage by ID + + Args: + app_id (str): The ID of the app representing the client application using + honcho + user_id (str): The User ID representing the user, managed by the user + session_id (int): The ID of the Session to retrieve + + Returns: + schemas.Session: The Session object of the requested Session + + Raises: + HTTPException: If the session is not found + operationId: >- + get_metamessage_v1_apps__app_id__users__user_id__sessions__session_id__metamessages__metamessage_id__get + security: + - HTTPBearer: [] + - {} + parameters: + - name: app_id + in: path + required: true + schema: + type: string + title: App Id + - name: user_id + in: path + required: true + schema: + type: string + title: User Id + - name: session_id + in: path + required: true + schema: + type: string + title: Session Id + - name: metamessage_id + in: path + required: true + schema: + type: string + title: Metamessage Id + - name: message_id + in: query + required: true + schema: + type: string + title: Message Id + responses: + '200': + description: Successful Response + content: + application/json: + schema: + $ref: '#/components/schemas/Metamessage' + '422': + description: Validation Error + content: + application/json: + schema: + $ref: '#/components/schemas/HTTPValidationError' + x-codeSamples: + - lang: JavaScript + source: |- + import Honcho from 'honcho'; + + const client = new Honcho({ + apiKey: process.env['HONCHO_API_KEY'], // This is the default and can be omitted + }); + + async function main() { + const metamessage = await client.apps.users.sessions.metamessages.get( + 'app_id', + 'user_id', + 'session_id', + 'metamessage_id', + { message_id: 'message_id' }, + ); + + console.log(metamessage.id); + } + + main(); + - lang: Python + source: |- + import os + from honcho import Honcho + + client = Honcho( + # This is the default and can be omitted + api_key=os.environ.get("HONCHO_API_KEY"), + ) + metamessage = client.apps.users.sessions.metamessages.get( + metamessage_id="metamessage_id", + app_id="app_id", + user_id="user_id", + session_id="session_id", + message_id="message_id", + ) + print(metamessage.id) + put: + tags: + - metamessages + summary: Update Metamessage + description: Update's the metadata of a metamessage + operationId: >- + update_metamessage_v1_apps__app_id__users__user_id__sessions__session_id__metamessages__metamessage_id__put + security: + - HTTPBearer: [] + - {} + parameters: + - name: app_id + in: path + required: true + schema: + type: string + title: App Id + - name: user_id + in: path + required: true + schema: + type: string + title: User Id + - name: session_id + in: path + required: true + schema: + type: string + title: Session Id + - name: metamessage_id + in: path + required: true + schema: + type: string + title: Metamessage Id + requestBody: + required: true + content: + application/json: + schema: + $ref: '#/components/schemas/MetamessageUpdate' + responses: + '200': + description: Successful Response + content: + application/json: + schema: + $ref: '#/components/schemas/Metamessage' + '422': + description: Validation Error + content: + application/json: + schema: + $ref: '#/components/schemas/HTTPValidationError' + x-codeSamples: + - lang: JavaScript + source: |- + import Honcho from 'honcho'; + + const client = new Honcho({ + apiKey: process.env['HONCHO_API_KEY'], // This is the default and can be omitted + }); + + async function main() { + const metamessage = await client.apps.users.sessions.metamessages.update( + 'app_id', + 'user_id', + 'session_id', + 'metamessage_id', + { message_id: 'message_id' }, + ); + + console.log(metamessage.id); + } + + main(); + - lang: Python + source: |- + import os + from honcho import Honcho + + client = Honcho( + # This is the default and can be omitted + api_key=os.environ.get("HONCHO_API_KEY"), + ) + metamessage = client.apps.users.sessions.metamessages.update( + metamessage_id="metamessage_id", + app_id="app_id", + user_id="user_id", + session_id="session_id", + message_id="message_id", + ) + print(metamessage.id) + /v1/apps/{app_id}/users/{user_id}/metamessages/list: + post: + tags: + - metamessages + summary: Get Metamessages By User + description: |- + Paginate through the user metamessages for a user + + Args: + app_id (str): The ID of the app representing the client application using honcho + user_id (str): The User ID representing the user, managed by the user + reverse (bool): Whether to reverse the order of the metamessages + + Returns: + list[schemas.Message]: List of Message objects + + Raises: + HTTPException: If the session is not found + operationId: get_metamessages_by_user_v1_apps__app_id__users__user_id__metamessages_list_post + security: + - HTTPBearer: [] + - {} + parameters: + - name: app_id + in: path + required: true + schema: + type: string + title: App Id + - name: user_id + in: path + required: true + schema: + type: string + title: User Id + - name: reverse + in: query + required: false + schema: + anyOf: + - type: boolean + - type: 'null' + default: false + title: Reverse + - name: page + in: query + required: false + schema: + type: integer + minimum: 1 + description: Page number + default: 1 + title: Page + description: Page number + - name: size + in: query + required: false + schema: + type: integer + maximum: 100 + minimum: 1 + description: Page size + default: 50 + title: Size + description: Page size + requestBody: + required: true + content: + application/json: + schema: + $ref: '#/components/schemas/MetamessageGetUserLevel' + responses: + '200': + description: Successful Response + content: + application/json: + schema: + $ref: '#/components/schemas/Page_Metamessage_' + '422': + description: Validation Error + content: + application/json: + schema: + $ref: '#/components/schemas/HTTPValidationError' + x-codeSamples: + - lang: JavaScript + source: |- + import Honcho from 'honcho'; + + const client = new Honcho({ + apiKey: process.env['HONCHO_API_KEY'], // This is the default and can be omitted + }); + + async function main() { + // Automatically fetches more pages as needed. + for await (const metamessage of client.apps.users.metamessages.list('app_id', 'user_id')) { + console.log(metamessage.id); + } + } + + main(); + - lang: Python + source: |- + import os + from honcho import Honcho + + client = Honcho( + # This is the default and can be omitted + api_key=os.environ.get("HONCHO_API_KEY"), + ) + page = client.apps.users.metamessages.list( + user_id="user_id", + app_id="app_id", + ) + page = page.items[0] + print(page.id) + /v1/apps/{app_id}/users/{user_id}/collections/list: + post: + tags: + - collections + summary: Get Collections + description: |- + Get All Collections for a User + + Args: + app_id (str): The ID of the app representing the client + application using honcho + user_id (str): The User ID representing the user, managed by the user + + Returns: + list[schemas.Collection]: List of Collection objects + operationId: get_collections_v1_apps__app_id__users__user_id__collections_list_post + security: + - HTTPBearer: [] + - {} + parameters: + - name: app_id + in: path + required: true + schema: + type: string + title: App Id + - name: user_id + in: path + required: true + schema: + type: string + title: User Id + - name: reverse + in: query + required: false + schema: + anyOf: + - type: boolean + - type: 'null' + default: false + title: Reverse + - name: page + in: query + required: false + schema: + type: integer + minimum: 1 + description: Page number + default: 1 + title: Page + description: Page number + - name: size + in: query + required: false + schema: + type: integer + maximum: 100 + minimum: 1 + description: Page size + default: 50 + title: Size + description: Page size + requestBody: + required: true + content: + application/json: + schema: + $ref: '#/components/schemas/CollectionGet' + responses: + '200': + description: Successful Response + content: + application/json: + schema: + $ref: '#/components/schemas/Page_Collection_' + '422': + description: Validation Error + content: + application/json: + schema: + $ref: '#/components/schemas/HTTPValidationError' + x-codeSamples: + - lang: JavaScript + source: |- + import Honcho from 'honcho'; + + const client = new Honcho({ + apiKey: process.env['HONCHO_API_KEY'], // This is the default and can be omitted + }); + + async function main() { + // Automatically fetches more pages as needed. + for await (const collection of client.apps.users.collections.list('app_id', 'user_id')) { + console.log(collection.id); + } + } + + main(); + - lang: Python + source: |- + import os + from honcho import Honcho + + client = Honcho( + # This is the default and can be omitted + api_key=os.environ.get("HONCHO_API_KEY"), + ) + page = client.apps.users.collections.list( + user_id="user_id", + app_id="app_id", + ) + page = page.items[0] + print(page.id) + /v1/apps/{app_id}/users/{user_id}/collections/name/{name}: + get: + tags: + - collections + summary: Get Collection By Name + operationId: get_collection_by_name_v1_apps__app_id__users__user_id__collections_name__name__get + security: + - HTTPBearer: [] + - {} + parameters: + - name: app_id + in: path + required: true + schema: + type: string + title: App Id + - name: user_id + in: path + required: true + schema: + type: string + title: User Id + - name: name + in: path + required: true + schema: + type: string + title: Name + responses: + '200': + description: Successful Response + content: + application/json: + schema: + $ref: '#/components/schemas/Collection' + '422': + description: Validation Error + content: + application/json: + schema: + $ref: '#/components/schemas/HTTPValidationError' + x-codeSamples: + - lang: JavaScript + source: |- + import Honcho from 'honcho'; + + const client = new Honcho({ + apiKey: process.env['HONCHO_API_KEY'], // This is the default and can be omitted + }); + + async function main() { + const collection = await client.apps.users.collections.getByName('app_id', 'user_id', 'name'); + + console.log(collection.id); + } + + main(); + - lang: Python + source: |- + import os + from honcho import Honcho + + client = Honcho( + # This is the default and can be omitted + api_key=os.environ.get("HONCHO_API_KEY"), + ) + collection = client.apps.users.collections.get_by_name( + name="name", + app_id="app_id", + user_id="user_id", + ) + print(collection.id) + /v1/apps/{app_id}/users/{user_id}/collections/{collection_id}: + get: + tags: + - collections + summary: Get Collection By Id + operationId: get_collection_by_id_v1_apps__app_id__users__user_id__collections__collection_id__get + security: + - HTTPBearer: [] + - {} + parameters: + - name: app_id + in: path + required: true + schema: + type: string + title: App Id + - name: user_id + in: path + required: true + schema: + type: string + title: User Id + - name: collection_id + in: path + required: true + schema: + type: string + title: Collection Id + responses: + '200': + description: Successful Response + content: + application/json: + schema: + $ref: '#/components/schemas/Collection' + '422': + description: Validation Error + content: + application/json: + schema: + $ref: '#/components/schemas/HTTPValidationError' + x-codeSamples: + - lang: JavaScript + source: |- + import Honcho from 'honcho'; + + const client = new Honcho({ + apiKey: process.env['HONCHO_API_KEY'], // This is the default and can be omitted + }); + + async function main() { + const collection = await client.apps.users.collections.get('app_id', 'user_id', 'collection_id'); + + console.log(collection.id); + } + + main(); + - lang: Python + source: |- + import os + from honcho import Honcho + + client = Honcho( + # This is the default and can be omitted + api_key=os.environ.get("HONCHO_API_KEY"), + ) + collection = client.apps.users.collections.get( + collection_id="collection_id", + app_id="app_id", + user_id="user_id", + ) + print(collection.id) + put: + tags: + - collections + summary: Update Collection + operationId: update_collection_v1_apps__app_id__users__user_id__collections__collection_id__put + security: + - HTTPBearer: [] + - {} + parameters: + - name: app_id + in: path + required: true + schema: + type: string + title: App Id + - name: user_id + in: path + required: true + schema: + type: string + title: User Id + - name: collection_id + in: path + required: true + schema: + type: string + title: Collection Id + requestBody: + required: true + content: + application/json: + schema: + $ref: '#/components/schemas/CollectionUpdate' + responses: + '200': + description: Successful Response + content: + application/json: + schema: + $ref: '#/components/schemas/Collection' + '422': + description: Validation Error + content: + application/json: + schema: + $ref: '#/components/schemas/HTTPValidationError' + x-codeSamples: + - lang: JavaScript + source: |- + import Honcho from 'honcho'; + + const client = new Honcho({ + apiKey: process.env['HONCHO_API_KEY'], // This is the default and can be omitted + }); + + async function main() { + const collection = await client.apps.users.collections.update('app_id', 'user_id', 'collection_id'); + + console.log(collection.id); + } + + main(); + - lang: Python + source: |- + import os + from honcho import Honcho + + client = Honcho( + # This is the default and can be omitted + api_key=os.environ.get("HONCHO_API_KEY"), + ) + collection = client.apps.users.collections.update( + collection_id="collection_id", + app_id="app_id", + user_id="user_id", + ) + print(collection.id) + delete: + tags: + - collections + summary: Delete Collection + operationId: delete_collection_v1_apps__app_id__users__user_id__collections__collection_id__delete + security: + - HTTPBearer: [] + - {} + parameters: + - name: app_id + in: path + required: true + schema: + type: string + title: App Id + - name: user_id + in: path + required: true + schema: + type: string + title: User Id + - name: collection_id + in: path + required: true + schema: + type: string + title: Collection Id + responses: + '200': + description: Successful Response + content: + application/json: + schema: {} + '422': + description: Validation Error + content: + application/json: + schema: + $ref: '#/components/schemas/HTTPValidationError' + x-codeSamples: + - lang: JavaScript + source: |- + import Honcho from 'honcho'; + + const client = new Honcho({ + apiKey: process.env['HONCHO_API_KEY'], // This is the default and can be omitted + }); + + async function main() { + const collection = await client.apps.users.collections.delete('app_id', 'user_id', 'collection_id'); + + console.log(collection); + } + + main(); + - lang: Python + source: |- + import os + from honcho import Honcho + + client = Honcho( + # This is the default and can be omitted + api_key=os.environ.get("HONCHO_API_KEY"), + ) + collection = client.apps.users.collections.delete( + collection_id="collection_id", + app_id="app_id", + user_id="user_id", + ) + print(collection) + /v1/apps/{app_id}/users/{user_id}/collections: + post: + tags: + - collections + summary: Create Collection + operationId: create_collection_v1_apps__app_id__users__user_id__collections_post + security: + - HTTPBearer: [] + - {} + parameters: + - name: app_id + in: path + required: true + schema: + type: string + title: App Id + - name: user_id + in: path + required: true + schema: + type: string + title: User Id + requestBody: + required: true + content: + application/json: + schema: + $ref: '#/components/schemas/CollectionCreate' + responses: + '200': + description: Successful Response + content: + application/json: + schema: + $ref: '#/components/schemas/Collection' + '422': + description: Validation Error + content: + application/json: + schema: + $ref: '#/components/schemas/HTTPValidationError' + x-codeSamples: + - lang: JavaScript + source: |- + import Honcho from 'honcho'; + + const client = new Honcho({ + apiKey: process.env['HONCHO_API_KEY'], // This is the default and can be omitted + }); + + async function main() { + const collection = await client.apps.users.collections.create('app_id', 'user_id', { name: 'name' }); + + console.log(collection.id); + } + + main(); + - lang: Python + source: |- + import os + from honcho import Honcho + + client = Honcho( + # This is the default and can be omitted + api_key=os.environ.get("HONCHO_API_KEY"), + ) + collection = client.apps.users.collections.create( + user_id="user_id", + app_id="app_id", + name="name", + ) + print(collection.id) + /v1/apps/{app_id}/users/{user_id}/collections/{collection_id}/documents/list: + post: + tags: + - documents + summary: Get Documents + operationId: get_documents_v1_apps__app_id__users__user_id__collections__collection_id__documents_list_post + security: + - HTTPBearer: [] + - {} + parameters: + - name: app_id + in: path + required: true + schema: + type: string + title: App Id + - name: user_id + in: path + required: true + schema: + type: string + title: User Id + - name: collection_id + in: path + required: true + schema: + type: string + title: Collection Id + - name: reverse + in: query + required: false + schema: + anyOf: + - type: boolean + - type: 'null' + default: false + title: Reverse + - name: page + in: query + required: false + schema: + type: integer + minimum: 1 + description: Page number + default: 1 + title: Page + description: Page number + - name: size + in: query + required: false + schema: + type: integer + maximum: 100 + minimum: 1 + description: Page size + default: 50 + title: Size + description: Page size + requestBody: + required: true + content: + application/json: + schema: + $ref: '#/components/schemas/DocumentGet' + responses: + '200': + description: Successful Response + content: + application/json: + schema: + $ref: '#/components/schemas/Page_Document_' + '422': + description: Validation Error + content: + application/json: + schema: + $ref: '#/components/schemas/HTTPValidationError' + x-codeSamples: + - lang: JavaScript + source: |- + import Honcho from 'honcho'; + + const client = new Honcho({ + apiKey: process.env['HONCHO_API_KEY'], // This is the default and can be omitted + }); + + async function main() { + // Automatically fetches more pages as needed. + for await (const document of client.apps.users.collections.documents.list( + 'app_id', + 'user_id', + 'collection_id', + )) { + console.log(document.id); + } + } + + main(); + - lang: Python + source: |- + import os + from honcho import Honcho + + client = Honcho( + # This is the default and can be omitted + api_key=os.environ.get("HONCHO_API_KEY"), + ) + page = client.apps.users.collections.documents.list( + collection_id="collection_id", + app_id="app_id", + user_id="user_id", + ) + page = page.items[0] + print(page.id) + /v1/apps/{app_id}/users/{user_id}/collections/{collection_id}/documents/{document_id}: + get: + tags: + - documents + summary: Get Document + operationId: get_document_v1_apps__app_id__users__user_id__collections__collection_id__documents__document_id__get + security: + - HTTPBearer: [] + - {} + parameters: + - name: app_id + in: path + required: true + schema: + type: string + title: App Id + - name: user_id + in: path + required: true + schema: + type: string + title: User Id + - name: collection_id + in: path + required: true + schema: + type: string + title: Collection Id + - name: document_id + in: path + required: true + schema: + type: string + title: Document Id + responses: + '200': + description: Successful Response + content: + application/json: + schema: + $ref: '#/components/schemas/Document' + '422': + description: Validation Error + content: + application/json: + schema: + $ref: '#/components/schemas/HTTPValidationError' + x-codeSamples: + - lang: JavaScript + source: |- + import Honcho from 'honcho'; + + const client = new Honcho({ + apiKey: process.env['HONCHO_API_KEY'], // This is the default and can be omitted + }); + + async function main() { + const document = await client.apps.users.collections.documents.get( + 'app_id', + 'user_id', + 'collection_id', + 'document_id', + ); + + console.log(document.id); + } + + main(); + - lang: Python + source: |- + import os + from honcho import Honcho + + client = Honcho( + # This is the default and can be omitted + api_key=os.environ.get("HONCHO_API_KEY"), + ) + document = client.apps.users.collections.documents.get( + document_id="document_id", + app_id="app_id", + user_id="user_id", + collection_id="collection_id", + ) + print(document.id) + put: + tags: + - documents + summary: Update Document + operationId: >- + update_document_v1_apps__app_id__users__user_id__collections__collection_id__documents__document_id__put + security: + - HTTPBearer: [] + - {} + parameters: + - name: app_id + in: path + required: true + schema: + type: string + title: App Id + - name: user_id + in: path + required: true + schema: + type: string + title: User Id + - name: collection_id + in: path + required: true + schema: + type: string + title: Collection Id + - name: document_id + in: path + required: true + schema: + type: string + title: Document Id + requestBody: + required: true + content: + application/json: + schema: + $ref: '#/components/schemas/DocumentUpdate' + responses: + '200': + description: Successful Response + content: + application/json: + schema: + $ref: '#/components/schemas/Document' + '422': + description: Validation Error + content: + application/json: + schema: + $ref: '#/components/schemas/HTTPValidationError' + x-codeSamples: + - lang: JavaScript + source: |- + import Honcho from 'honcho'; + + const client = new Honcho({ + apiKey: process.env['HONCHO_API_KEY'], // This is the default and can be omitted + }); + + async function main() { + const document = await client.apps.users.collections.documents.update( + 'app_id', + 'user_id', + 'collection_id', + 'document_id', + ); + + console.log(document.id); + } + + main(); + - lang: Python + source: |- + import os + from honcho import Honcho + + client = Honcho( + # This is the default and can be omitted + api_key=os.environ.get("HONCHO_API_KEY"), + ) + document = client.apps.users.collections.documents.update( + document_id="document_id", + app_id="app_id", + user_id="user_id", + collection_id="collection_id", + ) + print(document.id) + delete: + tags: + - documents + summary: Delete Document + operationId: >- + delete_document_v1_apps__app_id__users__user_id__collections__collection_id__documents__document_id__delete + security: + - HTTPBearer: [] + - {} + parameters: + - name: app_id + in: path + required: true + schema: + type: string + title: App Id + - name: user_id + in: path + required: true + schema: + type: string + title: User Id + - name: collection_id + in: path + required: true + schema: + type: string + title: Collection Id + - name: document_id + in: path + required: true + schema: + type: string + title: Document Id + responses: + '200': + description: Successful Response + content: + application/json: + schema: {} + '422': + description: Validation Error + content: + application/json: + schema: + $ref: '#/components/schemas/HTTPValidationError' + x-codeSamples: + - lang: JavaScript + source: |- + import Honcho from 'honcho'; + + const client = new Honcho({ + apiKey: process.env['HONCHO_API_KEY'], // This is the default and can be omitted + }); + + async function main() { + const document = await client.apps.users.collections.documents.delete( + 'app_id', + 'user_id', + 'collection_id', + 'document_id', + ); + + console.log(document); + } + + main(); + - lang: Python + source: |- + import os + from honcho import Honcho + + client = Honcho( + # This is the default and can be omitted + api_key=os.environ.get("HONCHO_API_KEY"), + ) + document = client.apps.users.collections.documents.delete( + document_id="document_id", + app_id="app_id", + user_id="user_id", + collection_id="collection_id", + ) + print(document) + /v1/apps/{app_id}/users/{user_id}/collections/{collection_id}/documents/query: + get: + tags: + - documents + summary: Query Documents + operationId: query_documents_v1_apps__app_id__users__user_id__collections__collection_id__documents_query_get + security: + - HTTPBearer: [] + - {} + parameters: + - name: app_id + in: path + required: true + schema: + type: string + title: App Id + - name: user_id + in: path + required: true + schema: + type: string + title: User Id + - name: collection_id + in: path + required: true + schema: + type: string + title: Collection Id + - name: query + in: query + required: true + schema: + type: string + title: Query + - name: top_k + in: query + required: false + schema: + type: integer + default: 5 + title: Top K + - name: filter + in: query + required: false + schema: + anyOf: + - type: string + - type: 'null' + title: Filter + responses: + '200': + description: Successful Response + content: + application/json: + schema: + type: array + items: + $ref: '#/components/schemas/Document' + title: >- + Response Query Documents V1 Apps App Id Users User Id Collections Collection Id + Documents Query Get + '422': + description: Validation Error + content: + application/json: + schema: + $ref: '#/components/schemas/HTTPValidationError' + x-codeSamples: + - lang: JavaScript + source: |- + import Honcho from 'honcho'; + + const client = new Honcho({ + apiKey: process.env['HONCHO_API_KEY'], // This is the default and can be omitted + }); + + async function main() { + const documents = await client.apps.users.collections.documents.query( + 'app_id', + 'user_id', + 'collection_id', + { query: 'query' }, + ); + + console.log(documents); + } + + main(); + - lang: Python + source: |- + import os + from honcho import Honcho + + client = Honcho( + # This is the default and can be omitted + api_key=os.environ.get("HONCHO_API_KEY"), + ) + documents = client.apps.users.collections.documents.query( + collection_id="collection_id", + app_id="app_id", + user_id="user_id", + query="query", + ) + print(documents) + /v1/apps/{app_id}/users/{user_id}/collections/{collection_id}/documents: + post: + tags: + - documents + summary: Create Document + operationId: create_document_v1_apps__app_id__users__user_id__collections__collection_id__documents_post + security: + - HTTPBearer: [] + - {} + parameters: + - name: app_id + in: path + required: true + schema: + type: string + title: App Id + - name: user_id + in: path + required: true + schema: + type: string + title: User Id + - name: collection_id + in: path + required: true + schema: + type: string + title: Collection Id + requestBody: + required: true + content: + application/json: + schema: + $ref: '#/components/schemas/DocumentCreate' + responses: + '200': + description: Successful Response + content: + application/json: + schema: + $ref: '#/components/schemas/Document' + '422': + description: Validation Error + content: + application/json: + schema: + $ref: '#/components/schemas/HTTPValidationError' + x-codeSamples: + - lang: JavaScript + source: |- + import Honcho from 'honcho'; + + const client = new Honcho({ + apiKey: process.env['HONCHO_API_KEY'], // This is the default and can be omitted + }); + + async function main() { + const document = await client.apps.users.collections.documents.create( + 'app_id', + 'user_id', + 'collection_id', + { content: 'content' }, + ); + + console.log(document.id); + } + + main(); + - lang: Python + source: |- + import os + from honcho import Honcho + + client = Honcho( + # This is the default and can be omitted + api_key=os.environ.get("HONCHO_API_KEY"), + ) + document = client.apps.users.collections.documents.create( + collection_id="collection_id", + app_id="app_id", + user_id="user_id", + content="content", + ) + print(document.id) +components: + schemas: + AgentChat: + properties: + content: + type: string + title: Content + type: object + required: + - content + title: AgentChat + AgentQuery: + properties: + queries: + anyOf: + - type: string + - items: + type: string + type: array + title: Queries + type: object + required: + - queries + title: AgentQuery + App: + properties: + id: + type: string + title: Id + name: + type: string + title: Name + metadata: + type: object + title: Metadata + additionalProperties: true + created_at: + type: string + format: date-time + title: Created At + type: object + required: + - id + - name + - metadata + - created_at + title: App + exclude: + - h_metadata + - public_id + AppCreate: + properties: + name: + type: string + title: Name + metadata: + type: object + title: Metadata + default: {} + additionalProperties: true + type: object + required: + - name + title: AppCreate + AppUpdate: + properties: + name: + anyOf: + - type: string + - type: 'null' + title: Name + metadata: + anyOf: + - type: object + additionalProperties: true + - type: 'null' + title: Metadata + type: object + title: AppUpdate + Collection: + properties: + id: + type: string + title: Id + name: + type: string + title: Name + user_id: + type: string + title: User Id + metadata: + type: object + title: Metadata + additionalProperties: true + created_at: + type: string + format: date-time + title: Created At + type: object + required: + - id + - name + - user_id + - metadata + - created_at + title: Collection + exclude: + - h_metadata + - public_id + CollectionCreate: + properties: + name: + type: string + title: Name + metadata: + anyOf: + - type: object + additionalProperties: true + - type: 'null' + title: Metadata + default: {} + type: object + required: + - name + title: CollectionCreate + CollectionGet: + properties: + filter: + anyOf: + - type: object + additionalProperties: true + - type: 'null' + title: Filter + type: object + title: CollectionGet + CollectionUpdate: + properties: + name: + anyOf: + - type: string + - type: 'null' + title: Name + metadata: + anyOf: + - type: object + additionalProperties: true + - type: 'null' + title: Metadata + type: object + title: CollectionUpdate + Document: + properties: + id: + type: string + title: Id + content: + type: string + title: Content + metadata: + type: object + title: Metadata + additionalProperties: true + created_at: + type: string + format: date-time + title: Created At + collection_id: + type: string + title: Collection Id + type: object + required: + - id + - content + - metadata + - created_at + - collection_id + title: Document + exclude: + - h_metadata + - public_id + DocumentCreate: + properties: + content: + type: string + title: Content + metadata: + anyOf: + - type: object + additionalProperties: true + - type: 'null' + title: Metadata + default: {} + type: object + required: + - content + title: DocumentCreate + DocumentGet: + properties: + filter: + anyOf: + - type: object + additionalProperties: true + - type: 'null' + title: Filter + type: object + title: DocumentGet + DocumentUpdate: + properties: + metadata: + anyOf: + - type: object + additionalProperties: true + - type: 'null' + title: Metadata + content: + anyOf: + - type: string + - type: 'null' + title: Content + type: object + title: DocumentUpdate + HTTPValidationError: + properties: + detail: + items: + $ref: '#/components/schemas/ValidationError' + type: array + title: Detail + type: object + title: HTTPValidationError + Message: + properties: + id: + type: string + title: Id + content: + type: string + title: Content + is_user: + type: boolean + title: Is User + session_id: + type: string + title: Session Id + metadata: + type: object + title: Metadata + additionalProperties: true + created_at: + type: string + format: date-time + title: Created At + type: object + required: + - id + - content + - is_user + - session_id + - metadata + - created_at + title: Message + exclude: + - h_metadata + - public_id + MessageCreate: + properties: + content: + type: string + title: Content + is_user: + type: boolean + title: Is User + metadata: + type: object + title: Metadata + default: {} + additionalProperties: true + type: object + required: + - content + - is_user + title: MessageCreate + MessageGet: + properties: + filter: + anyOf: + - type: object + additionalProperties: true + - type: 'null' + title: Filter + type: object + title: MessageGet + MessageUpdate: + properties: + metadata: + anyOf: + - type: object + additionalProperties: true + - type: 'null' + title: Metadata + type: object + title: MessageUpdate + Metamessage: + properties: + id: + type: string + title: Id + metamessage_type: + type: string + title: Metamessage Type + content: + type: string + title: Content + message_id: + type: string + title: Message Id + metadata: + type: object + title: Metadata + additionalProperties: true + created_at: + type: string + format: date-time + title: Created At + type: object + required: + - id + - metamessage_type + - content + - message_id + - metadata + - created_at + title: Metamessage + exclude: + - h_metadata + - public_id + MetamessageCreate: + properties: + metamessage_type: + type: string + title: Metamessage Type + content: + type: string + title: Content + message_id: + type: string + title: Message Id + metadata: + anyOf: + - type: object + additionalProperties: true + - type: 'null' + title: Metadata + default: {} + type: object + required: + - metamessage_type + - content + - message_id + title: MetamessageCreate + MetamessageGet: + properties: + metamessage_type: + anyOf: + - type: string + - type: 'null' + title: Metamessage Type + message_id: + anyOf: + - type: string + - type: 'null' + title: Message Id + filter: + anyOf: + - type: object + additionalProperties: true + - type: 'null' + title: Filter + type: object + title: MetamessageGet + MetamessageGetUserLevel: + properties: + filter: + anyOf: + - type: object + additionalProperties: true + - type: 'null' + title: Filter + metamessage_type: + anyOf: + - type: string + - type: 'null' + title: Metamessage Type + type: object + title: MetamessageGetUserLevel + MetamessageUpdate: + properties: + message_id: + type: string + title: Message Id + metamessage_type: + anyOf: + - type: string + - type: 'null' + title: Metamessage Type + metadata: + anyOf: + - type: object + additionalProperties: true + - type: 'null' + title: Metadata + type: object + required: + - message_id + title: MetamessageUpdate + Page_Collection_: + properties: + items: + items: + $ref: '#/components/schemas/Collection' + type: array + title: Items + total: + type: integer + minimum: 0 + title: Total + page: + type: integer + minimum: 1 + title: Page + size: + type: integer + minimum: 1 + title: Size + pages: + type: integer + minimum: 0 + title: Pages + type: object + required: + - items + - total + - page + - size + title: Page[Collection] + Page_Document_: + properties: + items: + items: + $ref: '#/components/schemas/Document' + type: array + title: Items + total: + type: integer + minimum: 0 + title: Total + page: + type: integer + minimum: 1 + title: Page + size: + type: integer + minimum: 1 + title: Size + pages: + type: integer + minimum: 0 + title: Pages + type: object + required: + - items + - total + - page + - size + title: Page[Document] + Page_Message_: + properties: + items: + items: + $ref: '#/components/schemas/Message' + type: array + title: Items + total: + type: integer + minimum: 0 + title: Total + page: + type: integer + minimum: 1 + title: Page + size: + type: integer + minimum: 1 + title: Size + pages: + type: integer + minimum: 0 + title: Pages + type: object + required: + - items + - total + - page + - size + title: Page[Message] + Page_Metamessage_: + properties: + items: + items: + $ref: '#/components/schemas/Metamessage' + type: array + title: Items + total: + type: integer + minimum: 0 + title: Total + page: + type: integer + minimum: 1 + title: Page + size: + type: integer + minimum: 1 + title: Size + pages: + type: integer + minimum: 0 + title: Pages + type: object + required: + - items + - total + - page + - size + title: Page[Metamessage] + Page_Session_: + properties: + items: + items: + $ref: '#/components/schemas/Session' + type: array + title: Items + total: + type: integer + minimum: 0 + title: Total + page: + type: integer + minimum: 1 + title: Page + size: + type: integer + minimum: 1 + title: Size + pages: + type: integer + minimum: 0 + title: Pages + type: object + required: + - items + - total + - page + - size + title: Page[Session] + Page_User_: + properties: + items: + items: + $ref: '#/components/schemas/User' + type: array + title: Items + total: + type: integer + minimum: 0 + title: Total + page: + type: integer + minimum: 1 + title: Page + size: + type: integer + minimum: 1 + title: Size + pages: + type: integer + minimum: 0 + title: Pages + type: object + required: + - items + - total + - page + - size + title: Page[User] + Session: + properties: + id: + type: string + title: Id + is_active: + type: boolean + title: Is Active + user_id: + type: string + title: User Id + metadata: + type: object + title: Metadata + additionalProperties: true + created_at: + type: string + format: date-time + title: Created At + type: object + required: + - id + - is_active + - user_id + - metadata + - created_at + title: Session + exclude: + - h_metadata + - public_id + SessionCreate: + properties: + metadata: + type: object + title: Metadata + default: {} + additionalProperties: true + type: object + title: SessionCreate + SessionGet: + properties: + filter: + anyOf: + - type: object + additionalProperties: true + - type: 'null' + title: Filter + is_active: + type: boolean + title: Is Active + default: false + type: object + title: SessionGet + SessionUpdate: + properties: + metadata: + anyOf: + - type: object + additionalProperties: true + - type: 'null' + title: Metadata + type: object + title: SessionUpdate + User: + properties: + id: + type: string + title: Id + name: + type: string + title: Name + app_id: + type: string + title: App Id + created_at: + type: string + format: date-time + title: Created At + metadata: + type: object + title: Metadata + additionalProperties: true + type: object + required: + - id + - name + - app_id + - created_at + - metadata + title: User + exclude: + - h_metadata + - public_id + UserCreate: + properties: + name: + type: string + title: Name + metadata: + type: object + title: Metadata + default: {} + additionalProperties: true + type: object + required: + - name + title: UserCreate + UserGet: + properties: + filter: + anyOf: + - type: object + additionalProperties: true + - type: 'null' + title: Filter + type: object + title: UserGet + UserUpdate: + properties: + name: + anyOf: + - type: string + - type: 'null' + title: Name + metadata: + anyOf: + - type: object + additionalProperties: true + - type: 'null' + title: Metadata + type: object + title: UserUpdate + ValidationError: + properties: + loc: + items: + anyOf: + - type: string + - type: integer + type: array + title: Location + msg: + type: string + title: Message + type: + type: string + title: Error Type + type: object + required: + - loc + - msg + - type + title: ValidationError + securitySchemes: + HTTPBearer: + type: http + scheme: bearer diff --git a/docs/package.json b/docs/package.json index e8ba319..121be15 100644 --- a/docs/package.json +++ b/docs/package.json @@ -5,7 +5,7 @@ "main": ".pnp.js", "scripts": { "dev": "mintlify dev", - "openapi": "npx @mintlify/scraping openapi-file openapi.json -o api-reference/endpoint", + "openapi": "npx @mintlify/scraping openapi-file openapi.yml -o api-reference/endpoint", "test": "echo \"Error: no test specified\" && exit 1" }, "author": "", diff --git a/pyproject.toml b/pyproject.toml index 1963069..869d87d 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -1,6 +1,6 @@ [project] name = "honcho" -version = "0.0.12" +version = "0.0.13" description = "Honcho Server" authors = [ {name = "Plastic Labs", email = "hello@plasticlabs.ai"}, diff --git a/src/crud.py b/src/crud.py index ce69116..2a49774 100644 --- a/src/crud.py +++ b/src/crud.py @@ -4,9 +4,10 @@ from dotenv import load_dotenv from openai import OpenAI -from sqlalchemy import Select, select +from sqlalchemy import Select, cast, insert, select from sqlalchemy.exc import IntegrityError from sqlalchemy.ext.asyncio import AsyncSession +from sqlalchemy.types import BigInteger from . import models, schemas @@ -269,6 +270,126 @@ async def delete_session( return True +async def clone_session( + db: AsyncSession, + app_id: str, + user_id: str, + original_session_id: str, + cutoff_message_id: Optional[str] = None, + deep_copy: bool = True, +) -> models.Session: + """ + Clone a session and its messages. If cutoff_message_id is provided, + only clone messages up to and including that message. + + Args: + db: SQLAlchemy session + app_id: ID of the app the target session is in + user_id: ID of the user the target session belongs to + original_session_id: ID of the session to clone + cutoff_message_id: Optional ID of the last message to include in the clone + + Returns: + The newly created session + """ + # Get the original session + stmt = ( + select(models.Session) + .join(models.User, models.User.public_id == models.Session.user_id) + .where(models.Session.public_id == original_session_id) + .where(models.Session.user_id == user_id) + .where(models.User.app_id == app_id) + ) + original_session = await db.scalar(stmt) + if not original_session: + raise ValueError("Original session not found") + + # If cutoff_message_id is provided, verify it belongs to the session + cutoff_message = None + if cutoff_message_id is not None: + stmt = select(models.Message).where( + models.Message.public_id == cutoff_message_id, + models.Message.session_id == original_session_id, + ) + cutoff_message = await db.scalar(stmt) + if not cutoff_message: + raise ValueError( + "Message not found or doesn't belong to the specified session" + ) + + # Create new session + new_session = models.Session( + user_id=original_session.user_id, + h_metadata=original_session.h_metadata, + ) + db.add(new_session) + await db.flush() # Flush to get the new session ID + + # Build query for messages to clone + stmt = select(models.Message).where( + models.Message.session_id == original_session_id + ) + if cutoff_message_id is not None and cutoff_message is not None: + stmt = stmt.where(models.Message.id <= cast(cutoff_message.id, BigInteger)) + stmt = stmt.order_by(models.Message.id) + + # Fetch messages to clone + messages_to_clone_scalars = await db.scalars(stmt) + messages_to_clone = messages_to_clone_scalars.all() + + if not messages_to_clone: + return new_session + + # Prepare bulk insert data + new_messages = [ + { + "session_id": new_session.public_id, + "content": message.content, + "is_user": message.is_user, + "h_metadata": message.h_metadata, + } + for message in messages_to_clone + ] + + stmt = insert(models.Message).returning(models.Message.public_id) + result = await db.execute(stmt, new_messages) + new_message_ids = result.scalars().all() + + # Create mapping of old to new message IDs + message_id_map = dict( + zip([message.public_id for message in messages_to_clone], new_message_ids) + ) + + # Handle metamessages if deep copy is requested + if deep_copy and message_id_map: + # Fetch all metamessages in a single query + stmt = select(models.Metamessage).where( + models.Metamessage.message_id.in_(message_id_map.keys()) + ) + metamessages_result = await db.scalars(stmt) + metamessages = metamessages_result.all() + + if metamessages: + # Prepare bulk insert data for metamessages + new_metamessages = [ + { + "message_id": message_id_map[meta.message_id], + "metamessage_type": meta.metamessage_type, + "content": meta.content, + "h_metadata": meta.h_metadata, + } + for meta in metamessages + ] + + # Bulk insert metamessages using modern insert syntax + stmt = insert(models.Metamessage) + await db.execute(stmt, new_metamessages) + + await db.commit() + + return new_session + + ######################################################## # Message Methods ######################################################## diff --git a/src/main.py b/src/main.py index 0077e82..ea76ed3 100644 --- a/src/main.py +++ b/src/main.py @@ -47,7 +47,7 @@ async def lifespan(app: FastAPI): summary="An API for adding personalization to AI Apps", description="""This API is used to store data and get insights about users for AI applications""", - version="0.0.12", + version="0.0.13", contact={ "name": "Plastic Labs", "url": "https://plasticlabs.ai", diff --git a/src/routers/sessions.py b/src/routers/sessions.py index 102d3d1..0a3196d 100644 --- a/src/routers/sessions.py +++ b/src/routers/sessions.py @@ -215,3 +215,22 @@ async def parse_stream(): return StreamingResponse( content=parse_stream(), media_type="text/event-stream", status_code=200 ) + + +@router.get("/{session_id}/clone", response_model=schemas.Session) +async def clone_session( + app_id: str, + user_id: str, + session_id: str, + db=db, + message_id: Optional[str] = None, + deep_copy: bool = False, +): + return await crud.clone_session( + db, + app_id=app_id, + user_id=user_id, + original_session_id=session_id, + cutoff_message_id=message_id, + deep_copy=deep_copy, + ) diff --git a/tests/routes/test_metamessages.py b/tests/routes/test_metamessages.py index 3791b2c..65ec8f6 100644 --- a/tests/routes/test_metamessages.py +++ b/tests/routes/test_metamessages.py @@ -80,25 +80,25 @@ async def test_get_metamessages(client, db_session, sample_data): test_metamessage_1 = models.Metamessage( message_id=test_message.public_id, content="Test Metamessage", - metadata={}, + h_metadata={}, metamessage_type="test_type", ) test_metamessage_2 = models.Metamessage( message_id=test_message.public_id, content="Test Metamessage", - metadata={}, + h_metadata={}, metamessage_type="test_type", ) test_metamessage_3 = models.Metamessage( message_id=test_message.public_id, content="Test Metamessage", - metadata={}, + h_metadata={}, metamessage_type="test_type", ) test_metamessage_4 = models.Metamessage( message_id=test_message.public_id, content="Test Metamessage", - metadata={}, + h_metadata={}, metamessage_type="test_type_2", ) db_session.add(test_metamessage_1) @@ -153,25 +153,25 @@ async def test_get_metamessage_by_user(client, db_session, sample_data): test_metamessage_1 = models.Metamessage( message_id=test_message_1.public_id, content="Test Metamessage", - metadata={}, + h_metadata={}, metamessage_type="test_type", ) test_metamessage_2 = models.Metamessage( message_id=test_message_2.public_id, content="Test Metamessage", - metadata={}, + h_metadata={}, metamessage_type="test_type", ) test_metamessage_3 = models.Metamessage( message_id=test_message_3.public_id, content="Test Metamessage", - metadata={}, + h_metadata={}, metamessage_type="test_type", ) test_metamessage_4 = models.Metamessage( message_id=test_message_3.public_id, content="Test Metamessage", - metadata={}, + h_metadata={}, metamessage_type="test_type_2", ) db_session.add(test_metamessage_1) @@ -186,9 +186,6 @@ async def test_get_metamessage_by_user(client, db_session, sample_data): ) assert response.status_code == 200 data = response.json() - print("=======") - print(data) - print("=======") assert len(data["items"]) > 0 assert len(data["items"]) == 3 assert data["items"][0]["content"] == "Test Metamessage" diff --git a/tests/routes/test_sessions.py b/tests/routes/test_sessions.py index 08b8cbb..a07b641 100644 --- a/tests/routes/test_sessions.py +++ b/tests/routes/test_sessions.py @@ -59,7 +59,7 @@ async def test_get_sessions(client, db_session, sample_data): async def test_empty_update_session(client, db_session, sample_data): test_app, test_user = sample_data # Create a test session - test_session = models.Session(user_id=test_user.public_id, metadata={}) + test_session = models.Session(user_id=test_user.public_id, h_metadata={}) db_session.add(test_session) await db_session.commit() @@ -75,7 +75,7 @@ async def test_update_delete_metadata(client, db_session, sample_data): test_app, test_user = sample_data # Create a test session test_session = models.Session( - user_id=test_user.public_id, metadata={"default": "value"} + user_id=test_user.public_id, h_metadata={"default": "value"} ) db_session.add(test_session) await db_session.commit() @@ -93,7 +93,7 @@ async def test_update_delete_metadata(client, db_session, sample_data): async def test_update_session(client, db_session, sample_data): test_app, test_user = sample_data # Create a test session - test_session = models.Session(user_id=test_user.public_id, metadata={}) + test_session = models.Session(user_id=test_user.public_id, h_metadata={}) db_session.add(test_session) await db_session.commit() @@ -110,7 +110,7 @@ async def test_update_session(client, db_session, sample_data): async def test_delete_session(client, db_session, sample_data): test_app, test_user = sample_data # Create a test session - test_session = models.Session(user_id=test_user.public_id, metadata={}) + test_session = models.Session(user_id=test_user.public_id, h_metadata={}) db_session.add(test_session) await db_session.commit() response = client.delete( @@ -122,3 +122,324 @@ async def test_delete_session(client, db_session, sample_data): ) data = response.json() assert data["is_active"] is False + + +@pytest.mark.asyncio +async def test_clone_session(client, db_session, sample_data): + test_app, test_user = sample_data + # Create a test session + test_session = models.Session( + user_id=test_user.public_id, h_metadata={"test": "key"} + ) + db_session.add(test_session) + await db_session.commit() + + test_message = models.Message( + session_id=test_session.public_id, + content="Test message", + is_user=True, + h_metadata={"key": "value"}, + ) + test_message2 = models.Message( + session_id=test_session.public_id, + content="Test message 2", + is_user=True, + h_metadata={"key": "value2"}, + ) + db_session.add(test_message) + db_session.add(test_message2) + await db_session.commit() + + response = client.get( + f"/v1/apps/{test_app.public_id}/users/{test_user.public_id}/sessions/{test_session.public_id}/clone", + ) + assert response.status_code == 200 + data = response.json() + assert data["metadata"] == {"test": "key"} + + print(data) + + response = client.post( + f"/v1/apps/{test_app.public_id}/users/{test_user.public_id}/sessions/{data['id']}/messages/list", + json={}, + ) + + assert response.status_code == 200 + data = response.json() + assert "items" in data + assert len(data["items"]) > 0 + assert len(data["items"]) == 2 + + assert data["items"][0]["content"] == "Test message" + assert data["items"][0]["is_user"] is True + assert data["items"][0]["metadata"] == {"key": "value"} + + assert data["items"][1]["content"] == "Test message 2" + assert data["items"][1]["is_user"] is True + assert data["items"][1]["metadata"] == {"key": "value2"} + + +@pytest.mark.asyncio +async def test_partial_clone_session(client, db_session, sample_data): + test_app, test_user = sample_data + # Create a test session + test_session = models.Session( + user_id=test_user.public_id, h_metadata={"test": "key"} + ) + db_session.add(test_session) + await db_session.commit() + + test_message = models.Message( + session_id=test_session.public_id, + content="Test message", + is_user=True, + h_metadata={"key": "value"}, + ) + test_message2 = models.Message( + session_id=test_session.public_id, + content="Test message 2", + is_user=True, + h_metadata={"key": "value2"}, + ) + + test_message3 = models.Message( + session_id=test_session.public_id, + content="Test message 2", + is_user=True, + h_metadata={"key": "value2"}, + ) + + db_session.add(test_message) + db_session.add(test_message2) + db_session.add(test_message3) + await db_session.commit() + + response = client.get( + f"/v1/apps/{test_app.public_id}/users/{test_user.public_id}/sessions/{test_session.public_id}/clone?message_id={test_message2.public_id}", + ) + assert response.status_code == 200 + data = response.json() + assert data["metadata"] == {"test": "key"} + + response = client.post( + f"/v1/apps/{test_app.public_id}/users/{test_user.public_id}/sessions/{data['id']}/messages/list", + json={}, + ) + + data = response.json() + assert len(data["items"]) > 0 + assert len(data["items"]) == 2 + + assert data["items"][0]["content"] == "Test message" + assert data["items"][0]["is_user"] is True + assert data["items"][0]["metadata"] == {"key": "value"} + + assert data["items"][1]["content"] == "Test message 2" + assert data["items"][1]["is_user"] is True + assert data["items"][1]["metadata"] == {"key": "value2"} + + +@pytest.mark.asyncio +async def test_deep_clone_session(client, db_session, sample_data): + test_app, test_user = sample_data + # Create a test session + test_session = models.Session( + user_id=test_user.public_id, h_metadata={"test": "key"} + ) + db_session.add(test_session) + await db_session.commit() + + test_message = models.Message( + session_id=test_session.public_id, + content="Test message", + is_user=True, + h_metadata={"key": "value"}, + ) + test_message2 = models.Message( + session_id=test_session.public_id, + content="Test message 2", + is_user=True, + h_metadata={"key": "value2"}, + ) + db_session.add(test_message) + db_session.add(test_message2) + await db_session.commit() + + test_metamessage_1 = models.Metamessage( + message_id=test_message.public_id, + content="Test Metamessage 1", + h_metadata={}, + metamessage_type="test_type", + ) + test_metamessage_2 = models.Metamessage( + message_id=test_message.public_id, + content="Test Metamessage 2", + h_metadata={}, + metamessage_type="test_type", + ) + test_metamessage_3 = models.Metamessage( + message_id=test_message2.public_id, + content="Test Metamessage 3", + h_metadata={}, + metamessage_type="test_type", + ) + test_metamessage_4 = models.Metamessage( + message_id=test_message2.public_id, + content="Test Metamessage 4", + h_metadata={}, + metamessage_type="test_type_2", + ) + + db_session.add(test_metamessage_1) + db_session.add(test_metamessage_2) + db_session.add(test_metamessage_3) + db_session.add(test_metamessage_4) + await db_session.commit() + + response = client.get( + f"/v1/apps/{test_app.public_id}/users/{test_user.public_id}/sessions/{test_session.public_id}/clone?deep_copy=true", + ) + assert response.status_code == 200 + data = response.json() + assert data["metadata"] == {"test": "key"} + + cloned_session_id = data["id"] + + response = client.post( + f"/v1/apps/{test_app.public_id}/users/{test_user.public_id}/sessions/{cloned_session_id}/messages/list", + json={}, + ) + + assert response.status_code == 200 + data = response.json() + assert "items" in data + assert len(data["items"]) > 0 + assert len(data["items"]) == 2 + + assert data["items"][0]["content"] == "Test message" + assert data["items"][0]["is_user"] is True + assert data["items"][0]["metadata"] == {"key": "value"} + + assert data["items"][1]["content"] == "Test message 2" + assert data["items"][1]["is_user"] is True + assert data["items"][1]["metadata"] == {"key": "value2"} + + response = client.post( + f"/v1/apps/{test_app.public_id}/users/{test_user.public_id}/sessions/{cloned_session_id}/metamessages/list", + json={}, + ) + + assert response.status_code == 200 + data = response.json() + assert len(data["items"]) > 0 + assert len(data["items"]) == 4 + assert data["items"][0]["content"] == "Test Metamessage 1" + assert data["items"][0]["metamessage_type"] == "test_type" + assert data["items"][0]["metadata"] == {} + assert data["items"][1]["content"] == "Test Metamessage 2" + assert data["items"][1]["metamessage_type"] == "test_type" + assert data["items"][1]["metadata"] == {} + assert data["items"][2]["content"] == "Test Metamessage 3" + assert data["items"][2]["metamessage_type"] == "test_type" + assert data["items"][2]["metadata"] == {} + assert data["items"][3]["content"] == "Test Metamessage 4" + assert data["items"][3]["metamessage_type"] == "test_type_2" + assert data["items"][3]["metadata"] == {} + + +@pytest.mark.asyncio +async def test_partial_deep_clone_session(client, db_session, sample_data): + test_app, test_user = sample_data + # Create a test session + test_session = models.Session( + user_id=test_user.public_id, h_metadata={"test": "key"} + ) + db_session.add(test_session) + await db_session.commit() + + test_message = models.Message( + session_id=test_session.public_id, + content="Test message", + is_user=True, + h_metadata={"key": "value"}, + ) + test_message2 = models.Message( + session_id=test_session.public_id, + content="Test message 2", + is_user=True, + h_metadata={"key": "value2"}, + ) + db_session.add(test_message) + db_session.add(test_message2) + await db_session.commit() + + test_metamessage_1 = models.Metamessage( + message_id=test_message.public_id, + content="Test Metamessage 1", + h_metadata={}, + metamessage_type="test_type", + ) + test_metamessage_2 = models.Metamessage( + message_id=test_message.public_id, + content="Test Metamessage 2", + h_metadata={}, + metamessage_type="test_type", + ) + test_metamessage_3 = models.Metamessage( + message_id=test_message2.public_id, + content="Test Metamessage 3", + h_metadata={}, + metamessage_type="test_type", + ) + test_metamessage_4 = models.Metamessage( + message_id=test_message2.public_id, + content="Test Metamessage 4", + h_metadata={}, + metamessage_type="test_type_2", + ) + + db_session.add(test_metamessage_1) + db_session.add(test_metamessage_2) + db_session.add(test_metamessage_3) + db_session.add(test_metamessage_4) + await db_session.commit() + + response = client.get( + f"/v1/apps/{test_app.public_id}/users/{test_user.public_id}/sessions/{test_session.public_id}/clone?deep_copy=true&message_id={test_message.public_id}", + ) + assert response.status_code == 200 + data = response.json() + assert data["metadata"] == {"test": "key"} + + cloned_session_id = data["id"] + + response = client.post( + f"/v1/apps/{test_app.public_id}/users/{test_user.public_id}/sessions/{cloned_session_id}/messages/list", + json={}, + ) + + assert response.status_code == 200 + data = response.json() + assert "items" in data + assert len(data["items"]) > 0 + assert len(data["items"]) == 1 + + assert data["items"][0]["content"] == "Test message" + assert data["items"][0]["is_user"] is True + assert data["items"][0]["metadata"] == {"key": "value"} + + response = client.post( + f"/v1/apps/{test_app.public_id}/users/{test_user.public_id}/sessions/{cloned_session_id}/metamessages/list", + json={}, + ) + + assert response.status_code == 200 + data = response.json() + assert len(data["items"]) > 0 + assert len(data["items"]) == 2 + assert data["items"][0]["content"] == "Test Metamessage 1" + assert data["items"][0]["metamessage_type"] == "test_type" + assert data["items"][0]["metadata"] == {} + assert data["items"][1]["content"] == "Test Metamessage 2" + assert data["items"][1]["metamessage_type"] == "test_type" + assert data["items"][1]["metadata"] == {} diff --git a/uv.lock b/uv.lock index 56a1e44..40a79ad 100644 --- a/uv.lock +++ b/uv.lock @@ -425,7 +425,7 @@ wheels = [ [[package]] name = "honcho" -version = "0.0.12" +version = "0.0.13" source = { virtual = "." } dependencies = [ { name = "anthropic" },