opencodesdk

package module
v0.0.2 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Aug 11, 2025 License: Apache-2.0 Imports: 17 Imported by: 0

README

Opencode SDK Go API Library

Go Reference

The Opencode SDK Go library provides convenient access to the Opencode SDK REST API from applications written in Go.

It is generated with Stainless.

Installation

import (
	"github.com/manno23/opencode-sdk-go" // imported as opencodesdk
)

Or to pin the version:

go get -u 'github.com/manno23/opencode-sdk-go@v0.0.2'

Requirements

This library requires Go 1.18+.

Usage

The full API of this library can be found in api.md.

package main

import (
	"context"
	"fmt"

	"github.com/manno23/opencode-sdk-go"
	"github.com/manno23/opencode-sdk-go/option"
)

func main() {
	client := opencodesdk.NewClient(
		option.WithAPIKey("My API Key"), // defaults to os.LookupEnv("OPENCODE_SDK_API_KEY")
	)
	events, err := client.Event.List(context.TODO())
	if err != nil {
		panic(err.Error())
	}
	fmt.Printf("%+v\n", events)
}

Request fields

The opencodesdk library uses the omitzero semantics from the Go 1.24+ encoding/json release for request fields.

Required primitive fields (int64, string, etc.) feature the tag `json:"...,required"`. These fields are always serialized, even their zero values.

Optional primitive types are wrapped in a param.Opt[T]. These fields can be set with the provided constructors, opencodesdk.String(string), opencodesdk.Int(int64), etc.

Any param.Opt[T], map, slice, struct or string enum uses the tag `json:"...,omitzero"`. Its zero value is considered omitted.

The param.IsOmitted(any) function can confirm the presence of any omitzero field.

p := opencodesdk.ExampleParams{
	ID:   "id_xxx",                  // required property
	Name: opencodesdk.String("..."), // optional property

	Point: opencodesdk.Point{
		X: 0,                  // required field will serialize as 0
		Y: opencodesdk.Int(1), // optional field will serialize as 1
		// ... omitted non-required fields will not be serialized
	},

	Origin: opencodesdk.Origin{}, // the zero value of [Origin] is considered omitted
}

To send null instead of a param.Opt[T], use param.Null[T](). To send null instead of a struct T, use param.NullStruct[T]().

p.Name = param.Null[string]()       // 'null' instead of string
p.Point = param.NullStruct[Point]() // 'null' instead of struct

param.IsNull(p.Name)  // true
param.IsNull(p.Point) // true

Request structs contain a .SetExtraFields(map[string]any) method which can send non-conforming fields in the request body. Extra fields overwrite any struct fields with a matching key. For security reasons, only use SetExtraFields with trusted data.

To send a custom value instead of a struct, use param.Override[T](value).

// In cases where the API specifies a given type,
// but you want to send something else, use [SetExtraFields]:
p.SetExtraFields(map[string]any{
	"x": 0.01, // send "x" as a float instead of int
})

// Send a number instead of an object
custom := param.Override[opencodesdk.FooParams](12)
Request unions

Unions are represented as a struct with fields prefixed by "Of" for each of it's variants, only one field can be non-zero. The non-zero field will be serialized.

Sub-properties of the union can be accessed via methods on the union struct. These methods return a mutable pointer to the underlying data, if present.

// Only one field can be non-zero, use param.IsOmitted() to check if a field is set
type AnimalUnionParam struct {
	OfCat *Cat `json:",omitzero,inline`
	OfDog *Dog `json:",omitzero,inline`
}

animal := AnimalUnionParam{
	OfCat: &Cat{
		Name: "Whiskers",
		Owner: PersonParam{
			Address: AddressParam{Street: "3333 Coyote Hill Rd", Zip: 0},
		},
	},
}

// Mutating a field
if address := animal.GetOwner().GetAddress(); address != nil {
	address.ZipCode = 94304
}
Response objects

All fields in response structs are ordinary value types (not pointers or wrappers). Response structs also include a special JSON field containing metadata about each property.

type Animal struct {
	Name   string `json:"name,nullable"`
	Owners int    `json:"owners"`
	Age    int    `json:"age"`
	JSON   struct {
		Name        respjson.Field
		Owner       respjson.Field
		Age         respjson.Field
		ExtraFields map[string]respjson.Field
	} `json:"-"`
}

To handle optional data, use the .Valid() method on the JSON field. .Valid() returns true if a field is not null, not present, or couldn't be marshaled.

If .Valid() is false, the corresponding field will simply be its zero value.

raw := `{"owners": 1, "name": null}`

var res Animal
json.Unmarshal([]byte(raw), &res)

// Accessing regular fields

res.Owners // 1
res.Name   // ""
res.Age    // 0

// Optional field checks

res.JSON.Owners.Valid() // true
res.JSON.Name.Valid()   // false
res.JSON.Age.Valid()    // false

// Raw JSON values

res.JSON.Owners.Raw()                  // "1"
res.JSON.Name.Raw() == "null"          // true
res.JSON.Name.Raw() == respjson.Null   // true
res.JSON.Age.Raw() == ""               // true
res.JSON.Age.Raw() == respjson.Omitted // true

These .JSON structs also include an ExtraFields map containing any properties in the json response that were not specified in the struct. This can be useful for API features not yet present in the SDK.

body := res.JSON.ExtraFields["my_unexpected_field"].Raw()
Response Unions

In responses, unions are represented by a flattened struct containing all possible fields from each of the object variants. To convert it to a variant use the .AsFooVariant() method or the .AsAny() method if present.

If a response value union contains primitive values, primitive fields will be alongside the properties but prefixed with Of and feature the tag json:"...,inline".

type AnimalUnion struct {
	// From variants [Dog], [Cat]
	Owner Person `json:"owner"`
	// From variant [Dog]
	DogBreed string `json:"dog_breed"`
	// From variant [Cat]
	CatBreed string `json:"cat_breed"`
	// ...

	JSON struct {
		Owner respjson.Field
		// ...
	} `json:"-"`
}

// If animal variant
if animal.Owner.Address.ZipCode == "" {
	panic("missing zip code")
}

// Switch on the variant
switch variant := animal.AsAny().(type) {
case Dog:
case Cat:
default:
	panic("unexpected type")
}
RequestOptions

This library uses the functional options pattern. Functions defined in the option package return a RequestOption, which is a closure that mutates a RequestConfig. These options can be supplied to the client or at individual requests. For example:

client := opencodesdk.NewClient(
	// Adds a header to every request made by the client
	option.WithHeader("X-Some-Header", "custom_header_info"),
)

client.Event.List(context.TODO(), ...,
	// Override the header
	option.WithHeader("X-Some-Header", "some_other_custom_header_info"),
	// Add an undocumented field to the request body, using sjson syntax
	option.WithJSONSet("some.json.path", map[string]string{"my": "object"}),
)

The request option option.WithDebugLog(nil) may be helpful while debugging.

See the full list of request options.

Pagination

This library provides some conveniences for working with paginated list endpoints.

You can use .ListAutoPaging() methods to iterate through items across all pages:

Or you can use simple .List() methods to fetch a single page and receive a standard response object with additional helper methods like .GetNextPage(), e.g.:

Errors

When the API returns a non-success status code, we return an error with type *opencodesdk.Error. This contains the StatusCode, *http.Request, and *http.Response values of the request, as well as the JSON of the error body (much like other response objects in the SDK).

To handle errors, we recommend that you use the errors.As pattern:

_, err := client.Event.List(context.TODO())
if err != nil {
	var apierr *opencodesdk.Error
	if errors.As(err, &apierr) {
		println(string(apierr.DumpRequest(true)))  // Prints the serialized HTTP request
		println(string(apierr.DumpResponse(true))) // Prints the serialized HTTP response
	}
	panic(err.Error()) // GET "/event": 400 Bad Request { ... }
}

When other errors occur, they are returned unwrapped; for example, if HTTP transport fails, you might receive *url.Error wrapping *net.OpError.

Timeouts

Requests do not time out by default; use context to configure a timeout for a request lifecycle.

Note that if a request is retried, the context timeout does not start over. To set a per-retry timeout, use option.WithRequestTimeout().

// This sets the timeout for the request, including all the retries.
ctx, cancel := context.WithTimeout(context.Background(), 5*time.Minute)
defer cancel()
client.Event.List(
	ctx,
	// This sets the per-retry timeout
	option.WithRequestTimeout(20*time.Second),
)
File uploads

Request parameters that correspond to file uploads in multipart requests are typed as io.Reader. The contents of the io.Reader will by default be sent as a multipart form part with the file name of "anonymous_file" and content-type of "application/octet-stream".

The file name and content-type can be customized by implementing Name() string or ContentType() string on the run-time type of io.Reader. Note that os.File implements Name() string, so a file returned by os.Open will be sent with the file name on disk.

We also provide a helper opencodesdk.File(reader io.Reader, filename string, contentType string) which can be used to wrap any io.Reader with the appropriate file name and content type.

Retries

Certain errors will be automatically retried 2 times by default, with a short exponential backoff. We retry by default all connection errors, 408 Request Timeout, 409 Conflict, 429 Rate Limit, and >=500 Internal errors.

You can use the WithMaxRetries option to configure or disable this:

// Configure the default for all requests:
client := opencodesdk.NewClient(
	option.WithMaxRetries(0), // default is 2
)

// Override per-request:
client.Event.List(context.TODO(), option.WithMaxRetries(5))
Accessing raw response data (e.g. response headers)

You can access the raw HTTP response data by using the option.WithResponseInto() request option. This is useful when you need to examine response headers, status codes, or other details.

// Create a variable to store the HTTP response
var response *http.Response
events, err := client.Event.List(context.TODO(), option.WithResponseInto(&response))
if err != nil {
	// handle error
}
fmt.Printf("%+v\n", events)

fmt.Printf("Status Code: %d\n", response.StatusCode)
fmt.Printf("Headers: %+#v\n", response.Header)
Making custom/undocumented requests

This library is typed for convenient access to the documented API. If you need to access undocumented endpoints, params, or response properties, the library can still be used.

Undocumented endpoints

To make requests to undocumented endpoints, you can use client.Get, client.Post, and other HTTP verbs. RequestOptions on the client, such as retries, will be respected when making these requests.

var (
    // params can be an io.Reader, a []byte, an encoding/json serializable object,
    // or a "…Params" struct defined in this library.
    params map[string]any

    // result can be an []byte, *http.Response, a encoding/json deserializable object,
    // or a model defined in this library.
    result *http.Response
)
err := client.Post(context.Background(), "/unspecified", params, &result)
if err != nil {
    …
}
Undocumented request params

To make requests using undocumented parameters, you may use either the option.WithQuerySet() or the option.WithJSONSet() methods.

params := FooNewParams{
    ID:   "id_xxxx",
    Data: FooNewParamsData{
        FirstName: opencodesdk.String("John"),
    },
}
client.Foo.New(context.Background(), params, option.WithJSONSet("data.last_name", "Doe"))
Undocumented response properties

To access undocumented response properties, you may either access the raw JSON of the response as a string with result.JSON.RawJSON(), or get the raw JSON of a particular field on the result with result.JSON.Foo.Raw().

Any fields that are not present on the response struct will be saved and can be accessed by result.JSON.ExtraFields() which returns the extra fields as a map[string]Field.

Middleware

We provide option.WithMiddleware which applies the given middleware to requests.

func Logger(req *http.Request, next option.MiddlewareNext) (res *http.Response, err error) {
	// Before the request
	start := time.Now()
	LogReq(req)

	// Forward the request to the next handler
	res, err = next(req)

	// Handle stuff after the request
	end := time.Now()
	LogRes(res, err, start - end)

    return res, err
}

client := opencodesdk.NewClient(
	option.WithMiddleware(Logger),
)

When multiple middlewares are provided as variadic arguments, the middlewares are applied left to right. If option.WithMiddleware is given multiple times, for example first in the client then the method, the middleware in the client will run first and the middleware given in the method will run next.

You may also replace the default http.Client with option.WithHTTPClient(client). Only one http client is accepted (this overwrites any previous client) and receives requests after any middleware has been applied.

Semantic versioning

This package generally follows SemVer conventions, though certain backwards-incompatible changes may be released as minor versions:

  1. Changes to library internals which are technically public but not intended or documented for external use. (Please open a GitHub issue to let us know if you are relying on such internals.)
  2. Changes that we do not expect to impact the vast majority of users in practice.

We take backwards-compatibility seriously and work hard to ensure you can rely on a smooth upgrade experience.

We are keen for your feedback; please open an issue with questions, bugs, or suggestions.

Contributing

See the contributing documentation.

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Bool

func Bool(b bool) param.Opt[bool]

func BoolPtr

func BoolPtr(v bool) *bool

func DefaultClientOptions

func DefaultClientOptions() []option.RequestOption

DefaultClientOptions read from the environment (OPENCODE_SDK_API_KEY, OPENCODE_SDK_BASE_URL). This should be used to initialize new clients.

func File

func File(rdr io.Reader, filename string, contentType string) file

func Float

func Float(f float64) param.Opt[float64]

func FloatPtr

func FloatPtr(v float64) *float64

func Int

func Int(i int64) param.Opt[int64]

func IntPtr

func IntPtr(v int64) *int64

func Opt

func Opt[T comparable](v T) param.Opt[T]

func Ptr

func Ptr[T any](v T) *T

func String

func String(s string) param.Opt[string]

func StringPtr

func StringPtr(v string) *string

func Time

func Time(t time.Time) param.Opt[time.Time]

func TimePtr

func TimePtr(v time.Time) *time.Time

Types

type AbortedError

type AbortedError struct {
	Data any                          `json:"data,required"`
	Name constant.MessageAbortedError `json:"name,required"`
	// JSON contains metadata for fields, check presence with [respjson.Field.Valid].
	JSON struct {
		Data        respjson.Field
		Name        respjson.Field
		ExtraFields map[string]respjson.Field
		// contains filtered or unexported fields
	} `json:"-"`
}

func (AbortedError) RawJSON

func (r AbortedError) RawJSON() string

Returns the unmodified JSON received from the API

func (*AbortedError) UnmarshalJSON

func (r *AbortedError) UnmarshalJSON(data []byte) error

type AgentListResponse

type AgentListResponse struct {
	// Any of "subagent", "primary", "all".
	Mode        AgentListResponseMode  `json:"mode,required"`
	Name        string                 `json:"name,required"`
	Options     map[string]any         `json:"options,required"`
	Tools       map[string]bool        `json:"tools,required"`
	Description string                 `json:"description"`
	Model       AgentListResponseModel `json:"model"`
	Prompt      string                 `json:"prompt"`
	Temperature float64                `json:"temperature"`
	TopP        float64                `json:"topP"`
	// JSON contains metadata for fields, check presence with [respjson.Field.Valid].
	JSON struct {
		Mode        respjson.Field
		Name        respjson.Field
		Options     respjson.Field
		Tools       respjson.Field
		Description respjson.Field
		Model       respjson.Field
		Prompt      respjson.Field
		Temperature respjson.Field
		TopP        respjson.Field
		ExtraFields map[string]respjson.Field
		// contains filtered or unexported fields
	} `json:"-"`
}

func (AgentListResponse) RawJSON

func (r AgentListResponse) RawJSON() string

Returns the unmodified JSON received from the API

func (*AgentListResponse) UnmarshalJSON

func (r *AgentListResponse) UnmarshalJSON(data []byte) error

type AgentListResponseMode

type AgentListResponseMode string
const (
	AgentListResponseModeSubagent AgentListResponseMode = "subagent"
	AgentListResponseModePrimary  AgentListResponseMode = "primary"
	AgentListResponseModeAll      AgentListResponseMode = "all"
)

type AgentListResponseModel

type AgentListResponseModel struct {
	ModelID    string `json:"modelID,required"`
	ProviderID string `json:"providerID,required"`
	// JSON contains metadata for fields, check presence with [respjson.Field.Valid].
	JSON struct {
		ModelID     respjson.Field
		ProviderID  respjson.Field
		ExtraFields map[string]respjson.Field
		// contains filtered or unexported fields
	} `json:"-"`
}

func (AgentListResponseModel) RawJSON

func (r AgentListResponseModel) RawJSON() string

Returns the unmodified JSON received from the API

func (*AgentListResponseModel) UnmarshalJSON

func (r *AgentListResponseModel) UnmarshalJSON(data []byte) error

type AgentService

type AgentService struct {
	Options []option.RequestOption
}

AgentService contains methods and other services that help with interacting with the opencode-sdk API.

Note, unlike clients, this service does not read variables from the environment automatically. You should not instantiate this service directly, and instead use the NewAgentService method instead.

func NewAgentService

func NewAgentService(opts ...option.RequestOption) (r AgentService)

NewAgentService generates a new service that applies the given options to each request. These options are applied after the parent client's options (if there is one), and before any request-specific options.

func (*AgentService) List

func (r *AgentService) List(ctx context.Context, opts ...option.RequestOption) (res *[]AgentListResponse, err error)

List all agents

type AppGetResponse

type AppGetResponse struct {
	Git      bool               `json:"git,required"`
	Hostname string             `json:"hostname,required"`
	Path     AppGetResponsePath `json:"path,required"`
	Time     AppGetResponseTime `json:"time,required"`
	// JSON contains metadata for fields, check presence with [respjson.Field.Valid].
	JSON struct {
		Git         respjson.Field
		Hostname    respjson.Field
		Path        respjson.Field
		Time        respjson.Field
		ExtraFields map[string]respjson.Field
		// contains filtered or unexported fields
	} `json:"-"`
}

func (AppGetResponse) RawJSON

func (r AppGetResponse) RawJSON() string

Returns the unmodified JSON received from the API

func (*AppGetResponse) UnmarshalJSON

func (r *AppGetResponse) UnmarshalJSON(data []byte) error

type AppGetResponsePath

type AppGetResponsePath struct {
	Config string `json:"config,required"`
	Cwd    string `json:"cwd,required"`
	Data   string `json:"data,required"`
	Root   string `json:"root,required"`
	State  string `json:"state,required"`
	// JSON contains metadata for fields, check presence with [respjson.Field.Valid].
	JSON struct {
		Config      respjson.Field
		Cwd         respjson.Field
		Data        respjson.Field
		Root        respjson.Field
		State       respjson.Field
		ExtraFields map[string]respjson.Field
		// contains filtered or unexported fields
	} `json:"-"`
}

func (AppGetResponsePath) RawJSON

func (r AppGetResponsePath) RawJSON() string

Returns the unmodified JSON received from the API

func (*AppGetResponsePath) UnmarshalJSON

func (r *AppGetResponsePath) UnmarshalJSON(data []byte) error

type AppGetResponseTime

type AppGetResponseTime struct {
	Initialized float64 `json:"initialized"`
	// JSON contains metadata for fields, check presence with [respjson.Field.Valid].
	JSON struct {
		Initialized respjson.Field
		ExtraFields map[string]respjson.Field
		// contains filtered or unexported fields
	} `json:"-"`
}

func (AppGetResponseTime) RawJSON

func (r AppGetResponseTime) RawJSON() string

Returns the unmodified JSON received from the API

func (*AppGetResponseTime) UnmarshalJSON

func (r *AppGetResponseTime) UnmarshalJSON(data []byte) error

type AppService

type AppService struct {
	Options []option.RequestOption
}

AppService contains methods and other services that help with interacting with the opencode-sdk API.

Note, unlike clients, this service does not read variables from the environment automatically. You should not instantiate this service directly, and instead use the NewAppService method instead.

func NewAppService

func NewAppService(opts ...option.RequestOption) (r AppService)

NewAppService generates a new service that applies the given options to each request. These options are applied after the parent client's options (if there is one), and before any request-specific options.

func (*AppService) Get

func (r *AppService) Get(ctx context.Context, opts ...option.RequestOption) (res *AppGetResponse, err error)

Get app info

func (*AppService) Initialize

func (r *AppService) Initialize(ctx context.Context, opts ...option.RequestOption) (res *bool, err error)

Initialize the app

type AssistantMessage

type AssistantMessage struct {
	ID         string                     `json:"id,required"`
	Cost       float64                    `json:"cost,required"`
	Mode       string                     `json:"mode,required"`
	ModelID    string                     `json:"modelID,required"`
	Path       AssistantMessagePath       `json:"path,required"`
	ProviderID string                     `json:"providerID,required"`
	Role       constant.Assistant         `json:"role,required"`
	SessionID  string                     `json:"sessionID,required"`
	System     []string                   `json:"system,required"`
	Time       AssistantMessageTime       `json:"time,required"`
	Tokens     AssistantMessageTokens     `json:"tokens,required"`
	Error      AssistantMessageErrorUnion `json:"error"`
	Summary    bool                       `json:"summary"`
	// JSON contains metadata for fields, check presence with [respjson.Field.Valid].
	JSON struct {
		ID          respjson.Field
		Cost        respjson.Field
		Mode        respjson.Field
		ModelID     respjson.Field
		Path        respjson.Field
		ProviderID  respjson.Field
		Role        respjson.Field
		SessionID   respjson.Field
		System      respjson.Field
		Time        respjson.Field
		Tokens      respjson.Field
		Error       respjson.Field
		Summary     respjson.Field
		ExtraFields map[string]respjson.Field
		// contains filtered or unexported fields
	} `json:"-"`
}

func (AssistantMessage) RawJSON

func (r AssistantMessage) RawJSON() string

Returns the unmodified JSON received from the API

func (*AssistantMessage) UnmarshalJSON

func (r *AssistantMessage) UnmarshalJSON(data []byte) error

type AssistantMessageErrorUnion

type AssistantMessageErrorUnion struct {
	// This field is a union of [ProviderAuthErrorData], [UnknownErrorData], [any],
	// [any]
	Data AssistantMessageErrorUnionData `json:"data"`
	// Any of "ProviderAuthError", "UnknownError", "MessageOutputLengthError",
	// "MessageAbortedError".
	Name string `json:"name"`
	JSON struct {
		Data respjson.Field
		Name respjson.Field
		// contains filtered or unexported fields
	} `json:"-"`
}

AssistantMessageErrorUnion contains all possible properties and values from ProviderAuthError, UnknownError, OutputLengthError, AbortedError.

Use the AssistantMessageErrorUnion.AsAny method to switch on the variant.

Use the methods beginning with 'As' to cast the union to one of its variants.

func (AssistantMessageErrorUnion) AsAny

func (u AssistantMessageErrorUnion) AsAny() anyAssistantMessageError

Use the following switch statement to find the correct variant

switch variant := AssistantMessageErrorUnion.AsAny().(type) {
case opencodesdk.ProviderAuthError:
case opencodesdk.UnknownError:
case opencodesdk.OutputLengthError:
case opencodesdk.AbortedError:
default:
  fmt.Errorf("no variant present")
}

func (AssistantMessageErrorUnion) AsMessageAbortedError

func (u AssistantMessageErrorUnion) AsMessageAbortedError() (v AbortedError)

func (AssistantMessageErrorUnion) AsMessageOutputLengthError

func (u AssistantMessageErrorUnion) AsMessageOutputLengthError() (v OutputLengthError)

func (AssistantMessageErrorUnion) AsProviderAuthError

func (u AssistantMessageErrorUnion) AsProviderAuthError() (v ProviderAuthError)

func (AssistantMessageErrorUnion) AsUnknownError

func (u AssistantMessageErrorUnion) AsUnknownError() (v UnknownError)

func (AssistantMessageErrorUnion) RawJSON

func (u AssistantMessageErrorUnion) RawJSON() string

Returns the unmodified JSON received from the API

func (*AssistantMessageErrorUnion) UnmarshalJSON

func (r *AssistantMessageErrorUnion) UnmarshalJSON(data []byte) error

type AssistantMessageErrorUnionData

type AssistantMessageErrorUnionData struct {
	// This field will be present if the value is a [any] instead of an object.
	OfAbortedErrorData any    `json:",inline"`
	Message            string `json:"message"`
	// This field is from variant [ProviderAuthErrorData].
	ProviderID string `json:"providerID"`
	JSON       struct {
		OfAbortedErrorData respjson.Field
		Message            respjson.Field
		ProviderID         respjson.Field
		// contains filtered or unexported fields
	} `json:"-"`
}

AssistantMessageErrorUnionData is an implicit subunion of AssistantMessageErrorUnion. AssistantMessageErrorUnionData provides convenient access to the sub-properties of the union.

For type safety it is recommended to directly use a variant of the AssistantMessageErrorUnion.

