| 12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788899091929394959697989910010110210310410510610710810911011111211311411511611711811912012112212312412512612712812913013113213313413513613713813914014114214314414514614714814915015115215315415515615715815916016116216316416516616716816917017117217317417517617717817918018118218318418518618718818919019119219319419519619719819920020120220320420520620720820921021121221321421521621721821922022122222322422522622722822923023123223323423523623723823924024124224324424524624724824925025125225325425525625725825926026126226326426526626726826927027127227327427527627727827928028128228328428528628728828929029129229329429529629729829930030130230330430530630730830931031131231331431531631731831932032132232332432532632732832933033133233333433533633733833934034134234334434534634734834935035135235335435535635735835936036136236336436536636736836937037137237337437537637737837938038138238338438538638738838939039139239339439539639739839940040140240340440540640740840941041141241341441541641741841942042142242342442542642742842943043143243343443543643743843944044144244344444544644744844945045145245345445545645745845946046146246346446546646746846947047147247347447547647747847948048148248348448548648748848949049149249349449549649749849950050150250350450550650750850951051151251351451551651751851952052152252352452552652752852953053153253353453553653753853954054154254354454554654754854955055155255355455555655755855956056156256356456556656756856957057157257357457557657757857958058158258358458558658758858959059159259359459559659759859960060160260360460560660760860961061161261361461561661761861962062162262362462562662762862963063163263363463563663763863964064164264364464564664764864965065165265365465565665765865966066166266366466566666766866967067167267367467567667767867968068168268368468568668768868969069169269369469569669769869970070170270370470570670770870971071171271371471571671771871972072172272372472572672772872973073173273373473573673773873974074174274374474574674774874975075175275375475575675775875976076176276376476576676776876977077177277377477577677777877978078178278378478578678778878979079179279379479579679779879980080180280380480580680780880981081181281381481581681781881982082182282382482582682782882983083183283383483583683783883984084184284384484584684784884985085185285385485585685785885986086186286386486586686786886987087187287387487587687787887988088188288388488588688788888989089189289389489589689789889990090190290390490590690790890991091191291391491591691791891992092192292392492592692792892993093193293393493593693793893994094194294394494594694794894995095195295395495595695795895996096196296396496596696796896997097197297397497597697797897998098198298398498598698798898999099199299399499599699799899910001001100210031004100510061007100810091010101110121013101410151016101710181019102010211022102310241025102610271028102910301031103210331034103510361037103810391040104110421043104410451046104710481049105010511052105310541055105610571058105910601061106210631064106510661067106810691070107110721073107410751076107710781079108010811082108310841085108610871088108910901091109210931094109510961097109810991100110111021103110411051106110711081109111011111112111311141115111611171118111911201121112211231124112511261127112811291130113111321133113411351136113711381139114011411142114311441145114611471148114911501151115211531154115511561157115811591160116111621163116411651166116711681169117011711172117311741175117611771178117911801181118211831184118511861187118811891190119111921193119411951196119711981199120012011202120312041205120612071208120912101211121212131214121512161217121812191220122112221223122412251226122712281229123012311232123312341235123612371238123912401241124212431244124512461247124812491250125112521253125412551256125712581259126012611262126312641265126612671268126912701271127212731274127512761277127812791280128112821283128412851286128712881289129012911292129312941295129612971298129913001301130213031304130513061307130813091310131113121313131413151316131713181319132013211322132313241325132613271328132913301331133213331334133513361337133813391340134113421343134413451346134713481349135013511352135313541355135613571358135913601361136213631364136513661367136813691370137113721373137413751376137713781379138013811382138313841385138613871388138913901391139213931394139513961397139813991400140114021403140414051406140714081409141014111412141314141415141614171418141914201421142214231424142514261427142814291430143114321433143414351436143714381439144014411442144314441445144614471448144914501451145214531454145514561457145814591460146114621463146414651466146714681469147014711472147314741475147614771478147914801481148214831484148514861487148814891490149114921493149414951496149714981499150015011502150315041505150615071508150915101511151215131514151515161517151815191520152115221523152415251526152715281529153015311532153315341535153615371538153915401541154215431544154515461547154815491550155115521553155415551556155715581559156015611562156315641565156615671568156915701571157215731574157515761577157815791580158115821583158415851586158715881589159015911592159315941595159615971598159916001601160216031604160516061607160816091610161116121613161416151616161716181619162016211622162316241625162616271628162916301631163216331634163516361637163816391640164116421643164416451646164716481649165016511652165316541655165616571658165916601661166216631664166516661667166816691670167116721673167416751676167716781679168016811682168316841685168616871688168916901691169216931694169516961697169816991700170117021703170417051706170717081709171017111712171317141715171617171718171917201721172217231724172517261727172817291730173117321733173417351736173717381739174017411742174317441745174617471748174917501751175217531754175517561757175817591760176117621763176417651766176717681769177017711772177317741775177617771778177917801781178217831784178517861787178817891790179117921793179417951796179717981799180018011802180318041805180618071808180918101811181218131814181518161817181818191820182118221823182418251826182718281829183018311832183318341835183618371838183918401841184218431844184518461847184818491850185118521853185418551856185718581859186018611862186318641865186618671868186918701871187218731874187518761877187818791880188118821883188418851886188718881889189018911892189318941895189618971898189919001901190219031904190519061907190819091910191119121913191419151916191719181919192019211922192319241925192619271928192919301931193219331934193519361937193819391940194119421943194419451946194719481949195019511952195319541955195619571958195919601961196219631964196519661967196819691970197119721973197419751976197719781979198019811982198319841985198619871988198919901991199219931994199519961997199819992000200120022003200420052006200720082009201020112012201320142015201620172018201920202021202220232024202520262027202820292030203120322033203420352036203720382039204020412042204320442045204620472048204920502051205220532054205520562057205820592060206120622063206420652066206720682069207020712072207320742075207620772078207920802081208220832084208520862087208820892090209120922093209420952096209720982099210021012102210321042105210621072108210921102111211221132114211521162117211821192120212121222123212421252126212721282129213021312132213321342135213621372138213921402141214221432144214521462147214821492150215121522153215421552156215721582159216021612162216321642165216621672168216921702171217221732174217521762177217821792180218121822183218421852186218721882189219021912192219321942195219621972198219922002201220222032204220522062207220822092210221122122213221422152216221722182219222022212222222322242225222622272228222922302231223222332234223522362237223822392240224122422243224422452246224722482249225022512252225322542255225622572258225922602261226222632264226522662267226822692270227122722273227422752276227722782279228022812282228322842285228622872288228922902291229222932294229522962297229822992300230123022303230423052306230723082309231023112312231323142315231623172318231923202321232223232324232523262327232823292330233123322333233423352336233723382339234023412342234323442345234623472348234923502351235223532354235523562357235823592360236123622363236423652366236723682369237023712372237323742375237623772378237923802381238223832384238523862387238823892390239123922393239423952396239723982399240024012402240324042405240624072408240924102411241224132414241524162417241824192420242124222423242424252426242724282429243024312432243324342435243624372438243924402441244224432444244524462447244824492450245124522453245424552456245724582459246024612462246324642465246624672468246924702471247224732474247524762477247824792480248124822483248424852486248724882489249024912492249324942495249624972498249925002501250225032504250525062507250825092510251125122513251425152516251725182519252025212522252325242525252625272528252925302531253225332534253525362537253825392540254125422543254425452546254725482549255025512552255325542555255625572558255925602561256225632564256525662567256825692570257125722573257425752576257725782579258025812582258325842585258625872588258925902591259225932594259525962597259825992600260126022603260426052606260726082609261026112612261326142615261626172618261926202621262226232624262526262627262826292630263126322633263426352636263726382639264026412642264326442645264626472648264926502651265226532654265526562657265826592660266126622663266426652666266726682669267026712672267326742675267626772678267926802681268226832684268526862687268826892690269126922693269426952696269726982699270027012702270327042705270627072708270927102711271227132714271527162717271827192720272127222723272427252726272727282729273027312732273327342735273627372738273927402741274227432744274527462747274827492750275127522753275427552756275727582759276027612762276327642765276627672768276927702771277227732774277527762777277827792780278127822783278427852786278727882789279027912792279327942795279627972798279928002801280228032804280528062807280828092810281128122813281428152816281728182819282028212822282328242825282628272828282928302831283228332834283528362837283828392840284128422843284428452846284728482849285028512852285328542855285628572858285928602861286228632864286528662867286828692870287128722873287428752876287728782879288028812882288328842885288628872888288928902891289228932894289528962897289828992900290129022903290429052906290729082909291029112912291329142915291629172918291929202921292229232924292529262927292829292930293129322933293429352936293729382939294029412942294329442945294629472948294929502951295229532954295529562957295829592960296129622963296429652966296729682969297029712972297329742975297629772978297929802981298229832984298529862987298829892990299129922993299429952996299729982999300030013002300330043005300630073008300930103011301230133014301530163017301830193020302130223023302430253026302730283029303030313032303330343035303630373038303930403041304230433044304530463047304830493050305130523053305430553056305730583059306030613062306330643065306630673068306930703071307230733074307530763077307830793080308130823083308430853086308730883089309030913092309330943095309630973098309931003101310231033104310531063107310831093110311131123113311431153116311731183119312031213122312331243125312631273128312931303131313231333134313531363137313831393140314131423143314431453146314731483149315031513152315331543155315631573158315931603161316231633164316531663167316831693170317131723173317431753176317731783179318031813182318331843185318631873188318931903191319231933194319531963197319831993200320132023203320432053206320732083209321032113212321332143215321632173218321932203221322232233224322532263227322832293230323132323233323432353236323732383239324032413242324332443245324632473248324932503251325232533254325532563257325832593260326132623263326432653266326732683269327032713272327332743275327632773278327932803281328232833284328532863287328832893290329132923293329432953296329732983299330033013302330333043305330633073308330933103311331233133314331533163317331833193320332133223323332433253326332733283329333033313332333333343335333633373338333933403341334233433344334533463347334833493350335133523353335433553356335733583359336033613362336333643365336633673368336933703371337233733374337533763377337833793380338133823383338433853386338733883389339033913392339333943395339633973398339934003401340234033404340534063407340834093410341134123413341434153416341734183419342034213422342334243425342634273428342934303431343234333434343534363437343834393440344134423443344434453446344734483449345034513452345334543455345634573458345934603461346234633464346534663467346834693470347134723473347434753476347734783479348034813482348334843485348634873488348934903491349234933494349534963497349834993500350135023503350435053506350735083509351035113512351335143515351635173518351935203521352235233524352535263527352835293530353135323533 |
- // 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"
- "errors"
- "fmt"
- "io"
- "net/http"
- "net/url"
- "strings"
- "github.com/oapi-codegen/runtime"
- )
- // Defines values for MessageInfoRole.
- const (
- Assistant MessageInfoRole = "assistant"
- User MessageInfoRole = "user"
- )
- // AppInfo defines model for App.Info.
- type AppInfo struct {
- Git bool `json:"git"`
- Path struct {
- Config string `json:"config"`
- Cwd string `json:"cwd"`
- Data string `json:"data"`
- Root string `json:"root"`
- State string `json:"state"`
- } `json:"path"`
- Time struct {
- Initialized *float32 `json:"initialized,omitempty"`
- } `json:"time"`
- User string `json:"user"`
- }
- // ConfigInfo defines model for Config.Info.
- type ConfigInfo struct {
- // Schema JSON schema reference for configuration validation
- Schema *string `json:"$schema,omitempty"`
- // Autoshare Share newly created sessions automatically
- Autoshare *bool `json:"autoshare,omitempty"`
- // Autoupdate Automatically update to the latest version
- Autoupdate *bool `json:"autoupdate,omitempty"`
- // DisabledProviders Disable providers that are loaded automatically
- DisabledProviders *[]string `json:"disabled_providers,omitempty"`
- Keybinds *ConfigKeybinds `json:"keybinds,omitempty"`
- // Mcp MCP (Model Context Protocol) server configurations
- Mcp *map[string]ConfigInfo_Mcp_AdditionalProperties `json:"mcp,omitempty"`
- // Model Model to use in the format of provider/model, eg anthropic/claude-2
- Model *string `json:"model,omitempty"`
- // Provider Custom provider configurations and model overrides
- Provider *map[string]struct {
- Api *string `json:"api,omitempty"`
- Env *[]string `json:"env,omitempty"`
- Id *string `json:"id,omitempty"`
- Models map[string]struct {
- Attachment *bool `json:"attachment,omitempty"`
- Cost *struct {
- CacheRead *float32 `json:"cache_read,omitempty"`
- CacheWrite *float32 `json:"cache_write,omitempty"`
- Input float32 `json:"input"`
- Output float32 `json:"output"`
- } `json:"cost,omitempty"`
- Id *string `json:"id,omitempty"`
- Limit *struct {
- Context float32 `json:"context"`
- Output float32 `json:"output"`
- } `json:"limit,omitempty"`
- Name *string `json:"name,omitempty"`
- Reasoning *bool `json:"reasoning,omitempty"`
- Temperature *bool `json:"temperature,omitempty"`
- } `json:"models"`
- Name *string `json:"name,omitempty"`
- Npm *string `json:"npm,omitempty"`
- Options *map[string]interface{} `json:"options,omitempty"`
- } `json:"provider,omitempty"`
- // Theme Theme name to use for the interface
- Theme *string `json:"theme,omitempty"`
- }
- // ConfigInfo_Mcp_AdditionalProperties defines model for Config.Info.mcp.AdditionalProperties.
- type ConfigInfo_Mcp_AdditionalProperties struct {
- union json.RawMessage
- }
- // ConfigKeybinds defines model for Config.Keybinds.
- type ConfigKeybinds struct {
- // AppExit Exit the application
- AppExit *string `json:"app_exit,omitempty"`
- // EditorOpen Open external editor
- EditorOpen *string `json:"editor_open,omitempty"`
- // Help Show help dialog
- Help *string `json:"help,omitempty"`
- // HistoryNext Navigate to next history item
- HistoryNext *string `json:"history_next,omitempty"`
- // HistoryPrevious Navigate to previous history item
- HistoryPrevious *string `json:"history_previous,omitempty"`
- // InputClear Clear input field
- InputClear *string `json:"input_clear,omitempty"`
- // InputNewline Insert newline in input
- InputNewline *string `json:"input_newline,omitempty"`
- // InputPaste Paste from clipboard
- InputPaste *string `json:"input_paste,omitempty"`
- // InputSubmit Submit input
- InputSubmit *string `json:"input_submit,omitempty"`
- // Leader Leader key for keybind combinations
- Leader *string `json:"leader,omitempty"`
- // MessagesFirst Navigate to first message
- MessagesFirst *string `json:"messages_first,omitempty"`
- // MessagesHalfPageDown Scroll messages down by half page
- MessagesHalfPageDown *string `json:"messages_half_page_down,omitempty"`
- // MessagesHalfPageUp Scroll messages up by half page
- MessagesHalfPageUp *string `json:"messages_half_page_up,omitempty"`
- // MessagesLast Navigate to last message
- MessagesLast *string `json:"messages_last,omitempty"`
- // MessagesNext Navigate to next message
- MessagesNext *string `json:"messages_next,omitempty"`
- // MessagesPageDown Scroll messages down by one page
- MessagesPageDown *string `json:"messages_page_down,omitempty"`
- // MessagesPageUp Scroll messages up by one page
- MessagesPageUp *string `json:"messages_page_up,omitempty"`
- // MessagesPrevious Navigate to previous message
- MessagesPrevious *string `json:"messages_previous,omitempty"`
- // ModelList List available models
- ModelList *string `json:"model_list,omitempty"`
- // ProjectInit Initialize project configuration
- ProjectInit *string `json:"project_init,omitempty"`
- // SessionCompact Toggle compact mode for session
- SessionCompact *string `json:"session_compact,omitempty"`
- // SessionInterrupt Interrupt current session
- SessionInterrupt *string `json:"session_interrupt,omitempty"`
- // SessionList List all sessions
- SessionList *string `json:"session_list,omitempty"`
- // SessionNew Create a new session
- SessionNew *string `json:"session_new,omitempty"`
- // SessionShare Share current session
- SessionShare *string `json:"session_share,omitempty"`
- // ThemeList List available themes
- ThemeList *string `json:"theme_list,omitempty"`
- // ToolDetails Show tool details
- ToolDetails *string `json:"tool_details,omitempty"`
- }
- // ConfigMcpLocal defines model for Config.McpLocal.
- type ConfigMcpLocal struct {
- // Command Command and arguments to run the MCP server
- Command []string `json:"command"`
- // Environment Environment variables to set when running the MCP server
- Environment *map[string]string `json:"environment,omitempty"`
- // Type Type of MCP server connection
- Type string `json:"type"`
- }
- // ConfigMcpRemote defines model for Config.McpRemote.
- type ConfigMcpRemote struct {
- // Type Type of MCP server connection
- Type string `json:"type"`
- // Url URL of the remote MCP server
- Url string `json:"url"`
- }
- // Error defines model for Error.
- type Error struct {
- Data map[string]interface{} `json:"data"`
- }
- // Event defines model for Event.
- type Event struct {
- union json.RawMessage
- }
- // EventInstallationUpdated defines model for Event.installation.updated.
- type EventInstallationUpdated struct {
- Properties struct {
- Version string `json:"version"`
- } `json:"properties"`
- Type string `json:"type"`
- }
- // 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"`
- }
- // EventMessagePartUpdated defines model for Event.message.part.updated.
- type EventMessagePartUpdated struct {
- Properties struct {
- MessageID string `json:"messageID"`
- Part MessagePart `json:"part"`
- SessionID string `json:"sessionID"`
- } `json:"properties"`
- Type string `json:"type"`
- }
- // EventMessageUpdated defines model for Event.message.updated.
- type EventMessageUpdated struct {
- Properties struct {
- Info MessageInfo `json:"info"`
- } `json:"properties"`
- Type string `json:"type"`
- }
- // EventPermissionUpdated defines model for Event.permission.updated.
- type EventPermissionUpdated struct {
- Properties PermissionInfo `json:"properties"`
- Type string `json:"type"`
- }
- // EventSessionError defines model for Event.session.error.
- type EventSessionError struct {
- Properties struct {
- Error *EventSessionError_Properties_Error `json:"error,omitempty"`
- } `json:"properties"`
- Type string `json:"type"`
- }
- // EventSessionError_Properties_Error defines model for EventSessionError.Properties.Error.
- type EventSessionError_Properties_Error struct {
- union json.RawMessage
- }
- // EventSessionUpdated defines model for Event.session.updated.
- type EventSessionUpdated struct {
- Properties struct {
- Info SessionInfo `json:"info"`
- } `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"`
- }
- // InstallationInfo defines model for InstallationInfo.
- type InstallationInfo struct {
- Latest string `json:"latest"`
- Version string `json:"version"`
- }
- // MessageInfo defines model for Message.Info.
- type MessageInfo struct {
- Id string `json:"id"`
- Metadata struct {
- Assistant *struct {
- Cost float32 `json:"cost"`
- ModelID string `json:"modelID"`
- Path struct {
- Cwd string `json:"cwd"`
- Root string `json:"root"`
- } `json:"path"`
- ProviderID string `json:"providerID"`
- Summary *bool `json:"summary,omitempty"`
- System []string `json:"system"`
- Tokens struct {
- Cache struct {
- Read float32 `json:"read"`
- Write float32 `json:"write"`
- } `json:"cache"`
- Input float32 `json:"input"`
- Output float32 `json:"output"`
- Reasoning float32 `json:"reasoning"`
- } `json:"tokens"`
- } `json:"assistant,omitempty"`
- Error *MessageInfo_Metadata_Error `json:"error,omitempty"`
- SessionID string `json:"sessionID"`
- Time struct {
- Completed *float32 `json:"completed,omitempty"`
- Created float32 `json:"created"`
- } `json:"time"`
- Tool map[string]MessageInfo_Metadata_Tool_AdditionalProperties `json:"tool"`
- } `json:"metadata"`
- Parts []MessagePart `json:"parts"`
- Role MessageInfoRole `json:"role"`
- }
- // MessageInfo_Metadata_Error defines model for MessageInfo.Metadata.Error.
- type MessageInfo_Metadata_Error struct {
- union json.RawMessage
- }
- // MessageInfo_Metadata_Tool_AdditionalProperties defines model for MessageInfo.Metadata.Tool.AdditionalProperties.
- type MessageInfo_Metadata_Tool_AdditionalProperties struct {
- Time struct {
- End float32 `json:"end"`
- Start float32 `json:"start"`
- } `json:"time"`
- Title string `json:"title"`
- AdditionalProperties map[string]interface{} `json:"-"`
- }
- // MessageInfoRole defines model for MessageInfo.Role.
- type MessageInfoRole string
- // MessagePart defines model for Message.Part.
- type MessagePart struct {
- union json.RawMessage
- }
- // MessagePartFile defines model for Message.Part.File.
- type MessagePartFile struct {
- Filename *string `json:"filename,omitempty"`
- MediaType string `json:"mediaType"`
- Type string `json:"type"`
- Url string `json:"url"`
- }
- // MessagePartReasoning defines model for Message.Part.Reasoning.
- type MessagePartReasoning struct {
- ProviderMetadata *map[string]interface{} `json:"providerMetadata,omitempty"`
- Text string `json:"text"`
- Type string `json:"type"`
- }
- // MessagePartSourceUrl defines model for Message.Part.SourceUrl.
- type MessagePartSourceUrl 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"`
- }
- // MessagePartStepStart defines model for Message.Part.StepStart.
- type MessagePartStepStart struct {
- Type string `json:"type"`
- }
- // MessagePartText defines model for Message.Part.Text.
- type MessagePartText struct {
- Text string `json:"text"`
- Type string `json:"type"`
- }
- // MessagePartToolInvocation defines model for Message.Part.ToolInvocation.
- type MessagePartToolInvocation struct {
- ToolInvocation MessageToolInvocation `json:"toolInvocation"`
- Type string `json:"type"`
- }
- // MessageToolInvocation defines model for Message.ToolInvocation.
- type MessageToolInvocation struct {
- union json.RawMessage
- }
- // 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"`
- }
- // 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"`
- }
- // 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"`
- }
- // ModelInfo defines model for Model.Info.
- type ModelInfo struct {
- Attachment bool `json:"attachment"`
- Cost struct {
- CacheRead *float32 `json:"cache_read,omitempty"`
- CacheWrite *float32 `json:"cache_write,omitempty"`
- Input float32 `json:"input"`
- Output float32 `json:"output"`
- } `json:"cost"`
- Id string `json:"id"`
- Limit struct {
- Context float32 `json:"context"`
- Output float32 `json:"output"`
- } `json:"limit"`
- Name string `json:"name"`
- Reasoning bool `json:"reasoning"`
- Temperature bool `json:"temperature"`
- }
- // ProviderInfo defines model for Provider.Info.
- type ProviderInfo struct {
- Api *string `json:"api,omitempty"`
- Env []string `json:"env"`
- Id string `json:"id"`
- Models map[string]ModelInfo `json:"models"`
- Name string `json:"name"`
- Npm *string `json:"npm,omitempty"`
- }
- // ProviderAuthError defines model for ProviderAuthError.
- type ProviderAuthError struct {
- Data struct {
- Message string `json:"message"`
- ProviderID string `json:"providerID"`
- } `json:"data"`
- Name string `json:"name"`
- }
- // UnknownError defines model for UnknownError.
- type UnknownError struct {
- Data struct {
- Message string `json:"message"`
- } `json:"data"`
- Name string `json:"name"`
- }
- // PermissionInfo defines model for permission.info.
- type PermissionInfo struct {
- Id string `json:"id"`
- Metadata map[string]interface{} `json:"metadata"`
- SessionID string `json:"sessionID"`
- Time struct {
- Created float32 `json:"created"`
- } `json:"time"`
- Title string `json:"title"`
- }
- // SessionInfo defines model for session.info.
- type SessionInfo struct {
- Id string `json:"id"`
- ParentID *string `json:"parentID,omitempty"`
- Share *struct {
- Url string `json:"url"`
- } `json:"share,omitempty"`
- Time struct {
- Created float32 `json:"created"`
- Updated float32 `json:"updated"`
- } `json:"time"`
- Title string `json:"title"`
- Version string `json:"version"`
- }
- // PostFileSearchJSONBody defines parameters for PostFileSearch.
- type PostFileSearchJSONBody struct {
- Query string `json:"query"`
- }
- // PostSessionAbortJSONBody defines parameters for PostSessionAbort.
- type PostSessionAbortJSONBody struct {
- SessionID string `json:"sessionID"`
- }
- // PostSessionChatJSONBody defines parameters for PostSessionChat.
- type PostSessionChatJSONBody struct {
- ModelID string `json:"modelID"`
- Parts []MessagePart `json:"parts"`
- ProviderID string `json:"providerID"`
- SessionID string `json:"sessionID"`
- }
- // PostSessionInitializeJSONBody defines parameters for PostSessionInitialize.
- type PostSessionInitializeJSONBody struct {
- ModelID string `json:"modelID"`
- ProviderID string `json:"providerID"`
- SessionID string `json:"sessionID"`
- }
- // PostSessionMessagesJSONBody defines parameters for PostSessionMessages.
- type PostSessionMessagesJSONBody struct {
- SessionID string `json:"sessionID"`
- }
- // PostSessionShareJSONBody defines parameters for PostSessionShare.
- type PostSessionShareJSONBody struct {
- SessionID string `json:"sessionID"`
- }
- // PostSessionSummarizeJSONBody defines parameters for PostSessionSummarize.
- type PostSessionSummarizeJSONBody struct {
- ModelID string `json:"modelID"`
- ProviderID string `json:"providerID"`
- SessionID string `json:"sessionID"`
- }
- // PostFileSearchJSONRequestBody defines body for PostFileSearch for application/json ContentType.
- type PostFileSearchJSONRequestBody PostFileSearchJSONBody
- // PostSessionAbortJSONRequestBody defines body for PostSessionAbort for application/json ContentType.
- type PostSessionAbortJSONRequestBody PostSessionAbortJSONBody
- // PostSessionChatJSONRequestBody defines body for PostSessionChat for application/json ContentType.
- type PostSessionChatJSONRequestBody PostSessionChatJSONBody
- // PostSessionInitializeJSONRequestBody defines body for PostSessionInitialize for application/json ContentType.
- type PostSessionInitializeJSONRequestBody PostSessionInitializeJSONBody
- // PostSessionMessagesJSONRequestBody defines body for PostSessionMessages for application/json ContentType.
- type PostSessionMessagesJSONRequestBody PostSessionMessagesJSONBody
- // PostSessionShareJSONRequestBody defines body for PostSessionShare for application/json ContentType.
- type PostSessionShareJSONRequestBody PostSessionShareJSONBody
- // PostSessionSummarizeJSONRequestBody defines body for PostSessionSummarize for application/json ContentType.
- type PostSessionSummarizeJSONRequestBody PostSessionSummarizeJSONBody
- // Getter for additional properties for MessageInfo_Metadata_Tool_AdditionalProperties. Returns the specified
- // element and whether it was found
- func (a MessageInfo_Metadata_Tool_AdditionalProperties) Get(fieldName string) (value interface{}, found bool) {
- if a.AdditionalProperties != nil {
- value, found = a.AdditionalProperties[fieldName]
- }
- return
- }
- // Setter for additional properties for MessageInfo_Metadata_Tool_AdditionalProperties
- func (a *MessageInfo_Metadata_Tool_AdditionalProperties) Set(fieldName string, value interface{}) {
- if a.AdditionalProperties == nil {
- a.AdditionalProperties = make(map[string]interface{})
- }
- a.AdditionalProperties[fieldName] = value
- }
- // Override default JSON handling for MessageInfo_Metadata_Tool_AdditionalProperties to handle AdditionalProperties
- func (a *MessageInfo_Metadata_Tool_AdditionalProperties) UnmarshalJSON(b []byte) error {
- object := make(map[string]json.RawMessage)
- err := json.Unmarshal(b, &object)
- if err != nil {
- return err
- }
- if raw, found := object["time"]; found {
- err = json.Unmarshal(raw, &a.Time)
- if err != nil {
- return fmt.Errorf("error reading 'time': %w", err)
- }
- delete(object, "time")
- }
- if raw, found := object["title"]; found {
- err = json.Unmarshal(raw, &a.Title)
- if err != nil {
- return fmt.Errorf("error reading 'title': %w", err)
- }
- delete(object, "title")
- }
- if len(object) != 0 {
- a.AdditionalProperties = make(map[string]interface{})
- for fieldName, fieldBuf := range object {
- var fieldVal interface{}
- err := json.Unmarshal(fieldBuf, &fieldVal)
- if err != nil {
- return fmt.Errorf("error unmarshalling field %s: %w", fieldName, err)
- }
- a.AdditionalProperties[fieldName] = fieldVal
- }
- }
- return nil
- }
- // Override default JSON handling for MessageInfo_Metadata_Tool_AdditionalProperties to handle AdditionalProperties
- func (a MessageInfo_Metadata_Tool_AdditionalProperties) MarshalJSON() ([]byte, error) {
- var err error
- object := make(map[string]json.RawMessage)
- object["time"], err = json.Marshal(a.Time)
- if err != nil {
- return nil, fmt.Errorf("error marshaling 'time': %w", err)
- }
- object["title"], err = json.Marshal(a.Title)
- if err != nil {
- return nil, fmt.Errorf("error marshaling 'title': %w", err)
- }
- for fieldName, field := range a.AdditionalProperties {
- object[fieldName], err = json.Marshal(field)
- if err != nil {
- return nil, fmt.Errorf("error marshaling '%s': %w", fieldName, err)
- }
- }
- return json.Marshal(object)
- }
- // AsConfigMcpLocal returns the union data inside the ConfigInfo_Mcp_AdditionalProperties as a ConfigMcpLocal
- func (t ConfigInfo_Mcp_AdditionalProperties) AsConfigMcpLocal() (ConfigMcpLocal, error) {
- var body ConfigMcpLocal
- err := json.Unmarshal(t.union, &body)
- return body, err
- }
- // FromConfigMcpLocal overwrites any union data inside the ConfigInfo_Mcp_AdditionalProperties as the provided ConfigMcpLocal
- func (t *ConfigInfo_Mcp_AdditionalProperties) FromConfigMcpLocal(v ConfigMcpLocal) error {
- v.Type = "local"
- b, err := json.Marshal(v)
- t.union = b
- return err
- }
- // MergeConfigMcpLocal performs a merge with any union data inside the ConfigInfo_Mcp_AdditionalProperties, using the provided ConfigMcpLocal
- func (t *ConfigInfo_Mcp_AdditionalProperties) MergeConfigMcpLocal(v ConfigMcpLocal) error {
- v.Type = "local"
- b, err := json.Marshal(v)
- if err != nil {
- return err
- }
- merged, err := runtime.JSONMerge(t.union, b)
- t.union = merged
- return err
- }
- // AsConfigMcpRemote returns the union data inside the ConfigInfo_Mcp_AdditionalProperties as a ConfigMcpRemote
- func (t ConfigInfo_Mcp_AdditionalProperties) AsConfigMcpRemote() (ConfigMcpRemote, error) {
- var body ConfigMcpRemote
- err := json.Unmarshal(t.union, &body)
- return body, err
- }
- // FromConfigMcpRemote overwrites any union data inside the ConfigInfo_Mcp_AdditionalProperties as the provided ConfigMcpRemote
- func (t *ConfigInfo_Mcp_AdditionalProperties) FromConfigMcpRemote(v ConfigMcpRemote) error {
- v.Type = "remote"
- b, err := json.Marshal(v)
- t.union = b
- return err
- }
- // MergeConfigMcpRemote performs a merge with any union data inside the ConfigInfo_Mcp_AdditionalProperties, using the provided ConfigMcpRemote
- func (t *ConfigInfo_Mcp_AdditionalProperties) MergeConfigMcpRemote(v ConfigMcpRemote) error {
- v.Type = "remote"
- b, err := json.Marshal(v)
- if err != nil {
- return err
- }
- merged, err := runtime.JSONMerge(t.union, b)
- t.union = merged
- return err
- }
- func (t ConfigInfo_Mcp_AdditionalProperties) Discriminator() (string, error) {
- var discriminator struct {
- Discriminator string `json:"type"`
- }
- err := json.Unmarshal(t.union, &discriminator)
- return discriminator.Discriminator, err
- }
- func (t ConfigInfo_Mcp_AdditionalProperties) ValueByDiscriminator() (interface{}, error) {
- discriminator, err := t.Discriminator()
- if err != nil {
- return nil, err
- }
- switch discriminator {
- case "local":
- return t.AsConfigMcpLocal()
- case "remote":
- return t.AsConfigMcpRemote()
- default:
- return nil, errors.New("unknown discriminator value: " + discriminator)
- }
- }
- func (t ConfigInfo_Mcp_AdditionalProperties) MarshalJSON() ([]byte, error) {
- b, err := t.union.MarshalJSON()
- return b, err
- }
- func (t *ConfigInfo_Mcp_AdditionalProperties) UnmarshalJSON(b []byte) error {
- err := t.union.UnmarshalJSON(b)
- return err
- }
- // 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
- }
- // AsEventInstallationUpdated returns the union data inside the Event as a EventInstallationUpdated
- func (t Event) AsEventInstallationUpdated() (EventInstallationUpdated, error) {
- var body EventInstallationUpdated
- err := json.Unmarshal(t.union, &body)
- return body, err
- }
- // FromEventInstallationUpdated overwrites any union data inside the Event as the provided EventInstallationUpdated
- func (t *Event) FromEventInstallationUpdated(v EventInstallationUpdated) error {
- v.Type = "installation.updated"
- b, err := json.Marshal(v)
- t.union = b
- return err
- }
- // MergeEventInstallationUpdated performs a merge with any union data inside the Event, using the provided EventInstallationUpdated
- func (t *Event) MergeEventInstallationUpdated(v EventInstallationUpdated) error {
- v.Type = "installation.updated"
- 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
- }
- // AsEventPermissionUpdated returns the union data inside the Event as a EventPermissionUpdated
- func (t Event) AsEventPermissionUpdated() (EventPermissionUpdated, error) {
- var body EventPermissionUpdated
- err := json.Unmarshal(t.union, &body)
- return body, err
- }
- // FromEventPermissionUpdated overwrites any union data inside the Event as the provided EventPermissionUpdated
- func (t *Event) FromEventPermissionUpdated(v EventPermissionUpdated) error {
- v.Type = "permission.updated"
- b, err := json.Marshal(v)
- t.union = b
- return err
- }
- // MergeEventPermissionUpdated performs a merge with any union data inside the Event, using the provided EventPermissionUpdated
- func (t *Event) MergeEventPermissionUpdated(v EventPermissionUpdated) error {
- v.Type = "permission.updated"
- 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
- }
- // AsEventMessagePartUpdated returns the union data inside the Event as a EventMessagePartUpdated
- func (t Event) AsEventMessagePartUpdated() (EventMessagePartUpdated, error) {
- var body EventMessagePartUpdated
- err := json.Unmarshal(t.union, &body)
- return body, err
- }
- // FromEventMessagePartUpdated overwrites any union data inside the Event as the provided EventMessagePartUpdated
- func (t *Event) FromEventMessagePartUpdated(v EventMessagePartUpdated) error {
- v.Type = "message.part.updated"
- b, err := json.Marshal(v)
- t.union = b
- return err
- }
- // MergeEventMessagePartUpdated performs a merge with any union data inside the Event, using the provided EventMessagePartUpdated
- func (t *Event) MergeEventMessagePartUpdated(v EventMessagePartUpdated) error {
- v.Type = "message.part.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
- }
- // AsEventSessionError returns the union data inside the Event as a EventSessionError
- func (t Event) AsEventSessionError() (EventSessionError, error) {
- var body EventSessionError
- err := json.Unmarshal(t.union, &body)
- return body, err
- }
- // FromEventSessionError overwrites any union data inside the Event as the provided EventSessionError
- func (t *Event) FromEventSessionError(v EventSessionError) error {
- v.Type = "session.error"
- b, err := json.Marshal(v)
- t.union = b
- return err
- }
- // MergeEventSessionError performs a merge with any union data inside the Event, using the provided EventSessionError
- func (t *Event) MergeEventSessionError(v EventSessionError) error {
- v.Type = "session.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 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 "installation.updated":
- return t.AsEventInstallationUpdated()
- case "lsp.client.diagnostics":
- return t.AsEventLspClientDiagnostics()
- case "message.part.updated":
- return t.AsEventMessagePartUpdated()
- case "message.updated":
- return t.AsEventMessageUpdated()
- case "permission.updated":
- return t.AsEventPermissionUpdated()
- case "session.error":
- return t.AsEventSessionError()
- 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
- }
- // AsProviderAuthError returns the union data inside the EventSessionError_Properties_Error as a ProviderAuthError
- func (t EventSessionError_Properties_Error) AsProviderAuthError() (ProviderAuthError, error) {
- var body ProviderAuthError
- err := json.Unmarshal(t.union, &body)
- return body, err
- }
- // FromProviderAuthError overwrites any union data inside the EventSessionError_Properties_Error as the provided ProviderAuthError
- func (t *EventSessionError_Properties_Error) FromProviderAuthError(v ProviderAuthError) error {
- v.Name = "ProviderAuthError"
- b, err := json.Marshal(v)
- t.union = b
- return err
- }
- // MergeProviderAuthError performs a merge with any union data inside the EventSessionError_Properties_Error, using the provided ProviderAuthError
- func (t *EventSessionError_Properties_Error) MergeProviderAuthError(v ProviderAuthError) error {
- v.Name = "ProviderAuthError"
- b, err := json.Marshal(v)
- if err != nil {
- return err
- }
- merged, err := runtime.JSONMerge(t.union, b)
- t.union = merged
- return err
- }
- // AsUnknownError returns the union data inside the EventSessionError_Properties_Error as a UnknownError
- func (t EventSessionError_Properties_Error) AsUnknownError() (UnknownError, error) {
- var body UnknownError
- err := json.Unmarshal(t.union, &body)
- return body, err
- }
- // FromUnknownError overwrites any union data inside the EventSessionError_Properties_Error as the provided UnknownError
- func (t *EventSessionError_Properties_Error) FromUnknownError(v UnknownError) error {
- v.Name = "UnknownError"
- b, err := json.Marshal(v)
- t.union = b
- return err
- }
- // MergeUnknownError performs a merge with any union data inside the EventSessionError_Properties_Error, using the provided UnknownError
- func (t *EventSessionError_Properties_Error) MergeUnknownError(v UnknownError) error {
- v.Name = "UnknownError"
- b, err := json.Marshal(v)
- if err != nil {
- return err
- }
- merged, err := runtime.JSONMerge(t.union, b)
- t.union = merged
- return err
- }
- func (t EventSessionError_Properties_Error) Discriminator() (string, error) {
- var discriminator struct {
- Discriminator string `json:"name"`
- }
- err := json.Unmarshal(t.union, &discriminator)
- return discriminator.Discriminator, err
- }
- func (t EventSessionError_Properties_Error) ValueByDiscriminator() (interface{}, error) {
- discriminator, err := t.Discriminator()
- if err != nil {
- return nil, err
- }
- switch discriminator {
- case "ProviderAuthError":
- return t.AsProviderAuthError()
- case "UnknownError":
- return t.AsUnknownError()
- default:
- return nil, errors.New("unknown discriminator value: " + discriminator)
- }
- }
- func (t EventSessionError_Properties_Error) MarshalJSON() ([]byte, error) {
- b, err := t.union.MarshalJSON()
- return b, err
- }
- func (t *EventSessionError_Properties_Error) UnmarshalJSON(b []byte) error {
- err := t.union.UnmarshalJSON(b)
- return err
- }
- // AsProviderAuthError returns the union data inside the MessageInfo_Metadata_Error as a ProviderAuthError
- func (t MessageInfo_Metadata_Error) AsProviderAuthError() (ProviderAuthError, error) {
- var body ProviderAuthError
- err := json.Unmarshal(t.union, &body)
- return body, err
- }
- // FromProviderAuthError overwrites any union data inside the MessageInfo_Metadata_Error as the provided ProviderAuthError
- func (t *MessageInfo_Metadata_Error) FromProviderAuthError(v ProviderAuthError) error {
- v.Name = "ProviderAuthError"
- b, err := json.Marshal(v)
- t.union = b
- return err
- }
- // MergeProviderAuthError performs a merge with any union data inside the MessageInfo_Metadata_Error, using the provided ProviderAuthError
- func (t *MessageInfo_Metadata_Error) MergeProviderAuthError(v ProviderAuthError) error {
- v.Name = "ProviderAuthError"
- b, err := json.Marshal(v)
- if err != nil {
- return err
- }
- merged, err := runtime.JSONMerge(t.union, b)
- t.union = merged
- return err
- }
- // AsUnknownError returns the union data inside the MessageInfo_Metadata_Error as a UnknownError
- func (t MessageInfo_Metadata_Error) AsUnknownError() (UnknownError, error) {
- var body UnknownError
- err := json.Unmarshal(t.union, &body)
- return body, err
- }
- // FromUnknownError overwrites any union data inside the MessageInfo_Metadata_Error as the provided UnknownError
- func (t *MessageInfo_Metadata_Error) FromUnknownError(v UnknownError) error {
- v.Name = "UnknownError"
- b, err := json.Marshal(v)
- t.union = b
- return err
- }
- // MergeUnknownError performs a merge with any union data inside the MessageInfo_Metadata_Error, using the provided UnknownError
- func (t *MessageInfo_Metadata_Error) MergeUnknownError(v UnknownError) error {
- v.Name = "UnknownError"
- b, err := json.Marshal(v)
- if err != nil {
- return err
- }
- merged, err := runtime.JSONMerge(t.union, b)
- t.union = merged
- return err
- }
- func (t MessageInfo_Metadata_Error) Discriminator() (string, error) {
- var discriminator struct {
- Discriminator string `json:"name"`
- }
- err := json.Unmarshal(t.union, &discriminator)
- return discriminator.Discriminator, err
- }
- func (t MessageInfo_Metadata_Error) ValueByDiscriminator() (interface{}, error) {
- discriminator, err := t.Discriminator()
- if err != nil {
- return nil, err
- }
- switch discriminator {
- case "ProviderAuthError":
- return t.AsProviderAuthError()
- case "UnknownError":
- return t.AsUnknownError()
- default:
- return nil, errors.New("unknown discriminator value: " + discriminator)
- }
- }
- func (t MessageInfo_Metadata_Error) MarshalJSON() ([]byte, error) {
- b, err := t.union.MarshalJSON()
- return b, err
- }
- func (t *MessageInfo_Metadata_Error) UnmarshalJSON(b []byte) error {
- err := t.union.UnmarshalJSON(b)
- return err
- }
- // AsMessagePartText returns the union data inside the MessagePart as a MessagePartText
- func (t MessagePart) AsMessagePartText() (MessagePartText, error) {
- var body MessagePartText
- err := json.Unmarshal(t.union, &body)
- return body, err
- }
- // FromMessagePartText overwrites any union data inside the MessagePart as the provided MessagePartText
- func (t *MessagePart) FromMessagePartText(v MessagePartText) error {
- v.Type = "text"
- b, err := json.Marshal(v)
- t.union = b
- return err
- }
- // MergeMessagePartText performs a merge with any union data inside the MessagePart, using the provided MessagePartText
- func (t *MessagePart) MergeMessagePartText(v MessagePartText) error {
- v.Type = "text"
- b, err := json.Marshal(v)
- if err != nil {
- return err
- }
- merged, err := runtime.JSONMerge(t.union, b)
- t.union = merged
- return err
- }
- // AsMessagePartReasoning returns the union data inside the MessagePart as a MessagePartReasoning
- func (t MessagePart) AsMessagePartReasoning() (MessagePartReasoning, error) {
- var body MessagePartReasoning
- err := json.Unmarshal(t.union, &body)
- return body, err
- }
- // FromMessagePartReasoning overwrites any union data inside the MessagePart as the provided MessagePartReasoning
- func (t *MessagePart) FromMessagePartReasoning(v MessagePartReasoning) error {
- v.Type = "reasoning"
- b, err := json.Marshal(v)
- t.union = b
- return err
- }
- // MergeMessagePartReasoning performs a merge with any union data inside the MessagePart, using the provided MessagePartReasoning
- func (t *MessagePart) MergeMessagePartReasoning(v MessagePartReasoning) error {
- v.Type = "reasoning"
- b, err := json.Marshal(v)
- if err != nil {
- return err
- }
- merged, err := runtime.JSONMerge(t.union, b)
- t.union = merged
- return err
- }
- // AsMessagePartToolInvocation returns the union data inside the MessagePart as a MessagePartToolInvocation
- func (t MessagePart) AsMessagePartToolInvocation() (MessagePartToolInvocation, error) {
- var body MessagePartToolInvocation
- err := json.Unmarshal(t.union, &body)
- return body, err
- }
- // FromMessagePartToolInvocation overwrites any union data inside the MessagePart as the provided MessagePartToolInvocation
- func (t *MessagePart) FromMessagePartToolInvocation(v MessagePartToolInvocation) error {
- v.Type = "tool-invocation"
- b, err := json.Marshal(v)
- t.union = b
- return err
- }
- // MergeMessagePartToolInvocation performs a merge with any union data inside the MessagePart, using the provided MessagePartToolInvocation
- func (t *MessagePart) MergeMessagePartToolInvocation(v MessagePartToolInvocation) error {
- v.Type = "tool-invocation"
- b, err := json.Marshal(v)
- if err != nil {
- return err
- }
- merged, err := runtime.JSONMerge(t.union, b)
- t.union = merged
- return err
- }
- // AsMessagePartSourceUrl returns the union data inside the MessagePart as a MessagePartSourceUrl
- func (t MessagePart) AsMessagePartSourceUrl() (MessagePartSourceUrl, error) {
- var body MessagePartSourceUrl
- err := json.Unmarshal(t.union, &body)
- return body, err
- }
- // FromMessagePartSourceUrl overwrites any union data inside the MessagePart as the provided MessagePartSourceUrl
- func (t *MessagePart) FromMessagePartSourceUrl(v MessagePartSourceUrl) error {
- v.Type = "source-url"
- b, err := json.Marshal(v)
- t.union = b
- return err
- }
- // MergeMessagePartSourceUrl performs a merge with any union data inside the MessagePart, using the provided MessagePartSourceUrl
- func (t *MessagePart) MergeMessagePartSourceUrl(v MessagePartSourceUrl) error {
- v.Type = "source-url"
- b, err := json.Marshal(v)
- if err != nil {
- return err
- }
- merged, err := runtime.JSONMerge(t.union, b)
- t.union = merged
- return err
- }
- // AsMessagePartFile returns the union data inside the MessagePart as a MessagePartFile
- func (t MessagePart) AsMessagePartFile() (MessagePartFile, error) {
- var body MessagePartFile
- err := json.Unmarshal(t.union, &body)
- return body, err
- }
- // FromMessagePartFile overwrites any union data inside the MessagePart as the provided MessagePartFile
- func (t *MessagePart) FromMessagePartFile(v MessagePartFile) error {
- v.Type = "file"
- b, err := json.Marshal(v)
- t.union = b
- return err
- }
- // MergeMessagePartFile performs a merge with any union data inside the MessagePart, using the provided MessagePartFile
- func (t *MessagePart) MergeMessagePartFile(v MessagePartFile) error {
- v.Type = "file"
- b, err := json.Marshal(v)
- if err != nil {
- return err
- }
- merged, err := runtime.JSONMerge(t.union, b)
- t.union = merged
- return err
- }
- // AsMessagePartStepStart returns the union data inside the MessagePart as a MessagePartStepStart
- func (t MessagePart) AsMessagePartStepStart() (MessagePartStepStart, error) {
- var body MessagePartStepStart
- err := json.Unmarshal(t.union, &body)
- return body, err
- }
- // FromMessagePartStepStart overwrites any union data inside the MessagePart as the provided MessagePartStepStart
- func (t *MessagePart) FromMessagePartStepStart(v MessagePartStepStart) error {
- v.Type = "step-start"
- b, err := json.Marshal(v)
- t.union = b
- return err
- }
- // MergeMessagePartStepStart performs a merge with any union data inside the MessagePart, using the provided MessagePartStepStart
- func (t *MessagePart) MergeMessagePartStepStart(v MessagePartStepStart) error {
- v.Type = "step-start"
- b, err := json.Marshal(v)
- if err != nil {
- return err
- }
- merged, err := runtime.JSONMerge(t.union, b)
- t.union = merged
- return err
- }
- func (t MessagePart) Discriminator() (string, error) {
- var discriminator struct {
- Discriminator string `json:"type"`
- }
- err := json.Unmarshal(t.union, &discriminator)
- return discriminator.Discriminator, err
- }
- func (t MessagePart) ValueByDiscriminator() (interface{}, error) {
- discriminator, err := t.Discriminator()
- if err != nil {
- return nil, err
- }
- switch discriminator {
- case "file":
- return t.AsMessagePartFile()
- case "reasoning":
- return t.AsMessagePartReasoning()
- case "source-url":
- return t.AsMessagePartSourceUrl()
- case "step-start":
- return t.AsMessagePartStepStart()
- case "text":
- return t.AsMessagePartText()
- case "tool-invocation":
- return t.AsMessagePartToolInvocation()
- default:
- return nil, errors.New("unknown discriminator value: " + discriminator)
- }
- }
- func (t MessagePart) MarshalJSON() ([]byte, error) {
- b, err := t.union.MarshalJSON()
- return b, err
- }
- func (t *MessagePart) UnmarshalJSON(b []byte) error {
- err := t.union.UnmarshalJSON(b)
- return err
- }
- // AsMessageToolInvocationToolCall returns the union data inside the MessageToolInvocation as a MessageToolInvocationToolCall
- func (t MessageToolInvocation) AsMessageToolInvocationToolCall() (MessageToolInvocationToolCall, error) {
- var body MessageToolInvocationToolCall
- err := json.Unmarshal(t.union, &body)
- return body, err
- }
- // FromMessageToolInvocationToolCall overwrites any union data inside the MessageToolInvocation as the provided MessageToolInvocationToolCall
- func (t *MessageToolInvocation) FromMessageToolInvocationToolCall(v MessageToolInvocationToolCall) error {
- v.State = "call"
- b, err := json.Marshal(v)
- t.union = b
- return err
- }
- // MergeMessageToolInvocationToolCall performs a merge with any union data inside the MessageToolInvocation, using the provided MessageToolInvocationToolCall
- func (t *MessageToolInvocation) MergeMessageToolInvocationToolCall(v MessageToolInvocationToolCall) error {
- v.State = "call"
- b, err := json.Marshal(v)
- if err != nil {
- return err
- }
- merged, err := runtime.JSONMerge(t.union, b)
- t.union = merged
- return err
- }
- // AsMessageToolInvocationToolPartialCall returns the union data inside the MessageToolInvocation as a MessageToolInvocationToolPartialCall
- func (t MessageToolInvocation) AsMessageToolInvocationToolPartialCall() (MessageToolInvocationToolPartialCall, error) {
- var body MessageToolInvocationToolPartialCall
- err := json.Unmarshal(t.union, &body)
- return body, err
- }
- // FromMessageToolInvocationToolPartialCall overwrites any union data inside the MessageToolInvocation as the provided MessageToolInvocationToolPartialCall
- func (t *MessageToolInvocation) FromMessageToolInvocationToolPartialCall(v MessageToolInvocationToolPartialCall) error {
- v.State = "partial-call"
- b, err := json.Marshal(v)
- t.union = b
- return err
- }
- // MergeMessageToolInvocationToolPartialCall performs a merge with any union data inside the MessageToolInvocation, using the provided MessageToolInvocationToolPartialCall
- func (t *MessageToolInvocation) MergeMessageToolInvocationToolPartialCall(v MessageToolInvocationToolPartialCall) error {
- v.State = "partial-call"
- b, err := json.Marshal(v)
- if err != nil {
- return err
- }
- merged, err := runtime.JSONMerge(t.union, b)
- t.union = merged
- return err
- }
- // AsMessageToolInvocationToolResult returns the union data inside the MessageToolInvocation as a MessageToolInvocationToolResult
- func (t MessageToolInvocation) AsMessageToolInvocationToolResult() (MessageToolInvocationToolResult, error) {
- var body MessageToolInvocationToolResult
- err := json.Unmarshal(t.union, &body)
- return body, err
- }
- // FromMessageToolInvocationToolResult overwrites any union data inside the MessageToolInvocation as the provided MessageToolInvocationToolResult
- func (t *MessageToolInvocation) FromMessageToolInvocationToolResult(v MessageToolInvocationToolResult) error {
- v.State = "result"
- b, err := json.Marshal(v)
- t.union = b
- return err
- }
- // MergeMessageToolInvocationToolResult performs a merge with any union data inside the MessageToolInvocation, using the provided MessageToolInvocationToolResult
- func (t *MessageToolInvocation) MergeMessageToolInvocationToolResult(v MessageToolInvocationToolResult) error {
- v.State = "result"
- b, err := json.Marshal(v)
- if err != nil {
- return err
- }
- merged, err := runtime.JSONMerge(t.union, b)
- t.union = merged
- return err
- }
- func (t MessageToolInvocation) Discriminator() (string, error) {
- var discriminator struct {
- Discriminator string `json:"state"`
- }
- err := json.Unmarshal(t.union, &discriminator)
- return discriminator.Discriminator, err
- }
- func (t MessageToolInvocation) ValueByDiscriminator() (interface{}, error) {
- discriminator, err := t.Discriminator()
- if err != nil {
- return nil, err
- }
- switch discriminator {
- case "call":
- return t.AsMessageToolInvocationToolCall()
- case "partial-call":
- return t.AsMessageToolInvocationToolPartialCall()
- case "result":
- return t.AsMessageToolInvocationToolResult()
- default:
- return nil, errors.New("unknown discriminator value: " + discriminator)
- }
- }
- func (t MessageToolInvocation) MarshalJSON() ([]byte, error) {
- b, err := t.union.MarshalJSON()
- return b, err
- }
- func (t *MessageToolInvocation) 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
- // 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 {
- // PostAppInfo request
- PostAppInfo(ctx context.Context, reqEditors ...RequestEditorFn) (*http.Response, error)
- // PostAppInitialize request
- PostAppInitialize(ctx context.Context, reqEditors ...RequestEditorFn) (*http.Response, error)
- // PostConfigGet request
- PostConfigGet(ctx context.Context, reqEditors ...RequestEditorFn) (*http.Response, error)
- // GetEvent request
- GetEvent(ctx context.Context, reqEditors ...RequestEditorFn) (*http.Response, error)
- // PostFileSearchWithBody request with any body
- PostFileSearchWithBody(ctx context.Context, contentType string, body io.Reader, reqEditors ...RequestEditorFn) (*http.Response, error)
- PostFileSearch(ctx context.Context, body PostFileSearchJSONRequestBody, reqEditors ...RequestEditorFn) (*http.Response, error)
- // PostInstallationInfo request
- PostInstallationInfo(ctx context.Context, reqEditors ...RequestEditorFn) (*http.Response, error)
- // PostPathGet request
- PostPathGet(ctx context.Context, reqEditors ...RequestEditorFn) (*http.Response, error)
- // PostProviderList request
- PostProviderList(ctx context.Context, reqEditors ...RequestEditorFn) (*http.Response, error)
- // 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)
- // 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)
- // PostSessionInitializeWithBody request with any body
- PostSessionInitializeWithBody(ctx context.Context, contentType string, body io.Reader, reqEditors ...RequestEditorFn) (*http.Response, error)
- PostSessionInitialize(ctx context.Context, body PostSessionInitializeJSONRequestBody, reqEditors ...RequestEditorFn) (*http.Response, error)
- // PostSessionList request
- PostSessionList(ctx context.Context, reqEditors ...RequestEditorFn) (*http.Response, error)
- // 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)
- // 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)
- }
- func (c *Client) PostAppInfo(ctx context.Context, reqEditors ...RequestEditorFn) (*http.Response, error) {
- req, err := NewPostAppInfoRequest(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)
- }
- func (c *Client) PostAppInitialize(ctx context.Context, reqEditors ...RequestEditorFn) (*http.Response, error) {
- req, err := NewPostAppInitializeRequest(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)
- }
- func (c *Client) PostConfigGet(ctx context.Context, reqEditors ...RequestEditorFn) (*http.Response, error) {
- req, err := NewPostConfigGetRequest(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)
- }
- 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)
- }
- func (c *Client) PostFileSearchWithBody(ctx context.Context, contentType string, body io.Reader, reqEditors ...RequestEditorFn) (*http.Response, error) {
- req, err := NewPostFileSearchRequestWithBody(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) PostFileSearch(ctx context.Context, body PostFileSearchJSONRequestBody, reqEditors ...RequestEditorFn) (*http.Response, error) {
- req, err := NewPostFileSearchRequest(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) PostInstallationInfo(ctx context.Context, reqEditors ...RequestEditorFn) (*http.Response, error) {
- req, err := NewPostInstallationInfoRequest(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)
- }
- func (c *Client) PostPathGet(ctx context.Context, reqEditors ...RequestEditorFn) (*http.Response, error) {
- req, err := NewPostPathGetRequest(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)
- }
- 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)
- }
- 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)
- }
- 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)
- }
- func (c *Client) PostSessionInitializeWithBody(ctx context.Context, contentType string, body io.Reader, reqEditors ...RequestEditorFn) (*http.Response, error) {
- req, err := NewPostSessionInitializeRequestWithBody(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) PostSessionInitialize(ctx context.Context, body PostSessionInitializeJSONRequestBody, reqEditors ...RequestEditorFn) (*http.Response, error) {
- req, err := NewPostSessionInitializeRequest(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) 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)
- }
- 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)
- }
- 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)
- }
- // NewPostAppInfoRequest generates requests for PostAppInfo
- func NewPostAppInfoRequest(server string) (*http.Request, error) {
- var err error
- serverURL, err := url.Parse(server)
- if err != nil {
- return nil, err
- }
- operationPath := fmt.Sprintf("/app_info")
- 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
- }
- // NewPostAppInitializeRequest generates requests for PostAppInitialize
- func NewPostAppInitializeRequest(server string) (*http.Request, error) {
- var err error
- serverURL, err := url.Parse(server)
- if err != nil {
- return nil, err
- }
- operationPath := fmt.Sprintf("/app_initialize")
- 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
- }
- // NewPostConfigGetRequest generates requests for PostConfigGet
- func NewPostConfigGetRequest(server string) (*http.Request, error) {
- var err error
- serverURL, err := url.Parse(server)
- if err != nil {
- return nil, err
- }
- operationPath := fmt.Sprintf("/config_get")
- 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
- }
- // 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
- }
- // NewPostFileSearchRequest calls the generic PostFileSearch builder with application/json body
- func NewPostFileSearchRequest(server string, body PostFileSearchJSONRequestBody) (*http.Request, error) {
- var bodyReader io.Reader
- buf, err := json.Marshal(body)
- if err != nil {
- return nil, err
- }
- bodyReader = bytes.NewReader(buf)
- return NewPostFileSearchRequestWithBody(server, "application/json", bodyReader)
- }
- // NewPostFileSearchRequestWithBody generates requests for PostFileSearch with any type of body
- func NewPostFileSearchRequestWithBody(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("/file_search")
- 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
- }
- // NewPostInstallationInfoRequest generates requests for PostInstallationInfo
- func NewPostInstallationInfoRequest(server string) (*http.Request, error) {
- var err error
- serverURL, err := url.Parse(server)
- if err != nil {
- return nil, err
- }
- operationPath := fmt.Sprintf("/installation_info")
- 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
- }
- // NewPostPathGetRequest generates requests for PostPathGet
- func NewPostPathGetRequest(server string) (*http.Request, error) {
- var err error
- serverURL, err := url.Parse(server)
- if err != nil {
- return nil, err
- }
- operationPath := fmt.Sprintf("/path_get")
- 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
- }
- // 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
- }
- // 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
- }
- // 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
- }
- // NewPostSessionInitializeRequest calls the generic PostSessionInitialize builder with application/json body
- func NewPostSessionInitializeRequest(server string, body PostSessionInitializeJSONRequestBody) (*http.Request, error) {
- var bodyReader io.Reader
- buf, err := json.Marshal(body)
- if err != nil {
- return nil, err
- }
- bodyReader = bytes.NewReader(buf)
- return NewPostSessionInitializeRequestWithBody(server, "application/json", bodyReader)
- }
- // NewPostSessionInitializeRequestWithBody generates requests for PostSessionInitialize with any type of body
- func NewPostSessionInitializeRequestWithBody(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_initialize")
- 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
- }
- // 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
- }
- // 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
- }
- // 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
- }
- 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 {
- // PostAppInfoWithResponse request
- PostAppInfoWithResponse(ctx context.Context, reqEditors ...RequestEditorFn) (*PostAppInfoResponse, error)
- // PostAppInitializeWithResponse request
- PostAppInitializeWithResponse(ctx context.Context, reqEditors ...RequestEditorFn) (*PostAppInitializeResponse, error)
- // PostConfigGetWithResponse request
- PostConfigGetWithResponse(ctx context.Context, reqEditors ...RequestEditorFn) (*PostConfigGetResponse, error)
- // GetEventWithResponse request
- GetEventWithResponse(ctx context.Context, reqEditors ...RequestEditorFn) (*GetEventResponse, error)
- // PostFileSearchWithBodyWithResponse request with any body
- PostFileSearchWithBodyWithResponse(ctx context.Context, contentType string, body io.Reader, reqEditors ...RequestEditorFn) (*PostFileSearchResponse, error)
- PostFileSearchWithResponse(ctx context.Context, body PostFileSearchJSONRequestBody, reqEditors ...RequestEditorFn) (*PostFileSearchResponse, error)
- // PostInstallationInfoWithResponse request
- PostInstallationInfoWithResponse(ctx context.Context, reqEditors ...RequestEditorFn) (*PostInstallationInfoResponse, error)
- // PostPathGetWithResponse request
- PostPathGetWithResponse(ctx context.Context, reqEditors ...RequestEditorFn) (*PostPathGetResponse, error)
- // PostProviderListWithResponse request
- PostProviderListWithResponse(ctx context.Context, reqEditors ...RequestEditorFn) (*PostProviderListResponse, error)
- // 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)
- // 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)
- // PostSessionInitializeWithBodyWithResponse request with any body
- PostSessionInitializeWithBodyWithResponse(ctx context.Context, contentType string, body io.Reader, reqEditors ...RequestEditorFn) (*PostSessionInitializeResponse, error)
- PostSessionInitializeWithResponse(ctx context.Context, body PostSessionInitializeJSONRequestBody, reqEditors ...RequestEditorFn) (*PostSessionInitializeResponse, error)
- // PostSessionListWithResponse request
- PostSessionListWithResponse(ctx context.Context, reqEditors ...RequestEditorFn) (*PostSessionListResponse, error)
- // 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)
- // 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)
- }
- type PostAppInfoResponse struct {
- Body []byte
- HTTPResponse *http.Response
- JSON200 *AppInfo
- }
- // Status returns HTTPResponse.Status
- func (r PostAppInfoResponse) Status() string {
- if r.HTTPResponse != nil {
- return r.HTTPResponse.Status
- }
- return http.StatusText(0)
- }
- // StatusCode returns HTTPResponse.StatusCode
- func (r PostAppInfoResponse) StatusCode() int {
- if r.HTTPResponse != nil {
- return r.HTTPResponse.StatusCode
- }
- return 0
- }
- type PostAppInitializeResponse struct {
- Body []byte
- HTTPResponse *http.Response
- JSON200 *bool
- }
- // Status returns HTTPResponse.Status
- func (r PostAppInitializeResponse) Status() string {
- if r.HTTPResponse != nil {
- return r.HTTPResponse.Status
- }
- return http.StatusText(0)
- }
- // StatusCode returns HTTPResponse.StatusCode
- func (r PostAppInitializeResponse) StatusCode() int {
- if r.HTTPResponse != nil {
- return r.HTTPResponse.StatusCode
- }
- return 0
- }
- type PostConfigGetResponse struct {
- Body []byte
- HTTPResponse *http.Response
- JSON200 *ConfigInfo
- }
- // Status returns HTTPResponse.Status
- func (r PostConfigGetResponse) Status() string {
- if r.HTTPResponse != nil {
- return r.HTTPResponse.Status
- }
- return http.StatusText(0)
- }
- // StatusCode returns HTTPResponse.StatusCode
- func (r PostConfigGetResponse) StatusCode() int {
- if r.HTTPResponse != nil {
- return r.HTTPResponse.StatusCode
- }
- return 0
- }
- 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
- }
- type PostFileSearchResponse struct {
- Body []byte
- HTTPResponse *http.Response
- JSON200 *[]string
- }
- // Status returns HTTPResponse.Status
- func (r PostFileSearchResponse) Status() string {
- if r.HTTPResponse != nil {
- return r.HTTPResponse.Status
- }
- return http.StatusText(0)
- }
- // StatusCode returns HTTPResponse.StatusCode
- func (r PostFileSearchResponse) StatusCode() int {
- if r.HTTPResponse != nil {
- return r.HTTPResponse.StatusCode
- }
- return 0
- }
- type PostInstallationInfoResponse struct {
- Body []byte
- HTTPResponse *http.Response
- JSON200 *InstallationInfo
- }
- // Status returns HTTPResponse.Status
- func (r PostInstallationInfoResponse) Status() string {
- if r.HTTPResponse != nil {
- return r.HTTPResponse.Status
- }
- return http.StatusText(0)
- }
- // StatusCode returns HTTPResponse.StatusCode
- func (r PostInstallationInfoResponse) StatusCode() int {
- if r.HTTPResponse != nil {
- return r.HTTPResponse.StatusCode
- }
- return 0
- }
- type PostPathGetResponse struct {
- Body []byte
- HTTPResponse *http.Response
- JSON200 *struct {
- Config string `json:"config"`
- Cwd string `json:"cwd"`
- Data string `json:"data"`
- Root string `json:"root"`
- }
- }
- // Status returns HTTPResponse.Status
- func (r PostPathGetResponse) Status() string {
- if r.HTTPResponse != nil {
- return r.HTTPResponse.Status
- }
- return http.StatusText(0)
- }
- // StatusCode returns HTTPResponse.StatusCode
- func (r PostPathGetResponse) StatusCode() int {
- if r.HTTPResponse != nil {
- return r.HTTPResponse.StatusCode
- }
- return 0
- }
- type PostProviderListResponse struct {
- Body []byte
- HTTPResponse *http.Response
- JSON200 *struct {
- Default map[string]string `json:"default"`
- Providers []ProviderInfo `json:"providers"`
- }
- }
- // 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
- }
- 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
- }
- type PostSessionChatResponse struct {
- Body []byte
- HTTPResponse *http.Response
- JSON200 *MessageInfo
- }
- // 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
- JSON400 *Error
- }
- // 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
- }
- type PostSessionInitializeResponse struct {
- Body []byte
- HTTPResponse *http.Response
- JSON200 *bool
- }
- // Status returns HTTPResponse.Status
- func (r PostSessionInitializeResponse) Status() string {
- if r.HTTPResponse != nil {
- return r.HTTPResponse.Status
- }
- return http.StatusText(0)
- }
- // StatusCode returns HTTPResponse.StatusCode
- func (r PostSessionInitializeResponse) StatusCode() int {
- if r.HTTPResponse != nil {
- return r.HTTPResponse.StatusCode
- }
- return 0
- }
- type PostSessionListResponse struct {
- Body []byte
- HTTPResponse *http.Response
- JSON200 *[]SessionInfo
- }
- // 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
- }
- type PostSessionMessagesResponse struct {
- Body []byte
- HTTPResponse *http.Response
- JSON200 *[]MessageInfo
- }
- // 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
- }
- 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
- }
- // PostAppInfoWithResponse request returning *PostAppInfoResponse
- func (c *ClientWithResponses) PostAppInfoWithResponse(ctx context.Context, reqEditors ...RequestEditorFn) (*PostAppInfoResponse, error) {
- rsp, err := c.PostAppInfo(ctx, reqEditors...)
- if err != nil {
- return nil, err
- }
- return ParsePostAppInfoResponse(rsp)
- }
- // PostAppInitializeWithResponse request returning *PostAppInitializeResponse
- func (c *ClientWithResponses) PostAppInitializeWithResponse(ctx context.Context, reqEditors ...RequestEditorFn) (*PostAppInitializeResponse, error) {
- rsp, err := c.PostAppInitialize(ctx, reqEditors...)
- if err != nil {
- return nil, err
- }
- return ParsePostAppInitializeResponse(rsp)
- }
- // PostConfigGetWithResponse request returning *PostConfigGetResponse
- func (c *ClientWithResponses) PostConfigGetWithResponse(ctx context.Context, reqEditors ...RequestEditorFn) (*PostConfigGetResponse, error) {
- rsp, err := c.PostConfigGet(ctx, reqEditors...)
- if err != nil {
- return nil, err
- }
- return ParsePostConfigGetResponse(rsp)
- }
- // 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)
- }
- // PostFileSearchWithBodyWithResponse request with arbitrary body returning *PostFileSearchResponse
- func (c *ClientWithResponses) PostFileSearchWithBodyWithResponse(ctx context.Context, contentType string, body io.Reader, reqEditors ...RequestEditorFn) (*PostFileSearchResponse, error) {
- rsp, err := c.PostFileSearchWithBody(ctx, contentType, body, reqEditors...)
- if err != nil {
- return nil, err
- }
- return ParsePostFileSearchResponse(rsp)
- }
- func (c *ClientWithResponses) PostFileSearchWithResponse(ctx context.Context, body PostFileSearchJSONRequestBody, reqEditors ...RequestEditorFn) (*PostFileSearchResponse, error) {
- rsp, err := c.PostFileSearch(ctx, body, reqEditors...)
- if err != nil {
- return nil, err
- }
- return ParsePostFileSearchResponse(rsp)
- }
- // PostInstallationInfoWithResponse request returning *PostInstallationInfoResponse
- func (c *ClientWithResponses) PostInstallationInfoWithResponse(ctx context.Context, reqEditors ...RequestEditorFn) (*PostInstallationInfoResponse, error) {
- rsp, err := c.PostInstallationInfo(ctx, reqEditors...)
- if err != nil {
- return nil, err
- }
- return ParsePostInstallationInfoResponse(rsp)
- }
- // PostPathGetWithResponse request returning *PostPathGetResponse
- func (c *ClientWithResponses) PostPathGetWithResponse(ctx context.Context, reqEditors ...RequestEditorFn) (*PostPathGetResponse, error) {
- rsp, err := c.PostPathGet(ctx, reqEditors...)
- if err != nil {
- return nil, err
- }
- return ParsePostPathGetResponse(rsp)
- }
- // 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)
- }
- // 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)
- }
- // 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)
- }
- // PostSessionInitializeWithBodyWithResponse request with arbitrary body returning *PostSessionInitializeResponse
- func (c *ClientWithResponses) PostSessionInitializeWithBodyWithResponse(ctx context.Context, contentType string, body io.Reader, reqEditors ...RequestEditorFn) (*PostSessionInitializeResponse, error) {
- rsp, err := c.PostSessionInitializeWithBody(ctx, contentType, body, reqEditors...)
- if err != nil {
- return nil, err
- }
- return ParsePostSessionInitializeResponse(rsp)
- }
- func (c *ClientWithResponses) PostSessionInitializeWithResponse(ctx context.Context, body PostSessionInitializeJSONRequestBody, reqEditors ...RequestEditorFn) (*PostSessionInitializeResponse, error) {
- rsp, err := c.PostSessionInitialize(ctx, body, reqEditors...)
- if err != nil {
- return nil, err
- }
- return ParsePostSessionInitializeResponse(rsp)
- }
- // 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)
- }
- // 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)
- }
- // 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)
- }
- // ParsePostAppInfoResponse parses an HTTP response from a PostAppInfoWithResponse call
- func ParsePostAppInfoResponse(rsp *http.Response) (*PostAppInfoResponse, error) {
- bodyBytes, err := io.ReadAll(rsp.Body)
- defer func() { _ = rsp.Body.Close() }()
- if err != nil {
- return nil, err
- }
- response := &PostAppInfoResponse{
- Body: bodyBytes,
- HTTPResponse: rsp,
- }
- switch {
- case strings.Contains(rsp.Header.Get("Content-Type"), "json") && rsp.StatusCode == 200:
- var dest AppInfo
- if err := json.Unmarshal(bodyBytes, &dest); err != nil {
- return nil, err
- }
- response.JSON200 = &dest
- }
- return response, nil
- }
- // ParsePostAppInitializeResponse parses an HTTP response from a PostAppInitializeWithResponse call
- func ParsePostAppInitializeResponse(rsp *http.Response) (*PostAppInitializeResponse, error) {
- bodyBytes, err := io.ReadAll(rsp.Body)
- defer func() { _ = rsp.Body.Close() }()
- if err != nil {
- return nil, err
- }
- response := &PostAppInitializeResponse{
- 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
- }
- // ParsePostConfigGetResponse parses an HTTP response from a PostConfigGetWithResponse call
- func ParsePostConfigGetResponse(rsp *http.Response) (*PostConfigGetResponse, error) {
- bodyBytes, err := io.ReadAll(rsp.Body)
- defer func() { _ = rsp.Body.Close() }()
- if err != nil {
- return nil, err
- }
- response := &PostConfigGetResponse{
- Body: bodyBytes,
- HTTPResponse: rsp,
- }
- switch {
- case strings.Contains(rsp.Header.Get("Content-Type"), "json") && rsp.StatusCode == 200:
- var dest ConfigInfo
- if err := json.Unmarshal(bodyBytes, &dest); err != nil {
- return nil, err
- }
- response.JSON200 = &dest
- }
- return response, nil
- }
- // 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
- }
- // ParsePostFileSearchResponse parses an HTTP response from a PostFileSearchWithResponse call
- func ParsePostFileSearchResponse(rsp *http.Response) (*PostFileSearchResponse, error) {
- bodyBytes, err := io.ReadAll(rsp.Body)
- defer func() { _ = rsp.Body.Close() }()
- if err != nil {
- return nil, err
- }
- response := &PostFileSearchResponse{
- Body: bodyBytes,
- HTTPResponse: rsp,
- }
- switch {
- case strings.Contains(rsp.Header.Get("Content-Type"), "json") && rsp.StatusCode == 200:
- var dest []string
- if err := json.Unmarshal(bodyBytes, &dest); err != nil {
- return nil, err
- }
- response.JSON200 = &dest
- }
- return response, nil
- }
- // ParsePostInstallationInfoResponse parses an HTTP response from a PostInstallationInfoWithResponse call
- func ParsePostInstallationInfoResponse(rsp *http.Response) (*PostInstallationInfoResponse, error) {
- bodyBytes, err := io.ReadAll(rsp.Body)
- defer func() { _ = rsp.Body.Close() }()
- if err != nil {
- return nil, err
- }
- response := &PostInstallationInfoResponse{
- Body: bodyBytes,
- HTTPResponse: rsp,
- }
- switch {
- case strings.Contains(rsp.Header.Get("Content-Type"), "json") && rsp.StatusCode == 200:
- var dest InstallationInfo
- if err := json.Unmarshal(bodyBytes, &dest); err != nil {
- return nil, err
- }
- response.JSON200 = &dest
- }
- return response, nil
- }
- // ParsePostPathGetResponse parses an HTTP response from a PostPathGetWithResponse call
- func ParsePostPathGetResponse(rsp *http.Response) (*PostPathGetResponse, error) {
- bodyBytes, err := io.ReadAll(rsp.Body)
- defer func() { _ = rsp.Body.Close() }()
- if err != nil {
- return nil, err
- }
- response := &PostPathGetResponse{
- Body: bodyBytes,
- HTTPResponse: rsp,
- }
- switch {
- case strings.Contains(rsp.Header.Get("Content-Type"), "json") && rsp.StatusCode == 200:
- var dest struct {
- Config string `json:"config"`
- Cwd string `json:"cwd"`
- Data string `json:"data"`
- Root string `json:"root"`
- }
- if err := json.Unmarshal(bodyBytes, &dest); err != nil {
- return nil, err
- }
- response.JSON200 = &dest
- }
- return response, nil
- }
- // 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:
- var dest struct {
- Default map[string]string `json:"default"`
- Providers []ProviderInfo `json:"providers"`
- }
- if err := json.Unmarshal(bodyBytes, &dest); err != nil {
- return nil, err
- }
- response.JSON200 = &dest
- }
- return response, nil
- }
- // 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
- }
- // 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,
- }
- switch {
- case strings.Contains(rsp.Header.Get("Content-Type"), "json") && rsp.StatusCode == 200:
- var dest MessageInfo
- if err := json.Unmarshal(bodyBytes, &dest); err != nil {
- return nil, err
- }
- response.JSON200 = &dest
- }
- 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
- case strings.Contains(rsp.Header.Get("Content-Type"), "json") && rsp.StatusCode == 400:
- var dest Error
- if err := json.Unmarshal(bodyBytes, &dest); err != nil {
- return nil, err
- }
- response.JSON400 = &dest
- }
- return response, nil
- }
- // ParsePostSessionInitializeResponse parses an HTTP response from a PostSessionInitializeWithResponse call
- func ParsePostSessionInitializeResponse(rsp *http.Response) (*PostSessionInitializeResponse, error) {
- bodyBytes, err := io.ReadAll(rsp.Body)
- defer func() { _ = rsp.Body.Close() }()
- if err != nil {
- return nil, err
- }
- response := &PostSessionInitializeResponse{
- 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
- }
- // 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:
- var dest []SessionInfo
- if err := json.Unmarshal(bodyBytes, &dest); err != nil {
- return nil, err
- }
- response.JSON200 = &dest
- }
- return response, nil
- }
- // 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:
- var dest []MessageInfo
- 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
- }
- // 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
- }
|