From 271801cd8a77ed8a9e995c88777dd8b893084a12 Mon Sep 17 00:00:00 2001 From: speakeasybot Date: Tue, 24 Dec 2024 00:31:01 +0000 Subject: [PATCH] ci: regenerated with OpenAPI Doc , Speakeasy CLI 1.460.2 --- .speakeasy/gen.lock | 72 +++++--- .speakeasy/gen.yaml | 2 +- .speakeasy/workflow.lock | 14 +- README.md | 23 ++- RELEASES.md | 12 +- USAGE.md | 3 +- apis.go | 55 ++++++- .../components/v1keysverifykeyrequest.md | 15 +- .../models/operations/listkeysresponsebody.md | 2 +- .../ratelimitsetoverrideresponse.md | 9 - ...questbody.md => setoverriderequestbody.md} | 2 +- docs/models/operations/setoverrideresponse.md | 9 + ...onsebody.md => setoverrideresponsebody.md} | 2 +- docs/sdks/apis/README.md | 25 +-- docs/sdks/identities/README.md | 25 +-- docs/sdks/keys/README.md | 70 ++++---- docs/sdks/liveness/README.md | 5 +- docs/sdks/migrations/README.md | 10 +- docs/sdks/permissions/README.md | 40 +++-- docs/sdks/ratelimit/README.md | 33 ++-- docs/sdks/ratelimits/README.md | 10 +- identities.go | 55 ++++++- internal/utils/queryparams.go | 13 +- internal/utils/requestbody.go | 8 +- internal/utils/utils.go | 3 + keys.go | 154 ++++++++++++++++-- liveness.go | 11 +- migrations.go | 22 ++- models/components/permissionquery.go | 6 +- models/components/v1keysverifykeyrequest.go | 14 ++ models/operations/listkeys.go | 2 +- models/operations/options.go | 19 ++- ...ratelimitsetoverride.go => setoverride.go} | 36 ++-- permissions.go | 88 +++++++++- ratelimit.go | 41 ++++- ratelimits.go | 22 ++- unkey.go | 6 +- 37 files changed, 708 insertions(+), 230 deletions(-) delete mode 100644 docs/models/operations/ratelimitsetoverrideresponse.md rename docs/models/operations/{ratelimitsetoverriderequestbody.md => setoverriderequestbody.md} (99%) create mode 100644 docs/models/operations/setoverrideresponse.md rename docs/models/operations/{ratelimitsetoverrideresponsebody.md => setoverrideresponsebody.md} (95%) rename models/operations/{ratelimitsetoverride.go => setoverride.go} (63%) diff --git a/.speakeasy/gen.lock b/.speakeasy/gen.lock index 21b81cf..2d86f08 100755 --- a/.speakeasy/gen.lock +++ b/.speakeasy/gen.lock @@ -1,19 +1,19 @@ lockVersion: 2.0.0 id: 4fc4737a-135f-4840-8e6d-42a2b2a2884b management: - docChecksum: aed0c1332c44cace441ba6222252499a + docChecksum: 5cf3e99269a4980fb916005ba7cdccb5 docVersion: 1.0.0 - speakeasyVersion: 1.453.4 - generationVersion: 2.474.6 - releaseVersion: 0.11.0 - configChecksum: a062b6a46d3010813d5b8551dd3182c1 + speakeasyVersion: 1.460.2 + generationVersion: 2.484.0 + releaseVersion: 0.12.0 + configChecksum: 71353dbefee1832b29202864ab261760 repoURL: https://github.com/unkeyed/unkey-go.git installationURL: https://github.com/unkeyed/unkey-go features: go: additionalDependencies: 0.1.0 constsAndDefaults: 0.1.6 - core: 3.5.17 + core: 3.6.2 defaultEnabledRetries: 0.2.0 deprecations: 2.81.1 envVarSecurityUsage: 0.3.2 @@ -25,7 +25,7 @@ features: ignores: 2.81.1 intellisenseMarkdownSupport: 0.1.0 nullables: 0.1.0 - pagination: 2.82.1 + pagination: 2.82.2 responseFormat: 0.1.2 retries: 2.83.1 sdkHooks: 0.1.0 @@ -65,9 +65,9 @@ generatedFiles: - /models/operations/listoverrides.go - /models/operations/listpermissions.go - /models/operations/listroles.go - - /models/operations/ratelimitsetoverride.go - /models/operations/removepermissions.go - /models/operations/removeroles.go + - /models/operations/setoverride.go - /models/operations/setpermissions.go - /models/operations/setroles.go - /models/operations/updateidentity.go @@ -201,9 +201,6 @@ generatedFiles: - docs/models/operations/permissions.md - docs/models/operations/ratelimit.md - docs/models/operations/ratelimits.md - - docs/models/operations/ratelimitsetoverriderequestbody.md - - docs/models/operations/ratelimitsetoverrideresponse.md - - docs/models/operations/ratelimitsetoverrideresponsebody.md - docs/models/operations/refill.md - docs/models/operations/removepermissionspermissions.md - docs/models/operations/removepermissionsrequestbody.md @@ -218,6 +215,9 @@ generatedFiles: - docs/models/operations/responsebody.md - docs/models/operations/roles.md - docs/models/operations/services.md + - docs/models/operations/setoverriderequestbody.md + - docs/models/operations/setoverrideresponse.md + - docs/models/operations/setoverrideresponsebody.md - docs/models/operations/setpermissionspermissions.md - docs/models/operations/setpermissionsrequestbody.md - docs/models/operations/setpermissionsresponse.md @@ -388,7 +388,8 @@ examples: application/json: {"error": {"code": "TOO_MANY_REQUESTS", "docs": "https://unkey.dev/docs/api-reference/errors/code/TOO_MANY_REQUESTS", "message": "", "requestId": "req_1234"}} "500": application/json: {"error": {"code": "INTERNAL_SERVER_ERROR", "docs": "https://unkey.dev/docs/api-reference/errors/code/INTERNAL_SERVER_ERROR", "message": "", "requestId": "req_1234"}} - "200": {} + "200": + application/json: {} createKey: speakeasy-default-create-key: requestBody: @@ -450,7 +451,8 @@ examples: application/json: {"error": {"code": "TOO_MANY_REQUESTS", "docs": "https://unkey.dev/docs/api-reference/errors/code/TOO_MANY_REQUESTS", "message": "", "requestId": "req_1234"}} "500": application/json: {"error": {"code": "INTERNAL_SERVER_ERROR", "docs": "https://unkey.dev/docs/api-reference/errors/code/INTERNAL_SERVER_ERROR", "message": "", "requestId": "req_1234"}} - "200": {} + "200": + application/json: {} updateRemaining: speakeasy-default-update-remaining: requestBody: @@ -538,7 +540,8 @@ examples: application/json: {"error": {"code": "TOO_MANY_REQUESTS", "docs": "https://unkey.dev/docs/api-reference/errors/code/TOO_MANY_REQUESTS", "message": "", "requestId": "req_1234"}} "500": application/json: {"error": {"code": "INTERNAL_SERVER_ERROR", "docs": "https://unkey.dev/docs/api-reference/errors/code/INTERNAL_SERVER_ERROR", "message": "", "requestId": "req_1234"}} - "200": {} + "200": + application/json: {} setPermissions: speakeasy-default-set-permissions: requestBody: @@ -600,7 +603,8 @@ examples: application/json: {"error": {"code": "TOO_MANY_REQUESTS", "docs": "https://unkey.dev/docs/api-reference/errors/code/TOO_MANY_REQUESTS", "message": "", "requestId": "req_1234"}} "500": application/json: {"error": {"code": "INTERNAL_SERVER_ERROR", "docs": "https://unkey.dev/docs/api-reference/errors/code/INTERNAL_SERVER_ERROR", "message": "", "requestId": "req_1234"}} - "200": {} + "200": + application/json: {} setRoles: speakeasy-default-set-roles: requestBody: @@ -707,7 +711,8 @@ examples: application/json: {"error": {"code": "DELETE_PROTECTED", "docs": "https://unkey.dev/docs/api-reference/errors/code/DELETE_PROTECTED", "message": "", "requestId": "req_1234"}} "500": application/json: {"error": {"code": "INTERNAL_SERVER_ERROR", "docs": "https://unkey.dev/docs/api-reference/errors/code/INTERNAL_SERVER_ERROR", "message": "", "requestId": "req_1234"}} - "200": {} + "200": + application/json: {} deleteKeys: speakeasy-default-delete-keys: requestBody: @@ -790,7 +795,8 @@ examples: application/json: {"error": {"code": "TOO_MANY_REQUESTS", "docs": "https://unkey.dev/docs/api-reference/errors/code/TOO_MANY_REQUESTS", "message": "", "requestId": "req_1234"}} "500": application/json: {"error": {"code": "INTERNAL_SERVER_ERROR", "docs": "https://unkey.dev/docs/api-reference/errors/code/INTERNAL_SERVER_ERROR", "message": "", "requestId": "req_1234"}} - "202": {} + "202": + application/json: {} createPermission: speakeasy-default-create-permission: requestBody: @@ -831,7 +837,8 @@ examples: application/json: {"error": {"code": "TOO_MANY_REQUESTS", "docs": "https://unkey.dev/docs/api-reference/errors/code/TOO_MANY_REQUESTS", "message": "", "requestId": "req_1234"}} "500": application/json: {"error": {"code": "INTERNAL_SERVER_ERROR", "docs": "https://unkey.dev/docs/api-reference/errors/code/INTERNAL_SERVER_ERROR", "message": "", "requestId": "req_1234"}} - "200": {} + "200": + application/json: {} getPermission: speakeasy-default-get-permission: parameters: @@ -913,7 +920,8 @@ examples: application/json: {"error": {"code": "TOO_MANY_REQUESTS", "docs": "https://unkey.dev/docs/api-reference/errors/code/TOO_MANY_REQUESTS", "message": "", "requestId": "req_1234"}} "500": application/json: {"error": {"code": "INTERNAL_SERVER_ERROR", "docs": "https://unkey.dev/docs/api-reference/errors/code/INTERNAL_SERVER_ERROR", "message": "", "requestId": "req_1234"}} - "200": {} + "200": + application/json: {} getRole: speakeasy-default-get-role: parameters: @@ -1061,7 +1069,8 @@ examples: application/json: {"error": {"code": "TOO_MANY_REQUESTS", "docs": "https://unkey.dev/docs/api-reference/errors/code/TOO_MANY_REQUESTS", "message": "", "requestId": "req_1234"}} "500": application/json: {"error": {"code": "INTERNAL_SERVER_ERROR", "docs": "https://unkey.dev/docs/api-reference/errors/code/INTERNAL_SERVER_ERROR", "message": "", "requestId": "req_1234"}} - "200": {} + "200": + application/json: {} whoami: speakeasy-default-whoami: requestBody: @@ -1102,6 +1111,8 @@ examples: application/json: {"error": {"code": "TOO_MANY_REQUESTS", "docs": "https://unkey.dev/docs/api-reference/errors/code/TOO_MANY_REQUESTS", "message": "", "requestId": "req_1234"}} "500": application/json: {"error": {"code": "INTERNAL_SERVER_ERROR", "docs": "https://unkey.dev/docs/api-reference/errors/code/INTERNAL_SERVER_ERROR", "message": "", "requestId": "req_1234"}} + "200": + application/json: {} ratelimit.setOverride: speakeasy-default-ratelimit-set-override: requestBody: @@ -1171,4 +1182,25 @@ examples: application/json: {"error": {"code": "TOO_MANY_REQUESTS", "docs": "https://unkey.dev/docs/api-reference/errors/code/TOO_MANY_REQUESTS", "message": "", "requestId": "req_1234"}} "500": application/json: {"error": {"code": "INTERNAL_SERVER_ERROR", "docs": "https://unkey.dev/docs/api-reference/errors/code/INTERNAL_SERVER_ERROR", "message": "", "requestId": "req_1234"}} + setOverride: + speakeasy-default-set-override: + requestBody: + application/json: {"namespaceId": "rlns_1234", "namespaceName": "email.outbound", "identifier": "user_123", "limit": 10, "duration": 60000} + responses: + "200": + application/json: {"overrideId": "over_123"} + "400": + application/json: {"error": {"code": "BAD_REQUEST", "docs": "https://unkey.dev/docs/api-reference/errors/code/BAD_REQUEST", "message": "", "requestId": "req_1234"}} + "401": + application/json: {"error": {"code": "UNAUTHORIZED", "docs": "https://unkey.dev/docs/api-reference/errors/code/UNAUTHORIZED", "message": "", "requestId": "req_1234"}} + "403": + application/json: {"error": {"code": "FORBIDDEN", "docs": "https://unkey.dev/docs/api-reference/errors/code/FORBIDDEN", "message": "", "requestId": "req_1234"}} + "404": + application/json: {"error": {"code": "NOT_FOUND", "docs": "https://unkey.dev/docs/api-reference/errors/code/NOT_FOUND", "message": "", "requestId": "req_1234"}} + "409": + application/json: {"error": {"code": "CONFLICT", "docs": "https://unkey.dev/docs/api-reference/errors/code/CONFLICT", "message": "", "requestId": "req_1234"}} + "429": + application/json: {"error": {"code": "TOO_MANY_REQUESTS", "docs": "https://unkey.dev/docs/api-reference/errors/code/TOO_MANY_REQUESTS", "message": "", "requestId": "req_1234"}} + "500": + application/json: {"error": {"code": "INTERNAL_SERVER_ERROR", "docs": "https://unkey.dev/docs/api-reference/errors/code/INTERNAL_SERVER_ERROR", "message": "", "requestId": "req_1234"}} generatedTests: {} diff --git a/.speakeasy/gen.yaml b/.speakeasy/gen.yaml index 6c43b6d..72bb43f 100755 --- a/.speakeasy/gen.yaml +++ b/.speakeasy/gen.yaml @@ -13,7 +13,7 @@ generation: oAuth2ClientCredentialsEnabled: true oAuth2PasswordEnabled: false go: - version: 0.11.0 + version: 0.12.0 additionalDependencies: {} allowUnknownFieldsInWeakUnions: false clientServerStatusCodesAsErrors: true diff --git a/.speakeasy/workflow.lock b/.speakeasy/workflow.lock index f702e9f..7ecfed4 100644 --- a/.speakeasy/workflow.lock +++ b/.speakeasy/workflow.lock @@ -1,21 +1,21 @@ -speakeasyVersion: 1.453.4 +speakeasyVersion: 1.460.2 sources: openapi.json: sourceNamespace: openapi-json - sourceRevisionDigest: sha256:805c458054c8cb789ff7b9496895307342a6e9a3cd48183010664f8dc91edf2d - sourceBlobDigest: sha256:7c411023d91510110ee6a90feac26e69e43d0c631fc7644606b9d4aa293dc629 + sourceRevisionDigest: sha256:efd31b857dc482079e573d49ac954a6668bf5a51062198fa555e21952a7763c2 + sourceBlobDigest: sha256:852b1a345f581d958c5f93243f85191000e087b37a281e616619238a754c5b4c tags: - latest - - speakeasy-sdk-regen-1731025759 + - speakeasy-sdk-regen-1733790794 - 1.0.0 targets: go: source: openapi.json sourceNamespace: openapi-json - sourceRevisionDigest: sha256:805c458054c8cb789ff7b9496895307342a6e9a3cd48183010664f8dc91edf2d - sourceBlobDigest: sha256:7c411023d91510110ee6a90feac26e69e43d0c631fc7644606b9d4aa293dc629 + sourceRevisionDigest: sha256:efd31b857dc482079e573d49ac954a6668bf5a51062198fa555e21952a7763c2 + sourceBlobDigest: sha256:852b1a345f581d958c5f93243f85191000e087b37a281e616619238a754c5b4c codeSamplesNamespace: openapi-json-go-code-samples - codeSamplesRevisionDigest: sha256:d87463f60ba7dcd50c93a255a7f50017204d67df2881cb3bbe41b1bb5f2ab7a9 + codeSamplesRevisionDigest: sha256:313f5ed7b6cabfbda33d36d53b7aacc34d1e8390de5c1150a4b41f872bbd1c16 workflow: workflowVersion: 1.0.0 speakeasyVersion: latest diff --git a/README.md b/README.md index 3048709..2d32839 100644 --- a/README.md +++ b/README.md @@ -55,11 +55,12 @@ import ( ) func main() { + ctx := context.Background() + s := unkeygo.New( unkeygo.WithSecurity("UNKEY_ROOT_KEY"), ) - ctx := context.Background() res, err := s.Liveness.V1Liveness(ctx) if err != nil { log.Fatal(err) @@ -133,7 +134,7 @@ func main() { ### [Ratelimit](docs/sdks/ratelimit/README.md) -* [RatelimitSetOverride](docs/sdks/ratelimit/README.md#ratelimitsetoverride) +* [SetOverride](docs/sdks/ratelimit/README.md#setoverride) * [ListOverrides](docs/sdks/ratelimit/README.md#listoverrides) * [GetOverride](docs/sdks/ratelimit/README.md#getoverride) @@ -180,11 +181,12 @@ import ( ) func main() { + ctx := context.Background() + s := unkeygo.New( unkeygo.WithSecurity("UNKEY_ROOT_KEY"), ) - ctx := context.Background() res, err := s.Liveness.V1Liveness(ctx) if err != nil { @@ -257,12 +259,13 @@ import ( ) func main() { + ctx := context.Background() + s := unkeygo.New( unkeygo.WithServerURL("https://api.unkey.dev"), unkeygo.WithSecurity("UNKEY_ROOT_KEY"), ) - ctx := context.Background() res, err := s.Liveness.V1Liveness(ctx) if err != nil { log.Fatal(err) @@ -326,11 +329,12 @@ import ( ) func main() { + ctx := context.Background() + s := unkeygo.New( unkeygo.WithSecurity("UNKEY_ROOT_KEY"), ) - ctx := context.Background() res, err := s.Liveness.V1Liveness(ctx) if err != nil { log.Fatal(err) @@ -361,11 +365,12 @@ import ( ) func main() { + ctx := context.Background() + s := unkeygo.New( unkeygo.WithSecurity("UNKEY_ROOT_KEY"), ) - ctx := context.Background() res, err := s.Liveness.V1Liveness(ctx, operations.WithRetries( retry.Config{ Strategy: "backoff", @@ -399,6 +404,8 @@ import ( ) func main() { + ctx := context.Background() + s := unkeygo.New( unkeygo.WithRetryConfig( retry.Config{ @@ -414,7 +421,6 @@ func main() { unkeygo.WithSecurity("UNKEY_ROOT_KEY"), ) - ctx := context.Background() res, err := s.Liveness.V1Liveness(ctx) if err != nil { log.Fatal(err) @@ -446,11 +452,12 @@ import ( ) func main() { + ctx := context.Background() + s := unkeygo.New( unkeygo.WithSecurity("UNKEY_ROOT_KEY"), ) - ctx := context.Background() res, err := s.Identities.ListIdentities(ctx, operations.ListIdentitiesRequest{ Limit: unkeygo.Int64(100), }) diff --git a/RELEASES.md b/RELEASES.md index 513a2f6..5b2ec97 100644 --- a/RELEASES.md +++ b/RELEASES.md @@ -278,4 +278,14 @@ Based on: ### Generated - [go v0.11.0] . ### Releases -- [Go v0.11.0] https://github.com/unkeyed/unkey-go/releases/tag/v0.11.0 - . \ No newline at end of file +- [Go v0.11.0] https://github.com/unkeyed/unkey-go/releases/tag/v0.11.0 - . + +## 2024-12-24 00:30:06 +### Changes +Based on: +- OpenAPI Doc +- Speakeasy CLI 1.460.2 (2.484.0) https://github.com/speakeasy-api/speakeasy +### Generated +- [go v0.12.0] . +### Releases +- [Go v0.12.0] https://github.com/unkeyed/unkey-go/releases/tag/v0.12.0 - . \ No newline at end of file diff --git a/USAGE.md b/USAGE.md index a702d76..a0cce5d 100644 --- a/USAGE.md +++ b/USAGE.md @@ -9,11 +9,12 @@ import ( ) func main() { + ctx := context.Background() + s := unkeygo.New( unkeygo.WithSecurity("UNKEY_ROOT_KEY"), ) - ctx := context.Background() res, err := s.Liveness.V1Liveness(ctx) if err != nil { log.Fatal(err) diff --git a/apis.go b/apis.go index dcc6534..e14d86c 100644 --- a/apis.go +++ b/apis.go @@ -46,7 +46,12 @@ func (s *Apis) GetAPI(ctx context.Context, request operations.GetAPIRequest, opt } } - baseURL := utils.ReplaceParameters(s.sdkConfiguration.GetServerDetails()) + var baseURL string + if o.ServerURL == nil { + baseURL = utils.ReplaceParameters(s.sdkConfiguration.GetServerDetails()) + } else { + baseURL = *o.ServerURL + } opURL, err := url.JoinPath(baseURL, "/v1/apis.getApi") if err != nil { return nil, fmt.Errorf("error generating URL: %w", err) @@ -78,6 +83,10 @@ func (s *Apis) GetAPI(ctx context.Context, request operations.GetAPIRequest, opt return nil, err } + for k, v := range o.SetHeaders { + req.Header.Set(k, v) + } + globalRetryConfig := s.sdkConfiguration.RetryConfig retryConfig := o.Retries if retryConfig == nil { @@ -389,7 +398,12 @@ func (s *Apis) CreateAPI(ctx context.Context, request operations.CreateAPIReques } } - baseURL := utils.ReplaceParameters(s.sdkConfiguration.GetServerDetails()) + var baseURL string + if o.ServerURL == nil { + baseURL = utils.ReplaceParameters(s.sdkConfiguration.GetServerDetails()) + } else { + baseURL = *o.ServerURL + } opURL, err := url.JoinPath(baseURL, "/v1/apis.createApi") if err != nil { return nil, fmt.Errorf("error generating URL: %w", err) @@ -423,6 +437,10 @@ func (s *Apis) CreateAPI(ctx context.Context, request operations.CreateAPIReques return nil, err } + for k, v := range o.SetHeaders { + req.Header.Set(k, v) + } + globalRetryConfig := s.sdkConfiguration.RetryConfig retryConfig := o.Retries if retryConfig == nil { @@ -734,7 +752,12 @@ func (s *Apis) ListKeys(ctx context.Context, request operations.ListKeysRequest, } } - baseURL := utils.ReplaceParameters(s.sdkConfiguration.GetServerDetails()) + var baseURL string + if o.ServerURL == nil { + baseURL = utils.ReplaceParameters(s.sdkConfiguration.GetServerDetails()) + } else { + baseURL = *o.ServerURL + } opURL, err := url.JoinPath(baseURL, "/v1/apis.listKeys") if err != nil { return nil, fmt.Errorf("error generating URL: %w", err) @@ -766,6 +789,10 @@ func (s *Apis) ListKeys(ctx context.Context, request operations.ListKeysRequest, return nil, err } + for k, v := range o.SetHeaders { + req.Header.Set(k, v) + } + globalRetryConfig := s.sdkConfiguration.RetryConfig retryConfig := o.Retries if retryConfig == nil { @@ -1077,7 +1104,12 @@ func (s *Apis) DeleteAPI(ctx context.Context, request operations.DeleteAPIReques } } - baseURL := utils.ReplaceParameters(s.sdkConfiguration.GetServerDetails()) + var baseURL string + if o.ServerURL == nil { + baseURL = utils.ReplaceParameters(s.sdkConfiguration.GetServerDetails()) + } else { + baseURL = *o.ServerURL + } opURL, err := url.JoinPath(baseURL, "/v1/apis.deleteApi") if err != nil { return nil, fmt.Errorf("error generating URL: %w", err) @@ -1111,6 +1143,10 @@ func (s *Apis) DeleteAPI(ctx context.Context, request operations.DeleteAPIReques return nil, err } + for k, v := range o.SetHeaders { + req.Header.Set(k, v) + } + globalRetryConfig := s.sdkConfiguration.RetryConfig retryConfig := o.Retries if retryConfig == nil { @@ -1422,7 +1458,12 @@ func (s *Apis) DeleteKeys(ctx context.Context, request operations.DeleteKeysRequ } } - baseURL := utils.ReplaceParameters(s.sdkConfiguration.GetServerDetails()) + var baseURL string + if o.ServerURL == nil { + baseURL = utils.ReplaceParameters(s.sdkConfiguration.GetServerDetails()) + } else { + baseURL = *o.ServerURL + } opURL, err := url.JoinPath(baseURL, "/v1/apis.deleteKeys") if err != nil { return nil, fmt.Errorf("error generating URL: %w", err) @@ -1456,6 +1497,10 @@ func (s *Apis) DeleteKeys(ctx context.Context, request operations.DeleteKeysRequ return nil, err } + for k, v := range o.SetHeaders { + req.Header.Set(k, v) + } + globalRetryConfig := s.sdkConfiguration.RetryConfig retryConfig := o.Retries if retryConfig == nil { diff --git a/docs/models/components/v1keysverifykeyrequest.md b/docs/models/components/v1keysverifykeyrequest.md index 0491e5e..ad0d28a 100644 --- a/docs/models/components/v1keysverifykeyrequest.md +++ b/docs/models/components/v1keysverifykeyrequest.md @@ -3,10 +3,11 @@ ## Fields -| Field | Type | Required | Description | Example | -| ---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | ---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | ---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | ---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | ---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | -| `APIID` | **string* | :heavy_minus_sign: | The id of the api where the key belongs to. This is optional for now but will be required soon.
The key will be verified against the api's configuration. If the key does not belong to the api, the verification will fail. | api_1234 | -| `Key` | *string* | :heavy_check_mark: | The key to verify | sk_1234 | -| `Authorization` | [*components.Authorization](../../models/components/authorization.md) | :heavy_minus_sign: | Perform RBAC checks | | -| ~~`Ratelimit`~~ | [*components.V1KeysVerifyKeyRequestRatelimit](../../models/components/v1keysverifykeyrequestratelimit.md) | :heavy_minus_sign: | : warning: ** DEPRECATED **: This will be removed in a future release, please migrate away from it as soon as possible.

