generated-client.go 95 KB

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