Packages
opencode_sdk
0.1.68
0.1.84
0.1.83
0.1.82
0.1.81
0.1.80
0.1.79
0.1.78
0.1.77
0.1.76
0.1.75
0.1.74
0.1.73
0.1.72
0.1.71
0.1.70
0.1.69
0.1.68
0.1.67
0.1.66
0.1.65
0.1.64
0.1.63
0.1.62
0.1.61
0.1.60
0.1.59
0.1.58
0.1.57
0.1.56
0.1.55
0.1.54
0.1.53
0.1.52
0.1.51
0.1.50
0.1.49
0.1.48
0.1.47
0.1.46
0.1.45
0.1.44
0.1.43
0.1.42
0.1.41
0.1.40
0.1.39
0.1.38
0.1.37
0.1.36
0.1.35
0.1.34
0.1.33
0.1.32
0.1.31
0.1.30
0.1.29
0.1.28
0.1.27
0.1.26
0.1.25
0.1.24
0.1.23
0.1.22
0.1.21
0.1.20
0.1.19
0.1.18
0.1.17
0.1.16
0.1.15
0.1.14
0.1.13
0.1.12
0.1.11
0.1.10
0.1.9
0.1.8
0.1.7
0.1.6
0.1.5
0.1.4
0.1.3
0.1.2
0.1.1
0.1.0
Unofficial OpenCode SDK for Elixir. A complete Elixir SDK for OpenCode, providing server creation, session management, messaging, file operations, and more. Mirrors the functionality of the official JavaScript SDK (@opencode-ai/sdk). Not affiliated with or built by the OpenCode team.
Current section
Files
Jump to
Current section
Files
lib/opencode/generated/config.ex
defmodule OpenCode.Generated.Config do
@moduledoc """
Provides API endpoints related to config
"""
@default_client OpenCode.Client
@doc """
Get configuration
Retrieve the current OpenCode configuration settings and preferences.
## Options
* `directory`
* `workspace`
"""
@spec config_get(opts :: keyword) ::
{:ok, OpenCode.Generated.Config.t()} | {:error, OpenCode.Generated.BadRequestError.t()}
def config_get(opts \\ []) do
client = opts[:client] || @default_client
query = Keyword.take(opts, [:directory, :workspace])
client.request(%{
args: [],
call: {OpenCode.Generated.Config, :config_get},
url: "/config",
method: :get,
query: query,
response: [
{200, {OpenCode.Generated.Config, :t}},
{400, {OpenCode.Generated.BadRequestError, :t}}
],
opts: opts
})
end
@type config_providers_200_json_resp :: %{
default: map,
providers: [OpenCode.Generated.Provider.t()]
}
@doc """
List config providers
Get a list of all configured AI providers and their default models.
## Options
* `directory`
* `workspace`
"""
@spec config_providers(opts :: keyword) ::
{:ok, OpenCode.Generated.Config.config_providers_200_json_resp()}
| {:error, OpenCode.Generated.BadRequestError.t()}
def config_providers(opts \\ []) do
client = opts[:client] || @default_client
query = Keyword.take(opts, [:directory, :workspace])
client.request(%{
args: [],
call: {OpenCode.Generated.Config, :config_providers},
url: "/config/providers",
method: :get,
query: query,
response: [
{200, {OpenCode.Generated.Config, :config_providers_200_json_resp}},
{400, {OpenCode.Generated.BadRequestError, :t}}
],
opts: opts
})
end
@doc """
Update configuration
Update OpenCode configuration settings and preferences.
## Options
* `directory`
* `workspace`
## Request Body
**Content Types**: `application/json`
"""
@spec config_update(body :: OpenCode.Generated.Config.t(), opts :: keyword) ::
{:ok, OpenCode.Generated.Config.t()}
| {:error,
OpenCode.Generated.EffectHttpApiErrorBadRequest.t()
| OpenCode.Generated.InvalidRequestError.t()}
def config_update(body, opts \\ []) do
client = opts[:client] || @default_client
query = Keyword.take(opts, [:directory, :workspace])
client.request(%{
args: [body: body],
call: {OpenCode.Generated.Config, :config_update},
url: "/config",
body: body,
method: :patch,
query: query,
request: [{"application/json", {OpenCode.Generated.Config, :t}}],
response: [
{200, {OpenCode.Generated.Config, :t}},
{400,
{:union,
[
{OpenCode.Generated.EffectHttpApiErrorBadRequest, :t},
{OpenCode.Generated.InvalidRequestError, :t}
]}}
],
opts: opts
})
end
@type t :: %__MODULE__{
agent: OpenCode.Generated.ConfigAgent.t() | nil,
attachment: OpenCode.Generated.AttachmentConfig.t() | nil,
autoshare: boolean | nil,
autoupdate: boolean | String.t() | nil,
command: map | nil,
compaction: OpenCode.Generated.ConfigCompaction.t() | nil,
default_agent: String.t() | nil,
disabled_providers: [String.t()] | nil,
enabled_providers: [String.t()] | nil,
enterprise: OpenCode.Generated.ConfigEnterprise.t() | nil,
experimental: OpenCode.Generated.ConfigExperimental.t() | nil,
formatter: boolean | map | nil,
instructions: [String.t()] | nil,
layout: String.t() | nil,
log_level: String.t() | nil,
lsp: boolean | map | nil,
mcp: map | nil,
mode: OpenCode.Generated.ConfigMode.t() | nil,
model: String.t() | nil,
permission: map | String.t() | nil,
plugin: [String.t() | [any]] | nil,
provider: map | nil,
reference: map | nil,
schema: String.t() | nil,
server: OpenCode.Generated.ServerConfig.t() | nil,
share: String.t() | nil,
shell: String.t() | nil,
skills: OpenCode.Generated.ConfigSkills.t() | nil,
small_model: String.t() | nil,
snapshot: boolean | nil,
tool_output: OpenCode.Generated.ConfigToolOutput.t() | nil,
tools: map | nil,
username: String.t() | nil,
watcher: OpenCode.Generated.ConfigWatcher.t() | nil
}
defstruct [
:agent,
:attachment,
:autoshare,
:autoupdate,
:command,
:compaction,
:default_agent,
:disabled_providers,
:enabled_providers,
:enterprise,
:experimental,
:formatter,
:instructions,
:layout,
:log_level,
:lsp,
:mcp,
:mode,
:model,
:permission,
:plugin,
:provider,
:reference,
:schema,
:server,
:share,
:shell,
:skills,
:small_model,
:snapshot,
:tool_output,
:tools,
:username,
:watcher
]
@doc false
@spec __fields__(atom) :: keyword
def __fields__(type \\ :t)
def __fields__(:config_providers_200_json_resp) do
[default: :map, providers: [{OpenCode.Generated.Provider, :t}]]
end
def __fields__(:t) do
[
agent: {OpenCode.Generated.ConfigAgent, :t},
attachment: {OpenCode.Generated.AttachmentConfig, :t},
autoshare: :boolean,
autoupdate: {:union, [:boolean, const: "notify"]},
command: :map,
compaction: {OpenCode.Generated.ConfigCompaction, :t},
default_agent: :string,
disabled_providers: [:string],
enabled_providers: [:string],
enterprise: {OpenCode.Generated.ConfigEnterprise, :t},
experimental: {OpenCode.Generated.ConfigExperimental, :t},
formatter: {:union, [:boolean, :map]},
instructions: [:string],
layout: {:enum, ["auto", "stretch"]},
log_level: {:enum, ["DEBUG", "INFO", "WARN", "ERROR"]},
lsp: {:union, [:boolean, :map]},
mcp: :map,
mode: {OpenCode.Generated.ConfigMode, :t},
model: :string,
permission: {:union, [:map, enum: ["ask", "allow", "deny"]]},
plugin: [union: [:string, [:unknown]]],
provider: :map,
reference: :map,
schema: :string,
server: {OpenCode.Generated.ServerConfig, :t},
share: {:enum, ["manual", "auto", "disabled"]},
shell: :string,
skills: {OpenCode.Generated.ConfigSkills, :t},
small_model: :string,
snapshot: :boolean,
tool_output: {OpenCode.Generated.ConfigToolOutput, :t},
tools: :map,
username: :string,
watcher: {OpenCode.Generated.ConfigWatcher, :t}
]
end
end