mirror of
https://github.com/anomalyco/opencode-sdk-go.git
synced 2026-05-19 08:09:58 +00:00
release: 0.4.0 (#33)
* feat(api): api update * release: 0.4.0 --------- Co-authored-by: stainless-app[bot] <142633134+stainless-app[bot]@users.noreply.github.com>
This commit is contained in:
parent
e9b09a07a0
commit
c334a8e3fe
9 changed files with 124 additions and 7 deletions
|
|
@ -1,3 +1,3 @@
|
|||
{
|
||||
".": "0.3.0"
|
||||
".": "0.4.0"
|
||||
}
|
||||
|
|
@ -1,4 +1,4 @@
|
|||
configured_endpoints: 41
|
||||
openapi_spec_url: https://storage.googleapis.com/stainless-sdk-openapi-specs/opencode%2Fopencode-bb36e7ac24778d179b2e2e45f9390962ec6cf2947f54e0bd4467a5ff147bfeb0.yml
|
||||
openapi_spec_hash: a2d19cf8740f29955a05ac3d811e7f7a
|
||||
config_hash: 935aaa601753841e318a70faa7018477
|
||||
configured_endpoints: 42
|
||||
openapi_spec_url: https://storage.googleapis.com/stainless-sdk-openapi-specs/opencode%2Fopencode-4abd0b72d011cf0a07c5a91c28ca4d16e8b9fe005ca771dac6498ed97bd25874.yml
|
||||
openapi_spec_hash: 3b1da51d6059a2eae5ef70726352dda5
|
||||
config_hash: 438a9bbaa02ccffea52d3463ca2122eb
|
||||
|
|
|
|||
|
|
@ -1,5 +1,13 @@
|
|||
# Changelog
|
||||
|
||||
## 0.4.0 (2025-08-31)
|
||||
|
||||
Full Changelog: [v0.3.0...v0.4.0](https://github.com/sst/opencode-sdk-go/compare/v0.3.0...v0.4.0)
|
||||
|
||||
### Features
|
||||
|
||||
* **api:** api update ([fa9d6ec](https://github.com/sst/opencode-sdk-go/commit/fa9d6ec6472e62f4f6605d0a71a7aa8bf8a24559))
|
||||
|
||||
## 0.3.0 (2025-08-31)
|
||||
|
||||
Full Changelog: [v0.2.0...v0.3.0](https://github.com/sst/opencode-sdk-go/compare/v0.2.0...v0.3.0)
|
||||
|
|
|
|||
|
|
@ -24,7 +24,7 @@ Or to pin the version:
|
|||
<!-- x-release-please-start-version -->
|
||||
|
||||
```sh
|
||||
go get -u 'github.com/sst/opencode-sdk-go@v0.3.0'
|
||||
go get -u 'github.com/sst/opencode-sdk-go@v0.4.0'
|
||||
```
|
||||
|
||||
<!-- x-release-please-end -->
|
||||
|
|
|
|||
10
api.md
10
api.md
|
|
@ -14,6 +14,16 @@ Methods:
|
|||
|
||||
- <code title="get /event">client.Event.<a href="https://pkg.go.dev/github.com/sst/opencode-sdk-go#EventService.List">List</a>(ctx <a href="https://pkg.go.dev/context">context</a>.<a href="https://pkg.go.dev/context#Context">Context</a>) (<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#EventListResponse">EventListResponse</a>, <a href="https://pkg.go.dev/builtin#error">error</a>)</code>
|
||||
|
||||
# Path
|
||||
|
||||
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#Path">Path</a>
|
||||
|
||||
Methods:
|
||||
|
||||
- <code title="get /path">client.Path.<a href="https://pkg.go.dev/github.com/sst/opencode-sdk-go#PathService.Get">Get</a>(ctx <a href="https://pkg.go.dev/context">context</a>.<a href="https://pkg.go.dev/context#Context">Context</a>) (<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#Path">Path</a>, <a href="https://pkg.go.dev/builtin#error">error</a>)</code>
|
||||
|
||||
# App
|
||||
|
||||
Response Types:
|
||||
|
|
|
|||
|
|
@ -17,6 +17,7 @@ import (
|
|||
type Client struct {
|
||||
Options []option.RequestOption
|
||||
Event *EventService
|
||||
Path *PathService
|
||||
App *AppService
|
||||
Agent *AgentService
|
||||
Find *FindService
|
||||
|
|
@ -48,6 +49,7 @@ func NewClient(opts ...option.RequestOption) (r *Client) {
|
|||
r = &Client{Options: opts}
|
||||
|
||||
r.Event = NewEventService(opts...)
|
||||
r.Path = NewPathService(opts...)
|
||||
r.App = NewAppService(opts...)
|
||||
r.Agent = NewAgentService(opts...)
|
||||
r.Find = NewFindService(opts...)
|
||||
|
|
|
|||
|
|
@ -2,4 +2,4 @@
|
|||
|
||||
package internal
|
||||
|
||||
const PackageVersion = "0.3.0" // x-release-please-version
|
||||
const PackageVersion = "0.4.0" // x-release-please-version
|
||||
|
|
|
|||
61
path.go
Normal file
61
path.go
Normal file
|
|
@ -0,0 +1,61 @@
|
|||
// File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details.
|
||||
|
||||
package opencode
|
||||
|
||||
import (
|
||||
"context"
|
||||
"net/http"
|
||||
|
||||
"github.com/sst/opencode-sdk-go/internal/apijson"
|
||||
"github.com/sst/opencode-sdk-go/internal/requestconfig"
|
||||
"github.com/sst/opencode-sdk-go/option"
|
||||
)
|
||||
|
||||
// PathService contains methods and other services that help with interacting with
|
||||
// the opencode 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 [NewPathService] method instead.
|
||||
type PathService struct {
|
||||
Options []option.RequestOption
|
||||
}
|
||||
|
||||
// NewPathService 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 NewPathService(opts ...option.RequestOption) (r *PathService) {
|
||||
r = &PathService{}
|
||||
r.Options = opts
|
||||
return
|
||||
}
|
||||
|
||||
// Get the current path
|
||||
func (r *PathService) Get(ctx context.Context, opts ...option.RequestOption) (res *Path, err error) {
|
||||
opts = append(r.Options[:], opts...)
|
||||
path := "path"
|
||||
err = requestconfig.ExecuteNewRequest(ctx, http.MethodGet, path, nil, &res, opts...)
|
||||
return
|
||||
}
|
||||
|
||||
type Path struct {
|
||||
Config string `json:"config,required"`
|
||||
State string `json:"state,required"`
|
||||
JSON pathJSON `json:"-"`
|
||||
}
|
||||
|
||||
// pathJSON contains the JSON metadata for the struct [Path]
|
||||
type pathJSON struct {
|
||||
Config apijson.Field
|
||||
State apijson.Field
|
||||
raw string
|
||||
ExtraFields map[string]apijson.Field
|
||||
}
|
||||
|
||||
func (r *Path) UnmarshalJSON(data []byte) (err error) {
|
||||
return apijson.UnmarshalRoot(data, r)
|
||||
}
|
||||
|
||||
func (r pathJSON) RawJSON() string {
|
||||
return r.raw
|
||||
}
|
||||
36
path_test.go
Normal file
36
path_test.go
Normal file
|
|
@ -0,0 +1,36 @@
|
|||
// File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details.
|
||||
|
||||
package opencode_test
|
||||
|
||||
import (
|
||||
"context"
|
||||
"errors"
|
||||
"os"
|
||||
"testing"
|
||||
|
||||
"github.com/sst/opencode-sdk-go"
|
||||
"github.com/sst/opencode-sdk-go/internal/testutil"
|
||||
"github.com/sst/opencode-sdk-go/option"
|
||||
)
|
||||
|
||||
func TestPathGet(t *testing.T) {
|
||||
t.Skip("Prism tests are disabled")
|
||||
baseURL := "http://localhost:4010"
|
||||
if envURL, ok := os.LookupEnv("TEST_API_BASE_URL"); ok {
|
||||
baseURL = envURL
|
||||
}
|
||||
if !testutil.CheckTestServer(t, baseURL) {
|
||||
return
|
||||
}
|
||||
client := opencode.NewClient(
|
||||
option.WithBaseURL(baseURL),
|
||||
)
|
||||
_, err := client.Path.Get(context.TODO())
|
||||
if err != nil {
|
||||
var apierr *opencode.Error
|
||||
if errors.As(err, &apierr) {
|
||||
t.Log(string(apierr.DumpRequest(true)))
|
||||
}
|
||||
t.Fatalf("err should be nil: %s", err.Error())
|
||||
}
|
||||
}
|
||||
Loading…
Add table
Add a link
Reference in a new issue