generated-client.go 90 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788789790791792793794795796797798799800801802803804805806807808809810811812813814815816817818819820821822823824825826827828829830831832833834835836837838839840841842843844845846847848849850851852853854855856857858859860861862863864865866867868869870871872873874875876877878879880881882883884885886887888889890891892893894895896897898899900901902903904905906907908909910911912913914915916917918919920921922923924925926927928929930931932933934935936937938939940941942943944945946947948949950951952953954955956957958959960961962963964965966967968969970971972973974975976977978979980981982983984985986987988989990991992993994995996997998999100010011002100310041005100610071008100910101011101210131014101510161017101810191020102110221023102410251026102710281029103010311032103310341035103610371038103910401041104210431044104510461047104810491050105110521053105410551056105710581059106010611062106310641065106610671068106910701071107210731074107510761077107810791080108110821083108410851086108710881089109010911092109310941095109610971098109911001101110211031104110511061107110811091110111111121113111411151116111711181119112011211122112311241125112611271128112911301131113211331134113511361137113811391140114111421143114411451146114711481149115011511152115311541155115611571158115911601161116211631164116511661167116811691170117111721173117411751176117711781179118011811182118311841185118611871188118911901191119211931194119511961197119811991200120112021203120412051206120712081209121012111212121312141215121612171218121912201221122212231224122512261227122812291230123112321233123412351236123712381239124012411242124312441245124612471248124912501251125212531254125512561257125812591260126112621263126412651266126712681269127012711272127312741275127612771278127912801281128212831284128512861287128812891290129112921293129412951296129712981299130013011302130313041305130613071308130913101311131213131314131513161317131813191320132113221323132413251326132713281329133013311332133313341335133613371338133913401341134213431344134513461347134813491350135113521353135413551356135713581359136013611362136313641365136613671368136913701371137213731374137513761377137813791380138113821383138413851386138713881389139013911392139313941395139613971398139914001401140214031404140514061407140814091410141114121413141414151416141714181419142014211422142314241425142614271428142914301431143214331434143514361437143814391440144114421443144414451446144714481449145014511452145314541455145614571458145914601461146214631464146514661467146814691470147114721473147414751476147714781479148014811482148314841485148614871488148914901491149214931494149514961497149814991500150115021503150415051506150715081509151015111512151315141515151615171518151915201521152215231524152515261527152815291530153115321533153415351536153715381539154015411542154315441545154615471548154915501551155215531554155515561557155815591560156115621563156415651566156715681569157015711572157315741575157615771578157915801581158215831584158515861587158815891590159115921593159415951596159715981599160016011602160316041605160616071608160916101611161216131614161516161617161816191620162116221623162416251626162716281629163016311632163316341635163616371638163916401641164216431644164516461647164816491650165116521653165416551656165716581659166016611662166316641665166616671668166916701671167216731674167516761677167816791680168116821683168416851686168716881689169016911692169316941695169616971698169917001701170217031704170517061707170817091710171117121713171417151716171717181719172017211722172317241725172617271728172917301731173217331734173517361737173817391740174117421743174417451746174717481749175017511752175317541755175617571758175917601761176217631764176517661767176817691770177117721773177417751776177717781779178017811782178317841785178617871788178917901791179217931794179517961797179817991800180118021803180418051806180718081809181018111812181318141815181618171818181918201821182218231824182518261827182818291830183118321833183418351836183718381839184018411842184318441845184618471848184918501851185218531854185518561857185818591860186118621863186418651866186718681869187018711872187318741875187618771878187918801881188218831884188518861887188818891890189118921893189418951896189718981899190019011902190319041905190619071908190919101911191219131914191519161917191819191920192119221923192419251926192719281929193019311932193319341935193619371938193919401941194219431944194519461947194819491950195119521953195419551956195719581959196019611962196319641965196619671968196919701971197219731974197519761977197819791980198119821983198419851986198719881989199019911992199319941995199619971998199920002001200220032004200520062007200820092010201120122013201420152016201720182019202020212022202320242025202620272028202920302031203220332034203520362037203820392040204120422043204420452046204720482049205020512052205320542055205620572058205920602061206220632064206520662067206820692070207120722073207420752076207720782079208020812082208320842085208620872088208920902091209220932094209520962097209820992100210121022103210421052106210721082109211021112112211321142115211621172118211921202121212221232124212521262127212821292130213121322133213421352136213721382139214021412142214321442145214621472148214921502151215221532154215521562157215821592160216121622163216421652166216721682169217021712172217321742175217621772178217921802181218221832184218521862187218821892190219121922193219421952196219721982199220022012202220322042205220622072208220922102211221222132214221522162217221822192220222122222223222422252226222722282229223022312232223322342235223622372238223922402241224222432244224522462247224822492250225122522253225422552256225722582259226022612262226322642265226622672268226922702271227222732274227522762277227822792280228122822283228422852286228722882289229022912292229322942295229622972298229923002301230223032304230523062307230823092310231123122313231423152316231723182319232023212322232323242325232623272328232923302331233223332334233523362337233823392340234123422343234423452346234723482349235023512352235323542355235623572358235923602361236223632364236523662367236823692370237123722373237423752376237723782379238023812382238323842385238623872388238923902391239223932394239523962397239823992400240124022403240424052406240724082409241024112412241324142415241624172418241924202421242224232424242524262427242824292430243124322433243424352436243724382439244024412442244324442445244624472448244924502451245224532454245524562457245824592460246124622463246424652466246724682469247024712472247324742475247624772478247924802481248224832484248524862487248824892490249124922493249424952496249724982499250025012502250325042505250625072508250925102511251225132514251525162517251825192520252125222523252425252526252725282529253025312532253325342535253625372538253925402541254225432544254525462547254825492550255125522553255425552556255725582559256025612562256325642565256625672568256925702571257225732574257525762577257825792580258125822583258425852586258725882589259025912592259325942595259625972598259926002601260226032604260526062607260826092610261126122613261426152616261726182619262026212622262326242625262626272628262926302631263226332634263526362637263826392640264126422643264426452646264726482649265026512652265326542655265626572658265926602661266226632664266526662667266826692670267126722673267426752676267726782679268026812682268326842685268626872688268926902691269226932694269526962697269826992700270127022703270427052706270727082709271027112712271327142715271627172718271927202721272227232724272527262727272827292730273127322733273427352736273727382739274027412742274327442745274627472748274927502751275227532754275527562757275827592760276127622763276427652766276727682769277027712772277327742775277627772778277927802781278227832784278527862787278827892790279127922793279427952796279727982799280028012802280328042805280628072808280928102811281228132814281528162817281828192820282128222823282428252826282728282829283028312832283328342835283628372838283928402841284228432844284528462847284828492850285128522853285428552856285728582859286028612862286328642865286628672868286928702871287228732874287528762877287828792880288128822883288428852886288728882889289028912892289328942895289628972898289929002901290229032904290529062907290829092910291129122913291429152916291729182919292029212922292329242925292629272928292929302931293229332934293529362937293829392940294129422943294429452946294729482949295029512952295329542955295629572958295929602961296229632964296529662967296829692970297129722973297429752976297729782979298029812982298329842985298629872988298929902991299229932994299529962997299829993000300130023003300430053006300730083009301030113012301330143015301630173018301930203021302230233024302530263027
  1. // Package client provides primitives to interact with the openapi HTTP API.
  2. //
  3. // Code generated by github.com/oapi-codegen/oapi-codegen/v2 version v2.4.1 DO NOT EDIT.
  4. package client
  5. import (
  6. "bytes"
  7. "context"
  8. "encoding/json"
  9. "errors"
  10. "fmt"
  11. "io"
  12. "net/http"
  13. "net/url"
  14. "strings"
  15. "github.com/oapi-codegen/runtime"
  16. )
  17. // Defines values for MessageInfoRole.
  18. const (
  19. Assistant MessageInfoRole = "assistant"
  20. User MessageInfoRole = "user"
  21. )
  22. // AppInfo defines model for App.Info.
  23. type AppInfo struct {
  24. Git bool `json:"git"`
  25. Path struct {
  26. Config string `json:"config"`
  27. Cwd string `json:"cwd"`
  28. Data string `json:"data"`
  29. Root string `json:"root"`
  30. } `json:"path"`
  31. Time struct {
  32. Initialized *float32 `json:"initialized,omitempty"`
  33. } `json:"time"`
  34. User string `json:"user"`
  35. }
  36. // Error defines model for Error.
  37. type Error struct {
  38. Data map[string]interface{} `json:"data"`
  39. }
  40. // Event defines model for Event.
  41. type Event struct {
  42. union json.RawMessage
  43. }
  44. // EventLspClientDiagnostics defines model for Event.lsp.client.diagnostics.
  45. type EventLspClientDiagnostics struct {
  46. Properties struct {
  47. Path string `json:"path"`
  48. ServerID string `json:"serverID"`
  49. } `json:"properties"`
  50. Type string `json:"type"`
  51. }
  52. // EventMessagePartUpdated defines model for Event.message.part.updated.
  53. type EventMessagePartUpdated struct {
  54. Properties struct {
  55. MessageID string `json:"messageID"`
  56. Part MessagePart `json:"part"`
  57. SessionID string `json:"sessionID"`
  58. } `json:"properties"`
  59. Type string `json:"type"`
  60. }
  61. // EventMessageUpdated defines model for Event.message.updated.
  62. type EventMessageUpdated struct {
  63. Properties struct {
  64. Info MessageInfo `json:"info"`
  65. } `json:"properties"`
  66. Type string `json:"type"`
  67. }
  68. // EventPermissionUpdated defines model for Event.permission.updated.
  69. type EventPermissionUpdated struct {
  70. Properties PermissionInfo `json:"properties"`
  71. Type string `json:"type"`
  72. }
  73. // EventSessionError defines model for Event.session.error.
  74. type EventSessionError struct {
  75. Properties struct {
  76. Error *EventSessionError_Properties_Error `json:"error,omitempty"`
  77. } `json:"properties"`
  78. Type string `json:"type"`
  79. }
  80. // EventSessionError_Properties_Error defines model for EventSessionError.Properties.Error.
  81. type EventSessionError_Properties_Error struct {
  82. union json.RawMessage
  83. }
  84. // EventSessionUpdated defines model for Event.session.updated.
  85. type EventSessionUpdated struct {
  86. Properties struct {
  87. Info SessionInfo `json:"info"`
  88. } `json:"properties"`
  89. Type string `json:"type"`
  90. }
  91. // EventStorageWrite defines model for Event.storage.write.
  92. type EventStorageWrite struct {
  93. Properties struct {
  94. Content *interface{} `json:"content,omitempty"`
  95. Key string `json:"key"`
  96. } `json:"properties"`
  97. Type string `json:"type"`
  98. }
  99. // MessageInfo defines model for Message.Info.
  100. type MessageInfo struct {
  101. Id string `json:"id"`
  102. Metadata struct {
  103. Assistant *struct {
  104. Cost float32 `json:"cost"`
  105. ModelID string `json:"modelID"`
  106. Path struct {
  107. Cwd string `json:"cwd"`
  108. Root string `json:"root"`
  109. } `json:"path"`
  110. ProviderID string `json:"providerID"`
  111. Summary *bool `json:"summary,omitempty"`
  112. System []string `json:"system"`
  113. Tokens struct {
  114. Input float32 `json:"input"`
  115. Output float32 `json:"output"`
  116. Reasoning float32 `json:"reasoning"`
  117. } `json:"tokens"`
  118. } `json:"assistant,omitempty"`
  119. Error *MessageInfo_Metadata_Error `json:"error,omitempty"`
  120. SessionID string `json:"sessionID"`
  121. Time struct {
  122. Completed *float32 `json:"completed,omitempty"`
  123. Created float32 `json:"created"`
  124. } `json:"time"`
  125. Tool map[string]MessageInfo_Metadata_Tool_AdditionalProperties `json:"tool"`
  126. } `json:"metadata"`
  127. Parts []MessagePart `json:"parts"`
  128. Role MessageInfoRole `json:"role"`
  129. }
  130. // MessageInfo_Metadata_Error defines model for MessageInfo.Metadata.Error.
  131. type MessageInfo_Metadata_Error struct {
  132. union json.RawMessage
  133. }
  134. // MessageInfo_Metadata_Tool_AdditionalProperties defines model for MessageInfo.Metadata.Tool.AdditionalProperties.
  135. type MessageInfo_Metadata_Tool_AdditionalProperties struct {
  136. Time struct {
  137. End float32 `json:"end"`
  138. Start float32 `json:"start"`
  139. } `json:"time"`
  140. Title string `json:"title"`
  141. AdditionalProperties map[string]interface{} `json:"-"`
  142. }
  143. // MessageInfoRole defines model for MessageInfo.Role.
  144. type MessageInfoRole string
  145. // MessagePart defines model for Message.Part.
  146. type MessagePart struct {
  147. union json.RawMessage
  148. }
  149. // MessagePartFile defines model for Message.Part.File.
  150. type MessagePartFile struct {
  151. Filename *string `json:"filename,omitempty"`
  152. MediaType string `json:"mediaType"`
  153. Type string `json:"type"`
  154. Url string `json:"url"`
  155. }
  156. // MessagePartReasoning defines model for Message.Part.Reasoning.
  157. type MessagePartReasoning struct {
  158. ProviderMetadata *map[string]interface{} `json:"providerMetadata,omitempty"`
  159. Text string `json:"text"`
  160. Type string `json:"type"`
  161. }
  162. // MessagePartSourceUrl defines model for Message.Part.SourceUrl.
  163. type MessagePartSourceUrl struct {
  164. ProviderMetadata *map[string]interface{} `json:"providerMetadata,omitempty"`
  165. SourceId string `json:"sourceId"`
  166. Title *string `json:"title,omitempty"`
  167. Type string `json:"type"`
  168. Url string `json:"url"`
  169. }
  170. // MessagePartStepStart defines model for Message.Part.StepStart.
  171. type MessagePartStepStart struct {
  172. Type string `json:"type"`
  173. }
  174. // MessagePartText defines model for Message.Part.Text.
  175. type MessagePartText struct {
  176. Text string `json:"text"`
  177. Type string `json:"type"`
  178. }
  179. // MessagePartToolInvocation defines model for Message.Part.ToolInvocation.
  180. type MessagePartToolInvocation struct {
  181. ToolInvocation MessageToolInvocation `json:"toolInvocation"`
  182. Type string `json:"type"`
  183. }
  184. // MessageToolInvocation defines model for Message.ToolInvocation.
  185. type MessageToolInvocation struct {
  186. union json.RawMessage
  187. }
  188. // MessageToolInvocationToolCall defines model for Message.ToolInvocation.ToolCall.
  189. type MessageToolInvocationToolCall struct {
  190. Args *interface{} `json:"args,omitempty"`
  191. State string `json:"state"`
  192. Step *float32 `json:"step,omitempty"`
  193. ToolCallId string `json:"toolCallId"`
  194. ToolName string `json:"toolName"`
  195. }
  196. // MessageToolInvocationToolPartialCall defines model for Message.ToolInvocation.ToolPartialCall.
  197. type MessageToolInvocationToolPartialCall struct {
  198. Args *interface{} `json:"args,omitempty"`
  199. State string `json:"state"`
  200. Step *float32 `json:"step,omitempty"`
  201. ToolCallId string `json:"toolCallId"`
  202. ToolName string `json:"toolName"`
  203. }
  204. // MessageToolInvocationToolResult defines model for Message.ToolInvocation.ToolResult.
  205. type MessageToolInvocationToolResult struct {
  206. Args *interface{} `json:"args,omitempty"`
  207. Result string `json:"result"`
  208. State string `json:"state"`
  209. Step *float32 `json:"step,omitempty"`
  210. ToolCallId string `json:"toolCallId"`
  211. ToolName string `json:"toolName"`
  212. }
  213. // ModelInfo defines model for Model.Info.
  214. type ModelInfo struct {
  215. Attachment bool `json:"attachment"`
  216. Cost struct {
  217. Input float32 `json:"input"`
  218. InputCached float32 `json:"inputCached"`
  219. Output float32 `json:"output"`
  220. OutputCached float32 `json:"outputCached"`
  221. } `json:"cost"`
  222. Id string `json:"id"`
  223. Limit struct {
  224. Context float32 `json:"context"`
  225. Output float32 `json:"output"`
  226. } `json:"limit"`
  227. Name string `json:"name"`
  228. Reasoning bool `json:"reasoning"`
  229. Temperature bool `json:"temperature"`
  230. }
  231. // ProviderInfo defines model for Provider.Info.
  232. type ProviderInfo struct {
  233. Env []string `json:"env"`
  234. Id string `json:"id"`
  235. Models map[string]ModelInfo `json:"models"`
  236. Name string `json:"name"`
  237. }
  238. // ProviderAuthError defines model for ProviderAuthError.
  239. type ProviderAuthError struct {
  240. Data struct {
  241. Message string `json:"message"`
  242. ProviderID string `json:"providerID"`
  243. } `json:"data"`
  244. Name string `json:"name"`
  245. }
  246. // UnknownError defines model for UnknownError.
  247. type UnknownError struct {
  248. Data struct {
  249. Message string `json:"message"`
  250. } `json:"data"`
  251. Name string `json:"name"`
  252. }
  253. // PermissionInfo defines model for permission.info.
  254. type PermissionInfo struct {
  255. Id string `json:"id"`
  256. Metadata map[string]interface{} `json:"metadata"`
  257. SessionID string `json:"sessionID"`
  258. Time struct {
  259. Created float32 `json:"created"`
  260. } `json:"time"`
  261. Title string `json:"title"`
  262. }
  263. // SessionInfo defines model for session.info.
  264. type SessionInfo struct {
  265. Id string `json:"id"`
  266. ParentID *string `json:"parentID,omitempty"`
  267. Share *struct {
  268. Secret string `json:"secret"`
  269. Url string `json:"url"`
  270. } `json:"share,omitempty"`
  271. Time struct {
  272. Created float32 `json:"created"`
  273. Updated float32 `json:"updated"`
  274. } `json:"time"`
  275. Title string `json:"title"`
  276. }
  277. // PostFileSearchJSONBody defines parameters for PostFileSearch.
  278. type PostFileSearchJSONBody struct {
  279. Query string `json:"query"`
  280. }
  281. // PostSessionAbortJSONBody defines parameters for PostSessionAbort.
  282. type PostSessionAbortJSONBody struct {
  283. SessionID string `json:"sessionID"`
  284. }
  285. // PostSessionChatJSONBody defines parameters for PostSessionChat.
  286. type PostSessionChatJSONBody struct {
  287. ModelID string `json:"modelID"`
  288. Parts []MessagePart `json:"parts"`
  289. ProviderID string `json:"providerID"`
  290. SessionID string `json:"sessionID"`
  291. }
  292. // PostSessionInitializeJSONBody defines parameters for PostSessionInitialize.
  293. type PostSessionInitializeJSONBody struct {
  294. ModelID string `json:"modelID"`
  295. ProviderID string `json:"providerID"`
  296. SessionID string `json:"sessionID"`
  297. }
  298. // PostSessionMessagesJSONBody defines parameters for PostSessionMessages.
  299. type PostSessionMessagesJSONBody struct {
  300. SessionID string `json:"sessionID"`
  301. }
  302. // PostSessionShareJSONBody defines parameters for PostSessionShare.
  303. type PostSessionShareJSONBody struct {
  304. SessionID string `json:"sessionID"`
  305. }
  306. // PostSessionSummarizeJSONBody defines parameters for PostSessionSummarize.
  307. type PostSessionSummarizeJSONBody struct {
  308. ModelID string `json:"modelID"`
  309. ProviderID string `json:"providerID"`
  310. SessionID string `json:"sessionID"`
  311. }
  312. // PostFileSearchJSONRequestBody defines body for PostFileSearch for application/json ContentType.
  313. type PostFileSearchJSONRequestBody PostFileSearchJSONBody
  314. // PostSessionAbortJSONRequestBody defines body for PostSessionAbort for application/json ContentType.
  315. type PostSessionAbortJSONRequestBody PostSessionAbortJSONBody
  316. // PostSessionChatJSONRequestBody defines body for PostSessionChat for application/json ContentType.
  317. type PostSessionChatJSONRequestBody PostSessionChatJSONBody
  318. // PostSessionInitializeJSONRequestBody defines body for PostSessionInitialize for application/json ContentType.
  319. type PostSessionInitializeJSONRequestBody PostSessionInitializeJSONBody
  320. // PostSessionMessagesJSONRequestBody defines body for PostSessionMessages for application/json ContentType.
  321. type PostSessionMessagesJSONRequestBody PostSessionMessagesJSONBody
  322. // PostSessionShareJSONRequestBody defines body for PostSessionShare for application/json ContentType.
  323. type PostSessionShareJSONRequestBody PostSessionShareJSONBody
  324. // PostSessionSummarizeJSONRequestBody defines body for PostSessionSummarize for application/json ContentType.
  325. type PostSessionSummarizeJSONRequestBody PostSessionSummarizeJSONBody
  326. // Getter for additional properties for MessageInfo_Metadata_Tool_AdditionalProperties. Returns the specified
  327. // element and whether it was found
  328. func (a MessageInfo_Metadata_Tool_AdditionalProperties) Get(fieldName string) (value interface{}, found bool) {
  329. if a.AdditionalProperties != nil {
  330. value, found = a.AdditionalProperties[fieldName]
  331. }
  332. return
  333. }
  334. // Setter for additional properties for MessageInfo_Metadata_Tool_AdditionalProperties
  335. func (a *MessageInfo_Metadata_Tool_AdditionalProperties) Set(fieldName string, value interface{}) {
  336. if a.AdditionalProperties == nil {
  337. a.AdditionalProperties = make(map[string]interface{})
  338. }
  339. a.AdditionalProperties[fieldName] = value
  340. }
  341. // Override default JSON handling for MessageInfo_Metadata_Tool_AdditionalProperties to handle AdditionalProperties
  342. func (a *MessageInfo_Metadata_Tool_AdditionalProperties) UnmarshalJSON(b []byte) error {
  343. object := make(map[string]json.RawMessage)
  344. err := json.Unmarshal(b, &object)
  345. if err != nil {
  346. return err
  347. }
  348. if raw, found := object["time"]; found {
  349. err = json.Unmarshal(raw, &a.Time)
  350. if err != nil {
  351. return fmt.Errorf("error reading 'time': %w", err)
  352. }
  353. delete(object, "time")
  354. }
  355. if raw, found := object["title"]; found {
  356. err = json.Unmarshal(raw, &a.Title)
  357. if err != nil {
  358. return fmt.Errorf("error reading 'title': %w", err)
  359. }
  360. delete(object, "title")
  361. }
  362. if len(object) != 0 {
  363. a.AdditionalProperties = make(map[string]interface{})
  364. for fieldName, fieldBuf := range object {
  365. var fieldVal interface{}
  366. err := json.Unmarshal(fieldBuf, &fieldVal)
  367. if err != nil {
  368. return fmt.Errorf("error unmarshaling field %s: %w", fieldName, err)
  369. }
  370. a.AdditionalProperties[fieldName] = fieldVal
  371. }
  372. }
  373. return nil
  374. }
  375. // Override default JSON handling for MessageInfo_Metadata_Tool_AdditionalProperties to handle AdditionalProperties
  376. func (a MessageInfo_Metadata_Tool_AdditionalProperties) MarshalJSON() ([]byte, error) {
  377. var err error
  378. object := make(map[string]json.RawMessage)
  379. object["time"], err = json.Marshal(a.Time)
  380. if err != nil {
  381. return nil, fmt.Errorf("error marshaling 'time': %w", err)
  382. }
  383. object["title"], err = json.Marshal(a.Title)
  384. if err != nil {
  385. return nil, fmt.Errorf("error marshaling 'title': %w", err)
  386. }
  387. for fieldName, field := range a.AdditionalProperties {
  388. object[fieldName], err = json.Marshal(field)
  389. if err != nil {
  390. return nil, fmt.Errorf("error marshaling '%s': %w", fieldName, err)
  391. }
  392. }
  393. return json.Marshal(object)
  394. }
  395. // AsEventStorageWrite returns the union data inside the Event as a EventStorageWrite
  396. func (t Event) AsEventStorageWrite() (EventStorageWrite, error) {
  397. var body EventStorageWrite
  398. err := json.Unmarshal(t.union, &body)
  399. return body, err
  400. }
  401. // FromEventStorageWrite overwrites any union data inside the Event as the provided EventStorageWrite
  402. func (t *Event) FromEventStorageWrite(v EventStorageWrite) error {
  403. v.Type = "storage.write"
  404. b, err := json.Marshal(v)
  405. t.union = b
  406. return err
  407. }
  408. // MergeEventStorageWrite performs a merge with any union data inside the Event, using the provided EventStorageWrite
  409. func (t *Event) MergeEventStorageWrite(v EventStorageWrite) error {
  410. v.Type = "storage.write"
  411. b, err := json.Marshal(v)
  412. if err != nil {
  413. return err
  414. }
  415. merged, err := runtime.JSONMerge(t.union, b)
  416. t.union = merged
  417. return err
  418. }
  419. // AsEventLspClientDiagnostics returns the union data inside the Event as a EventLspClientDiagnostics
  420. func (t Event) AsEventLspClientDiagnostics() (EventLspClientDiagnostics, error) {
  421. var body EventLspClientDiagnostics
  422. err := json.Unmarshal(t.union, &body)
  423. return body, err
  424. }
  425. // FromEventLspClientDiagnostics overwrites any union data inside the Event as the provided EventLspClientDiagnostics
  426. func (t *Event) FromEventLspClientDiagnostics(v EventLspClientDiagnostics) error {
  427. v.Type = "lsp.client.diagnostics"
  428. b, err := json.Marshal(v)
  429. t.union = b
  430. return err
  431. }
  432. // MergeEventLspClientDiagnostics performs a merge with any union data inside the Event, using the provided EventLspClientDiagnostics
  433. func (t *Event) MergeEventLspClientDiagnostics(v EventLspClientDiagnostics) error {
  434. v.Type = "lsp.client.diagnostics"
  435. b, err := json.Marshal(v)
  436. if err != nil {
  437. return err
  438. }
  439. merged, err := runtime.JSONMerge(t.union, b)
  440. t.union = merged
  441. return err
  442. }
  443. // AsEventPermissionUpdated returns the union data inside the Event as a EventPermissionUpdated
  444. func (t Event) AsEventPermissionUpdated() (EventPermissionUpdated, error) {
  445. var body EventPermissionUpdated
  446. err := json.Unmarshal(t.union, &body)
  447. return body, err
  448. }
  449. // FromEventPermissionUpdated overwrites any union data inside the Event as the provided EventPermissionUpdated
  450. func (t *Event) FromEventPermissionUpdated(v EventPermissionUpdated) error {
  451. v.Type = "permission.updated"
  452. b, err := json.Marshal(v)
  453. t.union = b
  454. return err
  455. }
  456. // MergeEventPermissionUpdated performs a merge with any union data inside the Event, using the provided EventPermissionUpdated
  457. func (t *Event) MergeEventPermissionUpdated(v EventPermissionUpdated) error {
  458. v.Type = "permission.updated"
  459. b, err := json.Marshal(v)
  460. if err != nil {
  461. return err
  462. }
  463. merged, err := runtime.JSONMerge(t.union, b)
  464. t.union = merged
  465. return err
  466. }
  467. // AsEventMessageUpdated returns the union data inside the Event as a EventMessageUpdated
  468. func (t Event) AsEventMessageUpdated() (EventMessageUpdated, error) {
  469. var body EventMessageUpdated
  470. err := json.Unmarshal(t.union, &body)
  471. return body, err
  472. }
  473. // FromEventMessageUpdated overwrites any union data inside the Event as the provided EventMessageUpdated
  474. func (t *Event) FromEventMessageUpdated(v EventMessageUpdated) error {
  475. v.Type = "message.updated"
  476. b, err := json.Marshal(v)
  477. t.union = b
  478. return err
  479. }
  480. // MergeEventMessageUpdated performs a merge with any union data inside the Event, using the provided EventMessageUpdated
  481. func (t *Event) MergeEventMessageUpdated(v EventMessageUpdated) error {
  482. v.Type = "message.updated"
  483. b, err := json.Marshal(v)
  484. if err != nil {
  485. return err
  486. }
  487. merged, err := runtime.JSONMerge(t.union, b)
  488. t.union = merged
  489. return err
  490. }
  491. // AsEventMessagePartUpdated returns the union data inside the Event as a EventMessagePartUpdated
  492. func (t Event) AsEventMessagePartUpdated() (EventMessagePartUpdated, error) {
  493. var body EventMessagePartUpdated
  494. err := json.Unmarshal(t.union, &body)
  495. return body, err
  496. }
  497. // FromEventMessagePartUpdated overwrites any union data inside the Event as the provided EventMessagePartUpdated
  498. func (t *Event) FromEventMessagePartUpdated(v EventMessagePartUpdated) error {
  499. v.Type = "message.part.updated"
  500. b, err := json.Marshal(v)
  501. t.union = b
  502. return err
  503. }
  504. // MergeEventMessagePartUpdated performs a merge with any union data inside the Event, using the provided EventMessagePartUpdated
  505. func (t *Event) MergeEventMessagePartUpdated(v EventMessagePartUpdated) error {
  506. v.Type = "message.part.updated"
  507. b, err := json.Marshal(v)
  508. if err != nil {
  509. return err
  510. }
  511. merged, err := runtime.JSONMerge(t.union, b)
  512. t.union = merged
  513. return err
  514. }
  515. // AsEventSessionUpdated returns the union data inside the Event as a EventSessionUpdated
  516. func (t Event) AsEventSessionUpdated() (EventSessionUpdated, error) {
  517. var body EventSessionUpdated
  518. err := json.Unmarshal(t.union, &body)
  519. return body, err
  520. }
  521. // FromEventSessionUpdated overwrites any union data inside the Event as the provided EventSessionUpdated
  522. func (t *Event) FromEventSessionUpdated(v EventSessionUpdated) error {
  523. v.Type = "session.updated"
  524. b, err := json.Marshal(v)
  525. t.union = b
  526. return err
  527. }
  528. // MergeEventSessionUpdated performs a merge with any union data inside the Event, using the provided EventSessionUpdated
  529. func (t *Event) MergeEventSessionUpdated(v EventSessionUpdated) error {
  530. v.Type = "session.updated"
  531. b, err := json.Marshal(v)
  532. if err != nil {
  533. return err
  534. }
  535. merged, err := runtime.JSONMerge(t.union, b)
  536. t.union = merged
  537. return err
  538. }
  539. // AsEventSessionError returns the union data inside the Event as a EventSessionError
  540. func (t Event) AsEventSessionError() (EventSessionError, error) {
  541. var body EventSessionError
  542. err := json.Unmarshal(t.union, &body)
  543. return body, err
  544. }
  545. // FromEventSessionError overwrites any union data inside the Event as the provided EventSessionError
  546. func (t *Event) FromEventSessionError(v EventSessionError) error {
  547. v.Type = "session.error"
  548. b, err := json.Marshal(v)
  549. t.union = b
  550. return err
  551. }
  552. // MergeEventSessionError performs a merge with any union data inside the Event, using the provided EventSessionError
  553. func (t *Event) MergeEventSessionError(v EventSessionError) error {
  554. v.Type = "session.error"
  555. b, err := json.Marshal(v)
  556. if err != nil {
  557. return err
  558. }
  559. merged, err := runtime.JSONMerge(t.union, b)
  560. t.union = merged
  561. return err
  562. }
  563. func (t Event) Discriminator() (string, error) {
  564. var discriminator struct {
  565. Discriminator string `json:"type"`
  566. }
  567. err := json.Unmarshal(t.union, &discriminator)
  568. return discriminator.Discriminator, err
  569. }
  570. func (t Event) ValueByDiscriminator() (interface{}, error) {
  571. discriminator, err := t.Discriminator()
  572. if err != nil {
  573. return nil, err
  574. }
  575. switch discriminator {
  576. case "lsp.client.diagnostics":
  577. return t.AsEventLspClientDiagnostics()
  578. case "message.part.updated":
  579. return t.AsEventMessagePartUpdated()
  580. case "message.updated":
  581. return t.AsEventMessageUpdated()
  582. case "permission.updated":
  583. return t.AsEventPermissionUpdated()
  584. case "session.error":
  585. return t.AsEventSessionError()
  586. case "session.updated":
  587. return t.AsEventSessionUpdated()
  588. case "storage.write":
  589. return t.AsEventStorageWrite()
  590. default:
  591. return nil, errors.New("unknown discriminator value: " + discriminator)
  592. }
  593. }
  594. func (t Event) MarshalJSON() ([]byte, error) {
  595. b, err := t.union.MarshalJSON()
  596. return b, err
  597. }
  598. func (t *Event) UnmarshalJSON(b []byte) error {
  599. err := t.union.UnmarshalJSON(b)
  600. return err
  601. }
  602. // AsProviderAuthError returns the union data inside the EventSessionError_Properties_Error as a ProviderAuthError
  603. func (t EventSessionError_Properties_Error) AsProviderAuthError() (ProviderAuthError, error) {
  604. var body ProviderAuthError
  605. err := json.Unmarshal(t.union, &body)
  606. return body, err
  607. }
  608. // FromProviderAuthError overwrites any union data inside the EventSessionError_Properties_Error as the provided ProviderAuthError
  609. func (t *EventSessionError_Properties_Error) FromProviderAuthError(v ProviderAuthError) error {
  610. v.Name = "ProviderAuthError"
  611. b, err := json.Marshal(v)
  612. t.union = b
  613. return err
  614. }
  615. // MergeProviderAuthError performs a merge with any union data inside the EventSessionError_Properties_Error, using the provided ProviderAuthError
  616. func (t *EventSessionError_Properties_Error) MergeProviderAuthError(v ProviderAuthError) error {
  617. v.Name = "ProviderAuthError"
  618. b, err := json.Marshal(v)
  619. if err != nil {
  620. return err
  621. }
  622. merged, err := runtime.JSONMerge(t.union, b)
  623. t.union = merged
  624. return err
  625. }
  626. // AsUnknownError returns the union data inside the EventSessionError_Properties_Error as a UnknownError
  627. func (t EventSessionError_Properties_Error) AsUnknownError() (UnknownError, error) {
  628. var body UnknownError
  629. err := json.Unmarshal(t.union, &body)
  630. return body, err
  631. }
  632. // FromUnknownError overwrites any union data inside the EventSessionError_Properties_Error as the provided UnknownError
  633. func (t *EventSessionError_Properties_Error) FromUnknownError(v UnknownError) error {
  634. v.Name = "UnknownError"
  635. b, err := json.Marshal(v)
  636. t.union = b
  637. return err
  638. }
  639. // MergeUnknownError performs a merge with any union data inside the EventSessionError_Properties_Error, using the provided UnknownError
  640. func (t *EventSessionError_Properties_Error) MergeUnknownError(v UnknownError) error {
  641. v.Name = "UnknownError"
  642. b, err := json.Marshal(v)
  643. if err != nil {
  644. return err
  645. }
  646. merged, err := runtime.JSONMerge(t.union, b)
  647. t.union = merged
  648. return err
  649. }
  650. func (t EventSessionError_Properties_Error) Discriminator() (string, error) {
  651. var discriminator struct {
  652. Discriminator string `json:"name"`
  653. }
  654. err := json.Unmarshal(t.union, &discriminator)
  655. return discriminator.Discriminator, err
  656. }
  657. func (t EventSessionError_Properties_Error) ValueByDiscriminator() (interface{}, error) {
  658. discriminator, err := t.Discriminator()
  659. if err != nil {
  660. return nil, err
  661. }
  662. switch discriminator {
  663. case "ProviderAuthError":
  664. return t.AsProviderAuthError()
  665. case "UnknownError":
  666. return t.AsUnknownError()
  667. default:
  668. return nil, errors.New("unknown discriminator value: " + discriminator)
  669. }
  670. }
  671. func (t EventSessionError_Properties_Error) MarshalJSON() ([]byte, error) {
  672. b, err := t.union.MarshalJSON()
  673. return b, err
  674. }
  675. func (t *EventSessionError_Properties_Error) UnmarshalJSON(b []byte) error {
  676. err := t.union.UnmarshalJSON(b)
  677. return err
  678. }
  679. // AsProviderAuthError returns the union data inside the MessageInfo_Metadata_Error as a ProviderAuthError
  680. func (t MessageInfo_Metadata_Error) AsProviderAuthError() (ProviderAuthError, error) {
  681. var body ProviderAuthError
  682. err := json.Unmarshal(t.union, &body)
  683. return body, err
  684. }
  685. // FromProviderAuthError overwrites any union data inside the MessageInfo_Metadata_Error as the provided ProviderAuthError
  686. func (t *MessageInfo_Metadata_Error) FromProviderAuthError(v ProviderAuthError) error {
  687. v.Name = "ProviderAuthError"
  688. b, err := json.Marshal(v)
  689. t.union = b
  690. return err
  691. }
  692. // MergeProviderAuthError performs a merge with any union data inside the MessageInfo_Metadata_Error, using the provided ProviderAuthError
  693. func (t *MessageInfo_Metadata_Error) MergeProviderAuthError(v ProviderAuthError) error {
  694. v.Name = "ProviderAuthError"
  695. b, err := json.Marshal(v)
  696. if err != nil {
  697. return err
  698. }
  699. merged, err := runtime.JSONMerge(t.union, b)
  700. t.union = merged
  701. return err
  702. }
  703. // AsUnknownError returns the union data inside the MessageInfo_Metadata_Error as a UnknownError
  704. func (t MessageInfo_Metadata_Error) AsUnknownError() (UnknownError, error) {
  705. var body UnknownError
  706. err := json.Unmarshal(t.union, &body)
  707. return body, err
  708. }
  709. // FromUnknownError overwrites any union data inside the MessageInfo_Metadata_Error as the provided UnknownError
  710. func (t *MessageInfo_Metadata_Error) FromUnknownError(v UnknownError) error {
  711. v.Name = "UnknownError"
  712. b, err := json.Marshal(v)
  713. t.union = b
  714. return err
  715. }
  716. // MergeUnknownError performs a merge with any union data inside the MessageInfo_Metadata_Error, using the provided UnknownError
  717. func (t *MessageInfo_Metadata_Error) MergeUnknownError(v UnknownError) error {
  718. v.Name = "UnknownError"
  719. b, err := json.Marshal(v)
  720. if err != nil {
  721. return err
  722. }
  723. merged, err := runtime.JSONMerge(t.union, b)
  724. t.union = merged
  725. return err
  726. }
  727. func (t MessageInfo_Metadata_Error) Discriminator() (string, error) {
  728. var discriminator struct {
  729. Discriminator string `json:"name"`
  730. }
  731. err := json.Unmarshal(t.union, &discriminator)
  732. return discriminator.Discriminator, err
  733. }
  734. func (t MessageInfo_Metadata_Error) ValueByDiscriminator() (interface{}, error) {
  735. discriminator, err := t.Discriminator()
  736. if err != nil {
  737. return nil, err
  738. }
  739. switch discriminator {
  740. case "ProviderAuthError":
  741. return t.AsProviderAuthError()
  742. case "UnknownError":
  743. return t.AsUnknownError()
  744. default:
  745. return nil, errors.New("unknown discriminator value: " + discriminator)
  746. }
  747. }
  748. func (t MessageInfo_Metadata_Error) MarshalJSON() ([]byte, error) {
  749. b, err := t.union.MarshalJSON()
  750. return b, err
  751. }
  752. func (t *MessageInfo_Metadata_Error) UnmarshalJSON(b []byte) error {
  753. err := t.union.UnmarshalJSON(b)
  754. return err
  755. }
  756. // AsMessagePartText returns the union data inside the MessagePart as a MessagePartText
  757. func (t MessagePart) AsMessagePartText() (MessagePartText, error) {
  758. var body MessagePartText
  759. err := json.Unmarshal(t.union, &body)
  760. return body, err
  761. }
  762. // FromMessagePartText overwrites any union data inside the MessagePart as the provided MessagePartText
  763. func (t *MessagePart) FromMessagePartText(v MessagePartText) error {
  764. v.Type = "text"
  765. b, err := json.Marshal(v)
  766. t.union = b
  767. return err
  768. }
  769. // MergeMessagePartText performs a merge with any union data inside the MessagePart, using the provided MessagePartText
  770. func (t *MessagePart) MergeMessagePartText(v MessagePartText) error {
  771. v.Type = "text"
  772. b, err := json.Marshal(v)
  773. if err != nil {
  774. return err
  775. }
  776. merged, err := runtime.JSONMerge(t.union, b)
  777. t.union = merged
  778. return err
  779. }
  780. // AsMessagePartReasoning returns the union data inside the MessagePart as a MessagePartReasoning
  781. func (t MessagePart) AsMessagePartReasoning() (MessagePartReasoning, error) {
  782. var body MessagePartReasoning
  783. err := json.Unmarshal(t.union, &body)
  784. return body, err
  785. }
  786. // FromMessagePartReasoning overwrites any union data inside the MessagePart as the provided MessagePartReasoning
  787. func (t *MessagePart) FromMessagePartReasoning(v MessagePartReasoning) error {
  788. v.Type = "reasoning"
  789. b, err := json.Marshal(v)
  790. t.union = b
  791. return err
  792. }
  793. // MergeMessagePartReasoning performs a merge with any union data inside the MessagePart, using the provided MessagePartReasoning
  794. func (t *MessagePart) MergeMessagePartReasoning(v MessagePartReasoning) error {
  795. v.Type = "reasoning"
  796. b, err := json.Marshal(v)
  797. if err != nil {
  798. return err
  799. }
  800. merged, err := runtime.JSONMerge(t.union, b)
  801. t.union = merged
  802. return err
  803. }
  804. // AsMessagePartToolInvocation returns the union data inside the MessagePart as a MessagePartToolInvocation
  805. func (t MessagePart) AsMessagePartToolInvocation() (MessagePartToolInvocation, error) {
  806. var body MessagePartToolInvocation
  807. err := json.Unmarshal(t.union, &body)
  808. return body, err
  809. }
  810. // FromMessagePartToolInvocation overwrites any union data inside the MessagePart as the provided MessagePartToolInvocation
  811. func (t *MessagePart) FromMessagePartToolInvocation(v MessagePartToolInvocation) error {
  812. v.Type = "tool-invocation"
  813. b, err := json.Marshal(v)
  814. t.union = b
  815. return err
  816. }
  817. // MergeMessagePartToolInvocation performs a merge with any union data inside the MessagePart, using the provided MessagePartToolInvocation
  818. func (t *MessagePart) MergeMessagePartToolInvocation(v MessagePartToolInvocation) error {
  819. v.Type = "tool-invocation"
  820. b, err := json.Marshal(v)
  821. if err != nil {
  822. return err
  823. }
  824. merged, err := runtime.JSONMerge(t.union, b)
  825. t.union = merged
  826. return err
  827. }
  828. // AsMessagePartSourceUrl returns the union data inside the MessagePart as a MessagePartSourceUrl
  829. func (t MessagePart) AsMessagePartSourceUrl() (MessagePartSourceUrl, error) {
  830. var body MessagePartSourceUrl
  831. err := json.Unmarshal(t.union, &body)
  832. return body, err
  833. }
  834. // FromMessagePartSourceUrl overwrites any union data inside the MessagePart as the provided MessagePartSourceUrl
  835. func (t *MessagePart) FromMessagePartSourceUrl(v MessagePartSourceUrl) error {
  836. v.Type = "source-url"
  837. b, err := json.Marshal(v)
  838. t.union = b
  839. return err
  840. }
  841. // MergeMessagePartSourceUrl performs a merge with any union data inside the MessagePart, using the provided MessagePartSourceUrl
  842. func (t *MessagePart) MergeMessagePartSourceUrl(v MessagePartSourceUrl) error {
  843. v.Type = "source-url"
  844. b, err := json.Marshal(v)
  845. if err != nil {
  846. return err
  847. }
  848. merged, err := runtime.JSONMerge(t.union, b)
  849. t.union = merged
  850. return err
  851. }
  852. // AsMessagePartFile returns the union data inside the MessagePart as a MessagePartFile
  853. func (t MessagePart) AsMessagePartFile() (MessagePartFile, error) {
  854. var body MessagePartFile
  855. err := json.Unmarshal(t.union, &body)
  856. return body, err
  857. }
  858. // FromMessagePartFile overwrites any union data inside the MessagePart as the provided MessagePartFile
  859. func (t *MessagePart) FromMessagePartFile(v MessagePartFile) error {
  860. v.Type = "file"
  861. b, err := json.Marshal(v)
  862. t.union = b
  863. return err
  864. }
  865. // MergeMessagePartFile performs a merge with any union data inside the MessagePart, using the provided MessagePartFile
  866. func (t *MessagePart) MergeMessagePartFile(v MessagePartFile) error {
  867. v.Type = "file"
  868. b, err := json.Marshal(v)
  869. if err != nil {
  870. return err
  871. }
  872. merged, err := runtime.JSONMerge(t.union, b)
  873. t.union = merged
  874. return err
  875. }
  876. // AsMessagePartStepStart returns the union data inside the MessagePart as a MessagePartStepStart
  877. func (t MessagePart) AsMessagePartStepStart() (MessagePartStepStart, error) {
  878. var body MessagePartStepStart
  879. err := json.Unmarshal(t.union, &body)
  880. return body, err
  881. }
  882. // FromMessagePartStepStart overwrites any union data inside the MessagePart as the provided MessagePartStepStart
  883. func (t *MessagePart) FromMessagePartStepStart(v MessagePartStepStart) error {
  884. v.Type = "step-start"
  885. b, err := json.Marshal(v)
  886. t.union = b
  887. return err
  888. }
  889. // MergeMessagePartStepStart performs a merge with any union data inside the MessagePart, using the provided MessagePartStepStart
  890. func (t *MessagePart) MergeMessagePartStepStart(v MessagePartStepStart) error {
  891. v.Type = "step-start"
  892. b, err := json.Marshal(v)
  893. if err != nil {
  894. return err
  895. }
  896. merged, err := runtime.JSONMerge(t.union, b)
  897. t.union = merged
  898. return err
  899. }
  900. func (t MessagePart) Discriminator() (string, error) {
  901. var discriminator struct {
  902. Discriminator string `json:"type"`
  903. }
  904. err := json.Unmarshal(t.union, &discriminator)
  905. return discriminator.Discriminator, err
  906. }
  907. func (t MessagePart) ValueByDiscriminator() (interface{}, error) {
  908. discriminator, err := t.Discriminator()
  909. if err != nil {
  910. return nil, err
  911. }
  912. switch discriminator {
  913. case "file":
  914. return t.AsMessagePartFile()
  915. case "reasoning":
  916. return t.AsMessagePartReasoning()
  917. case "source-url":
  918. return t.AsMessagePartSourceUrl()
  919. case "step-start":
  920. return t.AsMessagePartStepStart()
  921. case "text":
  922. return t.AsMessagePartText()
  923. case "tool-invocation":
  924. return t.AsMessagePartToolInvocation()
  925. default:
  926. return nil, errors.New("unknown discriminator value: " + discriminator)
  927. }
  928. }
  929. func (t MessagePart) MarshalJSON() ([]byte, error) {
  930. b, err := t.union.MarshalJSON()
  931. return b, err
  932. }
  933. func (t *MessagePart) UnmarshalJSON(b []byte) error {
  934. err := t.union.UnmarshalJSON(b)
  935. return err
  936. }
  937. // AsMessageToolInvocationToolCall returns the union data inside the MessageToolInvocation as a MessageToolInvocationToolCall
  938. func (t MessageToolInvocation) AsMessageToolInvocationToolCall() (MessageToolInvocationToolCall, error) {
  939. var body MessageToolInvocationToolCall
  940. err := json.Unmarshal(t.union, &body)
  941. return body, err
  942. }
  943. // FromMessageToolInvocationToolCall overwrites any union data inside the MessageToolInvocation as the provided MessageToolInvocationToolCall
  944. func (t *MessageToolInvocation) FromMessageToolInvocationToolCall(v MessageToolInvocationToolCall) error {
  945. v.State = "call"
  946. b, err := json.Marshal(v)
  947. t.union = b
  948. return err
  949. }
  950. // MergeMessageToolInvocationToolCall performs a merge with any union data inside the MessageToolInvocation, using the provided MessageToolInvocationToolCall
  951. func (t *MessageToolInvocation) MergeMessageToolInvocationToolCall(v MessageToolInvocationToolCall) error {
  952. v.State = "call"
  953. b, err := json.Marshal(v)
  954. if err != nil {
  955. return err
  956. }
  957. merged, err := runtime.JSONMerge(t.union, b)
  958. t.union = merged
  959. return err
  960. }
  961. // AsMessageToolInvocationToolPartialCall returns the union data inside the MessageToolInvocation as a MessageToolInvocationToolPartialCall
  962. func (t MessageToolInvocation) AsMessageToolInvocationToolPartialCall() (MessageToolInvocationToolPartialCall, error) {
  963. var body MessageToolInvocationToolPartialCall
  964. err := json.Unmarshal(t.union, &body)
  965. return body, err
  966. }
  967. // FromMessageToolInvocationToolPartialCall overwrites any union data inside the MessageToolInvocation as the provided MessageToolInvocationToolPartialCall
  968. func (t *MessageToolInvocation) FromMessageToolInvocationToolPartialCall(v MessageToolInvocationToolPartialCall) error {
  969. v.State = "partial-call"
  970. b, err := json.Marshal(v)
  971. t.union = b
  972. return err
  973. }
  974. // MergeMessageToolInvocationToolPartialCall performs a merge with any union data inside the MessageToolInvocation, using the provided MessageToolInvocationToolPartialCall
  975. func (t *MessageToolInvocation) MergeMessageToolInvocationToolPartialCall(v MessageToolInvocationToolPartialCall) error {
  976. v.State = "partial-call"
  977. b, err := json.Marshal(v)
  978. if err != nil {
  979. return err
  980. }
  981. merged, err := runtime.JSONMerge(t.union, b)
  982. t.union = merged
  983. return err
  984. }
  985. // AsMessageToolInvocationToolResult returns the union data inside the MessageToolInvocation as a MessageToolInvocationToolResult
  986. func (t MessageToolInvocation) AsMessageToolInvocationToolResult() (MessageToolInvocationToolResult, error) {
  987. var body MessageToolInvocationToolResult
  988. err := json.Unmarshal(t.union, &body)
  989. return body, err
  990. }
  991. // FromMessageToolInvocationToolResult overwrites any union data inside the MessageToolInvocation as the provided MessageToolInvocationToolResult
  992. func (t *MessageToolInvocation) FromMessageToolInvocationToolResult(v MessageToolInvocationToolResult) error {
  993. v.State = "result"
  994. b, err := json.Marshal(v)
  995. t.union = b
  996. return err
  997. }
  998. // MergeMessageToolInvocationToolResult performs a merge with any union data inside the MessageToolInvocation, using the provided MessageToolInvocationToolResult
  999. func (t *MessageToolInvocation) MergeMessageToolInvocationToolResult(v MessageToolInvocationToolResult) error {
  1000. v.State = "result"
  1001. b, err := json.Marshal(v)
  1002. if err != nil {
  1003. return err
  1004. }
  1005. merged, err := runtime.JSONMerge(t.union, b)
  1006. t.union = merged
  1007. return err
  1008. }
  1009. func (t MessageToolInvocation) Discriminator() (string, error) {
  1010. var discriminator struct {
  1011. Discriminator string `json:"state"`
  1012. }
  1013. err := json.Unmarshal(t.union, &discriminator)
  1014. return discriminator.Discriminator, err
  1015. }
  1016. func (t MessageToolInvocation) ValueByDiscriminator() (interface{}, error) {
  1017. discriminator, err := t.Discriminator()
  1018. if err != nil {
  1019. return nil, err
  1020. }
  1021. switch discriminator {
  1022. case "call":
  1023. return t.AsMessageToolInvocationToolCall()
  1024. case "partial-call":
  1025. return t.AsMessageToolInvocationToolPartialCall()
  1026. case "result":
  1027. return t.AsMessageToolInvocationToolResult()
  1028. default:
  1029. return nil, errors.New("unknown discriminator value: " + discriminator)
  1030. }
  1031. }
  1032. func (t MessageToolInvocation) MarshalJSON() ([]byte, error) {
  1033. b, err := t.union.MarshalJSON()
  1034. return b, err
  1035. }
  1036. func (t *MessageToolInvocation) UnmarshalJSON(b []byte) error {
  1037. err := t.union.UnmarshalJSON(b)
  1038. return err
  1039. }
  1040. // RequestEditorFn is the function signature for the RequestEditor callback function
  1041. type RequestEditorFn func(ctx context.Context, req *http.Request) error
  1042. // Doer performs HTTP requests.
  1043. //
  1044. // The standard http.Client implements this interface.
  1045. type HttpRequestDoer interface {
  1046. Do(req *http.Request) (*http.Response, error)
  1047. }
  1048. // Client which conforms to the OpenAPI3 specification for this service.
  1049. type Client struct {
  1050. // The endpoint of the server conforming to this interface, with scheme,
  1051. // https://api.deepmap.com for example. This can contain a path relative
  1052. // to the server, such as https://api.deepmap.com/dev-test, and all the
  1053. // paths in the swagger spec will be appended to the server.
  1054. Server string
  1055. // Doer for performing requests, typically a *http.Client with any
  1056. // customized settings, such as certificate chains.
  1057. Client HttpRequestDoer
  1058. // A list of callbacks for modifying requests which are generated before sending over
  1059. // the network.
  1060. RequestEditors []RequestEditorFn
  1061. }
  1062. // ClientOption allows setting custom parameters during construction
  1063. type ClientOption func(*Client) error
  1064. // Creates a new Client, with reasonable defaults
  1065. func NewClient(server string, opts ...ClientOption) (*Client, error) {
  1066. // create a client with sane default values
  1067. client := Client{
  1068. Server: server,
  1069. }
  1070. // mutate client and add all optional params
  1071. for _, o := range opts {
  1072. if err := o(&client); err != nil {
  1073. return nil, err
  1074. }
  1075. }
  1076. // ensure the server URL always has a trailing slash
  1077. if !strings.HasSuffix(client.Server, "/") {
  1078. client.Server += "/"
  1079. }
  1080. // create httpClient, if not already present
  1081. if client.Client == nil {
  1082. client.Client = &http.Client{}
  1083. }
  1084. return &client, nil
  1085. }
  1086. // WithHTTPClient allows overriding the default Doer, which is
  1087. // automatically created using http.Client. This is useful for tests.
  1088. func WithHTTPClient(doer HttpRequestDoer) ClientOption {
  1089. return func(c *Client) error {
  1090. c.Client = doer
  1091. return nil
  1092. }
  1093. }
  1094. // WithRequestEditorFn allows setting up a callback function, which will be
  1095. // called right before sending the request. This can be used to mutate the request.
  1096. func WithRequestEditorFn(fn RequestEditorFn) ClientOption {
  1097. return func(c *Client) error {
  1098. c.RequestEditors = append(c.RequestEditors, fn)
  1099. return nil
  1100. }
  1101. }
  1102. // The interface specification for the client above.
  1103. type ClientInterface interface {
  1104. // PostAppInfo request
  1105. PostAppInfo(ctx context.Context, reqEditors ...RequestEditorFn) (*http.Response, error)
  1106. // PostAppInitialize request
  1107. PostAppInitialize(ctx context.Context, reqEditors ...RequestEditorFn) (*http.Response, error)
  1108. // GetEvent request
  1109. GetEvent(ctx context.Context, reqEditors ...RequestEditorFn) (*http.Response, error)
  1110. // PostFileSearchWithBody request with any body
  1111. PostFileSearchWithBody(ctx context.Context, contentType string, body io.Reader, reqEditors ...RequestEditorFn) (*http.Response, error)
  1112. PostFileSearch(ctx context.Context, body PostFileSearchJSONRequestBody, reqEditors ...RequestEditorFn) (*http.Response, error)
  1113. // PostPathGet request
  1114. PostPathGet(ctx context.Context, reqEditors ...RequestEditorFn) (*http.Response, error)
  1115. // PostProviderList request
  1116. PostProviderList(ctx context.Context, reqEditors ...RequestEditorFn) (*http.Response, error)
  1117. // PostSessionAbortWithBody request with any body
  1118. PostSessionAbortWithBody(ctx context.Context, contentType string, body io.Reader, reqEditors ...RequestEditorFn) (*http.Response, error)
  1119. PostSessionAbort(ctx context.Context, body PostSessionAbortJSONRequestBody, reqEditors ...RequestEditorFn) (*http.Response, error)
  1120. // PostSessionChatWithBody request with any body
  1121. PostSessionChatWithBody(ctx context.Context, contentType string, body io.Reader, reqEditors ...RequestEditorFn) (*http.Response, error)
  1122. PostSessionChat(ctx context.Context, body PostSessionChatJSONRequestBody, reqEditors ...RequestEditorFn) (*http.Response, error)
  1123. // PostSessionCreate request
  1124. PostSessionCreate(ctx context.Context, reqEditors ...RequestEditorFn) (*http.Response, error)
  1125. // PostSessionInitializeWithBody request with any body
  1126. PostSessionInitializeWithBody(ctx context.Context, contentType string, body io.Reader, reqEditors ...RequestEditorFn) (*http.Response, error)
  1127. PostSessionInitialize(ctx context.Context, body PostSessionInitializeJSONRequestBody, reqEditors ...RequestEditorFn) (*http.Response, error)
  1128. // PostSessionList request
  1129. PostSessionList(ctx context.Context, reqEditors ...RequestEditorFn) (*http.Response, error)
  1130. // PostSessionMessagesWithBody request with any body
  1131. PostSessionMessagesWithBody(ctx context.Context, contentType string, body io.Reader, reqEditors ...RequestEditorFn) (*http.Response, error)
  1132. PostSessionMessages(ctx context.Context, body PostSessionMessagesJSONRequestBody, reqEditors ...RequestEditorFn) (*http.Response, error)
  1133. // PostSessionShareWithBody request with any body
  1134. PostSessionShareWithBody(ctx context.Context, contentType string, body io.Reader, reqEditors ...RequestEditorFn) (*http.Response, error)
  1135. PostSessionShare(ctx context.Context, body PostSessionShareJSONRequestBody, reqEditors ...RequestEditorFn) (*http.Response, error)
  1136. // PostSessionSummarizeWithBody request with any body
  1137. PostSessionSummarizeWithBody(ctx context.Context, contentType string, body io.Reader, reqEditors ...RequestEditorFn) (*http.Response, error)
  1138. PostSessionSummarize(ctx context.Context, body PostSessionSummarizeJSONRequestBody, reqEditors ...RequestEditorFn) (*http.Response, error)
  1139. }
  1140. func (c *Client) PostAppInfo(ctx context.Context, reqEditors ...RequestEditorFn) (*http.Response, error) {
  1141. req, err := NewPostAppInfoRequest(c.Server)
  1142. if err != nil {
  1143. return nil, err
  1144. }
  1145. req = req.WithContext(ctx)
  1146. if err := c.applyEditors(ctx, req, reqEditors); err != nil {
  1147. return nil, err
  1148. }
  1149. return c.Client.Do(req)
  1150. }
  1151. func (c *Client) PostAppInitialize(ctx context.Context, reqEditors ...RequestEditorFn) (*http.Response, error) {
  1152. req, err := NewPostAppInitializeRequest(c.Server)
  1153. if err != nil {
  1154. return nil, err
  1155. }
  1156. req = req.WithContext(ctx)
  1157. if err := c.applyEditors(ctx, req, reqEditors); err != nil {
  1158. return nil, err
  1159. }
  1160. return c.Client.Do(req)
  1161. }
  1162. func (c *Client) GetEvent(ctx context.Context, reqEditors ...RequestEditorFn) (*http.Response, error) {
  1163. req, err := NewGetEventRequest(c.Server)
  1164. if err != nil {
  1165. return nil, err
  1166. }
  1167. req = req.WithContext(ctx)
  1168. if err := c.applyEditors(ctx, req, reqEditors); err != nil {
  1169. return nil, err
  1170. }
  1171. return c.Client.Do(req)
  1172. }
  1173. func (c *Client) PostFileSearchWithBody(ctx context.Context, contentType string, body io.Reader, reqEditors ...RequestEditorFn) (*http.Response, error) {
  1174. req, err := NewPostFileSearchRequestWithBody(c.Server, contentType, body)
  1175. if err != nil {
  1176. return nil, err
  1177. }
  1178. req = req.WithContext(ctx)
  1179. if err := c.applyEditors(ctx, req, reqEditors); err != nil {
  1180. return nil, err
  1181. }
  1182. return c.Client.Do(req)
  1183. }
  1184. func (c *Client) PostFileSearch(ctx context.Context, body PostFileSearchJSONRequestBody, reqEditors ...RequestEditorFn) (*http.Response, error) {
  1185. req, err := NewPostFileSearchRequest(c.Server, body)
  1186. if err != nil {
  1187. return nil, err
  1188. }
  1189. req = req.WithContext(ctx)
  1190. if err := c.applyEditors(ctx, req, reqEditors); err != nil {
  1191. return nil, err
  1192. }
  1193. return c.Client.Do(req)
  1194. }
  1195. func (c *Client) PostPathGet(ctx context.Context, reqEditors ...RequestEditorFn) (*http.Response, error) {
  1196. req, err := NewPostPathGetRequest(c.Server)
  1197. if err != nil {
  1198. return nil, err
  1199. }
  1200. req = req.WithContext(ctx)
  1201. if err := c.applyEditors(ctx, req, reqEditors); err != nil {
  1202. return nil, err
  1203. }
  1204. return c.Client.Do(req)
  1205. }
  1206. func (c *Client) PostProviderList(ctx context.Context, reqEditors ...RequestEditorFn) (*http.Response, error) {
  1207. req, err := NewPostProviderListRequest(c.Server)
  1208. if err != nil {
  1209. return nil, err
  1210. }
  1211. req = req.WithContext(ctx)
  1212. if err := c.applyEditors(ctx, req, reqEditors); err != nil {
  1213. return nil, err
  1214. }
  1215. return c.Client.Do(req)
  1216. }
  1217. func (c *Client) PostSessionAbortWithBody(ctx context.Context, contentType string, body io.Reader, reqEditors ...RequestEditorFn) (*http.Response, error) {
  1218. req, err := NewPostSessionAbortRequestWithBody(c.Server, contentType, body)
  1219. if err != nil {
  1220. return nil, err
  1221. }
  1222. req = req.WithContext(ctx)
  1223. if err := c.applyEditors(ctx, req, reqEditors); err != nil {
  1224. return nil, err
  1225. }
  1226. return c.Client.Do(req)
  1227. }
  1228. func (c *Client) PostSessionAbort(ctx context.Context, body PostSessionAbortJSONRequestBody, reqEditors ...RequestEditorFn) (*http.Response, error) {
  1229. req, err := NewPostSessionAbortRequest(c.Server, body)
  1230. if err != nil {
  1231. return nil, err
  1232. }
  1233. req = req.WithContext(ctx)
  1234. if err := c.applyEditors(ctx, req, reqEditors); err != nil {
  1235. return nil, err
  1236. }
  1237. return c.Client.Do(req)
  1238. }
  1239. func (c *Client) PostSessionChatWithBody(ctx context.Context, contentType string, body io.Reader, reqEditors ...RequestEditorFn) (*http.Response, error) {
  1240. req, err := NewPostSessionChatRequestWithBody(c.Server, contentType, body)
  1241. if err != nil {
  1242. return nil, err
  1243. }
  1244. req = req.WithContext(ctx)
  1245. if err := c.applyEditors(ctx, req, reqEditors); err != nil {
  1246. return nil, err
  1247. }
  1248. return c.Client.Do(req)
  1249. }
  1250. func (c *Client) PostSessionChat(ctx context.Context, body PostSessionChatJSONRequestBody, reqEditors ...RequestEditorFn) (*http.Response, error) {
  1251. req, err := NewPostSessionChatRequest(c.Server, body)
  1252. if err != nil {
  1253. return nil, err
  1254. }
  1255. req = req.WithContext(ctx)
  1256. if err := c.applyEditors(ctx, req, reqEditors); err != nil {
  1257. return nil, err
  1258. }
  1259. return c.Client.Do(req)
  1260. }
  1261. func (c *Client) PostSessionCreate(ctx context.Context, reqEditors ...RequestEditorFn) (*http.Response, error) {
  1262. req, err := NewPostSessionCreateRequest(c.Server)
  1263. if err != nil {
  1264. return nil, err
  1265. }
  1266. req = req.WithContext(ctx)
  1267. if err := c.applyEditors(ctx, req, reqEditors); err != nil {
  1268. return nil, err
  1269. }
  1270. return c.Client.Do(req)
  1271. }
  1272. func (c *Client) PostSessionInitializeWithBody(ctx context.Context, contentType string, body io.Reader, reqEditors ...RequestEditorFn) (*http.Response, error) {
  1273. req, err := NewPostSessionInitializeRequestWithBody(c.Server, contentType, body)
  1274. if err != nil {
  1275. return nil, err
  1276. }
  1277. req = req.WithContext(ctx)
  1278. if err := c.applyEditors(ctx, req, reqEditors); err != nil {
  1279. return nil, err
  1280. }
  1281. return c.Client.Do(req)
  1282. }
  1283. func (c *Client) PostSessionInitialize(ctx context.Context, body PostSessionInitializeJSONRequestBody, reqEditors ...RequestEditorFn) (*http.Response, error) {
  1284. req, err := NewPostSessionInitializeRequest(c.Server, body)
  1285. if err != nil {
  1286. return nil, err
  1287. }
  1288. req = req.WithContext(ctx)
  1289. if err := c.applyEditors(ctx, req, reqEditors); err != nil {
  1290. return nil, err
  1291. }
  1292. return c.Client.Do(req)
  1293. }
  1294. func (c *Client) PostSessionList(ctx context.Context, reqEditors ...RequestEditorFn) (*http.Response, error) {
  1295. req, err := NewPostSessionListRequest(c.Server)
  1296. if err != nil {
  1297. return nil, err
  1298. }
  1299. req = req.WithContext(ctx)
  1300. if err := c.applyEditors(ctx, req, reqEditors); err != nil {
  1301. return nil, err
  1302. }
  1303. return c.Client.Do(req)
  1304. }
  1305. func (c *Client) PostSessionMessagesWithBody(ctx context.Context, contentType string, body io.Reader, reqEditors ...RequestEditorFn) (*http.Response, error) {
  1306. req, err := NewPostSessionMessagesRequestWithBody(c.Server, contentType, body)
  1307. if err != nil {
  1308. return nil, err
  1309. }
  1310. req = req.WithContext(ctx)
  1311. if err := c.applyEditors(ctx, req, reqEditors); err != nil {
  1312. return nil, err
  1313. }
  1314. return c.Client.Do(req)
  1315. }
  1316. func (c *Client) PostSessionMessages(ctx context.Context, body PostSessionMessagesJSONRequestBody, reqEditors ...RequestEditorFn) (*http.Response, error) {
  1317. req, err := NewPostSessionMessagesRequest(c.Server, body)
  1318. if err != nil {
  1319. return nil, err
  1320. }
  1321. req = req.WithContext(ctx)
  1322. if err := c.applyEditors(ctx, req, reqEditors); err != nil {
  1323. return nil, err
  1324. }
  1325. return c.Client.Do(req)
  1326. }
  1327. func (c *Client) PostSessionShareWithBody(ctx context.Context, contentType string, body io.Reader, reqEditors ...RequestEditorFn) (*http.Response, error) {
  1328. req, err := NewPostSessionShareRequestWithBody(c.Server, contentType, body)
  1329. if err != nil {
  1330. return nil, err
  1331. }
  1332. req = req.WithContext(ctx)
  1333. if err := c.applyEditors(ctx, req, reqEditors); err != nil {
  1334. return nil, err
  1335. }
  1336. return c.Client.Do(req)
  1337. }
  1338. func (c *Client) PostSessionShare(ctx context.Context, body PostSessionShareJSONRequestBody, reqEditors ...RequestEditorFn) (*http.Response, error) {
  1339. req, err := NewPostSessionShareRequest(c.Server, body)
  1340. if err != nil {
  1341. return nil, err
  1342. }
  1343. req = req.WithContext(ctx)
  1344. if err := c.applyEditors(ctx, req, reqEditors); err != nil {
  1345. return nil, err
  1346. }
  1347. return c.Client.Do(req)
  1348. }
  1349. func (c *Client) PostSessionSummarizeWithBody(ctx context.Context, contentType string, body io.Reader, reqEditors ...RequestEditorFn) (*http.Response, error) {
  1350. req, err := NewPostSessionSummarizeRequestWithBody(c.Server, contentType, body)
  1351. if err != nil {
  1352. return nil, err
  1353. }
  1354. req = req.WithContext(ctx)
  1355. if err := c.applyEditors(ctx, req, reqEditors); err != nil {
  1356. return nil, err
  1357. }
  1358. return c.Client.Do(req)
  1359. }
  1360. func (c *Client) PostSessionSummarize(ctx context.Context, body PostSessionSummarizeJSONRequestBody, reqEditors ...RequestEditorFn) (*http.Response, error) {
  1361. req, err := NewPostSessionSummarizeRequest(c.Server, body)
  1362. if err != nil {
  1363. return nil, err
  1364. }
  1365. req = req.WithContext(ctx)
  1366. if err := c.applyEditors(ctx, req, reqEditors); err != nil {
  1367. return nil, err
  1368. }
  1369. return c.Client.Do(req)
  1370. }
  1371. // NewPostAppInfoRequest generates requests for PostAppInfo
  1372. func NewPostAppInfoRequest(server string) (*http.Request, error) {
  1373. var err error
  1374. serverURL, err := url.Parse(server)
  1375. if err != nil {
  1376. return nil, err
  1377. }
  1378. operationPath := fmt.Sprintf("/app_info")
  1379. if operationPath[0] == '/' {
  1380. operationPath = "." + operationPath
  1381. }
  1382. queryURL, err := serverURL.Parse(operationPath)
  1383. if err != nil {
  1384. return nil, err
  1385. }
  1386. req, err := http.NewRequest("POST", queryURL.String(), nil)
  1387. if err != nil {
  1388. return nil, err
  1389. }
  1390. return req, nil
  1391. }
  1392. // NewPostAppInitializeRequest generates requests for PostAppInitialize
  1393. func NewPostAppInitializeRequest(server string) (*http.Request, error) {
  1394. var err error
  1395. serverURL, err := url.Parse(server)
  1396. if err != nil {
  1397. return nil, err
  1398. }
  1399. operationPath := fmt.Sprintf("/app_initialize")
  1400. if operationPath[0] == '/' {
  1401. operationPath = "." + operationPath
  1402. }
  1403. queryURL, err := serverURL.Parse(operationPath)
  1404. if err != nil {
  1405. return nil, err
  1406. }
  1407. req, err := http.NewRequest("POST", queryURL.String(), nil)
  1408. if err != nil {
  1409. return nil, err
  1410. }
  1411. return req, nil
  1412. }
  1413. // NewGetEventRequest generates requests for GetEvent
  1414. func NewGetEventRequest(server string) (*http.Request, error) {
  1415. var err error
  1416. serverURL, err := url.Parse(server)
  1417. if err != nil {
  1418. return nil, err
  1419. }
  1420. operationPath := fmt.Sprintf("/event")
  1421. if operationPath[0] == '/' {
  1422. operationPath = "." + operationPath
  1423. }
  1424. queryURL, err := serverURL.Parse(operationPath)
  1425. if err != nil {
  1426. return nil, err
  1427. }
  1428. req, err := http.NewRequest("GET", queryURL.String(), nil)
  1429. if err != nil {
  1430. return nil, err
  1431. }
  1432. return req, nil
  1433. }
  1434. // NewPostFileSearchRequest calls the generic PostFileSearch builder with application/json body
  1435. func NewPostFileSearchRequest(server string, body PostFileSearchJSONRequestBody) (*http.Request, error) {
  1436. var bodyReader io.Reader
  1437. buf, err := json.Marshal(body)
  1438. if err != nil {
  1439. return nil, err
  1440. }
  1441. bodyReader = bytes.NewReader(buf)
  1442. return NewPostFileSearchRequestWithBody(server, "application/json", bodyReader)
  1443. }
  1444. // NewPostFileSearchRequestWithBody generates requests for PostFileSearch with any type of body
  1445. func NewPostFileSearchRequestWithBody(server string, contentType string, body io.Reader) (*http.Request, error) {
  1446. var err error
  1447. serverURL, err := url.Parse(server)
  1448. if err != nil {
  1449. return nil, err
  1450. }
  1451. operationPath := fmt.Sprintf("/file_search")
  1452. if operationPath[0] == '/' {
  1453. operationPath = "." + operationPath
  1454. }
  1455. queryURL, err := serverURL.Parse(operationPath)
  1456. if err != nil {
  1457. return nil, err
  1458. }
  1459. req, err := http.NewRequest("POST", queryURL.String(), body)
  1460. if err != nil {
  1461. return nil, err
  1462. }
  1463. req.Header.Add("Content-Type", contentType)
  1464. return req, nil
  1465. }
  1466. // NewPostPathGetRequest generates requests for PostPathGet
  1467. func NewPostPathGetRequest(server string) (*http.Request, error) {
  1468. var err error
  1469. serverURL, err := url.Parse(server)
  1470. if err != nil {
  1471. return nil, err
  1472. }
  1473. operationPath := fmt.Sprintf("/path_get")
  1474. if operationPath[0] == '/' {
  1475. operationPath = "." + operationPath
  1476. }
  1477. queryURL, err := serverURL.Parse(operationPath)
  1478. if err != nil {
  1479. return nil, err
  1480. }
  1481. req, err := http.NewRequest("POST", queryURL.String(), nil)
  1482. if err != nil {
  1483. return nil, err
  1484. }
  1485. return req, nil
  1486. }
  1487. // NewPostProviderListRequest generates requests for PostProviderList
  1488. func NewPostProviderListRequest(server string) (*http.Request, error) {
  1489. var err error
  1490. serverURL, err := url.Parse(server)
  1491. if err != nil {
  1492. return nil, err
  1493. }
  1494. operationPath := fmt.Sprintf("/provider_list")
  1495. if operationPath[0] == '/' {
  1496. operationPath = "." + operationPath
  1497. }
  1498. queryURL, err := serverURL.Parse(operationPath)
  1499. if err != nil {
  1500. return nil, err
  1501. }
  1502. req, err := http.NewRequest("POST", queryURL.String(), nil)
  1503. if err != nil {
  1504. return nil, err
  1505. }
  1506. return req, nil
  1507. }
  1508. // NewPostSessionAbortRequest calls the generic PostSessionAbort builder with application/json body
  1509. func NewPostSessionAbortRequest(server string, body PostSessionAbortJSONRequestBody) (*http.Request, error) {
  1510. var bodyReader io.Reader
  1511. buf, err := json.Marshal(body)
  1512. if err != nil {
  1513. return nil, err
  1514. }
  1515. bodyReader = bytes.NewReader(buf)
  1516. return NewPostSessionAbortRequestWithBody(server, "application/json", bodyReader)
  1517. }
  1518. // NewPostSessionAbortRequestWithBody generates requests for PostSessionAbort with any type of body
  1519. func NewPostSessionAbortRequestWithBody(server string, contentType string, body io.Reader) (*http.Request, error) {
  1520. var err error
  1521. serverURL, err := url.Parse(server)
  1522. if err != nil {
  1523. return nil, err
  1524. }
  1525. operationPath := fmt.Sprintf("/session_abort")
  1526. if operationPath[0] == '/' {
  1527. operationPath = "." + operationPath
  1528. }
  1529. queryURL, err := serverURL.Parse(operationPath)
  1530. if err != nil {
  1531. return nil, err
  1532. }
  1533. req, err := http.NewRequest("POST", queryURL.String(), body)
  1534. if err != nil {
  1535. return nil, err
  1536. }
  1537. req.Header.Add("Content-Type", contentType)
  1538. return req, nil
  1539. }
  1540. // NewPostSessionChatRequest calls the generic PostSessionChat builder with application/json body
  1541. func NewPostSessionChatRequest(server string, body PostSessionChatJSONRequestBody) (*http.Request, error) {
  1542. var bodyReader io.Reader
  1543. buf, err := json.Marshal(body)
  1544. if err != nil {
  1545. return nil, err
  1546. }
  1547. bodyReader = bytes.NewReader(buf)
  1548. return NewPostSessionChatRequestWithBody(server, "application/json", bodyReader)
  1549. }
  1550. // NewPostSessionChatRequestWithBody generates requests for PostSessionChat with any type of body
  1551. func NewPostSessionChatRequestWithBody(server string, contentType string, body io.Reader) (*http.Request, error) {
  1552. var err error
  1553. serverURL, err := url.Parse(server)
  1554. if err != nil {
  1555. return nil, err
  1556. }
  1557. operationPath := fmt.Sprintf("/session_chat")
  1558. if operationPath[0] == '/' {
  1559. operationPath = "." + operationPath
  1560. }
  1561. queryURL, err := serverURL.Parse(operationPath)
  1562. if err != nil {
  1563. return nil, err
  1564. }
  1565. req, err := http.NewRequest("POST", queryURL.String(), body)
  1566. if err != nil {
  1567. return nil, err
  1568. }
  1569. req.Header.Add("Content-Type", contentType)
  1570. return req, nil
  1571. }
  1572. // NewPostSessionCreateRequest generates requests for PostSessionCreate
  1573. func NewPostSessionCreateRequest(server string) (*http.Request, error) {
  1574. var err error
  1575. serverURL, err := url.Parse(server)
  1576. if err != nil {
  1577. return nil, err
  1578. }
  1579. operationPath := fmt.Sprintf("/session_create")
  1580. if operationPath[0] == '/' {
  1581. operationPath = "." + operationPath
  1582. }
  1583. queryURL, err := serverURL.Parse(operationPath)
  1584. if err != nil {
  1585. return nil, err
  1586. }
  1587. req, err := http.NewRequest("POST", queryURL.String(), nil)
  1588. if err != nil {
  1589. return nil, err
  1590. }
  1591. return req, nil
  1592. }
  1593. // NewPostSessionInitializeRequest calls the generic PostSessionInitialize builder with application/json body
  1594. func NewPostSessionInitializeRequest(server string, body PostSessionInitializeJSONRequestBody) (*http.Request, error) {
  1595. var bodyReader io.Reader
  1596. buf, err := json.Marshal(body)
  1597. if err != nil {
  1598. return nil, err
  1599. }
  1600. bodyReader = bytes.NewReader(buf)
  1601. return NewPostSessionInitializeRequestWithBody(server, "application/json", bodyReader)
  1602. }
  1603. // NewPostSessionInitializeRequestWithBody generates requests for PostSessionInitialize with any type of body
  1604. func NewPostSessionInitializeRequestWithBody(server string, contentType string, body io.Reader) (*http.Request, error) {
  1605. var err error
  1606. serverURL, err := url.Parse(server)
  1607. if err != nil {
  1608. return nil, err
  1609. }
  1610. operationPath := fmt.Sprintf("/session_initialize")
  1611. if operationPath[0] == '/' {
  1612. operationPath = "." + operationPath
  1613. }
  1614. queryURL, err := serverURL.Parse(operationPath)
  1615. if err != nil {
  1616. return nil, err
  1617. }
  1618. req, err := http.NewRequest("POST", queryURL.String(), body)
  1619. if err != nil {
  1620. return nil, err
  1621. }
  1622. req.Header.Add("Content-Type", contentType)
  1623. return req, nil
  1624. }
  1625. // NewPostSessionListRequest generates requests for PostSessionList
  1626. func NewPostSessionListRequest(server string) (*http.Request, error) {
  1627. var err error
  1628. serverURL, err := url.Parse(server)
  1629. if err != nil {
  1630. return nil, err
  1631. }
  1632. operationPath := fmt.Sprintf("/session_list")
  1633. if operationPath[0] == '/' {
  1634. operationPath = "." + operationPath
  1635. }
  1636. queryURL, err := serverURL.Parse(operationPath)
  1637. if err != nil {
  1638. return nil, err
  1639. }
  1640. req, err := http.NewRequest("POST", queryURL.String(), nil)
  1641. if err != nil {
  1642. return nil, err
  1643. }
  1644. return req, nil
  1645. }
  1646. // NewPostSessionMessagesRequest calls the generic PostSessionMessages builder with application/json body
  1647. func NewPostSessionMessagesRequest(server string, body PostSessionMessagesJSONRequestBody) (*http.Request, error) {
  1648. var bodyReader io.Reader
  1649. buf, err := json.Marshal(body)
  1650. if err != nil {
  1651. return nil, err
  1652. }
  1653. bodyReader = bytes.NewReader(buf)
  1654. return NewPostSessionMessagesRequestWithBody(server, "application/json", bodyReader)
  1655. }
  1656. // NewPostSessionMessagesRequestWithBody generates requests for PostSessionMessages with any type of body
  1657. func NewPostSessionMessagesRequestWithBody(server string, contentType string, body io.Reader) (*http.Request, error) {
  1658. var err error
  1659. serverURL, err := url.Parse(server)
  1660. if err != nil {
  1661. return nil, err
  1662. }
  1663. operationPath := fmt.Sprintf("/session_messages")
  1664. if operationPath[0] == '/' {
  1665. operationPath = "." + operationPath
  1666. }
  1667. queryURL, err := serverURL.Parse(operationPath)
  1668. if err != nil {
  1669. return nil, err
  1670. }
  1671. req, err := http.NewRequest("POST", queryURL.String(), body)
  1672. if err != nil {
  1673. return nil, err
  1674. }
  1675. req.Header.Add("Content-Type", contentType)
  1676. return req, nil
  1677. }
  1678. // NewPostSessionShareRequest calls the generic PostSessionShare builder with application/json body
  1679. func NewPostSessionShareRequest(server string, body PostSessionShareJSONRequestBody) (*http.Request, error) {
  1680. var bodyReader io.Reader
  1681. buf, err := json.Marshal(body)
  1682. if err != nil {
  1683. return nil, err
  1684. }
  1685. bodyReader = bytes.NewReader(buf)
  1686. return NewPostSessionShareRequestWithBody(server, "application/json", bodyReader)
  1687. }
  1688. // NewPostSessionShareRequestWithBody generates requests for PostSessionShare with any type of body
  1689. func NewPostSessionShareRequestWithBody(server string, contentType string, body io.Reader) (*http.Request, error) {
  1690. var err error
  1691. serverURL, err := url.Parse(server)
  1692. if err != nil {
  1693. return nil, err
  1694. }
  1695. operationPath := fmt.Sprintf("/session_share")
  1696. if operationPath[0] == '/' {
  1697. operationPath = "." + operationPath
  1698. }
  1699. queryURL, err := serverURL.Parse(operationPath)
  1700. if err != nil {
  1701. return nil, err
  1702. }
  1703. req, err := http.NewRequest("POST", queryURL.String(), body)
  1704. if err != nil {
  1705. return nil, err
  1706. }
  1707. req.Header.Add("Content-Type", contentType)
  1708. return req, nil
  1709. }
  1710. // NewPostSessionSummarizeRequest calls the generic PostSessionSummarize builder with application/json body
  1711. func NewPostSessionSummarizeRequest(server string, body PostSessionSummarizeJSONRequestBody) (*http.Request, error) {
  1712. var bodyReader io.Reader
  1713. buf, err := json.Marshal(body)
  1714. if err != nil {
  1715. return nil, err
  1716. }
  1717. bodyReader = bytes.NewReader(buf)
  1718. return NewPostSessionSummarizeRequestWithBody(server, "application/json", bodyReader)
  1719. }
  1720. // NewPostSessionSummarizeRequestWithBody generates requests for PostSessionSummarize with any type of body
  1721. func NewPostSessionSummarizeRequestWithBody(server string, contentType string, body io.Reader) (*http.Request, error) {
  1722. var err error
  1723. serverURL, err := url.Parse(server)
  1724. if err != nil {
  1725. return nil, err
  1726. }
  1727. operationPath := fmt.Sprintf("/session_summarize")
  1728. if operationPath[0] == '/' {
  1729. operationPath = "." + operationPath
  1730. }
  1731. queryURL, err := serverURL.Parse(operationPath)
  1732. if err != nil {
  1733. return nil, err
  1734. }
  1735. req, err := http.NewRequest("POST", queryURL.String(), body)
  1736. if err != nil {
  1737. return nil, err
  1738. }
  1739. req.Header.Add("Content-Type", contentType)
  1740. return req, nil
  1741. }
  1742. func (c *Client) applyEditors(ctx context.Context, req *http.Request, additionalEditors []RequestEditorFn) error {
  1743. for _, r := range c.RequestEditors {
  1744. if err := r(ctx, req); err != nil {
  1745. return err
  1746. }
  1747. }
  1748. for _, r := range additionalEditors {
  1749. if err := r(ctx, req); err != nil {
  1750. return err
  1751. }
  1752. }
  1753. return nil
  1754. }
  1755. // ClientWithResponses builds on ClientInterface to offer response payloads
  1756. type ClientWithResponses struct {
  1757. ClientInterface
  1758. }
  1759. // NewClientWithResponses creates a new ClientWithResponses, which wraps
  1760. // Client with return type handling
  1761. func NewClientWithResponses(server string, opts ...ClientOption) (*ClientWithResponses, error) {
  1762. client, err := NewClient(server, opts...)
  1763. if err != nil {
  1764. return nil, err
  1765. }
  1766. return &ClientWithResponses{client}, nil
  1767. }
  1768. // WithBaseURL overrides the baseURL.
  1769. func WithBaseURL(baseURL string) ClientOption {
  1770. return func(c *Client) error {
  1771. newBaseURL, err := url.Parse(baseURL)
  1772. if err != nil {
  1773. return err
  1774. }
  1775. c.Server = newBaseURL.String()
  1776. return nil
  1777. }
  1778. }
  1779. // ClientWithResponsesInterface is the interface specification for the client with responses above.
  1780. type ClientWithResponsesInterface interface {
  1781. // PostAppInfoWithResponse request
  1782. PostAppInfoWithResponse(ctx context.Context, reqEditors ...RequestEditorFn) (*PostAppInfoResponse, error)
  1783. // PostAppInitializeWithResponse request
  1784. PostAppInitializeWithResponse(ctx context.Context, reqEditors ...RequestEditorFn) (*PostAppInitializeResponse, error)
  1785. // GetEventWithResponse request
  1786. GetEventWithResponse(ctx context.Context, reqEditors ...RequestEditorFn) (*GetEventResponse, error)
  1787. // PostFileSearchWithBodyWithResponse request with any body
  1788. PostFileSearchWithBodyWithResponse(ctx context.Context, contentType string, body io.Reader, reqEditors ...RequestEditorFn) (*PostFileSearchResponse, error)
  1789. PostFileSearchWithResponse(ctx context.Context, body PostFileSearchJSONRequestBody, reqEditors ...RequestEditorFn) (*PostFileSearchResponse, error)
  1790. // PostPathGetWithResponse request
  1791. PostPathGetWithResponse(ctx context.Context, reqEditors ...RequestEditorFn) (*PostPathGetResponse, error)
  1792. // PostProviderListWithResponse request
  1793. PostProviderListWithResponse(ctx context.Context, reqEditors ...RequestEditorFn) (*PostProviderListResponse, error)
  1794. // PostSessionAbortWithBodyWithResponse request with any body
  1795. PostSessionAbortWithBodyWithResponse(ctx context.Context, contentType string, body io.Reader, reqEditors ...RequestEditorFn) (*PostSessionAbortResponse, error)
  1796. PostSessionAbortWithResponse(ctx context.Context, body PostSessionAbortJSONRequestBody, reqEditors ...RequestEditorFn) (*PostSessionAbortResponse, error)
  1797. // PostSessionChatWithBodyWithResponse request with any body
  1798. PostSessionChatWithBodyWithResponse(ctx context.Context, contentType string, body io.Reader, reqEditors ...RequestEditorFn) (*PostSessionChatResponse, error)
  1799. PostSessionChatWithResponse(ctx context.Context, body PostSessionChatJSONRequestBody, reqEditors ...RequestEditorFn) (*PostSessionChatResponse, error)
  1800. // PostSessionCreateWithResponse request
  1801. PostSessionCreateWithResponse(ctx context.Context, reqEditors ...RequestEditorFn) (*PostSessionCreateResponse, error)
  1802. // PostSessionInitializeWithBodyWithResponse request with any body
  1803. PostSessionInitializeWithBodyWithResponse(ctx context.Context, contentType string, body io.Reader, reqEditors ...RequestEditorFn) (*PostSessionInitializeResponse, error)
  1804. PostSessionInitializeWithResponse(ctx context.Context, body PostSessionInitializeJSONRequestBody, reqEditors ...RequestEditorFn) (*PostSessionInitializeResponse, error)
  1805. // PostSessionListWithResponse request
  1806. PostSessionListWithResponse(ctx context.Context, reqEditors ...RequestEditorFn) (*PostSessionListResponse, error)
  1807. // PostSessionMessagesWithBodyWithResponse request with any body
  1808. PostSessionMessagesWithBodyWithResponse(ctx context.Context, contentType string, body io.Reader, reqEditors ...RequestEditorFn) (*PostSessionMessagesResponse, error)
  1809. PostSessionMessagesWithResponse(ctx context.Context, body PostSessionMessagesJSONRequestBody, reqEditors ...RequestEditorFn) (*PostSessionMessagesResponse, error)
  1810. // PostSessionShareWithBodyWithResponse request with any body
  1811. PostSessionShareWithBodyWithResponse(ctx context.Context, contentType string, body io.Reader, reqEditors ...RequestEditorFn) (*PostSessionShareResponse, error)
  1812. PostSessionShareWithResponse(ctx context.Context, body PostSessionShareJSONRequestBody, reqEditors ...RequestEditorFn) (*PostSessionShareResponse, error)
  1813. // PostSessionSummarizeWithBodyWithResponse request with any body
  1814. PostSessionSummarizeWithBodyWithResponse(ctx context.Context, contentType string, body io.Reader, reqEditors ...RequestEditorFn) (*PostSessionSummarizeResponse, error)
  1815. PostSessionSummarizeWithResponse(ctx context.Context, body PostSessionSummarizeJSONRequestBody, reqEditors ...RequestEditorFn) (*PostSessionSummarizeResponse, error)
  1816. }
  1817. type PostAppInfoResponse struct {
  1818. Body []byte
  1819. HTTPResponse *http.Response
  1820. JSON200 *AppInfo
  1821. }
  1822. // Status returns HTTPResponse.Status
  1823. func (r PostAppInfoResponse) Status() string {
  1824. if r.HTTPResponse != nil {
  1825. return r.HTTPResponse.Status
  1826. }
  1827. return http.StatusText(0)
  1828. }
  1829. // StatusCode returns HTTPResponse.StatusCode
  1830. func (r PostAppInfoResponse) StatusCode() int {
  1831. if r.HTTPResponse != nil {
  1832. return r.HTTPResponse.StatusCode
  1833. }
  1834. return 0
  1835. }
  1836. type PostAppInitializeResponse struct {
  1837. Body []byte
  1838. HTTPResponse *http.Response
  1839. JSON200 *bool
  1840. }
  1841. // Status returns HTTPResponse.Status
  1842. func (r PostAppInitializeResponse) Status() string {
  1843. if r.HTTPResponse != nil {
  1844. return r.HTTPResponse.Status
  1845. }
  1846. return http.StatusText(0)
  1847. }
  1848. // StatusCode returns HTTPResponse.StatusCode
  1849. func (r PostAppInitializeResponse) StatusCode() int {
  1850. if r.HTTPResponse != nil {
  1851. return r.HTTPResponse.StatusCode
  1852. }
  1853. return 0
  1854. }
  1855. type GetEventResponse struct {
  1856. Body []byte
  1857. HTTPResponse *http.Response
  1858. JSON200 *Event
  1859. }
  1860. // Status returns HTTPResponse.Status
  1861. func (r GetEventResponse) Status() string {
  1862. if r.HTTPResponse != nil {
  1863. return r.HTTPResponse.Status
  1864. }
  1865. return http.StatusText(0)
  1866. }
  1867. // StatusCode returns HTTPResponse.StatusCode
  1868. func (r GetEventResponse) StatusCode() int {
  1869. if r.HTTPResponse != nil {
  1870. return r.HTTPResponse.StatusCode
  1871. }
  1872. return 0
  1873. }
  1874. type PostFileSearchResponse struct {
  1875. Body []byte
  1876. HTTPResponse *http.Response
  1877. JSON200 *[]string
  1878. }
  1879. // Status returns HTTPResponse.Status
  1880. func (r PostFileSearchResponse) Status() string {
  1881. if r.HTTPResponse != nil {
  1882. return r.HTTPResponse.Status
  1883. }
  1884. return http.StatusText(0)
  1885. }
  1886. // StatusCode returns HTTPResponse.StatusCode
  1887. func (r PostFileSearchResponse) StatusCode() int {
  1888. if r.HTTPResponse != nil {
  1889. return r.HTTPResponse.StatusCode
  1890. }
  1891. return 0
  1892. }
  1893. type PostPathGetResponse struct {
  1894. Body []byte
  1895. HTTPResponse *http.Response
  1896. JSON200 *struct {
  1897. Config string `json:"config"`
  1898. Cwd string `json:"cwd"`
  1899. Data string `json:"data"`
  1900. Root string `json:"root"`
  1901. }
  1902. }
  1903. // Status returns HTTPResponse.Status
  1904. func (r PostPathGetResponse) Status() string {
  1905. if r.HTTPResponse != nil {
  1906. return r.HTTPResponse.Status
  1907. }
  1908. return http.StatusText(0)
  1909. }
  1910. // StatusCode returns HTTPResponse.StatusCode
  1911. func (r PostPathGetResponse) StatusCode() int {
  1912. if r.HTTPResponse != nil {
  1913. return r.HTTPResponse.StatusCode
  1914. }
  1915. return 0
  1916. }
  1917. type PostProviderListResponse struct {
  1918. Body []byte
  1919. HTTPResponse *http.Response
  1920. JSON200 *struct {
  1921. Default map[string]string `json:"default"`
  1922. Providers []ProviderInfo `json:"providers"`
  1923. }
  1924. }
  1925. // Status returns HTTPResponse.Status
  1926. func (r PostProviderListResponse) Status() string {
  1927. if r.HTTPResponse != nil {
  1928. return r.HTTPResponse.Status
  1929. }
  1930. return http.StatusText(0)
  1931. }
  1932. // StatusCode returns HTTPResponse.StatusCode
  1933. func (r PostProviderListResponse) StatusCode() int {
  1934. if r.HTTPResponse != nil {
  1935. return r.HTTPResponse.StatusCode
  1936. }
  1937. return 0
  1938. }
  1939. type PostSessionAbortResponse struct {
  1940. Body []byte
  1941. HTTPResponse *http.Response
  1942. JSON200 *bool
  1943. }
  1944. // Status returns HTTPResponse.Status
  1945. func (r PostSessionAbortResponse) Status() string {
  1946. if r.HTTPResponse != nil {
  1947. return r.HTTPResponse.Status
  1948. }
  1949. return http.StatusText(0)
  1950. }
  1951. // StatusCode returns HTTPResponse.StatusCode
  1952. func (r PostSessionAbortResponse) StatusCode() int {
  1953. if r.HTTPResponse != nil {
  1954. return r.HTTPResponse.StatusCode
  1955. }
  1956. return 0
  1957. }
  1958. type PostSessionChatResponse struct {
  1959. Body []byte
  1960. HTTPResponse *http.Response
  1961. JSON200 *MessageInfo
  1962. }
  1963. // Status returns HTTPResponse.Status
  1964. func (r PostSessionChatResponse) Status() string {
  1965. if r.HTTPResponse != nil {
  1966. return r.HTTPResponse.Status
  1967. }
  1968. return http.StatusText(0)
  1969. }
  1970. // StatusCode returns HTTPResponse.StatusCode
  1971. func (r PostSessionChatResponse) StatusCode() int {
  1972. if r.HTTPResponse != nil {
  1973. return r.HTTPResponse.StatusCode
  1974. }
  1975. return 0
  1976. }
  1977. type PostSessionCreateResponse struct {
  1978. Body []byte
  1979. HTTPResponse *http.Response
  1980. JSON200 *SessionInfo
  1981. JSON400 *Error
  1982. }
  1983. // Status returns HTTPResponse.Status
  1984. func (r PostSessionCreateResponse) Status() string {
  1985. if r.HTTPResponse != nil {
  1986. return r.HTTPResponse.Status
  1987. }
  1988. return http.StatusText(0)
  1989. }
  1990. // StatusCode returns HTTPResponse.StatusCode
  1991. func (r PostSessionCreateResponse) StatusCode() int {
  1992. if r.HTTPResponse != nil {
  1993. return r.HTTPResponse.StatusCode
  1994. }
  1995. return 0
  1996. }
  1997. type PostSessionInitializeResponse struct {
  1998. Body []byte
  1999. HTTPResponse *http.Response
  2000. JSON200 *bool
  2001. }
  2002. // Status returns HTTPResponse.Status
  2003. func (r PostSessionInitializeResponse) Status() string {
  2004. if r.HTTPResponse != nil {
  2005. return r.HTTPResponse.Status
  2006. }
  2007. return http.StatusText(0)
  2008. }
  2009. // StatusCode returns HTTPResponse.StatusCode
  2010. func (r PostSessionInitializeResponse) StatusCode() int {
  2011. if r.HTTPResponse != nil {
  2012. return r.HTTPResponse.StatusCode
  2013. }
  2014. return 0
  2015. }
  2016. type PostSessionListResponse struct {
  2017. Body []byte
  2018. HTTPResponse *http.Response
  2019. JSON200 *[]SessionInfo
  2020. }
  2021. // Status returns HTTPResponse.Status
  2022. func (r PostSessionListResponse) Status() string {
  2023. if r.HTTPResponse != nil {
  2024. return r.HTTPResponse.Status
  2025. }
  2026. return http.StatusText(0)
  2027. }
  2028. // StatusCode returns HTTPResponse.StatusCode
  2029. func (r PostSessionListResponse) StatusCode() int {
  2030. if r.HTTPResponse != nil {
  2031. return r.HTTPResponse.StatusCode
  2032. }
  2033. return 0
  2034. }
  2035. type PostSessionMessagesResponse struct {
  2036. Body []byte
  2037. HTTPResponse *http.Response
  2038. JSON200 *[]MessageInfo
  2039. }
  2040. // Status returns HTTPResponse.Status
  2041. func (r PostSessionMessagesResponse) Status() string {
  2042. if r.HTTPResponse != nil {
  2043. return r.HTTPResponse.Status
  2044. }
  2045. return http.StatusText(0)
  2046. }
  2047. // StatusCode returns HTTPResponse.StatusCode
  2048. func (r PostSessionMessagesResponse) StatusCode() int {
  2049. if r.HTTPResponse != nil {
  2050. return r.HTTPResponse.StatusCode
  2051. }
  2052. return 0
  2053. }
  2054. type PostSessionShareResponse struct {
  2055. Body []byte
  2056. HTTPResponse *http.Response
  2057. JSON200 *SessionInfo
  2058. }
  2059. // Status returns HTTPResponse.Status
  2060. func (r PostSessionShareResponse) Status() string {
  2061. if r.HTTPResponse != nil {
  2062. return r.HTTPResponse.Status
  2063. }
  2064. return http.StatusText(0)
  2065. }
  2066. // StatusCode returns HTTPResponse.StatusCode
  2067. func (r PostSessionShareResponse) StatusCode() int {
  2068. if r.HTTPResponse != nil {
  2069. return r.HTTPResponse.StatusCode
  2070. }
  2071. return 0
  2072. }
  2073. type PostSessionSummarizeResponse struct {
  2074. Body []byte
  2075. HTTPResponse *http.Response
  2076. JSON200 *bool
  2077. }
  2078. // Status returns HTTPResponse.Status
  2079. func (r PostSessionSummarizeResponse) Status() string {
  2080. if r.HTTPResponse != nil {
  2081. return r.HTTPResponse.Status
  2082. }
  2083. return http.StatusText(0)
  2084. }
  2085. // StatusCode returns HTTPResponse.StatusCode
  2086. func (r PostSessionSummarizeResponse) StatusCode() int {
  2087. if r.HTTPResponse != nil {
  2088. return r.HTTPResponse.StatusCode
  2089. }
  2090. return 0
  2091. }
  2092. // PostAppInfoWithResponse request returning *PostAppInfoResponse
  2093. func (c *ClientWithResponses) PostAppInfoWithResponse(ctx context.Context, reqEditors ...RequestEditorFn) (*PostAppInfoResponse, error) {
  2094. rsp, err := c.PostAppInfo(ctx, reqEditors...)
  2095. if err != nil {
  2096. return nil, err
  2097. }
  2098. return ParsePostAppInfoResponse(rsp)
  2099. }
  2100. // PostAppInitializeWithResponse request returning *PostAppInitializeResponse
  2101. func (c *ClientWithResponses) PostAppInitializeWithResponse(ctx context.Context, reqEditors ...RequestEditorFn) (*PostAppInitializeResponse, error) {
  2102. rsp, err := c.PostAppInitialize(ctx, reqEditors...)
  2103. if err != nil {
  2104. return nil, err
  2105. }
  2106. return ParsePostAppInitializeResponse(rsp)
  2107. }
  2108. // GetEventWithResponse request returning *GetEventResponse
  2109. func (c *ClientWithResponses) GetEventWithResponse(ctx context.Context, reqEditors ...RequestEditorFn) (*GetEventResponse, error) {
  2110. rsp, err := c.GetEvent(ctx, reqEditors...)
  2111. if err != nil {
  2112. return nil, err
  2113. }
  2114. return ParseGetEventResponse(rsp)
  2115. }
  2116. // PostFileSearchWithBodyWithResponse request with arbitrary body returning *PostFileSearchResponse
  2117. func (c *ClientWithResponses) PostFileSearchWithBodyWithResponse(ctx context.Context, contentType string, body io.Reader, reqEditors ...RequestEditorFn) (*PostFileSearchResponse, error) {
  2118. rsp, err := c.PostFileSearchWithBody(ctx, contentType, body, reqEditors...)
  2119. if err != nil {
  2120. return nil, err
  2121. }
  2122. return ParsePostFileSearchResponse(rsp)
  2123. }
  2124. func (c *ClientWithResponses) PostFileSearchWithResponse(ctx context.Context, body PostFileSearchJSONRequestBody, reqEditors ...RequestEditorFn) (*PostFileSearchResponse, error) {
  2125. rsp, err := c.PostFileSearch(ctx, body, reqEditors...)
  2126. if err != nil {
  2127. return nil, err
  2128. }
  2129. return ParsePostFileSearchResponse(rsp)
  2130. }
  2131. // PostPathGetWithResponse request returning *PostPathGetResponse
  2132. func (c *ClientWithResponses) PostPathGetWithResponse(ctx context.Context, reqEditors ...RequestEditorFn) (*PostPathGetResponse, error) {
  2133. rsp, err := c.PostPathGet(ctx, reqEditors...)
  2134. if err != nil {
  2135. return nil, err
  2136. }
  2137. return ParsePostPathGetResponse(rsp)
  2138. }
  2139. // PostProviderListWithResponse request returning *PostProviderListResponse
  2140. func (c *ClientWithResponses) PostProviderListWithResponse(ctx context.Context, reqEditors ...RequestEditorFn) (*PostProviderListResponse, error) {
  2141. rsp, err := c.PostProviderList(ctx, reqEditors...)
  2142. if err != nil {
  2143. return nil, err
  2144. }
  2145. return ParsePostProviderListResponse(rsp)
  2146. }
  2147. // PostSessionAbortWithBodyWithResponse request with arbitrary body returning *PostSessionAbortResponse
  2148. func (c *ClientWithResponses) PostSessionAbortWithBodyWithResponse(ctx context.Context, contentType string, body io.Reader, reqEditors ...RequestEditorFn) (*PostSessionAbortResponse, error) {
  2149. rsp, err := c.PostSessionAbortWithBody(ctx, contentType, body, reqEditors...)
  2150. if err != nil {
  2151. return nil, err
  2152. }
  2153. return ParsePostSessionAbortResponse(rsp)
  2154. }
  2155. func (c *ClientWithResponses) PostSessionAbortWithResponse(ctx context.Context, body PostSessionAbortJSONRequestBody, reqEditors ...RequestEditorFn) (*PostSessionAbortResponse, error) {
  2156. rsp, err := c.PostSessionAbort(ctx, body, reqEditors...)
  2157. if err != nil {
  2158. return nil, err
  2159. }
  2160. return ParsePostSessionAbortResponse(rsp)
  2161. }
  2162. // PostSessionChatWithBodyWithResponse request with arbitrary body returning *PostSessionChatResponse
  2163. func (c *ClientWithResponses) PostSessionChatWithBodyWithResponse(ctx context.Context, contentType string, body io.Reader, reqEditors ...RequestEditorFn) (*PostSessionChatResponse, error) {
  2164. rsp, err := c.PostSessionChatWithBody(ctx, contentType, body, reqEditors...)
  2165. if err != nil {
  2166. return nil, err
  2167. }
  2168. return ParsePostSessionChatResponse(rsp)
  2169. }
  2170. func (c *ClientWithResponses) PostSessionChatWithResponse(ctx context.Context, body PostSessionChatJSONRequestBody, reqEditors ...RequestEditorFn) (*PostSessionChatResponse, error) {
  2171. rsp, err := c.PostSessionChat(ctx, body, reqEditors...)
  2172. if err != nil {
  2173. return nil, err
  2174. }
  2175. return ParsePostSessionChatResponse(rsp)
  2176. }
  2177. // PostSessionCreateWithResponse request returning *PostSessionCreateResponse
  2178. func (c *ClientWithResponses) PostSessionCreateWithResponse(ctx context.Context, reqEditors ...RequestEditorFn) (*PostSessionCreateResponse, error) {
  2179. rsp, err := c.PostSessionCreate(ctx, reqEditors...)
  2180. if err != nil {
  2181. return nil, err
  2182. }
  2183. return ParsePostSessionCreateResponse(rsp)
  2184. }
  2185. // PostSessionInitializeWithBodyWithResponse request with arbitrary body returning *PostSessionInitializeResponse
  2186. func (c *ClientWithResponses) PostSessionInitializeWithBodyWithResponse(ctx context.Context, contentType string, body io.Reader, reqEditors ...RequestEditorFn) (*PostSessionInitializeResponse, error) {
  2187. rsp, err := c.PostSessionInitializeWithBody(ctx, contentType, body, reqEditors...)
  2188. if err != nil {
  2189. return nil, err
  2190. }
  2191. return ParsePostSessionInitializeResponse(rsp)
  2192. }
  2193. func (c *ClientWithResponses) PostSessionInitializeWithResponse(ctx context.Context, body PostSessionInitializeJSONRequestBody, reqEditors ...RequestEditorFn) (*PostSessionInitializeResponse, error) {
  2194. rsp, err := c.PostSessionInitialize(ctx, body, reqEditors...)
  2195. if err != nil {
  2196. return nil, err
  2197. }
  2198. return ParsePostSessionInitializeResponse(rsp)
  2199. }
  2200. // PostSessionListWithResponse request returning *PostSessionListResponse
  2201. func (c *ClientWithResponses) PostSessionListWithResponse(ctx context.Context, reqEditors ...RequestEditorFn) (*PostSessionListResponse, error) {
  2202. rsp, err := c.PostSessionList(ctx, reqEditors...)
  2203. if err != nil {
  2204. return nil, err
  2205. }
  2206. return ParsePostSessionListResponse(rsp)
  2207. }
  2208. // PostSessionMessagesWithBodyWithResponse request with arbitrary body returning *PostSessionMessagesResponse
  2209. func (c *ClientWithResponses) PostSessionMessagesWithBodyWithResponse(ctx context.Context, contentType string, body io.Reader, reqEditors ...RequestEditorFn) (*PostSessionMessagesResponse, error) {
  2210. rsp, err := c.PostSessionMessagesWithBody(ctx, contentType, body, reqEditors...)
  2211. if err != nil {
  2212. return nil, err
  2213. }
  2214. return ParsePostSessionMessagesResponse(rsp)
  2215. }
  2216. func (c *ClientWithResponses) PostSessionMessagesWithResponse(ctx context.Context, body PostSessionMessagesJSONRequestBody, reqEditors ...RequestEditorFn) (*PostSessionMessagesResponse, error) {
  2217. rsp, err := c.PostSessionMessages(ctx, body, reqEditors...)
  2218. if err != nil {
  2219. return nil, err
  2220. }
  2221. return ParsePostSessionMessagesResponse(rsp)
  2222. }
  2223. // PostSessionShareWithBodyWithResponse request with arbitrary body returning *PostSessionShareResponse
  2224. func (c *ClientWithResponses) PostSessionShareWithBodyWithResponse(ctx context.Context, contentType string, body io.Reader, reqEditors ...RequestEditorFn) (*PostSessionShareResponse, error) {
  2225. rsp, err := c.PostSessionShareWithBody(ctx, contentType, body, reqEditors...)
  2226. if err != nil {
  2227. return nil, err
  2228. }
  2229. return ParsePostSessionShareResponse(rsp)
  2230. }
  2231. func (c *ClientWithResponses) PostSessionShareWithResponse(ctx context.Context, body PostSessionShareJSONRequestBody, reqEditors ...RequestEditorFn) (*PostSessionShareResponse, error) {
  2232. rsp, err := c.PostSessionShare(ctx, body, reqEditors...)
  2233. if err != nil {
  2234. return nil, err
  2235. }
  2236. return ParsePostSessionShareResponse(rsp)
  2237. }
  2238. // PostSessionSummarizeWithBodyWithResponse request with arbitrary body returning *PostSessionSummarizeResponse
  2239. func (c *ClientWithResponses) PostSessionSummarizeWithBodyWithResponse(ctx context.Context, contentType string, body io.Reader, reqEditors ...RequestEditorFn) (*PostSessionSummarizeResponse, error) {
  2240. rsp, err := c.PostSessionSummarizeWithBody(ctx, contentType, body, reqEditors...)
  2241. if err != nil {
  2242. return nil, err
  2243. }
  2244. return ParsePostSessionSummarizeResponse(rsp)
  2245. }
  2246. func (c *ClientWithResponses) PostSessionSummarizeWithResponse(ctx context.Context, body PostSessionSummarizeJSONRequestBody, reqEditors ...RequestEditorFn) (*PostSessionSummarizeResponse, error) {
  2247. rsp, err := c.PostSessionSummarize(ctx, body, reqEditors...)
  2248. if err != nil {
  2249. return nil, err
  2250. }
  2251. return ParsePostSessionSummarizeResponse(rsp)
  2252. }
  2253. // ParsePostAppInfoResponse parses an HTTP response from a PostAppInfoWithResponse call
  2254. func ParsePostAppInfoResponse(rsp *http.Response) (*PostAppInfoResponse, error) {
  2255. bodyBytes, err := io.ReadAll(rsp.Body)
  2256. defer func() { _ = rsp.Body.Close() }()
  2257. if err != nil {
  2258. return nil, err
  2259. }
  2260. response := &PostAppInfoResponse{
  2261. Body: bodyBytes,
  2262. HTTPResponse: rsp,
  2263. }
  2264. switch {
  2265. case strings.Contains(rsp.Header.Get("Content-Type"), "json") && rsp.StatusCode == 200:
  2266. var dest AppInfo
  2267. if err := json.Unmarshal(bodyBytes, &dest); err != nil {
  2268. return nil, err
  2269. }
  2270. response.JSON200 = &dest
  2271. }
  2272. return response, nil
  2273. }
  2274. // ParsePostAppInitializeResponse parses an HTTP response from a PostAppInitializeWithResponse call
  2275. func ParsePostAppInitializeResponse(rsp *http.Response) (*PostAppInitializeResponse, error) {
  2276. bodyBytes, err := io.ReadAll(rsp.Body)
  2277. defer func() { _ = rsp.Body.Close() }()
  2278. if err != nil {
  2279. return nil, err
  2280. }
  2281. response := &PostAppInitializeResponse{
  2282. Body: bodyBytes,
  2283. HTTPResponse: rsp,
  2284. }
  2285. switch {
  2286. case strings.Contains(rsp.Header.Get("Content-Type"), "json") && rsp.StatusCode == 200:
  2287. var dest bool
  2288. if err := json.Unmarshal(bodyBytes, &dest); err != nil {
  2289. return nil, err
  2290. }
  2291. response.JSON200 = &dest
  2292. }
  2293. return response, nil
  2294. }
  2295. // ParseGetEventResponse parses an HTTP response from a GetEventWithResponse call
  2296. func ParseGetEventResponse(rsp *http.Response) (*GetEventResponse, error) {
  2297. bodyBytes, err := io.ReadAll(rsp.Body)
  2298. defer func() { _ = rsp.Body.Close() }()
  2299. if err != nil {
  2300. return nil, err
  2301. }
  2302. response := &GetEventResponse{
  2303. Body: bodyBytes,
  2304. HTTPResponse: rsp,
  2305. }
  2306. switch {
  2307. case strings.Contains(rsp.Header.Get("Content-Type"), "json") && rsp.StatusCode == 200:
  2308. var dest Event
  2309. if err := json.Unmarshal(bodyBytes, &dest); err != nil {
  2310. return nil, err
  2311. }
  2312. response.JSON200 = &dest
  2313. }
  2314. return response, nil
  2315. }
  2316. // ParsePostFileSearchResponse parses an HTTP response from a PostFileSearchWithResponse call
  2317. func ParsePostFileSearchResponse(rsp *http.Response) (*PostFileSearchResponse, error) {
  2318. bodyBytes, err := io.ReadAll(rsp.Body)
  2319. defer func() { _ = rsp.Body.Close() }()
  2320. if err != nil {
  2321. return nil, err
  2322. }
  2323. response := &PostFileSearchResponse{
  2324. Body: bodyBytes,
  2325. HTTPResponse: rsp,
  2326. }
  2327. switch {
  2328. case strings.Contains(rsp.Header.Get("Content-Type"), "json") && rsp.StatusCode == 200:
  2329. var dest []string
  2330. if err := json.Unmarshal(bodyBytes, &dest); err != nil {
  2331. return nil, err
  2332. }
  2333. response.JSON200 = &dest
  2334. }
  2335. return response, nil
  2336. }
  2337. // ParsePostPathGetResponse parses an HTTP response from a PostPathGetWithResponse call
  2338. func ParsePostPathGetResponse(rsp *http.Response) (*PostPathGetResponse, error) {
  2339. bodyBytes, err := io.ReadAll(rsp.Body)
  2340. defer func() { _ = rsp.Body.Close() }()
  2341. if err != nil {
  2342. return nil, err
  2343. }
  2344. response := &PostPathGetResponse{
  2345. Body: bodyBytes,
  2346. HTTPResponse: rsp,
  2347. }
  2348. switch {
  2349. case strings.Contains(rsp.Header.Get("Content-Type"), "json") && rsp.StatusCode == 200:
  2350. var dest struct {
  2351. Config string `json:"config"`
  2352. Cwd string `json:"cwd"`
  2353. Data string `json:"data"`
  2354. Root string `json:"root"`
  2355. }
  2356. if err := json.Unmarshal(bodyBytes, &dest); err != nil {
  2357. return nil, err
  2358. }
  2359. response.JSON200 = &dest
  2360. }
  2361. return response, nil
  2362. }
  2363. // ParsePostProviderListResponse parses an HTTP response from a PostProviderListWithResponse call
  2364. func ParsePostProviderListResponse(rsp *http.Response) (*PostProviderListResponse, error) {
  2365. bodyBytes, err := io.ReadAll(rsp.Body)
  2366. defer func() { _ = rsp.Body.Close() }()
  2367. if err != nil {
  2368. return nil, err
  2369. }
  2370. response := &PostProviderListResponse{
  2371. Body: bodyBytes,
  2372. HTTPResponse: rsp,
  2373. }
  2374. switch {
  2375. case strings.Contains(rsp.Header.Get("Content-Type"), "json") && rsp.StatusCode == 200:
  2376. var dest struct {
  2377. Default map[string]string `json:"default"`
  2378. Providers []ProviderInfo `json:"providers"`
  2379. }
  2380. if err := json.Unmarshal(bodyBytes, &dest); err != nil {
  2381. return nil, err
  2382. }
  2383. response.JSON200 = &dest
  2384. }
  2385. return response, nil
  2386. }
  2387. // ParsePostSessionAbortResponse parses an HTTP response from a PostSessionAbortWithResponse call
  2388. func ParsePostSessionAbortResponse(rsp *http.Response) (*PostSessionAbortResponse, error) {
  2389. bodyBytes, err := io.ReadAll(rsp.Body)
  2390. defer func() { _ = rsp.Body.Close() }()
  2391. if err != nil {
  2392. return nil, err
  2393. }
  2394. response := &PostSessionAbortResponse{
  2395. Body: bodyBytes,
  2396. HTTPResponse: rsp,
  2397. }
  2398. switch {
  2399. case strings.Contains(rsp.Header.Get("Content-Type"), "json") && rsp.StatusCode == 200:
  2400. var dest bool
  2401. if err := json.Unmarshal(bodyBytes, &dest); err != nil {
  2402. return nil, err
  2403. }
  2404. response.JSON200 = &dest
  2405. }
  2406. return response, nil
  2407. }
  2408. // ParsePostSessionChatResponse parses an HTTP response from a PostSessionChatWithResponse call
  2409. func ParsePostSessionChatResponse(rsp *http.Response) (*PostSessionChatResponse, error) {
  2410. bodyBytes, err := io.ReadAll(rsp.Body)
  2411. defer func() { _ = rsp.Body.Close() }()
  2412. if err != nil {
  2413. return nil, err
  2414. }
  2415. response := &PostSessionChatResponse{
  2416. Body: bodyBytes,
  2417. HTTPResponse: rsp,
  2418. }
  2419. switch {
  2420. case strings.Contains(rsp.Header.Get("Content-Type"), "json") && rsp.StatusCode == 200:
  2421. var dest MessageInfo
  2422. if err := json.Unmarshal(bodyBytes, &dest); err != nil {
  2423. return nil, err
  2424. }
  2425. response.JSON200 = &dest
  2426. }
  2427. return response, nil
  2428. }
  2429. // ParsePostSessionCreateResponse parses an HTTP response from a PostSessionCreateWithResponse call
  2430. func ParsePostSessionCreateResponse(rsp *http.Response) (*PostSessionCreateResponse, error) {
  2431. bodyBytes, err := io.ReadAll(rsp.Body)
  2432. defer func() { _ = rsp.Body.Close() }()
  2433. if err != nil {
  2434. return nil, err
  2435. }
  2436. response := &PostSessionCreateResponse{
  2437. Body: bodyBytes,
  2438. HTTPResponse: rsp,
  2439. }
  2440. switch {
  2441. case strings.Contains(rsp.Header.Get("Content-Type"), "json") && rsp.StatusCode == 200:
  2442. var dest SessionInfo
  2443. if err := json.Unmarshal(bodyBytes, &dest); err != nil {
  2444. return nil, err
  2445. }
  2446. response.JSON200 = &dest
  2447. case strings.Contains(rsp.Header.Get("Content-Type"), "json") && rsp.StatusCode == 400:
  2448. var dest Error
  2449. if err := json.Unmarshal(bodyBytes, &dest); err != nil {
  2450. return nil, err
  2451. }
  2452. response.JSON400 = &dest
  2453. }
  2454. return response, nil
  2455. }
  2456. // ParsePostSessionInitializeResponse parses an HTTP response from a PostSessionInitializeWithResponse call
  2457. func ParsePostSessionInitializeResponse(rsp *http.Response) (*PostSessionInitializeResponse, error) {
  2458. bodyBytes, err := io.ReadAll(rsp.Body)
  2459. defer func() { _ = rsp.Body.Close() }()
  2460. if err != nil {
  2461. return nil, err
  2462. }
  2463. response := &PostSessionInitializeResponse{
  2464. Body: bodyBytes,
  2465. HTTPResponse: rsp,
  2466. }
  2467. switch {
  2468. case strings.Contains(rsp.Header.Get("Content-Type"), "json") && rsp.StatusCode == 200:
  2469. var dest bool
  2470. if err := json.Unmarshal(bodyBytes, &dest); err != nil {
  2471. return nil, err
  2472. }
  2473. response.JSON200 = &dest
  2474. }
  2475. return response, nil
  2476. }
  2477. // ParsePostSessionListResponse parses an HTTP response from a PostSessionListWithResponse call
  2478. func ParsePostSessionListResponse(rsp *http.Response) (*PostSessionListResponse, error) {
  2479. bodyBytes, err := io.ReadAll(rsp.Body)
  2480. defer func() { _ = rsp.Body.Close() }()
  2481. if err != nil {
  2482. return nil, err
  2483. }
  2484. response := &PostSessionListResponse{
  2485. Body: bodyBytes,
  2486. HTTPResponse: rsp,
  2487. }
  2488. switch {
  2489. case strings.Contains(rsp.Header.Get("Content-Type"), "json") && rsp.StatusCode == 200:
  2490. var dest []SessionInfo
  2491. if err := json.Unmarshal(bodyBytes, &dest); err != nil {
  2492. return nil, err
  2493. }
  2494. response.JSON200 = &dest
  2495. }
  2496. return response, nil
  2497. }
  2498. // ParsePostSessionMessagesResponse parses an HTTP response from a PostSessionMessagesWithResponse call
  2499. func ParsePostSessionMessagesResponse(rsp *http.Response) (*PostSessionMessagesResponse, error) {
  2500. bodyBytes, err := io.ReadAll(rsp.Body)
  2501. defer func() { _ = rsp.Body.Close() }()
  2502. if err != nil {
  2503. return nil, err
  2504. }
  2505. response := &PostSessionMessagesResponse{
  2506. Body: bodyBytes,
  2507. HTTPResponse: rsp,
  2508. }
  2509. switch {
  2510. case strings.Contains(rsp.Header.Get("Content-Type"), "json") && rsp.StatusCode == 200:
  2511. var dest []MessageInfo
  2512. if err := json.Unmarshal(bodyBytes, &dest); err != nil {
  2513. return nil, err
  2514. }
  2515. response.JSON200 = &dest
  2516. }
  2517. return response, nil
  2518. }
  2519. // ParsePostSessionShareResponse parses an HTTP response from a PostSessionShareWithResponse call
  2520. func ParsePostSessionShareResponse(rsp *http.Response) (*PostSessionShareResponse, error) {
  2521. bodyBytes, err := io.ReadAll(rsp.Body)
  2522. defer func() { _ = rsp.Body.Close() }()
  2523. if err != nil {
  2524. return nil, err
  2525. }
  2526. response := &PostSessionShareResponse{
  2527. Body: bodyBytes,
  2528. HTTPResponse: rsp,
  2529. }
  2530. switch {
  2531. case strings.Contains(rsp.Header.Get("Content-Type"), "json") && rsp.StatusCode == 200:
  2532. var dest SessionInfo
  2533. if err := json.Unmarshal(bodyBytes, &dest); err != nil {
  2534. return nil, err
  2535. }
  2536. response.JSON200 = &dest
  2537. }
  2538. return response, nil
  2539. }
  2540. // ParsePostSessionSummarizeResponse parses an HTTP response from a PostSessionSummarizeWithResponse call
  2541. func ParsePostSessionSummarizeResponse(rsp *http.Response) (*PostSessionSummarizeResponse, error) {
  2542. bodyBytes, err := io.ReadAll(rsp.Body)
  2543. defer func() { _ = rsp.Body.Close() }()
  2544. if err != nil {
  2545. return nil, err
  2546. }
  2547. response := &PostSessionSummarizeResponse{
  2548. Body: bodyBytes,
  2549. HTTPResponse: rsp,
  2550. }
  2551. switch {
  2552. case strings.Contains(rsp.Header.Get("Content-Type"), "json") && rsp.StatusCode == 200:
  2553. var dest bool
  2554. if err := json.Unmarshal(bodyBytes, &dest); err != nil {
  2555. return nil, err
  2556. }
  2557. response.JSON200 = &dest
  2558. }
  2559. return response, nil
  2560. }