generated-client.go 75 KB

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