diff --git a/.speakeasy/gen.lock b/.speakeasy/gen.lock index 567f583..f576bf3 100755 --- a/.speakeasy/gen.lock +++ b/.speakeasy/gen.lock @@ -1,12 +1,12 @@ lockVersion: 2.0.0 id: 4fc4737a-135f-4840-8e6d-42a2b2a2884b management: - docChecksum: 3188b1c3a0851732a5d0f06231f3b62d + docChecksum: 9de89c451e8671005cab21ac38d9b3db docVersion: 1.0.0 - speakeasyVersion: 1.299.6 + speakeasyVersion: 1.299.7 generationVersion: 2.338.12 - releaseVersion: 0.3.1 - configChecksum: a9aa36dc0f0b5fa4a5fd7a8b4424246b + releaseVersion: 0.4.0 + configChecksum: 8eb61f55e2b56ff6181a4780ec9f63c4 repoURL: https://github.com/unkeyed/unkey-go.git installationURL: https://github.com/unkeyed/unkey-go features: @@ -24,6 +24,7 @@ features: nullables: 0.1.0 responseFormat: 0.1.2 sdkHooks: 0.1.0 + unions: 2.85.8 generatedFiles: - liveness.go - keys.go @@ -68,6 +69,7 @@ generatedFiles: - /models/components/key.go - /models/components/v1keysverifykeyresponse.go - /models/components/v1keysverifykeyrequest.go + - /models/components/permissionquery.go - /models/components/security.go - /models/sdkerrors/errbadrequest.go - /models/sdkerrors/errunauthorized.go @@ -155,10 +157,12 @@ generatedFiles: - docs/models/components/v1keysverifykeyresponseratelimit.md - docs/models/components/code.md - docs/models/components/v1keysverifykeyresponse.md - - docs/models/components/permissions.md - docs/models/components/authorization.md - docs/models/components/v1keysverifykeyrequestratelimit.md - docs/models/components/v1keysverifykeyrequest.md + - docs/models/components/or.md + - docs/models/components/and.md + - docs/models/components/permissionquery.md - docs/models/components/security.md - docs/models/sdkerrors/code.md - docs/models/sdkerrors/error.md diff --git a/.speakeasy/gen.yaml b/.speakeasy/gen.yaml index 6abf1f6..dd8518e 100755 --- a/.speakeasy/gen.yaml +++ b/.speakeasy/gen.yaml @@ -12,7 +12,7 @@ generation: auth: oAuth2ClientCredentialsEnabled: true go: - version: 0.3.1 + version: 0.4.0 additionalDependencies: {} allowUnknownFieldsInWeakUnions: false clientServerStatusCodesAsErrors: true diff --git a/.speakeasy/workflow.lock b/.speakeasy/workflow.lock index 3c4871f..9548580 100644 --- a/.speakeasy/workflow.lock +++ b/.speakeasy/workflow.lock @@ -1,9 +1,9 @@ -speakeasyVersion: 1.299.6 +speakeasyVersion: 1.299.7 sources: openapi.json: sourceNamespace: openapi-json - sourceRevisionDigest: sha256:a2b5ad618b785ff72011e1081eedc6c8a8790b3447a31ad5ebad20c72acb2220 - sourceBlobDigest: sha256:ba213955d102f59e4c11f384d41944a4d09ab26aea94f8bfb5cee29e0156e7f5 + sourceRevisionDigest: sha256:1ff66fb7de69bdbce405cf9068cde2274e026dd7ef4ac631ebd415e1d6d40dab + sourceBlobDigest: sha256:b91be605a0ba5ed3c5414df48293072f345501d2df156802d24880a8c7bee650 tags: - latest - main @@ -11,8 +11,8 @@ targets: go: source: openapi.json sourceNamespace: openapi-json - sourceRevisionDigest: sha256:a2b5ad618b785ff72011e1081eedc6c8a8790b3447a31ad5ebad20c72acb2220 - sourceBlobDigest: sha256:ba213955d102f59e4c11f384d41944a4d09ab26aea94f8bfb5cee29e0156e7f5 + sourceRevisionDigest: sha256:1ff66fb7de69bdbce405cf9068cde2274e026dd7ef4ac631ebd415e1d6d40dab + sourceBlobDigest: sha256:b91be605a0ba5ed3c5414df48293072f345501d2df156802d24880a8c7bee650 outLocation: /github/workspace/repo workflow: workflowVersion: 1.0.0 diff --git a/RELEASES.md b/RELEASES.md index 2394318..322116a 100644 --- a/RELEASES.md +++ b/RELEASES.md @@ -58,4 +58,14 @@ Based on: ### Generated - [go v0.3.1] . ### Releases -- [Go v0.3.1] https://github.com/unkeyed/unkey-go/releases/tag/v0.3.1 - . \ No newline at end of file +- [Go v0.3.1] https://github.com/unkeyed/unkey-go/releases/tag/v0.3.1 - . + +## 2024-06-04 20:34:05 +### Changes +Based on: +- OpenAPI Doc +- Speakeasy CLI 1.299.7 (2.338.12) https://github.com/speakeasy-api/speakeasy +### Generated +- [go v0.4.0] . +### Releases +- [Go v0.4.0] https://github.com/unkeyed/unkey-go/releases/tag/v0.4.0 - . \ No newline at end of file diff --git a/docs/models/components/and.md b/docs/models/components/and.md new file mode 100644 index 0000000..0272300 --- /dev/null +++ b/docs/models/components/and.md @@ -0,0 +1,8 @@ +# And + + +## Fields + +| Field | Type | Required | Description | +| --------------------------------------------- | --------------------------------------------- | --------------------------------------------- | --------------------------------------------- | +| `And` | [][PermissionQuery](../../permissionquery.md) | :heavy_check_mark: | N/A | \ No newline at end of file diff --git a/docs/models/components/authorization.md b/docs/models/components/authorization.md index 7f948ff..72f8598 100644 --- a/docs/models/components/authorization.md +++ b/docs/models/components/authorization.md @@ -5,6 +5,6 @@ Perform RBAC checks ## Fields -| Field | Type | Required | Description | Example | -| ---------------------------------------------------------------------------- | ---------------------------------------------------------------------------- | ---------------------------------------------------------------------------- | ---------------------------------------------------------------------------- | ---------------------------------------------------------------------------- | -| `Permissions` | [*components.Permissions](../../models/components/permissions.md) | :heavy_minus_sign: | A query for which permissions you require | {
"or": [
{
"and": [
"dns.record.read",
"dns.record.update"
]
},
"admin"
]
} | \ No newline at end of file +| Field | Type | Required | Description | +| ------------------------------------------------------------------------- | ------------------------------------------------------------------------- | ------------------------------------------------------------------------- | ------------------------------------------------------------------------- | +| `Permissions` | [*components.PermissionQuery](../../models/components/permissionquery.md) | :heavy_minus_sign: | A query for which permissions you require | \ No newline at end of file diff --git a/docs/models/components/or.md b/docs/models/components/or.md new file mode 100644 index 0000000..506fc26 --- /dev/null +++ b/docs/models/components/or.md @@ -0,0 +1,8 @@ +# Or + + +## Fields + +| Field | Type | Required | Description | +| --------------------------------------------- | --------------------------------------------- | --------------------------------------------- | --------------------------------------------- | +| `Or` | [][PermissionQuery](../../permissionquery.md) | :heavy_check_mark: | N/A | \ No newline at end of file diff --git a/docs/models/components/permissionquery.md b/docs/models/components/permissionquery.md new file mode 100644 index 0000000..61e7d71 --- /dev/null +++ b/docs/models/components/permissionquery.md @@ -0,0 +1,25 @@ +# PermissionQuery + +A query for which permissions you require + + +## Supported Types + +### + +```go +permissionQuery := components.CreatePermissionQueryStr(string{/* values here */}) +``` + +### And + +```go +permissionQuery := components.CreatePermissionQueryAnd(components.And{/* values here */}) +``` + +### Or + +```go +permissionQuery := components.CreatePermissionQueryOr(components.Or{/* values here */}) +``` + diff --git a/docs/models/components/permissions.md b/docs/models/components/permissions.md deleted file mode 100644 index 10b0762..0000000 --- a/docs/models/components/permissions.md +++ /dev/null @@ -1,9 +0,0 @@ -# Permissions - -A query for which permissions you require - - -## Fields - -| Field | Type | Required | Description | -| ----------- | ----------- | ----------- | ----------- | \ No newline at end of file diff --git a/docs/sdks/keys/README.md b/docs/sdks/keys/README.md index 449adcf..dd58f88 100644 --- a/docs/sdks/keys/README.md +++ b/docs/sdks/keys/README.md @@ -219,9 +219,6 @@ func main() { request := components.V1KeysVerifyKeyRequest{ APIID: unkeygo.String("api_1234"), Key: "sk_1234", - Authorization: &components.Authorization{ - Permissions: &components.Permissions{}, - }, } ctx := context.Background() res, err := s.Keys.VerifyKey(ctx, request) diff --git a/models/components/permissionquery.go b/models/components/permissionquery.go new file mode 100644 index 0000000..a11e258 --- /dev/null +++ b/models/components/permissionquery.go @@ -0,0 +1,117 @@ +// Code generated by Speakeasy (https://speakeasyapi.dev). DO NOT EDIT. + +package components + +import ( + "errors" + "fmt" + "github.com/unkeyed/unkey-go/internal/utils" +) + +type Or struct { + Or []PermissionQuery `json:"or"` +} + +func (o *Or) GetOr() []PermissionQuery { + if o == nil { + return []PermissionQuery{} + } + return o.Or +} + +type And struct { + And []PermissionQuery `json:"and"` +} + +func (o *And) GetAnd() []PermissionQuery { + if o == nil { + return []PermissionQuery{} + } + return o.And +} + +type PermissionQueryType string + +const ( + PermissionQueryTypeStr PermissionQueryType = "str" + PermissionQueryTypeAnd PermissionQueryType = "And" + PermissionQueryTypeOr PermissionQueryType = "Or" +) + +// PermissionQuery - A query for which permissions you require +type PermissionQuery struct { + Str *string + And *And + Or *Or + + Type PermissionQueryType +} + +func CreatePermissionQueryStr(str string) PermissionQuery { + typ := PermissionQueryTypeStr + + return PermissionQuery{ + Str: &str, + Type: typ, + } +} + +func CreatePermissionQueryAnd(and And) PermissionQuery { + typ := PermissionQueryTypeAnd + + return PermissionQuery{ + And: &and, + Type: typ, + } +} + +func CreatePermissionQueryOr(or Or) PermissionQuery { + typ := PermissionQueryTypeOr + + return PermissionQuery{ + Or: &or, + Type: typ, + } +} + +func (u *PermissionQuery) UnmarshalJSON(data []byte) error { + + var and And = And{} + if err := utils.UnmarshalJSON(data, &and, "", true, true); err == nil { + u.And = &and + u.Type = PermissionQueryTypeAnd + return nil + } + + var or Or = Or{} + if err := utils.UnmarshalJSON(data, &or, "", true, true); err == nil { + u.Or = &or + u.Type = PermissionQueryTypeOr + return nil + } + + var str string = "" + if err := utils.UnmarshalJSON(data, &str, "", true, true); err == nil { + u.Str = &str + u.Type = PermissionQueryTypeStr + return nil + } + + return fmt.Errorf("could not unmarshal `%s` into any supported union types for PermissionQuery", string(data)) +} + +func (u PermissionQuery) MarshalJSON() ([]byte, error) { + if u.Str != nil { + return utils.MarshalJSON(u.Str, "", true) + } + + if u.And != nil { + return utils.MarshalJSON(u.And, "", true) + } + + if u.Or != nil { + return utils.MarshalJSON(u.Or, "", true) + } + + return nil, errors.New("could not marshal union type PermissionQuery: all fields are null") +} diff --git a/models/components/v1keysverifykeyrequest.go b/models/components/v1keysverifykeyrequest.go index dcbf9de..b78628d 100644 --- a/models/components/v1keysverifykeyrequest.go +++ b/models/components/v1keysverifykeyrequest.go @@ -6,17 +6,13 @@ import ( "github.com/unkeyed/unkey-go/internal/utils" ) -// Permissions - A query for which permissions you require -type Permissions struct { -} - // Authorization - Perform RBAC checks type Authorization struct { // A query for which permissions you require - Permissions *Permissions `json:"permissions,omitempty"` + Permissions *PermissionQuery `json:"permissions,omitempty"` } -func (o *Authorization) GetPermissions() *Permissions { +func (o *Authorization) GetPermissions() *PermissionQuery { if o == nil { return nil } diff --git a/unkey.go b/unkey.go index f5d5615..d0a69b7 100644 --- a/unkey.go +++ b/unkey.go @@ -145,9 +145,9 @@ func New(opts ...SDKOption) *Unkey { sdkConfiguration: sdkConfiguration{ Language: "go", OpenAPIDocVersion: "1.0.0", - SDKVersion: "0.3.1", + SDKVersion: "0.4.0", GenVersion: "2.338.12", - UserAgent: "speakeasy-sdk/go 0.3.1 2.338.12 1.0.0 github.com/unkeyed/unkey-go", + UserAgent: "speakeasy-sdk/go 0.4.0 2.338.12 1.0.0 github.com/unkeyed/unkey-go", Hooks: hooks.New(), }, }