Class: OpencodeClient::Config
- Inherits:
-
ApiModelBase
- Object
- ApiModelBase
- OpencodeClient::Config
- Defined in:
- lib/opencode_client/models/config.rb
Defined Under Namespace
Classes: EnumAttributeValidator
Instance Attribute Summary collapse
-
#agent ⇒ Object
Returns the value of attribute agent.
-
#autoshare ⇒ Object
deprecated
Deprecated.
Use ‘share’ field instead. Share newly created sessions automatically
-
#autoupdate ⇒ Object
Returns the value of attribute autoupdate.
-
#clerk_code ⇒ Object
THAPE clerk code.
-
#command ⇒ Object
Command configuration, see opencode.ai/docs/commands.
-
#compaction ⇒ Object
Returns the value of attribute compaction.
-
#default_agent ⇒ Object
Default agent to use when none is specified.
-
#disabled_providers ⇒ Object
Disable providers that are loaded automatically.
-
#enabled_providers ⇒ Object
When set, ONLY these providers will be enabled.
-
#enterprise ⇒ Object
Returns the value of attribute enterprise.
-
#experimental ⇒ Object
Returns the value of attribute experimental.
-
#formatter ⇒ Object
Returns the value of attribute formatter.
-
#instructions ⇒ Object
Additional instruction files or patterns to include.
-
#keybinds ⇒ Object
Returns the value of attribute keybinds.
-
#layout ⇒ Object
Returns the value of attribute layout.
-
#log_level ⇒ Object
Returns the value of attribute log_level.
-
#lsp ⇒ Object
Returns the value of attribute lsp.
-
#mcp ⇒ Object
MCP (Model Context Protocol) server configurations.
-
#mode ⇒ Object
Returns the value of attribute mode.
-
#model ⇒ Object
Model to use in the format of provider/model, eg anthropic/claude-2.
-
#permission ⇒ Object
Returns the value of attribute permission.
-
#plugin ⇒ Object
Returns the value of attribute plugin.
-
#provider ⇒ Object
Custom provider configurations and model overrides.
-
#schema ⇒ Object
JSON schema reference for configuration validation.
-
#server ⇒ Object
Returns the value of attribute server.
-
#share ⇒ Object
Control sharing behavior:‘manual’ allows manual sharing via commands, ‘auto’ enables automatic sharing, ‘disabled’ disables all sharing.
-
#small_model ⇒ Object
Small model to use for tasks like title generation in the format of provider/model.
-
#snapshot ⇒ Object
Returns the value of attribute snapshot.
-
#theme ⇒ Object
Theme name to use for the interface.
-
#tools ⇒ Object
Returns the value of attribute tools.
-
#tui ⇒ Object
Returns the value of attribute tui.
-
#username ⇒ Object
Custom username to display in conversations instead of system username.
-
#watcher ⇒ Object
Returns the value of attribute watcher.
Class Method Summary collapse
-
.acceptable_attribute_map ⇒ Object
Returns attribute mapping this model knows about.
-
.acceptable_attributes ⇒ Object
Returns all the JSON keys this model knows about.
-
.attribute_map ⇒ Object
Attribute mapping from ruby-style variable name to JSON key.
-
.build_from_hash(attributes) ⇒ Object
Builds the object from hash.
-
.openapi_nullable ⇒ Object
List of attributes with nullable: true.
-
.openapi_types ⇒ Object
Attribute type mapping.
Instance Method Summary collapse
-
#==(o) ⇒ Object
Checks equality by comparing each attribute.
- #eql?(o) ⇒ Boolean
-
#hash ⇒ Integer
Calculates hash code according to all attributes.
-
#initialize(attributes = {}) ⇒ Config
constructor
Initializes the object.
-
#list_invalid_properties ⇒ Object
Show invalid properties with the reasons.
-
#to_hash ⇒ Hash
Returns the object in the form of hash.
-
#valid? ⇒ Boolean
Check to see if the all the properties in the model are valid.
Methods inherited from ApiModelBase
_deserialize, #_to_hash, #to_body, #to_s
Constructor Details
#initialize(attributes = {}) ⇒ Config
Initializes the object
217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 260 261 262 263 264 265 266 267 268 269 270 271 272 273 274 275 276 277 278 279 280 281 282 283 284 285 286 287 288 289 290 291 292 293 294 295 296 297 298 299 300 301 302 303 304 305 306 307 308 309 310 311 312 313 314 315 316 317 318 319 320 321 322 323 324 325 326 327 328 329 330 331 332 333 334 335 336 337 338 339 340 341 342 343 344 345 346 347 348 349 350 351 352 353 354 355 356 357 358 359 360 361 362 363 364 365 366 367 368 369 370 371 372 373 374 375 376 377 378 |
# File 'lib/opencode_client/models/config.rb', line 217 def initialize(attributes = {}) if (!attributes.is_a?(Hash)) fail ArgumentError, "The input argument (attributes) must be a hash in `OpencodeClient::Config` initialize method" end # check to see if the attribute exists and convert string to symbol for hash key acceptable_attribute_map = self.class.acceptable_attribute_map attributes = attributes.each_with_object({}) { |(k, v), h| if (!acceptable_attribute_map.key?(k.to_sym)) fail ArgumentError, "`#{k}` is not a valid attribute in `OpencodeClient::Config`. Please check the name to make sure it's valid. List of attributes: " + acceptable_attribute_map.keys.inspect end h[k.to_sym] = v } if attributes.key?(:'schema') self.schema = attributes[:'schema'] end if attributes.key?(:'theme') self.theme = attributes[:'theme'] end if attributes.key?(:'keybinds') self.keybinds = attributes[:'keybinds'] end if attributes.key?(:'log_level') self.log_level = attributes[:'log_level'] end if attributes.key?(:'tui') self.tui = attributes[:'tui'] end if attributes.key?(:'server') self.server = attributes[:'server'] end if attributes.key?(:'command') if (value = attributes[:'command']).is_a?(Hash) self.command = value end end if attributes.key?(:'watcher') self.watcher = attributes[:'watcher'] end if attributes.key?(:'plugin') if (value = attributes[:'plugin']).is_a?(Array) self.plugin = value end end if attributes.key?(:'snapshot') self.snapshot = attributes[:'snapshot'] end if attributes.key?(:'share') self.share = attributes[:'share'] end if attributes.key?(:'autoshare') self.autoshare = attributes[:'autoshare'] end if attributes.key?(:'autoupdate') self.autoupdate = attributes[:'autoupdate'] end if attributes.key?(:'disabled_providers') if (value = attributes[:'disabled_providers']).is_a?(Array) self.disabled_providers = value end end if attributes.key?(:'enabled_providers') if (value = attributes[:'enabled_providers']).is_a?(Array) self.enabled_providers = value end end if attributes.key?(:'model') self.model = attributes[:'model'] end if attributes.key?(:'small_model') self.small_model = attributes[:'small_model'] end if attributes.key?(:'default_agent') self.default_agent = attributes[:'default_agent'] end if attributes.key?(:'username') self.username = attributes[:'username'] end if attributes.key?(:'clerk_code') self.clerk_code = attributes[:'clerk_code'] end if attributes.key?(:'mode') self.mode = attributes[:'mode'] end if attributes.key?(:'agent') self.agent = attributes[:'agent'] end if attributes.key?(:'provider') if (value = attributes[:'provider']).is_a?(Hash) self.provider = value end end if attributes.key?(:'mcp') if (value = attributes[:'mcp']).is_a?(Hash) self.mcp = value end end if attributes.key?(:'formatter') self.formatter = attributes[:'formatter'] end if attributes.key?(:'lsp') self.lsp = attributes[:'lsp'] end if attributes.key?(:'instructions') if (value = attributes[:'instructions']).is_a?(Array) self.instructions = value end end if attributes.key?(:'layout') self.layout = attributes[:'layout'] end if attributes.key?(:'permission') self. = attributes[:'permission'] end if attributes.key?(:'tools') if (value = attributes[:'tools']).is_a?(Hash) self.tools = value end end if attributes.key?(:'enterprise') self.enterprise = attributes[:'enterprise'] end if attributes.key?(:'compaction') self.compaction = attributes[:'compaction'] end if attributes.key?(:'experimental') self.experimental = attributes[:'experimental'] end end |
Instance Attribute Details
#agent ⇒ Object
Returns the value of attribute agent.
72 73 74 |
# File 'lib/opencode_client/models/config.rb', line 72 def agent @agent end |
#autoshare ⇒ Object
Use ‘share’ field instead. Share newly created sessions automatically
45 46 47 |
# File 'lib/opencode_client/models/config.rb', line 45 def autoshare @autoshare end |
#autoupdate ⇒ Object
Returns the value of attribute autoupdate.
47 48 49 |
# File 'lib/opencode_client/models/config.rb', line 47 def autoupdate @autoupdate end |
#clerk_code ⇒ Object
THAPE clerk code. Auto-populated from SSO when available
68 69 70 |
# File 'lib/opencode_client/models/config.rb', line 68 def clerk_code @clerk_code end |
#command ⇒ Object
Command configuration, see opencode.ai/docs/commands
33 34 35 |
# File 'lib/opencode_client/models/config.rb', line 33 def command @command end |
#compaction ⇒ Object
Returns the value of attribute compaction.
95 96 97 |
# File 'lib/opencode_client/models/config.rb', line 95 def compaction @compaction end |
#default_agent ⇒ Object
Default agent to use when none is specified. Must be a primary agent. Falls back to ‘build’ if not set or if the specified agent is invalid.
62 63 64 |
# File 'lib/opencode_client/models/config.rb', line 62 def default_agent @default_agent end |
#disabled_providers ⇒ Object
Disable providers that are loaded automatically
50 51 52 |
# File 'lib/opencode_client/models/config.rb', line 50 def disabled_providers @disabled_providers end |
#enabled_providers ⇒ Object
When set, ONLY these providers will be enabled. All other providers will be ignored
53 54 55 |
# File 'lib/opencode_client/models/config.rb', line 53 def enabled_providers @enabled_providers end |
#enterprise ⇒ Object
Returns the value of attribute enterprise.
93 94 95 |
# File 'lib/opencode_client/models/config.rb', line 93 def enterprise @enterprise end |
#experimental ⇒ Object
Returns the value of attribute experimental.
97 98 99 |
# File 'lib/opencode_client/models/config.rb', line 97 def experimental @experimental end |
#formatter ⇒ Object
Returns the value of attribute formatter.
80 81 82 |
# File 'lib/opencode_client/models/config.rb', line 80 def formatter @formatter end |
#instructions ⇒ Object
Additional instruction files or patterns to include
85 86 87 |
# File 'lib/opencode_client/models/config.rb', line 85 def instructions @instructions end |
#keybinds ⇒ Object
Returns the value of attribute keybinds.
24 25 26 |
# File 'lib/opencode_client/models/config.rb', line 24 def keybinds @keybinds end |
#layout ⇒ Object
Returns the value of attribute layout.
87 88 89 |
# File 'lib/opencode_client/models/config.rb', line 87 def layout @layout end |
#log_level ⇒ Object
Returns the value of attribute log_level.
26 27 28 |
# File 'lib/opencode_client/models/config.rb', line 26 def log_level @log_level end |
#lsp ⇒ Object
Returns the value of attribute lsp.
82 83 84 |
# File 'lib/opencode_client/models/config.rb', line 82 def lsp @lsp end |
#mcp ⇒ Object
MCP (Model Context Protocol) server configurations
78 79 80 |
# File 'lib/opencode_client/models/config.rb', line 78 def mcp @mcp end |
#mode ⇒ Object
Returns the value of attribute mode.
70 71 72 |
# File 'lib/opencode_client/models/config.rb', line 70 def mode @mode end |
#model ⇒ Object
Model to use in the format of provider/model, eg anthropic/claude-2
56 57 58 |
# File 'lib/opencode_client/models/config.rb', line 56 def model @model end |
#permission ⇒ Object
Returns the value of attribute permission.
89 90 91 |
# File 'lib/opencode_client/models/config.rb', line 89 def end |
#plugin ⇒ Object
Returns the value of attribute plugin.
37 38 39 |
# File 'lib/opencode_client/models/config.rb', line 37 def plugin @plugin end |
#provider ⇒ Object
Custom provider configurations and model overrides
75 76 77 |
# File 'lib/opencode_client/models/config.rb', line 75 def provider @provider end |
#schema ⇒ Object
JSON schema reference for configuration validation
19 20 21 |
# File 'lib/opencode_client/models/config.rb', line 19 def schema @schema end |
#server ⇒ Object
Returns the value of attribute server.
30 31 32 |
# File 'lib/opencode_client/models/config.rb', line 30 def server @server end |
#share ⇒ Object
Control sharing behavior:‘manual’ allows manual sharing via commands, ‘auto’ enables automatic sharing, ‘disabled’ disables all sharing
42 43 44 |
# File 'lib/opencode_client/models/config.rb', line 42 def share @share end |
#small_model ⇒ Object
Small model to use for tasks like title generation in the format of provider/model
59 60 61 |
# File 'lib/opencode_client/models/config.rb', line 59 def small_model @small_model end |
#snapshot ⇒ Object
Returns the value of attribute snapshot.
39 40 41 |
# File 'lib/opencode_client/models/config.rb', line 39 def snapshot @snapshot end |
#theme ⇒ Object
Theme name to use for the interface
22 23 24 |
# File 'lib/opencode_client/models/config.rb', line 22 def theme @theme end |
#tools ⇒ Object
Returns the value of attribute tools.
91 92 93 |
# File 'lib/opencode_client/models/config.rb', line 91 def tools @tools end |
#tui ⇒ Object
Returns the value of attribute tui.
28 29 30 |
# File 'lib/opencode_client/models/config.rb', line 28 def tui @tui end |
#username ⇒ Object
Custom username to display in conversations instead of system username
65 66 67 |
# File 'lib/opencode_client/models/config.rb', line 65 def username @username end |
#watcher ⇒ Object
Returns the value of attribute watcher.
35 36 37 |
# File 'lib/opencode_client/models/config.rb', line 35 def watcher @watcher end |
Class Method Details
.acceptable_attribute_map ⇒ Object
Returns attribute mapping this model knows about
161 162 163 |
# File 'lib/opencode_client/models/config.rb', line 161 def self.acceptable_attribute_map attribute_map end |
.acceptable_attributes ⇒ Object
Returns all the JSON keys this model knows about
166 167 168 |
# File 'lib/opencode_client/models/config.rb', line 166 def self.acceptable_attributes acceptable_attribute_map.values end |
.attribute_map ⇒ Object
Attribute mapping from ruby-style variable name to JSON key.
122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 |
# File 'lib/opencode_client/models/config.rb', line 122 def self.attribute_map { :'schema' => :'$schema', :'theme' => :'theme', :'keybinds' => :'keybinds', :'log_level' => :'logLevel', :'tui' => :'tui', :'server' => :'server', :'command' => :'command', :'watcher' => :'watcher', :'plugin' => :'plugin', :'snapshot' => :'snapshot', :'share' => :'share', :'autoshare' => :'autoshare', :'autoupdate' => :'autoupdate', :'disabled_providers' => :'disabled_providers', :'enabled_providers' => :'enabled_providers', :'model' => :'model', :'small_model' => :'small_model', :'default_agent' => :'default_agent', :'username' => :'username', :'clerk_code' => :'clerk_code', :'mode' => :'mode', :'agent' => :'agent', :'provider' => :'provider', :'mcp' => :'mcp', :'formatter' => :'formatter', :'lsp' => :'lsp', :'instructions' => :'instructions', :'layout' => :'layout', :'permission' => :'permission', :'tools' => :'tools', :'enterprise' => :'enterprise', :'compaction' => :'compaction', :'experimental' => :'experimental' } end |
.build_from_hash(attributes) ⇒ Object
Builds the object from hash
462 463 464 465 466 467 468 469 470 471 472 473 474 475 476 477 478 479 480 |
# File 'lib/opencode_client/models/config.rb', line 462 def self.build_from_hash(attributes) return nil unless attributes.is_a?(Hash) attributes = attributes.transform_keys(&:to_sym) transformed_hash = {} openapi_types.each_pair do |key, type| if attributes.key?(attribute_map[key]) && attributes[attribute_map[key]].nil? transformed_hash["#{key}"] = nil elsif type =~ /\AArray<(.*)>/i # check to ensure the input is an array given that the attribute # is documented as an array but the input is not if attributes[attribute_map[key]].is_a?(Array) transformed_hash["#{key}"] = attributes[attribute_map[key]].map { |v| _deserialize($1, v) } end elsif !attributes[attribute_map[key]].nil? transformed_hash["#{key}"] = _deserialize(type, attributes[attribute_map[key]]) end end new(transformed_hash) end |
.openapi_nullable ⇒ Object
List of attributes with nullable: true
210 211 212 213 |
# File 'lib/opencode_client/models/config.rb', line 210 def self.openapi_nullable Set.new([ ]) end |
.openapi_types ⇒ Object
Attribute type mapping.
171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 |
# File 'lib/opencode_client/models/config.rb', line 171 def self.openapi_types { :'schema' => :'String', :'theme' => :'String', :'keybinds' => :'KeybindsConfig', :'log_level' => :'LogLevel', :'tui' => :'ConfigTui', :'server' => :'ServerConfig', :'command' => :'Hash<String, ConfigCommandValue>', :'watcher' => :'ConfigWatcher', :'plugin' => :'Array<String>', :'snapshot' => :'Boolean', :'share' => :'String', :'autoshare' => :'Boolean', :'autoupdate' => :'ConfigAutoupdate', :'disabled_providers' => :'Array<String>', :'enabled_providers' => :'Array<String>', :'model' => :'String', :'small_model' => :'String', :'default_agent' => :'String', :'username' => :'String', :'clerk_code' => :'String', :'mode' => :'ConfigMode', :'agent' => :'ConfigAgent', :'provider' => :'Hash<String, ProviderConfig>', :'mcp' => :'Hash<String, McpAddRequestConfig>', :'formatter' => :'ConfigFormatter', :'lsp' => :'ConfigLsp', :'instructions' => :'Array<String>', :'layout' => :'LayoutConfig', :'permission' => :'AgentConfigPermission', :'tools' => :'Hash<String, Boolean>', :'enterprise' => :'ConfigEnterprise', :'compaction' => :'ConfigCompaction', :'experimental' => :'ConfigExperimental' } end |
Instance Method Details
#==(o) ⇒ Object
Checks equality by comparing each attribute.
409 410 411 412 413 414 415 416 417 418 419 420 421 422 423 424 425 426 427 428 429 430 431 432 433 434 435 436 437 438 439 440 441 442 443 444 445 |
# File 'lib/opencode_client/models/config.rb', line 409 def ==(o) return true if self.equal?(o) self.class == o.class && schema == o.schema && theme == o.theme && keybinds == o.keybinds && log_level == o.log_level && tui == o.tui && server == o.server && command == o.command && watcher == o.watcher && plugin == o.plugin && snapshot == o.snapshot && share == o.share && autoshare == o.autoshare && autoupdate == o.autoupdate && disabled_providers == o.disabled_providers && enabled_providers == o.enabled_providers && model == o.model && small_model == o.small_model && default_agent == o.default_agent && username == o.username && clerk_code == o.clerk_code && mode == o.mode && agent == o.agent && provider == o.provider && mcp == o.mcp && formatter == o.formatter && lsp == o.lsp && instructions == o.instructions && layout == o.layout && == o. && tools == o.tools && enterprise == o.enterprise && compaction == o.compaction && experimental == o.experimental end |
#eql?(o) ⇒ Boolean
449 450 451 |
# File 'lib/opencode_client/models/config.rb', line 449 def eql?(o) self == o end |
#hash ⇒ Integer
Calculates hash code according to all attributes.
455 456 457 |
# File 'lib/opencode_client/models/config.rb', line 455 def hash [schema, theme, keybinds, log_level, tui, server, command, watcher, plugin, snapshot, share, autoshare, autoupdate, disabled_providers, enabled_providers, model, small_model, default_agent, username, clerk_code, mode, agent, provider, mcp, formatter, lsp, instructions, layout, , tools, enterprise, compaction, experimental].hash end |
#list_invalid_properties ⇒ Object
Show invalid properties with the reasons. Usually used together with valid?
382 383 384 385 386 |
# File 'lib/opencode_client/models/config.rb', line 382 def list_invalid_properties warn '[DEPRECATED] the `list_invalid_properties` method is obsolete' invalid_properties = Array.new invalid_properties end |
#to_hash ⇒ Hash
Returns the object in the form of hash
484 485 486 487 488 489 490 491 492 493 494 495 496 |
# File 'lib/opencode_client/models/config.rb', line 484 def to_hash hash = {} self.class.attribute_map.each_pair do |attr, param| value = self.send(attr) if value.nil? is_nullable = self.class.openapi_nullable.include?(attr) next if !is_nullable || (is_nullable && !instance_variable_defined?(:"@#{attr}")) end hash[param] = _to_hash(value) end hash end |
#valid? ⇒ Boolean
Check to see if the all the properties in the model are valid
390 391 392 393 394 395 |
# File 'lib/opencode_client/models/config.rb', line 390 def valid? warn '[DEPRECATED] the `valid?` method is obsolete' share_validator = EnumAttributeValidator.new('String', ["manual", "auto", "disabled"]) return false unless share_validator.valid?(@share) true end |