Class: OpencodeClient::Config

Inherits:
ApiModelBase show all
Defined in:
lib/opencode_client/models/config.rb

Defined Under Namespace

Classes: EnumAttributeValidator

Instance Attribute Summary collapse

Class Method Summary collapse

Instance Method Summary collapse

Methods inherited from ApiModelBase

_deserialize, #_to_hash, #to_body, #to_s

Constructor Details

#initialize(attributes = {}) ⇒ Config

Initializes the object

Parameters:

  • attributes (Hash) (defaults to: {})

    Model attributes in the form of hash



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.permission = 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

#agentObject

Returns the value of attribute agent.



72
73
74
# File 'lib/opencode_client/models/config.rb', line 72

def agent
  @agent
end

#autoshareObject

Deprecated.

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

#autoupdateObject

Returns the value of attribute autoupdate.



47
48
49
# File 'lib/opencode_client/models/config.rb', line 47

def autoupdate
  @autoupdate
end

#clerk_codeObject

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

#commandObject

Command configuration, see opencode.ai/docs/commands



33
34
35
# File 'lib/opencode_client/models/config.rb', line 33

def command
  @command
end

#compactionObject

Returns the value of attribute compaction.



95
96
97
# File 'lib/opencode_client/models/config.rb', line 95

def compaction
  @compaction
end

#default_agentObject

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_providersObject

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_providersObject

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

#enterpriseObject

Returns the value of attribute enterprise.



93
94
95
# File 'lib/opencode_client/models/config.rb', line 93

def enterprise
  @enterprise
end

#experimentalObject

Returns the value of attribute experimental.



97
98
99
# File 'lib/opencode_client/models/config.rb', line 97

def experimental
  @experimental
end

#formatterObject

Returns the value of attribute formatter.



80
81
82
# File 'lib/opencode_client/models/config.rb', line 80

def formatter
  @formatter
end

#instructionsObject

Additional instruction files or patterns to include



85
86
87
# File 'lib/opencode_client/models/config.rb', line 85

def instructions
  @instructions
end

#keybindsObject

Returns the value of attribute keybinds.



24
25
26
# File 'lib/opencode_client/models/config.rb', line 24

def keybinds
  @keybinds
end

#layoutObject

Returns the value of attribute layout.



87
88
89
# File 'lib/opencode_client/models/config.rb', line 87

def layout
  @layout
end

#log_levelObject

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

#lspObject

Returns the value of attribute lsp.



82
83
84
# File 'lib/opencode_client/models/config.rb', line 82

def lsp
  @lsp
end

#mcpObject

MCP (Model Context Protocol) server configurations



78
79
80
# File 'lib/opencode_client/models/config.rb', line 78

def mcp
  @mcp
end

#modeObject

Returns the value of attribute mode.



70
71
72
# File 'lib/opencode_client/models/config.rb', line 70

def mode
  @mode
end

#modelObject

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

#permissionObject

Returns the value of attribute permission.



89
90
91
# File 'lib/opencode_client/models/config.rb', line 89

def permission
  @permission
end

#pluginObject

Returns the value of attribute plugin.



37
38
39
# File 'lib/opencode_client/models/config.rb', line 37

def plugin
  @plugin
end

#providerObject

Custom provider configurations and model overrides



75
76
77
# File 'lib/opencode_client/models/config.rb', line 75

def provider
  @provider
end

#schemaObject

JSON schema reference for configuration validation



19
20
21
# File 'lib/opencode_client/models/config.rb', line 19

def schema
  @schema
end

#serverObject

Returns the value of attribute server.



30
31
32
# File 'lib/opencode_client/models/config.rb', line 30

def server
  @server
end

#shareObject

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_modelObject

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

#snapshotObject

Returns the value of attribute snapshot.



39
40
41
# File 'lib/opencode_client/models/config.rb', line 39

def snapshot
  @snapshot
end

#themeObject

Theme name to use for the interface



22
23
24
# File 'lib/opencode_client/models/config.rb', line 22

def theme
  @theme
end

#toolsObject

Returns the value of attribute tools.



91
92
93
# File 'lib/opencode_client/models/config.rb', line 91

def tools
  @tools
end

#tuiObject

Returns the value of attribute tui.



28
29
30
# File 'lib/opencode_client/models/config.rb', line 28

def tui
  @tui
end

#usernameObject

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

#watcherObject

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_mapObject

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_attributesObject

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_mapObject

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

Parameters:

  • attributes (Hash)

    Model attributes in the form of hash

Returns:

  • (Object)

    Returns the model itself



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_nullableObject

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_typesObject

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.

Parameters:

  • Object (Object)

    to be compared



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 &&
      permission == o.permission &&
      tools == o.tools &&
      enterprise == o.enterprise &&
      compaction == o.compaction &&
      experimental == o.experimental
end

#eql?(o) ⇒ Boolean

Parameters:

  • Object (Object)

    to be compared

Returns:

  • (Boolean)

See Also:

  • `==` method


449
450
451
# File 'lib/opencode_client/models/config.rb', line 449

def eql?(o)
  self == o
end

#hashInteger

Calculates hash code according to all attributes.

Returns:

  • (Integer)

    Hash code



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, permission, tools, enterprise, compaction, experimental].hash
end

#list_invalid_propertiesObject

Show invalid properties with the reasons. Usually used together with valid?

Returns:

  • Array for valid properties with the reasons



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_hashHash

Returns the object in the form of hash

Returns:

  • (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

Returns:

  • (Boolean)

    true if the model is 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