diff --git a/.speakeasy/gen.lock b/.speakeasy/gen.lock index 721f65c..9c2de85 100755 --- a/.speakeasy/gen.lock +++ b/.speakeasy/gen.lock @@ -1,23 +1,23 @@ lockVersion: 2.0.0 id: 4fc4737a-135f-4840-8e6d-42a2b2a2884b management: - docChecksum: cb57c3e224d3fc744f0f42932b21be86 + docChecksum: 5c90969528e4ba20ca9e64ea3b1e6a95 docVersion: 1.0.0 - speakeasyVersion: 1.349.2 - generationVersion: 2.382.2 - releaseVersion: 0.8.8 - configChecksum: f26de192591b96f25f0f067caeea31f9 + speakeasyVersion: 1.352.2 + generationVersion: 2.385.2 + releaseVersion: 0.8.9 + configChecksum: 8faf54ef797f49985007dd8c70ffeccc repoURL: https://github.com/unkeyed/unkey-go.git installationURL: https://github.com/unkeyed/unkey-go features: go: additionalDependencies: 0.1.0 constsAndDefaults: 0.1.4 - core: 3.5.2 + core: 3.5.3 defaultEnabledRetries: 0.2.0 deprecations: 2.81.1 - envVarSecurityUsage: 0.2.1 - globalSecurity: 2.82.9 + envVarSecurityUsage: 0.2.2 + globalSecurity: 2.82.10 globalSecurityCallbacks: 0.1.0 globalSecurityFlattening: 0.1.0 globalServerURLs: 2.82.2 @@ -104,6 +104,7 @@ generatedFiles: - /models/sdkerrors/errconflict.go - /models/sdkerrors/errtoomanyrequests.go - /models/sdkerrors/errinternalservererror.go + - /models/sdkerrors/errdeleteprotected.go - docs/models/operations/services.md - docs/models/operations/v1livenessresponsebody.md - docs/models/operations/v1livenessresponse.md @@ -283,6 +284,9 @@ generatedFiles: - docs/models/sdkerrors/errinternalservererrorcode.md - docs/models/sdkerrors/errinternalservererrorerror.md - docs/models/sdkerrors/errinternalservererror.md + - docs/models/sdkerrors/errdeleteprotectedcode.md + - docs/models/sdkerrors/errdeleteprotectederror.md + - docs/models/sdkerrors/errdeleteprotected.md - docs/sdks/unkey/README.md - docs/models/operations/option.md - docs/sdks/liveness/README.md diff --git a/.speakeasy/gen.yaml b/.speakeasy/gen.yaml index b52994b..fbd2e5e 100755 --- a/.speakeasy/gen.yaml +++ b/.speakeasy/gen.yaml @@ -12,7 +12,7 @@ generation: auth: oAuth2ClientCredentialsEnabled: true go: - version: 0.8.8 + version: 0.8.9 additionalDependencies: {} allowUnknownFieldsInWeakUnions: false clientServerStatusCodesAsErrors: true diff --git a/.speakeasy/workflow.lock b/.speakeasy/workflow.lock index 2dee789..da92a1c 100644 --- a/.speakeasy/workflow.lock +++ b/.speakeasy/workflow.lock @@ -1,9 +1,9 @@ -speakeasyVersion: 1.349.2 +speakeasyVersion: 1.352.2 sources: openapi.json: sourceNamespace: openapi-json - sourceRevisionDigest: sha256:f225ea6bd7d6c1ade6d1e10208bffcdddd73dea45e231767363aba5443c4dca7 - sourceBlobDigest: sha256:1014c289c881c466ded581e22ff631cbfb3739af1c8e8665c887bcabae4b8344 + sourceRevisionDigest: sha256:6d6296b2170dd24191a23ec6f3088ffc07ae7a57ad0a6db9917b9bd9cd786a62 + sourceBlobDigest: sha256:3e1a62a3e16aee8f00a9561a45331b89a01fc8572c439b16fb15c99e33f67c77 tags: - latest - main @@ -11,8 +11,8 @@ targets: go: source: openapi.json sourceNamespace: openapi-json - sourceRevisionDigest: sha256:f225ea6bd7d6c1ade6d1e10208bffcdddd73dea45e231767363aba5443c4dca7 - sourceBlobDigest: sha256:1014c289c881c466ded581e22ff631cbfb3739af1c8e8665c887bcabae4b8344 + sourceRevisionDigest: sha256:6d6296b2170dd24191a23ec6f3088ffc07ae7a57ad0a6db9917b9bd9cd786a62 + sourceBlobDigest: sha256:3e1a62a3e16aee8f00a9561a45331b89a01fc8572c439b16fb15c99e33f67c77 outLocation: /github/workspace/repo workflow: workflowVersion: 1.0.0 diff --git a/README.md b/README.md index b9eeca6..4370e6c 100644 --- a/README.md +++ b/README.md @@ -27,12 +27,11 @@ import ( "context" unkeygo "github.com/unkeyed/unkey-go" "log" - "os" ) func main() { s := unkeygo.New( - unkeygo.WithSecurity(os.Getenv("BEARER_AUTH")), + unkeygo.WithSecurity(""), ) ctx := context.Background() @@ -135,12 +134,11 @@ import ( unkeygo "github.com/unkeyed/unkey-go" "github.com/unkeyed/unkey-go/models/sdkerrors" "log" - "os" ) func main() { s := unkeygo.New( - unkeygo.WithSecurity(os.Getenv("BEARER_AUTH")), + unkeygo.WithSecurity(""), ) ctx := context.Background() @@ -220,13 +218,12 @@ import ( "context" unkeygo "github.com/unkeyed/unkey-go" "log" - "os" ) func main() { s := unkeygo.New( unkeygo.WithServerIndex(0), - unkeygo.WithSecurity(os.Getenv("BEARER_AUTH")), + unkeygo.WithSecurity(""), ) ctx := context.Background() @@ -252,13 +249,12 @@ import ( "context" unkeygo "github.com/unkeyed/unkey-go" "log" - "os" ) func main() { s := unkeygo.New( unkeygo.WithServerURL("https://api.unkey.dev"), - unkeygo.WithSecurity(os.Getenv("BEARER_AUTH")), + unkeygo.WithSecurity(""), ) ctx := context.Background() @@ -322,12 +318,11 @@ import ( "context" unkeygo "github.com/unkeyed/unkey-go" "log" - "os" ) func main() { s := unkeygo.New( - unkeygo.WithSecurity(os.Getenv("BEARER_AUTH")), + unkeygo.WithSecurity(""), ) ctx := context.Background() @@ -364,12 +359,11 @@ import ( "github.com/unkeyed/unkey-go/retry" "log" "models/operations" - "os" ) func main() { s := unkeygo.New( - unkeygo.WithSecurity(os.Getenv("BEARER_AUTH")), + unkeygo.WithSecurity(""), ) ctx := context.Background() @@ -403,7 +397,6 @@ import ( unkeygo "github.com/unkeyed/unkey-go" "github.com/unkeyed/unkey-go/retry" "log" - "os" ) func main() { @@ -419,7 +412,7 @@ func main() { }, RetryConnectionErrors: false, }), - unkeygo.WithSecurity(os.Getenv("BEARER_AUTH")), + unkeygo.WithSecurity(""), ) ctx := context.Background() @@ -451,12 +444,11 @@ import ( unkeygo "github.com/unkeyed/unkey-go" "github.com/unkeyed/unkey-go/models/operations" "log" - "os" ) func main() { s := unkeygo.New( - unkeygo.WithSecurity(os.Getenv("BEARER_AUTH")), + unkeygo.WithSecurity(""), ) request := operations.ListIdentitiesRequest{ Limit: unkeygo.Int64(100), diff --git a/RELEASES.md b/RELEASES.md index 60c93f8..2a0c39b 100644 --- a/RELEASES.md +++ b/RELEASES.md @@ -188,4 +188,14 @@ Based on: ### Generated - [go v0.8.8] . ### Releases -- [Go v0.8.8] https://github.com/unkeyed/unkey-go/releases/tag/v0.8.8 - . \ No newline at end of file +- [Go v0.8.8] https://github.com/unkeyed/unkey-go/releases/tag/v0.8.8 - . + +## 2024-08-06 11:06:22 +### Changes +Based on: +- OpenAPI Doc +- Speakeasy CLI 1.352.2 (2.385.2) https://github.com/speakeasy-api/speakeasy +### Generated +- [go v0.8.9] . +### Releases +- [Go v0.8.9] https://github.com/unkeyed/unkey-go/releases/tag/v0.8.9 - . \ No newline at end of file diff --git a/USAGE.md b/USAGE.md index 3b32914..55e4a87 100644 --- a/USAGE.md +++ b/USAGE.md @@ -6,12 +6,11 @@ import ( "context" unkeygo "github.com/unkeyed/unkey-go" "log" - "os" ) func main() { s := unkeygo.New( - unkeygo.WithSecurity(os.Getenv("BEARER_AUTH")), + unkeygo.WithSecurity(""), ) ctx := context.Background() diff --git a/apis.go b/apis.go index 404baf9..c6b6dc0 100644 --- a/apis.go +++ b/apis.go @@ -1063,7 +1063,7 @@ func (s *Apis) DeleteAPI(ctx context.Context, request operations.DeleteAPIReques case httpRes.StatusCode == 429: switch { case utils.MatchContentType(httpRes.Header.Get("Content-Type"), `application/json`): - var out sdkerrors.ErrTooManyRequests + var out sdkerrors.ErrDeleteProtected if err := utils.UnmarshalJsonFromResponseBody(bytes.NewBuffer(rawBody), &out, ""); err != nil { return nil, err } diff --git a/docs/models/components/key.md b/docs/models/components/key.md index dc98043..7699b93 100644 --- a/docs/models/components/key.md +++ b/docs/models/components/key.md @@ -14,7 +14,6 @@ | `Meta` | map[string]*any* | :heavy_minus_sign: | Any additional metadata you want to store with the key | {
"roles": [
"admin",
"user"
],
"stripeCustomerId": "cus_1234"
} | | `CreatedAt` | *int64* | :heavy_check_mark: | The unix timestamp in milliseconds when the key was created | 0 | | `UpdatedAt` | **int64* | :heavy_minus_sign: | The unix timestamp in milliseconds when the key was last updated | 0 | -| `DeletedAt` | **int64* | :heavy_minus_sign: | The unix timestamp in milliseconds when the key was deleted. We don't delete the key outright, you can restore it later. | 0 | | `Expires` | **int64* | :heavy_minus_sign: | The unix timestamp in milliseconds when the key will expire. If this field is null or undefined, the key is not expiring. | 0 | | `Remaining` | **int64* | :heavy_minus_sign: | The number of requests that can be made with this key before it becomes invalid. If this field is null or undefined, the key has no request limit. | 1000 | | `Refill` | [*components.Refill](../../models/components/refill.md) | :heavy_minus_sign: | Unkey allows you to refill remaining verifications on a key on a regular interval. | {
"interval": "daily",
"amount": 10
} | diff --git a/docs/models/components/security.md b/docs/models/components/security.md index bd7a7eb..45c85dd 100644 --- a/docs/models/components/security.md +++ b/docs/models/components/security.md @@ -5,4 +5,4 @@ | Field | Type | Required | Description | | ------------------ | ------------------ | ------------------ | ------------------ | -| `BearerAuth` | **string* | :heavy_minus_sign: | N/A | \ No newline at end of file +| `BearerAuth` | *string* | :heavy_check_mark: | N/A | \ No newline at end of file diff --git a/docs/models/operations/createkeyrequestbody.md b/docs/models/operations/createkeyrequestbody.md index d88f007..68cfc03 100644 --- a/docs/models/operations/createkeyrequestbody.md +++ b/docs/models/operations/createkeyrequestbody.md @@ -19,4 +19,5 @@ | `Refill` | [*operations.Refill](../../models/operations/refill.md) | :heavy_minus_sign: | Unkey enables you to refill verifications for each key at regular intervals. | {
"interval": "daily",
"amount": 100
} | | `Ratelimit` | [*operations.Ratelimit](../../models/operations/ratelimit.md) | :heavy_minus_sign: | Unkey comes with per-key fixed-window ratelimiting out of the box. | {
"type": "fast",
"limit": 10,
"duration": 60000
} | | `Enabled` | **bool* | :heavy_minus_sign: | Sets if key is enabled or disabled. Disabled keys are not valid. | false | +| `Recoverable` | **bool* | :heavy_minus_sign: | You may want to show keys again later. While we do not recommend this, we leave this option open for you.