Use 'ratelimits' with `[{ name: "default", cost: 2}]` | | -| `Ratelimits` | [][components.Ratelimits](../../models/components/ratelimits.md) | :heavy_minus_sign: | You can check against multiple ratelimits when verifying a key. Let's say you are building an app that uses AI under the hood and you want to limit your customers to 500 requests per hour, but also ensure they use up less than 20k tokens per day.


[](https://www.unkey.com/docs/concepts/identities/ratelimits) | [
{
"name": "requests",
"limit": 500,
"duration": 3600000
},
{
"name": "tokens",
"limit": 20000,
"duration": 86400000
}
] | \ No newline at end of file +| Field | Type | Required | Description | Example | +| ---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | ---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | ---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | ---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | ---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | +| `APIID` | **string* | :heavy_minus_sign: | The id of the api where the key belongs to. This is optional for now but will be required soon.
The key will be verified against the api's configuration. If the key does not belong to the api, the verification will fail. | api_1234 | +| `Key` | *string* | :heavy_check_mark: | The key to verify | sk_1234 | +| `Tags` | []*string* | :heavy_minus_sign: | Tags do not influence the outcome of a verification.
They can be added to filter or aggregate historical verification data for your analytics needs.
To unkey, a tag is simply a string, we don't enforce any schema but leave that up to you.
The only exception is that each tag must be between 1 and 128 characters long.
A typical setup would be to add key-value pairs of resources or locations, that you need later when querying.
| [
"path=/v1/users/123",
"region=us-east-1"
] | +| `Authorization` | [*components.Authorization](../../models/components/authorization.md) | :heavy_minus_sign: | Perform RBAC checks | | +| ~~`Ratelimit`~~ | [*components.V1KeysVerifyKeyRequestRatelimit](../../models/components/v1keysverifykeyrequestratelimit.md) | :heavy_minus_sign: | : warning: ** DEPRECATED **: This will be removed in a future release, please migrate away from it as soon as possible.

