diff --git a/.speakeasy/gen.lock b/.speakeasy/gen.lock
index 0f2fc1c..4afa83e 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: 547602f40f6ad29534bfdf081cab8873
+ docChecksum: 0785f5659b7521373ececdc3425c7efc
docVersion: 1.0.0
- speakeasyVersion: 1.326.0
- generationVersion: 2.359.0
- releaseVersion: 0.6.0
- configChecksum: 2a6062478c58c77a364cffd8940a8f10
+ speakeasyVersion: 1.330.0
+ generationVersion: 2.361.10
+ releaseVersion: 0.6.1
+ configChecksum: b411f7847c3a11ea34842f8b693e6fd0
repoURL: https://github.com/unkeyed/unkey-go.git
installationURL: https://github.com/unkeyed/unkey-go
features:
@@ -32,6 +32,7 @@ generatedFiles:
- apis.go
- ratelimits.go
- migrations.go
+ - permissions.go
- unkey.go
- go.mod
- models/sdkerrors/sdkerror.go
@@ -67,6 +68,14 @@ generatedFiles:
- /models/operations/limit.go
- /models/operations/v1migrationscreatekeys.go
- /models/operations/v1migrationsenqueuekeys.go
+ - /models/operations/createpermission.go
+ - /models/operations/deletepermission.go
+ - /models/operations/getpermission.go
+ - /models/operations/listpermissions.go
+ - /models/operations/createrole.go
+ - /models/operations/deleterole.go
+ - /models/operations/getrole.go
+ - /models/operations/listroles.go
- /models/components/httpmetadata.go
- /models/components/key.go
- /models/components/v1keysverifykeyresponse.go
@@ -150,6 +159,28 @@ generatedFiles:
- docs/models/operations/v1migrationsenqueuekeysrequestbody.md
- docs/models/operations/v1migrationsenqueuekeysresponsebody.md
- docs/models/operations/v1migrationsenqueuekeysresponse.md
+ - docs/models/operations/createpermissionrequestbody.md
+ - docs/models/operations/createpermissionresponsebody.md
+ - docs/models/operations/createpermissionresponse.md
+ - docs/models/operations/deletepermissionrequestbody.md
+ - docs/models/operations/deletepermissionresponsebody.md
+ - docs/models/operations/deletepermissionresponse.md
+ - docs/models/operations/getpermissionrequest.md
+ - docs/models/operations/getpermissionresponsebody.md
+ - docs/models/operations/getpermissionresponse.md
+ - docs/models/operations/responsebody.md
+ - docs/models/operations/listpermissionsresponse.md
+ - docs/models/operations/createrolerequestbody.md
+ - docs/models/operations/createroleresponsebody.md
+ - docs/models/operations/createroleresponse.md
+ - docs/models/operations/deleterolerequestbody.md
+ - docs/models/operations/deleteroleresponsebody.md
+ - docs/models/operations/deleteroleresponse.md
+ - docs/models/operations/getrolerequest.md
+ - docs/models/operations/getroleresponsebody.md
+ - docs/models/operations/getroleresponse.md
+ - docs/models/operations/listrolesresponsebody.md
+ - docs/models/operations/listrolesresponse.md
- docs/models/components/httpmetadata.md
- docs/models/components/interval.md
- docs/models/components/refill.md
@@ -195,6 +226,7 @@ generatedFiles:
- docs/sdks/apis/README.md
- docs/sdks/ratelimits/README.md
- docs/sdks/migrations/README.md
+ - docs/sdks/permissions/README.md
- USAGE.md
- models/operations/options.go
- .gitattributes
diff --git a/.speakeasy/gen.yaml b/.speakeasy/gen.yaml
index 7f16f13..f4a67ef 100755
--- a/.speakeasy/gen.yaml
+++ b/.speakeasy/gen.yaml
@@ -12,7 +12,7 @@ generation:
auth:
oAuth2ClientCredentialsEnabled: true
go:
- version: 0.6.0
+ version: 0.6.1
additionalDependencies: {}
allowUnknownFieldsInWeakUnions: false
clientServerStatusCodesAsErrors: true
diff --git a/.speakeasy/workflow.lock b/.speakeasy/workflow.lock
index 0450fec..0645072 100644
--- a/.speakeasy/workflow.lock
+++ b/.speakeasy/workflow.lock
@@ -1,9 +1,9 @@
-speakeasyVersion: 1.326.0
+speakeasyVersion: 1.330.0
sources:
openapi.json:
sourceNamespace: openapi-json
- sourceRevisionDigest: sha256:5755e12422b9cd83ab813c9d2ffd43a55d73bbbf981cbee7da4d4da7a0380903
- sourceBlobDigest: sha256:ef83f05349e97390bd3543fff7b29fb47c0067e347d53e75922e5e1c52d2b721
+ sourceRevisionDigest: sha256:5c12bae1c724729db89b905ce8cd7d30451db13721149eeb41b5538b0b93c1c7
+ sourceBlobDigest: sha256:24b012a381daa90eac68b5fc3ece8c6ec87883249492f438d669096c27465776
tags:
- latest
- main
@@ -11,8 +11,8 @@ targets:
go:
source: openapi.json
sourceNamespace: openapi-json
- sourceRevisionDigest: sha256:5755e12422b9cd83ab813c9d2ffd43a55d73bbbf981cbee7da4d4da7a0380903
- sourceBlobDigest: sha256:ef83f05349e97390bd3543fff7b29fb47c0067e347d53e75922e5e1c52d2b721
+ sourceRevisionDigest: sha256:5c12bae1c724729db89b905ce8cd7d30451db13721149eeb41b5538b0b93c1c7
+ sourceBlobDigest: sha256:24b012a381daa90eac68b5fc3ece8c6ec87883249492f438d669096c27465776
outLocation: /github/workspace/repo
workflow:
workflowVersion: 1.0.0
diff --git a/README.md b/README.md
index 6107d4a..3d690c9 100644
--- a/README.md
+++ b/README.md
@@ -84,6 +84,17 @@ func main() {
* [V1MigrationsCreateKeys](docs/sdks/migrations/README.md#v1migrationscreatekeys)
* [V1MigrationsEnqueueKeys](docs/sdks/migrations/README.md#v1migrationsenqueuekeys)
+
+### [Permissions](docs/sdks/permissions/README.md)
+
+* [CreatePermission](docs/sdks/permissions/README.md#createpermission)
+* [DeletePermission](docs/sdks/permissions/README.md#deletepermission)
+* [GetPermission](docs/sdks/permissions/README.md#getpermission)
+* [ListPermissions](docs/sdks/permissions/README.md#listpermissions)
+* [CreateRole](docs/sdks/permissions/README.md#createrole)
+* [DeleteRole](docs/sdks/permissions/README.md#deleterole)
+* [GetRole](docs/sdks/permissions/README.md#getrole)
+* [ListRoles](docs/sdks/permissions/README.md#listroles)
diff --git a/RELEASES.md b/RELEASES.md
index 723f573..c9b7a19 100644
--- a/RELEASES.md
+++ b/RELEASES.md
@@ -108,4 +108,14 @@ Based on:
### Generated
- [go v0.6.0] .
### Releases
-- [Go v0.6.0] https://github.com/unkeyed/unkey-go/releases/tag/v0.6.0 - .
\ No newline at end of file
+- [Go v0.6.0] https://github.com/unkeyed/unkey-go/releases/tag/v0.6.0 - .
+
+## 2024-07-09 08:11:33
+### Changes
+Based on:
+- OpenAPI Doc
+- Speakeasy CLI 1.330.0 (2.361.10) https://github.com/speakeasy-api/speakeasy
+### Generated
+- [go v0.6.1] .
+### Releases
+- [Go v0.6.1] https://github.com/unkeyed/unkey-go/releases/tag/v0.6.1 - .
\ No newline at end of file
diff --git a/docs/models/components/code.md b/docs/models/components/code.md
index a66e4a4..3b8f48b 100644
--- a/docs/models/components/code.md
+++ b/docs/models/components/code.md
@@ -10,6 +10,7 @@ Possible values are:
- UNAUTHORIZED: the key is not authorized
- DISABLED: the key is disabled
- INSUFFICIENT_PERMISSIONS: you do not have the required permissions to perform this action
+- EXPIRED: The key was only valid for a certain time and has expired.
@@ -24,4 +25,5 @@ Possible values are:
| `CodeRateLimited` | RATE_LIMITED |
| `CodeUnauthorized` | UNAUTHORIZED |
| `CodeDisabled` | DISABLED |
-| `CodeInsufficientPermissions` | INSUFFICIENT_PERMISSIONS |
\ No newline at end of file
+| `CodeInsufficientPermissions` | INSUFFICIENT_PERMISSIONS |
+| `CodeExpired` | EXPIRED |
\ No newline at end of file
diff --git a/docs/models/components/v1keysverifykeyresponse.md b/docs/models/components/v1keysverifykeyresponse.md
index 1405d3e..7f17490 100644
--- a/docs/models/components/v1keysverifykeyresponse.md
+++ b/docs/models/components/v1keysverifykeyresponse.md
@@ -3,17 +3,17 @@
## Fields
-| Field | Type | Required | Description | Example |
-| ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
-| `KeyID` | **string* | :heavy_minus_sign: | The id of the key | key_1234 |
-| `Valid` | *bool* | :heavy_check_mark: | Whether the key is valid or not.
A key could be invalid for a number of reasons, for example if it has expired, has no more verifications left or if it has been deleted. | true |
-| `Name` | **string* | :heavy_minus_sign: | The name of the key, give keys a name to easily identifiy their purpose | Customer X |
-| `OwnerID` | **string* | :heavy_minus_sign: | The id of the tenant associated with this key. Use whatever reference you have in your system to identify the tenant. When verifying the key, we will send this field back to you, so you know who is accessing your API. | user_123 |
-| `Meta` | map[string]*any* | :heavy_minus_sign: | Any additional metadata you want to store with the key | {
"roles": [
"admin",
"user"
],
"stripeCustomerId": "cus_1234"
} |
-| `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. | 123 |
-| `Ratelimit` | [*components.V1KeysVerifyKeyResponseRatelimit](../../models/components/v1keysverifykeyresponseratelimit.md) | :heavy_minus_sign: | Multi ratelimits TODO: | {
"limit": 10,
"remaining": 9,
"reset": 3600000
} |
-| `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 |
-| `Code` | [components.Code](../../models/components/code.md) | :heavy_check_mark: | A machine readable code why the key is not valid.
Possible values are:
- VALID: the key is valid and you should proceed
- NOT_FOUND: the key does not exist or has expired
- FORBIDDEN: the key is not allowed to access the api
- USAGE_EXCEEDED: the key has exceeded its request limit
- RATE_LIMITED: the key has been ratelimited
- UNAUTHORIZED: the key is not authorized
- DISABLED: the key is disabled
- INSUFFICIENT_PERMISSIONS: you do not have the required permissions to perform this action
| |
-| `Enabled` | **bool* | :heavy_minus_sign: | Sets the key to be enabled or disabled. Disabled keys will not verify. | |
-| `Permissions` | []*string* | :heavy_minus_sign: | A list of all the permissions this key is connected to. | [
"dns.record.update",
"dns.record.delete"
] |
-| `Environment` | **string* | :heavy_minus_sign: | The environment of the key, this is what what you set when you crated the key | test |
\ No newline at end of file
+| Field | Type | Required | Description | Example |
+| ----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | ----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | ----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | ----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | ----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
+| `KeyID` | **string* | :heavy_minus_sign: | The id of the key | key_1234 |
+| `Valid` | *bool* | :heavy_check_mark: | Whether the key is valid or not.
A key could be invalid for a number of reasons, for example if it has expired, has no more verifications left or if it has been deleted. | true |
+| `Name` | **string* | :heavy_minus_sign: | The name of the key, give keys a name to easily identifiy their purpose | Customer X |
+| `OwnerID` | **string* | :heavy_minus_sign: | The id of the tenant associated with this key. Use whatever reference you have in your system to identify the tenant. When verifying the key, we will send this field back to you, so you know who is accessing your API. | user_123 |
+| `Meta` | map[string]*any* | :heavy_minus_sign: | Any additional metadata you want to store with the key | {
"roles": [
"admin",
"user"
],
"stripeCustomerId": "cus_1234"
} |
+| `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. | 123 |
+| `Ratelimit` | [*components.V1KeysVerifyKeyResponseRatelimit](../../models/components/v1keysverifykeyresponseratelimit.md) | :heavy_minus_sign: | Multi ratelimits TODO: | {
"limit": 10,
"remaining": 9,
"reset": 3600000
} |
+| `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 |
+| `Code` | [components.Code](../../models/components/code.md) | :heavy_check_mark: | A machine readable code why the key is not valid.
Possible values are:
- VALID: the key is valid and you should proceed
- NOT_FOUND: the key does not exist or has expired
- FORBIDDEN: the key is not allowed to access the api
- USAGE_EXCEEDED: the key has exceeded its request limit
- RATE_LIMITED: the key has been ratelimited
- UNAUTHORIZED: the key is not authorized
- DISABLED: the key is disabled
- INSUFFICIENT_PERMISSIONS: you do not have the required permissions to perform this action
- EXPIRED: The key was only valid for a certain time and has expired.
| |
+| `Enabled` | **bool* | :heavy_minus_sign: | Sets the key to be enabled or disabled. Disabled keys will not verify. | |
+| `Permissions` | []*string* | :heavy_minus_sign: | A list of all the permissions this key is connected to. | [
"dns.record.update",
"dns.record.delete"
] |
+| `Environment` | **string* | :heavy_minus_sign: | The environment of the key, this is what what you set when you crated the key | test |
\ No newline at end of file
diff --git a/docs/models/operations/createpermissionrequestbody.md b/docs/models/operations/createpermissionrequestbody.md
new file mode 100644
index 0000000..87a393d
--- /dev/null
+++ b/docs/models/operations/createpermissionrequestbody.md
@@ -0,0 +1,9 @@
+# CreatePermissionRequestBody
+
+
+## Fields
+
+| Field | Type | Required | Description | Example |
+| -------------------------------------------------------------------------------------------- | -------------------------------------------------------------------------------------------- | -------------------------------------------------------------------------------------------- | -------------------------------------------------------------------------------------------- | -------------------------------------------------------------------------------------------- |
+| `Name` | *string* | :heavy_check_mark: | The unique name of your permission. | record.write |
+| `Description` | **string* | :heavy_minus_sign: | Explain what this permission does. This is just for your team, your users will not see this. | record.write can create new dns records for our domains. |
\ No newline at end of file
diff --git a/docs/models/operations/createpermissionresponse.md b/docs/models/operations/createpermissionresponse.md
new file mode 100644
index 0000000..1750e88
--- /dev/null
+++ b/docs/models/operations/createpermissionresponse.md
@@ -0,0 +1,9 @@
+# CreatePermissionResponse
+
+
+## Fields
+
+| Field | Type | Required | Description |
+| --------------------------------------------------------------------------------------------------- | --------------------------------------------------------------------------------------------------- | --------------------------------------------------------------------------------------------------- | --------------------------------------------------------------------------------------------------- |
+| `HTTPMeta` | [components.HTTPMetadata](../../models/components/httpmetadata.md) | :heavy_check_mark: | N/A |
+| `Object` | [*operations.CreatePermissionResponseBody](../../models/operations/createpermissionresponsebody.md) | :heavy_minus_sign: | Sucessfully created a permission |
\ No newline at end of file
diff --git a/docs/models/operations/createpermissionresponsebody.md b/docs/models/operations/createpermissionresponsebody.md
new file mode 100644
index 0000000..aa87127
--- /dev/null
+++ b/docs/models/operations/createpermissionresponsebody.md
@@ -0,0 +1,10 @@
+# CreatePermissionResponseBody
+
+Sucessfully created a permission
+
+
+## Fields
+
+| Field | Type | Required | Description | Example |
+| ------------------------------------------------- | ------------------------------------------------- | ------------------------------------------------- | ------------------------------------------------- | ------------------------------------------------- |
+| `PermissionID` | *string* | :heavy_check_mark: | The id of the permission. This is used internally | perm_123 |
\ No newline at end of file
diff --git a/docs/models/operations/createrolerequestbody.md b/docs/models/operations/createrolerequestbody.md
new file mode 100644
index 0000000..5e3c805
--- /dev/null
+++ b/docs/models/operations/createrolerequestbody.md
@@ -0,0 +1,9 @@
+# CreateRoleRequestBody
+
+
+## Fields
+
+| Field | Type | Required | Description | Example |
+| -------------------------------------------------------------------------------------- | -------------------------------------------------------------------------------------- | -------------------------------------------------------------------------------------- | -------------------------------------------------------------------------------------- | -------------------------------------------------------------------------------------- |
+| `Name` | *string* | :heavy_check_mark: | The unique name of your role. | dns.records.manager |
+| `Description` | **string* | :heavy_minus_sign: | Explain what this role does. This is just for your team, your users will not see this. | dns.records.manager can read and write dns records for our domains. |
\ No newline at end of file
diff --git a/docs/models/operations/createroleresponse.md b/docs/models/operations/createroleresponse.md
new file mode 100644
index 0000000..f2f11b7
--- /dev/null
+++ b/docs/models/operations/createroleresponse.md
@@ -0,0 +1,9 @@
+# CreateRoleResponse
+
+
+## Fields
+
+| Field | Type | Required | Description |
+| --------------------------------------------------------------------------------------- | --------------------------------------------------------------------------------------- | --------------------------------------------------------------------------------------- | --------------------------------------------------------------------------------------- |
+| `HTTPMeta` | [components.HTTPMetadata](../../models/components/httpmetadata.md) | :heavy_check_mark: | N/A |
+| `Object` | [*operations.CreateRoleResponseBody](../../models/operations/createroleresponsebody.md) | :heavy_minus_sign: | Sucessfully created a role |
\ No newline at end of file
diff --git a/docs/models/operations/createroleresponsebody.md b/docs/models/operations/createroleresponsebody.md
new file mode 100644
index 0000000..406ef8e
--- /dev/null
+++ b/docs/models/operations/createroleresponsebody.md
@@ -0,0 +1,10 @@
+# CreateRoleResponseBody
+
+Sucessfully created a role
+
+
+## Fields
+
+| Field | Type | Required | Description | Example |
+| ------------------------------------------- | ------------------------------------------- | ------------------------------------------- | ------------------------------------------- | ------------------------------------------- |
+| `RoleID` | *string* | :heavy_check_mark: | The id of the role. This is used internally | role_123 |
\ No newline at end of file
diff --git a/docs/models/operations/deletepermissionrequestbody.md b/docs/models/operations/deletepermissionrequestbody.md
new file mode 100644
index 0000000..dc6c15a
--- /dev/null
+++ b/docs/models/operations/deletepermissionrequestbody.md
@@ -0,0 +1,8 @@
+# DeletePermissionRequestBody
+
+
+## Fields
+
+| Field | Type | Required | Description | Example |
+| -------------------------------------------- | -------------------------------------------- | -------------------------------------------- | -------------------------------------------- | -------------------------------------------- |
+| `PermissionID` | *string* | :heavy_check_mark: | The id of the permission you want to delete. | perm_123 |
\ No newline at end of file
diff --git a/docs/models/operations/deletepermissionresponse.md b/docs/models/operations/deletepermissionresponse.md
new file mode 100644
index 0000000..6c7ac80
--- /dev/null
+++ b/docs/models/operations/deletepermissionresponse.md
@@ -0,0 +1,9 @@
+# DeletePermissionResponse
+
+
+## Fields
+
+| Field | Type | Required | Description |
+| --------------------------------------------------------------------------------------------------- | --------------------------------------------------------------------------------------------------- | --------------------------------------------------------------------------------------------------- | --------------------------------------------------------------------------------------------------- |
+| `HTTPMeta` | [components.HTTPMetadata](../../models/components/httpmetadata.md) | :heavy_check_mark: | N/A |
+| `Object` | [*operations.DeletePermissionResponseBody](../../models/operations/deletepermissionresponsebody.md) | :heavy_minus_sign: | Sucessfully deleted a permission |
\ No newline at end of file
diff --git a/docs/models/operations/deletepermissionresponsebody.md b/docs/models/operations/deletepermissionresponsebody.md
new file mode 100644
index 0000000..7c2beb7
--- /dev/null
+++ b/docs/models/operations/deletepermissionresponsebody.md
@@ -0,0 +1,9 @@
+# DeletePermissionResponseBody
+
+Sucessfully deleted a permission
+
+
+## Fields
+
+| Field | Type | Required | Description |
+| ----------- | ----------- | ----------- | ----------- |
\ No newline at end of file
diff --git a/docs/models/operations/deleterolerequestbody.md b/docs/models/operations/deleterolerequestbody.md
new file mode 100644
index 0000000..865bfa2
--- /dev/null
+++ b/docs/models/operations/deleterolerequestbody.md
@@ -0,0 +1,8 @@
+# DeleteRoleRequestBody
+
+
+## Fields
+
+| Field | Type | Required | Description | Example |
+| -------------------------------------- | -------------------------------------- | -------------------------------------- | -------------------------------------- | -------------------------------------- |
+| `RoleID` | *string* | :heavy_check_mark: | The id of the role you want to delete. | role_123 |
\ No newline at end of file
diff --git a/docs/models/operations/deleteroleresponse.md b/docs/models/operations/deleteroleresponse.md
new file mode 100644
index 0000000..f81b251
--- /dev/null
+++ b/docs/models/operations/deleteroleresponse.md
@@ -0,0 +1,9 @@
+# DeleteRoleResponse
+
+
+## Fields
+
+| Field | Type | Required | Description |
+| --------------------------------------------------------------------------------------- | --------------------------------------------------------------------------------------- | --------------------------------------------------------------------------------------- | --------------------------------------------------------------------------------------- |
+| `HTTPMeta` | [components.HTTPMetadata](../../models/components/httpmetadata.md) | :heavy_check_mark: | N/A |
+| `Object` | [*operations.DeleteRoleResponseBody](../../models/operations/deleteroleresponsebody.md) | :heavy_minus_sign: | Sucessfully deleted a role |
\ No newline at end of file
diff --git a/docs/models/operations/deleteroleresponsebody.md b/docs/models/operations/deleteroleresponsebody.md
new file mode 100644
index 0000000..4178286
--- /dev/null
+++ b/docs/models/operations/deleteroleresponsebody.md
@@ -0,0 +1,9 @@
+# DeleteRoleResponseBody
+
+Sucessfully deleted a role
+
+
+## Fields
+
+| Field | Type | Required | Description |
+| ----------- | ----------- | ----------- | ----------- |
\ No newline at end of file
diff --git a/docs/models/operations/getpermissionrequest.md b/docs/models/operations/getpermissionrequest.md
new file mode 100644
index 0000000..82bf63a
--- /dev/null
+++ b/docs/models/operations/getpermissionrequest.md
@@ -0,0 +1,8 @@
+# GetPermissionRequest
+
+
+## Fields
+
+| Field | Type | Required | Description | Example |
+| ------------------ | ------------------ | ------------------ | ------------------ | ------------------ |
+| `PermissionID` | *string* | :heavy_check_mark: | N/A | perm_123 |
\ No newline at end of file
diff --git a/docs/models/operations/getpermissionresponse.md b/docs/models/operations/getpermissionresponse.md
new file mode 100644
index 0000000..9a226ea
--- /dev/null
+++ b/docs/models/operations/getpermissionresponse.md
@@ -0,0 +1,9 @@
+# GetPermissionResponse
+
+
+## Fields
+
+| Field | Type | Required | Description |
+| --------------------------------------------------------------------------------------------- | --------------------------------------------------------------------------------------------- | --------------------------------------------------------------------------------------------- | --------------------------------------------------------------------------------------------- |
+| `HTTPMeta` | [components.HTTPMetadata](../../models/components/httpmetadata.md) | :heavy_check_mark: | N/A |
+| `Object` | [*operations.GetPermissionResponseBody](../../models/operations/getpermissionresponsebody.md) | :heavy_minus_sign: | The Role |
\ No newline at end of file
diff --git a/docs/models/operations/getpermissionresponsebody.md b/docs/models/operations/getpermissionresponsebody.md
new file mode 100644
index 0000000..3090200
--- /dev/null
+++ b/docs/models/operations/getpermissionresponsebody.md
@@ -0,0 +1,12 @@
+# GetPermissionResponseBody
+
+The Role
+
+
+## Fields
+
+| Field | Type | Required | Description | Example |
+| ------------------------------------------------------------------------------------------------------- | ------------------------------------------------------------------------------------------------------- | ------------------------------------------------------------------------------------------------------- | ------------------------------------------------------------------------------------------------------- | ------------------------------------------------------------------------------------------------------- |
+| `ID` | *string* | :heavy_check_mark: | The id of the permission | perm_123 |
+| `Name` | *string* | :heavy_check_mark: | The name of the permission. | domain.record.manager |
+| `Description` | **string* | :heavy_minus_sign: | The description of what this permission does. This is just for your team, your users will not see this. | Can manage dns records |
\ No newline at end of file
diff --git a/docs/models/operations/getrolerequest.md b/docs/models/operations/getrolerequest.md
new file mode 100644
index 0000000..54394c1
--- /dev/null
+++ b/docs/models/operations/getrolerequest.md
@@ -0,0 +1,8 @@
+# GetRoleRequest
+
+
+## Fields
+
+| Field | Type | Required | Description | Example |
+| ------------------ | ------------------ | ------------------ | ------------------ | ------------------ |
+| `RoleID` | *string* | :heavy_check_mark: | N/A | role_123 |
\ No newline at end of file
diff --git a/docs/models/operations/getroleresponse.md b/docs/models/operations/getroleresponse.md
new file mode 100644
index 0000000..8483df3
--- /dev/null
+++ b/docs/models/operations/getroleresponse.md
@@ -0,0 +1,9 @@
+# GetRoleResponse
+
+
+## Fields
+
+| Field | Type | Required | Description |
+| --------------------------------------------------------------------------------- | --------------------------------------------------------------------------------- | --------------------------------------------------------------------------------- | --------------------------------------------------------------------------------- |
+| `HTTPMeta` | [components.HTTPMetadata](../../models/components/httpmetadata.md) | :heavy_check_mark: | N/A |
+| `Object` | [*operations.GetRoleResponseBody](../../models/operations/getroleresponsebody.md) | :heavy_minus_sign: | The Role |
\ No newline at end of file
diff --git a/docs/models/operations/getroleresponsebody.md b/docs/models/operations/getroleresponsebody.md
new file mode 100644
index 0000000..945db1d
--- /dev/null
+++ b/docs/models/operations/getroleresponsebody.md
@@ -0,0 +1,12 @@
+# GetRoleResponseBody
+
+The Role
+
+
+## Fields
+
+| Field | Type | Required | Description | Example |
+| ------------------------------------------------------------------------------------------------- | ------------------------------------------------------------------------------------------------- | ------------------------------------------------------------------------------------------------- | ------------------------------------------------------------------------------------------------- | ------------------------------------------------------------------------------------------------- |
+| `ID` | *string* | :heavy_check_mark: | The id of the role | role_1234 |
+| `Name` | *string* | :heavy_check_mark: | The name of the role. | domain.record.manager |
+| `Description` | **string* | :heavy_minus_sign: | The description of what this role does. This is just for your team, your users will not see this. | Can manage dns records |
\ No newline at end of file
diff --git a/docs/models/operations/listpermissionsresponse.md b/docs/models/operations/listpermissionsresponse.md
new file mode 100644
index 0000000..03f280b
--- /dev/null
+++ b/docs/models/operations/listpermissionsresponse.md
@@ -0,0 +1,9 @@
+# ListPermissionsResponse
+
+
+## Fields
+
+| Field | Type | Required | Description |
+| -------------------------------------------------------------------- | -------------------------------------------------------------------- | -------------------------------------------------------------------- | -------------------------------------------------------------------- |
+| `HTTPMeta` | [components.HTTPMetadata](../../models/components/httpmetadata.md) | :heavy_check_mark: | N/A |
+| `ResponseBodies` | [][operations.ResponseBody](../../models/operations/responsebody.md) | :heavy_minus_sign: | The permissions in your workspace |
\ No newline at end of file
diff --git a/docs/models/operations/listrolesresponse.md b/docs/models/operations/listrolesresponse.md
new file mode 100644
index 0000000..9749076
--- /dev/null
+++ b/docs/models/operations/listrolesresponse.md
@@ -0,0 +1,9 @@
+# ListRolesResponse
+
+
+## Fields
+
+| Field | Type | Required | Description |
+| -------------------------------------------------------------------------------------- | -------------------------------------------------------------------------------------- | -------------------------------------------------------------------------------------- | -------------------------------------------------------------------------------------- |
+| `HTTPMeta` | [components.HTTPMetadata](../../models/components/httpmetadata.md) | :heavy_check_mark: | N/A |
+| `ResponseBodies` | [][operations.ListRolesResponseBody](../../models/operations/listrolesresponsebody.md) | :heavy_minus_sign: | The Roles in your workspace |
\ No newline at end of file
diff --git a/docs/models/operations/listrolesresponsebody.md b/docs/models/operations/listrolesresponsebody.md
new file mode 100644
index 0000000..36a979e
--- /dev/null
+++ b/docs/models/operations/listrolesresponsebody.md
@@ -0,0 +1,10 @@
+# ListRolesResponseBody
+
+
+## Fields
+
+| Field | Type | Required | Description | Example |
+| ------------------------------------------------------------------------------------------------- | ------------------------------------------------------------------------------------------------- | ------------------------------------------------------------------------------------------------- | ------------------------------------------------------------------------------------------------- | ------------------------------------------------------------------------------------------------- |
+| `ID` | *string* | :heavy_check_mark: | The id of the role | role_1234 |
+| `Name` | *string* | :heavy_check_mark: | The name of the role. | domain.record.manager |
+| `Description` | **string* | :heavy_minus_sign: | The description of what this role does. This is just for your team, your users will not see this. | Can manage dns records |
\ No newline at end of file
diff --git a/docs/models/operations/responsebody.md b/docs/models/operations/responsebody.md
new file mode 100644
index 0000000..e876aff
--- /dev/null
+++ b/docs/models/operations/responsebody.md
@@ -0,0 +1,10 @@
+# ResponseBody
+
+
+## Fields
+
+| Field | Type | Required | Description | Example |
+| ------------------------------------------------------------------------------------------------------- | ------------------------------------------------------------------------------------------------------- | ------------------------------------------------------------------------------------------------------- | ------------------------------------------------------------------------------------------------------- | ------------------------------------------------------------------------------------------------------- |
+| `ID` | *string* | :heavy_check_mark: | The id of the permission | perm_123 |
+| `Name` | *string* | :heavy_check_mark: | The name of the permission. | domain.record.manager |
+| `Description` | **string* | :heavy_minus_sign: | The description of what this permission does. This is just for your team, your users will not see this. | Can manage dns records |
\ No newline at end of file
diff --git a/docs/models/operations/updatekeyratelimit.md b/docs/models/operations/updatekeyratelimit.md
index 07b001e..d68af43 100644
--- a/docs/models/operations/updatekeyratelimit.md
+++ b/docs/models/operations/updatekeyratelimit.md
@@ -5,11 +5,11 @@ Unkey comes with per-key ratelimiting out of the box. Set `null` to disable.
## Fields
-| Field | Type | Required | Description |
-| --------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | --------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | --------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | --------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
-| ~~`Type`~~ | [*operations.UpdateKeyType](../../models/operations/updatekeytype.md) | :heavy_minus_sign: | : warning: ** DEPRECATED **: This will be removed in a future release, please migrate away from it as soon as possible.
Fast ratelimiting doesn't add latency, while consistent ratelimiting is more accurate.
[Learn more](https://unkey.dev/docs/features/ratelimiting) |
-| `Async` | **bool* | :heavy_minus_sign: | Asnyc ratelimiting doesn't add latency, while sync ratelimiting is more accurate.
[Learn more](https://unkey.dev/docs/features/ratelimiting) |
-| `Limit` | *int64* | :heavy_check_mark: | The total amount of burstable requests. |
-| ~~`RefillRate`~~ | **int64* | :heavy_minus_sign: | : warning: ** DEPRECATED **: This will be removed in a future release, please migrate away from it as soon as possible.
How many tokens to refill during each refillInterval. |
-| `RefillInterval` | *int64* | :heavy_check_mark: | Determines the speed at which tokens are refilled, in milliseconds. |
-| `Duration` | **int64* | :heavy_minus_sign: | The duration of each ratelimit window, in milliseconds. |
\ No newline at end of file
+| Field | Type | Required | Description |
+| ----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | ----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | ----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | ----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
+| ~~`Type`~~ | [*operations.UpdateKeyType](../../models/operations/updatekeytype.md) | :heavy_minus_sign: | : warning: ** DEPRECATED **: This will be removed in a future release, please migrate away from it as soon as possible.
Fast ratelimiting doesn't add latency, while consistent ratelimiting is more accurate.
Deprecated, use 'async' instead
[Learn more](https://unkey.dev/docs/features/ratelimiting) |
+| `Async` | **bool* | :heavy_minus_sign: | Asnyc ratelimiting doesn't add latency, while sync ratelimiting is slightly more accurate.
[Learn more](https://unkey.dev/docs/features/ratelimiting) |
+| `Limit` | *int64* | :heavy_check_mark: | The total amount of requests allowed in a single window. |
+| ~~`RefillRate`~~ | **int64* | :heavy_minus_sign: | : warning: ** DEPRECATED **: This will be removed in a future release, please migrate away from it as soon as possible.
How many tokens to refill during each refillInterval.
Deprecated, use 'limit' instead. |
+| ~~`RefillInterval`~~ | **int64* | :heavy_minus_sign: | : warning: ** DEPRECATED **: This will be removed in a future release, please migrate away from it as soon as possible.
Determines the speed at which tokens are refilled, in milliseconds.
Deprecated, use 'duration' |
+| `Duration` | **int64* | :heavy_minus_sign: | The duration of each ratelimit window, in milliseconds.
This field will become required in a future version. |
\ No newline at end of file
diff --git a/docs/models/operations/updatekeytype.md b/docs/models/operations/updatekeytype.md
index 1eb7f6b..9414ce3 100644
--- a/docs/models/operations/updatekeytype.md
+++ b/docs/models/operations/updatekeytype.md
@@ -1,6 +1,7 @@
# ~~UpdateKeyType~~
Fast ratelimiting doesn't add latency, while consistent ratelimiting is more accurate.
+Deprecated, use 'async' instead
Learn more
diff --git a/docs/sdks/keys/README.md b/docs/sdks/keys/README.md
index 46ee155..ee520d9 100644
--- a/docs/sdks/keys/README.md
+++ b/docs/sdks/keys/README.md
@@ -295,7 +295,7 @@ func main() {
Ratelimit: &operations.UpdateKeyRatelimit{
Limit: 10,
RefillRate: unkeygo.Int64(1),
- RefillInterval: 60,
+ RefillInterval: unkeygo.Int64(60),
},
Remaining: unkeygo.Float64(1000),
Refill: &operations.UpdateKeyRefill{
diff --git a/docs/sdks/permissions/README.md b/docs/sdks/permissions/README.md
new file mode 100644
index 0000000..4815b22
--- /dev/null
+++ b/docs/sdks/permissions/README.md
@@ -0,0 +1,447 @@
+# Permissions
+(*Permissions*)
+
+### Available Operations
+
+* [CreatePermission](#createpermission)
+* [DeletePermission](#deletepermission)
+* [GetPermission](#getpermission)
+* [ListPermissions](#listpermissions)
+* [CreateRole](#createrole)
+* [DeleteRole](#deleterole)
+* [GetRole](#getrole)
+* [ListRoles](#listroles)
+
+## CreatePermission
+
+### Example Usage
+
+```go
+package main
+
+import(
+ unkeygo "github.com/unkeyed/unkey-go"
+ "github.com/unkeyed/unkey-go/models/operations"
+ "context"
+ "log"
+)
+
+func main() {
+ s := unkeygo.New(
+ unkeygo.WithSecurity(""),
+ )
+ request := operations.CreatePermissionRequestBody{
+ Name: "record.write",
+ Description: unkeygo.String("record.write can create new dns records for our domains."),
+ }
+ ctx := context.Background()
+ res, err := s.Permissions.CreatePermission(ctx, request)
+ if err != nil {
+ log.Fatal(err)
+ }
+ if res.Object != nil {
+ // handle response
+ }
+}
+```
+
+### 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.CreatePermissionRequestBody](../../models/operations/createpermissionrequestbody.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.CreatePermissionResponse](../../models/operations/createpermissionresponse.md), error**
+| Error Object | Status Code | Content Type |
+| -------------------------------- | -------------------------------- | -------------------------------- |
+| sdkerrors.ErrBadRequest | 400 | application/json |
+| sdkerrors.ErrUnauthorized | 401 | application/json |
+| sdkerrors.ErrForbidden | 403 | application/json |
+| sdkerrors.ErrNotFound | 404 | application/json |
+| sdkerrors.ErrConflict | 409 | application/json |
+| sdkerrors.ErrTooManyRequests | 429 | application/json |
+| sdkerrors.ErrInternalServerError | 500 | application/json |
+| sdkerrors.SDKError | 4xx-5xx | */* |
+
+## DeletePermission
+
+### Example Usage
+
+```go
+package main
+
+import(
+ unkeygo "github.com/unkeyed/unkey-go"
+ "github.com/unkeyed/unkey-go/models/operations"
+ "context"
+ "log"
+)
+
+func main() {
+ s := unkeygo.New(
+ unkeygo.WithSecurity(""),
+ )
+ request := operations.DeletePermissionRequestBody{
+ PermissionID: "perm_123",
+ }
+ ctx := context.Background()
+ res, err := s.Permissions.DeletePermission(ctx, request)
+ if err != nil {
+ log.Fatal(err)
+ }
+ if res.Object != nil {
+ // handle response
+ }
+}
+```
+
+### 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.DeletePermissionRequestBody](../../models/operations/deletepermissionrequestbody.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.DeletePermissionResponse](../../models/operations/deletepermissionresponse.md), error**
+| Error Object | Status Code | Content Type |
+| -------------------------------- | -------------------------------- | -------------------------------- |
+| sdkerrors.ErrBadRequest | 400 | application/json |
+| sdkerrors.ErrUnauthorized | 401 | application/json |
+| sdkerrors.ErrForbidden | 403 | application/json |
+| sdkerrors.ErrNotFound | 404 | application/json |
+| sdkerrors.ErrConflict | 409 | application/json |
+| sdkerrors.ErrTooManyRequests | 429 | application/json |
+| sdkerrors.ErrInternalServerError | 500 | application/json |
+| sdkerrors.SDKError | 4xx-5xx | */* |
+
+## GetPermission
+
+### Example Usage
+
+```go
+package main
+
+import(
+ unkeygo "github.com/unkeyed/unkey-go"
+ "github.com/unkeyed/unkey-go/models/operations"
+ "context"
+ "log"
+)
+
+func main() {
+ s := unkeygo.New(
+ unkeygo.WithSecurity(""),
+ )
+ request := operations.GetPermissionRequest{
+ PermissionID: "perm_123",
+ }
+ ctx := context.Background()
+ res, err := s.Permissions.GetPermission(ctx, request)
+ if err != nil {
+ log.Fatal(err)
+ }
+ if res.Object != nil {
+ // handle response
+ }
+}
+```
+
+### 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.GetPermissionRequest](../../models/operations/getpermissionrequest.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.GetPermissionResponse](../../models/operations/getpermissionresponse.md), error**
+| Error Object | Status Code | Content Type |
+| -------------------------------- | -------------------------------- | -------------------------------- |
+| sdkerrors.ErrBadRequest | 400 | application/json |
+| sdkerrors.ErrUnauthorized | 401 | application/json |
+| sdkerrors.ErrForbidden | 403 | application/json |
+| sdkerrors.ErrNotFound | 404 | application/json |
+| sdkerrors.ErrConflict | 409 | application/json |
+| sdkerrors.ErrTooManyRequests | 429 | application/json |
+| sdkerrors.ErrInternalServerError | 500 | application/json |
+| sdkerrors.SDKError | 4xx-5xx | */* |
+
+## ListPermissions
+
+### Example Usage
+
+```go
+package main
+
+import(
+ unkeygo "github.com/unkeyed/unkey-go"
+ "context"
+ "log"
+)
+
+func main() {
+ s := unkeygo.New(
+ unkeygo.WithSecurity(""),
+ )
+
+ ctx := context.Background()
+ res, err := s.Permissions.ListPermissions(ctx)
+ if err != nil {
+ log.Fatal(err)
+ }
+ if res.ResponseBodies != nil {
+ // handle response
+ }
+}
+```
+
+### Parameters
+
+| Parameter | Type | Required | Description |
+| -------------------------------------------------------- | -------------------------------------------------------- | -------------------------------------------------------- | -------------------------------------------------------- |
+| `ctx` | [context.Context](https://pkg.go.dev/context#Context) | :heavy_check_mark: | The context to use for the request. |
+| `opts` | [][operations.Option](../../models/operations/option.md) | :heavy_minus_sign: | The options for this request. |
+
+
+### Response
+
+**[*operations.ListPermissionsResponse](../../models/operations/listpermissionsresponse.md), error**
+| Error Object | Status Code | Content Type |
+| -------------------------------- | -------------------------------- | -------------------------------- |
+| sdkerrors.ErrBadRequest | 400 | application/json |
+| sdkerrors.ErrUnauthorized | 401 | application/json |
+| sdkerrors.ErrForbidden | 403 | application/json |
+| sdkerrors.ErrNotFound | 404 | application/json |
+| sdkerrors.ErrConflict | 409 | application/json |
+| sdkerrors.ErrTooManyRequests | 429 | application/json |
+| sdkerrors.ErrInternalServerError | 500 | application/json |
+| sdkerrors.SDKError | 4xx-5xx | */* |
+
+## CreateRole
+
+### Example Usage
+
+```go
+package main
+
+import(
+ unkeygo "github.com/unkeyed/unkey-go"
+ "github.com/unkeyed/unkey-go/models/operations"
+ "context"
+ "log"
+)
+
+func main() {
+ s := unkeygo.New(
+ unkeygo.WithSecurity(""),
+ )
+ request := operations.CreateRoleRequestBody{
+ Name: "dns.records.manager",
+ Description: unkeygo.String("dns.records.manager can read and write dns records for our domains."),
+ }
+ ctx := context.Background()
+ res, err := s.Permissions.CreateRole(ctx, request)
+ if err != nil {
+ log.Fatal(err)
+ }
+ if res.Object != nil {
+ // handle response
+ }
+}
+```
+
+### 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.CreateRoleRequestBody](../../models/operations/createrolerequestbody.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.CreateRoleResponse](../../models/operations/createroleresponse.md), error**
+| Error Object | Status Code | Content Type |
+| -------------------------------- | -------------------------------- | -------------------------------- |
+| sdkerrors.ErrBadRequest | 400 | application/json |
+| sdkerrors.ErrUnauthorized | 401 | application/json |
+| sdkerrors.ErrForbidden | 403 | application/json |
+| sdkerrors.ErrNotFound | 404 | application/json |
+| sdkerrors.ErrConflict | 409 | application/json |
+| sdkerrors.ErrTooManyRequests | 429 | application/json |
+| sdkerrors.ErrInternalServerError | 500 | application/json |
+| sdkerrors.SDKError | 4xx-5xx | */* |
+
+## DeleteRole
+
+### Example Usage
+
+```go
+package main
+
+import(
+ unkeygo "github.com/unkeyed/unkey-go"
+ "github.com/unkeyed/unkey-go/models/operations"
+ "context"
+ "log"
+)
+
+func main() {
+ s := unkeygo.New(
+ unkeygo.WithSecurity(""),
+ )
+ request := operations.DeleteRoleRequestBody{
+ RoleID: "role_123",
+ }
+ ctx := context.Background()
+ res, err := s.Permissions.DeleteRole(ctx, request)
+ if err != nil {
+ log.Fatal(err)
+ }
+ if res.Object != nil {
+ // handle response
+ }
+}
+```
+
+### 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.DeleteRoleRequestBody](../../models/operations/deleterolerequestbody.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.DeleteRoleResponse](../../models/operations/deleteroleresponse.md), error**
+| Error Object | Status Code | Content Type |
+| -------------------------------- | -------------------------------- | -------------------------------- |
+| sdkerrors.ErrBadRequest | 400 | application/json |
+| sdkerrors.ErrUnauthorized | 401 | application/json |
+| sdkerrors.ErrForbidden | 403 | application/json |
+| sdkerrors.ErrNotFound | 404 | application/json |
+| sdkerrors.ErrConflict | 409 | application/json |
+| sdkerrors.ErrTooManyRequests | 429 | application/json |
+| sdkerrors.ErrInternalServerError | 500 | application/json |
+| sdkerrors.SDKError | 4xx-5xx | */* |
+
+## GetRole
+
+### Example Usage
+
+```go
+package main
+
+import(
+ unkeygo "github.com/unkeyed/unkey-go"
+ "github.com/unkeyed/unkey-go/models/operations"
+ "context"
+ "log"
+)
+
+func main() {
+ s := unkeygo.New(
+ unkeygo.WithSecurity(""),
+ )
+ request := operations.GetRoleRequest{
+ RoleID: "role_123",
+ }
+ ctx := context.Background()
+ res, err := s.Permissions.GetRole(ctx, request)
+ if err != nil {
+ log.Fatal(err)
+ }
+ if res.Object != nil {
+ // handle response
+ }
+}
+```
+
+### 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.GetRoleRequest](../../models/operations/getrolerequest.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.GetRoleResponse](../../models/operations/getroleresponse.md), error**
+| Error Object | Status Code | Content Type |
+| -------------------------------- | -------------------------------- | -------------------------------- |
+| sdkerrors.ErrBadRequest | 400 | application/json |
+| sdkerrors.ErrUnauthorized | 401 | application/json |
+| sdkerrors.ErrForbidden | 403 | application/json |
+| sdkerrors.ErrNotFound | 404 | application/json |
+| sdkerrors.ErrConflict | 409 | application/json |
+| sdkerrors.ErrTooManyRequests | 429 | application/json |
+| sdkerrors.ErrInternalServerError | 500 | application/json |
+| sdkerrors.SDKError | 4xx-5xx | */* |
+
+## ListRoles
+
+### Example Usage
+
+```go
+package main
+
+import(
+ unkeygo "github.com/unkeyed/unkey-go"
+ "context"
+ "log"
+)
+
+func main() {
+ s := unkeygo.New(
+ unkeygo.WithSecurity(""),
+ )
+
+ ctx := context.Background()
+ res, err := s.Permissions.ListRoles(ctx)
+ if err != nil {
+ log.Fatal(err)
+ }
+ if res.ResponseBodies != nil {
+ // handle response
+ }
+}
+```
+
+### Parameters
+
+| Parameter | Type | Required | Description |
+| -------------------------------------------------------- | -------------------------------------------------------- | -------------------------------------------------------- | -------------------------------------------------------- |
+| `ctx` | [context.Context](https://pkg.go.dev/context#Context) | :heavy_check_mark: | The context to use for the request. |
+| `opts` | [][operations.Option](../../models/operations/option.md) | :heavy_minus_sign: | The options for this request. |
+
+
+### Response
+
+**[*operations.ListRolesResponse](../../models/operations/listrolesresponse.md), error**
+| Error Object | Status Code | Content Type |
+| -------------------------------- | -------------------------------- | -------------------------------- |
+| sdkerrors.ErrBadRequest | 400 | application/json |
+| sdkerrors.ErrUnauthorized | 401 | application/json |
+| sdkerrors.ErrForbidden | 403 | application/json |
+| sdkerrors.ErrNotFound | 404 | application/json |
+| sdkerrors.ErrConflict | 409 | application/json |
+| sdkerrors.ErrTooManyRequests | 429 | application/json |
+| sdkerrors.ErrInternalServerError | 500 | application/json |
+| sdkerrors.SDKError | 4xx-5xx | */* |
diff --git a/models/components/v1keysverifykeyresponse.go b/models/components/v1keysverifykeyresponse.go
index ea372a1..9357d84 100644
--- a/models/components/v1keysverifykeyresponse.go
+++ b/models/components/v1keysverifykeyresponse.go
@@ -48,6 +48,7 @@ func (o *V1KeysVerifyKeyResponseRatelimit) GetReset() int64 {
// - UNAUTHORIZED: the key is not authorized
// - DISABLED: the key is disabled
// - INSUFFICIENT_PERMISSIONS: you do not have the required permissions to perform this action
+// - EXPIRED: The key was only valid for a certain time and has expired.
type Code string
const (
@@ -59,6 +60,7 @@ const (
CodeUnauthorized Code = "UNAUTHORIZED"
CodeDisabled Code = "DISABLED"
CodeInsufficientPermissions Code = "INSUFFICIENT_PERMISSIONS"
+ CodeExpired Code = "EXPIRED"
)
func (e Code) ToPointer() *Code {
@@ -85,6 +87,8 @@ func (e *Code) UnmarshalJSON(data []byte) error {
case "DISABLED":
fallthrough
case "INSUFFICIENT_PERMISSIONS":
+ fallthrough
+ case "EXPIRED":
*e = Code(v)
return nil
default:
@@ -120,6 +124,7 @@ type V1KeysVerifyKeyResponse struct {
// - UNAUTHORIZED: the key is not authorized
// - DISABLED: the key is disabled
// - INSUFFICIENT_PERMISSIONS: you do not have the required permissions to perform this action
+ // - EXPIRED: The key was only valid for a certain time and has expired.
//
Code Code `json:"code"`
// Sets the key to be enabled or disabled. Disabled keys will not verify.
diff --git a/models/operations/createpermission.go b/models/operations/createpermission.go
new file mode 100644
index 0000000..b3dfedf
--- /dev/null
+++ b/models/operations/createpermission.go
@@ -0,0 +1,61 @@
+// Code generated by Speakeasy (https://speakeasyapi.dev). DO NOT EDIT.
+
+package operations
+
+import (
+ "github.com/unkeyed/unkey-go/models/components"
+)
+
+type CreatePermissionRequestBody struct {
+ // The unique name of your permission.
+ Name string `json:"name"`
+ // Explain what this permission does. This is just for your team, your users will not see this.
+ Description *string `json:"description,omitempty"`
+}
+
+func (o *CreatePermissionRequestBody) GetName() string {
+ if o == nil {
+ return ""
+ }
+ return o.Name
+}
+
+func (o *CreatePermissionRequestBody) GetDescription() *string {
+ if o == nil {
+ return nil
+ }
+ return o.Description
+}
+
+// CreatePermissionResponseBody - Sucessfully created a permission
+type CreatePermissionResponseBody struct {
+ // The id of the permission. This is used internally
+ PermissionID string `json:"permissionId"`
+}
+
+func (o *CreatePermissionResponseBody) GetPermissionID() string {
+ if o == nil {
+ return ""
+ }
+ return o.PermissionID
+}
+
+type CreatePermissionResponse struct {
+ HTTPMeta components.HTTPMetadata `json:"-"`
+ // Sucessfully created a permission
+ Object *CreatePermissionResponseBody
+}
+
+func (o *CreatePermissionResponse) GetHTTPMeta() components.HTTPMetadata {
+ if o == nil {
+ return components.HTTPMetadata{}
+ }
+ return o.HTTPMeta
+}
+
+func (o *CreatePermissionResponse) GetObject() *CreatePermissionResponseBody {
+ if o == nil {
+ return nil
+ }
+ return o.Object
+}
diff --git a/models/operations/createrole.go b/models/operations/createrole.go
new file mode 100644
index 0000000..cff31e5
--- /dev/null
+++ b/models/operations/createrole.go
@@ -0,0 +1,61 @@
+// Code generated by Speakeasy (https://speakeasyapi.dev). DO NOT EDIT.
+
+package operations
+
+import (
+ "github.com/unkeyed/unkey-go/models/components"
+)
+
+type CreateRoleRequestBody struct {
+ // The unique name of your role.
+ Name string `json:"name"`
+ // Explain what this role does. This is just for your team, your users will not see this.
+ Description *string `json:"description,omitempty"`
+}
+
+func (o *CreateRoleRequestBody) GetName() string {
+ if o == nil {
+ return ""
+ }
+ return o.Name
+}
+
+func (o *CreateRoleRequestBody) GetDescription() *string {
+ if o == nil {
+ return nil
+ }
+ return o.Description
+}
+
+// CreateRoleResponseBody - Sucessfully created a role
+type CreateRoleResponseBody struct {
+ // The id of the role. This is used internally
+ RoleID string `json:"roleId"`
+}
+
+func (o *CreateRoleResponseBody) GetRoleID() string {
+ if o == nil {
+ return ""
+ }
+ return o.RoleID
+}
+
+type CreateRoleResponse struct {
+ HTTPMeta components.HTTPMetadata `json:"-"`
+ // Sucessfully created a role
+ Object *CreateRoleResponseBody
+}
+
+func (o *CreateRoleResponse) GetHTTPMeta() components.HTTPMetadata {
+ if o == nil {
+ return components.HTTPMetadata{}
+ }
+ return o.HTTPMeta
+}
+
+func (o *CreateRoleResponse) GetObject() *CreateRoleResponseBody {
+ if o == nil {
+ return nil
+ }
+ return o.Object
+}
diff --git a/models/operations/deletepermission.go b/models/operations/deletepermission.go
new file mode 100644
index 0000000..6212134
--- /dev/null
+++ b/models/operations/deletepermission.go
@@ -0,0 +1,43 @@
+// Code generated by Speakeasy (https://speakeasyapi.dev). DO NOT EDIT.
+
+package operations
+
+import (
+ "github.com/unkeyed/unkey-go/models/components"
+)
+
+type DeletePermissionRequestBody struct {
+ // The id of the permission you want to delete.
+ PermissionID string `json:"permissionId"`
+}
+
+func (o *DeletePermissionRequestBody) GetPermissionID() string {
+ if o == nil {
+ return ""
+ }
+ return o.PermissionID
+}
+
+// DeletePermissionResponseBody - Sucessfully deleted a permission
+type DeletePermissionResponseBody struct {
+}
+
+type DeletePermissionResponse struct {
+ HTTPMeta components.HTTPMetadata `json:"-"`
+ // Sucessfully deleted a permission
+ Object *DeletePermissionResponseBody
+}
+
+func (o *DeletePermissionResponse) GetHTTPMeta() components.HTTPMetadata {
+ if o == nil {
+ return components.HTTPMetadata{}
+ }
+ return o.HTTPMeta
+}
+
+func (o *DeletePermissionResponse) GetObject() *DeletePermissionResponseBody {
+ if o == nil {
+ return nil
+ }
+ return o.Object
+}
diff --git a/models/operations/deleterole.go b/models/operations/deleterole.go
new file mode 100644
index 0000000..37ca055
--- /dev/null
+++ b/models/operations/deleterole.go
@@ -0,0 +1,43 @@
+// Code generated by Speakeasy (https://speakeasyapi.dev). DO NOT EDIT.
+
+package operations
+
+import (
+ "github.com/unkeyed/unkey-go/models/components"
+)
+
+type DeleteRoleRequestBody struct {
+ // The id of the role you want to delete.
+ RoleID string `json:"roleId"`
+}
+
+func (o *DeleteRoleRequestBody) GetRoleID() string {
+ if o == nil {
+ return ""
+ }
+ return o.RoleID
+}
+
+// DeleteRoleResponseBody - Sucessfully deleted a role
+type DeleteRoleResponseBody struct {
+}
+
+type DeleteRoleResponse struct {
+ HTTPMeta components.HTTPMetadata `json:"-"`
+ // Sucessfully deleted a role
+ Object *DeleteRoleResponseBody
+}
+
+func (o *DeleteRoleResponse) GetHTTPMeta() components.HTTPMetadata {
+ if o == nil {
+ return components.HTTPMetadata{}
+ }
+ return o.HTTPMeta
+}
+
+func (o *DeleteRoleResponse) GetObject() *DeleteRoleResponseBody {
+ if o == nil {
+ return nil
+ }
+ return o.Object
+}
diff --git a/models/operations/getpermission.go b/models/operations/getpermission.go
new file mode 100644
index 0000000..4a7f773
--- /dev/null
+++ b/models/operations/getpermission.go
@@ -0,0 +1,69 @@
+// Code generated by Speakeasy (https://speakeasyapi.dev). DO NOT EDIT.
+
+package operations
+
+import (
+ "github.com/unkeyed/unkey-go/models/components"
+)
+
+type GetPermissionRequest struct {
+ PermissionID string `queryParam:"style=form,explode=true,name=permissionId"`
+}
+
+func (o *GetPermissionRequest) GetPermissionID() string {
+ if o == nil {
+ return ""
+ }
+ return o.PermissionID
+}
+
+// GetPermissionResponseBody - The Role
+type GetPermissionResponseBody struct {
+ // The id of the permission
+ ID string `json:"id"`
+ // The name of the permission.
+ Name string `json:"name"`
+ // The description of what this permission does. This is just for your team, your users will not see this.
+ Description *string `json:"description,omitempty"`
+}
+
+func (o *GetPermissionResponseBody) GetID() string {
+ if o == nil {
+ return ""
+ }
+ return o.ID
+}
+
+func (o *GetPermissionResponseBody) GetName() string {
+ if o == nil {
+ return ""
+ }
+ return o.Name
+}
+
+func (o *GetPermissionResponseBody) GetDescription() *string {
+ if o == nil {
+ return nil
+ }
+ return o.Description
+}
+
+type GetPermissionResponse struct {
+ HTTPMeta components.HTTPMetadata `json:"-"`
+ // The Role
+ Object *GetPermissionResponseBody
+}
+
+func (o *GetPermissionResponse) GetHTTPMeta() components.HTTPMetadata {
+ if o == nil {
+ return components.HTTPMetadata{}
+ }
+ return o.HTTPMeta
+}
+
+func (o *GetPermissionResponse) GetObject() *GetPermissionResponseBody {
+ if o == nil {
+ return nil
+ }
+ return o.Object
+}
diff --git a/models/operations/getrole.go b/models/operations/getrole.go
new file mode 100644
index 0000000..7eca507
--- /dev/null
+++ b/models/operations/getrole.go
@@ -0,0 +1,69 @@
+// Code generated by Speakeasy (https://speakeasyapi.dev). DO NOT EDIT.
+
+package operations
+
+import (
+ "github.com/unkeyed/unkey-go/models/components"
+)
+
+type GetRoleRequest struct {
+ RoleID string `queryParam:"style=form,explode=true,name=roleId"`
+}
+
+func (o *GetRoleRequest) GetRoleID() string {
+ if o == nil {
+ return ""
+ }
+ return o.RoleID
+}
+
+// GetRoleResponseBody - The Role
+type GetRoleResponseBody struct {
+ // The id of the role
+ ID string `json:"id"`
+ // The name of the role.
+ Name string `json:"name"`
+ // The description of what this role does. This is just for your team, your users will not see this.
+ Description *string `json:"description,omitempty"`
+}
+
+func (o *GetRoleResponseBody) GetID() string {
+ if o == nil {
+ return ""
+ }
+ return o.ID
+}
+
+func (o *GetRoleResponseBody) GetName() string {
+ if o == nil {
+ return ""
+ }
+ return o.Name
+}
+
+func (o *GetRoleResponseBody) GetDescription() *string {
+ if o == nil {
+ return nil
+ }
+ return o.Description
+}
+
+type GetRoleResponse struct {
+ HTTPMeta components.HTTPMetadata `json:"-"`
+ // The Role
+ Object *GetRoleResponseBody
+}
+
+func (o *GetRoleResponse) GetHTTPMeta() components.HTTPMetadata {
+ if o == nil {
+ return components.HTTPMetadata{}
+ }
+ return o.HTTPMeta
+}
+
+func (o *GetRoleResponse) GetObject() *GetRoleResponseBody {
+ if o == nil {
+ return nil
+ }
+ return o.Object
+}
diff --git a/models/operations/listpermissions.go b/models/operations/listpermissions.go
new file mode 100644
index 0000000..5f00e63
--- /dev/null
+++ b/models/operations/listpermissions.go
@@ -0,0 +1,57 @@
+// Code generated by Speakeasy (https://speakeasyapi.dev). DO NOT EDIT.
+
+package operations
+
+import (
+ "github.com/unkeyed/unkey-go/models/components"
+)
+
+type ResponseBody struct {
+ // The id of the permission
+ ID string `json:"id"`
+ // The name of the permission.
+ Name string `json:"name"`
+ // The description of what this permission does. This is just for your team, your users will not see this.
+ Description *string `json:"description,omitempty"`
+}
+
+func (o *ResponseBody) GetID() string {
+ if o == nil {
+ return ""
+ }
+ return o.ID
+}
+
+func (o *ResponseBody) GetName() string {
+ if o == nil {
+ return ""
+ }
+ return o.Name
+}
+
+func (o *ResponseBody) GetDescription() *string {
+ if o == nil {
+ return nil
+ }
+ return o.Description
+}
+
+type ListPermissionsResponse struct {
+ HTTPMeta components.HTTPMetadata `json:"-"`
+ // The permissions in your workspace
+ ResponseBodies []ResponseBody
+}
+
+func (o *ListPermissionsResponse) GetHTTPMeta() components.HTTPMetadata {
+ if o == nil {
+ return components.HTTPMetadata{}
+ }
+ return o.HTTPMeta
+}
+
+func (o *ListPermissionsResponse) GetResponseBodies() []ResponseBody {
+ if o == nil {
+ return nil
+ }
+ return o.ResponseBodies
+}
diff --git a/models/operations/listroles.go b/models/operations/listroles.go
new file mode 100644
index 0000000..a1df4a0
--- /dev/null
+++ b/models/operations/listroles.go
@@ -0,0 +1,57 @@
+// Code generated by Speakeasy (https://speakeasyapi.dev). DO NOT EDIT.
+
+package operations
+
+import (
+ "github.com/unkeyed/unkey-go/models/components"
+)
+
+type ListRolesResponseBody struct {
+ // The id of the role
+ ID string `json:"id"`
+ // The name of the role.
+ Name string `json:"name"`
+ // The description of what this role does. This is just for your team, your users will not see this.
+ Description *string `json:"description,omitempty"`
+}
+
+func (o *ListRolesResponseBody) GetID() string {
+ if o == nil {
+ return ""
+ }
+ return o.ID
+}
+
+func (o *ListRolesResponseBody) GetName() string {
+ if o == nil {
+ return ""
+ }
+ return o.Name
+}
+
+func (o *ListRolesResponseBody) GetDescription() *string {
+ if o == nil {
+ return nil
+ }
+ return o.Description
+}
+
+type ListRolesResponse struct {
+ HTTPMeta components.HTTPMetadata `json:"-"`
+ // The Roles in your workspace
+ ResponseBodies []ListRolesResponseBody
+}
+
+func (o *ListRolesResponse) GetHTTPMeta() components.HTTPMetadata {
+ if o == nil {
+ return components.HTTPMetadata{}
+ }
+ return o.HTTPMeta
+}
+
+func (o *ListRolesResponse) GetResponseBodies() []ListRolesResponseBody {
+ if o == nil {
+ return nil
+ }
+ return o.ResponseBodies
+}
diff --git a/models/operations/updatekey.go b/models/operations/updatekey.go
index 3998528..23987a8 100644
--- a/models/operations/updatekey.go
+++ b/models/operations/updatekey.go
@@ -10,6 +10,7 @@ import (
)
// UpdateKeyType - Fast ratelimiting doesn't add latency, while consistent ratelimiting is more accurate.
+// Deprecated, use 'async' instead
//
// https://unkey.dev/docs/features/ratelimiting - Learn more
//
@@ -43,20 +44,26 @@ func (e *UpdateKeyType) UnmarshalJSON(data []byte) error {
// UpdateKeyRatelimit - Unkey comes with per-key ratelimiting out of the box. Set `null` to disable.
type UpdateKeyRatelimit struct {
// Fast ratelimiting doesn't add latency, while consistent ratelimiting is more accurate.
+ // Deprecated, use 'async' instead
//
// Deprecated field: This will be removed in a future release, please migrate away from it as soon as possible.
Type *UpdateKeyType `json:"type,omitempty"`
- // Asnyc ratelimiting doesn't add latency, while sync ratelimiting is more accurate.
+ // Asnyc ratelimiting doesn't add latency, while sync ratelimiting is slightly more accurate.
Async *bool `default:"false" json:"async"`
- // The total amount of burstable requests.
+ // The total amount of requests allowed in a single window.
Limit int64 `json:"limit"`
// How many tokens to refill during each refillInterval.
+ // Deprecated, use 'limit' instead.
//
// Deprecated field: This will be removed in a future release, please migrate away from it as soon as possible.
RefillRate *int64 `json:"refillRate,omitempty"`
// Determines the speed at which tokens are refilled, in milliseconds.
- RefillInterval int64 `json:"refillInterval"`
+ // Deprecated, use 'duration'
+ //
+ // Deprecated field: This will be removed in a future release, please migrate away from it as soon as possible.
+ RefillInterval *int64 `json:"refillInterval,omitempty"`
// The duration of each ratelimit window, in milliseconds.
+ // This field will become required in a future version.
Duration *int64 `json:"duration,omitempty"`
}
@@ -99,9 +106,9 @@ func (o *UpdateKeyRatelimit) GetRefillRate() *int64 {
return o.RefillRate
}
-func (o *UpdateKeyRatelimit) GetRefillInterval() int64 {
+func (o *UpdateKeyRatelimit) GetRefillInterval() *int64 {
if o == nil {
- return 0
+ return nil
}
return o.RefillInterval
}
diff --git a/permissions.go b/permissions.go
new file mode 100644
index 0000000..33a8b07
--- /dev/null
+++ b/permissions.go
@@ -0,0 +1,1797 @@
+// Code generated by Speakeasy (https://speakeasyapi.dev). DO NOT EDIT.
+
+package unkeygo
+
+import (
+ "bytes"
+ "context"
+ "fmt"
+ "github.com/cenkalti/backoff/v4"
+ "github.com/unkeyed/unkey-go/internal/hooks"
+ "github.com/unkeyed/unkey-go/internal/utils"
+ "github.com/unkeyed/unkey-go/models/components"
+ "github.com/unkeyed/unkey-go/models/operations"
+ "github.com/unkeyed/unkey-go/models/sdkerrors"
+ "github.com/unkeyed/unkey-go/retry"
+ "io"
+ "net/http"
+ "net/url"
+)
+
+type Permissions struct {
+ sdkConfiguration sdkConfiguration
+}
+
+func newPermissions(sdkConfig sdkConfiguration) *Permissions {
+ return &Permissions{
+ sdkConfiguration: sdkConfig,
+ }
+}
+
+func (s *Permissions) CreatePermission(ctx context.Context, request operations.CreatePermissionRequestBody, opts ...operations.Option) (*operations.CreatePermissionResponse, error) {
+ hookCtx := hooks.HookContext{
+ Context: ctx,
+ OperationID: "createPermission",
+ OAuth2Scopes: []string{},
+ SecuritySource: s.sdkConfiguration.Security,
+ }
+
+ o := operations.Options{}
+ supportedOptions := []string{
+ operations.SupportedOptionRetries,
+ }
+
+ for _, opt := range opts {
+ if err := opt(&o, supportedOptions...); err != nil {
+ return nil, fmt.Errorf("error applying option: %w", err)
+ }
+ }
+ baseURL := utils.ReplaceParameters(s.sdkConfiguration.GetServerDetails())
+ opURL, err := url.JoinPath(baseURL, "/v1/permissions.createPermission")
+ if err != nil {
+ return nil, fmt.Errorf("error generating URL: %w", err)
+ }
+
+ bodyReader, reqContentType, err := utils.SerializeRequestBody(ctx, request, false, false, "Request", "json", `request:"mediaType=application/json"`)
+ if err != nil {
+ return nil, err
+ }
+
+ req, err := http.NewRequestWithContext(ctx, "POST", opURL, bodyReader)
+ if err != nil {
+ return nil, fmt.Errorf("error creating request: %w", err)
+ }
+ req.Header.Set("Accept", "application/json")
+ req.Header.Set("User-Agent", s.sdkConfiguration.UserAgent)
+ req.Header.Set("Content-Type", reqContentType)
+
+ if err := utils.PopulateSecurity(ctx, req, s.sdkConfiguration.Security); err != nil {
+ return nil, err
+ }
+
+ globalRetryConfig := s.sdkConfiguration.RetryConfig
+ retryConfig := o.Retries
+ if retryConfig == nil {
+ if globalRetryConfig == nil {
+ retryConfig = &retry.Config{
+ Strategy: "backoff",
+ Backoff: &retry.BackoffStrategy{
+ InitialInterval: 50,
+ MaxInterval: 1000,
+ Exponent: 1.5,
+ MaxElapsedTime: 30000,
+ },
+ RetryConnectionErrors: true,
+ }
+ } else {
+ retryConfig = globalRetryConfig
+ }
+ }
+
+ httpRes, err := utils.Retry(ctx, utils.Retries{
+ Config: retryConfig,
+ StatusCodes: []string{
+ "5XX",
+ },
+ }, func() (*http.Response, error) {
+ if req.Body != nil {
+ copyBody, err := req.GetBody()
+ if err != nil {
+ return nil, err
+ }
+ req.Body = copyBody
+ }
+
+ req, err = s.sdkConfiguration.Hooks.BeforeRequest(hooks.BeforeRequestContext{HookContext: hookCtx}, req)
+ if err != nil {
+ return nil, backoff.Permanent(err)
+ }
+
+ httpRes, err := s.sdkConfiguration.Client.Do(req)
+ if err != nil || httpRes == nil {
+ if err != nil {
+ err = fmt.Errorf("error sending request: %w", err)
+ } else {
+ err = fmt.Errorf("error sending request: no response")
+ }
+
+ _, err = s.sdkConfiguration.Hooks.AfterError(hooks.AfterErrorContext{HookContext: hookCtx}, nil, err)
+ }
+ return httpRes, err
+ })
+ if err != nil {
+ return nil, err
+ } else {
+ httpRes, err = s.sdkConfiguration.Hooks.AfterSuccess(hooks.AfterSuccessContext{HookContext: hookCtx}, httpRes)
+ if err != nil {
+ return nil, err
+ }
+ }
+
+ res := &operations.CreatePermissionResponse{
+ HTTPMeta: components.HTTPMetadata{
+ Request: req,
+ Response: httpRes,
+ },
+ }
+
+ rawBody, err := io.ReadAll(httpRes.Body)
+ if err != nil {
+ return nil, fmt.Errorf("error reading response body: %w", err)
+ }
+ httpRes.Body.Close()
+ httpRes.Body = io.NopCloser(bytes.NewBuffer(rawBody))
+
+ switch {
+ case httpRes.StatusCode == 200:
+ switch {
+ case utils.MatchContentType(httpRes.Header.Get("Content-Type"), `application/json`):
+ var out operations.CreatePermissionResponseBody
+ if err := utils.UnmarshalJsonFromResponseBody(bytes.NewBuffer(rawBody), &out, ""); err != nil {
+ return nil, err
+ }
+
+ res.Object = &out
+ default:
+ return nil, sdkerrors.NewSDKError(fmt.Sprintf("unknown content-type received: %s", httpRes.Header.Get("Content-Type")), httpRes.StatusCode, string(rawBody), httpRes)
+ }
+ case httpRes.StatusCode == 400:
+ switch {
+ case utils.MatchContentType(httpRes.Header.Get("Content-Type"), `application/json`):
+ var out sdkerrors.ErrBadRequest
+ if err := utils.UnmarshalJsonFromResponseBody(bytes.NewBuffer(rawBody), &out, ""); err != nil {
+ return nil, err
+ }
+
+ return nil, &out
+ default:
+ return nil, sdkerrors.NewSDKError(fmt.Sprintf("unknown content-type received: %s", httpRes.Header.Get("Content-Type")), httpRes.StatusCode, string(rawBody), httpRes)
+ }
+ case httpRes.StatusCode == 401:
+ switch {
+ case utils.MatchContentType(httpRes.Header.Get("Content-Type"), `application/json`):
+ var out sdkerrors.ErrUnauthorized
+ if err := utils.UnmarshalJsonFromResponseBody(bytes.NewBuffer(rawBody), &out, ""); err != nil {
+ return nil, err
+ }
+
+ return nil, &out
+ default:
+ return nil, sdkerrors.NewSDKError(fmt.Sprintf("unknown content-type received: %s", httpRes.Header.Get("Content-Type")), httpRes.StatusCode, string(rawBody), httpRes)
+ }
+ case httpRes.StatusCode == 403:
+ switch {
+ case utils.MatchContentType(httpRes.Header.Get("Content-Type"), `application/json`):
+ var out sdkerrors.ErrForbidden
+ if err := utils.UnmarshalJsonFromResponseBody(bytes.NewBuffer(rawBody), &out, ""); err != nil {
+ return nil, err
+ }
+
+ return nil, &out
+ default:
+ return nil, sdkerrors.NewSDKError(fmt.Sprintf("unknown content-type received: %s", httpRes.Header.Get("Content-Type")), httpRes.StatusCode, string(rawBody), httpRes)
+ }
+ case httpRes.StatusCode == 404:
+ switch {
+ case utils.MatchContentType(httpRes.Header.Get("Content-Type"), `application/json`):
+ var out sdkerrors.ErrNotFound
+ if err := utils.UnmarshalJsonFromResponseBody(bytes.NewBuffer(rawBody), &out, ""); err != nil {
+ return nil, err
+ }
+
+ return nil, &out
+ default:
+ return nil, sdkerrors.NewSDKError(fmt.Sprintf("unknown content-type received: %s", httpRes.Header.Get("Content-Type")), httpRes.StatusCode, string(rawBody), httpRes)
+ }
+ case httpRes.StatusCode == 409:
+ switch {
+ case utils.MatchContentType(httpRes.Header.Get("Content-Type"), `application/json`):
+ var out sdkerrors.ErrConflict
+ if err := utils.UnmarshalJsonFromResponseBody(bytes.NewBuffer(rawBody), &out, ""); err != nil {
+ return nil, err
+ }
+
+ return nil, &out
+ default:
+ return nil, sdkerrors.NewSDKError(fmt.Sprintf("unknown content-type received: %s", httpRes.Header.Get("Content-Type")), httpRes.StatusCode, string(rawBody), httpRes)
+ }
+ case httpRes.StatusCode == 429:
+ switch {
+ case utils.MatchContentType(httpRes.Header.Get("Content-Type"), `application/json`):
+ var out sdkerrors.ErrTooManyRequests
+ if err := utils.UnmarshalJsonFromResponseBody(bytes.NewBuffer(rawBody), &out, ""); err != nil {
+ return nil, err
+ }
+
+ return nil, &out
+ default:
+ return nil, sdkerrors.NewSDKError(fmt.Sprintf("unknown content-type received: %s", httpRes.Header.Get("Content-Type")), httpRes.StatusCode, string(rawBody), httpRes)
+ }
+ case httpRes.StatusCode == 500:
+ switch {
+ case utils.MatchContentType(httpRes.Header.Get("Content-Type"), `application/json`):
+ var out sdkerrors.ErrInternalServerError
+ if err := utils.UnmarshalJsonFromResponseBody(bytes.NewBuffer(rawBody), &out, ""); err != nil {
+ return nil, err
+ }
+
+ return nil, &out
+ default:
+ return nil, sdkerrors.NewSDKError(fmt.Sprintf("unknown content-type received: %s", httpRes.Header.Get("Content-Type")), httpRes.StatusCode, string(rawBody), httpRes)
+ }
+ case httpRes.StatusCode >= 400 && httpRes.StatusCode < 500:
+ fallthrough
+ case httpRes.StatusCode >= 500 && httpRes.StatusCode < 600:
+ return nil, sdkerrors.NewSDKError("API error occurred", httpRes.StatusCode, string(rawBody), httpRes)
+ default:
+ return nil, sdkerrors.NewSDKError("unknown status code returned", httpRes.StatusCode, string(rawBody), httpRes)
+ }
+
+ return res, nil
+
+}
+
+func (s *Permissions) DeletePermission(ctx context.Context, request operations.DeletePermissionRequestBody, opts ...operations.Option) (*operations.DeletePermissionResponse, error) {
+ hookCtx := hooks.HookContext{
+ Context: ctx,
+ OperationID: "deletePermission",
+ OAuth2Scopes: []string{},
+ SecuritySource: s.sdkConfiguration.Security,
+ }
+
+ o := operations.Options{}
+ supportedOptions := []string{
+ operations.SupportedOptionRetries,
+ }
+
+ for _, opt := range opts {
+ if err := opt(&o, supportedOptions...); err != nil {
+ return nil, fmt.Errorf("error applying option: %w", err)
+ }
+ }
+ baseURL := utils.ReplaceParameters(s.sdkConfiguration.GetServerDetails())
+ opURL, err := url.JoinPath(baseURL, "/v1/permissions.deletePermission")
+ if err != nil {
+ return nil, fmt.Errorf("error generating URL: %w", err)
+ }
+
+ bodyReader, reqContentType, err := utils.SerializeRequestBody(ctx, request, false, false, "Request", "json", `request:"mediaType=application/json"`)
+ if err != nil {
+ return nil, err
+ }
+
+ req, err := http.NewRequestWithContext(ctx, "POST", opURL, bodyReader)
+ if err != nil {
+ return nil, fmt.Errorf("error creating request: %w", err)
+ }
+ req.Header.Set("Accept", "application/json")
+ req.Header.Set("User-Agent", s.sdkConfiguration.UserAgent)
+ req.Header.Set("Content-Type", reqContentType)
+
+ if err := utils.PopulateSecurity(ctx, req, s.sdkConfiguration.Security); err != nil {
+ return nil, err
+ }
+
+ globalRetryConfig := s.sdkConfiguration.RetryConfig
+ retryConfig := o.Retries
+ if retryConfig == nil {
+ if globalRetryConfig == nil {
+ retryConfig = &retry.Config{
+ Strategy: "backoff",
+ Backoff: &retry.BackoffStrategy{
+ InitialInterval: 50,
+ MaxInterval: 1000,
+ Exponent: 1.5,
+ MaxElapsedTime: 30000,
+ },
+ RetryConnectionErrors: true,
+ }
+ } else {
+ retryConfig = globalRetryConfig
+ }
+ }
+
+ httpRes, err := utils.Retry(ctx, utils.Retries{
+ Config: retryConfig,
+ StatusCodes: []string{
+ "5XX",
+ },
+ }, func() (*http.Response, error) {
+ if req.Body != nil {
+ copyBody, err := req.GetBody()
+ if err != nil {
+ return nil, err
+ }
+ req.Body = copyBody
+ }
+
+ req, err = s.sdkConfiguration.Hooks.BeforeRequest(hooks.BeforeRequestContext{HookContext: hookCtx}, req)
+ if err != nil {
+ return nil, backoff.Permanent(err)
+ }
+
+ httpRes, err := s.sdkConfiguration.Client.Do(req)
+ if err != nil || httpRes == nil {
+ if err != nil {
+ err = fmt.Errorf("error sending request: %w", err)
+ } else {
+ err = fmt.Errorf("error sending request: no response")
+ }
+
+ _, err = s.sdkConfiguration.Hooks.AfterError(hooks.AfterErrorContext{HookContext: hookCtx}, nil, err)
+ }
+ return httpRes, err
+ })
+ if err != nil {
+ return nil, err
+ } else {
+ httpRes, err = s.sdkConfiguration.Hooks.AfterSuccess(hooks.AfterSuccessContext{HookContext: hookCtx}, httpRes)
+ if err != nil {
+ return nil, err
+ }
+ }
+
+ res := &operations.DeletePermissionResponse{
+ HTTPMeta: components.HTTPMetadata{
+ Request: req,
+ Response: httpRes,
+ },
+ }
+
+ rawBody, err := io.ReadAll(httpRes.Body)
+ if err != nil {
+ return nil, fmt.Errorf("error reading response body: %w", err)
+ }
+ httpRes.Body.Close()
+ httpRes.Body = io.NopCloser(bytes.NewBuffer(rawBody))
+
+ switch {
+ case httpRes.StatusCode == 200:
+ switch {
+ case utils.MatchContentType(httpRes.Header.Get("Content-Type"), `application/json`):
+ var out operations.DeletePermissionResponseBody
+ if err := utils.UnmarshalJsonFromResponseBody(bytes.NewBuffer(rawBody), &out, ""); err != nil {
+ return nil, err
+ }
+
+ res.Object = &out
+ default:
+ return nil, sdkerrors.NewSDKError(fmt.Sprintf("unknown content-type received: %s", httpRes.Header.Get("Content-Type")), httpRes.StatusCode, string(rawBody), httpRes)
+ }
+ case httpRes.StatusCode == 400:
+ switch {
+ case utils.MatchContentType(httpRes.Header.Get("Content-Type"), `application/json`):
+ var out sdkerrors.ErrBadRequest
+ if err := utils.UnmarshalJsonFromResponseBody(bytes.NewBuffer(rawBody), &out, ""); err != nil {
+ return nil, err
+ }
+
+ return nil, &out
+ default:
+ return nil, sdkerrors.NewSDKError(fmt.Sprintf("unknown content-type received: %s", httpRes.Header.Get("Content-Type")), httpRes.StatusCode, string(rawBody), httpRes)
+ }
+ case httpRes.StatusCode == 401:
+ switch {
+ case utils.MatchContentType(httpRes.Header.Get("Content-Type"), `application/json`):
+ var out sdkerrors.ErrUnauthorized
+ if err := utils.UnmarshalJsonFromResponseBody(bytes.NewBuffer(rawBody), &out, ""); err != nil {
+ return nil, err
+ }
+
+ return nil, &out
+ default:
+ return nil, sdkerrors.NewSDKError(fmt.Sprintf("unknown content-type received: %s", httpRes.Header.Get("Content-Type")), httpRes.StatusCode, string(rawBody), httpRes)
+ }
+ case httpRes.StatusCode == 403:
+ switch {
+ case utils.MatchContentType(httpRes.Header.Get("Content-Type"), `application/json`):
+ var out sdkerrors.ErrForbidden
+ if err := utils.UnmarshalJsonFromResponseBody(bytes.NewBuffer(rawBody), &out, ""); err != nil {
+ return nil, err
+ }
+
+ return nil, &out
+ default:
+ return nil, sdkerrors.NewSDKError(fmt.Sprintf("unknown content-type received: %s", httpRes.Header.Get("Content-Type")), httpRes.StatusCode, string(rawBody), httpRes)
+ }
+ case httpRes.StatusCode == 404:
+ switch {
+ case utils.MatchContentType(httpRes.Header.Get("Content-Type"), `application/json`):
+ var out sdkerrors.ErrNotFound
+ if err := utils.UnmarshalJsonFromResponseBody(bytes.NewBuffer(rawBody), &out, ""); err != nil {
+ return nil, err
+ }
+
+ return nil, &out
+ default:
+ return nil, sdkerrors.NewSDKError(fmt.Sprintf("unknown content-type received: %s", httpRes.Header.Get("Content-Type")), httpRes.StatusCode, string(rawBody), httpRes)
+ }
+ case httpRes.StatusCode == 409:
+ switch {
+ case utils.MatchContentType(httpRes.Header.Get("Content-Type"), `application/json`):
+ var out sdkerrors.ErrConflict
+ if err := utils.UnmarshalJsonFromResponseBody(bytes.NewBuffer(rawBody), &out, ""); err != nil {
+ return nil, err
+ }
+
+ return nil, &out
+ default:
+ return nil, sdkerrors.NewSDKError(fmt.Sprintf("unknown content-type received: %s", httpRes.Header.Get("Content-Type")), httpRes.StatusCode, string(rawBody), httpRes)
+ }
+ case httpRes.StatusCode == 429:
+ switch {
+ case utils.MatchContentType(httpRes.Header.Get("Content-Type"), `application/json`):
+ var out sdkerrors.ErrTooManyRequests
+ if err := utils.UnmarshalJsonFromResponseBody(bytes.NewBuffer(rawBody), &out, ""); err != nil {
+ return nil, err
+ }
+
+ return nil, &out
+ default:
+ return nil, sdkerrors.NewSDKError(fmt.Sprintf("unknown content-type received: %s", httpRes.Header.Get("Content-Type")), httpRes.StatusCode, string(rawBody), httpRes)
+ }
+ case httpRes.StatusCode == 500:
+ switch {
+ case utils.MatchContentType(httpRes.Header.Get("Content-Type"), `application/json`):
+ var out sdkerrors.ErrInternalServerError
+ if err := utils.UnmarshalJsonFromResponseBody(bytes.NewBuffer(rawBody), &out, ""); err != nil {
+ return nil, err
+ }
+
+ return nil, &out
+ default:
+ return nil, sdkerrors.NewSDKError(fmt.Sprintf("unknown content-type received: %s", httpRes.Header.Get("Content-Type")), httpRes.StatusCode, string(rawBody), httpRes)
+ }
+ case httpRes.StatusCode >= 400 && httpRes.StatusCode < 500:
+ fallthrough
+ case httpRes.StatusCode >= 500 && httpRes.StatusCode < 600:
+ return nil, sdkerrors.NewSDKError("API error occurred", httpRes.StatusCode, string(rawBody), httpRes)
+ default:
+ return nil, sdkerrors.NewSDKError("unknown status code returned", httpRes.StatusCode, string(rawBody), httpRes)
+ }
+
+ return res, nil
+
+}
+
+func (s *Permissions) GetPermission(ctx context.Context, request operations.GetPermissionRequest, opts ...operations.Option) (*operations.GetPermissionResponse, error) {
+ hookCtx := hooks.HookContext{
+ Context: ctx,
+ OperationID: "getPermission",
+ OAuth2Scopes: []string{},
+ SecuritySource: s.sdkConfiguration.Security,
+ }
+
+ o := operations.Options{}
+ supportedOptions := []string{
+ operations.SupportedOptionRetries,
+ }
+
+ for _, opt := range opts {
+ if err := opt(&o, supportedOptions...); err != nil {
+ return nil, fmt.Errorf("error applying option: %w", err)
+ }
+ }
+ baseURL := utils.ReplaceParameters(s.sdkConfiguration.GetServerDetails())
+ opURL, err := url.JoinPath(baseURL, "/v1/permissions.getPermission")
+ if err != nil {
+ return nil, fmt.Errorf("error generating URL: %w", err)
+ }
+
+ req, err := http.NewRequestWithContext(ctx, "GET", opURL, nil)
+ if err != nil {
+ return nil, fmt.Errorf("error creating request: %w", err)
+ }
+ req.Header.Set("Accept", "application/json")
+ req.Header.Set("User-Agent", s.sdkConfiguration.UserAgent)
+
+ if err := utils.PopulateQueryParams(ctx, req, request, nil); err != nil {
+ return nil, fmt.Errorf("error populating query params: %w", err)
+ }
+
+ if err := utils.PopulateSecurity(ctx, req, s.sdkConfiguration.Security); err != nil {
+ return nil, err
+ }
+
+ globalRetryConfig := s.sdkConfiguration.RetryConfig
+ retryConfig := o.Retries
+ if retryConfig == nil {
+ if globalRetryConfig == nil {
+ retryConfig = &retry.Config{
+ Strategy: "backoff",
+ Backoff: &retry.BackoffStrategy{
+ InitialInterval: 50,
+ MaxInterval: 1000,
+ Exponent: 1.5,
+ MaxElapsedTime: 30000,
+ },
+ RetryConnectionErrors: true,
+ }
+ } else {
+ retryConfig = globalRetryConfig
+ }
+ }
+
+ httpRes, err := utils.Retry(ctx, utils.Retries{
+ Config: retryConfig,
+ StatusCodes: []string{
+ "5XX",
+ },
+ }, func() (*http.Response, error) {
+ if req.Body != nil {
+ copyBody, err := req.GetBody()
+ if err != nil {
+ return nil, err
+ }
+ req.Body = copyBody
+ }
+
+ req, err = s.sdkConfiguration.Hooks.BeforeRequest(hooks.BeforeRequestContext{HookContext: hookCtx}, req)
+ if err != nil {
+ return nil, backoff.Permanent(err)
+ }
+
+ httpRes, err := s.sdkConfiguration.Client.Do(req)
+ if err != nil || httpRes == nil {
+ if err != nil {
+ err = fmt.Errorf("error sending request: %w", err)
+ } else {
+ err = fmt.Errorf("error sending request: no response")
+ }
+
+ _, err = s.sdkConfiguration.Hooks.AfterError(hooks.AfterErrorContext{HookContext: hookCtx}, nil, err)
+ }
+ return httpRes, err
+ })
+ if err != nil {
+ return nil, err
+ } else {
+ httpRes, err = s.sdkConfiguration.Hooks.AfterSuccess(hooks.AfterSuccessContext{HookContext: hookCtx}, httpRes)
+ if err != nil {
+ return nil, err
+ }
+ }
+
+ res := &operations.GetPermissionResponse{
+ HTTPMeta: components.HTTPMetadata{
+ Request: req,
+ Response: httpRes,
+ },
+ }
+
+ rawBody, err := io.ReadAll(httpRes.Body)
+ if err != nil {
+ return nil, fmt.Errorf("error reading response body: %w", err)
+ }
+ httpRes.Body.Close()
+ httpRes.Body = io.NopCloser(bytes.NewBuffer(rawBody))
+
+ switch {
+ case httpRes.StatusCode == 200:
+ switch {
+ case utils.MatchContentType(httpRes.Header.Get("Content-Type"), `application/json`):
+ var out operations.GetPermissionResponseBody
+ if err := utils.UnmarshalJsonFromResponseBody(bytes.NewBuffer(rawBody), &out, ""); err != nil {
+ return nil, err
+ }
+
+ res.Object = &out
+ default:
+ return nil, sdkerrors.NewSDKError(fmt.Sprintf("unknown content-type received: %s", httpRes.Header.Get("Content-Type")), httpRes.StatusCode, string(rawBody), httpRes)
+ }
+ case httpRes.StatusCode == 400:
+ switch {
+ case utils.MatchContentType(httpRes.Header.Get("Content-Type"), `application/json`):
+ var out sdkerrors.ErrBadRequest
+ if err := utils.UnmarshalJsonFromResponseBody(bytes.NewBuffer(rawBody), &out, ""); err != nil {
+ return nil, err
+ }
+
+ return nil, &out
+ default:
+ return nil, sdkerrors.NewSDKError(fmt.Sprintf("unknown content-type received: %s", httpRes.Header.Get("Content-Type")), httpRes.StatusCode, string(rawBody), httpRes)
+ }
+ case httpRes.StatusCode == 401:
+ switch {
+ case utils.MatchContentType(httpRes.Header.Get("Content-Type"), `application/json`):
+ var out sdkerrors.ErrUnauthorized
+ if err := utils.UnmarshalJsonFromResponseBody(bytes.NewBuffer(rawBody), &out, ""); err != nil {
+ return nil, err
+ }
+
+ return nil, &out
+ default:
+ return nil, sdkerrors.NewSDKError(fmt.Sprintf("unknown content-type received: %s", httpRes.Header.Get("Content-Type")), httpRes.StatusCode, string(rawBody), httpRes)
+ }
+ case httpRes.StatusCode == 403:
+ switch {
+ case utils.MatchContentType(httpRes.Header.Get("Content-Type"), `application/json`):
+ var out sdkerrors.ErrForbidden
+ if err := utils.UnmarshalJsonFromResponseBody(bytes.NewBuffer(rawBody), &out, ""); err != nil {
+ return nil, err
+ }
+
+ return nil, &out
+ default:
+ return nil, sdkerrors.NewSDKError(fmt.Sprintf("unknown content-type received: %s", httpRes.Header.Get("Content-Type")), httpRes.StatusCode, string(rawBody), httpRes)
+ }
+ case httpRes.StatusCode == 404:
+ switch {
+ case utils.MatchContentType(httpRes.Header.Get("Content-Type"), `application/json`):
+ var out sdkerrors.ErrNotFound
+ if err := utils.UnmarshalJsonFromResponseBody(bytes.NewBuffer(rawBody), &out, ""); err != nil {
+ return nil, err
+ }
+
+ return nil, &out
+ default:
+ return nil, sdkerrors.NewSDKError(fmt.Sprintf("unknown content-type received: %s", httpRes.Header.Get("Content-Type")), httpRes.StatusCode, string(rawBody), httpRes)
+ }
+ case httpRes.StatusCode == 409:
+ switch {
+ case utils.MatchContentType(httpRes.Header.Get("Content-Type"), `application/json`):
+ var out sdkerrors.ErrConflict
+ if err := utils.UnmarshalJsonFromResponseBody(bytes.NewBuffer(rawBody), &out, ""); err != nil {
+ return nil, err
+ }
+
+ return nil, &out
+ default:
+ return nil, sdkerrors.NewSDKError(fmt.Sprintf("unknown content-type received: %s", httpRes.Header.Get("Content-Type")), httpRes.StatusCode, string(rawBody), httpRes)
+ }
+ case httpRes.StatusCode == 429:
+ switch {
+ case utils.MatchContentType(httpRes.Header.Get("Content-Type"), `application/json`):
+ var out sdkerrors.ErrTooManyRequests
+ if err := utils.UnmarshalJsonFromResponseBody(bytes.NewBuffer(rawBody), &out, ""); err != nil {
+ return nil, err
+ }
+
+ return nil, &out
+ default:
+ return nil, sdkerrors.NewSDKError(fmt.Sprintf("unknown content-type received: %s", httpRes.Header.Get("Content-Type")), httpRes.StatusCode, string(rawBody), httpRes)
+ }
+ case httpRes.StatusCode == 500:
+ switch {
+ case utils.MatchContentType(httpRes.Header.Get("Content-Type"), `application/json`):
+ var out sdkerrors.ErrInternalServerError
+ if err := utils.UnmarshalJsonFromResponseBody(bytes.NewBuffer(rawBody), &out, ""); err != nil {
+ return nil, err
+ }
+
+ return nil, &out
+ default:
+ return nil, sdkerrors.NewSDKError(fmt.Sprintf("unknown content-type received: %s", httpRes.Header.Get("Content-Type")), httpRes.StatusCode, string(rawBody), httpRes)
+ }
+ case httpRes.StatusCode >= 400 && httpRes.StatusCode < 500:
+ fallthrough
+ case httpRes.StatusCode >= 500 && httpRes.StatusCode < 600:
+ return nil, sdkerrors.NewSDKError("API error occurred", httpRes.StatusCode, string(rawBody), httpRes)
+ default:
+ return nil, sdkerrors.NewSDKError("unknown status code returned", httpRes.StatusCode, string(rawBody), httpRes)
+ }
+
+ return res, nil
+
+}
+
+func (s *Permissions) ListPermissions(ctx context.Context, opts ...operations.Option) (*operations.ListPermissionsResponse, error) {
+ hookCtx := hooks.HookContext{
+ Context: ctx,
+ OperationID: "listPermissions",
+ OAuth2Scopes: []string{},
+ SecuritySource: s.sdkConfiguration.Security,
+ }
+
+ o := operations.Options{}
+ supportedOptions := []string{
+ operations.SupportedOptionRetries,
+ }
+
+ for _, opt := range opts {
+ if err := opt(&o, supportedOptions...); err != nil {
+ return nil, fmt.Errorf("error applying option: %w", err)
+ }
+ }
+ baseURL := utils.ReplaceParameters(s.sdkConfiguration.GetServerDetails())
+ opURL, err := url.JoinPath(baseURL, "/v1/permissions.listPermissions")
+ if err != nil {
+ return nil, fmt.Errorf("error generating URL: %w", err)
+ }
+
+ req, err := http.NewRequestWithContext(ctx, "GET", opURL, nil)
+ if err != nil {
+ return nil, fmt.Errorf("error creating request: %w", err)
+ }
+ req.Header.Set("Accept", "application/json")
+ req.Header.Set("User-Agent", s.sdkConfiguration.UserAgent)
+
+ if err := utils.PopulateSecurity(ctx, req, s.sdkConfiguration.Security); err != nil {
+ return nil, err
+ }
+
+ globalRetryConfig := s.sdkConfiguration.RetryConfig
+ retryConfig := o.Retries
+ if retryConfig == nil {
+ if globalRetryConfig == nil {
+ retryConfig = &retry.Config{
+ Strategy: "backoff",
+ Backoff: &retry.BackoffStrategy{
+ InitialInterval: 50,
+ MaxInterval: 1000,
+ Exponent: 1.5,
+ MaxElapsedTime: 30000,
+ },
+ RetryConnectionErrors: true,
+ }
+ } else {
+ retryConfig = globalRetryConfig
+ }
+ }
+
+ httpRes, err := utils.Retry(ctx, utils.Retries{
+ Config: retryConfig,
+ StatusCodes: []string{
+ "5XX",
+ },
+ }, func() (*http.Response, error) {
+ if req.Body != nil {
+ copyBody, err := req.GetBody()
+ if err != nil {
+ return nil, err
+ }
+ req.Body = copyBody
+ }
+
+ req, err = s.sdkConfiguration.Hooks.BeforeRequest(hooks.BeforeRequestContext{HookContext: hookCtx}, req)
+ if err != nil {
+ return nil, backoff.Permanent(err)
+ }
+
+ httpRes, err := s.sdkConfiguration.Client.Do(req)
+ if err != nil || httpRes == nil {
+ if err != nil {
+ err = fmt.Errorf("error sending request: %w", err)
+ } else {
+ err = fmt.Errorf("error sending request: no response")
+ }
+
+ _, err = s.sdkConfiguration.Hooks.AfterError(hooks.AfterErrorContext{HookContext: hookCtx}, nil, err)
+ }
+ return httpRes, err
+ })
+ if err != nil {
+ return nil, err
+ } else {
+ httpRes, err = s.sdkConfiguration.Hooks.AfterSuccess(hooks.AfterSuccessContext{HookContext: hookCtx}, httpRes)
+ if err != nil {
+ return nil, err
+ }
+ }
+
+ res := &operations.ListPermissionsResponse{
+ HTTPMeta: components.HTTPMetadata{
+ Request: req,
+ Response: httpRes,
+ },
+ }
+
+ rawBody, err := io.ReadAll(httpRes.Body)
+ if err != nil {
+ return nil, fmt.Errorf("error reading response body: %w", err)
+ }
+ httpRes.Body.Close()
+ httpRes.Body = io.NopCloser(bytes.NewBuffer(rawBody))
+
+ switch {
+ case httpRes.StatusCode == 200:
+ switch {
+ case utils.MatchContentType(httpRes.Header.Get("Content-Type"), `application/json`):
+ var out []operations.ResponseBody
+ if err := utils.UnmarshalJsonFromResponseBody(bytes.NewBuffer(rawBody), &out, ""); err != nil {
+ return nil, err
+ }
+
+ res.ResponseBodies = out
+ default:
+ return nil, sdkerrors.NewSDKError(fmt.Sprintf("unknown content-type received: %s", httpRes.Header.Get("Content-Type")), httpRes.StatusCode, string(rawBody), httpRes)
+ }
+ case httpRes.StatusCode == 400:
+ switch {
+ case utils.MatchContentType(httpRes.Header.Get("Content-Type"), `application/json`):
+ var out sdkerrors.ErrBadRequest
+ if err := utils.UnmarshalJsonFromResponseBody(bytes.NewBuffer(rawBody), &out, ""); err != nil {
+ return nil, err
+ }
+
+ return nil, &out
+ default:
+ return nil, sdkerrors.NewSDKError(fmt.Sprintf("unknown content-type received: %s", httpRes.Header.Get("Content-Type")), httpRes.StatusCode, string(rawBody), httpRes)
+ }
+ case httpRes.StatusCode == 401:
+ switch {
+ case utils.MatchContentType(httpRes.Header.Get("Content-Type"), `application/json`):
+ var out sdkerrors.ErrUnauthorized
+ if err := utils.UnmarshalJsonFromResponseBody(bytes.NewBuffer(rawBody), &out, ""); err != nil {
+ return nil, err
+ }
+
+ return nil, &out
+ default:
+ return nil, sdkerrors.NewSDKError(fmt.Sprintf("unknown content-type received: %s", httpRes.Header.Get("Content-Type")), httpRes.StatusCode, string(rawBody), httpRes)
+ }
+ case httpRes.StatusCode == 403:
+ switch {
+ case utils.MatchContentType(httpRes.Header.Get("Content-Type"), `application/json`):
+ var out sdkerrors.ErrForbidden
+ if err := utils.UnmarshalJsonFromResponseBody(bytes.NewBuffer(rawBody), &out, ""); err != nil {
+ return nil, err
+ }
+
+ return nil, &out
+ default:
+ return nil, sdkerrors.NewSDKError(fmt.Sprintf("unknown content-type received: %s", httpRes.Header.Get("Content-Type")), httpRes.StatusCode, string(rawBody), httpRes)
+ }
+ case httpRes.StatusCode == 404:
+ switch {
+ case utils.MatchContentType(httpRes.Header.Get("Content-Type"), `application/json`):
+ var out sdkerrors.ErrNotFound
+ if err := utils.UnmarshalJsonFromResponseBody(bytes.NewBuffer(rawBody), &out, ""); err != nil {
+ return nil, err
+ }
+
+ return nil, &out
+ default:
+ return nil, sdkerrors.NewSDKError(fmt.Sprintf("unknown content-type received: %s", httpRes.Header.Get("Content-Type")), httpRes.StatusCode, string(rawBody), httpRes)
+ }
+ case httpRes.StatusCode == 409:
+ switch {
+ case utils.MatchContentType(httpRes.Header.Get("Content-Type"), `application/json`):
+ var out sdkerrors.ErrConflict
+ if err := utils.UnmarshalJsonFromResponseBody(bytes.NewBuffer(rawBody), &out, ""); err != nil {
+ return nil, err
+ }
+
+ return nil, &out
+ default:
+ return nil, sdkerrors.NewSDKError(fmt.Sprintf("unknown content-type received: %s", httpRes.Header.Get("Content-Type")), httpRes.StatusCode, string(rawBody), httpRes)
+ }
+ case httpRes.StatusCode == 429:
+ switch {
+ case utils.MatchContentType(httpRes.Header.Get("Content-Type"), `application/json`):
+ var out sdkerrors.ErrTooManyRequests
+ if err := utils.UnmarshalJsonFromResponseBody(bytes.NewBuffer(rawBody), &out, ""); err != nil {
+ return nil, err
+ }
+
+ return nil, &out
+ default:
+ return nil, sdkerrors.NewSDKError(fmt.Sprintf("unknown content-type received: %s", httpRes.Header.Get("Content-Type")), httpRes.StatusCode, string(rawBody), httpRes)
+ }
+ case httpRes.StatusCode == 500:
+ switch {
+ case utils.MatchContentType(httpRes.Header.Get("Content-Type"), `application/json`):
+ var out sdkerrors.ErrInternalServerError
+ if err := utils.UnmarshalJsonFromResponseBody(bytes.NewBuffer(rawBody), &out, ""); err != nil {
+ return nil, err
+ }
+
+ return nil, &out
+ default:
+ return nil, sdkerrors.NewSDKError(fmt.Sprintf("unknown content-type received: %s", httpRes.Header.Get("Content-Type")), httpRes.StatusCode, string(rawBody), httpRes)
+ }
+ case httpRes.StatusCode >= 400 && httpRes.StatusCode < 500:
+ fallthrough
+ case httpRes.StatusCode >= 500 && httpRes.StatusCode < 600:
+ return nil, sdkerrors.NewSDKError("API error occurred", httpRes.StatusCode, string(rawBody), httpRes)
+ default:
+ return nil, sdkerrors.NewSDKError("unknown status code returned", httpRes.StatusCode, string(rawBody), httpRes)
+ }
+
+ return res, nil
+
+}
+
+func (s *Permissions) CreateRole(ctx context.Context, request operations.CreateRoleRequestBody, opts ...operations.Option) (*operations.CreateRoleResponse, error) {
+ hookCtx := hooks.HookContext{
+ Context: ctx,
+ OperationID: "createRole",
+ OAuth2Scopes: []string{},
+ SecuritySource: s.sdkConfiguration.Security,
+ }
+
+ o := operations.Options{}
+ supportedOptions := []string{
+ operations.SupportedOptionRetries,
+ }
+
+ for _, opt := range opts {
+ if err := opt(&o, supportedOptions...); err != nil {
+ return nil, fmt.Errorf("error applying option: %w", err)
+ }
+ }
+ baseURL := utils.ReplaceParameters(s.sdkConfiguration.GetServerDetails())
+ opURL, err := url.JoinPath(baseURL, "/v1/permissions.createRole")
+ if err != nil {
+ return nil, fmt.Errorf("error generating URL: %w", err)
+ }
+
+ bodyReader, reqContentType, err := utils.SerializeRequestBody(ctx, request, false, false, "Request", "json", `request:"mediaType=application/json"`)
+ if err != nil {
+ return nil, err
+ }
+
+ req, err := http.NewRequestWithContext(ctx, "POST", opURL, bodyReader)
+ if err != nil {
+ return nil, fmt.Errorf("error creating request: %w", err)
+ }
+ req.Header.Set("Accept", "application/json")
+ req.Header.Set("User-Agent", s.sdkConfiguration.UserAgent)
+ req.Header.Set("Content-Type", reqContentType)
+
+ if err := utils.PopulateSecurity(ctx, req, s.sdkConfiguration.Security); err != nil {
+ return nil, err
+ }
+
+ globalRetryConfig := s.sdkConfiguration.RetryConfig
+ retryConfig := o.Retries
+ if retryConfig == nil {
+ if globalRetryConfig == nil {
+ retryConfig = &retry.Config{
+ Strategy: "backoff",
+ Backoff: &retry.BackoffStrategy{
+ InitialInterval: 50,
+ MaxInterval: 1000,
+ Exponent: 1.5,
+ MaxElapsedTime: 30000,
+ },
+ RetryConnectionErrors: true,
+ }
+ } else {
+ retryConfig = globalRetryConfig
+ }
+ }
+
+ httpRes, err := utils.Retry(ctx, utils.Retries{
+ Config: retryConfig,
+ StatusCodes: []string{
+ "5XX",
+ },
+ }, func() (*http.Response, error) {
+ if req.Body != nil {
+ copyBody, err := req.GetBody()
+ if err != nil {
+ return nil, err
+ }
+ req.Body = copyBody
+ }
+
+ req, err = s.sdkConfiguration.Hooks.BeforeRequest(hooks.BeforeRequestContext{HookContext: hookCtx}, req)
+ if err != nil {
+ return nil, backoff.Permanent(err)
+ }
+
+ httpRes, err := s.sdkConfiguration.Client.Do(req)
+ if err != nil || httpRes == nil {
+ if err != nil {
+ err = fmt.Errorf("error sending request: %w", err)
+ } else {
+ err = fmt.Errorf("error sending request: no response")
+ }
+
+ _, err = s.sdkConfiguration.Hooks.AfterError(hooks.AfterErrorContext{HookContext: hookCtx}, nil, err)
+ }
+ return httpRes, err
+ })
+ if err != nil {
+ return nil, err
+ } else {
+ httpRes, err = s.sdkConfiguration.Hooks.AfterSuccess(hooks.AfterSuccessContext{HookContext: hookCtx}, httpRes)
+ if err != nil {
+ return nil, err
+ }
+ }
+
+ res := &operations.CreateRoleResponse{
+ HTTPMeta: components.HTTPMetadata{
+ Request: req,
+ Response: httpRes,
+ },
+ }
+
+ rawBody, err := io.ReadAll(httpRes.Body)
+ if err != nil {
+ return nil, fmt.Errorf("error reading response body: %w", err)
+ }
+ httpRes.Body.Close()
+ httpRes.Body = io.NopCloser(bytes.NewBuffer(rawBody))
+
+ switch {
+ case httpRes.StatusCode == 200:
+ switch {
+ case utils.MatchContentType(httpRes.Header.Get("Content-Type"), `application/json`):
+ var out operations.CreateRoleResponseBody
+ if err := utils.UnmarshalJsonFromResponseBody(bytes.NewBuffer(rawBody), &out, ""); err != nil {
+ return nil, err
+ }
+
+ res.Object = &out
+ default:
+ return nil, sdkerrors.NewSDKError(fmt.Sprintf("unknown content-type received: %s", httpRes.Header.Get("Content-Type")), httpRes.StatusCode, string(rawBody), httpRes)
+ }
+ case httpRes.StatusCode == 400:
+ switch {
+ case utils.MatchContentType(httpRes.Header.Get("Content-Type"), `application/json`):
+ var out sdkerrors.ErrBadRequest
+ if err := utils.UnmarshalJsonFromResponseBody(bytes.NewBuffer(rawBody), &out, ""); err != nil {
+ return nil, err
+ }
+
+ return nil, &out
+ default:
+ return nil, sdkerrors.NewSDKError(fmt.Sprintf("unknown content-type received: %s", httpRes.Header.Get("Content-Type")), httpRes.StatusCode, string(rawBody), httpRes)
+ }
+ case httpRes.StatusCode == 401:
+ switch {
+ case utils.MatchContentType(httpRes.Header.Get("Content-Type"), `application/json`):
+ var out sdkerrors.ErrUnauthorized
+ if err := utils.UnmarshalJsonFromResponseBody(bytes.NewBuffer(rawBody), &out, ""); err != nil {
+ return nil, err
+ }
+
+ return nil, &out
+ default:
+ return nil, sdkerrors.NewSDKError(fmt.Sprintf("unknown content-type received: %s", httpRes.Header.Get("Content-Type")), httpRes.StatusCode, string(rawBody), httpRes)
+ }
+ case httpRes.StatusCode == 403:
+ switch {
+ case utils.MatchContentType(httpRes.Header.Get("Content-Type"), `application/json`):
+ var out sdkerrors.ErrForbidden
+ if err := utils.UnmarshalJsonFromResponseBody(bytes.NewBuffer(rawBody), &out, ""); err != nil {
+ return nil, err
+ }
+
+ return nil, &out
+ default:
+ return nil, sdkerrors.NewSDKError(fmt.Sprintf("unknown content-type received: %s", httpRes.Header.Get("Content-Type")), httpRes.StatusCode, string(rawBody), httpRes)
+ }
+ case httpRes.StatusCode == 404:
+ switch {
+ case utils.MatchContentType(httpRes.Header.Get("Content-Type"), `application/json`):
+ var out sdkerrors.ErrNotFound
+ if err := utils.UnmarshalJsonFromResponseBody(bytes.NewBuffer(rawBody), &out, ""); err != nil {
+ return nil, err
+ }
+
+ return nil, &out
+ default:
+ return nil, sdkerrors.NewSDKError(fmt.Sprintf("unknown content-type received: %s", httpRes.Header.Get("Content-Type")), httpRes.StatusCode, string(rawBody), httpRes)
+ }
+ case httpRes.StatusCode == 409:
+ switch {
+ case utils.MatchContentType(httpRes.Header.Get("Content-Type"), `application/json`):
+ var out sdkerrors.ErrConflict
+ if err := utils.UnmarshalJsonFromResponseBody(bytes.NewBuffer(rawBody), &out, ""); err != nil {
+ return nil, err
+ }
+
+ return nil, &out
+ default:
+ return nil, sdkerrors.NewSDKError(fmt.Sprintf("unknown content-type received: %s", httpRes.Header.Get("Content-Type")), httpRes.StatusCode, string(rawBody), httpRes)
+ }
+ case httpRes.StatusCode == 429:
+ switch {
+ case utils.MatchContentType(httpRes.Header.Get("Content-Type"), `application/json`):
+ var out sdkerrors.ErrTooManyRequests
+ if err := utils.UnmarshalJsonFromResponseBody(bytes.NewBuffer(rawBody), &out, ""); err != nil {
+ return nil, err
+ }
+
+ return nil, &out
+ default:
+ return nil, sdkerrors.NewSDKError(fmt.Sprintf("unknown content-type received: %s", httpRes.Header.Get("Content-Type")), httpRes.StatusCode, string(rawBody), httpRes)
+ }
+ case httpRes.StatusCode == 500:
+ switch {
+ case utils.MatchContentType(httpRes.Header.Get("Content-Type"), `application/json`):
+ var out sdkerrors.ErrInternalServerError
+ if err := utils.UnmarshalJsonFromResponseBody(bytes.NewBuffer(rawBody), &out, ""); err != nil {
+ return nil, err
+ }
+
+ return nil, &out
+ default:
+ return nil, sdkerrors.NewSDKError(fmt.Sprintf("unknown content-type received: %s", httpRes.Header.Get("Content-Type")), httpRes.StatusCode, string(rawBody), httpRes)
+ }
+ case httpRes.StatusCode >= 400 && httpRes.StatusCode < 500:
+ fallthrough
+ case httpRes.StatusCode >= 500 && httpRes.StatusCode < 600:
+ return nil, sdkerrors.NewSDKError("API error occurred", httpRes.StatusCode, string(rawBody), httpRes)
+ default:
+ return nil, sdkerrors.NewSDKError("unknown status code returned", httpRes.StatusCode, string(rawBody), httpRes)
+ }
+
+ return res, nil
+
+}
+
+func (s *Permissions) DeleteRole(ctx context.Context, request operations.DeleteRoleRequestBody, opts ...operations.Option) (*operations.DeleteRoleResponse, error) {
+ hookCtx := hooks.HookContext{
+ Context: ctx,
+ OperationID: "deleteRole",
+ OAuth2Scopes: []string{},
+ SecuritySource: s.sdkConfiguration.Security,
+ }
+
+ o := operations.Options{}
+ supportedOptions := []string{
+ operations.SupportedOptionRetries,
+ }
+
+ for _, opt := range opts {
+ if err := opt(&o, supportedOptions...); err != nil {
+ return nil, fmt.Errorf("error applying option: %w", err)
+ }
+ }
+ baseURL := utils.ReplaceParameters(s.sdkConfiguration.GetServerDetails())
+ opURL, err := url.JoinPath(baseURL, "/v1/permissions.deleteRole")
+ if err != nil {
+ return nil, fmt.Errorf("error generating URL: %w", err)
+ }
+
+ bodyReader, reqContentType, err := utils.SerializeRequestBody(ctx, request, false, false, "Request", "json", `request:"mediaType=application/json"`)
+ if err != nil {
+ return nil, err
+ }
+
+ req, err := http.NewRequestWithContext(ctx, "POST", opURL, bodyReader)
+ if err != nil {
+ return nil, fmt.Errorf("error creating request: %w", err)
+ }
+ req.Header.Set("Accept", "application/json")
+ req.Header.Set("User-Agent", s.sdkConfiguration.UserAgent)
+ req.Header.Set("Content-Type", reqContentType)
+
+ if err := utils.PopulateSecurity(ctx, req, s.sdkConfiguration.Security); err != nil {
+ return nil, err
+ }
+
+ globalRetryConfig := s.sdkConfiguration.RetryConfig
+ retryConfig := o.Retries
+ if retryConfig == nil {
+ if globalRetryConfig == nil {
+ retryConfig = &retry.Config{
+ Strategy: "backoff",
+ Backoff: &retry.BackoffStrategy{
+ InitialInterval: 50,
+ MaxInterval: 1000,
+ Exponent: 1.5,
+ MaxElapsedTime: 30000,
+ },
+ RetryConnectionErrors: true,
+ }
+ } else {
+ retryConfig = globalRetryConfig
+ }
+ }
+
+ httpRes, err := utils.Retry(ctx, utils.Retries{
+ Config: retryConfig,
+ StatusCodes: []string{
+ "5XX",
+ },
+ }, func() (*http.Response, error) {
+ if req.Body != nil {
+ copyBody, err := req.GetBody()
+ if err != nil {
+ return nil, err
+ }
+ req.Body = copyBody
+ }
+
+ req, err = s.sdkConfiguration.Hooks.BeforeRequest(hooks.BeforeRequestContext{HookContext: hookCtx}, req)
+ if err != nil {
+ return nil, backoff.Permanent(err)
+ }
+
+ httpRes, err := s.sdkConfiguration.Client.Do(req)
+ if err != nil || httpRes == nil {
+ if err != nil {
+ err = fmt.Errorf("error sending request: %w", err)
+ } else {
+ err = fmt.Errorf("error sending request: no response")
+ }
+
+ _, err = s.sdkConfiguration.Hooks.AfterError(hooks.AfterErrorContext{HookContext: hookCtx}, nil, err)
+ }
+ return httpRes, err
+ })
+ if err != nil {
+ return nil, err
+ } else {
+ httpRes, err = s.sdkConfiguration.Hooks.AfterSuccess(hooks.AfterSuccessContext{HookContext: hookCtx}, httpRes)
+ if err != nil {
+ return nil, err
+ }
+ }
+
+ res := &operations.DeleteRoleResponse{
+ HTTPMeta: components.HTTPMetadata{
+ Request: req,
+ Response: httpRes,
+ },
+ }
+
+ rawBody, err := io.ReadAll(httpRes.Body)
+ if err != nil {
+ return nil, fmt.Errorf("error reading response body: %w", err)
+ }
+ httpRes.Body.Close()
+ httpRes.Body = io.NopCloser(bytes.NewBuffer(rawBody))
+
+ switch {
+ case httpRes.StatusCode == 200:
+ switch {
+ case utils.MatchContentType(httpRes.Header.Get("Content-Type"), `application/json`):
+ var out operations.DeleteRoleResponseBody
+ if err := utils.UnmarshalJsonFromResponseBody(bytes.NewBuffer(rawBody), &out, ""); err != nil {
+ return nil, err
+ }
+
+ res.Object = &out
+ default:
+ return nil, sdkerrors.NewSDKError(fmt.Sprintf("unknown content-type received: %s", httpRes.Header.Get("Content-Type")), httpRes.StatusCode, string(rawBody), httpRes)
+ }
+ case httpRes.StatusCode == 400:
+ switch {
+ case utils.MatchContentType(httpRes.Header.Get("Content-Type"), `application/json`):
+ var out sdkerrors.ErrBadRequest
+ if err := utils.UnmarshalJsonFromResponseBody(bytes.NewBuffer(rawBody), &out, ""); err != nil {
+ return nil, err
+ }
+
+ return nil, &out
+ default:
+ return nil, sdkerrors.NewSDKError(fmt.Sprintf("unknown content-type received: %s", httpRes.Header.Get("Content-Type")), httpRes.StatusCode, string(rawBody), httpRes)
+ }
+ case httpRes.StatusCode == 401:
+ switch {
+ case utils.MatchContentType(httpRes.Header.Get("Content-Type"), `application/json`):
+ var out sdkerrors.ErrUnauthorized
+ if err := utils.UnmarshalJsonFromResponseBody(bytes.NewBuffer(rawBody), &out, ""); err != nil {
+ return nil, err
+ }
+
+ return nil, &out
+ default:
+ return nil, sdkerrors.NewSDKError(fmt.Sprintf("unknown content-type received: %s", httpRes.Header.Get("Content-Type")), httpRes.StatusCode, string(rawBody), httpRes)
+ }
+ case httpRes.StatusCode == 403:
+ switch {
+ case utils.MatchContentType(httpRes.Header.Get("Content-Type"), `application/json`):
+ var out sdkerrors.ErrForbidden
+ if err := utils.UnmarshalJsonFromResponseBody(bytes.NewBuffer(rawBody), &out, ""); err != nil {
+ return nil, err
+ }
+
+ return nil, &out
+ default:
+ return nil, sdkerrors.NewSDKError(fmt.Sprintf("unknown content-type received: %s", httpRes.Header.Get("Content-Type")), httpRes.StatusCode, string(rawBody), httpRes)
+ }
+ case httpRes.StatusCode == 404:
+ switch {
+ case utils.MatchContentType(httpRes.Header.Get("Content-Type"), `application/json`):
+ var out sdkerrors.ErrNotFound
+ if err := utils.UnmarshalJsonFromResponseBody(bytes.NewBuffer(rawBody), &out, ""); err != nil {
+ return nil, err
+ }
+
+ return nil, &out
+ default:
+ return nil, sdkerrors.NewSDKError(fmt.Sprintf("unknown content-type received: %s", httpRes.Header.Get("Content-Type")), httpRes.StatusCode, string(rawBody), httpRes)
+ }
+ case httpRes.StatusCode == 409:
+ switch {
+ case utils.MatchContentType(httpRes.Header.Get("Content-Type"), `application/json`):
+ var out sdkerrors.ErrConflict
+ if err := utils.UnmarshalJsonFromResponseBody(bytes.NewBuffer(rawBody), &out, ""); err != nil {
+ return nil, err
+ }
+
+ return nil, &out
+ default:
+ return nil, sdkerrors.NewSDKError(fmt.Sprintf("unknown content-type received: %s", httpRes.Header.Get("Content-Type")), httpRes.StatusCode, string(rawBody), httpRes)
+ }
+ case httpRes.StatusCode == 429:
+ switch {
+ case utils.MatchContentType(httpRes.Header.Get("Content-Type"), `application/json`):
+ var out sdkerrors.ErrTooManyRequests
+ if err := utils.UnmarshalJsonFromResponseBody(bytes.NewBuffer(rawBody), &out, ""); err != nil {
+ return nil, err
+ }
+
+ return nil, &out
+ default:
+ return nil, sdkerrors.NewSDKError(fmt.Sprintf("unknown content-type received: %s", httpRes.Header.Get("Content-Type")), httpRes.StatusCode, string(rawBody), httpRes)
+ }
+ case httpRes.StatusCode == 500:
+ switch {
+ case utils.MatchContentType(httpRes.Header.Get("Content-Type"), `application/json`):
+ var out sdkerrors.ErrInternalServerError
+ if err := utils.UnmarshalJsonFromResponseBody(bytes.NewBuffer(rawBody), &out, ""); err != nil {
+ return nil, err
+ }
+
+ return nil, &out
+ default:
+ return nil, sdkerrors.NewSDKError(fmt.Sprintf("unknown content-type received: %s", httpRes.Header.Get("Content-Type")), httpRes.StatusCode, string(rawBody), httpRes)
+ }
+ case httpRes.StatusCode >= 400 && httpRes.StatusCode < 500:
+ fallthrough
+ case httpRes.StatusCode >= 500 && httpRes.StatusCode < 600:
+ return nil, sdkerrors.NewSDKError("API error occurred", httpRes.StatusCode, string(rawBody), httpRes)
+ default:
+ return nil, sdkerrors.NewSDKError("unknown status code returned", httpRes.StatusCode, string(rawBody), httpRes)
+ }
+
+ return res, nil
+
+}
+
+func (s *Permissions) GetRole(ctx context.Context, request operations.GetRoleRequest, opts ...operations.Option) (*operations.GetRoleResponse, error) {
+ hookCtx := hooks.HookContext{
+ Context: ctx,
+ OperationID: "getRole",
+ OAuth2Scopes: []string{},
+ SecuritySource: s.sdkConfiguration.Security,
+ }
+
+ o := operations.Options{}
+ supportedOptions := []string{
+ operations.SupportedOptionRetries,
+ }
+
+ for _, opt := range opts {
+ if err := opt(&o, supportedOptions...); err != nil {
+ return nil, fmt.Errorf("error applying option: %w", err)
+ }
+ }
+ baseURL := utils.ReplaceParameters(s.sdkConfiguration.GetServerDetails())
+ opURL, err := url.JoinPath(baseURL, "/v1/permissions.getRole")
+ if err != nil {
+ return nil, fmt.Errorf("error generating URL: %w", err)
+ }
+
+ req, err := http.NewRequestWithContext(ctx, "GET", opURL, nil)
+ if err != nil {
+ return nil, fmt.Errorf("error creating request: %w", err)
+ }
+ req.Header.Set("Accept", "application/json")
+ req.Header.Set("User-Agent", s.sdkConfiguration.UserAgent)
+
+ if err := utils.PopulateQueryParams(ctx, req, request, nil); err != nil {
+ return nil, fmt.Errorf("error populating query params: %w", err)
+ }
+
+ if err := utils.PopulateSecurity(ctx, req, s.sdkConfiguration.Security); err != nil {
+ return nil, err
+ }
+
+ globalRetryConfig := s.sdkConfiguration.RetryConfig
+ retryConfig := o.Retries
+ if retryConfig == nil {
+ if globalRetryConfig == nil {
+ retryConfig = &retry.Config{
+ Strategy: "backoff",
+ Backoff: &retry.BackoffStrategy{
+ InitialInterval: 50,
+ MaxInterval: 1000,
+ Exponent: 1.5,
+ MaxElapsedTime: 30000,
+ },
+ RetryConnectionErrors: true,
+ }
+ } else {
+ retryConfig = globalRetryConfig
+ }
+ }
+
+ httpRes, err := utils.Retry(ctx, utils.Retries{
+ Config: retryConfig,
+ StatusCodes: []string{
+ "5XX",
+ },
+ }, func() (*http.Response, error) {
+ if req.Body != nil {
+ copyBody, err := req.GetBody()
+ if err != nil {
+ return nil, err
+ }
+ req.Body = copyBody
+ }
+
+ req, err = s.sdkConfiguration.Hooks.BeforeRequest(hooks.BeforeRequestContext{HookContext: hookCtx}, req)
+ if err != nil {
+ return nil, backoff.Permanent(err)
+ }
+
+ httpRes, err := s.sdkConfiguration.Client.Do(req)
+ if err != nil || httpRes == nil {
+ if err != nil {
+ err = fmt.Errorf("error sending request: %w", err)
+ } else {
+ err = fmt.Errorf("error sending request: no response")
+ }
+
+ _, err = s.sdkConfiguration.Hooks.AfterError(hooks.AfterErrorContext{HookContext: hookCtx}, nil, err)
+ }
+ return httpRes, err
+ })
+ if err != nil {
+ return nil, err
+ } else {
+ httpRes, err = s.sdkConfiguration.Hooks.AfterSuccess(hooks.AfterSuccessContext{HookContext: hookCtx}, httpRes)
+ if err != nil {
+ return nil, err
+ }
+ }
+
+ res := &operations.GetRoleResponse{
+ HTTPMeta: components.HTTPMetadata{
+ Request: req,
+ Response: httpRes,
+ },
+ }
+
+ rawBody, err := io.ReadAll(httpRes.Body)
+ if err != nil {
+ return nil, fmt.Errorf("error reading response body: %w", err)
+ }
+ httpRes.Body.Close()
+ httpRes.Body = io.NopCloser(bytes.NewBuffer(rawBody))
+
+ switch {
+ case httpRes.StatusCode == 200:
+ switch {
+ case utils.MatchContentType(httpRes.Header.Get("Content-Type"), `application/json`):
+ var out operations.GetRoleResponseBody
+ if err := utils.UnmarshalJsonFromResponseBody(bytes.NewBuffer(rawBody), &out, ""); err != nil {
+ return nil, err
+ }
+
+ res.Object = &out
+ default:
+ return nil, sdkerrors.NewSDKError(fmt.Sprintf("unknown content-type received: %s", httpRes.Header.Get("Content-Type")), httpRes.StatusCode, string(rawBody), httpRes)
+ }
+ case httpRes.StatusCode == 400:
+ switch {
+ case utils.MatchContentType(httpRes.Header.Get("Content-Type"), `application/json`):
+ var out sdkerrors.ErrBadRequest
+ if err := utils.UnmarshalJsonFromResponseBody(bytes.NewBuffer(rawBody), &out, ""); err != nil {
+ return nil, err
+ }
+
+ return nil, &out
+ default:
+ return nil, sdkerrors.NewSDKError(fmt.Sprintf("unknown content-type received: %s", httpRes.Header.Get("Content-Type")), httpRes.StatusCode, string(rawBody), httpRes)
+ }
+ case httpRes.StatusCode == 401:
+ switch {
+ case utils.MatchContentType(httpRes.Header.Get("Content-Type"), `application/json`):
+ var out sdkerrors.ErrUnauthorized
+ if err := utils.UnmarshalJsonFromResponseBody(bytes.NewBuffer(rawBody), &out, ""); err != nil {
+ return nil, err
+ }
+
+ return nil, &out
+ default:
+ return nil, sdkerrors.NewSDKError(fmt.Sprintf("unknown content-type received: %s", httpRes.Header.Get("Content-Type")), httpRes.StatusCode, string(rawBody), httpRes)
+ }
+ case httpRes.StatusCode == 403:
+ switch {
+ case utils.MatchContentType(httpRes.Header.Get("Content-Type"), `application/json`):
+ var out sdkerrors.ErrForbidden
+ if err := utils.UnmarshalJsonFromResponseBody(bytes.NewBuffer(rawBody), &out, ""); err != nil {
+ return nil, err
+ }
+
+ return nil, &out
+ default:
+ return nil, sdkerrors.NewSDKError(fmt.Sprintf("unknown content-type received: %s", httpRes.Header.Get("Content-Type")), httpRes.StatusCode, string(rawBody), httpRes)
+ }
+ case httpRes.StatusCode == 404:
+ switch {
+ case utils.MatchContentType(httpRes.Header.Get("Content-Type"), `application/json`):
+ var out sdkerrors.ErrNotFound
+ if err := utils.UnmarshalJsonFromResponseBody(bytes.NewBuffer(rawBody), &out, ""); err != nil {
+ return nil, err
+ }
+
+ return nil, &out
+ default:
+ return nil, sdkerrors.NewSDKError(fmt.Sprintf("unknown content-type received: %s", httpRes.Header.Get("Content-Type")), httpRes.StatusCode, string(rawBody), httpRes)
+ }
+ case httpRes.StatusCode == 409:
+ switch {
+ case utils.MatchContentType(httpRes.Header.Get("Content-Type"), `application/json`):
+ var out sdkerrors.ErrConflict
+ if err := utils.UnmarshalJsonFromResponseBody(bytes.NewBuffer(rawBody), &out, ""); err != nil {
+ return nil, err
+ }
+
+ return nil, &out
+ default:
+ return nil, sdkerrors.NewSDKError(fmt.Sprintf("unknown content-type received: %s", httpRes.Header.Get("Content-Type")), httpRes.StatusCode, string(rawBody), httpRes)
+ }
+ case httpRes.StatusCode == 429:
+ switch {
+ case utils.MatchContentType(httpRes.Header.Get("Content-Type"), `application/json`):
+ var out sdkerrors.ErrTooManyRequests
+ if err := utils.UnmarshalJsonFromResponseBody(bytes.NewBuffer(rawBody), &out, ""); err != nil {
+ return nil, err
+ }
+
+ return nil, &out
+ default:
+ return nil, sdkerrors.NewSDKError(fmt.Sprintf("unknown content-type received: %s", httpRes.Header.Get("Content-Type")), httpRes.StatusCode, string(rawBody), httpRes)
+ }
+ case httpRes.StatusCode == 500:
+ switch {
+ case utils.MatchContentType(httpRes.Header.Get("Content-Type"), `application/json`):
+ var out sdkerrors.ErrInternalServerError
+ if err := utils.UnmarshalJsonFromResponseBody(bytes.NewBuffer(rawBody), &out, ""); err != nil {
+ return nil, err
+ }
+
+ return nil, &out
+ default:
+ return nil, sdkerrors.NewSDKError(fmt.Sprintf("unknown content-type received: %s", httpRes.Header.Get("Content-Type")), httpRes.StatusCode, string(rawBody), httpRes)
+ }
+ case httpRes.StatusCode >= 400 && httpRes.StatusCode < 500:
+ fallthrough
+ case httpRes.StatusCode >= 500 && httpRes.StatusCode < 600:
+ return nil, sdkerrors.NewSDKError("API error occurred", httpRes.StatusCode, string(rawBody), httpRes)
+ default:
+ return nil, sdkerrors.NewSDKError("unknown status code returned", httpRes.StatusCode, string(rawBody), httpRes)
+ }
+
+ return res, nil
+
+}
+
+func (s *Permissions) ListRoles(ctx context.Context, opts ...operations.Option) (*operations.ListRolesResponse, error) {
+ hookCtx := hooks.HookContext{
+ Context: ctx,
+ OperationID: "listRoles",
+ OAuth2Scopes: []string{},
+ SecuritySource: s.sdkConfiguration.Security,
+ }
+
+ o := operations.Options{}
+ supportedOptions := []string{
+ operations.SupportedOptionRetries,
+ }
+
+ for _, opt := range opts {
+ if err := opt(&o, supportedOptions...); err != nil {
+ return nil, fmt.Errorf("error applying option: %w", err)
+ }
+ }
+ baseURL := utils.ReplaceParameters(s.sdkConfiguration.GetServerDetails())
+ opURL, err := url.JoinPath(baseURL, "/v1/permissions.listRoles")
+ if err != nil {
+ return nil, fmt.Errorf("error generating URL: %w", err)
+ }
+
+ req, err := http.NewRequestWithContext(ctx, "GET", opURL, nil)
+ if err != nil {
+ return nil, fmt.Errorf("error creating request: %w", err)
+ }
+ req.Header.Set("Accept", "application/json")
+ req.Header.Set("User-Agent", s.sdkConfiguration.UserAgent)
+
+ if err := utils.PopulateSecurity(ctx, req, s.sdkConfiguration.Security); err != nil {
+ return nil, err
+ }
+
+ globalRetryConfig := s.sdkConfiguration.RetryConfig
+ retryConfig := o.Retries
+ if retryConfig == nil {
+ if globalRetryConfig == nil {
+ retryConfig = &retry.Config{
+ Strategy: "backoff",
+ Backoff: &retry.BackoffStrategy{
+ InitialInterval: 50,
+ MaxInterval: 1000,
+ Exponent: 1.5,
+ MaxElapsedTime: 30000,
+ },
+ RetryConnectionErrors: true,
+ }
+ } else {
+ retryConfig = globalRetryConfig
+ }
+ }
+
+ httpRes, err := utils.Retry(ctx, utils.Retries{
+ Config: retryConfig,
+ StatusCodes: []string{
+ "5XX",
+ },
+ }, func() (*http.Response, error) {
+ if req.Body != nil {
+ copyBody, err := req.GetBody()
+ if err != nil {
+ return nil, err
+ }
+ req.Body = copyBody
+ }
+
+ req, err = s.sdkConfiguration.Hooks.BeforeRequest(hooks.BeforeRequestContext{HookContext: hookCtx}, req)
+ if err != nil {
+ return nil, backoff.Permanent(err)
+ }
+
+ httpRes, err := s.sdkConfiguration.Client.Do(req)
+ if err != nil || httpRes == nil {
+ if err != nil {
+ err = fmt.Errorf("error sending request: %w", err)
+ } else {
+ err = fmt.Errorf("error sending request: no response")
+ }
+
+ _, err = s.sdkConfiguration.Hooks.AfterError(hooks.AfterErrorContext{HookContext: hookCtx}, nil, err)
+ }
+ return httpRes, err
+ })
+ if err != nil {
+ return nil, err
+ } else {
+ httpRes, err = s.sdkConfiguration.Hooks.AfterSuccess(hooks.AfterSuccessContext{HookContext: hookCtx}, httpRes)
+ if err != nil {
+ return nil, err
+ }
+ }
+
+ res := &operations.ListRolesResponse{
+ HTTPMeta: components.HTTPMetadata{
+ Request: req,
+ Response: httpRes,
+ },
+ }
+
+ rawBody, err := io.ReadAll(httpRes.Body)
+ if err != nil {
+ return nil, fmt.Errorf("error reading response body: %w", err)
+ }
+ httpRes.Body.Close()
+ httpRes.Body = io.NopCloser(bytes.NewBuffer(rawBody))
+
+ switch {
+ case httpRes.StatusCode == 200:
+ switch {
+ case utils.MatchContentType(httpRes.Header.Get("Content-Type"), `application/json`):
+ var out []operations.ListRolesResponseBody
+ if err := utils.UnmarshalJsonFromResponseBody(bytes.NewBuffer(rawBody), &out, ""); err != nil {
+ return nil, err
+ }
+
+ res.ResponseBodies = out
+ default:
+ return nil, sdkerrors.NewSDKError(fmt.Sprintf("unknown content-type received: %s", httpRes.Header.Get("Content-Type")), httpRes.StatusCode, string(rawBody), httpRes)
+ }
+ case httpRes.StatusCode == 400:
+ switch {
+ case utils.MatchContentType(httpRes.Header.Get("Content-Type"), `application/json`):
+ var out sdkerrors.ErrBadRequest
+ if err := utils.UnmarshalJsonFromResponseBody(bytes.NewBuffer(rawBody), &out, ""); err != nil {
+ return nil, err
+ }
+
+ return nil, &out
+ default:
+ return nil, sdkerrors.NewSDKError(fmt.Sprintf("unknown content-type received: %s", httpRes.Header.Get("Content-Type")), httpRes.StatusCode, string(rawBody), httpRes)
+ }
+ case httpRes.StatusCode == 401:
+ switch {
+ case utils.MatchContentType(httpRes.Header.Get("Content-Type"), `application/json`):
+ var out sdkerrors.ErrUnauthorized
+ if err := utils.UnmarshalJsonFromResponseBody(bytes.NewBuffer(rawBody), &out, ""); err != nil {
+ return nil, err
+ }
+
+ return nil, &out
+ default:
+ return nil, sdkerrors.NewSDKError(fmt.Sprintf("unknown content-type received: %s", httpRes.Header.Get("Content-Type")), httpRes.StatusCode, string(rawBody), httpRes)
+ }
+ case httpRes.StatusCode == 403:
+ switch {
+ case utils.MatchContentType(httpRes.Header.Get("Content-Type"), `application/json`):
+ var out sdkerrors.ErrForbidden
+ if err := utils.UnmarshalJsonFromResponseBody(bytes.NewBuffer(rawBody), &out, ""); err != nil {
+ return nil, err
+ }
+
+ return nil, &out
+ default:
+ return nil, sdkerrors.NewSDKError(fmt.Sprintf("unknown content-type received: %s", httpRes.Header.Get("Content-Type")), httpRes.StatusCode, string(rawBody), httpRes)
+ }
+ case httpRes.StatusCode == 404:
+ switch {
+ case utils.MatchContentType(httpRes.Header.Get("Content-Type"), `application/json`):
+ var out sdkerrors.ErrNotFound
+ if err := utils.UnmarshalJsonFromResponseBody(bytes.NewBuffer(rawBody), &out, ""); err != nil {
+ return nil, err
+ }
+
+ return nil, &out
+ default:
+ return nil, sdkerrors.NewSDKError(fmt.Sprintf("unknown content-type received: %s", httpRes.Header.Get("Content-Type")), httpRes.StatusCode, string(rawBody), httpRes)
+ }
+ case httpRes.StatusCode == 409:
+ switch {
+ case utils.MatchContentType(httpRes.Header.Get("Content-Type"), `application/json`):
+ var out sdkerrors.ErrConflict
+ if err := utils.UnmarshalJsonFromResponseBody(bytes.NewBuffer(rawBody), &out, ""); err != nil {
+ return nil, err
+ }
+
+ return nil, &out
+ default:
+ return nil, sdkerrors.NewSDKError(fmt.Sprintf("unknown content-type received: %s", httpRes.Header.Get("Content-Type")), httpRes.StatusCode, string(rawBody), httpRes)
+ }
+ case httpRes.StatusCode == 429:
+ switch {
+ case utils.MatchContentType(httpRes.Header.Get("Content-Type"), `application/json`):
+ var out sdkerrors.ErrTooManyRequests
+ if err := utils.UnmarshalJsonFromResponseBody(bytes.NewBuffer(rawBody), &out, ""); err != nil {
+ return nil, err
+ }
+
+ return nil, &out
+ default:
+ return nil, sdkerrors.NewSDKError(fmt.Sprintf("unknown content-type received: %s", httpRes.Header.Get("Content-Type")), httpRes.StatusCode, string(rawBody), httpRes)
+ }
+ case httpRes.StatusCode == 500:
+ switch {
+ case utils.MatchContentType(httpRes.Header.Get("Content-Type"), `application/json`):
+ var out sdkerrors.ErrInternalServerError
+ if err := utils.UnmarshalJsonFromResponseBody(bytes.NewBuffer(rawBody), &out, ""); err != nil {
+ return nil, err
+ }
+
+ return nil, &out
+ default:
+ return nil, sdkerrors.NewSDKError(fmt.Sprintf("unknown content-type received: %s", httpRes.Header.Get("Content-Type")), httpRes.StatusCode, string(rawBody), httpRes)
+ }
+ case httpRes.StatusCode >= 400 && httpRes.StatusCode < 500:
+ fallthrough
+ case httpRes.StatusCode >= 500 && httpRes.StatusCode < 600:
+ return nil, sdkerrors.NewSDKError("API error occurred", httpRes.StatusCode, string(rawBody), httpRes)
+ default:
+ return nil, sdkerrors.NewSDKError("unknown status code returned", httpRes.StatusCode, string(rawBody), httpRes)
+ }
+
+ return res, nil
+
+}
diff --git a/unkey.go b/unkey.go
index e00c05c..52b3b14 100644
--- a/unkey.go
+++ b/unkey.go
@@ -71,11 +71,12 @@ func (c *sdkConfiguration) GetServerDetails() (string, map[string]string) {
}
type Unkey struct {
- Liveness *Liveness
- Keys *Keys
- Apis *Apis
- Ratelimits *Ratelimits
- Migrations *Migrations
+ Liveness *Liveness
+ Keys *Keys
+ Apis *Apis
+ Ratelimits *Ratelimits
+ Migrations *Migrations
+ Permissions *Permissions
sdkConfiguration sdkConfiguration
}
@@ -147,9 +148,9 @@ func New(opts ...SDKOption) *Unkey {
sdkConfiguration: sdkConfiguration{
Language: "go",
OpenAPIDocVersion: "1.0.0",
- SDKVersion: "0.6.0",
- GenVersion: "2.359.0",
- UserAgent: "speakeasy-sdk/go 0.6.0 2.359.0 1.0.0 github.com/unkeyed/unkey-go",
+ SDKVersion: "0.6.1",
+ GenVersion: "2.361.10",
+ UserAgent: "speakeasy-sdk/go 0.6.1 2.361.10 1.0.0 github.com/unkeyed/unkey-go",
Hooks: hooks.New(),
},
}
@@ -179,6 +180,8 @@ func New(opts ...SDKOption) *Unkey {
sdk.Migrations = newMigrations(sdk.sdkConfiguration)
+ sdk.Permissions = newPermissions(sdk.sdkConfiguration)
+
return sdk
}