In addition to storing the key's hash, recoverable keys are stored in an encrypted vault, allowing you to retrieve and display the plaintext later.

https://www.unkey.com/docs/security/recovering-keys for more information. | | | `Environment` | **string* | :heavy_minus_sign: | Environments allow you to divide your keyspace.

Some applications like Stripe, Clerk, WorkOS and others have a concept of "live" and "test" keys to
give the developer a way to develop their own application without the risk of modifying real world
resources.

When you set an environment, we will return it back to you when validating the key, so you can
handle it correctly.
| | \ No newline at end of file diff --git a/docs/models/operations/deletekeysrequestbody.md b/docs/models/operations/deletekeysrequestbody.md index 86e359a..e6de1f3 100644 --- a/docs/models/operations/deletekeysrequestbody.md +++ b/docs/models/operations/deletekeysrequestbody.md @@ -3,7 +3,7 @@ ## Fields -| Field | Type | Required | Description | Example | -| ------------------------------------------------------------------------------------------------------------------ | ------------------------------------------------------------------------------------------------------------------ | ------------------------------------------------------------------------------------------------------------------ | ------------------------------------------------------------------------------------------------------------------ | ------------------------------------------------------------------------------------------------------------------ | -| `APIID` | *string* | :heavy_check_mark: | The id of the api, that the keys belong to. | api_1234 | -| `Permanent` | **bool* | :heavy_minus_sign: | If true, the keys will be permanently deleted. If false, the keys will be soft-deleted and can be restored later. | | \ No newline at end of file +| Field | Type | Required | Description | Example | +| --------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | --------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | --------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | --------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | --------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | +| `APIID` | *string* | :heavy_check_mark: | The id of the api, that the keys belong to. | api_1234 | +| `Permanent` | **bool* | :heavy_minus_sign: | Delete the keys permanently, if false the keys will be marked as deleted but not removed from the database. In either case, the keys will no longer be valid when verifying them. | | \ No newline at end of file diff --git a/docs/models/sdkerrors/errdeleteprotected.md b/docs/models/sdkerrors/errdeleteprotected.md new file mode 100644 index 0000000..e9fd317 --- /dev/null +++ b/docs/models/sdkerrors/errdeleteprotected.md @@ -0,0 +1,8 @@ +# ErrDeleteProtected + + +## Fields + +| Field | Type | Required | Description | +| -------------------------------------------------------------------------------------- | -------------------------------------------------------------------------------------- | -------------------------------------------------------------------------------------- | -------------------------------------------------------------------------------------- | +| `Error` | [sdkerrors.ErrDeleteProtectedError](../../models/sdkerrors/errdeleteprotectederror.md) | :heavy_check_mark: | N/A | \ No newline at end of file diff --git a/docs/models/sdkerrors/errdeleteprotectedcode.md b/docs/models/sdkerrors/errdeleteprotectedcode.md new file mode 100644 index 0000000..83931dc --- /dev/null +++ b/docs/models/sdkerrors/errdeleteprotectedcode.md @@ -0,0 +1,10 @@ +# ErrDeleteProtectedCode + +A machine readable error code. + + +## Values + +| Name | Value | +| --------------------------------------- | --------------------------------------- | +| `ErrDeleteProtectedCodeDeleteProtected` | DELETE_PROTECTED | \ No newline at end of file diff --git a/docs/models/sdkerrors/errdeleteprotectederror.md b/docs/models/sdkerrors/errdeleteprotectederror.md new file mode 100644 index 0000000..7da2de3 --- /dev/null +++ b/docs/models/sdkerrors/errdeleteprotectederror.md @@ -0,0 +1,11 @@ +# ErrDeleteProtectedError + + +## Fields + +| Field | Type | Required | Description | Example | +| ------------------------------------------------------------------------------------ | ------------------------------------------------------------------------------------ | ------------------------------------------------------------------------------------ | ------------------------------------------------------------------------------------ | ------------------------------------------------------------------------------------ | +| `Code` | [sdkerrors.ErrDeleteProtectedCode](../../models/sdkerrors/errdeleteprotectedcode.md) | :heavy_check_mark: | A machine readable error code. | DELETE_PROTECTED | +| `Docs` | *string* | :heavy_check_mark: | A link to our documentation with more details about this error code | https://unkey.dev/docs/api-reference/errors/code/DELETE_PROTECTED | +| `Message` | *string* | :heavy_check_mark: | A human readable explanation of what went wrong | | +| `RequestID` | *string* | :heavy_check_mark: | Please always include the requestId in your error report | req_1234 | \ No newline at end of file diff --git a/docs/sdks/apis/README.md b/docs/sdks/apis/README.md index e2331f2..6a0884a 100644 --- a/docs/sdks/apis/README.md +++ b/docs/sdks/apis/README.md @@ -17,7 +17,6 @@ package main import( - "os" unkeygo "github.com/unkeyed/unkey-go" "github.com/unkeyed/unkey-go/models/operations" "context" @@ -26,7 +25,7 @@ import( func main() { s := unkeygo.New( - unkeygo.WithSecurity(os.Getenv("BEARER_AUTH")), + unkeygo.WithSecurity(""), ) request := operations.GetAPIRequest{ APIID: "api_1234", @@ -73,7 +72,6 @@ func main() { package main import( - "os" unkeygo "github.com/unkeyed/unkey-go" "github.com/unkeyed/unkey-go/models/operations" "context" @@ -82,7 +80,7 @@ import( func main() { s := unkeygo.New( - unkeygo.WithSecurity(os.Getenv("BEARER_AUTH")), + unkeygo.WithSecurity(""), ) request := operations.CreateAPIRequestBody{ Name: "my-api", @@ -129,7 +127,6 @@ func main() { package main import( - "os" unkeygo "github.com/unkeyed/unkey-go" "github.com/unkeyed/unkey-go/models/operations" "context" @@ -138,7 +135,7 @@ import( func main() { s := unkeygo.New( - unkeygo.WithSecurity(os.Getenv("BEARER_AUTH")), + unkeygo.WithSecurity(""), ) request := operations.ListKeysRequest{ APIID: "api_1234", @@ -186,7 +183,6 @@ func main() { package main import( - "os" unkeygo "github.com/unkeyed/unkey-go" "github.com/unkeyed/unkey-go/models/operations" "context" @@ -195,7 +191,7 @@ import( func main() { s := unkeygo.New( - unkeygo.WithSecurity(os.Getenv("BEARER_AUTH")), + unkeygo.WithSecurity(""), ) request := operations.DeleteAPIRequestBody{ APIID: "api_1234", @@ -230,7 +226,7 @@ func main() { | sdkerrors.ErrForbidden | 403 | application/json | | sdkerrors.ErrNotFound | 404 | application/json | | sdkerrors.ErrConflict | 409 | application/json | -| sdkerrors.ErrTooManyRequests | 429 | application/json | +| sdkerrors.ErrDeleteProtected | 429 | application/json | | sdkerrors.ErrInternalServerError | 500 | application/json | | sdkerrors.SDKError | 4xx-5xx | */* | @@ -242,7 +238,6 @@ func main() { package main import( - "os" unkeygo "github.com/unkeyed/unkey-go" "github.com/unkeyed/unkey-go/models/operations" "context" @@ -251,7 +246,7 @@ import( func main() { s := unkeygo.New( - unkeygo.WithSecurity(os.Getenv("BEARER_AUTH")), + unkeygo.WithSecurity(""), ) request := operations.DeleteKeysRequestBody{ APIID: "api_1234", diff --git a/docs/sdks/identities/README.md b/docs/sdks/identities/README.md index 5c7a7fc..bd4df74 100644 --- a/docs/sdks/identities/README.md +++ b/docs/sdks/identities/README.md @@ -17,7 +17,6 @@ package main import( - "os" unkeygo "github.com/unkeyed/unkey-go" "github.com/unkeyed/unkey-go/models/operations" "context" @@ -26,7 +25,7 @@ import( func main() { s := unkeygo.New( - unkeygo.WithSecurity(os.Getenv("BEARER_AUTH")), + unkeygo.WithSecurity(""), ) request := operations.CreateIdentityRequestBody{ ExternalID: "user_123", @@ -80,7 +79,6 @@ func main() { package main import( - "os" unkeygo "github.com/unkeyed/unkey-go" "github.com/unkeyed/unkey-go/models/operations" "context" @@ -89,7 +87,7 @@ import( func main() { s := unkeygo.New( - unkeygo.WithSecurity(os.Getenv("BEARER_AUTH")), + unkeygo.WithSecurity(""), ) request := operations.GetIdentityRequest{ IdentityID: unkeygo.String("id_1234"), @@ -137,7 +135,6 @@ func main() { package main import( - "os" unkeygo "github.com/unkeyed/unkey-go" "github.com/unkeyed/unkey-go/models/operations" "context" @@ -146,7 +143,7 @@ import( func main() { s := unkeygo.New( - unkeygo.WithSecurity(os.Getenv("BEARER_AUTH")), + unkeygo.WithSecurity(""), ) request := operations.ListIdentitiesRequest{ Limit: unkeygo.Int64(100), @@ -206,7 +203,6 @@ func main() { package main import( - "os" unkeygo "github.com/unkeyed/unkey-go" "github.com/unkeyed/unkey-go/models/operations" "context" @@ -215,7 +211,7 @@ import( func main() { s := unkeygo.New( - unkeygo.WithSecurity(os.Getenv("BEARER_AUTH")), + unkeygo.WithSecurity(""), ) request := operations.UpdateIdentityRequestBody{ IdentityID: unkeygo.String("id_1234"), @@ -270,7 +266,6 @@ func main() { package main import( - "os" unkeygo "github.com/unkeyed/unkey-go" "github.com/unkeyed/unkey-go/models/operations" "context" @@ -279,7 +274,7 @@ import( func main() { s := unkeygo.New( - unkeygo.WithSecurity(os.Getenv("BEARER_AUTH")), + unkeygo.WithSecurity(""), ) request := operations.DeleteIdentityRequestBody{ IdentityID: "id_1234", diff --git a/docs/sdks/keys/README.md b/docs/sdks/keys/README.md index eb251a7..4c118a5 100644 --- a/docs/sdks/keys/README.md +++ b/docs/sdks/keys/README.md @@ -25,7 +25,6 @@ package main import( - "os" unkeygo "github.com/unkeyed/unkey-go" "github.com/unkeyed/unkey-go/models/operations" "context" @@ -34,7 +33,7 @@ import( func main() { s := unkeygo.New( - unkeygo.WithSecurity(os.Getenv("BEARER_AUTH")), + unkeygo.WithSecurity(""), ) request := operations.GetKeyRequest{ KeyID: "key_1234", @@ -81,7 +80,6 @@ func main() { package main import( - "os" unkeygo "github.com/unkeyed/unkey-go" "github.com/unkeyed/unkey-go/models/operations" "context" @@ -90,7 +88,7 @@ import( func main() { s := unkeygo.New( - unkeygo.WithSecurity(os.Getenv("BEARER_AUTH")), + unkeygo.WithSecurity(""), ) request := operations.DeleteKeyRequestBody{ KeyID: "key_1234", @@ -137,7 +135,6 @@ func main() { package main import( - "os" unkeygo "github.com/unkeyed/unkey-go" "github.com/unkeyed/unkey-go/models/operations" "context" @@ -146,7 +143,7 @@ import( func main() { s := unkeygo.New( - unkeygo.WithSecurity(os.Getenv("BEARER_AUTH")), + unkeygo.WithSecurity(""), ) request := operations.CreateKeyRequestBody{ APIID: "api_123", @@ -218,7 +215,6 @@ func main() { package main import( - "os" unkeygo "github.com/unkeyed/unkey-go" "github.com/unkeyed/unkey-go/models/components" "context" @@ -227,7 +223,7 @@ import( func main() { s := unkeygo.New( - unkeygo.WithSecurity(os.Getenv("BEARER_AUTH")), + unkeygo.WithSecurity(""), ) request := components.V1KeysVerifyKeyRequest{ APIID: unkeygo.String("api_1234"), @@ -287,7 +283,6 @@ func main() { package main import( - "os" unkeygo "github.com/unkeyed/unkey-go" "github.com/unkeyed/unkey-go/models/operations" "context" @@ -296,7 +291,7 @@ import( func main() { s := unkeygo.New( - unkeygo.WithSecurity(os.Getenv("BEARER_AUTH")), + unkeygo.WithSecurity(""), ) request := operations.UpdateKeyRequestBody{ KeyID: "key_123", @@ -388,7 +383,6 @@ func main() { package main import( - "os" unkeygo "github.com/unkeyed/unkey-go" "github.com/unkeyed/unkey-go/models/operations" "context" @@ -397,7 +391,7 @@ import( func main() { s := unkeygo.New( - unkeygo.WithSecurity(os.Getenv("BEARER_AUTH")), + unkeygo.WithSecurity(""), ) request := operations.UpdateRemainingRequestBody{ KeyID: "key_123", @@ -446,7 +440,6 @@ func main() { package main import( - "os" unkeygo "github.com/unkeyed/unkey-go" "github.com/unkeyed/unkey-go/models/operations" "context" @@ -455,7 +448,7 @@ import( func main() { s := unkeygo.New( - unkeygo.WithSecurity(os.Getenv("BEARER_AUTH")), + unkeygo.WithSecurity(""), ) request := operations.GetVerificationsRequest{ KeyID: unkeygo.String("key_1234"), @@ -506,7 +499,6 @@ func main() { package main import( - "os" unkeygo "github.com/unkeyed/unkey-go" "github.com/unkeyed/unkey-go/models/operations" "context" @@ -515,7 +507,7 @@ import( func main() { s := unkeygo.New( - unkeygo.WithSecurity(os.Getenv("BEARER_AUTH")), + unkeygo.WithSecurity(""), ) request := operations.AddPermissionsRequestBody{ KeyID: "", @@ -565,7 +557,6 @@ func main() { package main import( - "os" unkeygo "github.com/unkeyed/unkey-go" "github.com/unkeyed/unkey-go/models/operations" "context" @@ -574,7 +565,7 @@ import( func main() { s := unkeygo.New( - unkeygo.WithSecurity(os.Getenv("BEARER_AUTH")), + unkeygo.WithSecurity(""), ) request := operations.RemovePermissionsRequestBody{ KeyID: "", @@ -629,7 +620,6 @@ func main() { package main import( - "os" unkeygo "github.com/unkeyed/unkey-go" "github.com/unkeyed/unkey-go/models/operations" "context" @@ -638,7 +628,7 @@ import( func main() { s := unkeygo.New( - unkeygo.WithSecurity(os.Getenv("BEARER_AUTH")), + unkeygo.WithSecurity(""), ) request := operations.SetPermissionsRequestBody{ KeyID: "", @@ -697,7 +687,6 @@ func main() { package main import( - "os" unkeygo "github.com/unkeyed/unkey-go" "github.com/unkeyed/unkey-go/models/operations" "context" @@ -706,7 +695,7 @@ import( func main() { s := unkeygo.New( - unkeygo.WithSecurity(os.Getenv("BEARER_AUTH")), + unkeygo.WithSecurity(""), ) request := operations.AddRolesRequestBody{ KeyID: "", @@ -765,7 +754,6 @@ func main() { package main import( - "os" unkeygo "github.com/unkeyed/unkey-go" "github.com/unkeyed/unkey-go/models/operations" "context" @@ -774,7 +762,7 @@ import( func main() { s := unkeygo.New( - unkeygo.WithSecurity(os.Getenv("BEARER_AUTH")), + unkeygo.WithSecurity(""), ) request := operations.RemoveRolesRequestBody{ KeyID: "", @@ -829,7 +817,6 @@ func main() { package main import( - "os" unkeygo "github.com/unkeyed/unkey-go" "github.com/unkeyed/unkey-go/models/operations" "context" @@ -838,7 +825,7 @@ import( func main() { s := unkeygo.New( - unkeygo.WithSecurity(os.Getenv("BEARER_AUTH")), + unkeygo.WithSecurity(""), ) request := operations.SetRolesRequestBody{ KeyID: "", diff --git a/docs/sdks/liveness/README.md b/docs/sdks/liveness/README.md index 5ae295b..21a4741 100644 --- a/docs/sdks/liveness/README.md +++ b/docs/sdks/liveness/README.md @@ -13,7 +13,6 @@ package main import( - "os" unkeygo "github.com/unkeyed/unkey-go" "context" "log" @@ -21,7 +20,7 @@ import( func main() { s := unkeygo.New( - unkeygo.WithSecurity(os.Getenv("BEARER_AUTH")), + unkeygo.WithSecurity(""), ) ctx := context.Background() diff --git a/docs/sdks/migrations/README.md b/docs/sdks/migrations/README.md index a9e1ac2..0bfccbc 100644 --- a/docs/sdks/migrations/README.md +++ b/docs/sdks/migrations/README.md @@ -14,7 +14,6 @@ package main import( - "os" unkeygo "github.com/unkeyed/unkey-go" "github.com/unkeyed/unkey-go/models/operations" "context" @@ -23,7 +22,7 @@ import( func main() { s := unkeygo.New( - unkeygo.WithSecurity(os.Getenv("BEARER_AUTH")), + unkeygo.WithSecurity(""), ) request := []operations.RequestBody{ operations.RequestBody{ @@ -99,7 +98,6 @@ func main() { package main import( - "os" unkeygo "github.com/unkeyed/unkey-go" "github.com/unkeyed/unkey-go/models/operations" "context" @@ -108,7 +106,7 @@ import( func main() { s := unkeygo.New( - unkeygo.WithSecurity(os.Getenv("BEARER_AUTH")), + unkeygo.WithSecurity(""), ) request := operations.V1MigrationsEnqueueKeysRequestBody{ MigrationID: "", diff --git a/docs/sdks/permissions/README.md b/docs/sdks/permissions/README.md index 72c9bde..4815b22 100644 --- a/docs/sdks/permissions/README.md +++ b/docs/sdks/permissions/README.md @@ -20,7 +20,6 @@ package main import( - "os" unkeygo "github.com/unkeyed/unkey-go" "github.com/unkeyed/unkey-go/models/operations" "context" @@ -29,7 +28,7 @@ import( func main() { s := unkeygo.New( - unkeygo.WithSecurity(os.Getenv("BEARER_AUTH")), + unkeygo.WithSecurity(""), ) request := operations.CreatePermissionRequestBody{ Name: "record.write", @@ -77,7 +76,6 @@ func main() { package main import( - "os" unkeygo "github.com/unkeyed/unkey-go" "github.com/unkeyed/unkey-go/models/operations" "context" @@ -86,7 +84,7 @@ import( func main() { s := unkeygo.New( - unkeygo.WithSecurity(os.Getenv("BEARER_AUTH")), + unkeygo.WithSecurity(""), ) request := operations.DeletePermissionRequestBody{ PermissionID: "perm_123", @@ -133,7 +131,6 @@ func main() { package main import( - "os" unkeygo "github.com/unkeyed/unkey-go" "github.com/unkeyed/unkey-go/models/operations" "context" @@ -142,7 +139,7 @@ import( func main() { s := unkeygo.New( - unkeygo.WithSecurity(os.Getenv("BEARER_AUTH")), + unkeygo.WithSecurity(""), ) request := operations.GetPermissionRequest{ PermissionID: "perm_123", @@ -189,7 +186,6 @@ func main() { package main import( - "os" unkeygo "github.com/unkeyed/unkey-go" "context" "log" @@ -197,7 +193,7 @@ import( func main() { s := unkeygo.New( - unkeygo.WithSecurity(os.Getenv("BEARER_AUTH")), + unkeygo.WithSecurity(""), ) ctx := context.Background() @@ -241,7 +237,6 @@ func main() { package main import( - "os" unkeygo "github.com/unkeyed/unkey-go" "github.com/unkeyed/unkey-go/models/operations" "context" @@ -250,7 +245,7 @@ import( func main() { s := unkeygo.New( - unkeygo.WithSecurity(os.Getenv("BEARER_AUTH")), + unkeygo.WithSecurity(""), ) request := operations.CreateRoleRequestBody{ Name: "dns.records.manager", @@ -298,7 +293,6 @@ func main() { package main import( - "os" unkeygo "github.com/unkeyed/unkey-go" "github.com/unkeyed/unkey-go/models/operations" "context" @@ -307,7 +301,7 @@ import( func main() { s := unkeygo.New( - unkeygo.WithSecurity(os.Getenv("BEARER_AUTH")), + unkeygo.WithSecurity(""), ) request := operations.DeleteRoleRequestBody{ RoleID: "role_123", @@ -354,7 +348,6 @@ func main() { package main import( - "os" unkeygo "github.com/unkeyed/unkey-go" "github.com/unkeyed/unkey-go/models/operations" "context" @@ -363,7 +356,7 @@ import( func main() { s := unkeygo.New( - unkeygo.WithSecurity(os.Getenv("BEARER_AUTH")), + unkeygo.WithSecurity(""), ) request := operations.GetRoleRequest{ RoleID: "role_123", @@ -410,7 +403,6 @@ func main() { package main import( - "os" unkeygo "github.com/unkeyed/unkey-go" "context" "log" @@ -418,7 +410,7 @@ import( func main() { s := unkeygo.New( - unkeygo.WithSecurity(os.Getenv("BEARER_AUTH")), + unkeygo.WithSecurity(""), ) ctx := context.Background() diff --git a/docs/sdks/ratelimits/README.md b/docs/sdks/ratelimits/README.md index 2fbfc0d..2b91bea 100644 --- a/docs/sdks/ratelimits/README.md +++ b/docs/sdks/ratelimits/README.md @@ -13,7 +13,6 @@ package main import( - "os" unkeygo "github.com/unkeyed/unkey-go" "github.com/unkeyed/unkey-go/models/operations" "context" @@ -22,7 +21,7 @@ import( func main() { s := unkeygo.New( - unkeygo.WithSecurity(os.Getenv("BEARER_AUTH")), + unkeygo.WithSecurity(""), ) request := operations.LimitRequestBody{ Namespace: unkeygo.String("email.outbound"), diff --git a/models/components/key.go b/models/components/key.go index 6c8486c..b855c28 100644 --- a/models/components/key.go +++ b/models/components/key.go @@ -201,8 +201,6 @@ type Key struct { CreatedAt int64 `json:"createdAt"` // The unix timestamp in milliseconds when the key was last updated UpdatedAt *int64 `json:"updatedAt,omitempty"` - // The unix timestamp in milliseconds when the key was deleted. We don't delete the key outright, you can restore it later. - DeletedAt *int64 `json:"deletedAt,omitempty"` // The unix timestamp in milliseconds when the key will expire. If this field is null or undefined, the key is not expiring. Expires *int64 `json:"expires,omitempty"` // The number of requests that can be made with this key before it becomes invalid. If this field is null or undefined, the key has no request limit. @@ -286,13 +284,6 @@ func (o *Key) GetUpdatedAt() *int64 { return o.UpdatedAt } -func (o *Key) GetDeletedAt() *int64 { - if o == nil { - return nil - } - return o.DeletedAt -} - func (o *Key) GetExpires() *int64 { if o == nil { return nil diff --git a/models/components/security.go b/models/components/security.go index 7e32642..a4a64df 100644 --- a/models/components/security.go +++ b/models/components/security.go @@ -3,12 +3,12 @@ package components type Security struct { - BearerAuth *string `security:"scheme,type=http,subtype=bearer,name=Authorization"` + BearerAuth string `security:"scheme,type=http,subtype=bearer,name=Authorization"` } -func (o *Security) GetBearerAuth() *string { +func (o *Security) GetBearerAuth() string { if o == nil { - return nil + return "" } return o.BearerAuth } diff --git a/models/operations/createkey.go b/models/operations/createkey.go index 5166842..7c6a008 100644 --- a/models/operations/createkey.go +++ b/models/operations/createkey.go @@ -201,6 +201,12 @@ type CreateKeyRequestBody struct { Ratelimit *Ratelimit `json:"ratelimit,omitempty"` // Sets if key is enabled or disabled. Disabled keys are not valid. Enabled *bool `default:"true" json:"enabled"` + // You may want to show keys again later. While we do not recommend this, we leave this option open for you. + // + // In addition to storing the key's hash, recoverable keys are stored in an encrypted vault, allowing you to retrieve and display the plaintext later. + // + // https://www.unkey.com/docs/security/recovering-keys for more information. + Recoverable *bool `default:"false" json:"recoverable"` // Environments allow you to divide your keyspace. // // Some applications like Stripe, Clerk, WorkOS and others have a concept of "live" and "test" keys to @@ -322,6 +328,13 @@ func (o *CreateKeyRequestBody) GetEnabled() *bool { return o.Enabled } +func (o *CreateKeyRequestBody) GetRecoverable() *bool { + if o == nil { + return nil + } + return o.Recoverable +} + func (o *CreateKeyRequestBody) GetEnvironment() *string { if o == nil { return nil diff --git a/models/operations/deletekeys.go b/models/operations/deletekeys.go index 4568142..d77a9b2 100644 --- a/models/operations/deletekeys.go +++ b/models/operations/deletekeys.go @@ -10,7 +10,7 @@ import ( type DeleteKeysRequestBody struct { // The id of the api, that the keys belong to. APIID string `json:"apiId"` - // If true, the keys will be permanently deleted. If false, the keys will be soft-deleted and can be restored later. + // Delete the keys permanently, if false the keys will be marked as deleted but not removed from the database. In either case, the keys will no longer be valid when verifying them. Permanent *bool `default:"false" json:"permanent"` } diff --git a/models/sdkerrors/errdeleteprotected.go b/models/sdkerrors/errdeleteprotected.go new file mode 100644 index 0000000..1ea3341 --- /dev/null +++ b/models/sdkerrors/errdeleteprotected.go @@ -0,0 +1,82 @@ +// Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT. + +package sdkerrors + +import ( + "encoding/json" + "fmt" +) + +// ErrDeleteProtectedCode - A machine readable error code. +type ErrDeleteProtectedCode string + +const ( + ErrDeleteProtectedCodeDeleteProtected ErrDeleteProtectedCode = "DELETE_PROTECTED" +) + +func (e ErrDeleteProtectedCode) ToPointer() *ErrDeleteProtectedCode { + return &e +} +func (e *ErrDeleteProtectedCode) UnmarshalJSON(data []byte) error { + var v string + if err := json.Unmarshal(data, &v); err != nil { + return err + } + switch v { + case "DELETE_PROTECTED": + *e = ErrDeleteProtectedCode(v) + return nil + default: + return fmt.Errorf("invalid value for ErrDeleteProtectedCode: %v", v) + } +} + +type ErrDeleteProtectedError struct { + // A machine readable error code. + Code ErrDeleteProtectedCode `json:"code"` + // A link to our documentation with more details about this error code + Docs string `json:"docs"` + // A human readable explanation of what went wrong + Message string `json:"message"` + // Please always include the requestId in your error report + RequestID string `json:"requestId"` +} + +func (o *ErrDeleteProtectedError) GetCode() ErrDeleteProtectedCode { + if o == nil { + return ErrDeleteProtectedCode("") + } + return o.Code +} + +func (o *ErrDeleteProtectedError) GetDocs() string { + if o == nil { + return "" + } + return o.Docs +} + +func (o *ErrDeleteProtectedError) GetMessage() string { + if o == nil { + return "" + } + return o.Message +} + +func (o *ErrDeleteProtectedError) GetRequestID() string { + if o == nil { + return "" + } + return o.RequestID +} + +type ErrDeleteProtected struct { + Error_ ErrDeleteProtectedError `json:"error"` +} + +var _ error = &ErrDeleteProtected{} + +func (e *ErrDeleteProtected) Error() string { + data, _ := json.Marshal(e) + return string(data) +} diff --git a/unkey.go b/unkey.go index 8154d54..fce4ef0 100644 --- a/unkey.go +++ b/unkey.go @@ -118,7 +118,7 @@ func WithClient(client HTTPClient) SDKOption { // WithSecurity configures the SDK to use the provided security details func WithSecurity(bearerAuth string) SDKOption { return func(sdk *Unkey) { - security := components.Security{BearerAuth: &bearerAuth} + security := components.Security{BearerAuth: bearerAuth} sdk.sdkConfiguration.Security = utils.AsSecuritySource(&security) } } @@ -151,9 +151,9 @@ func New(opts ...SDKOption) *Unkey { sdkConfiguration: sdkConfiguration{ Language: "go", OpenAPIDocVersion: "1.0.0", - SDKVersion: "0.8.8", - GenVersion: "2.382.2", - UserAgent: "speakeasy-sdk/go 0.8.8 2.382.2 1.0.0 github.com/unkeyed/unkey-go", + SDKVersion: "0.8.9", + GenVersion: "2.385.2", + UserAgent: "speakeasy-sdk/go 0.8.9 2.385.2 1.0.0 github.com/unkeyed/unkey-go", Hooks: hooks.New(), }, }