Use 'ratelimits' with `[{ name: "default", cost: 2}]` | | +| `Ratelimits` | [][components.Ratelimits](../../models/components/ratelimits.md) | :heavy_minus_sign: | You can check against multiple ratelimits when verifying a key. Let's say you are building an app that uses AI under the hood and you want to limit your customers to 500 requests per hour, but also ensure they use up less than 20k tokens per day.


[](https://www.unkey.com/docs/concepts/identities/ratelimits) | [
{
"name": "requests",
"limit": 500,
"duration": 3600000
},
{
"name": "tokens",
"limit": 20000,
"duration": 86400000
}
] | \ No newline at end of file diff --git a/docs/models/operations/listkeysresponsebody.md b/docs/models/operations/listkeysresponsebody.md index 7b736a9..f87d5b6 100644 --- a/docs/models/operations/listkeysresponsebody.md +++ b/docs/models/operations/listkeysresponsebody.md @@ -9,4 +9,4 @@ List of keys for the api | --------------------------------------------------------------------------------------------------- | --------------------------------------------------------------------------------------------------- | --------------------------------------------------------------------------------------------------- | --------------------------------------------------------------------------------------------------- | --------------------------------------------------------------------------------------------------- | | `Keys` | [][components.Key](../../models/components/key.md) | :heavy_check_mark: | N/A | | | `Cursor` | **string* | :heavy_minus_sign: | The cursor to use for the next page of results, if no cursor is returned, there are no more results | eyJrZXkiOiJrZXlfMTIzNCJ9 | -| `Total` | *int64* | :heavy_check_mark: | The total number of keys for this api | | \ No newline at end of file +| `Total` | *int64* | :heavy_check_mark: | The total number of keys for this api. This is an approximation and may lag behind up to 5 minutes. | | \ No newline at end of file diff --git a/docs/models/operations/ratelimitsetoverrideresponse.md b/docs/models/operations/ratelimitsetoverrideresponse.md deleted file mode 100644 index 9af71a3..0000000 --- a/docs/models/operations/ratelimitsetoverrideresponse.md +++ /dev/null @@ -1,9 +0,0 @@ -# RatelimitSetOverrideResponse - - -## Fields - -| Field | Type | Required | Description | -| ----------------------------------------------------------------------------------------------------------- | ----------------------------------------------------------------------------------------------------------- | ----------------------------------------------------------------------------------------------------------- | ----------------------------------------------------------------------------------------------------------- | -| `HTTPMeta` | [components.HTTPMetadata](../../models/components/httpmetadata.md) | :heavy_check_mark: | N/A | -| `Object` | [*operations.RatelimitSetOverrideResponseBody](../../models/operations/ratelimitsetoverrideresponsebody.md) | :heavy_minus_sign: | Sucessfully created a ratelimit override | \ No newline at end of file diff --git a/docs/models/operations/ratelimitsetoverriderequestbody.md b/docs/models/operations/setoverriderequestbody.md similarity index 99% rename from docs/models/operations/ratelimitsetoverriderequestbody.md rename to docs/models/operations/setoverriderequestbody.md index ec962af..34d9177 100644 --- a/docs/models/operations/ratelimitsetoverriderequestbody.md +++ b/docs/models/operations/setoverriderequestbody.md @@ -1,4 +1,4 @@ -# RatelimitSetOverrideRequestBody +# SetOverrideRequestBody ## Fields diff --git a/docs/models/operations/setoverrideresponse.md b/docs/models/operations/setoverrideresponse.md new file mode 100644 index 0000000..76f7680 --- /dev/null +++ b/docs/models/operations/setoverrideresponse.md @@ -0,0 +1,9 @@ +# SetOverrideResponse + + +## Fields + +| Field | Type | Required | Description | +| ----------------------------------------------------------------------------------------- | ----------------------------------------------------------------------------------------- | ----------------------------------------------------------------------------------------- | ----------------------------------------------------------------------------------------- | +| `HTTPMeta` | [components.HTTPMetadata](../../models/components/httpmetadata.md) | :heavy_check_mark: | N/A | +| `Object` | [*operations.SetOverrideResponseBody](../../models/operations/setoverrideresponsebody.md) | :heavy_minus_sign: | Sucessfully created a ratelimit override | \ No newline at end of file diff --git a/docs/models/operations/ratelimitsetoverrideresponsebody.md b/docs/models/operations/setoverrideresponsebody.md similarity index 95% rename from docs/models/operations/ratelimitsetoverrideresponsebody.md rename to docs/models/operations/setoverrideresponsebody.md index 5e4b206..f5c8dd7 100644 --- a/docs/models/operations/ratelimitsetoverrideresponsebody.md +++ b/docs/models/operations/setoverrideresponsebody.md @@ -1,4 +1,4 @@ -# RatelimitSetOverrideResponseBody +# SetOverrideResponseBody Sucessfully created a ratelimit override diff --git a/docs/sdks/apis/README.md b/docs/sdks/apis/README.md index 14284ab..e1b49a4 100644 --- a/docs/sdks/apis/README.md +++ b/docs/sdks/apis/README.md @@ -19,18 +19,19 @@ package main import( + "context" unkeygo "github.com/unkeyed/unkey-go" "github.com/unkeyed/unkey-go/models/operations" - "context" "log" ) func main() { + ctx := context.Background() + s := unkeygo.New( unkeygo.WithSecurity("UNKEY_ROOT_KEY"), ) - ctx := context.Background() res, err := s.Apis.GetAPI(ctx, operations.GetAPIRequest{ APIID: "api_1234", }) @@ -76,18 +77,19 @@ func main() { package main import( + "context" unkeygo "github.com/unkeyed/unkey-go" "github.com/unkeyed/unkey-go/models/operations" - "context" "log" ) func main() { + ctx := context.Background() + s := unkeygo.New( unkeygo.WithSecurity("UNKEY_ROOT_KEY"), ) - ctx := context.Background() res, err := s.Apis.CreateAPI(ctx, operations.CreateAPIRequestBody{ Name: "my-api", }) @@ -133,18 +135,19 @@ func main() { package main import( + "context" unkeygo "github.com/unkeyed/unkey-go" "github.com/unkeyed/unkey-go/models/operations" - "context" "log" ) func main() { + ctx := context.Background() + s := unkeygo.New( unkeygo.WithSecurity("UNKEY_ROOT_KEY"), ) - ctx := context.Background() res, err := s.Apis.ListKeys(ctx, operations.ListKeysRequest{ APIID: "api_1234", Limit: unkeygo.Int64(100), @@ -191,18 +194,19 @@ func main() { package main import( + "context" unkeygo "github.com/unkeyed/unkey-go" "github.com/unkeyed/unkey-go/models/operations" - "context" "log" ) func main() { + ctx := context.Background() + s := unkeygo.New( unkeygo.WithSecurity("UNKEY_ROOT_KEY"), ) - ctx := context.Background() res, err := s.Apis.DeleteAPI(ctx, operations.DeleteAPIRequestBody{ APIID: "api_1234", }) @@ -248,18 +252,19 @@ func main() { package main import( + "context" unkeygo "github.com/unkeyed/unkey-go" "github.com/unkeyed/unkey-go/models/operations" - "context" "log" ) func main() { + ctx := context.Background() + s := unkeygo.New( unkeygo.WithSecurity("UNKEY_ROOT_KEY"), ) - ctx := context.Background() res, err := s.Apis.DeleteKeys(ctx, operations.DeleteKeysRequestBody{ APIID: "api_1234", }) diff --git a/docs/sdks/identities/README.md b/docs/sdks/identities/README.md index 6f39083..abb9c00 100644 --- a/docs/sdks/identities/README.md +++ b/docs/sdks/identities/README.md @@ -19,18 +19,19 @@ package main import( + "context" unkeygo "github.com/unkeyed/unkey-go" "github.com/unkeyed/unkey-go/models/operations" - "context" "log" ) func main() { + ctx := context.Background() + s := unkeygo.New( unkeygo.WithSecurity("UNKEY_ROOT_KEY"), ) - ctx := context.Background() res, err := s.Identities.CreateIdentity(ctx, operations.CreateIdentityRequestBody{ ExternalID: "user_123", Ratelimits: []operations.Ratelimits{ @@ -88,18 +89,19 @@ func main() { package main import( + "context" unkeygo "github.com/unkeyed/unkey-go" "github.com/unkeyed/unkey-go/models/operations" - "context" "log" ) func main() { + ctx := context.Background() + s := unkeygo.New( unkeygo.WithSecurity("UNKEY_ROOT_KEY"), ) - ctx := context.Background() res, err := s.Identities.GetIdentity(ctx, operations.GetIdentityRequest{ IdentityID: unkeygo.String("id_1234"), ExternalID: unkeygo.String("id_1234"), @@ -146,18 +148,19 @@ func main() { package main import( + "context" unkeygo "github.com/unkeyed/unkey-go" "github.com/unkeyed/unkey-go/models/operations" - "context" "log" ) func main() { + ctx := context.Background() + s := unkeygo.New( unkeygo.WithSecurity("UNKEY_ROOT_KEY"), ) - ctx := context.Background() res, err := s.Identities.ListIdentities(ctx, operations.ListIdentitiesRequest{ Limit: unkeygo.Int64(100), }) @@ -215,18 +218,19 @@ func main() { package main import( + "context" unkeygo "github.com/unkeyed/unkey-go" "github.com/unkeyed/unkey-go/models/operations" - "context" "log" ) func main() { + ctx := context.Background() + s := unkeygo.New( unkeygo.WithSecurity("UNKEY_ROOT_KEY"), ) - ctx := context.Background() res, err := s.Identities.UpdateIdentity(ctx, operations.UpdateIdentityRequestBody{ IdentityID: unkeygo.String("id_1234"), ExternalID: unkeygo.String("user_1234"), @@ -290,18 +294,19 @@ func main() { package main import( + "context" unkeygo "github.com/unkeyed/unkey-go" "github.com/unkeyed/unkey-go/models/operations" - "context" "log" ) func main() { + ctx := context.Background() + s := unkeygo.New( unkeygo.WithSecurity("UNKEY_ROOT_KEY"), ) - ctx := context.Background() res, err := s.Identities.DeleteIdentity(ctx, operations.DeleteIdentityRequestBody{ IdentityID: "id_1234", }) diff --git a/docs/sdks/keys/README.md b/docs/sdks/keys/README.md index 87339e2..6a3a8c5 100644 --- a/docs/sdks/keys/README.md +++ b/docs/sdks/keys/README.md @@ -28,18 +28,19 @@ package main import( + "context" unkeygo "github.com/unkeyed/unkey-go" "github.com/unkeyed/unkey-go/models/operations" - "context" "log" ) func main() { + ctx := context.Background() + s := unkeygo.New( unkeygo.WithSecurity("UNKEY_ROOT_KEY"), ) - ctx := context.Background() res, err := s.Keys.GetKey(ctx, operations.GetKeyRequest{ KeyID: "key_1234", }) @@ -85,18 +86,19 @@ func main() { package main import( + "context" unkeygo "github.com/unkeyed/unkey-go" "github.com/unkeyed/unkey-go/models/operations" - "context" "log" ) func main() { + ctx := context.Background() + s := unkeygo.New( unkeygo.WithSecurity("UNKEY_ROOT_KEY"), ) - ctx := context.Background() res, err := s.Keys.Whoami(ctx, operations.WhoamiRequestBody{ Key: "sk_123", }) @@ -142,18 +144,19 @@ func main() { package main import( + "context" unkeygo "github.com/unkeyed/unkey-go" "github.com/unkeyed/unkey-go/models/operations" - "context" "log" ) func main() { + ctx := context.Background() + s := unkeygo.New( unkeygo.WithSecurity("UNKEY_ROOT_KEY"), ) - ctx := context.Background() res, err := s.Keys.DeleteKey(ctx, operations.DeleteKeyRequestBody{ KeyID: "key_1234", }) @@ -199,18 +202,19 @@ func main() { package main import( + "context" unkeygo "github.com/unkeyed/unkey-go" "github.com/unkeyed/unkey-go/models/operations" - "context" "log" ) func main() { + ctx := context.Background() + s := unkeygo.New( unkeygo.WithSecurity("UNKEY_ROOT_KEY"), ) - ctx := context.Background() res, err := s.Keys.CreateKey(ctx, operations.CreateKeyRequestBody{ APIID: "api_123", Name: unkeygo.String("my key"), @@ -283,18 +287,19 @@ func main() { package main import( + "context" unkeygo "github.com/unkeyed/unkey-go" "github.com/unkeyed/unkey-go/models/components" - "context" "log" ) func main() { + ctx := context.Background() + s := unkeygo.New( unkeygo.WithSecurity("UNKEY_ROOT_KEY"), ) - ctx := context.Background() res, err := s.Keys.VerifyKey(ctx, components.V1KeysVerifyKeyRequest{ APIID: unkeygo.String("api_1234"), Key: "sk_1234", @@ -353,18 +358,19 @@ func main() { package main import( + "context" unkeygo "github.com/unkeyed/unkey-go" "github.com/unkeyed/unkey-go/models/operations" - "context" "log" ) func main() { + ctx := context.Background() + s := unkeygo.New( unkeygo.WithSecurity("UNKEY_ROOT_KEY"), ) - ctx := context.Background() res, err := s.Keys.UpdateKey(ctx, operations.UpdateKeyRequestBody{ KeyID: "key_123", Name: unkeygo.String("Customer X"), @@ -456,18 +462,19 @@ func main() { package main import( + "context" unkeygo "github.com/unkeyed/unkey-go" "github.com/unkeyed/unkey-go/models/operations" - "context" "log" ) func main() { + ctx := context.Background() + s := unkeygo.New( unkeygo.WithSecurity("UNKEY_ROOT_KEY"), ) - ctx := context.Background() res, err := s.Keys.UpdateRemaining(ctx, operations.UpdateRemainingRequestBody{ KeyID: "key_123", Op: operations.OpSet, @@ -515,18 +522,19 @@ func main() { package main import( + "context" unkeygo "github.com/unkeyed/unkey-go" "github.com/unkeyed/unkey-go/models/operations" - "context" "log" ) func main() { + ctx := context.Background() + s := unkeygo.New( unkeygo.WithSecurity("UNKEY_ROOT_KEY"), ) - ctx := context.Background() res, err := s.Keys.GetVerifications(ctx, operations.GetVerificationsRequest{ KeyID: unkeygo.String("key_1234"), OwnerID: unkeygo.String("chronark"), @@ -576,18 +584,19 @@ func main() { package main import( + "context" unkeygo "github.com/unkeyed/unkey-go" "github.com/unkeyed/unkey-go/models/operations" - "context" "log" ) func main() { + ctx := context.Background() + s := unkeygo.New( unkeygo.WithSecurity("UNKEY_ROOT_KEY"), ) - ctx := context.Background() res, err := s.Keys.AddPermissions(ctx, operations.AddPermissionsRequestBody{ KeyID: "", Permissions: []operations.AddPermissionsPermissions{ @@ -636,18 +645,19 @@ func main() { package main import( + "context" unkeygo "github.com/unkeyed/unkey-go" "github.com/unkeyed/unkey-go/models/operations" - "context" "log" ) func main() { + ctx := context.Background() + s := unkeygo.New( unkeygo.WithSecurity("UNKEY_ROOT_KEY"), ) - ctx := context.Background() res, err := s.Keys.RemovePermissions(ctx, operations.RemovePermissionsRequestBody{ KeyID: "", Permissions: []operations.RemovePermissionsPermissions{ @@ -701,18 +711,19 @@ func main() { package main import( + "context" unkeygo "github.com/unkeyed/unkey-go" "github.com/unkeyed/unkey-go/models/operations" - "context" "log" ) func main() { + ctx := context.Background() + s := unkeygo.New( unkeygo.WithSecurity("UNKEY_ROOT_KEY"), ) - ctx := context.Background() res, err := s.Keys.SetPermissions(ctx, operations.SetPermissionsRequestBody{ KeyID: "", Permissions: []operations.SetPermissionsPermissions{ @@ -770,18 +781,19 @@ func main() { package main import( + "context" unkeygo "github.com/unkeyed/unkey-go" "github.com/unkeyed/unkey-go/models/operations" - "context" "log" ) func main() { + ctx := context.Background() + s := unkeygo.New( unkeygo.WithSecurity("UNKEY_ROOT_KEY"), ) - ctx := context.Background() res, err := s.Keys.AddRoles(ctx, operations.AddRolesRequestBody{ KeyID: "", Roles: []operations.AddRolesRoles{ @@ -839,18 +851,19 @@ func main() { package main import( + "context" unkeygo "github.com/unkeyed/unkey-go" "github.com/unkeyed/unkey-go/models/operations" - "context" "log" ) func main() { + ctx := context.Background() + s := unkeygo.New( unkeygo.WithSecurity("UNKEY_ROOT_KEY"), ) - ctx := context.Background() res, err := s.Keys.RemoveRoles(ctx, operations.RemoveRolesRequestBody{ KeyID: "", Roles: []operations.RemoveRolesRoles{ @@ -904,18 +917,19 @@ func main() { package main import( + "context" unkeygo "github.com/unkeyed/unkey-go" "github.com/unkeyed/unkey-go/models/operations" - "context" "log" ) func main() { + ctx := context.Background() + s := unkeygo.New( unkeygo.WithSecurity("UNKEY_ROOT_KEY"), ) - ctx := context.Background() res, err := s.Keys.SetRoles(ctx, operations.SetRolesRequestBody{ KeyID: "", Roles: []operations.SetRolesRoles{ diff --git a/docs/sdks/liveness/README.md b/docs/sdks/liveness/README.md index 5660e95..b648cc5 100644 --- a/docs/sdks/liveness/README.md +++ b/docs/sdks/liveness/README.md @@ -15,17 +15,18 @@ package main import( - unkeygo "github.com/unkeyed/unkey-go" "context" + unkeygo "github.com/unkeyed/unkey-go" "log" ) func main() { + ctx := context.Background() + s := unkeygo.New( unkeygo.WithSecurity("UNKEY_ROOT_KEY"), ) - ctx := context.Background() res, err := s.Liveness.V1Liveness(ctx) if err != nil { log.Fatal(err) diff --git a/docs/sdks/migrations/README.md b/docs/sdks/migrations/README.md index 1397b01..2d62adb 100644 --- a/docs/sdks/migrations/README.md +++ b/docs/sdks/migrations/README.md @@ -16,18 +16,19 @@ package main import( + "context" unkeygo "github.com/unkeyed/unkey-go" "github.com/unkeyed/unkey-go/models/operations" - "context" "log" ) func main() { + ctx := context.Background() + s := unkeygo.New( unkeygo.WithSecurity("UNKEY_ROOT_KEY"), ) - ctx := context.Background() res, err := s.Migrations.V1MigrationsCreateKeys(ctx, []operations.RequestBody{ operations.RequestBody{ APIID: "api_123", @@ -103,18 +104,19 @@ func main() { package main import( + "context" unkeygo "github.com/unkeyed/unkey-go" "github.com/unkeyed/unkey-go/models/operations" - "context" "log" ) func main() { + ctx := context.Background() + s := unkeygo.New( unkeygo.WithSecurity("UNKEY_ROOT_KEY"), ) - ctx := context.Background() res, err := s.Migrations.V1MigrationsEnqueueKeys(ctx, operations.V1MigrationsEnqueueKeysRequestBody{ MigrationID: "", APIID: "", diff --git a/docs/sdks/permissions/README.md b/docs/sdks/permissions/README.md index ff90381..458a4eb 100644 --- a/docs/sdks/permissions/README.md +++ b/docs/sdks/permissions/README.md @@ -22,18 +22,19 @@ package main import( + "context" unkeygo "github.com/unkeyed/unkey-go" "github.com/unkeyed/unkey-go/models/operations" - "context" "log" ) func main() { + ctx := context.Background() + s := unkeygo.New( unkeygo.WithSecurity("UNKEY_ROOT_KEY"), ) - ctx := context.Background() res, err := s.Permissions.CreatePermission(ctx, operations.CreatePermissionRequestBody{ Name: "record.write", Description: unkeygo.String("record.write can create new dns records for our domains."), @@ -80,18 +81,19 @@ func main() { package main import( + "context" unkeygo "github.com/unkeyed/unkey-go" "github.com/unkeyed/unkey-go/models/operations" - "context" "log" ) func main() { + ctx := context.Background() + s := unkeygo.New( unkeygo.WithSecurity("UNKEY_ROOT_KEY"), ) - ctx := context.Background() res, err := s.Permissions.DeletePermission(ctx, operations.DeletePermissionRequestBody{ PermissionID: "perm_123", }) @@ -137,18 +139,19 @@ func main() { package main import( + "context" unkeygo "github.com/unkeyed/unkey-go" "github.com/unkeyed/unkey-go/models/operations" - "context" "log" ) func main() { + ctx := context.Background() + s := unkeygo.New( unkeygo.WithSecurity("UNKEY_ROOT_KEY"), ) - ctx := context.Background() res, err := s.Permissions.GetPermission(ctx, operations.GetPermissionRequest{ PermissionID: "perm_123", }) @@ -194,17 +197,18 @@ func main() { package main import( - unkeygo "github.com/unkeyed/unkey-go" "context" + unkeygo "github.com/unkeyed/unkey-go" "log" ) func main() { + ctx := context.Background() + s := unkeygo.New( unkeygo.WithSecurity("UNKEY_ROOT_KEY"), ) - ctx := context.Background() res, err := s.Permissions.ListPermissions(ctx) if err != nil { log.Fatal(err) @@ -247,18 +251,19 @@ func main() { package main import( + "context" unkeygo "github.com/unkeyed/unkey-go" "github.com/unkeyed/unkey-go/models/operations" - "context" "log" ) func main() { + ctx := context.Background() + s := unkeygo.New( unkeygo.WithSecurity("UNKEY_ROOT_KEY"), ) - ctx := context.Background() res, err := s.Permissions.CreateRole(ctx, operations.CreateRoleRequestBody{ Name: "dns.records.manager", Description: unkeygo.String("dns.records.manager can read and write dns records for our domains."), @@ -305,18 +310,19 @@ func main() { package main import( + "context" unkeygo "github.com/unkeyed/unkey-go" "github.com/unkeyed/unkey-go/models/operations" - "context" "log" ) func main() { + ctx := context.Background() + s := unkeygo.New( unkeygo.WithSecurity("UNKEY_ROOT_KEY"), ) - ctx := context.Background() res, err := s.Permissions.DeleteRole(ctx, operations.DeleteRoleRequestBody{ RoleID: "role_123", }) @@ -362,18 +368,19 @@ func main() { package main import( + "context" unkeygo "github.com/unkeyed/unkey-go" "github.com/unkeyed/unkey-go/models/operations" - "context" "log" ) func main() { + ctx := context.Background() + s := unkeygo.New( unkeygo.WithSecurity("UNKEY_ROOT_KEY"), ) - ctx := context.Background() res, err := s.Permissions.GetRole(ctx, operations.GetRoleRequest{ RoleID: "role_123", }) @@ -419,17 +426,18 @@ func main() { package main import( - unkeygo "github.com/unkeyed/unkey-go" "context" + unkeygo "github.com/unkeyed/unkey-go" "log" ) func main() { + ctx := context.Background() + s := unkeygo.New( unkeygo.WithSecurity("UNKEY_ROOT_KEY"), ) - ctx := context.Background() res, err := s.Permissions.ListRoles(ctx) if err != nil { log.Fatal(err) diff --git a/docs/sdks/ratelimit/README.md b/docs/sdks/ratelimit/README.md index b84727b..f98338d 100644 --- a/docs/sdks/ratelimit/README.md +++ b/docs/sdks/ratelimit/README.md @@ -5,11 +5,11 @@ ### Available Operations -* [RatelimitSetOverride](#ratelimitsetoverride) +* [SetOverride](#setoverride) * [ListOverrides](#listoverrides) * [GetOverride](#getoverride) -## RatelimitSetOverride +## SetOverride ### Example Usage @@ -17,19 +17,20 @@ package main import( + "context" unkeygo "github.com/unkeyed/unkey-go" "github.com/unkeyed/unkey-go/models/operations" - "context" "log" ) func main() { + ctx := context.Background() + s := unkeygo.New( unkeygo.WithSecurity("UNKEY_ROOT_KEY"), ) - ctx := context.Background() - res, err := s.Ratelimit.RatelimitSetOverride(ctx, operations.RatelimitSetOverrideRequestBody{ + res, err := s.Ratelimit.SetOverride(ctx, operations.SetOverrideRequestBody{ NamespaceID: unkeygo.String("rlns_1234"), NamespaceName: unkeygo.String("email.outbound"), Identifier: "user_123", @@ -47,15 +48,15 @@ func main() { ### Parameters -| Parameter | Type | Required | Description | -| -------------------------------------------------------------------------------------------------------- | -------------------------------------------------------------------------------------------------------- | -------------------------------------------------------------------------------------------------------- | -------------------------------------------------------------------------------------------------------- | -| `ctx` | [context.Context](https://pkg.go.dev/context#Context) | :heavy_check_mark: | The context to use for the request. | -| `request` | [operations.RatelimitSetOverrideRequestBody](../../models/operations/ratelimitsetoverriderequestbody.md) | :heavy_check_mark: | The request object to use for the request. | -| `opts` | [][operations.Option](../../models/operations/option.md) | :heavy_minus_sign: | The options for this request. | +| Parameter | Type | Required | Description | +| -------------------------------------------------------------------------------------- | -------------------------------------------------------------------------------------- | -------------------------------------------------------------------------------------- | -------------------------------------------------------------------------------------- | +| `ctx` | [context.Context](https://pkg.go.dev/context#Context) | :heavy_check_mark: | The context to use for the request. | +| `request` | [operations.SetOverrideRequestBody](../../models/operations/setoverriderequestbody.md) | :heavy_check_mark: | The request object to use for the request. | +| `opts` | [][operations.Option](../../models/operations/option.md) | :heavy_minus_sign: | The options for this request. | ### Response -**[*operations.RatelimitSetOverrideResponse](../../models/operations/ratelimitsetoverrideresponse.md), error** +**[*operations.SetOverrideResponse](../../models/operations/setoverrideresponse.md), error** ### Errors @@ -78,18 +79,19 @@ func main() { package main import( + "context" unkeygo "github.com/unkeyed/unkey-go" "github.com/unkeyed/unkey-go/models/operations" - "context" "log" ) func main() { + ctx := context.Background() + s := unkeygo.New( unkeygo.WithSecurity("UNKEY_ROOT_KEY"), ) - ctx := context.Background() res, err := s.Ratelimit.ListOverrides(ctx, operations.ListOverridesRequest{ NamespaceID: unkeygo.String("rlns_1234"), NamespaceName: unkeygo.String("email.outbound"), @@ -137,18 +139,19 @@ func main() { package main import( + "context" unkeygo "github.com/unkeyed/unkey-go" "github.com/unkeyed/unkey-go/models/operations" - "context" "log" ) func main() { + ctx := context.Background() + s := unkeygo.New( unkeygo.WithSecurity("UNKEY_ROOT_KEY"), ) - ctx := context.Background() res, err := s.Ratelimit.GetOverride(ctx, operations.GetOverrideRequest{ NamespaceID: unkeygo.String("rlns_1234"), NamespaceName: unkeygo.String("email.outbound"), diff --git a/docs/sdks/ratelimits/README.md b/docs/sdks/ratelimits/README.md index c404603..934d99f 100644 --- a/docs/sdks/ratelimits/README.md +++ b/docs/sdks/ratelimits/README.md @@ -16,18 +16,19 @@ package main import( + "context" unkeygo "github.com/unkeyed/unkey-go" "github.com/unkeyed/unkey-go/models/operations" - "context" "log" ) func main() { + ctx := context.Background() + s := unkeygo.New( unkeygo.WithSecurity("UNKEY_ROOT_KEY"), ) - ctx := context.Background() res, err := s.Ratelimits.Limit(ctx, operations.LimitRequestBody{ Namespace: unkeygo.String("email.outbound"), Identifier: "user_123", @@ -84,18 +85,19 @@ func main() { package main import( + "context" unkeygo "github.com/unkeyed/unkey-go" "github.com/unkeyed/unkey-go/models/operations" - "context" "log" ) func main() { + ctx := context.Background() + s := unkeygo.New( unkeygo.WithSecurity("UNKEY_ROOT_KEY"), ) - ctx := context.Background() res, err := s.Ratelimits.DeleteOverride(ctx, operations.DeleteOverrideRequestBody{ NamespaceID: unkeygo.String("rlns_1234"), NamespaceName: unkeygo.String("email.outbound"), diff --git a/identities.go b/identities.go index 2bb7ed1..9a35724 100644 --- a/identities.go +++ b/identities.go @@ -48,7 +48,12 @@ func (s *Identities) CreateIdentity(ctx context.Context, request operations.Crea } } - baseURL := utils.ReplaceParameters(s.sdkConfiguration.GetServerDetails()) + var baseURL string + if o.ServerURL == nil { + baseURL = utils.ReplaceParameters(s.sdkConfiguration.GetServerDetails()) + } else { + baseURL = *o.ServerURL + } opURL, err := url.JoinPath(baseURL, "/v1/identities.createIdentity") if err != nil { return nil, fmt.Errorf("error generating URL: %w", err) @@ -82,6 +87,10 @@ func (s *Identities) CreateIdentity(ctx context.Context, request operations.Crea return nil, err } + for k, v := range o.SetHeaders { + req.Header.Set(k, v) + } + globalRetryConfig := s.sdkConfiguration.RetryConfig retryConfig := o.Retries if retryConfig == nil { @@ -393,7 +402,12 @@ func (s *Identities) GetIdentity(ctx context.Context, request operations.GetIden } } - baseURL := utils.ReplaceParameters(s.sdkConfiguration.GetServerDetails()) + var baseURL string + if o.ServerURL == nil { + baseURL = utils.ReplaceParameters(s.sdkConfiguration.GetServerDetails()) + } else { + baseURL = *o.ServerURL + } opURL, err := url.JoinPath(baseURL, "/v1/identities.getIdentity") if err != nil { return nil, fmt.Errorf("error generating URL: %w", err) @@ -425,6 +439,10 @@ func (s *Identities) GetIdentity(ctx context.Context, request operations.GetIden return nil, err } + for k, v := range o.SetHeaders { + req.Header.Set(k, v) + } + globalRetryConfig := s.sdkConfiguration.RetryConfig retryConfig := o.Retries if retryConfig == nil { @@ -736,7 +754,12 @@ func (s *Identities) ListIdentities(ctx context.Context, request operations.List } } - baseURL := utils.ReplaceParameters(s.sdkConfiguration.GetServerDetails()) + var baseURL string + if o.ServerURL == nil { + baseURL = utils.ReplaceParameters(s.sdkConfiguration.GetServerDetails()) + } else { + baseURL = *o.ServerURL + } opURL, err := url.JoinPath(baseURL, "/v1/identities.listIdentities") if err != nil { return nil, fmt.Errorf("error generating URL: %w", err) @@ -768,6 +791,10 @@ func (s *Identities) ListIdentities(ctx context.Context, request operations.List return nil, err } + for k, v := range o.SetHeaders { + req.Header.Set(k, v) + } + globalRetryConfig := s.sdkConfiguration.RetryConfig retryConfig := o.Retries if retryConfig == nil { @@ -1123,7 +1150,12 @@ func (s *Identities) UpdateIdentity(ctx context.Context, request operations.Upda } } - baseURL := utils.ReplaceParameters(s.sdkConfiguration.GetServerDetails()) + var baseURL string + if o.ServerURL == nil { + baseURL = utils.ReplaceParameters(s.sdkConfiguration.GetServerDetails()) + } else { + baseURL = *o.ServerURL + } opURL, err := url.JoinPath(baseURL, "/v1/identities.updateIdentity") if err != nil { return nil, fmt.Errorf("error generating URL: %w", err) @@ -1157,6 +1189,10 @@ func (s *Identities) UpdateIdentity(ctx context.Context, request operations.Upda return nil, err } + for k, v := range o.SetHeaders { + req.Header.Set(k, v) + } + globalRetryConfig := s.sdkConfiguration.RetryConfig retryConfig := o.Retries if retryConfig == nil { @@ -1468,7 +1504,12 @@ func (s *Identities) DeleteIdentity(ctx context.Context, request operations.Dele } } - baseURL := utils.ReplaceParameters(s.sdkConfiguration.GetServerDetails()) + var baseURL string + if o.ServerURL == nil { + baseURL = utils.ReplaceParameters(s.sdkConfiguration.GetServerDetails()) + } else { + baseURL = *o.ServerURL + } opURL, err := url.JoinPath(baseURL, "/v1/identities.deleteIdentity") if err != nil { return nil, fmt.Errorf("error generating URL: %w", err) @@ -1502,6 +1543,10 @@ func (s *Identities) DeleteIdentity(ctx context.Context, request operations.Dele return nil, err } + for k, v := range o.SetHeaders { + req.Header.Set(k, v) + } + globalRetryConfig := s.sdkConfiguration.RetryConfig retryConfig := o.Retries if retryConfig == nil { diff --git a/internal/utils/queryparams.go b/internal/utils/queryparams.go index b50538c..f5c2f33 100644 --- a/internal/utils/queryparams.go +++ b/internal/utils/queryparams.go @@ -214,7 +214,11 @@ func populateDeepObjectParamsStruct(qsValues url.Values, priorScope string, stru continue } - scope := priorScope + "[" + qpTag.ParamName + "]" + scope := priorScope + + if !qpTag.Inline { + scope = priorScope + "[" + qpTag.ParamName + "]" + } switch fieldValue.Kind() { case reflect.Array, reflect.Slice: @@ -252,6 +256,13 @@ type paramTag struct { Explode bool ParamName string Serialization string + + // Inline is a special case for union/oneOf. When a wrapper struct type is + // used, each union/oneOf value field should be inlined (e.g. not appended + // in deepObject style with the name) as if the value was directly on the + // parent struct field. Without this annotation, the value would not be + // encoded by downstream logic that requires the struct field tag. + Inline bool } func parseQueryParamTag(field reflect.StructField) *paramTag { diff --git a/internal/utils/requestbody.go b/internal/utils/requestbody.go index 000226e..78479c6 100644 --- a/internal/utils/requestbody.go +++ b/internal/utils/requestbody.go @@ -166,7 +166,7 @@ func encodeMultipartFormData(w io.Writer, data interface{}) (string, error) { tag := parseMultipartFormTag(field) if tag.File { - if err := encodeMultipartFormDataFile(writer, fieldType, valType); err != nil { + if err := encodeMultipartFormDataFile(writer, tag.Name, fieldType, valType); err != nil { writer.Close() return "", err } @@ -211,12 +211,11 @@ func encodeMultipartFormData(w io.Writer, data interface{}) (string, error) { return writer.FormDataContentType(), nil } -func encodeMultipartFormDataFile(w *multipart.Writer, fieldType reflect.Type, valType reflect.Value) error { +func encodeMultipartFormDataFile(w *multipart.Writer, fieldName string, fieldType reflect.Type, valType reflect.Value) error { if fieldType.Kind() != reflect.Struct { return fmt.Errorf("invalid type %s for multipart/form-data file", valType.Type()) } - var fieldName string var fileName string var reader io.Reader @@ -236,12 +235,11 @@ func encodeMultipartFormDataFile(w *multipart.Writer, fieldType reflect.Type, va reader = val.Interface().(io.Reader) } } else { - fieldName = tag.Name fileName = val.String() } } - if fieldName == "" || fileName == "" || reader == nil { + if fileName == "" || reader == nil { return fmt.Errorf("invalid multipart/form-data file") } diff --git a/internal/utils/utils.go b/internal/utils/utils.go index f1ff9e0..031a71a 100644 --- a/internal/utils/utils.go +++ b/internal/utils/utils.go @@ -127,6 +127,7 @@ func parseStructTag(tagKey string, field reflect.StructField) map[string]string func parseParamTag(tagKey string, field reflect.StructField, defaultStyle string, defaultExplode bool) *paramTag { // example `{tagKey}:"style=simple,explode=false,name=apiID"` + // example `{tagKey}:"inline"` values := parseStructTag(tagKey, field) if values == nil { return nil @@ -140,6 +141,8 @@ func parseParamTag(tagKey string, field reflect.StructField, defaultStyle string for k, v := range values { switch k { + case "inline": + tag.Inline = v == "true" case "style": tag.Style = v case "explode": diff --git a/keys.go b/keys.go index a0812b5..bbb9665 100644 --- a/keys.go +++ b/keys.go @@ -46,7 +46,12 @@ func (s *Keys) GetKey(ctx context.Context, request operations.GetKeyRequest, opt } } - baseURL := utils.ReplaceParameters(s.sdkConfiguration.GetServerDetails()) + var baseURL string + if o.ServerURL == nil { + baseURL = utils.ReplaceParameters(s.sdkConfiguration.GetServerDetails()) + } else { + baseURL = *o.ServerURL + } opURL, err := url.JoinPath(baseURL, "/v1/keys.getKey") if err != nil { return nil, fmt.Errorf("error generating URL: %w", err) @@ -78,6 +83,10 @@ func (s *Keys) GetKey(ctx context.Context, request operations.GetKeyRequest, opt return nil, err } + for k, v := range o.SetHeaders { + req.Header.Set(k, v) + } + globalRetryConfig := s.sdkConfiguration.RetryConfig retryConfig := o.Retries if retryConfig == nil { @@ -389,7 +398,12 @@ func (s *Keys) Whoami(ctx context.Context, request operations.WhoamiRequestBody, } } - baseURL := utils.ReplaceParameters(s.sdkConfiguration.GetServerDetails()) + var baseURL string + if o.ServerURL == nil { + baseURL = utils.ReplaceParameters(s.sdkConfiguration.GetServerDetails()) + } else { + baseURL = *o.ServerURL + } opURL, err := url.JoinPath(baseURL, "/v1/keys.whoami") if err != nil { return nil, fmt.Errorf("error generating URL: %w", err) @@ -423,6 +437,10 @@ func (s *Keys) Whoami(ctx context.Context, request operations.WhoamiRequestBody, return nil, err } + for k, v := range o.SetHeaders { + req.Header.Set(k, v) + } + globalRetryConfig := s.sdkConfiguration.RetryConfig retryConfig := o.Retries if retryConfig == nil { @@ -734,7 +752,12 @@ func (s *Keys) DeleteKey(ctx context.Context, request operations.DeleteKeyReques } } - baseURL := utils.ReplaceParameters(s.sdkConfiguration.GetServerDetails()) + var baseURL string + if o.ServerURL == nil { + baseURL = utils.ReplaceParameters(s.sdkConfiguration.GetServerDetails()) + } else { + baseURL = *o.ServerURL + } opURL, err := url.JoinPath(baseURL, "/v1/keys.deleteKey") if err != nil { return nil, fmt.Errorf("error generating URL: %w", err) @@ -768,6 +791,10 @@ func (s *Keys) DeleteKey(ctx context.Context, request operations.DeleteKeyReques return nil, err } + for k, v := range o.SetHeaders { + req.Header.Set(k, v) + } + globalRetryConfig := s.sdkConfiguration.RetryConfig retryConfig := o.Retries if retryConfig == nil { @@ -1079,7 +1106,12 @@ func (s *Keys) CreateKey(ctx context.Context, request operations.CreateKeyReques } } - baseURL := utils.ReplaceParameters(s.sdkConfiguration.GetServerDetails()) + var baseURL string + if o.ServerURL == nil { + baseURL = utils.ReplaceParameters(s.sdkConfiguration.GetServerDetails()) + } else { + baseURL = *o.ServerURL + } opURL, err := url.JoinPath(baseURL, "/v1/keys.createKey") if err != nil { return nil, fmt.Errorf("error generating URL: %w", err) @@ -1113,6 +1145,10 @@ func (s *Keys) CreateKey(ctx context.Context, request operations.CreateKeyReques return nil, err } + for k, v := range o.SetHeaders { + req.Header.Set(k, v) + } + globalRetryConfig := s.sdkConfiguration.RetryConfig retryConfig := o.Retries if retryConfig == nil { @@ -1424,7 +1460,12 @@ func (s *Keys) VerifyKey(ctx context.Context, request components.V1KeysVerifyKey } } - baseURL := utils.ReplaceParameters(s.sdkConfiguration.GetServerDetails()) + var baseURL string + if o.ServerURL == nil { + baseURL = utils.ReplaceParameters(s.sdkConfiguration.GetServerDetails()) + } else { + baseURL = *o.ServerURL + } opURL, err := url.JoinPath(baseURL, "/v1/keys.verifyKey") if err != nil { return nil, fmt.Errorf("error generating URL: %w", err) @@ -1458,6 +1499,10 @@ func (s *Keys) VerifyKey(ctx context.Context, request components.V1KeysVerifyKey return nil, err } + for k, v := range o.SetHeaders { + req.Header.Set(k, v) + } + globalRetryConfig := s.sdkConfiguration.RetryConfig retryConfig := o.Retries if retryConfig == nil { @@ -1769,7 +1814,12 @@ func (s *Keys) UpdateKey(ctx context.Context, request operations.UpdateKeyReques } } - baseURL := utils.ReplaceParameters(s.sdkConfiguration.GetServerDetails()) + var baseURL string + if o.ServerURL == nil { + baseURL = utils.ReplaceParameters(s.sdkConfiguration.GetServerDetails()) + } else { + baseURL = *o.ServerURL + } opURL, err := url.JoinPath(baseURL, "/v1/keys.updateKey") if err != nil { return nil, fmt.Errorf("error generating URL: %w", err) @@ -1803,6 +1853,10 @@ func (s *Keys) UpdateKey(ctx context.Context, request operations.UpdateKeyReques return nil, err } + for k, v := range o.SetHeaders { + req.Header.Set(k, v) + } + globalRetryConfig := s.sdkConfiguration.RetryConfig retryConfig := o.Retries if retryConfig == nil { @@ -2114,7 +2168,12 @@ func (s *Keys) UpdateRemaining(ctx context.Context, request operations.UpdateRem } } - baseURL := utils.ReplaceParameters(s.sdkConfiguration.GetServerDetails()) + var baseURL string + if o.ServerURL == nil { + baseURL = utils.ReplaceParameters(s.sdkConfiguration.GetServerDetails()) + } else { + baseURL = *o.ServerURL + } opURL, err := url.JoinPath(baseURL, "/v1/keys.updateRemaining") if err != nil { return nil, fmt.Errorf("error generating URL: %w", err) @@ -2148,6 +2207,10 @@ func (s *Keys) UpdateRemaining(ctx context.Context, request operations.UpdateRem return nil, err } + for k, v := range o.SetHeaders { + req.Header.Set(k, v) + } + globalRetryConfig := s.sdkConfiguration.RetryConfig retryConfig := o.Retries if retryConfig == nil { @@ -2459,7 +2522,12 @@ func (s *Keys) GetVerifications(ctx context.Context, request operations.GetVerif } } - baseURL := utils.ReplaceParameters(s.sdkConfiguration.GetServerDetails()) + var baseURL string + if o.ServerURL == nil { + baseURL = utils.ReplaceParameters(s.sdkConfiguration.GetServerDetails()) + } else { + baseURL = *o.ServerURL + } opURL, err := url.JoinPath(baseURL, "/v1/keys.getVerifications") if err != nil { return nil, fmt.Errorf("error generating URL: %w", err) @@ -2491,6 +2559,10 @@ func (s *Keys) GetVerifications(ctx context.Context, request operations.GetVerif return nil, err } + for k, v := range o.SetHeaders { + req.Header.Set(k, v) + } + globalRetryConfig := s.sdkConfiguration.RetryConfig retryConfig := o.Retries if retryConfig == nil { @@ -2802,7 +2874,12 @@ func (s *Keys) AddPermissions(ctx context.Context, request operations.AddPermiss } } - baseURL := utils.ReplaceParameters(s.sdkConfiguration.GetServerDetails()) + var baseURL string + if o.ServerURL == nil { + baseURL = utils.ReplaceParameters(s.sdkConfiguration.GetServerDetails()) + } else { + baseURL = *o.ServerURL + } opURL, err := url.JoinPath(baseURL, "/v1/keys.addPermissions") if err != nil { return nil, fmt.Errorf("error generating URL: %w", err) @@ -2836,6 +2913,10 @@ func (s *Keys) AddPermissions(ctx context.Context, request operations.AddPermiss return nil, err } + for k, v := range o.SetHeaders { + req.Header.Set(k, v) + } + globalRetryConfig := s.sdkConfiguration.RetryConfig retryConfig := o.Retries if retryConfig == nil { @@ -3147,7 +3228,12 @@ func (s *Keys) RemovePermissions(ctx context.Context, request operations.RemoveP } } - baseURL := utils.ReplaceParameters(s.sdkConfiguration.GetServerDetails()) + var baseURL string + if o.ServerURL == nil { + baseURL = utils.ReplaceParameters(s.sdkConfiguration.GetServerDetails()) + } else { + baseURL = *o.ServerURL + } opURL, err := url.JoinPath(baseURL, "/v1/keys.removePermissions") if err != nil { return nil, fmt.Errorf("error generating URL: %w", err) @@ -3181,6 +3267,10 @@ func (s *Keys) RemovePermissions(ctx context.Context, request operations.RemoveP return nil, err } + for k, v := range o.SetHeaders { + req.Header.Set(k, v) + } + globalRetryConfig := s.sdkConfiguration.RetryConfig retryConfig := o.Retries if retryConfig == nil { @@ -3492,7 +3582,12 @@ func (s *Keys) SetPermissions(ctx context.Context, request operations.SetPermiss } } - baseURL := utils.ReplaceParameters(s.sdkConfiguration.GetServerDetails()) + var baseURL string + if o.ServerURL == nil { + baseURL = utils.ReplaceParameters(s.sdkConfiguration.GetServerDetails()) + } else { + baseURL = *o.ServerURL + } opURL, err := url.JoinPath(baseURL, "/v1/keys.setPermissions") if err != nil { return nil, fmt.Errorf("error generating URL: %w", err) @@ -3526,6 +3621,10 @@ func (s *Keys) SetPermissions(ctx context.Context, request operations.SetPermiss return nil, err } + for k, v := range o.SetHeaders { + req.Header.Set(k, v) + } + globalRetryConfig := s.sdkConfiguration.RetryConfig retryConfig := o.Retries if retryConfig == nil { @@ -3837,7 +3936,12 @@ func (s *Keys) AddRoles(ctx context.Context, request operations.AddRolesRequestB } } - baseURL := utils.ReplaceParameters(s.sdkConfiguration.GetServerDetails()) + var baseURL string + if o.ServerURL == nil { + baseURL = utils.ReplaceParameters(s.sdkConfiguration.GetServerDetails()) + } else { + baseURL = *o.ServerURL + } opURL, err := url.JoinPath(baseURL, "/v1/keys.addRoles") if err != nil { return nil, fmt.Errorf("error generating URL: %w", err) @@ -3871,6 +3975,10 @@ func (s *Keys) AddRoles(ctx context.Context, request operations.AddRolesRequestB return nil, err } + for k, v := range o.SetHeaders { + req.Header.Set(k, v) + } + globalRetryConfig := s.sdkConfiguration.RetryConfig retryConfig := o.Retries if retryConfig == nil { @@ -4182,7 +4290,12 @@ func (s *Keys) RemoveRoles(ctx context.Context, request operations.RemoveRolesRe } } - baseURL := utils.ReplaceParameters(s.sdkConfiguration.GetServerDetails()) + var baseURL string + if o.ServerURL == nil { + baseURL = utils.ReplaceParameters(s.sdkConfiguration.GetServerDetails()) + } else { + baseURL = *o.ServerURL + } opURL, err := url.JoinPath(baseURL, "/v1/keys.removeRoles") if err != nil { return nil, fmt.Errorf("error generating URL: %w", err) @@ -4216,6 +4329,10 @@ func (s *Keys) RemoveRoles(ctx context.Context, request operations.RemoveRolesRe return nil, err } + for k, v := range o.SetHeaders { + req.Header.Set(k, v) + } + globalRetryConfig := s.sdkConfiguration.RetryConfig retryConfig := o.Retries if retryConfig == nil { @@ -4527,7 +4644,12 @@ func (s *Keys) SetRoles(ctx context.Context, request operations.SetRolesRequestB } } - baseURL := utils.ReplaceParameters(s.sdkConfiguration.GetServerDetails()) + var baseURL string + if o.ServerURL == nil { + baseURL = utils.ReplaceParameters(s.sdkConfiguration.GetServerDetails()) + } else { + baseURL = *o.ServerURL + } opURL, err := url.JoinPath(baseURL, "/v1/keys.setRoles") if err != nil { return nil, fmt.Errorf("error generating URL: %w", err) @@ -4561,6 +4683,10 @@ func (s *Keys) SetRoles(ctx context.Context, request operations.SetRolesRequestB return nil, err } + for k, v := range o.SetHeaders { + req.Header.Set(k, v) + } + globalRetryConfig := s.sdkConfiguration.RetryConfig retryConfig := o.Retries if retryConfig == nil { diff --git a/liveness.go b/liveness.go index f6e5f82..0a80d70 100644 --- a/liveness.go +++ b/liveness.go @@ -46,7 +46,12 @@ func (s *Liveness) V1Liveness(ctx context.Context, opts ...operations.Option) (* } } - baseURL := utils.ReplaceParameters(s.sdkConfiguration.GetServerDetails()) + var baseURL string + if o.ServerURL == nil { + baseURL = utils.ReplaceParameters(s.sdkConfiguration.GetServerDetails()) + } else { + baseURL = *o.ServerURL + } opURL, err := url.JoinPath(baseURL, "/v1/liveness") if err != nil { return nil, fmt.Errorf("error generating URL: %w", err) @@ -74,6 +79,10 @@ func (s *Liveness) V1Liveness(ctx context.Context, opts ...operations.Option) (* return nil, err } + for k, v := range o.SetHeaders { + req.Header.Set(k, v) + } + globalRetryConfig := s.sdkConfiguration.RetryConfig retryConfig := o.Retries if retryConfig == nil { diff --git a/migrations.go b/migrations.go index 49fdd6a..091d325 100644 --- a/migrations.go +++ b/migrations.go @@ -46,7 +46,12 @@ func (s *Migrations) V1MigrationsCreateKeys(ctx context.Context, request []opera } } - baseURL := utils.ReplaceParameters(s.sdkConfiguration.GetServerDetails()) + var baseURL string + if o.ServerURL == nil { + baseURL = utils.ReplaceParameters(s.sdkConfiguration.GetServerDetails()) + } else { + baseURL = *o.ServerURL + } opURL, err := url.JoinPath(baseURL, "/v1/migrations.createKeys") if err != nil { return nil, fmt.Errorf("error generating URL: %w", err) @@ -80,6 +85,10 @@ func (s *Migrations) V1MigrationsCreateKeys(ctx context.Context, request []opera return nil, err } + for k, v := range o.SetHeaders { + req.Header.Set(k, v) + } + globalRetryConfig := s.sdkConfiguration.RetryConfig retryConfig := o.Retries if retryConfig == nil { @@ -391,7 +400,12 @@ func (s *Migrations) V1MigrationsEnqueueKeys(ctx context.Context, request operat } } - baseURL := utils.ReplaceParameters(s.sdkConfiguration.GetServerDetails()) + var baseURL string + if o.ServerURL == nil { + baseURL = utils.ReplaceParameters(s.sdkConfiguration.GetServerDetails()) + } else { + baseURL = *o.ServerURL + } opURL, err := url.JoinPath(baseURL, "/v1/migrations.enqueueKeys") if err != nil { return nil, fmt.Errorf("error generating URL: %w", err) @@ -425,6 +439,10 @@ func (s *Migrations) V1MigrationsEnqueueKeys(ctx context.Context, request operat return nil, err } + for k, v := range o.SetHeaders { + req.Header.Set(k, v) + } + globalRetryConfig := s.sdkConfiguration.RetryConfig retryConfig := o.Retries if retryConfig == nil { diff --git a/models/components/permissionquery.go b/models/components/permissionquery.go index b98b875..14b93ff 100644 --- a/models/components/permissionquery.go +++ b/models/components/permissionquery.go @@ -40,9 +40,9 @@ const ( // PermissionQuery - A query for which permissions you require type PermissionQuery struct { - Str *string - And *And - Or *Or + Str *string `queryParam:"inline"` + And *And `queryParam:"inline"` + Or *Or `queryParam:"inline"` Type PermissionQueryType } diff --git a/models/components/v1keysverifykeyrequest.go b/models/components/v1keysverifykeyrequest.go index 4ce0cf6..3af12d8 100644 --- a/models/components/v1keysverifykeyrequest.go +++ b/models/components/v1keysverifykeyrequest.go @@ -101,6 +101,13 @@ type V1KeysVerifyKeyRequest struct { APIID *string `json:"apiId,omitempty"` // The key to verify Key string `json:"key"` + // Tags do not influence the outcome of a verification. + // They can be added to filter or aggregate historical verification data for your analytics needs. + // To unkey, a tag is simply a string, we don't enforce any schema but leave that up to you. + // The only exception is that each tag must be between 1 and 128 characters long. + // A typical setup would be to add key-value pairs of resources or locations, that you need later when querying. + // + Tags []string `json:"tags,omitempty"` // Perform RBAC checks Authorization *Authorization `json:"authorization,omitempty"` // Use 'ratelimits' with `[{ name: "default", cost: 2}]` @@ -126,6 +133,13 @@ func (o *V1KeysVerifyKeyRequest) GetKey() string { return o.Key } +func (o *V1KeysVerifyKeyRequest) GetTags() []string { + if o == nil { + return nil + } + return o.Tags +} + func (o *V1KeysVerifyKeyRequest) GetAuthorization() *Authorization { if o == nil { return nil diff --git a/models/operations/listkeys.go b/models/operations/listkeys.go index c7e6c49..2897429 100644 --- a/models/operations/listkeys.go +++ b/models/operations/listkeys.go @@ -82,7 +82,7 @@ type ListKeysResponseBody struct { Keys []components.Key `json:"keys"` // The cursor to use for the next page of results, if no cursor is returned, there are no more results Cursor *string `json:"cursor,omitempty"` - // The total number of keys for this api + // The total number of keys for this api. This is an approximation and may lag behind up to 5 minutes. Total int64 `json:"total"` } diff --git a/models/operations/options.go b/models/operations/options.go index 623eb19..99a40de 100644 --- a/models/operations/options.go +++ b/models/operations/options.go @@ -12,7 +12,6 @@ import ( var ErrUnsupportedOption = errors.New("unsupported option") const ( - SupportedOptionServerURL = "serverURL" SupportedOptionRetries = "retries" SupportedOptionTimeout = "timeout" SupportedOptionAcceptHeaderOverride = "acceptHeaderOverride" @@ -24,6 +23,7 @@ type Options struct { Retries *retry.Config Timeout *time.Duration URLOverride *string + SetHeaders map[string]string } type Option func(*Options, ...string) error @@ -31,10 +31,6 @@ type Option func(*Options, ...string) error // WithServerURL allows providing an alternative server URL. func WithServerURL(serverURL string) Option { return func(opts *Options, supportedOptions ...string) error { - if !utils.Contains(supportedOptions, SupportedOptionServerURL) { - return ErrUnsupportedOption - } - opts.ServerURL = &serverURL return nil } @@ -43,10 +39,6 @@ func WithServerURL(serverURL string) Option { // WithTemplatedServerURL allows providing an alternative server URL with templated parameters. func WithTemplatedServerURL(serverURL string, params map[string]string) Option { return func(opts *Options, supportedOptions ...string) error { - if !utils.Contains(supportedOptions, SupportedOptionServerURL) { - return ErrUnsupportedOption - } - if params != nil { serverURL = utils.ReplaceParameters(serverURL, params) } @@ -91,3 +83,12 @@ func WithURLOverride(urlOverride string) Option { return nil } } + +// WithSetHeaders takes a map of headers that will applied to a request. If the +// request contains headers that are in the map then they will be overwritten. +func WithSetHeaders(hdrs map[string]string) Option { + return func(opts *Options, supportedOptions ...string) error { + opts.SetHeaders = hdrs + return nil + } +} diff --git a/models/operations/ratelimitsetoverride.go b/models/operations/setoverride.go similarity index 63% rename from models/operations/ratelimitsetoverride.go rename to models/operations/setoverride.go index 0b676b8..b7463d6 100644 --- a/models/operations/ratelimitsetoverride.go +++ b/models/operations/setoverride.go @@ -7,7 +7,7 @@ import ( "github.com/unkeyed/unkey-go/models/components" ) -type RatelimitSetOverrideRequestBody struct { +type SetOverrideRequestBody struct { // The id of the namespace. Either namespaceId or namespaceName must be provided NamespaceID *string `json:"namespaceId,omitempty"` // Namespaces group different limits together for better analytics. You might have a namespace for your public API and one for internal tRPC routes. Wildcards can also be used, more info can be found at https://www.unkey.com/docs/ratelimiting/overrides#wildcard-rules @@ -22,86 +22,86 @@ type RatelimitSetOverrideRequestBody struct { Async *bool `default:"false" json:"async"` } -func (r RatelimitSetOverrideRequestBody) MarshalJSON() ([]byte, error) { - return utils.MarshalJSON(r, "", false) +func (s SetOverrideRequestBody) MarshalJSON() ([]byte, error) { + return utils.MarshalJSON(s, "", false) } -func (r *RatelimitSetOverrideRequestBody) UnmarshalJSON(data []byte) error { - if err := utils.UnmarshalJSON(data, &r, "", false, false); err != nil { +func (s *SetOverrideRequestBody) UnmarshalJSON(data []byte) error { + if err := utils.UnmarshalJSON(data, &s, "", false, false); err != nil { return err } return nil } -func (o *RatelimitSetOverrideRequestBody) GetNamespaceID() *string { +func (o *SetOverrideRequestBody) GetNamespaceID() *string { if o == nil { return nil } return o.NamespaceID } -func (o *RatelimitSetOverrideRequestBody) GetNamespaceName() *string { +func (o *SetOverrideRequestBody) GetNamespaceName() *string { if o == nil { return nil } return o.NamespaceName } -func (o *RatelimitSetOverrideRequestBody) GetIdentifier() string { +func (o *SetOverrideRequestBody) GetIdentifier() string { if o == nil { return "" } return o.Identifier } -func (o *RatelimitSetOverrideRequestBody) GetLimit() int64 { +func (o *SetOverrideRequestBody) GetLimit() int64 { if o == nil { return 0 } return o.Limit } -func (o *RatelimitSetOverrideRequestBody) GetDuration() int64 { +func (o *SetOverrideRequestBody) GetDuration() int64 { if o == nil { return 0 } return o.Duration } -func (o *RatelimitSetOverrideRequestBody) GetAsync() *bool { +func (o *SetOverrideRequestBody) GetAsync() *bool { if o == nil { return nil } return o.Async } -// RatelimitSetOverrideResponseBody - Sucessfully created a ratelimit override -type RatelimitSetOverrideResponseBody struct { +// SetOverrideResponseBody - Sucessfully created a ratelimit override +type SetOverrideResponseBody struct { // The id of the override. This is used internally OverrideID string `json:"overrideId"` } -func (o *RatelimitSetOverrideResponseBody) GetOverrideID() string { +func (o *SetOverrideResponseBody) GetOverrideID() string { if o == nil { return "" } return o.OverrideID } -type RatelimitSetOverrideResponse struct { +type SetOverrideResponse struct { HTTPMeta components.HTTPMetadata `json:"-"` // Sucessfully created a ratelimit override - Object *RatelimitSetOverrideResponseBody + Object *SetOverrideResponseBody } -func (o *RatelimitSetOverrideResponse) GetHTTPMeta() components.HTTPMetadata { +func (o *SetOverrideResponse) GetHTTPMeta() components.HTTPMetadata { if o == nil { return components.HTTPMetadata{} } return o.HTTPMeta } -func (o *RatelimitSetOverrideResponse) GetObject() *RatelimitSetOverrideResponseBody { +func (o *SetOverrideResponse) GetObject() *SetOverrideResponseBody { if o == nil { return nil } diff --git a/permissions.go b/permissions.go index d88149f..2f08edb 100644 --- a/permissions.go +++ b/permissions.go @@ -46,7 +46,12 @@ func (s *Permissions) CreatePermission(ctx context.Context, request operations.C } } - baseURL := utils.ReplaceParameters(s.sdkConfiguration.GetServerDetails()) + var baseURL string + if o.ServerURL == nil { + baseURL = utils.ReplaceParameters(s.sdkConfiguration.GetServerDetails()) + } else { + baseURL = *o.ServerURL + } opURL, err := url.JoinPath(baseURL, "/v1/permissions.createPermission") if err != nil { return nil, fmt.Errorf("error generating URL: %w", err) @@ -80,6 +85,10 @@ func (s *Permissions) CreatePermission(ctx context.Context, request operations.C return nil, err } + for k, v := range o.SetHeaders { + req.Header.Set(k, v) + } + globalRetryConfig := s.sdkConfiguration.RetryConfig retryConfig := o.Retries if retryConfig == nil { @@ -391,7 +400,12 @@ func (s *Permissions) DeletePermission(ctx context.Context, request operations.D } } - baseURL := utils.ReplaceParameters(s.sdkConfiguration.GetServerDetails()) + var baseURL string + if o.ServerURL == nil { + baseURL = utils.ReplaceParameters(s.sdkConfiguration.GetServerDetails()) + } else { + baseURL = *o.ServerURL + } opURL, err := url.JoinPath(baseURL, "/v1/permissions.deletePermission") if err != nil { return nil, fmt.Errorf("error generating URL: %w", err) @@ -425,6 +439,10 @@ func (s *Permissions) DeletePermission(ctx context.Context, request operations.D return nil, err } + for k, v := range o.SetHeaders { + req.Header.Set(k, v) + } + globalRetryConfig := s.sdkConfiguration.RetryConfig retryConfig := o.Retries if retryConfig == nil { @@ -736,7 +754,12 @@ func (s *Permissions) GetPermission(ctx context.Context, request operations.GetP } } - baseURL := utils.ReplaceParameters(s.sdkConfiguration.GetServerDetails()) + var baseURL string + if o.ServerURL == nil { + baseURL = utils.ReplaceParameters(s.sdkConfiguration.GetServerDetails()) + } else { + baseURL = *o.ServerURL + } opURL, err := url.JoinPath(baseURL, "/v1/permissions.getPermission") if err != nil { return nil, fmt.Errorf("error generating URL: %w", err) @@ -768,6 +791,10 @@ func (s *Permissions) GetPermission(ctx context.Context, request operations.GetP return nil, err } + for k, v := range o.SetHeaders { + req.Header.Set(k, v) + } + globalRetryConfig := s.sdkConfiguration.RetryConfig retryConfig := o.Retries if retryConfig == nil { @@ -1079,7 +1106,12 @@ func (s *Permissions) ListPermissions(ctx context.Context, opts ...operations.Op } } - baseURL := utils.ReplaceParameters(s.sdkConfiguration.GetServerDetails()) + var baseURL string + if o.ServerURL == nil { + baseURL = utils.ReplaceParameters(s.sdkConfiguration.GetServerDetails()) + } else { + baseURL = *o.ServerURL + } opURL, err := url.JoinPath(baseURL, "/v1/permissions.listPermissions") if err != nil { return nil, fmt.Errorf("error generating URL: %w", err) @@ -1107,6 +1139,10 @@ func (s *Permissions) ListPermissions(ctx context.Context, opts ...operations.Op return nil, err } + for k, v := range o.SetHeaders { + req.Header.Set(k, v) + } + globalRetryConfig := s.sdkConfiguration.RetryConfig retryConfig := o.Retries if retryConfig == nil { @@ -1418,7 +1454,12 @@ func (s *Permissions) CreateRole(ctx context.Context, request operations.CreateR } } - baseURL := utils.ReplaceParameters(s.sdkConfiguration.GetServerDetails()) + var baseURL string + if o.ServerURL == nil { + baseURL = utils.ReplaceParameters(s.sdkConfiguration.GetServerDetails()) + } else { + baseURL = *o.ServerURL + } opURL, err := url.JoinPath(baseURL, "/v1/permissions.createRole") if err != nil { return nil, fmt.Errorf("error generating URL: %w", err) @@ -1452,6 +1493,10 @@ func (s *Permissions) CreateRole(ctx context.Context, request operations.CreateR return nil, err } + for k, v := range o.SetHeaders { + req.Header.Set(k, v) + } + globalRetryConfig := s.sdkConfiguration.RetryConfig retryConfig := o.Retries if retryConfig == nil { @@ -1763,7 +1808,12 @@ func (s *Permissions) DeleteRole(ctx context.Context, request operations.DeleteR } } - baseURL := utils.ReplaceParameters(s.sdkConfiguration.GetServerDetails()) + var baseURL string + if o.ServerURL == nil { + baseURL = utils.ReplaceParameters(s.sdkConfiguration.GetServerDetails()) + } else { + baseURL = *o.ServerURL + } opURL, err := url.JoinPath(baseURL, "/v1/permissions.deleteRole") if err != nil { return nil, fmt.Errorf("error generating URL: %w", err) @@ -1797,6 +1847,10 @@ func (s *Permissions) DeleteRole(ctx context.Context, request operations.DeleteR return nil, err } + for k, v := range o.SetHeaders { + req.Header.Set(k, v) + } + globalRetryConfig := s.sdkConfiguration.RetryConfig retryConfig := o.Retries if retryConfig == nil { @@ -2108,7 +2162,12 @@ func (s *Permissions) GetRole(ctx context.Context, request operations.GetRoleReq } } - baseURL := utils.ReplaceParameters(s.sdkConfiguration.GetServerDetails()) + var baseURL string + if o.ServerURL == nil { + baseURL = utils.ReplaceParameters(s.sdkConfiguration.GetServerDetails()) + } else { + baseURL = *o.ServerURL + } opURL, err := url.JoinPath(baseURL, "/v1/permissions.getRole") if err != nil { return nil, fmt.Errorf("error generating URL: %w", err) @@ -2140,6 +2199,10 @@ func (s *Permissions) GetRole(ctx context.Context, request operations.GetRoleReq return nil, err } + for k, v := range o.SetHeaders { + req.Header.Set(k, v) + } + globalRetryConfig := s.sdkConfiguration.RetryConfig retryConfig := o.Retries if retryConfig == nil { @@ -2451,7 +2514,12 @@ func (s *Permissions) ListRoles(ctx context.Context, opts ...operations.Option) } } - baseURL := utils.ReplaceParameters(s.sdkConfiguration.GetServerDetails()) + var baseURL string + if o.ServerURL == nil { + baseURL = utils.ReplaceParameters(s.sdkConfiguration.GetServerDetails()) + } else { + baseURL = *o.ServerURL + } opURL, err := url.JoinPath(baseURL, "/v1/permissions.listRoles") if err != nil { return nil, fmt.Errorf("error generating URL: %w", err) @@ -2479,6 +2547,10 @@ func (s *Permissions) ListRoles(ctx context.Context, opts ...operations.Option) return nil, err } + for k, v := range o.SetHeaders { + req.Header.Set(k, v) + } + globalRetryConfig := s.sdkConfiguration.RetryConfig retryConfig := o.Retries if retryConfig == nil { diff --git a/ratelimit.go b/ratelimit.go index e028cc5..2f73b3a 100644 --- a/ratelimit.go +++ b/ratelimit.go @@ -26,10 +26,10 @@ func newRatelimit(sdkConfig sdkConfiguration) *Ratelimit { } } -func (s *Ratelimit) RatelimitSetOverride(ctx context.Context, request operations.RatelimitSetOverrideRequestBody, opts ...operations.Option) (*operations.RatelimitSetOverrideResponse, error) { +func (s *Ratelimit) SetOverride(ctx context.Context, request operations.SetOverrideRequestBody, opts ...operations.Option) (*operations.SetOverrideResponse, error) { hookCtx := hooks.HookContext{ Context: ctx, - OperationID: "ratelimit.setOverride", + OperationID: "setOverride", OAuth2Scopes: []string{}, SecuritySource: s.sdkConfiguration.Security, } @@ -46,7 +46,12 @@ func (s *Ratelimit) RatelimitSetOverride(ctx context.Context, request operations } } - baseURL := utils.ReplaceParameters(s.sdkConfiguration.GetServerDetails()) + var baseURL string + if o.ServerURL == nil { + baseURL = utils.ReplaceParameters(s.sdkConfiguration.GetServerDetails()) + } else { + baseURL = *o.ServerURL + } opURL, err := url.JoinPath(baseURL, "/v1/ratelimits.setOverride") if err != nil { return nil, fmt.Errorf("error generating URL: %w", err) @@ -80,6 +85,10 @@ func (s *Ratelimit) RatelimitSetOverride(ctx context.Context, request operations return nil, err } + for k, v := range o.SetHeaders { + req.Header.Set(k, v) + } + globalRetryConfig := s.sdkConfiguration.RetryConfig retryConfig := o.Retries if retryConfig == nil { @@ -175,7 +184,7 @@ func (s *Ratelimit) RatelimitSetOverride(ctx context.Context, request operations } } - res := &operations.RatelimitSetOverrideResponse{ + res := &operations.SetOverrideResponse{ HTTPMeta: components.HTTPMetadata{ Request: req, Response: httpRes, @@ -191,7 +200,7 @@ func (s *Ratelimit) RatelimitSetOverride(ctx context.Context, request operations return nil, err } - var out operations.RatelimitSetOverrideResponseBody + var out operations.SetOverrideResponseBody if err := utils.UnmarshalJsonFromResponseBody(bytes.NewBuffer(rawBody), &out, ""); err != nil { return nil, err } @@ -391,7 +400,12 @@ func (s *Ratelimit) ListOverrides(ctx context.Context, request operations.ListOv } } - baseURL := utils.ReplaceParameters(s.sdkConfiguration.GetServerDetails()) + var baseURL string + if o.ServerURL == nil { + baseURL = utils.ReplaceParameters(s.sdkConfiguration.GetServerDetails()) + } else { + baseURL = *o.ServerURL + } opURL, err := url.JoinPath(baseURL, "/v1/ratelimits.listOverrides") if err != nil { return nil, fmt.Errorf("error generating URL: %w", err) @@ -423,6 +437,10 @@ func (s *Ratelimit) ListOverrides(ctx context.Context, request operations.ListOv return nil, err } + for k, v := range o.SetHeaders { + req.Header.Set(k, v) + } + globalRetryConfig := s.sdkConfiguration.RetryConfig retryConfig := o.Retries if retryConfig == nil { @@ -734,7 +752,12 @@ func (s *Ratelimit) GetOverride(ctx context.Context, request operations.GetOverr } } - baseURL := utils.ReplaceParameters(s.sdkConfiguration.GetServerDetails()) + var baseURL string + if o.ServerURL == nil { + baseURL = utils.ReplaceParameters(s.sdkConfiguration.GetServerDetails()) + } else { + baseURL = *o.ServerURL + } opURL, err := url.JoinPath(baseURL, "/v1/ratelimits.getOverride") if err != nil { return nil, fmt.Errorf("error generating URL: %w", err) @@ -766,6 +789,10 @@ func (s *Ratelimit) GetOverride(ctx context.Context, request operations.GetOverr return nil, err } + for k, v := range o.SetHeaders { + req.Header.Set(k, v) + } + globalRetryConfig := s.sdkConfiguration.RetryConfig retryConfig := o.Retries if retryConfig == nil { diff --git a/ratelimits.go b/ratelimits.go index 210e99a..9d6c9d0 100644 --- a/ratelimits.go +++ b/ratelimits.go @@ -46,7 +46,12 @@ func (s *Ratelimits) Limit(ctx context.Context, request operations.LimitRequestB } } - baseURL := utils.ReplaceParameters(s.sdkConfiguration.GetServerDetails()) + var baseURL string + if o.ServerURL == nil { + baseURL = utils.ReplaceParameters(s.sdkConfiguration.GetServerDetails()) + } else { + baseURL = *o.ServerURL + } opURL, err := url.JoinPath(baseURL, "/v1/ratelimits.limit") if err != nil { return nil, fmt.Errorf("error generating URL: %w", err) @@ -80,6 +85,10 @@ func (s *Ratelimits) Limit(ctx context.Context, request operations.LimitRequestB return nil, err } + for k, v := range o.SetHeaders { + req.Header.Set(k, v) + } + globalRetryConfig := s.sdkConfiguration.RetryConfig retryConfig := o.Retries if retryConfig == nil { @@ -391,7 +400,12 @@ func (s *Ratelimits) DeleteOverride(ctx context.Context, request operations.Dele } } - baseURL := utils.ReplaceParameters(s.sdkConfiguration.GetServerDetails()) + var baseURL string + if o.ServerURL == nil { + baseURL = utils.ReplaceParameters(s.sdkConfiguration.GetServerDetails()) + } else { + baseURL = *o.ServerURL + } opURL, err := url.JoinPath(baseURL, "/v1/ratelimits.deleteOverride") if err != nil { return nil, fmt.Errorf("error generating URL: %w", err) @@ -425,6 +439,10 @@ func (s *Ratelimits) DeleteOverride(ctx context.Context, request operations.Dele return nil, err } + for k, v := range o.SetHeaders { + req.Header.Set(k, v) + } + globalRetryConfig := s.sdkConfiguration.RetryConfig retryConfig := o.Retries if retryConfig == nil { diff --git a/unkey.go b/unkey.go index 255e95a..f066f86 100644 --- a/unkey.go +++ b/unkey.go @@ -155,9 +155,9 @@ func New(opts ...SDKOption) *Unkey { sdkConfiguration: sdkConfiguration{ Language: "go", OpenAPIDocVersion: "1.0.0", - SDKVersion: "0.11.0", - GenVersion: "2.474.6", - UserAgent: "speakeasy-sdk/go 0.11.0 2.474.6 1.0.0 github.com/unkeyed/unkey-go", + SDKVersion: "0.12.0", + GenVersion: "2.484.0", + UserAgent: "speakeasy-sdk/go 0.12.0 2.484.0 1.0.0 github.com/unkeyed/unkey-go", Hooks: hooks.New(), }, }