If the underlying value is not a json object, one of the following properties will be valid: OfAbortedErrorData]

func (*AssistantMessageErrorUnionData) UnmarshalJSON

func (r *AssistantMessageErrorUnionData) UnmarshalJSON(data []byte) error

type AssistantMessagePath

type AssistantMessagePath struct {
	Cwd  string `json:"cwd,required"`
	Root string `json:"root,required"`
	// JSON contains metadata for fields, check presence with [respjson.Field.Valid].
	JSON struct {
		Cwd         respjson.Field
		Root        respjson.Field
		ExtraFields map[string]respjson.Field
		// contains filtered or unexported fields
	} `json:"-"`
}

func (AssistantMessagePath) RawJSON

func (r AssistantMessagePath) RawJSON() string

Returns the unmodified JSON received from the API

func (*AssistantMessagePath) UnmarshalJSON

func (r *AssistantMessagePath) UnmarshalJSON(data []byte) error

type AssistantMessageTime

type AssistantMessageTime struct {
	Created   float64 `json:"created,required"`
	Completed float64 `json:"completed"`
	// JSON contains metadata for fields, check presence with [respjson.Field.Valid].
	JSON struct {
		Created     respjson.Field
		Completed   respjson.Field
		ExtraFields map[string]respjson.Field
		// contains filtered or unexported fields
	} `json:"-"`
}

func (AssistantMessageTime) RawJSON

func (r AssistantMessageTime) RawJSON() string

Returns the unmodified JSON received from the API

func (*AssistantMessageTime) UnmarshalJSON

func (r *AssistantMessageTime) UnmarshalJSON(data []byte) error

type AssistantMessageTokens

type AssistantMessageTokens struct {
	Cache     AssistantMessageTokensCache `json:"cache,required"`
	Input     float64                     `json:"input,required"`
	Output    float64                     `json:"output,required"`
	Reasoning float64                     `json:"reasoning,required"`
	// JSON contains metadata for fields, check presence with [respjson.Field.Valid].
	JSON struct {
		Cache       respjson.Field
		Input       respjson.Field
		Output      respjson.Field
		Reasoning   respjson.Field
		ExtraFields map[string]respjson.Field
		// contains filtered or unexported fields
	} `json:"-"`
}

func (AssistantMessageTokens) RawJSON

func (r AssistantMessageTokens) RawJSON() string

Returns the unmodified JSON received from the API

func (*AssistantMessageTokens) UnmarshalJSON

func (r *AssistantMessageTokens) UnmarshalJSON(data []byte) error

type AssistantMessageTokensCache

type AssistantMessageTokensCache struct {
	Read  float64 `json:"read,required"`
	Write float64 `json:"write,required"`
	// JSON contains metadata for fields, check presence with [respjson.Field.Valid].
	JSON struct {
		Read        respjson.Field
		Write       respjson.Field
		ExtraFields map[string]respjson.Field
		// contains filtered or unexported fields
	} `json:"-"`
}

func (AssistantMessageTokensCache) RawJSON

func (r AssistantMessageTokensCache) RawJSON() string

Returns the unmodified JSON received from the API

func (*AssistantMessageTokensCache) UnmarshalJSON

func (r *AssistantMessageTokensCache) UnmarshalJSON(data []byte) error

type Client

type Client struct {
	Options []option.RequestOption
	Event   EventService
	App     AppService
	Config  ConfigService
	Session SessionService
	Find    FindService
	File    FileService
	Log     LogService
	Agent   AgentService
	Tui     TuiService
}

Client creates a struct with services and top level methods that help with interacting with the opencode-sdk API. You should not instantiate this client directly, and instead use the NewClient method instead.

func NewClient

func NewClient(opts ...option.RequestOption) (r Client)

NewClient generates a new client with the default option read from the environment (OPENCODE_SDK_API_KEY, OPENCODE_SDK_BASE_URL). The option passed in as arguments are applied after these default arguments, and all option will be passed down to the services and requests that this client makes.

func (*Client) Delete

func (r *Client) Delete(ctx context.Context, path string, params any, res any, opts ...option.RequestOption) error

Delete makes a DELETE request with the given URL, params, and optionally deserializes to a response. See [Execute] documentation on the params and response.

func (*Client) Execute

func (r *Client) Execute(ctx context.Context, method string, path string, params any, res any, opts ...option.RequestOption) error

Execute makes a request with the given context, method, URL, request params, response, and request options. This is useful for hitting undocumented endpoints while retaining the base URL, auth, retries, and other options from the client.

If a byte slice or an io.Reader is supplied to params, it will be used as-is for the request body.

The params is by default serialized into the body using encoding/json. If your type implements a MarshalJSON function, it will be used instead to serialize the request. If a URLQuery method is implemented, the returned url.Values will be used as query strings to the url.

If your params struct uses param.Field, you must provide either [MarshalJSON], [URLQuery], and/or [MarshalForm] functions. It is undefined behavior to use a struct uses param.Field without specifying how it is serialized.

Any "…Params" object defined in this library can be used as the request argument. Note that 'path' arguments will not be forwarded into the url.

The response body will be deserialized into the res variable, depending on its type:

  • A pointer to a *http.Response is populated by the raw response.
  • A pointer to a byte array will be populated with the contents of the request body.
  • A pointer to any other type uses this library's default JSON decoding, which respects UnmarshalJSON if it is defined on the type.
  • A nil value will not read the response body.

For even greater flexibility, see option.WithResponseInto and option.WithResponseBodyInto.

func (*Client) Get

func (r *Client) Get(ctx context.Context, path string, params any, res any, opts ...option.RequestOption) error

Get makes a GET request with the given URL, params, and optionally deserializes to a response. See [Execute] documentation on the params and response.

func (*Client) Patch

func (r *Client) Patch(ctx context.Context, path string, params any, res any, opts ...option.RequestOption) error

Patch makes a PATCH request with the given URL, params, and optionally deserializes to a response. See [Execute] documentation on the params and response.

func (*Client) Post

func (r *Client) Post(ctx context.Context, path string, params any, res any, opts ...option.RequestOption) error

Post makes a POST request with the given URL, params, and optionally deserializes to a response. See [Execute] documentation on the params and response.

func (*Client) Put

func (r *Client) Put(ctx context.Context, path string, params any, res any, opts ...option.RequestOption) error

Put makes a PUT request with the given URL, params, and optionally deserializes to a response. See [Execute] documentation on the params and response.

type ConfigGetResponse

type ConfigGetResponse struct {
	// JSON schema reference for configuration validation
	Schema string `json:"$schema"`
	// Agent configuration, see https://opencode.ai/docs/agent
	Agent ConfigGetResponseAgent `json:"agent"`
	// @deprecated Use 'share' field instead. Share newly created sessions
	// automatically
	Autoshare bool `json:"autoshare"`
	// Automatically update to the latest version
	Autoupdate bool `json:"autoupdate"`
	// Disable providers that are loaded automatically
	DisabledProviders []string                              `json:"disabled_providers"`
	Experimental      ConfigGetResponseExperimental         `json:"experimental"`
	Formatter         map[string]ConfigGetResponseFormatter `json:"formatter"`
	// Additional instruction files or patterns to include
	Instructions []string `json:"instructions"`
	// Custom keybind configurations
	Keybinds ConfigGetResponseKeybinds `json:"keybinds"`
	// @deprecated Always uses stretch layout.
	//
	// Any of "auto", "stretch".
	Layout ConfigGetResponseLayout              `json:"layout"`
	Lsp    map[string]ConfigGetResponseLspUnion `json:"lsp"`
	// MCP (Model Context Protocol) server configurations
	Mcp map[string]ConfigGetResponseMcpUnion `json:"mcp"`
	// @deprecated Use `agent` field instead.
	Mode ConfigGetResponseMode `json:"mode"`
	// Model to use in the format of provider/model, eg anthropic/claude-2
	Model      string                      `json:"model"`
	Permission ConfigGetResponsePermission `json:"permission"`
	Plugin     []string                    `json:"plugin"`
	// Custom provider configurations and model overrides
	Provider map[string]ConfigGetResponseProvider `json:"provider"`
	// Control sharing behavior:'manual' allows manual sharing via commands, 'auto'
	// enables automatic sharing, 'disabled' disables all sharing
	//
	// Any of "manual", "auto", "disabled".
	Share ConfigGetResponseShare `json:"share"`
	// Small model to use for tasks like title generation in the format of
	// provider/model
	SmallModel string `json:"small_model"`
	Snapshot   bool   `json:"snapshot"`
	// Theme name to use for the interface
	Theme string `json:"theme"`
	// Custom username to display in conversations instead of system username
	Username string `json:"username"`
	// JSON contains metadata for fields, check presence with [respjson.Field.Valid].
	JSON struct {
		Schema            respjson.Field
		Agent             respjson.Field
		Autoshare         respjson.Field
		Autoupdate        respjson.Field
		DisabledProviders respjson.Field
		Experimental      respjson.Field
		Formatter         respjson.Field
		Instructions      respjson.Field
		Keybinds          respjson.Field
		Layout            respjson.Field
		Lsp               respjson.Field
		Mcp               respjson.Field
		Mode              respjson.Field
		Model             respjson.Field
		Permission        respjson.Field
		Plugin            respjson.Field
		Provider          respjson.Field
		Share             respjson.Field
		SmallModel        respjson.Field
		Snapshot          respjson.Field
		Theme             respjson.Field
		Username          respjson.Field
		ExtraFields       map[string]respjson.Field
		// contains filtered or unexported fields
	} `json:"-"`
}

func (ConfigGetResponse) RawJSON

func (r ConfigGetResponse) RawJSON() string

Returns the unmodified JSON received from the API

func (*ConfigGetResponse) UnmarshalJSON

func (r *ConfigGetResponse) UnmarshalJSON(data []byte) error

type ConfigGetResponseAgent

type ConfigGetResponseAgent struct {
	Build       ConfigGetResponseAgentBuild       `json:"build"`
	General     ConfigGetResponseAgentGeneral     `json:"general"`
	Plan        ConfigGetResponseAgentPlan        `json:"plan"`
	ExtraFields map[string]ConfigGetResponseAgent `json:",extras"`
	// JSON contains metadata for fields, check presence with [respjson.Field.Valid].
	JSON struct {
		Build       respjson.Field
		General     respjson.Field
		Plan        respjson.Field
		ExtraFields map[string]respjson.Field
		// contains filtered or unexported fields
	} `json:"-"`
}

Agent configuration, see https://opencode.ai/docs/agent

func (ConfigGetResponseAgent) RawJSON

func (r ConfigGetResponseAgent) RawJSON() string

Returns the unmodified JSON received from the API

func (*ConfigGetResponseAgent) UnmarshalJSON

func (r *ConfigGetResponseAgent) UnmarshalJSON(data []byte) error

type ConfigGetResponseAgentBuild

type ConfigGetResponseAgentBuild struct {
	// Description of when to use the agent
	Description string `json:"description"`
	Disable     bool   `json:"disable"`
	// Any of "subagent", "primary", "all".
	Mode        ConfigGetResponseAgentBuildMode `json:"mode"`
	Model       string                          `json:"model"`
	Prompt      string                          `json:"prompt"`
	Temperature float64                         `json:"temperature"`
	Tools       map[string]bool                 `json:"tools"`
	TopP        float64                         `json:"top_p"`
	ExtraFields map[string]any                  `json:",extras"`
	// JSON contains metadata for fields, check presence with [respjson.Field.Valid].
	JSON struct {
		Description respjson.Field
		Disable     respjson.Field
		Mode        respjson.Field
		Model       respjson.Field
		Prompt      respjson.Field
		Temperature respjson.Field
		Tools       respjson.Field
		TopP        respjson.Field
		ExtraFields map[string]respjson.Field
		// contains filtered or unexported fields
	} `json:"-"`
}

func (ConfigGetResponseAgentBuild) RawJSON

func (r ConfigGetResponseAgentBuild) RawJSON() string

Returns the unmodified JSON received from the API

func (*ConfigGetResponseAgentBuild) UnmarshalJSON

func (r *ConfigGetResponseAgentBuild) UnmarshalJSON(data []byte) error

type ConfigGetResponseAgentBuildMode

type ConfigGetResponseAgentBuildMode string
const (
	ConfigGetResponseAgentBuildModeSubagent ConfigGetResponseAgentBuildMode = "subagent"
	ConfigGetResponseAgentBuildModePrimary  ConfigGetResponseAgentBuildMode = "primary"
	ConfigGetResponseAgentBuildModeAll      ConfigGetResponseAgentBuildMode = "all"
)

type ConfigGetResponseAgentGeneral

type ConfigGetResponseAgentGeneral struct {
	// Description of when to use the agent
	Description string `json:"description"`
	Disable     bool   `json:"disable"`
	// Any of "subagent", "primary", "all".
	Mode        ConfigGetResponseAgentGeneralMode `json:"mode"`
	Model       string                            `json:"model"`
	Prompt      string                            `json:"prompt"`
	Temperature float64                           `json:"temperature"`
	Tools       map[string]bool                   `json:"tools"`
	TopP        float64                           `json:"top_p"`
	ExtraFields map[string]any                    `json:",extras"`
	// JSON contains metadata for fields, check presence with [respjson.Field.Valid].
	JSON struct {
		Description respjson.Field
		Disable     respjson.Field
		Mode        respjson.Field
		Model       respjson.Field
		Prompt      respjson.Field
		Temperature respjson.Field
		Tools       respjson.Field
		TopP        respjson.Field
		ExtraFields map[string]respjson.Field
		// contains filtered or unexported fields
	} `json:"-"`
}

func (ConfigGetResponseAgentGeneral) RawJSON

Returns the unmodified JSON received from the API

func (*ConfigGetResponseAgentGeneral) UnmarshalJSON

func (r *ConfigGetResponseAgentGeneral) UnmarshalJSON(data []byte) error

type ConfigGetResponseAgentGeneralMode

type ConfigGetResponseAgentGeneralMode string
const (
	ConfigGetResponseAgentGeneralModeSubagent ConfigGetResponseAgentGeneralMode = "subagent"
	ConfigGetResponseAgentGeneralModePrimary  ConfigGetResponseAgentGeneralMode = "primary"
	ConfigGetResponseAgentGeneralModeAll      ConfigGetResponseAgentGeneralMode = "all"
)

type ConfigGetResponseAgentPlan

type ConfigGetResponseAgentPlan struct {
	// Description of when to use the agent
	Description string `json:"description"`
	Disable     bool   `json:"disable"`
	// Any of "subagent", "primary", "all".
	Mode        ConfigGetResponseAgentPlanMode `json:"mode"`
	Model       string                         `json:"model"`
	Prompt      string                         `json:"prompt"`
	Temperature float64                        `json:"temperature"`
	Tools       map[string]bool                `json:"tools"`
	TopP        float64                        `json:"top_p"`
	ExtraFields map[string]any                 `json:",extras"`
	// JSON contains metadata for fields, check presence with [respjson.Field.Valid].
	JSON struct {
		Description respjson.Field
		Disable     respjson.Field
		Mode        respjson.Field
		Model       respjson.Field
		Prompt      respjson.Field
		Temperature respjson.Field
		Tools       respjson.Field
		TopP        respjson.Field
		ExtraFields map[string]respjson.Field
		// contains filtered or unexported fields
	} `json:"-"`
}

func (ConfigGetResponseAgentPlan) RawJSON

func (r ConfigGetResponseAgentPlan) RawJSON() string

Returns the unmodified JSON received from the API

func (*ConfigGetResponseAgentPlan) UnmarshalJSON

func (r *ConfigGetResponseAgentPlan) UnmarshalJSON(data []byte) error

type ConfigGetResponseAgentPlanMode

type ConfigGetResponseAgentPlanMode string
const (
	ConfigGetResponseAgentPlanModeSubagent ConfigGetResponseAgentPlanMode = "subagent"
	ConfigGetResponseAgentPlanModePrimary  ConfigGetResponseAgentPlanMode = "primary"
	ConfigGetResponseAgentPlanModeAll      ConfigGetResponseAgentPlanMode = "all"
)

type ConfigGetResponseExperimental

type ConfigGetResponseExperimental struct {
	Hook ConfigGetResponseExperimentalHook `json:"hook"`
	// JSON contains metadata for fields, check presence with [respjson.Field.Valid].
	JSON struct {
		Hook        respjson.Field
		ExtraFields map[string]respjson.Field
		// contains filtered or unexported fields
	} `json:"-"`
}

func (ConfigGetResponseExperimental) RawJSON

Returns the unmodified JSON received from the API

func (*ConfigGetResponseExperimental) UnmarshalJSON

func (r *ConfigGetResponseExperimental) UnmarshalJSON(data []byte) error

type ConfigGetResponseExperimentalHook

type ConfigGetResponseExperimentalHook struct {
	FileEdited       map[string][]ConfigGetResponseExperimentalHookFileEdited `json:"file_edited"`
	SessionCompleted []ConfigGetResponseExperimentalHookSessionCompleted      `json:"session_completed"`
	// JSON contains metadata for fields, check presence with [respjson.Field.Valid].
	JSON struct {
		FileEdited       respjson.Field
		SessionCompleted respjson.Field
		ExtraFields      map[string]respjson.Field
		// contains filtered or unexported fields
	} `json:"-"`
}

func (ConfigGetResponseExperimentalHook) RawJSON

Returns the unmodified JSON received from the API

func (*ConfigGetResponseExperimentalHook) UnmarshalJSON

func (r *ConfigGetResponseExperimentalHook) UnmarshalJSON(data []byte) error

type ConfigGetResponseExperimentalHookFileEdited

type ConfigGetResponseExperimentalHookFileEdited struct {
	Command     []string          `json:"command,required"`
	Environment map[string]string `json:"environment"`
	// JSON contains metadata for fields, check presence with [respjson.Field.Valid].
	JSON struct {
		Command     respjson.Field
		Environment respjson.Field
		ExtraFields map[string]respjson.Field
		// contains filtered or unexported fields
	} `json:"-"`
}

func (ConfigGetResponseExperimentalHookFileEdited) RawJSON

Returns the unmodified JSON received from the API

func (*ConfigGetResponseExperimentalHookFileEdited) UnmarshalJSON

func (r *ConfigGetResponseExperimentalHookFileEdited) UnmarshalJSON(data []byte) error

type ConfigGetResponseExperimentalHookSessionCompleted

type ConfigGetResponseExperimentalHookSessionCompleted struct {
	Command     []string          `json:"command,required"`
	Environment map[string]string `json:"environment"`
	// JSON contains metadata for fields, check presence with [respjson.Field.Valid].
	JSON struct {
		Command     respjson.Field
		Environment respjson.Field
		ExtraFields map[string]respjson.Field
		// contains filtered or unexported fields
	} `json:"-"`
}

func (ConfigGetResponseExperimentalHookSessionCompleted) RawJSON

Returns the unmodified JSON received from the API

func (*ConfigGetResponseExperimentalHookSessionCompleted) UnmarshalJSON

type ConfigGetResponseFormatter

type ConfigGetResponseFormatter struct {
	Command     []string          `json:"command"`
	Disabled    bool              `json:"disabled"`
	Environment map[string]string `json:"environment"`
	Extensions  []string          `json:"extensions"`
	// JSON contains metadata for fields, check presence with [respjson.Field.Valid].
	JSON struct {
		Command     respjson.Field
		Disabled    respjson.Field
		Environment respjson.Field
		Extensions  respjson.Field
		ExtraFields map[string]respjson.Field
		// contains filtered or unexported fields
	} `json:"-"`
}

func (ConfigGetResponseFormatter) RawJSON

func (r ConfigGetResponseFormatter) RawJSON() string

Returns the unmodified JSON received from the API

func (*ConfigGetResponseFormatter) UnmarshalJSON

func (r *ConfigGetResponseFormatter) UnmarshalJSON(data []byte) error

type ConfigGetResponseKeybinds

type ConfigGetResponseKeybinds struct {
	// Exit the application
	AppExit string `json:"app_exit,required"`
	// Show help dialog
	AppHelp string `json:"app_help,required"`
	// Open external editor
	EditorOpen string `json:"editor_open,required"`
	// Close file
	FileClose string `json:"file_close,required"`
	// Split/unified diff
	FileDiffToggle string `json:"file_diff_toggle,required"`
	// List files
	FileList string `json:"file_list,required"`
	// Search file
	FileSearch string `json:"file_search,required"`
	// Clear input field
	InputClear string `json:"input_clear,required"`
	// Insert newline in input
	InputNewline string `json:"input_newline,required"`
	// Paste from clipboard
	InputPaste string `json:"input_paste,required"`
	// Submit input
	InputSubmit string `json:"input_submit,required"`
	// Leader key for keybind combinations
	Leader string `json:"leader,required"`
	// Copy message
	MessagesCopy string `json:"messages_copy,required"`
	// Navigate to first message
	MessagesFirst string `json:"messages_first,required"`
	// Scroll messages down by half page
	MessagesHalfPageDown string `json:"messages_half_page_down,required"`
	// Scroll messages up by half page
	MessagesHalfPageUp string `json:"messages_half_page_up,required"`
	// Navigate to last message
	MessagesLast string `json:"messages_last,required"`
	// Toggle layout
	MessagesLayoutToggle string `json:"messages_layout_toggle,required"`
	// Navigate to next message
	MessagesNext string `json:"messages_next,required"`
	// Scroll messages down by one page
	MessagesPageDown string `json:"messages_page_down,required"`
	// Scroll messages up by one page
	MessagesPageUp string `json:"messages_page_up,required"`
	// Navigate to previous message
	MessagesPrevious string `json:"messages_previous,required"`
	// Redo message
	MessagesRedo string `json:"messages_redo,required"`
	// @deprecated use messages_undo. Revert message
	MessagesRevert string `json:"messages_revert,required"`
	// Undo message
	MessagesUndo string `json:"messages_undo,required"`
	// List available models
	ModelList string `json:"model_list,required"`
	// Create/update AGENTS.md
	ProjectInit string `json:"project_init,required"`
	// Compact the session
	SessionCompact string `json:"session_compact,required"`
	// Export session to editor
	SessionExport string `json:"session_export,required"`
	// Interrupt current session
	SessionInterrupt string `json:"session_interrupt,required"`
	// List all sessions
	SessionList string `json:"session_list,required"`
	// Create a new session
	SessionNew string `json:"session_new,required"`
	// Share current session
	SessionShare string `json:"session_share,required"`
	// Unshare current session
	SessionUnshare string `json:"session_unshare,required"`
	// Next agent
	SwitchAgent string `json:"switch_agent,required"`
	// Previous agent
	SwitchAgentReverse string `json:"switch_agent_reverse,required"`
	// @deprecated use switch_agent. Next mode
	SwitchMode string `json:"switch_mode,required"`
	// @deprecated use switch_agent_reverse. Previous mode
	SwitchModeReverse string `json:"switch_mode_reverse,required"`
	// List available themes
	ThemeList string `json:"theme_list,required"`
	// Toggle tool details
	ToolDetails string `json:"tool_details,required"`
	// JSON contains metadata for fields, check presence with [respjson.Field.Valid].
	JSON struct {
		AppExit              respjson.Field
		AppHelp              respjson.Field
		EditorOpen           respjson.Field
		FileClose            respjson.Field
		FileDiffToggle       respjson.Field
		FileList             respjson.Field
		FileSearch           respjson.Field
		InputClear           respjson.Field
		InputNewline         respjson.Field
		InputPaste           respjson.Field
		InputSubmit          respjson.Field
		Leader               respjson.Field
		MessagesCopy         respjson.Field
		MessagesFirst        respjson.Field
		MessagesHalfPageDown respjson.Field
		MessagesHalfPageUp   respjson.Field
		MessagesLast         respjson.Field
		MessagesLayoutToggle respjson.Field
		MessagesNext         respjson.Field
		MessagesPageDown     respjson.Field
		MessagesPageUp       respjson.Field
		MessagesPrevious     respjson.Field
		MessagesRedo         respjson.Field
		MessagesRevert       respjson.Field
		MessagesUndo         respjson.Field
		ModelList            respjson.Field
		ProjectInit          respjson.Field
		SessionCompact       respjson.Field
		SessionExport        respjson.Field
		SessionInterrupt     respjson.Field
		SessionList          respjson.Field
		SessionNew           respjson.Field
		SessionShare         respjson.Field
		SessionUnshare       respjson.Field
		SwitchAgent          respjson.Field
		SwitchAgentReverse   respjson.Field
		SwitchMode           respjson.Field
		SwitchModeReverse    respjson.Field
		ThemeList            respjson.Field
		ToolDetails          respjson.Field
		ExtraFields          map[string]respjson.Field
		// contains filtered or unexported fields
	} `json:"-"`
}

