generated-client.go 74 KB

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