opencode_client 1.0.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (769) hide show
  1. checksums.yaml +7 -0
  2. data/Gemfile +9 -0
  3. data/Gemfile.lock +102 -0
  4. data/README.md +423 -0
  5. data/Rakefile +10 -0
  6. data/docs/APIError.md +20 -0
  7. data/docs/APIErrorData.md +28 -0
  8. data/docs/Agent.md +46 -0
  9. data/docs/AgentConfig.md +38 -0
  10. data/docs/AgentConfigPermission.md +28 -0
  11. data/docs/AgentConfigPermissionBash.md +15 -0
  12. data/docs/AgentPart.md +28 -0
  13. data/docs/AgentPartInput.md +24 -0
  14. data/docs/AgentPartSource.md +22 -0
  15. data/docs/AgentPermission.md +28 -0
  16. data/docs/ApiAuth.md +20 -0
  17. data/docs/AppLogRequest.md +24 -0
  18. data/docs/AssistantMessage.md +46 -0
  19. data/docs/AssistantMessageError.md +20 -0
  20. data/docs/AssistantMessagePath.md +20 -0
  21. data/docs/AssistantMessageTime.md +20 -0
  22. data/docs/AssistantMessageTokens.md +24 -0
  23. data/docs/AssistantMessageTokensCache.md +20 -0
  24. data/docs/Auth.md +30 -0
  25. data/docs/BadRequestError.md +22 -0
  26. data/docs/Command.md +28 -0
  27. data/docs/CompactionPart.md +26 -0
  28. data/docs/Config.md +82 -0
  29. data/docs/ConfigAgent.md +30 -0
  30. data/docs/ConfigAutoupdate.md +15 -0
  31. data/docs/ConfigCommandValue.md +26 -0
  32. data/docs/ConfigCompaction.md +20 -0
  33. data/docs/ConfigEnterprise.md +18 -0
  34. data/docs/ConfigExperimental.md +30 -0
  35. data/docs/ConfigExperimentalHook.md +20 -0
  36. data/docs/ConfigExperimentalHookFileEditedValueInner.md +20 -0
  37. data/docs/ConfigFormatter.md +15 -0
  38. data/docs/ConfigFormatterAnyOfValue.md +24 -0
  39. data/docs/ConfigLsp.md +15 -0
  40. data/docs/ConfigLspAnyOfValue.md +26 -0
  41. data/docs/ConfigLspAnyOfValueAnyOf.md +18 -0
  42. data/docs/ConfigLspAnyOfValueAnyOf1.md +26 -0
  43. data/docs/ConfigMode.md +20 -0
  44. data/docs/ConfigProviders200Response.md +20 -0
  45. data/docs/ConfigTui.md +22 -0
  46. data/docs/ConfigTuiScrollAcceleration.md +18 -0
  47. data/docs/ConfigWatcher.md +18 -0
  48. data/docs/DefaultApi.md +5641 -0
  49. data/docs/Event.md +20 -0
  50. data/docs/EventCommandExecuted.md +20 -0
  51. data/docs/EventCommandExecutedProperties.md +24 -0
  52. data/docs/EventFileEdited.md +20 -0
  53. data/docs/EventFileEditedProperties.md +18 -0
  54. data/docs/EventFileWatcherUpdated.md +20 -0
  55. data/docs/EventFileWatcherUpdatedProperties.md +20 -0
  56. data/docs/EventGlobalDisposed.md +20 -0
  57. data/docs/EventInstallationUpdateAvailable.md +20 -0
  58. data/docs/EventInstallationUpdated.md +20 -0
  59. data/docs/EventInstallationUpdatedProperties.md +18 -0
  60. data/docs/EventLspClientDiagnostics.md +20 -0
  61. data/docs/EventLspClientDiagnosticsProperties.md +20 -0
  62. data/docs/EventLspUpdated.md +20 -0
  63. data/docs/EventMcpToolsChanged.md +20 -0
  64. data/docs/EventMcpToolsChangedProperties.md +18 -0
  65. data/docs/EventMessagePartRemoved.md +20 -0
  66. data/docs/EventMessagePartRemovedProperties.md +22 -0
  67. data/docs/EventMessagePartUpdated.md +20 -0
  68. data/docs/EventMessagePartUpdatedProperties.md +20 -0
  69. data/docs/EventMessageRemoved.md +20 -0
  70. data/docs/EventMessageRemovedProperties.md +20 -0
  71. data/docs/EventMessageUpdated.md +20 -0
  72. data/docs/EventMessageUpdatedProperties.md +18 -0
  73. data/docs/EventPermissionReplied.md +20 -0
  74. data/docs/EventPermissionRepliedProperties.md +22 -0
  75. data/docs/EventPermissionUpdated.md +20 -0
  76. data/docs/EventProjectUpdated.md +20 -0
  77. data/docs/EventPtyCreated.md +20 -0
  78. data/docs/EventPtyCreatedProperties.md +18 -0
  79. data/docs/EventPtyDeleted.md +20 -0
  80. data/docs/EventPtyDeletedProperties.md +18 -0
  81. data/docs/EventPtyExited.md +20 -0
  82. data/docs/EventPtyExitedProperties.md +20 -0
  83. data/docs/EventPtyUpdated.md +20 -0
  84. data/docs/EventServerConnected.md +20 -0
  85. data/docs/EventServerInstanceDisposed.md +20 -0
  86. data/docs/EventServerInstanceDisposedProperties.md +18 -0
  87. data/docs/EventSessionCompacted.md +20 -0
  88. data/docs/EventSessionCreated.md +20 -0
  89. data/docs/EventSessionCreatedProperties.md +18 -0
  90. data/docs/EventSessionDeleted.md +20 -0
  91. data/docs/EventSessionDiff.md +20 -0
  92. data/docs/EventSessionDiffProperties.md +20 -0
  93. data/docs/EventSessionError.md +20 -0
  94. data/docs/EventSessionErrorProperties.md +20 -0
  95. data/docs/EventSessionIdle.md +20 -0
  96. data/docs/EventSessionIdleProperties.md +18 -0
  97. data/docs/EventSessionStatus.md +20 -0
  98. data/docs/EventSessionStatusProperties.md +20 -0
  99. data/docs/EventSessionUpdated.md +20 -0
  100. data/docs/EventTodoUpdated.md +20 -0
  101. data/docs/EventTodoUpdatedProperties.md +20 -0
  102. data/docs/EventTuiCommandExecute.md +20 -0
  103. data/docs/EventTuiCommandExecuteProperties.md +18 -0
  104. data/docs/EventTuiCommandExecutePropertiesCommand.md +15 -0
  105. data/docs/EventTuiPromptAppend.md +20 -0
  106. data/docs/EventTuiToastShow.md +20 -0
  107. data/docs/EventVcsBranchUpdated.md +20 -0
  108. data/docs/EventVcsBranchUpdatedProperties.md +18 -0
  109. data/docs/File.md +24 -0
  110. data/docs/FileContent.md +28 -0
  111. data/docs/FileContentPatch.md +28 -0
  112. data/docs/FileContentPatchHunksInner.md +26 -0
  113. data/docs/FileDiff.md +26 -0
  114. data/docs/FileNode.md +26 -0
  115. data/docs/FilePart.md +32 -0
  116. data/docs/FilePartInput.md +28 -0
  117. data/docs/FilePartSource.md +28 -0
  118. data/docs/FilePartSourceText.md +22 -0
  119. data/docs/FileSource.md +22 -0
  120. data/docs/FindText200ResponseInner.md +26 -0
  121. data/docs/FindText200ResponseInnerPath.md +18 -0
  122. data/docs/FindText200ResponseInnerSubmatchesInner.md +22 -0
  123. data/docs/FormatterStatus.md +22 -0
  124. data/docs/GlobalEvent.md +20 -0
  125. data/docs/GlobalHealth200Response.md +20 -0
  126. data/docs/KeybindsConfig.md +188 -0
  127. data/docs/LSPStatus.md +24 -0
  128. data/docs/LayoutConfig.md +15 -0
  129. data/docs/LogLevel.md +15 -0
  130. data/docs/MCPStatus.md +20 -0
  131. data/docs/MCPStatusConnected.md +18 -0
  132. data/docs/MCPStatusDisabled.md +18 -0
  133. data/docs/MCPStatusFailed.md +20 -0
  134. data/docs/MCPStatusNeedsAuth.md +18 -0
  135. data/docs/MCPStatusNeedsClientRegistration.md +20 -0
  136. data/docs/McpAddRequest.md +20 -0
  137. data/docs/McpAddRequestConfig.md +32 -0
  138. data/docs/McpAuthCallbackRequest.md +18 -0
  139. data/docs/McpAuthRemove200Response.md +18 -0
  140. data/docs/McpAuthStart200Response.md +18 -0
  141. data/docs/McpLocalConfig.md +26 -0
  142. data/docs/McpOAuthConfig.md +22 -0
  143. data/docs/McpRemoteConfig.md +28 -0
  144. data/docs/McpRemoteConfigOauth.md +22 -0
  145. data/docs/Message.md +52 -0
  146. data/docs/MessageAbortedError.md +20 -0
  147. data/docs/MessageOutputLengthError.md +20 -0
  148. data/docs/Model.md +40 -0
  149. data/docs/ModelApi.md +22 -0
  150. data/docs/ModelCapabilities.md +30 -0
  151. data/docs/ModelCapabilitiesInput.md +26 -0
  152. data/docs/ModelCapabilitiesInterleaved.md +18 -0
  153. data/docs/ModelCapabilitiesInterleavedAnyOf.md +18 -0
  154. data/docs/ModelCost.md +24 -0
  155. data/docs/ModelCostExperimentalOver200K.md +22 -0
  156. data/docs/NotFoundError.md +20 -0
  157. data/docs/OAuth.md +26 -0
  158. data/docs/Part.md +76 -0
  159. data/docs/PartAnyOf.md +32 -0
  160. data/docs/PatchPart.md +28 -0
  161. data/docs/Path.md +26 -0
  162. data/docs/Permission.md +34 -0
  163. data/docs/PermissionPattern.md +15 -0
  164. data/docs/PermissionRespondRequest.md +18 -0
  165. data/docs/Project.md +28 -0
  166. data/docs/ProjectTime.md +22 -0
  167. data/docs/ProjectUpdateRequest.md +20 -0
  168. data/docs/ProjectUpdateRequestIcon.md +20 -0
  169. data/docs/Provider.md +30 -0
  170. data/docs/ProviderAuthAuthorization.md +22 -0
  171. data/docs/ProviderAuthError.md +20 -0
  172. data/docs/ProviderAuthErrorData.md +20 -0
  173. data/docs/ProviderAuthMethod.md +20 -0
  174. data/docs/ProviderConfig.md +34 -0
  175. data/docs/ProviderConfigModelsValue.md +50 -0
  176. data/docs/ProviderConfigModelsValueInterleaved.md +18 -0
  177. data/docs/ProviderConfigModelsValueInterleavedAnyOf.md +18 -0
  178. data/docs/ProviderConfigOptions.md +26 -0
  179. data/docs/ProviderConfigOptionsTimeout.md +15 -0
  180. data/docs/ProviderList200Response.md +22 -0
  181. data/docs/ProviderList200ResponseAllInner.md +28 -0
  182. data/docs/ProviderList200ResponseAllInnerModelsValue.md +50 -0
  183. data/docs/ProviderList200ResponseAllInnerModelsValueCost.md +26 -0
  184. data/docs/ProviderList200ResponseAllInnerModelsValueCostContextOver200k.md +24 -0
  185. data/docs/ProviderList200ResponseAllInnerModelsValueInterleaved.md +18 -0
  186. data/docs/ProviderList200ResponseAllInnerModelsValueInterleavedAnyOf.md +18 -0
  187. data/docs/ProviderList200ResponseAllInnerModelsValueLimit.md +20 -0
  188. data/docs/ProviderList200ResponseAllInnerModelsValueModalities.md +20 -0
  189. data/docs/ProviderList200ResponseAllInnerModelsValueProvider.md +18 -0
  190. data/docs/ProviderOauthAuthorizeRequest.md +18 -0
  191. data/docs/ProviderOauthCallbackRequest.md +20 -0
  192. data/docs/Pty.md +30 -0
  193. data/docs/PtyCreateRequest.md +26 -0
  194. data/docs/PtyUpdateRequest.md +20 -0
  195. data/docs/PtyUpdateRequestSize.md +20 -0
  196. data/docs/Range.md +20 -0
  197. data/docs/RangeStart.md +20 -0
  198. data/docs/ReasoningPart.md +30 -0
  199. data/docs/RetryPart.md +30 -0
  200. data/docs/ServerConfig.md +22 -0
  201. data/docs/Session.md +36 -0
  202. data/docs/SessionApi.md +145 -0
  203. data/docs/SessionCommandRequest.md +26 -0
  204. data/docs/SessionCreateRequest.md +20 -0
  205. data/docs/SessionForkRequest.md +18 -0
  206. data/docs/SessionInitRequest.md +22 -0
  207. data/docs/SessionMessages200ResponseInner.md +20 -0
  208. data/docs/SessionPrompt200Response.md +20 -0
  209. data/docs/SessionPromptRequest.md +30 -0
  210. data/docs/SessionPromptRequestModel.md +20 -0
  211. data/docs/SessionPromptRequestPartsInner.md +48 -0
  212. data/docs/SessionRevert.md +24 -0
  213. data/docs/SessionRevertRequest.md +20 -0
  214. data/docs/SessionShare.md +18 -0
  215. data/docs/SessionShellRequest.md +22 -0
  216. data/docs/SessionStatus.md +24 -0
  217. data/docs/SessionStatusAnyOf.md +18 -0
  218. data/docs/SessionStatusAnyOf1.md +24 -0
  219. data/docs/SessionStatusAnyOf2.md +18 -0
  220. data/docs/SessionSummarizeRequest.md +22 -0
  221. data/docs/SessionSummary.md +24 -0
  222. data/docs/SessionTime.md +24 -0
  223. data/docs/SessionUpdateRequest.md +20 -0
  224. data/docs/SessionUpdateRequestTime.md +18 -0
  225. data/docs/SnapshotPart.md +26 -0
  226. data/docs/StepFinishPart.md +32 -0
  227. data/docs/StepStartPart.md +26 -0
  228. data/docs/SubtaskPartInput.md +28 -0
  229. data/docs/Symbol.md +22 -0
  230. data/docs/SymbolLocation.md +20 -0
  231. data/docs/SymbolSource.md +28 -0
  232. data/docs/TextPart.md +34 -0
  233. data/docs/TextPartInput.md +30 -0
  234. data/docs/TextPartTime.md +20 -0
  235. data/docs/Todo.md +24 -0
  236. data/docs/ToolListItem.md +22 -0
  237. data/docs/ToolPart.md +32 -0
  238. data/docs/ToolState.md +34 -0
  239. data/docs/ToolStateCompleted.md +30 -0
  240. data/docs/ToolStateCompletedTime.md +22 -0
  241. data/docs/ToolStateError.md +26 -0
  242. data/docs/ToolStateErrorTime.md +20 -0
  243. data/docs/ToolStatePending.md +22 -0
  244. data/docs/ToolStateRunning.md +26 -0
  245. data/docs/ToolStateRunningTime.md +18 -0
  246. data/docs/TuiControlNext200Response.md +20 -0
  247. data/docs/TuiExecuteCommandRequest.md +18 -0
  248. data/docs/TuiPublishRequest.md +20 -0
  249. data/docs/TuiShowToastRequest.md +24 -0
  250. data/docs/UnknownError.md +20 -0
  251. data/docs/UnknownErrorData.md +18 -0
  252. data/docs/UserMessage.md +34 -0
  253. data/docs/UserMessageSummary.md +22 -0
  254. data/docs/UserMessageTime.md +18 -0
  255. data/docs/VcsInfo.md +18 -0
  256. data/docs/WellKnownAuth.md +22 -0
  257. data/git_push.sh +57 -0
  258. data/lib/opencode_client/api/default_api.rb +5442 -0
  259. data/lib/opencode_client/api/session_api.rb +164 -0
  260. data/lib/opencode_client/api_client.rb +374 -0
  261. data/lib/opencode_client/api_error.rb +58 -0
  262. data/lib/opencode_client/api_model_base.rb +88 -0
  263. data/lib/opencode_client/configuration.rb +288 -0
  264. data/lib/opencode_client/models/agent.rb +405 -0
  265. data/lib/opencode_client/models/agent_config.rb +316 -0
  266. data/lib/opencode_client/models/agent_config_permission.rb +262 -0
  267. data/lib/opencode_client/models/agent_config_permission_bash.rb +103 -0
  268. data/lib/opencode_client/models/agent_part.rb +301 -0
  269. data/lib/opencode_client/models/agent_part_input.rb +232 -0
  270. data/lib/opencode_client/models/agent_part_source.rb +252 -0
  271. data/lib/opencode_client/models/agent_permission.rb +287 -0
  272. data/lib/opencode_client/models/api_auth.rb +214 -0
  273. data/lib/opencode_client/models/api_error.rb +214 -0
  274. data/lib/opencode_client/models/api_error_data.rb +230 -0
  275. data/lib/opencode_client/models/app_log_request.rb +255 -0
  276. data/lib/opencode_client/models/assistant_message.rb +501 -0
  277. data/lib/opencode_client/models/assistant_message_error.rb +106 -0
  278. data/lib/opencode_client/models/assistant_message_path.rb +190 -0
  279. data/lib/opencode_client/models/assistant_message_time.rb +173 -0
  280. data/lib/opencode_client/models/assistant_message_tokens.rb +242 -0
  281. data/lib/opencode_client/models/assistant_message_tokens_cache.rb +190 -0
  282. data/lib/opencode_client/models/auth.rb +104 -0
  283. data/lib/opencode_client/models/bad_request_error.rb +228 -0
  284. data/lib/opencode_client/models/command.rb +226 -0
  285. data/lib/opencode_client/models/compaction_part.rb +292 -0
  286. data/lib/opencode_client/models/config.rb +500 -0
  287. data/lib/opencode_client/models/config_agent.rb +202 -0
  288. data/lib/opencode_client/models/config_autoupdate.rb +104 -0
  289. data/lib/opencode_client/models/config_command_value.rb +200 -0
  290. data/lib/opencode_client/models/config_compaction.rb +158 -0
  291. data/lib/opencode_client/models/config_enterprise.rb +148 -0
  292. data/lib/opencode_client/models/config_experimental.rb +208 -0
  293. data/lib/opencode_client/models/config_experimental_hook.rb +160 -0
  294. data/lib/opencode_client/models/config_experimental_hook_file_edited_value_inner.rb +177 -0
  295. data/lib/opencode_client/models/config_formatter.rb +103 -0
  296. data/lib/opencode_client/models/config_formatter_any_of_value.rb +180 -0
  297. data/lib/opencode_client/models/config_lsp.rb +103 -0
  298. data/lib/opencode_client/models/config_lsp_any_of_value.rb +103 -0
  299. data/lib/opencode_client/models/config_lsp_any_of_value_any_of.rb +188 -0
  300. data/lib/opencode_client/models/config_lsp_any_of_value_any_of1.rb +208 -0
  301. data/lib/opencode_client/models/config_mode.rb +157 -0
  302. data/lib/opencode_client/models/config_providers200_response.rb +194 -0
  303. data/lib/opencode_client/models/config_tui.rb +221 -0
  304. data/lib/opencode_client/models/config_tui_scroll_acceleration.rb +166 -0
  305. data/lib/opencode_client/models/config_watcher.rb +149 -0
  306. data/lib/opencode_client/models/event.rb +136 -0
  307. data/lib/opencode_client/models/event_command_executed.rb +214 -0
  308. data/lib/opencode_client/models/event_command_executed_properties.rb +264 -0
  309. data/lib/opencode_client/models/event_file_edited.rb +214 -0
  310. data/lib/opencode_client/models/event_file_edited_properties.rb +164 -0
  311. data/lib/opencode_client/models/event_file_watcher_updated.rb +214 -0
  312. data/lib/opencode_client/models/event_file_watcher_updated_properties.rb +214 -0
  313. data/lib/opencode_client/models/event_global_disposed.rb +214 -0
  314. data/lib/opencode_client/models/event_installation_update_available.rb +214 -0
  315. data/lib/opencode_client/models/event_installation_updated.rb +214 -0
  316. data/lib/opencode_client/models/event_installation_updated_properties.rb +164 -0
  317. data/lib/opencode_client/models/event_lsp_client_diagnostics.rb +214 -0
  318. data/lib/opencode_client/models/event_lsp_client_diagnostics_properties.rb +190 -0
  319. data/lib/opencode_client/models/event_lsp_updated.rb +214 -0
  320. data/lib/opencode_client/models/event_mcp_tools_changed.rb +214 -0
  321. data/lib/opencode_client/models/event_mcp_tools_changed_properties.rb +164 -0
  322. data/lib/opencode_client/models/event_message_part_removed.rb +214 -0
  323. data/lib/opencode_client/models/event_message_part_removed_properties.rb +216 -0
  324. data/lib/opencode_client/models/event_message_part_updated.rb +214 -0
  325. data/lib/opencode_client/models/event_message_part_updated_properties.rb +173 -0
  326. data/lib/opencode_client/models/event_message_removed.rb +214 -0
  327. data/lib/opencode_client/models/event_message_removed_properties.rb +190 -0
  328. data/lib/opencode_client/models/event_message_updated.rb +214 -0
  329. data/lib/opencode_client/models/event_message_updated_properties.rb +164 -0
  330. data/lib/opencode_client/models/event_permission_replied.rb +214 -0
  331. data/lib/opencode_client/models/event_permission_replied_properties.rb +216 -0
  332. data/lib/opencode_client/models/event_permission_updated.rb +214 -0
  333. data/lib/opencode_client/models/event_project_updated.rb +214 -0
  334. data/lib/opencode_client/models/event_pty_created.rb +214 -0
  335. data/lib/opencode_client/models/event_pty_created_properties.rb +164 -0
  336. data/lib/opencode_client/models/event_pty_deleted.rb +214 -0
  337. data/lib/opencode_client/models/event_pty_deleted_properties.rb +175 -0
  338. data/lib/opencode_client/models/event_pty_exited.rb +214 -0
  339. data/lib/opencode_client/models/event_pty_exited_properties.rb +201 -0
  340. data/lib/opencode_client/models/event_pty_updated.rb +214 -0
  341. data/lib/opencode_client/models/event_server_connected.rb +214 -0
  342. data/lib/opencode_client/models/event_server_instance_disposed.rb +214 -0
  343. data/lib/opencode_client/models/event_server_instance_disposed_properties.rb +164 -0
  344. data/lib/opencode_client/models/event_session_compacted.rb +214 -0
  345. data/lib/opencode_client/models/event_session_created.rb +214 -0
  346. data/lib/opencode_client/models/event_session_created_properties.rb +164 -0
  347. data/lib/opencode_client/models/event_session_deleted.rb +214 -0
  348. data/lib/opencode_client/models/event_session_diff.rb +214 -0
  349. data/lib/opencode_client/models/event_session_diff_properties.rb +192 -0
  350. data/lib/opencode_client/models/event_session_error.rb +214 -0
  351. data/lib/opencode_client/models/event_session_error_properties.rb +156 -0
  352. data/lib/opencode_client/models/event_session_idle.rb +214 -0
  353. data/lib/opencode_client/models/event_session_idle_properties.rb +164 -0
  354. data/lib/opencode_client/models/event_session_status.rb +214 -0
  355. data/lib/opencode_client/models/event_session_status_properties.rb +190 -0
  356. data/lib/opencode_client/models/event_session_updated.rb +214 -0
  357. data/lib/opencode_client/models/event_todo_updated.rb +214 -0
  358. data/lib/opencode_client/models/event_todo_updated_properties.rb +192 -0
  359. data/lib/opencode_client/models/event_tui_command_execute.rb +214 -0
  360. data/lib/opencode_client/models/event_tui_command_execute_properties.rb +164 -0
  361. data/lib/opencode_client/models/event_tui_command_execute_properties_command.rb +102 -0
  362. data/lib/opencode_client/models/event_tui_prompt_append.rb +214 -0
  363. data/lib/opencode_client/models/event_tui_toast_show.rb +214 -0
  364. data/lib/opencode_client/models/event_vcs_branch_updated.rb +214 -0
  365. data/lib/opencode_client/models/event_vcs_branch_updated_properties.rb +147 -0
  366. data/lib/opencode_client/models/file.rb +302 -0
  367. data/lib/opencode_client/models/file_content.rb +262 -0
  368. data/lib/opencode_client/models/file_content_patch.rb +245 -0
  369. data/lib/opencode_client/models/file_content_patch_hunks_inner.rb +270 -0
  370. data/lib/opencode_client/models/file_diff.rb +268 -0
  371. data/lib/opencode_client/models/file_node.rb +292 -0
  372. data/lib/opencode_client/models/file_part.rb +336 -0
  373. data/lib/opencode_client/models/file_part_input.rb +267 -0
  374. data/lib/opencode_client/models/file_part_source.rb +103 -0
  375. data/lib/opencode_client/models/file_part_source_text.rb +252 -0
  376. data/lib/opencode_client/models/file_source.rb +240 -0
  377. data/lib/opencode_client/models/find_text200_response_inner.rb +270 -0
  378. data/lib/opencode_client/models/find_text200_response_inner_path.rb +164 -0
  379. data/lib/opencode_client/models/find_text200_response_inner_submatches_inner.rb +216 -0
  380. data/lib/opencode_client/models/formatter_status.rb +218 -0
  381. data/lib/opencode_client/models/global_event.rb +190 -0
  382. data/lib/opencode_client/models/global_health200_response.rb +214 -0
  383. data/lib/opencode_client/models/keybinds_config.rb +1171 -0
  384. data/lib/opencode_client/models/layout_config.rb +40 -0
  385. data/lib/opencode_client/models/log_level.rb +42 -0
  386. data/lib/opencode_client/models/lsp_status.rb +266 -0
  387. data/lib/opencode_client/models/mcp_add_request.rb +190 -0
  388. data/lib/opencode_client/models/mcp_add_request_config.rb +103 -0
  389. data/lib/opencode_client/models/mcp_auth_callback_request.rb +165 -0
  390. data/lib/opencode_client/models/mcp_auth_remove200_response.rb +188 -0
  391. data/lib/opencode_client/models/mcp_auth_start200_response.rb +165 -0
  392. data/lib/opencode_client/models/mcp_local_config.rb +269 -0
  393. data/lib/opencode_client/models/mcp_o_auth_config.rb +168 -0
  394. data/lib/opencode_client/models/mcp_remote_config.rb +276 -0
  395. data/lib/opencode_client/models/mcp_remote_config_oauth.rb +104 -0
  396. data/lib/opencode_client/models/mcp_status.rb +106 -0
  397. data/lib/opencode_client/models/mcp_status_connected.rb +188 -0
  398. data/lib/opencode_client/models/mcp_status_disabled.rb +188 -0
  399. data/lib/opencode_client/models/mcp_status_failed.rb +214 -0
  400. data/lib/opencode_client/models/mcp_status_needs_auth.rb +188 -0
  401. data/lib/opencode_client/models/mcp_status_needs_client_registration.rb +214 -0
  402. data/lib/opencode_client/models/message.rb +103 -0
  403. data/lib/opencode_client/models/message_aborted_error.rb +214 -0
  404. data/lib/opencode_client/models/message_output_length_error.rb +214 -0
  405. data/lib/opencode_client/models/model.rb +461 -0
  406. data/lib/opencode_client/models/model_api.rb +216 -0
  407. data/lib/opencode_client/models/model_capabilities.rb +320 -0
  408. data/lib/opencode_client/models/model_capabilities_input.rb +268 -0
  409. data/lib/opencode_client/models/model_capabilities_interleaved.rb +103 -0
  410. data/lib/opencode_client/models/model_capabilities_interleaved_any_of.rb +188 -0
  411. data/lib/opencode_client/models/model_cost.rb +225 -0
  412. data/lib/opencode_client/models/model_cost_experimental_over200_k.rb +216 -0
  413. data/lib/opencode_client/models/not_found_error.rb +214 -0
  414. data/lib/opencode_client/models/o_auth.rb +275 -0
  415. data/lib/opencode_client/models/part.rb +113 -0
  416. data/lib/opencode_client/models/part_any_of.rb +353 -0
  417. data/lib/opencode_client/models/patch_part.rb +320 -0
  418. data/lib/opencode_client/models/path.rb +268 -0
  419. data/lib/opencode_client/models/permission.rb +340 -0
  420. data/lib/opencode_client/models/permission_pattern.rb +103 -0
  421. data/lib/opencode_client/models/permission_respond_request.rb +188 -0
  422. data/lib/opencode_client/models/project.rb +277 -0
  423. data/lib/opencode_client/models/project_time.rb +199 -0
  424. data/lib/opencode_client/models/project_update_request.rb +156 -0
  425. data/lib/opencode_client/models/project_update_request_icon.rb +156 -0
  426. data/lib/opencode_client/models/provider.rb +333 -0
  427. data/lib/opencode_client/models/provider_auth_authorization.rb +240 -0
  428. data/lib/opencode_client/models/provider_auth_error.rb +214 -0
  429. data/lib/opencode_client/models/provider_auth_error_data.rb +190 -0
  430. data/lib/opencode_client/models/provider_auth_method.rb +214 -0
  431. data/lib/opencode_client/models/provider_config.rb +227 -0
  432. data/lib/opencode_client/models/provider_config_models_value.rb +329 -0
  433. data/lib/opencode_client/models/provider_config_models_value_interleaved.rb +103 -0
  434. data/lib/opencode_client/models/provider_config_models_value_interleaved_any_of.rb +188 -0
  435. data/lib/opencode_client/models/provider_config_options.rb +185 -0
  436. data/lib/opencode_client/models/provider_config_options_timeout.rb +104 -0
  437. data/lib/opencode_client/models/provider_list200_response.rb +222 -0
  438. data/lib/opencode_client/models/provider_list200_response_all_inner.rb +264 -0
  439. data/lib/opencode_client/models/provider_list200_response_all_inner_models_value.rb +482 -0
  440. data/lib/opencode_client/models/provider_list200_response_all_inner_models_value_cost.rb +217 -0
  441. data/lib/opencode_client/models/provider_list200_response_all_inner_models_value_cost_context_over200k.rb +208 -0
  442. data/lib/opencode_client/models/provider_list200_response_all_inner_models_value_interleaved.rb +103 -0
  443. data/lib/opencode_client/models/provider_list200_response_all_inner_models_value_interleaved_any_of.rb +188 -0
  444. data/lib/opencode_client/models/provider_list200_response_all_inner_models_value_limit.rb +190 -0
  445. data/lib/opencode_client/models/provider_list200_response_all_inner_models_value_modalities.rb +196 -0
  446. data/lib/opencode_client/models/provider_list200_response_all_inner_models_value_provider.rb +164 -0
  447. data/lib/opencode_client/models/provider_oauth_authorize_request.rb +165 -0
  448. data/lib/opencode_client/models/provider_oauth_callback_request.rb +175 -0
  449. data/lib/opencode_client/models/pty.rb +357 -0
  450. data/lib/opencode_client/models/pty_create_request.rb +187 -0
  451. data/lib/opencode_client/models/pty_update_request.rb +156 -0
  452. data/lib/opencode_client/models/pty_update_request_size.rb +190 -0
  453. data/lib/opencode_client/models/range.rb +190 -0
  454. data/lib/opencode_client/models/range_start.rb +190 -0
  455. data/lib/opencode_client/models/reasoning_part.rb +329 -0
  456. data/lib/opencode_client/models/retry_part.rb +344 -0
  457. data/lib/opencode_client/models/server_config.rb +188 -0
  458. data/lib/opencode_client/models/session.rb +362 -0
  459. data/lib/opencode_client/models/session_command_request.rb +238 -0
  460. data/lib/opencode_client/models/session_create_request.rb +177 -0
  461. data/lib/opencode_client/models/session_fork_request.rb +168 -0
  462. data/lib/opencode_client/models/session_init_request.rb +227 -0
  463. data/lib/opencode_client/models/session_messages200_response_inner.rb +192 -0
  464. data/lib/opencode_client/models/session_prompt200_response.rb +192 -0
  465. data/lib/opencode_client/models/session_prompt_request.rb +243 -0
  466. data/lib/opencode_client/models/session_prompt_request_model.rb +190 -0
  467. data/lib/opencode_client/models/session_prompt_request_parts_inner.rb +105 -0
  468. data/lib/opencode_client/models/session_revert.rb +191 -0
  469. data/lib/opencode_client/models/session_revert_request.rb +205 -0
  470. data/lib/opencode_client/models/session_share.rb +164 -0
  471. data/lib/opencode_client/models/session_shell_request.rb +199 -0
  472. data/lib/opencode_client/models/session_status.rb +104 -0
  473. data/lib/opencode_client/models/session_status_any_of.rb +188 -0
  474. data/lib/opencode_client/models/session_status_any_of1.rb +266 -0
  475. data/lib/opencode_client/models/session_status_any_of2.rb +188 -0
  476. data/lib/opencode_client/models/session_summarize_request.rb +201 -0
  477. data/lib/opencode_client/models/session_summary.rb +227 -0
  478. data/lib/opencode_client/models/session_time.rb +208 -0
  479. data/lib/opencode_client/models/session_update_request.rb +156 -0
  480. data/lib/opencode_client/models/session_update_request_time.rb +147 -0
  481. data/lib/opencode_client/models/snapshot_part.rb +292 -0
  482. data/lib/opencode_client/models/step_finish_part.rb +353 -0
  483. data/lib/opencode_client/models/step_start_part.rb +275 -0
  484. data/lib/opencode_client/models/subtask_part_input.rb +284 -0
  485. data/lib/opencode_client/models/symbol.rb +216 -0
  486. data/lib/opencode_client/models/symbol_location.rb +190 -0
  487. data/lib/opencode_client/models/symbol_source.rb +336 -0
  488. data/lib/opencode_client/models/text_part.rb +330 -0
  489. data/lib/opencode_client/models/text_part_input.rb +261 -0
  490. data/lib/opencode_client/models/text_part_time.rb +173 -0
  491. data/lib/opencode_client/models/todo.rb +246 -0
  492. data/lib/opencode_client/models/tool_list_item.rb +202 -0
  493. data/lib/opencode_client/models/tool_part.rb +355 -0
  494. data/lib/opencode_client/models/tool_state.rb +105 -0
  495. data/lib/opencode_client/models/tool_state_completed.rb +333 -0
  496. data/lib/opencode_client/models/tool_state_completed_time.rb +199 -0
  497. data/lib/opencode_client/models/tool_state_error.rb +279 -0
  498. data/lib/opencode_client/models/tool_state_error_time.rb +190 -0
  499. data/lib/opencode_client/models/tool_state_pending.rb +242 -0
  500. data/lib/opencode_client/models/tool_state_running.rb +262 -0
  501. data/lib/opencode_client/models/tool_state_running_time.rb +164 -0
  502. data/lib/opencode_client/models/tui_control_next200_response.rb +176 -0
  503. data/lib/opencode_client/models/tui_execute_command_request.rb +164 -0
  504. data/lib/opencode_client/models/tui_publish_request.rb +104 -0
  505. data/lib/opencode_client/models/tui_show_toast_request.rb +235 -0
  506. data/lib/opencode_client/models/unknown_error.rb +214 -0
  507. data/lib/opencode_client/models/unknown_error_data.rb +164 -0
  508. data/lib/opencode_client/models/user_message.rb +347 -0
  509. data/lib/opencode_client/models/user_message_summary.rb +184 -0
  510. data/lib/opencode_client/models/user_message_time.rb +164 -0
  511. data/lib/opencode_client/models/vcs_info.rb +164 -0
  512. data/lib/opencode_client/models/well_known_auth.rb +240 -0
  513. data/lib/opencode_client/version.rb +15 -0
  514. data/lib/opencode_client.rb +291 -0
  515. data/opencode_client.gemspec +39 -0
  516. data/pkg/opencode_client-1.0.0.gem +0 -0
  517. data/spec/api/default_api_spec.rb +1090 -0
  518. data/spec/api/session_api_spec.rb +61 -0
  519. data/spec/models/agent_config_permission_bash_spec.rb +21 -0
  520. data/spec/models/agent_config_permission_spec.rb +82 -0
  521. data/spec/models/agent_config_spec.rb +100 -0
  522. data/spec/models/agent_part_input_spec.rb +58 -0
  523. data/spec/models/agent_part_source_spec.rb +48 -0
  524. data/spec/models/agent_part_spec.rb +70 -0
  525. data/spec/models/agent_permission_spec.rb +90 -0
  526. data/spec/models/agent_spec.rb +124 -0
  527. data/spec/models/api_auth_spec.rb +46 -0
  528. data/spec/models/api_error_data_spec.rb +66 -0
  529. data/spec/models/api_error_spec.rb +46 -0
  530. data/spec/models/app_log_request_spec.rb +58 -0
  531. data/spec/models/assistant_message_error_spec.rb +21 -0
  532. data/spec/models/assistant_message_path_spec.rb +42 -0
  533. data/spec/models/assistant_message_spec.rb +124 -0
  534. data/spec/models/assistant_message_time_spec.rb +42 -0
  535. data/spec/models/assistant_message_tokens_cache_spec.rb +42 -0
  536. data/spec/models/assistant_message_tokens_spec.rb +54 -0
  537. data/spec/models/auth_spec.rb +21 -0
  538. data/spec/models/bad_request_error_spec.rb +52 -0
  539. data/spec/models/command_spec.rb +66 -0
  540. data/spec/models/compaction_part_spec.rb +64 -0
  541. data/spec/models/config_agent_spec.rb +72 -0
  542. data/spec/models/config_autoupdate_spec.rb +21 -0
  543. data/spec/models/config_command_value_spec.rb +60 -0
  544. data/spec/models/config_compaction_spec.rb +42 -0
  545. data/spec/models/config_enterprise_spec.rb +36 -0
  546. data/spec/models/config_experimental_hook_file_edited_value_inner_spec.rb +42 -0
  547. data/spec/models/config_experimental_hook_spec.rb +42 -0
  548. data/spec/models/config_experimental_spec.rb +72 -0
  549. data/spec/models/config_formatter_any_of_value_spec.rb +54 -0
  550. data/spec/models/config_formatter_spec.rb +21 -0
  551. data/spec/models/config_lsp_any_of_value_any_of1_spec.rb +60 -0
  552. data/spec/models/config_lsp_any_of_value_any_of_spec.rb +40 -0
  553. data/spec/models/config_lsp_any_of_value_spec.rb +21 -0
  554. data/spec/models/config_lsp_spec.rb +21 -0
  555. data/spec/models/config_mode_spec.rb +42 -0
  556. data/spec/models/config_providers200_response_spec.rb +42 -0
  557. data/spec/models/config_spec.rb +232 -0
  558. data/spec/models/config_tui_scroll_acceleration_spec.rb +36 -0
  559. data/spec/models/config_tui_spec.rb +52 -0
  560. data/spec/models/config_watcher_spec.rb +36 -0
  561. data/spec/models/event_command_executed_properties_spec.rb +54 -0
  562. data/spec/models/event_command_executed_spec.rb +46 -0
  563. data/spec/models/event_file_edited_properties_spec.rb +36 -0
  564. data/spec/models/event_file_edited_spec.rb +46 -0
  565. data/spec/models/event_file_watcher_updated_properties_spec.rb +46 -0
  566. data/spec/models/event_file_watcher_updated_spec.rb +46 -0
  567. data/spec/models/event_global_disposed_spec.rb +46 -0
  568. data/spec/models/event_installation_update_available_spec.rb +46 -0
  569. data/spec/models/event_installation_updated_properties_spec.rb +36 -0
  570. data/spec/models/event_installation_updated_spec.rb +46 -0
  571. data/spec/models/event_lsp_client_diagnostics_properties_spec.rb +42 -0
  572. data/spec/models/event_lsp_client_diagnostics_spec.rb +46 -0
  573. data/spec/models/event_lsp_updated_spec.rb +46 -0
  574. data/spec/models/event_mcp_tools_changed_properties_spec.rb +36 -0
  575. data/spec/models/event_mcp_tools_changed_spec.rb +46 -0
  576. data/spec/models/event_message_part_removed_properties_spec.rb +48 -0
  577. data/spec/models/event_message_part_removed_spec.rb +46 -0
  578. data/spec/models/event_message_part_updated_properties_spec.rb +42 -0
  579. data/spec/models/event_message_part_updated_spec.rb +46 -0
  580. data/spec/models/event_message_removed_properties_spec.rb +42 -0
  581. data/spec/models/event_message_removed_spec.rb +46 -0
  582. data/spec/models/event_message_updated_properties_spec.rb +36 -0
  583. data/spec/models/event_message_updated_spec.rb +46 -0
  584. data/spec/models/event_permission_replied_properties_spec.rb +48 -0
  585. data/spec/models/event_permission_replied_spec.rb +46 -0
  586. data/spec/models/event_permission_updated_spec.rb +46 -0
  587. data/spec/models/event_project_updated_spec.rb +46 -0
  588. data/spec/models/event_pty_created_properties_spec.rb +36 -0
  589. data/spec/models/event_pty_created_spec.rb +46 -0
  590. data/spec/models/event_pty_deleted_properties_spec.rb +36 -0
  591. data/spec/models/event_pty_deleted_spec.rb +46 -0
  592. data/spec/models/event_pty_exited_properties_spec.rb +42 -0
  593. data/spec/models/event_pty_exited_spec.rb +46 -0
  594. data/spec/models/event_pty_updated_spec.rb +46 -0
  595. data/spec/models/event_server_connected_spec.rb +46 -0
  596. data/spec/models/event_server_instance_disposed_properties_spec.rb +36 -0
  597. data/spec/models/event_server_instance_disposed_spec.rb +46 -0
  598. data/spec/models/event_session_compacted_spec.rb +46 -0
  599. data/spec/models/event_session_created_properties_spec.rb +36 -0
  600. data/spec/models/event_session_created_spec.rb +46 -0
  601. data/spec/models/event_session_deleted_spec.rb +46 -0
  602. data/spec/models/event_session_diff_properties_spec.rb +42 -0
  603. data/spec/models/event_session_diff_spec.rb +46 -0
  604. data/spec/models/event_session_error_properties_spec.rb +42 -0
  605. data/spec/models/event_session_error_spec.rb +46 -0
  606. data/spec/models/event_session_idle_properties_spec.rb +36 -0
  607. data/spec/models/event_session_idle_spec.rb +46 -0
  608. data/spec/models/event_session_status_properties_spec.rb +42 -0
  609. data/spec/models/event_session_status_spec.rb +46 -0
  610. data/spec/models/event_session_updated_spec.rb +46 -0
  611. data/spec/models/event_spec.rb +21 -0
  612. data/spec/models/event_todo_updated_properties_spec.rb +42 -0
  613. data/spec/models/event_todo_updated_spec.rb +46 -0
  614. data/spec/models/event_tui_command_execute_properties_command_spec.rb +21 -0
  615. data/spec/models/event_tui_command_execute_properties_spec.rb +36 -0
  616. data/spec/models/event_tui_command_execute_spec.rb +46 -0
  617. data/spec/models/event_tui_prompt_append_spec.rb +46 -0
  618. data/spec/models/event_tui_toast_show_spec.rb +46 -0
  619. data/spec/models/event_vcs_branch_updated_properties_spec.rb +36 -0
  620. data/spec/models/event_vcs_branch_updated_spec.rb +46 -0
  621. data/spec/models/file_content_patch_hunks_inner_spec.rb +60 -0
  622. data/spec/models/file_content_patch_spec.rb +66 -0
  623. data/spec/models/file_content_spec.rb +74 -0
  624. data/spec/models/file_diff_spec.rb +60 -0
  625. data/spec/models/file_node_spec.rb +64 -0
  626. data/spec/models/file_part_input_spec.rb +70 -0
  627. data/spec/models/file_part_source_spec.rb +21 -0
  628. data/spec/models/file_part_source_text_spec.rb +48 -0
  629. data/spec/models/file_part_spec.rb +82 -0
  630. data/spec/models/file_source_spec.rb +52 -0
  631. data/spec/models/file_spec.rb +58 -0
  632. data/spec/models/find_text200_response_inner_path_spec.rb +36 -0
  633. data/spec/models/find_text200_response_inner_spec.rb +60 -0
  634. data/spec/models/find_text200_response_inner_submatches_inner_spec.rb +48 -0
  635. data/spec/models/formatter_status_spec.rb +48 -0
  636. data/spec/models/global_event_spec.rb +42 -0
  637. data/spec/models/global_health200_response_spec.rb +46 -0
  638. data/spec/models/keybinds_config_spec.rb +546 -0
  639. data/spec/models/layout_config_spec.rb +30 -0
  640. data/spec/models/log_level_spec.rb +30 -0
  641. data/spec/models/lsp_status_spec.rb +58 -0
  642. data/spec/models/mcp_add_request_config_spec.rb +21 -0
  643. data/spec/models/mcp_add_request_spec.rb +42 -0
  644. data/spec/models/mcp_auth_callback_request_spec.rb +36 -0
  645. data/spec/models/mcp_auth_remove200_response_spec.rb +40 -0
  646. data/spec/models/mcp_auth_start200_response_spec.rb +36 -0
  647. data/spec/models/mcp_local_config_spec.rb +64 -0
  648. data/spec/models/mcp_o_auth_config_spec.rb +48 -0
  649. data/spec/models/mcp_remote_config_oauth_spec.rb +21 -0
  650. data/spec/models/mcp_remote_config_spec.rb +70 -0
  651. data/spec/models/mcp_status_connected_spec.rb +40 -0
  652. data/spec/models/mcp_status_disabled_spec.rb +40 -0
  653. data/spec/models/mcp_status_failed_spec.rb +46 -0
  654. data/spec/models/mcp_status_needs_auth_spec.rb +40 -0
  655. data/spec/models/mcp_status_needs_client_registration_spec.rb +46 -0
  656. data/spec/models/mcp_status_spec.rb +21 -0
  657. data/spec/models/message_aborted_error_spec.rb +46 -0
  658. data/spec/models/message_output_length_error_spec.rb +46 -0
  659. data/spec/models/message_spec.rb +21 -0
  660. data/spec/models/model_api_spec.rb +48 -0
  661. data/spec/models/model_capabilities_input_spec.rb +60 -0
  662. data/spec/models/model_capabilities_interleaved_any_of_spec.rb +40 -0
  663. data/spec/models/model_capabilities_interleaved_spec.rb +21 -0
  664. data/spec/models/model_capabilities_spec.rb +72 -0
  665. data/spec/models/model_cost_experimental_over200_k_spec.rb +48 -0
  666. data/spec/models/model_cost_spec.rb +54 -0
  667. data/spec/models/model_spec.rb +106 -0
  668. data/spec/models/not_found_error_spec.rb +46 -0
  669. data/spec/models/o_auth_spec.rb +64 -0
  670. data/spec/models/part_any_of_spec.rb +82 -0
  671. data/spec/models/part_spec.rb +21 -0
  672. data/spec/models/patch_part_spec.rb +70 -0
  673. data/spec/models/path_spec.rb +60 -0
  674. data/spec/models/permission_pattern_spec.rb +21 -0
  675. data/spec/models/permission_respond_request_spec.rb +40 -0
  676. data/spec/models/permission_spec.rb +84 -0
  677. data/spec/models/project_spec.rb +70 -0
  678. data/spec/models/project_time_spec.rb +48 -0
  679. data/spec/models/project_update_request_icon_spec.rb +42 -0
  680. data/spec/models/project_update_request_spec.rb +42 -0
  681. data/spec/models/provider_auth_authorization_spec.rb +52 -0
  682. data/spec/models/provider_auth_error_data_spec.rb +42 -0
  683. data/spec/models/provider_auth_error_spec.rb +46 -0
  684. data/spec/models/provider_auth_method_spec.rb +46 -0
  685. data/spec/models/provider_config_models_value_interleaved_any_of_spec.rb +40 -0
  686. data/spec/models/provider_config_models_value_interleaved_spec.rb +21 -0
  687. data/spec/models/provider_config_models_value_spec.rb +136 -0
  688. data/spec/models/provider_config_options_spec.rb +60 -0
  689. data/spec/models/provider_config_options_timeout_spec.rb +21 -0
  690. data/spec/models/provider_config_spec.rb +84 -0
  691. data/spec/models/provider_list200_response_all_inner_models_value_cost_context_over200k_spec.rb +54 -0
  692. data/spec/models/provider_list200_response_all_inner_models_value_cost_spec.rb +60 -0
  693. data/spec/models/provider_list200_response_all_inner_models_value_interleaved_any_of_spec.rb +40 -0
  694. data/spec/models/provider_list200_response_all_inner_models_value_interleaved_spec.rb +21 -0
  695. data/spec/models/provider_list200_response_all_inner_models_value_limit_spec.rb +42 -0
  696. data/spec/models/provider_list200_response_all_inner_models_value_modalities_spec.rb +50 -0
  697. data/spec/models/provider_list200_response_all_inner_models_value_provider_spec.rb +36 -0
  698. data/spec/models/provider_list200_response_all_inner_models_value_spec.rb +136 -0
  699. data/spec/models/provider_list200_response_all_inner_spec.rb +66 -0
  700. data/spec/models/provider_list200_response_spec.rb +48 -0
  701. data/spec/models/provider_oauth_authorize_request_spec.rb +36 -0
  702. data/spec/models/provider_oauth_callback_request_spec.rb +42 -0
  703. data/spec/models/provider_spec.rb +76 -0
  704. data/spec/models/pty_create_request_spec.rb +60 -0
  705. data/spec/models/pty_spec.rb +76 -0
  706. data/spec/models/pty_update_request_size_spec.rb +42 -0
  707. data/spec/models/pty_update_request_spec.rb +42 -0
  708. data/spec/models/range_spec.rb +42 -0
  709. data/spec/models/range_start_spec.rb +42 -0
  710. data/spec/models/reasoning_part_spec.rb +76 -0
  711. data/spec/models/retry_part_spec.rb +76 -0
  712. data/spec/models/server_config_spec.rb +48 -0
  713. data/spec/models/session_command_request_spec.rb +60 -0
  714. data/spec/models/session_create_request_spec.rb +42 -0
  715. data/spec/models/session_fork_request_spec.rb +36 -0
  716. data/spec/models/session_init_request_spec.rb +48 -0
  717. data/spec/models/session_messages200_response_inner_spec.rb +42 -0
  718. data/spec/models/session_prompt200_response_spec.rb +42 -0
  719. data/spec/models/session_prompt_request_model_spec.rb +42 -0
  720. data/spec/models/session_prompt_request_parts_inner_spec.rb +21 -0
  721. data/spec/models/session_prompt_request_spec.rb +72 -0
  722. data/spec/models/session_revert_request_spec.rb +42 -0
  723. data/spec/models/session_revert_spec.rb +54 -0
  724. data/spec/models/session_share_spec.rb +36 -0
  725. data/spec/models/session_shell_request_spec.rb +48 -0
  726. data/spec/models/session_spec.rb +90 -0
  727. data/spec/models/session_status_any_of1_spec.rb +58 -0
  728. data/spec/models/session_status_any_of2_spec.rb +40 -0
  729. data/spec/models/session_status_any_of_spec.rb +40 -0
  730. data/spec/models/session_status_spec.rb +21 -0
  731. data/spec/models/session_summarize_request_spec.rb +48 -0
  732. data/spec/models/session_summary_spec.rb +54 -0
  733. data/spec/models/session_time_spec.rb +54 -0
  734. data/spec/models/session_update_request_spec.rb +42 -0
  735. data/spec/models/session_update_request_time_spec.rb +36 -0
  736. data/spec/models/snapshot_part_spec.rb +64 -0
  737. data/spec/models/step_finish_part_spec.rb +82 -0
  738. data/spec/models/step_start_part_spec.rb +64 -0
  739. data/spec/models/subtask_part_input_spec.rb +70 -0
  740. data/spec/models/symbol_location_spec.rb +42 -0
  741. data/spec/models/symbol_source_spec.rb +70 -0
  742. data/spec/models/symbol_spec.rb +48 -0
  743. data/spec/models/text_part_input_spec.rb +76 -0
  744. data/spec/models/text_part_spec.rb +88 -0
  745. data/spec/models/text_part_time_spec.rb +42 -0
  746. data/spec/models/todo_spec.rb +54 -0
  747. data/spec/models/tool_list_item_spec.rb +48 -0
  748. data/spec/models/tool_part_spec.rb +82 -0
  749. data/spec/models/tool_state_completed_spec.rb +76 -0
  750. data/spec/models/tool_state_completed_time_spec.rb +48 -0
  751. data/spec/models/tool_state_error_spec.rb +64 -0
  752. data/spec/models/tool_state_error_time_spec.rb +42 -0
  753. data/spec/models/tool_state_pending_spec.rb +52 -0
  754. data/spec/models/tool_state_running_spec.rb +64 -0
  755. data/spec/models/tool_state_running_time_spec.rb +36 -0
  756. data/spec/models/tool_state_spec.rb +21 -0
  757. data/spec/models/tui_control_next200_response_spec.rb +42 -0
  758. data/spec/models/tui_execute_command_request_spec.rb +36 -0
  759. data/spec/models/tui_publish_request_spec.rb +21 -0
  760. data/spec/models/tui_show_toast_request_spec.rb +58 -0
  761. data/spec/models/unknown_error_data_spec.rb +36 -0
  762. data/spec/models/unknown_error_spec.rb +46 -0
  763. data/spec/models/user_message_spec.rb +88 -0
  764. data/spec/models/user_message_summary_spec.rb +48 -0
  765. data/spec/models/user_message_time_spec.rb +36 -0
  766. data/spec/models/vcs_info_spec.rb +36 -0
  767. data/spec/models/well_known_auth_spec.rb +52 -0
  768. data/spec/spec_helper.rb +111 -0
  769. metadata +1099 -0
