summaryrefslogtreecommitdiffhomepage
path: root/packages/sdk
diff options
context:
space:
mode:
authorTommy D. Rossi <[email protected]>2025-12-20 16:00:20 +0100
committeropencode <[email protected]>2025-12-20 15:00:41 +0000
commita7a2bbb497f9c8775bc93cbfd9c2964fe3472d79 (patch)
treea9ccab518932c17d38172c05b5de5581c20d3a6b /packages/sdk
parent6e93d14bdba29015ed8fe617bcc26d459c33a5b2 (diff)
downloadopencode-a7a2bbb497f9c8775bc93cbfd9c2964fe3472d79.tar.gz
opencode-a7a2bbb497f9c8775bc93cbfd9c2964fe3472d79.zip
feat: add endpoints to delete and update message parts (#5433)
Diffstat (limited to 'packages/sdk')
-rw-r--r--packages/sdk/js/src/v2/gen/sdk.gen.ts80
-rw-r--r--packages/sdk/js/src/v2/gen/types.gen.ts88
-rw-r--r--packages/sdk/openapi.json167
3 files changed, 335 insertions, 0 deletions
diff --git a/packages/sdk/js/src/v2/gen/sdk.gen.ts b/packages/sdk/js/src/v2/gen/sdk.gen.ts
index 16fe07ae4..1a7128e24 100644
--- a/packages/sdk/js/src/v2/gen/sdk.gen.ts
+++ b/packages/sdk/js/src/v2/gen/sdk.gen.ts
@@ -47,6 +47,11 @@ import type {
McpLocalConfig,
McpRemoteConfig,
McpStatusResponses,
+ Part as Part2,
+ PartDeleteErrors,
+ PartDeleteResponses,
+ PartUpdateErrors,
+ PartUpdateResponses,
PathGetResponses,
PermissionRespondErrors,
PermissionRespondResponses,
@@ -1486,6 +1491,79 @@ export class Session extends HeyApiClient {
}
}
+export class Part extends HeyApiClient {
+ /**
+ * Delete a part from a message
+ */
+ public delete<ThrowOnError extends boolean = false>(
+ parameters: {
+ sessionID: string
+ messageID: string
+ partID: string
+ directory?: string
+ },
+ options?: Options<never, ThrowOnError>,
+ ) {
+ const params = buildClientParams(
+ [parameters],
+ [
+ {
+ args: [
+ { in: "path", key: "sessionID" },
+ { in: "path", key: "messageID" },
+ { in: "path", key: "partID" },
+ { in: "query", key: "directory" },
+ ],
+ },
+ ],
+ )
+ return (options?.client ?? this.client).delete<PartDeleteResponses, PartDeleteErrors, ThrowOnError>({
+ url: "/session/{sessionID}/message/{messageID}/part/{partID}",
+ ...options,
+ ...params,
+ })
+ }
+
+ /**
+ * Update a part in a message
+ */
+ public update<ThrowOnError extends boolean = false>(
+ parameters: {
+ sessionID: string
+ messageID: string
+ partID: string
+ directory?: string
+ part?: Part2
+ },
+ options?: Options<never, ThrowOnError>,
+ ) {
+ const params = buildClientParams(
+ [parameters],
+ [
+ {
+ args: [
+ { in: "path", key: "sessionID" },
+ { in: "path", key: "messageID" },
+ { in: "path", key: "partID" },
+ { in: "query", key: "directory" },
+ { key: "part", map: "body" },
+ ],
+ },
+ ],
+ )
+ return (options?.client ?? this.client).patch<PartUpdateResponses, PartUpdateErrors, ThrowOnError>({
+ url: "/session/{sessionID}/message/{messageID}/part/{partID}",
+ ...options,
+ ...params,
+ headers: {
+ "Content-Type": "application/json",
+ ...options?.headers,
+ ...params.headers,
+ },
+ })
+ }
+}
+
export class Permission extends HeyApiClient {
/**
* Respond to permission
@@ -2588,6 +2666,8 @@ export class OpencodeClient extends HeyApiClient {
session = new Session({ client: this.client })
+ part = new Part({ client: this.client })
+
permission = new Permission({ client: this.client })
command = new Command({ client: this.client })
diff --git a/packages/sdk/js/src/v2/gen/types.gen.ts b/packages/sdk/js/src/v2/gen/types.gen.ts
index c96530737..cdbdfdfda 100644
--- a/packages/sdk/js/src/v2/gen/types.gen.ts
+++ b/packages/sdk/js/src/v2/gen/types.gen.ts
@@ -2915,6 +2915,94 @@ export type SessionMessageResponses = {
export type SessionMessageResponse = SessionMessageResponses[keyof SessionMessageResponses]
+export type PartDeleteData = {
+ body?: never
+ path: {
+ /**
+ * Session ID
+ */
+ sessionID: string
+ /**
+ * Message ID
+ */
+ messageID: string
+ /**
+ * Part ID
+ */
+ partID: string
+ }
+ query?: {
+ directory?: string
+ }
+ url: "/session/{sessionID}/message/{messageID}/part/{partID}"
+}
+
+export type PartDeleteErrors = {
+ /**
+ * Bad request
+ */
+ 400: BadRequestError
+ /**
+ * Not found
+ */
+ 404: NotFoundError
+}
+
+export type PartDeleteError = PartDeleteErrors[keyof PartDeleteErrors]
+
+export type PartDeleteResponses = {
+ /**
+ * Successfully deleted part
+ */
+ 200: boolean
+}
+
+export type PartDeleteResponse = PartDeleteResponses[keyof PartDeleteResponses]
+
+export type PartUpdateData = {
+ body?: Part
+ path: {
+ /**
+ * Session ID
+ */
+ sessionID: string
+ /**
+ * Message ID
+ */
+ messageID: string
+ /**
+ * Part ID
+ */
+ partID: string
+ }
+ query?: {
+ directory?: string
+ }
+ url: "/session/{sessionID}/message/{messageID}/part/{partID}"
+}
+
+export type PartUpdateErrors = {
+ /**
+ * Bad request
+ */
+ 400: BadRequestError
+ /**
+ * Not found
+ */
+ 404: NotFoundError
+}
+
+export type PartUpdateError = PartUpdateErrors[keyof PartUpdateErrors]
+
+export type PartUpdateResponses = {
+ /**
+ * Successfully updated part
+ */
+ 200: Part
+}
+
+export type PartUpdateResponse = PartUpdateResponses[keyof PartUpdateResponses]
+
export type SessionPromptAsyncData = {
body?: {
messageID?: string
diff --git a/packages/sdk/openapi.json b/packages/sdk/openapi.json
index 09c7ea8e9..eeb81a844 100644
--- a/packages/sdk/openapi.json
+++ b/packages/sdk/openapi.json
@@ -2126,6 +2126,173 @@
]
}
},
+ "/session/{sessionID}/message/{messageID}/part/{partID}": {
+ "delete": {
+ "operationId": "part.delete",
+ "parameters": [
+ {
+ "in": "query",
+ "name": "directory",
+ "schema": {
+ "type": "string"
+ }
+ },
+ {
+ "in": "path",
+ "name": "sessionID",
+ "schema": {
+ "type": "string"
+ },
+ "required": true,
+ "description": "Session ID"
+ },
+ {
+ "in": "path",
+ "name": "messageID",
+ "schema": {
+ "type": "string"
+ },
+ "required": true,
+ "description": "Message ID"
+ },
+ {
+ "in": "path",
+ "name": "partID",
+ "schema": {
+ "type": "string"
+ },
+ "required": true,
+ "description": "Part ID"
+ }
+ ],
+ "description": "Delete a part from a message",
+ "responses": {
+ "200": {
+ "description": "Successfully deleted part",
+ "content": {
+ "application/json": {
+ "schema": {
+ "type": "boolean"
+ }
+ }
+ }
+ },
+ "400": {
+ "description": "Bad request",
+ "content": {
+ "application/json": {
+ "schema": {
+ "$ref": "#/components/schemas/BadRequestError"
+ }
+ }
+ }
+ },
+ "404": {
+ "description": "Not found",
+ "content": {
+ "application/json": {
+ "schema": {
+ "$ref": "#/components/schemas/NotFoundError"
+ }
+ }
+ }
+ }
+ },
+ "x-codeSamples": [
+ {
+ "lang": "js",
+ "source": "import { createOpencodeClient } from \"@opencode-ai/sdk\n\nconst client = createOpencodeClient()\nawait client.part.delete({\n ...\n})"
+ }
+ ]
+ },
+ "patch": {
+ "operationId": "part.update",
+ "parameters": [
+ {
+ "in": "query",
+ "name": "directory",
+ "schema": {
+ "type": "string"
+ }
+ },
+ {
+ "in": "path",
+ "name": "sessionID",
+ "schema": {
+ "type": "string"
+ },
+ "required": true,
+ "description": "Session ID"
+ },
+ {
+ "in": "path",
+ "name": "messageID",
+ "schema": {
+ "type": "string"
+ },
+ "required": true,
+ "description": "Message ID"
+ },
+ {
+ "in": "path",
+ "name": "partID",
+ "schema": {
+ "type": "string"
+ },
+ "required": true,
+ "description": "Part ID"
+ }
+ ],
+ "description": "Update a part in a message",
+ "responses": {
+ "200": {
+ "description": "Successfully updated part",
+ "content": {
+ "application/json": {
+ "schema": {
+ "$ref": "#/components/schemas/Part"
+ }
+ }
+ }
+ },
+ "400": {
+ "description": "Bad request",
+ "content": {
+ "application/json": {
+ "schema": {
+ "$ref": "#/components/schemas/BadRequestError"
+ }
+ }
+ }
+ },
+ "404": {
+ "description": "Not found",
+ "content": {
+ "application/json": {
+ "schema": {
+ "$ref": "#/components/schemas/NotFoundError"
+ }
+ }
+ }
+ }
+ },
+ "requestBody": {
+ "content": {
+ "application/json": {
+ "schema": {
+ "$ref": "#/components/schemas/Part"
+ }
+ }
+ }
+ },
+ "x-codeSamples": [
+ {
+ "lang": "js",
+ "source": "import { createOpencodeClient } from \"@opencode-ai/sdk\n\nconst client = createOpencodeClient()\nawait client.part.update({\n ...\n})"
+ }
+ ]
+ }
+ },
"/session/{sessionID}/prompt_async": {
"post": {
"operationId": "session.prompt_async",