summaryrefslogtreecommitdiffhomepage
path: root/pkg/client/generated-client.go
diff options
context:
space:
mode:
authorDax Raad <[email protected]>2025-05-28 13:22:48 -0400
committerDax Raad <[email protected]>2025-05-28 13:22:48 -0400
commit3a4d3b249f4b529ead2f80dd0df19a9cdc0c10a6 (patch)
treebb77726cba6875a6daa8fe6230d9a2826fab83ed /pkg/client/generated-client.go
parent55a6fcdd3f5b3c55712e5cfc9dd4d994da38d4c8 (diff)
downloadopencode-3a4d3b249f4b529ead2f80dd0df19a9cdc0c10a6.tar.gz
opencode-3a4d3b249f4b529ead2f80dd0df19a9cdc0c10a6.zip
generate message type
Diffstat (limited to 'pkg/client/generated-client.go')
-rw-r--r--pkg/client/generated-client.go405
1 files changed, 399 insertions, 6 deletions
diff --git a/pkg/client/generated-client.go b/pkg/client/generated-client.go
index 89d6a9273..14d2c56e6 100644
--- a/pkg/client/generated-client.go
+++ b/pkg/client/generated-client.go
@@ -12,6 +12,15 @@ import (
"net/http"
"net/url"
"strings"
+
+ "github.com/oapi-codegen/runtime"
+)
+
+// Defines values for SessionMessageRole.
+const (
+ Assistant SessionMessageRole = "assistant"
+ System SessionMessageRole = "system"
+ User SessionMessageRole = "user"
)
// ProviderInfo defines model for Provider.Info.
@@ -43,12 +52,116 @@ type SessionInfo struct {
} `json:"tokens"`
}
+// SessionMessage defines model for Session.Message.
+type SessionMessage struct {
+ Id string `json:"id"`
+ Metadata struct {
+ SessionID string `json:"sessionID"`
+ Time struct {
+ Completed *float32 `json:"completed,omitempty"`
+ Created float32 `json:"created"`
+ } `json:"time"`
+ Tool map[string]interface{} `json:"tool"`
+ } `json:"metadata"`
+ Parts []SessionMessagePart `json:"parts"`
+ Role SessionMessageRole `json:"role"`
+}
+
+// SessionMessageRole defines model for SessionMessage.Role.
+type SessionMessageRole string
+
+// SessionMessagePart defines model for Session.Message.Part.
+type SessionMessagePart struct {
+ union json.RawMessage
+}
+
+// SessionMessagePartData defines model for Session.Message.Part.Data.
+type SessionMessagePartData struct {
+ Data *interface{} `json:"data,omitempty"`
+ Id *string `json:"id,omitempty"`
+ Type *interface{} `json:"type,omitempty"`
+}
+
+// SessionMessagePartFile defines model for Session.Message.Part.File.
+type SessionMessagePartFile struct {
+ Filename *string `json:"filename,omitempty"`
+ MediaType string `json:"mediaType"`
+ Type string `json:"type"`
+ Url string `json:"url"`
+}
+
+// SessionMessagePartReasoning defines model for Session.Message.Part.Reasoning.
+type SessionMessagePartReasoning struct {
+ ProviderMetadata *map[string]interface{} `json:"providerMetadata,omitempty"`
+ Text string `json:"text"`
+ Type string `json:"type"`
+}
+
+// SessionMessagePartSourceUrl defines model for Session.Message.Part.SourceUrl.
+type SessionMessagePartSourceUrl struct {
+ ProviderMetadata *map[string]interface{} `json:"providerMetadata,omitempty"`
+ SourceId string `json:"sourceId"`
+ Title *string `json:"title,omitempty"`
+ Type string `json:"type"`
+ Url string `json:"url"`
+}
+
+// SessionMessagePartStepStart defines model for Session.Message.Part.StepStart.
+type SessionMessagePartStepStart struct {
+ Type string `json:"type"`
+}
+
+// SessionMessagePartText defines model for Session.Message.Part.Text.
+type SessionMessagePartText struct {
+ Text string `json:"text"`
+ Type string `json:"type"`
+}
+
+// SessionMessagePartToolInvocation defines model for Session.Message.Part.ToolInvocation.
+type SessionMessagePartToolInvocation struct {
+ ToolInvocation SessionMessageToolInvocation `json:"toolInvocation"`
+ Type string `json:"type"`
+}
+
+// SessionMessageToolInvocation defines model for Session.Message.ToolInvocation.
+type SessionMessageToolInvocation struct {
+ union json.RawMessage
+}
+
+// SessionMessageToolInvocationToolCall defines model for Session.Message.ToolInvocation.ToolCall.
+type SessionMessageToolInvocationToolCall struct {
+ Args map[string]interface{} `json:"args"`
+ State string `json:"state"`
+ Step *float32 `json:"step,omitempty"`
+ ToolCallId string `json:"toolCallId"`
+ ToolName string `json:"toolName"`
+}
+
+// SessionMessageToolInvocationToolPartialCall defines model for Session.Message.ToolInvocation.ToolPartialCall.
+type SessionMessageToolInvocationToolPartialCall struct {
+ Args map[string]interface{} `json:"args"`
+ State string `json:"state"`
+ Step *float32 `json:"step,omitempty"`
+ ToolCallId string `json:"toolCallId"`
+ ToolName string `json:"toolName"`
+}
+
+// SessionMessageToolInvocationToolResult defines model for Session.Message.ToolInvocation.ToolResult.
+type SessionMessageToolInvocationToolResult struct {
+ Args map[string]interface{} `json:"args"`
+ Result string `json:"result"`
+ State string `json:"state"`
+ Step *float32 `json:"step,omitempty"`
+ ToolCallId string `json:"toolCallId"`
+ ToolName string `json:"toolName"`
+}
+
// PostSessionChatJSONBody defines parameters for PostSessionChat.
type PostSessionChatJSONBody struct {
- ModelID string `json:"modelID"`
- Parts *interface{} `json:"parts,omitempty"`
- ProviderID string `json:"providerID"`
- SessionID string `json:"sessionID"`
+ ModelID string `json:"modelID"`
+ Parts []SessionMessagePart `json:"parts"`
+ ProviderID string `json:"providerID"`
+ SessionID string `json:"sessionID"`
}
// PostSessionMessagesJSONBody defines parameters for PostSessionMessages.
@@ -70,6 +183,286 @@ type PostSessionMessagesJSONRequestBody PostSessionMessagesJSONBody
// PostSessionShareJSONRequestBody defines body for PostSessionShare for application/json ContentType.
type PostSessionShareJSONRequestBody PostSessionShareJSONBody
+// AsSessionMessagePartText returns the union data inside the SessionMessagePart as a SessionMessagePartText
+func (t SessionMessagePart) AsSessionMessagePartText() (SessionMessagePartText, error) {
+ var body SessionMessagePartText
+ err := json.Unmarshal(t.union, &body)
+ return body, err
+}
+
+// FromSessionMessagePartText overwrites any union data inside the SessionMessagePart as the provided SessionMessagePartText
+func (t *SessionMessagePart) FromSessionMessagePartText(v SessionMessagePartText) error {
+ b, err := json.Marshal(v)
+ t.union = b
+ return err
+}
+
+// MergeSessionMessagePartText performs a merge with any union data inside the SessionMessagePart, using the provided SessionMessagePartText
+func (t *SessionMessagePart) MergeSessionMessagePartText(v SessionMessagePartText) error {
+ b, err := json.Marshal(v)
+ if err != nil {
+ return err
+ }
+
+ merged, err := runtime.JSONMerge(t.union, b)
+ t.union = merged
+ return err
+}
+
+// AsSessionMessagePartReasoning returns the union data inside the SessionMessagePart as a SessionMessagePartReasoning
+func (t SessionMessagePart) AsSessionMessagePartReasoning() (SessionMessagePartReasoning, error) {
+ var body SessionMessagePartReasoning
+ err := json.Unmarshal(t.union, &body)
+ return body, err
+}
+
+// FromSessionMessagePartReasoning overwrites any union data inside the SessionMessagePart as the provided SessionMessagePartReasoning
+func (t *SessionMessagePart) FromSessionMessagePartReasoning(v SessionMessagePartReasoning) error {
+ b, err := json.Marshal(v)
+ t.union = b
+ return err
+}
+
+// MergeSessionMessagePartReasoning performs a merge with any union data inside the SessionMessagePart, using the provided SessionMessagePartReasoning
+func (t *SessionMessagePart) MergeSessionMessagePartReasoning(v SessionMessagePartReasoning) error {
+ b, err := json.Marshal(v)
+ if err != nil {
+ return err
+ }
+
+ merged, err := runtime.JSONMerge(t.union, b)
+ t.union = merged
+ return err
+}
+
+// AsSessionMessagePartToolInvocation returns the union data inside the SessionMessagePart as a SessionMessagePartToolInvocation
+func (t SessionMessagePart) AsSessionMessagePartToolInvocation() (SessionMessagePartToolInvocation, error) {
+ var body SessionMessagePartToolInvocation
+ err := json.Unmarshal(t.union, &body)
+ return body, err
+}
+
+// FromSessionMessagePartToolInvocation overwrites any union data inside the SessionMessagePart as the provided SessionMessagePartToolInvocation
+func (t *SessionMessagePart) FromSessionMessagePartToolInvocation(v SessionMessagePartToolInvocation) error {
+ b, err := json.Marshal(v)
+ t.union = b
+ return err
+}
+
+// MergeSessionMessagePartToolInvocation performs a merge with any union data inside the SessionMessagePart, using the provided SessionMessagePartToolInvocation
+func (t *SessionMessagePart) MergeSessionMessagePartToolInvocation(v SessionMessagePartToolInvocation) error {
+ b, err := json.Marshal(v)
+ if err != nil {
+ return err
+ }
+
+ merged, err := runtime.JSONMerge(t.union, b)
+ t.union = merged
+ return err
+}
+
+// AsSessionMessagePartSourceUrl returns the union data inside the SessionMessagePart as a SessionMessagePartSourceUrl
+func (t SessionMessagePart) AsSessionMessagePartSourceUrl() (SessionMessagePartSourceUrl, error) {
+ var body SessionMessagePartSourceUrl
+ err := json.Unmarshal(t.union, &body)
+ return body, err
+}
+
+// FromSessionMessagePartSourceUrl overwrites any union data inside the SessionMessagePart as the provided SessionMessagePartSourceUrl
+func (t *SessionMessagePart) FromSessionMessagePartSourceUrl(v SessionMessagePartSourceUrl) error {
+ b, err := json.Marshal(v)
+ t.union = b
+ return err
+}
+
+// MergeSessionMessagePartSourceUrl performs a merge with any union data inside the SessionMessagePart, using the provided SessionMessagePartSourceUrl
+func (t *SessionMessagePart) MergeSessionMessagePartSourceUrl(v SessionMessagePartSourceUrl) error {
+ b, err := json.Marshal(v)
+ if err != nil {
+ return err
+ }
+
+ merged, err := runtime.JSONMerge(t.union, b)
+ t.union = merged
+ return err
+}
+
+// AsSessionMessagePartFile returns the union data inside the SessionMessagePart as a SessionMessagePartFile
+func (t SessionMessagePart) AsSessionMessagePartFile() (SessionMessagePartFile, error) {
+ var body SessionMessagePartFile
+ err := json.Unmarshal(t.union, &body)
+ return body, err
+}
+
+// FromSessionMessagePartFile overwrites any union data inside the SessionMessagePart as the provided SessionMessagePartFile
+func (t *SessionMessagePart) FromSessionMessagePartFile(v SessionMessagePartFile) error {
+ b, err := json.Marshal(v)
+ t.union = b
+ return err
+}
+
+// MergeSessionMessagePartFile performs a merge with any union data inside the SessionMessagePart, using the provided SessionMessagePartFile
+func (t *SessionMessagePart) MergeSessionMessagePartFile(v SessionMessagePartFile) error {
+ b, err := json.Marshal(v)
+ if err != nil {
+ return err
+ }
+
+ merged, err := runtime.JSONMerge(t.union, b)
+ t.union = merged
+ return err
+}
+
+// AsSessionMessagePartStepStart returns the union data inside the SessionMessagePart as a SessionMessagePartStepStart
+func (t SessionMessagePart) AsSessionMessagePartStepStart() (SessionMessagePartStepStart, error) {
+ var body SessionMessagePartStepStart
+ err := json.Unmarshal(t.union, &body)
+ return body, err
+}
+
+// FromSessionMessagePartStepStart overwrites any union data inside the SessionMessagePart as the provided SessionMessagePartStepStart
+func (t *SessionMessagePart) FromSessionMessagePartStepStart(v SessionMessagePartStepStart) error {
+ b, err := json.Marshal(v)
+ t.union = b
+ return err
+}
+
+// MergeSessionMessagePartStepStart performs a merge with any union data inside the SessionMessagePart, using the provided SessionMessagePartStepStart
+func (t *SessionMessagePart) MergeSessionMessagePartStepStart(v SessionMessagePartStepStart) error {
+ b, err := json.Marshal(v)
+ if err != nil {
+ return err
+ }
+
+ merged, err := runtime.JSONMerge(t.union, b)
+ t.union = merged
+ return err
+}
+
+// AsSessionMessagePartData returns the union data inside the SessionMessagePart as a SessionMessagePartData
+func (t SessionMessagePart) AsSessionMessagePartData() (SessionMessagePartData, error) {
+ var body SessionMessagePartData
+ err := json.Unmarshal(t.union, &body)
+ return body, err
+}
+
+// FromSessionMessagePartData overwrites any union data inside the SessionMessagePart as the provided SessionMessagePartData
+func (t *SessionMessagePart) FromSessionMessagePartData(v SessionMessagePartData) error {
+ b, err := json.Marshal(v)
+ t.union = b
+ return err
+}
+
+// MergeSessionMessagePartData performs a merge with any union data inside the SessionMessagePart, using the provided SessionMessagePartData
+func (t *SessionMessagePart) MergeSessionMessagePartData(v SessionMessagePartData) error {
+ b, err := json.Marshal(v)
+ if err != nil {
+ return err
+ }
+
+ merged, err := runtime.JSONMerge(t.union, b)
+ t.union = merged
+ return err
+}
+
+func (t SessionMessagePart) MarshalJSON() ([]byte, error) {
+ b, err := t.union.MarshalJSON()
+ return b, err
+}
+
+func (t *SessionMessagePart) UnmarshalJSON(b []byte) error {
+ err := t.union.UnmarshalJSON(b)
+ return err
+}
+
+// AsSessionMessageToolInvocationToolCall returns the union data inside the SessionMessageToolInvocation as a SessionMessageToolInvocationToolCall
+func (t SessionMessageToolInvocation) AsSessionMessageToolInvocationToolCall() (SessionMessageToolInvocationToolCall, error) {
+ var body SessionMessageToolInvocationToolCall
+ err := json.Unmarshal(t.union, &body)
+ return body, err
+}
+
+// FromSessionMessageToolInvocationToolCall overwrites any union data inside the SessionMessageToolInvocation as the provided SessionMessageToolInvocationToolCall
+func (t *SessionMessageToolInvocation) FromSessionMessageToolInvocationToolCall(v SessionMessageToolInvocationToolCall) error {
+ b, err := json.Marshal(v)
+ t.union = b
+ return err
+}
+
+// MergeSessionMessageToolInvocationToolCall performs a merge with any union data inside the SessionMessageToolInvocation, using the provided SessionMessageToolInvocationToolCall
+func (t *SessionMessageToolInvocation) MergeSessionMessageToolInvocationToolCall(v SessionMessageToolInvocationToolCall) error {
+ b, err := json.Marshal(v)
+ if err != nil {
+ return err
+ }
+
+ merged, err := runtime.JSONMerge(t.union, b)
+ t.union = merged
+ return err
+}
+
+// AsSessionMessageToolInvocationToolPartialCall returns the union data inside the SessionMessageToolInvocation as a SessionMessageToolInvocationToolPartialCall
+func (t SessionMessageToolInvocation) AsSessionMessageToolInvocationToolPartialCall() (SessionMessageToolInvocationToolPartialCall, error) {
+ var body SessionMessageToolInvocationToolPartialCall
+ err := json.Unmarshal(t.union, &body)
+ return body, err
+}
+
+// FromSessionMessageToolInvocationToolPartialCall overwrites any union data inside the SessionMessageToolInvocation as the provided SessionMessageToolInvocationToolPartialCall
+func (t *SessionMessageToolInvocation) FromSessionMessageToolInvocationToolPartialCall(v SessionMessageToolInvocationToolPartialCall) error {
+ b, err := json.Marshal(v)
+ t.union = b
+ return err
+}
+
+// MergeSessionMessageToolInvocationToolPartialCall performs a merge with any union data inside the SessionMessageToolInvocation, using the provided SessionMessageToolInvocationToolPartialCall
+func (t *SessionMessageToolInvocation) MergeSessionMessageToolInvocationToolPartialCall(v SessionMessageToolInvocationToolPartialCall) error {
+ b, err := json.Marshal(v)
+ if err != nil {
+ return err
+ }
+
+ merged, err := runtime.JSONMerge(t.union, b)
+ t.union = merged
+ return err
+}
+
+// AsSessionMessageToolInvocationToolResult returns the union data inside the SessionMessageToolInvocation as a SessionMessageToolInvocationToolResult
+func (t SessionMessageToolInvocation) AsSessionMessageToolInvocationToolResult() (SessionMessageToolInvocationToolResult, error) {
+ var body SessionMessageToolInvocationToolResult
+ err := json.Unmarshal(t.union, &body)
+ return body, err
+}
+
+// FromSessionMessageToolInvocationToolResult overwrites any union data inside the SessionMessageToolInvocation as the provided SessionMessageToolInvocationToolResult
+func (t *SessionMessageToolInvocation) FromSessionMessageToolInvocationToolResult(v SessionMessageToolInvocationToolResult) error {
+ b, err := json.Marshal(v)
+ t.union = b
+ return err
+}
+
+// MergeSessionMessageToolInvocationToolResult performs a merge with any union data inside the SessionMessageToolInvocation, using the provided SessionMessageToolInvocationToolResult
+func (t *SessionMessageToolInvocation) MergeSessionMessageToolInvocationToolResult(v SessionMessageToolInvocationToolResult) error {
+ b, err := json.Marshal(v)
+ if err != nil {
+ return err
+ }
+
+ merged, err := runtime.JSONMerge(t.union, b)
+ t.union = merged
+ return err
+}
+
+func (t SessionMessageToolInvocation) MarshalJSON() ([]byte, error) {
+ b, err := t.union.MarshalJSON()
+ return b, err
+}
+
+func (t *SessionMessageToolInvocation) UnmarshalJSON(b []byte) error {
+ err := t.union.UnmarshalJSON(b)
+ return err
+}
+
// RequestEditorFn is the function signature for the RequestEditor callback function
type RequestEditorFn func(ctx context.Context, req *http.Request) error
@@ -644,7 +1037,7 @@ func (r PostSessionListResponse) StatusCode() int {
type PostSessionMessagesResponse struct {
Body []byte
HTTPResponse *http.Response
- JSON200 *interface{}
+ JSON200 *[]SessionMessage
}
// Status returns HTTPResponse.Status
@@ -881,7 +1274,7 @@ func ParsePostSessionMessagesResponse(rsp *http.Response) (*PostSessionMessagesR
switch {
case strings.Contains(rsp.Header.Get("Content-Type"), "json") && rsp.StatusCode == 200:
- var dest interface{}
+ var dest []SessionMessage
if err := json.Unmarshal(bodyBytes, &dest); err != nil {
return nil, err
}