@@ -0,0 +1,268 @@
1
+ =begin
2
+ #opencode
3
+
4
+ #opencode api
5
+
6
+ The version of the OpenAPI document: 1.0.0
7
+
8
+ Generated by: https://openapi-generator.tech
9
+ Generator version: 7.18.0
10
+
11
+ =end
12
+
13
+ require 'date'
14
+ require 'time'
15
+
16
+ module OpencodeClient
17
+ class Path < ApiModelBase
18
+ attr_accessor :home
19
+
20
+ attr_accessor :state
21
+
22
+ attr_accessor :config
23
+
24
+ attr_accessor :worktree
25
+
26
+ attr_accessor :directory
27
+
28
+ # Attribute mapping from ruby-style variable name to JSON key.
29
+ def self.attribute_map
30
+ {
31
+ :'home' => :'home',
32
+ :'state' => :'state',
33
+ :'config' => :'config',
34
+ :'worktree' => :'worktree',
35
+ :'directory' => :'directory'
36
+ }
37
+ end
38
+
39
+ # Returns attribute mapping this model knows about
40
+ def self.acceptable_attribute_map
41
+ attribute_map
42
+ end
43
+
44
+ # Returns all the JSON keys this model knows about
45
+ def self.acceptable_attributes
46
+ acceptable_attribute_map.values
47
+ end
48
+
49
+ # Attribute type mapping.
50
+ def self.openapi_types
51
+ {
52
+ :'home' => :'String',
53
+ :'state' => :'String',
54
+ :'config' => :'String',
55
+ :'worktree' => :'String',
56
+ :'directory' => :'String'
57
+ }
58
+ end
59
+
60
+ # List of attributes with nullable: true
61
+ def self.openapi_nullable
62
+ Set.new([
63
+ ])
64
+ end
65
+
66
+ # Initializes the object
67
+ # @param [Hash] attributes Model attributes in the form of hash
68
+ def initialize(attributes = {})
69
+ if (!attributes.is_a?(Hash))
70
+ fail ArgumentError, "The input argument (attributes) must be a hash in `OpencodeClient::Path` initialize method"
71
+ end
72
+
73
+ # check to see if the attribute exists and convert string to symbol for hash key
74
+ acceptable_attribute_map = self.class.acceptable_attribute_map
75
+ attributes = attributes.each_with_object({}) { |(k, v), h|
76
+ if (!acceptable_attribute_map.key?(k.to_sym))
77
+ fail ArgumentError, "`#{k}` is not a valid attribute in `OpencodeClient::Path`. Please check the name to make sure it's valid. List of attributes: " + acceptable_attribute_map.keys.inspect
78
+ end
79
+ h[k.to_sym] = v
80
+ }
81
+
82
+ if attributes.key?(:'home')
83
+ self.home = attributes[:'home']
84
+ else
85
+ self.home = nil
86
+ end
87
+
88
+ if attributes.key?(:'state')
89
+ self.state = attributes[:'state']
90
+ else
91
+ self.state = nil
92
+ end
93
+
94
+ if attributes.key?(:'config')
95
+ self.config = attributes[:'config']
96
+ else
97
+ self.config = nil
98
+ end
99
+
100
+ if attributes.key?(:'worktree')
101
+ self.worktree = attributes[:'worktree']
102
+ else
103
+ self.worktree = nil
104
+ end
105
+
106
+ if attributes.key?(:'directory')
107
+ self.directory = attributes[:'directory']
108
+ else
109
+ self.directory = nil
110
+ end
111
+ end
112
+
113
+ # Show invalid properties with the reasons. Usually used together with valid?
114
+ # @return Array for valid properties with the reasons
115
+ def list_invalid_properties
116
+ warn '[DEPRECATED] the `list_invalid_properties` method is obsolete'
117
+ invalid_properties = Array.new
118
+ if @home.nil?
119
+ invalid_properties.push('invalid value for "home", home cannot be nil.')
120
+ end
121
+
122
+ if @state.nil?
123
+ invalid_properties.push('invalid value for "state", state cannot be nil.')
124
+ end
125
+
126
+ if @config.nil?
127
+ invalid_properties.push('invalid value for "config", config cannot be nil.')
128
+ end
129
+
130
+ if @worktree.nil?
131
+ invalid_properties.push('invalid value for "worktree", worktree cannot be nil.')
132
+ end
133
+
134
+ if @directory.nil?
135
+ invalid_properties.push('invalid value for "directory", directory cannot be nil.')
136
+ end
137
+
138
+ invalid_properties
139
+ end
140
+
141
+ # Check to see if the all the properties in the model are valid
142
+ # @return true if the model is valid
143
+ def valid?
144
+ warn '[DEPRECATED] the `valid?` method is obsolete'
145
+ return false if @home.nil?
146
+ return false if @state.nil?
147
+ return false if @config.nil?
148
+ return false if @worktree.nil?
149
+ return false if @directory.nil?
150
+ true
151
+ end
152
+
153
+ # Custom attribute writer method with validation
154
+ # @param [Object] home Value to be assigned
155
+ def home=(home)
156
+ if home.nil?
157
+ fail ArgumentError, 'home cannot be nil'
158
+ end
159
+
160
+ @home = home
161
+ end
162
+
163
+ # Custom attribute writer method with validation
164
+ # @param [Object] state Value to be assigned
165
+ def state=(state)
166
+ if state.nil?
167
+ fail ArgumentError, 'state cannot be nil'
168
+ end
169
+
170
+ @state = state
171
+ end
172
+
173
+ # Custom attribute writer method with validation
174
+ # @param [Object] config Value to be assigned
175
+ def config=(config)
176
+ if config.nil?
177
+ fail ArgumentError, 'config cannot be nil'
178
+ end
179
+
180
+ @config = config
181
+ end
182
+
183
+ # Custom attribute writer method with validation
184
+ # @param [Object] worktree Value to be assigned
185
+ def worktree=(worktree)
186
+ if worktree.nil?
187
+ fail ArgumentError, 'worktree cannot be nil'
188
+ end
189
+
190
+ @worktree = worktree
191
+ end
192
+
193
+ # Custom attribute writer method with validation
194
+ # @param [Object] directory Value to be assigned
195
+ def directory=(directory)
196
+ if directory.nil?
197
+ fail ArgumentError, 'directory cannot be nil'
198
+ end
199
+
200
+ @directory = directory
201
+ end
202
+
203
+ # Checks equality by comparing each attribute.
204
+ # @param [Object] Object to be compared
205
+ def ==(o)
206
+ return true if self.equal?(o)
207
+ self.class == o.class &&
208
+ home == o.home &&
209
+ state == o.state &&
210
+ config == o.config &&
211
+ worktree == o.worktree &&
212
+ directory == o.directory
213
+ end
214
+
215
+ # @see the `==` method
216
+ # @param [Object] Object to be compared
217
+ def eql?(o)
218
+ self == o
219
+ end
220
+
221
+ # Calculates hash code according to all attributes.
222
+ # @return [Integer] Hash code
223
+ def hash
224
+ [home, state, config, worktree, directory].hash
225
+ end
226
+
227
+ # Builds the object from hash
228
+ # @param [Hash] attributes Model attributes in the form of hash
229
+ # @return [Object] Returns the model itself
230
+ def self.build_from_hash(attributes)
231
+ return nil unless attributes.is_a?(Hash)
232
+ attributes = attributes.transform_keys(&:to_sym)
233
+ transformed_hash = {}
234
+ openapi_types.each_pair do |key, type|
235
+ if attributes.key?(attribute_map[key]) && attributes[attribute_map[key]].nil?
236
+ transformed_hash["#{key}"] = nil
237
+ elsif type =~ /\AArray<(.*)>/i
238
+ # check to ensure the input is an array given that the attribute
239
+ # is documented as an array but the input is not
240
+ if attributes[attribute_map[key]].is_a?(Array)
241
+ transformed_hash["#{key}"] = attributes[attribute_map[key]].map { |v| _deserialize($1, v) }
242
+ end
243
+ elsif !attributes[attribute_map[key]].nil?
244
+ transformed_hash["#{key}"] = _deserialize(type, attributes[attribute_map[key]])
245
+ end
246
+ end
247
+ new(transformed_hash)
248
+ end
249
+
250
+ # Returns the object in the form of hash
251
+ # @return [Hash] Returns the object in the form of hash
252
+ def to_hash
253
+ hash = {}
254
+ self.class.attribute_map.each_pair do |attr, param|
255
+ value = self.send(attr)
256
+ if value.nil?
257
+ is_nullable = self.class.openapi_nullable.include?(attr)
258
+ next if !is_nullable || (is_nullable && !instance_variable_defined?(:"@#{attr}"))
259
+ end
260
+
261
+ hash[param] = _to_hash(value)
262
+ end
263
+ hash
264
+ end
265
+
266
+ end
267
+
268
+ end
@@ -0,0 +1,340 @@
1
+ =begin
2
+ #opencode
3
+
4
+ #opencode api
5
+
6
+ The version of the OpenAPI document: 1.0.0
7
+
8
+ Generated by: https://openapi-generator.tech
9
+ Generator version: 7.18.0
10
+
11
+ =end
12
+
13
+ require 'date'
14
+ require 'time'
15
+
16
+ module OpencodeClient
17
+ class Permission < ApiModelBase
18
+ attr_accessor :id
19
+
20
+ attr_accessor :type
21
+
22
+ attr_accessor :pattern
23
+
24
+ attr_accessor :session_id
25
+
26
+ attr_accessor :message_id
27
+
28
+ attr_accessor :call_id
29
+
30
+ attr_accessor :title
31
+
32
+ attr_accessor :metadata
33
+
34
+ attr_accessor :time
35
+
36
+ # Attribute mapping from ruby-style variable name to JSON key.
37
+ def self.attribute_map
38
+ {
39
+ :'id' => :'id',
40
+ :'type' => :'type',
41
+ :'pattern' => :'pattern',
42
+ :'session_id' => :'sessionID',
43
+ :'message_id' => :'messageID',
44
+ :'call_id' => :'callID',
45
+ :'title' => :'title',
46
+ :'metadata' => :'metadata',
47
+ :'time' => :'time'
48
+ }
49
+ end
50
+
51
+ # Returns attribute mapping this model knows about
52
+ def self.acceptable_attribute_map
53
+ attribute_map
54
+ end
55
+
56
+ # Returns all the JSON keys this model knows about
57
+ def self.acceptable_attributes
58
+ acceptable_attribute_map.values
59
+ end
60
+
61
+ # Attribute type mapping.
62
+ def self.openapi_types
63
+ {
64
+ :'id' => :'String',
65
+ :'type' => :'String',
66
+ :'pattern' => :'PermissionPattern',
67
+ :'session_id' => :'String',
68
+ :'message_id' => :'String',
69
+ :'call_id' => :'String',
70
+ :'title' => :'String',
71
+ :'metadata' => :'Hash<String, Object>',
72
+ :'time' => :'UserMessageTime'
73
+ }
74
+ end
75
+
76
+ # List of attributes with nullable: true
77
+ def self.openapi_nullable
78
+ Set.new([
79
+ ])
80
+ end
81
+
82
+ # Initializes the object
83
+ # @param [Hash] attributes Model attributes in the form of hash
84
+ def initialize(attributes = {})
85
+ if (!attributes.is_a?(Hash))
86
+ fail ArgumentError, "The input argument (attributes) must be a hash in `OpencodeClient::Permission` initialize method"
87
+ end
88
+
89
+ # check to see if the attribute exists and convert string to symbol for hash key
90
+ acceptable_attribute_map = self.class.acceptable_attribute_map
91
+ attributes = attributes.each_with_object({}) { |(k, v), h|
92
+ if (!acceptable_attribute_map.key?(k.to_sym))
93
+ fail ArgumentError, "`#{k}` is not a valid attribute in `OpencodeClient::Permission`. Please check the name to make sure it's valid. List of attributes: " + acceptable_attribute_map.keys.inspect
94
+ end
95
+ h[k.to_sym] = v
96
+ }
97
+
98
+ if attributes.key?(:'id')
99
+ self.id = attributes[:'id']
100
+ else
101
+ self.id = nil
102
+ end
103
+
104
+ if attributes.key?(:'type')
105
+ self.type = attributes[:'type']
106
+ else
107
+ self.type = nil
108
+ end
109
+
110
+ if attributes.key?(:'pattern')
111
+ self.pattern = attributes[:'pattern']
112
+ end
113
+
114
+ if attributes.key?(:'session_id')
115
+ self.session_id = attributes[:'session_id']
116
+ else
117
+ self.session_id = nil
118
+ end
119
+
120
+ if attributes.key?(:'message_id')
121
+ self.message_id = attributes[:'message_id']
122
+ else
123
+ self.message_id = nil
124
+ end
125
+
126
+ if attributes.key?(:'call_id')
127
+ self.call_id = attributes[:'call_id']
128
+ end
129
+
130
+ if attributes.key?(:'title')
131
+ self.title = attributes[:'title']
132
+ else
133
+ self.title = nil
134
+ end
135
+
136
+ if attributes.key?(:'metadata')
137
+ if (value = attributes[:'metadata']).is_a?(Hash)
138
+ self.metadata = value
139
+ end
140
+ else
141
+ self.metadata = nil
142
+ end
143
+
144
+ if attributes.key?(:'time')
145
+ self.time = attributes[:'time']
146
+ else
147
+ self.time = nil
148
+ end
149
+ end
150
+
151
+ # Show invalid properties with the reasons. Usually used together with valid?
152
+ # @return Array for valid properties with the reasons
153
+ def list_invalid_properties
154
+ warn '[DEPRECATED] the `list_invalid_properties` method is obsolete'
155
+ invalid_properties = Array.new
156
+ if @id.nil?
157
+ invalid_properties.push('invalid value for "id", id cannot be nil.')
158
+ end
159
+
160
+ if @type.nil?
161
+ invalid_properties.push('invalid value for "type", type cannot be nil.')
162
+ end
163
+
164
+ if @session_id.nil?
165
+ invalid_properties.push('invalid value for "session_id", session_id cannot be nil.')
166
+ end
167
+
168
+ if @message_id.nil?
169
+ invalid_properties.push('invalid value for "message_id", message_id cannot be nil.')
170
+ end
171
+
172
+ if @title.nil?
173
+ invalid_properties.push('invalid value for "title", title cannot be nil.')
174
+ end
175
+
176
+ if @metadata.nil?
177
+ invalid_properties.push('invalid value for "metadata", metadata cannot be nil.')
178
+ end
179
+
180
+ if @time.nil?
181
+ invalid_properties.push('invalid value for "time", time cannot be nil.')
182
+ end
183
+
184
+ invalid_properties
185
+ end
186
+
187
+ # Check to see if the all the properties in the model are valid
188
+ # @return true if the model is valid
189
+ def valid?
190
+ warn '[DEPRECATED] the `valid?` method is obsolete'
191
+ return false if @id.nil?
192
+ return false if @type.nil?
193
+ return false if @session_id.nil?
194
+ return false if @message_id.nil?
195
+ return false if @title.nil?
196
+ return false if @metadata.nil?
197
+ return false if @time.nil?
198
+ true
199
+ end
200
+
201
+ # Custom attribute writer method with validation
202
+ # @param [Object] id Value to be assigned
203
+ def id=(id)
204
+ if id.nil?
205
+ fail ArgumentError, 'id cannot be nil'
206
+ end
207
+
208
+ @id = id
209
+ end
210
+
211
+ # Custom attribute writer method with validation
212
+ # @param [Object] type Value to be assigned
213
+ def type=(type)
214
+ if type.nil?
215
+ fail ArgumentError, 'type cannot be nil'
216
+ end
217
+
218
+ @type = type
219
+ end
220
+
221
+ # Custom attribute writer method with validation
222
+ # @param [Object] session_id Value to be assigned
223
+ def session_id=(session_id)
224
+ if session_id.nil?
225
+ fail ArgumentError, 'session_id cannot be nil'
226
+ end
227
+
228
+ @session_id = session_id
229
+ end
230
+
231
+ # Custom attribute writer method with validation
232
+ # @param [Object] message_id Value to be assigned
233
+ def message_id=(message_id)
234
+ if message_id.nil?
235
+ fail ArgumentError, 'message_id cannot be nil'
236
+ end
237
+
238
+ @message_id = message_id
239
+ end
240
+
241
+ # Custom attribute writer method with validation
242
+ # @param [Object] title Value to be assigned
243
+ def title=(title)
244
+ if title.nil?
245
+ fail ArgumentError, 'title cannot be nil'
246
+ end
247
+
248
+ @title = title
249
+ end
250
+
251
+ # Custom attribute writer method with validation
252
+ # @param [Object] metadata Value to be assigned
253
+ def metadata=(metadata)
254
+ if metadata.nil?
255
+ fail ArgumentError, 'metadata cannot be nil'
256
+ end
257
+
258
+ @metadata = metadata
259
+ end
260
+
261
+ # Custom attribute writer method with validation
262
+ # @param [Object] time Value to be assigned
263
+ def time=(time)
264
+ if time.nil?
265
+ fail ArgumentError, 'time cannot be nil'
266
+ end
267
+
268
+ @time = time
269
+ end
270
+
271
+ # Checks equality by comparing each attribute.
272
+ # @param [Object] Object to be compared
273
+ def ==(o)
274
+ return true if self.equal?(o)
275
+ self.class == o.class &&
276
+ id == o.id &&
277
+ type == o.type &&
278
+ pattern == o.pattern &&
279
+ session_id == o.session_id &&
280
+ message_id == o.message_id &&
281
+ call_id == o.call_id &&
282
+ title == o.title &&
283
+ metadata == o.metadata &&
284
+ time == o.time
285
+ end
286
+
287
+ # @see the `==` method
288
+ # @param [Object] Object to be compared
289
+ def eql?(o)
290
+ self == o
291
+ end
292
+
293
+ # Calculates hash code according to all attributes.
294
+ # @return [Integer] Hash code
295
+ def hash
296
+ [id, type, pattern, session_id, message_id, call_id, title, metadata, time].hash
297
+ end
298
+
299
+ # Builds the object from hash
300
+ # @param [Hash] attributes Model attributes in the form of hash
301
+ # @return [Object] Returns the model itself
302
+ def self.build_from_hash(attributes)
303
+ return nil unless attributes.is_a?(Hash)
304
+ attributes = attributes.transform_keys(&:to_sym)
305
+ transformed_hash = {}
306
+ openapi_types.each_pair do |key, type|
307
+ if attributes.key?(attribute_map[key]) && attributes[attribute_map[key]].nil?
308
+ transformed_hash["#{key}"] = nil
309
+ elsif type =~ /\AArray<(.*)>/i
310
+ # check to ensure the input is an array given that the attribute
311
+ # is documented as an array but the input is not
312
+ if attributes[attribute_map[key]].is_a?(Array)
313
+ transformed_hash["#{key}"] = attributes[attribute_map[key]].map { |v| _deserialize($1, v) }
314
+ end
315
+ elsif !attributes[attribute_map[key]].nil?
316
+ transformed_hash["#{key}"] = _deserialize(type, attributes[attribute_map[key]])
317
+ end
318
+ end
319
+ new(transformed_hash)
320
+ end
321
+
322
+ # Returns the object in the form of hash
323
+ # @return [Hash] Returns the object in the form of hash
324
+ def to_hash
325
+ hash = {}
326
+ self.class.attribute_map.each_pair do |attr, param|
327
+ value = self.send(attr)
328
+ if value.nil?
329
+ is_nullable = self.class.openapi_nullable.include?(attr)
330
+ next if !is_nullable || (is_nullable && !instance_variable_defined?(:"@#{attr}"))
331
+ end
332
+
333
+ hash[param] = _to_hash(value)
334
+ end
335
+ hash
336
+ end
337
+
338
+ end
339
+
340
+ end
@@ -0,0 +1,103 @@
1
+ =begin
2
+ #opencode
3
+
4
+ #opencode api
5
+
6
+ The version of the OpenAPI document: 1.0.0
7
+
8
+ Generated by: https://openapi-generator.tech
9
+ Generator version: 7.18.0
10
+
11
+ =end
12
+
13
+ require 'date'
14
+ require 'time'
15
+
16
+ module OpencodeClient
17
+ module PermissionPattern
18
+ class << self
19
+ # List of class defined in anyOf (OpenAPI v3)
20
+ def openapi_any_of
21
+ [
22
+ :'Array<String>',
23
+ :'String'
24
+ ]
25
+ end
26
+
27
+ # Builds the object
28
+ # @param [Mixed] Data to be matched against the list of anyOf items
29
+ # @return [Object] Returns the model or the data itself
30
+ def build(data)
31
+ # Go through the list of anyOf items and attempt to identify the appropriate one.
32
+ # Note:
33
+ # - No advanced validation of types in some cases (e.g. "x: { type: string }" will happily match { x: 123 })
34
+ # due to the way the deserialization is made in the base_object template (it just casts without verifying).
35
+ # - TODO: scalar values are de facto behaving as if they were nullable.
36
+ # - TODO: logging when debugging is set.
37
+ openapi_any_of.each do |klass|
38
+ begin
39
+ next if klass == :AnyType # "nullable: true"
40
+ return find_and_cast_into_type(klass, data)
41
+ rescue # rescue all errors so we keep iterating even if the current item lookup raises
42
+ end
43
+ end
44
+
45
+ openapi_any_of.include?(:AnyType) ? data : nil
46
+ end
47
+
48
+ private
49
+
50
+ SchemaMismatchError = Class.new(StandardError)
51
+
52
+ # Note: 'File' is missing here because in the regular case we get the data _after_ a call to JSON.parse.
53
+ def find_and_cast_into_type(klass, data)
54
+ return if data.nil?
55
+
56
+ case klass.to_s
57
+ when 'Boolean'
58
+ return data if data.instance_of?(TrueClass) || data.instance_of?(FalseClass)
59
+ when 'Float'
60
+ return data if data.instance_of?(Float)
61
+ when 'Integer'
62
+ return data if data.instance_of?(Integer)
63
+ when 'Time'
64
+ return Time.parse(data)
65
+ when 'Date'
66
+ return Date.iso8601(data)
67
+ when 'String'
68
+ return data if data.instance_of?(String)
69
+ when 'Object' # "type: object"
70
+ return data if data.instance_of?(Hash)
71
+ when /\AArray<(?<sub_type>.+)>\z/ # "type: array"
72
+ if data.instance_of?(Array)
73
+ sub_type = Regexp.last_match[:sub_type]
74
+ return data.map { |item| find_and_cast_into_type(sub_type, item) }
75
+ end
76
+ when /\AHash<String, (?<sub_type>.+)>\z/ # "type: object" with "additionalProperties: { ... }"
77
+ if data.instance_of?(Hash) && data.keys.all? { |k| k.instance_of?(Symbol) || k.instance_of?(String) }
78
+ sub_type = Regexp.last_match[:sub_type]
79
+ return data.each_with_object({}) { |(k, v), hsh| hsh[k] = find_and_cast_into_type(sub_type, v) }
80
+ end
81
+ else # model
82
+ const = OpencodeClient.const_get(klass)
83
+ if const
84
+ if const.respond_to?(:openapi_any_of) # nested anyOf model
85
+ model = const.build(data)
86
+ return model if model
87
+ else
88
+ # raise if data contains keys that are not known to the model
89
+ raise if const.respond_to?(:acceptable_attributes) && !(data.keys - const.acceptable_attributes).empty?
90
+ model = const.build_from_hash(data)
91
+ return model if model
92
+ end
93
+ end
94
+ end
95
+
96
+ raise # if no match by now, raise
97
+ rescue
98
+ raise SchemaMismatchError, "#{data} doesn't match the #{klass} type"
99
+ end
100
+ end
101
+ end
102
+
103
+ end