Custom keybind configurations

func (ConfigGetResponseKeybinds) RawJSON

func (r ConfigGetResponseKeybinds) RawJSON() string

Returns the unmodified JSON received from the API

func (*ConfigGetResponseKeybinds) UnmarshalJSON

func (r *ConfigGetResponseKeybinds) UnmarshalJSON(data []byte) error

type ConfigGetResponseLayout

type ConfigGetResponseLayout string

@deprecated Always uses stretch layout.

const (
	ConfigGetResponseLayoutAuto    ConfigGetResponseLayout = "auto"
	ConfigGetResponseLayoutStretch ConfigGetResponseLayout = "stretch"
)

type ConfigGetResponseLspDisabled

type ConfigGetResponseLspDisabled struct {
	Disabled bool `json:"disabled,required"`
	// JSON contains metadata for fields, check presence with [respjson.Field.Valid].
	JSON struct {
		Disabled    respjson.Field
		ExtraFields map[string]respjson.Field
		// contains filtered or unexported fields
	} `json:"-"`
}

func (ConfigGetResponseLspDisabled) RawJSON

Returns the unmodified JSON received from the API

func (*ConfigGetResponseLspDisabled) UnmarshalJSON

func (r *ConfigGetResponseLspDisabled) UnmarshalJSON(data []byte) error

type ConfigGetResponseLspObject

type ConfigGetResponseLspObject struct {
	Command        []string          `json:"command,required"`
	Disabled       bool              `json:"disabled"`
	Env            map[string]string `json:"env"`
	Extensions     []string          `json:"extensions"`
	Initialization map[string]any    `json:"initialization"`
	// JSON contains metadata for fields, check presence with [respjson.Field.Valid].
	JSON struct {
		Command        respjson.Field
		Disabled       respjson.Field
		Env            respjson.Field
		Extensions     respjson.Field
		Initialization respjson.Field
		ExtraFields    map[string]respjson.Field
		// contains filtered or unexported fields
	} `json:"-"`
}

func (ConfigGetResponseLspObject) RawJSON

func (r ConfigGetResponseLspObject) RawJSON() string

Returns the unmodified JSON received from the API

func (*ConfigGetResponseLspObject) UnmarshalJSON

func (r *ConfigGetResponseLspObject) UnmarshalJSON(data []byte) error

type ConfigGetResponseLspUnion

type ConfigGetResponseLspUnion struct {
	Disabled bool `json:"disabled"`
	// This field is from variant [ConfigGetResponseLspObject].
	Command []string `json:"command"`
	// This field is from variant [ConfigGetResponseLspObject].
	Env map[string]string `json:"env"`
	// This field is from variant [ConfigGetResponseLspObject].
	Extensions []string `json:"extensions"`
	// This field is from variant [ConfigGetResponseLspObject].
	Initialization map[string]any `json:"initialization"`
	JSON           struct {
		Disabled       respjson.Field
		Command        respjson.Field
		Env            respjson.Field
		Extensions     respjson.Field
		Initialization respjson.Field
		// contains filtered or unexported fields
	} `json:"-"`
}

ConfigGetResponseLspUnion contains all possible properties and values from ConfigGetResponseLspDisabled, ConfigGetResponseLspObject.

Use the methods beginning with 'As' to cast the union to one of its variants.

func (ConfigGetResponseLspUnion) AsConfigGetResponseLspDisabled

func (u ConfigGetResponseLspUnion) AsConfigGetResponseLspDisabled() (v ConfigGetResponseLspDisabled)

func (ConfigGetResponseLspUnion) AsConfigGetResponseLspObject

func (u ConfigGetResponseLspUnion) AsConfigGetResponseLspObject() (v ConfigGetResponseLspObject)

func (ConfigGetResponseLspUnion) RawJSON

func (u ConfigGetResponseLspUnion) RawJSON() string

Returns the unmodified JSON received from the API

func (*ConfigGetResponseLspUnion) UnmarshalJSON

func (r *ConfigGetResponseLspUnion) UnmarshalJSON(data []byte) error

type ConfigGetResponseMcpLocal

type ConfigGetResponseMcpLocal struct {
	// Command and arguments to run the MCP server
	Command []string `json:"command,required"`
	// Type of MCP server connection
	Type constant.Local `json:"type,required"`
	// Enable or disable the MCP server on startup
	Enabled bool `json:"enabled"`
	// Environment variables to set when running the MCP server
	Environment map[string]string `json:"environment"`
	// JSON contains metadata for fields, check presence with [respjson.Field.Valid].
	JSON struct {
		Command     respjson.Field
		Type        respjson.Field
		Enabled     respjson.Field
		Environment respjson.Field
		ExtraFields map[string]respjson.Field
		// contains filtered or unexported fields
	} `json:"-"`
}

func (ConfigGetResponseMcpLocal) RawJSON

func (r ConfigGetResponseMcpLocal) RawJSON() string

Returns the unmodified JSON received from the API

func (*ConfigGetResponseMcpLocal) UnmarshalJSON

func (r *ConfigGetResponseMcpLocal) UnmarshalJSON(data []byte) error

type ConfigGetResponseMcpRemote

type ConfigGetResponseMcpRemote struct {
	// Type of MCP server connection
	Type constant.Remote `json:"type,required"`
	// URL of the remote MCP server
	URL string `json:"url,required"`
	// Enable or disable the MCP server on startup
	Enabled bool `json:"enabled"`
	// Headers to send with the request
	Headers map[string]string `json:"headers"`
	// JSON contains metadata for fields, check presence with [respjson.Field.Valid].
	JSON struct {
		Type        respjson.Field
		URL         respjson.Field
		Enabled     respjson.Field
		Headers     respjson.Field
		ExtraFields map[string]respjson.Field
		// contains filtered or unexported fields
	} `json:"-"`
}

func (ConfigGetResponseMcpRemote) RawJSON

func (r ConfigGetResponseMcpRemote) RawJSON() string

Returns the unmodified JSON received from the API

func (*ConfigGetResponseMcpRemote) UnmarshalJSON

func (r *ConfigGetResponseMcpRemote) UnmarshalJSON(data []byte) error

type ConfigGetResponseMcpUnion

type ConfigGetResponseMcpUnion struct {
	// This field is from variant [ConfigGetResponseMcpLocal].
	Command []string `json:"command"`
	// Any of "local", "remote".
	Type    string `json:"type"`
	Enabled bool   `json:"enabled"`
	// This field is from variant [ConfigGetResponseMcpLocal].
	Environment map[string]string `json:"environment"`
	// This field is from variant [ConfigGetResponseMcpRemote].
	URL string `json:"url"`
	// This field is from variant [ConfigGetResponseMcpRemote].
	Headers map[string]string `json:"headers"`
	JSON    struct {
		Command     respjson.Field
		Type        respjson.Field
		Enabled     respjson.Field
		Environment respjson.Field
		URL         respjson.Field
		Headers     respjson.Field
		// contains filtered or unexported fields
	} `json:"-"`
}

ConfigGetResponseMcpUnion contains all possible properties and values from ConfigGetResponseMcpLocal, ConfigGetResponseMcpRemote.

Use the ConfigGetResponseMcpUnion.AsAny method to switch on the variant.

Use the methods beginning with 'As' to cast the union to one of its variants.

func (ConfigGetResponseMcpUnion) AsAny

func (u ConfigGetResponseMcpUnion) AsAny() anyConfigGetResponseMcp

Use the following switch statement to find the correct variant

switch variant := ConfigGetResponseMcpUnion.AsAny().(type) {
case opencodesdk.ConfigGetResponseMcpLocal:
case opencodesdk.ConfigGetResponseMcpRemote:
default:
  fmt.Errorf("no variant present")
}

func (ConfigGetResponseMcpUnion) AsLocal

func (ConfigGetResponseMcpUnion) AsRemote

func (ConfigGetResponseMcpUnion) RawJSON

func (u ConfigGetResponseMcpUnion) RawJSON() string

Returns the unmodified JSON received from the API

func (*ConfigGetResponseMcpUnion) UnmarshalJSON

func (r *ConfigGetResponseMcpUnion) UnmarshalJSON(data []byte) error

type ConfigGetResponseMode

type ConfigGetResponseMode struct {
	Build       ConfigGetResponseModeBuild       `json:"build"`
	Plan        ConfigGetResponseModePlan        `json:"plan"`
	ExtraFields map[string]ConfigGetResponseMode `json:",extras"`
	// JSON contains metadata for fields, check presence with [respjson.Field.Valid].
	JSON struct {
		Build       respjson.Field
		Plan        respjson.Field
		ExtraFields map[string]respjson.Field
		// contains filtered or unexported fields
	} `json:"-"`
}

@deprecated Use `agent` field instead.

func (ConfigGetResponseMode) RawJSON

func (r ConfigGetResponseMode) RawJSON() string

Returns the unmodified JSON received from the API

func (*ConfigGetResponseMode) UnmarshalJSON

func (r *ConfigGetResponseMode) UnmarshalJSON(data []byte) error

type ConfigGetResponseModeBuild

type ConfigGetResponseModeBuild struct {
	// Description of when to use the agent
	Description string `json:"description"`
	Disable     bool   `json:"disable"`
	// Any of "subagent", "primary", "all".
	Mode        ConfigGetResponseModeBuildMode `json:"mode"`
	Model       string                         `json:"model"`
	Prompt      string                         `json:"prompt"`
	Temperature float64                        `json:"temperature"`
	Tools       map[string]bool                `json:"tools"`
	TopP        float64                        `json:"top_p"`
	ExtraFields map[string]any                 `json:",extras"`
	// JSON contains metadata for fields, check presence with [respjson.Field.Valid].
	JSON struct {
		Description respjson.Field
		Disable     respjson.Field
		Mode        respjson.Field
		Model       respjson.Field
		Prompt      respjson.Field
		Temperature respjson.Field
		Tools       respjson.Field
		TopP        respjson.Field
		ExtraFields map[string]respjson.Field
		// contains filtered or unexported fields
	} `json:"-"`
}

func (ConfigGetResponseModeBuild) RawJSON

func (r ConfigGetResponseModeBuild) RawJSON() string

Returns the unmodified JSON received from the API

func (*ConfigGetResponseModeBuild) UnmarshalJSON

func (r *ConfigGetResponseModeBuild) UnmarshalJSON(data []byte) error

type ConfigGetResponseModeBuildMode

type ConfigGetResponseModeBuildMode string
const (
	ConfigGetResponseModeBuildModeSubagent ConfigGetResponseModeBuildMode = "subagent"
	ConfigGetResponseModeBuildModePrimary  ConfigGetResponseModeBuildMode = "primary"
	ConfigGetResponseModeBuildModeAll      ConfigGetResponseModeBuildMode = "all"
)

type ConfigGetResponseModePlan

type ConfigGetResponseModePlan struct {
	// Description of when to use the agent
	Description string `json:"description"`
	Disable     bool   `json:"disable"`
	// Any of "subagent", "primary", "all".
	Mode        ConfigGetResponseModePlanMode `json:"mode"`
	Model       string                        `json:"model"`
	Prompt      string                        `json:"prompt"`
	Temperature float64                       `json:"temperature"`
	Tools       map[string]bool               `json:"tools"`
	TopP        float64                       `json:"top_p"`
	ExtraFields map[string]any                `json:",extras"`
	// JSON contains metadata for fields, check presence with [respjson.Field.Valid].
	JSON struct {
		Description respjson.Field
		Disable     respjson.Field
		Mode        respjson.Field
		Model       respjson.Field
		Prompt      respjson.Field
		Temperature respjson.Field
		Tools       respjson.Field
		TopP        respjson.Field
		ExtraFields map[string]respjson.Field
		// contains filtered or unexported fields
	} `json:"-"`
}

func (ConfigGetResponseModePlan) RawJSON

func (r ConfigGetResponseModePlan) RawJSON() string

Returns the unmodified JSON received from the API

func (*ConfigGetResponseModePlan) UnmarshalJSON

func (r *ConfigGetResponseModePlan) UnmarshalJSON(data []byte) error

type ConfigGetResponseModePlanMode

type ConfigGetResponseModePlanMode string
const (
	ConfigGetResponseModePlanModeSubagent ConfigGetResponseModePlanMode = "subagent"
	ConfigGetResponseModePlanModePrimary  ConfigGetResponseModePlanMode = "primary"
	ConfigGetResponseModePlanModeAll      ConfigGetResponseModePlanMode = "all"
)

type ConfigGetResponsePermission

type ConfigGetResponsePermission struct {
	Bash ConfigGetResponsePermissionBashUnion `json:"bash"`
	// Any of "ask", "allow", "deny".
	Edit ConfigGetResponsePermissionEdit `json:"edit"`
	// Any of "ask", "allow", "deny".
	Webfetch ConfigGetResponsePermissionWebfetch `json:"webfetch"`
	// JSON contains metadata for fields, check presence with [respjson.Field.Valid].
	JSON struct {
		Bash        respjson.Field
		Edit        respjson.Field
		Webfetch    respjson.Field
		ExtraFields map[string]respjson.Field
		// contains filtered or unexported fields
	} `json:"-"`
}

func (ConfigGetResponsePermission) RawJSON

func (r ConfigGetResponsePermission) RawJSON() string

Returns the unmodified JSON received from the API

func (*ConfigGetResponsePermission) UnmarshalJSON

func (r *ConfigGetResponsePermission) UnmarshalJSON(data []byte) error

type ConfigGetResponsePermissionBashMapItem

type ConfigGetResponsePermissionBashMapItem string
const (
	ConfigGetResponsePermissionBashMapItemAsk   ConfigGetResponsePermissionBashMapItem = "ask"
	ConfigGetResponsePermissionBashMapItemAllow ConfigGetResponsePermissionBashMapItem = "allow"
	ConfigGetResponsePermissionBashMapItemDeny  ConfigGetResponsePermissionBashMapItem = "deny"
)

type ConfigGetResponsePermissionBashString

type ConfigGetResponsePermissionBashString string
const (
	ConfigGetResponsePermissionBashStringAsk   ConfigGetResponsePermissionBashString = "ask"
	ConfigGetResponsePermissionBashStringAllow ConfigGetResponsePermissionBashString = "allow"
	ConfigGetResponsePermissionBashStringDeny  ConfigGetResponsePermissionBashString = "deny"
)

type ConfigGetResponsePermissionEdit

type ConfigGetResponsePermissionEdit string
const (
	ConfigGetResponsePermissionEditAsk   ConfigGetResponsePermissionEdit = "ask"
	ConfigGetResponsePermissionEditAllow ConfigGetResponsePermissionEdit = "allow"
	ConfigGetResponsePermissionEditDeny  ConfigGetResponsePermissionEdit = "deny"
)

type ConfigGetResponsePermissionWebfetch

type ConfigGetResponsePermissionWebfetch string
const (
	ConfigGetResponsePermissionWebfetchAsk   ConfigGetResponsePermissionWebfetch = "ask"
	ConfigGetResponsePermissionWebfetchAllow ConfigGetResponsePermissionWebfetch = "allow"
	ConfigGetResponsePermissionWebfetchDeny  ConfigGetResponsePermissionWebfetch = "deny"
)

type ConfigGetResponseProvider

type ConfigGetResponseProvider struct {
	Models  map[string]ConfigGetResponseProviderModel `json:"models,required"`
	ID      string                                    `json:"id"`
	API     string                                    `json:"api"`
	Env     []string                                  `json:"env"`
	Name    string                                    `json:"name"`
	Npm     string                                    `json:"npm"`
	Options ConfigGetResponseProviderOptions          `json:"options"`
	// JSON contains metadata for fields, check presence with [respjson.Field.Valid].
	JSON struct {
		Models      respjson.Field
		ID          respjson.Field
		API         respjson.Field
		Env         respjson.Field
		Name        respjson.Field
		Npm         respjson.Field
		Options     respjson.Field
		ExtraFields map[string]respjson.Field
		// contains filtered or unexported fields
	} `json:"-"`
}

func (ConfigGetResponseProvider) RawJSON

func (r ConfigGetResponseProvider) RawJSON() string

Returns the unmodified JSON received from the API

func (*ConfigGetResponseProvider) UnmarshalJSON

func (r *ConfigGetResponseProvider) UnmarshalJSON(data []byte) error

type ConfigGetResponseProviderModel

type ConfigGetResponseProviderModel struct {
	ID          string                              `json:"id,required"`
	Attachment  bool                                `json:"attachment,required"`
	Cost        ConfigGetResponseProviderModelCost  `json:"cost,required"`
	Limit       ConfigGetResponseProviderModelLimit `json:"limit,required"`
	Name        string                              `json:"name,required"`
	Options     map[string]any                      `json:"options,required"`
	Reasoning   bool                                `json:"reasoning,required"`
	ReleaseDate string                              `json:"release_date,required"`
	Temperature bool                                `json:"temperature,required"`
	ToolCall    bool                                `json:"tool_call,required"`
	// JSON contains metadata for fields, check presence with [respjson.Field.Valid].
	JSON struct {
		ID          respjson.Field
		Attachment  respjson.Field
		Cost        respjson.Field
		Limit       respjson.Field
		Name        respjson.Field
		Options     respjson.Field
		Reasoning   respjson.Field
		ReleaseDate respjson.Field
		Temperature respjson.Field
		ToolCall    respjson.Field
		ExtraFields map[string]respjson.Field
		// contains filtered or unexported fields
	} `json:"-"`
}

func (ConfigGetResponseProviderModel) RawJSON

Returns the unmodified JSON received from the API

func (*ConfigGetResponseProviderModel) UnmarshalJSON

func (r *ConfigGetResponseProviderModel) UnmarshalJSON(data []byte) error

type ConfigGetResponseProviderModelCost

type ConfigGetResponseProviderModelCost struct {
	Input      float64 `json:"input,required"`
	Output     float64 `json:"output,required"`
	CacheRead  float64 `json:"cache_read"`
	CacheWrite float64 `json:"cache_write"`
	// JSON contains metadata for fields, check presence with [respjson.Field.Valid].
	JSON struct {
		Input       respjson.Field
		Output      respjson.Field
		CacheRead   respjson.Field
		CacheWrite  respjson.Field
		ExtraFields map[string]respjson.Field
		// contains filtered or unexported fields
	} `json:"-"`
}

func (ConfigGetResponseProviderModelCost) RawJSON

Returns the unmodified JSON received from the API

func (*ConfigGetResponseProviderModelCost) UnmarshalJSON

func (r *ConfigGetResponseProviderModelCost) UnmarshalJSON(data []byte) error

type ConfigGetResponseProviderModelLimit

type ConfigGetResponseProviderModelLimit struct {
	Context float64 `json:"context,required"`
	Output  float64 `json:"output,required"`
	// JSON contains metadata for fields, check presence with [respjson.Field.Valid].
	JSON struct {
		Context     respjson.Field
		Output      respjson.Field
		ExtraFields map[string]respjson.Field
		// contains filtered or unexported fields
	} `json:"-"`
}

func (ConfigGetResponseProviderModelLimit) RawJSON

Returns the unmodified JSON received from the API

func (*ConfigGetResponseProviderModelLimit) UnmarshalJSON

func (r *ConfigGetResponseProviderModelLimit) UnmarshalJSON(data []byte) error

type ConfigGetResponseProviderOptions

type ConfigGetResponseProviderOptions struct {
	APIKey      string         `json:"apiKey"`
	BaseURL     string         `json:"baseURL"`
	ExtraFields map[string]any `json:",extras"`
	// JSON contains metadata for fields, check presence with [respjson.Field.Valid].
	JSON struct {
		APIKey      respjson.Field
		BaseURL     respjson.Field
		ExtraFields map[string]respjson.Field
		// contains filtered or unexported fields
	} `json:"-"`
}

func (ConfigGetResponseProviderOptions) RawJSON

Returns the unmodified JSON received from the API

func (*ConfigGetResponseProviderOptions) UnmarshalJSON

func (r *ConfigGetResponseProviderOptions) UnmarshalJSON(data []byte) error

type ConfigGetResponseShare

type ConfigGetResponseShare string

Control sharing behavior:'manual' allows manual sharing via commands, 'auto' enables automatic sharing, 'disabled' disables all sharing

const (
	ConfigGetResponseShareManual   ConfigGetResponseShare = "manual"
	ConfigGetResponseShareAuto     ConfigGetResponseShare = "auto"
	ConfigGetResponseShareDisabled ConfigGetResponseShare = "disabled"
)

type ConfigListProvidersResponse

type ConfigListProvidersResponse struct {
	Default   map[string]string                     `json:"default,required"`
	Providers []ConfigListProvidersResponseProvider `json:"providers,required"`
	// JSON contains metadata for fields, check presence with [respjson.Field.Valid].
	JSON struct {
		Default     respjson.Field
		Providers   respjson.Field
		ExtraFields map[string]respjson.Field
		// contains filtered or unexported fields
	} `json:"-"`
}

func (ConfigListProvidersResponse) RawJSON

func (r ConfigListProvidersResponse) RawJSON() string

Returns the unmodified JSON received from the API

func (*ConfigListProvidersResponse) UnmarshalJSON

func (r *ConfigListProvidersResponse) UnmarshalJSON(data []byte) error

type ConfigListProvidersResponseProvider

type ConfigListProvidersResponseProvider struct {
	ID     string                                              `json:"id,required"`
	Env    []string                                            `json:"env,required"`
	Models map[string]ConfigListProvidersResponseProviderModel `json:"models,required"`
	Name   string                                              `json:"name,required"`
	API    string                                              `json:"api"`
	Npm    string                                              `json:"npm"`
	// JSON contains metadata for fields, check presence with [respjson.Field.Valid].
	JSON struct {
		ID          respjson.Field
		Env         respjson.Field
		Models      respjson.Field
		Name        respjson.Field
		API         respjson.Field
		Npm         respjson.Field
		ExtraFields map[string]respjson.Field
		// contains filtered or unexported fields
	} `json:"-"`
}

func (ConfigListProvidersResponseProvider) RawJSON

Returns the unmodified JSON received from the API

func (*ConfigListProvidersResponseProvider) UnmarshalJSON

func (r *ConfigListProvidersResponseProvider) UnmarshalJSON(data []byte) error

type ConfigListProvidersResponseProviderModel

type ConfigListProvidersResponseProviderModel struct {
	ID          string                                        `json:"id,required"`
	Attachment  bool                                          `json:"attachment,required"`
	Cost        ConfigListProvidersResponseProviderModelCost  `json:"cost,required"`
	Limit       ConfigListProvidersResponseProviderModelLimit `json:"limit,required"`
	Name        string                                        `json:"name,required"`
	Options     map[string]any                                `json:"options,required"`
	Reasoning   bool                                          `json:"reasoning,required"`
	ReleaseDate string                                        `json:"release_date,required"`
	Temperature bool                                          `json:"temperature,required"`
	ToolCall    bool                                          `json:"tool_call,required"`
	// JSON contains metadata for fields, check presence with [respjson.Field.Valid].
	JSON struct {
		ID          respjson.Field
		Attachment  respjson.Field
		Cost        respjson.Field
		Limit       respjson.Field
		Name        respjson.Field
		Options     respjson.Field
		Reasoning   respjson.Field
		ReleaseDate respjson.Field
		Temperature respjson.Field
		ToolCall    respjson.Field
		ExtraFields map[string]respjson.Field
		// contains filtered or unexported fields
	} `json:"-"`
}

func (ConfigListProvidersResponseProviderModel) RawJSON

Returns the unmodified JSON received from the API

func (*ConfigListProvidersResponseProviderModel) UnmarshalJSON

func (r *ConfigListProvidersResponseProviderModel) UnmarshalJSON(data []byte) error

type ConfigListProvidersResponseProviderModelCost

type ConfigListProvidersResponseProviderModelCost struct {
	Input      float64 `json:"input,required"`
	Output     float64 `json:"output,required"`
	CacheRead  float64 `json:"cache_read"`
	CacheWrite float64 `json:"cache_write"`
	// JSON contains metadata for fields, check presence with [respjson.Field.Valid].
	JSON struct {
		Input       respjson.Field
		Output      respjson.Field
		CacheRead   respjson.Field
		CacheWrite  respjson.Field
		ExtraFields map[string]respjson.Field
		// contains filtered or unexported fields
	} `json:"-"`
}

