feat(api): api update

This commit is contained in:
stainless-app[bot] 2025-09-01 20:22:34 +00:00
parent bb02caf4f2
commit be0464d2ea
6 changed files with 80 additions and 23 deletions

View file

@ -1,4 +1,4 @@
configured_endpoints: 43
openapi_spec_url: https://storage.googleapis.com/stainless-sdk-openapi-specs/opencode%2Fopencode-24d6bfcc66bba2e3a826fdad7e48a474c5aa9193a6bb89dc8ab1feb1f3d9bf72.yml
openapi_spec_hash: db8b553192d9027e1f9254096406cfc2
openapi_spec_url: https://storage.googleapis.com/stainless-sdk-openapi-specs/opencode%2Fopencode-57001be06439e5325d0cb6837dd39d04fb7e438386668dcb67b4375ce6fabcf5.yml
openapi_spec_hash: 5c3f5b2a345e5e6cda17865e3bae1fd2
config_hash: 1b0d220e033fe9f683abf7048e7ad076

View file

@ -13,6 +13,7 @@ import (
"github.com/sst/opencode-sdk-go/internal/param"
"github.com/sst/opencode-sdk-go/internal/requestconfig"
"github.com/sst/opencode-sdk-go/option"
"github.com/sst/opencode-sdk-go/shared"
"github.com/tidwall/gjson"
)
@ -1650,10 +1651,13 @@ func (r configProviderModelsLimitJSON) RawJSON() string {
}
type ConfigProviderOptions struct {
APIKey string `json:"apiKey"`
BaseURL string `json:"baseURL"`
ExtraFields map[string]interface{} `json:"-,extras"`
JSON configProviderOptionsJSON `json:"-"`
APIKey string `json:"apiKey"`
BaseURL string `json:"baseURL"`
// Timeout in milliseconds for requests to this provider. Default is 300000 (5
// minutes). Set to false to disable timeout.
Timeout ConfigProviderOptionsTimeoutUnion `json:"timeout"`
ExtraFields map[string]interface{} `json:"-,extras"`
JSON configProviderOptionsJSON `json:"-"`
}
// configProviderOptionsJSON contains the JSON metadata for the struct
@ -1661,6 +1665,7 @@ type ConfigProviderOptions struct {
type configProviderOptionsJSON struct {
APIKey apijson.Field
BaseURL apijson.Field
Timeout apijson.Field
raw string
ExtraFields map[string]apijson.Field
}
@ -1673,6 +1678,33 @@ func (r configProviderOptionsJSON) RawJSON() string {
return r.raw
}
// Timeout in milliseconds for requests to this provider. Default is 300000 (5
// minutes). Set to false to disable timeout.
//
// Union satisfied by [shared.UnionInt] or [shared.UnionBool].
type ConfigProviderOptionsTimeoutUnion interface {
ImplementsConfigProviderOptionsTimeoutUnion()
}
func init() {
apijson.RegisterUnion(
reflect.TypeOf((*ConfigProviderOptionsTimeoutUnion)(nil)).Elem(),
"",
apijson.UnionVariant{
TypeFilter: gjson.Number,
Type: reflect.TypeOf(shared.UnionInt(0)),
},
apijson.UnionVariant{
TypeFilter: gjson.True,
Type: reflect.TypeOf(shared.UnionBool(false)),
},
apijson.UnionVariant{
TypeFilter: gjson.False,
Type: reflect.TypeOf(shared.UnionBool(false)),
},
)
}
// Control sharing behavior:'manual' allows manual sharing via commands, 'auto'
// enables automatic sharing, 'disabled' disables all sharing
type ConfigShare string

10
path.go
View file

@ -42,15 +42,19 @@ func (r *PathService) Get(ctx context.Context, query PathGetParams, opts ...opti
}
type Path struct {
Config string `json:"config,required"`
State string `json:"state,required"`
JSON pathJSON `json:"-"`
Config string `json:"config,required"`
Directory string `json:"directory,required"`
State string `json:"state,required"`
Worktree string `json:"worktree,required"`
JSON pathJSON `json:"-"`
}
// pathJSON contains the JSON metadata for the struct [Path]
type pathJSON struct {
Config apijson.Field
Directory apijson.Field
State apijson.Field
Worktree apijson.Field
raw string
ExtraFields map[string]apijson.Field
}

View file

@ -2460,14 +2460,13 @@ func (r SessionAbortParams) URLQuery() (v url.Values) {
}
type SessionChatParams struct {
ModelID param.Field[string] `json:"modelID,required"`
Parts param.Field[[]SessionChatParamsPartUnion] `json:"parts,required"`
ProviderID param.Field[string] `json:"providerID,required"`
Directory param.Field[string] `query:"directory"`
Agent param.Field[string] `json:"agent"`
MessageID param.Field[string] `json:"messageID"`
System param.Field[string] `json:"system"`
Tools param.Field[map[string]bool] `json:"tools"`
Parts param.Field[[]SessionChatParamsPartUnion] `json:"parts,required"`
Directory param.Field[string] `query:"directory"`
Agent param.Field[string] `json:"agent"`
MessageID param.Field[string] `json:"messageID"`
Model param.Field[SessionChatParamsModel] `json:"model"`
System param.Field[string] `json:"system"`
Tools param.Field[map[string]bool] `json:"tools"`
}
func (r SessionChatParams) MarshalJSON() (data []byte, err error) {
@ -2523,6 +2522,15 @@ func (r SessionChatParamsPartsType) IsKnown() bool {
return false
}
type SessionChatParamsModel struct {
ModelID param.Field[string] `json:"modelID,required"`
ProviderID param.Field[string] `json:"providerID,required"`
}
func (r SessionChatParamsModel) MarshalJSON() (data []byte, err error) {
return apijson.MarshalRoot(r)
}
type SessionChildrenParams struct {
Directory param.Field[string] `query:"directory"`
}

View file

@ -164,7 +164,6 @@ func TestSessionChatWithOptionalParams(t *testing.T) {
context.TODO(),
"id",
opencode.SessionChatParams{
ModelID: opencode.F("modelID"),
Parts: opencode.F([]opencode.SessionChatParamsPartUnion{opencode.TextPartInputParam{
Text: opencode.F("text"),
Type: opencode.F(opencode.TextPartInputTypeText),
@ -175,11 +174,14 @@ func TestSessionChatWithOptionalParams(t *testing.T) {
End: opencode.F(0.000000),
}),
}}),
ProviderID: opencode.F("providerID"),
Directory: opencode.F("directory"),
Agent: opencode.F("agent"),
MessageID: opencode.F("msg"),
System: opencode.F("system"),
Directory: opencode.F("directory"),
Agent: opencode.F("agent"),
MessageID: opencode.F("msg"),
Model: opencode.F(opencode.SessionChatParamsModel{
ModelID: opencode.F("modelID"),
ProviderID: opencode.F("providerID"),
}),
System: opencode.F("system"),
Tools: opencode.F(map[string]bool{
"foo": true,
}),

11
shared/union.go Normal file
View file

@ -0,0 +1,11 @@
// File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details.
package shared
type UnionBool bool
func (UnionBool) ImplementsConfigProviderOptionsTimeoutUnion() {}
type UnionInt int64
func (UnionInt) ImplementsConfigProviderOptionsTimeoutUnion() {}