From c334a8e3fe898d13f00451dcafa1791d5437a347 Mon Sep 17 00:00:00 2001 From: "stainless-app[bot]" <142633134+stainless-app[bot]@users.noreply.github.com> Date: Sun, 31 Aug 2025 01:59:51 -0400 Subject: [PATCH] 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> --- .release-please-manifest.json | 2 +- .stats.yml | 8 ++--- CHANGELOG.md | 8 +++++ README.md | 2 +- api.md | 10 ++++++ client.go | 2 ++ internal/version.go | 2 +- path.go | 61 +++++++++++++++++++++++++++++++++++ path_test.go | 36 +++++++++++++++++++++ 9 files changed, 124 insertions(+), 7 deletions(-) create mode 100644 path.go create mode 100644 path_test.go diff --git a/.release-please-manifest.json b/.release-please-manifest.json index 6b7b74c..da59f99 100644 --- a/.release-please-manifest.json +++ b/.release-please-manifest.json @@ -1,3 +1,3 @@ { - ".": "0.3.0" + ".": "0.4.0" } \ No newline at end of file diff --git a/.stats.yml b/.stats.yml index 6c2bc97..f560376 100644 --- a/.stats.yml +++ b/.stats.yml @@ -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 diff --git a/CHANGELOG.md b/CHANGELOG.md index ef0984e..69bf339 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -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) diff --git a/README.md b/README.md index a8c915f..f579048 100644 --- a/README.md +++ b/README.md @@ -24,7 +24,7 @@ Or to pin the 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' ``` diff --git a/api.md b/api.md index 3e6c2c7..f5b2d9f 100644 --- a/api.md +++ b/api.md @@ -14,6 +14,16 @@ Methods: - client.Event.List(ctx context.Context) (opencode.EventListResponse, error) +# Path + +Response Types: + +- opencode.Path + +Methods: + +- client.Path.Get(ctx context.Context) (opencode.Path, error) + # App Response Types: diff --git a/client.go b/client.go index 9310744..c66b86b 100644 --- a/client.go +++ b/client.go @@ -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...) diff --git a/internal/version.go b/internal/version.go index 7cb1898..5c62cac 100644 --- a/internal/version.go +++ b/internal/version.go @@ -2,4 +2,4 @@ package internal -const PackageVersion = "0.3.0" // x-release-please-version +const PackageVersion = "0.4.0" // x-release-please-version diff --git a/path.go b/path.go new file mode 100644 index 0000000..da5528b --- /dev/null +++ b/path.go @@ -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 +} diff --git a/path_test.go b/path_test.go new file mode 100644 index 0000000..e8b274a --- /dev/null +++ b/path_test.go @@ -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()) + } +}