func (ConfigListProvidersResponseProviderModelCost) RawJSON

Returns the unmodified JSON received from the API

func (*ConfigListProvidersResponseProviderModelCost) UnmarshalJSON

func (r *ConfigListProvidersResponseProviderModelCost) UnmarshalJSON(data []byte) error

type ConfigListProvidersResponseProviderModelLimit

type ConfigListProvidersResponseProviderModelLimit struct {
	Context float64 `json:"context,required"`
	Output  float64 `json:"output,required"`
	// JSON contains metadata for fields, check presence with [respjson.Field.Valid].
	JSON struct {
		Context     respjson.Field
		Output      respjson.Field
		ExtraFields map[string]respjson.Field
		// contains filtered or unexported fields
	} `json:"-"`
}

func (ConfigListProvidersResponseProviderModelLimit) RawJSON

Returns the unmodified JSON received from the API

func (*ConfigListProvidersResponseProviderModelLimit) UnmarshalJSON

func (r *ConfigListProvidersResponseProviderModelLimit) UnmarshalJSON(data []byte) error

type ConfigService

type ConfigService struct {
	Options []option.RequestOption
}

ConfigService contains methods and other services that help with interacting with the opencode-sdk API.

Note, unlike clients, this service does not read variables from the environment automatically. You should not instantiate this service directly, and instead use the NewConfigService method instead.

func NewConfigService

func NewConfigService(opts ...option.RequestOption) (r ConfigService)

NewConfigService generates a new service that applies the given options to each request. These options are applied after the parent client's options (if there is one), and before any request-specific options.

func (*ConfigService) Get

func (r *ConfigService) Get(ctx context.Context, opts ...option.RequestOption) (res *ConfigGetResponse, err error)

Get config info

func (*ConfigService) ListProviders

func (r *ConfigService) ListProviders(ctx context.Context, opts ...option.RequestOption) (res *ConfigListProvidersResponse, err error)

List all providers

type Error

type Error = apierror.Error

type EventListResponseFileEdited

type EventListResponseFileEdited struct {
	Properties EventListResponseFileEditedProperties `json:"properties,required"`
	Type       constant.FileEdited                   `json:"type,required"`
	// JSON contains metadata for fields, check presence with [respjson.Field.Valid].
	JSON struct {
		Properties  respjson.Field
		Type        respjson.Field
		ExtraFields map[string]respjson.Field
		// contains filtered or unexported fields
	} `json:"-"`
}

func (EventListResponseFileEdited) RawJSON

func (r EventListResponseFileEdited) RawJSON() string

Returns the unmodified JSON received from the API

func (*EventListResponseFileEdited) UnmarshalJSON

func (r *EventListResponseFileEdited) UnmarshalJSON(data []byte) error

type EventListResponseFileEditedProperties

type EventListResponseFileEditedProperties struct {
	File string `json:"file,required"`
	// JSON contains metadata for fields, check presence with [respjson.Field.Valid].
	JSON struct {
		File        respjson.Field
		ExtraFields map[string]respjson.Field
		// contains filtered or unexported fields
	} `json:"-"`
}

func (EventListResponseFileEditedProperties) RawJSON

Returns the unmodified JSON received from the API

func (*EventListResponseFileEditedProperties) UnmarshalJSON

func (r *EventListResponseFileEditedProperties) UnmarshalJSON(data []byte) error

type EventListResponseFileWatcherUpdated

type EventListResponseFileWatcherUpdated struct {
	Properties EventListResponseFileWatcherUpdatedProperties `json:"properties,required"`
	Type       constant.FileWatcherUpdated                   `json:"type,required"`
	// JSON contains metadata for fields, check presence with [respjson.Field.Valid].
	JSON struct {
		Properties  respjson.Field
		Type        respjson.Field
		ExtraFields map[string]respjson.Field
		// contains filtered or unexported fields
	} `json:"-"`
}

func (EventListResponseFileWatcherUpdated) RawJSON

Returns the unmodified JSON received from the API

func (*EventListResponseFileWatcherUpdated) UnmarshalJSON

func (r *EventListResponseFileWatcherUpdated) UnmarshalJSON(data []byte) error

type EventListResponseFileWatcherUpdatedProperties

type EventListResponseFileWatcherUpdatedProperties struct {
	// Any of "rename", "change".
	Event EventListResponseFileWatcherUpdatedPropertiesEvent `json:"event,required"`
	File  string                                             `json:"file,required"`
	// JSON contains metadata for fields, check presence with [respjson.Field.Valid].
	JSON struct {
		Event       respjson.Field
		File        respjson.Field
		ExtraFields map[string]respjson.Field
		// contains filtered or unexported fields
	} `json:"-"`
}

func (EventListResponseFileWatcherUpdatedProperties) RawJSON

Returns the unmodified JSON received from the API

func (*EventListResponseFileWatcherUpdatedProperties) UnmarshalJSON

func (r *EventListResponseFileWatcherUpdatedProperties) UnmarshalJSON(data []byte) error

type EventListResponseFileWatcherUpdatedPropertiesEvent

type EventListResponseFileWatcherUpdatedPropertiesEvent string
const (
	EventListResponseFileWatcherUpdatedPropertiesEventRename EventListResponseFileWatcherUpdatedPropertiesEvent = "rename"
	EventListResponseFileWatcherUpdatedPropertiesEventChange EventListResponseFileWatcherUpdatedPropertiesEvent = "change"
)

type EventListResponseIdeInstalled

type EventListResponseIdeInstalled struct {
	Properties EventListResponseIdeInstalledProperties `json:"properties,required"`
	Type       constant.IdeInstalled                   `json:"type,required"`
	// JSON contains metadata for fields, check presence with [respjson.Field.Valid].
	JSON struct {
		Properties  respjson.Field
		Type        respjson.Field
		ExtraFields map[string]respjson.Field
		// contains filtered or unexported fields
	} `json:"-"`
}

func (EventListResponseIdeInstalled) RawJSON

Returns the unmodified JSON received from the API

func (*EventListResponseIdeInstalled) UnmarshalJSON

func (r *EventListResponseIdeInstalled) UnmarshalJSON(data []byte) error

type EventListResponseIdeInstalledProperties

type EventListResponseIdeInstalledProperties struct {
	Ide string `json:"ide,required"`
	// JSON contains metadata for fields, check presence with [respjson.Field.Valid].
	JSON struct {
		Ide         respjson.Field
		ExtraFields map[string]respjson.Field
		// contains filtered or unexported fields
	} `json:"-"`
}

func (EventListResponseIdeInstalledProperties) RawJSON

Returns the unmodified JSON received from the API

func (*EventListResponseIdeInstalledProperties) UnmarshalJSON

func (r *EventListResponseIdeInstalledProperties) UnmarshalJSON(data []byte) error

type EventListResponseInstallationUpdated

type EventListResponseInstallationUpdated struct {
	Properties EventListResponseInstallationUpdatedProperties `json:"properties,required"`
	Type       constant.InstallationUpdated                   `json:"type,required"`
	// JSON contains metadata for fields, check presence with [respjson.Field.Valid].
	JSON struct {
		Properties  respjson.Field
		Type        respjson.Field
		ExtraFields map[string]respjson.Field
		// contains filtered or unexported fields
	} `json:"-"`
}

func (EventListResponseInstallationUpdated) RawJSON

Returns the unmodified JSON received from the API

func (*EventListResponseInstallationUpdated) UnmarshalJSON

func (r *EventListResponseInstallationUpdated) UnmarshalJSON(data []byte) error

type EventListResponseInstallationUpdatedProperties

type EventListResponseInstallationUpdatedProperties struct {
	Version string `json:"version,required"`
	// JSON contains metadata for fields, check presence with [respjson.Field.Valid].
	JSON struct {
		Version     respjson.Field
		ExtraFields map[string]respjson.Field
		// contains filtered or unexported fields
	} `json:"-"`
}

func (EventListResponseInstallationUpdatedProperties) RawJSON

Returns the unmodified JSON received from the API

func (*EventListResponseInstallationUpdatedProperties) UnmarshalJSON

type EventListResponseLspClientDiagnostics

type EventListResponseLspClientDiagnostics struct {
	Properties EventListResponseLspClientDiagnosticsProperties `json:"properties,required"`
	Type       constant.LspClientDiagnostics                   `json:"type,required"`
	// JSON contains metadata for fields, check presence with [respjson.Field.Valid].
	JSON struct {
		Properties  respjson.Field
		Type        respjson.Field
		ExtraFields map[string]respjson.Field
		// contains filtered or unexported fields
	} `json:"-"`
}

func (EventListResponseLspClientDiagnostics) RawJSON

Returns the unmodified JSON received from the API

func (*EventListResponseLspClientDiagnostics) UnmarshalJSON

func (r *EventListResponseLspClientDiagnostics) UnmarshalJSON(data []byte) error

type EventListResponseLspClientDiagnosticsProperties

type EventListResponseLspClientDiagnosticsProperties struct {
	Path     string `json:"path,required"`
	ServerID string `json:"serverID,required"`
	// JSON contains metadata for fields, check presence with [respjson.Field.Valid].
	JSON struct {
		Path        respjson.Field
		ServerID    respjson.Field
		ExtraFields map[string]respjson.Field
		// contains filtered or unexported fields
	} `json:"-"`
}

func (EventListResponseLspClientDiagnosticsProperties) RawJSON

Returns the unmodified JSON received from the API

func (*EventListResponseLspClientDiagnosticsProperties) UnmarshalJSON

type EventListResponseMessagePartRemoved

type EventListResponseMessagePartRemoved struct {
	Properties EventListResponseMessagePartRemovedProperties `json:"properties,required"`
	Type       constant.MessagePartRemoved                   `json:"type,required"`
	// JSON contains metadata for fields, check presence with [respjson.Field.Valid].
	JSON struct {
		Properties  respjson.Field
		Type        respjson.Field
		ExtraFields map[string]respjson.Field
		// contains filtered or unexported fields
	} `json:"-"`
}

func (EventListResponseMessagePartRemoved) RawJSON

Returns the unmodified JSON received from the API

func (*EventListResponseMessagePartRemoved) UnmarshalJSON

func (r *EventListResponseMessagePartRemoved) UnmarshalJSON(data []byte) error

type EventListResponseMessagePartRemovedProperties

type EventListResponseMessagePartRemovedProperties struct {
	MessageID string `json:"messageID,required"`
	PartID    string `json:"partID,required"`
	SessionID string `json:"sessionID,required"`
	// JSON contains metadata for fields, check presence with [respjson.Field.Valid].
	JSON struct {
		MessageID   respjson.Field
		PartID      respjson.Field
		SessionID   respjson.Field
		ExtraFields map[string]respjson.Field
		// contains filtered or unexported fields
	} `json:"-"`
}

func (EventListResponseMessagePartRemovedProperties) RawJSON

Returns the unmodified JSON received from the API

func (*EventListResponseMessagePartRemovedProperties) UnmarshalJSON

func (r *EventListResponseMessagePartRemovedProperties) UnmarshalJSON(data []byte) error

type EventListResponseMessagePartUpdated

type EventListResponseMessagePartUpdated struct {
	Properties EventListResponseMessagePartUpdatedProperties `json:"properties,required"`
	Type       constant.MessagePartUpdated                   `json:"type,required"`
	// JSON contains metadata for fields, check presence with [respjson.Field.Valid].
	JSON struct {
		Properties  respjson.Field
		Type        respjson.Field
		ExtraFields map[string]respjson.Field
		// contains filtered or unexported fields
	} `json:"-"`
}

func (EventListResponseMessagePartUpdated) RawJSON

Returns the unmodified JSON received from the API

func (*EventListResponseMessagePartUpdated) UnmarshalJSON

func (r *EventListResponseMessagePartUpdated) UnmarshalJSON(data []byte) error

type EventListResponseMessagePartUpdatedProperties

type EventListResponseMessagePartUpdatedProperties struct {
	Part PartUnion `json:"part,required"`
	// JSON contains metadata for fields, check presence with [respjson.Field.Valid].
	JSON struct {
		Part        respjson.Field
		ExtraFields map[string]respjson.Field
		// contains filtered or unexported fields
	} `json:"-"`
}

func (EventListResponseMessagePartUpdatedProperties) RawJSON

Returns the unmodified JSON received from the API

func (*EventListResponseMessagePartUpdatedProperties) UnmarshalJSON

func (r *EventListResponseMessagePartUpdatedProperties) UnmarshalJSON(data []byte) error

type EventListResponseMessageRemoved

type EventListResponseMessageRemoved struct {
	Properties EventListResponseMessageRemovedProperties `json:"properties,required"`
	Type       constant.MessageRemoved                   `json:"type,required"`
	// JSON contains metadata for fields, check presence with [respjson.Field.Valid].
	JSON struct {
		Properties  respjson.Field
		Type        respjson.Field
		ExtraFields map[string]respjson.Field
		// contains filtered or unexported fields
	} `json:"-"`
}

func (EventListResponseMessageRemoved) RawJSON

Returns the unmodified JSON received from the API

func (*EventListResponseMessageRemoved) UnmarshalJSON

func (r *EventListResponseMessageRemoved) UnmarshalJSON(data []byte) error

type EventListResponseMessageRemovedProperties

type EventListResponseMessageRemovedProperties struct {
	MessageID string `json:"messageID,required"`
	SessionID string `json:"sessionID,required"`
	// JSON contains metadata for fields, check presence with [respjson.Field.Valid].
	JSON struct {
		MessageID   respjson.Field
		SessionID   respjson.Field
		ExtraFields map[string]respjson.Field
		// contains filtered or unexported fields
	} `json:"-"`
}

func (EventListResponseMessageRemovedProperties) RawJSON

Returns the unmodified JSON received from the API

func (*EventListResponseMessageRemovedProperties) UnmarshalJSON

func (r *EventListResponseMessageRemovedProperties) UnmarshalJSON(data []byte) error

type EventListResponseMessageUpdated

type EventListResponseMessageUpdated struct {
	Properties EventListResponseMessageUpdatedProperties `json:"properties,required"`
	Type       constant.MessageUpdated                   `json:"type,required"`
	// JSON contains metadata for fields, check presence with [respjson.Field.Valid].
	JSON struct {
		Properties  respjson.Field
		Type        respjson.Field
		ExtraFields map[string]respjson.Field
		// contains filtered or unexported fields
	} `json:"-"`
}

func (EventListResponseMessageUpdated) RawJSON

Returns the unmodified JSON received from the API

func (*EventListResponseMessageUpdated) UnmarshalJSON

func (r *EventListResponseMessageUpdated) UnmarshalJSON(data []byte) error

type EventListResponseMessageUpdatedProperties

type EventListResponseMessageUpdatedProperties struct {
	Info MessageUnion `json:"info,required"`
	// JSON contains metadata for fields, check presence with [respjson.Field.Valid].
	JSON struct {
		Info        respjson.Field
		ExtraFields map[string]respjson.Field
		// contains filtered or unexported fields
	} `json:"-"`
}

func (EventListResponseMessageUpdatedProperties) RawJSON

Returns the unmodified JSON received from the API

func (*EventListResponseMessageUpdatedProperties) UnmarshalJSON

func (r *EventListResponseMessageUpdatedProperties) UnmarshalJSON(data []byte) error

type EventListResponsePermissionReplied

type EventListResponsePermissionReplied struct {
	Properties EventListResponsePermissionRepliedProperties `json:"properties,required"`
	Type       constant.PermissionReplied                   `json:"type,required"`
	// JSON contains metadata for fields, check presence with [respjson.Field.Valid].
	JSON struct {
		Properties  respjson.Field
		Type        respjson.Field
		ExtraFields map[string]respjson.Field
		// contains filtered or unexported fields
	} `json:"-"`
}

func (EventListResponsePermissionReplied) RawJSON

Returns the unmodified JSON received from the API

func (*EventListResponsePermissionReplied) UnmarshalJSON

func (r *EventListResponsePermissionReplied) UnmarshalJSON(data []byte) error

type EventListResponsePermissionRepliedProperties

type EventListResponsePermissionRepliedProperties struct {
	PermissionID string `json:"permissionID,required"`
	Response     string `json:"response,required"`
	SessionID    string `json:"sessionID,required"`
	// JSON contains metadata for fields, check presence with [respjson.Field.Valid].
	JSON struct {
		PermissionID respjson.Field
		Response     respjson.Field
		SessionID    respjson.Field
		ExtraFields  map[string]respjson.Field
		// contains filtered or unexported fields
	} `json:"-"`
}

func (EventListResponsePermissionRepliedProperties) RawJSON

Returns the unmodified JSON received from the API

func (*EventListResponsePermissionRepliedProperties) UnmarshalJSON

func (r *EventListResponsePermissionRepliedProperties) UnmarshalJSON(data []byte) error

type EventListResponsePermissionUpdated

type EventListResponsePermissionUpdated struct {
	Properties EventListResponsePermissionUpdatedProperties `json:"properties,required"`
	Type       constant.PermissionUpdated                   `json:"type,required"`
	// JSON contains metadata for fields, check presence with [respjson.Field.Valid].
	JSON struct {
		Properties  respjson.Field
		Type        respjson.Field
		ExtraFields map[string]respjson.Field
		// contains filtered or unexported fields
	} `json:"-"`
}

func (EventListResponsePermissionUpdated) RawJSON

Returns the unmodified JSON received from the API

func (*EventListResponsePermissionUpdated) UnmarshalJSON

func (r *EventListResponsePermissionUpdated) UnmarshalJSON(data []byte) error

type EventListResponsePermissionUpdatedProperties

type EventListResponsePermissionUpdatedProperties struct {
	ID        string                                           `json:"id,required"`
	MessageID string                                           `json:"messageID,required"`
	Metadata  map[string]any                                   `json:"metadata,required"`
	SessionID string                                           `json:"sessionID,required"`
	Time      EventListResponsePermissionUpdatedPropertiesTime `json:"time,required"`
	Title     string                                           `json:"title,required"`
	Type      string                                           `json:"type,required"`
	CallID    string                                           `json:"callID"`
	Pattern   string                                           `json:"pattern"`
	// JSON contains metadata for fields, check presence with [respjson.Field.Valid].
	JSON struct {
		ID          respjson.Field
		MessageID   respjson.Field
		Metadata    respjson.Field
		SessionID   respjson.Field
		Time        respjson.Field
		Title       respjson.Field
		Type        respjson.Field
		CallID      respjson.Field
		Pattern     respjson.Field
		ExtraFields map[string]respjson.Field
		// contains filtered or unexported fields
	} `json:"-"`
}

func (EventListResponsePermissionUpdatedProperties) RawJSON

Returns the unmodified JSON received from the API

func (*EventListResponsePermissionUpdatedProperties) UnmarshalJSON

func (r *EventListResponsePermissionUpdatedProperties) UnmarshalJSON(data []byte) error

type EventListResponsePermissionUpdatedPropertiesTime

type EventListResponsePermissionUpdatedPropertiesTime struct {
	Created float64 `json:"created,required"`
	// JSON contains metadata for fields, check presence with [respjson.Field.Valid].
	JSON struct {
		Created     respjson.Field
		ExtraFields map[string]respjson.Field
		// contains filtered or unexported fields
	} `json:"-"`
}

func (EventListResponsePermissionUpdatedPropertiesTime) RawJSON

Returns the unmodified JSON received from the API

func (*EventListResponsePermissionUpdatedPropertiesTime) UnmarshalJSON

type EventListResponseServerConnected

type EventListResponseServerConnected struct {
	Properties any                      `json:"properties,required"`
	Type       constant.ServerConnected `json:"type,required"`
	// JSON contains metadata for fields, check presence with [respjson.Field.Valid].
	JSON struct {
		Properties  respjson.Field
		Type        respjson.Field
		ExtraFields map[string]respjson.Field
		// contains filtered or unexported fields
	} `json:"-"`
}

func (EventListResponseServerConnected) RawJSON

Returns the unmodified JSON received from the API

func (*EventListResponseServerConnected) UnmarshalJSON

func (r *EventListResponseServerConnected) UnmarshalJSON(data []byte) error

type EventListResponseSessionDeleted

type EventListResponseSessionDeleted struct {
	Properties EventListResponseSessionDeletedProperties `json:"properties,required"`
	Type       constant.SessionDeleted                   `json:"type,required"`
	// JSON contains metadata for fields, check presence with [respjson.Field.Valid].
	JSON struct {
		Properties  respjson.Field
		Type        respjson.Field
		ExtraFields map[string]respjson.Field
		// contains filtered or unexported fields
	} `json:"-"`
}

func (EventListResponseSessionDeleted) RawJSON

Returns the unmodified JSON received from the API

func (*EventListResponseSessionDeleted) UnmarshalJSON

func (r *EventListResponseSessionDeleted) UnmarshalJSON(data []byte) error

type EventListResponseSessionDeletedProperties

type EventListResponseSessionDeletedProperties struct {
	Info Session `json:"info,required"`
	// JSON contains metadata for fields, check presence with [respjson.Field.Valid].
	JSON struct {
		Info        respjson.Field
		ExtraFields map[string]respjson.Field
		// contains filtered or unexported fields
	} `json:"-"`
}

func (EventListResponseSessionDeletedProperties) RawJSON

Returns the unmodified JSON received from the API

func (*EventListResponseSessionDeletedProperties) UnmarshalJSON

func (r *EventListResponseSessionDeletedProperties) UnmarshalJSON(data []byte) error

type EventListResponseSessionError

type EventListResponseSessionError struct {
	Properties EventListResponseSessionErrorProperties `json:"properties,required"`
	Type       constant.SessionError                   `json:"type,required"`
	// JSON contains metadata for fields, check presence with [respjson.Field.Valid].
	JSON struct {
		Properties  respjson.Field
		Type        respjson.Field
		ExtraFields map[string]respjson.Field
		// contains filtered or unexported fields
	} `json:"-"`
}

func (EventListResponseSessionError) RawJSON

Returns the unmodified JSON received from the API

func (*EventListResponseSessionError) UnmarshalJSON

func (r *EventListResponseSessionError) UnmarshalJSON(data []byte) error

type EventListResponseSessionErrorProperties

type EventListResponseSessionErrorProperties struct {
	Error     EventListResponseSessionErrorPropertiesErrorUnion `json:"error"`
	SessionID string                                            `json:"sessionID"`
	// JSON contains metadata for fields, check presence with [respjson.Field.Valid].
	JSON struct {
		Error       respjson.Field
		SessionID   respjson.Field
		ExtraFields map[string]respjson.Field
		// contains filtered or unexported fields
	} `json:"-"`
}

func (EventListResponseSessionErrorProperties) RawJSON

Returns the unmodified JSON received from the API

func (*EventListResponseSessionErrorProperties) UnmarshalJSON

func (r *EventListResponseSessionErrorProperties) UnmarshalJSON(data []byte) error

type EventListResponseSessionErrorPropertiesErrorUnion

type EventListResponseSessionErrorPropertiesErrorUnion struct {
	// This field is a union of [ProviderAuthErrorData], [UnknownErrorData], [any],
	// [any]
	Data EventListResponseSessionErrorPropertiesErrorUnionData `json:"data"`
	// Any of "ProviderAuthError", "UnknownError", "MessageOutputLengthError",
	// "MessageAbortedError".
	Name string `json:"name"`
	JSON struct {
		Data respjson.Field
		Name respjson.Field
		// contains filtered or unexported fields
	} `json:"-"`
}

EventListResponseSessionErrorPropertiesErrorUnion contains all possible properties and values from ProviderAuthError, UnknownError, OutputLengthError, AbortedError.

Use the EventListResponseSessionErrorPropertiesErrorUnion.AsAny method to switch on the variant.

Use the methods beginning with 'As' to cast the union to one of its variants.

func (EventListResponseSessionErrorPropertiesErrorUnion) AsAny

func (u EventListResponseSessionErrorPropertiesErrorUnion) AsAny() anyEventListResponseSessionErrorPropertiesError

Use the following switch statement to find the correct variant

switch variant := EventListResponseSessionErrorPropertiesErrorUnion.AsAny().(type) {
case opencodesdk.ProviderAuthError:
case opencodesdk.UnknownError:
case opencodesdk.OutputLengthError:
case opencodesdk.AbortedError:
default:
  fmt.Errorf("no variant present")
}

func (EventListResponseSessionErrorPropertiesErrorUnion) AsMessageAbortedError

func (EventListResponseSessionErrorPropertiesErrorUnion) AsMessageOutputLengthError

