mirror of
https://github.com/anomalyco/opencode-sdk-go.git
synced 2026-04-28 04:29:49 +00:00
feat(api): api update
This commit is contained in:
parent
9d50dbc558
commit
88a87a458f
4 changed files with 26 additions and 22 deletions
|
|
@ -1,4 +1,4 @@
|
|||
configured_endpoints: 26
|
||||
openapi_spec_url: https://storage.googleapis.com/stainless-sdk-openapi-specs/opencode%2Fopencode-335697785b44f3928145853339226bd5e8accd5199bb9d79e2a3fd2d8ce62a57.yml
|
||||
openapi_spec_hash: 74fbaad0fa44496d0d8b11d9b98eab03
|
||||
openapi_spec_url: https://storage.googleapis.com/stainless-sdk-openapi-specs/opencode%2Fopencode-fb4caa8d0381531c44dd2d3c8c0b930b8c15a7bdde474d15bf7aeeb3b27aef56.yml
|
||||
openapi_spec_hash: 3a263e46f2369eeb2410430001c60d15
|
||||
config_hash: 1ae82c93499b9f0b9ba828b8919f9cb3
|
||||
|
|
|
|||
4
api.md
4
api.md
|
|
@ -16,6 +16,10 @@ Methods:
|
|||
|
||||
# App
|
||||
|
||||
Params Types:
|
||||
|
||||
- <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#LogLevel">LogLevel</a>
|
||||
|
||||
Response Types:
|
||||
|
||||
- <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#App">App</a>
|
||||
|
|
|
|||
38
app.go
38
app.go
|
|
@ -145,6 +145,24 @@ func (r appTimeJSON) RawJSON() string {
|
|||
return r.raw
|
||||
}
|
||||
|
||||
// Log level
|
||||
type LogLevel string
|
||||
|
||||
const (
|
||||
LogLevelDebug LogLevel = "debug"
|
||||
LogLevelInfo LogLevel = "info"
|
||||
LogLevelError LogLevel = "error"
|
||||
LogLevelWarn LogLevel = "warn"
|
||||
)
|
||||
|
||||
func (r LogLevel) IsKnown() bool {
|
||||
switch r {
|
||||
case LogLevelDebug, LogLevelInfo, LogLevelError, LogLevelWarn:
|
||||
return true
|
||||
}
|
||||
return false
|
||||
}
|
||||
|
||||
type Mode struct {
|
||||
Name string `json:"name,required"`
|
||||
Tools map[string]bool `json:"tools,required"`
|
||||
|
|
@ -334,7 +352,7 @@ func (r appProvidersResponseJSON) RawJSON() string {
|
|||
|
||||
type AppLogParams struct {
|
||||
// Log level
|
||||
Level param.Field[AppLogParamsLevel] `json:"level,required"`
|
||||
Level param.Field[LogLevel] `json:"level,required"`
|
||||
// Log message
|
||||
Message param.Field[string] `json:"message,required"`
|
||||
// Service name for the log entry
|
||||
|
|
@ -346,21 +364,3 @@ type AppLogParams struct {
|
|||
func (r AppLogParams) MarshalJSON() (data []byte, err error) {
|
||||
return apijson.MarshalRoot(r)
|
||||
}
|
||||
|
||||
// Log level
|
||||
type AppLogParamsLevel string
|
||||
|
||||
const (
|
||||
AppLogParamsLevelDebug AppLogParamsLevel = "debug"
|
||||
AppLogParamsLevelInfo AppLogParamsLevel = "info"
|
||||
AppLogParamsLevelError AppLogParamsLevel = "error"
|
||||
AppLogParamsLevelWarn AppLogParamsLevel = "warn"
|
||||
)
|
||||
|
||||
func (r AppLogParamsLevel) IsKnown() bool {
|
||||
switch r {
|
||||
case AppLogParamsLevelDebug, AppLogParamsLevelInfo, AppLogParamsLevelError, AppLogParamsLevelWarn:
|
||||
return true
|
||||
}
|
||||
return false
|
||||
}
|
||||
|
|
|
|||
|
|
@ -70,7 +70,7 @@ func TestAppLogWithOptionalParams(t *testing.T) {
|
|||
option.WithBaseURL(baseURL),
|
||||
)
|
||||
_, err := client.App.Log(context.TODO(), opencode.AppLogParams{
|
||||
Level: opencode.F(opencode.AppLogParamsLevelDebug),
|
||||
Level: opencode.F(opencode.LogLevelDebug),
|
||||
Message: opencode.F("message"),
|
||||
Service: opencode.F("service"),
|
||||
Extra: opencode.F(map[string]interface{}{
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue