2025-05-19 10:30:41 +08:00
// Package client provides primitives to interact with the openapi HTTP API.
//
// Code generated by github.com/oapi-codegen/oapi-codegen/v2 version v2.4.1 DO NOT EDIT.
package client
import (
"bytes"
"context"
"encoding/json"
2025-05-29 01:35:05 +08:00
"errors"
2025-05-19 10:30:41 +08:00
"fmt"
"io"
"net/http"
"net/url"
"strings"
2025-05-29 01:22:48 +08:00
"github.com/oapi-codegen/runtime"
)
2025-05-29 22:21:59 +08:00
// Defines values for MessageInfoRole.
2025-05-29 01:22:48 +08:00
const (
2025-05-29 22:21:59 +08:00
Assistant MessageInfoRole = "assistant"
System MessageInfoRole = "system"
User MessageInfoRole = "user"
2025-05-19 10:30:41 +08:00
)
2025-05-29 23:32:55 +08:00
// Event defines model for Event.
type Event struct {
union json . RawMessage
}
// EventLspClientDiagnostics defines model for Event.lsp.client.diagnostics.
type EventLspClientDiagnostics struct {
Properties struct {
Path string ` json:"path" `
ServerID string ` json:"serverID" `
} ` json:"properties" `
Type string ` json:"type" `
}
// EventMessageUpdated defines model for Event.message.updated.
type EventMessageUpdated struct {
Properties struct {
2025-05-29 23:35:56 +08:00
Info MessageInfo ` json:"info" `
2025-05-29 23:32:55 +08:00
} ` json:"properties" `
Type string ` json:"type" `
}
// EventSessionUpdated defines model for Event.session.updated.
type EventSessionUpdated struct {
Properties struct {
2025-05-29 23:38:55 +08:00
Info SessionInfo ` json:"info" `
2025-05-29 23:32:55 +08:00
} ` json:"properties" `
Type string ` json:"type" `
}
// EventStorageWrite defines model for Event.storage.write.
type EventStorageWrite struct {
Properties struct {
Content * interface { } ` json:"content,omitempty" `
Key string ` json:"key" `
} ` json:"properties" `
Type string ` json:"type" `
}
2025-05-29 22:21:59 +08:00
// MessageInfo defines model for Message.Info.
type MessageInfo struct {
2025-05-29 01:22:48 +08:00
Id string ` json:"id" `
Metadata struct {
2025-05-29 22:21:59 +08:00
Assistant * struct {
Cost float32 ` json:"cost" `
ModelID string ` json:"modelID" `
ProviderID string ` json:"providerID" `
2025-05-30 03:04:44 +08:00
Summary * bool ` json:"summary,omitempty" `
2025-05-29 22:21:59 +08:00
Tokens struct {
Input float32 ` json:"input" `
Output float32 ` json:"output" `
Reasoning float32 ` json:"reasoning" `
} ` json:"tokens" `
} ` json:"assistant,omitempty" `
2025-05-29 01:22:48 +08:00
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" `
2025-05-29 22:21:59 +08:00
Parts [ ] MessagePart ` json:"parts" `
Role MessageInfoRole ` json:"role" `
2025-05-29 01:22:48 +08:00
}
2025-05-29 22:21:59 +08:00
// MessageInfoRole defines model for MessageInfo.Role.
type MessageInfoRole string
2025-05-29 01:22:48 +08:00
2025-05-29 22:21:59 +08:00
// MessagePart defines model for Message.Part.
type MessagePart struct {
2025-05-29 01:22:48 +08:00
union json . RawMessage
}
2025-05-29 22:21:59 +08:00
// MessagePartFile defines model for Message.Part.File.
type MessagePartFile struct {
2025-05-29 01:22:48 +08:00
Filename * string ` json:"filename,omitempty" `
MediaType string ` json:"mediaType" `
Type string ` json:"type" `
Url string ` json:"url" `
}
2025-05-29 22:21:59 +08:00
// MessagePartReasoning defines model for Message.Part.Reasoning.
type MessagePartReasoning struct {
2025-05-29 01:22:48 +08:00
ProviderMetadata * map [ string ] interface { } ` json:"providerMetadata,omitempty" `
Text string ` json:"text" `
Type string ` json:"type" `
}
2025-05-29 22:21:59 +08:00
// MessagePartSourceUrl defines model for Message.Part.SourceUrl.
type MessagePartSourceUrl struct {
2025-05-29 01:22:48 +08:00
ProviderMetadata * map [ string ] interface { } ` json:"providerMetadata,omitempty" `
SourceId string ` json:"sourceId" `
Title * string ` json:"title,omitempty" `
Type string ` json:"type" `
Url string ` json:"url" `
}
2025-05-29 22:21:59 +08:00
// MessagePartStepStart defines model for Message.Part.StepStart.
type MessagePartStepStart struct {
2025-05-29 01:22:48 +08:00
Type string ` json:"type" `
}
2025-05-29 22:21:59 +08:00
// MessagePartText defines model for Message.Part.Text.
type MessagePartText struct {
2025-05-29 01:22:48 +08:00
Text string ` json:"text" `
Type string ` json:"type" `
}
2025-05-29 22:21:59 +08:00
// MessagePartToolInvocation defines model for Message.Part.ToolInvocation.
type MessagePartToolInvocation struct {
ToolInvocation MessageToolInvocation ` json:"toolInvocation" `
Type string ` json:"type" `
2025-05-29 01:22:48 +08:00
}
2025-05-29 22:21:59 +08:00
// MessageToolInvocation defines model for Message.ToolInvocation.
type MessageToolInvocation struct {
2025-05-29 01:22:48 +08:00
union json . RawMessage
}
2025-05-29 22:21:59 +08:00
// MessageToolInvocationToolCall defines model for Message.ToolInvocation.ToolCall.
type MessageToolInvocationToolCall struct {
Args * interface { } ` json:"args,omitempty" `
State string ` json:"state" `
Step * float32 ` json:"step,omitempty" `
ToolCallId string ` json:"toolCallId" `
ToolName string ` json:"toolName" `
2025-05-29 01:22:48 +08:00
}
2025-05-29 22:21:59 +08:00
// MessageToolInvocationToolPartialCall defines model for Message.ToolInvocation.ToolPartialCall.
type MessageToolInvocationToolPartialCall struct {
Args * interface { } ` json:"args,omitempty" `
State string ` json:"state" `
Step * float32 ` json:"step,omitempty" `
ToolCallId string ` json:"toolCallId" `
ToolName string ` json:"toolName" `
2025-05-29 01:22:48 +08:00
}
2025-05-29 22:21:59 +08:00
// MessageToolInvocationToolResult defines model for Message.ToolInvocation.ToolResult.
type MessageToolInvocationToolResult struct {
Args * interface { } ` json:"args,omitempty" `
Result string ` json:"result" `
State string ` json:"state" `
Step * float32 ` json:"step,omitempty" `
ToolCallId string ` json:"toolCallId" `
ToolName string ` json:"toolName" `
}
2025-05-29 23:58:40 +08:00
// ProviderInfo defines model for Provider.Info.
type ProviderInfo struct {
Models map [ string ] ProviderModel ` json:"models" `
Options * map [ string ] interface { } ` json:"options,omitempty" `
}
// ProviderModel defines model for Provider.Model.
type ProviderModel struct {
2025-05-29 23:38:55 +08:00
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" `
2025-05-30 03:20:55 +08:00
MaxOutputTokens * float32 ` json:"maxOutputTokens,omitempty" `
Name * string ` json:"name,omitempty" `
Reasoning * bool ` json:"reasoning,omitempty" `
2025-05-29 23:38:55 +08:00
}
// SessionInfo defines model for session.info.
2025-05-29 22:21:59 +08:00
type SessionInfo struct {
Id string ` json:"id" `
ShareID * string ` json:"shareID,omitempty" `
Title string ` json:"title" `
2025-05-29 01:22:48 +08:00
}
2025-05-29 03:07:51 +08:00
// PostSessionAbortJSONBody defines parameters for PostSessionAbort.
type PostSessionAbortJSONBody struct {
SessionID string ` json:"sessionID" `
}
2025-05-19 10:30:41 +08:00
// PostSessionChatJSONBody defines parameters for PostSessionChat.
type PostSessionChatJSONBody struct {
2025-05-29 22:21:59 +08:00
ModelID string ` json:"modelID" `
Parts [ ] MessagePart ` json:"parts" `
ProviderID string ` json:"providerID" `
SessionID string ` json:"sessionID" `
2025-05-19 10:30:41 +08:00
}
2025-05-27 06:14:36 +08:00
// PostSessionMessagesJSONBody defines parameters for PostSessionMessages.
type PostSessionMessagesJSONBody struct {
SessionID string ` json:"sessionID" `
}
// PostSessionShareJSONBody defines parameters for PostSessionShare.
type PostSessionShareJSONBody struct {
SessionID string ` json:"sessionID" `
}
2025-05-30 03:04:44 +08:00
// PostSessionSummarizeJSONBody defines parameters for PostSessionSummarize.
type PostSessionSummarizeJSONBody struct {
ModelID string ` json:"modelID" `
ProviderID string ` json:"providerID" `
SessionID string ` json:"sessionID" `
}
2025-05-29 03:07:51 +08:00
// PostSessionAbortJSONRequestBody defines body for PostSessionAbort for application/json ContentType.
type PostSessionAbortJSONRequestBody PostSessionAbortJSONBody
2025-05-19 10:30:41 +08:00
// PostSessionChatJSONRequestBody defines body for PostSessionChat for application/json ContentType.
type PostSessionChatJSONRequestBody PostSessionChatJSONBody
2025-05-27 06:14:36 +08:00
// PostSessionMessagesJSONRequestBody defines body for PostSessionMessages for application/json ContentType.
type PostSessionMessagesJSONRequestBody PostSessionMessagesJSONBody
// PostSessionShareJSONRequestBody defines body for PostSessionShare for application/json ContentType.
type PostSessionShareJSONRequestBody PostSessionShareJSONBody
2025-05-30 03:04:44 +08:00
// PostSessionSummarizeJSONRequestBody defines body for PostSessionSummarize for application/json ContentType.
type PostSessionSummarizeJSONRequestBody PostSessionSummarizeJSONBody
2025-05-29 23:32:55 +08:00
// AsEventStorageWrite returns the union data inside the Event as a EventStorageWrite
func ( t Event ) AsEventStorageWrite ( ) ( EventStorageWrite , error ) {
var body EventStorageWrite
err := json . Unmarshal ( t . union , & body )
return body , err
}
// FromEventStorageWrite overwrites any union data inside the Event as the provided EventStorageWrite
func ( t * Event ) FromEventStorageWrite ( v EventStorageWrite ) error {
v . Type = "storage.write"
b , err := json . Marshal ( v )
t . union = b
return err
}
// MergeEventStorageWrite performs a merge with any union data inside the Event, using the provided EventStorageWrite
func ( t * Event ) MergeEventStorageWrite ( v EventStorageWrite ) error {
v . Type = "storage.write"
b , err := json . Marshal ( v )
if err != nil {
return err
}
merged , err := runtime . JSONMerge ( t . union , b )
t . union = merged
return err
}
// AsEventLspClientDiagnostics returns the union data inside the Event as a EventLspClientDiagnostics
func ( t Event ) AsEventLspClientDiagnostics ( ) ( EventLspClientDiagnostics , error ) {
var body EventLspClientDiagnostics
err := json . Unmarshal ( t . union , & body )
return body , err
}
// FromEventLspClientDiagnostics overwrites any union data inside the Event as the provided EventLspClientDiagnostics
func ( t * Event ) FromEventLspClientDiagnostics ( v EventLspClientDiagnostics ) error {
v . Type = "lsp.client.diagnostics"
b , err := json . Marshal ( v )
t . union = b
return err
}
// MergeEventLspClientDiagnostics performs a merge with any union data inside the Event, using the provided EventLspClientDiagnostics
func ( t * Event ) MergeEventLspClientDiagnostics ( v EventLspClientDiagnostics ) error {
v . Type = "lsp.client.diagnostics"
b , err := json . Marshal ( v )
if err != nil {
return err
}
merged , err := runtime . JSONMerge ( t . union , b )
t . union = merged
return err
}
// AsEventMessageUpdated returns the union data inside the Event as a EventMessageUpdated
func ( t Event ) AsEventMessageUpdated ( ) ( EventMessageUpdated , error ) {
var body EventMessageUpdated
err := json . Unmarshal ( t . union , & body )
return body , err
}
// FromEventMessageUpdated overwrites any union data inside the Event as the provided EventMessageUpdated
func ( t * Event ) FromEventMessageUpdated ( v EventMessageUpdated ) error {
v . Type = "message.updated"
b , err := json . Marshal ( v )
t . union = b
return err
}
// MergeEventMessageUpdated performs a merge with any union data inside the Event, using the provided EventMessageUpdated
func ( t * Event ) MergeEventMessageUpdated ( v EventMessageUpdated ) error {
v . Type = "message.updated"
b , err := json . Marshal ( v )
if err != nil {
return err
}
merged , err := runtime . JSONMerge ( t . union , b )
t . union = merged
return err
}
// AsEventSessionUpdated returns the union data inside the Event as a EventSessionUpdated
func ( t Event ) AsEventSessionUpdated ( ) ( EventSessionUpdated , error ) {
var body EventSessionUpdated
err := json . Unmarshal ( t . union , & body )
return body , err
}
// FromEventSessionUpdated overwrites any union data inside the Event as the provided EventSessionUpdated
func ( t * Event ) FromEventSessionUpdated ( v EventSessionUpdated ) error {
v . Type = "session.updated"
b , err := json . Marshal ( v )
t . union = b
return err
}
// MergeEventSessionUpdated performs a merge with any union data inside the Event, using the provided EventSessionUpdated
func ( t * Event ) MergeEventSessionUpdated ( v EventSessionUpdated ) error {
v . Type = "session.updated"
b , err := json . Marshal ( v )
if err != nil {
return err
}
merged , err := runtime . JSONMerge ( t . union , b )
t . union = merged
return err
}
func ( t Event ) Discriminator ( ) ( string , error ) {
var discriminator struct {
Discriminator string ` json:"type" `
}
err := json . Unmarshal ( t . union , & discriminator )
return discriminator . Discriminator , err
}
func ( t Event ) ValueByDiscriminator ( ) ( interface { } , error ) {
discriminator , err := t . Discriminator ( )
if err != nil {
return nil , err
}
switch discriminator {
case "lsp.client.diagnostics" :
return t . AsEventLspClientDiagnostics ( )
case "message.updated" :
return t . AsEventMessageUpdated ( )
case "session.updated" :
return t . AsEventSessionUpdated ( )
case "storage.write" :
return t . AsEventStorageWrite ( )
default :
return nil , errors . New ( "unknown discriminator value: " + discriminator )
}
}
func ( t Event ) MarshalJSON ( ) ( [ ] byte , error ) {
b , err := t . union . MarshalJSON ( )
return b , err
}
func ( t * Event ) UnmarshalJSON ( b [ ] byte ) error {
err := t . union . UnmarshalJSON ( b )
return err
}
2025-05-29 22:21:59 +08:00
// AsMessagePartText returns the union data inside the MessagePart as a MessagePartText
func ( t MessagePart ) AsMessagePartText ( ) ( MessagePartText , error ) {
var body MessagePartText
2025-05-29 01:22:48 +08:00
err := json . Unmarshal ( t . union , & body )
return body , err
}
2025-05-29 22:21:59 +08:00
// FromMessagePartText overwrites any union data inside the MessagePart as the provided MessagePartText
func ( t * MessagePart ) FromMessagePartText ( v MessagePartText ) error {
2025-05-29 01:35:05 +08:00
v . Type = "text"
2025-05-29 01:22:48 +08:00
b , err := json . Marshal ( v )
t . union = b
return err
}
2025-05-29 22:21:59 +08:00
// MergeMessagePartText performs a merge with any union data inside the MessagePart, using the provided MessagePartText
func ( t * MessagePart ) MergeMessagePartText ( v MessagePartText ) error {
2025-05-29 01:35:05 +08:00
v . Type = "text"
2025-05-29 01:22:48 +08:00
b , err := json . Marshal ( v )
if err != nil {
return err
}
merged , err := runtime . JSONMerge ( t . union , b )
t . union = merged
return err
}
2025-05-29 22:21:59 +08:00
// AsMessagePartReasoning returns the union data inside the MessagePart as a MessagePartReasoning
func ( t MessagePart ) AsMessagePartReasoning ( ) ( MessagePartReasoning , error ) {
var body MessagePartReasoning
2025-05-29 01:22:48 +08:00
err := json . Unmarshal ( t . union , & body )
return body , err
}
2025-05-29 22:21:59 +08:00
// FromMessagePartReasoning overwrites any union data inside the MessagePart as the provided MessagePartReasoning
func ( t * MessagePart ) FromMessagePartReasoning ( v MessagePartReasoning ) error {
2025-05-29 01:35:05 +08:00
v . Type = "reasoning"
2025-05-29 01:22:48 +08:00
b , err := json . Marshal ( v )
t . union = b
return err
}
2025-05-29 22:21:59 +08:00
// MergeMessagePartReasoning performs a merge with any union data inside the MessagePart, using the provided MessagePartReasoning
func ( t * MessagePart ) MergeMessagePartReasoning ( v MessagePartReasoning ) error {
2025-05-29 01:35:05 +08:00
v . Type = "reasoning"
2025-05-29 01:22:48 +08:00
b , err := json . Marshal ( v )
if err != nil {
return err
}
merged , err := runtime . JSONMerge ( t . union , b )
t . union = merged
return err
}
2025-05-29 22:21:59 +08:00
// AsMessagePartToolInvocation returns the union data inside the MessagePart as a MessagePartToolInvocation
func ( t MessagePart ) AsMessagePartToolInvocation ( ) ( MessagePartToolInvocation , error ) {
var body MessagePartToolInvocation
2025-05-29 01:22:48 +08:00
err := json . Unmarshal ( t . union , & body )
return body , err
}
2025-05-29 22:21:59 +08:00
// FromMessagePartToolInvocation overwrites any union data inside the MessagePart as the provided MessagePartToolInvocation
func ( t * MessagePart ) FromMessagePartToolInvocation ( v MessagePartToolInvocation ) error {
2025-05-29 01:35:05 +08:00
v . Type = "tool-invocation"
2025-05-29 01:22:48 +08:00
b , err := json . Marshal ( v )
t . union = b
return err
}
2025-05-29 22:21:59 +08:00
// MergeMessagePartToolInvocation performs a merge with any union data inside the MessagePart, using the provided MessagePartToolInvocation
func ( t * MessagePart ) MergeMessagePartToolInvocation ( v MessagePartToolInvocation ) error {
2025-05-29 01:35:05 +08:00
v . Type = "tool-invocation"
2025-05-29 01:22:48 +08:00
b , err := json . Marshal ( v )
if err != nil {
return err
}
merged , err := runtime . JSONMerge ( t . union , b )
t . union = merged
return err
}
2025-05-29 22:21:59 +08:00
// AsMessagePartSourceUrl returns the union data inside the MessagePart as a MessagePartSourceUrl
func ( t MessagePart ) AsMessagePartSourceUrl ( ) ( MessagePartSourceUrl , error ) {
var body MessagePartSourceUrl
2025-05-29 01:22:48 +08:00
err := json . Unmarshal ( t . union , & body )
return body , err
}
2025-05-29 22:21:59 +08:00
// FromMessagePartSourceUrl overwrites any union data inside the MessagePart as the provided MessagePartSourceUrl
func ( t * MessagePart ) FromMessagePartSourceUrl ( v MessagePartSourceUrl ) error {
2025-05-29 01:35:05 +08:00
v . Type = "source-url"
2025-05-29 01:22:48 +08:00
b , err := json . Marshal ( v )
t . union = b
return err
}
2025-05-29 22:21:59 +08:00
// MergeMessagePartSourceUrl performs a merge with any union data inside the MessagePart, using the provided MessagePartSourceUrl
func ( t * MessagePart ) MergeMessagePartSourceUrl ( v MessagePartSourceUrl ) error {
2025-05-29 01:35:05 +08:00
v . Type = "source-url"
2025-05-29 01:22:48 +08:00
b , err := json . Marshal ( v )
if err != nil {
return err
}
merged , err := runtime . JSONMerge ( t . union , b )
t . union = merged
return err
}
2025-05-29 22:21:59 +08:00
// AsMessagePartFile returns the union data inside the MessagePart as a MessagePartFile
func ( t MessagePart ) AsMessagePartFile ( ) ( MessagePartFile , error ) {
var body MessagePartFile
2025-05-29 01:22:48 +08:00
err := json . Unmarshal ( t . union , & body )
return body , err
}
2025-05-29 22:21:59 +08:00
// FromMessagePartFile overwrites any union data inside the MessagePart as the provided MessagePartFile
func ( t * MessagePart ) FromMessagePartFile ( v MessagePartFile ) error {
2025-05-29 01:35:05 +08:00
v . Type = "file"
2025-05-29 01:22:48 +08:00
b , err := json . Marshal ( v )
t . union = b
return err
}
2025-05-29 22:21:59 +08:00
// MergeMessagePartFile performs a merge with any union data inside the MessagePart, using the provided MessagePartFile
func ( t * MessagePart ) MergeMessagePartFile ( v MessagePartFile ) error {
2025-05-29 01:35:05 +08:00
v . Type = "file"
2025-05-29 01:22:48 +08:00
b , err := json . Marshal ( v )
if err != nil {
return err
}
merged , err := runtime . JSONMerge ( t . union , b )
t . union = merged
return err
}
2025-05-29 22:21:59 +08:00
// AsMessagePartStepStart returns the union data inside the MessagePart as a MessagePartStepStart
func ( t MessagePart ) AsMessagePartStepStart ( ) ( MessagePartStepStart , error ) {
var body MessagePartStepStart
2025-05-29 01:22:48 +08:00
err := json . Unmarshal ( t . union , & body )
return body , err
}
2025-05-29 22:21:59 +08:00
// FromMessagePartStepStart overwrites any union data inside the MessagePart as the provided MessagePartStepStart
func ( t * MessagePart ) FromMessagePartStepStart ( v MessagePartStepStart ) error {
2025-05-29 01:35:05 +08:00
v . Type = "step-start"
2025-05-29 01:22:48 +08:00
b , err := json . Marshal ( v )
t . union = b
return err
}
2025-05-29 22:21:59 +08:00
// MergeMessagePartStepStart performs a merge with any union data inside the MessagePart, using the provided MessagePartStepStart
func ( t * MessagePart ) MergeMessagePartStepStart ( v MessagePartStepStart ) error {
2025-05-29 01:35:05 +08:00
v . Type = "step-start"
2025-05-29 01:22:48 +08:00
b , err := json . Marshal ( v )
if err != nil {
return err
}
merged , err := runtime . JSONMerge ( t . union , b )
t . union = merged
return err
}
2025-05-29 22:21:59 +08:00
func ( t MessagePart ) Discriminator ( ) ( string , error ) {
2025-05-29 01:35:05 +08:00
var discriminator struct {
Discriminator string ` json:"type" `
}
err := json . Unmarshal ( t . union , & discriminator )
return discriminator . Discriminator , err
2025-05-29 01:22:48 +08:00
}
2025-05-29 22:21:59 +08:00
func ( t MessagePart ) ValueByDiscriminator ( ) ( interface { } , error ) {
2025-05-29 01:35:05 +08:00
discriminator , err := t . Discriminator ( )
2025-05-29 01:22:48 +08:00
if err != nil {
2025-05-29 01:35:05 +08:00
return nil , err
}
switch discriminator {
case "file" :
2025-05-29 22:21:59 +08:00
return t . AsMessagePartFile ( )
2025-05-29 01:35:05 +08:00
case "reasoning" :
2025-05-29 22:21:59 +08:00
return t . AsMessagePartReasoning ( )
2025-05-29 01:35:05 +08:00
case "source-url" :
2025-05-29 22:21:59 +08:00
return t . AsMessagePartSourceUrl ( )
2025-05-29 01:35:05 +08:00
case "step-start" :
2025-05-29 22:21:59 +08:00
return t . AsMessagePartStepStart ( )
2025-05-29 01:35:05 +08:00
case "text" :
2025-05-29 22:21:59 +08:00
return t . AsMessagePartText ( )
2025-05-29 01:35:05 +08:00
case "tool-invocation" :
2025-05-29 22:21:59 +08:00
return t . AsMessagePartToolInvocation ( )
2025-05-29 01:35:05 +08:00
default :
return nil , errors . New ( "unknown discriminator value: " + discriminator )
2025-05-29 01:22:48 +08:00
}
}
2025-05-29 22:21:59 +08:00
func ( t MessagePart ) MarshalJSON ( ) ( [ ] byte , error ) {
2025-05-29 01:22:48 +08:00
b , err := t . union . MarshalJSON ( )
return b , err
}
2025-05-29 22:21:59 +08:00
func ( t * MessagePart ) UnmarshalJSON ( b [ ] byte ) error {
2025-05-29 01:22:48 +08:00
err := t . union . UnmarshalJSON ( b )
return err
}
2025-05-29 22:21:59 +08:00
// AsMessageToolInvocationToolCall returns the union data inside the MessageToolInvocation as a MessageToolInvocationToolCall
func ( t MessageToolInvocation ) AsMessageToolInvocationToolCall ( ) ( MessageToolInvocationToolCall , error ) {
var body MessageToolInvocationToolCall
2025-05-29 01:22:48 +08:00
err := json . Unmarshal ( t . union , & body )
return body , err
}
2025-05-29 22:21:59 +08:00
// FromMessageToolInvocationToolCall overwrites any union data inside the MessageToolInvocation as the provided MessageToolInvocationToolCall
func ( t * MessageToolInvocation ) FromMessageToolInvocationToolCall ( v MessageToolInvocationToolCall ) error {
2025-05-29 01:35:05 +08:00
v . State = "call"
2025-05-29 01:22:48 +08:00
b , err := json . Marshal ( v )
t . union = b
return err
}
2025-05-29 22:21:59 +08:00
// MergeMessageToolInvocationToolCall performs a merge with any union data inside the MessageToolInvocation, using the provided MessageToolInvocationToolCall
func ( t * MessageToolInvocation ) MergeMessageToolInvocationToolCall ( v MessageToolInvocationToolCall ) error {
2025-05-29 01:35:05 +08:00
v . State = "call"
2025-05-29 01:22:48 +08:00
b , err := json . Marshal ( v )
if err != nil {
return err
}
merged , err := runtime . JSONMerge ( t . union , b )
t . union = merged
return err
}
2025-05-29 22:21:59 +08:00
// AsMessageToolInvocationToolPartialCall returns the union data inside the MessageToolInvocation as a MessageToolInvocationToolPartialCall
func ( t MessageToolInvocation ) AsMessageToolInvocationToolPartialCall ( ) ( MessageToolInvocationToolPartialCall , error ) {
var body MessageToolInvocationToolPartialCall
2025-05-29 01:22:48 +08:00
err := json . Unmarshal ( t . union , & body )
return body , err
}
2025-05-29 22:21:59 +08:00
// FromMessageToolInvocationToolPartialCall overwrites any union data inside the MessageToolInvocation as the provided MessageToolInvocationToolPartialCall
func ( t * MessageToolInvocation ) FromMessageToolInvocationToolPartialCall ( v MessageToolInvocationToolPartialCall ) error {
2025-05-29 01:35:05 +08:00
v . State = "partial-call"
2025-05-29 01:22:48 +08:00
b , err := json . Marshal ( v )
t . union = b
return err
}
2025-05-29 22:21:59 +08:00
// MergeMessageToolInvocationToolPartialCall performs a merge with any union data inside the MessageToolInvocation, using the provided MessageToolInvocationToolPartialCall
func ( t * MessageToolInvocation ) MergeMessageToolInvocationToolPartialCall ( v MessageToolInvocationToolPartialCall ) error {
2025-05-29 01:35:05 +08:00
v . State = "partial-call"
2025-05-29 01:22:48 +08:00
b , err := json . Marshal ( v )
if err != nil {
return err
}
merged , err := runtime . JSONMerge ( t . union , b )
t . union = merged
return err
}
2025-05-29 22:21:59 +08:00
// AsMessageToolInvocationToolResult returns the union data inside the MessageToolInvocation as a MessageToolInvocationToolResult
func ( t MessageToolInvocation ) AsMessageToolInvocationToolResult ( ) ( MessageToolInvocationToolResult , error ) {
var body MessageToolInvocationToolResult
2025-05-29 01:22:48 +08:00
err := json . Unmarshal ( t . union , & body )
return body , err
}
2025-05-29 22:21:59 +08:00
// FromMessageToolInvocationToolResult overwrites any union data inside the MessageToolInvocation as the provided MessageToolInvocationToolResult
func ( t * MessageToolInvocation ) FromMessageToolInvocationToolResult ( v MessageToolInvocationToolResult ) error {
2025-05-29 01:35:05 +08:00
v . State = "result"
2025-05-29 01:22:48 +08:00
b , err := json . Marshal ( v )
t . union = b
return err
}
2025-05-29 22:21:59 +08:00
// MergeMessageToolInvocationToolResult performs a merge with any union data inside the MessageToolInvocation, using the provided MessageToolInvocationToolResult
func ( t * MessageToolInvocation ) MergeMessageToolInvocationToolResult ( v MessageToolInvocationToolResult ) error {
2025-05-29 01:35:05 +08:00
v . State = "result"
2025-05-29 01:22:48 +08:00
b , err := json . Marshal ( v )
if err != nil {
return err
}
merged , err := runtime . JSONMerge ( t . union , b )
t . union = merged
return err
}
2025-05-29 22:21:59 +08:00
func ( t MessageToolInvocation ) Discriminator ( ) ( string , error ) {
2025-05-29 01:35:05 +08:00
var discriminator struct {
Discriminator string ` json:"state" `
}
err := json . Unmarshal ( t . union , & discriminator )
return discriminator . Discriminator , err
}
2025-05-29 22:21:59 +08:00
func ( t MessageToolInvocation ) ValueByDiscriminator ( ) ( interface { } , error ) {
2025-05-29 01:35:05 +08:00
discriminator , err := t . Discriminator ( )
if err != nil {
return nil , err
}
switch discriminator {
case "call" :
2025-05-29 22:21:59 +08:00
return t . AsMessageToolInvocationToolCall ( )
2025-05-29 01:35:05 +08:00
case "partial-call" :
2025-05-29 22:21:59 +08:00
return t . AsMessageToolInvocationToolPartialCall ( )
2025-05-29 01:35:05 +08:00
case "result" :
2025-05-29 22:21:59 +08:00
return t . AsMessageToolInvocationToolResult ( )
2025-05-29 01:35:05 +08:00
default :
return nil , errors . New ( "unknown discriminator value: " + discriminator )
}
}
2025-05-29 22:21:59 +08:00
func ( t MessageToolInvocation ) MarshalJSON ( ) ( [ ] byte , error ) {
2025-05-29 01:22:48 +08:00
b , err := t . union . MarshalJSON ( )
return b , err
}
2025-05-29 22:21:59 +08:00
func ( t * MessageToolInvocation ) UnmarshalJSON ( b [ ] byte ) error {
2025-05-29 01:22:48 +08:00
err := t . union . UnmarshalJSON ( b )
return err
}
2025-05-19 10:30:41 +08:00
// RequestEditorFn is the function signature for the RequestEditor callback function
type RequestEditorFn func ( ctx context . Context , req * http . Request ) error
// Doer performs HTTP requests.
//
// The standard http.Client implements this interface.
type HttpRequestDoer interface {
Do ( req * http . Request ) ( * http . Response , error )
}
// Client which conforms to the OpenAPI3 specification for this service.
type Client struct {
// The endpoint of the server conforming to this interface, with scheme,
// https://api.deepmap.com for example. This can contain a path relative
// to the server, such as https://api.deepmap.com/dev-test, and all the
// paths in the swagger spec will be appended to the server.
Server string
// Doer for performing requests, typically a *http.Client with any
// customized settings, such as certificate chains.
Client HttpRequestDoer
// A list of callbacks for modifying requests which are generated before sending over
// the network.
RequestEditors [ ] RequestEditorFn
}
// ClientOption allows setting custom parameters during construction
type ClientOption func ( * Client ) error
// Creates a new Client, with reasonable defaults
func NewClient ( server string , opts ... ClientOption ) ( * Client , error ) {
// create a client with sane default values
client := Client {
Server : server ,
}
// mutate client and add all optional params
for _ , o := range opts {
if err := o ( & client ) ; err != nil {
return nil , err
}
}
// ensure the server URL always has a trailing slash
if ! strings . HasSuffix ( client . Server , "/" ) {
client . Server += "/"
}
// create httpClient, if not already present
if client . Client == nil {
client . Client = & http . Client { }
}
return & client , nil
}
// WithHTTPClient allows overriding the default Doer, which is
// automatically created using http.Client. This is useful for tests.
func WithHTTPClient ( doer HttpRequestDoer ) ClientOption {
return func ( c * Client ) error {
c . Client = doer
return nil
}
}
// WithRequestEditorFn allows setting up a callback function, which will be
// called right before sending the request. This can be used to mutate the request.
func WithRequestEditorFn ( fn RequestEditorFn ) ClientOption {
return func ( c * Client ) error {
c . RequestEditors = append ( c . RequestEditors , fn )
return nil
}
}
// The interface specification for the client above.
type ClientInterface interface {
2025-05-29 23:32:55 +08:00
// GetEvent request
GetEvent ( ctx context . Context , reqEditors ... RequestEditorFn ) ( * http . Response , error )
2025-05-29 00:53:22 +08:00
// PostProviderList request
PostProviderList ( ctx context . Context , reqEditors ... RequestEditorFn ) ( * http . Response , error )
2025-05-29 03:07:51 +08:00
// PostSessionAbortWithBody request with any body
PostSessionAbortWithBody ( ctx context . Context , contentType string , body io . Reader , reqEditors ... RequestEditorFn ) ( * http . Response , error )
PostSessionAbort ( ctx context . Context , body PostSessionAbortJSONRequestBody , reqEditors ... RequestEditorFn ) ( * http . Response , error )
2025-05-19 10:30:41 +08:00
// PostSessionChatWithBody request with any body
PostSessionChatWithBody ( ctx context . Context , contentType string , body io . Reader , reqEditors ... RequestEditorFn ) ( * http . Response , error )
PostSessionChat ( ctx context . Context , body PostSessionChatJSONRequestBody , reqEditors ... RequestEditorFn ) ( * http . Response , error )
// PostSessionCreate request
PostSessionCreate ( ctx context . Context , reqEditors ... RequestEditorFn ) ( * http . Response , error )
2025-05-27 06:14:36 +08:00
2025-05-28 03:35:48 +08:00
// PostSessionList request
PostSessionList ( ctx context . Context , reqEditors ... RequestEditorFn ) ( * http . Response , error )
2025-05-27 06:14:36 +08:00
// PostSessionMessagesWithBody request with any body
PostSessionMessagesWithBody ( ctx context . Context , contentType string , body io . Reader , reqEditors ... RequestEditorFn ) ( * http . Response , error )
PostSessionMessages ( ctx context . Context , body PostSessionMessagesJSONRequestBody , reqEditors ... RequestEditorFn ) ( * http . Response , error )
// PostSessionShareWithBody request with any body
PostSessionShareWithBody ( ctx context . Context , contentType string , body io . Reader , reqEditors ... RequestEditorFn ) ( * http . Response , error )
PostSessionShare ( ctx context . Context , body PostSessionShareJSONRequestBody , reqEditors ... RequestEditorFn ) ( * http . Response , error )
2025-05-30 03:04:44 +08:00
// PostSessionSummarizeWithBody request with any body
PostSessionSummarizeWithBody ( ctx context . Context , contentType string , body io . Reader , reqEditors ... RequestEditorFn ) ( * http . Response , error )
PostSessionSummarize ( ctx context . Context , body PostSessionSummarizeJSONRequestBody , reqEditors ... RequestEditorFn ) ( * http . Response , error )
2025-05-19 10:30:41 +08:00
}
2025-05-29 23:32:55 +08:00
func ( c * Client ) GetEvent ( ctx context . Context , reqEditors ... RequestEditorFn ) ( * http . Response , error ) {
req , err := NewGetEventRequest ( c . Server )
if err != nil {
return nil , err
}
req = req . WithContext ( ctx )
if err := c . applyEditors ( ctx , req , reqEditors ) ; err != nil {
return nil , err
}
return c . Client . Do ( req )
}
2025-05-29 00:53:22 +08:00
func ( c * Client ) PostProviderList ( ctx context . Context , reqEditors ... RequestEditorFn ) ( * http . Response , error ) {
req , err := NewPostProviderListRequest ( c . Server )
if err != nil {
return nil , err
}
req = req . WithContext ( ctx )
if err := c . applyEditors ( ctx , req , reqEditors ) ; err != nil {
return nil , err
}
return c . Client . Do ( req )
}
2025-05-29 03:07:51 +08:00
func ( c * Client ) PostSessionAbortWithBody ( ctx context . Context , contentType string , body io . Reader , reqEditors ... RequestEditorFn ) ( * http . Response , error ) {
req , err := NewPostSessionAbortRequestWithBody ( c . Server , contentType , body )
if err != nil {
return nil , err
}
req = req . WithContext ( ctx )
if err := c . applyEditors ( ctx , req , reqEditors ) ; err != nil {
return nil , err
}
return c . Client . Do ( req )
}
func ( c * Client ) PostSessionAbort ( ctx context . Context , body PostSessionAbortJSONRequestBody , reqEditors ... RequestEditorFn ) ( * http . Response , error ) {
req , err := NewPostSessionAbortRequest ( c . Server , body )
if err != nil {
return nil , err
}
req = req . WithContext ( ctx )
if err := c . applyEditors ( ctx , req , reqEditors ) ; err != nil {
return nil , err
}
return c . Client . Do ( req )
}
2025-05-19 10:30:41 +08:00
func ( c * Client ) PostSessionChatWithBody ( ctx context . Context , contentType string , body io . Reader , reqEditors ... RequestEditorFn ) ( * http . Response , error ) {
req , err := NewPostSessionChatRequestWithBody ( c . Server , contentType , body )
if err != nil {
return nil , err
}
req = req . WithContext ( ctx )
if err := c . applyEditors ( ctx , req , reqEditors ) ; err != nil {
return nil , err
}
return c . Client . Do ( req )
}
func ( c * Client ) PostSessionChat ( ctx context . Context , body PostSessionChatJSONRequestBody , reqEditors ... RequestEditorFn ) ( * http . Response , error ) {
req , err := NewPostSessionChatRequest ( c . Server , body )
if err != nil {
return nil , err
}
req = req . WithContext ( ctx )
if err := c . applyEditors ( ctx , req , reqEditors ) ; err != nil {
return nil , err
}
return c . Client . Do ( req )
}
func ( c * Client ) PostSessionCreate ( ctx context . Context , reqEditors ... RequestEditorFn ) ( * http . Response , error ) {
req , err := NewPostSessionCreateRequest ( c . Server )
if err != nil {
return nil , err
}
req = req . WithContext ( ctx )
if err := c . applyEditors ( ctx , req , reqEditors ) ; err != nil {
return nil , err
}
return c . Client . Do ( req )
}
2025-05-28 03:35:48 +08:00
func ( c * Client ) PostSessionList ( ctx context . Context , reqEditors ... RequestEditorFn ) ( * http . Response , error ) {
req , err := NewPostSessionListRequest ( c . Server )
if err != nil {
return nil , err
}
req = req . WithContext ( ctx )
if err := c . applyEditors ( ctx , req , reqEditors ) ; err != nil {
return nil , err
}
return c . Client . Do ( req )
}
2025-05-27 06:14:36 +08:00
func ( c * Client ) PostSessionMessagesWithBody ( ctx context . Context , contentType string , body io . Reader , reqEditors ... RequestEditorFn ) ( * http . Response , error ) {
req , err := NewPostSessionMessagesRequestWithBody ( c . Server , contentType , body )
if err != nil {
return nil , err
}
req = req . WithContext ( ctx )
if err := c . applyEditors ( ctx , req , reqEditors ) ; err != nil {
return nil , err
}
return c . Client . Do ( req )
}
func ( c * Client ) PostSessionMessages ( ctx context . Context , body PostSessionMessagesJSONRequestBody , reqEditors ... RequestEditorFn ) ( * http . Response , error ) {
req , err := NewPostSessionMessagesRequest ( c . Server , body )
if err != nil {
return nil , err
}
req = req . WithContext ( ctx )
if err := c . applyEditors ( ctx , req , reqEditors ) ; err != nil {
return nil , err
}
return c . Client . Do ( req )
}
func ( c * Client ) PostSessionShareWithBody ( ctx context . Context , contentType string , body io . Reader , reqEditors ... RequestEditorFn ) ( * http . Response , error ) {
req , err := NewPostSessionShareRequestWithBody ( c . Server , contentType , body )
if err != nil {
return nil , err
}
req = req . WithContext ( ctx )
if err := c . applyEditors ( ctx , req , reqEditors ) ; err != nil {
return nil , err
}
return c . Client . Do ( req )
}
func ( c * Client ) PostSessionShare ( ctx context . Context , body PostSessionShareJSONRequestBody , reqEditors ... RequestEditorFn ) ( * http . Response , error ) {
req , err := NewPostSessionShareRequest ( c . Server , body )
if err != nil {
return nil , err
}
req = req . WithContext ( ctx )
if err := c . applyEditors ( ctx , req , reqEditors ) ; err != nil {
return nil , err
}
return c . Client . Do ( req )
}
2025-05-30 03:04:44 +08:00
func ( c * Client ) PostSessionSummarizeWithBody ( ctx context . Context , contentType string , body io . Reader , reqEditors ... RequestEditorFn ) ( * http . Response , error ) {
req , err := NewPostSessionSummarizeRequestWithBody ( c . Server , contentType , body )
if err != nil {
return nil , err
}
req = req . WithContext ( ctx )
if err := c . applyEditors ( ctx , req , reqEditors ) ; err != nil {
return nil , err
}
return c . Client . Do ( req )
}
func ( c * Client ) PostSessionSummarize ( ctx context . Context , body PostSessionSummarizeJSONRequestBody , reqEditors ... RequestEditorFn ) ( * http . Response , error ) {
req , err := NewPostSessionSummarizeRequest ( c . Server , body )
if err != nil {
return nil , err
}
req = req . WithContext ( ctx )
if err := c . applyEditors ( ctx , req , reqEditors ) ; err != nil {
return nil , err
}
return c . Client . Do ( req )
}
2025-05-29 23:32:55 +08:00
// NewGetEventRequest generates requests for GetEvent
func NewGetEventRequest ( server string ) ( * http . Request , error ) {
var err error
serverURL , err := url . Parse ( server )
if err != nil {
return nil , err
}
operationPath := fmt . Sprintf ( "/event" )
if operationPath [ 0 ] == '/' {
operationPath = "." + operationPath
}
queryURL , err := serverURL . Parse ( operationPath )
if err != nil {
return nil , err
}
req , err := http . NewRequest ( "GET" , queryURL . String ( ) , nil )
if err != nil {
return nil , err
}
return req , nil
}
2025-05-29 00:53:22 +08:00
// NewPostProviderListRequest generates requests for PostProviderList
func NewPostProviderListRequest ( server string ) ( * http . Request , error ) {
var err error
serverURL , err := url . Parse ( server )
if err != nil {
return nil , err
}
operationPath := fmt . Sprintf ( "/provider_list" )
if operationPath [ 0 ] == '/' {
operationPath = "." + operationPath
}
queryURL , err := serverURL . Parse ( operationPath )
if err != nil {
return nil , err
}
req , err := http . NewRequest ( "POST" , queryURL . String ( ) , nil )
if err != nil {
return nil , err
}
return req , nil
}
2025-05-29 03:07:51 +08:00
// NewPostSessionAbortRequest calls the generic PostSessionAbort builder with application/json body
func NewPostSessionAbortRequest ( server string , body PostSessionAbortJSONRequestBody ) ( * http . Request , error ) {
var bodyReader io . Reader
buf , err := json . Marshal ( body )
if err != nil {
return nil , err
}
bodyReader = bytes . NewReader ( buf )
return NewPostSessionAbortRequestWithBody ( server , "application/json" , bodyReader )
}
// NewPostSessionAbortRequestWithBody generates requests for PostSessionAbort with any type of body
func NewPostSessionAbortRequestWithBody ( server string , contentType string , body io . Reader ) ( * http . Request , error ) {
var err error
serverURL , err := url . Parse ( server )
if err != nil {
return nil , err
}
operationPath := fmt . Sprintf ( "/session_abort" )
if operationPath [ 0 ] == '/' {
operationPath = "." + operationPath
}
queryURL , err := serverURL . Parse ( operationPath )
if err != nil {
return nil , err
}
req , err := http . NewRequest ( "POST" , queryURL . String ( ) , body )
if err != nil {
return nil , err
}
req . Header . Add ( "Content-Type" , contentType )
return req , nil
}
2025-05-19 10:30:41 +08:00
// NewPostSessionChatRequest calls the generic PostSessionChat builder with application/json body
func NewPostSessionChatRequest ( server string , body PostSessionChatJSONRequestBody ) ( * http . Request , error ) {
var bodyReader io . Reader
buf , err := json . Marshal ( body )
if err != nil {
return nil , err
}
bodyReader = bytes . NewReader ( buf )
return NewPostSessionChatRequestWithBody ( server , "application/json" , bodyReader )
}
// NewPostSessionChatRequestWithBody generates requests for PostSessionChat with any type of body
func NewPostSessionChatRequestWithBody ( server string , contentType string , body io . Reader ) ( * http . Request , error ) {
var err error
serverURL , err := url . Parse ( server )
if err != nil {
return nil , err
}
operationPath := fmt . Sprintf ( "/session_chat" )
if operationPath [ 0 ] == '/' {
operationPath = "." + operationPath
}
queryURL , err := serverURL . Parse ( operationPath )
if err != nil {
return nil , err
}
req , err := http . NewRequest ( "POST" , queryURL . String ( ) , body )
if err != nil {
return nil , err
}
req . Header . Add ( "Content-Type" , contentType )
return req , nil
}
// NewPostSessionCreateRequest generates requests for PostSessionCreate
func NewPostSessionCreateRequest ( server string ) ( * http . Request , error ) {
var err error
serverURL , err := url . Parse ( server )
if err != nil {
return nil , err
}
operationPath := fmt . Sprintf ( "/session_create" )
if operationPath [ 0 ] == '/' {
operationPath = "." + operationPath
}
queryURL , err := serverURL . Parse ( operationPath )
if err != nil {
return nil , err
}
req , err := http . NewRequest ( "POST" , queryURL . String ( ) , nil )
if err != nil {
return nil , err
}
return req , nil
}
2025-05-28 03:35:48 +08:00
// NewPostSessionListRequest generates requests for PostSessionList
func NewPostSessionListRequest ( server string ) ( * http . Request , error ) {
var err error
serverURL , err := url . Parse ( server )
if err != nil {
return nil , err
}
operationPath := fmt . Sprintf ( "/session_list" )
if operationPath [ 0 ] == '/' {
operationPath = "." + operationPath
}
queryURL , err := serverURL . Parse ( operationPath )
if err != nil {
return nil , err
}
req , err := http . NewRequest ( "POST" , queryURL . String ( ) , nil )
if err != nil {
return nil , err
}
return req , nil
}
2025-05-27 06:14:36 +08:00
// NewPostSessionMessagesRequest calls the generic PostSessionMessages builder with application/json body
func NewPostSessionMessagesRequest ( server string , body PostSessionMessagesJSONRequestBody ) ( * http . Request , error ) {
var bodyReader io . Reader
buf , err := json . Marshal ( body )
if err != nil {
return nil , err
}
bodyReader = bytes . NewReader ( buf )
return NewPostSessionMessagesRequestWithBody ( server , "application/json" , bodyReader )
}
// NewPostSessionMessagesRequestWithBody generates requests for PostSessionMessages with any type of body
func NewPostSessionMessagesRequestWithBody ( server string , contentType string , body io . Reader ) ( * http . Request , error ) {
var err error
serverURL , err := url . Parse ( server )
if err != nil {
return nil , err
}
operationPath := fmt . Sprintf ( "/session_messages" )
if operationPath [ 0 ] == '/' {
operationPath = "." + operationPath
}
queryURL , err := serverURL . Parse ( operationPath )
if err != nil {
return nil , err
}
req , err := http . NewRequest ( "POST" , queryURL . String ( ) , body )
if err != nil {
return nil , err
}
req . Header . Add ( "Content-Type" , contentType )
return req , nil
}
// NewPostSessionShareRequest calls the generic PostSessionShare builder with application/json body
func NewPostSessionShareRequest ( server string , body PostSessionShareJSONRequestBody ) ( * http . Request , error ) {
var bodyReader io . Reader
buf , err := json . Marshal ( body )
if err != nil {
return nil , err
}
bodyReader = bytes . NewReader ( buf )
return NewPostSessionShareRequestWithBody ( server , "application/json" , bodyReader )
}
// NewPostSessionShareRequestWithBody generates requests for PostSessionShare with any type of body
func NewPostSessionShareRequestWithBody ( server string , contentType string , body io . Reader ) ( * http . Request , error ) {
var err error
serverURL , err := url . Parse ( server )
if err != nil {
return nil , err
}
operationPath := fmt . Sprintf ( "/session_share" )
if operationPath [ 0 ] == '/' {
operationPath = "." + operationPath
}
queryURL , err := serverURL . Parse ( operationPath )
if err != nil {
return nil , err
}
req , err := http . NewRequest ( "POST" , queryURL . String ( ) , body )
if err != nil {
return nil , err
}
req . Header . Add ( "Content-Type" , contentType )
return req , nil
}
2025-05-30 03:04:44 +08:00
// NewPostSessionSummarizeRequest calls the generic PostSessionSummarize builder with application/json body
func NewPostSessionSummarizeRequest ( server string , body PostSessionSummarizeJSONRequestBody ) ( * http . Request , error ) {
var bodyReader io . Reader
buf , err := json . Marshal ( body )
if err != nil {
return nil , err
}
bodyReader = bytes . NewReader ( buf )
return NewPostSessionSummarizeRequestWithBody ( server , "application/json" , bodyReader )
}
// NewPostSessionSummarizeRequestWithBody generates requests for PostSessionSummarize with any type of body
func NewPostSessionSummarizeRequestWithBody ( server string , contentType string , body io . Reader ) ( * http . Request , error ) {
var err error
serverURL , err := url . Parse ( server )
if err != nil {
return nil , err
}
operationPath := fmt . Sprintf ( "/session_summarize" )
if operationPath [ 0 ] == '/' {
operationPath = "." + operationPath
}
queryURL , err := serverURL . Parse ( operationPath )
if err != nil {
return nil , err
}
req , err := http . NewRequest ( "POST" , queryURL . String ( ) , body )
if err != nil {
return nil , err
}
req . Header . Add ( "Content-Type" , contentType )
return req , nil
}
2025-05-19 10:30:41 +08:00
func ( c * Client ) applyEditors ( ctx context . Context , req * http . Request , additionalEditors [ ] RequestEditorFn ) error {
for _ , r := range c . RequestEditors {
if err := r ( ctx , req ) ; err != nil {
return err
}
}
for _ , r := range additionalEditors {
if err := r ( ctx , req ) ; err != nil {
return err
}
}
return nil
}
// ClientWithResponses builds on ClientInterface to offer response payloads
type ClientWithResponses struct {
ClientInterface
}
// NewClientWithResponses creates a new ClientWithResponses, which wraps
// Client with return type handling
func NewClientWithResponses ( server string , opts ... ClientOption ) ( * ClientWithResponses , error ) {
client , err := NewClient ( server , opts ... )
if err != nil {
return nil , err
}
return & ClientWithResponses { client } , nil
}
// WithBaseURL overrides the baseURL.
func WithBaseURL ( baseURL string ) ClientOption {
return func ( c * Client ) error {
newBaseURL , err := url . Parse ( baseURL )
if err != nil {
return err
}
c . Server = newBaseURL . String ( )
return nil
}
}
// ClientWithResponsesInterface is the interface specification for the client with responses above.
type ClientWithResponsesInterface interface {
2025-05-29 23:32:55 +08:00
// GetEventWithResponse request
GetEventWithResponse ( ctx context . Context , reqEditors ... RequestEditorFn ) ( * GetEventResponse , error )
2025-05-29 00:53:22 +08:00
// PostProviderListWithResponse request
PostProviderListWithResponse ( ctx context . Context , reqEditors ... RequestEditorFn ) ( * PostProviderListResponse , error )
2025-05-29 03:07:51 +08:00
// PostSessionAbortWithBodyWithResponse request with any body
PostSessionAbortWithBodyWithResponse ( ctx context . Context , contentType string , body io . Reader , reqEditors ... RequestEditorFn ) ( * PostSessionAbortResponse , error )
PostSessionAbortWithResponse ( ctx context . Context , body PostSessionAbortJSONRequestBody , reqEditors ... RequestEditorFn ) ( * PostSessionAbortResponse , error )
2025-05-19 10:30:41 +08:00
// PostSessionChatWithBodyWithResponse request with any body
PostSessionChatWithBodyWithResponse ( ctx context . Context , contentType string , body io . Reader , reqEditors ... RequestEditorFn ) ( * PostSessionChatResponse , error )
PostSessionChatWithResponse ( ctx context . Context , body PostSessionChatJSONRequestBody , reqEditors ... RequestEditorFn ) ( * PostSessionChatResponse , error )
// PostSessionCreateWithResponse request
PostSessionCreateWithResponse ( ctx context . Context , reqEditors ... RequestEditorFn ) ( * PostSessionCreateResponse , error )
2025-05-27 06:14:36 +08:00
2025-05-28 03:35:48 +08:00
// PostSessionListWithResponse request
PostSessionListWithResponse ( ctx context . Context , reqEditors ... RequestEditorFn ) ( * PostSessionListResponse , error )
2025-05-27 06:14:36 +08:00
// PostSessionMessagesWithBodyWithResponse request with any body
PostSessionMessagesWithBodyWithResponse ( ctx context . Context , contentType string , body io . Reader , reqEditors ... RequestEditorFn ) ( * PostSessionMessagesResponse , error )
PostSessionMessagesWithResponse ( ctx context . Context , body PostSessionMessagesJSONRequestBody , reqEditors ... RequestEditorFn ) ( * PostSessionMessagesResponse , error )
// PostSessionShareWithBodyWithResponse request with any body
PostSessionShareWithBodyWithResponse ( ctx context . Context , contentType string , body io . Reader , reqEditors ... RequestEditorFn ) ( * PostSessionShareResponse , error )
PostSessionShareWithResponse ( ctx context . Context , body PostSessionShareJSONRequestBody , reqEditors ... RequestEditorFn ) ( * PostSessionShareResponse , error )
2025-05-30 03:04:44 +08:00
// PostSessionSummarizeWithBodyWithResponse request with any body
PostSessionSummarizeWithBodyWithResponse ( ctx context . Context , contentType string , body io . Reader , reqEditors ... RequestEditorFn ) ( * PostSessionSummarizeResponse , error )
PostSessionSummarizeWithResponse ( ctx context . Context , body PostSessionSummarizeJSONRequestBody , reqEditors ... RequestEditorFn ) ( * PostSessionSummarizeResponse , error )
2025-05-19 10:30:41 +08:00
}
2025-05-29 23:32:55 +08:00
type GetEventResponse struct {
Body [ ] byte
HTTPResponse * http . Response
JSON200 * Event
}
// Status returns HTTPResponse.Status
func ( r GetEventResponse ) Status ( ) string {
if r . HTTPResponse != nil {
return r . HTTPResponse . Status
}
return http . StatusText ( 0 )
}
// StatusCode returns HTTPResponse.StatusCode
func ( r GetEventResponse ) StatusCode ( ) int {
if r . HTTPResponse != nil {
return r . HTTPResponse . StatusCode
}
return 0
}
2025-05-29 00:53:22 +08:00
type PostProviderListResponse struct {
Body [ ] byte
HTTPResponse * http . Response
2025-05-29 23:58:40 +08:00
JSON200 * map [ string ] ProviderInfo
2025-05-29 00:53:22 +08:00
}
// Status returns HTTPResponse.Status
func ( r PostProviderListResponse ) Status ( ) string {
if r . HTTPResponse != nil {
return r . HTTPResponse . Status
}
return http . StatusText ( 0 )
}
// StatusCode returns HTTPResponse.StatusCode
func ( r PostProviderListResponse ) StatusCode ( ) int {
if r . HTTPResponse != nil {
return r . HTTPResponse . StatusCode
}
return 0
}
2025-05-29 03:07:51 +08:00
type PostSessionAbortResponse struct {
Body [ ] byte
HTTPResponse * http . Response
JSON200 * bool
}
// Status returns HTTPResponse.Status
func ( r PostSessionAbortResponse ) Status ( ) string {
if r . HTTPResponse != nil {
return r . HTTPResponse . Status
}
return http . StatusText ( 0 )
}
// StatusCode returns HTTPResponse.StatusCode
func ( r PostSessionAbortResponse ) StatusCode ( ) int {
if r . HTTPResponse != nil {
return r . HTTPResponse . StatusCode
}
return 0
}
2025-05-19 10:30:41 +08:00
type PostSessionChatResponse struct {
Body [ ] byte
HTTPResponse * http . Response
2025-05-29 22:21:59 +08:00
JSON200 * MessageInfo
2025-05-19 10:30:41 +08:00
}
// Status returns HTTPResponse.Status
func ( r PostSessionChatResponse ) Status ( ) string {
if r . HTTPResponse != nil {
return r . HTTPResponse . Status
}
return http . StatusText ( 0 )
}
// StatusCode returns HTTPResponse.StatusCode
func ( r PostSessionChatResponse ) StatusCode ( ) int {
if r . HTTPResponse != nil {
return r . HTTPResponse . StatusCode
}
return 0
}
type PostSessionCreateResponse struct {
Body [ ] byte
HTTPResponse * http . Response
JSON200 * SessionInfo
}
// Status returns HTTPResponse.Status
func ( r PostSessionCreateResponse ) Status ( ) string {
if r . HTTPResponse != nil {
return r . HTTPResponse . Status
}
return http . StatusText ( 0 )
}
// StatusCode returns HTTPResponse.StatusCode
func ( r PostSessionCreateResponse ) StatusCode ( ) int {
if r . HTTPResponse != nil {
return r . HTTPResponse . StatusCode
}
return 0
}
2025-05-28 03:35:48 +08:00
type PostSessionListResponse struct {
Body [ ] byte
HTTPResponse * http . Response
2025-05-29 23:38:55 +08:00
JSON200 * [ ] SessionInfo
2025-05-28 03:35:48 +08:00
}
// Status returns HTTPResponse.Status
func ( r PostSessionListResponse ) Status ( ) string {
if r . HTTPResponse != nil {
return r . HTTPResponse . Status
}
return http . StatusText ( 0 )
}
// StatusCode returns HTTPResponse.StatusCode
func ( r PostSessionListResponse ) StatusCode ( ) int {
if r . HTTPResponse != nil {
return r . HTTPResponse . StatusCode
}
return 0
}
2025-05-27 06:14:36 +08:00
type PostSessionMessagesResponse struct {
Body [ ] byte
HTTPResponse * http . Response
2025-05-29 22:21:59 +08:00
JSON200 * [ ] MessageInfo
2025-05-27 06:14:36 +08:00
}
// Status returns HTTPResponse.Status
func ( r PostSessionMessagesResponse ) Status ( ) string {
if r . HTTPResponse != nil {
return r . HTTPResponse . Status
}
return http . StatusText ( 0 )
}
// StatusCode returns HTTPResponse.StatusCode
func ( r PostSessionMessagesResponse ) StatusCode ( ) int {
if r . HTTPResponse != nil {
return r . HTTPResponse . StatusCode
}
return 0
}
type PostSessionShareResponse struct {
Body [ ] byte
HTTPResponse * http . Response
JSON200 * SessionInfo
}
// Status returns HTTPResponse.Status
func ( r PostSessionShareResponse ) Status ( ) string {
if r . HTTPResponse != nil {
return r . HTTPResponse . Status
}
return http . StatusText ( 0 )
}
// StatusCode returns HTTPResponse.StatusCode
func ( r PostSessionShareResponse ) StatusCode ( ) int {
if r . HTTPResponse != nil {
return r . HTTPResponse . StatusCode
}
return 0
}
2025-05-30 03:04:44 +08:00
type PostSessionSummarizeResponse struct {
Body [ ] byte
HTTPResponse * http . Response
JSON200 * bool
}
// Status returns HTTPResponse.Status
func ( r PostSessionSummarizeResponse ) Status ( ) string {
if r . HTTPResponse != nil {
return r . HTTPResponse . Status
}
return http . StatusText ( 0 )
}
// StatusCode returns HTTPResponse.StatusCode
func ( r PostSessionSummarizeResponse ) StatusCode ( ) int {
if r . HTTPResponse != nil {
return r . HTTPResponse . StatusCode
}
return 0
}
2025-05-29 23:32:55 +08:00
// GetEventWithResponse request returning *GetEventResponse
func ( c * ClientWithResponses ) GetEventWithResponse ( ctx context . Context , reqEditors ... RequestEditorFn ) ( * GetEventResponse , error ) {
rsp , err := c . GetEvent ( ctx , reqEditors ... )
if err != nil {
return nil , err
}
return ParseGetEventResponse ( rsp )
}
2025-05-29 00:53:22 +08:00
// PostProviderListWithResponse request returning *PostProviderListResponse
func ( c * ClientWithResponses ) PostProviderListWithResponse ( ctx context . Context , reqEditors ... RequestEditorFn ) ( * PostProviderListResponse , error ) {
rsp , err := c . PostProviderList ( ctx , reqEditors ... )
if err != nil {
return nil , err
}
return ParsePostProviderListResponse ( rsp )
}
2025-05-29 03:07:51 +08:00
// PostSessionAbortWithBodyWithResponse request with arbitrary body returning *PostSessionAbortResponse
func ( c * ClientWithResponses ) PostSessionAbortWithBodyWithResponse ( ctx context . Context , contentType string , body io . Reader , reqEditors ... RequestEditorFn ) ( * PostSessionAbortResponse , error ) {
rsp , err := c . PostSessionAbortWithBody ( ctx , contentType , body , reqEditors ... )
if err != nil {
return nil , err
}
return ParsePostSessionAbortResponse ( rsp )
}
func ( c * ClientWithResponses ) PostSessionAbortWithResponse ( ctx context . Context , body PostSessionAbortJSONRequestBody , reqEditors ... RequestEditorFn ) ( * PostSessionAbortResponse , error ) {
rsp , err := c . PostSessionAbort ( ctx , body , reqEditors ... )
if err != nil {
return nil , err
}
return ParsePostSessionAbortResponse ( rsp )
}
2025-05-19 10:30:41 +08:00
// PostSessionChatWithBodyWithResponse request with arbitrary body returning *PostSessionChatResponse
func ( c * ClientWithResponses ) PostSessionChatWithBodyWithResponse ( ctx context . Context , contentType string , body io . Reader , reqEditors ... RequestEditorFn ) ( * PostSessionChatResponse , error ) {
rsp , err := c . PostSessionChatWithBody ( ctx , contentType , body , reqEditors ... )
if err != nil {
return nil , err
}
return ParsePostSessionChatResponse ( rsp )
}
func ( c * ClientWithResponses ) PostSessionChatWithResponse ( ctx context . Context , body PostSessionChatJSONRequestBody , reqEditors ... RequestEditorFn ) ( * PostSessionChatResponse , error ) {
rsp , err := c . PostSessionChat ( ctx , body , reqEditors ... )
if err != nil {
return nil , err
}
return ParsePostSessionChatResponse ( rsp )
}
// PostSessionCreateWithResponse request returning *PostSessionCreateResponse
func ( c * ClientWithResponses ) PostSessionCreateWithResponse ( ctx context . Context , reqEditors ... RequestEditorFn ) ( * PostSessionCreateResponse , error ) {
rsp , err := c . PostSessionCreate ( ctx , reqEditors ... )
if err != nil {
return nil , err
}
return ParsePostSessionCreateResponse ( rsp )
}
2025-05-28 03:35:48 +08:00
// PostSessionListWithResponse request returning *PostSessionListResponse
func ( c * ClientWithResponses ) PostSessionListWithResponse ( ctx context . Context , reqEditors ... RequestEditorFn ) ( * PostSessionListResponse , error ) {
rsp , err := c . PostSessionList ( ctx , reqEditors ... )
if err != nil {
return nil , err
}
return ParsePostSessionListResponse ( rsp )
}
2025-05-27 06:14:36 +08:00
// PostSessionMessagesWithBodyWithResponse request with arbitrary body returning *PostSessionMessagesResponse
func ( c * ClientWithResponses ) PostSessionMessagesWithBodyWithResponse ( ctx context . Context , contentType string , body io . Reader , reqEditors ... RequestEditorFn ) ( * PostSessionMessagesResponse , error ) {
rsp , err := c . PostSessionMessagesWithBody ( ctx , contentType , body , reqEditors ... )
if err != nil {
return nil , err
}
return ParsePostSessionMessagesResponse ( rsp )
}
func ( c * ClientWithResponses ) PostSessionMessagesWithResponse ( ctx context . Context , body PostSessionMessagesJSONRequestBody , reqEditors ... RequestEditorFn ) ( * PostSessionMessagesResponse , error ) {
rsp , err := c . PostSessionMessages ( ctx , body , reqEditors ... )
if err != nil {
return nil , err
}
return ParsePostSessionMessagesResponse ( rsp )
}
// PostSessionShareWithBodyWithResponse request with arbitrary body returning *PostSessionShareResponse
func ( c * ClientWithResponses ) PostSessionShareWithBodyWithResponse ( ctx context . Context , contentType string , body io . Reader , reqEditors ... RequestEditorFn ) ( * PostSessionShareResponse , error ) {
rsp , err := c . PostSessionShareWithBody ( ctx , contentType , body , reqEditors ... )
if err != nil {
return nil , err
}
return ParsePostSessionShareResponse ( rsp )
}
func ( c * ClientWithResponses ) PostSessionShareWithResponse ( ctx context . Context , body PostSessionShareJSONRequestBody , reqEditors ... RequestEditorFn ) ( * PostSessionShareResponse , error ) {
rsp , err := c . PostSessionShare ( ctx , body , reqEditors ... )
if err != nil {
return nil , err
}
return ParsePostSessionShareResponse ( rsp )
}
2025-05-30 03:04:44 +08:00
// PostSessionSummarizeWithBodyWithResponse request with arbitrary body returning *PostSessionSummarizeResponse
func ( c * ClientWithResponses ) PostSessionSummarizeWithBodyWithResponse ( ctx context . Context , contentType string , body io . Reader , reqEditors ... RequestEditorFn ) ( * PostSessionSummarizeResponse , error ) {
rsp , err := c . PostSessionSummarizeWithBody ( ctx , contentType , body , reqEditors ... )
if err != nil {
return nil , err
}
return ParsePostSessionSummarizeResponse ( rsp )
}
func ( c * ClientWithResponses ) PostSessionSummarizeWithResponse ( ctx context . Context , body PostSessionSummarizeJSONRequestBody , reqEditors ... RequestEditorFn ) ( * PostSessionSummarizeResponse , error ) {
rsp , err := c . PostSessionSummarize ( ctx , body , reqEditors ... )
if err != nil {
return nil , err
}
return ParsePostSessionSummarizeResponse ( rsp )
}
2025-05-29 23:32:55 +08:00
// ParseGetEventResponse parses an HTTP response from a GetEventWithResponse call
func ParseGetEventResponse ( rsp * http . Response ) ( * GetEventResponse , error ) {
bodyBytes , err := io . ReadAll ( rsp . Body )
defer func ( ) { _ = rsp . Body . Close ( ) } ( )
if err != nil {
return nil , err
}
response := & GetEventResponse {
Body : bodyBytes ,
HTTPResponse : rsp ,
}
switch {
case strings . Contains ( rsp . Header . Get ( "Content-Type" ) , "json" ) && rsp . StatusCode == 200 :
var dest Event
if err := json . Unmarshal ( bodyBytes , & dest ) ; err != nil {
return nil , err
}
response . JSON200 = & dest
}
return response , nil
}
2025-05-29 00:53:22 +08:00
// ParsePostProviderListResponse parses an HTTP response from a PostProviderListWithResponse call
func ParsePostProviderListResponse ( rsp * http . Response ) ( * PostProviderListResponse , error ) {
bodyBytes , err := io . ReadAll ( rsp . Body )
defer func ( ) { _ = rsp . Body . Close ( ) } ( )
if err != nil {
return nil , err
}
response := & PostProviderListResponse {
Body : bodyBytes ,
HTTPResponse : rsp ,
}
switch {
case strings . Contains ( rsp . Header . Get ( "Content-Type" ) , "json" ) && rsp . StatusCode == 200 :
2025-05-29 23:58:40 +08:00
var dest map [ string ] ProviderInfo
2025-05-29 00:53:22 +08:00
if err := json . Unmarshal ( bodyBytes , & dest ) ; err != nil {
return nil , err
}
response . JSON200 = & dest
}
return response , nil
}
2025-05-29 03:07:51 +08:00
// ParsePostSessionAbortResponse parses an HTTP response from a PostSessionAbortWithResponse call
func ParsePostSessionAbortResponse ( rsp * http . Response ) ( * PostSessionAbortResponse , error ) {
bodyBytes , err := io . ReadAll ( rsp . Body )
defer func ( ) { _ = rsp . Body . Close ( ) } ( )
if err != nil {
return nil , err
}
response := & PostSessionAbortResponse {
Body : bodyBytes ,
HTTPResponse : rsp ,
}
switch {
case strings . Contains ( rsp . Header . Get ( "Content-Type" ) , "json" ) && rsp . StatusCode == 200 :
var dest bool
if err := json . Unmarshal ( bodyBytes , & dest ) ; err != nil {
return nil , err
}
response . JSON200 = & dest
}
return response , nil
}
2025-05-19 10:30:41 +08:00
// ParsePostSessionChatResponse parses an HTTP response from a PostSessionChatWithResponse call
func ParsePostSessionChatResponse ( rsp * http . Response ) ( * PostSessionChatResponse , error ) {
bodyBytes , err := io . ReadAll ( rsp . Body )
defer func ( ) { _ = rsp . Body . Close ( ) } ( )
if err != nil {
return nil , err
}
response := & PostSessionChatResponse {
Body : bodyBytes ,
HTTPResponse : rsp ,
}
2025-05-29 03:07:51 +08:00
switch {
case strings . Contains ( rsp . Header . Get ( "Content-Type" ) , "json" ) && rsp . StatusCode == 200 :
2025-05-29 22:21:59 +08:00
var dest MessageInfo
2025-05-29 03:07:51 +08:00
if err := json . Unmarshal ( bodyBytes , & dest ) ; err != nil {
return nil , err
}
response . JSON200 = & dest
}
2025-05-19 10:30:41 +08:00
return response , nil
}
// ParsePostSessionCreateResponse parses an HTTP response from a PostSessionCreateWithResponse call
func ParsePostSessionCreateResponse ( rsp * http . Response ) ( * PostSessionCreateResponse , error ) {
bodyBytes , err := io . ReadAll ( rsp . Body )
defer func ( ) { _ = rsp . Body . Close ( ) } ( )
if err != nil {
return nil , err
}
response := & PostSessionCreateResponse {
Body : bodyBytes ,
HTTPResponse : rsp ,
}
switch {
case strings . Contains ( rsp . Header . Get ( "Content-Type" ) , "json" ) && rsp . StatusCode == 200 :
var dest SessionInfo
if err := json . Unmarshal ( bodyBytes , & dest ) ; err != nil {
return nil , err
}
response . JSON200 = & dest
}
return response , nil
}
2025-05-27 06:14:36 +08:00
2025-05-28 03:35:48 +08:00
// ParsePostSessionListResponse parses an HTTP response from a PostSessionListWithResponse call
func ParsePostSessionListResponse ( rsp * http . Response ) ( * PostSessionListResponse , error ) {
bodyBytes , err := io . ReadAll ( rsp . Body )
defer func ( ) { _ = rsp . Body . Close ( ) } ( )
if err != nil {
return nil , err
}
response := & PostSessionListResponse {
Body : bodyBytes ,
HTTPResponse : rsp ,
}
switch {
case strings . Contains ( rsp . Header . Get ( "Content-Type" ) , "json" ) && rsp . StatusCode == 200 :
2025-05-29 23:38:55 +08:00
var dest [ ] SessionInfo
2025-05-28 03:35:48 +08:00
if err := json . Unmarshal ( bodyBytes , & dest ) ; err != nil {
return nil , err
}
response . JSON200 = & dest
}
return response , nil
}
2025-05-27 06:14:36 +08:00
// ParsePostSessionMessagesResponse parses an HTTP response from a PostSessionMessagesWithResponse call
func ParsePostSessionMessagesResponse ( rsp * http . Response ) ( * PostSessionMessagesResponse , error ) {
bodyBytes , err := io . ReadAll ( rsp . Body )
defer func ( ) { _ = rsp . Body . Close ( ) } ( )
if err != nil {
return nil , err
}
response := & PostSessionMessagesResponse {
Body : bodyBytes ,
HTTPResponse : rsp ,
}
switch {
case strings . Contains ( rsp . Header . Get ( "Content-Type" ) , "json" ) && rsp . StatusCode == 200 :
2025-05-29 22:21:59 +08:00
var dest [ ] MessageInfo
2025-05-27 06:14:36 +08:00
if err := json . Unmarshal ( bodyBytes , & dest ) ; err != nil {
return nil , err
}
response . JSON200 = & dest
}
return response , nil
}
// ParsePostSessionShareResponse parses an HTTP response from a PostSessionShareWithResponse call
func ParsePostSessionShareResponse ( rsp * http . Response ) ( * PostSessionShareResponse , error ) {
bodyBytes , err := io . ReadAll ( rsp . Body )
defer func ( ) { _ = rsp . Body . Close ( ) } ( )
if err != nil {
return nil , err
}
response := & PostSessionShareResponse {
Body : bodyBytes ,
HTTPResponse : rsp ,
}
switch {
case strings . Contains ( rsp . Header . Get ( "Content-Type" ) , "json" ) && rsp . StatusCode == 200 :
var dest SessionInfo
if err := json . Unmarshal ( bodyBytes , & dest ) ; err != nil {
return nil , err
}
response . JSON200 = & dest
}
return response , nil
}
2025-05-30 03:04:44 +08:00
// ParsePostSessionSummarizeResponse parses an HTTP response from a PostSessionSummarizeWithResponse call
func ParsePostSessionSummarizeResponse ( rsp * http . Response ) ( * PostSessionSummarizeResponse , error ) {
bodyBytes , err := io . ReadAll ( rsp . Body )
defer func ( ) { _ = rsp . Body . Close ( ) } ( )
if err != nil {
return nil , err
}
response := & PostSessionSummarizeResponse {
Body : bodyBytes ,
HTTPResponse : rsp ,
}
switch {
case strings . Contains ( rsp . Header . Get ( "Content-Type" ) , "json" ) && rsp . StatusCode == 200 :
var dest bool
if err := json . Unmarshal ( bodyBytes , & dest ) ; err != nil {
return nil , err
}
response . JSON200 = & dest
}
return response , nil
}