func (u EventListResponseSessionErrorPropertiesErrorUnion) AsMessageOutputLengthError() (v OutputLengthError)

func (EventListResponseSessionErrorPropertiesErrorUnion) AsProviderAuthError

func (EventListResponseSessionErrorPropertiesErrorUnion) AsUnknownError

func (EventListResponseSessionErrorPropertiesErrorUnion) RawJSON

Returns the unmodified JSON received from the API

func (*EventListResponseSessionErrorPropertiesErrorUnion) UnmarshalJSON

type EventListResponseSessionErrorPropertiesErrorUnionData

type EventListResponseSessionErrorPropertiesErrorUnionData struct {
	// This field will be present if the value is a [any] instead of an object.
	OfAbortedErrorData any    `json:",inline"`
	Message            string `json:"message"`
	// This field is from variant [ProviderAuthErrorData].
	ProviderID string `json:"providerID"`
	JSON       struct {
		OfAbortedErrorData respjson.Field
		Message            respjson.Field
		ProviderID         respjson.Field
		// contains filtered or unexported fields
	} `json:"-"`
}

EventListResponseSessionErrorPropertiesErrorUnionData is an implicit subunion of EventListResponseSessionErrorPropertiesErrorUnion. EventListResponseSessionErrorPropertiesErrorUnionData provides convenient access to the sub-properties of the union.

For type safety it is recommended to directly use a variant of the EventListResponseSessionErrorPropertiesErrorUnion.

If the underlying value is not a json object, one of the following properties will be valid: OfAbortedErrorData]

func (*EventListResponseSessionErrorPropertiesErrorUnionData) UnmarshalJSON

type EventListResponseSessionIdle

type EventListResponseSessionIdle struct {
	Properties EventListResponseSessionIdleProperties `json:"properties,required"`
	Type       constant.SessionIdle                   `json:"type,required"`
	// JSON contains metadata for fields, check presence with [respjson.Field.Valid].
	JSON struct {
		Properties  respjson.Field
		Type        respjson.Field
		ExtraFields map[string]respjson.Field
		// contains filtered or unexported fields
	} `json:"-"`
}

func (EventListResponseSessionIdle) RawJSON

Returns the unmodified JSON received from the API

func (*EventListResponseSessionIdle) UnmarshalJSON

func (r *EventListResponseSessionIdle) UnmarshalJSON(data []byte) error

type EventListResponseSessionIdleProperties

type EventListResponseSessionIdleProperties struct {
	SessionID string `json:"sessionID,required"`
	// JSON contains metadata for fields, check presence with [respjson.Field.Valid].
	JSON struct {
		SessionID   respjson.Field
		ExtraFields map[string]respjson.Field
		// contains filtered or unexported fields
	} `json:"-"`
}

func (EventListResponseSessionIdleProperties) RawJSON

Returns the unmodified JSON received from the API

func (*EventListResponseSessionIdleProperties) UnmarshalJSON

func (r *EventListResponseSessionIdleProperties) UnmarshalJSON(data []byte) error

type EventListResponseSessionUpdated

type EventListResponseSessionUpdated struct {
	Properties EventListResponseSessionUpdatedProperties `json:"properties,required"`
	Type       constant.SessionUpdated                   `json:"type,required"`
	// JSON contains metadata for fields, check presence with [respjson.Field.Valid].
	JSON struct {
		Properties  respjson.Field
		Type        respjson.Field
		ExtraFields map[string]respjson.Field
		// contains filtered or unexported fields
	} `json:"-"`
}

func (EventListResponseSessionUpdated) RawJSON

Returns the unmodified JSON received from the API

func (*EventListResponseSessionUpdated) UnmarshalJSON

func (r *EventListResponseSessionUpdated) UnmarshalJSON(data []byte) error

type EventListResponseSessionUpdatedProperties

type EventListResponseSessionUpdatedProperties struct {
	Info Session `json:"info,required"`
	// JSON contains metadata for fields, check presence with [respjson.Field.Valid].
	JSON struct {
		Info        respjson.Field
		ExtraFields map[string]respjson.Field
		// contains filtered or unexported fields
	} `json:"-"`
}

func (EventListResponseSessionUpdatedProperties) RawJSON

Returns the unmodified JSON received from the API

func (*EventListResponseSessionUpdatedProperties) UnmarshalJSON

func (r *EventListResponseSessionUpdatedProperties) UnmarshalJSON(data []byte) error

type EventListResponseStorageWrite

type EventListResponseStorageWrite struct {
	Properties EventListResponseStorageWriteProperties `json:"properties,required"`
	Type       constant.StorageWrite                   `json:"type,required"`
	// JSON contains metadata for fields, check presence with [respjson.Field.Valid].
	JSON struct {
		Properties  respjson.Field
		Type        respjson.Field
		ExtraFields map[string]respjson.Field
		// contains filtered or unexported fields
	} `json:"-"`
}

func (EventListResponseStorageWrite) RawJSON

Returns the unmodified JSON received from the API

func (*EventListResponseStorageWrite) UnmarshalJSON

func (r *EventListResponseStorageWrite) UnmarshalJSON(data []byte) error

type EventListResponseStorageWriteProperties

type EventListResponseStorageWriteProperties struct {
	Key     string `json:"key,required"`
	Content any    `json:"content"`
	// JSON contains metadata for fields, check presence with [respjson.Field.Valid].
	JSON struct {
		Key         respjson.Field
		Content     respjson.Field
		ExtraFields map[string]respjson.Field
		// contains filtered or unexported fields
	} `json:"-"`
}

func (EventListResponseStorageWriteProperties) RawJSON

Returns the unmodified JSON received from the API

func (*EventListResponseStorageWriteProperties) UnmarshalJSON

func (r *EventListResponseStorageWriteProperties) UnmarshalJSON(data []byte) error

type EventListResponseUnion

type EventListResponseUnion struct {
	// This field is a union of [EventListResponseInstallationUpdatedProperties],
	// [EventListResponseLspClientDiagnosticsProperties],
	// [EventListResponseMessageUpdatedProperties],
	// [EventListResponseMessageRemovedProperties],
	// [EventListResponseMessagePartUpdatedProperties],
	// [EventListResponseMessagePartRemovedProperties],
	// [EventListResponseStorageWriteProperties],
	// [EventListResponsePermissionUpdatedProperties],
	// [EventListResponsePermissionRepliedProperties],
	// [EventListResponseFileEditedProperties],
	// [EventListResponseSessionUpdatedProperties],
	// [EventListResponseSessionDeletedProperties],
	// [EventListResponseSessionIdleProperties],
	// [EventListResponseSessionErrorProperties], [any],
	// [EventListResponseFileWatcherUpdatedProperties],
	// [EventListResponseIdeInstalledProperties]
	Properties EventListResponseUnionProperties `json:"properties"`
	// Any of "installation.updated", "lsp.client.diagnostics", "message.updated",
	// "message.removed", "message.part.updated", "message.part.removed",
	// "storage.write", "permission.updated", "permission.replied", "file.edited",
	// "session.updated", "session.deleted", "session.idle", "session.error",
	// "server.connected", "file.watcher.updated", "ide.installed".
	Type string `json:"type"`
	JSON struct {
		Properties respjson.Field
		Type       respjson.Field
		// contains filtered or unexported fields
	} `json:"-"`
}

EventListResponseUnion contains all possible properties and values from EventListResponseInstallationUpdated, EventListResponseLspClientDiagnostics, EventListResponseMessageUpdated, EventListResponseMessageRemoved, EventListResponseMessagePartUpdated, EventListResponseMessagePartRemoved, EventListResponseStorageWrite, EventListResponsePermissionUpdated, EventListResponsePermissionReplied, EventListResponseFileEdited, EventListResponseSessionUpdated, EventListResponseSessionDeleted, EventListResponseSessionIdle, EventListResponseSessionError, EventListResponseServerConnected, EventListResponseFileWatcherUpdated, EventListResponseIdeInstalled.

Use the EventListResponseUnion.AsAny method to switch on the variant.

Use the methods beginning with 'As' to cast the union to one of its variants.

func (EventListResponseUnion) AsAny

func (u EventListResponseUnion) AsAny() anyEventListResponse

Use the following switch statement to find the correct variant

switch variant := EventListResponseUnion.AsAny().(type) {
case opencodesdk.EventListResponseInstallationUpdated:
case opencodesdk.EventListResponseLspClientDiagnostics:
case opencodesdk.EventListResponseMessageUpdated:
case opencodesdk.EventListResponseMessageRemoved:
case opencodesdk.EventListResponseMessagePartUpdated:
case opencodesdk.EventListResponseMessagePartRemoved:
case opencodesdk.EventListResponseStorageWrite:
case opencodesdk.EventListResponsePermissionUpdated:
case opencodesdk.EventListResponsePermissionReplied:
case opencodesdk.EventListResponseFileEdited:
case opencodesdk.EventListResponseSessionUpdated:
case opencodesdk.EventListResponseSessionDeleted:
case opencodesdk.EventListResponseSessionIdle:
case opencodesdk.EventListResponseSessionError:
case opencodesdk.EventListResponseServerConnected:
case opencodesdk.EventListResponseFileWatcherUpdated:
case opencodesdk.EventListResponseIdeInstalled:
default:
  fmt.Errorf("no variant present")
}

func (EventListResponseUnion) AsFileEdited

func (EventListResponseUnion) AsFileWatcherUpdated

func (u EventListResponseUnion) AsFileWatcherUpdated() (v EventListResponseFileWatcherUpdated)

func (EventListResponseUnion) AsIdeInstalled

func (EventListResponseUnion) AsInstallationUpdated

func (u EventListResponseUnion) AsInstallationUpdated() (v EventListResponseInstallationUpdated)

func (EventListResponseUnion) AsLspClientDiagnostics

func (u EventListResponseUnion) AsLspClientDiagnostics() (v EventListResponseLspClientDiagnostics)

func (EventListResponseUnion) AsMessagePartRemoved

func (u EventListResponseUnion) AsMessagePartRemoved() (v EventListResponseMessagePartRemoved)

func (EventListResponseUnion) AsMessagePartUpdated

func (u EventListResponseUnion) AsMessagePartUpdated() (v EventListResponseMessagePartUpdated)

func (EventListResponseUnion) AsMessageRemoved

func (EventListResponseUnion) AsMessageUpdated

func (EventListResponseUnion) AsPermissionReplied

func (u EventListResponseUnion) AsPermissionReplied() (v EventListResponsePermissionReplied)

func (EventListResponseUnion) AsPermissionUpdated

func (u EventListResponseUnion) AsPermissionUpdated() (v EventListResponsePermissionUpdated)

func (EventListResponseUnion) AsServerConnected

func (u EventListResponseUnion) AsServerConnected() (v EventListResponseServerConnected)

func (EventListResponseUnion) AsSessionDeleted

func (EventListResponseUnion) AsSessionError

func (EventListResponseUnion) AsSessionIdle

func (EventListResponseUnion) AsSessionUpdated

func (EventListResponseUnion) AsStorageWrite

func (EventListResponseUnion) RawJSON

func (u EventListResponseUnion) RawJSON() string

Returns the unmodified JSON received from the API

func (*EventListResponseUnion) UnmarshalJSON

func (r *EventListResponseUnion) UnmarshalJSON(data []byte) error

type EventListResponseUnionProperties

type EventListResponseUnionProperties struct {
	// This field will be present if the value is a [any] instead of an object.
	OfEventListResponseServerConnectedProperties any `json:",inline"`
	// This field is from variant [EventListResponseInstallationUpdatedProperties].
	Version string `json:"version"`
	// This field is from variant [EventListResponseLspClientDiagnosticsProperties].
	Path string `json:"path"`
	// This field is from variant [EventListResponseLspClientDiagnosticsProperties].
	ServerID string `json:"serverID"`
	// This field is a union of [MessageUnion], [Session]
	Info      EventListResponseUnionPropertiesInfo `json:"info"`
	MessageID string                               `json:"messageID"`
	SessionID string                               `json:"sessionID"`
	// This field is from variant [EventListResponseMessagePartUpdatedProperties].
	Part PartUnion `json:"part"`
	// This field is from variant [EventListResponseMessagePartRemovedProperties].
	PartID string `json:"partID"`
	// This field is from variant [EventListResponseStorageWriteProperties].
	Key string `json:"key"`
	// This field is from variant [EventListResponseStorageWriteProperties].
	Content any `json:"content"`
	// This field is from variant [EventListResponsePermissionUpdatedProperties].
	ID string `json:"id"`
	// This field is from variant [EventListResponsePermissionUpdatedProperties].
	Metadata map[string]any `json:"metadata"`
	// This field is from variant [EventListResponsePermissionUpdatedProperties].
	Time EventListResponsePermissionUpdatedPropertiesTime `json:"time"`
	// This field is from variant [EventListResponsePermissionUpdatedProperties].
	Title string `json:"title"`
	// This field is from variant [EventListResponsePermissionUpdatedProperties].
	Type string `json:"type"`
	// This field is from variant [EventListResponsePermissionUpdatedProperties].
	CallID string `json:"callID"`
	// This field is from variant [EventListResponsePermissionUpdatedProperties].
	Pattern string `json:"pattern"`
	// This field is from variant [EventListResponsePermissionRepliedProperties].
	PermissionID string `json:"permissionID"`
	// This field is from variant [EventListResponsePermissionRepliedProperties].
	Response string `json:"response"`
	File     string `json:"file"`
	// This field is from variant [EventListResponseSessionErrorProperties].
	Error EventListResponseSessionErrorPropertiesErrorUnion `json:"error"`
	// This field is from variant [EventListResponseFileWatcherUpdatedProperties].
	Event EventListResponseFileWatcherUpdatedPropertiesEvent `json:"event"`
	// This field is from variant [EventListResponseIdeInstalledProperties].
	Ide  string `json:"ide"`
	JSON struct {
		OfEventListResponseServerConnectedProperties respjson.Field
		Version                                      respjson.Field
		Path                                         respjson.Field
		ServerID                                     respjson.Field
		Info                                         respjson.Field
		MessageID                                    respjson.Field
		SessionID                                    respjson.Field
		Part                                         respjson.Field
		PartID                                       respjson.Field
		Key                                          respjson.Field
		Content                                      respjson.Field
		ID                                           respjson.Field
		Metadata                                     respjson.Field
		Time                                         respjson.Field
		Title                                        respjson.Field
		Type                                         respjson.Field
		CallID                                       respjson.Field
		Pattern                                      respjson.Field
		PermissionID                                 respjson.Field
		Response                                     respjson.Field
		File                                         respjson.Field
		Error                                        respjson.Field
		Event                                        respjson.Field
		Ide                                          respjson.Field
		// contains filtered or unexported fields
	} `json:"-"`
}

EventListResponseUnionProperties is an implicit subunion of EventListResponseUnion. EventListResponseUnionProperties provides convenient access to the sub-properties of the union.

For type safety it is recommended to directly use a variant of the EventListResponseUnion.

If the underlying value is not a json object, one of the following properties will be valid: OfEventListResponseServerConnectedProperties]

func (*EventListResponseUnionProperties) UnmarshalJSON

func (r *EventListResponseUnionProperties) UnmarshalJSON(data []byte) error

type EventListResponseUnionPropertiesInfo

type EventListResponseUnionPropertiesInfo struct {
	ID        string `json:"id"`
	Role      string `json:"role"`
	SessionID string `json:"sessionID"`
	// This field is a union of [MessageUserTime], [AssistantMessageTime],
	// [SessionTime]
	Time EventListResponseUnionPropertiesInfoTime `json:"time"`
	// This field is from variant [MessageUnion].
	Cost float64 `json:"cost"`
	// This field is from variant [MessageUnion].
	Mode string `json:"mode"`
	// This field is from variant [MessageUnion].
	ModelID string `json:"modelID"`
	// This field is from variant [MessageUnion].
	Path AssistantMessagePath `json:"path"`
	// This field is from variant [MessageUnion].
	ProviderID string `json:"providerID"`
	// This field is from variant [MessageUnion].
	System []string `json:"system"`
	// This field is from variant [MessageUnion].
	Tokens AssistantMessageTokens `json:"tokens"`
	// This field is from variant [MessageUnion].
	Error AssistantMessageErrorUnion `json:"error"`
	// This field is from variant [MessageUnion].
	Summary bool `json:"summary"`
	// This field is from variant [Session].
	Title string `json:"title"`
	// This field is from variant [Session].
	Version string `json:"version"`
	// This field is from variant [Session].
	ParentID string `json:"parentID"`
	// This field is from variant [Session].
	Revert SessionRevert `json:"revert"`
	// This field is from variant [Session].
	Share SessionShare `json:"share"`
	JSON  struct {
		ID         respjson.Field
		Role       respjson.Field
		SessionID  respjson.Field
		Time       respjson.Field
		Cost       respjson.Field
		Mode       respjson.Field
		ModelID    respjson.Field
		Path       respjson.Field
		ProviderID respjson.Field
		System     respjson.Field
		Tokens     respjson.Field
		Error      respjson.Field
		Summary    respjson.Field
		Title      respjson.Field
		Version    respjson.Field
		ParentID   respjson.Field
		Revert     respjson.Field
		Share      respjson.Field
		// contains filtered or unexported fields
	} `json:"-"`
}

EventListResponseUnionPropertiesInfo is an implicit subunion of EventListResponseUnion. EventListResponseUnionPropertiesInfo provides convenient access to the sub-properties of the union.

For type safety it is recommended to directly use a variant of the EventListResponseUnion.

func (*EventListResponseUnionPropertiesInfo) UnmarshalJSON

func (r *EventListResponseUnionPropertiesInfo) UnmarshalJSON(data []byte) error

type EventListResponseUnionPropertiesInfoTime

type EventListResponseUnionPropertiesInfoTime struct {
	Created float64 `json:"created"`
	// This field is from variant [AssistantMessageTime].
	Completed float64 `json:"completed"`
	// This field is from variant [SessionTime].
	Updated float64 `json:"updated"`
	JSON    struct {
		Created   respjson.Field
		Completed respjson.Field
		Updated   respjson.Field
		// contains filtered or unexported fields
	} `json:"-"`
}

EventListResponseUnionPropertiesInfoTime is an implicit subunion of EventListResponseUnion. EventListResponseUnionPropertiesInfoTime provides convenient access to the sub-properties of the union.

For type safety it is recommended to directly use a variant of the EventListResponseUnion.

func (*EventListResponseUnionPropertiesInfoTime) UnmarshalJSON

func (r *EventListResponseUnionPropertiesInfoTime) UnmarshalJSON(data []byte) error

type EventService

type EventService struct {
	Options []option.RequestOption
}

EventService contains methods and other services that help with interacting with the opencode-sdk API.

Note, unlike clients, this service does not read variables from the environment automatically. You should not instantiate this service directly, and instead use the NewEventService method instead.

func NewEventService

func NewEventService(opts ...option.RequestOption) (r EventService)

NewEventService generates a new service that applies the given options to each request. These options are applied after the parent client's options (if there is one), and before any request-specific options.

func (*EventService) List

func (r *EventService) List(ctx context.Context, opts ...option.RequestOption) (res *EventListResponseUnion, err error)

Get events

type FileGetParams

type FileGetParams struct {
	Path string `query:"path,required" json:"-"`
	// contains filtered or unexported fields
}

func (FileGetParams) URLQuery

func (r FileGetParams) URLQuery() (v url.Values, err error)

URLQuery serializes FileGetParams's query parameters as `url.Values`.

type FileGetResponse

type FileGetResponse struct {
	Content string `json:"content,required"`
	// Any of "raw", "patch".
	Type FileGetResponseType `json:"type,required"`
	// JSON contains metadata for fields, check presence with [respjson.Field.Valid].
	JSON struct {
		Content     respjson.Field
		Type        respjson.Field
		ExtraFields map[string]respjson.Field
		// contains filtered or unexported fields
	} `json:"-"`
}

func (FileGetResponse) RawJSON

func (r FileGetResponse) RawJSON() string

Returns the unmodified JSON received from the API

func (*FileGetResponse) UnmarshalJSON

func (r *FileGetResponse) UnmarshalJSON(data []byte) error

type FileGetResponseType

type FileGetResponseType string
const (
	FileGetResponseTypeRaw   FileGetResponseType = "raw"
	FileGetResponseTypePatch FileGetResponseType = "patch"
)

type FileGetStatusResponse

type FileGetStatusResponse struct {
	Added   int64  `json:"added,required"`
	Path    string `json:"path,required"`
	Removed int64  `json:"removed,required"`
	// Any of "added", "deleted", "modified".
	Status FileGetStatusResponseStatus `json:"status,required"`
	// JSON contains metadata for fields, check presence with [respjson.Field.Valid].
	JSON struct {
		Added       respjson.Field
		Path        respjson.Field
		Removed     respjson.Field
		Status      respjson.Field
		ExtraFields map[string]respjson.Field
		// contains filtered or unexported fields
	} `json:"-"`
}

func (FileGetStatusResponse) RawJSON

func (r FileGetStatusResponse) RawJSON() string

Returns the unmodified JSON received from the API

func (*FileGetStatusResponse) UnmarshalJSON

func (r *FileGetStatusResponse) UnmarshalJSON(data []byte) error

type FileGetStatusResponseStatus

type FileGetStatusResponseStatus string
const (
	FileGetStatusResponseStatusAdded    FileGetStatusResponseStatus = "added"
	FileGetStatusResponseStatusDeleted  FileGetStatusResponseStatus = "deleted"
	FileGetStatusResponseStatusModified FileGetStatusResponseStatus = "modified"
)

type FilePartSourceFile

type FilePartSourceFile struct {
	Path string             `json:"path,required"`
	Text FilePartSourceText `json:"text,required"`
	Type constant.File      `json:"type,required"`
	// JSON contains metadata for fields, check presence with [respjson.Field.Valid].
	JSON struct {
		Path        respjson.Field
		Text        respjson.Field
		Type        respjson.Field
		ExtraFields map[string]respjson.Field
		// contains filtered or unexported fields
	} `json:"-"`
}

func (FilePartSourceFile) RawJSON

func (r FilePartSourceFile) RawJSON() string

Returns the unmodified JSON received from the API

func (*FilePartSourceFile) UnmarshalJSON

func (r *FilePartSourceFile) UnmarshalJSON(data []byte) error

type FilePartSourceFileParam

type FilePartSourceFileParam struct {
	Path string                  `json:"path,required"`
	Text FilePartSourceTextParam `json:"text,omitzero,required"`
	// This field can be elided, and will marshal its zero value as "file".
	Type constant.File `json:"type,required"`
	// contains filtered or unexported fields
}

The properties Path, Text, Type are required.

func (FilePartSourceFileParam) MarshalJSON

func (r FilePartSourceFileParam) MarshalJSON() (data []byte, err error)

func (*FilePartSourceFileParam) UnmarshalJSON

func (r *FilePartSourceFileParam) UnmarshalJSON(data []byte) error

type FilePartSourceSymbol

type FilePartSourceSymbol struct {
	Kind  int64              `json:"kind,required"`
	Name  string             `json:"name,required"`
	Path  string             `json:"path,required"`
	Range Range              `json:"range,required"`
	Text  FilePartSourceText `json:"text,required"`
	Type  constant.Symbol    `json:"type,required"`
	// JSON contains metadata for fields, check presence with [respjson.Field.Valid].
	JSON struct {
		Kind        respjson.Field
		Name        respjson.Field
		Path        respjson.Field
		Range       respjson.Field
		Text        respjson.Field
		Type        respjson.Field
		ExtraFields map[string]respjson.Field
		// contains filtered or unexported fields
	} `json:"-"`
}

func (FilePartSourceSymbol) RawJSON

func (r FilePartSourceSymbol) RawJSON() string

Returns the unmodified JSON received from the API

func (*FilePartSourceSymbol) UnmarshalJSON

func (r *FilePartSourceSymbol) UnmarshalJSON(data []byte) error

type FilePartSourceSymbolParam

type FilePartSourceSymbolParam struct {
	Kind  int64                   `json:"kind,required"`
	Name  string                  `json:"name,required"`
	Path  string                  `json:"path,required"`
	Range RangeParam              `json:"range,omitzero,required"`
	Text  FilePartSourceTextParam `json:"text,omitzero,required"`
	// This field can be elided, and will marshal its zero value as "symbol".
	Type constant.Symbol `json:"type,required"`
	// contains filtered or unexported fields
}

