summaryrefslogtreecommitdiffhomepage
path: root/pkg
diff options
context:
space:
mode:
authorDax Raad <[email protected]>2025-05-29 11:38:55 -0400
committerDax Raad <[email protected]>2025-05-29 11:38:55 -0400
commit48f81fe4d3a286ead827888e030f9bd89c864dee (patch)
tree5715dd3b6a923cab8ce4155f5c66ca54661e6dce /pkg
parenta96c2ce65c8e87431dce84f0466abb9769e2f7fd (diff)
downloadopencode-48f81fe4d3a286ead827888e030f9bd89c864dee.tar.gz
opencode-48f81fe4d3a286ead827888e030f9bd89c864dee.zip
sync
Diffstat (limited to 'pkg')
-rw-r--r--pkg/client/gen/openapi.json141
-rw-r--r--pkg/client/generated-client.go57
2 files changed, 80 insertions, 118 deletions
diff --git a/pkg/client/gen/openapi.json b/pkg/client/gen/openapi.json
index 274c6c7d6..4e6506e73 100644
--- a/pkg/client/gen/openapi.json
+++ b/pkg/client/gen/openapi.json
@@ -33,7 +33,7 @@
"content": {
"application/json": {
"schema": {
- "$ref": "#/components/schemas/Session.Info"
+ "$ref": "#/components/schemas/session.info"
}
}
}
@@ -52,7 +52,7 @@
"content": {
"application/json": {
"schema": {
- "$ref": "#/components/schemas/Session.Info"
+ "$ref": "#/components/schemas/session.info"
}
}
}
@@ -129,23 +129,7 @@
"schema": {
"type": "array",
"items": {
- "type": "object",
- "properties": {
- "id": {
- "type": "string",
- "pattern": "^ses"
- },
- "shareID": {
- "type": "string"
- },
- "title": {
- "type": "string"
- }
- },
- "required": [
- "id",
- "title"
- ]
+ "$ref": "#/components/schemas/session.info"
}
}
}
@@ -254,7 +238,7 @@
"schema": {
"type": "object",
"additionalProperties": {
- "$ref": "#/components/schemas/Provider.Info"
+ "$ref": "#/components/schemas/provider"
}
}
}
@@ -724,23 +708,7 @@
"type": "object",
"properties": {
"info": {
- "type": "object",
- "properties": {
- "id": {
- "type": "string",
- "pattern": "^ses"
- },
- "shareID": {
- "type": "string"
- },
- "title": {
- "type": "string"
- }
- },
- "required": [
- "id",
- "title"
- ]
+ "$ref": "#/components/schemas/session.info"
}
},
"required": [
@@ -753,7 +721,7 @@
"properties"
]
},
- "Session.Info": {
+ "session.info": {
"type": "object",
"properties": {
"id": {
@@ -772,7 +740,7 @@
"title"
]
},
- "Provider.Info": {
+ "provider": {
"type": "object",
"properties": {
"options": {
@@ -782,58 +750,61 @@
"models": {
"type": "object",
"additionalProperties": {
- "type": "object",
- "properties": {
- "name": {
- "type": "string"
- },
- "cost": {
- "type": "object",
- "properties": {
- "input": {
- "type": "number"
- },
- "inputCached": {
- "type": "number"
- },
- "output": {
- "type": "number"
- },
- "outputCached": {
- "type": "number"
- }
- },
- "required": [
- "input",
- "inputCached",
- "output",
- "outputCached"
- ]
- },
- "contextWindow": {
- "type": "number"
- },
- "maxTokens": {
- "type": "number"
- },
- "attachment": {
- "type": "boolean"
- },
- "reasoning": {
- "type": "boolean"
- }
- },
- "required": [
- "cost",
- "contextWindow",
- "attachment"
- ]
+ "$ref": "#/components/schemas/model"
}
}
},
"required": [
"models"
]
+ },
+ "model": {
+ "type": "object",
+ "properties": {
+ "name": {
+ "type": "string"
+ },
+ "cost": {
+ "type": "object",
+ "properties": {
+ "input": {
+ "type": "number"
+ },
+ "inputCached": {
+ "type": "number"
+ },
+ "output": {
+ "type": "number"
+ },
+ "outputCached": {
+ "type": "number"
+ }
+ },
+ "required": [
+ "input",
+ "inputCached",
+ "output",
+ "outputCached"
+ ]
+ },
+ "contextWindow": {
+ "type": "number"
+ },
+ "maxTokens": {
+ "type": "number"
+ },
+ "attachment": {
+ "type": "boolean"
+ },
+ "reasoning": {
+ "type": "boolean"
+ }
+ },
+ "required": [
+ "cost",
+ "contextWindow",
+ "attachment"
+ ]
}
}
}
diff --git a/pkg/client/generated-client.go b/pkg/client/generated-client.go
index 7af8b48fd..0fce536e7 100644
--- a/pkg/client/generated-client.go
+++ b/pkg/client/generated-client.go
@@ -49,11 +49,7 @@ type EventMessageUpdated struct {
// EventSessionUpdated defines model for Event.session.updated.
type EventSessionUpdated struct {
Properties struct {
- Info struct {
- Id string `json:"id"`
- ShareID *string `json:"shareID,omitempty"`
- Title string `json:"title"`
- } `json:"info"`
+ Info SessionInfo `json:"info"`
} `json:"properties"`
Type string `json:"type"`
}
@@ -174,25 +170,28 @@ type MessageToolInvocationToolResult struct {
ToolName string `json:"toolName"`
}
-// ProviderInfo defines model for Provider.Info.
-type ProviderInfo struct {
- Models map[string]struct {
- Attachment bool `json:"attachment"`
- ContextWindow float32 `json:"contextWindow"`
- Cost struct {
- Input float32 `json:"input"`
- InputCached float32 `json:"inputCached"`
- Output float32 `json:"output"`
- OutputCached float32 `json:"outputCached"`
- } `json:"cost"`
- MaxTokens *float32 `json:"maxTokens,omitempty"`
- Name *string `json:"name,omitempty"`
- Reasoning *bool `json:"reasoning,omitempty"`
- } `json:"models"`
+// Model defines model for model.
+type Model struct {
+ Attachment bool `json:"attachment"`
+ ContextWindow float32 `json:"contextWindow"`
+ Cost struct {
+ Input float32 `json:"input"`
+ InputCached float32 `json:"inputCached"`
+ Output float32 `json:"output"`
+ OutputCached float32 `json:"outputCached"`
+ } `json:"cost"`
+ MaxTokens *float32 `json:"maxTokens,omitempty"`
+ Name *string `json:"name,omitempty"`
+ Reasoning *bool `json:"reasoning,omitempty"`
+}
+
+// Provider defines model for provider.
+type Provider struct {
+ Models map[string]Model `json:"models"`
Options *map[string]interface{} `json:"options,omitempty"`
}
-// SessionInfo defines model for Session.Info.
+// SessionInfo defines model for session.info.
type SessionInfo struct {
Id string `json:"id"`
ShareID *string `json:"shareID,omitempty"`
@@ -1330,7 +1329,7 @@ func (r GetEventResponse) StatusCode() int {
type PostProviderListResponse struct {
Body []byte
HTTPResponse *http.Response
- JSON200 *map[string]ProviderInfo
+ JSON200 *map[string]Provider
}
// Status returns HTTPResponse.Status
@@ -1418,11 +1417,7 @@ func (r PostSessionCreateResponse) StatusCode() int {
type PostSessionListResponse struct {
Body []byte
HTTPResponse *http.Response
- JSON200 *[]struct {
- Id string `json:"id"`
- ShareID *string `json:"shareID,omitempty"`
- Title string `json:"title"`
- }
+ JSON200 *[]SessionInfo
}
// Status returns HTTPResponse.Status
@@ -1630,7 +1625,7 @@ func ParsePostProviderListResponse(rsp *http.Response) (*PostProviderListRespons
switch {
case strings.Contains(rsp.Header.Get("Content-Type"), "json") && rsp.StatusCode == 200:
- var dest map[string]ProviderInfo
+ var dest map[string]Provider
if err := json.Unmarshal(bodyBytes, &dest); err != nil {
return nil, err
}
@@ -1734,11 +1729,7 @@ func ParsePostSessionListResponse(rsp *http.Response) (*PostSessionListResponse,
switch {
case strings.Contains(rsp.Header.Get("Content-Type"), "json") && rsp.StatusCode == 200:
- var dest []struct {
- Id string `json:"id"`
- ShareID *string `json:"shareID,omitempty"`
- Title string `json:"title"`
- }
+ var dest []SessionInfo
if err := json.Unmarshal(bodyBytes, &dest); err != nil {
return nil, err
}