generated-client.go 75 KB

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