The properties Kind, Name, Path, Range, Text, Type are required.

func (FilePartSourceSymbolParam) MarshalJSON

func (r FilePartSourceSymbolParam) MarshalJSON() (data []byte, err error)

func (*FilePartSourceSymbolParam) UnmarshalJSON

func (r *FilePartSourceSymbolParam) UnmarshalJSON(data []byte) error

type FilePartSourceText

type FilePartSourceText struct {
	End   int64  `json:"end,required"`
	Start int64  `json:"start,required"`
	Value string `json:"value,required"`
	// JSON contains metadata for fields, check presence with [respjson.Field.Valid].
	JSON struct {
		End         respjson.Field
		Start       respjson.Field
		Value       respjson.Field
		ExtraFields map[string]respjson.Field
		// contains filtered or unexported fields
	} `json:"-"`
}

func (FilePartSourceText) RawJSON

func (r FilePartSourceText) RawJSON() string

Returns the unmodified JSON received from the API

func (FilePartSourceText) ToParam

ToParam converts this FilePartSourceText to a FilePartSourceTextParam.

Warning: the fields of the param type will not be present. ToParam should only be used at the last possible moment before sending a request. Test for this with FilePartSourceTextParam.Overrides()

func (*FilePartSourceText) UnmarshalJSON

func (r *FilePartSourceText) UnmarshalJSON(data []byte) error

type FilePartSourceTextParam

type FilePartSourceTextParam struct {
	End   int64  `json:"end,required"`
	Start int64  `json:"start,required"`
	Value string `json:"value,required"`
	// contains filtered or unexported fields
}

The properties End, Start, Value are required.

func (FilePartSourceTextParam) MarshalJSON

func (r FilePartSourceTextParam) MarshalJSON() (data []byte, err error)

func (*FilePartSourceTextParam) UnmarshalJSON

func (r *FilePartSourceTextParam) UnmarshalJSON(data []byte) error

type FilePartSourceUnion

type FilePartSourceUnion struct {
	Path string `json:"path"`
	// This field is from variant [FilePartSourceFile].
	Text FilePartSourceText `json:"text"`
	// Any of "file", "symbol".
	Type string `json:"type"`
	// This field is from variant [FilePartSourceSymbol].
	Kind int64 `json:"kind"`
	// This field is from variant [FilePartSourceSymbol].
	Name string `json:"name"`
	// This field is from variant [FilePartSourceSymbol].
	Range Range `json:"range"`
	JSON  struct {
		Path  respjson.Field
		Text  respjson.Field
		Type  respjson.Field
		Kind  respjson.Field
		Name  respjson.Field
		Range respjson.Field
		// contains filtered or unexported fields
	} `json:"-"`
}

FilePartSourceUnion contains all possible properties and values from FilePartSourceFile, FilePartSourceSymbol.

Use the FilePartSourceUnion.AsAny method to switch on the variant.

Use the methods beginning with 'As' to cast the union to one of its variants.

func (FilePartSourceUnion) AsAny

func (u FilePartSourceUnion) AsAny() anyFilePartSource

Use the following switch statement to find the correct variant

switch variant := FilePartSourceUnion.AsAny().(type) {
case opencodesdk.FilePartSourceFile:
case opencodesdk.FilePartSourceSymbol:
default:
  fmt.Errorf("no variant present")
}

func (FilePartSourceUnion) AsFile

func (u FilePartSourceUnion) AsFile() (v FilePartSourceFile)

func (FilePartSourceUnion) AsSymbol

func (u FilePartSourceUnion) AsSymbol() (v FilePartSourceSymbol)

func (FilePartSourceUnion) RawJSON

func (u FilePartSourceUnion) RawJSON() string

Returns the unmodified JSON received from the API

func (FilePartSourceUnion) ToParam

ToParam converts this FilePartSourceUnion to a FilePartSourceUnionParam.

Warning: the fields of the param type will not be present. ToParam should only be used at the last possible moment before sending a request. Test for this with FilePartSourceUnionParam.Overrides()

func (*FilePartSourceUnion) UnmarshalJSON

func (r *FilePartSourceUnion) UnmarshalJSON(data []byte) error

type FilePartSourceUnionParam

type FilePartSourceUnionParam struct {
	OfFile   *FilePartSourceFileParam   `json:",omitzero,inline"`
	OfSymbol *FilePartSourceSymbolParam `json:",omitzero,inline"`
	// contains filtered or unexported fields
}

Only one field can be non-zero.

Use param.IsOmitted to confirm if a field is set.

func FilePartSourceParamOfFile

func FilePartSourceParamOfFile(path string, text FilePartSourceTextParam) FilePartSourceUnionParam

func (FilePartSourceUnionParam) GetKind

func (u FilePartSourceUnionParam) GetKind() *int64

Returns a pointer to the underlying variant's property, if present.

func (FilePartSourceUnionParam) GetName

func (u FilePartSourceUnionParam) GetName() *string

Returns a pointer to the underlying variant's property, if present.

func (FilePartSourceUnionParam) GetPath

func (u FilePartSourceUnionParam) GetPath() *string

Returns a pointer to the underlying variant's property, if present.

func (FilePartSourceUnionParam) GetRange

func (u FilePartSourceUnionParam) GetRange() *RangeParam

Returns a pointer to the underlying variant's property, if present.

func (FilePartSourceUnionParam) GetText

Returns a pointer to the underlying variant's Text property, if present.

func (FilePartSourceUnionParam) GetType

func (u FilePartSourceUnionParam) GetType() *string

Returns a pointer to the underlying variant's property, if present.

func (FilePartSourceUnionParam) MarshalJSON

func (u FilePartSourceUnionParam) MarshalJSON() ([]byte, error)

func (*FilePartSourceUnionParam) UnmarshalJSON

func (u *FilePartSourceUnionParam) UnmarshalJSON(data []byte) error

type FileService

type FileService struct {
	Options []option.RequestOption
}

FileService contains methods and other services that help with interacting with the opencode-sdk API.

Note, unlike clients, this service does not read variables from the environment automatically. You should not instantiate this service directly, and instead use the NewFileService method instead.

func NewFileService

func NewFileService(opts ...option.RequestOption) (r FileService)

NewFileService generates a new service that applies the given options to each request. These options are applied after the parent client's options (if there is one), and before any request-specific options.

func (*FileService) Get

func (r *FileService) Get(ctx context.Context, query FileGetParams, opts ...option.RequestOption) (res *FileGetResponse, err error)

Read a file

func (*FileService) GetStatus

func (r *FileService) GetStatus(ctx context.Context, opts ...option.RequestOption) (res *[]FileGetStatusResponse, err error)

Get file status

type FindGetFileParams

type FindGetFileParams struct {
	Query string `query:"query,required" json:"-"`
	// contains filtered or unexported fields
}

func (FindGetFileParams) URLQuery

func (r FindGetFileParams) URLQuery() (v url.Values, err error)

URLQuery serializes FindGetFileParams's query parameters as `url.Values`.

type FindGetParams

type FindGetParams struct {
	Pattern string `query:"pattern,required" json:"-"`
	// contains filtered or unexported fields
}

func (FindGetParams) URLQuery

func (r FindGetParams) URLQuery() (v url.Values, err error)

URLQuery serializes FindGetParams's query parameters as `url.Values`.

type FindGetResponse

type FindGetResponse struct {
	AbsoluteOffset float64                   `json:"absolute_offset,required"`
	LineNumber     float64                   `json:"line_number,required"`
	Lines          FindGetResponseLines      `json:"lines,required"`
	Path           FindGetResponsePath       `json:"path,required"`
	Submatches     []FindGetResponseSubmatch `json:"submatches,required"`
	// JSON contains metadata for fields, check presence with [respjson.Field.Valid].
	JSON struct {
		AbsoluteOffset respjson.Field
		LineNumber     respjson.Field
		Lines          respjson.Field
		Path           respjson.Field
		Submatches     respjson.Field
		ExtraFields    map[string]respjson.Field
		// contains filtered or unexported fields
	} `json:"-"`
}

func (FindGetResponse) RawJSON

func (r FindGetResponse) RawJSON() string

Returns the unmodified JSON received from the API

func (*FindGetResponse) UnmarshalJSON

func (r *FindGetResponse) UnmarshalJSON(data []byte) error

type FindGetResponseLines

type FindGetResponseLines struct {
	Text string `json:"text,required"`
	// JSON contains metadata for fields, check presence with [respjson.Field.Valid].
	JSON struct {
		Text        respjson.Field
		ExtraFields map[string]respjson.Field
		// contains filtered or unexported fields
	} `json:"-"`
}

func (FindGetResponseLines) RawJSON

func (r FindGetResponseLines) RawJSON() string

Returns the unmodified JSON received from the API

func (*FindGetResponseLines) UnmarshalJSON

func (r *FindGetResponseLines) UnmarshalJSON(data []byte) error

type FindGetResponsePath

type FindGetResponsePath struct {
	Text string `json:"text,required"`
	// JSON contains metadata for fields, check presence with [respjson.Field.Valid].
	JSON struct {
		Text        respjson.Field
		ExtraFields map[string]respjson.Field
		// contains filtered or unexported fields
	} `json:"-"`
}

func (FindGetResponsePath) RawJSON

func (r FindGetResponsePath) RawJSON() string

Returns the unmodified JSON received from the API

func (*FindGetResponsePath) UnmarshalJSON

func (r *FindGetResponsePath) UnmarshalJSON(data []byte) error

type FindGetResponseSubmatch

type FindGetResponseSubmatch struct {
	End   float64                      `json:"end,required"`
	Match FindGetResponseSubmatchMatch `json:"match,required"`
	Start float64                      `json:"start,required"`
	// JSON contains metadata for fields, check presence with [respjson.Field.Valid].
	JSON struct {
		End         respjson.Field
		Match       respjson.Field
		Start       respjson.Field
		ExtraFields map[string]respjson.Field
		// contains filtered or unexported fields
	} `json:"-"`
}

func (FindGetResponseSubmatch) RawJSON

func (r FindGetResponseSubmatch) RawJSON() string

Returns the unmodified JSON received from the API

func (*FindGetResponseSubmatch) UnmarshalJSON

func (r *FindGetResponseSubmatch) UnmarshalJSON(data []byte) error

type FindGetResponseSubmatchMatch

type FindGetResponseSubmatchMatch struct {
	Text string `json:"text,required"`
	// JSON contains metadata for fields, check presence with [respjson.Field.Valid].
	JSON struct {
		Text        respjson.Field
		ExtraFields map[string]respjson.Field
		// contains filtered or unexported fields
	} `json:"-"`
}

func (FindGetResponseSubmatchMatch) RawJSON

Returns the unmodified JSON received from the API

func (*FindGetResponseSubmatchMatch) UnmarshalJSON

func (r *FindGetResponseSubmatchMatch) UnmarshalJSON(data []byte) error

type FindGetSymbolParams

type FindGetSymbolParams struct {
	Query string `query:"query,required" json:"-"`
	// contains filtered or unexported fields
}

func (FindGetSymbolParams) URLQuery

func (r FindGetSymbolParams) URLQuery() (v url.Values, err error)

URLQuery serializes FindGetSymbolParams's query parameters as `url.Values`.

type FindGetSymbolResponse

type FindGetSymbolResponse struct {
	Kind     float64                       `json:"kind,required"`
	Location FindGetSymbolResponseLocation `json:"location,required"`
	Name     string                        `json:"name,required"`
	// JSON contains metadata for fields, check presence with [respjson.Field.Valid].
	JSON struct {
		Kind        respjson.Field
		Location    respjson.Field
		Name        respjson.Field
		ExtraFields map[string]respjson.Field
		// contains filtered or unexported fields
	} `json:"-"`
}

func (FindGetSymbolResponse) RawJSON

func (r FindGetSymbolResponse) RawJSON() string

Returns the unmodified JSON received from the API

func (*FindGetSymbolResponse) UnmarshalJSON

func (r *FindGetSymbolResponse) UnmarshalJSON(data []byte) error

type FindGetSymbolResponseLocation

type FindGetSymbolResponseLocation struct {
	Range Range  `json:"range,required"`
	Uri   string `json:"uri,required"`
	// JSON contains metadata for fields, check presence with [respjson.Field.Valid].
	JSON struct {
		Range       respjson.Field
		Uri         respjson.Field
		ExtraFields map[string]respjson.Field
		// contains filtered or unexported fields
	} `json:"-"`
}

func (FindGetSymbolResponseLocation) RawJSON

Returns the unmodified JSON received from the API

func (*FindGetSymbolResponseLocation) UnmarshalJSON

func (r *FindGetSymbolResponseLocation) UnmarshalJSON(data []byte) error

type FindService

type FindService struct {
	Options []option.RequestOption
}

FindService contains methods and other services that help with interacting with the opencode-sdk API.

Note, unlike clients, this service does not read variables from the environment automatically. You should not instantiate this service directly, and instead use the NewFindService method instead.

func NewFindService

func NewFindService(opts ...option.RequestOption) (r FindService)

NewFindService generates a new service that applies the given options to each request. These options are applied after the parent client's options (if there is one), and before any request-specific options.

func (*FindService) Get

func (r *FindService) Get(ctx context.Context, query FindGetParams, opts ...option.RequestOption) (res *[]FindGetResponse, err error)

Find text in files

func (*FindService) GetFile

func (r *FindService) GetFile(ctx context.Context, query FindGetFileParams, opts ...option.RequestOption) (res *[]string, err error)

Find files

func (*FindService) GetSymbol

func (r *FindService) GetSymbol(ctx context.Context, query FindGetSymbolParams, opts ...option.RequestOption) (res *[]FindGetSymbolResponse, err error)

Find workspace symbols

type LogNewParams

type LogNewParams struct {
	// Log level
	//
	// Any of "debug", "info", "error", "warn".
	Level LogNewParamsLevel `json:"level,omitzero,required"`
	// Log message
	Message string `json:"message,required"`
	// Service name for the log entry
	Service string `json:"service,required"`
	// Additional metadata for the log entry
	Extra map[string]any `json:"extra,omitzero"`
	// contains filtered or unexported fields
}

func (LogNewParams) MarshalJSON

func (r LogNewParams) MarshalJSON() (data []byte, err error)

func (*LogNewParams) UnmarshalJSON

func (r *LogNewParams) UnmarshalJSON(data []byte) error

type LogNewParamsLevel

type LogNewParamsLevel string

Log level

const (
	LogNewParamsLevelDebug LogNewParamsLevel = "debug"
	LogNewParamsLevelInfo  LogNewParamsLevel = "info"
	LogNewParamsLevelError LogNewParamsLevel = "error"
	LogNewParamsLevelWarn  LogNewParamsLevel = "warn"
)

type LogService

type LogService struct {
	Options []option.RequestOption
}

LogService contains methods and other services that help with interacting with the opencode-sdk API.

Note, unlike clients, this service does not read variables from the environment automatically. You should not instantiate this service directly, and instead use the NewLogService method instead.

func NewLogService

func NewLogService(opts ...option.RequestOption) (r LogService)

NewLogService generates a new service that applies the given options to each request. These options are applied after the parent client's options (if there is one), and before any request-specific options.

func (*LogService) New

func (r *LogService) New(ctx context.Context, body LogNewParams, opts ...option.RequestOption) (res *bool, err error)

Write a log entry to the server logs

type MessageUnion

type MessageUnion struct {
	ID string `json:"id"`
	// Any of "user", "assistant".
	Role      string `json:"role"`
	SessionID string `json:"sessionID"`
	// This field is a union of [MessageUserTime], [AssistantMessageTime]
	Time MessageUnionTime `json:"time"`
	// This field is from variant [AssistantMessage].
	Cost float64 `json:"cost"`
	// This field is from variant [AssistantMessage].
	Mode string `json:"mode"`
	// This field is from variant [AssistantMessage].
	ModelID string `json:"modelID"`
	// This field is from variant [AssistantMessage].
	Path AssistantMessagePath `json:"path"`
	// This field is from variant [AssistantMessage].
	ProviderID string `json:"providerID"`
	// This field is from variant [AssistantMessage].
	System []string `json:"system"`
	// This field is from variant [AssistantMessage].
	Tokens AssistantMessageTokens `json:"tokens"`
	// This field is from variant [AssistantMessage].
	Error AssistantMessageErrorUnion `json:"error"`
	// This field is from variant [AssistantMessage].
	Summary bool `json:"summary"`
	JSON    struct {
		ID         respjson.Field
		Role       respjson.Field
		SessionID  respjson.Field
		Time       respjson.Field
		Cost       respjson.Field
		Mode       respjson.Field
		ModelID    respjson.Field
		Path       respjson.Field
		ProviderID respjson.Field
		System     respjson.Field
		Tokens     respjson.Field
		Error      respjson.Field
		Summary    respjson.Field
		// contains filtered or unexported fields
	} `json:"-"`
}

MessageUnion contains all possible properties and values from MessageUser, AssistantMessage.

Use the MessageUnion.AsAny method to switch on the variant.

Use the methods beginning with 'As' to cast the union to one of its variants.

func (MessageUnion) AsAny

func (u MessageUnion) AsAny() anyMessage

Use the following switch statement to find the correct variant

switch variant := MessageUnion.AsAny().(type) {
case opencodesdk.MessageUser:
case opencodesdk.AssistantMessage:
default:
  fmt.Errorf("no variant present")
}

func (MessageUnion) AsAssistant

func (u MessageUnion) AsAssistant() (v AssistantMessage)

func (MessageUnion) AsUser

func (u MessageUnion) AsUser() (v MessageUser)

func (MessageUnion) RawJSON

func (u MessageUnion) RawJSON() string

Returns the unmodified JSON received from the API

func (*MessageUnion) UnmarshalJSON

func (r *MessageUnion) UnmarshalJSON(data []byte) error

type MessageUnionTime

type MessageUnionTime struct {
	Created float64 `json:"created"`
	// This field is from variant [AssistantMessageTime].
	Completed float64 `json:"completed"`
	JSON      struct {
		Created   respjson.Field
		Completed respjson.Field
		// contains filtered or unexported fields
	} `json:"-"`
}

MessageUnionTime is an implicit subunion of MessageUnion. MessageUnionTime provides convenient access to the sub-properties of the union.

For type safety it is recommended to directly use a variant of the MessageUnion.

func (*MessageUnionTime) UnmarshalJSON

func (r *MessageUnionTime) UnmarshalJSON(data []byte) error

type MessageUser

type MessageUser struct {
	ID        string          `json:"id,required"`
	Role      constant.User   `json:"role,required"`
	SessionID string          `json:"sessionID,required"`
	Time      MessageUserTime `json:"time,required"`
	// JSON contains metadata for fields, check presence with [respjson.Field.Valid].
	JSON struct {
		ID          respjson.Field
		Role        respjson.Field
		SessionID   respjson.Field
		Time        respjson.Field
		ExtraFields map[string]respjson.Field
		// contains filtered or unexported fields
	} `json:"-"`
}

func (MessageUser) RawJSON

func (r MessageUser) RawJSON() string

Returns the unmodified JSON received from the API

func (*MessageUser) UnmarshalJSON

func (r *MessageUser) UnmarshalJSON(data []byte) error

type MessageUserTime

type MessageUserTime struct {
	Created float64 `json:"created,required"`
	// JSON contains metadata for fields, check presence with [respjson.Field.Valid].
	JSON struct {
		Created     respjson.Field
		ExtraFields map[string]respjson.Field
		// contains filtered or unexported fields
	} `json:"-"`
}

func (MessageUserTime) RawJSON

func (r MessageUserTime) RawJSON() string

Returns the unmodified JSON received from the API

func (*MessageUserTime) UnmarshalJSON

func (r *MessageUserTime) UnmarshalJSON(data []byte) error

type OutputLengthError

type OutputLengthError struct {
	Data any                               `json:"data,required"`
	Name constant.MessageOutputLengthError `json:"name,required"`
	// JSON contains metadata for fields, check presence with [respjson.Field.Valid].
	JSON struct {
		Data        respjson.Field
		Name        respjson.Field
		ExtraFields map[string]respjson.Field
		// contains filtered or unexported fields
	} `json:"-"`
}

func (OutputLengthError) RawJSON

func (r OutputLengthError) RawJSON() string

Returns the unmodified JSON received from the API

func (*OutputLengthError) UnmarshalJSON

func (r *OutputLengthError) UnmarshalJSON(data []byte) error

type PartAgent

type PartAgent struct {
	ID        string          `json:"id,required"`
	MessageID string          `json:"messageID,required"`
	Name      string          `json:"name,required"`
	SessionID string          `json:"sessionID,required"`
	Type      constant.Agent  `json:"type,required"`
	Source    PartAgentSource `json:"source"`
	// JSON contains metadata for fields, check presence with [respjson.Field.Valid].
	JSON struct {
		ID          respjson.Field
		MessageID   respjson.Field
		Name        respjson.Field
		SessionID   respjson.Field
		Type        respjson.Field
		Source      respjson.Field
		ExtraFields map[string]respjson.Field
		// contains filtered or unexported fields
	} `json:"-"`
}

func (PartAgent) RawJSON

func (r PartAgent) RawJSON() string

Returns the unmodified JSON received from the API

func (*PartAgent) UnmarshalJSON

func (r *PartAgent) UnmarshalJSON(data []byte) error

type PartAgentSource

type PartAgentSource struct {
	End   int64  `json:"end,required"`
	Start int64  `json:"start,required"`
	Value string `json:"value,required"`
	// JSON contains metadata for fields, check presence with [respjson.Field.Valid].
	JSON struct {
		End         respjson.Field
		Start       respjson.Field
		Value       respjson.Field
		ExtraFields map[string]respjson.Field
		// contains filtered or unexported fields
	} `json:"-"`
}

func (PartAgentSource) RawJSON

func (r PartAgentSource) RawJSON() string

Returns the unmodified JSON received from the API

func (*PartAgentSource) UnmarshalJSON

func (r *PartAgentSource) UnmarshalJSON(data []byte) error

type PartFile

type PartFile struct {
	ID        string              `json:"id,required"`
	MessageID string              `json:"messageID,required"`
	Mime      string              `json:"mime,required"`
	SessionID string              `json:"sessionID,required"`
	Type      constant.File       `json:"type,required"`
	URL       string              `json:"url,required"`
	Filename  string              `json:"filename"`
	Source    FilePartSourceUnion `json:"source"`
	// JSON contains metadata for fields, check presence with [respjson.Field.Valid].
	JSON struct {
		ID          respjson.Field
		MessageID   respjson.Field
		Mime        respjson.Field
		SessionID   respjson.Field
		Type        respjson.Field
		URL         respjson.Field
		Filename    respjson.Field
		Source      respjson.Field
		ExtraFields map[string]respjson.Field
		// contains filtered or unexported fields
	} `json:"-"`
}

func (PartFile) RawJSON

func (r PartFile) RawJSON() string

Returns the unmodified JSON received from the API

func (*PartFile) UnmarshalJSON

func (r *PartFile) UnmarshalJSON(data []byte) error

type PartPatch

type PartPatch struct {
	ID        string         `json:"id,required"`
	Files     []string       `json:"files,required"`
	Hash      string         `json:"hash,required"`
	MessageID string         `json:"messageID,required"`
	SessionID string         `json:"sessionID,required"`
	Type      constant.Patch `json:"type,required"`
	// JSON contains metadata for fields, check presence with [respjson.Field.Valid].
	JSON struct {
		ID          respjson.Field
		Files       respjson.Field
		Hash        respjson.Field
		MessageID   respjson.Field
		SessionID   respjson.Field
		Type        respjson.Field
		ExtraFields map[string]respjson.Field
		// contains filtered or unexported fields
	} `json:"-"`
}

func (PartPatch) RawJSON

func (r PartPatch) RawJSON() string

Returns the unmodified JSON received from the API

func (*PartPatch) UnmarshalJSON

func (r *PartPatch) UnmarshalJSON(data []byte) error

type PartReasoning

type PartReasoning struct {
	ID        string             `json:"id,required"`
	MessageID string             `json:"messageID,required"`
	SessionID string             `json:"sessionID,required"`
	Text      string             `json:"text,required"`
	Time      PartReasoningTime  `json:"time,required"`
	Type      constant.Reasoning `json:"type,required"`
	Metadata  map[string]any     `json:"metadata"`
	// JSON contains metadata for fields, check presence with [respjson.Field.Valid].
	JSON struct {
		ID          respjson.Field
		MessageID   respjson.Field
		SessionID   respjson.Field
		Text        respjson.Field
		Time        respjson.Field
		Type        respjson.Field
		Metadata    respjson.Field
		ExtraFields map[string]respjson.Field
		// contains filtered or unexported fields
	} `json:"-"`
}

