diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 829f3d7..0ffe702 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -13,6 +13,33 @@ on: - 'stl-preview-base/**' jobs: + build: + timeout-minutes: 10 + name: build + permissions: + contents: read + id-token: write + runs-on: ${{ github.repository == 'stainless-sdks/arcade-engine-go' && 'depot-ubuntu-24.04' || 'ubuntu-latest' }} + if: |- + github.repository == 'stainless-sdks/arcade-engine-go' && + (github.event_name == 'push' || github.event.pull_request.head.repo.fork) + steps: + - uses: actions/checkout@v6 + + - name: Get GitHub OIDC Token + if: github.repository == 'stainless-sdks/arcade-engine-go' + id: github-oidc + uses: actions/github-script@v8 + with: + script: core.setOutput('github_token', await core.getIDToken()); + + - name: Upload tarball + if: github.repository == 'stainless-sdks/arcade-engine-go' + env: + URL: https://pkg.stainless.com/s + AUTH: ${{ steps.github-oidc.outputs.github_token }} + SHA: ${{ github.sha }} + run: ./scripts/utils/upload-artifact.sh lint: timeout-minutes: 10 name: lint @@ -20,7 +47,7 @@ jobs: if: github.event_name == 'push' || github.event.pull_request.head.repo.fork steps: - - uses: actions/checkout@v4 + - uses: actions/checkout@v6 - name: Setup go uses: actions/setup-go@v5 @@ -35,7 +62,7 @@ jobs: runs-on: ${{ github.repository == 'stainless-sdks/arcade-engine-go' && 'depot-ubuntu-24.04' || 'ubuntu-latest' }} if: github.event_name == 'push' || github.event.pull_request.head.repo.fork steps: - - uses: actions/checkout@v4 + - uses: actions/checkout@v6 - name: Setup go uses: actions/setup-go@v5 diff --git a/.release-please-manifest.json b/.release-please-manifest.json index c373724..46b9b6b 100644 --- a/.release-please-manifest.json +++ b/.release-please-manifest.json @@ -1,3 +1,3 @@ { - ".": "0.1.0-alpha.8" + ".": "0.1.0-alpha.9" } \ No newline at end of file diff --git a/.stats.yml b/.stats.yml index d521f65..f7c06a5 100644 --- a/.stats.yml +++ b/.stats.yml @@ -1,4 +1,4 @@ -configured_endpoints: 29 -openapi_spec_url: https://storage.googleapis.com/stainless-sdk-openapi-specs/arcade-ai%2Farcade-engine-0a15ddd7e03addf08468ff36ac294458f86a3a990277a71870e4bc293635bef9.yml -openapi_spec_hash: 8640228f8a86e5dc464dfa2c8205a2a7 -config_hash: 70cdb57c982c578d1961657c07b8b397 +configured_endpoints: 30 +openapi_spec_url: https://storage.googleapis.com/stainless-sdk-openapi-specs/arcade-ai%2Farcade-engine-6ff494eafa2c154892716407682bb2296cff4f18c45765c5fb16bdf36f452ae1.yml +openapi_spec_hash: 63dde2481a7d51042a241bfba232b0b0 +config_hash: bf64816643634a621cd0ffd93d9c4347 diff --git a/CHANGELOG.md b/CHANGELOG.md index 2621d57..1aee55c 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,5 +1,48 @@ # Changelog +## 0.1.0-alpha.9 (2026-03-03) + +Full Changelog: [v0.1.0-alpha.8...v0.1.0-alpha.9](https://github.com/ArcadeAI/arcade-go/compare/v0.1.0-alpha.8...v0.1.0-alpha.9) + +### Features + +* **api:** api update ([8e0a60b](https://github.com/ArcadeAI/arcade-go/commit/8e0a60b92a5d9aaf32d3b1fd3c008921972ccec8)) +* **api:** api update ([e7ec3a4](https://github.com/ArcadeAI/arcade-go/commit/e7ec3a489005741fb4fe27aed0223e479aaf15d6)) +* **api:** api update ([ef6dba7](https://github.com/ArcadeAI/arcade-go/commit/ef6dba7dcc75ec8a355da12108145dc966564949)) +* **api:** api update ([e295d78](https://github.com/ArcadeAI/arcade-go/commit/e295d78443c56c5d146c1ce425cc0b94aa986abd)) +* **api:** api update ([f3cafbb](https://github.com/ArcadeAI/arcade-go/commit/f3cafbbda12389ddac755ad764cdfca589fed640)) +* **api:** api update ([426bd50](https://github.com/ArcadeAI/arcade-go/commit/426bd5094794f1fe5cf17928871bdbf7c8372cbc)) +* **api:** api update ([31b05fe](https://github.com/ArcadeAI/arcade-go/commit/31b05fe785b727d1fce4a403f6995f354476a3ab)) +* **api:** api update ([dba7b85](https://github.com/ArcadeAI/arcade-go/commit/dba7b8599c6b63c207634e3ac9a8250abbd8c478)) +* **api:** api update ([96bb51d](https://github.com/ArcadeAI/arcade-go/commit/96bb51dc393da8eda932aebcb8817e15c6f0fd3c)) +* **api:** api update ([8a8ad69](https://github.com/ArcadeAI/arcade-go/commit/8a8ad6959f8ae3aed9085661c6efd7a19713ea41)) +* **api:** api update ([225468e](https://github.com/ArcadeAI/arcade-go/commit/225468eb94ab97ea95c360939964eef2c9f15142)) + + +### Bug Fixes + +* allow canceling a request while it is waiting to retry ([5093f28](https://github.com/ArcadeAI/arcade-go/commit/5093f2889531dc14af7be689f2af8baba011f606)) +* **client:** correctly specify Accept header with */* instead of empty ([b4971e9](https://github.com/ArcadeAI/arcade-go/commit/b4971e9ac4114e03f0b91628a5e5bea5055d4d90)) +* **docs:** add missing pointer prefix to api.md return types ([11168f2](https://github.com/ArcadeAI/arcade-go/commit/11168f2105fd658a16d9378d56dc283925e31412)) +* **mcp:** correct code tool API endpoint ([cdd7fa0](https://github.com/ArcadeAI/arcade-go/commit/cdd7fa02a5ca03e198cad5a969e7e2951e6fb372)) +* rename param to avoid collision ([31f124a](https://github.com/ArcadeAI/arcade-go/commit/31f124a0dd547c82e1655a34e30be9bbed9ed06f)) + + +### Chores + +* elide duplicate aliases ([37f1785](https://github.com/ArcadeAI/arcade-go/commit/37f1785677e7707685049d97ea3fc88f6955cd45)) +* **internal:** codegen related update ([d308faf](https://github.com/ArcadeAI/arcade-go/commit/d308fafcd3b08787165aa32d4b89302368d85396)) +* **internal:** codegen related update ([d2a63a5](https://github.com/ArcadeAI/arcade-go/commit/d2a63a5c1426deb8172d2f98a3976e37b10a8d1d)) +* **internal:** codegen related update ([263a9c8](https://github.com/ArcadeAI/arcade-go/commit/263a9c8e76c9920b0b7984701e9498da2cee6398)) +* **internal:** move custom custom `json` tags to `api` ([cedae74](https://github.com/ArcadeAI/arcade-go/commit/cedae746b544a425461567895a612b8a3f6753fc)) +* **internal:** update `actions/checkout` version ([c507015](https://github.com/ArcadeAI/arcade-go/commit/c5070155e8a43faf42a500d32d97e2a569c3eea0)) +* update mock server docs ([78e159d](https://github.com/ArcadeAI/arcade-go/commit/78e159d152c1a41ce41f28c28902fa63913ba87d)) + + +### Documentation + +* add more examples ([c8e95c7](https://github.com/ArcadeAI/arcade-go/commit/c8e95c7814031cf786e5e6d09e4bf8b51a48063a)) + ## 0.1.0-alpha.8 (2025-11-07) Full Changelog: [v0.1.0-alpha.7...v0.1.0-alpha.8](https://github.com/ArcadeAI/arcade-go/compare/v0.1.0-alpha.7...v0.1.0-alpha.8) diff --git a/CONTRIBUTING.md b/CONTRIBUTING.md index 99b994b..9385c78 100644 --- a/CONTRIBUTING.md +++ b/CONTRIBUTING.md @@ -49,8 +49,7 @@ $ go mod edit -replace github.com/ArcadeAI/arcade-go=/path/to/arcade-go Most tests require you to [set up a mock server](https://github.com/stoplightio/prism) against the OpenAPI spec to run the tests. ```sh -# you will need npm installed -$ npx prism mock path/to/your/openapi.yml +$ ./scripts/mock ``` ```sh diff --git a/LICENSE b/LICENSE index 586b176..fed1c6e 100644 --- a/LICENSE +++ b/LICENSE @@ -1,4 +1,4 @@ -Copyright 2025 Arcade +Copyright 2026 Arcade Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions: diff --git a/README.md b/README.md index 503a2ed..78d6ec2 100644 --- a/README.md +++ b/README.md @@ -24,7 +24,7 @@ Or to pin the version: ```sh -go get -u 'github.com/ArcadeAI/arcade-go@v0.1.0-alpha.8' +go get -u 'github.com/ArcadeAI/arcade-go@v0.1.0-alpha.9' ``` @@ -165,9 +165,34 @@ This library provides some conveniences for working with paginated list endpoint You can use `.ListAutoPaging()` methods to iterate through items across all pages: +```go +iter := client.Admin.UserConnections.ListAutoPaging(context.TODO(), arcadego.AdminUserConnectionListParams{}) +// Automatically fetches more pages as needed. +for iter.Next() { + userConnectionResponse := iter.Current() + fmt.Printf("%+v\n", userConnectionResponse) +} +if err := iter.Err(); err != nil { + panic(err.Error()) +} +``` + Or you can use simple `.List()` methods to fetch a single page and receive a standard response object with additional helper methods like `.GetNextPage()`, e.g.: +```go +page, err := client.Admin.UserConnections.List(context.TODO(), arcadego.AdminUserConnectionListParams{}) +for page != nil { + for _, userConnection := range page.Items { + fmt.Printf("%+v\n", userConnection) + } + page, err = page.GetNextPage() +} +if err != nil { + panic(err.Error()) +} +``` + ### Errors When the API returns a non-success status code, we return an error with type diff --git a/adminauthprovider.go b/adminauthprovider.go index 4b1afa9..bb61c03 100644 --- a/adminauthprovider.go +++ b/adminauthprovider.go @@ -87,7 +87,7 @@ func (r *AdminAuthProviderService) Patch(ctx context.Context, id string, body Ad } type AuthProviderCreateRequestParam struct { - ID param.Field[string] `json:"id,required"` + ID param.Field[string] `json:"id" api:"required"` Description param.Field[string] `json:"description"` // The unique external ID for the auth provider ExternalID param.Field[string] `json:"external_id"` @@ -102,7 +102,7 @@ func (r AuthProviderCreateRequestParam) MarshalJSON() (data []byte, err error) { } type AuthProviderCreateRequestOauth2Param struct { - ClientID param.Field[string] `json:"client_id,required"` + ClientID param.Field[string] `json:"client_id" api:"required"` AuthorizeRequest param.Field[AuthProviderCreateRequestOauth2AuthorizeRequestParam] `json:"authorize_request"` ClientSecret param.Field[string] `json:"client_secret"` Pkce param.Field[AuthProviderCreateRequestOauth2PkceParam] `json:"pkce"` @@ -118,7 +118,7 @@ func (r AuthProviderCreateRequestOauth2Param) MarshalJSON() (data []byte, err er } type AuthProviderCreateRequestOauth2AuthorizeRequestParam struct { - Endpoint param.Field[string] `json:"endpoint,required"` + Endpoint param.Field[string] `json:"endpoint" api:"required"` AuthHeaderValueFormat param.Field[string] `json:"auth_header_value_format"` AuthMethod param.Field[string] `json:"auth_method"` Method param.Field[string] `json:"method"` @@ -172,7 +172,7 @@ func (r AuthProviderCreateRequestOauth2PkceParam) MarshalJSON() (data []byte, er } type AuthProviderCreateRequestOauth2RefreshRequestParam struct { - Endpoint param.Field[string] `json:"endpoint,required"` + Endpoint param.Field[string] `json:"endpoint" api:"required"` AuthHeaderValueFormat param.Field[string] `json:"auth_header_value_format"` AuthMethod param.Field[string] `json:"auth_method"` Method param.Field[string] `json:"method"` @@ -232,8 +232,8 @@ func (r AuthProviderCreateRequestOauth2ScopeDelimiter) IsKnown() bool { } type AuthProviderCreateRequestOauth2TokenIntrospectionRequestParam struct { - Endpoint param.Field[string] `json:"endpoint,required"` - Triggers param.Field[AuthProviderCreateRequestOauth2TokenIntrospectionRequestTriggersParam] `json:"triggers,required"` + Endpoint param.Field[string] `json:"endpoint" api:"required"` + Triggers param.Field[AuthProviderCreateRequestOauth2TokenIntrospectionRequestTriggersParam] `json:"triggers" api:"required"` AuthHeaderValueFormat param.Field[string] `json:"auth_header_value_format"` AuthMethod param.Field[string] `json:"auth_method"` Method param.Field[string] `json:"method"` @@ -287,7 +287,7 @@ func (r AuthProviderCreateRequestOauth2TokenIntrospectionRequestResponseContentT } type AuthProviderCreateRequestOauth2TokenRequestParam struct { - Endpoint param.Field[string] `json:"endpoint,required"` + Endpoint param.Field[string] `json:"endpoint" api:"required"` AuthHeaderValueFormat param.Field[string] `json:"auth_header_value_format"` AuthMethod param.Field[string] `json:"auth_method"` Method param.Field[string] `json:"method"` @@ -332,8 +332,8 @@ func (r AuthProviderCreateRequestOauth2TokenRequestResponseContentType) IsKnown( } type AuthProviderCreateRequestOauth2UserInfoRequestParam struct { - Endpoint param.Field[string] `json:"endpoint,required"` - Triggers param.Field[AuthProviderCreateRequestOauth2UserInfoRequestTriggersParam] `json:"triggers,required"` + Endpoint param.Field[string] `json:"endpoint" api:"required"` + Triggers param.Field[AuthProviderCreateRequestOauth2UserInfoRequestTriggersParam] `json:"triggers" api:"required"` AuthHeaderValueFormat param.Field[string] `json:"auth_header_value_format"` AuthMethod param.Field[string] `json:"auth_method"` Method param.Field[string] `json:"method"` @@ -544,7 +544,6 @@ type AuthProviderResponseOauth2ClientSecret struct { Binding AuthProviderResponseOauth2ClientSecretBinding `json:"binding"` Editable bool `json:"editable"` Exists bool `json:"exists"` - Hint string `json:"hint"` Value string `json:"value"` JSON authProviderResponseOauth2ClientSecretJSON `json:"-"` } @@ -555,7 +554,6 @@ type authProviderResponseOauth2ClientSecretJSON struct { Binding apijson.Field Editable apijson.Field Exists apijson.Field - Hint apijson.Field Value apijson.Field raw string ExtraFields map[string]apijson.Field @@ -1082,7 +1080,7 @@ func (r adminAuthProviderListResponseJSON) RawJSON() string { } type AdminAuthProviderNewParams struct { - AuthProviderCreateRequest AuthProviderCreateRequestParam `json:"auth_provider_create_request,required"` + AuthProviderCreateRequest AuthProviderCreateRequestParam `json:"auth_provider_create_request" api:"required"` } func (r AdminAuthProviderNewParams) MarshalJSON() (data []byte, err error) { @@ -1090,7 +1088,7 @@ func (r AdminAuthProviderNewParams) MarshalJSON() (data []byte, err error) { } type AdminAuthProviderPatchParams struct { - AuthProviderUpdateRequest AuthProviderUpdateRequestParam `json:"auth_provider_update_request,required"` + AuthProviderUpdateRequest AuthProviderUpdateRequestParam `json:"auth_provider_update_request" api:"required"` } func (r AdminAuthProviderPatchParams) MarshalJSON() (data []byte, err error) { diff --git a/adminsecret.go b/adminsecret.go index 06f9a3c..981cec4 100644 --- a/adminsecret.go +++ b/adminsecret.go @@ -10,6 +10,7 @@ import ( "slices" "github.com/ArcadeAI/arcade-go/internal/apijson" + "github.com/ArcadeAI/arcade-go/internal/param" "github.com/ArcadeAI/arcade-go/internal/requestconfig" "github.com/ArcadeAI/arcade-go/option" ) @@ -33,6 +34,18 @@ func NewAdminSecretService(opts ...option.RequestOption) (r *AdminSecretService) return } +// Create or update a secret +func (r *AdminSecretService) New(ctx context.Context, secretKey string, body AdminSecretNewParams, opts ...option.RequestOption) (res *SecretResponse, err error) { + opts = slices.Concat(r.Options, opts) + if secretKey == "" { + err = errors.New("missing required secret_key parameter") + return + } + path := fmt.Sprintf("v1/admin/secrets/%s", secretKey) + err = requestconfig.ExecuteNewRequest(ctx, http.MethodPost, path, body, &res, opts...) + return +} + // List all secrets that are visible to the caller func (r *AdminSecretService) List(ctx context.Context, opts ...option.RequestOption) (res *AdminSecretListResponse, err error) { opts = slices.Concat(r.Options, opts) @@ -44,7 +57,7 @@ func (r *AdminSecretService) List(ctx context.Context, opts ...option.RequestOpt // Delete a secret by its ID func (r *AdminSecretService) Delete(ctx context.Context, secretID string, opts ...option.RequestOption) (err error) { opts = slices.Concat(r.Options, opts) - opts = append([]option.RequestOption{option.WithHeader("Accept", "")}, opts...) + opts = append([]option.RequestOption{option.WithHeader("Accept", "*/*")}, opts...) if secretID == "" { err = errors.New("missing required secret_id parameter") return @@ -59,7 +72,6 @@ type SecretResponse struct { Binding SecretResponseBinding `json:"binding"` CreatedAt string `json:"created_at"` Description string `json:"description"` - Hint string `json:"hint"` Key string `json:"key"` LastAccessedAt string `json:"last_accessed_at"` UpdatedAt string `json:"updated_at"` @@ -72,7 +84,6 @@ type secretResponseJSON struct { Binding apijson.Field CreatedAt apijson.Field Description apijson.Field - Hint apijson.Field Key apijson.Field LastAccessedAt apijson.Field UpdatedAt apijson.Field @@ -156,3 +167,12 @@ func (r *AdminSecretListResponse) UnmarshalJSON(data []byte) (err error) { func (r adminSecretListResponseJSON) RawJSON() string { return r.raw } + +type AdminSecretNewParams struct { + Value param.Field[string] `json:"value" api:"required"` + Description param.Field[string] `json:"description"` +} + +func (r AdminSecretNewParams) MarshalJSON() (data []byte, err error) { + return apijson.MarshalRoot(r) +} diff --git a/adminsecret_test.go b/adminsecret_test.go index 3aca95c..8b23303 100644 --- a/adminsecret_test.go +++ b/adminsecret_test.go @@ -13,6 +13,35 @@ import ( "github.com/ArcadeAI/arcade-go/option" ) +func TestAdminSecretNewWithOptionalParams(t *testing.T) { + baseURL := "http://localhost:4010" + if envURL, ok := os.LookupEnv("TEST_API_BASE_URL"); ok { + baseURL = envURL + } + if !testutil.CheckTestServer(t, baseURL) { + return + } + client := arcadego.NewClient( + option.WithBaseURL(baseURL), + option.WithAPIKey("My API Key"), + ) + _, err := client.Admin.Secrets.New( + context.TODO(), + "secret_key", + arcadego.AdminSecretNewParams{ + Value: arcadego.F("value"), + Description: arcadego.F("description"), + }, + ) + if err != nil { + var apierr *arcadego.Error + if errors.As(err, &apierr) { + t.Log(string(apierr.DumpRequest(true))) + } + t.Fatalf("err should be nil: %s", err.Error()) + } +} + func TestAdminSecretList(t *testing.T) { baseURL := "http://localhost:4010" if envURL, ok := os.LookupEnv("TEST_API_BASE_URL"); ok { diff --git a/adminuserconnection.go b/adminuserconnection.go index 3fe52d9..8e9060d 100644 --- a/adminuserconnection.go +++ b/adminuserconnection.go @@ -63,7 +63,7 @@ func (r *AdminUserConnectionService) ListAutoPaging(ctx context.Context, query A // Delete a user/auth provider connection func (r *AdminUserConnectionService) Delete(ctx context.Context, id string, opts ...option.RequestOption) (err error) { opts = slices.Concat(r.Options, opts) - opts = append([]option.RequestOption{option.WithHeader("Accept", "")}, opts...) + opts = append([]option.RequestOption{option.WithHeader("Accept", "*/*")}, opts...) if id == "" { err = errors.New("missing required id parameter") return @@ -114,42 +114,16 @@ type AdminUserConnectionListParams struct { // Page size Limit param.Field[int64] `query:"limit"` // Page offset - Offset param.Field[int64] `query:"offset"` - Provider param.Field[AdminUserConnectionListParamsProvider] `query:"provider"` - User param.Field[AdminUserConnectionListParamsUser] `query:"user"` -} - -// URLQuery serializes [AdminUserConnectionListParams]'s query parameters as -// `url.Values`. -func (r AdminUserConnectionListParams) URLQuery() (v url.Values) { - return apiquery.MarshalWithSettings(r, apiquery.QuerySettings{ - ArrayFormat: apiquery.ArrayQueryFormatComma, - NestedFormat: apiquery.NestedQueryFormatBrackets, - }) -} - -type AdminUserConnectionListParamsProvider struct { + Offset param.Field[int64] `query:"offset"` // Provider ID - ID param.Field[string] `query:"id"` -} - -// URLQuery serializes [AdminUserConnectionListParamsProvider]'s query parameters -// as `url.Values`. -func (r AdminUserConnectionListParamsProvider) URLQuery() (v url.Values) { - return apiquery.MarshalWithSettings(r, apiquery.QuerySettings{ - ArrayFormat: apiquery.ArrayQueryFormatComma, - NestedFormat: apiquery.NestedQueryFormatBrackets, - }) -} - -type AdminUserConnectionListParamsUser struct { + ProviderID param.Field[string] `query:"provider_id"` // User ID - ID param.Field[string] `query:"id"` + UserID param.Field[string] `query:"user_id"` } -// URLQuery serializes [AdminUserConnectionListParamsUser]'s query parameters as +// URLQuery serializes [AdminUserConnectionListParams]'s query parameters as // `url.Values`. -func (r AdminUserConnectionListParamsUser) URLQuery() (v url.Values) { +func (r AdminUserConnectionListParams) URLQuery() (v url.Values) { return apiquery.MarshalWithSettings(r, apiquery.QuerySettings{ ArrayFormat: apiquery.ArrayQueryFormatComma, NestedFormat: apiquery.NestedQueryFormatBrackets, diff --git a/adminuserconnection_test.go b/adminuserconnection_test.go index ef75334..66693f4 100644 --- a/adminuserconnection_test.go +++ b/adminuserconnection_test.go @@ -26,14 +26,10 @@ func TestAdminUserConnectionListWithOptionalParams(t *testing.T) { option.WithAPIKey("My API Key"), ) _, err := client.Admin.UserConnections.List(context.TODO(), arcadego.AdminUserConnectionListParams{ - Limit: arcadego.F(int64(0)), - Offset: arcadego.F(int64(0)), - Provider: arcadego.F(arcadego.AdminUserConnectionListParamsProvider{ - ID: arcadego.F("id"), - }), - User: arcadego.F(arcadego.AdminUserConnectionListParamsUser{ - ID: arcadego.F("id"), - }), + Limit: arcadego.F(int64(0)), + Offset: arcadego.F(int64(0)), + ProviderID: arcadego.F("provider_id"), + UserID: arcadego.F("user_id"), }) if err != nil { var apierr *arcadego.Error diff --git a/api.md b/api.md index 7b69123..df901c3 100644 --- a/api.md +++ b/api.md @@ -13,7 +13,7 @@ Response Types: Methods: -- client.Admin.UserConnections.List(ctx context.Context, query arcadego.AdminUserConnectionListParams) (pagination.OffsetPage[arcadego.UserConnectionResponse], error) +- client.Admin.UserConnections.List(ctx context.Context, query arcadego.AdminUserConnectionListParams) (\*pagination.OffsetPage[arcadego.UserConnectionResponse], error) - client.Admin.UserConnections.Delete(ctx context.Context, id string) error ## AuthProviders @@ -30,11 +30,11 @@ Response Types: Methods: -- client.Admin.AuthProviders.New(ctx context.Context, body arcadego.AdminAuthProviderNewParams) (arcadego.AuthProviderResponse, error) -- client.Admin.AuthProviders.List(ctx context.Context) (arcadego.AdminAuthProviderListResponse, error) -- client.Admin.AuthProviders.Delete(ctx context.Context, id string) (arcadego.AuthProviderResponse, error) -- client.Admin.AuthProviders.Get(ctx context.Context, id string) (arcadego.AuthProviderResponse, error) -- client.Admin.AuthProviders.Patch(ctx context.Context, id string, body arcadego.AdminAuthProviderPatchParams) (arcadego.AuthProviderResponse, error) +- client.Admin.AuthProviders.New(ctx context.Context, body arcadego.AdminAuthProviderNewParams) (\*arcadego.AuthProviderResponse, error) +- client.Admin.AuthProviders.List(ctx context.Context) (\*arcadego.AdminAuthProviderListResponse, error) +- client.Admin.AuthProviders.Delete(ctx context.Context, id string) (\*arcadego.AuthProviderResponse, error) +- client.Admin.AuthProviders.Get(ctx context.Context, id string) (\*arcadego.AuthProviderResponse, error) +- client.Admin.AuthProviders.Patch(ctx context.Context, id string, body arcadego.AdminAuthProviderPatchParams) (\*arcadego.AuthProviderResponse, error) ## Secrets @@ -45,7 +45,8 @@ Response Types: Methods: -- client.Admin.Secrets.List(ctx context.Context) (arcadego.AdminSecretListResponse, error) +- client.Admin.Secrets.New(ctx context.Context, secretKey string, body arcadego.AdminSecretNewParams) (\*arcadego.SecretResponse, error) +- client.Admin.Secrets.List(ctx context.Context) (\*arcadego.AdminSecretListResponse, error) - client.Admin.Secrets.Delete(ctx context.Context, secretID string) error # Auth @@ -61,9 +62,9 @@ Response Types: Methods: -- client.Auth.Authorize(ctx context.Context, body arcadego.AuthAuthorizeParams) (shared.AuthorizationResponse, error) -- client.Auth.ConfirmUser(ctx context.Context, body arcadego.AuthConfirmUserParams) (arcadego.ConfirmUserResponse, error) -- client.Auth.Status(ctx context.Context, query arcadego.AuthStatusParams) (shared.AuthorizationResponse, error) +- client.Auth.Authorize(ctx context.Context, body arcadego.AuthAuthorizeParams) (\*shared.AuthorizationResponse, error) +- client.Auth.ConfirmUser(ctx context.Context, body arcadego.AuthConfirmUserParams) (\*arcadego.ConfirmUserResponse, error) +- client.Auth.Status(ctx context.Context, query arcadego.AuthStatusParams) (\*shared.AuthorizationResponse, error) # Health @@ -73,7 +74,7 @@ Response Types: Methods: -- client.Health.Check(ctx context.Context) (arcadego.HealthSchema, error) +- client.Health.Check(ctx context.Context) (\*arcadego.HealthSchema, error) # Chat @@ -93,7 +94,7 @@ Response Types: Methods: -- client.Chat.Completions.New(ctx context.Context, body arcadego.ChatCompletionNewParams) (arcadego.ChatResponse, error) +- client.Chat.Completions.New(ctx context.Context, body arcadego.ChatCompletionNewParams) (\*arcadego.ChatResponse, error) # Tools @@ -112,10 +113,10 @@ Response Types: Methods: -- client.Tools.List(ctx context.Context, query arcadego.ToolListParams) (pagination.OffsetPage[arcadego.ToolDefinition], error) -- client.Tools.Authorize(ctx context.Context, body arcadego.ToolAuthorizeParams) (shared.AuthorizationResponse, error) -- client.Tools.Execute(ctx context.Context, body arcadego.ToolExecuteParams) (arcadego.ExecuteToolResponse, error) -- client.Tools.Get(ctx context.Context, name string, query arcadego.ToolGetParams) (arcadego.ToolDefinition, error) +- client.Tools.List(ctx context.Context, query arcadego.ToolListParams) (\*pagination.OffsetPage[arcadego.ToolDefinition], error) +- client.Tools.Authorize(ctx context.Context, body arcadego.ToolAuthorizeParams) (\*shared.AuthorizationResponse, error) +- client.Tools.Execute(ctx context.Context, body arcadego.ToolExecuteParams) (\*arcadego.ExecuteToolResponse, error) +- client.Tools.Get(ctx context.Context, name string, query arcadego.ToolGetParams) (\*arcadego.ToolDefinition, error) ## Scheduled @@ -125,8 +126,8 @@ Response Types: Methods: -- client.Tools.Scheduled.List(ctx context.Context, query arcadego.ToolScheduledListParams) (pagination.OffsetPage[arcadego.ToolExecution], error) -- client.Tools.Scheduled.Get(ctx context.Context, id string) (arcadego.ToolScheduledGetResponse, error) +- client.Tools.Scheduled.List(ctx context.Context, query arcadego.ToolScheduledListParams) (\*pagination.OffsetPage[arcadego.ToolExecution], error) +- client.Tools.Scheduled.Get(ctx context.Context, id string) (\*arcadego.ToolScheduledGetResponse, error) ## Formatted @@ -137,8 +138,8 @@ Response Types: Methods: -- client.Tools.Formatted.List(ctx context.Context, query arcadego.ToolFormattedListParams) (pagination.OffsetPage[arcadego.ToolFormattedListResponse], error) -- client.Tools.Formatted.Get(ctx context.Context, name string, query arcadego.ToolFormattedGetParams) (arcadego.ToolFormattedGetResponse, error) +- client.Tools.Formatted.List(ctx context.Context, query arcadego.ToolFormattedListParams) (\*pagination.OffsetPage[arcadego.ToolFormattedListResponse], error) +- client.Tools.Formatted.Get(ctx context.Context, name string, query arcadego.ToolFormattedGetParams) (\*arcadego.ToolFormattedGetResponse, error) # Workers @@ -154,10 +155,10 @@ Response Types: Methods: -- client.Workers.New(ctx context.Context, body arcadego.WorkerNewParams) (arcadego.WorkerResponse, error) -- client.Workers.Update(ctx context.Context, id string, body arcadego.WorkerUpdateParams) (arcadego.WorkerResponse, error) -- client.Workers.List(ctx context.Context, query arcadego.WorkerListParams) (pagination.OffsetPage[arcadego.WorkerResponse], error) +- client.Workers.New(ctx context.Context, body arcadego.WorkerNewParams) (\*arcadego.WorkerResponse, error) +- client.Workers.Update(ctx context.Context, id string, body arcadego.WorkerUpdateParams) (\*arcadego.WorkerResponse, error) +- client.Workers.List(ctx context.Context, query arcadego.WorkerListParams) (\*pagination.OffsetPage[arcadego.WorkerResponse], error) - client.Workers.Delete(ctx context.Context, id string) error -- client.Workers.Get(ctx context.Context, id string) (arcadego.WorkerResponse, error) -- client.Workers.Health(ctx context.Context, id string) (arcadego.WorkerHealthResponse, error) -- client.Workers.Tools(ctx context.Context, id string, query arcadego.WorkerToolsParams) (pagination.OffsetPage[arcadego.ToolDefinition], error) +- client.Workers.Get(ctx context.Context, id string) (\*arcadego.WorkerResponse, error) +- client.Workers.Health(ctx context.Context, id string) (\*arcadego.WorkerHealthResponse, error) +- client.Workers.Tools(ctx context.Context, id string, query arcadego.WorkerToolsParams) (\*pagination.OffsetPage[arcadego.ToolDefinition], error) diff --git a/auth.go b/auth.go index 3401e92..932a398 100644 --- a/auth.go +++ b/auth.go @@ -62,8 +62,8 @@ func (r *AuthService) Status(ctx context.Context, query AuthStatusParams, opts . } type AuthRequestParam struct { - AuthRequirement param.Field[AuthRequestAuthRequirementParam] `json:"auth_requirement,required"` - UserID param.Field[string] `json:"user_id,required"` + AuthRequirement param.Field[AuthRequestAuthRequirementParam] `json:"auth_requirement" api:"required"` + UserID param.Field[string] `json:"user_id" api:"required"` // Optional: if provided, the user will be redirected to this URI after // authorization NextUri param.Field[string] `json:"next_uri"` @@ -95,8 +95,8 @@ func (r AuthRequestAuthRequirementOauth2Param) MarshalJSON() (data []byte, err e } type ConfirmUserRequestParam struct { - FlowID param.Field[string] `json:"flow_id,required"` - UserID param.Field[string] `json:"user_id,required"` + FlowID param.Field[string] `json:"flow_id" api:"required"` + UserID param.Field[string] `json:"user_id" api:"required"` } func (r ConfirmUserRequestParam) MarshalJSON() (data []byte, err error) { @@ -104,7 +104,7 @@ func (r ConfirmUserRequestParam) MarshalJSON() (data []byte, err error) { } type ConfirmUserResponse struct { - AuthID string `json:"auth_id,required"` + AuthID string `json:"auth_id" api:"required"` NextUri string `json:"next_uri"` JSON confirmUserResponseJSON `json:"-"` } @@ -127,7 +127,7 @@ func (r confirmUserResponseJSON) RawJSON() string { } type AuthAuthorizeParams struct { - AuthRequest AuthRequestParam `json:"auth_request,required"` + AuthRequest AuthRequestParam `json:"auth_request" api:"required"` } func (r AuthAuthorizeParams) MarshalJSON() (data []byte, err error) { @@ -135,7 +135,7 @@ func (r AuthAuthorizeParams) MarshalJSON() (data []byte, err error) { } type AuthConfirmUserParams struct { - ConfirmUserRequest ConfirmUserRequestParam `json:"confirm_user_request,required"` + ConfirmUserRequest ConfirmUserRequestParam `json:"confirm_user_request" api:"required"` } func (r AuthConfirmUserParams) MarshalJSON() (data []byte, err error) { @@ -144,7 +144,7 @@ func (r AuthConfirmUserParams) MarshalJSON() (data []byte, err error) { type AuthStatusParams struct { // Authorization ID - ID param.Field[string] `query:"id,required"` + ID param.Field[string] `query:"id" api:"required"` // Timeout in seconds (max 59) Wait param.Field[int64] `query:"wait"` } diff --git a/chat.go b/chat.go index 7d0b372..fba04b8 100644 --- a/chat.go +++ b/chat.go @@ -32,9 +32,9 @@ func NewChatService(opts ...option.RequestOption) (r *ChatService) { type ChatMessage struct { // The content of the message. - Content string `json:"content,required"` + Content string `json:"content" api:"required"` // The role of the author of this message. One of system, user, tool, or assistant. - Role string `json:"role,required"` + Role string `json:"role" api:"required"` // tool Name Name string `json:"name"` // tool_call_id @@ -127,9 +127,9 @@ func (r ChatMessageToolCallsType) IsKnown() bool { type ChatMessageParam struct { // The content of the message. - Content param.Field[string] `json:"content,required"` + Content param.Field[string] `json:"content" api:"required"` // The role of the author of this message. One of system, user, tool, or assistant. - Role param.Field[string] `json:"role,required"` + Role param.Field[string] `json:"role" api:"required"` // tool Name Name param.Field[string] `json:"name"` // tool_call_id diff --git a/chatcompletion.go b/chatcompletion.go index f619f7b..9b4e4cb 100644 --- a/chatcompletion.go +++ b/chatcompletion.go @@ -40,7 +40,7 @@ func (r *ChatCompletionService) New(ctx context.Context, body ChatCompletionNewP } type ChatCompletionNewParams struct { - ChatRequest ChatRequestParam `json:"chat_request,required"` + ChatRequest ChatRequestParam `json:"chat_request" api:"required"` } func (r ChatCompletionNewParams) MarshalJSON() (data []byte, err error) { diff --git a/health.go b/health.go index 2007a09..f989fa5 100644 --- a/health.go +++ b/health.go @@ -40,13 +40,16 @@ func (r *HealthService) Check(ctx context.Context, opts ...option.RequestOption) } type HealthSchema struct { - Healthy bool `json:"healthy"` - JSON healthSchemaJSON `json:"-"` + Healthy bool `json:"healthy"` + // Optional: explains why unhealthy + Reason string `json:"reason"` + JSON healthSchemaJSON `json:"-"` } // healthSchemaJSON contains the JSON metadata for the struct [HealthSchema] type healthSchemaJSON struct { Healthy apijson.Field + Reason apijson.Field raw string ExtraFields map[string]apijson.Field } diff --git a/internal/apiform/form_test.go b/internal/apiform/form_test.go index 39d1460..5ef4421 100644 --- a/internal/apiform/form_test.go +++ b/internal/apiform/form_test.go @@ -39,18 +39,18 @@ type DateTime struct { type AdditionalProperties struct { A bool `form:"a"` - Extras map[string]interface{} `form:"-,extras"` + Extras map[string]interface{} `form:"-" api:"extrafields"` } type TypedAdditionalProperties struct { A bool `form:"a"` - Extras map[string]int `form:"-,extras"` + Extras map[string]int `form:"-" api:"extrafields"` } type EmbeddedStructs struct { AdditionalProperties A *int `form:"number2"` - Extras map[string]interface{} `form:"-,extras"` + Extras map[string]interface{} `form:"-" api:"extrafields"` } type Recursive struct { diff --git a/internal/apiform/tag.go b/internal/apiform/tag.go index b22e054..dea631b 100644 --- a/internal/apiform/tag.go +++ b/internal/apiform/tag.go @@ -5,6 +5,7 @@ import ( "strings" ) +const apiStructTag = "api" const jsonStructTag = "json" const formStructTag = "form" const formatStructTag = "format" @@ -39,9 +40,27 @@ func parseFormStructTag(field reflect.StructField) (tag parsedStructTag, ok bool tag.metadata = true } } + + parseApiStructTag(field, &tag) return } +func parseApiStructTag(field reflect.StructField, tag *parsedStructTag) { + raw, ok := field.Tag.Lookup(apiStructTag) + if !ok { + return + } + parts := strings.Split(raw, ",") + for _, part := range parts { + switch part { + case "extrafields": + tag.extras = true + case "required": + tag.required = true + } + } +} + func parseFormatStructTag(field reflect.StructField) (format string, ok bool) { format, ok = field.Tag.Lookup(formatStructTag) return diff --git a/internal/apijson/json_test.go b/internal/apijson/json_test.go index d4c6283..474e418 100644 --- a/internal/apijson/json_test.go +++ b/internal/apijson/json_test.go @@ -40,12 +40,12 @@ type DateTime struct { type AdditionalProperties struct { A bool `json:"a"` - ExtraFields map[string]interface{} `json:"-,extras"` + ExtraFields map[string]interface{} `json:"-" api:"extrafields"` } type TypedAdditionalProperties struct { A bool `json:"a"` - ExtraFields map[string]int `json:"-,extras"` + ExtraFields map[string]int `json:"-" api:"extrafields"` } type EmbeddedStruct struct { @@ -65,7 +65,7 @@ type EmbeddedStructJSON struct { type EmbeddedStructs struct { EmbeddedStruct A *int `json:"a"` - ExtraFields map[string]interface{} `json:"-,extras"` + ExtraFields map[string]interface{} `json:"-" api:"extrafields"` JSON EmbeddedStructsJSON } @@ -86,7 +86,7 @@ type JSONFieldStruct struct { B int64 `json:"b"` C string `json:"c"` D string `json:"d"` - ExtraFields map[string]int64 `json:"-,extras"` + ExtraFields map[string]int64 `json:"-" api:"extrafields"` JSON JSONFieldStructJSON `json:"-,metadata"` } diff --git a/internal/apijson/tag.go b/internal/apijson/tag.go index 812fb3c..49731b8 100644 --- a/internal/apijson/tag.go +++ b/internal/apijson/tag.go @@ -5,6 +5,7 @@ import ( "strings" ) +const apiStructTag = "api" const jsonStructTag = "json" const formatStructTag = "format" @@ -38,9 +39,28 @@ func parseJSONStructTag(field reflect.StructField) (tag parsedStructTag, ok bool tag.inline = true } } + + // the `api` struct tag is only used alongside `json` for custom behaviour + parseApiStructTag(field, &tag) return } +func parseApiStructTag(field reflect.StructField, tag *parsedStructTag) { + raw, ok := field.Tag.Lookup(apiStructTag) + if !ok { + return + } + parts := strings.Split(raw, ",") + for _, part := range parts { + switch part { + case "extrafields": + tag.extras = true + case "required": + tag.required = true + } + } +} + func parseFormatStructTag(field reflect.StructField) (format string, ok bool) { format, ok = field.Tag.Lookup(formatStructTag) return diff --git a/internal/requestconfig/requestconfig.go b/internal/requestconfig/requestconfig.go index 4bccfaf..b24ab87 100644 --- a/internal/requestconfig/requestconfig.go +++ b/internal/requestconfig/requestconfig.go @@ -470,7 +470,11 @@ func (cfg *RequestConfig) Execute() (err error) { res.Body.Close() } - time.Sleep(retryDelay(res, retryCount)) + select { + case <-ctx.Done(): + return ctx.Err() + case <-time.After(retryDelay(res, retryCount)): + } } // Save *http.Response if it is requested to, even if there was an error making the request. This is diff --git a/internal/testutil/testutil.go b/internal/testutil/testutil.go index 826d266..31103e9 100644 --- a/internal/testutil/testutil.go +++ b/internal/testutil/testutil.go @@ -16,10 +16,10 @@ func CheckTestServer(t *testing.T, url string) bool { t.Fatalf("strconv.ParseBool(os.LookupEnv(%s)) failed: %s", SKIP_MOCK_TESTS, err) } if skip { - t.Skip("The test will not run without a mock Prism server running against your OpenAPI spec") + t.Skip("The test will not run without a mock server running against your OpenAPI spec") return false } - t.Errorf("The test will not run without a mock Prism server running against your OpenAPI spec. You can set the environment variable %s to true to skip running any tests that require the mock server", SKIP_MOCK_TESTS) + t.Errorf("The test will not run without a mock server running against your OpenAPI spec. You can set the environment variable %s to true to skip running any tests that require the mock server", SKIP_MOCK_TESTS) return false } } diff --git a/internal/version.go b/internal/version.go index 64dcebb..81ac6eb 100644 --- a/internal/version.go +++ b/internal/version.go @@ -2,4 +2,4 @@ package internal -const PackageVersion = "0.1.0-alpha.8" // x-release-please-version +const PackageVersion = "0.1.0-alpha.9" // x-release-please-version diff --git a/packages/pagination/pagination.go b/packages/pagination/pagination.go index 930d57a..e3e3e02 100644 --- a/packages/pagination/pagination.go +++ b/packages/pagination/pagination.go @@ -46,7 +46,9 @@ func (r *OffsetPage[T]) GetNextPage() (res *OffsetPage[T], err error) { } cfg := r.cfg.Clone(r.cfg.Context) - next := r.Offset + offset := r.Offset + length := int64(len(r.Items)) + next := offset + length if next < r.TotalCount && next != 0 { err = cfg.Apply(option.WithQuery("offset", strconv.FormatInt(next, 10))) diff --git a/paginationauto_test.go b/paginationauto_test.go new file mode 100644 index 0000000..8ff5898 --- /dev/null +++ b/paginationauto_test.go @@ -0,0 +1,36 @@ +// File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. + +package arcadego_test + +import ( + "context" + "os" + "testing" + + "github.com/ArcadeAI/arcade-go" + "github.com/ArcadeAI/arcade-go/internal/testutil" + "github.com/ArcadeAI/arcade-go/option" +) + +func TestAutoPagination(t *testing.T) { + baseURL := "http://localhost:4010" + if envURL, ok := os.LookupEnv("TEST_API_BASE_URL"); ok { + baseURL = envURL + } + if !testutil.CheckTestServer(t, baseURL) { + return + } + client := arcadego.NewClient( + option.WithBaseURL(baseURL), + option.WithAPIKey("My API Key"), + ) + iter := client.Admin.UserConnections.ListAutoPaging(context.TODO(), arcadego.AdminUserConnectionListParams{}) + // The mock server isn't going to give us real pagination + for i := 0; i < 3 && iter.Next(); i++ { + userConnection := iter.Current() + t.Logf("%+v\n", userConnection.ID) + } + if err := iter.Err(); err != nil { + t.Fatalf("err should be nil: %s", err.Error()) + } +} diff --git a/paginationmanual_test.go b/paginationmanual_test.go new file mode 100644 index 0000000..6666593 --- /dev/null +++ b/paginationmanual_test.go @@ -0,0 +1,44 @@ +// File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. + +package arcadego_test + +import ( + "context" + "os" + "testing" + + "github.com/ArcadeAI/arcade-go" + "github.com/ArcadeAI/arcade-go/internal/testutil" + "github.com/ArcadeAI/arcade-go/option" +) + +func TestManualPagination(t *testing.T) { + baseURL := "http://localhost:4010" + if envURL, ok := os.LookupEnv("TEST_API_BASE_URL"); ok { + baseURL = envURL + } + if !testutil.CheckTestServer(t, baseURL) { + return + } + client := arcadego.NewClient( + option.WithBaseURL(baseURL), + option.WithAPIKey("My API Key"), + ) + page, err := client.Admin.UserConnections.List(context.TODO(), arcadego.AdminUserConnectionListParams{}) + if err != nil { + t.Fatalf("err should be nil: %s", err.Error()) + } + for _, userConnection := range page.Items { + t.Logf("%+v\n", userConnection.ID) + } + // The mock server isn't going to give us real pagination + page, err = page.GetNextPage() + if err != nil { + t.Fatalf("err should be nil: %s", err.Error()) + } + if page != nil { + for _, userConnection := range page.Items { + t.Logf("%+v\n", userConnection.ID) + } + } +} diff --git a/scripts/utils/upload-artifact.sh b/scripts/utils/upload-artifact.sh new file mode 100755 index 0000000..d5f0226 --- /dev/null +++ b/scripts/utils/upload-artifact.sh @@ -0,0 +1,50 @@ +#!/usr/bin/env bash +set -exuo pipefail + +DIST_DIR="dist" +FILENAME="source.zip" + +mapfile -d '' files < <( + find . -type f \ + \( -name '*.go' -o -name 'go.mod' -o -name 'go.sum' \) \ + ! -path "./${DIST_DIR}/*" \ + -print0 +) + +if [[ ${#files[@]} -eq 0 ]]; then + echo -e "\033[31mNo Go source files found for packaging.\033[0m" + exit 1 +fi + +mkdir -p "$DIST_DIR" +rm -f "${DIST_DIR}/${FILENAME}" + +relative_files=() +for file in "${files[@]}"; do + relative_files+=("${file#./}") +done + +zip "${DIST_DIR}/${FILENAME}" "${relative_files[@]}" + +RESPONSE=$(curl -X POST "$URL?filename=$FILENAME" \ + -H "Authorization: Bearer $AUTH" \ + -H "Content-Type: application/json") + +SIGNED_URL=$(echo "$RESPONSE" | jq -r '.url') + +if [[ "$SIGNED_URL" == "null" ]]; then + echo -e "\033[31mFailed to get signed URL.\033[0m" + exit 1 +fi + +UPLOAD_RESPONSE=$(curl -v -X PUT \ + -H "Content-Type: application/zip" \ + --data-binary "@${DIST_DIR}/${FILENAME}" "$SIGNED_URL" 2>&1) + +if echo "$UPLOAD_RESPONSE" | grep -q "HTTP/[0-9.]* 200"; then + echo -e "\033[32mUploaded build to Stainless storage.\033[0m" + echo -e "\033[32mInstallation: Download and unzip: 'https://pkg.stainless.com/s/arcade-engine-go/$SHA'. Run 'go mod edit -replace github.com/ArcadeAI/arcade-go=/path/to/unzipped_directory'.\033[0m" +else + echo -e "\033[31mFailed to upload artifact.\033[0m" + exit 1 +fi diff --git a/tool.go b/tool.go index 4efed6c..af2b30f 100644 --- a/tool.go +++ b/tool.go @@ -96,7 +96,7 @@ func (r *ToolService) Get(ctx context.Context, name string, query ToolGetParams, } type AuthorizeToolRequestParam struct { - ToolName param.Field[string] `json:"tool_name,required"` + ToolName param.Field[string] `json:"tool_name" api:"required"` // Optional: if provided, the user will be redirected to this URI after // authorization NextUri param.Field[string] `json:"next_uri"` @@ -111,7 +111,7 @@ func (r AuthorizeToolRequestParam) MarshalJSON() (data []byte, err error) { } type ExecuteToolRequestParam struct { - ToolName param.Field[string] `json:"tool_name,required"` + ToolName param.Field[string] `json:"tool_name" api:"required"` // Whether to include the error stacktrace in the response. If not provided, the // error stacktrace is not included. IncludeErrorStacktrace param.Field[bool] `json:"include_error_stacktrace"` @@ -197,9 +197,9 @@ func (r executeToolResponseOutputJSON) RawJSON() string { } type ExecuteToolResponseOutputError struct { - CanRetry bool `json:"can_retry,required"` - Kind ExecuteToolResponseOutputErrorKind `json:"kind,required"` - Message string `json:"message,required"` + CanRetry bool `json:"can_retry" api:"required"` + Kind ExecuteToolResponseOutputErrorKind `json:"kind" api:"required"` + Message string `json:"message" api:"required"` AdditionalPromptContent string `json:"additional_prompt_content"` DeveloperMessage string `json:"developer_message"` Extra map[string]interface{} `json:"extra"` @@ -246,6 +246,8 @@ const ( ExecuteToolResponseOutputErrorKindToolRuntimeRetry ExecuteToolResponseOutputErrorKind = "TOOL_RUNTIME_RETRY" ExecuteToolResponseOutputErrorKindToolRuntimeContextRequired ExecuteToolResponseOutputErrorKind = "TOOL_RUNTIME_CONTEXT_REQUIRED" ExecuteToolResponseOutputErrorKindToolRuntimeFatal ExecuteToolResponseOutputErrorKind = "TOOL_RUNTIME_FATAL" + ExecuteToolResponseOutputErrorKindContextCheckFailed ExecuteToolResponseOutputErrorKind = "CONTEXT_CHECK_FAILED" + ExecuteToolResponseOutputErrorKindContextDenied ExecuteToolResponseOutputErrorKind = "CONTEXT_DENIED" ExecuteToolResponseOutputErrorKindUpstreamRuntimeBadRequest ExecuteToolResponseOutputErrorKind = "UPSTREAM_RUNTIME_BAD_REQUEST" ExecuteToolResponseOutputErrorKindUpstreamRuntimeAuthError ExecuteToolResponseOutputErrorKind = "UPSTREAM_RUNTIME_AUTH_ERROR" ExecuteToolResponseOutputErrorKindUpstreamRuntimeNotFound ExecuteToolResponseOutputErrorKind = "UPSTREAM_RUNTIME_NOT_FOUND" @@ -258,15 +260,15 @@ const ( func (r ExecuteToolResponseOutputErrorKind) IsKnown() bool { switch r { - case ExecuteToolResponseOutputErrorKindToolkitLoadFailed, ExecuteToolResponseOutputErrorKindToolDefinitionBadDefinition, ExecuteToolResponseOutputErrorKindToolDefinitionBadInputSchema, ExecuteToolResponseOutputErrorKindToolDefinitionBadOutputSchema, ExecuteToolResponseOutputErrorKindToolRequirementsNotMet, ExecuteToolResponseOutputErrorKindToolRuntimeBadInputValue, ExecuteToolResponseOutputErrorKindToolRuntimeBadOutputValue, ExecuteToolResponseOutputErrorKindToolRuntimeRetry, ExecuteToolResponseOutputErrorKindToolRuntimeContextRequired, ExecuteToolResponseOutputErrorKindToolRuntimeFatal, ExecuteToolResponseOutputErrorKindUpstreamRuntimeBadRequest, ExecuteToolResponseOutputErrorKindUpstreamRuntimeAuthError, ExecuteToolResponseOutputErrorKindUpstreamRuntimeNotFound, ExecuteToolResponseOutputErrorKindUpstreamRuntimeValidationError, ExecuteToolResponseOutputErrorKindUpstreamRuntimeRateLimit, ExecuteToolResponseOutputErrorKindUpstreamRuntimeServerError, ExecuteToolResponseOutputErrorKindUpstreamRuntimeUnmapped, ExecuteToolResponseOutputErrorKindUnknown: + case ExecuteToolResponseOutputErrorKindToolkitLoadFailed, ExecuteToolResponseOutputErrorKindToolDefinitionBadDefinition, ExecuteToolResponseOutputErrorKindToolDefinitionBadInputSchema, ExecuteToolResponseOutputErrorKindToolDefinitionBadOutputSchema, ExecuteToolResponseOutputErrorKindToolRequirementsNotMet, ExecuteToolResponseOutputErrorKindToolRuntimeBadInputValue, ExecuteToolResponseOutputErrorKindToolRuntimeBadOutputValue, ExecuteToolResponseOutputErrorKindToolRuntimeRetry, ExecuteToolResponseOutputErrorKindToolRuntimeContextRequired, ExecuteToolResponseOutputErrorKindToolRuntimeFatal, ExecuteToolResponseOutputErrorKindContextCheckFailed, ExecuteToolResponseOutputErrorKindContextDenied, ExecuteToolResponseOutputErrorKindUpstreamRuntimeBadRequest, ExecuteToolResponseOutputErrorKindUpstreamRuntimeAuthError, ExecuteToolResponseOutputErrorKindUpstreamRuntimeNotFound, ExecuteToolResponseOutputErrorKindUpstreamRuntimeValidationError, ExecuteToolResponseOutputErrorKindUpstreamRuntimeRateLimit, ExecuteToolResponseOutputErrorKindUpstreamRuntimeServerError, ExecuteToolResponseOutputErrorKindUpstreamRuntimeUnmapped, ExecuteToolResponseOutputErrorKindUnknown: return true } return false } type ExecuteToolResponseOutputLog struct { - Level string `json:"level,required"` - Message string `json:"message,required"` + Level string `json:"level" api:"required"` + Message string `json:"message" api:"required"` Subtype string `json:"subtype"` JSON executeToolResponseOutputLogJSON `json:"-"` } @@ -290,13 +292,14 @@ func (r executeToolResponseOutputLogJSON) RawJSON() string { } type ToolDefinition struct { - FullyQualifiedName string `json:"fully_qualified_name,required"` - Input ToolDefinitionInput `json:"input,required"` - Name string `json:"name,required"` - QualifiedName string `json:"qualified_name,required"` - Toolkit ToolDefinitionToolkit `json:"toolkit,required"` + FullyQualifiedName string `json:"fully_qualified_name" api:"required"` + Input ToolDefinitionInput `json:"input" api:"required"` + Name string `json:"name" api:"required"` + QualifiedName string `json:"qualified_name" api:"required"` + Toolkit ToolDefinitionToolkit `json:"toolkit" api:"required"` Description string `json:"description"` FormattedSchema map[string]interface{} `json:"formatted_schema"` + Metadata ToolDefinitionMetadata `json:"metadata"` Output ToolDefinitionOutput `json:"output"` Requirements ToolDefinitionRequirements `json:"requirements"` JSON toolDefinitionJSON `json:"-"` @@ -311,6 +314,7 @@ type toolDefinitionJSON struct { Toolkit apijson.Field Description apijson.Field FormattedSchema apijson.Field + Metadata apijson.Field Output apijson.Field Requirements apijson.Field raw string @@ -347,8 +351,8 @@ func (r toolDefinitionInputJSON) RawJSON() string { } type ToolDefinitionInputParameter struct { - Name string `json:"name,required"` - ValueSchema ValueSchema `json:"value_schema,required"` + Name string `json:"name" api:"required"` + ValueSchema ValueSchema `json:"value_schema" api:"required"` Description string `json:"description"` Inferrable bool `json:"inferrable"` Required bool `json:"required"` @@ -376,7 +380,7 @@ func (r toolDefinitionInputParameterJSON) RawJSON() string { } type ToolDefinitionToolkit struct { - Name string `json:"name,required"` + Name string `json:"name" api:"required"` Description string `json:"description"` Version string `json:"version"` JSON toolDefinitionToolkitJSON `json:"-"` @@ -400,6 +404,81 @@ func (r toolDefinitionToolkitJSON) RawJSON() string { return r.raw } +type ToolDefinitionMetadata struct { + Behavior ToolDefinitionMetadataBehavior `json:"behavior"` + Classification ToolDefinitionMetadataClassification `json:"classification"` + Extras map[string]interface{} `json:"extras"` + JSON toolDefinitionMetadataJSON `json:"-"` +} + +// toolDefinitionMetadataJSON contains the JSON metadata for the struct +// [ToolDefinitionMetadata] +type toolDefinitionMetadataJSON struct { + Behavior apijson.Field + Classification apijson.Field + Extras apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *ToolDefinitionMetadata) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +func (r toolDefinitionMetadataJSON) RawJSON() string { + return r.raw +} + +type ToolDefinitionMetadataBehavior struct { + Destructive bool `json:"destructive"` + Idempotent bool `json:"idempotent"` + OpenWorld bool `json:"open_world"` + Operations []string `json:"operations"` + ReadOnly bool `json:"read_only"` + JSON toolDefinitionMetadataBehaviorJSON `json:"-"` +} + +// toolDefinitionMetadataBehaviorJSON contains the JSON metadata for the struct +// [ToolDefinitionMetadataBehavior] +type toolDefinitionMetadataBehaviorJSON struct { + Destructive apijson.Field + Idempotent apijson.Field + OpenWorld apijson.Field + Operations apijson.Field + ReadOnly apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *ToolDefinitionMetadataBehavior) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +func (r toolDefinitionMetadataBehaviorJSON) RawJSON() string { + return r.raw +} + +type ToolDefinitionMetadataClassification struct { + ServiceDomains []string `json:"service_domains"` + JSON toolDefinitionMetadataClassificationJSON `json:"-"` +} + +// toolDefinitionMetadataClassificationJSON contains the JSON metadata for the +// struct [ToolDefinitionMetadataClassification] +type toolDefinitionMetadataClassificationJSON struct { + ServiceDomains apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *ToolDefinitionMetadataClassification) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +func (r toolDefinitionMetadataClassificationJSON) RawJSON() string { + return r.raw +} + type ToolDefinitionOutput struct { AvailableModes []string `json:"available_modes"` Description string `json:"description"` @@ -537,7 +616,7 @@ func (r ToolDefinitionRequirementsAuthorizationTokenStatus) IsKnown() bool { } type ToolDefinitionRequirementsSecret struct { - Key string `json:"key,required"` + Key string `json:"key" api:"required"` Met bool `json:"met"` StatusReason string `json:"status_reason"` JSON toolDefinitionRequirementsSecretJSON `json:"-"` @@ -662,9 +741,9 @@ func (r toolExecutionAttemptOutputJSON) RawJSON() string { } type ToolExecutionAttemptOutputError struct { - CanRetry bool `json:"can_retry,required"` - Kind ToolExecutionAttemptOutputErrorKind `json:"kind,required"` - Message string `json:"message,required"` + CanRetry bool `json:"can_retry" api:"required"` + Kind ToolExecutionAttemptOutputErrorKind `json:"kind" api:"required"` + Message string `json:"message" api:"required"` AdditionalPromptContent string `json:"additional_prompt_content"` DeveloperMessage string `json:"developer_message"` Extra map[string]interface{} `json:"extra"` @@ -711,6 +790,8 @@ const ( ToolExecutionAttemptOutputErrorKindToolRuntimeRetry ToolExecutionAttemptOutputErrorKind = "TOOL_RUNTIME_RETRY" ToolExecutionAttemptOutputErrorKindToolRuntimeContextRequired ToolExecutionAttemptOutputErrorKind = "TOOL_RUNTIME_CONTEXT_REQUIRED" ToolExecutionAttemptOutputErrorKindToolRuntimeFatal ToolExecutionAttemptOutputErrorKind = "TOOL_RUNTIME_FATAL" + ToolExecutionAttemptOutputErrorKindContextCheckFailed ToolExecutionAttemptOutputErrorKind = "CONTEXT_CHECK_FAILED" + ToolExecutionAttemptOutputErrorKindContextDenied ToolExecutionAttemptOutputErrorKind = "CONTEXT_DENIED" ToolExecutionAttemptOutputErrorKindUpstreamRuntimeBadRequest ToolExecutionAttemptOutputErrorKind = "UPSTREAM_RUNTIME_BAD_REQUEST" ToolExecutionAttemptOutputErrorKindUpstreamRuntimeAuthError ToolExecutionAttemptOutputErrorKind = "UPSTREAM_RUNTIME_AUTH_ERROR" ToolExecutionAttemptOutputErrorKindUpstreamRuntimeNotFound ToolExecutionAttemptOutputErrorKind = "UPSTREAM_RUNTIME_NOT_FOUND" @@ -723,15 +804,15 @@ const ( func (r ToolExecutionAttemptOutputErrorKind) IsKnown() bool { switch r { - case ToolExecutionAttemptOutputErrorKindToolkitLoadFailed, ToolExecutionAttemptOutputErrorKindToolDefinitionBadDefinition, ToolExecutionAttemptOutputErrorKindToolDefinitionBadInputSchema, ToolExecutionAttemptOutputErrorKindToolDefinitionBadOutputSchema, ToolExecutionAttemptOutputErrorKindToolRequirementsNotMet, ToolExecutionAttemptOutputErrorKindToolRuntimeBadInputValue, ToolExecutionAttemptOutputErrorKindToolRuntimeBadOutputValue, ToolExecutionAttemptOutputErrorKindToolRuntimeRetry, ToolExecutionAttemptOutputErrorKindToolRuntimeContextRequired, ToolExecutionAttemptOutputErrorKindToolRuntimeFatal, ToolExecutionAttemptOutputErrorKindUpstreamRuntimeBadRequest, ToolExecutionAttemptOutputErrorKindUpstreamRuntimeAuthError, ToolExecutionAttemptOutputErrorKindUpstreamRuntimeNotFound, ToolExecutionAttemptOutputErrorKindUpstreamRuntimeValidationError, ToolExecutionAttemptOutputErrorKindUpstreamRuntimeRateLimit, ToolExecutionAttemptOutputErrorKindUpstreamRuntimeServerError, ToolExecutionAttemptOutputErrorKindUpstreamRuntimeUnmapped, ToolExecutionAttemptOutputErrorKindUnknown: + case ToolExecutionAttemptOutputErrorKindToolkitLoadFailed, ToolExecutionAttemptOutputErrorKindToolDefinitionBadDefinition, ToolExecutionAttemptOutputErrorKindToolDefinitionBadInputSchema, ToolExecutionAttemptOutputErrorKindToolDefinitionBadOutputSchema, ToolExecutionAttemptOutputErrorKindToolRequirementsNotMet, ToolExecutionAttemptOutputErrorKindToolRuntimeBadInputValue, ToolExecutionAttemptOutputErrorKindToolRuntimeBadOutputValue, ToolExecutionAttemptOutputErrorKindToolRuntimeRetry, ToolExecutionAttemptOutputErrorKindToolRuntimeContextRequired, ToolExecutionAttemptOutputErrorKindToolRuntimeFatal, ToolExecutionAttemptOutputErrorKindContextCheckFailed, ToolExecutionAttemptOutputErrorKindContextDenied, ToolExecutionAttemptOutputErrorKindUpstreamRuntimeBadRequest, ToolExecutionAttemptOutputErrorKindUpstreamRuntimeAuthError, ToolExecutionAttemptOutputErrorKindUpstreamRuntimeNotFound, ToolExecutionAttemptOutputErrorKindUpstreamRuntimeValidationError, ToolExecutionAttemptOutputErrorKindUpstreamRuntimeRateLimit, ToolExecutionAttemptOutputErrorKindUpstreamRuntimeServerError, ToolExecutionAttemptOutputErrorKindUpstreamRuntimeUnmapped, ToolExecutionAttemptOutputErrorKindUnknown: return true } return false } type ToolExecutionAttemptOutputLog struct { - Level string `json:"level,required"` - Message string `json:"message,required"` + Level string `json:"level" api:"required"` + Message string `json:"message" api:"required"` Subtype string `json:"subtype"` JSON toolExecutionAttemptOutputLogJSON `json:"-"` } @@ -755,7 +836,7 @@ func (r toolExecutionAttemptOutputLogJSON) RawJSON() string { } type ValueSchema struct { - ValType string `json:"val_type,required"` + ValType string `json:"val_type" api:"required"` Enum []string `json:"enum"` InnerValType string `json:"inner_val_type"` JSON valueSchemaJSON `json:"-"` @@ -779,6 +860,8 @@ func (r valueSchemaJSON) RawJSON() string { } type ToolListParams struct { + // Include all versions of each tool + IncludeAllVersions param.Field[bool] `query:"include_all_versions"` // Comma separated tool formats that will be included in the response. IncludeFormat param.Field[[]ToolListParamsIncludeFormat] `query:"include_format"` // Number of items to return (default: 25, max: 100) @@ -816,7 +899,7 @@ func (r ToolListParamsIncludeFormat) IsKnown() bool { } type ToolAuthorizeParams struct { - AuthorizeToolRequest AuthorizeToolRequestParam `json:"authorize_tool_request,required"` + AuthorizeToolRequest AuthorizeToolRequestParam `json:"authorize_tool_request" api:"required"` } func (r ToolAuthorizeParams) MarshalJSON() (data []byte, err error) { @@ -824,7 +907,7 @@ func (r ToolAuthorizeParams) MarshalJSON() (data []byte, err error) { } type ToolExecuteParams struct { - ExecuteToolRequest ExecuteToolRequestParam `json:"execute_tool_request,required"` + ExecuteToolRequest ExecuteToolRequestParam `json:"execute_tool_request" api:"required"` } func (r ToolExecuteParams) MarshalJSON() (data []byte, err error) { diff --git a/tool_test.go b/tool_test.go index 06aa887..ff6111e 100644 --- a/tool_test.go +++ b/tool_test.go @@ -26,11 +26,12 @@ func TestToolListWithOptionalParams(t *testing.T) { option.WithAPIKey("My API Key"), ) _, err := client.Tools.List(context.TODO(), arcadego.ToolListParams{ - IncludeFormat: arcadego.F([]arcadego.ToolListParamsIncludeFormat{arcadego.ToolListParamsIncludeFormatArcade}), - Limit: arcadego.F(int64(0)), - Offset: arcadego.F(int64(0)), - Toolkit: arcadego.F("toolkit"), - UserID: arcadego.F("user_id"), + IncludeAllVersions: arcadego.F(true), + IncludeFormat: arcadego.F([]arcadego.ToolListParamsIncludeFormat{arcadego.ToolListParamsIncludeFormatArcade}), + Limit: arcadego.F(int64(0)), + Offset: arcadego.F(int64(0)), + Toolkit: arcadego.F("toolkit"), + UserID: arcadego.F("user_id"), }) if err != nil { var apierr *arcadego.Error diff --git a/toolformatted.go b/toolformatted.go index d280ee4..7354064 100644 --- a/toolformatted.go +++ b/toolformatted.go @@ -73,13 +73,15 @@ func (r *ToolFormattedService) Get(ctx context.Context, name string, query ToolF return } -type ToolFormattedListResponse = interface{} +type ToolFormattedListResponse map[string]interface{} -type ToolFormattedGetResponse = interface{} +type ToolFormattedGetResponse map[string]interface{} type ToolFormattedListParams struct { // Provider format Format param.Field[string] `query:"format"` + // Include all versions of each tool + IncludeAllVersions param.Field[bool] `query:"include_all_versions"` // Number of items to return (default: 25, max: 100) Limit param.Field[int64] `query:"limit"` // Offset from the start of the list (default: 0) diff --git a/toolformatted_test.go b/toolformatted_test.go index 4b6c16d..d1ff6e5 100644 --- a/toolformatted_test.go +++ b/toolformatted_test.go @@ -26,11 +26,12 @@ func TestToolFormattedListWithOptionalParams(t *testing.T) { option.WithAPIKey("My API Key"), ) _, err := client.Tools.Formatted.List(context.TODO(), arcadego.ToolFormattedListParams{ - Format: arcadego.F("format"), - Limit: arcadego.F(int64(0)), - Offset: arcadego.F(int64(0)), - Toolkit: arcadego.F("toolkit"), - UserID: arcadego.F("user_id"), + Format: arcadego.F("format"), + IncludeAllVersions: arcadego.F(true), + Limit: arcadego.F(int64(0)), + Offset: arcadego.F(int64(0)), + Toolkit: arcadego.F("toolkit"), + UserID: arcadego.F("user_id"), }) if err != nil { var apierr *arcadego.Error diff --git a/worker.go b/worker.go index 9844f93..7b2cd3e 100644 --- a/worker.go +++ b/worker.go @@ -83,7 +83,7 @@ func (r *WorkerService) ListAutoPaging(ctx context.Context, query WorkerListPara // Delete a worker func (r *WorkerService) Delete(ctx context.Context, id string, opts ...option.RequestOption) (err error) { opts = slices.Concat(r.Options, opts) - opts = append([]option.RequestOption{option.WithHeader("Accept", "")}, opts...) + opts = append([]option.RequestOption{option.WithHeader("Accept", "*/*")}, opts...) if id == "" { err = errors.New("missing required id parameter") return @@ -145,7 +145,7 @@ func (r *WorkerService) ToolsAutoPaging(ctx context.Context, id string, query Wo } type CreateWorkerRequestParam struct { - ID param.Field[string] `json:"id,required"` + ID param.Field[string] `json:"id" api:"required"` Enabled param.Field[bool] `json:"enabled"` HTTP param.Field[CreateWorkerRequestHTTPParam] `json:"http"` Mcp param.Field[CreateWorkerRequestMcpParam] `json:"mcp"` @@ -157,10 +157,10 @@ func (r CreateWorkerRequestParam) MarshalJSON() (data []byte, err error) { } type CreateWorkerRequestHTTPParam struct { - Retry param.Field[int64] `json:"retry,required"` - Secret param.Field[string] `json:"secret,required"` - Timeout param.Field[int64] `json:"timeout,required"` - Uri param.Field[string] `json:"uri,required"` + Retry param.Field[int64] `json:"retry" api:"required"` + Secret param.Field[string] `json:"secret" api:"required"` + Timeout param.Field[int64] `json:"timeout" api:"required"` + Uri param.Field[string] `json:"uri" api:"required"` } func (r CreateWorkerRequestHTTPParam) MarshalJSON() (data []byte, err error) { @@ -168,9 +168,9 @@ func (r CreateWorkerRequestHTTPParam) MarshalJSON() (data []byte, err error) { } type CreateWorkerRequestMcpParam struct { - Retry param.Field[int64] `json:"retry,required"` - Timeout param.Field[int64] `json:"timeout,required"` - Uri param.Field[string] `json:"uri,required"` + Retry param.Field[int64] `json:"retry" api:"required"` + Timeout param.Field[int64] `json:"timeout" api:"required"` + Uri param.Field[string] `json:"uri" api:"required"` Headers param.Field[map[string]string] `json:"headers"` Oauth2 param.Field[CreateWorkerRequestMcpOauth2Param] `json:"oauth2"` Secrets param.Field[map[string]string] `json:"secrets"` @@ -367,7 +367,6 @@ type WorkerResponseHTTPSecret struct { Binding WorkerResponseHTTPSecretBinding `json:"binding"` Editable bool `json:"editable"` Exists bool `json:"exists"` - Hint string `json:"hint"` Value string `json:"value"` JSON workerResponseHTTPSecretJSON `json:"-"` } @@ -378,7 +377,6 @@ type workerResponseHTTPSecretJSON struct { Binding apijson.Field Editable apijson.Field Exists apijson.Field - Hint apijson.Field Value apijson.Field raw string ExtraFields map[string]apijson.Field @@ -444,7 +442,9 @@ type WorkerResponseMcpOauth2 struct { AuthorizationURL string `json:"authorization_url"` ClientID string `json:"client_id"` ClientSecret WorkerResponseMcpOauth2ClientSecret `json:"client_secret"` + ExternalID string `json:"external_id"` RedirectUri string `json:"redirect_uri"` + SupportedScopes []string `json:"supported_scopes"` JSON workerResponseMcpOauth2JSON `json:"-"` } @@ -454,7 +454,9 @@ type workerResponseMcpOauth2JSON struct { AuthorizationURL apijson.Field ClientID apijson.Field ClientSecret apijson.Field + ExternalID apijson.Field RedirectUri apijson.Field + SupportedScopes apijson.Field raw string ExtraFields map[string]apijson.Field } @@ -471,7 +473,6 @@ type WorkerResponseMcpOauth2ClientSecret struct { Binding WorkerResponseMcpOauth2ClientSecretBinding `json:"binding"` Editable bool `json:"editable"` Exists bool `json:"exists"` - Hint string `json:"hint"` Value string `json:"value"` JSON workerResponseMcpOauth2ClientSecretJSON `json:"-"` } @@ -482,7 +483,6 @@ type workerResponseMcpOauth2ClientSecretJSON struct { Binding apijson.Field Editable apijson.Field Exists apijson.Field - Hint apijson.Field Value apijson.Field raw string ExtraFields map[string]apijson.Field @@ -517,7 +517,6 @@ type WorkerResponseMcpSecret struct { Binding WorkerResponseMcpSecretsBinding `json:"binding"` Editable bool `json:"editable"` Exists bool `json:"exists"` - Hint string `json:"hint"` Value string `json:"value"` JSON workerResponseMcpSecretJSON `json:"-"` } @@ -528,7 +527,6 @@ type workerResponseMcpSecretJSON struct { Binding apijson.Field Editable apijson.Field Exists apijson.Field - Hint apijson.Field Value apijson.Field raw string ExtraFields map[string]apijson.Field @@ -643,7 +641,7 @@ func (r WorkerResponseType) IsKnown() bool { } type WorkerNewParams struct { - CreateWorkerRequest CreateWorkerRequestParam `json:"create_worker_request,required"` + CreateWorkerRequest CreateWorkerRequestParam `json:"create_worker_request" api:"required"` } func (r WorkerNewParams) MarshalJSON() (data []byte, err error) { @@ -651,7 +649,7 @@ func (r WorkerNewParams) MarshalJSON() (data []byte, err error) { } type WorkerUpdateParams struct { - UpdateWorkerRequest UpdateWorkerRequestParam `json:"update_worker_request,required"` + UpdateWorkerRequest UpdateWorkerRequestParam `json:"update_worker_request" api:"required"` } func (r WorkerUpdateParams) MarshalJSON() (data []byte, err error) {