Skip to content

Commit d1eb243

Browse files
feat(api): api update
1 parent b60fee9 commit d1eb243

File tree

4 files changed

+77
-44
lines changed

4 files changed

+77
-44
lines changed

.stats.yml

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
11
configured_endpoints: 22
2-
openapi_spec_url: https://storage.googleapis.com/stainless-sdk-openapi-specs/opencode%2Fopencode-68cbf6e18d22079b425afcaed2bd8f3e6d728aeded96ea31261e81acf2664895.yml
3-
openapi_spec_hash: 1e2f53491687817ec77f4929b469ce29
4-
config_hash: b7f3d9742335715c458494988498b183
2+
openapi_spec_url: https://storage.googleapis.com/stainless-sdk-openapi-specs/opencode%2Fopencode-186e713234760e9f755b35c78809f89378e4f778a451cd5e30649f41489e0bfd.yml
3+
openapi_spec_hash: 5fb2ce9d8055253d597567a8a3293e73
4+
config_hash: a8441af7cb2db855d79fd372ee3b9fb1

api.md

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -75,6 +75,11 @@ Methods:
7575

7676
# Session
7777

78+
Params Types:
79+
80+
- <a href="https://pkg.go.dev/github.com/sst/opencode-sdk-go">opencode</a>.<a href="https://pkg.go.dev/github.com/sst/opencode-sdk-go#FilePartInputParam">FilePartInputParam</a>
81+
- <a href="https://pkg.go.dev/github.com/sst/opencode-sdk-go">opencode</a>.<a href="https://pkg.go.dev/github.com/sst/opencode-sdk-go#TextPartInputParam">TextPartInputParam</a>
82+
7883
Response Types:
7984

8085
- <a href="https://pkg.go.dev/github.com/sst/opencode-sdk-go">opencode</a>.<a href="https://pkg.go.dev/github.com/sst/opencode-sdk-go#AssistantMessage">AssistantMessage</a>

session.go

Lines changed: 66 additions & 38 deletions
Original file line numberDiff line numberDiff line change
@@ -481,6 +481,34 @@ func (r FilePartType) IsKnown() bool {
481481
return false
482482
}
483483

