generated-client.go 74 KB

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