func (PartReasoning) RawJSON

func (r PartReasoning) RawJSON() string

Returns the unmodified JSON received from the API

func (*PartReasoning) UnmarshalJSON

func (r *PartReasoning) UnmarshalJSON(data []byte) error

type PartReasoningTime

type PartReasoningTime struct {
	Start float64 `json:"start,required"`
	End   float64 `json:"end"`
	// JSON contains metadata for fields, check presence with [respjson.Field.Valid].
	JSON struct {
		Start       respjson.Field
		End         respjson.Field
		ExtraFields map[string]respjson.Field
		// contains filtered or unexported fields
	} `json:"-"`
}

func (PartReasoningTime) RawJSON

func (r PartReasoningTime) RawJSON() string

Returns the unmodified JSON received from the API

func (*PartReasoningTime) UnmarshalJSON

func (r *PartReasoningTime) UnmarshalJSON(data []byte) error

type PartSnapshot

type PartSnapshot struct {
	ID        string            `json:"id,required"`
	MessageID string            `json:"messageID,required"`
	SessionID string            `json:"sessionID,required"`
	Snapshot  string            `json:"snapshot,required"`
	Type      constant.Snapshot `json:"type,required"`
	// JSON contains metadata for fields, check presence with [respjson.Field.Valid].
	JSON struct {
		ID          respjson.Field
		MessageID   respjson.Field
		SessionID   respjson.Field
		Snapshot    respjson.Field
		Type        respjson.Field
		ExtraFields map[string]respjson.Field
		// contains filtered or unexported fields
	} `json:"-"`
}

func (PartSnapshot) RawJSON

func (r PartSnapshot) RawJSON() string

Returns the unmodified JSON received from the API

func (*PartSnapshot) UnmarshalJSON

func (r *PartSnapshot) UnmarshalJSON(data []byte) error

type PartStepFinish

type PartStepFinish struct {
	ID        string               `json:"id,required"`
	Cost      float64              `json:"cost,required"`
	MessageID string               `json:"messageID,required"`
	SessionID string               `json:"sessionID,required"`
	Tokens    PartStepFinishTokens `json:"tokens,required"`
	Type      constant.StepFinish  `json:"type,required"`
	// JSON contains metadata for fields, check presence with [respjson.Field.Valid].
	JSON struct {
		ID          respjson.Field
		Cost        respjson.Field
		MessageID   respjson.Field
		SessionID   respjson.Field
		Tokens      respjson.Field
		Type        respjson.Field
		ExtraFields map[string]respjson.Field
		// contains filtered or unexported fields
	} `json:"-"`
}

func (PartStepFinish) RawJSON

func (r PartStepFinish) RawJSON() string

Returns the unmodified JSON received from the API

func (*PartStepFinish) UnmarshalJSON

func (r *PartStepFinish) UnmarshalJSON(data []byte) error

type PartStepFinishTokens

type PartStepFinishTokens struct {
	Cache     PartStepFinishTokensCache `json:"cache,required"`
	Input     float64                   `json:"input,required"`
	Output    float64                   `json:"output,required"`
	Reasoning float64                   `json:"reasoning,required"`
	// JSON contains metadata for fields, check presence with [respjson.Field.Valid].
	JSON struct {
		Cache       respjson.Field
		Input       respjson.Field
		Output      respjson.Field
		Reasoning   respjson.Field
		ExtraFields map[string]respjson.Field
		// contains filtered or unexported fields
	} `json:"-"`
}

func (PartStepFinishTokens) RawJSON

func (r PartStepFinishTokens) RawJSON() string

Returns the unmodified JSON received from the API

func (*PartStepFinishTokens) UnmarshalJSON

func (r *PartStepFinishTokens) UnmarshalJSON(data []byte) error

type PartStepFinishTokensCache

type PartStepFinishTokensCache struct {
	Read  float64 `json:"read,required"`
	Write float64 `json:"write,required"`
	// JSON contains metadata for fields, check presence with [respjson.Field.Valid].
	JSON struct {
		Read        respjson.Field
		Write       respjson.Field
		ExtraFields map[string]respjson.Field
		// contains filtered or unexported fields
	} `json:"-"`
}

func (PartStepFinishTokensCache) RawJSON

func (r PartStepFinishTokensCache) RawJSON() string

Returns the unmodified JSON received from the API

func (*PartStepFinishTokensCache) UnmarshalJSON

func (r *PartStepFinishTokensCache) UnmarshalJSON(data []byte) error

type PartStepStart

type PartStepStart struct {
	ID        string             `json:"id,required"`
	MessageID string             `json:"messageID,required"`
	SessionID string             `json:"sessionID,required"`
	Type      constant.StepStart `json:"type,required"`
	// JSON contains metadata for fields, check presence with [respjson.Field.Valid].
	JSON struct {
		ID          respjson.Field
		MessageID   respjson.Field
		SessionID   respjson.Field
		Type        respjson.Field
		ExtraFields map[string]respjson.Field
		// contains filtered or unexported fields
	} `json:"-"`
}

func (PartStepStart) RawJSON

func (r PartStepStart) RawJSON() string

Returns the unmodified JSON received from the API

func (*PartStepStart) UnmarshalJSON

func (r *PartStepStart) UnmarshalJSON(data []byte) error

type PartText

type PartText struct {
	ID        string        `json:"id,required"`
	MessageID string        `json:"messageID,required"`
	SessionID string        `json:"sessionID,required"`
	Text      string        `json:"text,required"`
	Type      constant.Text `json:"type,required"`
	Synthetic bool          `json:"synthetic"`
	Time      PartTextTime  `json:"time"`
	// JSON contains metadata for fields, check presence with [respjson.Field.Valid].
	JSON struct {
		ID          respjson.Field
		MessageID   respjson.Field
		SessionID   respjson.Field
		Text        respjson.Field
		Type        respjson.Field
		Synthetic   respjson.Field
		Time        respjson.Field
		ExtraFields map[string]respjson.Field
		// contains filtered or unexported fields
	} `json:"-"`
}

func (PartText) RawJSON

func (r PartText) RawJSON() string

Returns the unmodified JSON received from the API

func (*PartText) UnmarshalJSON

func (r *PartText) UnmarshalJSON(data []byte) error

type PartTextTime

type PartTextTime struct {
	Start float64 `json:"start,required"`
	End   float64 `json:"end"`
	// JSON contains metadata for fields, check presence with [respjson.Field.Valid].
	JSON struct {
		Start       respjson.Field
		End         respjson.Field
		ExtraFields map[string]respjson.Field
		// contains filtered or unexported fields
	} `json:"-"`
}

func (PartTextTime) RawJSON

func (r PartTextTime) RawJSON() string

Returns the unmodified JSON received from the API

func (*PartTextTime) UnmarshalJSON

func (r *PartTextTime) UnmarshalJSON(data []byte) error

type PartTool

type PartTool struct {
	ID        string             `json:"id,required"`
	CallID    string             `json:"callID,required"`
	MessageID string             `json:"messageID,required"`
	SessionID string             `json:"sessionID,required"`
	State     PartToolStateUnion `json:"state,required"`
	Tool      string             `json:"tool,required"`
	Type      constant.Tool      `json:"type,required"`
	// JSON contains metadata for fields, check presence with [respjson.Field.Valid].
	JSON struct {
		ID          respjson.Field
		CallID      respjson.Field
		MessageID   respjson.Field
		SessionID   respjson.Field
		State       respjson.Field
		Tool        respjson.Field
		Type        respjson.Field
		ExtraFields map[string]respjson.Field
		// contains filtered or unexported fields
	} `json:"-"`
}

func (PartTool) RawJSON

func (r PartTool) RawJSON() string

Returns the unmodified JSON received from the API

func (*PartTool) UnmarshalJSON

func (r *PartTool) UnmarshalJSON(data []byte) error

type PartToolStateCompleted

type PartToolStateCompleted struct {
	Input    map[string]any             `json:"input,required"`
	Metadata map[string]any             `json:"metadata,required"`
	Output   string                     `json:"output,required"`
	Status   constant.Completed         `json:"status,required"`
	Time     PartToolStateCompletedTime `json:"time,required"`
	Title    string                     `json:"title,required"`
	// JSON contains metadata for fields, check presence with [respjson.Field.Valid].
	JSON struct {
		Input       respjson.Field
		Metadata    respjson.Field
		Output      respjson.Field
		Status      respjson.Field
		Time        respjson.Field
		Title       respjson.Field
		ExtraFields map[string]respjson.Field
		// contains filtered or unexported fields
	} `json:"-"`
}

func (PartToolStateCompleted) RawJSON

func (r PartToolStateCompleted) RawJSON() string

Returns the unmodified JSON received from the API

func (*PartToolStateCompleted) UnmarshalJSON

func (r *PartToolStateCompleted) UnmarshalJSON(data []byte) error

type PartToolStateCompletedTime

type PartToolStateCompletedTime struct {
	End   float64 `json:"end,required"`
	Start float64 `json:"start,required"`
	// JSON contains metadata for fields, check presence with [respjson.Field.Valid].
	JSON struct {
		End         respjson.Field
		Start       respjson.Field
		ExtraFields map[string]respjson.Field
		// contains filtered or unexported fields
	} `json:"-"`
}

func (PartToolStateCompletedTime) RawJSON

func (r PartToolStateCompletedTime) RawJSON() string

Returns the unmodified JSON received from the API

func (*PartToolStateCompletedTime) UnmarshalJSON

func (r *PartToolStateCompletedTime) UnmarshalJSON(data []byte) error

type PartToolStateError

type PartToolStateError struct {
	Error  string                 `json:"error,required"`
	Input  map[string]any         `json:"input,required"`
	Status constant.Error         `json:"status,required"`
	Time   PartToolStateErrorTime `json:"time,required"`
	// JSON contains metadata for fields, check presence with [respjson.Field.Valid].
	JSON struct {
		Error       respjson.Field
		Input       respjson.Field
		Status      respjson.Field
		Time        respjson.Field
		ExtraFields map[string]respjson.Field
		// contains filtered or unexported fields
	} `json:"-"`
}

func (PartToolStateError) RawJSON

func (r PartToolStateError) RawJSON() string

Returns the unmodified JSON received from the API

func (*PartToolStateError) UnmarshalJSON

func (r *PartToolStateError) UnmarshalJSON(data []byte) error

type PartToolStateErrorTime

type PartToolStateErrorTime struct {
	End   float64 `json:"end,required"`
	Start float64 `json:"start,required"`
	// JSON contains metadata for fields, check presence with [respjson.Field.Valid].
	JSON struct {
		End         respjson.Field
		Start       respjson.Field
		ExtraFields map[string]respjson.Field
		// contains filtered or unexported fields
	} `json:"-"`
}

func (PartToolStateErrorTime) RawJSON

func (r PartToolStateErrorTime) RawJSON() string

Returns the unmodified JSON received from the API

func (*PartToolStateErrorTime) UnmarshalJSON

func (r *PartToolStateErrorTime) UnmarshalJSON(data []byte) error

type PartToolStatePending

type PartToolStatePending struct {
	Status constant.Pending `json:"status,required"`
	// JSON contains metadata for fields, check presence with [respjson.Field.Valid].
	JSON struct {
		Status      respjson.Field
		ExtraFields map[string]respjson.Field
		// contains filtered or unexported fields
	} `json:"-"`
}

func (PartToolStatePending) RawJSON

func (r PartToolStatePending) RawJSON() string

Returns the unmodified JSON received from the API

func (*PartToolStatePending) UnmarshalJSON

func (r *PartToolStatePending) UnmarshalJSON(data []byte) error

type PartToolStateRunning

type PartToolStateRunning struct {
	Status   constant.Running         `json:"status,required"`
	Time     PartToolStateRunningTime `json:"time,required"`
	Input    any                      `json:"input"`
	Metadata map[string]any           `json:"metadata"`
	Title    string                   `json:"title"`
	// JSON contains metadata for fields, check presence with [respjson.Field.Valid].
	JSON struct {
		Status      respjson.Field
		Time        respjson.Field
		Input       respjson.Field
		Metadata    respjson.Field
		Title       respjson.Field
		ExtraFields map[string]respjson.Field
		// contains filtered or unexported fields
	} `json:"-"`
}

func (PartToolStateRunning) RawJSON

func (r PartToolStateRunning) RawJSON() string

Returns the unmodified JSON received from the API

func (*PartToolStateRunning) UnmarshalJSON

func (r *PartToolStateRunning) UnmarshalJSON(data []byte) error

type PartToolStateRunningTime

type PartToolStateRunningTime struct {
	Start float64 `json:"start,required"`
	// JSON contains metadata for fields, check presence with [respjson.Field.Valid].
	JSON struct {
		Start       respjson.Field
		ExtraFields map[string]respjson.Field
		// contains filtered or unexported fields
	} `json:"-"`
}

func (PartToolStateRunningTime) RawJSON

func (r PartToolStateRunningTime) RawJSON() string

Returns the unmodified JSON received from the API

func (*PartToolStateRunningTime) UnmarshalJSON

func (r *PartToolStateRunningTime) UnmarshalJSON(data []byte) error

type PartToolStateUnion

type PartToolStateUnion struct {
	// Any of "pending", "running", "completed", "error".
	Status string `json:"status"`
	// This field is a union of [PartToolStateRunningTime],
	// [PartToolStateCompletedTime], [PartToolStateErrorTime]
	Time     PartToolStateUnionTime `json:"time"`
	Input    any                    `json:"input"`
	Metadata any                    `json:"metadata"`
	Title    string                 `json:"title"`
	// This field is from variant [PartToolStateCompleted].
	Output string `json:"output"`
	// This field is from variant [PartToolStateError].
	Error string `json:"error"`
	JSON  struct {
		Status   respjson.Field
		Time     respjson.Field
		Input    respjson.Field
		Metadata respjson.Field
		Title    respjson.Field
		Output   respjson.Field
		Error    respjson.Field
		// contains filtered or unexported fields
	} `json:"-"`
}

PartToolStateUnion contains all possible properties and values from PartToolStatePending, PartToolStateRunning, PartToolStateCompleted, PartToolStateError.

Use the PartToolStateUnion.AsAny method to switch on the variant.

Use the methods beginning with 'As' to cast the union to one of its variants.

func (PartToolStateUnion) AsAny

func (u PartToolStateUnion) AsAny() anyPartToolState

Use the following switch statement to find the correct variant

switch variant := PartToolStateUnion.AsAny().(type) {
case opencodesdk.PartToolStatePending:
case opencodesdk.PartToolStateRunning:
case opencodesdk.PartToolStateCompleted:
case opencodesdk.PartToolStateError:
default:
  fmt.Errorf("no variant present")
}

func (PartToolStateUnion) AsCompleted

func (u PartToolStateUnion) AsCompleted() (v PartToolStateCompleted)

func (PartToolStateUnion) AsError

func (u PartToolStateUnion) AsError() (v PartToolStateError)

func (PartToolStateUnion) AsPending

func (u PartToolStateUnion) AsPending() (v PartToolStatePending)

func (PartToolStateUnion) AsRunning

func (u PartToolStateUnion) AsRunning() (v PartToolStateRunning)

func (PartToolStateUnion) RawJSON

func (u PartToolStateUnion) RawJSON() string

Returns the unmodified JSON received from the API

func (*PartToolStateUnion) UnmarshalJSON

func (r *PartToolStateUnion) UnmarshalJSON(data []byte) error

type PartToolStateUnionTime

type PartToolStateUnionTime struct {
	Start float64 `json:"start"`
	End   float64 `json:"end"`
	JSON  struct {
		Start respjson.Field
		End   respjson.Field
		// contains filtered or unexported fields
	} `json:"-"`
}

PartToolStateUnionTime is an implicit subunion of PartToolStateUnion. PartToolStateUnionTime provides convenient access to the sub-properties of the union.

For type safety it is recommended to directly use a variant of the PartToolStateUnion.

func (*PartToolStateUnionTime) UnmarshalJSON

func (r *PartToolStateUnionTime) UnmarshalJSON(data []byte) error

type PartUnion

type PartUnion struct {
	ID        string `json:"id"`
	MessageID string `json:"messageID"`
	SessionID string `json:"sessionID"`
	Text      string `json:"text"`
	// Any of "text", "reasoning", "file", "tool", "step-start", "step-finish",
	// "snapshot", "patch", "agent".
	Type string `json:"type"`
	// This field is from variant [PartText].
	Synthetic bool `json:"synthetic"`
	// This field is a union of [PartTextTime], [PartReasoningTime]
	Time PartUnionTime `json:"time"`
	// This field is from variant [PartReasoning].
	Metadata map[string]any `json:"metadata"`
	// This field is from variant [PartFile].
	Mime string `json:"mime"`
	// This field is from variant [PartFile].
	URL string `json:"url"`
	// This field is from variant [PartFile].
	Filename string `json:"filename"`
	// This field is a union of [FilePartSourceUnion], [PartAgentSource]
	Source PartUnionSource `json:"source"`
	// This field is from variant [PartTool].
	CallID string `json:"callID"`
	// This field is from variant [PartTool].
	State PartToolStateUnion `json:"state"`
	// This field is from variant [PartTool].
	Tool string `json:"tool"`
	// This field is from variant [PartStepFinish].
	Cost float64 `json:"cost"`
	// This field is from variant [PartStepFinish].
	Tokens PartStepFinishTokens `json:"tokens"`
	// This field is from variant [PartSnapshot].
	Snapshot string `json:"snapshot"`
	// This field is from variant [PartPatch].
	Files []string `json:"files"`
	// This field is from variant [PartPatch].
	Hash string `json:"hash"`
	// This field is from variant [PartAgent].
	Name string `json:"name"`
	JSON struct {
		ID        respjson.Field
		MessageID respjson.Field
		SessionID respjson.Field
		Text      respjson.Field
		Type      respjson.Field
		Synthetic respjson.Field
		Time      respjson.Field
		Metadata  respjson.Field
		Mime      respjson.Field
		URL       respjson.Field
		Filename  respjson.Field
		Source    respjson.Field
		CallID    respjson.Field
		State     respjson.Field
		Tool      respjson.Field
		Cost      respjson.Field
		Tokens    respjson.Field
		Snapshot  respjson.Field
		Files     respjson.Field
		Hash      respjson.Field
		Name      respjson.Field
		// contains filtered or unexported fields
	} `json:"-"`
}

PartUnion contains all possible properties and values from PartText, PartReasoning, PartFile, PartTool, PartStepStart, PartStepFinish, PartSnapshot, PartPatch, PartAgent.

Use the PartUnion.AsAny method to switch on the variant.

Use the methods beginning with 'As' to cast the union to one of its variants.

func (PartUnion) AsAgent

func (u PartUnion) AsAgent() (v PartAgent)

func (PartUnion) AsAny

func (u PartUnion) AsAny() anyPart

Use the following switch statement to find the correct variant

switch variant := PartUnion.AsAny().(type) {
case opencodesdk.PartText:
case opencodesdk.PartReasoning:
case opencodesdk.PartFile:
case opencodesdk.PartTool:
case opencodesdk.PartStepStart:
case opencodesdk.PartStepFinish:
case opencodesdk.PartSnapshot:
case opencodesdk.PartPatch:
case opencodesdk.PartAgent:
default:
  fmt.Errorf("no variant present")
}

func (PartUnion) AsFile

func (u PartUnion) AsFile() (v PartFile)

func (PartUnion) AsPatch

func (u PartUnion) AsPatch() (v PartPatch)

func (PartUnion) AsReasoning

func (u PartUnion) AsReasoning() (v PartReasoning)

func (PartUnion) AsSnapshot

func (u PartUnion) AsSnapshot() (v PartSnapshot)

func (PartUnion) AsStepFinish

func (u PartUnion) AsStepFinish() (v PartStepFinish)

func (PartUnion) AsStepStart

func (u PartUnion) AsStepStart() (v PartStepStart)

func (PartUnion) AsText

func (u PartUnion) AsText() (v PartText)

func (PartUnion) AsTool

func (u PartUnion) AsTool() (v PartTool)

func (PartUnion) RawJSON

func (u PartUnion) RawJSON() string

Returns the unmodified JSON received from the API

func (*PartUnion) UnmarshalJSON

func (r *PartUnion) UnmarshalJSON(data []byte) error

type PartUnionSource

type PartUnionSource struct {
	Path string `json:"path"`
	// This field is from variant [FilePartSourceUnion].
	Text FilePartSourceText `json:"text"`
	Type string             `json:"type"`
	// This field is from variant [FilePartSourceUnion].
	Kind int64 `json:"kind"`
	// This field is from variant [FilePartSourceUnion].
	Name string `json:"name"`
	// This field is from variant [FilePartSourceUnion].
	Range Range `json:"range"`
	// This field is from variant [PartAgentSource].
	End int64 `json:"end"`
	// This field is from variant [PartAgentSource].
	Start int64 `json:"start"`
	// This field is from variant [PartAgentSource].
	Value string `json:"value"`
	JSON  struct {
		Path  respjson.Field
		Text  respjson.Field
		Type  respjson.Field
		Kind  respjson.Field
		Name  respjson.Field
		Range respjson.Field
		End   respjson.Field
		Start respjson.Field
		Value respjson.Field
		// contains filtered or unexported fields
	} `json:"-"`
}

PartUnionSource is an implicit subunion of PartUnion. PartUnionSource provides convenient access to the sub-properties of the union.

For type safety it is recommended to directly use a variant of the PartUnion.

func (*PartUnionSource) UnmarshalJSON

func (r *PartUnionSource) UnmarshalJSON(data []byte) error

type PartUnionTime

type PartUnionTime struct {
	Start float64 `json:"start"`
	End   float64 `json:"end"`
	JSON  struct {
		Start respjson.Field
		End   respjson.Field
		// contains filtered or unexported fields
	} `json:"-"`
}

PartUnionTime is an implicit subunion of PartUnion. PartUnionTime provides convenient access to the sub-properties of the union.

For type safety it is recommended to directly use a variant of the PartUnion.

func (*PartUnionTime) UnmarshalJSON

func (r *PartUnionTime) UnmarshalJSON(data []byte) error

type ProviderAuthError

type ProviderAuthError struct {
	Data ProviderAuthErrorData      `json:"data,required"`
	Name constant.ProviderAuthError `json:"name,required"`
	// JSON contains metadata for fields, check presence with [respjson.Field.Valid].
	JSON struct {
		Data        respjson.Field
		Name        respjson.Field
		ExtraFields map[string]respjson.Field
		// contains filtered or unexported fields
	} `json:"-"`
}

func (ProviderAuthError) RawJSON

func (r ProviderAuthError) RawJSON() string

Returns the unmodified JSON received from the API

func (*ProviderAuthError) UnmarshalJSON

func (r *ProviderAuthError) UnmarshalJSON(data []byte) error

type ProviderAuthErrorData

type ProviderAuthErrorData struct {
	Message    string `json:"message,required"`
	ProviderID string `json:"providerID,required"`
	// JSON contains metadata for fields, check presence with [respjson.Field.Valid].
	JSON struct {
		Message     respjson.Field
		ProviderID  respjson.Field
		ExtraFields map[string]respjson.Field
		// contains filtered or unexported fields
	} `json:"-"`
}

func (ProviderAuthErrorData) RawJSON

func (r ProviderAuthErrorData) RawJSON() string

Returns the unmodified JSON received from the API

func (*ProviderAuthErrorData) UnmarshalJSON

func (r *ProviderAuthErrorData) UnmarshalJSON(data []byte) error

type Range

type Range struct {
	End   RangeEnd   `json:"end,required"`
	Start RangeStart `json:"start,required"`
	// JSON contains metadata for fields, check presence with [respjson.Field.Valid].
	JSON struct {
		End         respjson.Field
		Start       respjson.Field
		ExtraFields map[string]respjson.Field
		// contains filtered or unexported fields
	} `json:"-"`
}

func (Range) RawJSON

func (r Range) RawJSON() string

Returns the unmodified JSON received from the API

func (Range) ToParam

func (r Range) ToParam() RangeParam

ToParam converts this Range to a RangeParam.

Warning: the fields of the param type will not be present. ToParam should only be used at the last possible moment before sending a request. Test for this with RangeParam.Overrides()

func (*Range) UnmarshalJSON