484+
type FilePartInputParam struct {
485+
Mime param.Field[string] `json:"mime,required"`
486+
Type param.Field[FilePartInputType] `json:"type,required"`
487+
URL param.Field[string] `json:"url,required"`
488+
ID param.Field[string] `json:"id"`
489+
Filename param.Field[string] `json:"filename"`
490+
}
491+
492+
func (r FilePartInputParam) MarshalJSON() (data []byte, err error) {
493+
return apijson.MarshalRoot(r)
494+
}
495+
496+
func (r FilePartInputParam) implementsSessionChatParamsPartUnion() {}
497+
498+
type FilePartInputType string
499+
500+
const (
501+
FilePartInputTypeFile FilePartInputType = "file"
502+
)
503+
504+
func (r FilePartInputType) IsKnown() bool {
505+
switch r {
506+
case FilePartInputTypeFile:
507+
return true
508+
}
509+
return false
510+
}
511+
484512
type Message struct {
485513
ID string `json:"id,required"`
486514
Role MessageRole `json:"role,required"`
@@ -1060,6 +1088,43 @@ func (r textPartTimeJSON) RawJSON() string {
10601088
return r.raw
10611089
}
10621090

1091+
type TextPartInputParam struct {
1092+
Text param.Field[string] `json:"text,required"`
1093+
Type param.Field[TextPartInputType] `json:"type,required"`
1094+
ID param.Field[string] `json:"id"`
1095+
Synthetic param.Field[bool] `json:"synthetic"`
1096+
Time param.Field[TextPartInputTimeParam] `json:"time"`
1097+
}
1098+
1099+
func (r TextPartInputParam) MarshalJSON() (data []byte, err error) {
1100+
return apijson.MarshalRoot(r)
1101+
}
1102+
1103+
func (r TextPartInputParam) implementsSessionChatParamsPartUnion() {}
1104+
1105+
type TextPartInputType string
1106+
1107+
const (
1108+
TextPartInputTypeText TextPartInputType = "text"
1109+
)
1110+
1111+
func (r TextPartInputType) IsKnown() bool {
1112+
switch r {
1113+
case TextPartInputTypeText:
1114+
return true
1115+
}
1116+
return false
1117+
}
1118+
1119+
type TextPartInputTimeParam struct {
1120+
Start param.Field[float64] `json:"start,required"`
1121+
End param.Field[float64] `json:"end"`
1122+
}
1123+
1124+
func (r TextPartInputTimeParam) MarshalJSON() (data []byte, err error) {
1125+
return apijson.MarshalRoot(r)
1126+
}
1127+
10631128
type ToolPart struct {
10641129
ID string `json:"id,required"`
10651130
CallID string `json:"callID,required"`
@@ -1562,49 +1627,12 @@ func (r SessionChatParamsPart) MarshalJSON() (data []byte, err error) {
15621627

15631628
func (r SessionChatParamsPart) implementsSessionChatParamsPartUnion() {}
15641629

1565-
// Satisfied by [SessionChatParamsPartsObject], [SessionChatParamsPartsObject],
1630+
// Satisfied by [TextPartInputParam], [FilePartInputParam],
15661631
// [SessionChatParamsPart].
15671632
type SessionChatParamsPartUnion interface {
15681633
implementsSessionChatParamsPartUnion()
15691634
}
15701635

1571-
type SessionChatParamsPartsObject struct {
1572-
Text param.Field[string] `json:"text,required"`
1573-
Type param.Field[SessionChatParamsPartsObjectType] `json:"type,required"`
1574-
ID param.Field[string] `json:"id"`
1575-
Synthetic param.Field[bool] `json:"synthetic"`
1576-
Time param.Field[SessionChatParamsPartsObjectTime] `json:"time"`
1577-
}
1578-
1579-
func (r SessionChatParamsPartsObject) MarshalJSON() (data []byte, err error) {
1580-
return apijson.MarshalRoot(r)
1581-
}
1582-
1583-
func (r SessionChatParamsPartsObject) implementsSessionChatParamsPartUnion() {}
1584-
1585-
type SessionChatParamsPartsObjectType string
1586-
1587-
const (
1588-
SessionChatParamsPartsObjectTypeText SessionChatParamsPartsObjectType = "text"
1589-
)
1590-
1591-
func (r SessionChatParamsPartsObjectType) IsKnown() bool {
1592-
switch r {
1593-
case SessionChatParamsPartsObjectTypeText:
1594-
return true
1595-
}
1596-
return false
1597-
}
1598-
1599-
type SessionChatParamsPartsObjectTime struct {
1600-
Start param.Field[float64] `json:"start,required"`
1601-
End param.Field[float64] `json:"end"`
1602-
}
1603-
1604-
func (r SessionChatParamsPartsObjectTime) MarshalJSON() (data []byte, err error) {
1605-
return apijson.MarshalRoot(r)
1606-
}
1607-
16081636
type SessionChatParamsPartsType string
16091637

16101638
const (

session_test.go

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -118,12 +118,12 @@ func TestSessionChatWithOptionalParams(t *testing.T) {
118118
"id",
119119
opencode.SessionChatParams{
120120
ModelID: opencode.F("modelID"),
121-
Parts: opencode.F([]opencode.SessionChatParamsPartUnion{opencode.SessionChatParamsPartsObject{
121+
Parts: opencode.F([]opencode.SessionChatParamsPartUnion{opencode.TextPartInputParam{
122122
Text: opencode.F("text"),
123-
Type: opencode.F(opencode.SessionChatParamsPartsObjectTypeText),
123+
Type: opencode.F(opencode.TextPartInputTypeText),
124124
ID: opencode.F("id"),
125125
Synthetic: opencode.F(true),
126-
Time: opencode.F(opencode.SessionChatParamsPartsObjectTime{
126+
Time: opencode.F(opencode.TextPartInputTimeParam{
127127
Start: opencode.F(0.000000),
128128
End: opencode.F(0.000000),
129129
}),

0 commit comments

Comments
 (0)