func (r *Range) UnmarshalJSON(data []byte) error

type RangeEnd

type RangeEnd struct {
	Character float64 `json:"character,required"`
	Line      float64 `json:"line,required"`
	// JSON contains metadata for fields, check presence with [respjson.Field.Valid].
	JSON struct {
		Character   respjson.Field
		Line        respjson.Field
		ExtraFields map[string]respjson.Field
		// contains filtered or unexported fields
	} `json:"-"`
}

func (RangeEnd) RawJSON

func (r RangeEnd) RawJSON() string

Returns the unmodified JSON received from the API

func (*RangeEnd) UnmarshalJSON

func (r *RangeEnd) UnmarshalJSON(data []byte) error

type RangeEndParam

type RangeEndParam struct {
	Character float64 `json:"character,required"`
	Line      float64 `json:"line,required"`
	// contains filtered or unexported fields
}

The properties Character, Line are required.

func (RangeEndParam) MarshalJSON

func (r RangeEndParam) MarshalJSON() (data []byte, err error)

func (*RangeEndParam) UnmarshalJSON

func (r *RangeEndParam) UnmarshalJSON(data []byte) error

type RangeParam

type RangeParam struct {
	End   RangeEndParam   `json:"end,omitzero,required"`
	Start RangeStartParam `json:"start,omitzero,required"`
	// contains filtered or unexported fields
}

The properties End, Start are required.

func (RangeParam) MarshalJSON

func (r RangeParam) MarshalJSON() (data []byte, err error)

func (*RangeParam) UnmarshalJSON

func (r *RangeParam) UnmarshalJSON(data []byte) error

type RangeStart

type RangeStart struct {
	Character float64 `json:"character,required"`
	Line      float64 `json:"line,required"`
	// JSON contains metadata for fields, check presence with [respjson.Field.Valid].
	JSON struct {
		Character   respjson.Field
		Line        respjson.Field
		ExtraFields map[string]respjson.Field
		// contains filtered or unexported fields
	} `json:"-"`
}

func (RangeStart) RawJSON

func (r RangeStart) RawJSON() string

Returns the unmodified JSON received from the API

func (*RangeStart) UnmarshalJSON

func (r *RangeStart) UnmarshalJSON(data []byte) error

type RangeStartParam

type RangeStartParam struct {
	Character float64 `json:"character,required"`
	Line      float64 `json:"line,required"`
	// contains filtered or unexported fields
}

The properties Character, Line are required.

func (RangeStartParam) MarshalJSON

func (r RangeStartParam) MarshalJSON() (data []byte, err error)

func (*RangeStartParam) UnmarshalJSON

func (r *RangeStartParam) UnmarshalJSON(data []byte) error

type Session

type Session struct {
	ID       string        `json:"id,required"`
	Time     SessionTime   `json:"time,required"`
	Title    string        `json:"title,required"`
	Version  string        `json:"version,required"`
	ParentID string        `json:"parentID"`
	Revert   SessionRevert `json:"revert"`
	Share    SessionShare  `json:"share"`
	// JSON contains metadata for fields, check presence with [respjson.Field.Valid].
	JSON struct {
		ID          respjson.Field
		Time        respjson.Field
		Title       respjson.Field
		Version     respjson.Field
		ParentID    respjson.Field
		Revert      respjson.Field
		Share       respjson.Field
		ExtraFields map[string]respjson.Field
		// contains filtered or unexported fields
	} `json:"-"`
}

func (Session) RawJSON

func (r Session) RawJSON() string

Returns the unmodified JSON received from the API

func (*Session) UnmarshalJSON

func (r *Session) UnmarshalJSON(data []byte) error

type SessionInitParams

type SessionInitParams struct {
	MessageID  string `json:"messageID,required"`
	ModelID    string `json:"modelID,required"`
	ProviderID string `json:"providerID,required"`
	// contains filtered or unexported fields
}

func (SessionInitParams) MarshalJSON

func (r SessionInitParams) MarshalJSON() (data []byte, err error)

func (*SessionInitParams) UnmarshalJSON

func (r *SessionInitParams) UnmarshalJSON(data []byte) error

type SessionMessageGetParams

type SessionMessageGetParams struct {
	// Session ID
	ID string `path:"id,required" json:"-"`
	// contains filtered or unexported fields
}

type SessionMessageGetResponse

type SessionMessageGetResponse struct {
	Info  MessageUnion `json:"info,required"`
	Parts []PartUnion  `json:"parts,required"`
	// JSON contains metadata for fields, check presence with [respjson.Field.Valid].
	JSON struct {
		Info        respjson.Field
		Parts       respjson.Field
		ExtraFields map[string]respjson.Field
		// contains filtered or unexported fields
	} `json:"-"`
}

func (SessionMessageGetResponse) RawJSON

func (r SessionMessageGetResponse) RawJSON() string

Returns the unmodified JSON received from the API

func (*SessionMessageGetResponse) UnmarshalJSON

func (r *SessionMessageGetResponse) UnmarshalJSON(data []byte) error

type SessionMessageListResponse

type SessionMessageListResponse struct {
	Info  MessageUnion `json:"info,required"`
	Parts []PartUnion  `json:"parts,required"`
	// JSON contains metadata for fields, check presence with [respjson.Field.Valid].
	JSON struct {
		Info        respjson.Field
		Parts       respjson.Field
		ExtraFields map[string]respjson.Field
		// contains filtered or unexported fields
	} `json:"-"`
}

func (SessionMessageListResponse) RawJSON

func (r SessionMessageListResponse) RawJSON() string

Returns the unmodified JSON received from the API

func (*SessionMessageListResponse) UnmarshalJSON

func (r *SessionMessageListResponse) UnmarshalJSON(data []byte) error

type SessionMessageNewParams

type SessionMessageNewParams struct {
	ModelID    string                             `json:"modelID,required"`
	Parts      []SessionMessageNewParamsPartUnion `json:"parts,omitzero,required"`
	ProviderID string                             `json:"providerID,required"`
	Agent      param.Opt[string]                  `json:"agent,omitzero"`
	MessageID  param.Opt[string]                  `json:"messageID,omitzero"`
	System     param.Opt[string]                  `json:"system,omitzero"`
	Tools      map[string]bool                    `json:"tools,omitzero"`
	// contains filtered or unexported fields
}

func (SessionMessageNewParams) MarshalJSON

func (r SessionMessageNewParams) MarshalJSON() (data []byte, err error)

func (*SessionMessageNewParams) UnmarshalJSON

func (r *SessionMessageNewParams) UnmarshalJSON(data []byte) error

type SessionMessageNewParamsPartAgent

type SessionMessageNewParamsPartAgent struct {
	Name   string                                 `json:"name,required"`
	ID     param.Opt[string]                      `json:"id,omitzero"`
	Source SessionMessageNewParamsPartAgentSource `json:"source,omitzero"`
	// This field can be elided, and will marshal its zero value as "agent".
	Type constant.Agent `json:"type,required"`
	// contains filtered or unexported fields
}

The properties Name, Type are required.

func (SessionMessageNewParamsPartAgent) MarshalJSON

func (r SessionMessageNewParamsPartAgent) MarshalJSON() (data []byte, err error)

func (*SessionMessageNewParamsPartAgent) UnmarshalJSON

func (r *SessionMessageNewParamsPartAgent) UnmarshalJSON(data []byte) error

type SessionMessageNewParamsPartAgentSource

type SessionMessageNewParamsPartAgentSource struct {
	End   int64  `json:"end,required"`
	Start int64  `json:"start,required"`
	Value string `json:"value,required"`
	// contains filtered or unexported fields
}

The properties End, Start, Value are required.

func (SessionMessageNewParamsPartAgentSource) MarshalJSON

func (r SessionMessageNewParamsPartAgentSource) MarshalJSON() (data []byte, err error)

func (*SessionMessageNewParamsPartAgentSource) UnmarshalJSON

func (r *SessionMessageNewParamsPartAgentSource) UnmarshalJSON(data []byte) error

type SessionMessageNewParamsPartFile

type SessionMessageNewParamsPartFile struct {
	Mime     string                   `json:"mime,required"`
	URL      string                   `json:"url,required"`
	ID       param.Opt[string]        `json:"id,omitzero"`
	Filename param.Opt[string]        `json:"filename,omitzero"`
	Source   FilePartSourceUnionParam `json:"source,omitzero"`
	// This field can be elided, and will marshal its zero value as "file".
	Type constant.File `json:"type,required"`
	// contains filtered or unexported fields
}

The properties Mime, Type, URL are required.

func (SessionMessageNewParamsPartFile) MarshalJSON

func (r SessionMessageNewParamsPartFile) MarshalJSON() (data []byte, err error)

func (*SessionMessageNewParamsPartFile) UnmarshalJSON

func (r *SessionMessageNewParamsPartFile) UnmarshalJSON(data []byte) error

type SessionMessageNewParamsPartText

type SessionMessageNewParamsPartText struct {
	Text      string                              `json:"text,required"`
	ID        param.Opt[string]                   `json:"id,omitzero"`
	Synthetic param.Opt[bool]                     `json:"synthetic,omitzero"`
	Time      SessionMessageNewParamsPartTextTime `json:"time,omitzero"`
	// This field can be elided, and will marshal its zero value as "text".
	Type constant.Text `json:"type,required"`
	// contains filtered or unexported fields
}

The properties Text, Type are required.

func (SessionMessageNewParamsPartText) MarshalJSON

func (r SessionMessageNewParamsPartText) MarshalJSON() (data []byte, err error)

func (*SessionMessageNewParamsPartText) UnmarshalJSON

func (r *SessionMessageNewParamsPartText) UnmarshalJSON(data []byte) error

type SessionMessageNewParamsPartTextTime

type SessionMessageNewParamsPartTextTime struct {
	Start float64            `json:"start,required"`
	End   param.Opt[float64] `json:"end,omitzero"`
	// contains filtered or unexported fields
}

The property Start is required.

func (SessionMessageNewParamsPartTextTime) MarshalJSON

func (r SessionMessageNewParamsPartTextTime) MarshalJSON() (data []byte, err error)

func (*SessionMessageNewParamsPartTextTime) UnmarshalJSON

func (r *SessionMessageNewParamsPartTextTime) UnmarshalJSON(data []byte) error

type SessionMessageNewParamsPartUnion

type SessionMessageNewParamsPartUnion struct {
	OfText  *SessionMessageNewParamsPartText  `json:",omitzero,inline"`
	OfFile  *SessionMessageNewParamsPartFile  `json:",omitzero,inline"`
	OfAgent *SessionMessageNewParamsPartAgent `json:",omitzero,inline"`
	// contains filtered or unexported fields
}

Only one field can be non-zero.

Use param.IsOmitted to confirm if a field is set.

func (SessionMessageNewParamsPartUnion) GetFilename

func (u SessionMessageNewParamsPartUnion) GetFilename() *string

Returns a pointer to the underlying variant's property, if present.

func (SessionMessageNewParamsPartUnion) GetID

Returns a pointer to the underlying variant's property, if present.

func (SessionMessageNewParamsPartUnion) GetMime

Returns a pointer to the underlying variant's property, if present.

func (SessionMessageNewParamsPartUnion) GetName

Returns a pointer to the underlying variant's property, if present.

func (SessionMessageNewParamsPartUnion) GetSource

func (u SessionMessageNewParamsPartUnion) GetSource() (res sessionMessageNewParamsPartUnionSource)

Returns a subunion which exports methods to access subproperties

Or use AsAny() to get the underlying value

func (SessionMessageNewParamsPartUnion) GetSynthetic

func (u SessionMessageNewParamsPartUnion) GetSynthetic() *bool

Returns a pointer to the underlying variant's property, if present.

func (SessionMessageNewParamsPartUnion) GetText

Returns a pointer to the underlying variant's property, if present.

func (SessionMessageNewParamsPartUnion) GetTime

Returns a pointer to the underlying variant's property, if present.

func (SessionMessageNewParamsPartUnion) GetType

Returns a pointer to the underlying variant's property, if present.

func (SessionMessageNewParamsPartUnion) GetURL

Returns a pointer to the underlying variant's property, if present.

func (SessionMessageNewParamsPartUnion) MarshalJSON

func (u SessionMessageNewParamsPartUnion) MarshalJSON() ([]byte, error)

func (*SessionMessageNewParamsPartUnion) UnmarshalJSON

func (u *SessionMessageNewParamsPartUnion) UnmarshalJSON(data []byte) error

type SessionMessageService

type SessionMessageService struct {
	Options []option.RequestOption
}

SessionMessageService contains methods and other services that help with interacting with the opencode-sdk API.

Note, unlike clients, this service does not read variables from the environment automatically. You should not instantiate this service directly, and instead use the NewSessionMessageService method instead.

func NewSessionMessageService

func NewSessionMessageService(opts ...option.RequestOption) (r SessionMessageService)

NewSessionMessageService generates a new service that applies the given options to each request. These options are applied after the parent client's options (if there is one), and before any request-specific options.

func (*SessionMessageService) Get

Get a message from a session

func (*SessionMessageService) List

List messages for a session

func (*SessionMessageService) New

Create and send a new message to a session

type SessionRespondToPermissionParams

type SessionRespondToPermissionParams struct {
	ID string `path:"id,required" json:"-"`
	// Any of "once", "always", "reject".
	Response SessionRespondToPermissionParamsResponse `json:"response,omitzero,required"`
	// contains filtered or unexported fields
}

func (SessionRespondToPermissionParams) MarshalJSON

func (r SessionRespondToPermissionParams) MarshalJSON() (data []byte, err error)

func (*SessionRespondToPermissionParams) UnmarshalJSON

func (r *SessionRespondToPermissionParams) UnmarshalJSON(data []byte) error

type SessionRespondToPermissionParamsResponse

type SessionRespondToPermissionParamsResponse string
const (
	SessionRespondToPermissionParamsResponseOnce   SessionRespondToPermissionParamsResponse = "once"
	SessionRespondToPermissionParamsResponseAlways SessionRespondToPermissionParamsResponse = "always"
	SessionRespondToPermissionParamsResponseReject SessionRespondToPermissionParamsResponse = "reject"
)

type SessionRevert

type SessionRevert struct {
	MessageID string `json:"messageID,required"`
	Diff      string `json:"diff"`
	PartID    string `json:"partID"`
	Snapshot  string `json:"snapshot"`
	// JSON contains metadata for fields, check presence with [respjson.Field.Valid].
	JSON struct {
		MessageID   respjson.Field
		Diff        respjson.Field
		PartID      respjson.Field
		Snapshot    respjson.Field
		ExtraFields map[string]respjson.Field
		// contains filtered or unexported fields
	} `json:"-"`
}

func (SessionRevert) RawJSON

func (r SessionRevert) RawJSON() string

Returns the unmodified JSON received from the API

func (*SessionRevert) UnmarshalJSON

func (r *SessionRevert) UnmarshalJSON(data []byte) error

type SessionRevertParams

type SessionRevertParams struct {
	MessageID string            `json:"messageID,required"`
	PartID    param.Opt[string] `json:"partID,omitzero"`
	// contains filtered or unexported fields
}

func (SessionRevertParams) MarshalJSON

func (r SessionRevertParams) MarshalJSON() (data []byte, err error)

func (*SessionRevertParams) UnmarshalJSON

func (r *SessionRevertParams) UnmarshalJSON(data []byte) error

type SessionService

type SessionService struct {
	Options []option.RequestOption
	Share   SessionShareService
	Message SessionMessageService
}

SessionService contains methods and other services that help with interacting with the opencode-sdk API.

Note, unlike clients, this service does not read variables from the environment automatically. You should not instantiate this service directly, and instead use the NewSessionService method instead.

func NewSessionService

func NewSessionService(opts ...option.RequestOption) (r SessionService)

NewSessionService generates a new service that applies the given options to each request. These options are applied after the parent client's options (if there is one), and before any request-specific options.

func (*SessionService) Abort

func (r *SessionService) Abort(ctx context.Context, id string, opts ...option.RequestOption) (res *bool, err error)

Abort a session

func (*SessionService) Delete

func (r *SessionService) Delete(ctx context.Context, id string, opts ...option.RequestOption) (res *bool, err error)

Delete a session and all its data

func (*SessionService) Get

func (r *SessionService) Get(ctx context.Context, id string, opts ...option.RequestOption) (res *Session, err error)

Get session

func (*SessionService) Init

func (r *SessionService) Init(ctx context.Context, id string, body SessionInitParams, opts ...option.RequestOption) (res *bool, err error)

Analyze the app and create an AGENTS.md file

func (*SessionService) List

func (r *SessionService) List(ctx context.Context, opts ...option.RequestOption) (res *[]Session, err error)

List all sessions

func (*SessionService) New

func (r *SessionService) New(ctx context.Context, opts ...option.RequestOption) (res *Session, err error)

Create a new session

func (*SessionService) RespondToPermission

func (r *SessionService) RespondToPermission(ctx context.Context, permissionID string, params SessionRespondToPermissionParams, opts ...option.RequestOption) (res *bool, err error)

Respond to a permission request

func (*SessionService) Revert

func (r *SessionService) Revert(ctx context.Context, id string, body SessionRevertParams, opts ...option.RequestOption) (res *Session, err error)

Revert a message

func (*SessionService) Summarize

func (r *SessionService) Summarize(ctx context.Context, id string, body SessionSummarizeParams, opts ...option.RequestOption) (res *bool, err error)

Summarize the session

func (*SessionService) Unrevert

func (r *SessionService) Unrevert(ctx context.Context, id string, opts ...option.RequestOption) (res *Session, err error)

Restore all reverted messages

type SessionShare

type SessionShare struct {
	URL string `json:"url,required"`
	// JSON contains metadata for fields, check presence with [respjson.Field.Valid].
	JSON struct {
		URL         respjson.Field
		ExtraFields map[string]respjson.Field
		// contains filtered or unexported fields
	} `json:"-"`
}

func (SessionShare) RawJSON

func (r SessionShare) RawJSON() string

Returns the unmodified JSON received from the API

func (*SessionShare) UnmarshalJSON

func (r *SessionShare) UnmarshalJSON(data []byte) error

type SessionShareService

type SessionShareService struct {
	Options []option.RequestOption
}

SessionShareService contains methods and other services that help with interacting with the opencode-sdk API.

Note, unlike clients, this service does not read variables from the environment automatically. You should not instantiate this service directly, and instead use the NewSessionShareService method instead.

func NewSessionShareService

func NewSessionShareService(opts ...option.RequestOption) (r SessionShareService)

NewSessionShareService generates a new service that applies the given options to each request. These options are applied after the parent client's options (if there is one), and before any request-specific options.

func (*SessionShareService) Delete

func (r *SessionShareService) Delete(ctx context.Context, id string, opts ...option.RequestOption) (res *Session, err error)

Unshare the session

func (*SessionShareService) New

func (r *SessionShareService) New(ctx context.Context, id string, opts ...option.RequestOption) (res *Session, err error)

Share a session

type SessionSummarizeParams

type SessionSummarizeParams struct {
	ModelID    string `json:"modelID,required"`
	ProviderID string `json:"providerID,required"`
	// contains filtered or unexported fields
}

func (SessionSummarizeParams) MarshalJSON

func (r SessionSummarizeParams) MarshalJSON() (data []byte, err error)

func (*SessionSummarizeParams) UnmarshalJSON

func (r *SessionSummarizeParams) UnmarshalJSON(data []byte) error

type SessionTime

type SessionTime struct {
	Created float64 `json:"created,required"`
	Updated float64 `json:"updated,required"`
	// JSON contains metadata for fields, check presence with [respjson.Field.Valid].
	JSON struct {
		Created     respjson.Field
		Updated     respjson.Field
		ExtraFields map[string]respjson.Field
		// contains filtered or unexported fields
	} `json:"-"`
}

func (SessionTime) RawJSON

func (r SessionTime) RawJSON() string

Returns the unmodified JSON received from the API

func (*SessionTime) UnmarshalJSON

func (r *SessionTime) UnmarshalJSON(data []byte) error

type TuiAppendPromptParams

type TuiAppendPromptParams struct {
	Text string `json:"text,required"`
	// contains filtered or unexported fields
}

func (TuiAppendPromptParams) MarshalJSON

func (r TuiAppendPromptParams) MarshalJSON() (data []byte, err error)

func (*TuiAppendPromptParams) UnmarshalJSON

func (r *TuiAppendPromptParams) UnmarshalJSON(data []byte) error

type TuiExecuteCommandParams

type TuiExecuteCommandParams struct {
	Command string `json:"command,required"`
	// contains filtered or unexported fields
}

func (TuiExecuteCommandParams) MarshalJSON

func (r TuiExecuteCommandParams) MarshalJSON() (data []byte, err error)

func (*TuiExecuteCommandParams) UnmarshalJSON

func (r *TuiExecuteCommandParams) UnmarshalJSON(data []byte) error

type TuiService

type TuiService struct {
	Options []option.RequestOption
}

TuiService contains methods and other services that help with interacting with the opencode-sdk API.

Note, unlike clients, this service does not read variables from the environment automatically. You should not instantiate this service directly, and instead use the NewTuiService method instead.

func NewTuiService

func NewTuiService(opts ...option.RequestOption) (r TuiService)

NewTuiService generates a new service that applies the given options to each request. These options are applied after the parent client's options (if there is one), and before any request-specific options.

func (*TuiService) AppendPrompt

func (r *TuiService) AppendPrompt(ctx context.Context, body TuiAppendPromptParams, opts ...option.RequestOption) (res *bool, err error)

Append prompt to the TUI

func (*TuiService) ClearPrompt

func (r *TuiService) ClearPrompt(ctx context.Context, opts ...option.RequestOption) (res *bool, err error)

Clear the prompt

func (*TuiService) ExecuteCommand

func (r *TuiService) ExecuteCommand(ctx context.Context, body TuiExecuteCommandParams, opts ...option.RequestOption) (res *bool, err error)

Execute a TUI command (e.g. switch_agent)

func (*TuiService) OpenHelp

func (r *TuiService) OpenHelp(ctx context.Context, opts ...option.RequestOption) (res *bool, err error)

Open the help dialog

func (*TuiService) OpenModels

func (r *TuiService) OpenModels(ctx context.Context, opts ...option.RequestOption) (res *bool, err error)

Open the model dialog

func (*TuiService) OpenSessions

func (r *TuiService) OpenSessions(ctx context.Context, opts ...option.RequestOption) (res *bool, err error)

Open the session dialog

func (*TuiService) OpenThemes

func (r *TuiService) OpenThemes(ctx context.Context, opts ...option.RequestOption) (res *bool, err error)

Open the theme dialog

func (*TuiService) SubmitPrompt

func (r *TuiService) SubmitPrompt(ctx context.Context, opts ...option.RequestOption) (res *bool, err error)

Submit the prompt

type UnknownError

type UnknownError struct {
	Data UnknownErrorData      `json:"data,required"`
	Name constant.UnknownError `json:"name,required"`
	// JSON contains metadata for fields, check presence with [respjson.Field.Valid].
	JSON struct {
		Data        respjson.Field
		Name        respjson.Field
		ExtraFields map[string]respjson.Field
		// contains filtered or unexported fields
	} `json:"-"`
}

func (UnknownError) RawJSON

func (r UnknownError) RawJSON() string

Returns the unmodified JSON received from the API

func (*UnknownError) UnmarshalJSON

func (r *UnknownError) UnmarshalJSON(data []byte) error

type UnknownErrorData

type UnknownErrorData struct {
	Message string `json:"message,required"`
	// JSON contains metadata for fields, check presence with [respjson.Field.Valid].
	JSON struct {
		Message     respjson.Field
		ExtraFields map[string]respjson.Field
		// contains filtered or unexported fields
	} `json:"-"`
}

func (UnknownErrorData) RawJSON

func (r UnknownErrorData) RawJSON() string

Returns the unmodified JSON received from the API

func (*UnknownErrorData) UnmarshalJSON

func (r *UnknownErrorData) UnmarshalJSON(data []byte) error

Directories

Path Synopsis
encoding/json
Package json implements encoding and decoding of JSON as defined in RFC 7159.
Package json implements encoding and decoding of JSON as defined in RFC 7159.
encoding/json/shims
This package provides shims over Go 1.2{2,3} APIs which are missing from Go 1.21, and used by the Go 1.24 encoding/json package.
This package provides shims over Go 1.2{2,3} APIs which are missing from Go 1.21, and used by the Go 1.24 encoding/json package.
packages
shared

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL