diff --git a/.gitignore b/.gitignore index b2ed866..cd6b06b 100644 --- a/.gitignore +++ b/.gitignore @@ -1,3 +1,6 @@ +**/.speakeasy/temp/ +**/.speakeasy/logs/ +.speakeasy/reports .venv/ src/*.egg-info/ .python-version diff --git a/.speakeasy/gen.lock b/.speakeasy/gen.lock index 24562c9..dfd44df 100644 --- a/.speakeasy/gen.lock +++ b/.speakeasy/gen.lock @@ -1,12 +1,12 @@ lockVersion: 2.0.0 id: 8618b570-44d2-4c9e-aa91-d78e8fe5330e management: - docChecksum: f899cfa35b2cdbf0c33132e8b3bb7b65 + docChecksum: bfe38c7f353caac54d660ad8b4da7379 docVersion: 1.0.0 - speakeasyVersion: 1.453.4 - generationVersion: 2.474.6 - releaseVersion: 0.9.0 - configChecksum: af10b2f489f315b9d3534884be2253f2 + speakeasyVersion: 1.542.0 + generationVersion: 2.596.2 + releaseVersion: 0.10.0 + configChecksum: e0c6253dd43d90096293129d839ac551 repoURL: https://github.com/unkeyed/unkey-py.git installationURL: https://github.com/unkeyed/unkey-py.git published: true @@ -14,26 +14,26 @@ features: python: additionalDependencies: 1.0.0 constsAndDefaults: 1.0.5 - core: 5.6.9 + core: 5.17.0 defaultEnabledRetries: 0.2.0 - deprecations: 3.0.0 + deprecations: 3.0.2 devContainers: 3.0.0 enumUnions: 0.1.0 envVarSecurityUsage: 0.3.2 - examples: 3.0.0 - flattening: 3.1.0 - globalSecurity: 3.0.2 + examples: 3.0.1 + flattening: 3.1.1 + globalSecurity: 3.0.3 globalSecurityCallbacks: 1.0.0 globalSecurityFlattening: 1.0.0 - globalServerURLs: 3.0.0 - ignores: 3.0.0 + globalServerURLs: 3.1.0 + ignores: 3.0.1 methodArguments: 1.0.2 - nameOverrides: 3.0.0 - nullables: 1.0.0 - pagination: 3.0.1 + nameOverrides: 3.0.1 + nullables: 1.0.1 + pagination: 3.0.5 responseFormat: 1.0.1 retries: 3.0.2 - sdkHooks: 1.0.0 + sdkHooks: 1.0.1 unions: 3.0.4 generatedFiles: - .devcontainer/README.md @@ -42,7 +42,6 @@ generatedFiles: - .gitattributes - .python-version - .vscode/settings.json - - CONTRIBUTING.md - USAGE.md - docs/models/addpermissionspermissions.md - docs/models/addpermissionsrequestbody.md @@ -71,6 +70,7 @@ generatedFiles: - docs/models/createpermissionrequestbody.md - docs/models/createpermissionresponse.md - docs/models/createpermissionresponsebody.md + - docs/models/createroledescription.md - docs/models/createrolerequestbody.md - docs/models/createroleresponse.md - docs/models/createroleresponsebody.md @@ -95,6 +95,8 @@ generatedFiles: - docs/models/deleterolerequestbody.md - docs/models/deleteroleresponse.md - docs/models/deleteroleresponsebody.md + - docs/models/description.md + - docs/models/description2.md - docs/models/errbadrequest.md - docs/models/errbadrequestcode.md - docs/models/errconflict.md @@ -113,6 +115,9 @@ generatedFiles: - docs/models/errnotfoundcode.md - docs/models/errnotfounderror.md - docs/models/error.md + - docs/models/errpreconditionfailed.md + - docs/models/errpreconditionfailedcode.md + - docs/models/errpreconditionfailederror.md - docs/models/errtoomanyrequests.md - docs/models/errtoomanyrequestscode.md - docs/models/errtoomanyrequestserror.md @@ -137,15 +142,21 @@ generatedFiles: - docs/models/getrolerequest.md - docs/models/getroleresponse.md - docs/models/getroleresponsebody.md + - docs/models/getverificationsidentity.md - docs/models/getverificationsrequest.md - docs/models/getverificationsresponse.md - docs/models/getverificationsresponsebody.md - docs/models/granularity.md + - docs/models/groupby.md - docs/models/hash.md - docs/models/httpmetadata.md - docs/models/identity.md - docs/models/interval.md - docs/models/key.md + - docs/models/keyid.md + - docs/models/keysgetverificationsrequest.md + - docs/models/keysgetverificationsresponse.md + - docs/models/keysgetverificationsresponsebody.md - docs/models/limitrequestbody.md - docs/models/limitresponse.md - docs/models/limitresponsebody.md @@ -164,16 +175,18 @@ generatedFiles: - docs/models/listpermissionsresponsebody.md - docs/models/listrolesresponse.md - docs/models/listrolesresponsebody.md + - docs/models/one.md - docs/models/op.md - docs/models/or_.md + - docs/models/order.md + - docs/models/orderby.md - docs/models/overrides.md - docs/models/permissionquery.md + - docs/models/queryparam2.md - docs/models/ratelimitmodel.md - - docs/models/ratelimitsetoverriderequestbody.md - - docs/models/ratelimitsetoverrideresponse.md - - docs/models/ratelimitsetoverrideresponsebody.md - docs/models/ratelimitsmodel.md - docs/models/refill.md + - docs/models/remaining.md - docs/models/removepermissionspermissions.md - docs/models/removepermissionsrequestbody.md - docs/models/removepermissionsresponse.md @@ -188,6 +201,9 @@ generatedFiles: - docs/models/roles.md - docs/models/security.md - docs/models/services.md + - docs/models/setoverriderequestbody.md + - docs/models/setoverrideresponse.md + - docs/models/setoverrideresponsebody.md - docs/models/setpermissionspermissions.md - docs/models/setpermissionsrequestbody.md - docs/models/setpermissionsresponse.md @@ -196,6 +212,8 @@ generatedFiles: - docs/models/setrolesresponse.md - docs/models/setrolesresponsebody.md - docs/models/setrolesroles.md + - docs/models/tag.md + - docs/models/two.md - docs/models/type.md - docs/models/updateidentityidentitiesratelimits.md - docs/models/updateidentityratelimits.md @@ -244,6 +262,7 @@ generatedFiles: - docs/models/whoamirequestbody.md - docs/models/whoamiresponse.md - docs/models/whoamiresponsebody.md + - docs/sdks/analytics/README.md - docs/sdks/apis/README.md - docs/sdks/identities/README.md - docs/sdks/keys/README.md @@ -257,13 +276,14 @@ generatedFiles: - py.typed - pylintrc - pyproject.toml - - scripts/prepare-readme.py + - scripts/prepare_readme.py - scripts/publish.sh - src/unkey_py/__init__.py - src/unkey_py/_hooks/__init__.py - src/unkey_py/_hooks/sdkhooks.py - src/unkey_py/_hooks/types.py - src/unkey_py/_version.py + - src/unkey_py/analytics.py - src/unkey_py/apis.py - src/unkey_py/basesdk.py - src/unkey_py/httpclient.py @@ -292,6 +312,7 @@ generatedFiles: - src/unkey_py/models/errforbidden.py - src/unkey_py/models/errinternalservererror.py - src/unkey_py/models/errnotfound.py + - src/unkey_py/models/errpreconditionfailed.py - src/unkey_py/models/errtoomanyrequests.py - src/unkey_py/models/errunauthorized.py - src/unkey_py/models/getapiop.py @@ -303,6 +324,7 @@ generatedFiles: - src/unkey_py/models/getverificationsop.py - src/unkey_py/models/httpmetadata.py - src/unkey_py/models/key.py + - src/unkey_py/models/keys_getverificationsop.py - src/unkey_py/models/limitop.py - src/unkey_py/models/listidentitiesop.py - src/unkey_py/models/listkeysop.py @@ -310,11 +332,11 @@ generatedFiles: - src/unkey_py/models/listpermissionsop.py - src/unkey_py/models/listrolesop.py - src/unkey_py/models/permissionquery.py - - src/unkey_py/models/ratelimit_setoverrideop.py - src/unkey_py/models/removepermissionsop.py - src/unkey_py/models/removerolesop.py - src/unkey_py/models/sdkerror.py - src/unkey_py/models/security.py + - src/unkey_py/models/setoverrideop.py - src/unkey_py/models/setpermissionsop.py - src/unkey_py/models/setrolesop.py - src/unkey_py/models/updateidentityop.py @@ -337,6 +359,7 @@ generatedFiles: - src/unkey_py/types/basemodel.py - src/unkey_py/utils/__init__.py - src/unkey_py/utils/annotations.py + - src/unkey_py/utils/datetimes.py - src/unkey_py/utils/enums.py - src/unkey_py/utils/eventstreaming.py - src/unkey_py/utils/forms.py @@ -366,6 +389,8 @@ examples: application/json: {"error": {"code": "NOT_FOUND", "docs": "https://unkey.dev/docs/api-reference/errors/code/NOT_FOUND", "message": "", "requestId": "req_1234"}} "409": application/json: {"error": {"code": "CONFLICT", "docs": "https://unkey.dev/docs/api-reference/errors/code/CONFLICT", "message": "", "requestId": "req_1234"}} + "412": + application/json: {"error": {"code": "PRECONDITION_FAILED", "docs": "https://unkey.dev/docs/api-reference/errors/code/PRECONDITION_FAILED", "message": "", "requestId": "req_1234"}} "429": application/json: {"error": {"code": "TOO_MANY_REQUESTS", "docs": "https://unkey.dev/docs/api-reference/errors/code/TOO_MANY_REQUESTS", "message": "", "requestId": "req_1234"}} "500": @@ -388,6 +413,8 @@ examples: application/json: {"error": {"code": "NOT_FOUND", "docs": "https://unkey.dev/docs/api-reference/errors/code/NOT_FOUND", "message": "", "requestId": "req_1234"}} "409": application/json: {"error": {"code": "CONFLICT", "docs": "https://unkey.dev/docs/api-reference/errors/code/CONFLICT", "message": "", "requestId": "req_1234"}} + "412": + application/json: {"error": {"code": "PRECONDITION_FAILED", "docs": "https://unkey.dev/docs/api-reference/errors/code/PRECONDITION_FAILED", "message": "", "requestId": "req_1234"}} "429": application/json: {"error": {"code": "TOO_MANY_REQUESTS", "docs": "https://unkey.dev/docs/api-reference/errors/code/TOO_MANY_REQUESTS", "message": "", "requestId": "req_1234"}} "500": @@ -409,6 +436,8 @@ examples: application/json: {"error": {"code": "NOT_FOUND", "docs": "https://unkey.dev/docs/api-reference/errors/code/NOT_FOUND", "message": "", "requestId": "req_1234"}} "409": application/json: {"error": {"code": "CONFLICT", "docs": "https://unkey.dev/docs/api-reference/errors/code/CONFLICT", "message": "", "requestId": "req_1234"}} + "412": + application/json: {"error": {"code": "PRECONDITION_FAILED", "docs": "https://unkey.dev/docs/api-reference/errors/code/PRECONDITION_FAILED", "message": "", "requestId": "req_1234"}} "429": application/json: {"error": {"code": "TOO_MANY_REQUESTS", "docs": "https://unkey.dev/docs/api-reference/errors/code/TOO_MANY_REQUESTS", "message": "", "requestId": "req_1234"}} "500": @@ -416,8 +445,10 @@ examples: deleteKey: speakeasy-default-delete-key: requestBody: - application/json: {"keyId": "key_1234"} + application/json: {"keyId": "key_1234", "permanent": false} responses: + "200": + application/json: {} "400": application/json: {"error": {"code": "BAD_REQUEST", "docs": "https://unkey.dev/docs/api-reference/errors/code/BAD_REQUEST", "message": "", "requestId": "req_1234"}} "401": @@ -428,15 +459,16 @@ examples: application/json: {"error": {"code": "NOT_FOUND", "docs": "https://unkey.dev/docs/api-reference/errors/code/NOT_FOUND", "message": "", "requestId": "req_1234"}} "409": application/json: {"error": {"code": "CONFLICT", "docs": "https://unkey.dev/docs/api-reference/errors/code/CONFLICT", "message": "", "requestId": "req_1234"}} + "412": + application/json: {"error": {"code": "PRECONDITION_FAILED", "docs": "https://unkey.dev/docs/api-reference/errors/code/PRECONDITION_FAILED", "message": "", "requestId": "req_1234"}} "429": application/json: {"error": {"code": "TOO_MANY_REQUESTS", "docs": "https://unkey.dev/docs/api-reference/errors/code/TOO_MANY_REQUESTS", "message": "", "requestId": "req_1234"}} "500": application/json: {"error": {"code": "INTERNAL_SERVER_ERROR", "docs": "https://unkey.dev/docs/api-reference/errors/code/INTERNAL_SERVER_ERROR", "message": "", "requestId": "req_1234"}} - "200": {} createKey: speakeasy-default-create-key: requestBody: - application/json: {"apiId": "api_123", "name": "my key", "externalId": "team_123", "meta": {"billingTier": "PRO", "trialEnds": "2023-06-16T17:16:37.161Z"}, "roles": ["admin", "finance"], "permissions": ["domains.create_record", "say_hello"], "expires": 1623869797161, "remaining": 1000, "refill": {"interval": "monthly", "amount": 100, "refillDay": 15}, "ratelimit": {"type": "fast", "limit": 10, "duration": 60000}, "enabled": false} + application/json: {"apiId": "api_123", "name": "my key", "byteLength": 16, "externalId": "team_123", "meta": {"billingTier": "PRO", "trialEnds": "2023-06-16T17:16:37.161Z"}, "roles": ["admin", "finance"], "permissions": ["domains.create_record", "say_hello"], "expires": 1623869797161, "remaining": 1000, "refill": {"interval": "monthly", "amount": 100, "refillDay": 15}, "ratelimit": {"async": true, "type": "fast", "limit": 10, "duration": 60000}, "enabled": false, "recoverable": false} responses: "200": application/json: {"keyId": "key_123", "key": "prefix_xxxxxxxxx"} @@ -450,6 +482,8 @@ examples: application/json: {"error": {"code": "NOT_FOUND", "docs": "https://unkey.dev/docs/api-reference/errors/code/NOT_FOUND", "message": "", "requestId": "req_1234"}} "409": application/json: {"error": {"code": "CONFLICT", "docs": "https://unkey.dev/docs/api-reference/errors/code/CONFLICT", "message": "", "requestId": "req_1234"}} + "412": + application/json: {"error": {"code": "PRECONDITION_FAILED", "docs": "https://unkey.dev/docs/api-reference/errors/code/PRECONDITION_FAILED", "message": "", "requestId": "req_1234"}} "429": application/json: {"error": {"code": "TOO_MANY_REQUESTS", "docs": "https://unkey.dev/docs/api-reference/errors/code/TOO_MANY_REQUESTS", "message": "", "requestId": "req_1234"}} "500": @@ -457,10 +491,10 @@ examples: verifyKey: speakeasy-default-verify-key: requestBody: - application/json: {"apiId": "api_1234", "key": "sk_1234", "ratelimits": [{"name": "tokens", "limit": 500, "duration": 3600000}, {"name": "tokens", "limit": 20000, "duration": 86400000}]} + application/json: {"apiId": "api_1234", "key": "sk_1234", "tags": ["path=/v1/users/123", "region=us-east-1"], "ratelimits": [{"name": "tokens", "cost": 1, "limit": 500, "duration": 3600000}, {"name": "tokens", "cost": 1, "limit": 20000, "duration": 86400000}]} responses: "200": - application/json: {"keyId": "key_1234", "valid": true, "name": "Customer X", "ownerId": "user_123", "meta": {"roles": ["admin", "user"], "stripeCustomerId": "cus_1234"}, "expires": 123, "ratelimit": {"limit": 10, "remaining": 9, "reset": 3600000}, "remaining": 1000, "code": "DISABLED", "permissions": ["dns.record.update", "dns.record.delete"], "environment": "test"} + application/json: {"keyId": "key_1234", "valid": true, "name": "Customer X", "ownerId": "user_123", "meta": {"roles": ["admin", "user"], "stripeCustomerId": "cus_1234"}, "expires": 123, "ratelimit": {"limit": 10, "remaining": 9, "reset": 3600000}, "remaining": 1000, "code": "INSUFFICIENT_PERMISSIONS", "permissions": ["dns.record.update", "dns.record.delete"], "roles": ["admin"], "environment": "test", "requestId": ""} "400": application/json: {"error": {"code": "BAD_REQUEST", "docs": "https://unkey.dev/docs/api-reference/errors/code/BAD_REQUEST", "message": "", "requestId": "req_1234"}} "401": @@ -471,6 +505,8 @@ examples: application/json: {"error": {"code": "NOT_FOUND", "docs": "https://unkey.dev/docs/api-reference/errors/code/NOT_FOUND", "message": "", "requestId": "req_1234"}} "409": application/json: {"error": {"code": "CONFLICT", "docs": "https://unkey.dev/docs/api-reference/errors/code/CONFLICT", "message": "", "requestId": "req_1234"}} + "412": + application/json: {"error": {"code": "PRECONDITION_FAILED", "docs": "https://unkey.dev/docs/api-reference/errors/code/PRECONDITION_FAILED", "message": "", "requestId": "req_1234"}} "429": application/json: {"error": {"code": "TOO_MANY_REQUESTS", "docs": "https://unkey.dev/docs/api-reference/errors/code/TOO_MANY_REQUESTS", "message": "", "requestId": "req_1234"}} "500": @@ -478,8 +514,10 @@ examples: updateKey: speakeasy-default-update-key: requestBody: - application/json: {"keyId": "key_123", "name": "Customer X", "externalId": "user_123", "meta": {"roles": ["admin", "user"], "stripeCustomerId": "cus_1234"}, "expires": 0, "ratelimit": {"type": "fast", "limit": 10, "refillRate": 1, "refillInterval": 60}, "remaining": 1000, "refill": {"interval": "daily", "amount": 100}, "enabled": true, "roles": [{"id": "perm_123"}, {"name": "dns.record.create"}, {"name": "dns.record.delete", "create": true}], "permissions": [{"id": "perm_123"}, {"name": "dns.record.create"}, {"name": "dns.record.delete", "create": true}]} + application/json: {"keyId": "key_123", "name": "Customer X", "externalId": "user_123", "meta": {"roles": ["admin", "user"], "stripeCustomerId": "cus_1234"}, "expires": 0, "ratelimit": {"type": "fast", "async": false, "limit": 10, "refillRate": 1, "refillInterval": 60}, "remaining": 1000, "refill": {"interval": "daily", "amount": 100}, "enabled": true, "roles": [{"id": "perm_123"}, {"name": "dns.record.create"}, {"name": "dns.record.delete", "create": true}], "permissions": [{"id": "perm_123"}, {"name": "dns.record.create"}, {"name": "dns.record.delete", "create": true}]} responses: + "200": + application/json: {} "400": application/json: {"error": {"code": "BAD_REQUEST", "docs": "https://unkey.dev/docs/api-reference/errors/code/BAD_REQUEST", "message": "", "requestId": "req_1234"}} "401": @@ -490,11 +528,12 @@ examples: application/json: {"error": {"code": "NOT_FOUND", "docs": "https://unkey.dev/docs/api-reference/errors/code/NOT_FOUND", "message": "", "requestId": "req_1234"}} "409": application/json: {"error": {"code": "CONFLICT", "docs": "https://unkey.dev/docs/api-reference/errors/code/CONFLICT", "message": "", "requestId": "req_1234"}} + "412": + application/json: {"error": {"code": "PRECONDITION_FAILED", "docs": "https://unkey.dev/docs/api-reference/errors/code/PRECONDITION_FAILED", "message": "", "requestId": "req_1234"}} "429": application/json: {"error": {"code": "TOO_MANY_REQUESTS", "docs": "https://unkey.dev/docs/api-reference/errors/code/TOO_MANY_REQUESTS", "message": "", "requestId": "req_1234"}} "500": application/json: {"error": {"code": "INTERNAL_SERVER_ERROR", "docs": "https://unkey.dev/docs/api-reference/errors/code/INTERNAL_SERVER_ERROR", "message": "", "requestId": "req_1234"}} - "200": {} updateRemaining: speakeasy-default-update-remaining: requestBody: @@ -512,12 +551,14 @@ examples: application/json: {"error": {"code": "NOT_FOUND", "docs": "https://unkey.dev/docs/api-reference/errors/code/NOT_FOUND", "message": "", "requestId": "req_1234"}} "409": application/json: {"error": {"code": "CONFLICT", "docs": "https://unkey.dev/docs/api-reference/errors/code/CONFLICT", "message": "", "requestId": "req_1234"}} + "412": + application/json: {"error": {"code": "PRECONDITION_FAILED", "docs": "https://unkey.dev/docs/api-reference/errors/code/PRECONDITION_FAILED", "message": "", "requestId": "req_1234"}} "429": application/json: {"error": {"code": "TOO_MANY_REQUESTS", "docs": "https://unkey.dev/docs/api-reference/errors/code/TOO_MANY_REQUESTS", "message": "", "requestId": "req_1234"}} "500": application/json: {"error": {"code": "INTERNAL_SERVER_ERROR", "docs": "https://unkey.dev/docs/api-reference/errors/code/INTERNAL_SERVER_ERROR", "message": "", "requestId": "req_1234"}} - getVerifications: - speakeasy-default-get-verifications: + keys.getVerifications: + speakeasy-default-keys-get-verifications: parameters: query: keyId: "key_1234" @@ -538,6 +579,8 @@ examples: application/json: {"error": {"code": "NOT_FOUND", "docs": "https://unkey.dev/docs/api-reference/errors/code/NOT_FOUND", "message": "", "requestId": "req_1234"}} "409": application/json: {"error": {"code": "CONFLICT", "docs": "https://unkey.dev/docs/api-reference/errors/code/CONFLICT", "message": "", "requestId": "req_1234"}} + "412": + application/json: {"error": {"code": "PRECONDITION_FAILED", "docs": "https://unkey.dev/docs/api-reference/errors/code/PRECONDITION_FAILED", "message": "", "requestId": "req_1234"}} "429": application/json: {"error": {"code": "TOO_MANY_REQUESTS", "docs": "https://unkey.dev/docs/api-reference/errors/code/TOO_MANY_REQUESTS", "message": "", "requestId": "req_1234"}} "500": @@ -545,10 +588,10 @@ examples: addPermissions: speakeasy-default-add-permissions: requestBody: - application/json: {"keyId": ""} + application/json: {"keyId": "", "permissions": [{}, {}, {}]} responses: "200": - application/json: [{"id": "perm_123", "name": "dns.record.create"}] + application/json: [{"id": "perm_123", "name": "dns.record.create"}, {"id": "perm_123", "name": "dns.record.create"}] "400": application/json: {"error": {"code": "BAD_REQUEST", "docs": "https://unkey.dev/docs/api-reference/errors/code/BAD_REQUEST", "message": "", "requestId": "req_1234"}} "401": @@ -559,6 +602,8 @@ examples: application/json: {"error": {"code": "NOT_FOUND", "docs": "https://unkey.dev/docs/api-reference/errors/code/NOT_FOUND", "message": "", "requestId": "req_1234"}} "409": application/json: {"error": {"code": "CONFLICT", "docs": "https://unkey.dev/docs/api-reference/errors/code/CONFLICT", "message": "", "requestId": "req_1234"}} + "412": + application/json: {"error": {"code": "PRECONDITION_FAILED", "docs": "https://unkey.dev/docs/api-reference/errors/code/PRECONDITION_FAILED", "message": "", "requestId": "req_1234"}} "429": application/json: {"error": {"code": "TOO_MANY_REQUESTS", "docs": "https://unkey.dev/docs/api-reference/errors/code/TOO_MANY_REQUESTS", "message": "", "requestId": "req_1234"}} "500": @@ -568,6 +613,8 @@ examples: requestBody: application/json: {"keyId": "", "permissions": [{"id": "perm_123"}, {"name": "dns.record.create"}]} responses: + "200": + application/json: {} "400": application/json: {"error": {"code": "BAD_REQUEST", "docs": "https://unkey.dev/docs/api-reference/errors/code/BAD_REQUEST", "message": "", "requestId": "req_1234"}} "401": @@ -578,18 +625,19 @@ examples: application/json: {"error": {"code": "NOT_FOUND", "docs": "https://unkey.dev/docs/api-reference/errors/code/NOT_FOUND", "message": "", "requestId": "req_1234"}} "409": application/json: {"error": {"code": "CONFLICT", "docs": "https://unkey.dev/docs/api-reference/errors/code/CONFLICT", "message": "", "requestId": "req_1234"}} + "412": + application/json: {"error": {"code": "PRECONDITION_FAILED", "docs": "https://unkey.dev/docs/api-reference/errors/code/PRECONDITION_FAILED", "message": "", "requestId": "req_1234"}} "429": application/json: {"error": {"code": "TOO_MANY_REQUESTS", "docs": "https://unkey.dev/docs/api-reference/errors/code/TOO_MANY_REQUESTS", "message": "", "requestId": "req_1234"}} "500": application/json: {"error": {"code": "INTERNAL_SERVER_ERROR", "docs": "https://unkey.dev/docs/api-reference/errors/code/INTERNAL_SERVER_ERROR", "message": "", "requestId": "req_1234"}} - "200": {} setPermissions: speakeasy-default-set-permissions: requestBody: application/json: {"keyId": "", "permissions": [{"id": "perm_123"}, {"name": "dns.record.create"}, {"name": "dns.record.delete", "create": true}]} responses: "200": - application/json: [{"id": "perm_123", "name": "dns.record.create"}] + application/json: [{"id": "perm_123", "name": "dns.record.create"}, {"id": "perm_123", "name": "dns.record.create"}] "400": application/json: {"error": {"code": "BAD_REQUEST", "docs": "https://unkey.dev/docs/api-reference/errors/code/BAD_REQUEST", "message": "", "requestId": "req_1234"}} "401": @@ -600,6 +648,8 @@ examples: application/json: {"error": {"code": "NOT_FOUND", "docs": "https://unkey.dev/docs/api-reference/errors/code/NOT_FOUND", "message": "", "requestId": "req_1234"}} "409": application/json: {"error": {"code": "CONFLICT", "docs": "https://unkey.dev/docs/api-reference/errors/code/CONFLICT", "message": "", "requestId": "req_1234"}} + "412": + application/json: {"error": {"code": "PRECONDITION_FAILED", "docs": "https://unkey.dev/docs/api-reference/errors/code/PRECONDITION_FAILED", "message": "", "requestId": "req_1234"}} "429": application/json: {"error": {"code": "TOO_MANY_REQUESTS", "docs": "https://unkey.dev/docs/api-reference/errors/code/TOO_MANY_REQUESTS", "message": "", "requestId": "req_1234"}} "500": @@ -621,6 +671,8 @@ examples: application/json: {"error": {"code": "NOT_FOUND", "docs": "https://unkey.dev/docs/api-reference/errors/code/NOT_FOUND", "message": "", "requestId": "req_1234"}} "409": application/json: {"error": {"code": "CONFLICT", "docs": "https://unkey.dev/docs/api-reference/errors/code/CONFLICT", "message": "", "requestId": "req_1234"}} + "412": + application/json: {"error": {"code": "PRECONDITION_FAILED", "docs": "https://unkey.dev/docs/api-reference/errors/code/PRECONDITION_FAILED", "message": "", "requestId": "req_1234"}} "429": application/json: {"error": {"code": "TOO_MANY_REQUESTS", "docs": "https://unkey.dev/docs/api-reference/errors/code/TOO_MANY_REQUESTS", "message": "", "requestId": "req_1234"}} "500": @@ -630,6 +682,8 @@ examples: requestBody: application/json: {"keyId": "", "roles": [{"id": "role_123"}, {"name": "dns.record.create"}]} responses: + "200": + application/json: {} "400": application/json: {"error": {"code": "BAD_REQUEST", "docs": "https://unkey.dev/docs/api-reference/errors/code/BAD_REQUEST", "message": "", "requestId": "req_1234"}} "401": @@ -640,11 +694,12 @@ examples: application/json: {"error": {"code": "NOT_FOUND", "docs": "https://unkey.dev/docs/api-reference/errors/code/NOT_FOUND", "message": "", "requestId": "req_1234"}} "409": application/json: {"error": {"code": "CONFLICT", "docs": "https://unkey.dev/docs/api-reference/errors/code/CONFLICT", "message": "", "requestId": "req_1234"}} + "412": + application/json: {"error": {"code": "PRECONDITION_FAILED", "docs": "https://unkey.dev/docs/api-reference/errors/code/PRECONDITION_FAILED", "message": "", "requestId": "req_1234"}} "429": application/json: {"error": {"code": "TOO_MANY_REQUESTS", "docs": "https://unkey.dev/docs/api-reference/errors/code/TOO_MANY_REQUESTS", "message": "", "requestId": "req_1234"}} "500": application/json: {"error": {"code": "INTERNAL_SERVER_ERROR", "docs": "https://unkey.dev/docs/api-reference/errors/code/INTERNAL_SERVER_ERROR", "message": "", "requestId": "req_1234"}} - "200": {} setRoles: speakeasy-default-set-roles: requestBody: @@ -662,6 +717,8 @@ examples: application/json: {"error": {"code": "NOT_FOUND", "docs": "https://unkey.dev/docs/api-reference/errors/code/NOT_FOUND", "message": "", "requestId": "req_1234"}} "409": application/json: {"error": {"code": "CONFLICT", "docs": "https://unkey.dev/docs/api-reference/errors/code/CONFLICT", "message": "", "requestId": "req_1234"}} + "412": + application/json: {"error": {"code": "PRECONDITION_FAILED", "docs": "https://unkey.dev/docs/api-reference/errors/code/PRECONDITION_FAILED", "message": "", "requestId": "req_1234"}} "429": application/json: {"error": {"code": "TOO_MANY_REQUESTS", "docs": "https://unkey.dev/docs/api-reference/errors/code/TOO_MANY_REQUESTS", "message": "", "requestId": "req_1234"}} "500": @@ -684,6 +741,8 @@ examples: application/json: {"error": {"code": "NOT_FOUND", "docs": "https://unkey.dev/docs/api-reference/errors/code/NOT_FOUND", "message": "", "requestId": "req_1234"}} "409": application/json: {"error": {"code": "CONFLICT", "docs": "https://unkey.dev/docs/api-reference/errors/code/CONFLICT", "message": "", "requestId": "req_1234"}} + "412": + application/json: {"error": {"code": "PRECONDITION_FAILED", "docs": "https://unkey.dev/docs/api-reference/errors/code/PRECONDITION_FAILED", "message": "", "requestId": "req_1234"}} "429": application/json: {"error": {"code": "TOO_MANY_REQUESTS", "docs": "https://unkey.dev/docs/api-reference/errors/code/TOO_MANY_REQUESTS", "message": "", "requestId": "req_1234"}} "500": @@ -705,6 +764,8 @@ examples: application/json: {"error": {"code": "NOT_FOUND", "docs": "https://unkey.dev/docs/api-reference/errors/code/NOT_FOUND", "message": "", "requestId": "req_1234"}} "409": application/json: {"error": {"code": "CONFLICT", "docs": "https://unkey.dev/docs/api-reference/errors/code/CONFLICT", "message": "", "requestId": "req_1234"}} + "412": + application/json: {"error": {"code": "PRECONDITION_FAILED", "docs": "https://unkey.dev/docs/api-reference/errors/code/PRECONDITION_FAILED", "message": "", "requestId": "req_1234"}} "429": application/json: {"error": {"code": "TOO_MANY_REQUESTS", "docs": "https://unkey.dev/docs/api-reference/errors/code/TOO_MANY_REQUESTS", "message": "", "requestId": "req_1234"}} "500": @@ -715,6 +776,7 @@ examples: query: apiId: "api_1234" limit: 100 + revalidateKeysCache: false responses: "200": application/json: {"keys": [{"id": "key_1234", "start": "sk_5j1", "workspaceId": "ws_1234", "apiId": "api_1234", "name": "Customer X", "ownerId": "user_123", "meta": {"roles": ["admin", "user"], "stripeCustomerId": "cus_1234"}, "createdAt": 0, "updatedAt": 0, "expires": 0, "remaining": 1000, "refill": {"interval": "daily", "amount": 100, "refillDay": 15, "lastRefillAt": 100}, "ratelimit": {"async": true, "limit": 10, "duration": 60}, "roles": ["admin", "finance"], "permissions": ["domain.dns.create_record", "finance.read_receipt"], "enabled": true}, {"id": "key_1234", "start": "sk_5j1", "workspaceId": "ws_1234", "apiId": "api_1234", "name": "Customer X", "ownerId": "user_123", "meta": {"roles": ["admin", "user"], "stripeCustomerId": "cus_1234"}, "createdAt": 0, "updatedAt": 0, "expires": 0, "remaining": 1000, "refill": {"interval": "daily", "amount": 100, "refillDay": 15, "lastRefillAt": 100}, "ratelimit": {"async": true, "limit": 10, "duration": 60}, "roles": ["admin", "finance"], "permissions": ["domain.dns.create_record", "finance.read_receipt"], "enabled": true}], "cursor": "eyJrZXkiOiJrZXlfMTIzNCJ9", "total": 688970} @@ -728,6 +790,8 @@ examples: application/json: {"error": {"code": "NOT_FOUND", "docs": "https://unkey.dev/docs/api-reference/errors/code/NOT_FOUND", "message": "", "requestId": "req_1234"}} "409": application/json: {"error": {"code": "CONFLICT", "docs": "https://unkey.dev/docs/api-reference/errors/code/CONFLICT", "message": "", "requestId": "req_1234"}} + "412": + application/json: {"error": {"code": "PRECONDITION_FAILED", "docs": "https://unkey.dev/docs/api-reference/errors/code/PRECONDITION_FAILED", "message": "", "requestId": "req_1234"}} "429": application/json: {"error": {"code": "TOO_MANY_REQUESTS", "docs": "https://unkey.dev/docs/api-reference/errors/code/TOO_MANY_REQUESTS", "message": "", "requestId": "req_1234"}} "500": @@ -737,6 +801,8 @@ examples: requestBody: application/json: {"apiId": "api_1234"} responses: + "200": + application/json: {} "400": application/json: {"error": {"code": "BAD_REQUEST", "docs": "https://unkey.dev/docs/api-reference/errors/code/BAD_REQUEST", "message": "", "requestId": "req_1234"}} "401": @@ -747,15 +813,16 @@ examples: application/json: {"error": {"code": "NOT_FOUND", "docs": "https://unkey.dev/docs/api-reference/errors/code/NOT_FOUND", "message": "", "requestId": "req_1234"}} "409": application/json: {"error": {"code": "CONFLICT", "docs": "https://unkey.dev/docs/api-reference/errors/code/CONFLICT", "message": "", "requestId": "req_1234"}} + "412": + application/json: {"error": {"code": "PRECONDITION_FAILED", "docs": "https://unkey.dev/docs/api-reference/errors/code/PRECONDITION_FAILED", "message": "", "requestId": "req_1234"}} "429": application/json: {"error": {"code": "DELETE_PROTECTED", "docs": "https://unkey.dev/docs/api-reference/errors/code/DELETE_PROTECTED", "message": "", "requestId": "req_1234"}} "500": application/json: {"error": {"code": "INTERNAL_SERVER_ERROR", "docs": "https://unkey.dev/docs/api-reference/errors/code/INTERNAL_SERVER_ERROR", "message": "", "requestId": "req_1234"}} - "200": {} deleteKeys: speakeasy-default-delete-keys: requestBody: - application/json: {"apiId": "api_1234"} + application/json: {"apiId": "api_1234", "permanent": false} responses: "200": application/json: {"deletedKeys": 282252} @@ -769,6 +836,8 @@ examples: application/json: {"error": {"code": "NOT_FOUND", "docs": "https://unkey.dev/docs/api-reference/errors/code/NOT_FOUND", "message": "", "requestId": "req_1234"}} "409": application/json: {"error": {"code": "CONFLICT", "docs": "https://unkey.dev/docs/api-reference/errors/code/CONFLICT", "message": "", "requestId": "req_1234"}} + "412": + application/json: {"error": {"code": "PRECONDITION_FAILED", "docs": "https://unkey.dev/docs/api-reference/errors/code/PRECONDITION_FAILED", "message": "", "requestId": "req_1234"}} "429": application/json: {"error": {"code": "TOO_MANY_REQUESTS", "docs": "https://unkey.dev/docs/api-reference/errors/code/TOO_MANY_REQUESTS", "message": "", "requestId": "req_1234"}} "500": @@ -776,7 +845,7 @@ examples: limit: speakeasy-default-limit: requestBody: - application/json: {"namespace": "email.outbound", "identifier": "user_123", "limit": 10, "duration": 60000, "cost": 2, "resources": [{"type": "organization", "id": "org_123", "name": "unkey"}]} + application/json: {"namespace": "email.outbound", "identifier": "user_123", "limit": 10, "duration": 60000, "cost": 2, "async": false, "resources": [{"type": "organization", "id": "org_123", "name": "unkey"}]} responses: "200": application/json: {"success": true, "limit": 10, "remaining": 9, "reset": 1709804263654} @@ -790,6 +859,106 @@ examples: application/json: {"error": {"code": "NOT_FOUND", "docs": "https://unkey.dev/docs/api-reference/errors/code/NOT_FOUND", "message": "", "requestId": "req_1234"}} "409": application/json: {"error": {"code": "CONFLICT", "docs": "https://unkey.dev/docs/api-reference/errors/code/CONFLICT", "message": "", "requestId": "req_1234"}} + "412": + application/json: {"error": {"code": "PRECONDITION_FAILED", "docs": "https://unkey.dev/docs/api-reference/errors/code/PRECONDITION_FAILED", "message": "", "requestId": "req_1234"}} + "429": + application/json: {"error": {"code": "TOO_MANY_REQUESTS", "docs": "https://unkey.dev/docs/api-reference/errors/code/TOO_MANY_REQUESTS", "message": "", "requestId": "req_1234"}} + "500": + application/json: {"error": {"code": "INTERNAL_SERVER_ERROR", "docs": "https://unkey.dev/docs/api-reference/errors/code/INTERNAL_SERVER_ERROR", "message": "", "requestId": "req_1234"}} + deleteOverride: + speakeasy-default-delete-override: + requestBody: + application/json: {"namespaceId": "rlns_1234", "namespaceName": "email.outbound", "identifier": "user_123"} + responses: + "200": + application/json: {} + "400": + application/json: {"error": {"code": "BAD_REQUEST", "docs": "https://unkey.dev/docs/api-reference/errors/code/BAD_REQUEST", "message": "", "requestId": "req_1234"}} + "401": + application/json: {"error": {"code": "UNAUTHORIZED", "docs": "https://unkey.dev/docs/api-reference/errors/code/UNAUTHORIZED", "message": "", "requestId": "req_1234"}} + "403": + application/json: {"error": {"code": "FORBIDDEN", "docs": "https://unkey.dev/docs/api-reference/errors/code/FORBIDDEN", "message": "", "requestId": "req_1234"}} + "404": + application/json: {"error": {"code": "NOT_FOUND", "docs": "https://unkey.dev/docs/api-reference/errors/code/NOT_FOUND", "message": "", "requestId": "req_1234"}} + "409": + application/json: {"error": {"code": "CONFLICT", "docs": "https://unkey.dev/docs/api-reference/errors/code/CONFLICT", "message": "", "requestId": "req_1234"}} + "412": + application/json: {"error": {"code": "PRECONDITION_FAILED", "docs": "https://unkey.dev/docs/api-reference/errors/code/PRECONDITION_FAILED", "message": "", "requestId": "req_1234"}} + "429": + application/json: {"error": {"code": "TOO_MANY_REQUESTS", "docs": "https://unkey.dev/docs/api-reference/errors/code/TOO_MANY_REQUESTS", "message": "", "requestId": "req_1234"}} + "500": + application/json: {"error": {"code": "INTERNAL_SERVER_ERROR", "docs": "https://unkey.dev/docs/api-reference/errors/code/INTERNAL_SERVER_ERROR", "message": "", "requestId": "req_1234"}} + setOverride: + speakeasy-default-set-override: + requestBody: + application/json: {"namespaceId": "rlns_1234", "namespaceName": "email.outbound", "identifier": "user_123", "limit": 10, "duration": 60000, "async": false} + responses: + "200": + application/json: {"overrideId": "over_123"} + "400": + application/json: {"error": {"code": "BAD_REQUEST", "docs": "https://unkey.dev/docs/api-reference/errors/code/BAD_REQUEST", "message": "", "requestId": "req_1234"}} + "401": + application/json: {"error": {"code": "UNAUTHORIZED", "docs": "https://unkey.dev/docs/api-reference/errors/code/UNAUTHORIZED", "message": "", "requestId": "req_1234"}} + "403": + application/json: {"error": {"code": "FORBIDDEN", "docs": "https://unkey.dev/docs/api-reference/errors/code/FORBIDDEN", "message": "", "requestId": "req_1234"}} + "404": + application/json: {"error": {"code": "NOT_FOUND", "docs": "https://unkey.dev/docs/api-reference/errors/code/NOT_FOUND", "message": "", "requestId": "req_1234"}} + "409": + application/json: {"error": {"code": "CONFLICT", "docs": "https://unkey.dev/docs/api-reference/errors/code/CONFLICT", "message": "", "requestId": "req_1234"}} + "412": + application/json: {"error": {"code": "PRECONDITION_FAILED", "docs": "https://unkey.dev/docs/api-reference/errors/code/PRECONDITION_FAILED", "message": "", "requestId": "req_1234"}} + "429": + application/json: {"error": {"code": "TOO_MANY_REQUESTS", "docs": "https://unkey.dev/docs/api-reference/errors/code/TOO_MANY_REQUESTS", "message": "", "requestId": "req_1234"}} + "500": + application/json: {"error": {"code": "INTERNAL_SERVER_ERROR", "docs": "https://unkey.dev/docs/api-reference/errors/code/INTERNAL_SERVER_ERROR", "message": "", "requestId": "req_1234"}} + listOverrides: + speakeasy-default-list-overrides: + parameters: + query: + namespaceId: "rlns_1234" + namespaceName: "email.outbound" + limit: 100 + responses: + "200": + application/json: {"overrides": [{"id": "", "identifier": "", "limit": 579960, "duration": 62070}, {"id": "", "identifier": "", "limit": 157093, "duration": 220141}], "cursor": "eyJrZXkiOiJrZXlfMTIzNCJ9", "total": 414453} + "400": + application/json: {"error": {"code": "BAD_REQUEST", "docs": "https://unkey.dev/docs/api-reference/errors/code/BAD_REQUEST", "message": "", "requestId": "req_1234"}} + "401": + application/json: {"error": {"code": "UNAUTHORIZED", "docs": "https://unkey.dev/docs/api-reference/errors/code/UNAUTHORIZED", "message": "", "requestId": "req_1234"}} + "403": + application/json: {"error": {"code": "FORBIDDEN", "docs": "https://unkey.dev/docs/api-reference/errors/code/FORBIDDEN", "message": "", "requestId": "req_1234"}} + "404": + application/json: {"error": {"code": "NOT_FOUND", "docs": "https://unkey.dev/docs/api-reference/errors/code/NOT_FOUND", "message": "", "requestId": "req_1234"}} + "409": + application/json: {"error": {"code": "CONFLICT", "docs": "https://unkey.dev/docs/api-reference/errors/code/CONFLICT", "message": "", "requestId": "req_1234"}} + "412": + application/json: {"error": {"code": "PRECONDITION_FAILED", "docs": "https://unkey.dev/docs/api-reference/errors/code/PRECONDITION_FAILED", "message": "", "requestId": "req_1234"}} + "429": + application/json: {"error": {"code": "TOO_MANY_REQUESTS", "docs": "https://unkey.dev/docs/api-reference/errors/code/TOO_MANY_REQUESTS", "message": "", "requestId": "req_1234"}} + "500": + application/json: {"error": {"code": "INTERNAL_SERVER_ERROR", "docs": "https://unkey.dev/docs/api-reference/errors/code/INTERNAL_SERVER_ERROR", "message": "", "requestId": "req_1234"}} + getOverride: + speakeasy-default-get-override: + parameters: + query: + namespaceId: "rlns_1234" + namespaceName: "email.outbound" + identifier: "user_123" + responses: + "200": + application/json: {"id": "", "identifier": "", "limit": 223250, "duration": 911447} + "400": + application/json: {"error": {"code": "BAD_REQUEST", "docs": "https://unkey.dev/docs/api-reference/errors/code/BAD_REQUEST", "message": "", "requestId": "req_1234"}} + "401": + application/json: {"error": {"code": "UNAUTHORIZED", "docs": "https://unkey.dev/docs/api-reference/errors/code/UNAUTHORIZED", "message": "", "requestId": "req_1234"}} + "403": + application/json: {"error": {"code": "FORBIDDEN", "docs": "https://unkey.dev/docs/api-reference/errors/code/FORBIDDEN", "message": "", "requestId": "req_1234"}} + "404": + application/json: {"error": {"code": "NOT_FOUND", "docs": "https://unkey.dev/docs/api-reference/errors/code/NOT_FOUND", "message": "", "requestId": "req_1234"}} + "409": + application/json: {"error": {"code": "CONFLICT", "docs": "https://unkey.dev/docs/api-reference/errors/code/CONFLICT", "message": "", "requestId": "req_1234"}} + "412": + application/json: {"error": {"code": "PRECONDITION_FAILED", "docs": "https://unkey.dev/docs/api-reference/errors/code/PRECONDITION_FAILED", "message": "", "requestId": "req_1234"}} "429": application/json: {"error": {"code": "TOO_MANY_REQUESTS", "docs": "https://unkey.dev/docs/api-reference/errors/code/TOO_MANY_REQUESTS", "message": "", "requestId": "req_1234"}} "500": @@ -797,7 +966,7 @@ examples: v1.migrations.createKeys: speakeasy-default-v1-migrations-create-keys: requestBody: - application/json: [] + application/json: [{"apiId": "api_123", "name": "my key", "start": "unkey_32kq", "externalId": "user_123", "meta": {"billingTier": "PRO", "trialEnds": "2023-06-16T17:16:37.161Z"}, "roles": ["admin", "finance"], "permissions": ["domains.create_record", "say_hello"], "expires": 1623869797161, "remaining": 1000, "refill": {"interval": "daily", "amount": 100}, "ratelimit": {"async": false, "type": "fast", "limit": 10, "refillRate": 1, "refillInterval": 60}, "enabled": false}, {"apiId": "api_123", "name": "my key", "start": "unkey_32kq", "externalId": "user_123", "meta": {"billingTier": "PRO", "trialEnds": "2023-06-16T17:16:37.161Z"}, "roles": ["admin", "finance"], "permissions": ["domains.create_record", "say_hello"], "expires": 1623869797161, "remaining": 1000, "refill": {"interval": "daily", "amount": 100}, "ratelimit": {"async": false, "type": "fast", "limit": 10, "refillRate": 1, "refillInterval": 60}, "enabled": false}] responses: "200": application/json: {"keyIds": ["key_123", "key_456"]} @@ -811,6 +980,8 @@ examples: application/json: {"error": {"code": "NOT_FOUND", "docs": "https://unkey.dev/docs/api-reference/errors/code/NOT_FOUND", "message": "", "requestId": "req_1234"}} "409": application/json: {"error": {"code": "CONFLICT", "docs": "https://unkey.dev/docs/api-reference/errors/code/CONFLICT", "message": "", "requestId": "req_1234"}} + "412": + application/json: {"error": {"code": "PRECONDITION_FAILED", "docs": "https://unkey.dev/docs/api-reference/errors/code/PRECONDITION_FAILED", "message": "", "requestId": "req_1234"}} "429": application/json: {"error": {"code": "TOO_MANY_REQUESTS", "docs": "https://unkey.dev/docs/api-reference/errors/code/TOO_MANY_REQUESTS", "message": "", "requestId": "req_1234"}} "500": @@ -818,8 +989,10 @@ examples: v1.migrations.enqueueKeys: speakeasy-default-v1-migrations-enqueue-keys: requestBody: - application/json: {"migrationId": "", "apiId": "", "keys": [{"name": "my key", "start": "unkey_32kq", "ownerId": "team_123", "meta": {"billingTier": "PRO", "trialEnds": "2023-06-16T17:16:37.161Z"}, "roles": ["admin", "finance"], "permissions": ["domains.create_record", "say_hello"], "expires": 1623869797161, "remaining": 1000, "refill": {"interval": "daily", "amount": 100}, "ratelimit": {"type": "fast", "limit": 10, "duration": 60000}, "enabled": false}]} + application/json: {"migrationId": "", "apiId": "", "keys": [{"name": "my key", "start": "unkey_32kq", "ownerId": "team_123", "meta": {"billingTier": "PRO", "trialEnds": "2023-06-16T17:16:37.161Z"}, "roles": ["admin", "finance"], "permissions": ["domains.create_record", "say_hello"], "expires": 1623869797161, "remaining": 1000, "refill": {"interval": "daily", "amount": 100}, "ratelimit": {"async": true, "type": "fast", "limit": 10, "duration": 60000}, "enabled": false}, {"name": "my key", "start": "unkey_32kq", "ownerId": "team_123", "meta": {"billingTier": "PRO", "trialEnds": "2023-06-16T17:16:37.161Z"}, "roles": ["admin", "finance"], "permissions": ["domains.create_record", "say_hello"], "expires": 1623869797161, "remaining": 1000, "refill": {"interval": "daily", "amount": 100}, "ratelimit": {"async": true, "type": "fast", "limit": 10, "duration": 60000}, "enabled": false}, {"name": "my key", "start": "unkey_32kq", "ownerId": "team_123", "meta": {"billingTier": "PRO", "trialEnds": "2023-06-16T17:16:37.161Z"}, "roles": ["admin", "finance"], "permissions": ["domains.create_record", "say_hello"], "expires": 1623869797161, "remaining": 1000, "refill": {"interval": "daily", "amount": 100}, "ratelimit": {"async": true, "type": "fast", "limit": 10, "duration": 60000}, "enabled": false}]} responses: + "202": + application/json: {} "400": application/json: {"error": {"code": "BAD_REQUEST", "docs": "https://unkey.dev/docs/api-reference/errors/code/BAD_REQUEST", "message": "", "requestId": "req_1234"}} "401": @@ -830,11 +1003,12 @@ examples: application/json: {"error": {"code": "NOT_FOUND", "docs": "https://unkey.dev/docs/api-reference/errors/code/NOT_FOUND", "message": "", "requestId": "req_1234"}} "409": application/json: {"error": {"code": "CONFLICT", "docs": "https://unkey.dev/docs/api-reference/errors/code/CONFLICT", "message": "", "requestId": "req_1234"}} + "412": + application/json: {"error": {"code": "PRECONDITION_FAILED", "docs": "https://unkey.dev/docs/api-reference/errors/code/PRECONDITION_FAILED", "message": "", "requestId": "req_1234"}} "429": application/json: {"error": {"code": "TOO_MANY_REQUESTS", "docs": "https://unkey.dev/docs/api-reference/errors/code/TOO_MANY_REQUESTS", "message": "", "requestId": "req_1234"}} "500": application/json: {"error": {"code": "INTERNAL_SERVER_ERROR", "docs": "https://unkey.dev/docs/api-reference/errors/code/INTERNAL_SERVER_ERROR", "message": "", "requestId": "req_1234"}} - "202": {} createPermission: speakeasy-default-create-permission: requestBody: @@ -852,6 +1026,8 @@ examples: application/json: {"error": {"code": "NOT_FOUND", "docs": "https://unkey.dev/docs/api-reference/errors/code/NOT_FOUND", "message": "", "requestId": "req_1234"}} "409": application/json: {"error": {"code": "CONFLICT", "docs": "https://unkey.dev/docs/api-reference/errors/code/CONFLICT", "message": "", "requestId": "req_1234"}} + "412": + application/json: {"error": {"code": "PRECONDITION_FAILED", "docs": "https://unkey.dev/docs/api-reference/errors/code/PRECONDITION_FAILED", "message": "", "requestId": "req_1234"}} "429": application/json: {"error": {"code": "TOO_MANY_REQUESTS", "docs": "https://unkey.dev/docs/api-reference/errors/code/TOO_MANY_REQUESTS", "message": "", "requestId": "req_1234"}} "500": @@ -861,6 +1037,8 @@ examples: requestBody: application/json: {"permissionId": "perm_123"} responses: + "200": + application/json: {} "400": application/json: {"error": {"code": "BAD_REQUEST", "docs": "https://unkey.dev/docs/api-reference/errors/code/BAD_REQUEST", "message": "", "requestId": "req_1234"}} "401": @@ -871,11 +1049,12 @@ examples: application/json: {"error": {"code": "NOT_FOUND", "docs": "https://unkey.dev/docs/api-reference/errors/code/NOT_FOUND", "message": "", "requestId": "req_1234"}} "409": application/json: {"error": {"code": "CONFLICT", "docs": "https://unkey.dev/docs/api-reference/errors/code/CONFLICT", "message": "", "requestId": "req_1234"}} + "412": + application/json: {"error": {"code": "PRECONDITION_FAILED", "docs": "https://unkey.dev/docs/api-reference/errors/code/PRECONDITION_FAILED", "message": "", "requestId": "req_1234"}} "429": application/json: {"error": {"code": "TOO_MANY_REQUESTS", "docs": "https://unkey.dev/docs/api-reference/errors/code/TOO_MANY_REQUESTS", "message": "", "requestId": "req_1234"}} "500": application/json: {"error": {"code": "INTERNAL_SERVER_ERROR", "docs": "https://unkey.dev/docs/api-reference/errors/code/INTERNAL_SERVER_ERROR", "message": "", "requestId": "req_1234"}} - "200": {} getPermission: speakeasy-default-get-permission: parameters: @@ -894,6 +1073,8 @@ examples: application/json: {"error": {"code": "NOT_FOUND", "docs": "https://unkey.dev/docs/api-reference/errors/code/NOT_FOUND", "message": "", "requestId": "req_1234"}} "409": application/json: {"error": {"code": "CONFLICT", "docs": "https://unkey.dev/docs/api-reference/errors/code/CONFLICT", "message": "", "requestId": "req_1234"}} + "412": + application/json: {"error": {"code": "PRECONDITION_FAILED", "docs": "https://unkey.dev/docs/api-reference/errors/code/PRECONDITION_FAILED", "message": "", "requestId": "req_1234"}} "429": application/json: {"error": {"code": "TOO_MANY_REQUESTS", "docs": "https://unkey.dev/docs/api-reference/errors/code/TOO_MANY_REQUESTS", "message": "", "requestId": "req_1234"}} "500": @@ -902,7 +1083,7 @@ examples: speakeasy-default-list-permissions: responses: "200": - application/json: [{"id": "perm_123", "name": "domain.record.manager", "description": "Can manage dns records"}] + application/json: [{"id": "perm_123", "name": "domain.record.manager", "description": "Can manage dns records"}, {"id": "perm_123", "name": "domain.record.manager", "description": "Can manage dns records"}, {"id": "perm_123", "name": "domain.record.manager", "description": "Can manage dns records"}] "400": application/json: {"error": {"code": "BAD_REQUEST", "docs": "https://unkey.dev/docs/api-reference/errors/code/BAD_REQUEST", "message": "", "requestId": "req_1234"}} "401": @@ -913,6 +1094,8 @@ examples: application/json: {"error": {"code": "NOT_FOUND", "docs": "https://unkey.dev/docs/api-reference/errors/code/NOT_FOUND", "message": "", "requestId": "req_1234"}} "409": application/json: {"error": {"code": "CONFLICT", "docs": "https://unkey.dev/docs/api-reference/errors/code/CONFLICT", "message": "", "requestId": "req_1234"}} + "412": + application/json: {"error": {"code": "PRECONDITION_FAILED", "docs": "https://unkey.dev/docs/api-reference/errors/code/PRECONDITION_FAILED", "message": "", "requestId": "req_1234"}} "429": application/json: {"error": {"code": "TOO_MANY_REQUESTS", "docs": "https://unkey.dev/docs/api-reference/errors/code/TOO_MANY_REQUESTS", "message": "", "requestId": "req_1234"}} "500": @@ -934,6 +1117,8 @@ examples: application/json: {"error": {"code": "NOT_FOUND", "docs": "https://unkey.dev/docs/api-reference/errors/code/NOT_FOUND", "message": "", "requestId": "req_1234"}} "409": application/json: {"error": {"code": "CONFLICT", "docs": "https://unkey.dev/docs/api-reference/errors/code/CONFLICT", "message": "", "requestId": "req_1234"}} + "412": + application/json: {"error": {"code": "PRECONDITION_FAILED", "docs": "https://unkey.dev/docs/api-reference/errors/code/PRECONDITION_FAILED", "message": "", "requestId": "req_1234"}} "429": application/json: {"error": {"code": "TOO_MANY_REQUESTS", "docs": "https://unkey.dev/docs/api-reference/errors/code/TOO_MANY_REQUESTS", "message": "", "requestId": "req_1234"}} "500": @@ -943,6 +1128,8 @@ examples: requestBody: application/json: {"roleId": "role_123"} responses: + "200": + application/json: {} "400": application/json: {"error": {"code": "BAD_REQUEST", "docs": "https://unkey.dev/docs/api-reference/errors/code/BAD_REQUEST", "message": "", "requestId": "req_1234"}} "401": @@ -953,11 +1140,12 @@ examples: application/json: {"error": {"code": "NOT_FOUND", "docs": "https://unkey.dev/docs/api-reference/errors/code/NOT_FOUND", "message": "", "requestId": "req_1234"}} "409": application/json: {"error": {"code": "CONFLICT", "docs": "https://unkey.dev/docs/api-reference/errors/code/CONFLICT", "message": "", "requestId": "req_1234"}} + "412": + application/json: {"error": {"code": "PRECONDITION_FAILED", "docs": "https://unkey.dev/docs/api-reference/errors/code/PRECONDITION_FAILED", "message": "", "requestId": "req_1234"}} "429": application/json: {"error": {"code": "TOO_MANY_REQUESTS", "docs": "https://unkey.dev/docs/api-reference/errors/code/TOO_MANY_REQUESTS", "message": "", "requestId": "req_1234"}} "500": application/json: {"error": {"code": "INTERNAL_SERVER_ERROR", "docs": "https://unkey.dev/docs/api-reference/errors/code/INTERNAL_SERVER_ERROR", "message": "", "requestId": "req_1234"}} - "200": {} getRole: speakeasy-default-get-role: parameters: @@ -976,6 +1164,8 @@ examples: application/json: {"error": {"code": "NOT_FOUND", "docs": "https://unkey.dev/docs/api-reference/errors/code/NOT_FOUND", "message": "", "requestId": "req_1234"}} "409": application/json: {"error": {"code": "CONFLICT", "docs": "https://unkey.dev/docs/api-reference/errors/code/CONFLICT", "message": "", "requestId": "req_1234"}} + "412": + application/json: {"error": {"code": "PRECONDITION_FAILED", "docs": "https://unkey.dev/docs/api-reference/errors/code/PRECONDITION_FAILED", "message": "", "requestId": "req_1234"}} "429": application/json: {"error": {"code": "TOO_MANY_REQUESTS", "docs": "https://unkey.dev/docs/api-reference/errors/code/TOO_MANY_REQUESTS", "message": "", "requestId": "req_1234"}} "500": @@ -995,6 +1185,8 @@ examples: application/json: {"error": {"code": "NOT_FOUND", "docs": "https://unkey.dev/docs/api-reference/errors/code/NOT_FOUND", "message": "", "requestId": "req_1234"}} "409": application/json: {"error": {"code": "CONFLICT", "docs": "https://unkey.dev/docs/api-reference/errors/code/CONFLICT", "message": "", "requestId": "req_1234"}} + "412": + application/json: {"error": {"code": "PRECONDITION_FAILED", "docs": "https://unkey.dev/docs/api-reference/errors/code/PRECONDITION_FAILED", "message": "", "requestId": "req_1234"}} "429": application/json: {"error": {"code": "TOO_MANY_REQUESTS", "docs": "https://unkey.dev/docs/api-reference/errors/code/TOO_MANY_REQUESTS", "message": "", "requestId": "req_1234"}} "500": @@ -1016,6 +1208,8 @@ examples: application/json: {"error": {"code": "NOT_FOUND", "docs": "https://unkey.dev/docs/api-reference/errors/code/NOT_FOUND", "message": "", "requestId": "req_1234"}} "409": application/json: {"error": {"code": "CONFLICT", "docs": "https://unkey.dev/docs/api-reference/errors/code/CONFLICT", "message": "", "requestId": "req_1234"}} + "412": + application/json: {"error": {"code": "PRECONDITION_FAILED", "docs": "https://unkey.dev/docs/api-reference/errors/code/PRECONDITION_FAILED", "message": "", "requestId": "req_1234"}} "429": application/json: {"error": {"code": "TOO_MANY_REQUESTS", "docs": "https://unkey.dev/docs/api-reference/errors/code/TOO_MANY_REQUESTS", "message": "", "requestId": "req_1234"}} "500": @@ -1028,7 +1222,7 @@ examples: externalId: "id_1234" responses: "200": - application/json: {"id": "", "externalId": "", "meta": {"key": "", "key1": ""}, "ratelimits": [{"name": "tokens", "limit": 10, "duration": 1000}]} + application/json: {"id": "", "externalId": "", "meta": {"key": "", "key1": ""}, "ratelimits": [{"name": "tokens", "limit": 10, "duration": 1000}, {"name": "tokens", "limit": 10, "duration": 1000}]} "400": application/json: {"error": {"code": "BAD_REQUEST", "docs": "https://unkey.dev/docs/api-reference/errors/code/BAD_REQUEST", "message": "", "requestId": "req_1234"}} "401": @@ -1039,6 +1233,8 @@ examples: application/json: {"error": {"code": "NOT_FOUND", "docs": "https://unkey.dev/docs/api-reference/errors/code/NOT_FOUND", "message": "", "requestId": "req_1234"}} "409": application/json: {"error": {"code": "CONFLICT", "docs": "https://unkey.dev/docs/api-reference/errors/code/CONFLICT", "message": "", "requestId": "req_1234"}} + "412": + application/json: {"error": {"code": "PRECONDITION_FAILED", "docs": "https://unkey.dev/docs/api-reference/errors/code/PRECONDITION_FAILED", "message": "", "requestId": "req_1234"}} "429": application/json: {"error": {"code": "TOO_MANY_REQUESTS", "docs": "https://unkey.dev/docs/api-reference/errors/code/TOO_MANY_REQUESTS", "message": "", "requestId": "req_1234"}} "500": @@ -1047,10 +1243,11 @@ examples: speakeasy-default-list-identities: parameters: query: + environment: "default" limit: 100 responses: "200": - application/json: {"identities": [{"id": "", "externalId": "", "ratelimits": [{"name": "tokens", "limit": 10, "duration": 1000}, {"name": "tokens", "limit": 10, "duration": 1000}]}], "cursor": "eyJrZXkiOiJrZXlfMTIzNCJ9", "total": 777201} + application/json: {"identities": [{"id": "", "externalId": "", "ratelimits": [{"name": "tokens", "limit": 10, "duration": 1000}, {"name": "tokens", "limit": 10, "duration": 1000}]}, {"id": "", "externalId": "", "ratelimits": [{"name": "tokens", "limit": 10, "duration": 1000}, {"name": "tokens", "limit": 10, "duration": 1000}]}, {"id": "", "externalId": "", "ratelimits": []}], "cursor": "eyJrZXkiOiJrZXlfMTIzNCJ9", "total": 229716} "400": application/json: {"error": {"code": "BAD_REQUEST", "docs": "https://unkey.dev/docs/api-reference/errors/code/BAD_REQUEST", "message": "", "requestId": "req_1234"}} "401": @@ -1061,6 +1258,8 @@ examples: application/json: {"error": {"code": "NOT_FOUND", "docs": "https://unkey.dev/docs/api-reference/errors/code/NOT_FOUND", "message": "", "requestId": "req_1234"}} "409": application/json: {"error": {"code": "CONFLICT", "docs": "https://unkey.dev/docs/api-reference/errors/code/CONFLICT", "message": "", "requestId": "req_1234"}} + "412": + application/json: {"error": {"code": "PRECONDITION_FAILED", "docs": "https://unkey.dev/docs/api-reference/errors/code/PRECONDITION_FAILED", "message": "", "requestId": "req_1234"}} "429": application/json: {"error": {"code": "TOO_MANY_REQUESTS", "docs": "https://unkey.dev/docs/api-reference/errors/code/TOO_MANY_REQUESTS", "message": "", "requestId": "req_1234"}} "500": @@ -1068,10 +1267,10 @@ examples: updateIdentity: speakeasy-default-update-identity: requestBody: - application/json: {"identityId": "id_1234", "externalId": "user_1234", "ratelimits": [{"name": "tokens", "limit": 10, "duration": 1000}, {"name": "tokens", "limit": 10, "duration": 1000}, {"name": "tokens", "limit": 10, "duration": 1000}]} + application/json: {"identityId": "id_1234", "externalId": "user_1234", "environment": "default", "ratelimits": [{"name": "tokens", "limit": 10, "duration": 1000}, {"name": "tokens", "limit": 10, "duration": 1000}, {"name": "tokens", "limit": 10, "duration": 1000}]} responses: "200": - application/json: {"id": "id_1234", "externalId": "user_1234", "meta": {"stripeSubscriptionId": "sub_1234"}, "ratelimits": [{"name": "tokens", "limit": 10, "duration": 1000}, {"name": "tokens", "limit": 10, "duration": 1000}, {"name": "tokens", "limit": 10, "duration": 1000}]} + application/json: {"id": "id_1234", "externalId": "user_1234", "meta": {"stripeSubscriptionId": "sub_1234"}, "ratelimits": [{"name": "tokens", "limit": 10, "duration": 1000}, {"name": "tokens", "limit": 10, "duration": 1000}]} "400": application/json: {"error": {"code": "BAD_REQUEST", "docs": "https://unkey.dev/docs/api-reference/errors/code/BAD_REQUEST", "message": "", "requestId": "req_1234"}} "401": @@ -1082,6 +1281,8 @@ examples: application/json: {"error": {"code": "NOT_FOUND", "docs": "https://unkey.dev/docs/api-reference/errors/code/NOT_FOUND", "message": "", "requestId": "req_1234"}} "409": application/json: {"error": {"code": "CONFLICT", "docs": "https://unkey.dev/docs/api-reference/errors/code/CONFLICT", "message": "", "requestId": "req_1234"}} + "412": + application/json: {"error": {"code": "PRECONDITION_FAILED", "docs": "https://unkey.dev/docs/api-reference/errors/code/PRECONDITION_FAILED", "message": "", "requestId": "req_1234"}} "429": application/json: {"error": {"code": "TOO_MANY_REQUESTS", "docs": "https://unkey.dev/docs/api-reference/errors/code/TOO_MANY_REQUESTS", "message": "", "requestId": "req_1234"}} "500": @@ -1090,48 +1291,9 @@ examples: speakeasy-default-delete-identity: requestBody: application/json: {"identityId": "id_1234"} - responses: - "400": - application/json: {"error": {"code": "BAD_REQUEST", "docs": "https://unkey.dev/docs/api-reference/errors/code/BAD_REQUEST", "message": "", "requestId": "req_1234"}} - "401": - application/json: {"error": {"code": "UNAUTHORIZED", "docs": "https://unkey.dev/docs/api-reference/errors/code/UNAUTHORIZED", "message": "", "requestId": "req_1234"}} - "403": - application/json: {"error": {"code": "FORBIDDEN", "docs": "https://unkey.dev/docs/api-reference/errors/code/FORBIDDEN", "message": "", "requestId": "req_1234"}} - "404": - application/json: {"error": {"code": "NOT_FOUND", "docs": "https://unkey.dev/docs/api-reference/errors/code/NOT_FOUND", "message": "", "requestId": "req_1234"}} - "409": - application/json: {"error": {"code": "CONFLICT", "docs": "https://unkey.dev/docs/api-reference/errors/code/CONFLICT", "message": "", "requestId": "req_1234"}} - "429": - application/json: {"error": {"code": "TOO_MANY_REQUESTS", "docs": "https://unkey.dev/docs/api-reference/errors/code/TOO_MANY_REQUESTS", "message": "", "requestId": "req_1234"}} - "500": - application/json: {"error": {"code": "INTERNAL_SERVER_ERROR", "docs": "https://unkey.dev/docs/api-reference/errors/code/INTERNAL_SERVER_ERROR", "message": "", "requestId": "req_1234"}} - "200": {} - deleteOverride: - speakeasy-default-delete-override: - requestBody: - application/json: {"namespaceId": "rlns_1234", "namespaceName": "email.outbound", "identifier": "user_123"} - responses: - "400": - application/json: {"error": {"code": "BAD_REQUEST", "docs": "https://unkey.dev/docs/api-reference/errors/code/BAD_REQUEST", "message": "", "requestId": "req_1234"}} - "401": - application/json: {"error": {"code": "UNAUTHORIZED", "docs": "https://unkey.dev/docs/api-reference/errors/code/UNAUTHORIZED", "message": "", "requestId": "req_1234"}} - "403": - application/json: {"error": {"code": "FORBIDDEN", "docs": "https://unkey.dev/docs/api-reference/errors/code/FORBIDDEN", "message": "", "requestId": "req_1234"}} - "404": - application/json: {"error": {"code": "NOT_FOUND", "docs": "https://unkey.dev/docs/api-reference/errors/code/NOT_FOUND", "message": "", "requestId": "req_1234"}} - "409": - application/json: {"error": {"code": "CONFLICT", "docs": "https://unkey.dev/docs/api-reference/errors/code/CONFLICT", "message": "", "requestId": "req_1234"}} - "429": - application/json: {"error": {"code": "TOO_MANY_REQUESTS", "docs": "https://unkey.dev/docs/api-reference/errors/code/TOO_MANY_REQUESTS", "message": "", "requestId": "req_1234"}} - "500": - application/json: {"error": {"code": "INTERNAL_SERVER_ERROR", "docs": "https://unkey.dev/docs/api-reference/errors/code/INTERNAL_SERVER_ERROR", "message": "", "requestId": "req_1234"}} - ratelimit.setOverride: - speakeasy-default-ratelimit-set-override: - requestBody: - application/json: {"namespaceId": "rlns_1234", "namespaceName": "email.outbound", "identifier": "user_123", "limit": 10, "duration": 60000} responses: "200": - application/json: {"overrideId": "over_123"} + application/json: {} "400": application/json: {"error": {"code": "BAD_REQUEST", "docs": "https://unkey.dev/docs/api-reference/errors/code/BAD_REQUEST", "message": "", "requestId": "req_1234"}} "401": @@ -1142,44 +1304,25 @@ examples: application/json: {"error": {"code": "NOT_FOUND", "docs": "https://unkey.dev/docs/api-reference/errors/code/NOT_FOUND", "message": "", "requestId": "req_1234"}} "409": application/json: {"error": {"code": "CONFLICT", "docs": "https://unkey.dev/docs/api-reference/errors/code/CONFLICT", "message": "", "requestId": "req_1234"}} + "412": + application/json: {"error": {"code": "PRECONDITION_FAILED", "docs": "https://unkey.dev/docs/api-reference/errors/code/PRECONDITION_FAILED", "message": "", "requestId": "req_1234"}} "429": application/json: {"error": {"code": "TOO_MANY_REQUESTS", "docs": "https://unkey.dev/docs/api-reference/errors/code/TOO_MANY_REQUESTS", "message": "", "requestId": "req_1234"}} "500": application/json: {"error": {"code": "INTERNAL_SERVER_ERROR", "docs": "https://unkey.dev/docs/api-reference/errors/code/INTERNAL_SERVER_ERROR", "message": "", "requestId": "req_1234"}} - listOverrides: - speakeasy-default-list-overrides: - parameters: - query: - namespaceId: "rlns_1234" - namespaceName: "email.outbound" - limit: 100 - responses: - "200": - application/json: {"overrides": [{"id": "", "identifier": "", "limit": 579960, "duration": 62070}, {"id": "", "identifier": "", "limit": 157093, "duration": 220141}], "cursor": "eyJrZXkiOiJrZXlfMTIzNCJ9", "total": 414453} - "400": - application/json: {"error": {"code": "BAD_REQUEST", "docs": "https://unkey.dev/docs/api-reference/errors/code/BAD_REQUEST", "message": "", "requestId": "req_1234"}} - "401": - application/json: {"error": {"code": "UNAUTHORIZED", "docs": "https://unkey.dev/docs/api-reference/errors/code/UNAUTHORIZED", "message": "", "requestId": "req_1234"}} - "403": - application/json: {"error": {"code": "FORBIDDEN", "docs": "https://unkey.dev/docs/api-reference/errors/code/FORBIDDEN", "message": "", "requestId": "req_1234"}} - "404": - application/json: {"error": {"code": "NOT_FOUND", "docs": "https://unkey.dev/docs/api-reference/errors/code/NOT_FOUND", "message": "", "requestId": "req_1234"}} - "409": - application/json: {"error": {"code": "CONFLICT", "docs": "https://unkey.dev/docs/api-reference/errors/code/CONFLICT", "message": "", "requestId": "req_1234"}} - "429": - application/json: {"error": {"code": "TOO_MANY_REQUESTS", "docs": "https://unkey.dev/docs/api-reference/errors/code/TOO_MANY_REQUESTS", "message": "", "requestId": "req_1234"}} - "500": - application/json: {"error": {"code": "INTERNAL_SERVER_ERROR", "docs": "https://unkey.dev/docs/api-reference/errors/code/INTERNAL_SERVER_ERROR", "message": "", "requestId": "req_1234"}} - getOverride: - speakeasy-default-get-override: + getVerifications: + speakeasy-default-get-verifications: parameters: query: - namespaceId: "rlns_1234" - namespaceName: "email.outbound" - identifier: "user_123" + apiId: "" + keyId: ["key_1234"] + tag: ["key_1234"] + start: 1620000000000 + end: 1620000000000 + order: "asc" responses: "200": - application/json: {"id": "", "identifier": "", "limit": 223250, "duration": 911447} + application/json: [{"total": 143308}, {"total": 39736}] "400": application/json: {"error": {"code": "BAD_REQUEST", "docs": "https://unkey.dev/docs/api-reference/errors/code/BAD_REQUEST", "message": "", "requestId": "req_1234"}} "401": @@ -1190,8 +1333,11 @@ examples: application/json: {"error": {"code": "NOT_FOUND", "docs": "https://unkey.dev/docs/api-reference/errors/code/NOT_FOUND", "message": "", "requestId": "req_1234"}} "409": application/json: {"error": {"code": "CONFLICT", "docs": "https://unkey.dev/docs/api-reference/errors/code/CONFLICT", "message": "", "requestId": "req_1234"}} + "412": + application/json: {"error": {"code": "PRECONDITION_FAILED", "docs": "https://unkey.dev/docs/api-reference/errors/code/PRECONDITION_FAILED", "message": "", "requestId": "req_1234"}} "429": application/json: {"error": {"code": "TOO_MANY_REQUESTS", "docs": "https://unkey.dev/docs/api-reference/errors/code/TOO_MANY_REQUESTS", "message": "", "requestId": "req_1234"}} "500": application/json: {"error": {"code": "INTERNAL_SERVER_ERROR", "docs": "https://unkey.dev/docs/api-reference/errors/code/INTERNAL_SERVER_ERROR", "message": "", "requestId": "req_1234"}} +examplesVersion: 1.0.1 generatedTests: {} diff --git a/.speakeasy/gen.yaml b/.speakeasy/gen.yaml index 646d6b1..00fd37d 100644 --- a/.speakeasy/gen.yaml +++ b/.speakeasy/gen.yaml @@ -10,13 +10,16 @@ generation: useClassNamesForArrayFields: true fixes: nameResolutionDec2023: true + nameResolutionFeb2025: false parameterOrderingFeb2024: true requestResponseComponentNamesFeb2024: true + securityFeb2025: false + sharedErrorComponentsApr2025: false auth: oAuth2ClientCredentialsEnabled: true oAuth2PasswordEnabled: false python: - version: 0.9.0 + version: 0.10.0 additionalDependencies: dev: {} main: {} @@ -25,6 +28,7 @@ python: clientServerStatusCodesAsErrors: true defaultErrorName: SDKError description: Python Client SDK for unkey.com. + enableCustomCodeRegions: false enumFormat: enum envVarPrefix: UNKEY fixFlags: @@ -43,7 +47,9 @@ python: inputModelSuffix: input maxMethodParams: 4 methodArguments: infer-optional-args + moduleName: "" outputModelSuffix: output packageName: unkey.py + pytestTimeout: 0 responseFormat: envelope-http templateVersion: v2 diff --git a/.speakeasy/workflow.lock b/.speakeasy/workflow.lock index bf28eaf..dac263a 100644 --- a/.speakeasy/workflow.lock +++ b/.speakeasy/workflow.lock @@ -1,21 +1,21 @@ -speakeasyVersion: 1.453.4 +speakeasyVersion: 1.542.0 sources: Unkey-OAS: sourceNamespace: unkey-oas - sourceRevisionDigest: sha256:8195101f876a2dee27540ad46a0ff11904f6f41eaab663ca7e6d6ec88adf8c68 - sourceBlobDigest: sha256:2ec7e32aea77a854bdd608875cfcd1110ba479f365389e3707bfff61885ff102 + sourceRevisionDigest: sha256:b8b1c12eb30ce4d7302cd39a23e89311607e6afa6367e7f6f98525f5e067cb79 + sourceBlobDigest: sha256:a49e993937048849bc96687425b26b53cf517b1764c6a6875f9fe2954048413d tags: - latest - - speakeasy-sdk-regen-1730334330 + - speakeasy-sdk-regen-1739752037 - 1.0.0 targets: unkey: source: Unkey-OAS sourceNamespace: unkey-oas - sourceRevisionDigest: sha256:8195101f876a2dee27540ad46a0ff11904f6f41eaab663ca7e6d6ec88adf8c68 - sourceBlobDigest: sha256:2ec7e32aea77a854bdd608875cfcd1110ba479f365389e3707bfff61885ff102 + sourceRevisionDigest: sha256:b8b1c12eb30ce4d7302cd39a23e89311607e6afa6367e7f6f98525f5e067cb79 + sourceBlobDigest: sha256:a49e993937048849bc96687425b26b53cf517b1764c6a6875f9fe2954048413d codeSamplesNamespace: unkey-oas-python-code-samples - codeSamplesRevisionDigest: sha256:4c557e4115ee27d060ee91bebe3faa42dfaea6651b128997b9f722c7992a96fc + codeSamplesRevisionDigest: sha256:8da04e4f13997f10374b747e86cf7244e4e1a9077e641bf6ac58023dd296f4fa workflow: workflowVersion: 1.0.0 speakeasyVersion: latest diff --git a/README.md b/README.md index 60197d4..f929c21 100644 --- a/README.md +++ b/README.md @@ -32,6 +32,7 @@ Developer-friendly & type-safe Python SDK for Unkey's API. * [Server Selection](#server-selection) * [Custom HTTP Client](#custom-http-client) * [Authentication](#authentication) + * [Resource Management](#resource-management) * [Debugging](#debugging) * [Development](#development) * [Maturity](#maturity) @@ -42,6 +43,11 @@ Developer-friendly & type-safe Python SDK for Unkey's API. ## SDK Installation +> [!NOTE] +> **Python version upgrade policy** +> +> Once a Python version reaches its [official end of life date](https://devguide.python.org/versions/), a 3-month grace period is provided for users to upgrade. Following this grace period, the minimum python version supported in the SDK will be updated. + The SDK can be installed with either *pip* or *poetry* package managers. ### PIP @@ -59,6 +65,37 @@ pip install unkey.py ```bash poetry add unkey.py ``` + +### Shell and script usage with `uv` + +You can use this SDK in a Python shell with [uv](https://docs.astral.sh/uv/) and the `uvx` command that comes with it like so: + +```shell +uvx --from unkey.py python +``` + +It's also possible to write a standalone Python script without needing to set up a whole project like so: + +```python +#!/usr/bin/env -S uv run --script +# /// script +# requires-python = ">=3.9" +# dependencies = [ +# "unkey.py", +# ] +# /// + +from unkey_py import Unkey + +sdk = Unkey( + # SDK arguments +) + +# Rest of script here... +``` + +Once that is saved to a file, you can run it with `uv run script.py` where +`script.py` can be replaced with the actual file name. @@ -80,14 +117,17 @@ Generally, the SDK will work well with most IDEs out of the box. However, when u # Synchronous Example from unkey_py import Unkey + with Unkey( bearer_auth="UNKEY_ROOT_KEY", -) as s: - res = s.liveness.check() +) as unkey: + + res = unkey.liveness.check() - if res.object is not None: - # handle response - pass + assert res.object is not None + + # Handle response + print(res.object) ```
@@ -99,14 +139,17 @@ import asyncio from unkey_py import Unkey async def main(): + async with Unkey( bearer_auth="UNKEY_ROOT_KEY", - ) as s: - res = await s.liveness.check_async() + ) as unkey: - if res.object is not None: - # handle response - pass + res = await unkey.liveness.check_async() + + assert res.object is not None + + # Handle response + print(res.object) asyncio.run(main()) ``` @@ -118,6 +161,10 @@ asyncio.run(main())
Available methods +### [analytics](docs/sdks/analytics/README.md) + +* [get_verifications](docs/sdks/analytics/README.md#get_verifications) + ### [apis](docs/sdks/apis/README.md) * [get](docs/sdks/apis/README.md#get) @@ -173,7 +220,7 @@ asyncio.run(main()) ### [ratelimit](docs/sdks/ratelimit/README.md) -* [ratelimit_set_override](docs/sdks/ratelimit/README.md#ratelimit_set_override) +* [set_override](docs/sdks/ratelimit/README.md#set_override) * [list_overrides](docs/sdks/ratelimit/README.md#list_overrides) * [get_override](docs/sdks/ratelimit/README.md#get_override) @@ -197,18 +244,17 @@ Here's an example of one such pagination call: ```python from unkey_py import Unkey + with Unkey( bearer_auth="UNKEY_ROOT_KEY", -) as s: - res = s.identities.list(limit=100) +) as unkey: + + res = unkey.identities.list() - if res.object is not None: - while True: - # handle items + while res is not None: + # Handle items - res = res.next() - if res is None: - break + res = res.next() ``` @@ -220,35 +266,41 @@ Some of the endpoints in this SDK support retries. If you use the SDK without an To change the default retry strategy for a single API call, simply provide a `RetryConfig` object to the call: ```python -from unkey.utils import BackoffStrategy, RetryConfig from unkey_py import Unkey +from unkey_py.utils import BackoffStrategy, RetryConfig + with Unkey( bearer_auth="UNKEY_ROOT_KEY", -) as s: - res = s.liveness.check(, +) as unkey: + + res = unkey.liveness.check(, RetryConfig("backoff", BackoffStrategy(1, 50, 1.1, 100), False)) - if res.object is not None: - # handle response - pass + assert res.object is not None + + # Handle response + print(res.object) ``` If you'd like to override the default retry strategy for all operations that support retries, you can use the `retry_config` optional parameter when initializing the SDK: ```python -from unkey.utils import BackoffStrategy, RetryConfig from unkey_py import Unkey +from unkey_py.utils import BackoffStrategy, RetryConfig + with Unkey( retry_config=RetryConfig("backoff", BackoffStrategy(1, 50, 1.1, 100), False), bearer_auth="UNKEY_ROOT_KEY", -) as s: - res = s.liveness.check() +) as unkey: + + res = unkey.liveness.check() - if res.object is not None: - # handle response - pass + assert res.object is not None + + # Handle response + print(res.object) ``` @@ -276,6 +328,7 @@ When custom error responses are specified for an operation, the SDK may also rai | models.ErrForbidden | 403 | application/json | | models.ErrNotFound | 404 | application/json | | models.ErrConflict | 409 | application/json | +| models.ErrPreconditionFailed | 412 | application/json | | models.ErrTooManyRequests | 429 | application/json | | models.ErrInternalServerError | 500 | application/json | | models.SDKError | 4XX, 5XX | \*/\* | @@ -285,16 +338,19 @@ When custom error responses are specified for an operation, the SDK may also rai ```python from unkey_py import Unkey, models + with Unkey( bearer_auth="UNKEY_ROOT_KEY", -) as s: +) as unkey: res = None try: - res = s.liveness.check() - if res.object is not None: - # handle response - pass + res = unkey.liveness.check() + + assert res.object is not None + + # Handle response + print(res.object) except models.ErrBadRequest as e: # handle e.data: models.ErrBadRequestData @@ -311,6 +367,9 @@ with Unkey( except models.ErrConflict as e: # handle e.data: models.ErrConflictData raise(e) + except models.ErrPreconditionFailed as e: + # handle e.data: models.ErrPreconditionFailedData + raise(e) except models.ErrTooManyRequests as e: # handle e.data: models.ErrTooManyRequestsData raise(e) @@ -328,19 +387,22 @@ with Unkey( ### Override Server URL Per-Client -The default server can also be overridden globally by passing a URL to the `server_url: str` optional parameter when initializing the SDK client instance. For example: +The default server can be overridden globally by passing a URL to the `server_url: str` optional parameter when initializing the SDK client instance. For example: ```python from unkey_py import Unkey + with Unkey( server_url="https://api.unkey.dev", bearer_auth="UNKEY_ROOT_KEY", -) as s: - res = s.liveness.check() +) as unkey: + + res = unkey.liveness.check() - if res.object is not None: - # handle response - pass + assert res.object is not None + + # Handle response + print(res.object) ``` @@ -441,18 +503,48 @@ To authenticate with the API the `bearer_auth` parameter must be set when initia ```python from unkey_py import Unkey + with Unkey( bearer_auth="UNKEY_ROOT_KEY", -) as s: - res = s.liveness.check() +) as unkey: - if res.object is not None: - # handle response - pass + res = unkey.liveness.check() + + assert res.object is not None + + # Handle response + print(res.object) ``` + +## Resource Management + +The `Unkey` class implements the context manager protocol and registers a finalizer function to close the underlying sync and async HTTPX clients it uses under the hood. This will close HTTP connections, release memory and free up other resources held by the SDK. In short-lived Python programs and notebooks that make a few SDK method calls, resource management may not be a concern. However, in longer-lived programs, it is beneficial to create a single SDK instance via a [context manager][context-manager] and reuse it across the application. + +[context-manager]: https://docs.python.org/3/reference/datamodel.html#context-managers + +```python +from unkey_py import Unkey +def main(): + + with Unkey( + bearer_auth="UNKEY_ROOT_KEY", + ) as unkey: + # Rest of application here... + + +# Or when using async: +async def amain(): + + async with Unkey( + bearer_auth="UNKEY_ROOT_KEY", + ) as unkey: + # Rest of application here... +``` + + ## Debugging diff --git a/RELEASES.md b/RELEASES.md index f2578da..52dc9b4 100644 --- a/RELEASES.md +++ b/RELEASES.md @@ -48,4 +48,14 @@ Based on: ### Generated - [python v0.9.0] . ### Releases -- [PyPI v0.9.0] https://pypi.org/project/unkey.py/0.9.0 - . \ No newline at end of file +- [PyPI v0.9.0] https://pypi.org/project/unkey.py/0.9.0 - . + +## 2025-05-03 00:27:24 +### Changes +Based on: +- OpenAPI Doc +- Speakeasy CLI 1.542.0 (2.596.2) https://github.com/speakeasy-api/speakeasy +### Generated +- [python v0.10.0] . +### Releases +- [PyPI v0.10.0] https://pypi.org/project/unkey.py/0.10.0 - . \ No newline at end of file diff --git a/USAGE.md b/USAGE.md index 7d4464d..1333812 100644 --- a/USAGE.md +++ b/USAGE.md @@ -3,14 +3,17 @@ # Synchronous Example from unkey_py import Unkey + with Unkey( bearer_auth="UNKEY_ROOT_KEY", -) as s: - res = s.liveness.check() +) as unkey: + + res = unkey.liveness.check() + + assert res.object is not None - if res.object is not None: - # handle response - pass + # Handle response + print(res.object) ```
@@ -22,14 +25,17 @@ import asyncio from unkey_py import Unkey async def main(): + async with Unkey( bearer_auth="UNKEY_ROOT_KEY", - ) as s: - res = await s.liveness.check_async() + ) as unkey: + + res = await unkey.liveness.check_async() + + assert res.object is not None - if res.object is not None: - # handle response - pass + # Handle response + print(res.object) asyncio.run(main()) ``` diff --git a/docs/models/and_.md b/docs/models/and_.md index 65e6ffc..cb06d7d 100644 --- a/docs/models/and_.md +++ b/docs/models/and_.md @@ -3,6 +3,6 @@ ## Fields -| Field | Type | Required | Description | -| ------------------------------------------------------------ | ------------------------------------------------------------ | ------------------------------------------------------------ | ------------------------------------------------------------ | -| `and_` | List[[models.PermissionQuery](../models/permissionquery.md)] | :heavy_check_mark: | N/A | \ No newline at end of file +| Field | Type | Required | Description | +| ---------------------------------------------------------------------- | ---------------------------------------------------------------------- | ---------------------------------------------------------------------- | ---------------------------------------------------------------------- | +| `and_` | List[[Nullable[models.PermissionQuery]](../models/permissionquery.md)] | :heavy_check_mark: | N/A | \ No newline at end of file diff --git a/docs/models/createidentityrequestbody.md b/docs/models/createidentityrequestbody.md index ae59420..4b9007f 100644 --- a/docs/models/createidentityrequestbody.md +++ b/docs/models/createidentityrequestbody.md @@ -3,8 +3,8 @@ ## Fields -| Field | Type | Required | Description | Example | -| --------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | --------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | --------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | --------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | --------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | -| `external_id` | *str* | :heavy_check_mark: | The id of this identity in your system.

This usually comes from your authentication provider and could be a userId, organisationId or even an email.
It does not matter what you use, as long as it uniquely identifies something in your application.

`externalId`s are unique across your workspace and therefore a `PRECONDITION_FAILED` error is returned when you try to create duplicates.
| user_123 | -| `meta` | Dict[str, *Any*] | :heavy_minus_sign: | Attach metadata to this identity that you need to have access to when verifying a key.

This will be returned as part of the `verifyKey` response.
| | -| `ratelimits` | List[[models.CreateIdentityRatelimits](../models/createidentityratelimits.md)] | :heavy_minus_sign: | Attach ratelimits to this identity.

When verifying keys, you can specify which limits you want to use and all keys attached to this identity, will share the limits. | | \ No newline at end of file +| Field | Type | Required | Description | Example | +| ---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | ---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | ---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | ---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | ---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | +| `external_id` | *str* | :heavy_check_mark: | The id of this identity in your system.

This usually comes from your authentication provider and could be a userId, organisationId or even an email.
It does not matter what you use, as long as it uniquely identifies something in your application.

`externalId`s are unique across your workspace and therefore a `CONFLICT` error is returned when you try to create duplicates.
| user_123 | +| `meta` | Dict[str, *Nullable[Any]*] | :heavy_minus_sign: | Attach metadata to this identity that you need to have access to when verifying a key.

This will be returned as part of the `verifyKey` response.
| | +| `ratelimits` | List[[models.CreateIdentityRatelimits](../models/createidentityratelimits.md)] | :heavy_minus_sign: | Attach ratelimits to this identity.

When verifying keys, you can specify which limits you want to use and all keys attached to this identity, will share the limits. | | \ No newline at end of file diff --git a/docs/models/createkeyratelimit.md b/docs/models/createkeyratelimit.md index da71074..ea50b54 100644 --- a/docs/models/createkeyratelimit.md +++ b/docs/models/createkeyratelimit.md @@ -7,9 +7,9 @@ Unkey comes with per-key fixed-window ratelimiting out of the box. | Field | Type | Required | Description | Example | | ---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | ---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | ---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | ---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | ---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | -| `limit` | *int* | :heavy_check_mark: | The total amount of requests in a given interval. | | | `async_` | *Optional[bool]* | :heavy_minus_sign: | Async will return a response immediately, lowering latency at the cost of accuracy. Will be required soon.

[Learn more](https://unkey.dev/docs/features/ratelimiting) | | | ~~`type`~~ | [Optional[models.CreateKeyType]](../models/createkeytype.md) | :heavy_minus_sign: | : warning: ** DEPRECATED **: This will be removed in a future release, please migrate away from it as soon as possible.

Deprecated, use `async`. Fast ratelimiting doesn't add latency, while consistent ratelimiting is more accurate.

[Learn more](https://unkey.dev/docs/features/ratelimiting) | | +| `limit` | *int* | :heavy_check_mark: | The total amount of requests in a given interval. | | | `duration` | *Optional[int]* | :heavy_minus_sign: | The window duration in milliseconds. Will be required soon. | 60000 | | ~~`refill_rate`~~ | *Optional[int]* | :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. | | | ~~`refill_interval`~~ | *Optional[int]* | :heavy_minus_sign: | : warning: ** DEPRECATED **: This will be removed in a future release, please migrate away from it as soon as possible.

The refill timeframe, in milliseconds. | | \ No newline at end of file diff --git a/docs/models/createkeyrequestbody.md b/docs/models/createkeyrequestbody.md index 2ab77f2..cb79f8a 100644 --- a/docs/models/createkeyrequestbody.md +++ b/docs/models/createkeyrequestbody.md @@ -11,7 +11,7 @@ | `byte_length` | *Optional[int]* | :heavy_minus_sign: | The byte length used to generate your key determines its entropy as well as its length. Higher is better, but keys become longer and more annoying to handle. The default is 16 bytes, or 2^^128 possible combinations. | | | ~~`owner_id`~~ | *Optional[str]* | :heavy_minus_sign: | : warning: ** DEPRECATED **: This will be removed in a future release, please migrate away from it as soon as possible.

Deprecated, use `externalId` | team_123 | | `external_id` | *Optional[str]* | :heavy_minus_sign: | Your user's Id. This will provide a link between Unkey and your customer record.
When validating a key, we will return this back to you, so you can clearly identify your user from their api key. | team_123 | -| `meta` | Dict[str, *Any*] | :heavy_minus_sign: | This is a place for dynamic meta data, anything that feels useful for you should go here | {
"billingTier": "PRO",
"trialEnds": "2023-06-16T17:16:37.161Z"
} | +| `meta` | Dict[str, *Nullable[Any]*] | :heavy_minus_sign: | This is a place for dynamic meta data, anything that feels useful for you should go here | {
"billingTier": "PRO",
"trialEnds": "2023-06-16T17:16:37.161Z"
} | | `roles` | List[*str*] | :heavy_minus_sign: | A list of roles that this key should have. If the role does not exist, an error is thrown | [
"admin",
"finance"
] | | `permissions` | List[*str*] | :heavy_minus_sign: | A list of permissions that this key should have. If the permission does not exist, an error is thrown | [
"domains.create_record",
"say_hello"
] | | `expires` | *Optional[int]* | :heavy_minus_sign: | You can auto expire keys by providing a unix timestamp in milliseconds. Once Keys expire they will automatically be disabled and are no longer valid unless you enable them again. | 1623869797161 | diff --git a/docs/models/createpermissionrequestbody.md b/docs/models/createpermissionrequestbody.md index f8fedbb..7c88eba 100644 --- a/docs/models/createpermissionrequestbody.md +++ b/docs/models/createpermissionrequestbody.md @@ -6,4 +6,4 @@ | Field | Type | Required | Description | Example | | -------------------------------------------------------------------------------------------- | -------------------------------------------------------------------------------------------- | -------------------------------------------------------------------------------------------- | -------------------------------------------------------------------------------------------- | -------------------------------------------------------------------------------------------- | | `name` | *str* | :heavy_check_mark: | The unique name of your permission. | record.write | -| `description` | *Optional[str]* | :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 +| `description` | [Optional[models.Description]](../models/description.md) | :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/createroledescription.md b/docs/models/createroledescription.md new file mode 100644 index 0000000..08d4edb --- /dev/null +++ b/docs/models/createroledescription.md @@ -0,0 +1,19 @@ +# CreateRoleDescription + +Explain what this role does. This is just for your team, your users will not see this. + + +## Supported Types + +### `str` + +```python +value: str = /* values here */ +``` + +### `models.Description2` + +```python +value: models.Description2 = /* values here */ +``` + diff --git a/docs/models/createrolerequestbody.md b/docs/models/createrolerequestbody.md index 8df89df..1eec5a9 100644 --- a/docs/models/createrolerequestbody.md +++ b/docs/models/createrolerequestbody.md @@ -6,4 +6,4 @@ | Field | Type | Required | Description | Example | | -------------------------------------------------------------------------------------- | -------------------------------------------------------------------------------------- | -------------------------------------------------------------------------------------- | -------------------------------------------------------------------------------------- | -------------------------------------------------------------------------------------- | | `name` | *str* | :heavy_check_mark: | The unique name of your role. | dns.records.manager | -| `description` | *Optional[str]* | :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 +| `description` | [Optional[models.CreateRoleDescription]](../models/createroledescription.md) | :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/deletekeyrequestbody.md b/docs/models/deletekeyrequestbody.md index 2b61feb..8d3e5db 100644 --- a/docs/models/deletekeyrequestbody.md +++ b/docs/models/deletekeyrequestbody.md @@ -3,6 +3,7 @@ ## Fields -| Field | Type | Required | Description | Example | -| --------------------------- | --------------------------- | --------------------------- | --------------------------- | --------------------------- | -| `key_id` | *str* | :heavy_check_mark: | The id of the key to revoke | key_1234 | \ No newline at end of file +| Field | Type | Required | Description | Example | +| ----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | ----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | ----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | ----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | ----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | +| `key_id` | *str* | :heavy_check_mark: | The id of the key to revoke | key_1234 | +| `permanent` | *Optional[bool]* | :heavy_minus_sign: | By default Unkey soft deletes keys, so they may be recovered later. If you want to permanently delete it, set permanent=true. This might be necessary if you run into CONFLICT errors during key migration. | | \ No newline at end of file diff --git a/docs/models/deleteoverriderequestbody.md b/docs/models/deleteoverriderequestbody.md index 67317b9..478d738 100644 --- a/docs/models/deleteoverriderequestbody.md +++ b/docs/models/deleteoverriderequestbody.md @@ -5,6 +5,6 @@ | Field | Type | Required | Description | Example | | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ | -| `identifier` | *str* | :heavy_check_mark: | Identifier of your user, this can be their userId, an email, an ip or anything else. Wildcards ( * ) can be used to match multiple identifiers, More info can be found at https://www.unkey.com/docs/ratelimiting/overrides#wildcard-rules | user_123 | | `namespace_id` | *Optional[str]* | :heavy_minus_sign: | The id of the namespace. Either namespaceId or namespaceName must be provided | rlns_1234 | -| `namespace_name` | *Optional[str]* | :heavy_minus_sign: | The name of the namespace. Namespaces group different limits together for better analytics. You might have a namespace for your public API and one for internal tRPC routes. | email.outbound | \ No newline at end of file +| `namespace_name` | *Optional[str]* | :heavy_minus_sign: | The name of the namespace. Namespaces group different limits together for better analytics. You might have a namespace for your public API and one for internal tRPC routes. | email.outbound | +| `identifier` | *str* | :heavy_check_mark: | Identifier of your user, this can be their userId, an email, an ip or anything else. Wildcards ( * ) can be used to match multiple identifiers, More info can be found at https://www.unkey.com/docs/ratelimiting/overrides#wildcard-rules | user_123 | \ No newline at end of file diff --git a/docs/models/description.md b/docs/models/description.md new file mode 100644 index 0000000..48dc30a --- /dev/null +++ b/docs/models/description.md @@ -0,0 +1,19 @@ +# Description + +Explain what this permission does. This is just for your team, your users will not see this. + + +## Supported Types + +### `str` + +```python +value: str = /* values here */ +``` + +### `models.Two` + +```python +value: models.Two = /* values here */ +``` + diff --git a/docs/models/description2.md b/docs/models/description2.md new file mode 100644 index 0000000..33f6a37 --- /dev/null +++ b/docs/models/description2.md @@ -0,0 +1,8 @@ +# Description2 + + +## Values + +| Name | Value | +| --------- | --------- | +| `UNKNOWN` | | \ No newline at end of file diff --git a/docs/models/errpreconditionfailed.md b/docs/models/errpreconditionfailed.md new file mode 100644 index 0000000..3ca688e --- /dev/null +++ b/docs/models/errpreconditionfailed.md @@ -0,0 +1,8 @@ +# ErrPreconditionFailed + + +## Fields + +| Field | Type | Required | Description | +| ---------------------------------------------------------------------------- | ---------------------------------------------------------------------------- | ---------------------------------------------------------------------------- | ---------------------------------------------------------------------------- | +| `error` | [models.ErrPreconditionFailedError](../models/errpreconditionfailederror.md) | :heavy_check_mark: | N/A | \ No newline at end of file diff --git a/docs/models/errpreconditionfailedcode.md b/docs/models/errpreconditionfailedcode.md new file mode 100644 index 0000000..481975d --- /dev/null +++ b/docs/models/errpreconditionfailedcode.md @@ -0,0 +1,10 @@ +# ErrPreconditionFailedCode + +A machine readable error code. + + +## Values + +| Name | Value | +| --------------------- | --------------------- | +| `PRECONDITION_FAILED` | PRECONDITION_FAILED | \ No newline at end of file diff --git a/docs/models/errpreconditionfailederror.md b/docs/models/errpreconditionfailederror.md new file mode 100644 index 0000000..99ebffa --- /dev/null +++ b/docs/models/errpreconditionfailederror.md @@ -0,0 +1,11 @@ +# ErrPreconditionFailedError + + +## Fields + +| Field | Type | Required | Description | Example | +| -------------------------------------------------------------------------- | -------------------------------------------------------------------------- | -------------------------------------------------------------------------- | -------------------------------------------------------------------------- | -------------------------------------------------------------------------- | +| `code` | [models.ErrPreconditionFailedCode](../models/errpreconditionfailedcode.md) | :heavy_check_mark: | A machine readable error code. | PRECONDITION_FAILED | +| `docs` | *str* | :heavy_check_mark: | A link to our documentation with more details about this error code | https://unkey.dev/docs/api-reference/errors/code/PRECONDITION_FAILED | +| `message` | *str* | :heavy_check_mark: | A human readable explanation of what went wrong | | +| `request_id` | *str* | :heavy_check_mark: | Please always include the requestId in your error report | req_1234 | \ No newline at end of file diff --git a/docs/models/getidentityresponsebody.md b/docs/models/getidentityresponsebody.md index 3a9df80..cdc9fb3 100644 --- a/docs/models/getidentityresponsebody.md +++ b/docs/models/getidentityresponsebody.md @@ -9,5 +9,5 @@ The configuration for an api | -------------------------------------------------------------------------------------------------------------------------------- | -------------------------------------------------------------------------------------------------------------------------------- | -------------------------------------------------------------------------------------------------------------------------------- | -------------------------------------------------------------------------------------------------------------------------------- | | `id` | *str* | :heavy_check_mark: | The id of this identity. Used to interact with unkey's API | | `external_id` | *str* | :heavy_check_mark: | The id in your system | -| `meta` | Dict[str, *Any*] | :heavy_check_mark: | The meta object defined for this identity. | +| `meta` | Dict[str, *Nullable[Any]*] | :heavy_check_mark: | The meta object defined for this identity. | | `ratelimits` | List[[models.GetIdentityRatelimits](../models/getidentityratelimits.md)] | :heavy_check_mark: | When verifying keys, you can specify which limits you want to use and all keys attached to this identity, will share the limits. | \ No newline at end of file diff --git a/docs/models/getoverriderequest.md b/docs/models/getoverriderequest.md index bab5cdc..7acb95b 100644 --- a/docs/models/getoverriderequest.md +++ b/docs/models/getoverriderequest.md @@ -5,6 +5,6 @@ | Field | Type | Required | Description | Example | | ------------------ | ------------------ | ------------------ | ------------------ | ------------------ | -| `identifier` | *str* | :heavy_check_mark: | N/A | user_123 | | `namespace_id` | *Optional[str]* | :heavy_minus_sign: | N/A | rlns_1234 | -| `namespace_name` | *Optional[str]* | :heavy_minus_sign: | N/A | email.outbound | \ No newline at end of file +| `namespace_name` | *Optional[str]* | :heavy_minus_sign: | N/A | email.outbound | +| `identifier` | *str* | :heavy_check_mark: | N/A | user_123 | \ No newline at end of file diff --git a/docs/models/getverificationsidentity.md b/docs/models/getverificationsidentity.md new file mode 100644 index 0000000..a482711 --- /dev/null +++ b/docs/models/getverificationsidentity.md @@ -0,0 +1,12 @@ +# GetVerificationsIdentity + +Only available when specifying groupBy=identity in the query. +In this case there would be one datapoint per time and groupBy target. + + +## Fields + +| Field | Type | Required | Description | +| ------------------ | ------------------ | ------------------ | ------------------ | +| `id` | *str* | :heavy_check_mark: | N/A | +| `external_id` | *str* | :heavy_check_mark: | N/A | \ No newline at end of file diff --git a/docs/models/getverificationsrequest.md b/docs/models/getverificationsrequest.md index 37caaa8..993505d 100644 --- a/docs/models/getverificationsrequest.md +++ b/docs/models/getverificationsrequest.md @@ -3,10 +3,15 @@ ## Fields -| Field | Type | Required | Description | Example | -| ----------------------------------------------------------------------------- | ----------------------------------------------------------------------------- | ----------------------------------------------------------------------------- | ----------------------------------------------------------------------------- | ----------------------------------------------------------------------------- | -| `key_id` | *Optional[str]* | :heavy_minus_sign: | N/A | key_1234 | -| `owner_id` | *Optional[str]* | :heavy_minus_sign: | N/A | chronark | -| `start` | *OptionalNullable[int]* | :heavy_minus_sign: | N/A | 1620000000000 | -| `end` | *OptionalNullable[int]* | :heavy_minus_sign: | N/A | 1620000000000 | -| `granularity` | [Optional[models.Granularity]](../models/granularity.md) | :heavy_minus_sign: | The granularity of the usage data to fetch, currently only `day` is supported | day | \ No newline at end of file +| Field | Type | Required | Description | Example | +| ---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | ---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | ---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | ---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | ---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | +| `api_id` | *str* | :heavy_check_mark: | N/A | | +| `external_id` | *Optional[str]* | :heavy_minus_sign: | N/A | | +| `key_id` | [Optional[models.KeyID]](../models/keyid.md) | :heavy_minus_sign: | Only include data for a specific key or keys.

When you are providing zero or more than one key ids, all usage counts are aggregated and summed up. Send multiple requests with one keyId each if you need counts per key.

| [
"key_1234"
] | +| `tag` | [Optional[models.Tag]](../models/tag.md) | :heavy_minus_sign: | Only include data for a specific tag or tags.

When you are providing zero or more than one tag, all usage counts are aggregated and summed up. Send multiple requests with one tag each if you need counts per tag. | [
"key_1234"
] | +| `start` | *OptionalNullable[int]* | :heavy_minus_sign: | N/A | 1620000000000 | +| `end` | *OptionalNullable[int]* | :heavy_minus_sign: | N/A | 1620000000000 | +| `group_by` | [Optional[models.GroupBy]](../models/groupby.md) | :heavy_minus_sign: | By default, datapoints are not aggregated, however you probably want to get a breakdown per time, key or identity.

Grouping by tags and by tag is mutually exclusive. | | +| `limit` | *Optional[int]* | :heavy_minus_sign: | N/A | | +| `order_by` | [Optional[models.OrderBy]](../models/orderby.md) | :heavy_minus_sign: | Sort the output by a specific value. You can use this in combination with the `order` param. | | +| `order` | [Optional[models.Order]](../models/order.md) | :heavy_minus_sign: | Define the order of sorting. Use this in combination with `orderBy` | | \ No newline at end of file diff --git a/docs/models/getverificationsresponse.md b/docs/models/getverificationsresponse.md index 2544078..99aa275 100644 --- a/docs/models/getverificationsresponse.md +++ b/docs/models/getverificationsresponse.md @@ -3,7 +3,7 @@ ## Fields -| Field | Type | Required | Description | -| ------------------------------------------------------------------------------------------ | ------------------------------------------------------------------------------------------ | ------------------------------------------------------------------------------------------ | ------------------------------------------------------------------------------------------ | -| `http_meta` | [models.HTTPMetadata](../models/httpmetadata.md) | :heavy_check_mark: | N/A | -| `object` | [Optional[models.GetVerificationsResponseBody]](../models/getverificationsresponsebody.md) | :heavy_minus_sign: | Usage numbers over time | \ No newline at end of file +| Field | Type | Required | Description | +| -------------------------------------------------------------------------------------------------- | -------------------------------------------------------------------------------------------------- | -------------------------------------------------------------------------------------------------- | -------------------------------------------------------------------------------------------------- | +| `http_meta` | [models.HTTPMetadata](../models/httpmetadata.md) | :heavy_check_mark: | N/A | +| `response_bodies` | List[[models.GetVerificationsResponseBody](../models/getverificationsresponsebody.md)] | :heavy_minus_sign: | Retrieve all required data to build end-user facing dashboards and drive your usage-based billing. | \ No newline at end of file diff --git a/docs/models/getverificationsresponsebody.md b/docs/models/getverificationsresponsebody.md index d084852..40afbf9 100644 --- a/docs/models/getverificationsresponsebody.md +++ b/docs/models/getverificationsresponsebody.md @@ -1,10 +1,22 @@ # GetVerificationsResponseBody -Usage numbers over time - ## Fields -| Field | Type | Required | Description | -| -------------------------------------------------------- | -------------------------------------------------------- | -------------------------------------------------------- | -------------------------------------------------------- | -| `verifications` | List[[models.Verifications](../models/verifications.md)] | :heavy_check_mark: | N/A | \ No newline at end of file +| Field | Type | Required | Description | +| ------------------------------------------------------------------------------------------------------------------------------------ | ------------------------------------------------------------------------------------------------------------------------------------ | ------------------------------------------------------------------------------------------------------------------------------------ | ------------------------------------------------------------------------------------------------------------------------------------ | +| `time` | *Optional[int]* | :heavy_minus_sign: | Unix timestamp in milliseconds of the start of the current time slice. | +| `valid` | *Optional[int]* | :heavy_minus_sign: | N/A | +| `not_found` | *Optional[int]* | :heavy_minus_sign: | N/A | +| `forbidden` | *Optional[int]* | :heavy_minus_sign: | N/A | +| `usage_exceeded` | *Optional[int]* | :heavy_minus_sign: | N/A | +| `rate_limited` | *Optional[int]* | :heavy_minus_sign: | N/A | +| `unauthorized` | *Optional[int]* | :heavy_minus_sign: | N/A | +| `disabled` | *Optional[int]* | :heavy_minus_sign: | N/A | +| `insufficient_permissions` | *Optional[int]* | :heavy_minus_sign: | N/A | +| `expired` | *Optional[int]* | :heavy_minus_sign: | N/A | +| `total` | *int* | :heavy_check_mark: | Total number of verifications in the current time slice, regardless of outcome. | +| `tag` | *Optional[str]* | :heavy_minus_sign: | Only available when grouping by tag. | +| `tags` | List[*str*] | :heavy_minus_sign: | Filter by one or multiple tags. If multiple tags are provided | +| `key_id` | *Optional[str]* | :heavy_minus_sign: | Only available when specifying groupBy=key in the query.
In this case there would be one datapoint per time and groupBy target. | +| `identity` | [Optional[models.GetVerificationsIdentity]](../models/getverificationsidentity.md) | :heavy_minus_sign: | Only available when specifying groupBy=identity in the query.
In this case there would be one datapoint per time and groupBy target. | \ No newline at end of file diff --git a/docs/models/groupby.md b/docs/models/groupby.md new file mode 100644 index 0000000..5997d7a --- /dev/null +++ b/docs/models/groupby.md @@ -0,0 +1,21 @@ +# GroupBy + +By default, datapoints are not aggregated, however you probably want to get a breakdown per time, key or identity. + +Grouping by tags and by tag is mutually exclusive. + + +## Supported Types + +### `models.One` + +```python +value: models.One = /* values here */ +``` + +### `List[models.QueryParam2]` + +```python +value: List[models.QueryParam2] = /* values here */ +``` + diff --git a/docs/models/identity.md b/docs/models/identity.md index e77dcf3..c3faad0 100644 --- a/docs/models/identity.md +++ b/docs/models/identity.md @@ -9,4 +9,4 @@ The identity of the key | ------------------------------------------------ | ------------------------------------------------ | ------------------------------------------------ | ------------------------------------------------ | | `id` | *str* | :heavy_check_mark: | The id of the identity | | `external_id` | *str* | :heavy_check_mark: | The external id of the identity | -| `meta` | Dict[str, *Any*] | :heavy_minus_sign: | Any additional metadata attached to the identity | \ No newline at end of file +| `meta` | Dict[str, *Nullable[Any]*] | :heavy_minus_sign: | Any additional metadata attached to the identity | \ No newline at end of file diff --git a/docs/models/key.md b/docs/models/key.md index e2452e3..225aa99 100644 --- a/docs/models/key.md +++ b/docs/models/key.md @@ -8,11 +8,11 @@ | `id` | *str* | :heavy_check_mark: | The id of the key | key_1234 | | `start` | *str* | :heavy_check_mark: | The first few characters of the key to visually identify it | sk_5j1 | | `workspace_id` | *str* | :heavy_check_mark: | The id of the workspace that owns the key | ws_1234 | -| `created_at` | *int* | :heavy_check_mark: | The unix timestamp in milliseconds when the key was created | 0 | | `api_id` | *Optional[str]* | :heavy_minus_sign: | The id of the api that this key is for | api_1234 | | `name` | *Optional[str]* | :heavy_minus_sign: | The name of the key, give keys a name to easily identify their purpose | Customer X | | `owner_id` | *Optional[str]* | :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` | Dict[str, *Any*] | :heavy_minus_sign: | Any additional metadata you want to store with the key | {
"roles": [
"admin",
"user"
],
"stripeCustomerId": "cus_1234"
} | +| `meta` | Dict[str, *Nullable[Any]*] | :heavy_minus_sign: | Any additional metadata you want to store with the key | {
"roles": [
"admin",
"user"
],
"stripeCustomerId": "cus_1234"
} | +| `created_at` | *int* | :heavy_check_mark: | The unix timestamp in milliseconds when the key was created | 0 | | `updated_at` | *Optional[int]* | :heavy_minus_sign: | The unix timestamp in milliseconds when the key was last updated | 0 | | `expires` | *Optional[int]* | :heavy_minus_sign: | The unix timestamp in milliseconds when the key will expire. If this field is null or undefined, the key is not expiring. | 0 | | `remaining` | *Optional[int]* | :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 | diff --git a/docs/models/keyid.md b/docs/models/keyid.md new file mode 100644 index 0000000..706a458 --- /dev/null +++ b/docs/models/keyid.md @@ -0,0 +1,23 @@ +# KeyID + +Only include data for a specific key or keys. + +When you are providing zero or more than one key ids, all usage counts are aggregated and summed up. Send multiple requests with one keyId each if you need counts per key. + + + + +## Supported Types + +### `str` + +```python +value: str = /* values here */ +``` + +### `List[str]` + +```python +value: List[str] = /* values here */ +``` + diff --git a/docs/models/keysgetverificationsrequest.md b/docs/models/keysgetverificationsrequest.md new file mode 100644 index 0000000..812bac5 --- /dev/null +++ b/docs/models/keysgetverificationsrequest.md @@ -0,0 +1,12 @@ +# KeysGetVerificationsRequest + + +## Fields + +| Field | Type | Required | Description | Example | +| ----------------------------------------------------------------------------- | ----------------------------------------------------------------------------- | ----------------------------------------------------------------------------- | ----------------------------------------------------------------------------- | ----------------------------------------------------------------------------- | +| `key_id` | *Optional[str]* | :heavy_minus_sign: | N/A | key_1234 | +| `owner_id` | *Optional[str]* | :heavy_minus_sign: | N/A | chronark | +| `start` | *OptionalNullable[int]* | :heavy_minus_sign: | N/A | 1620000000000 | +| `end` | *OptionalNullable[int]* | :heavy_minus_sign: | N/A | 1620000000000 | +| `granularity` | [Optional[models.Granularity]](../models/granularity.md) | :heavy_minus_sign: | The granularity of the usage data to fetch, currently only `day` is supported | day | \ No newline at end of file diff --git a/docs/models/ratelimitsetoverrideresponse.md b/docs/models/keysgetverificationsresponse.md similarity index 82% rename from docs/models/ratelimitsetoverrideresponse.md rename to docs/models/keysgetverificationsresponse.md index 29a8d20..6845b46 100644 --- a/docs/models/ratelimitsetoverrideresponse.md +++ b/docs/models/keysgetverificationsresponse.md @@ -1,4 +1,4 @@ -# RatelimitSetOverrideResponse +# KeysGetVerificationsResponse ## Fields @@ -6,4 +6,4 @@ | Field | Type | Required | Description | | -------------------------------------------------------------------------------------------------- | -------------------------------------------------------------------------------------------------- | -------------------------------------------------------------------------------------------------- | -------------------------------------------------------------------------------------------------- | | `http_meta` | [models.HTTPMetadata](../models/httpmetadata.md) | :heavy_check_mark: | N/A | -| `object` | [Optional[models.RatelimitSetOverrideResponseBody]](../models/ratelimitsetoverrideresponsebody.md) | :heavy_minus_sign: | Sucessfully created a ratelimit override | \ No newline at end of file +| `object` | [Optional[models.KeysGetVerificationsResponseBody]](../models/keysgetverificationsresponsebody.md) | :heavy_minus_sign: | Usage numbers over time | \ No newline at end of file diff --git a/docs/models/keysgetverificationsresponsebody.md b/docs/models/keysgetverificationsresponsebody.md new file mode 100644 index 0000000..3bba98d --- /dev/null +++ b/docs/models/keysgetverificationsresponsebody.md @@ -0,0 +1,10 @@ +# KeysGetVerificationsResponseBody + +Usage numbers over time + + +## Fields + +| Field | Type | Required | Description | +| -------------------------------------------------------- | -------------------------------------------------------- | -------------------------------------------------------- | -------------------------------------------------------- | +| `verifications` | List[[models.Verifications](../models/verifications.md)] | :heavy_check_mark: | N/A | \ No newline at end of file diff --git a/docs/models/limitrequestbody.md b/docs/models/limitrequestbody.md index 17b5977..b207fd5 100644 --- a/docs/models/limitrequestbody.md +++ b/docs/models/limitrequestbody.md @@ -5,11 +5,11 @@ | Field | Type | Required | Description | Example | | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | +| `namespace` | *Optional[str]* | :heavy_minus_sign: | Namespaces group different limits together for better analytics. You might have a namespace for your public API and one for internal tRPC routes. | email.outbound | | `identifier` | *str* | :heavy_check_mark: | Identifier of your user, this can be their userId, an email, an ip or anything else. | user_123 | | `limit` | *int* | :heavy_check_mark: | How many requests may pass in a given window. | 10 | | `duration` | *int* | :heavy_check_mark: | The window duration in milliseconds | 60000 | -| `namespace` | *Optional[str]* | :heavy_minus_sign: | Namespaces group different limits together for better analytics. You might have a namespace for your public API and one for internal tRPC routes. | email.outbound | | `cost` | *Optional[int]* | :heavy_minus_sign: | Expensive requests may use up more tokens. You can specify a cost to the request here and we'll deduct this many tokens in the current window.
If there are not enough tokens left, the request is denied.

Set it to 0 to receive the current limit without changing anything. | 2 | | `async_` | *Optional[bool]* | :heavy_minus_sign: | Async will return a response immediately, lowering latency at the cost of accuracy. | | -| `meta` | Dict[str, *Any*] | :heavy_minus_sign: | Attach any metadata to this request | | +| `meta` | Dict[str, *Nullable[Any]*] | :heavy_minus_sign: | Attach any metadata to this request | | | `resources` | List[[models.Resources](../models/resources.md)] | :heavy_minus_sign: | Resources that are about to be accessed by the user | [
{
"type": "project",
"id": "p_123",
"name": "dub"
}
] | \ No newline at end of file diff --git a/docs/models/listidentitiesresponsebody.md b/docs/models/listidentitiesresponsebody.md index 01c35d0..168c184 100644 --- a/docs/models/listidentitiesresponsebody.md +++ b/docs/models/listidentitiesresponsebody.md @@ -8,5 +8,5 @@ A list of identities. | Field | Type | Required | Description | Example | | --------------------------------------------------------------------------------------------------- | --------------------------------------------------------------------------------------------------- | --------------------------------------------------------------------------------------------------- | --------------------------------------------------------------------------------------------------- | --------------------------------------------------------------------------------------------------- | | `identities` | List[[models.ListIdentitiesIdentities](../models/listidentitiesidentities.md)] | :heavy_check_mark: | A list of identities. | | -| `total` | *int* | :heavy_check_mark: | The total number of identities for this environment | | -| `cursor` | *Optional[str]* | :heavy_minus_sign: | The cursor to use for the next page of results, if no cursor is returned, there are no more results | eyJrZXkiOiJrZXlfMTIzNCJ9 | \ No newline at end of file +| `cursor` | *Optional[str]* | :heavy_minus_sign: | The cursor to use for the next page of results, if no cursor is returned, there are no more results | eyJrZXkiOiJrZXlfMTIzNCJ9 | +| `total` | *int* | :heavy_check_mark: | The total number of identities for this environment | | \ No newline at end of file diff --git a/docs/models/listkeysresponsebody.md b/docs/models/listkeysresponsebody.md index a227962..92ed59d 100644 --- a/docs/models/listkeysresponsebody.md +++ b/docs/models/listkeysresponsebody.md @@ -8,5 +8,5 @@ List of keys for the api | Field | Type | Required | Description | Example | | --------------------------------------------------------------------------------------------------- | --------------------------------------------------------------------------------------------------- | --------------------------------------------------------------------------------------------------- | --------------------------------------------------------------------------------------------------- | --------------------------------------------------------------------------------------------------- | | `keys` | List[[models.Key](../models/key.md)] | :heavy_check_mark: | N/A | | -| `total` | *int* | :heavy_check_mark: | The total number of keys for this api | | -| `cursor` | *Optional[str]* | :heavy_minus_sign: | The cursor to use for the next page of results, if no cursor is returned, there are no more results | eyJrZXkiOiJrZXlfMTIzNCJ9 | \ No newline at end of file +| `cursor` | *Optional[str]* | :heavy_minus_sign: | The cursor to use for the next page of results, if no cursor is returned, there are no more results | eyJrZXkiOiJrZXlfMTIzNCJ9 | +| `total` | *int* | :heavy_check_mark: | The total number of keys for this api. This is an approximation and may lag behind up to 5 minutes. | | \ No newline at end of file diff --git a/docs/models/listoverridesresponsebody.md b/docs/models/listoverridesresponsebody.md index 6a155f0..8c38791 100644 --- a/docs/models/listoverridesresponsebody.md +++ b/docs/models/listoverridesresponsebody.md @@ -8,5 +8,5 @@ List of overrides for the given namespace. | Field | Type | Required | Description | Example | | --------------------------------------------------------------------------------------------------- | --------------------------------------------------------------------------------------------------- | --------------------------------------------------------------------------------------------------- | --------------------------------------------------------------------------------------------------- | --------------------------------------------------------------------------------------------------- | | `overrides` | List[[models.Overrides](../models/overrides.md)] | :heavy_check_mark: | N/A | | -| `total` | *int* | :heavy_check_mark: | The total number of overrides for the namespace | | -| `cursor` | *Optional[str]* | :heavy_minus_sign: | The cursor to use for the next page of results, if no cursor is returned, there are no more results | eyJrZXkiOiJrZXlfMTIzNCJ9 | \ No newline at end of file +| `cursor` | *Optional[str]* | :heavy_minus_sign: | The cursor to use for the next page of results, if no cursor is returned, there are no more results | eyJrZXkiOiJrZXlfMTIzNCJ9 | +| `total` | *int* | :heavy_check_mark: | The total number of overrides for the namespace | | \ No newline at end of file diff --git a/docs/models/one.md b/docs/models/one.md new file mode 100644 index 0000000..1c19cc2 --- /dev/null +++ b/docs/models/one.md @@ -0,0 +1,14 @@ +# One + + +## Values + +| Name | Value | +| ---------- | ---------- | +| `KEY` | key | +| `IDENTITY` | identity | +| `TAGS` | tags | +| `TAG` | tag | +| `MONTH` | month | +| `DAY` | day | +| `HOUR` | hour | \ No newline at end of file diff --git a/docs/models/or_.md b/docs/models/or_.md index a1c28ad..8c7a8c7 100644 --- a/docs/models/or_.md +++ b/docs/models/or_.md @@ -3,6 +3,6 @@ ## Fields -| Field | Type | Required | Description | -| ------------------------------------------------------------ | ------------------------------------------------------------ | ------------------------------------------------------------ | ------------------------------------------------------------ | -| `or_` | List[[models.PermissionQuery](../models/permissionquery.md)] | :heavy_check_mark: | N/A | \ No newline at end of file +| Field | Type | Required | Description | +| ---------------------------------------------------------------------- | ---------------------------------------------------------------------- | ---------------------------------------------------------------------- | ---------------------------------------------------------------------- | +| `or_` | List[[Nullable[models.PermissionQuery]](../models/permissionquery.md)] | :heavy_check_mark: | N/A | \ No newline at end of file diff --git a/docs/models/order.md b/docs/models/order.md new file mode 100644 index 0000000..210752d --- /dev/null +++ b/docs/models/order.md @@ -0,0 +1,11 @@ +# Order + +Define the order of sorting. Use this in combination with `orderBy` + + +## Values + +| Name | Value | +| ------ | ------ | +| `ASC` | asc | +| `DESC` | desc | \ No newline at end of file diff --git a/docs/models/orderby.md b/docs/models/orderby.md new file mode 100644 index 0000000..8916b74 --- /dev/null +++ b/docs/models/orderby.md @@ -0,0 +1,20 @@ +# OrderBy + +Sort the output by a specific value. You can use this in combination with the `order` param. + + +## Values + +| Name | Value | +| -------------------------- | -------------------------- | +| `TIME` | time | +| `VALID` | valid | +| `NOT_FOUND` | notFound | +| `FORBIDDEN` | forbidden | +| `USAGE_EXCEEDED` | usageExceeded | +| `RATE_LIMITED` | rateLimited | +| `UNAUTHORIZED` | unauthorized | +| `DISABLED` | disabled | +| `INSUFFICIENT_PERMISSIONS` | insufficientPermissions | +| `EXPIRED` | expired | +| `TOTAL` | total | \ No newline at end of file diff --git a/docs/models/queryparam2.md b/docs/models/queryparam2.md new file mode 100644 index 0000000..5e002e0 --- /dev/null +++ b/docs/models/queryparam2.md @@ -0,0 +1,14 @@ +# QueryParam2 + + +## Values + +| Name | Value | +| ---------- | ---------- | +| `KEY` | key | +| `IDENTITY` | identity | +| `TAGS` | tags | +| `TAG` | tag | +| `MONTH` | month | +| `DAY` | day | +| `HOUR` | hour | \ No newline at end of file diff --git a/docs/models/ratelimitmodel.md b/docs/models/ratelimitmodel.md index 0aa009c..5bd3034 100644 --- a/docs/models/ratelimitmodel.md +++ b/docs/models/ratelimitmodel.md @@ -8,8 +8,8 @@ Unkey comes with per-key ratelimiting out of the box. | Field | Type | Required | Description | | -------------------------------------------------------------------------------------------------------------------------------------------------- | -------------------------------------------------------------------------------------------------------------------------------------------------- | -------------------------------------------------------------------------------------------------------------------------------------------------- | -------------------------------------------------------------------------------------------------------------------------------------------------- | | `async_` | *bool* | :heavy_check_mark: | N/A | -| `limit` | *int* | :heavy_check_mark: | The total amount of burstable requests. | -| `duration` | *int* | :heavy_check_mark: | The duration of the ratelimit window, in milliseconds. | | `type` | [Optional[models.Type]](../models/type.md) | :heavy_minus_sign: | Fast ratelimiting doesn't add latency, while consistent ratelimiting is more accurate.

[Learn more](https://unkey.dev/docs/features/ratelimiting) | +| `limit` | *int* | :heavy_check_mark: | The total amount of burstable requests. | | `refill_rate` | *Optional[int]* | :heavy_minus_sign: | How many tokens to refill during each refillInterval. | -| `refill_interval` | *Optional[int]* | :heavy_minus_sign: | Determines the speed at which tokens are refilled, in milliseconds. | \ No newline at end of file +| `refill_interval` | *Optional[int]* | :heavy_minus_sign: | Determines the speed at which tokens are refilled, in milliseconds. | +| `duration` | *int* | :heavy_check_mark: | The duration of the ratelimit window, in milliseconds. | \ No newline at end of file diff --git a/docs/models/remaining.md b/docs/models/remaining.md new file mode 100644 index 0000000..ab1e207 --- /dev/null +++ b/docs/models/remaining.md @@ -0,0 +1,10 @@ +# Remaining + +Customize the behaviour of deducting remaining uses. When some of your endpoints are more expensive than others, you can set a custom `cost` for each. + + +## Fields + +| Field | Type | Required | Description | +| ---------------------------------------------------------------------------------------------------- | ---------------------------------------------------------------------------------------------------- | ---------------------------------------------------------------------------------------------------- | ---------------------------------------------------------------------------------------------------- | +| `cost` | *Optional[int]* | :heavy_minus_sign: | How many tokens should be deducted from the current `remaining` value. Set it to 0, to make it free. | \ No newline at end of file diff --git a/docs/models/requestbody.md b/docs/models/requestbody.md index 5c2730e..cc53122 100644 --- a/docs/models/requestbody.md +++ b/docs/models/requestbody.md @@ -11,8 +11,9 @@ | `plaintext` | *Optional[str]* | :heavy_minus_sign: | The raw key in plaintext. If provided, unkey encrypts this value and stores it securely. Provide either `hash` or `plaintext` | | | `hash` | [Optional[models.Hash]](../models/hash.md) | :heavy_minus_sign: | Provide either `hash` or `plaintext` | | | `start` | *Optional[str]* | :heavy_minus_sign: | The first 4 characters of the key. If a prefix is used, it should be the prefix plus 4 characters. | unkey_32kq | -| `owner_id` | *Optional[str]* | :heavy_minus_sign: | Your user’s Id. This will provide a link between Unkey and your customer record.
When validating a key, we will return this back to you, so you can clearly identify your user from their api key. | team_123 | -| `meta` | Dict[str, *Any*] | :heavy_minus_sign: | This is a place for dynamic meta data, anything that feels useful for you should go here | {
"billingTier": "PRO",
"trialEnds": "2023-06-16T17:16:37.161Z"
} | +| ~~`owner_id`~~ | *Optional[str]* | :heavy_minus_sign: | : warning: ** DEPRECATED **: This will be removed in a future release, please migrate away from it as soon as possible.

Deprecated, use `externalId` | team_123 | +| `external_id` | *Optional[str]* | :heavy_minus_sign: | Your user’s Id. This will provide a link between Unkey and your customer record.
When validating a key, we will return this back to you, so you can clearly identify your user from their api key. | user_123 | +| `meta` | Dict[str, *Nullable[Any]*] | :heavy_minus_sign: | This is a place for dynamic meta data, anything that feels useful for you should go here | {
"billingTier": "PRO",
"trialEnds": "2023-06-16T17:16:37.161Z"
} | | `roles` | List[*str*] | :heavy_minus_sign: | A list of roles that this key should have. If the role does not exist, an error is thrown | [
"admin",
"finance"
] | | `permissions` | List[*str*] | :heavy_minus_sign: | A list of permissions that this key should have. If the permission does not exist, an error is thrown | [
"domains.create_record",
"say_hello"
] | | `expires` | *Optional[int]* | :heavy_minus_sign: | You can auto expire keys by providing a unix timestamp in milliseconds. Once Keys expire they will automatically be disabled and are no longer valid unless you enable them again. | 1623869797161 | diff --git a/docs/models/resources.md b/docs/models/resources.md index 64d18d7..33064c4 100644 --- a/docs/models/resources.md +++ b/docs/models/resources.md @@ -8,4 +8,4 @@ | `type` | *str* | :heavy_check_mark: | The type of resource | organization | | `id` | *str* | :heavy_check_mark: | The unique identifier for the resource | org_123 | | `name` | *Optional[str]* | :heavy_minus_sign: | A human readable name for this resource | unkey | -| `meta` | Dict[str, *Any*] | :heavy_minus_sign: | Attach any metadata to this resources | | \ No newline at end of file +| `meta` | Dict[str, *Nullable[Any]*] | :heavy_minus_sign: | Attach any metadata to this resources | | \ No newline at end of file diff --git a/docs/models/ratelimitsetoverriderequestbody.md b/docs/models/setoverriderequestbody.md similarity index 99% rename from docs/models/ratelimitsetoverriderequestbody.md rename to docs/models/setoverriderequestbody.md index f867221..7213e35 100644 --- a/docs/models/ratelimitsetoverriderequestbody.md +++ b/docs/models/setoverriderequestbody.md @@ -1,13 +1,13 @@ -# RatelimitSetOverrideRequestBody +# SetOverrideRequestBody ## Fields | Field | Type | Required | Description | Example | | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ | +| `namespace_id` | *Optional[str]* | :heavy_minus_sign: | The id of the namespace. Either namespaceId or namespaceName must be provided | rlns_1234 | +| `namespace_name` | *Optional[str]* | :heavy_minus_sign: | Namespaces group different limits together for better analytics. You might have a namespace for your public API and one for internal tRPC routes. Wildcards can also be used, more info can be found at https://www.unkey.com/docs/ratelimiting/overrides#wildcard-rules | email.outbound | | `identifier` | *str* | :heavy_check_mark: | Identifier of your user, this can be their userId, an email, an ip or anything else. Wildcards ( * ) can be used to match multiple identifiers, More info can be found at https://www.unkey.com/docs/ratelimiting/overrides#wildcard-rules | user_123 | | `limit` | *int* | :heavy_check_mark: | How many requests may pass in a given window. | 10 | | `duration` | *int* | :heavy_check_mark: | The window duration in milliseconds | 60000 | -| `namespace_id` | *Optional[str]* | :heavy_minus_sign: | The id of the namespace. Either namespaceId or namespaceName must be provided | rlns_1234 | -| `namespace_name` | *Optional[str]* | :heavy_minus_sign: | Namespaces group different limits together for better analytics. You might have a namespace for your public API and one for internal tRPC routes. Wildcards can also be used, more info can be found at https://www.unkey.com/docs/ratelimiting/overrides#wildcard-rules | email.outbound | | `async_` | *Optional[bool]* | :heavy_minus_sign: | Async will return a response immediately, lowering latency at the cost of accuracy. | | \ No newline at end of file diff --git a/docs/models/setoverrideresponse.md b/docs/models/setoverrideresponse.md new file mode 100644 index 0000000..a46be44 --- /dev/null +++ b/docs/models/setoverrideresponse.md @@ -0,0 +1,9 @@ +# SetOverrideResponse + + +## Fields + +| Field | Type | Required | Description | +| -------------------------------------------------------------------------------- | -------------------------------------------------------------------------------- | -------------------------------------------------------------------------------- | -------------------------------------------------------------------------------- | +| `http_meta` | [models.HTTPMetadata](../models/httpmetadata.md) | :heavy_check_mark: | N/A | +| `object` | [Optional[models.SetOverrideResponseBody]](../models/setoverrideresponsebody.md) | :heavy_minus_sign: | Sucessfully created a ratelimit override | \ No newline at end of file diff --git a/docs/models/ratelimitsetoverrideresponsebody.md b/docs/models/setoverrideresponsebody.md similarity index 95% rename from docs/models/ratelimitsetoverrideresponsebody.md rename to docs/models/setoverrideresponsebody.md index c2e87f7..b9d935f 100644 --- a/docs/models/ratelimitsetoverrideresponsebody.md +++ b/docs/models/setoverrideresponsebody.md @@ -1,4 +1,4 @@ -# RatelimitSetOverrideResponseBody +# SetOverrideResponseBody Sucessfully created a ratelimit override diff --git a/docs/models/tag.md b/docs/models/tag.md new file mode 100644 index 0000000..1b167e0 --- /dev/null +++ b/docs/models/tag.md @@ -0,0 +1,21 @@ +# Tag + +Only include data for a specific tag or tags. + +When you are providing zero or more than one tag, all usage counts are aggregated and summed up. Send multiple requests with one tag each if you need counts per tag. + + +## Supported Types + +### `str` + +```python +value: str = /* values here */ +``` + +### `List[str]` + +```python +value: List[str] = /* values here */ +``` + diff --git a/docs/models/two.md b/docs/models/two.md new file mode 100644 index 0000000..0c8dc4b --- /dev/null +++ b/docs/models/two.md @@ -0,0 +1,8 @@ +# Two + + +## Values + +| Name | Value | +| --------- | --------- | +| `UNKNOWN` | | \ No newline at end of file diff --git a/docs/models/updateidentityrequestbody.md b/docs/models/updateidentityrequestbody.md index 350d061..7392fec 100644 --- a/docs/models/updateidentityrequestbody.md +++ b/docs/models/updateidentityrequestbody.md @@ -8,5 +8,5 @@ | `identity_id` | *Optional[str]* | :heavy_minus_sign: | The id of the identity to update, use either `identityId` or `externalId`, if both are provided, `identityId` takes precedence. | id_1234 | | `external_id` | *Optional[str]* | :heavy_minus_sign: | The externalId of the identity to update, use either `identityId` or `externalId`, if both are provided, `identityId` takes precedence. | user_1234 | | `environment` | *Optional[str]* | :heavy_minus_sign: | This is not yet used but here for future compatibility. | | -| `meta` | Dict[str, *Any*] | :heavy_minus_sign: | Attach metadata to this identity that you need to have access to when verifying a key.

Set to `{}` to clear.

This will be returned as part of the `verifyKey` response.
| | +| `meta` | Dict[str, *Nullable[Any]*] | :heavy_minus_sign: | Attach metadata to this identity that you need to have access to when verifying a key.

Set to `{}` to clear.

This will be returned as part of the `verifyKey` response.
| | | `ratelimits` | List[[models.UpdateIdentityRatelimits](../models/updateidentityratelimits.md)] | :heavy_minus_sign: | Attach ratelimits to this identity.

This overwrites all existing ratelimits on this identity.
Setting an empty array will delete all existing ratelimits.

When verifying keys, you can specify which limits you want to use and all keys attached to this identity, will share the limits. | | \ No newline at end of file diff --git a/docs/models/updateidentityresponsebody.md b/docs/models/updateidentityresponsebody.md index af2fbed..61beece 100644 --- a/docs/models/updateidentityresponsebody.md +++ b/docs/models/updateidentityresponsebody.md @@ -9,5 +9,5 @@ The identity after the update. | -------------------------------------------------------------------------------------------------- | -------------------------------------------------------------------------------------------------- | -------------------------------------------------------------------------------------------------- | -------------------------------------------------------------------------------------------------- | -------------------------------------------------------------------------------------------------- | | `id` | *str* | :heavy_check_mark: | The id of the identity. | id_1234 | | `external_id` | *str* | :heavy_check_mark: | The externalId of the identity. | user_1234 | -| `meta` | Dict[str, *Any*] | :heavy_check_mark: | The metadata attached to this identity. | {
"stripeSubscriptionId": "sub_1234"
} | +| `meta` | Dict[str, *Nullable[Any]*] | :heavy_check_mark: | The metadata attached to this identity. | {
"stripeSubscriptionId": "sub_1234"
} | | `ratelimits` | List[[models.UpdateIdentityIdentitiesRatelimits](../models/updateidentityidentitiesratelimits.md)] | :heavy_check_mark: | N/A | | \ No newline at end of file diff --git a/docs/models/updatekeyratelimit.md b/docs/models/updatekeyratelimit.md index 24d5def..953e95f 100644 --- a/docs/models/updatekeyratelimit.md +++ b/docs/models/updatekeyratelimit.md @@ -7,9 +7,9 @@ Unkey comes with per-key ratelimiting out of the box. Set `null` to disable. | Field | Type | Required | Description | | ----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | ----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | ----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | ----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | -| `limit` | *int* | :heavy_check_mark: | The total amount of requests allowed in a single window. | | ~~`type`~~ | [Optional[models.UpdateKeyType]](../models/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_` | *Optional[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` | *int* | :heavy_check_mark: | The total amount of requests allowed in a single window. | | ~~`refill_rate`~~ | *Optional[int]* | :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. | | ~~`refill_interval`~~ | *Optional[int]* | :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` | *Optional[int]* | :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/updatekeyrequestbody.md b/docs/models/updatekeyrequestbody.md index b5e4710..3fd0f13 100644 --- a/docs/models/updatekeyrequestbody.md +++ b/docs/models/updatekeyrequestbody.md @@ -12,7 +12,7 @@ Update a key's configuration. | `name` | *OptionalNullable[str]* | :heavy_minus_sign: | The name of the key | Customer X | | ~~`owner_id`~~ | *OptionalNullable[str]* | :heavy_minus_sign: | : warning: ** DEPRECATED **: This will be removed in a future release, please migrate away from it as soon as possible.

Deprecated, use `externalId`
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 | | `external_id` | *OptionalNullable[str]* | :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 back to you, so you know who is accessing your API.
Under the hood this upserts and connects an `ìdentity` for you.
To disconnect the key from an identity, set `externalId: null`. | user_123 | -| `meta` | Dict[str, *Any*] | :heavy_minus_sign: | Any additional metadata you want to store with the key | {
"roles": [
"admin",
"user"
],
"stripeCustomerId": "cus_1234"
} | +| `meta` | Dict[str, *Nullable[Any]*] | :heavy_minus_sign: | Any additional metadata you want to store with the key | {
"roles": [
"admin",
"user"
],
"stripeCustomerId": "cus_1234"
} | | `expires` | *OptionalNullable[int]* | :heavy_minus_sign: | The unix timestamp in milliseconds when the key will expire. If this field is null or undefined, the key is not expiring. | 0 | | `ratelimit` | [OptionalNullable[models.UpdateKeyRatelimit]](../models/updatekeyratelimit.md) | :heavy_minus_sign: | Unkey comes with per-key ratelimiting out of the box. Set `null` to disable. | {
"type": "fast",
"limit": 10,
"refillRate": 1,
"refillInterval": 60
} | | `remaining` | *OptionalNullable[int]* | :heavy_minus_sign: | The number of requests that can be made with this key before it becomes invalid. Set `null` to disable. | 1000 | diff --git a/docs/models/v1keysverifykeyrequest.md b/docs/models/v1keysverifykeyrequest.md index 13fde22..dd76636 100644 --- a/docs/models/v1keysverifykeyrequest.md +++ b/docs/models/v1keysverifykeyrequest.md @@ -3,10 +3,12 @@ ## Fields -| Field | Type | Required | Description | Example | -| ---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | ---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | ---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | ---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | ---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | -| `key` | *str* | :heavy_check_mark: | The key to verify | sk_1234 | -| `api_id` | *Optional[str]* | :heavy_minus_sign: | The id of the api where the key belongs to. This is optional for now but will be required soon.
The key will be verified against the api's configuration. If the key does not belong to the api, the verification will fail. | api_1234 | -| `authorization` | [Optional[models.Authorization]](../models/authorization.md) | :heavy_minus_sign: | Perform RBAC checks | | -| ~~`ratelimit`~~ | [Optional[models.V1KeysVerifyKeyRequestRatelimit]](../models/v1keysverifykeyrequestratelimit.md) | :heavy_minus_sign: | : warning: ** DEPRECATED **: This will be removed in a future release, please migrate away from it as soon as possible.

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


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

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


[](https://www.unkey.com/docs/concepts/identities/ratelimits) | [
{
"name": "requests",
"limit": 500,
"duration": 3600000
},
{
"name": "tokens",
"limit": 20000,
"duration": 86400000
}
] | \ No newline at end of file diff --git a/docs/models/v1keysverifykeyresponse.md b/docs/models/v1keysverifykeyresponse.md index 4d5e382..5fe21d8 100644 --- a/docs/models/v1keysverifykeyresponse.md +++ b/docs/models/v1keysverifykeyresponse.md @@ -5,16 +5,18 @@ | Field | Type | Required | Description | Example | | --------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | --------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | --------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | --------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | --------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | -| `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 | -| `code` | [models.Code](../models/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.

These are validation codes, the HTTP status will be 200.
| | | `key_id` | *Optional[str]* | :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` | *Optional[str]* | :heavy_minus_sign: | The name of the key, give keys a name to easily identifiy their purpose | Customer X | | `owner_id` | *Optional[str]* | :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` | Dict[str, *Any*] | :heavy_minus_sign: | Any additional metadata you want to store with the key | {
"roles": [
"admin",
"user"
],
"stripeCustomerId": "cus_1234"
} | +| `meta` | Dict[str, *Nullable[Any]*] | :heavy_minus_sign: | Any additional metadata you want to store with the key | {
"roles": [
"admin",
"user"
],
"stripeCustomerId": "cus_1234"
} | | `expires` | *Optional[int]* | :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` | [Optional[models.V1KeysVerifyKeyResponseRatelimit]](../models/v1keysverifykeyresponseratelimit.md) | :heavy_minus_sign: | The ratelimit configuration for this key. If this field is null or undefined, the key has no ratelimit. | {
"limit": 10,
"remaining": 9,
"reset": 3600000
} | | `remaining` | *Optional[int]* | :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` | [models.Code](../models/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.

These are validation codes, the HTTP status will be 200.
| | | `enabled` | *Optional[bool]* | :heavy_minus_sign: | Sets the key to be enabled or disabled. Disabled keys will not verify. | | | `permissions` | List[*str*] | :heavy_minus_sign: | A list of all the permissions this key is connected to. | [
"dns.record.update",
"dns.record.delete"
] | +| `roles` | List[*str*] | :heavy_minus_sign: | A list of all the roles this key is connected to. | [
"admin"
] | | `environment` | *Optional[str]* | :heavy_minus_sign: | The environment of the key, this is what what you set when you crated the key | test | -| `identity` | [Optional[models.V1KeysVerifyKeyResponseIdentity]](../models/v1keysverifykeyresponseidentity.md) | :heavy_minus_sign: | The associated identity of this key. | | \ No newline at end of file +| `identity` | [Optional[models.V1KeysVerifyKeyResponseIdentity]](../models/v1keysverifykeyresponseidentity.md) | :heavy_minus_sign: | The associated identity of this key. | | +| `request_id` | *str* | :heavy_check_mark: | A unique id for this request, please provide it to Unkey support to help us debug your issue. | | \ No newline at end of file diff --git a/docs/models/v1keysverifykeyresponseidentity.md b/docs/models/v1keysverifykeyresponseidentity.md index 4b92438..7f5356a 100644 --- a/docs/models/v1keysverifykeyresponseidentity.md +++ b/docs/models/v1keysverifykeyresponseidentity.md @@ -5,8 +5,8 @@ The associated identity of this key. ## Fields -| Field | Type | Required | Description | -| ------------------ | ------------------ | ------------------ | ------------------ | -| `id` | *str* | :heavy_check_mark: | N/A | -| `external_id` | *str* | :heavy_check_mark: | N/A | -| `meta` | Dict[str, *Any*] | :heavy_check_mark: | N/A | \ No newline at end of file +| Field | Type | Required | Description | +| -------------------------- | -------------------------- | -------------------------- | -------------------------- | +| `id` | *str* | :heavy_check_mark: | N/A | +| `external_id` | *str* | :heavy_check_mark: | N/A | +| `meta` | Dict[str, *Nullable[Any]*] | :heavy_check_mark: | N/A | \ No newline at end of file diff --git a/docs/models/v1migrationscreatekeysratelimit.md b/docs/models/v1migrationscreatekeysratelimit.md index 6acc6e7..ab3ceff 100644 --- a/docs/models/v1migrationscreatekeysratelimit.md +++ b/docs/models/v1migrationscreatekeysratelimit.md @@ -7,8 +7,8 @@ Unkey comes with per-key ratelimiting out of the box. | Field | Type | Required | Description | | --------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | --------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | --------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | --------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | +| `async_` | *Optional[bool]* | :heavy_minus_sign: | Async will return a response immediately, lowering latency at the cost of accuracy.

[Learn more](https://unkey.dev/docs/features/ratelimiting) | +| ~~`type`~~ | [Optional[models.V1MigrationsCreateKeysType]](../models/v1migrationscreatekeystype.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) | | `limit` | *int* | :heavy_check_mark: | The total amount of burstable requests. | | ~~`refill_rate`~~ | *int* | :heavy_check_mark: | : 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. | -| ~~`refill_interval`~~ | *int* | :heavy_check_mark: | : 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. | -| `async_` | *Optional[bool]* | :heavy_minus_sign: | Async will return a response immediately, lowering latency at the cost of accuracy.

[Learn more](https://unkey.dev/docs/features/ratelimiting) | -| ~~`type`~~ | [Optional[models.V1MigrationsCreateKeysType]](../models/v1migrationscreatekeystype.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) | \ No newline at end of file +| ~~`refill_interval`~~ | *int* | :heavy_check_mark: | : 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. | \ No newline at end of file diff --git a/docs/models/v1migrationsenqueuekeyskeys.md b/docs/models/v1migrationsenqueuekeyskeys.md index 00162b6..58bf43b 100644 --- a/docs/models/v1migrationsenqueuekeyskeys.md +++ b/docs/models/v1migrationsenqueuekeyskeys.md @@ -11,7 +11,7 @@ | `hash` | [Optional[models.V1MigrationsEnqueueKeysHash]](../models/v1migrationsenqueuekeyshash.md) | :heavy_minus_sign: | Provide either `hash` or `plaintext` | | | `start` | *Optional[str]* | :heavy_minus_sign: | The first 4 characters of the key. If a prefix is used, it should be the prefix plus 4 characters. | unkey_32kq | | `owner_id` | *Optional[str]* | :heavy_minus_sign: | Your user’s Id. This will provide a link between Unkey and your customer record.
When validating a key, we will return this back to you, so you can clearly identify your user from their api key. | team_123 | -| `meta` | Dict[str, *Any*] | :heavy_minus_sign: | This is a place for dynamic meta data, anything that feels useful for you should go here | {
"billingTier": "PRO",
"trialEnds": "2023-06-16T17:16:37.161Z"
} | +| `meta` | Dict[str, *Nullable[Any]*] | :heavy_minus_sign: | This is a place for dynamic meta data, anything that feels useful for you should go here | {
"billingTier": "PRO",
"trialEnds": "2023-06-16T17:16:37.161Z"
} | | `roles` | List[*str*] | :heavy_minus_sign: | A list of roles that this key should have. If the role does not exist, an error is thrown | [
"admin",
"finance"
] | | `permissions` | List[*str*] | :heavy_minus_sign: | A list of permissions that this key should have. If the permission does not exist, an error is thrown | [
"domains.create_record",
"say_hello"
] | | `expires` | *Optional[int]* | :heavy_minus_sign: | You can auto expire keys by providing a unix timestamp in milliseconds. Once Keys expire they will automatically be disabled and are no longer valid unless you enable them again. | 1623869797161 | diff --git a/docs/models/v1migrationsenqueuekeysratelimit.md b/docs/models/v1migrationsenqueuekeysratelimit.md index 5b85f05..b278b9e 100644 --- a/docs/models/v1migrationsenqueuekeysratelimit.md +++ b/docs/models/v1migrationsenqueuekeysratelimit.md @@ -7,9 +7,9 @@ Unkey comes with per-key fixed-window ratelimiting out of the box. | Field | Type | Required | Description | Example | | ---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | ---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | ---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | ---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | ---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | -| `limit` | *int* | :heavy_check_mark: | The total amount of requests in a given interval. | | -| `duration` | *int* | :heavy_check_mark: | The window duration in milliseconds | 60000 | | `async_` | *Optional[bool]* | :heavy_minus_sign: | Async will return a response immediately, lowering latency at the cost of accuracy.

[Learn more](https://unkey.dev/docs/features/ratelimiting) | | | ~~`type`~~ | [Optional[models.V1MigrationsEnqueueKeysType]](../models/v1migrationsenqueuekeystype.md) | :heavy_minus_sign: | : warning: ** DEPRECATED **: This will be removed in a future release, please migrate away from it as soon as possible.

Deprecated, use `async`. Fast ratelimiting doesn't add latency, while consistent ratelimiting is more accurate.

[Learn more](https://unkey.dev/docs/features/ratelimiting) | | +| `limit` | *int* | :heavy_check_mark: | The total amount of requests in a given interval. | | +| `duration` | *int* | :heavy_check_mark: | The window duration in milliseconds | 60000 | | ~~`refill_rate`~~ | *Optional[int]* | :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. | | | ~~`refill_interval`~~ | *Optional[int]* | :heavy_minus_sign: | : warning: ** DEPRECATED **: This will be removed in a future release, please migrate away from it as soon as possible.

The refill timeframe, in milliseconds. | | \ No newline at end of file diff --git a/docs/models/whoamiresponsebody.md b/docs/models/whoamiresponsebody.md index 9e3b13d..661f91e 100644 --- a/docs/models/whoamiresponsebody.md +++ b/docs/models/whoamiresponsebody.md @@ -8,10 +8,10 @@ The configuration for a single key | Field | Type | Required | Description | Example | | -------------------------------------------------------------- | -------------------------------------------------------------- | -------------------------------------------------------------- | -------------------------------------------------------------- | -------------------------------------------------------------- | | `id` | *str* | :heavy_check_mark: | The ID of the key | key_123 | -| `created_at` | *int* | :heavy_check_mark: | The timestamp in milliseconds when the key was created | 1620000000000 | -| `enabled` | *bool* | :heavy_check_mark: | Whether the key is enabled | true | | `name` | *Optional[str]* | :heavy_minus_sign: | The name of the key | API Key 1 | | `remaining` | *Optional[int]* | :heavy_minus_sign: | The remaining number of requests for the key | 1000 | | `identity` | [Optional[models.WhoamiIdentity]](../models/whoamiidentity.md) | :heavy_minus_sign: | The identity object associated with the key | | -| `meta` | Dict[str, *Any*] | :heavy_minus_sign: | Metadata associated with the key | {
"role": "admin",
"plan": "premium"
} | +| `meta` | Dict[str, *Nullable[Any]*] | :heavy_minus_sign: | Metadata associated with the key | {
"role": "admin",
"plan": "premium"
} | +| `created_at` | *int* | :heavy_check_mark: | The timestamp in milliseconds when the key was created | 1620000000000 | +| `enabled` | *bool* | :heavy_check_mark: | Whether the key is enabled | true | | `environment` | *Optional[str]* | :heavy_minus_sign: | The environment the key is associated with | production | \ No newline at end of file diff --git a/docs/sdks/analytics/README.md b/docs/sdks/analytics/README.md new file mode 100644 index 0000000..921da7f --- /dev/null +++ b/docs/sdks/analytics/README.md @@ -0,0 +1,63 @@ +# Analytics +(*analytics*) + +## Overview + +### Available Operations + +* [get_verifications](#get_verifications) + +## get_verifications + +### Example Usage + +```python +from unkey_py import Unkey + + +with Unkey( + bearer_auth="UNKEY_ROOT_KEY", +) as unkey: + + res = unkey.analytics.get_verifications(request={ + "api_id": "", + "key_id": [ + "key_1234", + ], + "tag": [ + "key_1234", + ], + "start": 1620000000000, + }) + + assert res.response_bodies is not None + + # Handle response + print(res.response_bodies) + +``` + +### Parameters + +| Parameter | Type | Required | Description | +| ------------------------------------------------------------------------- | ------------------------------------------------------------------------- | ------------------------------------------------------------------------- | ------------------------------------------------------------------------- | +| `request` | [models.GetVerificationsRequest](../../models/getverificationsrequest.md) | :heavy_check_mark: | The request object to use for the request. | +| `retries` | [Optional[utils.RetryConfig]](../../models/utils/retryconfig.md) | :heavy_minus_sign: | Configuration to override the default retry behavior of the client. | + +### Response + +**[models.GetVerificationsResponse](../../models/getverificationsresponse.md)** + +### Errors + +| Error Type | Status Code | Content Type | +| ----------------------------- | ----------------------------- | ----------------------------- | +| models.ErrBadRequest | 400 | application/json | +| models.ErrUnauthorized | 401 | application/json | +| models.ErrForbidden | 403 | application/json | +| models.ErrNotFound | 404 | application/json | +| models.ErrConflict | 409 | application/json | +| models.ErrPreconditionFailed | 412 | application/json | +| models.ErrTooManyRequests | 429 | application/json | +| models.ErrInternalServerError | 500 | application/json | +| models.SDKError | 4XX, 5XX | \*/\* | \ No newline at end of file diff --git a/docs/sdks/apis/README.md b/docs/sdks/apis/README.md index 8b0e416..efcc7c5 100644 --- a/docs/sdks/apis/README.md +++ b/docs/sdks/apis/README.md @@ -18,14 +18,17 @@ ```python from unkey_py import Unkey + with Unkey( bearer_auth="UNKEY_ROOT_KEY", -) as s: - res = s.apis.get(api_id="api_1234") +) as unkey: + + res = unkey.apis.get(api_id="api_1234") - if res.object is not None: - # handle response - pass + assert res.object is not None + + # Handle response + print(res.object) ``` @@ -49,6 +52,7 @@ with Unkey( | models.ErrForbidden | 403 | application/json | | models.ErrNotFound | 404 | application/json | | models.ErrConflict | 409 | application/json | +| models.ErrPreconditionFailed | 412 | application/json | | models.ErrTooManyRequests | 429 | application/json | | models.ErrInternalServerError | 500 | application/json | | models.SDKError | 4XX, 5XX | \*/\* | @@ -60,16 +64,19 @@ with Unkey( ```python from unkey_py import Unkey + with Unkey( bearer_auth="UNKEY_ROOT_KEY", -) as s: - res = s.apis.create(request={ +) as unkey: + + res = unkey.apis.create(request={ "name": "my-api", }) - if res.object is not None: - # handle response - pass + assert res.object is not None + + # Handle response + print(res.object) ``` @@ -93,6 +100,7 @@ with Unkey( | models.ErrForbidden | 403 | application/json | | models.ErrNotFound | 404 | application/json | | models.ErrConflict | 409 | application/json | +| models.ErrPreconditionFailed | 412 | application/json | | models.ErrTooManyRequests | 429 | application/json | | models.ErrInternalServerError | 500 | application/json | | models.SDKError | 4XX, 5XX | \*/\* | @@ -104,17 +112,19 @@ with Unkey( ```python from unkey_py import Unkey + with Unkey( bearer_auth="UNKEY_ROOT_KEY", -) as s: - res = s.apis.list_keys(request={ +) as unkey: + + res = unkey.apis.list_keys(request={ "api_id": "api_1234", - "limit": 100, }) - if res.object is not None: - # handle response - pass + assert res.object is not None + + # Handle response + print(res.object) ``` @@ -138,6 +148,7 @@ with Unkey( | models.ErrForbidden | 403 | application/json | | models.ErrNotFound | 404 | application/json | | models.ErrConflict | 409 | application/json | +| models.ErrPreconditionFailed | 412 | application/json | | models.ErrTooManyRequests | 429 | application/json | | models.ErrInternalServerError | 500 | application/json | | models.SDKError | 4XX, 5XX | \*/\* | @@ -149,16 +160,19 @@ with Unkey( ```python from unkey_py import Unkey + with Unkey( bearer_auth="UNKEY_ROOT_KEY", -) as s: - res = s.apis.delete(request={ +) as unkey: + + res = unkey.apis.delete(request={ "api_id": "api_1234", }) - if res.object is not None: - # handle response - pass + assert res.object is not None + + # Handle response + print(res.object) ``` @@ -182,6 +196,7 @@ with Unkey( | models.ErrForbidden | 403 | application/json | | models.ErrNotFound | 404 | application/json | | models.ErrConflict | 409 | application/json | +| models.ErrPreconditionFailed | 412 | application/json | | models.ErrDeleteProtected | 429 | application/json | | models.ErrInternalServerError | 500 | application/json | | models.SDKError | 4XX, 5XX | \*/\* | @@ -193,16 +208,19 @@ with Unkey( ```python from unkey_py import Unkey + with Unkey( bearer_auth="UNKEY_ROOT_KEY", -) as s: - res = s.apis.delete_keys(request={ +) as unkey: + + res = unkey.apis.delete_keys(request={ "api_id": "api_1234", }) - if res.object is not None: - # handle response - pass + assert res.object is not None + + # Handle response + print(res.object) ``` @@ -226,6 +244,7 @@ with Unkey( | models.ErrForbidden | 403 | application/json | | models.ErrNotFound | 404 | application/json | | models.ErrConflict | 409 | application/json | +| models.ErrPreconditionFailed | 412 | application/json | | models.ErrTooManyRequests | 429 | application/json | | models.ErrInternalServerError | 500 | application/json | | models.SDKError | 4XX, 5XX | \*/\* | \ No newline at end of file diff --git a/docs/sdks/identities/README.md b/docs/sdks/identities/README.md index 202e0a5..b555da4 100644 --- a/docs/sdks/identities/README.md +++ b/docs/sdks/identities/README.md @@ -18,10 +18,12 @@ ```python from unkey_py import Unkey + with Unkey( bearer_auth="UNKEY_ROOT_KEY", -) as s: - res = s.identities.create(request={ +) as unkey: + + res = unkey.identities.create(request={ "external_id": "user_123", "ratelimits": [ { @@ -37,9 +39,10 @@ with Unkey( ], }) - if res.object is not None: - # handle response - pass + assert res.object is not None + + # Handle response + print(res.object) ``` @@ -63,6 +66,7 @@ with Unkey( | models.ErrForbidden | 403 | application/json | | models.ErrNotFound | 404 | application/json | | models.ErrConflict | 409 | application/json | +| models.ErrPreconditionFailed | 412 | application/json | | models.ErrTooManyRequests | 429 | application/json | | models.ErrInternalServerError | 500 | application/json | | models.SDKError | 4XX, 5XX | \*/\* | @@ -74,14 +78,17 @@ with Unkey( ```python from unkey_py import Unkey + with Unkey( bearer_auth="UNKEY_ROOT_KEY", -) as s: - res = s.identities.get(identity_id="id_1234", external_id="id_1234") +) as unkey: - if res.object is not None: - # handle response - pass + res = unkey.identities.get(identity_id="id_1234", external_id="id_1234") + + assert res.object is not None + + # Handle response + print(res.object) ``` @@ -106,6 +113,7 @@ with Unkey( | models.ErrForbidden | 403 | application/json | | models.ErrNotFound | 404 | application/json | | models.ErrConflict | 409 | application/json | +| models.ErrPreconditionFailed | 412 | application/json | | models.ErrTooManyRequests | 429 | application/json | | models.ErrInternalServerError | 500 | application/json | | models.SDKError | 4XX, 5XX | \*/\* | @@ -117,18 +125,17 @@ with Unkey( ```python from unkey_py import Unkey + with Unkey( bearer_auth="UNKEY_ROOT_KEY", -) as s: - res = s.identities.list(limit=100) +) as unkey: - if res.object is not None: - while True: - # handle items + res = unkey.identities.list() - res = res.next() - if res is None: - break + while res is not None: + # Handle items + + res = res.next() ``` @@ -154,6 +161,7 @@ with Unkey( | models.ErrForbidden | 403 | application/json | | models.ErrNotFound | 404 | application/json | | models.ErrConflict | 409 | application/json | +| models.ErrPreconditionFailed | 412 | application/json | | models.ErrTooManyRequests | 429 | application/json | | models.ErrInternalServerError | 500 | application/json | | models.SDKError | 4XX, 5XX | \*/\* | @@ -165,10 +173,12 @@ with Unkey( ```python from unkey_py import Unkey + with Unkey( bearer_auth="UNKEY_ROOT_KEY", -) as s: - res = s.identities.update(request={ +) as unkey: + + res = unkey.identities.update(request={ "identity_id": "id_1234", "external_id": "user_1234", "ratelimits": [ @@ -190,9 +200,10 @@ with Unkey( ], }) - if res.object is not None: - # handle response - pass + assert res.object is not None + + # Handle response + print(res.object) ``` @@ -216,6 +227,7 @@ with Unkey( | models.ErrForbidden | 403 | application/json | | models.ErrNotFound | 404 | application/json | | models.ErrConflict | 409 | application/json | +| models.ErrPreconditionFailed | 412 | application/json | | models.ErrTooManyRequests | 429 | application/json | | models.ErrInternalServerError | 500 | application/json | | models.SDKError | 4XX, 5XX | \*/\* | @@ -227,16 +239,19 @@ with Unkey( ```python from unkey_py import Unkey + with Unkey( bearer_auth="UNKEY_ROOT_KEY", -) as s: - res = s.identities.delete(request={ +) as unkey: + + res = unkey.identities.delete(request={ "identity_id": "id_1234", }) - if res.object is not None: - # handle response - pass + assert res.object is not None + + # Handle response + print(res.object) ``` @@ -260,6 +275,7 @@ with Unkey( | models.ErrForbidden | 403 | application/json | | models.ErrNotFound | 404 | application/json | | models.ErrConflict | 409 | application/json | +| models.ErrPreconditionFailed | 412 | application/json | | models.ErrTooManyRequests | 429 | application/json | | models.ErrInternalServerError | 500 | application/json | | models.SDKError | 4XX, 5XX | \*/\* | \ No newline at end of file diff --git a/docs/sdks/keys/README.md b/docs/sdks/keys/README.md index 3f5a039..eb43f8a 100644 --- a/docs/sdks/keys/README.md +++ b/docs/sdks/keys/README.md @@ -27,14 +27,17 @@ ```python from unkey_py import Unkey + with Unkey( bearer_auth="UNKEY_ROOT_KEY", -) as s: - res = s.keys.get(key_id="key_1234") +) as unkey: + + res = unkey.keys.get(key_id="key_1234") - if res.key is not None: - # handle response - pass + assert res.key is not None + + # Handle response + print(res.key) ``` @@ -59,6 +62,7 @@ with Unkey( | models.ErrForbidden | 403 | application/json | | models.ErrNotFound | 404 | application/json | | models.ErrConflict | 409 | application/json | +| models.ErrPreconditionFailed | 412 | application/json | | models.ErrTooManyRequests | 429 | application/json | | models.ErrInternalServerError | 500 | application/json | | models.SDKError | 4XX, 5XX | \*/\* | @@ -70,16 +74,19 @@ with Unkey( ```python from unkey_py import Unkey + with Unkey( bearer_auth="UNKEY_ROOT_KEY", -) as s: - res = s.keys.whoami(request={ +) as unkey: + + res = unkey.keys.whoami(request={ "key": "sk_123", }) - if res.object is not None: - # handle response - pass + assert res.object is not None + + # Handle response + print(res.object) ``` @@ -103,6 +110,7 @@ with Unkey( | models.ErrForbidden | 403 | application/json | | models.ErrNotFound | 404 | application/json | | models.ErrConflict | 409 | application/json | +| models.ErrPreconditionFailed | 412 | application/json | | models.ErrTooManyRequests | 429 | application/json | | models.ErrInternalServerError | 500 | application/json | | models.SDKError | 4XX, 5XX | \*/\* | @@ -114,16 +122,19 @@ with Unkey( ```python from unkey_py import Unkey + with Unkey( bearer_auth="UNKEY_ROOT_KEY", -) as s: - res = s.keys.delete(request={ +) as unkey: + + res = unkey.keys.delete(request={ "key_id": "key_1234", }) - if res.object is not None: - # handle response - pass + assert res.object is not None + + # Handle response + print(res.object) ``` @@ -147,6 +158,7 @@ with Unkey( | models.ErrForbidden | 403 | application/json | | models.ErrNotFound | 404 | application/json | | models.ErrConflict | 409 | application/json | +| models.ErrPreconditionFailed | 412 | application/json | | models.ErrTooManyRequests | 429 | application/json | | models.ErrInternalServerError | 500 | application/json | | models.SDKError | 4XX, 5XX | \*/\* | @@ -159,10 +171,12 @@ with Unkey( import unkey_py from unkey_py import Unkey + with Unkey( bearer_auth="UNKEY_ROOT_KEY", -) as s: - res = s.keys.create(request={ +) as unkey: + + res = unkey.keys.create(request={ "api_id": "api_123", "name": "my key", "external_id": "team_123", @@ -187,15 +201,14 @@ with Unkey( }, "ratelimit": { "limit": 10, - "type": unkey_py.CreateKeyType.FAST, "duration": 60000, }, - "enabled": False, }) - if res.object is not None: - # handle response - pass + assert res.object is not None + + # Handle response + print(res.object) ``` @@ -219,6 +232,7 @@ with Unkey( | models.ErrForbidden | 403 | application/json | | models.ErrNotFound | 404 | application/json | | models.ErrConflict | 409 | application/json | +| models.ErrPreconditionFailed | 412 | application/json | | models.ErrTooManyRequests | 429 | application/json | | models.ErrInternalServerError | 500 | application/json | | models.SDKError | 4XX, 5XX | \*/\* | @@ -230,12 +244,18 @@ with Unkey( ```python from unkey_py import Unkey + with Unkey( bearer_auth="UNKEY_ROOT_KEY", -) as s: - res = s.keys.verify(request={ - "key": "sk_1234", +) as unkey: + + res = unkey.keys.verify(request={ "api_id": "api_1234", + "key": "sk_1234", + "tags": [ + "path=/v1/users/123", + "region=us-east-1", + ], "ratelimits": [ { "name": "tokens", @@ -250,9 +270,10 @@ with Unkey( ], }) - if res.v1_keys_verify_key_response is not None: - # handle response - pass + assert res.v1_keys_verify_key_response is not None + + # Handle response + print(res.v1_keys_verify_key_response) ``` @@ -276,6 +297,7 @@ with Unkey( | models.ErrForbidden | 403 | application/json | | models.ErrNotFound | 404 | application/json | | models.ErrConflict | 409 | application/json | +| models.ErrPreconditionFailed | 412 | application/json | | models.ErrTooManyRequests | 429 | application/json | | models.ErrInternalServerError | 500 | application/json | | models.SDKError | 4XX, 5XX | \*/\* | @@ -288,10 +310,12 @@ with Unkey( import unkey_py from unkey_py import Unkey + with Unkey( bearer_auth="UNKEY_ROOT_KEY", -) as s: - res = s.keys.update(request={ +) as unkey: + + res = unkey.keys.update(request={ "key_id": "key_123", "name": "Customer X", "external_id": "user_123", @@ -304,8 +328,8 @@ with Unkey( }, "expires": 0, "ratelimit": { - "limit": 10, "type": unkey_py.UpdateKeyType.FAST, + "limit": 10, "refill_rate": 1, "refill_interval": 60, }, @@ -341,9 +365,10 @@ with Unkey( ], }) - if res.object is not None: - # handle response - pass + assert res.object is not None + + # Handle response + print(res.object) ``` @@ -367,6 +392,7 @@ with Unkey( | models.ErrForbidden | 403 | application/json | | models.ErrNotFound | 404 | application/json | | models.ErrConflict | 409 | application/json | +| models.ErrPreconditionFailed | 412 | application/json | | models.ErrTooManyRequests | 429 | application/json | | models.ErrInternalServerError | 500 | application/json | | models.SDKError | 4XX, 5XX | \*/\* | @@ -379,18 +405,21 @@ with Unkey( import unkey_py from unkey_py import Unkey + with Unkey( bearer_auth="UNKEY_ROOT_KEY", -) as s: - res = s.keys.update_remaining(request={ +) as unkey: + + res = unkey.keys.update_remaining(request={ "key_id": "key_123", "op": unkey_py.Op.SET, "value": 1, }) - if res.object is not None: - # handle response - pass + assert res.object is not None + + # Handle response + print(res.object) ``` @@ -414,6 +443,7 @@ with Unkey( | models.ErrForbidden | 403 | application/json | | models.ErrNotFound | 404 | application/json | | models.ErrConflict | 409 | application/json | +| models.ErrPreconditionFailed | 412 | application/json | | models.ErrTooManyRequests | 429 | application/json | | models.ErrInternalServerError | 500 | application/json | | models.SDKError | 4XX, 5XX | \*/\* | @@ -423,36 +453,37 @@ with Unkey( ### Example Usage ```python -import unkey_py from unkey_py import Unkey + with Unkey( bearer_auth="UNKEY_ROOT_KEY", -) as s: - res = s.keys.get_verifications(request={ +) as unkey: + + res = unkey.keys.get_verifications(request={ "key_id": "key_1234", "owner_id": "chronark", "start": 1620000000000, "end": 1620000000000, - "granularity": unkey_py.Granularity.DAY, }) - if res.object is not None: - # handle response - pass + assert res.object is not None + + # Handle response + print(res.object) ``` ### Parameters -| Parameter | Type | Required | Description | -| ------------------------------------------------------------------------- | ------------------------------------------------------------------------- | ------------------------------------------------------------------------- | ------------------------------------------------------------------------- | -| `request` | [models.GetVerificationsRequest](../../models/getverificationsrequest.md) | :heavy_check_mark: | The request object to use for the request. | -| `retries` | [Optional[utils.RetryConfig]](../../models/utils/retryconfig.md) | :heavy_minus_sign: | Configuration to override the default retry behavior of the client. | +| Parameter | Type | Required | Description | +| --------------------------------------------------------------------------------- | --------------------------------------------------------------------------------- | --------------------------------------------------------------------------------- | --------------------------------------------------------------------------------- | +| `request` | [models.KeysGetVerificationsRequest](../../models/keysgetverificationsrequest.md) | :heavy_check_mark: | The request object to use for the request. | +| `retries` | [Optional[utils.RetryConfig]](../../models/utils/retryconfig.md) | :heavy_minus_sign: | Configuration to override the default retry behavior of the client. | ### Response -**[models.GetVerificationsResponse](../../models/getverificationsresponse.md)** +**[models.KeysGetVerificationsResponse](../../models/keysgetverificationsresponse.md)** ### Errors @@ -463,6 +494,7 @@ with Unkey( | models.ErrForbidden | 403 | application/json | | models.ErrNotFound | 404 | application/json | | models.ErrConflict | 409 | application/json | +| models.ErrPreconditionFailed | 412 | application/json | | models.ErrTooManyRequests | 429 | application/json | | models.ErrInternalServerError | 500 | application/json | | models.SDKError | 4XX, 5XX | \*/\* | @@ -474,19 +506,24 @@ with Unkey( ```python from unkey_py import Unkey + with Unkey( bearer_auth="UNKEY_ROOT_KEY", -) as s: - res = s.keys.add_permissions(request={ +) as unkey: + + res = unkey.keys.add_permissions(request={ "key_id": "", "permissions": [ {}, + {}, + {}, ], }) - if res.response_bodies is not None: - # handle response - pass + assert res.response_bodies is not None + + # Handle response + print(res.response_bodies) ``` @@ -510,6 +547,7 @@ with Unkey( | models.ErrForbidden | 403 | application/json | | models.ErrNotFound | 404 | application/json | | models.ErrConflict | 409 | application/json | +| models.ErrPreconditionFailed | 412 | application/json | | models.ErrTooManyRequests | 429 | application/json | | models.ErrInternalServerError | 500 | application/json | | models.SDKError | 4XX, 5XX | \*/\* | @@ -521,10 +559,12 @@ with Unkey( ```python from unkey_py import Unkey + with Unkey( bearer_auth="UNKEY_ROOT_KEY", -) as s: - res = s.keys.remove_permissions(request={ +) as unkey: + + res = unkey.keys.remove_permissions(request={ "key_id": "", "permissions": [ { @@ -536,9 +576,10 @@ with Unkey( ], }) - if res.object is not None: - # handle response - pass + assert res.object is not None + + # Handle response + print(res.object) ``` @@ -562,6 +603,7 @@ with Unkey( | models.ErrForbidden | 403 | application/json | | models.ErrNotFound | 404 | application/json | | models.ErrConflict | 409 | application/json | +| models.ErrPreconditionFailed | 412 | application/json | | models.ErrTooManyRequests | 429 | application/json | | models.ErrInternalServerError | 500 | application/json | | models.SDKError | 4XX, 5XX | \*/\* | @@ -573,10 +615,12 @@ with Unkey( ```python from unkey_py import Unkey + with Unkey( bearer_auth="UNKEY_ROOT_KEY", -) as s: - res = s.keys.set_permissions(request={ +) as unkey: + + res = unkey.keys.set_permissions(request={ "key_id": "", "permissions": [ { @@ -592,9 +636,10 @@ with Unkey( ], }) - if res.response_bodies is not None: - # handle response - pass + assert res.response_bodies is not None + + # Handle response + print(res.response_bodies) ``` @@ -618,6 +663,7 @@ with Unkey( | models.ErrForbidden | 403 | application/json | | models.ErrNotFound | 404 | application/json | | models.ErrConflict | 409 | application/json | +| models.ErrPreconditionFailed | 412 | application/json | | models.ErrTooManyRequests | 429 | application/json | | models.ErrInternalServerError | 500 | application/json | | models.SDKError | 4XX, 5XX | \*/\* | @@ -629,10 +675,12 @@ with Unkey( ```python from unkey_py import Unkey + with Unkey( bearer_auth="UNKEY_ROOT_KEY", -) as s: - res = s.keys.add_roles(request={ +) as unkey: + + res = unkey.keys.add_roles(request={ "key_id": "", "roles": [ { @@ -648,9 +696,10 @@ with Unkey( ], }) - if res.response_bodies is not None: - # handle response - pass + assert res.response_bodies is not None + + # Handle response + print(res.response_bodies) ``` @@ -674,6 +723,7 @@ with Unkey( | models.ErrForbidden | 403 | application/json | | models.ErrNotFound | 404 | application/json | | models.ErrConflict | 409 | application/json | +| models.ErrPreconditionFailed | 412 | application/json | | models.ErrTooManyRequests | 429 | application/json | | models.ErrInternalServerError | 500 | application/json | | models.SDKError | 4XX, 5XX | \*/\* | @@ -685,10 +735,12 @@ with Unkey( ```python from unkey_py import Unkey + with Unkey( bearer_auth="UNKEY_ROOT_KEY", -) as s: - res = s.keys.remove_roles(request={ +) as unkey: + + res = unkey.keys.remove_roles(request={ "key_id": "", "roles": [ { @@ -700,9 +752,10 @@ with Unkey( ], }) - if res.object is not None: - # handle response - pass + assert res.object is not None + + # Handle response + print(res.object) ``` @@ -726,6 +779,7 @@ with Unkey( | models.ErrForbidden | 403 | application/json | | models.ErrNotFound | 404 | application/json | | models.ErrConflict | 409 | application/json | +| models.ErrPreconditionFailed | 412 | application/json | | models.ErrTooManyRequests | 429 | application/json | | models.ErrInternalServerError | 500 | application/json | | models.SDKError | 4XX, 5XX | \*/\* | @@ -737,10 +791,12 @@ with Unkey( ```python from unkey_py import Unkey + with Unkey( bearer_auth="UNKEY_ROOT_KEY", -) as s: - res = s.keys.set_roles(request={ +) as unkey: + + res = unkey.keys.set_roles(request={ "key_id": "", "roles": [ { @@ -756,9 +812,10 @@ with Unkey( ], }) - if res.response_bodies is not None: - # handle response - pass + assert res.response_bodies is not None + + # Handle response + print(res.response_bodies) ``` @@ -782,6 +839,7 @@ with Unkey( | models.ErrForbidden | 403 | application/json | | models.ErrNotFound | 404 | application/json | | models.ErrConflict | 409 | application/json | +| models.ErrPreconditionFailed | 412 | application/json | | models.ErrTooManyRequests | 429 | application/json | | models.ErrInternalServerError | 500 | application/json | | models.SDKError | 4XX, 5XX | \*/\* | \ No newline at end of file diff --git a/docs/sdks/liveness/README.md b/docs/sdks/liveness/README.md index 26c3be4..39115b4 100644 --- a/docs/sdks/liveness/README.md +++ b/docs/sdks/liveness/README.md @@ -14,14 +14,17 @@ ```python from unkey_py import Unkey + with Unkey( bearer_auth="UNKEY_ROOT_KEY", -) as s: - res = s.liveness.check() +) as unkey: + + res = unkey.liveness.check() + + assert res.object is not None - if res.object is not None: - # handle response - pass + # Handle response + print(res.object) ``` @@ -44,6 +47,7 @@ with Unkey( | models.ErrForbidden | 403 | application/json | | models.ErrNotFound | 404 | application/json | | models.ErrConflict | 409 | application/json | +| models.ErrPreconditionFailed | 412 | application/json | | models.ErrTooManyRequests | 429 | application/json | | models.ErrInternalServerError | 500 | application/json | | models.SDKError | 4XX, 5XX | \*/\* | \ No newline at end of file diff --git a/docs/sdks/migrations/README.md b/docs/sdks/migrations/README.md index 17967a9..96d8a14 100644 --- a/docs/sdks/migrations/README.md +++ b/docs/sdks/migrations/README.md @@ -16,15 +16,46 @@ import unkey_py from unkey_py import Unkey + with Unkey( bearer_auth="UNKEY_ROOT_KEY", -) as s: - res = s.migrations.create_keys(request=[ +) as unkey: + + res = unkey.migrations.create_keys(request=[ + { + "api_id": "api_123", + "name": "my key", + "start": "unkey_32kq", + "external_id": "user_123", + "meta": { + "billingTier": "PRO", + "trialEnds": "2023-06-16T17:16:37.161Z", + }, + "roles": [ + "admin", + "finance", + ], + "permissions": [ + "domains.create_record", + "say_hello", + ], + "expires": 1623869797161, + "remaining": 1000, + "refill": { + "interval": unkey_py.V1MigrationsCreateKeysInterval.DAILY, + "amount": 100, + }, + "ratelimit": { + "limit": 10, + "refill_rate": 1, + "refill_interval": 60, + }, + }, { "api_id": "api_123", "name": "my key", "start": "unkey_32kq", - "owner_id": "team_123", + "external_id": "user_123", "meta": { "billingTier": "PRO", "trialEnds": "2023-06-16T17:16:37.161Z", @@ -47,15 +78,14 @@ with Unkey( "limit": 10, "refill_rate": 1, "refill_interval": 60, - "type": unkey_py.V1MigrationsCreateKeysType.FAST, }, - "enabled": False, }, ]) - if res.object is not None: - # handle response - pass + assert res.object is not None + + # Handle response + print(res.object) ``` @@ -79,6 +109,7 @@ with Unkey( | models.ErrForbidden | 403 | application/json | | models.ErrNotFound | 404 | application/json | | models.ErrConflict | 409 | application/json | +| models.ErrPreconditionFailed | 412 | application/json | | models.ErrTooManyRequests | 429 | application/json | | models.ErrInternalServerError | 500 | application/json | | models.SDKError | 4XX, 5XX | \*/\* | @@ -91,10 +122,12 @@ with Unkey( import unkey_py from unkey_py import Unkey + with Unkey( bearer_auth="UNKEY_ROOT_KEY", -) as s: - res = s.migrations.enqueue(request={ +) as unkey: + + res = unkey.migrations.enqueue(request={ "migration_id": "", "api_id": "", "keys": [ @@ -123,16 +156,69 @@ with Unkey( "ratelimit": { "limit": 10, "duration": 60000, - "type": unkey_py.V1MigrationsEnqueueKeysType.FAST, }, - "enabled": False, + }, + { + "name": "my key", + "start": "unkey_32kq", + "owner_id": "team_123", + "meta": { + "billingTier": "PRO", + "trialEnds": "2023-06-16T17:16:37.161Z", + }, + "roles": [ + "admin", + "finance", + ], + "permissions": [ + "domains.create_record", + "say_hello", + ], + "expires": 1623869797161, + "remaining": 1000, + "refill": { + "interval": unkey_py.V1MigrationsEnqueueKeysInterval.DAILY, + "amount": 100, + }, + "ratelimit": { + "limit": 10, + "duration": 60000, + }, + }, + { + "name": "my key", + "start": "unkey_32kq", + "owner_id": "team_123", + "meta": { + "billingTier": "PRO", + "trialEnds": "2023-06-16T17:16:37.161Z", + }, + "roles": [ + "admin", + "finance", + ], + "permissions": [ + "domains.create_record", + "say_hello", + ], + "expires": 1623869797161, + "remaining": 1000, + "refill": { + "interval": unkey_py.V1MigrationsEnqueueKeysInterval.DAILY, + "amount": 100, + }, + "ratelimit": { + "limit": 10, + "duration": 60000, + }, }, ], }) - if res.object is not None: - # handle response - pass + assert res.object is not None + + # Handle response + print(res.object) ``` @@ -156,6 +242,7 @@ with Unkey( | models.ErrForbidden | 403 | application/json | | models.ErrNotFound | 404 | application/json | | models.ErrConflict | 409 | application/json | +| models.ErrPreconditionFailed | 412 | application/json | | models.ErrTooManyRequests | 429 | application/json | | models.ErrInternalServerError | 500 | application/json | | models.SDKError | 4XX, 5XX | \*/\* | \ No newline at end of file diff --git a/docs/sdks/permissions/README.md b/docs/sdks/permissions/README.md index 4ae5655..baad185 100644 --- a/docs/sdks/permissions/README.md +++ b/docs/sdks/permissions/README.md @@ -21,17 +21,20 @@ ```python from unkey_py import Unkey + with Unkey( bearer_auth="UNKEY_ROOT_KEY", -) as s: - res = s.permissions.create(request={ +) as unkey: + + res = unkey.permissions.create(request={ "name": "record.write", "description": "record.write can create new dns records for our domains.", }) - if res.object is not None: - # handle response - pass + assert res.object is not None + + # Handle response + print(res.object) ``` @@ -55,6 +58,7 @@ with Unkey( | models.ErrForbidden | 403 | application/json | | models.ErrNotFound | 404 | application/json | | models.ErrConflict | 409 | application/json | +| models.ErrPreconditionFailed | 412 | application/json | | models.ErrTooManyRequests | 429 | application/json | | models.ErrInternalServerError | 500 | application/json | | models.SDKError | 4XX, 5XX | \*/\* | @@ -66,16 +70,19 @@ with Unkey( ```python from unkey_py import Unkey + with Unkey( bearer_auth="UNKEY_ROOT_KEY", -) as s: - res = s.permissions.delete(request={ +) as unkey: + + res = unkey.permissions.delete(request={ "permission_id": "perm_123", }) - if res.object is not None: - # handle response - pass + assert res.object is not None + + # Handle response + print(res.object) ``` @@ -99,6 +106,7 @@ with Unkey( | models.ErrForbidden | 403 | application/json | | models.ErrNotFound | 404 | application/json | | models.ErrConflict | 409 | application/json | +| models.ErrPreconditionFailed | 412 | application/json | | models.ErrTooManyRequests | 429 | application/json | | models.ErrInternalServerError | 500 | application/json | | models.SDKError | 4XX, 5XX | \*/\* | @@ -110,14 +118,17 @@ with Unkey( ```python from unkey_py import Unkey + with Unkey( bearer_auth="UNKEY_ROOT_KEY", -) as s: - res = s.permissions.get(permission_id="perm_123") +) as unkey: + + res = unkey.permissions.get(permission_id="perm_123") + + assert res.object is not None - if res.object is not None: - # handle response - pass + # Handle response + print(res.object) ``` @@ -141,6 +152,7 @@ with Unkey( | models.ErrForbidden | 403 | application/json | | models.ErrNotFound | 404 | application/json | | models.ErrConflict | 409 | application/json | +| models.ErrPreconditionFailed | 412 | application/json | | models.ErrTooManyRequests | 429 | application/json | | models.ErrInternalServerError | 500 | application/json | | models.SDKError | 4XX, 5XX | \*/\* | @@ -152,14 +164,17 @@ with Unkey( ```python from unkey_py import Unkey + with Unkey( bearer_auth="UNKEY_ROOT_KEY", -) as s: - res = s.permissions.list() +) as unkey: + + res = unkey.permissions.list() + + assert res.response_bodies is not None - if res.response_bodies is not None: - # handle response - pass + # Handle response + print(res.response_bodies) ``` @@ -182,6 +197,7 @@ with Unkey( | models.ErrForbidden | 403 | application/json | | models.ErrNotFound | 404 | application/json | | models.ErrConflict | 409 | application/json | +| models.ErrPreconditionFailed | 412 | application/json | | models.ErrTooManyRequests | 429 | application/json | | models.ErrInternalServerError | 500 | application/json | | models.SDKError | 4XX, 5XX | \*/\* | @@ -193,17 +209,20 @@ with Unkey( ```python from unkey_py import Unkey + with Unkey( bearer_auth="UNKEY_ROOT_KEY", -) as s: - res = s.permissions.create_role(request={ +) as unkey: + + res = unkey.permissions.create_role(request={ "name": "dns.records.manager", "description": "dns.records.manager can read and write dns records for our domains.", }) - if res.object is not None: - # handle response - pass + assert res.object is not None + + # Handle response + print(res.object) ``` @@ -227,6 +246,7 @@ with Unkey( | models.ErrForbidden | 403 | application/json | | models.ErrNotFound | 404 | application/json | | models.ErrConflict | 409 | application/json | +| models.ErrPreconditionFailed | 412 | application/json | | models.ErrTooManyRequests | 429 | application/json | | models.ErrInternalServerError | 500 | application/json | | models.SDKError | 4XX, 5XX | \*/\* | @@ -238,16 +258,19 @@ with Unkey( ```python from unkey_py import Unkey + with Unkey( bearer_auth="UNKEY_ROOT_KEY", -) as s: - res = s.permissions.delete_role(request={ +) as unkey: + + res = unkey.permissions.delete_role(request={ "role_id": "role_123", }) - if res.object is not None: - # handle response - pass + assert res.object is not None + + # Handle response + print(res.object) ``` @@ -271,6 +294,7 @@ with Unkey( | models.ErrForbidden | 403 | application/json | | models.ErrNotFound | 404 | application/json | | models.ErrConflict | 409 | application/json | +| models.ErrPreconditionFailed | 412 | application/json | | models.ErrTooManyRequests | 429 | application/json | | models.ErrInternalServerError | 500 | application/json | | models.SDKError | 4XX, 5XX | \*/\* | @@ -282,14 +306,17 @@ with Unkey( ```python from unkey_py import Unkey + with Unkey( bearer_auth="UNKEY_ROOT_KEY", -) as s: - res = s.permissions.get_role(role_id="role_123") +) as unkey: + + res = unkey.permissions.get_role(role_id="role_123") + + assert res.object is not None - if res.object is not None: - # handle response - pass + # Handle response + print(res.object) ``` @@ -313,6 +340,7 @@ with Unkey( | models.ErrForbidden | 403 | application/json | | models.ErrNotFound | 404 | application/json | | models.ErrConflict | 409 | application/json | +| models.ErrPreconditionFailed | 412 | application/json | | models.ErrTooManyRequests | 429 | application/json | | models.ErrInternalServerError | 500 | application/json | | models.SDKError | 4XX, 5XX | \*/\* | @@ -324,14 +352,17 @@ with Unkey( ```python from unkey_py import Unkey + with Unkey( bearer_auth="UNKEY_ROOT_KEY", -) as s: - res = s.permissions.list_roles() +) as unkey: + + res = unkey.permissions.list_roles() + + assert res.response_bodies is not None - if res.response_bodies is not None: - # handle response - pass + # Handle response + print(res.response_bodies) ``` @@ -354,6 +385,7 @@ with Unkey( | models.ErrForbidden | 403 | application/json | | models.ErrNotFound | 404 | application/json | | models.ErrConflict | 409 | application/json | +| models.ErrPreconditionFailed | 412 | application/json | | models.ErrTooManyRequests | 429 | application/json | | models.ErrInternalServerError | 500 | application/json | | models.SDKError | 4XX, 5XX | \*/\* | \ No newline at end of file diff --git a/docs/sdks/ratelimit/README.md b/docs/sdks/ratelimit/README.md index 27dc823..e3b3946 100644 --- a/docs/sdks/ratelimit/README.md +++ b/docs/sdks/ratelimit/README.md @@ -5,44 +5,47 @@ ### Available Operations -* [ratelimit_set_override](#ratelimit_set_override) +* [set_override](#set_override) * [list_overrides](#list_overrides) * [get_override](#get_override) -## ratelimit_set_override +## set_override ### Example Usage ```python from unkey_py import Unkey + with Unkey( bearer_auth="UNKEY_ROOT_KEY", -) as s: - res = s.ratelimit.ratelimit_set_override(request={ +) as unkey: + + res = unkey.ratelimit.set_override(request={ + "namespace_id": "rlns_1234", + "namespace_name": "email.outbound", "identifier": "user_123", "limit": 10, "duration": 60000, - "namespace_id": "rlns_1234", - "namespace_name": "email.outbound", }) - if res.object is not None: - # handle response - pass + assert res.object is not None + + # Handle response + print(res.object) ``` ### Parameters -| Parameter | Type | Required | Description | -| ----------------------------------------------------------------------------------------- | ----------------------------------------------------------------------------------------- | ----------------------------------------------------------------------------------------- | ----------------------------------------------------------------------------------------- | -| `request` | [models.RatelimitSetOverrideRequestBody](../../models/ratelimitsetoverriderequestbody.md) | :heavy_check_mark: | The request object to use for the request. | -| `retries` | [Optional[utils.RetryConfig]](../../models/utils/retryconfig.md) | :heavy_minus_sign: | Configuration to override the default retry behavior of the client. | +| Parameter | Type | Required | Description | +| ----------------------------------------------------------------------- | ----------------------------------------------------------------------- | ----------------------------------------------------------------------- | ----------------------------------------------------------------------- | +| `request` | [models.SetOverrideRequestBody](../../models/setoverriderequestbody.md) | :heavy_check_mark: | The request object to use for the request. | +| `retries` | [Optional[utils.RetryConfig]](../../models/utils/retryconfig.md) | :heavy_minus_sign: | Configuration to override the default retry behavior of the client. | ### Response -**[models.RatelimitSetOverrideResponse](../../models/ratelimitsetoverrideresponse.md)** +**[models.SetOverrideResponse](../../models/setoverrideresponse.md)** ### Errors @@ -53,6 +56,7 @@ with Unkey( | models.ErrForbidden | 403 | application/json | | models.ErrNotFound | 404 | application/json | | models.ErrConflict | 409 | application/json | +| models.ErrPreconditionFailed | 412 | application/json | | models.ErrTooManyRequests | 429 | application/json | | models.ErrInternalServerError | 500 | application/json | | models.SDKError | 4XX, 5XX | \*/\* | @@ -64,14 +68,17 @@ with Unkey( ```python from unkey_py import Unkey + with Unkey( bearer_auth="UNKEY_ROOT_KEY", -) as s: - res = s.ratelimit.list_overrides(namespace_id="rlns_1234", namespace_name="email.outbound", limit=100) +) as unkey: + + res = unkey.ratelimit.list_overrides(namespace_id="rlns_1234", namespace_name="email.outbound") + + assert res.object is not None - if res.object is not None: - # handle response - pass + # Handle response + print(res.object) ``` @@ -98,6 +105,7 @@ with Unkey( | models.ErrForbidden | 403 | application/json | | models.ErrNotFound | 404 | application/json | | models.ErrConflict | 409 | application/json | +| models.ErrPreconditionFailed | 412 | application/json | | models.ErrTooManyRequests | 429 | application/json | | models.ErrInternalServerError | 500 | application/json | | models.SDKError | 4XX, 5XX | \*/\* | @@ -109,14 +117,17 @@ with Unkey( ```python from unkey_py import Unkey + with Unkey( bearer_auth="UNKEY_ROOT_KEY", -) as s: - res = s.ratelimit.get_override(identifier="user_123", namespace_id="rlns_1234", namespace_name="email.outbound") +) as unkey: + + res = unkey.ratelimit.get_override(identifier="user_123", namespace_id="rlns_1234", namespace_name="email.outbound") + + assert res.object is not None - if res.object is not None: - # handle response - pass + # Handle response + print(res.object) ``` @@ -142,6 +153,7 @@ with Unkey( | models.ErrForbidden | 403 | application/json | | models.ErrNotFound | 404 | application/json | | models.ErrConflict | 409 | application/json | +| models.ErrPreconditionFailed | 412 | application/json | | models.ErrTooManyRequests | 429 | application/json | | models.ErrInternalServerError | 500 | application/json | | models.SDKError | 4XX, 5XX | \*/\* | \ No newline at end of file diff --git a/docs/sdks/ratelimits/README.md b/docs/sdks/ratelimits/README.md index 4fd404a..d8bbdd1 100644 --- a/docs/sdks/ratelimits/README.md +++ b/docs/sdks/ratelimits/README.md @@ -15,15 +15,15 @@ ```python from unkey_py import Unkey + with Unkey( bearer_auth="UNKEY_ROOT_KEY", -) as s: - res = s.ratelimits.limit(request={ +) as unkey: + + res = unkey.ratelimits.limit(request={ "identifier": "user_123", "limit": 10, "duration": 60000, - "namespace": "email.outbound", - "cost": 2, "resources": [ { "type": "organization", @@ -33,9 +33,10 @@ with Unkey( ], }) - if res.object is not None: - # handle response - pass + assert res.object is not None + + # Handle response + print(res.object) ``` @@ -59,6 +60,7 @@ with Unkey( | models.ErrForbidden | 403 | application/json | | models.ErrNotFound | 404 | application/json | | models.ErrConflict | 409 | application/json | +| models.ErrPreconditionFailed | 412 | application/json | | models.ErrTooManyRequests | 429 | application/json | | models.ErrInternalServerError | 500 | application/json | | models.SDKError | 4XX, 5XX | \*/\* | @@ -70,18 +72,21 @@ with Unkey( ```python from unkey_py import Unkey + with Unkey( bearer_auth="UNKEY_ROOT_KEY", -) as s: - res = s.ratelimits.delete_override(request={ - "identifier": "user_123", +) as unkey: + + res = unkey.ratelimits.delete_override(request={ "namespace_id": "rlns_1234", "namespace_name": "email.outbound", + "identifier": "user_123", }) - if res.object is not None: - # handle response - pass + assert res.object is not None + + # Handle response + print(res.object) ``` @@ -105,6 +110,7 @@ with Unkey( | models.ErrForbidden | 403 | application/json | | models.ErrNotFound | 404 | application/json | | models.ErrConflict | 409 | application/json | +| models.ErrPreconditionFailed | 412 | application/json | | models.ErrTooManyRequests | 429 | application/json | | models.ErrInternalServerError | 500 | application/json | | models.SDKError | 4XX, 5XX | \*/\* | \ No newline at end of file diff --git a/poetry.lock b/poetry.lock index 00347c3..9815839 100644 --- a/poetry.lock +++ b/poetry.lock @@ -1,4 +1,4 @@ -# This file is automatically @generated by Poetry 1.8.3 and should not be changed by hand. +# This file is automatically @generated by Poetry 2.1.2 and should not be changed by hand. [[package]] name = "annotated-types" @@ -6,20 +6,19 @@ version = "0.7.0" description = "Reusable constraint types to use with typing.Annotated" optional = false python-versions = ">=3.8" +groups = ["main"] files = [ {file = "annotated_types-0.7.0-py3-none-any.whl", hash = "sha256:1f02e8b43a8fbbc3f3e0d4f0f4bfc8131bcb4eebe8849b8e5c773f3a1c582a53"}, {file = "annotated_types-0.7.0.tar.gz", hash = "sha256:aff07c09a53a08bc8cfccb9c85b05f1aa9a2a6f23728d790723543408344ce89"}, ] -[package.dependencies] -typing-extensions = {version = ">=4.0.0", markers = "python_version < \"3.9\""} - [[package]] name = "anyio" version = "4.5.2" description = "High level compatibility layer for multiple asynchronous event loop implementations" optional = false python-versions = ">=3.8" +groups = ["main"] files = [ {file = "anyio-4.5.2-py3-none-any.whl", hash = "sha256:c011ee36bc1e8ba40e5a81cb9df91925c218fe9b778554e0b56a21e1b5d4716f"}, {file = "anyio-4.5.2.tar.gz", hash = "sha256:23009af4ed04ce05991845451e11ef02fc7c5ed29179ac9a420e5ad0ac7ddc5b"}, @@ -33,7 +32,7 @@ typing-extensions = {version = ">=4.1", markers = "python_version < \"3.11\""} [package.extras] doc = ["Sphinx (>=7.4,<8.0)", "packaging", "sphinx-autodoc-typehints (>=1.2.0)", "sphinx-rtd-theme"] -test = ["anyio[trio]", "coverage[toml] (>=7)", "exceptiongroup (>=1.2.0)", "hypothesis (>=4.0)", "psutil (>=5.9)", "pytest (>=7.0)", "pytest-mock (>=3.6.1)", "trustme", "truststore (>=0.9.1)", "uvloop (>=0.21.0b1)"] +test = ["anyio[trio]", "coverage[toml] (>=7)", "exceptiongroup (>=1.2.0)", "hypothesis (>=4.0)", "psutil (>=5.9)", "pytest (>=7.0)", "pytest-mock (>=3.6.1)", "trustme", "truststore (>=0.9.1) ; python_version >= \"3.10\"", "uvloop (>=0.21.0b1) ; platform_python_implementation == \"CPython\" and platform_system != \"Windows\""] trio = ["trio (>=0.26.1)"] [[package]] @@ -42,6 +41,7 @@ version = "3.2.4" description = "An abstract syntax tree for Python with inference support." optional = false python-versions = ">=3.8.0" +groups = ["dev"] files = [ {file = "astroid-3.2.4-py3-none-any.whl", hash = "sha256:413658a61eeca6202a59231abb473f932038fbcbf1666587f66d482083413a25"}, {file = "astroid-3.2.4.tar.gz", hash = "sha256:0e14202810b30da1b735827f78f5157be2bbd4a7a59b7707ca0bfc2fb4c0063a"}, @@ -56,6 +56,7 @@ version = "2024.8.30" description = "Python package for providing Mozilla's CA Bundle." optional = false python-versions = ">=3.6" +groups = ["main"] files = [ {file = "certifi-2024.8.30-py3-none-any.whl", hash = "sha256:922820b53db7a7257ffbda3f597266d435245903d80737e34f8a45ff3e3230d8"}, {file = "certifi-2024.8.30.tar.gz", hash = "sha256:bec941d2aa8195e248a60b31ff9f0558284cf01a52591ceda73ea9afffd69fd9"}, @@ -67,6 +68,8 @@ version = "0.4.6" description = "Cross-platform colored terminal text." optional = false python-versions = "!=3.0.*,!=3.1.*,!=3.2.*,!=3.3.*,!=3.4.*,!=3.5.*,!=3.6.*,>=2.7" +groups = ["dev"] +markers = "sys_platform == \"win32\"" files = [ {file = "colorama-0.4.6-py2.py3-none-any.whl", hash = "sha256:4f1d9991f5acc0ca119f9d443620b77f9d6b33703e51011c16baf57afb285fc6"}, {file = "colorama-0.4.6.tar.gz", hash = "sha256:08695f5cb7ed6e0531a20572697297273c47b8cae5a63ffc6d6ed5c201be6e44"}, @@ -78,6 +81,7 @@ version = "0.3.9" description = "serialize all of Python" optional = false python-versions = ">=3.8" +groups = ["dev"] files = [ {file = "dill-0.3.9-py3-none-any.whl", hash = "sha256:468dff3b89520b474c0397703366b7b95eebe6303f108adf9b19da1f702be87a"}, {file = "dill-0.3.9.tar.gz", hash = "sha256:81aa267dddf68cbfe8029c42ca9ec6a4ab3b22371d1c450abc54422577b4512c"}, @@ -87,26 +91,14 @@ files = [ graph = ["objgraph (>=1.7.2)"] profile = ["gprof2dot (>=2022.7.29)"] -[[package]] -name = "eval-type-backport" -version = "0.2.0" -description = "Like `typing._eval_type`, but lets older Python versions use newer typing features." -optional = false -python-versions = ">=3.8" -files = [ - {file = "eval_type_backport-0.2.0-py3-none-any.whl", hash = "sha256:ac2f73d30d40c5a30a80b8739a789d6bb5e49fdffa66d7912667e2015d9c9933"}, - {file = "eval_type_backport-0.2.0.tar.gz", hash = "sha256:68796cfbc7371ebf923f03bdf7bef415f3ec098aeced24e054b253a0e78f7b37"}, -] - -[package.extras] -tests = ["pytest"] - [[package]] name = "exceptiongroup" version = "1.2.2" description = "Backport of PEP 654 (exception groups)" optional = false python-versions = ">=3.7" +groups = ["main"] +markers = "python_version < \"3.11\"" files = [ {file = "exceptiongroup-1.2.2-py3-none-any.whl", hash = "sha256:3111b9d131c238bec2f8f516e123e14ba243563fb135d3fe885990585aa7795b"}, {file = "exceptiongroup-1.2.2.tar.gz", hash = "sha256:47c2edf7c6738fafb49fd34290706d1a1a2f4d1c6df275526b62cbb4aa5393cc"}, @@ -121,6 +113,7 @@ version = "0.14.0" description = "A pure-Python, bring-your-own-I/O implementation of HTTP/1.1" optional = false python-versions = ">=3.7" +groups = ["main"] files = [ {file = "h11-0.14.0-py3-none-any.whl", hash = "sha256:e3fe4ac4b851c468cc8363d500db52c2ead036020723024a109d37346efaa761"}, {file = "h11-0.14.0.tar.gz", hash = "sha256:8f19fbbe99e72420ff35c00b27a34cb9937e902a8b810e2c88300c6f0a3b699d"}, @@ -132,6 +125,7 @@ version = "1.0.6" description = "A minimal low-level HTTP client." optional = false python-versions = ">=3.8" +groups = ["main"] files = [ {file = "httpcore-1.0.6-py3-none-any.whl", hash = "sha256:27b59625743b85577a8c0e10e55b50b5368a4f2cfe8cc7bcfa9cf00829c2682f"}, {file = "httpcore-1.0.6.tar.gz", hash = "sha256:73f6dbd6eb8c21bbf7ef8efad555481853f5f6acdeaff1edb0694289269ee17f"}, @@ -149,13 +143,14 @@ trio = ["trio (>=0.22.0,<1.0)"] [[package]] name = "httpx" -version = "0.27.2" +version = "0.28.1" description = "The next generation HTTP client." optional = false python-versions = ">=3.8" +groups = ["main"] files = [ - {file = "httpx-0.27.2-py3-none-any.whl", hash = "sha256:7bb2708e112d8fdd7829cd4243970f0c223274051cb35ee80c03301ee29a3df0"}, - {file = "httpx-0.27.2.tar.gz", hash = "sha256:f7c2be1d2f3c3c3160d441802406b206c2b76f5947b11115e6df10c6c65e66c2"}, + {file = "httpx-0.28.1-py3-none-any.whl", hash = "sha256:d909fcccc110f8c7faf814ca82a9a4d816bc5a6dbfea25d6591d6985b8ba59ad"}, + {file = "httpx-0.28.1.tar.gz", hash = "sha256:75e98c5f16b0f35b567856f597f06ff2270a374470a5c2392242528e3e3e42fc"}, ] [package.dependencies] @@ -163,10 +158,9 @@ anyio = "*" certifi = "*" httpcore = "==1.*" idna = "*" -sniffio = "*" [package.extras] -brotli = ["brotli", "brotlicffi"] +brotli = ["brotli ; platform_python_implementation == \"CPython\"", "brotlicffi ; platform_python_implementation != \"CPython\""] cli = ["click (==8.*)", "pygments (==2.*)", "rich (>=10,<14)"] http2 = ["h2 (>=3,<5)"] socks = ["socksio (==1.*)"] @@ -178,6 +172,7 @@ version = "3.10" description = "Internationalized Domain Names in Applications (IDNA)" optional = false python-versions = ">=3.6" +groups = ["main"] files = [ {file = "idna-3.10-py3-none-any.whl", hash = "sha256:946d195a0d259cbba61165e88e65941f16e9b36ea6ddb97f00452bae8b1287d3"}, {file = "idna-3.10.tar.gz", hash = "sha256:12f65c9b470abda6dc35cf8e63cc574b1c52b11df2c86030af0ac09b01b13ea9"}, @@ -192,6 +187,7 @@ version = "5.13.2" description = "A Python utility / library to sort Python imports." optional = false python-versions = ">=3.8.0" +groups = ["dev"] files = [ {file = "isort-5.13.2-py3-none-any.whl", hash = "sha256:8ca5e72a8d85860d5a3fa69b8745237f2939afe12dbf656afbcb47fe72d947a6"}, {file = "isort-5.13.2.tar.gz", hash = "sha256:48fdfcb9face5d58a4f6dde2e72a1fb8dcaf8ab26f95ab49fab84c2ddefb0109"}, @@ -206,6 +202,7 @@ version = "1.0.6" description = "A more powerful JSONPath implementation in modern python" optional = false python-versions = ">=3.6" +groups = ["main"] files = [ {file = "jsonpath-python-1.0.6.tar.gz", hash = "sha256:dd5be4a72d8a2995c3f583cf82bf3cd1a9544cfdabf2d22595b67aff07349666"}, {file = "jsonpath_python-1.0.6-py3-none-any.whl", hash = "sha256:1e3b78df579f5efc23565293612decee04214609208a2335884b3ee3f786b575"}, @@ -217,6 +214,7 @@ version = "0.7.0" description = "McCabe checker, plugin for flake8" optional = false python-versions = ">=3.6" +groups = ["dev"] files = [ {file = "mccabe-0.7.0-py2.py3-none-any.whl", hash = "sha256:6c2d30ab6be0e4a46919781807b4f0d834ebdd6c6e3dca0bda5a15f863427b6e"}, {file = "mccabe-0.7.0.tar.gz", hash = "sha256:348e0240c33b60bbdf4e523192ef919f28cb2c3d7d5c7794f74009290f236325"}, @@ -224,49 +222,50 @@ files = [ [[package]] name = "mypy" -version = "1.13.0" +version = "1.15.0" description = "Optional static typing for Python" optional = false -python-versions = ">=3.8" +python-versions = ">=3.9" +groups = ["dev"] files = [ - {file = "mypy-1.13.0-cp310-cp310-macosx_10_9_x86_64.whl", hash = "sha256:6607e0f1dd1fb7f0aca14d936d13fd19eba5e17e1cd2a14f808fa5f8f6d8f60a"}, - {file = "mypy-1.13.0-cp310-cp310-macosx_11_0_arm64.whl", hash = "sha256:8a21be69bd26fa81b1f80a61ee7ab05b076c674d9b18fb56239d72e21d9f4c80"}, - {file = "mypy-1.13.0-cp310-cp310-manylinux_2_17_x86_64.manylinux2014_x86_64.manylinux_2_28_x86_64.whl", hash = "sha256:7b2353a44d2179846a096e25691d54d59904559f4232519d420d64da6828a3a7"}, - {file = "mypy-1.13.0-cp310-cp310-musllinux_1_1_x86_64.whl", hash = "sha256:0730d1c6a2739d4511dc4253f8274cdd140c55c32dfb0a4cf8b7a43f40abfa6f"}, - {file = "mypy-1.13.0-cp310-cp310-win_amd64.whl", hash = "sha256:c5fc54dbb712ff5e5a0fca797e6e0aa25726c7e72c6a5850cfd2adbc1eb0a372"}, - {file = "mypy-1.13.0-cp311-cp311-macosx_10_9_x86_64.whl", hash = "sha256:581665e6f3a8a9078f28d5502f4c334c0c8d802ef55ea0e7276a6e409bc0d82d"}, - {file = "mypy-1.13.0-cp311-cp311-macosx_11_0_arm64.whl", hash = "sha256:3ddb5b9bf82e05cc9a627e84707b528e5c7caaa1c55c69e175abb15a761cec2d"}, - {file = "mypy-1.13.0-cp311-cp311-manylinux_2_17_x86_64.manylinux2014_x86_64.manylinux_2_28_x86_64.whl", hash = "sha256:20c7ee0bc0d5a9595c46f38beb04201f2620065a93755704e141fcac9f59db2b"}, - {file = "mypy-1.13.0-cp311-cp311-musllinux_1_1_x86_64.whl", hash = "sha256:3790ded76f0b34bc9c8ba4def8f919dd6a46db0f5a6610fb994fe8efdd447f73"}, - {file = "mypy-1.13.0-cp311-cp311-win_amd64.whl", hash = "sha256:51f869f4b6b538229c1d1bcc1dd7d119817206e2bc54e8e374b3dfa202defcca"}, - {file = "mypy-1.13.0-cp312-cp312-macosx_10_13_x86_64.whl", hash = "sha256:5c7051a3461ae84dfb5dd15eff5094640c61c5f22257c8b766794e6dd85e72d5"}, - {file = "mypy-1.13.0-cp312-cp312-macosx_11_0_arm64.whl", hash = "sha256:39bb21c69a5d6342f4ce526e4584bc5c197fd20a60d14a8624d8743fffb9472e"}, - {file = "mypy-1.13.0-cp312-cp312-manylinux_2_17_x86_64.manylinux2014_x86_64.manylinux_2_28_x86_64.whl", hash = "sha256:164f28cb9d6367439031f4c81e84d3ccaa1e19232d9d05d37cb0bd880d3f93c2"}, - {file = "mypy-1.13.0-cp312-cp312-musllinux_1_1_x86_64.whl", hash = "sha256:a4c1bfcdbce96ff5d96fc9b08e3831acb30dc44ab02671eca5953eadad07d6d0"}, - {file = "mypy-1.13.0-cp312-cp312-win_amd64.whl", hash = "sha256:a0affb3a79a256b4183ba09811e3577c5163ed06685e4d4b46429a271ba174d2"}, - {file = "mypy-1.13.0-cp313-cp313-macosx_10_13_x86_64.whl", hash = "sha256:a7b44178c9760ce1a43f544e595d35ed61ac2c3de306599fa59b38a6048e1aa7"}, - {file = "mypy-1.13.0-cp313-cp313-macosx_11_0_arm64.whl", hash = "sha256:5d5092efb8516d08440e36626f0153b5006d4088c1d663d88bf79625af3d1d62"}, - {file = "mypy-1.13.0-cp313-cp313-manylinux_2_17_x86_64.manylinux2014_x86_64.manylinux_2_28_x86_64.whl", hash = "sha256:de2904956dac40ced10931ac967ae63c5089bd498542194b436eb097a9f77bc8"}, - {file = "mypy-1.13.0-cp313-cp313-musllinux_1_1_x86_64.whl", hash = "sha256:7bfd8836970d33c2105562650656b6846149374dc8ed77d98424b40b09340ba7"}, - {file = "mypy-1.13.0-cp313-cp313-win_amd64.whl", hash = "sha256:9f73dba9ec77acb86457a8fc04b5239822df0c14a082564737833d2963677dbc"}, - {file = "mypy-1.13.0-cp38-cp38-macosx_10_9_x86_64.whl", hash = "sha256:100fac22ce82925f676a734af0db922ecfea991e1d7ec0ceb1e115ebe501301a"}, - {file = "mypy-1.13.0-cp38-cp38-macosx_11_0_arm64.whl", hash = "sha256:7bcb0bb7f42a978bb323a7c88f1081d1b5dee77ca86f4100735a6f541299d8fb"}, - {file = "mypy-1.13.0-cp38-cp38-manylinux_2_17_x86_64.manylinux2014_x86_64.manylinux_2_28_x86_64.whl", hash = "sha256:bde31fc887c213e223bbfc34328070996061b0833b0a4cfec53745ed61f3519b"}, - {file = "mypy-1.13.0-cp38-cp38-musllinux_1_1_x86_64.whl", hash = "sha256:07de989f89786f62b937851295ed62e51774722e5444a27cecca993fc3f9cd74"}, - {file = "mypy-1.13.0-cp38-cp38-win_amd64.whl", hash = "sha256:4bde84334fbe19bad704b3f5b78c4abd35ff1026f8ba72b29de70dda0916beb6"}, - {file = "mypy-1.13.0-cp39-cp39-macosx_10_9_x86_64.whl", hash = "sha256:0246bcb1b5de7f08f2826451abd947bf656945209b140d16ed317f65a17dc7dc"}, - {file = "mypy-1.13.0-cp39-cp39-macosx_11_0_arm64.whl", hash = "sha256:7f5b7deae912cf8b77e990b9280f170381fdfbddf61b4ef80927edd813163732"}, - {file = "mypy-1.13.0-cp39-cp39-manylinux_2_17_x86_64.manylinux2014_x86_64.manylinux_2_28_x86_64.whl", hash = "sha256:7029881ec6ffb8bc233a4fa364736789582c738217b133f1b55967115288a2bc"}, - {file = "mypy-1.13.0-cp39-cp39-musllinux_1_1_x86_64.whl", hash = "sha256:3e38b980e5681f28f033f3be86b099a247b13c491f14bb8b1e1e134d23bb599d"}, - {file = "mypy-1.13.0-cp39-cp39-win_amd64.whl", hash = "sha256:a6789be98a2017c912ae6ccb77ea553bbaf13d27605d2ca20a76dfbced631b24"}, - {file = "mypy-1.13.0-py3-none-any.whl", hash = "sha256:9c250883f9fd81d212e0952c92dbfcc96fc237f4b7c92f56ac81fd48460b3e5a"}, - {file = "mypy-1.13.0.tar.gz", hash = "sha256:0291a61b6fbf3e6673e3405cfcc0e7650bebc7939659fdca2702958038bd835e"}, + {file = "mypy-1.15.0-cp310-cp310-macosx_10_9_x86_64.whl", hash = "sha256:979e4e1a006511dacf628e36fadfecbcc0160a8af6ca7dad2f5025529e082c13"}, + {file = "mypy-1.15.0-cp310-cp310-macosx_11_0_arm64.whl", hash = "sha256:c4bb0e1bd29f7d34efcccd71cf733580191e9a264a2202b0239da95984c5b559"}, + {file = "mypy-1.15.0-cp310-cp310-manylinux_2_17_aarch64.manylinux2014_aarch64.manylinux_2_28_aarch64.whl", hash = "sha256:be68172e9fd9ad8fb876c6389f16d1c1b5f100ffa779f77b1fb2176fcc9ab95b"}, + {file = "mypy-1.15.0-cp310-cp310-manylinux_2_17_x86_64.manylinux2014_x86_64.manylinux_2_28_x86_64.whl", hash = "sha256:c7be1e46525adfa0d97681432ee9fcd61a3964c2446795714699a998d193f1a3"}, + {file = "mypy-1.15.0-cp310-cp310-musllinux_1_2_x86_64.whl", hash = "sha256:2e2c2e6d3593f6451b18588848e66260ff62ccca522dd231cd4dd59b0160668b"}, + {file = "mypy-1.15.0-cp310-cp310-win_amd64.whl", hash = "sha256:6983aae8b2f653e098edb77f893f7b6aca69f6cffb19b2cc7443f23cce5f4828"}, + {file = "mypy-1.15.0-cp311-cp311-macosx_10_9_x86_64.whl", hash = "sha256:2922d42e16d6de288022e5ca321cd0618b238cfc5570e0263e5ba0a77dbef56f"}, + {file = "mypy-1.15.0-cp311-cp311-macosx_11_0_arm64.whl", hash = "sha256:2ee2d57e01a7c35de00f4634ba1bbf015185b219e4dc5909e281016df43f5ee5"}, + {file = "mypy-1.15.0-cp311-cp311-manylinux_2_17_aarch64.manylinux2014_aarch64.manylinux_2_28_aarch64.whl", hash = "sha256:973500e0774b85d9689715feeffcc980193086551110fd678ebe1f4342fb7c5e"}, + {file = "mypy-1.15.0-cp311-cp311-manylinux_2_17_x86_64.manylinux2014_x86_64.manylinux_2_28_x86_64.whl", hash = "sha256:5a95fb17c13e29d2d5195869262f8125dfdb5c134dc8d9a9d0aecf7525b10c2c"}, + {file = "mypy-1.15.0-cp311-cp311-musllinux_1_2_x86_64.whl", hash = "sha256:1905f494bfd7d85a23a88c5d97840888a7bd516545fc5aaedff0267e0bb54e2f"}, + {file = "mypy-1.15.0-cp311-cp311-win_amd64.whl", hash = "sha256:c9817fa23833ff189db061e6d2eff49b2f3b6ed9856b4a0a73046e41932d744f"}, + {file = "mypy-1.15.0-cp312-cp312-macosx_10_13_x86_64.whl", hash = "sha256:aea39e0583d05124836ea645f412e88a5c7d0fd77a6d694b60d9b6b2d9f184fd"}, + {file = "mypy-1.15.0-cp312-cp312-macosx_11_0_arm64.whl", hash = "sha256:2f2147ab812b75e5b5499b01ade1f4a81489a147c01585cda36019102538615f"}, + {file = "mypy-1.15.0-cp312-cp312-manylinux_2_17_aarch64.manylinux2014_aarch64.manylinux_2_28_aarch64.whl", hash = "sha256:ce436f4c6d218a070048ed6a44c0bbb10cd2cc5e272b29e7845f6a2f57ee4464"}, + {file = "mypy-1.15.0-cp312-cp312-manylinux_2_17_x86_64.manylinux2014_x86_64.manylinux_2_28_x86_64.whl", hash = "sha256:8023ff13985661b50a5928fc7a5ca15f3d1affb41e5f0a9952cb68ef090b31ee"}, + {file = "mypy-1.15.0-cp312-cp312-musllinux_1_2_x86_64.whl", hash = "sha256:1124a18bc11a6a62887e3e137f37f53fbae476dc36c185d549d4f837a2a6a14e"}, + {file = "mypy-1.15.0-cp312-cp312-win_amd64.whl", hash = "sha256:171a9ca9a40cd1843abeca0e405bc1940cd9b305eaeea2dda769ba096932bb22"}, + {file = "mypy-1.15.0-cp313-cp313-macosx_10_13_x86_64.whl", hash = "sha256:93faf3fdb04768d44bf28693293f3904bbb555d076b781ad2530214ee53e3445"}, + {file = "mypy-1.15.0-cp313-cp313-macosx_11_0_arm64.whl", hash = "sha256:811aeccadfb730024c5d3e326b2fbe9249bb7413553f15499a4050f7c30e801d"}, + {file = "mypy-1.15.0-cp313-cp313-manylinux_2_17_aarch64.manylinux2014_aarch64.manylinux_2_28_aarch64.whl", hash = "sha256:98b7b9b9aedb65fe628c62a6dc57f6d5088ef2dfca37903a7d9ee374d03acca5"}, + {file = "mypy-1.15.0-cp313-cp313-manylinux_2_17_x86_64.manylinux2014_x86_64.manylinux_2_28_x86_64.whl", hash = "sha256:c43a7682e24b4f576d93072216bf56eeff70d9140241f9edec0c104d0c515036"}, + {file = "mypy-1.15.0-cp313-cp313-musllinux_1_2_x86_64.whl", hash = "sha256:baefc32840a9f00babd83251560e0ae1573e2f9d1b067719479bfb0e987c6357"}, + {file = "mypy-1.15.0-cp313-cp313-win_amd64.whl", hash = "sha256:b9378e2c00146c44793c98b8d5a61039a048e31f429fb0eb546d93f4b000bedf"}, + {file = "mypy-1.15.0-cp39-cp39-macosx_10_9_x86_64.whl", hash = "sha256:e601a7fa172c2131bff456bb3ee08a88360760d0d2f8cbd7a75a65497e2df078"}, + {file = "mypy-1.15.0-cp39-cp39-macosx_11_0_arm64.whl", hash = "sha256:712e962a6357634fef20412699a3655c610110e01cdaa6180acec7fc9f8513ba"}, + {file = "mypy-1.15.0-cp39-cp39-manylinux_2_17_aarch64.manylinux2014_aarch64.manylinux_2_28_aarch64.whl", hash = "sha256:f95579473af29ab73a10bada2f9722856792a36ec5af5399b653aa28360290a5"}, + {file = "mypy-1.15.0-cp39-cp39-manylinux_2_17_x86_64.manylinux2014_x86_64.manylinux_2_28_x86_64.whl", hash = "sha256:8f8722560a14cde92fdb1e31597760dc35f9f5524cce17836c0d22841830fd5b"}, + {file = "mypy-1.15.0-cp39-cp39-musllinux_1_2_x86_64.whl", hash = "sha256:1fbb8da62dc352133d7d7ca90ed2fb0e9d42bb1a32724c287d3c76c58cbaa9c2"}, + {file = "mypy-1.15.0-cp39-cp39-win_amd64.whl", hash = "sha256:d10d994b41fb3497719bbf866f227b3489048ea4bbbb5015357db306249f7980"}, + {file = "mypy-1.15.0-py3-none-any.whl", hash = "sha256:5469affef548bd1895d86d3bf10ce2b44e33d86923c29e4d675b3e323437ea3e"}, + {file = "mypy-1.15.0.tar.gz", hash = "sha256:404534629d51d3efea5c800ee7c42b72a6554d6c400e6a79eafe15d11341fd43"}, ] [package.dependencies] -mypy-extensions = ">=1.0.0" +mypy_extensions = ">=1.0.0" tomli = {version = ">=1.1.0", markers = "python_version < \"3.11\""} -typing-extensions = ">=4.6.0" +typing_extensions = ">=4.6.0" [package.extras] dmypy = ["psutil (>=4.0)"] @@ -281,6 +280,7 @@ version = "1.0.0" description = "Type system extensions for programs checked with the mypy type checker." optional = false python-versions = ">=3.5" +groups = ["dev"] files = [ {file = "mypy_extensions-1.0.0-py3-none-any.whl", hash = "sha256:4392f6c0eb8a5668a69e23d168ffa70f0be9ccfd32b5cc2d26a34ae5b844552d"}, {file = "mypy_extensions-1.0.0.tar.gz", hash = "sha256:75dbf8955dc00442a438fc4d0666508a9a97b6bd41aa2f0ffe9d2f2725af0782"}, @@ -292,6 +292,7 @@ version = "4.3.6" description = "A small Python package for determining appropriate platform-specific dirs, e.g. a `user data dir`." optional = false python-versions = ">=3.8" +groups = ["dev"] files = [ {file = "platformdirs-4.3.6-py3-none-any.whl", hash = "sha256:73e575e1408ab8103900836b97580d5307456908a03e92031bab39e4554cc3fb"}, {file = "platformdirs-4.3.6.tar.gz", hash = "sha256:357fb2acbc885b0419afd3ce3ed34564c13c9b95c89360cd9563f73aa5e2b907"}, @@ -304,123 +305,133 @@ type = ["mypy (>=1.11.2)"] [[package]] name = "pydantic" -version = "2.9.2" +version = "2.11.4" description = "Data validation using Python type hints" optional = false -python-versions = ">=3.8" +python-versions = ">=3.9" +groups = ["main"] files = [ - {file = "pydantic-2.9.2-py3-none-any.whl", hash = "sha256:f048cec7b26778210e28a0459867920654d48e5e62db0958433636cde4254f12"}, - {file = "pydantic-2.9.2.tar.gz", hash = "sha256:d155cef71265d1e9807ed1c32b4c8deec042a44a50a4188b25ac67ecd81a9c0f"}, + {file = "pydantic-2.11.4-py3-none-any.whl", hash = "sha256:d9615eaa9ac5a063471da949c8fc16376a84afb5024688b3ff885693506764eb"}, + {file = "pydantic-2.11.4.tar.gz", hash = "sha256:32738d19d63a226a52eed76645a98ee07c1f410ee41d93b4afbfa85ed8111c2d"}, ] [package.dependencies] annotated-types = ">=0.6.0" -pydantic-core = "2.23.4" -typing-extensions = [ - {version = ">=4.6.1", markers = "python_version < \"3.13\""}, - {version = ">=4.12.2", markers = "python_version >= \"3.13\""}, -] +pydantic-core = "2.33.2" +typing-extensions = ">=4.12.2" +typing-inspection = ">=0.4.0" [package.extras] email = ["email-validator (>=2.0.0)"] -timezone = ["tzdata"] +timezone = ["tzdata ; python_version >= \"3.9\" and platform_system == \"Windows\""] [[package]] name = "pydantic-core" -version = "2.23.4" +version = "2.33.2" description = "Core functionality for Pydantic validation and serialization" optional = false -python-versions = ">=3.8" +python-versions = ">=3.9" +groups = ["main"] files = [ - {file = "pydantic_core-2.23.4-cp310-cp310-macosx_10_12_x86_64.whl", hash = "sha256:b10bd51f823d891193d4717448fab065733958bdb6a6b351967bd349d48d5c9b"}, - {file = "pydantic_core-2.23.4-cp310-cp310-macosx_11_0_arm64.whl", hash = "sha256:4fc714bdbfb534f94034efaa6eadd74e5b93c8fa6315565a222f7b6f42ca1166"}, - {file = "pydantic_core-2.23.4-cp310-cp310-manylinux_2_17_aarch64.manylinux2014_aarch64.whl", hash = "sha256:63e46b3169866bd62849936de036f901a9356e36376079b05efa83caeaa02ceb"}, - {file = "pydantic_core-2.23.4-cp310-cp310-manylinux_2_17_armv7l.manylinux2014_armv7l.whl", hash = "sha256:ed1a53de42fbe34853ba90513cea21673481cd81ed1be739f7f2efb931b24916"}, - {file = "pydantic_core-2.23.4-cp310-cp310-manylinux_2_17_ppc64le.manylinux2014_ppc64le.whl", hash = "sha256:cfdd16ab5e59fc31b5e906d1a3f666571abc367598e3e02c83403acabc092e07"}, - {file = "pydantic_core-2.23.4-cp310-cp310-manylinux_2_17_s390x.manylinux2014_s390x.whl", hash = "sha256:255a8ef062cbf6674450e668482456abac99a5583bbafb73f9ad469540a3a232"}, - {file = "pydantic_core-2.23.4-cp310-cp310-manylinux_2_17_x86_64.manylinux2014_x86_64.whl", hash = "sha256:4a7cd62e831afe623fbb7aabbb4fe583212115b3ef38a9f6b71869ba644624a2"}, - {file = "pydantic_core-2.23.4-cp310-cp310-manylinux_2_5_i686.manylinux1_i686.whl", hash = "sha256:f09e2ff1f17c2b51f2bc76d1cc33da96298f0a036a137f5440ab3ec5360b624f"}, - {file = "pydantic_core-2.23.4-cp310-cp310-musllinux_1_1_aarch64.whl", hash = "sha256:e38e63e6f3d1cec5a27e0afe90a085af8b6806ee208b33030e65b6516353f1a3"}, - {file = "pydantic_core-2.23.4-cp310-cp310-musllinux_1_1_x86_64.whl", hash = "sha256:0dbd8dbed2085ed23b5c04afa29d8fd2771674223135dc9bc937f3c09284d071"}, - {file = "pydantic_core-2.23.4-cp310-none-win32.whl", hash = "sha256:6531b7ca5f951d663c339002e91aaebda765ec7d61b7d1e3991051906ddde119"}, - {file = "pydantic_core-2.23.4-cp310-none-win_amd64.whl", hash = "sha256:7c9129eb40958b3d4500fa2467e6a83356b3b61bfff1b414c7361d9220f9ae8f"}, - {file = "pydantic_core-2.23.4-cp311-cp311-macosx_10_12_x86_64.whl", hash = "sha256:77733e3892bb0a7fa797826361ce8a9184d25c8dffaec60b7ffe928153680ba8"}, - {file = "pydantic_core-2.23.4-cp311-cp311-macosx_11_0_arm64.whl", hash = "sha256:1b84d168f6c48fabd1f2027a3d1bdfe62f92cade1fb273a5d68e621da0e44e6d"}, - {file = "pydantic_core-2.23.4-cp311-cp311-manylinux_2_17_aarch64.manylinux2014_aarch64.whl", hash = "sha256:df49e7a0861a8c36d089c1ed57d308623d60416dab2647a4a17fe050ba85de0e"}, - {file = "pydantic_core-2.23.4-cp311-cp311-manylinux_2_17_armv7l.manylinux2014_armv7l.whl", hash = "sha256:ff02b6d461a6de369f07ec15e465a88895f3223eb75073ffea56b84d9331f607"}, - {file = "pydantic_core-2.23.4-cp311-cp311-manylinux_2_17_ppc64le.manylinux2014_ppc64le.whl", hash = "sha256:996a38a83508c54c78a5f41456b0103c30508fed9abcad0a59b876d7398f25fd"}, - {file = "pydantic_core-2.23.4-cp311-cp311-manylinux_2_17_s390x.manylinux2014_s390x.whl", hash = "sha256:d97683ddee4723ae8c95d1eddac7c192e8c552da0c73a925a89fa8649bf13eea"}, - {file = "pydantic_core-2.23.4-cp311-cp311-manylinux_2_17_x86_64.manylinux2014_x86_64.whl", hash = "sha256:216f9b2d7713eb98cb83c80b9c794de1f6b7e3145eef40400c62e86cee5f4e1e"}, - {file = "pydantic_core-2.23.4-cp311-cp311-manylinux_2_5_i686.manylinux1_i686.whl", hash = "sha256:6f783e0ec4803c787bcea93e13e9932edab72068f68ecffdf86a99fd5918878b"}, - {file = "pydantic_core-2.23.4-cp311-cp311-musllinux_1_1_aarch64.whl", hash = "sha256:d0776dea117cf5272382634bd2a5c1b6eb16767c223c6a5317cd3e2a757c61a0"}, - {file = "pydantic_core-2.23.4-cp311-cp311-musllinux_1_1_x86_64.whl", hash = "sha256:d5f7a395a8cf1621939692dba2a6b6a830efa6b3cee787d82c7de1ad2930de64"}, - {file = "pydantic_core-2.23.4-cp311-none-win32.whl", hash = "sha256:74b9127ffea03643e998e0c5ad9bd3811d3dac8c676e47db17b0ee7c3c3bf35f"}, - {file = "pydantic_core-2.23.4-cp311-none-win_amd64.whl", hash = "sha256:98d134c954828488b153d88ba1f34e14259284f256180ce659e8d83e9c05eaa3"}, - {file = "pydantic_core-2.23.4-cp312-cp312-macosx_10_12_x86_64.whl", hash = "sha256:f3e0da4ebaef65158d4dfd7d3678aad692f7666877df0002b8a522cdf088f231"}, - {file = "pydantic_core-2.23.4-cp312-cp312-macosx_11_0_arm64.whl", hash = "sha256:f69a8e0b033b747bb3e36a44e7732f0c99f7edd5cea723d45bc0d6e95377ffee"}, - {file = "pydantic_core-2.23.4-cp312-cp312-manylinux_2_17_aarch64.manylinux2014_aarch64.whl", hash = "sha256:723314c1d51722ab28bfcd5240d858512ffd3116449c557a1336cbe3919beb87"}, - {file = "pydantic_core-2.23.4-cp312-cp312-manylinux_2_17_armv7l.manylinux2014_armv7l.whl", hash = "sha256:bb2802e667b7051a1bebbfe93684841cc9351004e2badbd6411bf357ab8d5ac8"}, - {file = "pydantic_core-2.23.4-cp312-cp312-manylinux_2_17_ppc64le.manylinux2014_ppc64le.whl", hash = "sha256:d18ca8148bebe1b0a382a27a8ee60350091a6ddaf475fa05ef50dc35b5df6327"}, - {file = "pydantic_core-2.23.4-cp312-cp312-manylinux_2_17_s390x.manylinux2014_s390x.whl", hash = "sha256:33e3d65a85a2a4a0dc3b092b938a4062b1a05f3a9abde65ea93b233bca0e03f2"}, - {file = "pydantic_core-2.23.4-cp312-cp312-manylinux_2_17_x86_64.manylinux2014_x86_64.whl", hash = "sha256:128585782e5bfa515c590ccee4b727fb76925dd04a98864182b22e89a4e6ed36"}, - {file = "pydantic_core-2.23.4-cp312-cp312-manylinux_2_5_i686.manylinux1_i686.whl", hash = "sha256:68665f4c17edcceecc112dfed5dbe6f92261fb9d6054b47d01bf6371a6196126"}, - {file = "pydantic_core-2.23.4-cp312-cp312-musllinux_1_1_aarch64.whl", hash = "sha256:20152074317d9bed6b7a95ade3b7d6054845d70584216160860425f4fbd5ee9e"}, - {file = "pydantic_core-2.23.4-cp312-cp312-musllinux_1_1_x86_64.whl", hash = "sha256:9261d3ce84fa1d38ed649c3638feefeae23d32ba9182963e465d58d62203bd24"}, - {file = "pydantic_core-2.23.4-cp312-none-win32.whl", hash = "sha256:4ba762ed58e8d68657fc1281e9bb72e1c3e79cc5d464be146e260c541ec12d84"}, - {file = "pydantic_core-2.23.4-cp312-none-win_amd64.whl", hash = "sha256:97df63000f4fea395b2824da80e169731088656d1818a11b95f3b173747b6cd9"}, - {file = "pydantic_core-2.23.4-cp313-cp313-macosx_10_12_x86_64.whl", hash = "sha256:7530e201d10d7d14abce4fb54cfe5b94a0aefc87da539d0346a484ead376c3cc"}, - {file = "pydantic_core-2.23.4-cp313-cp313-macosx_11_0_arm64.whl", hash = "sha256:df933278128ea1cd77772673c73954e53a1c95a4fdf41eef97c2b779271bd0bd"}, - {file = "pydantic_core-2.23.4-cp313-cp313-manylinux_2_17_aarch64.manylinux2014_aarch64.whl", hash = "sha256:0cb3da3fd1b6a5d0279a01877713dbda118a2a4fc6f0d821a57da2e464793f05"}, - {file = "pydantic_core-2.23.4-cp313-cp313-manylinux_2_17_armv7l.manylinux2014_armv7l.whl", hash = "sha256:42c6dcb030aefb668a2b7009c85b27f90e51e6a3b4d5c9bc4c57631292015b0d"}, - {file = "pydantic_core-2.23.4-cp313-cp313-manylinux_2_17_ppc64le.manylinux2014_ppc64le.whl", hash = "sha256:696dd8d674d6ce621ab9d45b205df149399e4bb9aa34102c970b721554828510"}, - {file = "pydantic_core-2.23.4-cp313-cp313-manylinux_2_17_s390x.manylinux2014_s390x.whl", hash = "sha256:2971bb5ffe72cc0f555c13e19b23c85b654dd2a8f7ab493c262071377bfce9f6"}, - {file = "pydantic_core-2.23.4-cp313-cp313-manylinux_2_17_x86_64.manylinux2014_x86_64.whl", hash = "sha256:8394d940e5d400d04cad4f75c0598665cbb81aecefaca82ca85bd28264af7f9b"}, - {file = "pydantic_core-2.23.4-cp313-cp313-manylinux_2_5_i686.manylinux1_i686.whl", hash = "sha256:0dff76e0602ca7d4cdaacc1ac4c005e0ce0dcfe095d5b5259163a80d3a10d327"}, - {file = "pydantic_core-2.23.4-cp313-cp313-musllinux_1_1_aarch64.whl", hash = "sha256:7d32706badfe136888bdea71c0def994644e09fff0bfe47441deaed8e96fdbc6"}, - {file = "pydantic_core-2.23.4-cp313-cp313-musllinux_1_1_x86_64.whl", hash = "sha256:ed541d70698978a20eb63d8c5d72f2cc6d7079d9d90f6b50bad07826f1320f5f"}, - {file = "pydantic_core-2.23.4-cp313-none-win32.whl", hash = "sha256:3d5639516376dce1940ea36edf408c554475369f5da2abd45d44621cb616f769"}, - {file = "pydantic_core-2.23.4-cp313-none-win_amd64.whl", hash = "sha256:5a1504ad17ba4210df3a045132a7baeeba5a200e930f57512ee02909fc5c4cb5"}, - {file = "pydantic_core-2.23.4-cp38-cp38-macosx_10_12_x86_64.whl", hash = "sha256:d4488a93b071c04dc20f5cecc3631fc78b9789dd72483ba15d423b5b3689b555"}, - {file = "pydantic_core-2.23.4-cp38-cp38-macosx_11_0_arm64.whl", hash = "sha256:81965a16b675b35e1d09dd14df53f190f9129c0202356ed44ab2728b1c905658"}, - {file = "pydantic_core-2.23.4-cp38-cp38-manylinux_2_17_aarch64.manylinux2014_aarch64.whl", hash = "sha256:4ffa2ebd4c8530079140dd2d7f794a9d9a73cbb8e9d59ffe24c63436efa8f271"}, - {file = "pydantic_core-2.23.4-cp38-cp38-manylinux_2_17_armv7l.manylinux2014_armv7l.whl", hash = "sha256:61817945f2fe7d166e75fbfb28004034b48e44878177fc54d81688e7b85a3665"}, - {file = "pydantic_core-2.23.4-cp38-cp38-manylinux_2_17_ppc64le.manylinux2014_ppc64le.whl", hash = "sha256:29d2c342c4bc01b88402d60189f3df065fb0dda3654744d5a165a5288a657368"}, - {file = "pydantic_core-2.23.4-cp38-cp38-manylinux_2_17_s390x.manylinux2014_s390x.whl", hash = "sha256:5e11661ce0fd30a6790e8bcdf263b9ec5988e95e63cf901972107efc49218b13"}, - {file = "pydantic_core-2.23.4-cp38-cp38-manylinux_2_17_x86_64.manylinux2014_x86_64.whl", hash = "sha256:9d18368b137c6295db49ce7218b1a9ba15c5bc254c96d7c9f9e924a9bc7825ad"}, - {file = "pydantic_core-2.23.4-cp38-cp38-manylinux_2_5_i686.manylinux1_i686.whl", hash = "sha256:ec4e55f79b1c4ffb2eecd8a0cfba9955a2588497d96851f4c8f99aa4a1d39b12"}, - {file = "pydantic_core-2.23.4-cp38-cp38-musllinux_1_1_aarch64.whl", hash = "sha256:374a5e5049eda9e0a44c696c7ade3ff355f06b1fe0bb945ea3cac2bc336478a2"}, - {file = "pydantic_core-2.23.4-cp38-cp38-musllinux_1_1_x86_64.whl", hash = "sha256:5c364564d17da23db1106787675fc7af45f2f7b58b4173bfdd105564e132e6fb"}, - {file = "pydantic_core-2.23.4-cp38-none-win32.whl", hash = "sha256:d7a80d21d613eec45e3d41eb22f8f94ddc758a6c4720842dc74c0581f54993d6"}, - {file = "pydantic_core-2.23.4-cp38-none-win_amd64.whl", hash = "sha256:5f5ff8d839f4566a474a969508fe1c5e59c31c80d9e140566f9a37bba7b8d556"}, - {file = "pydantic_core-2.23.4-cp39-cp39-macosx_10_12_x86_64.whl", hash = "sha256:a4fa4fc04dff799089689f4fd502ce7d59de529fc2f40a2c8836886c03e0175a"}, - {file = "pydantic_core-2.23.4-cp39-cp39-macosx_11_0_arm64.whl", hash = "sha256:0a7df63886be5e270da67e0966cf4afbae86069501d35c8c1b3b6c168f42cb36"}, - {file = "pydantic_core-2.23.4-cp39-cp39-manylinux_2_17_aarch64.manylinux2014_aarch64.whl", hash = "sha256:dcedcd19a557e182628afa1d553c3895a9f825b936415d0dbd3cd0bbcfd29b4b"}, - {file = "pydantic_core-2.23.4-cp39-cp39-manylinux_2_17_armv7l.manylinux2014_armv7l.whl", hash = "sha256:5f54b118ce5de9ac21c363d9b3caa6c800341e8c47a508787e5868c6b79c9323"}, - {file = "pydantic_core-2.23.4-cp39-cp39-manylinux_2_17_ppc64le.manylinux2014_ppc64le.whl", hash = "sha256:86d2f57d3e1379a9525c5ab067b27dbb8a0642fb5d454e17a9ac434f9ce523e3"}, - {file = "pydantic_core-2.23.4-cp39-cp39-manylinux_2_17_s390x.manylinux2014_s390x.whl", hash = "sha256:de6d1d1b9e5101508cb37ab0d972357cac5235f5c6533d1071964c47139257df"}, - {file = "pydantic_core-2.23.4-cp39-cp39-manylinux_2_17_x86_64.manylinux2014_x86_64.whl", hash = "sha256:1278e0d324f6908e872730c9102b0112477a7f7cf88b308e4fc36ce1bdb6d58c"}, - {file = "pydantic_core-2.23.4-cp39-cp39-manylinux_2_5_i686.manylinux1_i686.whl", hash = "sha256:9a6b5099eeec78827553827f4c6b8615978bb4b6a88e5d9b93eddf8bb6790f55"}, - {file = "pydantic_core-2.23.4-cp39-cp39-musllinux_1_1_aarch64.whl", hash = "sha256:e55541f756f9b3ee346b840103f32779c695a19826a4c442b7954550a0972040"}, - {file = "pydantic_core-2.23.4-cp39-cp39-musllinux_1_1_x86_64.whl", hash = "sha256:a5c7ba8ffb6d6f8f2ab08743be203654bb1aaa8c9dcb09f82ddd34eadb695605"}, - {file = "pydantic_core-2.23.4-cp39-none-win32.whl", hash = "sha256:37b0fe330e4a58d3c58b24d91d1eb102aeec675a3db4c292ec3928ecd892a9a6"}, - {file = "pydantic_core-2.23.4-cp39-none-win_amd64.whl", hash = "sha256:1498bec4c05c9c787bde9125cfdcc63a41004ff167f495063191b863399b1a29"}, - {file = "pydantic_core-2.23.4-pp310-pypy310_pp73-macosx_10_12_x86_64.whl", hash = "sha256:f455ee30a9d61d3e1a15abd5068827773d6e4dc513e795f380cdd59932c782d5"}, - {file = "pydantic_core-2.23.4-pp310-pypy310_pp73-macosx_11_0_arm64.whl", hash = "sha256:1e90d2e3bd2c3863d48525d297cd143fe541be8bbf6f579504b9712cb6b643ec"}, - {file = "pydantic_core-2.23.4-pp310-pypy310_pp73-manylinux_2_17_aarch64.manylinux2014_aarch64.whl", hash = "sha256:2e203fdf807ac7e12ab59ca2bfcabb38c7cf0b33c41efeb00f8e5da1d86af480"}, - {file = "pydantic_core-2.23.4-pp310-pypy310_pp73-manylinux_2_17_x86_64.manylinux2014_x86_64.whl", hash = "sha256:e08277a400de01bc72436a0ccd02bdf596631411f592ad985dcee21445bd0068"}, - {file = "pydantic_core-2.23.4-pp310-pypy310_pp73-manylinux_2_5_i686.manylinux1_i686.whl", hash = "sha256:f220b0eea5965dec25480b6333c788fb72ce5f9129e8759ef876a1d805d00801"}, - {file = "pydantic_core-2.23.4-pp310-pypy310_pp73-musllinux_1_1_aarch64.whl", hash = "sha256:d06b0c8da4f16d1d1e352134427cb194a0a6e19ad5db9161bf32b2113409e728"}, - {file = "pydantic_core-2.23.4-pp310-pypy310_pp73-musllinux_1_1_x86_64.whl", hash = "sha256:ba1a0996f6c2773bd83e63f18914c1de3c9dd26d55f4ac302a7efe93fb8e7433"}, - {file = "pydantic_core-2.23.4-pp310-pypy310_pp73-win_amd64.whl", hash = "sha256:9a5bce9d23aac8f0cf0836ecfc033896aa8443b501c58d0602dbfd5bd5b37753"}, - {file = "pydantic_core-2.23.4-pp39-pypy39_pp73-macosx_10_12_x86_64.whl", hash = "sha256:78ddaaa81421a29574a682b3179d4cf9e6d405a09b99d93ddcf7e5239c742e21"}, - {file = "pydantic_core-2.23.4-pp39-pypy39_pp73-macosx_11_0_arm64.whl", hash = "sha256:883a91b5dd7d26492ff2f04f40fbb652de40fcc0afe07e8129e8ae779c2110eb"}, - {file = "pydantic_core-2.23.4-pp39-pypy39_pp73-manylinux_2_17_aarch64.manylinux2014_aarch64.whl", hash = "sha256:88ad334a15b32a791ea935af224b9de1bf99bcd62fabf745d5f3442199d86d59"}, - {file = "pydantic_core-2.23.4-pp39-pypy39_pp73-manylinux_2_17_x86_64.manylinux2014_x86_64.whl", hash = "sha256:233710f069d251feb12a56da21e14cca67994eab08362207785cf8c598e74577"}, - {file = "pydantic_core-2.23.4-pp39-pypy39_pp73-manylinux_2_5_i686.manylinux1_i686.whl", hash = "sha256:19442362866a753485ba5e4be408964644dd6a09123d9416c54cd49171f50744"}, - {file = "pydantic_core-2.23.4-pp39-pypy39_pp73-musllinux_1_1_aarch64.whl", hash = "sha256:624e278a7d29b6445e4e813af92af37820fafb6dcc55c012c834f9e26f9aaaef"}, - {file = "pydantic_core-2.23.4-pp39-pypy39_pp73-musllinux_1_1_x86_64.whl", hash = "sha256:f5ef8f42bec47f21d07668a043f077d507e5bf4e668d5c6dfe6aaba89de1a5b8"}, - {file = "pydantic_core-2.23.4-pp39-pypy39_pp73-win_amd64.whl", hash = "sha256:aea443fffa9fbe3af1a9ba721a87f926fe548d32cab71d188a6ede77d0ff244e"}, - {file = "pydantic_core-2.23.4.tar.gz", hash = "sha256:2584f7cf844ac4d970fba483a717dbe10c1c1c96a969bf65d61ffe94df1b2863"}, + {file = "pydantic_core-2.33.2-cp310-cp310-macosx_10_12_x86_64.whl", hash = "sha256:2b3d326aaef0c0399d9afffeb6367d5e26ddc24d351dbc9c636840ac355dc5d8"}, + {file = "pydantic_core-2.33.2-cp310-cp310-macosx_11_0_arm64.whl", hash = "sha256:0e5b2671f05ba48b94cb90ce55d8bdcaaedb8ba00cc5359f6810fc918713983d"}, + {file = "pydantic_core-2.33.2-cp310-cp310-manylinux_2_17_aarch64.manylinux2014_aarch64.whl", hash = "sha256:0069c9acc3f3981b9ff4cdfaf088e98d83440a4c7ea1bc07460af3d4dc22e72d"}, + {file = "pydantic_core-2.33.2-cp310-cp310-manylinux_2_17_armv7l.manylinux2014_armv7l.whl", hash = "sha256:d53b22f2032c42eaaf025f7c40c2e3b94568ae077a606f006d206a463bc69572"}, + {file = "pydantic_core-2.33.2-cp310-cp310-manylinux_2_17_ppc64le.manylinux2014_ppc64le.whl", hash = "sha256:0405262705a123b7ce9f0b92f123334d67b70fd1f20a9372b907ce1080c7ba02"}, + {file = "pydantic_core-2.33.2-cp310-cp310-manylinux_2_17_s390x.manylinux2014_s390x.whl", hash = "sha256:4b25d91e288e2c4e0662b8038a28c6a07eaac3e196cfc4ff69de4ea3db992a1b"}, + {file = "pydantic_core-2.33.2-cp310-cp310-manylinux_2_17_x86_64.manylinux2014_x86_64.whl", hash = "sha256:6bdfe4b3789761f3bcb4b1ddf33355a71079858958e3a552f16d5af19768fef2"}, + {file = "pydantic_core-2.33.2-cp310-cp310-manylinux_2_5_i686.manylinux1_i686.whl", hash = "sha256:efec8db3266b76ef9607c2c4c419bdb06bf335ae433b80816089ea7585816f6a"}, + {file = "pydantic_core-2.33.2-cp310-cp310-musllinux_1_1_aarch64.whl", hash = "sha256:031c57d67ca86902726e0fae2214ce6770bbe2f710dc33063187a68744a5ecac"}, + {file = "pydantic_core-2.33.2-cp310-cp310-musllinux_1_1_armv7l.whl", hash = "sha256:f8de619080e944347f5f20de29a975c2d815d9ddd8be9b9b7268e2e3ef68605a"}, + {file = "pydantic_core-2.33.2-cp310-cp310-musllinux_1_1_x86_64.whl", hash = "sha256:73662edf539e72a9440129f231ed3757faab89630d291b784ca99237fb94db2b"}, + {file = "pydantic_core-2.33.2-cp310-cp310-win32.whl", hash = "sha256:0a39979dcbb70998b0e505fb1556a1d550a0781463ce84ebf915ba293ccb7e22"}, + {file = "pydantic_core-2.33.2-cp310-cp310-win_amd64.whl", hash = "sha256:b0379a2b24882fef529ec3b4987cb5d003b9cda32256024e6fe1586ac45fc640"}, + {file = "pydantic_core-2.33.2-cp311-cp311-macosx_10_12_x86_64.whl", hash = "sha256:4c5b0a576fb381edd6d27f0a85915c6daf2f8138dc5c267a57c08a62900758c7"}, + {file = "pydantic_core-2.33.2-cp311-cp311-macosx_11_0_arm64.whl", hash = "sha256:e799c050df38a639db758c617ec771fd8fb7a5f8eaaa4b27b101f266b216a246"}, + {file = "pydantic_core-2.33.2-cp311-cp311-manylinux_2_17_aarch64.manylinux2014_aarch64.whl", hash = "sha256:dc46a01bf8d62f227d5ecee74178ffc448ff4e5197c756331f71efcc66dc980f"}, + {file = "pydantic_core-2.33.2-cp311-cp311-manylinux_2_17_armv7l.manylinux2014_armv7l.whl", hash = "sha256:a144d4f717285c6d9234a66778059f33a89096dfb9b39117663fd8413d582dcc"}, + {file = "pydantic_core-2.33.2-cp311-cp311-manylinux_2_17_ppc64le.manylinux2014_ppc64le.whl", hash = "sha256:73cf6373c21bc80b2e0dc88444f41ae60b2f070ed02095754eb5a01df12256de"}, + {file = "pydantic_core-2.33.2-cp311-cp311-manylinux_2_17_s390x.manylinux2014_s390x.whl", hash = "sha256:3dc625f4aa79713512d1976fe9f0bc99f706a9dee21dfd1810b4bbbf228d0e8a"}, + {file = "pydantic_core-2.33.2-cp311-cp311-manylinux_2_17_x86_64.manylinux2014_x86_64.whl", hash = "sha256:881b21b5549499972441da4758d662aeea93f1923f953e9cbaff14b8b9565aef"}, + {file = "pydantic_core-2.33.2-cp311-cp311-manylinux_2_5_i686.manylinux1_i686.whl", hash = "sha256:bdc25f3681f7b78572699569514036afe3c243bc3059d3942624e936ec93450e"}, + {file = "pydantic_core-2.33.2-cp311-cp311-musllinux_1_1_aarch64.whl", hash = "sha256:fe5b32187cbc0c862ee201ad66c30cf218e5ed468ec8dc1cf49dec66e160cc4d"}, + {file = "pydantic_core-2.33.2-cp311-cp311-musllinux_1_1_armv7l.whl", hash = "sha256:bc7aee6f634a6f4a95676fcb5d6559a2c2a390330098dba5e5a5f28a2e4ada30"}, + {file = "pydantic_core-2.33.2-cp311-cp311-musllinux_1_1_x86_64.whl", hash = "sha256:235f45e5dbcccf6bd99f9f472858849f73d11120d76ea8707115415f8e5ebebf"}, + {file = "pydantic_core-2.33.2-cp311-cp311-win32.whl", hash = "sha256:6368900c2d3ef09b69cb0b913f9f8263b03786e5b2a387706c5afb66800efd51"}, + {file = "pydantic_core-2.33.2-cp311-cp311-win_amd64.whl", hash = "sha256:1e063337ef9e9820c77acc768546325ebe04ee38b08703244c1309cccc4f1bab"}, + {file = "pydantic_core-2.33.2-cp311-cp311-win_arm64.whl", hash = "sha256:6b99022f1d19bc32a4c2a0d544fc9a76e3be90f0b3f4af413f87d38749300e65"}, + {file = "pydantic_core-2.33.2-cp312-cp312-macosx_10_12_x86_64.whl", hash = "sha256:a7ec89dc587667f22b6a0b6579c249fca9026ce7c333fc142ba42411fa243cdc"}, + {file = "pydantic_core-2.33.2-cp312-cp312-macosx_11_0_arm64.whl", hash = "sha256:3c6db6e52c6d70aa0d00d45cdb9b40f0433b96380071ea80b09277dba021ddf7"}, + {file = "pydantic_core-2.33.2-cp312-cp312-manylinux_2_17_aarch64.manylinux2014_aarch64.whl", hash = "sha256:4e61206137cbc65e6d5256e1166f88331d3b6238e082d9f74613b9b765fb9025"}, + {file = "pydantic_core-2.33.2-cp312-cp312-manylinux_2_17_armv7l.manylinux2014_armv7l.whl", hash = "sha256:eb8c529b2819c37140eb51b914153063d27ed88e3bdc31b71198a198e921e011"}, + {file = "pydantic_core-2.33.2-cp312-cp312-manylinux_2_17_ppc64le.manylinux2014_ppc64le.whl", hash = "sha256:c52b02ad8b4e2cf14ca7b3d918f3eb0ee91e63b3167c32591e57c4317e134f8f"}, + {file = "pydantic_core-2.33.2-cp312-cp312-manylinux_2_17_s390x.manylinux2014_s390x.whl", hash = "sha256:96081f1605125ba0855dfda83f6f3df5ec90c61195421ba72223de35ccfb2f88"}, + {file = "pydantic_core-2.33.2-cp312-cp312-manylinux_2_17_x86_64.manylinux2014_x86_64.whl", hash = "sha256:8f57a69461af2a5fa6e6bbd7a5f60d3b7e6cebb687f55106933188e79ad155c1"}, + {file = "pydantic_core-2.33.2-cp312-cp312-manylinux_2_5_i686.manylinux1_i686.whl", hash = "sha256:572c7e6c8bb4774d2ac88929e3d1f12bc45714ae5ee6d9a788a9fb35e60bb04b"}, + {file = "pydantic_core-2.33.2-cp312-cp312-musllinux_1_1_aarch64.whl", hash = "sha256:db4b41f9bd95fbe5acd76d89920336ba96f03e149097365afe1cb092fceb89a1"}, + {file = "pydantic_core-2.33.2-cp312-cp312-musllinux_1_1_armv7l.whl", hash = "sha256:fa854f5cf7e33842a892e5c73f45327760bc7bc516339fda888c75ae60edaeb6"}, + {file = "pydantic_core-2.33.2-cp312-cp312-musllinux_1_1_x86_64.whl", hash = "sha256:5f483cfb75ff703095c59e365360cb73e00185e01aaea067cd19acffd2ab20ea"}, + {file = "pydantic_core-2.33.2-cp312-cp312-win32.whl", hash = "sha256:9cb1da0f5a471435a7bc7e439b8a728e8b61e59784b2af70d7c169f8dd8ae290"}, + {file = "pydantic_core-2.33.2-cp312-cp312-win_amd64.whl", hash = "sha256:f941635f2a3d96b2973e867144fde513665c87f13fe0e193c158ac51bfaaa7b2"}, + {file = "pydantic_core-2.33.2-cp312-cp312-win_arm64.whl", hash = "sha256:cca3868ddfaccfbc4bfb1d608e2ccaaebe0ae628e1416aeb9c4d88c001bb45ab"}, + {file = "pydantic_core-2.33.2-cp313-cp313-macosx_10_12_x86_64.whl", hash = "sha256:1082dd3e2d7109ad8b7da48e1d4710c8d06c253cbc4a27c1cff4fbcaa97a9e3f"}, + {file = "pydantic_core-2.33.2-cp313-cp313-macosx_11_0_arm64.whl", hash = "sha256:f517ca031dfc037a9c07e748cefd8d96235088b83b4f4ba8939105d20fa1dcd6"}, + {file = "pydantic_core-2.33.2-cp313-cp313-manylinux_2_17_aarch64.manylinux2014_aarch64.whl", hash = "sha256:0a9f2c9dd19656823cb8250b0724ee9c60a82f3cdf68a080979d13092a3b0fef"}, + {file = "pydantic_core-2.33.2-cp313-cp313-manylinux_2_17_armv7l.manylinux2014_armv7l.whl", hash = "sha256:2b0a451c263b01acebe51895bfb0e1cc842a5c666efe06cdf13846c7418caa9a"}, + {file = "pydantic_core-2.33.2-cp313-cp313-manylinux_2_17_ppc64le.manylinux2014_ppc64le.whl", hash = "sha256:1ea40a64d23faa25e62a70ad163571c0b342b8bf66d5fa612ac0dec4f069d916"}, + {file = "pydantic_core-2.33.2-cp313-cp313-manylinux_2_17_s390x.manylinux2014_s390x.whl", hash = "sha256:0fb2d542b4d66f9470e8065c5469ec676978d625a8b7a363f07d9a501a9cb36a"}, + {file = "pydantic_core-2.33.2-cp313-cp313-manylinux_2_17_x86_64.manylinux2014_x86_64.whl", hash = "sha256:9fdac5d6ffa1b5a83bca06ffe7583f5576555e6c8b3a91fbd25ea7780f825f7d"}, + {file = "pydantic_core-2.33.2-cp313-cp313-manylinux_2_5_i686.manylinux1_i686.whl", hash = "sha256:04a1a413977ab517154eebb2d326da71638271477d6ad87a769102f7c2488c56"}, + {file = "pydantic_core-2.33.2-cp313-cp313-musllinux_1_1_aarch64.whl", hash = "sha256:c8e7af2f4e0194c22b5b37205bfb293d166a7344a5b0d0eaccebc376546d77d5"}, + {file = "pydantic_core-2.33.2-cp313-cp313-musllinux_1_1_armv7l.whl", hash = "sha256:5c92edd15cd58b3c2d34873597a1e20f13094f59cf88068adb18947df5455b4e"}, + {file = "pydantic_core-2.33.2-cp313-cp313-musllinux_1_1_x86_64.whl", hash = "sha256:65132b7b4a1c0beded5e057324b7e16e10910c106d43675d9bd87d4f38dde162"}, + {file = "pydantic_core-2.33.2-cp313-cp313-win32.whl", hash = "sha256:52fb90784e0a242bb96ec53f42196a17278855b0f31ac7c3cc6f5c1ec4811849"}, + {file = "pydantic_core-2.33.2-cp313-cp313-win_amd64.whl", hash = "sha256:c083a3bdd5a93dfe480f1125926afcdbf2917ae714bdb80b36d34318b2bec5d9"}, + {file = "pydantic_core-2.33.2-cp313-cp313-win_arm64.whl", hash = "sha256:e80b087132752f6b3d714f041ccf74403799d3b23a72722ea2e6ba2e892555b9"}, + {file = "pydantic_core-2.33.2-cp313-cp313t-macosx_11_0_arm64.whl", hash = "sha256:61c18fba8e5e9db3ab908620af374db0ac1baa69f0f32df4f61ae23f15e586ac"}, + {file = "pydantic_core-2.33.2-cp313-cp313t-manylinux_2_17_x86_64.manylinux2014_x86_64.whl", hash = "sha256:95237e53bb015f67b63c91af7518a62a8660376a6a0db19b89acc77a4d6199f5"}, + {file = "pydantic_core-2.33.2-cp313-cp313t-win_amd64.whl", hash = "sha256:c2fc0a768ef76c15ab9238afa6da7f69895bb5d1ee83aeea2e3509af4472d0b9"}, + {file = "pydantic_core-2.33.2-cp39-cp39-macosx_10_12_x86_64.whl", hash = "sha256:a2b911a5b90e0374d03813674bf0a5fbbb7741570dcd4b4e85a2e48d17def29d"}, + {file = "pydantic_core-2.33.2-cp39-cp39-macosx_11_0_arm64.whl", hash = "sha256:6fa6dfc3e4d1f734a34710f391ae822e0a8eb8559a85c6979e14e65ee6ba2954"}, + {file = "pydantic_core-2.33.2-cp39-cp39-manylinux_2_17_aarch64.manylinux2014_aarch64.whl", hash = "sha256:c54c939ee22dc8e2d545da79fc5381f1c020d6d3141d3bd747eab59164dc89fb"}, + {file = "pydantic_core-2.33.2-cp39-cp39-manylinux_2_17_armv7l.manylinux2014_armv7l.whl", hash = "sha256:53a57d2ed685940a504248187d5685e49eb5eef0f696853647bf37c418c538f7"}, + {file = "pydantic_core-2.33.2-cp39-cp39-manylinux_2_17_ppc64le.manylinux2014_ppc64le.whl", hash = "sha256:09fb9dd6571aacd023fe6aaca316bd01cf60ab27240d7eb39ebd66a3a15293b4"}, + {file = "pydantic_core-2.33.2-cp39-cp39-manylinux_2_17_s390x.manylinux2014_s390x.whl", hash = "sha256:0e6116757f7959a712db11f3e9c0a99ade00a5bbedae83cb801985aa154f071b"}, + {file = "pydantic_core-2.33.2-cp39-cp39-manylinux_2_17_x86_64.manylinux2014_x86_64.whl", hash = "sha256:8d55ab81c57b8ff8548c3e4947f119551253f4e3787a7bbc0b6b3ca47498a9d3"}, + {file = "pydantic_core-2.33.2-cp39-cp39-manylinux_2_5_i686.manylinux1_i686.whl", hash = "sha256:c20c462aa4434b33a2661701b861604913f912254e441ab8d78d30485736115a"}, + {file = "pydantic_core-2.33.2-cp39-cp39-musllinux_1_1_aarch64.whl", hash = "sha256:44857c3227d3fb5e753d5fe4a3420d6376fa594b07b621e220cd93703fe21782"}, + {file = "pydantic_core-2.33.2-cp39-cp39-musllinux_1_1_armv7l.whl", hash = "sha256:eb9b459ca4df0e5c87deb59d37377461a538852765293f9e6ee834f0435a93b9"}, + {file = "pydantic_core-2.33.2-cp39-cp39-musllinux_1_1_x86_64.whl", hash = "sha256:9fcd347d2cc5c23b06de6d3b7b8275be558a0c90549495c699e379a80bf8379e"}, + {file = "pydantic_core-2.33.2-cp39-cp39-win32.whl", hash = "sha256:83aa99b1285bc8f038941ddf598501a86f1536789740991d7d8756e34f1e74d9"}, + {file = "pydantic_core-2.33.2-cp39-cp39-win_amd64.whl", hash = "sha256:f481959862f57f29601ccced557cc2e817bce7533ab8e01a797a48b49c9692b3"}, + {file = "pydantic_core-2.33.2-pp310-pypy310_pp73-macosx_10_12_x86_64.whl", hash = "sha256:5c4aa4e82353f65e548c476b37e64189783aa5384903bfea4f41580f255fddfa"}, + {file = "pydantic_core-2.33.2-pp310-pypy310_pp73-macosx_11_0_arm64.whl", hash = "sha256:d946c8bf0d5c24bf4fe333af284c59a19358aa3ec18cb3dc4370080da1e8ad29"}, + {file = "pydantic_core-2.33.2-pp310-pypy310_pp73-manylinux_2_17_aarch64.manylinux2014_aarch64.whl", hash = "sha256:87b31b6846e361ef83fedb187bb5b4372d0da3f7e28d85415efa92d6125d6e6d"}, + {file = "pydantic_core-2.33.2-pp310-pypy310_pp73-manylinux_2_17_x86_64.manylinux2014_x86_64.whl", hash = "sha256:aa9d91b338f2df0508606f7009fde642391425189bba6d8c653afd80fd6bb64e"}, + {file = "pydantic_core-2.33.2-pp310-pypy310_pp73-manylinux_2_5_i686.manylinux1_i686.whl", hash = "sha256:2058a32994f1fde4ca0480ab9d1e75a0e8c87c22b53a3ae66554f9af78f2fe8c"}, + {file = "pydantic_core-2.33.2-pp310-pypy310_pp73-musllinux_1_1_aarch64.whl", hash = "sha256:0e03262ab796d986f978f79c943fc5f620381be7287148b8010b4097f79a39ec"}, + {file = "pydantic_core-2.33.2-pp310-pypy310_pp73-musllinux_1_1_armv7l.whl", hash = "sha256:1a8695a8d00c73e50bff9dfda4d540b7dee29ff9b8053e38380426a85ef10052"}, + {file = "pydantic_core-2.33.2-pp310-pypy310_pp73-musllinux_1_1_x86_64.whl", hash = "sha256:fa754d1850735a0b0e03bcffd9d4b4343eb417e47196e4485d9cca326073a42c"}, + {file = "pydantic_core-2.33.2-pp310-pypy310_pp73-win_amd64.whl", hash = "sha256:a11c8d26a50bfab49002947d3d237abe4d9e4b5bdc8846a63537b6488e197808"}, + {file = "pydantic_core-2.33.2-pp311-pypy311_pp73-macosx_10_12_x86_64.whl", hash = "sha256:dd14041875d09cc0f9308e37a6f8b65f5585cf2598a53aa0123df8b129d481f8"}, + {file = "pydantic_core-2.33.2-pp311-pypy311_pp73-macosx_11_0_arm64.whl", hash = "sha256:d87c561733f66531dced0da6e864f44ebf89a8fba55f31407b00c2f7f9449593"}, + {file = "pydantic_core-2.33.2-pp311-pypy311_pp73-manylinux_2_17_aarch64.manylinux2014_aarch64.whl", hash = "sha256:2f82865531efd18d6e07a04a17331af02cb7a651583c418df8266f17a63c6612"}, + {file = "pydantic_core-2.33.2-pp311-pypy311_pp73-manylinux_2_17_x86_64.manylinux2014_x86_64.whl", hash = "sha256:2bfb5112df54209d820d7bf9317c7a6c9025ea52e49f46b6a2060104bba37de7"}, + {file = "pydantic_core-2.33.2-pp311-pypy311_pp73-manylinux_2_5_i686.manylinux1_i686.whl", hash = "sha256:64632ff9d614e5eecfb495796ad51b0ed98c453e447a76bcbeeb69615079fc7e"}, + {file = "pydantic_core-2.33.2-pp311-pypy311_pp73-musllinux_1_1_aarch64.whl", hash = "sha256:f889f7a40498cc077332c7ab6b4608d296d852182211787d4f3ee377aaae66e8"}, + {file = "pydantic_core-2.33.2-pp311-pypy311_pp73-musllinux_1_1_armv7l.whl", hash = "sha256:de4b83bb311557e439b9e186f733f6c645b9417c84e2eb8203f3f820a4b988bf"}, + {file = "pydantic_core-2.33.2-pp311-pypy311_pp73-musllinux_1_1_x86_64.whl", hash = "sha256:82f68293f055f51b51ea42fafc74b6aad03e70e191799430b90c13d643059ebb"}, + {file = "pydantic_core-2.33.2-pp311-pypy311_pp73-win_amd64.whl", hash = "sha256:329467cecfb529c925cf2bbd4d60d2c509bc2fb52a20c1045bf09bb70971a9c1"}, + {file = "pydantic_core-2.33.2-pp39-pypy39_pp73-macosx_10_12_x86_64.whl", hash = "sha256:87acbfcf8e90ca885206e98359d7dca4bcbb35abdc0ff66672a293e1d7a19101"}, + {file = "pydantic_core-2.33.2-pp39-pypy39_pp73-macosx_11_0_arm64.whl", hash = "sha256:7f92c15cd1e97d4b12acd1cc9004fa092578acfa57b67ad5e43a197175d01a64"}, + {file = "pydantic_core-2.33.2-pp39-pypy39_pp73-manylinux_2_17_aarch64.manylinux2014_aarch64.whl", hash = "sha256:d3f26877a748dc4251cfcfda9dfb5f13fcb034f5308388066bcfe9031b63ae7d"}, + {file = "pydantic_core-2.33.2-pp39-pypy39_pp73-manylinux_2_17_x86_64.manylinux2014_x86_64.whl", hash = "sha256:dac89aea9af8cd672fa7b510e7b8c33b0bba9a43186680550ccf23020f32d535"}, + {file = "pydantic_core-2.33.2-pp39-pypy39_pp73-manylinux_2_5_i686.manylinux1_i686.whl", hash = "sha256:970919794d126ba8645f3837ab6046fb4e72bbc057b3709144066204c19a455d"}, + {file = "pydantic_core-2.33.2-pp39-pypy39_pp73-musllinux_1_1_aarch64.whl", hash = "sha256:3eb3fe62804e8f859c49ed20a8451342de53ed764150cb14ca71357c765dc2a6"}, + {file = "pydantic_core-2.33.2-pp39-pypy39_pp73-musllinux_1_1_armv7l.whl", hash = "sha256:3abcd9392a36025e3bd55f9bd38d908bd17962cc49bc6da8e7e96285336e2bca"}, + {file = "pydantic_core-2.33.2-pp39-pypy39_pp73-musllinux_1_1_x86_64.whl", hash = "sha256:3a1c81334778f9e3af2f8aeb7a960736e5cab1dfebfb26aabca09afd2906c039"}, + {file = "pydantic_core-2.33.2-pp39-pypy39_pp73-win_amd64.whl", hash = "sha256:2807668ba86cb38c6817ad9bc66215ab8584d1d304030ce4f0887336f28a5e27"}, + {file = "pydantic_core-2.33.2.tar.gz", hash = "sha256:7cb8bc3605c29176e1b105350d2e6474142d7c1bd1d9327c4a9bdb46bf827acc"}, ] [package.dependencies] @@ -432,6 +443,7 @@ version = "3.2.3" description = "python code static checker" optional = false python-versions = ">=3.8.0" +groups = ["dev"] files = [ {file = "pylint-3.2.3-py3-none-any.whl", hash = "sha256:b3d7d2708a3e04b4679e02d99e72329a8b7ee8afb8d04110682278781f889fa8"}, {file = "pylint-3.2.3.tar.gz", hash = "sha256:02f6c562b215582386068d52a30f520d84fdbcf2a95fc7e855b816060d048b60"}, @@ -443,7 +455,7 @@ colorama = {version = ">=0.4.5", markers = "sys_platform == \"win32\""} dill = [ {version = ">=0.2", markers = "python_version < \"3.11\""}, {version = ">=0.3.7", markers = "python_version >= \"3.12\""}, - {version = ">=0.3.6", markers = "python_version >= \"3.11\" and python_version < \"3.12\""}, + {version = ">=0.3.6", markers = "python_version == \"3.11\""}, ] isort = ">=4.2.5,<5.13.0 || >5.13.0,<6" mccabe = ">=0.6,<0.8" @@ -456,37 +468,13 @@ typing-extensions = {version = ">=3.10.0", markers = "python_version < \"3.10\"" spelling = ["pyenchant (>=3.2,<4.0)"] testutils = ["gitpython (>3)"] -[[package]] -name = "python-dateutil" -version = "2.8.2" -description = "Extensions to the standard Python datetime module" -optional = false -python-versions = "!=3.0.*,!=3.1.*,!=3.2.*,>=2.7" -files = [ - {file = "python-dateutil-2.8.2.tar.gz", hash = "sha256:0123cacc1627ae19ddf3c27a5de5bd67ee4586fbdd6440d9748f8abb483d3e86"}, - {file = "python_dateutil-2.8.2-py2.py3-none-any.whl", hash = "sha256:961d03dc3453ebbc59dbdea9e4e11c5651520a876d0f4db161e8674aae935da9"}, -] - -[package.dependencies] -six = ">=1.5" - -[[package]] -name = "six" -version = "1.16.0" -description = "Python 2 and 3 compatibility utilities" -optional = false -python-versions = ">=2.7, !=3.0.*, !=3.1.*, !=3.2.*" -files = [ - {file = "six-1.16.0-py2.py3-none-any.whl", hash = "sha256:8abb2f1d86890a2dfb989f9a77cfcfd3e47c2a354b01111771326f8aa26e0254"}, - {file = "six-1.16.0.tar.gz", hash = "sha256:1e61c37477a1626458e36f7b1d82aa5c9b094fa4802892072e49de9c60c4c926"}, -] - [[package]] name = "sniffio" version = "1.3.1" description = "Sniff out which async library your code is running under" optional = false python-versions = ">=3.7" +groups = ["main"] files = [ {file = "sniffio-1.3.1-py3-none-any.whl", hash = "sha256:2f6da418d1f1e0fddd844478f41680e794e6051915791a034ff65e5f100525a2"}, {file = "sniffio-1.3.1.tar.gz", hash = "sha256:f4324edc670a0f49750a81b895f35c3adb843cca46f0530f79fc1babb23789dc"}, @@ -498,6 +486,8 @@ version = "2.0.2" description = "A lil' TOML parser" optional = false python-versions = ">=3.8" +groups = ["dev"] +markers = "python_version < \"3.11\"" files = [ {file = "tomli-2.0.2-py3-none-any.whl", hash = "sha256:2ebe24485c53d303f690b0ec092806a085f07af5a5aa1464f3931eec36caaa38"}, {file = "tomli-2.0.2.tar.gz", hash = "sha256:d46d457a85337051c36524bc5349dd91b1877838e2979ac5ced3e710ed8a60ed"}, @@ -509,49 +499,40 @@ version = "0.13.2" description = "Style preserving TOML library" optional = false python-versions = ">=3.8" +groups = ["dev"] files = [ {file = "tomlkit-0.13.2-py3-none-any.whl", hash = "sha256:7a974427f6e119197f670fbbbeae7bef749a6c14e793db934baefc1b5f03efde"}, {file = "tomlkit-0.13.2.tar.gz", hash = "sha256:fff5fe59a87295b278abd31bec92c15d9bc4a06885ab12bcea52c71119392e79"}, ] -[[package]] -name = "types-python-dateutil" -version = "2.9.0.20241003" -description = "Typing stubs for python-dateutil" -optional = false -python-versions = ">=3.8" -files = [ - {file = "types-python-dateutil-2.9.0.20241003.tar.gz", hash = "sha256:58cb85449b2a56d6684e41aeefb4c4280631246a0da1a719bdbe6f3fb0317446"}, - {file = "types_python_dateutil-2.9.0.20241003-py3-none-any.whl", hash = "sha256:250e1d8e80e7bbc3a6c99b907762711d1a1cdd00e978ad39cb5940f6f0a87f3d"}, -] - [[package]] name = "typing-extensions" version = "4.12.2" description = "Backported and Experimental Type Hints for Python 3.8+" optional = false python-versions = ">=3.8" +groups = ["main", "dev"] files = [ {file = "typing_extensions-4.12.2-py3-none-any.whl", hash = "sha256:04e5ca0351e0f3f85c6853954072df659d0d13fac324d0072316b67d7794700d"}, {file = "typing_extensions-4.12.2.tar.gz", hash = "sha256:1a7ead55c7e559dd4dee8856e3a88b41225abfe1ce8df57b7c13915fe121ffb8"}, ] [[package]] -name = "typing-inspect" -version = "0.9.0" -description = "Runtime inspection utilities for typing module." +name = "typing-inspection" +version = "0.4.0" +description = "Runtime typing introspection tools" optional = false -python-versions = "*" +python-versions = ">=3.9" +groups = ["main"] files = [ - {file = "typing_inspect-0.9.0-py3-none-any.whl", hash = "sha256:9ee6fc59062311ef8547596ab6b955e1b8aa46242d854bfc78f4f6b0eff35f9f"}, - {file = "typing_inspect-0.9.0.tar.gz", hash = "sha256:b23fc42ff6f6ef6954e4852c1fb512cdd18dbea03134f91f856a95ccc9461f78"}, + {file = "typing_inspection-0.4.0-py3-none-any.whl", hash = "sha256:50e72559fcd2a6367a19f7a7e610e6afcb9fac940c650290eed893d61386832f"}, + {file = "typing_inspection-0.4.0.tar.gz", hash = "sha256:9765c87de36671694a67904bf2c96e395be9c6439bb6c87b5142569dcdd65122"}, ] [package.dependencies] -mypy-extensions = ">=0.3.0" -typing-extensions = ">=3.7.4" +typing-extensions = ">=4.12.0" [metadata] -lock-version = "2.0" -python-versions = "^3.8" -content-hash = "634a1e2581f680cde0149401ee60f1a571cfb482ce541acd8d0fa9a558cadf9d" +lock-version = "2.1" +python-versions = ">=3.9" +content-hash = "6cad13cf7de0e6ac37e32587119a5079460e1b33ab20454449bcdd8dfec35450" diff --git a/pylintrc b/pylintrc index 87752b9..92c927c 100644 --- a/pylintrc +++ b/pylintrc @@ -89,7 +89,7 @@ persistent=yes # Minimum Python version to use for version dependent checks. Will default to # the version used to run pylint. -py-version=3.8 +py-version=3.9 # Discover python modules and packages in the file system subtree. recursive=no @@ -188,8 +188,8 @@ good-names=i, Run, _, e, - op, - id + id, + op # Good variable names regexes, separated by a comma. If names match any regex, # they will always be accepted @@ -455,7 +455,11 @@ disable=raw-checker-failed, bare-except, broad-exception-caught, fixme, - relative-beyond-top-level + relative-beyond-top-level, + consider-using-with, + wildcard-import, + unused-wildcard-import, + too-many-return-statements # Enable the message, report, category or checker with the given id(s). You can # either give multiple identifier separated by comma (,) or put this option @@ -656,4 +660,4 @@ init-import=no # List of qualified module names which can have objects that can redefine # builtins. -redefining-builtins-modules=six.moves,past.builtins,future.builtins,builtins,io +redefining-builtins-modules=six.moves,past.builtins,future.builtins,builtins,io \ No newline at end of file diff --git a/pyproject.toml b/pyproject.toml index bb77b12..e38cde2 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -1,9 +1,17 @@ -[tool.poetry] +[project] name = "unkey.py" -version = "0.9.0" +version = "0.10.0" description = "Python Client SDK for unkey.com." -authors = ["Speakeasy",] +authors = [{ name = "Speakeasy" },] readme = "README-PYPI.md" +requires-python = ">=3.9" +dependencies = [ + "httpx >=0.28.1", + "jsonpath-python >=1.0.6", + "pydantic >=2.11.2", +] + +[tool.poetry] repository = "https://github.com/unkeyed/unkey-py.git" packages = [ { include = "unkey_py", from = "src" } @@ -16,25 +24,16 @@ include = ["py.typed", "src/unkey_py/py.typed"] [virtualenvs] in-project = true -[tool.poetry.dependencies] -python = "^3.8" -eval-type-backport = "^0.2.0" -httpx = "^0.27.0" -jsonpath-python = "^1.0.6" -pydantic = "~2.9.2" -python-dateutil = "^2.8.2" -typing-inspect = "^0.9.0" - [tool.poetry.group.dev.dependencies] -mypy = "==1.13.0" +mypy = "==1.15.0" pylint = "==3.2.3" -types-python-dateutil = "^2.9.0.20240316" [build-system] requires = ["poetry-core"] build-backend = "poetry.core.masonry.api" [tool.pytest.ini_options] +asyncio_default_fixture_loop_scope = "function" pythonpath = ["src"] [tool.mypy] diff --git a/scripts/prepare-readme.py b/scripts/prepare_readme.py similarity index 84% rename from scripts/prepare-readme.py rename to scripts/prepare_readme.py index 9916449..5c82133 100644 --- a/scripts/prepare-readme.py +++ b/scripts/prepare_readme.py @@ -4,7 +4,7 @@ import shutil try: - with open("README.md", "r") as rh: + with open("README.md", "r", encoding="utf-8") as rh: readme_contents = rh.read() GITHUB_URL = "https://github.com/unkeyed/unkey-py.git" GITHUB_URL = ( @@ -21,13 +21,13 @@ readme_contents, ) - with open("README-PYPI.md", "w") as wh: + with open("README-PYPI.md", "w", encoding="utf-8") as wh: wh.write(readme_contents) except Exception as e: try: print("Failed to rewrite README.md to README-PYPI.md, copying original instead") print(e) shutil.copyfile("README.md", "README-PYPI.md") - except Exception as e: + except Exception as ie: print("Failed to copy README.md to README-PYPI.md") - print(e) + print(ie) diff --git a/scripts/publish.sh b/scripts/publish.sh index ab45b1f..f2f2cf2 100755 --- a/scripts/publish.sh +++ b/scripts/publish.sh @@ -2,6 +2,6 @@ export POETRY_PYPI_TOKEN_PYPI=${PYPI_TOKEN} -poetry run python scripts/prepare-readme.py +poetry run python scripts/prepare_readme.py poetry publish --build --skip-existing diff --git a/src/unkey_py/__init__.py b/src/unkey_py/__init__.py index a1b7f62..dd02e42 100644 --- a/src/unkey_py/__init__.py +++ b/src/unkey_py/__init__.py @@ -1,9 +1,18 @@ """Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT.""" -from ._version import __title__, __version__ +from ._version import ( + __title__, + __version__, + __openapi_doc_version__, + __gen_version__, + __user_agent__, +) from .sdk import * from .sdkconfiguration import * from .models import * VERSION: str = __version__ +OPENAPI_DOC_VERSION = __openapi_doc_version__ +SPEAKEASY_GENERATOR_VERSION = __gen_version__ +USER_AGENT = __user_agent__ diff --git a/src/unkey_py/_hooks/types.py b/src/unkey_py/_hooks/types.py index 665a44d..d860525 100644 --- a/src/unkey_py/_hooks/types.py +++ b/src/unkey_py/_hooks/types.py @@ -7,16 +7,19 @@ class HookContext: + base_url: str operation_id: str oauth2_scopes: Optional[List[str]] = None security_source: Optional[Union[Any, Callable[[], Any]]] = None def __init__( self, + base_url: str, operation_id: str, oauth2_scopes: Optional[List[str]], security_source: Optional[Union[Any, Callable[[], Any]]], ): + self.base_url = base_url self.operation_id = operation_id self.oauth2_scopes = oauth2_scopes self.security_source = security_source @@ -25,21 +28,30 @@ def __init__( class BeforeRequestContext(HookContext): def __init__(self, hook_ctx: HookContext): super().__init__( - hook_ctx.operation_id, hook_ctx.oauth2_scopes, hook_ctx.security_source + hook_ctx.base_url, + hook_ctx.operation_id, + hook_ctx.oauth2_scopes, + hook_ctx.security_source, ) class AfterSuccessContext(HookContext): def __init__(self, hook_ctx: HookContext): super().__init__( - hook_ctx.operation_id, hook_ctx.oauth2_scopes, hook_ctx.security_source + hook_ctx.base_url, + hook_ctx.operation_id, + hook_ctx.oauth2_scopes, + hook_ctx.security_source, ) class AfterErrorContext(HookContext): def __init__(self, hook_ctx: HookContext): super().__init__( - hook_ctx.operation_id, hook_ctx.oauth2_scopes, hook_ctx.security_source + hook_ctx.base_url, + hook_ctx.operation_id, + hook_ctx.oauth2_scopes, + hook_ctx.security_source, ) diff --git a/src/unkey_py/_version.py b/src/unkey_py/_version.py index 841dda2..47e21b7 100644 --- a/src/unkey_py/_version.py +++ b/src/unkey_py/_version.py @@ -3,7 +3,10 @@ import importlib.metadata __title__: str = "unkey.py" -__version__: str = "0.9.0" +__version__: str = "0.10.0" +__openapi_doc_version__: str = "1.0.0" +__gen_version__: str = "2.596.2" +__user_agent__: str = "speakeasy-sdk/python 0.10.0 2.596.2 1.0.0 unkey.py" try: if __package__ is not None: diff --git a/src/unkey_py/analytics.py b/src/unkey_py/analytics.py new file mode 100644 index 0000000..e4d2d21 --- /dev/null +++ b/src/unkey_py/analytics.py @@ -0,0 +1,304 @@ +"""Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT.""" + +from .basesdk import BaseSDK +from typing import Any, List, Mapping, Optional, Union, cast +from unkey_py import models, utils +from unkey_py._hooks import HookContext +from unkey_py.types import BaseModel, OptionalNullable, UNSET +from unkey_py.utils import get_security_from_env + + +class Analytics(BaseSDK): + def get_verifications( + self, + *, + request: Union[ + models.GetVerificationsRequest, models.GetVerificationsRequestTypedDict + ], + retries: OptionalNullable[utils.RetryConfig] = UNSET, + server_url: Optional[str] = None, + timeout_ms: Optional[int] = None, + http_headers: Optional[Mapping[str, str]] = None, + ) -> models.GetVerificationsResponse: + r""" + :param request: The request object to send. + :param retries: Override the default retry configuration for this method + :param server_url: Override the default server URL for this method + :param timeout_ms: Override the default request timeout configuration for this method in milliseconds + :param http_headers: Additional headers to set or replace on requests. + """ + base_url = None + url_variables = None + if timeout_ms is None: + timeout_ms = self.sdk_configuration.timeout_ms + + if server_url is not None: + base_url = server_url + else: + base_url = self._get_url(base_url, url_variables) + + if not isinstance(request, BaseModel): + request = utils.unmarshal(request, models.GetVerificationsRequest) + request = cast(models.GetVerificationsRequest, request) + + req = self._build_request( + method="GET", + path="/v1/analytics.getVerifications", + base_url=base_url, + url_variables=url_variables, + request=request, + request_body_required=False, + request_has_path_params=False, + request_has_query_params=True, + user_agent_header="user-agent", + accept_header_value="application/json", + http_headers=http_headers, + security=self.sdk_configuration.security, + timeout_ms=timeout_ms, + ) + + if retries == UNSET: + if self.sdk_configuration.retry_config is not UNSET: + retries = self.sdk_configuration.retry_config + else: + retries = utils.RetryConfig( + "backoff", utils.BackoffStrategy(50, 1000, 1.5, 30000), True + ) + + retry_config = None + if isinstance(retries, utils.RetryConfig): + retry_config = (retries, ["5XX"]) + + http_res = self.do_request( + hook_ctx=HookContext( + base_url=base_url or "", + operation_id="getVerifications", + oauth2_scopes=[], + security_source=get_security_from_env( + self.sdk_configuration.security, models.Security + ), + ), + request=req, + error_status_codes=[ + "400", + "401", + "403", + "404", + "409", + "412", + "429", + "4XX", + "500", + "5XX", + ], + retry_config=retry_config, + ) + + response_data: Any = None + if utils.match_response(http_res, "200", "application/json"): + return models.GetVerificationsResponse( + response_bodies=utils.unmarshal_json( + http_res.text, Optional[List[models.GetVerificationsResponseBody]] + ), + http_meta=models.HTTPMetadata(request=req, response=http_res), + ) + if utils.match_response(http_res, "400", "application/json"): + response_data = utils.unmarshal_json( + http_res.text, models.ErrBadRequestData + ) + raise models.ErrBadRequest(data=response_data) + if utils.match_response(http_res, "401", "application/json"): + response_data = utils.unmarshal_json( + http_res.text, models.ErrUnauthorizedData + ) + raise models.ErrUnauthorized(data=response_data) + if utils.match_response(http_res, "403", "application/json"): + response_data = utils.unmarshal_json(http_res.text, models.ErrForbiddenData) + raise models.ErrForbidden(data=response_data) + if utils.match_response(http_res, "404", "application/json"): + response_data = utils.unmarshal_json(http_res.text, models.ErrNotFoundData) + raise models.ErrNotFound(data=response_data) + if utils.match_response(http_res, "409", "application/json"): + response_data = utils.unmarshal_json(http_res.text, models.ErrConflictData) + raise models.ErrConflict(data=response_data) + if utils.match_response(http_res, "412", "application/json"): + response_data = utils.unmarshal_json( + http_res.text, models.ErrPreconditionFailedData + ) + raise models.ErrPreconditionFailed(data=response_data) + if utils.match_response(http_res, "429", "application/json"): + response_data = utils.unmarshal_json( + http_res.text, models.ErrTooManyRequestsData + ) + raise models.ErrTooManyRequests(data=response_data) + if utils.match_response(http_res, "500", "application/json"): + response_data = utils.unmarshal_json( + http_res.text, models.ErrInternalServerErrorData + ) + raise models.ErrInternalServerError(data=response_data) + if utils.match_response(http_res, "4XX", "*"): + http_res_text = utils.stream_to_text(http_res) + raise models.SDKError( + "API error occurred", http_res.status_code, http_res_text, http_res + ) + if utils.match_response(http_res, "5XX", "*"): + http_res_text = utils.stream_to_text(http_res) + raise models.SDKError( + "API error occurred", http_res.status_code, http_res_text, http_res + ) + + content_type = http_res.headers.get("Content-Type") + http_res_text = utils.stream_to_text(http_res) + raise models.SDKError( + f"Unexpected response received (code: {http_res.status_code}, type: {content_type})", + http_res.status_code, + http_res_text, + http_res, + ) + + async def get_verifications_async( + self, + *, + request: Union[ + models.GetVerificationsRequest, models.GetVerificationsRequestTypedDict + ], + retries: OptionalNullable[utils.RetryConfig] = UNSET, + server_url: Optional[str] = None, + timeout_ms: Optional[int] = None, + http_headers: Optional[Mapping[str, str]] = None, + ) -> models.GetVerificationsResponse: + r""" + :param request: The request object to send. + :param retries: Override the default retry configuration for this method + :param server_url: Override the default server URL for this method + :param timeout_ms: Override the default request timeout configuration for this method in milliseconds + :param http_headers: Additional headers to set or replace on requests. + """ + base_url = None + url_variables = None + if timeout_ms is None: + timeout_ms = self.sdk_configuration.timeout_ms + + if server_url is not None: + base_url = server_url + else: + base_url = self._get_url(base_url, url_variables) + + if not isinstance(request, BaseModel): + request = utils.unmarshal(request, models.GetVerificationsRequest) + request = cast(models.GetVerificationsRequest, request) + + req = self._build_request_async( + method="GET", + path="/v1/analytics.getVerifications", + base_url=base_url, + url_variables=url_variables, + request=request, + request_body_required=False, + request_has_path_params=False, + request_has_query_params=True, + user_agent_header="user-agent", + accept_header_value="application/json", + http_headers=http_headers, + security=self.sdk_configuration.security, + timeout_ms=timeout_ms, + ) + + if retries == UNSET: + if self.sdk_configuration.retry_config is not UNSET: + retries = self.sdk_configuration.retry_config + else: + retries = utils.RetryConfig( + "backoff", utils.BackoffStrategy(50, 1000, 1.5, 30000), True + ) + + retry_config = None + if isinstance(retries, utils.RetryConfig): + retry_config = (retries, ["5XX"]) + + http_res = await self.do_request_async( + hook_ctx=HookContext( + base_url=base_url or "", + operation_id="getVerifications", + oauth2_scopes=[], + security_source=get_security_from_env( + self.sdk_configuration.security, models.Security + ), + ), + request=req, + error_status_codes=[ + "400", + "401", + "403", + "404", + "409", + "412", + "429", + "4XX", + "500", + "5XX", + ], + retry_config=retry_config, + ) + + response_data: Any = None + if utils.match_response(http_res, "200", "application/json"): + return models.GetVerificationsResponse( + response_bodies=utils.unmarshal_json( + http_res.text, Optional[List[models.GetVerificationsResponseBody]] + ), + http_meta=models.HTTPMetadata(request=req, response=http_res), + ) + if utils.match_response(http_res, "400", "application/json"): + response_data = utils.unmarshal_json( + http_res.text, models.ErrBadRequestData + ) + raise models.ErrBadRequest(data=response_data) + if utils.match_response(http_res, "401", "application/json"): + response_data = utils.unmarshal_json( + http_res.text, models.ErrUnauthorizedData + ) + raise models.ErrUnauthorized(data=response_data) + if utils.match_response(http_res, "403", "application/json"): + response_data = utils.unmarshal_json(http_res.text, models.ErrForbiddenData) + raise models.ErrForbidden(data=response_data) + if utils.match_response(http_res, "404", "application/json"): + response_data = utils.unmarshal_json(http_res.text, models.ErrNotFoundData) + raise models.ErrNotFound(data=response_data) + if utils.match_response(http_res, "409", "application/json"): + response_data = utils.unmarshal_json(http_res.text, models.ErrConflictData) + raise models.ErrConflict(data=response_data) + if utils.match_response(http_res, "412", "application/json"): + response_data = utils.unmarshal_json( + http_res.text, models.ErrPreconditionFailedData + ) + raise models.ErrPreconditionFailed(data=response_data) + if utils.match_response(http_res, "429", "application/json"): + response_data = utils.unmarshal_json( + http_res.text, models.ErrTooManyRequestsData + ) + raise models.ErrTooManyRequests(data=response_data) + if utils.match_response(http_res, "500", "application/json"): + response_data = utils.unmarshal_json( + http_res.text, models.ErrInternalServerErrorData + ) + raise models.ErrInternalServerError(data=response_data) + if utils.match_response(http_res, "4XX", "*"): + http_res_text = await utils.stream_to_text_async(http_res) + raise models.SDKError( + "API error occurred", http_res.status_code, http_res_text, http_res + ) + if utils.match_response(http_res, "5XX", "*"): + http_res_text = await utils.stream_to_text_async(http_res) + raise models.SDKError( + "API error occurred", http_res.status_code, http_res_text, http_res + ) + + content_type = http_res.headers.get("Content-Type") + http_res_text = await utils.stream_to_text_async(http_res) + raise models.SDKError( + f"Unexpected response received (code: {http_res.status_code}, type: {content_type})", + http_res.status_code, + http_res_text, + http_res, + ) diff --git a/src/unkey_py/apis.py b/src/unkey_py/apis.py index e19c2f0..5ef57c8 100644 --- a/src/unkey_py/apis.py +++ b/src/unkey_py/apis.py @@ -1,7 +1,7 @@ """Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT.""" from .basesdk import BaseSDK -from typing import Any, Optional, Union, cast +from typing import Any, Mapping, Optional, Union, cast from unkey_py import models, utils from unkey_py._hooks import HookContext from unkey_py.types import BaseModel, OptionalNullable, UNSET @@ -16,12 +16,14 @@ def get( retries: OptionalNullable[utils.RetryConfig] = UNSET, server_url: Optional[str] = None, timeout_ms: Optional[int] = None, + http_headers: Optional[Mapping[str, str]] = None, ) -> models.GetAPIResponse: r""" :param api_id: :param retries: Override the default retry configuration for this method :param server_url: Override the default server URL for this method :param timeout_ms: Override the default request timeout configuration for this method in milliseconds + :param http_headers: Additional headers to set or replace on requests. """ base_url = None url_variables = None @@ -30,12 +32,14 @@ def get( if server_url is not None: base_url = server_url + else: + base_url = self._get_url(base_url, url_variables) request = models.GetAPIRequest( api_id=api_id, ) - req = self.build_request( + req = self._build_request( method="GET", path="/v1/apis.getApi", base_url=base_url, @@ -46,6 +50,7 @@ def get( request_has_query_params=True, user_agent_header="user-agent", accept_header_value="application/json", + http_headers=http_headers, security=self.sdk_configuration.security, timeout_ms=timeout_ms, ) @@ -64,6 +69,7 @@ def get( http_res = self.do_request( hook_ctx=HookContext( + base_url=base_url or "", operation_id="getApi", oauth2_scopes=[], security_source=get_security_from_env( @@ -77,6 +83,7 @@ def get( "403", "404", "409", + "412", "429", "4XX", "500", @@ -85,7 +92,7 @@ def get( retry_config=retry_config, ) - data: Any = None + response_data: Any = None if utils.match_response(http_res, "200", "application/json"): return models.GetAPIResponse( object=utils.unmarshal_json( @@ -94,29 +101,45 @@ def get( http_meta=models.HTTPMetadata(request=req, response=http_res), ) if utils.match_response(http_res, "400", "application/json"): - data = utils.unmarshal_json(http_res.text, models.ErrBadRequestData) - raise models.ErrBadRequest(data=data) + response_data = utils.unmarshal_json( + http_res.text, models.ErrBadRequestData + ) + raise models.ErrBadRequest(data=response_data) if utils.match_response(http_res, "401", "application/json"): - data = utils.unmarshal_json(http_res.text, models.ErrUnauthorizedData) - raise models.ErrUnauthorized(data=data) + response_data = utils.unmarshal_json( + http_res.text, models.ErrUnauthorizedData + ) + raise models.ErrUnauthorized(data=response_data) if utils.match_response(http_res, "403", "application/json"): - data = utils.unmarshal_json(http_res.text, models.ErrForbiddenData) - raise models.ErrForbidden(data=data) + response_data = utils.unmarshal_json(http_res.text, models.ErrForbiddenData) + raise models.ErrForbidden(data=response_data) if utils.match_response(http_res, "404", "application/json"): - data = utils.unmarshal_json(http_res.text, models.ErrNotFoundData) - raise models.ErrNotFound(data=data) + response_data = utils.unmarshal_json(http_res.text, models.ErrNotFoundData) + raise models.ErrNotFound(data=response_data) if utils.match_response(http_res, "409", "application/json"): - data = utils.unmarshal_json(http_res.text, models.ErrConflictData) - raise models.ErrConflict(data=data) + response_data = utils.unmarshal_json(http_res.text, models.ErrConflictData) + raise models.ErrConflict(data=response_data) + if utils.match_response(http_res, "412", "application/json"): + response_data = utils.unmarshal_json( + http_res.text, models.ErrPreconditionFailedData + ) + raise models.ErrPreconditionFailed(data=response_data) if utils.match_response(http_res, "429", "application/json"): - data = utils.unmarshal_json(http_res.text, models.ErrTooManyRequestsData) - raise models.ErrTooManyRequests(data=data) + response_data = utils.unmarshal_json( + http_res.text, models.ErrTooManyRequestsData + ) + raise models.ErrTooManyRequests(data=response_data) if utils.match_response(http_res, "500", "application/json"): - data = utils.unmarshal_json( + response_data = utils.unmarshal_json( http_res.text, models.ErrInternalServerErrorData ) - raise models.ErrInternalServerError(data=data) - if utils.match_response(http_res, ["4XX", "5XX"], "*"): + raise models.ErrInternalServerError(data=response_data) + if utils.match_response(http_res, "4XX", "*"): + http_res_text = utils.stream_to_text(http_res) + raise models.SDKError( + "API error occurred", http_res.status_code, http_res_text, http_res + ) + if utils.match_response(http_res, "5XX", "*"): http_res_text = utils.stream_to_text(http_res) raise models.SDKError( "API error occurred", http_res.status_code, http_res_text, http_res @@ -138,12 +161,14 @@ async def get_async( retries: OptionalNullable[utils.RetryConfig] = UNSET, server_url: Optional[str] = None, timeout_ms: Optional[int] = None, + http_headers: Optional[Mapping[str, str]] = None, ) -> models.GetAPIResponse: r""" :param api_id: :param retries: Override the default retry configuration for this method :param server_url: Override the default server URL for this method :param timeout_ms: Override the default request timeout configuration for this method in milliseconds + :param http_headers: Additional headers to set or replace on requests. """ base_url = None url_variables = None @@ -152,12 +177,14 @@ async def get_async( if server_url is not None: base_url = server_url + else: + base_url = self._get_url(base_url, url_variables) request = models.GetAPIRequest( api_id=api_id, ) - req = self.build_request_async( + req = self._build_request_async( method="GET", path="/v1/apis.getApi", base_url=base_url, @@ -168,6 +195,7 @@ async def get_async( request_has_query_params=True, user_agent_header="user-agent", accept_header_value="application/json", + http_headers=http_headers, security=self.sdk_configuration.security, timeout_ms=timeout_ms, ) @@ -186,6 +214,7 @@ async def get_async( http_res = await self.do_request_async( hook_ctx=HookContext( + base_url=base_url or "", operation_id="getApi", oauth2_scopes=[], security_source=get_security_from_env( @@ -199,6 +228,7 @@ async def get_async( "403", "404", "409", + "412", "429", "4XX", "500", @@ -207,7 +237,7 @@ async def get_async( retry_config=retry_config, ) - data: Any = None + response_data: Any = None if utils.match_response(http_res, "200", "application/json"): return models.GetAPIResponse( object=utils.unmarshal_json( @@ -216,29 +246,45 @@ async def get_async( http_meta=models.HTTPMetadata(request=req, response=http_res), ) if utils.match_response(http_res, "400", "application/json"): - data = utils.unmarshal_json(http_res.text, models.ErrBadRequestData) - raise models.ErrBadRequest(data=data) + response_data = utils.unmarshal_json( + http_res.text, models.ErrBadRequestData + ) + raise models.ErrBadRequest(data=response_data) if utils.match_response(http_res, "401", "application/json"): - data = utils.unmarshal_json(http_res.text, models.ErrUnauthorizedData) - raise models.ErrUnauthorized(data=data) + response_data = utils.unmarshal_json( + http_res.text, models.ErrUnauthorizedData + ) + raise models.ErrUnauthorized(data=response_data) if utils.match_response(http_res, "403", "application/json"): - data = utils.unmarshal_json(http_res.text, models.ErrForbiddenData) - raise models.ErrForbidden(data=data) + response_data = utils.unmarshal_json(http_res.text, models.ErrForbiddenData) + raise models.ErrForbidden(data=response_data) if utils.match_response(http_res, "404", "application/json"): - data = utils.unmarshal_json(http_res.text, models.ErrNotFoundData) - raise models.ErrNotFound(data=data) + response_data = utils.unmarshal_json(http_res.text, models.ErrNotFoundData) + raise models.ErrNotFound(data=response_data) if utils.match_response(http_res, "409", "application/json"): - data = utils.unmarshal_json(http_res.text, models.ErrConflictData) - raise models.ErrConflict(data=data) + response_data = utils.unmarshal_json(http_res.text, models.ErrConflictData) + raise models.ErrConflict(data=response_data) + if utils.match_response(http_res, "412", "application/json"): + response_data = utils.unmarshal_json( + http_res.text, models.ErrPreconditionFailedData + ) + raise models.ErrPreconditionFailed(data=response_data) if utils.match_response(http_res, "429", "application/json"): - data = utils.unmarshal_json(http_res.text, models.ErrTooManyRequestsData) - raise models.ErrTooManyRequests(data=data) + response_data = utils.unmarshal_json( + http_res.text, models.ErrTooManyRequestsData + ) + raise models.ErrTooManyRequests(data=response_data) if utils.match_response(http_res, "500", "application/json"): - data = utils.unmarshal_json( + response_data = utils.unmarshal_json( http_res.text, models.ErrInternalServerErrorData ) - raise models.ErrInternalServerError(data=data) - if utils.match_response(http_res, ["4XX", "5XX"], "*"): + raise models.ErrInternalServerError(data=response_data) + if utils.match_response(http_res, "4XX", "*"): + http_res_text = await utils.stream_to_text_async(http_res) + raise models.SDKError( + "API error occurred", http_res.status_code, http_res_text, http_res + ) + if utils.match_response(http_res, "5XX", "*"): http_res_text = await utils.stream_to_text_async(http_res) raise models.SDKError( "API error occurred", http_res.status_code, http_res_text, http_res @@ -262,12 +308,14 @@ def create( retries: OptionalNullable[utils.RetryConfig] = UNSET, server_url: Optional[str] = None, timeout_ms: Optional[int] = None, + http_headers: Optional[Mapping[str, str]] = None, ) -> models.CreateAPIResponse: r""" :param request: The request object to send. :param retries: Override the default retry configuration for this method :param server_url: Override the default server URL for this method :param timeout_ms: Override the default request timeout configuration for this method in milliseconds + :param http_headers: Additional headers to set or replace on requests. """ base_url = None url_variables = None @@ -276,12 +324,14 @@ def create( if server_url is not None: base_url = server_url + else: + base_url = self._get_url(base_url, url_variables) if not isinstance(request, BaseModel): request = utils.unmarshal(request, models.CreateAPIRequestBody) request = cast(models.CreateAPIRequestBody, request) - req = self.build_request( + req = self._build_request( method="POST", path="/v1/apis.createApi", base_url=base_url, @@ -292,6 +342,7 @@ def create( request_has_query_params=True, user_agent_header="user-agent", accept_header_value="application/json", + http_headers=http_headers, security=self.sdk_configuration.security, get_serialized_body=lambda: utils.serialize_request_body( request, False, False, "json", models.CreateAPIRequestBody @@ -313,6 +364,7 @@ def create( http_res = self.do_request( hook_ctx=HookContext( + base_url=base_url or "", operation_id="createApi", oauth2_scopes=[], security_source=get_security_from_env( @@ -326,6 +378,7 @@ def create( "403", "404", "409", + "412", "429", "4XX", "500", @@ -334,7 +387,7 @@ def create( retry_config=retry_config, ) - data: Any = None + response_data: Any = None if utils.match_response(http_res, "200", "application/json"): return models.CreateAPIResponse( object=utils.unmarshal_json( @@ -343,29 +396,45 @@ def create( http_meta=models.HTTPMetadata(request=req, response=http_res), ) if utils.match_response(http_res, "400", "application/json"): - data = utils.unmarshal_json(http_res.text, models.ErrBadRequestData) - raise models.ErrBadRequest(data=data) + response_data = utils.unmarshal_json( + http_res.text, models.ErrBadRequestData + ) + raise models.ErrBadRequest(data=response_data) if utils.match_response(http_res, "401", "application/json"): - data = utils.unmarshal_json(http_res.text, models.ErrUnauthorizedData) - raise models.ErrUnauthorized(data=data) + response_data = utils.unmarshal_json( + http_res.text, models.ErrUnauthorizedData + ) + raise models.ErrUnauthorized(data=response_data) if utils.match_response(http_res, "403", "application/json"): - data = utils.unmarshal_json(http_res.text, models.ErrForbiddenData) - raise models.ErrForbidden(data=data) + response_data = utils.unmarshal_json(http_res.text, models.ErrForbiddenData) + raise models.ErrForbidden(data=response_data) if utils.match_response(http_res, "404", "application/json"): - data = utils.unmarshal_json(http_res.text, models.ErrNotFoundData) - raise models.ErrNotFound(data=data) + response_data = utils.unmarshal_json(http_res.text, models.ErrNotFoundData) + raise models.ErrNotFound(data=response_data) if utils.match_response(http_res, "409", "application/json"): - data = utils.unmarshal_json(http_res.text, models.ErrConflictData) - raise models.ErrConflict(data=data) + response_data = utils.unmarshal_json(http_res.text, models.ErrConflictData) + raise models.ErrConflict(data=response_data) + if utils.match_response(http_res, "412", "application/json"): + response_data = utils.unmarshal_json( + http_res.text, models.ErrPreconditionFailedData + ) + raise models.ErrPreconditionFailed(data=response_data) if utils.match_response(http_res, "429", "application/json"): - data = utils.unmarshal_json(http_res.text, models.ErrTooManyRequestsData) - raise models.ErrTooManyRequests(data=data) + response_data = utils.unmarshal_json( + http_res.text, models.ErrTooManyRequestsData + ) + raise models.ErrTooManyRequests(data=response_data) if utils.match_response(http_res, "500", "application/json"): - data = utils.unmarshal_json( + response_data = utils.unmarshal_json( http_res.text, models.ErrInternalServerErrorData ) - raise models.ErrInternalServerError(data=data) - if utils.match_response(http_res, ["4XX", "5XX"], "*"): + raise models.ErrInternalServerError(data=response_data) + if utils.match_response(http_res, "4XX", "*"): + http_res_text = utils.stream_to_text(http_res) + raise models.SDKError( + "API error occurred", http_res.status_code, http_res_text, http_res + ) + if utils.match_response(http_res, "5XX", "*"): http_res_text = utils.stream_to_text(http_res) raise models.SDKError( "API error occurred", http_res.status_code, http_res_text, http_res @@ -389,12 +458,14 @@ async def create_async( retries: OptionalNullable[utils.RetryConfig] = UNSET, server_url: Optional[str] = None, timeout_ms: Optional[int] = None, + http_headers: Optional[Mapping[str, str]] = None, ) -> models.CreateAPIResponse: r""" :param request: The request object to send. :param retries: Override the default retry configuration for this method :param server_url: Override the default server URL for this method :param timeout_ms: Override the default request timeout configuration for this method in milliseconds + :param http_headers: Additional headers to set or replace on requests. """ base_url = None url_variables = None @@ -403,12 +474,14 @@ async def create_async( if server_url is not None: base_url = server_url + else: + base_url = self._get_url(base_url, url_variables) if not isinstance(request, BaseModel): request = utils.unmarshal(request, models.CreateAPIRequestBody) request = cast(models.CreateAPIRequestBody, request) - req = self.build_request_async( + req = self._build_request_async( method="POST", path="/v1/apis.createApi", base_url=base_url, @@ -419,6 +492,7 @@ async def create_async( request_has_query_params=True, user_agent_header="user-agent", accept_header_value="application/json", + http_headers=http_headers, security=self.sdk_configuration.security, get_serialized_body=lambda: utils.serialize_request_body( request, False, False, "json", models.CreateAPIRequestBody @@ -440,6 +514,7 @@ async def create_async( http_res = await self.do_request_async( hook_ctx=HookContext( + base_url=base_url or "", operation_id="createApi", oauth2_scopes=[], security_source=get_security_from_env( @@ -453,6 +528,7 @@ async def create_async( "403", "404", "409", + "412", "429", "4XX", "500", @@ -461,7 +537,7 @@ async def create_async( retry_config=retry_config, ) - data: Any = None + response_data: Any = None if utils.match_response(http_res, "200", "application/json"): return models.CreateAPIResponse( object=utils.unmarshal_json( @@ -470,29 +546,45 @@ async def create_async( http_meta=models.HTTPMetadata(request=req, response=http_res), ) if utils.match_response(http_res, "400", "application/json"): - data = utils.unmarshal_json(http_res.text, models.ErrBadRequestData) - raise models.ErrBadRequest(data=data) + response_data = utils.unmarshal_json( + http_res.text, models.ErrBadRequestData + ) + raise models.ErrBadRequest(data=response_data) if utils.match_response(http_res, "401", "application/json"): - data = utils.unmarshal_json(http_res.text, models.ErrUnauthorizedData) - raise models.ErrUnauthorized(data=data) + response_data = utils.unmarshal_json( + http_res.text, models.ErrUnauthorizedData + ) + raise models.ErrUnauthorized(data=response_data) if utils.match_response(http_res, "403", "application/json"): - data = utils.unmarshal_json(http_res.text, models.ErrForbiddenData) - raise models.ErrForbidden(data=data) + response_data = utils.unmarshal_json(http_res.text, models.ErrForbiddenData) + raise models.ErrForbidden(data=response_data) if utils.match_response(http_res, "404", "application/json"): - data = utils.unmarshal_json(http_res.text, models.ErrNotFoundData) - raise models.ErrNotFound(data=data) + response_data = utils.unmarshal_json(http_res.text, models.ErrNotFoundData) + raise models.ErrNotFound(data=response_data) if utils.match_response(http_res, "409", "application/json"): - data = utils.unmarshal_json(http_res.text, models.ErrConflictData) - raise models.ErrConflict(data=data) + response_data = utils.unmarshal_json(http_res.text, models.ErrConflictData) + raise models.ErrConflict(data=response_data) + if utils.match_response(http_res, "412", "application/json"): + response_data = utils.unmarshal_json( + http_res.text, models.ErrPreconditionFailedData + ) + raise models.ErrPreconditionFailed(data=response_data) if utils.match_response(http_res, "429", "application/json"): - data = utils.unmarshal_json(http_res.text, models.ErrTooManyRequestsData) - raise models.ErrTooManyRequests(data=data) + response_data = utils.unmarshal_json( + http_res.text, models.ErrTooManyRequestsData + ) + raise models.ErrTooManyRequests(data=response_data) if utils.match_response(http_res, "500", "application/json"): - data = utils.unmarshal_json( + response_data = utils.unmarshal_json( http_res.text, models.ErrInternalServerErrorData ) - raise models.ErrInternalServerError(data=data) - if utils.match_response(http_res, ["4XX", "5XX"], "*"): + raise models.ErrInternalServerError(data=response_data) + if utils.match_response(http_res, "4XX", "*"): + http_res_text = await utils.stream_to_text_async(http_res) + raise models.SDKError( + "API error occurred", http_res.status_code, http_res_text, http_res + ) + if utils.match_response(http_res, "5XX", "*"): http_res_text = await utils.stream_to_text_async(http_res) raise models.SDKError( "API error occurred", http_res.status_code, http_res_text, http_res @@ -514,12 +606,14 @@ def list_keys( retries: OptionalNullable[utils.RetryConfig] = UNSET, server_url: Optional[str] = None, timeout_ms: Optional[int] = None, + http_headers: Optional[Mapping[str, str]] = None, ) -> models.ListKeysResponse: r""" :param request: The request object to send. :param retries: Override the default retry configuration for this method :param server_url: Override the default server URL for this method :param timeout_ms: Override the default request timeout configuration for this method in milliseconds + :param http_headers: Additional headers to set or replace on requests. """ base_url = None url_variables = None @@ -528,12 +622,14 @@ def list_keys( if server_url is not None: base_url = server_url + else: + base_url = self._get_url(base_url, url_variables) if not isinstance(request, BaseModel): request = utils.unmarshal(request, models.ListKeysRequest) request = cast(models.ListKeysRequest, request) - req = self.build_request( + req = self._build_request( method="GET", path="/v1/apis.listKeys", base_url=base_url, @@ -544,6 +640,7 @@ def list_keys( request_has_query_params=True, user_agent_header="user-agent", accept_header_value="application/json", + http_headers=http_headers, security=self.sdk_configuration.security, timeout_ms=timeout_ms, ) @@ -562,6 +659,7 @@ def list_keys( http_res = self.do_request( hook_ctx=HookContext( + base_url=base_url or "", operation_id="listKeys", oauth2_scopes=[], security_source=get_security_from_env( @@ -575,6 +673,7 @@ def list_keys( "403", "404", "409", + "412", "429", "4XX", "500", @@ -583,7 +682,7 @@ def list_keys( retry_config=retry_config, ) - data: Any = None + response_data: Any = None if utils.match_response(http_res, "200", "application/json"): return models.ListKeysResponse( object=utils.unmarshal_json( @@ -592,29 +691,45 @@ def list_keys( http_meta=models.HTTPMetadata(request=req, response=http_res), ) if utils.match_response(http_res, "400", "application/json"): - data = utils.unmarshal_json(http_res.text, models.ErrBadRequestData) - raise models.ErrBadRequest(data=data) + response_data = utils.unmarshal_json( + http_res.text, models.ErrBadRequestData + ) + raise models.ErrBadRequest(data=response_data) if utils.match_response(http_res, "401", "application/json"): - data = utils.unmarshal_json(http_res.text, models.ErrUnauthorizedData) - raise models.ErrUnauthorized(data=data) + response_data = utils.unmarshal_json( + http_res.text, models.ErrUnauthorizedData + ) + raise models.ErrUnauthorized(data=response_data) if utils.match_response(http_res, "403", "application/json"): - data = utils.unmarshal_json(http_res.text, models.ErrForbiddenData) - raise models.ErrForbidden(data=data) + response_data = utils.unmarshal_json(http_res.text, models.ErrForbiddenData) + raise models.ErrForbidden(data=response_data) if utils.match_response(http_res, "404", "application/json"): - data = utils.unmarshal_json(http_res.text, models.ErrNotFoundData) - raise models.ErrNotFound(data=data) + response_data = utils.unmarshal_json(http_res.text, models.ErrNotFoundData) + raise models.ErrNotFound(data=response_data) if utils.match_response(http_res, "409", "application/json"): - data = utils.unmarshal_json(http_res.text, models.ErrConflictData) - raise models.ErrConflict(data=data) + response_data = utils.unmarshal_json(http_res.text, models.ErrConflictData) + raise models.ErrConflict(data=response_data) + if utils.match_response(http_res, "412", "application/json"): + response_data = utils.unmarshal_json( + http_res.text, models.ErrPreconditionFailedData + ) + raise models.ErrPreconditionFailed(data=response_data) if utils.match_response(http_res, "429", "application/json"): - data = utils.unmarshal_json(http_res.text, models.ErrTooManyRequestsData) - raise models.ErrTooManyRequests(data=data) + response_data = utils.unmarshal_json( + http_res.text, models.ErrTooManyRequestsData + ) + raise models.ErrTooManyRequests(data=response_data) if utils.match_response(http_res, "500", "application/json"): - data = utils.unmarshal_json( + response_data = utils.unmarshal_json( http_res.text, models.ErrInternalServerErrorData ) - raise models.ErrInternalServerError(data=data) - if utils.match_response(http_res, ["4XX", "5XX"], "*"): + raise models.ErrInternalServerError(data=response_data) + if utils.match_response(http_res, "4XX", "*"): + http_res_text = utils.stream_to_text(http_res) + raise models.SDKError( + "API error occurred", http_res.status_code, http_res_text, http_res + ) + if utils.match_response(http_res, "5XX", "*"): http_res_text = utils.stream_to_text(http_res) raise models.SDKError( "API error occurred", http_res.status_code, http_res_text, http_res @@ -636,12 +751,14 @@ async def list_keys_async( retries: OptionalNullable[utils.RetryConfig] = UNSET, server_url: Optional[str] = None, timeout_ms: Optional[int] = None, + http_headers: Optional[Mapping[str, str]] = None, ) -> models.ListKeysResponse: r""" :param request: The request object to send. :param retries: Override the default retry configuration for this method :param server_url: Override the default server URL for this method :param timeout_ms: Override the default request timeout configuration for this method in milliseconds + :param http_headers: Additional headers to set or replace on requests. """ base_url = None url_variables = None @@ -650,12 +767,14 @@ async def list_keys_async( if server_url is not None: base_url = server_url + else: + base_url = self._get_url(base_url, url_variables) if not isinstance(request, BaseModel): request = utils.unmarshal(request, models.ListKeysRequest) request = cast(models.ListKeysRequest, request) - req = self.build_request_async( + req = self._build_request_async( method="GET", path="/v1/apis.listKeys", base_url=base_url, @@ -666,6 +785,7 @@ async def list_keys_async( request_has_query_params=True, user_agent_header="user-agent", accept_header_value="application/json", + http_headers=http_headers, security=self.sdk_configuration.security, timeout_ms=timeout_ms, ) @@ -684,6 +804,7 @@ async def list_keys_async( http_res = await self.do_request_async( hook_ctx=HookContext( + base_url=base_url or "", operation_id="listKeys", oauth2_scopes=[], security_source=get_security_from_env( @@ -697,6 +818,7 @@ async def list_keys_async( "403", "404", "409", + "412", "429", "4XX", "500", @@ -705,7 +827,7 @@ async def list_keys_async( retry_config=retry_config, ) - data: Any = None + response_data: Any = None if utils.match_response(http_res, "200", "application/json"): return models.ListKeysResponse( object=utils.unmarshal_json( @@ -714,29 +836,45 @@ async def list_keys_async( http_meta=models.HTTPMetadata(request=req, response=http_res), ) if utils.match_response(http_res, "400", "application/json"): - data = utils.unmarshal_json(http_res.text, models.ErrBadRequestData) - raise models.ErrBadRequest(data=data) + response_data = utils.unmarshal_json( + http_res.text, models.ErrBadRequestData + ) + raise models.ErrBadRequest(data=response_data) if utils.match_response(http_res, "401", "application/json"): - data = utils.unmarshal_json(http_res.text, models.ErrUnauthorizedData) - raise models.ErrUnauthorized(data=data) + response_data = utils.unmarshal_json( + http_res.text, models.ErrUnauthorizedData + ) + raise models.ErrUnauthorized(data=response_data) if utils.match_response(http_res, "403", "application/json"): - data = utils.unmarshal_json(http_res.text, models.ErrForbiddenData) - raise models.ErrForbidden(data=data) + response_data = utils.unmarshal_json(http_res.text, models.ErrForbiddenData) + raise models.ErrForbidden(data=response_data) if utils.match_response(http_res, "404", "application/json"): - data = utils.unmarshal_json(http_res.text, models.ErrNotFoundData) - raise models.ErrNotFound(data=data) + response_data = utils.unmarshal_json(http_res.text, models.ErrNotFoundData) + raise models.ErrNotFound(data=response_data) if utils.match_response(http_res, "409", "application/json"): - data = utils.unmarshal_json(http_res.text, models.ErrConflictData) - raise models.ErrConflict(data=data) + response_data = utils.unmarshal_json(http_res.text, models.ErrConflictData) + raise models.ErrConflict(data=response_data) + if utils.match_response(http_res, "412", "application/json"): + response_data = utils.unmarshal_json( + http_res.text, models.ErrPreconditionFailedData + ) + raise models.ErrPreconditionFailed(data=response_data) if utils.match_response(http_res, "429", "application/json"): - data = utils.unmarshal_json(http_res.text, models.ErrTooManyRequestsData) - raise models.ErrTooManyRequests(data=data) + response_data = utils.unmarshal_json( + http_res.text, models.ErrTooManyRequestsData + ) + raise models.ErrTooManyRequests(data=response_data) if utils.match_response(http_res, "500", "application/json"): - data = utils.unmarshal_json( + response_data = utils.unmarshal_json( http_res.text, models.ErrInternalServerErrorData ) - raise models.ErrInternalServerError(data=data) - if utils.match_response(http_res, ["4XX", "5XX"], "*"): + raise models.ErrInternalServerError(data=response_data) + if utils.match_response(http_res, "4XX", "*"): + http_res_text = await utils.stream_to_text_async(http_res) + raise models.SDKError( + "API error occurred", http_res.status_code, http_res_text, http_res + ) + if utils.match_response(http_res, "5XX", "*"): http_res_text = await utils.stream_to_text_async(http_res) raise models.SDKError( "API error occurred", http_res.status_code, http_res_text, http_res @@ -760,12 +898,14 @@ def delete( retries: OptionalNullable[utils.RetryConfig] = UNSET, server_url: Optional[str] = None, timeout_ms: Optional[int] = None, + http_headers: Optional[Mapping[str, str]] = None, ) -> models.DeleteAPIResponse: r""" :param request: The request object to send. :param retries: Override the default retry configuration for this method :param server_url: Override the default server URL for this method :param timeout_ms: Override the default request timeout configuration for this method in milliseconds + :param http_headers: Additional headers to set or replace on requests. """ base_url = None url_variables = None @@ -774,12 +914,14 @@ def delete( if server_url is not None: base_url = server_url + else: + base_url = self._get_url(base_url, url_variables) if not isinstance(request, BaseModel): request = utils.unmarshal(request, models.DeleteAPIRequestBody) request = cast(models.DeleteAPIRequestBody, request) - req = self.build_request( + req = self._build_request( method="POST", path="/v1/apis.deleteApi", base_url=base_url, @@ -790,6 +932,7 @@ def delete( request_has_query_params=True, user_agent_header="user-agent", accept_header_value="application/json", + http_headers=http_headers, security=self.sdk_configuration.security, get_serialized_body=lambda: utils.serialize_request_body( request, False, False, "json", models.DeleteAPIRequestBody @@ -811,6 +954,7 @@ def delete( http_res = self.do_request( hook_ctx=HookContext( + base_url=base_url or "", operation_id="deleteApi", oauth2_scopes=[], security_source=get_security_from_env( @@ -824,6 +968,7 @@ def delete( "403", "404", "409", + "412", "429", "4XX", "500", @@ -832,7 +977,7 @@ def delete( retry_config=retry_config, ) - data: Any = None + response_data: Any = None if utils.match_response(http_res, "200", "application/json"): return models.DeleteAPIResponse( object=utils.unmarshal_json( @@ -841,29 +986,45 @@ def delete( http_meta=models.HTTPMetadata(request=req, response=http_res), ) if utils.match_response(http_res, "400", "application/json"): - data = utils.unmarshal_json(http_res.text, models.ErrBadRequestData) - raise models.ErrBadRequest(data=data) + response_data = utils.unmarshal_json( + http_res.text, models.ErrBadRequestData + ) + raise models.ErrBadRequest(data=response_data) if utils.match_response(http_res, "401", "application/json"): - data = utils.unmarshal_json(http_res.text, models.ErrUnauthorizedData) - raise models.ErrUnauthorized(data=data) + response_data = utils.unmarshal_json( + http_res.text, models.ErrUnauthorizedData + ) + raise models.ErrUnauthorized(data=response_data) if utils.match_response(http_res, "403", "application/json"): - data = utils.unmarshal_json(http_res.text, models.ErrForbiddenData) - raise models.ErrForbidden(data=data) + response_data = utils.unmarshal_json(http_res.text, models.ErrForbiddenData) + raise models.ErrForbidden(data=response_data) if utils.match_response(http_res, "404", "application/json"): - data = utils.unmarshal_json(http_res.text, models.ErrNotFoundData) - raise models.ErrNotFound(data=data) + response_data = utils.unmarshal_json(http_res.text, models.ErrNotFoundData) + raise models.ErrNotFound(data=response_data) if utils.match_response(http_res, "409", "application/json"): - data = utils.unmarshal_json(http_res.text, models.ErrConflictData) - raise models.ErrConflict(data=data) + response_data = utils.unmarshal_json(http_res.text, models.ErrConflictData) + raise models.ErrConflict(data=response_data) + if utils.match_response(http_res, "412", "application/json"): + response_data = utils.unmarshal_json( + http_res.text, models.ErrPreconditionFailedData + ) + raise models.ErrPreconditionFailed(data=response_data) if utils.match_response(http_res, "429", "application/json"): - data = utils.unmarshal_json(http_res.text, models.ErrDeleteProtectedData) - raise models.ErrDeleteProtected(data=data) + response_data = utils.unmarshal_json( + http_res.text, models.ErrDeleteProtectedData + ) + raise models.ErrDeleteProtected(data=response_data) if utils.match_response(http_res, "500", "application/json"): - data = utils.unmarshal_json( + response_data = utils.unmarshal_json( http_res.text, models.ErrInternalServerErrorData ) - raise models.ErrInternalServerError(data=data) - if utils.match_response(http_res, ["4XX", "5XX"], "*"): + raise models.ErrInternalServerError(data=response_data) + if utils.match_response(http_res, "4XX", "*"): + http_res_text = utils.stream_to_text(http_res) + raise models.SDKError( + "API error occurred", http_res.status_code, http_res_text, http_res + ) + if utils.match_response(http_res, "5XX", "*"): http_res_text = utils.stream_to_text(http_res) raise models.SDKError( "API error occurred", http_res.status_code, http_res_text, http_res @@ -887,12 +1048,14 @@ async def delete_async( retries: OptionalNullable[utils.RetryConfig] = UNSET, server_url: Optional[str] = None, timeout_ms: Optional[int] = None, + http_headers: Optional[Mapping[str, str]] = None, ) -> models.DeleteAPIResponse: r""" :param request: The request object to send. :param retries: Override the default retry configuration for this method :param server_url: Override the default server URL for this method :param timeout_ms: Override the default request timeout configuration for this method in milliseconds + :param http_headers: Additional headers to set or replace on requests. """ base_url = None url_variables = None @@ -901,12 +1064,14 @@ async def delete_async( if server_url is not None: base_url = server_url + else: + base_url = self._get_url(base_url, url_variables) if not isinstance(request, BaseModel): request = utils.unmarshal(request, models.DeleteAPIRequestBody) request = cast(models.DeleteAPIRequestBody, request) - req = self.build_request_async( + req = self._build_request_async( method="POST", path="/v1/apis.deleteApi", base_url=base_url, @@ -917,6 +1082,7 @@ async def delete_async( request_has_query_params=True, user_agent_header="user-agent", accept_header_value="application/json", + http_headers=http_headers, security=self.sdk_configuration.security, get_serialized_body=lambda: utils.serialize_request_body( request, False, False, "json", models.DeleteAPIRequestBody @@ -938,6 +1104,7 @@ async def delete_async( http_res = await self.do_request_async( hook_ctx=HookContext( + base_url=base_url or "", operation_id="deleteApi", oauth2_scopes=[], security_source=get_security_from_env( @@ -951,6 +1118,7 @@ async def delete_async( "403", "404", "409", + "412", "429", "4XX", "500", @@ -959,7 +1127,7 @@ async def delete_async( retry_config=retry_config, ) - data: Any = None + response_data: Any = None if utils.match_response(http_res, "200", "application/json"): return models.DeleteAPIResponse( object=utils.unmarshal_json( @@ -968,29 +1136,45 @@ async def delete_async( http_meta=models.HTTPMetadata(request=req, response=http_res), ) if utils.match_response(http_res, "400", "application/json"): - data = utils.unmarshal_json(http_res.text, models.ErrBadRequestData) - raise models.ErrBadRequest(data=data) + response_data = utils.unmarshal_json( + http_res.text, models.ErrBadRequestData + ) + raise models.ErrBadRequest(data=response_data) if utils.match_response(http_res, "401", "application/json"): - data = utils.unmarshal_json(http_res.text, models.ErrUnauthorizedData) - raise models.ErrUnauthorized(data=data) + response_data = utils.unmarshal_json( + http_res.text, models.ErrUnauthorizedData + ) + raise models.ErrUnauthorized(data=response_data) if utils.match_response(http_res, "403", "application/json"): - data = utils.unmarshal_json(http_res.text, models.ErrForbiddenData) - raise models.ErrForbidden(data=data) + response_data = utils.unmarshal_json(http_res.text, models.ErrForbiddenData) + raise models.ErrForbidden(data=response_data) if utils.match_response(http_res, "404", "application/json"): - data = utils.unmarshal_json(http_res.text, models.ErrNotFoundData) - raise models.ErrNotFound(data=data) + response_data = utils.unmarshal_json(http_res.text, models.ErrNotFoundData) + raise models.ErrNotFound(data=response_data) if utils.match_response(http_res, "409", "application/json"): - data = utils.unmarshal_json(http_res.text, models.ErrConflictData) - raise models.ErrConflict(data=data) + response_data = utils.unmarshal_json(http_res.text, models.ErrConflictData) + raise models.ErrConflict(data=response_data) + if utils.match_response(http_res, "412", "application/json"): + response_data = utils.unmarshal_json( + http_res.text, models.ErrPreconditionFailedData + ) + raise models.ErrPreconditionFailed(data=response_data) if utils.match_response(http_res, "429", "application/json"): - data = utils.unmarshal_json(http_res.text, models.ErrDeleteProtectedData) - raise models.ErrDeleteProtected(data=data) + response_data = utils.unmarshal_json( + http_res.text, models.ErrDeleteProtectedData + ) + raise models.ErrDeleteProtected(data=response_data) if utils.match_response(http_res, "500", "application/json"): - data = utils.unmarshal_json( + response_data = utils.unmarshal_json( http_res.text, models.ErrInternalServerErrorData ) - raise models.ErrInternalServerError(data=data) - if utils.match_response(http_res, ["4XX", "5XX"], "*"): + raise models.ErrInternalServerError(data=response_data) + if utils.match_response(http_res, "4XX", "*"): + http_res_text = await utils.stream_to_text_async(http_res) + raise models.SDKError( + "API error occurred", http_res.status_code, http_res_text, http_res + ) + if utils.match_response(http_res, "5XX", "*"): http_res_text = await utils.stream_to_text_async(http_res) raise models.SDKError( "API error occurred", http_res.status_code, http_res_text, http_res @@ -1014,12 +1198,14 @@ def delete_keys( retries: OptionalNullable[utils.RetryConfig] = UNSET, server_url: Optional[str] = None, timeout_ms: Optional[int] = None, + http_headers: Optional[Mapping[str, str]] = None, ) -> models.DeleteKeysResponse: r""" :param request: The request object to send. :param retries: Override the default retry configuration for this method :param server_url: Override the default server URL for this method :param timeout_ms: Override the default request timeout configuration for this method in milliseconds + :param http_headers: Additional headers to set or replace on requests. """ base_url = None url_variables = None @@ -1028,12 +1214,14 @@ def delete_keys( if server_url is not None: base_url = server_url + else: + base_url = self._get_url(base_url, url_variables) if not isinstance(request, BaseModel): request = utils.unmarshal(request, models.DeleteKeysRequestBody) request = cast(models.DeleteKeysRequestBody, request) - req = self.build_request( + req = self._build_request( method="POST", path="/v1/apis.deleteKeys", base_url=base_url, @@ -1044,6 +1232,7 @@ def delete_keys( request_has_query_params=True, user_agent_header="user-agent", accept_header_value="application/json", + http_headers=http_headers, security=self.sdk_configuration.security, get_serialized_body=lambda: utils.serialize_request_body( request, False, False, "json", models.DeleteKeysRequestBody @@ -1065,6 +1254,7 @@ def delete_keys( http_res = self.do_request( hook_ctx=HookContext( + base_url=base_url or "", operation_id="deleteKeys", oauth2_scopes=[], security_source=get_security_from_env( @@ -1078,6 +1268,7 @@ def delete_keys( "403", "404", "409", + "412", "429", "4XX", "500", @@ -1086,7 +1277,7 @@ def delete_keys( retry_config=retry_config, ) - data: Any = None + response_data: Any = None if utils.match_response(http_res, "200", "application/json"): return models.DeleteKeysResponse( object=utils.unmarshal_json( @@ -1095,29 +1286,45 @@ def delete_keys( http_meta=models.HTTPMetadata(request=req, response=http_res), ) if utils.match_response(http_res, "400", "application/json"): - data = utils.unmarshal_json(http_res.text, models.ErrBadRequestData) - raise models.ErrBadRequest(data=data) + response_data = utils.unmarshal_json( + http_res.text, models.ErrBadRequestData + ) + raise models.ErrBadRequest(data=response_data) if utils.match_response(http_res, "401", "application/json"): - data = utils.unmarshal_json(http_res.text, models.ErrUnauthorizedData) - raise models.ErrUnauthorized(data=data) + response_data = utils.unmarshal_json( + http_res.text, models.ErrUnauthorizedData + ) + raise models.ErrUnauthorized(data=response_data) if utils.match_response(http_res, "403", "application/json"): - data = utils.unmarshal_json(http_res.text, models.ErrForbiddenData) - raise models.ErrForbidden(data=data) + response_data = utils.unmarshal_json(http_res.text, models.ErrForbiddenData) + raise models.ErrForbidden(data=response_data) if utils.match_response(http_res, "404", "application/json"): - data = utils.unmarshal_json(http_res.text, models.ErrNotFoundData) - raise models.ErrNotFound(data=data) + response_data = utils.unmarshal_json(http_res.text, models.ErrNotFoundData) + raise models.ErrNotFound(data=response_data) if utils.match_response(http_res, "409", "application/json"): - data = utils.unmarshal_json(http_res.text, models.ErrConflictData) - raise models.ErrConflict(data=data) + response_data = utils.unmarshal_json(http_res.text, models.ErrConflictData) + raise models.ErrConflict(data=response_data) + if utils.match_response(http_res, "412", "application/json"): + response_data = utils.unmarshal_json( + http_res.text, models.ErrPreconditionFailedData + ) + raise models.ErrPreconditionFailed(data=response_data) if utils.match_response(http_res, "429", "application/json"): - data = utils.unmarshal_json(http_res.text, models.ErrTooManyRequestsData) - raise models.ErrTooManyRequests(data=data) + response_data = utils.unmarshal_json( + http_res.text, models.ErrTooManyRequestsData + ) + raise models.ErrTooManyRequests(data=response_data) if utils.match_response(http_res, "500", "application/json"): - data = utils.unmarshal_json( + response_data = utils.unmarshal_json( http_res.text, models.ErrInternalServerErrorData ) - raise models.ErrInternalServerError(data=data) - if utils.match_response(http_res, ["4XX", "5XX"], "*"): + raise models.ErrInternalServerError(data=response_data) + if utils.match_response(http_res, "4XX", "*"): + http_res_text = utils.stream_to_text(http_res) + raise models.SDKError( + "API error occurred", http_res.status_code, http_res_text, http_res + ) + if utils.match_response(http_res, "5XX", "*"): http_res_text = utils.stream_to_text(http_res) raise models.SDKError( "API error occurred", http_res.status_code, http_res_text, http_res @@ -1141,12 +1348,14 @@ async def delete_keys_async( retries: OptionalNullable[utils.RetryConfig] = UNSET, server_url: Optional[str] = None, timeout_ms: Optional[int] = None, + http_headers: Optional[Mapping[str, str]] = None, ) -> models.DeleteKeysResponse: r""" :param request: The request object to send. :param retries: Override the default retry configuration for this method :param server_url: Override the default server URL for this method :param timeout_ms: Override the default request timeout configuration for this method in milliseconds + :param http_headers: Additional headers to set or replace on requests. """ base_url = None url_variables = None @@ -1155,12 +1364,14 @@ async def delete_keys_async( if server_url is not None: base_url = server_url + else: + base_url = self._get_url(base_url, url_variables) if not isinstance(request, BaseModel): request = utils.unmarshal(request, models.DeleteKeysRequestBody) request = cast(models.DeleteKeysRequestBody, request) - req = self.build_request_async( + req = self._build_request_async( method="POST", path="/v1/apis.deleteKeys", base_url=base_url, @@ -1171,6 +1382,7 @@ async def delete_keys_async( request_has_query_params=True, user_agent_header="user-agent", accept_header_value="application/json", + http_headers=http_headers, security=self.sdk_configuration.security, get_serialized_body=lambda: utils.serialize_request_body( request, False, False, "json", models.DeleteKeysRequestBody @@ -1192,6 +1404,7 @@ async def delete_keys_async( http_res = await self.do_request_async( hook_ctx=HookContext( + base_url=base_url or "", operation_id="deleteKeys", oauth2_scopes=[], security_source=get_security_from_env( @@ -1205,6 +1418,7 @@ async def delete_keys_async( "403", "404", "409", + "412", "429", "4XX", "500", @@ -1213,7 +1427,7 @@ async def delete_keys_async( retry_config=retry_config, ) - data: Any = None + response_data: Any = None if utils.match_response(http_res, "200", "application/json"): return models.DeleteKeysResponse( object=utils.unmarshal_json( @@ -1222,29 +1436,45 @@ async def delete_keys_async( http_meta=models.HTTPMetadata(request=req, response=http_res), ) if utils.match_response(http_res, "400", "application/json"): - data = utils.unmarshal_json(http_res.text, models.ErrBadRequestData) - raise models.ErrBadRequest(data=data) + response_data = utils.unmarshal_json( + http_res.text, models.ErrBadRequestData + ) + raise models.ErrBadRequest(data=response_data) if utils.match_response(http_res, "401", "application/json"): - data = utils.unmarshal_json(http_res.text, models.ErrUnauthorizedData) - raise models.ErrUnauthorized(data=data) + response_data = utils.unmarshal_json( + http_res.text, models.ErrUnauthorizedData + ) + raise models.ErrUnauthorized(data=response_data) if utils.match_response(http_res, "403", "application/json"): - data = utils.unmarshal_json(http_res.text, models.ErrForbiddenData) - raise models.ErrForbidden(data=data) + response_data = utils.unmarshal_json(http_res.text, models.ErrForbiddenData) + raise models.ErrForbidden(data=response_data) if utils.match_response(http_res, "404", "application/json"): - data = utils.unmarshal_json(http_res.text, models.ErrNotFoundData) - raise models.ErrNotFound(data=data) + response_data = utils.unmarshal_json(http_res.text, models.ErrNotFoundData) + raise models.ErrNotFound(data=response_data) if utils.match_response(http_res, "409", "application/json"): - data = utils.unmarshal_json(http_res.text, models.ErrConflictData) - raise models.ErrConflict(data=data) + response_data = utils.unmarshal_json(http_res.text, models.ErrConflictData) + raise models.ErrConflict(data=response_data) + if utils.match_response(http_res, "412", "application/json"): + response_data = utils.unmarshal_json( + http_res.text, models.ErrPreconditionFailedData + ) + raise models.ErrPreconditionFailed(data=response_data) if utils.match_response(http_res, "429", "application/json"): - data = utils.unmarshal_json(http_res.text, models.ErrTooManyRequestsData) - raise models.ErrTooManyRequests(data=data) + response_data = utils.unmarshal_json( + http_res.text, models.ErrTooManyRequestsData + ) + raise models.ErrTooManyRequests(data=response_data) if utils.match_response(http_res, "500", "application/json"): - data = utils.unmarshal_json( + response_data = utils.unmarshal_json( http_res.text, models.ErrInternalServerErrorData ) - raise models.ErrInternalServerError(data=data) - if utils.match_response(http_res, ["4XX", "5XX"], "*"): + raise models.ErrInternalServerError(data=response_data) + if utils.match_response(http_res, "4XX", "*"): + http_res_text = await utils.stream_to_text_async(http_res) + raise models.SDKError( + "API error occurred", http_res.status_code, http_res_text, http_res + ) + if utils.match_response(http_res, "5XX", "*"): http_res_text = await utils.stream_to_text_async(http_res) raise models.SDKError( "API error occurred", http_res.status_code, http_res_text, http_res diff --git a/src/unkey_py/basesdk.py b/src/unkey_py/basesdk.py index 18b572d..7104a15 100644 --- a/src/unkey_py/basesdk.py +++ b/src/unkey_py/basesdk.py @@ -2,10 +2,11 @@ from .sdkconfiguration import SDKConfiguration import httpx -from typing import Callable, List, Optional, Tuple +from typing import Callable, List, Mapping, Optional, Tuple from unkey_py import models, utils from unkey_py._hooks import AfterErrorContext, AfterSuccessContext, BeforeRequestContext from unkey_py.utils import RetryConfig, SerializedRequestBody, get_body_content +from urllib.parse import parse_qs, urlparse class BaseSDK: @@ -14,7 +15,7 @@ class BaseSDK: def __init__(self, sdk_config: SDKConfiguration) -> None: self.sdk_configuration = sdk_config - def get_url(self, base_url, url_variables): + def _get_url(self, base_url, url_variables): sdk_url, sdk_variables = self.sdk_configuration.get_server_details() if base_url is None: @@ -25,7 +26,7 @@ def get_url(self, base_url, url_variables): return utils.template_url(base_url, url_variables) - def build_request_async( + def _build_request_async( self, method, path, @@ -44,9 +45,10 @@ def build_request_async( Callable[[], Optional[SerializedRequestBody]] ] = None, url_override: Optional[str] = None, + http_headers: Optional[Mapping[str, str]] = None, ) -> httpx.Request: client = self.sdk_configuration.async_client - return self.build_request_with_client( + return self._build_request_with_client( client, method, path, @@ -63,9 +65,10 @@ def build_request_async( timeout_ms, get_serialized_body, url_override, + http_headers, ) - def build_request( + def _build_request( self, method, path, @@ -84,9 +87,10 @@ def build_request( Callable[[], Optional[SerializedRequestBody]] ] = None, url_override: Optional[str] = None, + http_headers: Optional[Mapping[str, str]] = None, ) -> httpx.Request: client = self.sdk_configuration.client - return self.build_request_with_client( + return self._build_request_with_client( client, method, path, @@ -103,9 +107,10 @@ def build_request( timeout_ms, get_serialized_body, url_override, + http_headers, ) - def build_request_with_client( + def _build_request_with_client( self, client, method, @@ -125,13 +130,14 @@ def build_request_with_client( Callable[[], Optional[SerializedRequestBody]] ] = None, url_override: Optional[str] = None, + http_headers: Optional[Mapping[str, str]] = None, ) -> httpx.Request: query_params = {} url = url_override if url is None: url = utils.generate_url( - self.get_url(base_url, url_variables), + self._get_url(base_url, url_variables), path, request if request_has_path_params else None, _globals if request_has_path_params else None, @@ -141,6 +147,12 @@ def build_request_with_client( request if request_has_query_params else None, _globals if request_has_query_params else None, ) + else: + # Pick up the query parameter from the override so they can be + # preserved when building the request later on (necessary as of + # httpx 0.28). + parsed_override = urlparse(str(url_override)) + query_params = parse_qs(parsed_override.query, keep_blank_values=True) headers = utils.get_headers(request, _globals) headers["Accept"] = accept_header_value @@ -174,6 +186,10 @@ def build_request_with_client( ): headers["content-type"] = serialized_request_body.media_type + if http_headers is not None: + for header, value in http_headers.items(): + headers[header] = value + timeout = timeout_ms / 1000 if timeout_ms is not None else None return client.build_request( @@ -211,6 +227,10 @@ def do(): req.headers, get_body_content(req), ) + + if client is None: + raise ValueError("client is required") + http_res = client.send(req, stream=stream) except Exception as e: _, e = self.sdk_configuration.get_hooks().after_error( @@ -283,6 +303,10 @@ async def do(): req.headers, get_body_content(req), ) + + if client is None: + raise ValueError("client is required") + http_res = await client.send(req, stream=stream) except Exception as e: _, e = self.sdk_configuration.get_hooks().after_error( diff --git a/src/unkey_py/httpclient.py b/src/unkey_py/httpclient.py index 167cea4..1e42635 100644 --- a/src/unkey_py/httpclient.py +++ b/src/unkey_py/httpclient.py @@ -1,6 +1,8 @@ """Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT.""" # pyright: reportReturnType = false +import asyncio +from concurrent.futures import ThreadPoolExecutor from typing_extensions import Protocol, runtime_checkable import httpx from typing import Any, Optional, Union @@ -82,3 +84,53 @@ def build_request( async def aclose(self) -> None: pass + + +class ClientOwner(Protocol): + client: Union[HttpClient, None] + async_client: Union[AsyncHttpClient, None] + + +def close_clients( + owner: ClientOwner, + sync_client: Union[HttpClient, None], + sync_client_supplied: bool, + async_client: Union[AsyncHttpClient, None], + async_client_supplied: bool, +) -> None: + """ + A finalizer function that is meant to be used with weakref.finalize to close + httpx clients used by an SDK so that underlying resources can be garbage + collected. + """ + + # Unset the client/async_client properties so there are no more references + # to them from the owning SDK instance and they can be reaped. + owner.client = None + owner.async_client = None + + if sync_client is not None and not sync_client_supplied: + try: + sync_client.close() + except Exception: + pass + + if async_client is not None and not async_client_supplied: + is_async = False + try: + asyncio.get_running_loop() + is_async = True + except RuntimeError: + pass + + try: + # If this function is called in an async loop then start another + # loop in a separate thread to close the async http client. + if is_async: + with ThreadPoolExecutor(max_workers=1) as executor: + future = executor.submit(asyncio.run, async_client.aclose()) + future.result() + else: + asyncio.run(async_client.aclose()) + except Exception: + pass diff --git a/src/unkey_py/identities.py b/src/unkey_py/identities.py index dcf6287..afe6129 100644 --- a/src/unkey_py/identities.py +++ b/src/unkey_py/identities.py @@ -2,7 +2,7 @@ from .basesdk import BaseSDK from jsonpath import JSONPath -from typing import Any, Dict, Optional, Union, cast +from typing import Any, Dict, List, Mapping, Optional, Union, cast from unkey_py import models, utils from unkey_py._hooks import HookContext from unkey_py.types import BaseModel, OptionalNullable, UNSET @@ -19,12 +19,14 @@ def create( retries: OptionalNullable[utils.RetryConfig] = UNSET, server_url: Optional[str] = None, timeout_ms: Optional[int] = None, + http_headers: Optional[Mapping[str, str]] = None, ) -> models.CreateIdentityResponse: r""" :param request: The request object to send. :param retries: Override the default retry configuration for this method :param server_url: Override the default server URL for this method :param timeout_ms: Override the default request timeout configuration for this method in milliseconds + :param http_headers: Additional headers to set or replace on requests. """ base_url = None url_variables = None @@ -33,12 +35,14 @@ def create( if server_url is not None: base_url = server_url + else: + base_url = self._get_url(base_url, url_variables) if not isinstance(request, BaseModel): request = utils.unmarshal(request, models.CreateIdentityRequestBody) request = cast(models.CreateIdentityRequestBody, request) - req = self.build_request( + req = self._build_request( method="POST", path="/v1/identities.createIdentity", base_url=base_url, @@ -49,6 +53,7 @@ def create( request_has_query_params=True, user_agent_header="user-agent", accept_header_value="application/json", + http_headers=http_headers, security=self.sdk_configuration.security, get_serialized_body=lambda: utils.serialize_request_body( request, False, False, "json", models.CreateIdentityRequestBody @@ -70,6 +75,7 @@ def create( http_res = self.do_request( hook_ctx=HookContext( + base_url=base_url or "", operation_id="createIdentity", oauth2_scopes=[], security_source=get_security_from_env( @@ -83,6 +89,7 @@ def create( "403", "404", "409", + "412", "429", "4XX", "500", @@ -91,7 +98,7 @@ def create( retry_config=retry_config, ) - data: Any = None + response_data: Any = None if utils.match_response(http_res, "200", "application/json"): return models.CreateIdentityResponse( object=utils.unmarshal_json( @@ -100,29 +107,45 @@ def create( http_meta=models.HTTPMetadata(request=req, response=http_res), ) if utils.match_response(http_res, "400", "application/json"): - data = utils.unmarshal_json(http_res.text, models.ErrBadRequestData) - raise models.ErrBadRequest(data=data) + response_data = utils.unmarshal_json( + http_res.text, models.ErrBadRequestData + ) + raise models.ErrBadRequest(data=response_data) if utils.match_response(http_res, "401", "application/json"): - data = utils.unmarshal_json(http_res.text, models.ErrUnauthorizedData) - raise models.ErrUnauthorized(data=data) + response_data = utils.unmarshal_json( + http_res.text, models.ErrUnauthorizedData + ) + raise models.ErrUnauthorized(data=response_data) if utils.match_response(http_res, "403", "application/json"): - data = utils.unmarshal_json(http_res.text, models.ErrForbiddenData) - raise models.ErrForbidden(data=data) + response_data = utils.unmarshal_json(http_res.text, models.ErrForbiddenData) + raise models.ErrForbidden(data=response_data) if utils.match_response(http_res, "404", "application/json"): - data = utils.unmarshal_json(http_res.text, models.ErrNotFoundData) - raise models.ErrNotFound(data=data) + response_data = utils.unmarshal_json(http_res.text, models.ErrNotFoundData) + raise models.ErrNotFound(data=response_data) if utils.match_response(http_res, "409", "application/json"): - data = utils.unmarshal_json(http_res.text, models.ErrConflictData) - raise models.ErrConflict(data=data) + response_data = utils.unmarshal_json(http_res.text, models.ErrConflictData) + raise models.ErrConflict(data=response_data) + if utils.match_response(http_res, "412", "application/json"): + response_data = utils.unmarshal_json( + http_res.text, models.ErrPreconditionFailedData + ) + raise models.ErrPreconditionFailed(data=response_data) if utils.match_response(http_res, "429", "application/json"): - data = utils.unmarshal_json(http_res.text, models.ErrTooManyRequestsData) - raise models.ErrTooManyRequests(data=data) + response_data = utils.unmarshal_json( + http_res.text, models.ErrTooManyRequestsData + ) + raise models.ErrTooManyRequests(data=response_data) if utils.match_response(http_res, "500", "application/json"): - data = utils.unmarshal_json( + response_data = utils.unmarshal_json( http_res.text, models.ErrInternalServerErrorData ) - raise models.ErrInternalServerError(data=data) - if utils.match_response(http_res, ["4XX", "5XX"], "*"): + raise models.ErrInternalServerError(data=response_data) + if utils.match_response(http_res, "4XX", "*"): + http_res_text = utils.stream_to_text(http_res) + raise models.SDKError( + "API error occurred", http_res.status_code, http_res_text, http_res + ) + if utils.match_response(http_res, "5XX", "*"): http_res_text = utils.stream_to_text(http_res) raise models.SDKError( "API error occurred", http_res.status_code, http_res_text, http_res @@ -146,12 +169,14 @@ async def create_async( retries: OptionalNullable[utils.RetryConfig] = UNSET, server_url: Optional[str] = None, timeout_ms: Optional[int] = None, + http_headers: Optional[Mapping[str, str]] = None, ) -> models.CreateIdentityResponse: r""" :param request: The request object to send. :param retries: Override the default retry configuration for this method :param server_url: Override the default server URL for this method :param timeout_ms: Override the default request timeout configuration for this method in milliseconds + :param http_headers: Additional headers to set or replace on requests. """ base_url = None url_variables = None @@ -160,12 +185,14 @@ async def create_async( if server_url is not None: base_url = server_url + else: + base_url = self._get_url(base_url, url_variables) if not isinstance(request, BaseModel): request = utils.unmarshal(request, models.CreateIdentityRequestBody) request = cast(models.CreateIdentityRequestBody, request) - req = self.build_request_async( + req = self._build_request_async( method="POST", path="/v1/identities.createIdentity", base_url=base_url, @@ -176,6 +203,7 @@ async def create_async( request_has_query_params=True, user_agent_header="user-agent", accept_header_value="application/json", + http_headers=http_headers, security=self.sdk_configuration.security, get_serialized_body=lambda: utils.serialize_request_body( request, False, False, "json", models.CreateIdentityRequestBody @@ -197,6 +225,7 @@ async def create_async( http_res = await self.do_request_async( hook_ctx=HookContext( + base_url=base_url or "", operation_id="createIdentity", oauth2_scopes=[], security_source=get_security_from_env( @@ -210,6 +239,7 @@ async def create_async( "403", "404", "409", + "412", "429", "4XX", "500", @@ -218,7 +248,7 @@ async def create_async( retry_config=retry_config, ) - data: Any = None + response_data: Any = None if utils.match_response(http_res, "200", "application/json"): return models.CreateIdentityResponse( object=utils.unmarshal_json( @@ -227,29 +257,45 @@ async def create_async( http_meta=models.HTTPMetadata(request=req, response=http_res), ) if utils.match_response(http_res, "400", "application/json"): - data = utils.unmarshal_json(http_res.text, models.ErrBadRequestData) - raise models.ErrBadRequest(data=data) + response_data = utils.unmarshal_json( + http_res.text, models.ErrBadRequestData + ) + raise models.ErrBadRequest(data=response_data) if utils.match_response(http_res, "401", "application/json"): - data = utils.unmarshal_json(http_res.text, models.ErrUnauthorizedData) - raise models.ErrUnauthorized(data=data) + response_data = utils.unmarshal_json( + http_res.text, models.ErrUnauthorizedData + ) + raise models.ErrUnauthorized(data=response_data) if utils.match_response(http_res, "403", "application/json"): - data = utils.unmarshal_json(http_res.text, models.ErrForbiddenData) - raise models.ErrForbidden(data=data) + response_data = utils.unmarshal_json(http_res.text, models.ErrForbiddenData) + raise models.ErrForbidden(data=response_data) if utils.match_response(http_res, "404", "application/json"): - data = utils.unmarshal_json(http_res.text, models.ErrNotFoundData) - raise models.ErrNotFound(data=data) + response_data = utils.unmarshal_json(http_res.text, models.ErrNotFoundData) + raise models.ErrNotFound(data=response_data) if utils.match_response(http_res, "409", "application/json"): - data = utils.unmarshal_json(http_res.text, models.ErrConflictData) - raise models.ErrConflict(data=data) + response_data = utils.unmarshal_json(http_res.text, models.ErrConflictData) + raise models.ErrConflict(data=response_data) + if utils.match_response(http_res, "412", "application/json"): + response_data = utils.unmarshal_json( + http_res.text, models.ErrPreconditionFailedData + ) + raise models.ErrPreconditionFailed(data=response_data) if utils.match_response(http_res, "429", "application/json"): - data = utils.unmarshal_json(http_res.text, models.ErrTooManyRequestsData) - raise models.ErrTooManyRequests(data=data) + response_data = utils.unmarshal_json( + http_res.text, models.ErrTooManyRequestsData + ) + raise models.ErrTooManyRequests(data=response_data) if utils.match_response(http_res, "500", "application/json"): - data = utils.unmarshal_json( + response_data = utils.unmarshal_json( http_res.text, models.ErrInternalServerErrorData ) - raise models.ErrInternalServerError(data=data) - if utils.match_response(http_res, ["4XX", "5XX"], "*"): + raise models.ErrInternalServerError(data=response_data) + if utils.match_response(http_res, "4XX", "*"): + http_res_text = await utils.stream_to_text_async(http_res) + raise models.SDKError( + "API error occurred", http_res.status_code, http_res_text, http_res + ) + if utils.match_response(http_res, "5XX", "*"): http_res_text = await utils.stream_to_text_async(http_res) raise models.SDKError( "API error occurred", http_res.status_code, http_res_text, http_res @@ -272,6 +318,7 @@ def get( retries: OptionalNullable[utils.RetryConfig] = UNSET, server_url: Optional[str] = None, timeout_ms: Optional[int] = None, + http_headers: Optional[Mapping[str, str]] = None, ) -> models.GetIdentityResponse: r""" :param identity_id: @@ -279,6 +326,7 @@ def get( :param retries: Override the default retry configuration for this method :param server_url: Override the default server URL for this method :param timeout_ms: Override the default request timeout configuration for this method in milliseconds + :param http_headers: Additional headers to set or replace on requests. """ base_url = None url_variables = None @@ -287,13 +335,15 @@ def get( if server_url is not None: base_url = server_url + else: + base_url = self._get_url(base_url, url_variables) request = models.GetIdentityRequest( identity_id=identity_id, external_id=external_id, ) - req = self.build_request( + req = self._build_request( method="GET", path="/v1/identities.getIdentity", base_url=base_url, @@ -304,6 +354,7 @@ def get( request_has_query_params=True, user_agent_header="user-agent", accept_header_value="application/json", + http_headers=http_headers, security=self.sdk_configuration.security, timeout_ms=timeout_ms, ) @@ -322,6 +373,7 @@ def get( http_res = self.do_request( hook_ctx=HookContext( + base_url=base_url or "", operation_id="getIdentity", oauth2_scopes=[], security_source=get_security_from_env( @@ -335,6 +387,7 @@ def get( "403", "404", "409", + "412", "429", "4XX", "500", @@ -343,7 +396,7 @@ def get( retry_config=retry_config, ) - data: Any = None + response_data: Any = None if utils.match_response(http_res, "200", "application/json"): return models.GetIdentityResponse( object=utils.unmarshal_json( @@ -352,29 +405,45 @@ def get( http_meta=models.HTTPMetadata(request=req, response=http_res), ) if utils.match_response(http_res, "400", "application/json"): - data = utils.unmarshal_json(http_res.text, models.ErrBadRequestData) - raise models.ErrBadRequest(data=data) + response_data = utils.unmarshal_json( + http_res.text, models.ErrBadRequestData + ) + raise models.ErrBadRequest(data=response_data) if utils.match_response(http_res, "401", "application/json"): - data = utils.unmarshal_json(http_res.text, models.ErrUnauthorizedData) - raise models.ErrUnauthorized(data=data) + response_data = utils.unmarshal_json( + http_res.text, models.ErrUnauthorizedData + ) + raise models.ErrUnauthorized(data=response_data) if utils.match_response(http_res, "403", "application/json"): - data = utils.unmarshal_json(http_res.text, models.ErrForbiddenData) - raise models.ErrForbidden(data=data) + response_data = utils.unmarshal_json(http_res.text, models.ErrForbiddenData) + raise models.ErrForbidden(data=response_data) if utils.match_response(http_res, "404", "application/json"): - data = utils.unmarshal_json(http_res.text, models.ErrNotFoundData) - raise models.ErrNotFound(data=data) + response_data = utils.unmarshal_json(http_res.text, models.ErrNotFoundData) + raise models.ErrNotFound(data=response_data) if utils.match_response(http_res, "409", "application/json"): - data = utils.unmarshal_json(http_res.text, models.ErrConflictData) - raise models.ErrConflict(data=data) + response_data = utils.unmarshal_json(http_res.text, models.ErrConflictData) + raise models.ErrConflict(data=response_data) + if utils.match_response(http_res, "412", "application/json"): + response_data = utils.unmarshal_json( + http_res.text, models.ErrPreconditionFailedData + ) + raise models.ErrPreconditionFailed(data=response_data) if utils.match_response(http_res, "429", "application/json"): - data = utils.unmarshal_json(http_res.text, models.ErrTooManyRequestsData) - raise models.ErrTooManyRequests(data=data) + response_data = utils.unmarshal_json( + http_res.text, models.ErrTooManyRequestsData + ) + raise models.ErrTooManyRequests(data=response_data) if utils.match_response(http_res, "500", "application/json"): - data = utils.unmarshal_json( + response_data = utils.unmarshal_json( http_res.text, models.ErrInternalServerErrorData ) - raise models.ErrInternalServerError(data=data) - if utils.match_response(http_res, ["4XX", "5XX"], "*"): + raise models.ErrInternalServerError(data=response_data) + if utils.match_response(http_res, "4XX", "*"): + http_res_text = utils.stream_to_text(http_res) + raise models.SDKError( + "API error occurred", http_res.status_code, http_res_text, http_res + ) + if utils.match_response(http_res, "5XX", "*"): http_res_text = utils.stream_to_text(http_res) raise models.SDKError( "API error occurred", http_res.status_code, http_res_text, http_res @@ -397,6 +466,7 @@ async def get_async( retries: OptionalNullable[utils.RetryConfig] = UNSET, server_url: Optional[str] = None, timeout_ms: Optional[int] = None, + http_headers: Optional[Mapping[str, str]] = None, ) -> models.GetIdentityResponse: r""" :param identity_id: @@ -404,6 +474,7 @@ async def get_async( :param retries: Override the default retry configuration for this method :param server_url: Override the default server URL for this method :param timeout_ms: Override the default request timeout configuration for this method in milliseconds + :param http_headers: Additional headers to set or replace on requests. """ base_url = None url_variables = None @@ -412,13 +483,15 @@ async def get_async( if server_url is not None: base_url = server_url + else: + base_url = self._get_url(base_url, url_variables) request = models.GetIdentityRequest( identity_id=identity_id, external_id=external_id, ) - req = self.build_request_async( + req = self._build_request_async( method="GET", path="/v1/identities.getIdentity", base_url=base_url, @@ -429,6 +502,7 @@ async def get_async( request_has_query_params=True, user_agent_header="user-agent", accept_header_value="application/json", + http_headers=http_headers, security=self.sdk_configuration.security, timeout_ms=timeout_ms, ) @@ -447,6 +521,7 @@ async def get_async( http_res = await self.do_request_async( hook_ctx=HookContext( + base_url=base_url or "", operation_id="getIdentity", oauth2_scopes=[], security_source=get_security_from_env( @@ -460,6 +535,7 @@ async def get_async( "403", "404", "409", + "412", "429", "4XX", "500", @@ -468,7 +544,7 @@ async def get_async( retry_config=retry_config, ) - data: Any = None + response_data: Any = None if utils.match_response(http_res, "200", "application/json"): return models.GetIdentityResponse( object=utils.unmarshal_json( @@ -477,29 +553,45 @@ async def get_async( http_meta=models.HTTPMetadata(request=req, response=http_res), ) if utils.match_response(http_res, "400", "application/json"): - data = utils.unmarshal_json(http_res.text, models.ErrBadRequestData) - raise models.ErrBadRequest(data=data) + response_data = utils.unmarshal_json( + http_res.text, models.ErrBadRequestData + ) + raise models.ErrBadRequest(data=response_data) if utils.match_response(http_res, "401", "application/json"): - data = utils.unmarshal_json(http_res.text, models.ErrUnauthorizedData) - raise models.ErrUnauthorized(data=data) + response_data = utils.unmarshal_json( + http_res.text, models.ErrUnauthorizedData + ) + raise models.ErrUnauthorized(data=response_data) if utils.match_response(http_res, "403", "application/json"): - data = utils.unmarshal_json(http_res.text, models.ErrForbiddenData) - raise models.ErrForbidden(data=data) + response_data = utils.unmarshal_json(http_res.text, models.ErrForbiddenData) + raise models.ErrForbidden(data=response_data) if utils.match_response(http_res, "404", "application/json"): - data = utils.unmarshal_json(http_res.text, models.ErrNotFoundData) - raise models.ErrNotFound(data=data) + response_data = utils.unmarshal_json(http_res.text, models.ErrNotFoundData) + raise models.ErrNotFound(data=response_data) if utils.match_response(http_res, "409", "application/json"): - data = utils.unmarshal_json(http_res.text, models.ErrConflictData) - raise models.ErrConflict(data=data) + response_data = utils.unmarshal_json(http_res.text, models.ErrConflictData) + raise models.ErrConflict(data=response_data) + if utils.match_response(http_res, "412", "application/json"): + response_data = utils.unmarshal_json( + http_res.text, models.ErrPreconditionFailedData + ) + raise models.ErrPreconditionFailed(data=response_data) if utils.match_response(http_res, "429", "application/json"): - data = utils.unmarshal_json(http_res.text, models.ErrTooManyRequestsData) - raise models.ErrTooManyRequests(data=data) + response_data = utils.unmarshal_json( + http_res.text, models.ErrTooManyRequestsData + ) + raise models.ErrTooManyRequests(data=response_data) if utils.match_response(http_res, "500", "application/json"): - data = utils.unmarshal_json( + response_data = utils.unmarshal_json( http_res.text, models.ErrInternalServerErrorData ) - raise models.ErrInternalServerError(data=data) - if utils.match_response(http_res, ["4XX", "5XX"], "*"): + raise models.ErrInternalServerError(data=response_data) + if utils.match_response(http_res, "4XX", "*"): + http_res_text = await utils.stream_to_text_async(http_res) + raise models.SDKError( + "API error occurred", http_res.status_code, http_res_text, http_res + ) + if utils.match_response(http_res, "5XX", "*"): http_res_text = await utils.stream_to_text_async(http_res) raise models.SDKError( "API error occurred", http_res.status_code, http_res_text, http_res @@ -523,6 +615,7 @@ def list( retries: OptionalNullable[utils.RetryConfig] = UNSET, server_url: Optional[str] = None, timeout_ms: Optional[int] = None, + http_headers: Optional[Mapping[str, str]] = None, ) -> Optional[models.ListIdentitiesResponse]: r""" :param environment: @@ -531,6 +624,7 @@ def list( :param retries: Override the default retry configuration for this method :param server_url: Override the default server URL for this method :param timeout_ms: Override the default request timeout configuration for this method in milliseconds + :param http_headers: Additional headers to set or replace on requests. """ base_url = None url_variables = None @@ -539,6 +633,8 @@ def list( if server_url is not None: base_url = server_url + else: + base_url = self._get_url(base_url, url_variables) request = models.ListIdentitiesRequest( environment=environment, @@ -546,7 +642,7 @@ def list( cursor=cursor, ) - req = self.build_request( + req = self._build_request( method="GET", path="/v1/identities.listIdentities", base_url=base_url, @@ -557,6 +653,7 @@ def list( request_has_query_params=True, user_agent_header="user-agent", accept_header_value="application/json", + http_headers=http_headers, security=self.sdk_configuration.security, timeout_ms=timeout_ms, ) @@ -575,6 +672,7 @@ def list( http_res = self.do_request( hook_ctx=HookContext( + base_url=base_url or "", operation_id="listIdentities", oauth2_scopes=[], security_source=get_security_from_env( @@ -588,6 +686,7 @@ def list( "403", "404", "409", + "412", "429", "4XX", "500", @@ -597,12 +696,15 @@ def list( ) def next_func() -> Optional[models.ListIdentitiesResponse]: - body = utils.unmarshal_json(http_res.text, Dict[Any, Any]) + body = utils.unmarshal_json(http_res.text, Union[Dict[Any, Any], List[Any]]) next_cursor = JSONPath("$.cursor").parse(body) if len(next_cursor) == 0: return None + next_cursor = next_cursor[0] + if next_cursor is None: + return None return self.list( environment=environment, @@ -611,7 +713,7 @@ def next_func() -> Optional[models.ListIdentitiesResponse]: retries=retries, ) - data: Any = None + response_data: Any = None if utils.match_response(http_res, "200", "application/json"): return models.ListIdentitiesResponse( object=utils.unmarshal_json( @@ -621,29 +723,45 @@ def next_func() -> Optional[models.ListIdentitiesResponse]: next=next_func, ) if utils.match_response(http_res, "400", "application/json"): - data = utils.unmarshal_json(http_res.text, models.ErrBadRequestData) - raise models.ErrBadRequest(data=data) + response_data = utils.unmarshal_json( + http_res.text, models.ErrBadRequestData + ) + raise models.ErrBadRequest(data=response_data) if utils.match_response(http_res, "401", "application/json"): - data = utils.unmarshal_json(http_res.text, models.ErrUnauthorizedData) - raise models.ErrUnauthorized(data=data) + response_data = utils.unmarshal_json( + http_res.text, models.ErrUnauthorizedData + ) + raise models.ErrUnauthorized(data=response_data) if utils.match_response(http_res, "403", "application/json"): - data = utils.unmarshal_json(http_res.text, models.ErrForbiddenData) - raise models.ErrForbidden(data=data) + response_data = utils.unmarshal_json(http_res.text, models.ErrForbiddenData) + raise models.ErrForbidden(data=response_data) if utils.match_response(http_res, "404", "application/json"): - data = utils.unmarshal_json(http_res.text, models.ErrNotFoundData) - raise models.ErrNotFound(data=data) + response_data = utils.unmarshal_json(http_res.text, models.ErrNotFoundData) + raise models.ErrNotFound(data=response_data) if utils.match_response(http_res, "409", "application/json"): - data = utils.unmarshal_json(http_res.text, models.ErrConflictData) - raise models.ErrConflict(data=data) + response_data = utils.unmarshal_json(http_res.text, models.ErrConflictData) + raise models.ErrConflict(data=response_data) + if utils.match_response(http_res, "412", "application/json"): + response_data = utils.unmarshal_json( + http_res.text, models.ErrPreconditionFailedData + ) + raise models.ErrPreconditionFailed(data=response_data) if utils.match_response(http_res, "429", "application/json"): - data = utils.unmarshal_json(http_res.text, models.ErrTooManyRequestsData) - raise models.ErrTooManyRequests(data=data) + response_data = utils.unmarshal_json( + http_res.text, models.ErrTooManyRequestsData + ) + raise models.ErrTooManyRequests(data=response_data) if utils.match_response(http_res, "500", "application/json"): - data = utils.unmarshal_json( + response_data = utils.unmarshal_json( http_res.text, models.ErrInternalServerErrorData ) - raise models.ErrInternalServerError(data=data) - if utils.match_response(http_res, ["4XX", "5XX"], "*"): + raise models.ErrInternalServerError(data=response_data) + if utils.match_response(http_res, "4XX", "*"): + http_res_text = utils.stream_to_text(http_res) + raise models.SDKError( + "API error occurred", http_res.status_code, http_res_text, http_res + ) + if utils.match_response(http_res, "5XX", "*"): http_res_text = utils.stream_to_text(http_res) raise models.SDKError( "API error occurred", http_res.status_code, http_res_text, http_res @@ -667,6 +785,7 @@ async def list_async( retries: OptionalNullable[utils.RetryConfig] = UNSET, server_url: Optional[str] = None, timeout_ms: Optional[int] = None, + http_headers: Optional[Mapping[str, str]] = None, ) -> Optional[models.ListIdentitiesResponse]: r""" :param environment: @@ -675,6 +794,7 @@ async def list_async( :param retries: Override the default retry configuration for this method :param server_url: Override the default server URL for this method :param timeout_ms: Override the default request timeout configuration for this method in milliseconds + :param http_headers: Additional headers to set or replace on requests. """ base_url = None url_variables = None @@ -683,6 +803,8 @@ async def list_async( if server_url is not None: base_url = server_url + else: + base_url = self._get_url(base_url, url_variables) request = models.ListIdentitiesRequest( environment=environment, @@ -690,7 +812,7 @@ async def list_async( cursor=cursor, ) - req = self.build_request_async( + req = self._build_request_async( method="GET", path="/v1/identities.listIdentities", base_url=base_url, @@ -701,6 +823,7 @@ async def list_async( request_has_query_params=True, user_agent_header="user-agent", accept_header_value="application/json", + http_headers=http_headers, security=self.sdk_configuration.security, timeout_ms=timeout_ms, ) @@ -719,6 +842,7 @@ async def list_async( http_res = await self.do_request_async( hook_ctx=HookContext( + base_url=base_url or "", operation_id="listIdentities", oauth2_scopes=[], security_source=get_security_from_env( @@ -732,6 +856,7 @@ async def list_async( "403", "404", "409", + "412", "429", "4XX", "500", @@ -741,12 +866,15 @@ async def list_async( ) def next_func() -> Optional[models.ListIdentitiesResponse]: - body = utils.unmarshal_json(http_res.text, Dict[Any, Any]) + body = utils.unmarshal_json(http_res.text, Union[Dict[Any, Any], List[Any]]) next_cursor = JSONPath("$.cursor").parse(body) if len(next_cursor) == 0: return None + next_cursor = next_cursor[0] + if next_cursor is None: + return None return self.list( environment=environment, @@ -755,7 +883,7 @@ def next_func() -> Optional[models.ListIdentitiesResponse]: retries=retries, ) - data: Any = None + response_data: Any = None if utils.match_response(http_res, "200", "application/json"): return models.ListIdentitiesResponse( object=utils.unmarshal_json( @@ -765,29 +893,45 @@ def next_func() -> Optional[models.ListIdentitiesResponse]: next=next_func, ) if utils.match_response(http_res, "400", "application/json"): - data = utils.unmarshal_json(http_res.text, models.ErrBadRequestData) - raise models.ErrBadRequest(data=data) + response_data = utils.unmarshal_json( + http_res.text, models.ErrBadRequestData + ) + raise models.ErrBadRequest(data=response_data) if utils.match_response(http_res, "401", "application/json"): - data = utils.unmarshal_json(http_res.text, models.ErrUnauthorizedData) - raise models.ErrUnauthorized(data=data) + response_data = utils.unmarshal_json( + http_res.text, models.ErrUnauthorizedData + ) + raise models.ErrUnauthorized(data=response_data) if utils.match_response(http_res, "403", "application/json"): - data = utils.unmarshal_json(http_res.text, models.ErrForbiddenData) - raise models.ErrForbidden(data=data) + response_data = utils.unmarshal_json(http_res.text, models.ErrForbiddenData) + raise models.ErrForbidden(data=response_data) if utils.match_response(http_res, "404", "application/json"): - data = utils.unmarshal_json(http_res.text, models.ErrNotFoundData) - raise models.ErrNotFound(data=data) + response_data = utils.unmarshal_json(http_res.text, models.ErrNotFoundData) + raise models.ErrNotFound(data=response_data) if utils.match_response(http_res, "409", "application/json"): - data = utils.unmarshal_json(http_res.text, models.ErrConflictData) - raise models.ErrConflict(data=data) + response_data = utils.unmarshal_json(http_res.text, models.ErrConflictData) + raise models.ErrConflict(data=response_data) + if utils.match_response(http_res, "412", "application/json"): + response_data = utils.unmarshal_json( + http_res.text, models.ErrPreconditionFailedData + ) + raise models.ErrPreconditionFailed(data=response_data) if utils.match_response(http_res, "429", "application/json"): - data = utils.unmarshal_json(http_res.text, models.ErrTooManyRequestsData) - raise models.ErrTooManyRequests(data=data) + response_data = utils.unmarshal_json( + http_res.text, models.ErrTooManyRequestsData + ) + raise models.ErrTooManyRequests(data=response_data) if utils.match_response(http_res, "500", "application/json"): - data = utils.unmarshal_json( + response_data = utils.unmarshal_json( http_res.text, models.ErrInternalServerErrorData ) - raise models.ErrInternalServerError(data=data) - if utils.match_response(http_res, ["4XX", "5XX"], "*"): + raise models.ErrInternalServerError(data=response_data) + if utils.match_response(http_res, "4XX", "*"): + http_res_text = await utils.stream_to_text_async(http_res) + raise models.SDKError( + "API error occurred", http_res.status_code, http_res_text, http_res + ) + if utils.match_response(http_res, "5XX", "*"): http_res_text = await utils.stream_to_text_async(http_res) raise models.SDKError( "API error occurred", http_res.status_code, http_res_text, http_res @@ -811,12 +955,14 @@ def update( retries: OptionalNullable[utils.RetryConfig] = UNSET, server_url: Optional[str] = None, timeout_ms: Optional[int] = None, + http_headers: Optional[Mapping[str, str]] = None, ) -> models.UpdateIdentityResponse: r""" :param request: The request object to send. :param retries: Override the default retry configuration for this method :param server_url: Override the default server URL for this method :param timeout_ms: Override the default request timeout configuration for this method in milliseconds + :param http_headers: Additional headers to set or replace on requests. """ base_url = None url_variables = None @@ -825,12 +971,14 @@ def update( if server_url is not None: base_url = server_url + else: + base_url = self._get_url(base_url, url_variables) if not isinstance(request, BaseModel): request = utils.unmarshal(request, models.UpdateIdentityRequestBody) request = cast(models.UpdateIdentityRequestBody, request) - req = self.build_request( + req = self._build_request( method="POST", path="/v1/identities.updateIdentity", base_url=base_url, @@ -841,6 +989,7 @@ def update( request_has_query_params=True, user_agent_header="user-agent", accept_header_value="application/json", + http_headers=http_headers, security=self.sdk_configuration.security, get_serialized_body=lambda: utils.serialize_request_body( request, False, True, "json", Optional[models.UpdateIdentityRequestBody] @@ -862,6 +1011,7 @@ def update( http_res = self.do_request( hook_ctx=HookContext( + base_url=base_url or "", operation_id="updateIdentity", oauth2_scopes=[], security_source=get_security_from_env( @@ -875,6 +1025,7 @@ def update( "403", "404", "409", + "412", "429", "4XX", "500", @@ -883,7 +1034,7 @@ def update( retry_config=retry_config, ) - data: Any = None + response_data: Any = None if utils.match_response(http_res, "200", "application/json"): return models.UpdateIdentityResponse( object=utils.unmarshal_json( @@ -892,29 +1043,45 @@ def update( http_meta=models.HTTPMetadata(request=req, response=http_res), ) if utils.match_response(http_res, "400", "application/json"): - data = utils.unmarshal_json(http_res.text, models.ErrBadRequestData) - raise models.ErrBadRequest(data=data) + response_data = utils.unmarshal_json( + http_res.text, models.ErrBadRequestData + ) + raise models.ErrBadRequest(data=response_data) if utils.match_response(http_res, "401", "application/json"): - data = utils.unmarshal_json(http_res.text, models.ErrUnauthorizedData) - raise models.ErrUnauthorized(data=data) + response_data = utils.unmarshal_json( + http_res.text, models.ErrUnauthorizedData + ) + raise models.ErrUnauthorized(data=response_data) if utils.match_response(http_res, "403", "application/json"): - data = utils.unmarshal_json(http_res.text, models.ErrForbiddenData) - raise models.ErrForbidden(data=data) + response_data = utils.unmarshal_json(http_res.text, models.ErrForbiddenData) + raise models.ErrForbidden(data=response_data) if utils.match_response(http_res, "404", "application/json"): - data = utils.unmarshal_json(http_res.text, models.ErrNotFoundData) - raise models.ErrNotFound(data=data) + response_data = utils.unmarshal_json(http_res.text, models.ErrNotFoundData) + raise models.ErrNotFound(data=response_data) if utils.match_response(http_res, "409", "application/json"): - data = utils.unmarshal_json(http_res.text, models.ErrConflictData) - raise models.ErrConflict(data=data) + response_data = utils.unmarshal_json(http_res.text, models.ErrConflictData) + raise models.ErrConflict(data=response_data) + if utils.match_response(http_res, "412", "application/json"): + response_data = utils.unmarshal_json( + http_res.text, models.ErrPreconditionFailedData + ) + raise models.ErrPreconditionFailed(data=response_data) if utils.match_response(http_res, "429", "application/json"): - data = utils.unmarshal_json(http_res.text, models.ErrTooManyRequestsData) - raise models.ErrTooManyRequests(data=data) + response_data = utils.unmarshal_json( + http_res.text, models.ErrTooManyRequestsData + ) + raise models.ErrTooManyRequests(data=response_data) if utils.match_response(http_res, "500", "application/json"): - data = utils.unmarshal_json( + response_data = utils.unmarshal_json( http_res.text, models.ErrInternalServerErrorData ) - raise models.ErrInternalServerError(data=data) - if utils.match_response(http_res, ["4XX", "5XX"], "*"): + raise models.ErrInternalServerError(data=response_data) + if utils.match_response(http_res, "4XX", "*"): + http_res_text = utils.stream_to_text(http_res) + raise models.SDKError( + "API error occurred", http_res.status_code, http_res_text, http_res + ) + if utils.match_response(http_res, "5XX", "*"): http_res_text = utils.stream_to_text(http_res) raise models.SDKError( "API error occurred", http_res.status_code, http_res_text, http_res @@ -938,12 +1105,14 @@ async def update_async( retries: OptionalNullable[utils.RetryConfig] = UNSET, server_url: Optional[str] = None, timeout_ms: Optional[int] = None, + http_headers: Optional[Mapping[str, str]] = None, ) -> models.UpdateIdentityResponse: r""" :param request: The request object to send. :param retries: Override the default retry configuration for this method :param server_url: Override the default server URL for this method :param timeout_ms: Override the default request timeout configuration for this method in milliseconds + :param http_headers: Additional headers to set or replace on requests. """ base_url = None url_variables = None @@ -952,12 +1121,14 @@ async def update_async( if server_url is not None: base_url = server_url + else: + base_url = self._get_url(base_url, url_variables) if not isinstance(request, BaseModel): request = utils.unmarshal(request, models.UpdateIdentityRequestBody) request = cast(models.UpdateIdentityRequestBody, request) - req = self.build_request_async( + req = self._build_request_async( method="POST", path="/v1/identities.updateIdentity", base_url=base_url, @@ -968,6 +1139,7 @@ async def update_async( request_has_query_params=True, user_agent_header="user-agent", accept_header_value="application/json", + http_headers=http_headers, security=self.sdk_configuration.security, get_serialized_body=lambda: utils.serialize_request_body( request, False, True, "json", Optional[models.UpdateIdentityRequestBody] @@ -989,6 +1161,7 @@ async def update_async( http_res = await self.do_request_async( hook_ctx=HookContext( + base_url=base_url or "", operation_id="updateIdentity", oauth2_scopes=[], security_source=get_security_from_env( @@ -1002,6 +1175,7 @@ async def update_async( "403", "404", "409", + "412", "429", "4XX", "500", @@ -1010,7 +1184,7 @@ async def update_async( retry_config=retry_config, ) - data: Any = None + response_data: Any = None if utils.match_response(http_res, "200", "application/json"): return models.UpdateIdentityResponse( object=utils.unmarshal_json( @@ -1019,29 +1193,45 @@ async def update_async( http_meta=models.HTTPMetadata(request=req, response=http_res), ) if utils.match_response(http_res, "400", "application/json"): - data = utils.unmarshal_json(http_res.text, models.ErrBadRequestData) - raise models.ErrBadRequest(data=data) + response_data = utils.unmarshal_json( + http_res.text, models.ErrBadRequestData + ) + raise models.ErrBadRequest(data=response_data) if utils.match_response(http_res, "401", "application/json"): - data = utils.unmarshal_json(http_res.text, models.ErrUnauthorizedData) - raise models.ErrUnauthorized(data=data) + response_data = utils.unmarshal_json( + http_res.text, models.ErrUnauthorizedData + ) + raise models.ErrUnauthorized(data=response_data) if utils.match_response(http_res, "403", "application/json"): - data = utils.unmarshal_json(http_res.text, models.ErrForbiddenData) - raise models.ErrForbidden(data=data) + response_data = utils.unmarshal_json(http_res.text, models.ErrForbiddenData) + raise models.ErrForbidden(data=response_data) if utils.match_response(http_res, "404", "application/json"): - data = utils.unmarshal_json(http_res.text, models.ErrNotFoundData) - raise models.ErrNotFound(data=data) + response_data = utils.unmarshal_json(http_res.text, models.ErrNotFoundData) + raise models.ErrNotFound(data=response_data) if utils.match_response(http_res, "409", "application/json"): - data = utils.unmarshal_json(http_res.text, models.ErrConflictData) - raise models.ErrConflict(data=data) + response_data = utils.unmarshal_json(http_res.text, models.ErrConflictData) + raise models.ErrConflict(data=response_data) + if utils.match_response(http_res, "412", "application/json"): + response_data = utils.unmarshal_json( + http_res.text, models.ErrPreconditionFailedData + ) + raise models.ErrPreconditionFailed(data=response_data) if utils.match_response(http_res, "429", "application/json"): - data = utils.unmarshal_json(http_res.text, models.ErrTooManyRequestsData) - raise models.ErrTooManyRequests(data=data) + response_data = utils.unmarshal_json( + http_res.text, models.ErrTooManyRequestsData + ) + raise models.ErrTooManyRequests(data=response_data) if utils.match_response(http_res, "500", "application/json"): - data = utils.unmarshal_json( + response_data = utils.unmarshal_json( http_res.text, models.ErrInternalServerErrorData ) - raise models.ErrInternalServerError(data=data) - if utils.match_response(http_res, ["4XX", "5XX"], "*"): + raise models.ErrInternalServerError(data=response_data) + if utils.match_response(http_res, "4XX", "*"): + http_res_text = await utils.stream_to_text_async(http_res) + raise models.SDKError( + "API error occurred", http_res.status_code, http_res_text, http_res + ) + if utils.match_response(http_res, "5XX", "*"): http_res_text = await utils.stream_to_text_async(http_res) raise models.SDKError( "API error occurred", http_res.status_code, http_res_text, http_res @@ -1065,12 +1255,14 @@ def delete( retries: OptionalNullable[utils.RetryConfig] = UNSET, server_url: Optional[str] = None, timeout_ms: Optional[int] = None, + http_headers: Optional[Mapping[str, str]] = None, ) -> models.DeleteIdentityResponse: r""" :param request: The request object to send. :param retries: Override the default retry configuration for this method :param server_url: Override the default server URL for this method :param timeout_ms: Override the default request timeout configuration for this method in milliseconds + :param http_headers: Additional headers to set or replace on requests. """ base_url = None url_variables = None @@ -1079,12 +1271,14 @@ def delete( if server_url is not None: base_url = server_url + else: + base_url = self._get_url(base_url, url_variables) if not isinstance(request, BaseModel): request = utils.unmarshal(request, models.DeleteIdentityRequestBody) request = cast(models.DeleteIdentityRequestBody, request) - req = self.build_request( + req = self._build_request( method="POST", path="/v1/identities.deleteIdentity", base_url=base_url, @@ -1095,6 +1289,7 @@ def delete( request_has_query_params=True, user_agent_header="user-agent", accept_header_value="application/json", + http_headers=http_headers, security=self.sdk_configuration.security, get_serialized_body=lambda: utils.serialize_request_body( request, False, False, "json", models.DeleteIdentityRequestBody @@ -1116,6 +1311,7 @@ def delete( http_res = self.do_request( hook_ctx=HookContext( + base_url=base_url or "", operation_id="deleteIdentity", oauth2_scopes=[], security_source=get_security_from_env( @@ -1129,6 +1325,7 @@ def delete( "403", "404", "409", + "412", "429", "4XX", "500", @@ -1137,7 +1334,7 @@ def delete( retry_config=retry_config, ) - data: Any = None + response_data: Any = None if utils.match_response(http_res, "200", "application/json"): return models.DeleteIdentityResponse( object=utils.unmarshal_json( @@ -1146,29 +1343,45 @@ def delete( http_meta=models.HTTPMetadata(request=req, response=http_res), ) if utils.match_response(http_res, "400", "application/json"): - data = utils.unmarshal_json(http_res.text, models.ErrBadRequestData) - raise models.ErrBadRequest(data=data) + response_data = utils.unmarshal_json( + http_res.text, models.ErrBadRequestData + ) + raise models.ErrBadRequest(data=response_data) if utils.match_response(http_res, "401", "application/json"): - data = utils.unmarshal_json(http_res.text, models.ErrUnauthorizedData) - raise models.ErrUnauthorized(data=data) + response_data = utils.unmarshal_json( + http_res.text, models.ErrUnauthorizedData + ) + raise models.ErrUnauthorized(data=response_data) if utils.match_response(http_res, "403", "application/json"): - data = utils.unmarshal_json(http_res.text, models.ErrForbiddenData) - raise models.ErrForbidden(data=data) + response_data = utils.unmarshal_json(http_res.text, models.ErrForbiddenData) + raise models.ErrForbidden(data=response_data) if utils.match_response(http_res, "404", "application/json"): - data = utils.unmarshal_json(http_res.text, models.ErrNotFoundData) - raise models.ErrNotFound(data=data) + response_data = utils.unmarshal_json(http_res.text, models.ErrNotFoundData) + raise models.ErrNotFound(data=response_data) if utils.match_response(http_res, "409", "application/json"): - data = utils.unmarshal_json(http_res.text, models.ErrConflictData) - raise models.ErrConflict(data=data) + response_data = utils.unmarshal_json(http_res.text, models.ErrConflictData) + raise models.ErrConflict(data=response_data) + if utils.match_response(http_res, "412", "application/json"): + response_data = utils.unmarshal_json( + http_res.text, models.ErrPreconditionFailedData + ) + raise models.ErrPreconditionFailed(data=response_data) if utils.match_response(http_res, "429", "application/json"): - data = utils.unmarshal_json(http_res.text, models.ErrTooManyRequestsData) - raise models.ErrTooManyRequests(data=data) + response_data = utils.unmarshal_json( + http_res.text, models.ErrTooManyRequestsData + ) + raise models.ErrTooManyRequests(data=response_data) if utils.match_response(http_res, "500", "application/json"): - data = utils.unmarshal_json( + response_data = utils.unmarshal_json( http_res.text, models.ErrInternalServerErrorData ) - raise models.ErrInternalServerError(data=data) - if utils.match_response(http_res, ["4XX", "5XX"], "*"): + raise models.ErrInternalServerError(data=response_data) + if utils.match_response(http_res, "4XX", "*"): + http_res_text = utils.stream_to_text(http_res) + raise models.SDKError( + "API error occurred", http_res.status_code, http_res_text, http_res + ) + if utils.match_response(http_res, "5XX", "*"): http_res_text = utils.stream_to_text(http_res) raise models.SDKError( "API error occurred", http_res.status_code, http_res_text, http_res @@ -1192,12 +1405,14 @@ async def delete_async( retries: OptionalNullable[utils.RetryConfig] = UNSET, server_url: Optional[str] = None, timeout_ms: Optional[int] = None, + http_headers: Optional[Mapping[str, str]] = None, ) -> models.DeleteIdentityResponse: r""" :param request: The request object to send. :param retries: Override the default retry configuration for this method :param server_url: Override the default server URL for this method :param timeout_ms: Override the default request timeout configuration for this method in milliseconds + :param http_headers: Additional headers to set or replace on requests. """ base_url = None url_variables = None @@ -1206,12 +1421,14 @@ async def delete_async( if server_url is not None: base_url = server_url + else: + base_url = self._get_url(base_url, url_variables) if not isinstance(request, BaseModel): request = utils.unmarshal(request, models.DeleteIdentityRequestBody) request = cast(models.DeleteIdentityRequestBody, request) - req = self.build_request_async( + req = self._build_request_async( method="POST", path="/v1/identities.deleteIdentity", base_url=base_url, @@ -1222,6 +1439,7 @@ async def delete_async( request_has_query_params=True, user_agent_header="user-agent", accept_header_value="application/json", + http_headers=http_headers, security=self.sdk_configuration.security, get_serialized_body=lambda: utils.serialize_request_body( request, False, False, "json", models.DeleteIdentityRequestBody @@ -1243,6 +1461,7 @@ async def delete_async( http_res = await self.do_request_async( hook_ctx=HookContext( + base_url=base_url or "", operation_id="deleteIdentity", oauth2_scopes=[], security_source=get_security_from_env( @@ -1256,6 +1475,7 @@ async def delete_async( "403", "404", "409", + "412", "429", "4XX", "500", @@ -1264,7 +1484,7 @@ async def delete_async( retry_config=retry_config, ) - data: Any = None + response_data: Any = None if utils.match_response(http_res, "200", "application/json"): return models.DeleteIdentityResponse( object=utils.unmarshal_json( @@ -1273,29 +1493,45 @@ async def delete_async( http_meta=models.HTTPMetadata(request=req, response=http_res), ) if utils.match_response(http_res, "400", "application/json"): - data = utils.unmarshal_json(http_res.text, models.ErrBadRequestData) - raise models.ErrBadRequest(data=data) + response_data = utils.unmarshal_json( + http_res.text, models.ErrBadRequestData + ) + raise models.ErrBadRequest(data=response_data) if utils.match_response(http_res, "401", "application/json"): - data = utils.unmarshal_json(http_res.text, models.ErrUnauthorizedData) - raise models.ErrUnauthorized(data=data) + response_data = utils.unmarshal_json( + http_res.text, models.ErrUnauthorizedData + ) + raise models.ErrUnauthorized(data=response_data) if utils.match_response(http_res, "403", "application/json"): - data = utils.unmarshal_json(http_res.text, models.ErrForbiddenData) - raise models.ErrForbidden(data=data) + response_data = utils.unmarshal_json(http_res.text, models.ErrForbiddenData) + raise models.ErrForbidden(data=response_data) if utils.match_response(http_res, "404", "application/json"): - data = utils.unmarshal_json(http_res.text, models.ErrNotFoundData) - raise models.ErrNotFound(data=data) + response_data = utils.unmarshal_json(http_res.text, models.ErrNotFoundData) + raise models.ErrNotFound(data=response_data) if utils.match_response(http_res, "409", "application/json"): - data = utils.unmarshal_json(http_res.text, models.ErrConflictData) - raise models.ErrConflict(data=data) + response_data = utils.unmarshal_json(http_res.text, models.ErrConflictData) + raise models.ErrConflict(data=response_data) + if utils.match_response(http_res, "412", "application/json"): + response_data = utils.unmarshal_json( + http_res.text, models.ErrPreconditionFailedData + ) + raise models.ErrPreconditionFailed(data=response_data) if utils.match_response(http_res, "429", "application/json"): - data = utils.unmarshal_json(http_res.text, models.ErrTooManyRequestsData) - raise models.ErrTooManyRequests(data=data) + response_data = utils.unmarshal_json( + http_res.text, models.ErrTooManyRequestsData + ) + raise models.ErrTooManyRequests(data=response_data) if utils.match_response(http_res, "500", "application/json"): - data = utils.unmarshal_json( + response_data = utils.unmarshal_json( http_res.text, models.ErrInternalServerErrorData ) - raise models.ErrInternalServerError(data=data) - if utils.match_response(http_res, ["4XX", "5XX"], "*"): + raise models.ErrInternalServerError(data=response_data) + if utils.match_response(http_res, "4XX", "*"): + http_res_text = await utils.stream_to_text_async(http_res) + raise models.SDKError( + "API error occurred", http_res.status_code, http_res_text, http_res + ) + if utils.match_response(http_res, "5XX", "*"): http_res_text = await utils.stream_to_text_async(http_res) raise models.SDKError( "API error occurred", http_res.status_code, http_res_text, http_res diff --git a/src/unkey_py/keys.py b/src/unkey_py/keys.py index 36e98fe..fdefe83 100644 --- a/src/unkey_py/keys.py +++ b/src/unkey_py/keys.py @@ -1,7 +1,7 @@ """Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT.""" from .basesdk import BaseSDK -from typing import Any, List, Optional, Union, cast +from typing import Any, List, Mapping, Optional, Union, cast from unkey_py import models, utils from unkey_py._hooks import HookContext from unkey_py.types import BaseModel, OptionalNullable, UNSET @@ -17,6 +17,7 @@ def get( retries: OptionalNullable[utils.RetryConfig] = UNSET, server_url: Optional[str] = None, timeout_ms: Optional[int] = None, + http_headers: Optional[Mapping[str, str]] = None, ) -> models.GetKeyResponse: r""" :param key_id: @@ -24,6 +25,7 @@ def get( :param retries: Override the default retry configuration for this method :param server_url: Override the default server URL for this method :param timeout_ms: Override the default request timeout configuration for this method in milliseconds + :param http_headers: Additional headers to set or replace on requests. """ base_url = None url_variables = None @@ -32,13 +34,15 @@ def get( if server_url is not None: base_url = server_url + else: + base_url = self._get_url(base_url, url_variables) request = models.GetKeyRequest( key_id=key_id, decrypt=decrypt, ) - req = self.build_request( + req = self._build_request( method="GET", path="/v1/keys.getKey", base_url=base_url, @@ -49,6 +53,7 @@ def get( request_has_query_params=True, user_agent_header="user-agent", accept_header_value="application/json", + http_headers=http_headers, security=self.sdk_configuration.security, timeout_ms=timeout_ms, ) @@ -67,6 +72,7 @@ def get( http_res = self.do_request( hook_ctx=HookContext( + base_url=base_url or "", operation_id="getKey", oauth2_scopes=[], security_source=get_security_from_env( @@ -80,6 +86,7 @@ def get( "403", "404", "409", + "412", "429", "4XX", "500", @@ -88,36 +95,52 @@ def get( retry_config=retry_config, ) - data: Any = None + response_data: Any = None if utils.match_response(http_res, "200", "application/json"): return models.GetKeyResponse( key=utils.unmarshal_json(http_res.text, Optional[models.Key]), http_meta=models.HTTPMetadata(request=req, response=http_res), ) if utils.match_response(http_res, "400", "application/json"): - data = utils.unmarshal_json(http_res.text, models.ErrBadRequestData) - raise models.ErrBadRequest(data=data) + response_data = utils.unmarshal_json( + http_res.text, models.ErrBadRequestData + ) + raise models.ErrBadRequest(data=response_data) if utils.match_response(http_res, "401", "application/json"): - data = utils.unmarshal_json(http_res.text, models.ErrUnauthorizedData) - raise models.ErrUnauthorized(data=data) + response_data = utils.unmarshal_json( + http_res.text, models.ErrUnauthorizedData + ) + raise models.ErrUnauthorized(data=response_data) if utils.match_response(http_res, "403", "application/json"): - data = utils.unmarshal_json(http_res.text, models.ErrForbiddenData) - raise models.ErrForbidden(data=data) + response_data = utils.unmarshal_json(http_res.text, models.ErrForbiddenData) + raise models.ErrForbidden(data=response_data) if utils.match_response(http_res, "404", "application/json"): - data = utils.unmarshal_json(http_res.text, models.ErrNotFoundData) - raise models.ErrNotFound(data=data) + response_data = utils.unmarshal_json(http_res.text, models.ErrNotFoundData) + raise models.ErrNotFound(data=response_data) if utils.match_response(http_res, "409", "application/json"): - data = utils.unmarshal_json(http_res.text, models.ErrConflictData) - raise models.ErrConflict(data=data) + response_data = utils.unmarshal_json(http_res.text, models.ErrConflictData) + raise models.ErrConflict(data=response_data) + if utils.match_response(http_res, "412", "application/json"): + response_data = utils.unmarshal_json( + http_res.text, models.ErrPreconditionFailedData + ) + raise models.ErrPreconditionFailed(data=response_data) if utils.match_response(http_res, "429", "application/json"): - data = utils.unmarshal_json(http_res.text, models.ErrTooManyRequestsData) - raise models.ErrTooManyRequests(data=data) + response_data = utils.unmarshal_json( + http_res.text, models.ErrTooManyRequestsData + ) + raise models.ErrTooManyRequests(data=response_data) if utils.match_response(http_res, "500", "application/json"): - data = utils.unmarshal_json( + response_data = utils.unmarshal_json( http_res.text, models.ErrInternalServerErrorData ) - raise models.ErrInternalServerError(data=data) - if utils.match_response(http_res, ["4XX", "5XX"], "*"): + raise models.ErrInternalServerError(data=response_data) + if utils.match_response(http_res, "4XX", "*"): + http_res_text = utils.stream_to_text(http_res) + raise models.SDKError( + "API error occurred", http_res.status_code, http_res_text, http_res + ) + if utils.match_response(http_res, "5XX", "*"): http_res_text = utils.stream_to_text(http_res) raise models.SDKError( "API error occurred", http_res.status_code, http_res_text, http_res @@ -140,6 +163,7 @@ async def get_async( retries: OptionalNullable[utils.RetryConfig] = UNSET, server_url: Optional[str] = None, timeout_ms: Optional[int] = None, + http_headers: Optional[Mapping[str, str]] = None, ) -> models.GetKeyResponse: r""" :param key_id: @@ -147,6 +171,7 @@ async def get_async( :param retries: Override the default retry configuration for this method :param server_url: Override the default server URL for this method :param timeout_ms: Override the default request timeout configuration for this method in milliseconds + :param http_headers: Additional headers to set or replace on requests. """ base_url = None url_variables = None @@ -155,13 +180,15 @@ async def get_async( if server_url is not None: base_url = server_url + else: + base_url = self._get_url(base_url, url_variables) request = models.GetKeyRequest( key_id=key_id, decrypt=decrypt, ) - req = self.build_request_async( + req = self._build_request_async( method="GET", path="/v1/keys.getKey", base_url=base_url, @@ -172,6 +199,7 @@ async def get_async( request_has_query_params=True, user_agent_header="user-agent", accept_header_value="application/json", + http_headers=http_headers, security=self.sdk_configuration.security, timeout_ms=timeout_ms, ) @@ -190,6 +218,7 @@ async def get_async( http_res = await self.do_request_async( hook_ctx=HookContext( + base_url=base_url or "", operation_id="getKey", oauth2_scopes=[], security_source=get_security_from_env( @@ -203,6 +232,7 @@ async def get_async( "403", "404", "409", + "412", "429", "4XX", "500", @@ -211,36 +241,52 @@ async def get_async( retry_config=retry_config, ) - data: Any = None + response_data: Any = None if utils.match_response(http_res, "200", "application/json"): return models.GetKeyResponse( key=utils.unmarshal_json(http_res.text, Optional[models.Key]), http_meta=models.HTTPMetadata(request=req, response=http_res), ) if utils.match_response(http_res, "400", "application/json"): - data = utils.unmarshal_json(http_res.text, models.ErrBadRequestData) - raise models.ErrBadRequest(data=data) + response_data = utils.unmarshal_json( + http_res.text, models.ErrBadRequestData + ) + raise models.ErrBadRequest(data=response_data) if utils.match_response(http_res, "401", "application/json"): - data = utils.unmarshal_json(http_res.text, models.ErrUnauthorizedData) - raise models.ErrUnauthorized(data=data) + response_data = utils.unmarshal_json( + http_res.text, models.ErrUnauthorizedData + ) + raise models.ErrUnauthorized(data=response_data) if utils.match_response(http_res, "403", "application/json"): - data = utils.unmarshal_json(http_res.text, models.ErrForbiddenData) - raise models.ErrForbidden(data=data) + response_data = utils.unmarshal_json(http_res.text, models.ErrForbiddenData) + raise models.ErrForbidden(data=response_data) if utils.match_response(http_res, "404", "application/json"): - data = utils.unmarshal_json(http_res.text, models.ErrNotFoundData) - raise models.ErrNotFound(data=data) + response_data = utils.unmarshal_json(http_res.text, models.ErrNotFoundData) + raise models.ErrNotFound(data=response_data) if utils.match_response(http_res, "409", "application/json"): - data = utils.unmarshal_json(http_res.text, models.ErrConflictData) - raise models.ErrConflict(data=data) + response_data = utils.unmarshal_json(http_res.text, models.ErrConflictData) + raise models.ErrConflict(data=response_data) + if utils.match_response(http_res, "412", "application/json"): + response_data = utils.unmarshal_json( + http_res.text, models.ErrPreconditionFailedData + ) + raise models.ErrPreconditionFailed(data=response_data) if utils.match_response(http_res, "429", "application/json"): - data = utils.unmarshal_json(http_res.text, models.ErrTooManyRequestsData) - raise models.ErrTooManyRequests(data=data) + response_data = utils.unmarshal_json( + http_res.text, models.ErrTooManyRequestsData + ) + raise models.ErrTooManyRequests(data=response_data) if utils.match_response(http_res, "500", "application/json"): - data = utils.unmarshal_json( + response_data = utils.unmarshal_json( http_res.text, models.ErrInternalServerErrorData ) - raise models.ErrInternalServerError(data=data) - if utils.match_response(http_res, ["4XX", "5XX"], "*"): + raise models.ErrInternalServerError(data=response_data) + if utils.match_response(http_res, "4XX", "*"): + http_res_text = await utils.stream_to_text_async(http_res) + raise models.SDKError( + "API error occurred", http_res.status_code, http_res_text, http_res + ) + if utils.match_response(http_res, "5XX", "*"): http_res_text = await utils.stream_to_text_async(http_res) raise models.SDKError( "API error occurred", http_res.status_code, http_res_text, http_res @@ -262,12 +308,14 @@ def whoami( retries: OptionalNullable[utils.RetryConfig] = UNSET, server_url: Optional[str] = None, timeout_ms: Optional[int] = None, + http_headers: Optional[Mapping[str, str]] = None, ) -> models.WhoamiResponse: r""" :param request: The request object to send. :param retries: Override the default retry configuration for this method :param server_url: Override the default server URL for this method :param timeout_ms: Override the default request timeout configuration for this method in milliseconds + :param http_headers: Additional headers to set or replace on requests. """ base_url = None url_variables = None @@ -276,12 +324,14 @@ def whoami( if server_url is not None: base_url = server_url + else: + base_url = self._get_url(base_url, url_variables) if not isinstance(request, BaseModel): request = utils.unmarshal(request, models.WhoamiRequestBody) request = cast(models.WhoamiRequestBody, request) - req = self.build_request( + req = self._build_request( method="POST", path="/v1/keys.whoami", base_url=base_url, @@ -292,6 +342,7 @@ def whoami( request_has_query_params=True, user_agent_header="user-agent", accept_header_value="application/json", + http_headers=http_headers, security=self.sdk_configuration.security, get_serialized_body=lambda: utils.serialize_request_body( request, False, False, "json", models.WhoamiRequestBody @@ -313,6 +364,7 @@ def whoami( http_res = self.do_request( hook_ctx=HookContext( + base_url=base_url or "", operation_id="whoami", oauth2_scopes=[], security_source=get_security_from_env( @@ -326,6 +378,7 @@ def whoami( "403", "404", "409", + "412", "429", "4XX", "500", @@ -334,7 +387,7 @@ def whoami( retry_config=retry_config, ) - data: Any = None + response_data: Any = None if utils.match_response(http_res, "200", "application/json"): return models.WhoamiResponse( object=utils.unmarshal_json( @@ -343,29 +396,45 @@ def whoami( http_meta=models.HTTPMetadata(request=req, response=http_res), ) if utils.match_response(http_res, "400", "application/json"): - data = utils.unmarshal_json(http_res.text, models.ErrBadRequestData) - raise models.ErrBadRequest(data=data) + response_data = utils.unmarshal_json( + http_res.text, models.ErrBadRequestData + ) + raise models.ErrBadRequest(data=response_data) if utils.match_response(http_res, "401", "application/json"): - data = utils.unmarshal_json(http_res.text, models.ErrUnauthorizedData) - raise models.ErrUnauthorized(data=data) + response_data = utils.unmarshal_json( + http_res.text, models.ErrUnauthorizedData + ) + raise models.ErrUnauthorized(data=response_data) if utils.match_response(http_res, "403", "application/json"): - data = utils.unmarshal_json(http_res.text, models.ErrForbiddenData) - raise models.ErrForbidden(data=data) + response_data = utils.unmarshal_json(http_res.text, models.ErrForbiddenData) + raise models.ErrForbidden(data=response_data) if utils.match_response(http_res, "404", "application/json"): - data = utils.unmarshal_json(http_res.text, models.ErrNotFoundData) - raise models.ErrNotFound(data=data) + response_data = utils.unmarshal_json(http_res.text, models.ErrNotFoundData) + raise models.ErrNotFound(data=response_data) if utils.match_response(http_res, "409", "application/json"): - data = utils.unmarshal_json(http_res.text, models.ErrConflictData) - raise models.ErrConflict(data=data) + response_data = utils.unmarshal_json(http_res.text, models.ErrConflictData) + raise models.ErrConflict(data=response_data) + if utils.match_response(http_res, "412", "application/json"): + response_data = utils.unmarshal_json( + http_res.text, models.ErrPreconditionFailedData + ) + raise models.ErrPreconditionFailed(data=response_data) if utils.match_response(http_res, "429", "application/json"): - data = utils.unmarshal_json(http_res.text, models.ErrTooManyRequestsData) - raise models.ErrTooManyRequests(data=data) + response_data = utils.unmarshal_json( + http_res.text, models.ErrTooManyRequestsData + ) + raise models.ErrTooManyRequests(data=response_data) if utils.match_response(http_res, "500", "application/json"): - data = utils.unmarshal_json( + response_data = utils.unmarshal_json( http_res.text, models.ErrInternalServerErrorData ) - raise models.ErrInternalServerError(data=data) - if utils.match_response(http_res, ["4XX", "5XX"], "*"): + raise models.ErrInternalServerError(data=response_data) + if utils.match_response(http_res, "4XX", "*"): + http_res_text = utils.stream_to_text(http_res) + raise models.SDKError( + "API error occurred", http_res.status_code, http_res_text, http_res + ) + if utils.match_response(http_res, "5XX", "*"): http_res_text = utils.stream_to_text(http_res) raise models.SDKError( "API error occurred", http_res.status_code, http_res_text, http_res @@ -387,12 +456,14 @@ async def whoami_async( retries: OptionalNullable[utils.RetryConfig] = UNSET, server_url: Optional[str] = None, timeout_ms: Optional[int] = None, + http_headers: Optional[Mapping[str, str]] = None, ) -> models.WhoamiResponse: r""" :param request: The request object to send. :param retries: Override the default retry configuration for this method :param server_url: Override the default server URL for this method :param timeout_ms: Override the default request timeout configuration for this method in milliseconds + :param http_headers: Additional headers to set or replace on requests. """ base_url = None url_variables = None @@ -401,12 +472,14 @@ async def whoami_async( if server_url is not None: base_url = server_url + else: + base_url = self._get_url(base_url, url_variables) if not isinstance(request, BaseModel): request = utils.unmarshal(request, models.WhoamiRequestBody) request = cast(models.WhoamiRequestBody, request) - req = self.build_request_async( + req = self._build_request_async( method="POST", path="/v1/keys.whoami", base_url=base_url, @@ -417,6 +490,7 @@ async def whoami_async( request_has_query_params=True, user_agent_header="user-agent", accept_header_value="application/json", + http_headers=http_headers, security=self.sdk_configuration.security, get_serialized_body=lambda: utils.serialize_request_body( request, False, False, "json", models.WhoamiRequestBody @@ -438,6 +512,7 @@ async def whoami_async( http_res = await self.do_request_async( hook_ctx=HookContext( + base_url=base_url or "", operation_id="whoami", oauth2_scopes=[], security_source=get_security_from_env( @@ -451,6 +526,7 @@ async def whoami_async( "403", "404", "409", + "412", "429", "4XX", "500", @@ -459,7 +535,7 @@ async def whoami_async( retry_config=retry_config, ) - data: Any = None + response_data: Any = None if utils.match_response(http_res, "200", "application/json"): return models.WhoamiResponse( object=utils.unmarshal_json( @@ -468,29 +544,45 @@ async def whoami_async( http_meta=models.HTTPMetadata(request=req, response=http_res), ) if utils.match_response(http_res, "400", "application/json"): - data = utils.unmarshal_json(http_res.text, models.ErrBadRequestData) - raise models.ErrBadRequest(data=data) + response_data = utils.unmarshal_json( + http_res.text, models.ErrBadRequestData + ) + raise models.ErrBadRequest(data=response_data) if utils.match_response(http_res, "401", "application/json"): - data = utils.unmarshal_json(http_res.text, models.ErrUnauthorizedData) - raise models.ErrUnauthorized(data=data) + response_data = utils.unmarshal_json( + http_res.text, models.ErrUnauthorizedData + ) + raise models.ErrUnauthorized(data=response_data) if utils.match_response(http_res, "403", "application/json"): - data = utils.unmarshal_json(http_res.text, models.ErrForbiddenData) - raise models.ErrForbidden(data=data) + response_data = utils.unmarshal_json(http_res.text, models.ErrForbiddenData) + raise models.ErrForbidden(data=response_data) if utils.match_response(http_res, "404", "application/json"): - data = utils.unmarshal_json(http_res.text, models.ErrNotFoundData) - raise models.ErrNotFound(data=data) + response_data = utils.unmarshal_json(http_res.text, models.ErrNotFoundData) + raise models.ErrNotFound(data=response_data) if utils.match_response(http_res, "409", "application/json"): - data = utils.unmarshal_json(http_res.text, models.ErrConflictData) - raise models.ErrConflict(data=data) + response_data = utils.unmarshal_json(http_res.text, models.ErrConflictData) + raise models.ErrConflict(data=response_data) + if utils.match_response(http_res, "412", "application/json"): + response_data = utils.unmarshal_json( + http_res.text, models.ErrPreconditionFailedData + ) + raise models.ErrPreconditionFailed(data=response_data) if utils.match_response(http_res, "429", "application/json"): - data = utils.unmarshal_json(http_res.text, models.ErrTooManyRequestsData) - raise models.ErrTooManyRequests(data=data) + response_data = utils.unmarshal_json( + http_res.text, models.ErrTooManyRequestsData + ) + raise models.ErrTooManyRequests(data=response_data) if utils.match_response(http_res, "500", "application/json"): - data = utils.unmarshal_json( + response_data = utils.unmarshal_json( http_res.text, models.ErrInternalServerErrorData ) - raise models.ErrInternalServerError(data=data) - if utils.match_response(http_res, ["4XX", "5XX"], "*"): + raise models.ErrInternalServerError(data=response_data) + if utils.match_response(http_res, "4XX", "*"): + http_res_text = await utils.stream_to_text_async(http_res) + raise models.SDKError( + "API error occurred", http_res.status_code, http_res_text, http_res + ) + if utils.match_response(http_res, "5XX", "*"): http_res_text = await utils.stream_to_text_async(http_res) raise models.SDKError( "API error occurred", http_res.status_code, http_res_text, http_res @@ -514,12 +606,14 @@ def delete( retries: OptionalNullable[utils.RetryConfig] = UNSET, server_url: Optional[str] = None, timeout_ms: Optional[int] = None, + http_headers: Optional[Mapping[str, str]] = None, ) -> models.DeleteKeyResponse: r""" :param request: The request object to send. :param retries: Override the default retry configuration for this method :param server_url: Override the default server URL for this method :param timeout_ms: Override the default request timeout configuration for this method in milliseconds + :param http_headers: Additional headers to set or replace on requests. """ base_url = None url_variables = None @@ -528,12 +622,14 @@ def delete( if server_url is not None: base_url = server_url + else: + base_url = self._get_url(base_url, url_variables) if not isinstance(request, BaseModel): request = utils.unmarshal(request, models.DeleteKeyRequestBody) request = cast(models.DeleteKeyRequestBody, request) - req = self.build_request( + req = self._build_request( method="POST", path="/v1/keys.deleteKey", base_url=base_url, @@ -544,6 +640,7 @@ def delete( request_has_query_params=True, user_agent_header="user-agent", accept_header_value="application/json", + http_headers=http_headers, security=self.sdk_configuration.security, get_serialized_body=lambda: utils.serialize_request_body( request, False, False, "json", models.DeleteKeyRequestBody @@ -565,6 +662,7 @@ def delete( http_res = self.do_request( hook_ctx=HookContext( + base_url=base_url or "", operation_id="deleteKey", oauth2_scopes=[], security_source=get_security_from_env( @@ -578,6 +676,7 @@ def delete( "403", "404", "409", + "412", "429", "4XX", "500", @@ -586,7 +685,7 @@ def delete( retry_config=retry_config, ) - data: Any = None + response_data: Any = None if utils.match_response(http_res, "200", "application/json"): return models.DeleteKeyResponse( object=utils.unmarshal_json( @@ -595,29 +694,45 @@ def delete( http_meta=models.HTTPMetadata(request=req, response=http_res), ) if utils.match_response(http_res, "400", "application/json"): - data = utils.unmarshal_json(http_res.text, models.ErrBadRequestData) - raise models.ErrBadRequest(data=data) + response_data = utils.unmarshal_json( + http_res.text, models.ErrBadRequestData + ) + raise models.ErrBadRequest(data=response_data) if utils.match_response(http_res, "401", "application/json"): - data = utils.unmarshal_json(http_res.text, models.ErrUnauthorizedData) - raise models.ErrUnauthorized(data=data) + response_data = utils.unmarshal_json( + http_res.text, models.ErrUnauthorizedData + ) + raise models.ErrUnauthorized(data=response_data) if utils.match_response(http_res, "403", "application/json"): - data = utils.unmarshal_json(http_res.text, models.ErrForbiddenData) - raise models.ErrForbidden(data=data) + response_data = utils.unmarshal_json(http_res.text, models.ErrForbiddenData) + raise models.ErrForbidden(data=response_data) if utils.match_response(http_res, "404", "application/json"): - data = utils.unmarshal_json(http_res.text, models.ErrNotFoundData) - raise models.ErrNotFound(data=data) + response_data = utils.unmarshal_json(http_res.text, models.ErrNotFoundData) + raise models.ErrNotFound(data=response_data) if utils.match_response(http_res, "409", "application/json"): - data = utils.unmarshal_json(http_res.text, models.ErrConflictData) - raise models.ErrConflict(data=data) + response_data = utils.unmarshal_json(http_res.text, models.ErrConflictData) + raise models.ErrConflict(data=response_data) + if utils.match_response(http_res, "412", "application/json"): + response_data = utils.unmarshal_json( + http_res.text, models.ErrPreconditionFailedData + ) + raise models.ErrPreconditionFailed(data=response_data) if utils.match_response(http_res, "429", "application/json"): - data = utils.unmarshal_json(http_res.text, models.ErrTooManyRequestsData) - raise models.ErrTooManyRequests(data=data) + response_data = utils.unmarshal_json( + http_res.text, models.ErrTooManyRequestsData + ) + raise models.ErrTooManyRequests(data=response_data) if utils.match_response(http_res, "500", "application/json"): - data = utils.unmarshal_json( + response_data = utils.unmarshal_json( http_res.text, models.ErrInternalServerErrorData ) - raise models.ErrInternalServerError(data=data) - if utils.match_response(http_res, ["4XX", "5XX"], "*"): + raise models.ErrInternalServerError(data=response_data) + if utils.match_response(http_res, "4XX", "*"): + http_res_text = utils.stream_to_text(http_res) + raise models.SDKError( + "API error occurred", http_res.status_code, http_res_text, http_res + ) + if utils.match_response(http_res, "5XX", "*"): http_res_text = utils.stream_to_text(http_res) raise models.SDKError( "API error occurred", http_res.status_code, http_res_text, http_res @@ -641,12 +756,14 @@ async def delete_async( retries: OptionalNullable[utils.RetryConfig] = UNSET, server_url: Optional[str] = None, timeout_ms: Optional[int] = None, + http_headers: Optional[Mapping[str, str]] = None, ) -> models.DeleteKeyResponse: r""" :param request: The request object to send. :param retries: Override the default retry configuration for this method :param server_url: Override the default server URL for this method :param timeout_ms: Override the default request timeout configuration for this method in milliseconds + :param http_headers: Additional headers to set or replace on requests. """ base_url = None url_variables = None @@ -655,12 +772,14 @@ async def delete_async( if server_url is not None: base_url = server_url + else: + base_url = self._get_url(base_url, url_variables) if not isinstance(request, BaseModel): request = utils.unmarshal(request, models.DeleteKeyRequestBody) request = cast(models.DeleteKeyRequestBody, request) - req = self.build_request_async( + req = self._build_request_async( method="POST", path="/v1/keys.deleteKey", base_url=base_url, @@ -671,6 +790,7 @@ async def delete_async( request_has_query_params=True, user_agent_header="user-agent", accept_header_value="application/json", + http_headers=http_headers, security=self.sdk_configuration.security, get_serialized_body=lambda: utils.serialize_request_body( request, False, False, "json", models.DeleteKeyRequestBody @@ -692,6 +812,7 @@ async def delete_async( http_res = await self.do_request_async( hook_ctx=HookContext( + base_url=base_url or "", operation_id="deleteKey", oauth2_scopes=[], security_source=get_security_from_env( @@ -705,6 +826,7 @@ async def delete_async( "403", "404", "409", + "412", "429", "4XX", "500", @@ -713,7 +835,7 @@ async def delete_async( retry_config=retry_config, ) - data: Any = None + response_data: Any = None if utils.match_response(http_res, "200", "application/json"): return models.DeleteKeyResponse( object=utils.unmarshal_json( @@ -722,29 +844,45 @@ async def delete_async( http_meta=models.HTTPMetadata(request=req, response=http_res), ) if utils.match_response(http_res, "400", "application/json"): - data = utils.unmarshal_json(http_res.text, models.ErrBadRequestData) - raise models.ErrBadRequest(data=data) + response_data = utils.unmarshal_json( + http_res.text, models.ErrBadRequestData + ) + raise models.ErrBadRequest(data=response_data) if utils.match_response(http_res, "401", "application/json"): - data = utils.unmarshal_json(http_res.text, models.ErrUnauthorizedData) - raise models.ErrUnauthorized(data=data) + response_data = utils.unmarshal_json( + http_res.text, models.ErrUnauthorizedData + ) + raise models.ErrUnauthorized(data=response_data) if utils.match_response(http_res, "403", "application/json"): - data = utils.unmarshal_json(http_res.text, models.ErrForbiddenData) - raise models.ErrForbidden(data=data) + response_data = utils.unmarshal_json(http_res.text, models.ErrForbiddenData) + raise models.ErrForbidden(data=response_data) if utils.match_response(http_res, "404", "application/json"): - data = utils.unmarshal_json(http_res.text, models.ErrNotFoundData) - raise models.ErrNotFound(data=data) + response_data = utils.unmarshal_json(http_res.text, models.ErrNotFoundData) + raise models.ErrNotFound(data=response_data) if utils.match_response(http_res, "409", "application/json"): - data = utils.unmarshal_json(http_res.text, models.ErrConflictData) - raise models.ErrConflict(data=data) + response_data = utils.unmarshal_json(http_res.text, models.ErrConflictData) + raise models.ErrConflict(data=response_data) + if utils.match_response(http_res, "412", "application/json"): + response_data = utils.unmarshal_json( + http_res.text, models.ErrPreconditionFailedData + ) + raise models.ErrPreconditionFailed(data=response_data) if utils.match_response(http_res, "429", "application/json"): - data = utils.unmarshal_json(http_res.text, models.ErrTooManyRequestsData) - raise models.ErrTooManyRequests(data=data) + response_data = utils.unmarshal_json( + http_res.text, models.ErrTooManyRequestsData + ) + raise models.ErrTooManyRequests(data=response_data) if utils.match_response(http_res, "500", "application/json"): - data = utils.unmarshal_json( + response_data = utils.unmarshal_json( http_res.text, models.ErrInternalServerErrorData ) - raise models.ErrInternalServerError(data=data) - if utils.match_response(http_res, ["4XX", "5XX"], "*"): + raise models.ErrInternalServerError(data=response_data) + if utils.match_response(http_res, "4XX", "*"): + http_res_text = await utils.stream_to_text_async(http_res) + raise models.SDKError( + "API error occurred", http_res.status_code, http_res_text, http_res + ) + if utils.match_response(http_res, "5XX", "*"): http_res_text = await utils.stream_to_text_async(http_res) raise models.SDKError( "API error occurred", http_res.status_code, http_res_text, http_res @@ -768,12 +906,14 @@ def create( retries: OptionalNullable[utils.RetryConfig] = UNSET, server_url: Optional[str] = None, timeout_ms: Optional[int] = None, + http_headers: Optional[Mapping[str, str]] = None, ) -> models.CreateKeyResponse: r""" :param request: The request object to send. :param retries: Override the default retry configuration for this method :param server_url: Override the default server URL for this method :param timeout_ms: Override the default request timeout configuration for this method in milliseconds + :param http_headers: Additional headers to set or replace on requests. """ base_url = None url_variables = None @@ -782,12 +922,14 @@ def create( if server_url is not None: base_url = server_url + else: + base_url = self._get_url(base_url, url_variables) if not isinstance(request, BaseModel): request = utils.unmarshal(request, models.CreateKeyRequestBody) request = cast(models.CreateKeyRequestBody, request) - req = self.build_request( + req = self._build_request( method="POST", path="/v1/keys.createKey", base_url=base_url, @@ -798,6 +940,7 @@ def create( request_has_query_params=True, user_agent_header="user-agent", accept_header_value="application/json", + http_headers=http_headers, security=self.sdk_configuration.security, get_serialized_body=lambda: utils.serialize_request_body( request, False, False, "json", models.CreateKeyRequestBody @@ -819,6 +962,7 @@ def create( http_res = self.do_request( hook_ctx=HookContext( + base_url=base_url or "", operation_id="createKey", oauth2_scopes=[], security_source=get_security_from_env( @@ -832,6 +976,7 @@ def create( "403", "404", "409", + "412", "429", "4XX", "500", @@ -840,7 +985,7 @@ def create( retry_config=retry_config, ) - data: Any = None + response_data: Any = None if utils.match_response(http_res, "200", "application/json"): return models.CreateKeyResponse( object=utils.unmarshal_json( @@ -849,29 +994,45 @@ def create( http_meta=models.HTTPMetadata(request=req, response=http_res), ) if utils.match_response(http_res, "400", "application/json"): - data = utils.unmarshal_json(http_res.text, models.ErrBadRequestData) - raise models.ErrBadRequest(data=data) + response_data = utils.unmarshal_json( + http_res.text, models.ErrBadRequestData + ) + raise models.ErrBadRequest(data=response_data) if utils.match_response(http_res, "401", "application/json"): - data = utils.unmarshal_json(http_res.text, models.ErrUnauthorizedData) - raise models.ErrUnauthorized(data=data) + response_data = utils.unmarshal_json( + http_res.text, models.ErrUnauthorizedData + ) + raise models.ErrUnauthorized(data=response_data) if utils.match_response(http_res, "403", "application/json"): - data = utils.unmarshal_json(http_res.text, models.ErrForbiddenData) - raise models.ErrForbidden(data=data) + response_data = utils.unmarshal_json(http_res.text, models.ErrForbiddenData) + raise models.ErrForbidden(data=response_data) if utils.match_response(http_res, "404", "application/json"): - data = utils.unmarshal_json(http_res.text, models.ErrNotFoundData) - raise models.ErrNotFound(data=data) + response_data = utils.unmarshal_json(http_res.text, models.ErrNotFoundData) + raise models.ErrNotFound(data=response_data) if utils.match_response(http_res, "409", "application/json"): - data = utils.unmarshal_json(http_res.text, models.ErrConflictData) - raise models.ErrConflict(data=data) + response_data = utils.unmarshal_json(http_res.text, models.ErrConflictData) + raise models.ErrConflict(data=response_data) + if utils.match_response(http_res, "412", "application/json"): + response_data = utils.unmarshal_json( + http_res.text, models.ErrPreconditionFailedData + ) + raise models.ErrPreconditionFailed(data=response_data) if utils.match_response(http_res, "429", "application/json"): - data = utils.unmarshal_json(http_res.text, models.ErrTooManyRequestsData) - raise models.ErrTooManyRequests(data=data) + response_data = utils.unmarshal_json( + http_res.text, models.ErrTooManyRequestsData + ) + raise models.ErrTooManyRequests(data=response_data) if utils.match_response(http_res, "500", "application/json"): - data = utils.unmarshal_json( + response_data = utils.unmarshal_json( http_res.text, models.ErrInternalServerErrorData ) - raise models.ErrInternalServerError(data=data) - if utils.match_response(http_res, ["4XX", "5XX"], "*"): + raise models.ErrInternalServerError(data=response_data) + if utils.match_response(http_res, "4XX", "*"): + http_res_text = utils.stream_to_text(http_res) + raise models.SDKError( + "API error occurred", http_res.status_code, http_res_text, http_res + ) + if utils.match_response(http_res, "5XX", "*"): http_res_text = utils.stream_to_text(http_res) raise models.SDKError( "API error occurred", http_res.status_code, http_res_text, http_res @@ -895,12 +1056,14 @@ async def create_async( retries: OptionalNullable[utils.RetryConfig] = UNSET, server_url: Optional[str] = None, timeout_ms: Optional[int] = None, + http_headers: Optional[Mapping[str, str]] = None, ) -> models.CreateKeyResponse: r""" :param request: The request object to send. :param retries: Override the default retry configuration for this method :param server_url: Override the default server URL for this method :param timeout_ms: Override the default request timeout configuration for this method in milliseconds + :param http_headers: Additional headers to set or replace on requests. """ base_url = None url_variables = None @@ -909,12 +1072,14 @@ async def create_async( if server_url is not None: base_url = server_url + else: + base_url = self._get_url(base_url, url_variables) if not isinstance(request, BaseModel): request = utils.unmarshal(request, models.CreateKeyRequestBody) request = cast(models.CreateKeyRequestBody, request) - req = self.build_request_async( + req = self._build_request_async( method="POST", path="/v1/keys.createKey", base_url=base_url, @@ -925,6 +1090,7 @@ async def create_async( request_has_query_params=True, user_agent_header="user-agent", accept_header_value="application/json", + http_headers=http_headers, security=self.sdk_configuration.security, get_serialized_body=lambda: utils.serialize_request_body( request, False, False, "json", models.CreateKeyRequestBody @@ -946,6 +1112,7 @@ async def create_async( http_res = await self.do_request_async( hook_ctx=HookContext( + base_url=base_url or "", operation_id="createKey", oauth2_scopes=[], security_source=get_security_from_env( @@ -959,6 +1126,7 @@ async def create_async( "403", "404", "409", + "412", "429", "4XX", "500", @@ -967,7 +1135,7 @@ async def create_async( retry_config=retry_config, ) - data: Any = None + response_data: Any = None if utils.match_response(http_res, "200", "application/json"): return models.CreateKeyResponse( object=utils.unmarshal_json( @@ -976,29 +1144,45 @@ async def create_async( http_meta=models.HTTPMetadata(request=req, response=http_res), ) if utils.match_response(http_res, "400", "application/json"): - data = utils.unmarshal_json(http_res.text, models.ErrBadRequestData) - raise models.ErrBadRequest(data=data) + response_data = utils.unmarshal_json( + http_res.text, models.ErrBadRequestData + ) + raise models.ErrBadRequest(data=response_data) if utils.match_response(http_res, "401", "application/json"): - data = utils.unmarshal_json(http_res.text, models.ErrUnauthorizedData) - raise models.ErrUnauthorized(data=data) + response_data = utils.unmarshal_json( + http_res.text, models.ErrUnauthorizedData + ) + raise models.ErrUnauthorized(data=response_data) if utils.match_response(http_res, "403", "application/json"): - data = utils.unmarshal_json(http_res.text, models.ErrForbiddenData) - raise models.ErrForbidden(data=data) + response_data = utils.unmarshal_json(http_res.text, models.ErrForbiddenData) + raise models.ErrForbidden(data=response_data) if utils.match_response(http_res, "404", "application/json"): - data = utils.unmarshal_json(http_res.text, models.ErrNotFoundData) - raise models.ErrNotFound(data=data) + response_data = utils.unmarshal_json(http_res.text, models.ErrNotFoundData) + raise models.ErrNotFound(data=response_data) if utils.match_response(http_res, "409", "application/json"): - data = utils.unmarshal_json(http_res.text, models.ErrConflictData) - raise models.ErrConflict(data=data) + response_data = utils.unmarshal_json(http_res.text, models.ErrConflictData) + raise models.ErrConflict(data=response_data) + if utils.match_response(http_res, "412", "application/json"): + response_data = utils.unmarshal_json( + http_res.text, models.ErrPreconditionFailedData + ) + raise models.ErrPreconditionFailed(data=response_data) if utils.match_response(http_res, "429", "application/json"): - data = utils.unmarshal_json(http_res.text, models.ErrTooManyRequestsData) - raise models.ErrTooManyRequests(data=data) + response_data = utils.unmarshal_json( + http_res.text, models.ErrTooManyRequestsData + ) + raise models.ErrTooManyRequests(data=response_data) if utils.match_response(http_res, "500", "application/json"): - data = utils.unmarshal_json( + response_data = utils.unmarshal_json( http_res.text, models.ErrInternalServerErrorData ) - raise models.ErrInternalServerError(data=data) - if utils.match_response(http_res, ["4XX", "5XX"], "*"): + raise models.ErrInternalServerError(data=response_data) + if utils.match_response(http_res, "4XX", "*"): + http_res_text = await utils.stream_to_text_async(http_res) + raise models.SDKError( + "API error occurred", http_res.status_code, http_res_text, http_res + ) + if utils.match_response(http_res, "5XX", "*"): http_res_text = await utils.stream_to_text_async(http_res) raise models.SDKError( "API error occurred", http_res.status_code, http_res_text, http_res @@ -1022,12 +1206,14 @@ def verify( retries: OptionalNullable[utils.RetryConfig] = UNSET, server_url: Optional[str] = None, timeout_ms: Optional[int] = None, + http_headers: Optional[Mapping[str, str]] = None, ) -> models.VerifyKeyResponse: r""" :param request: The request object to send. :param retries: Override the default retry configuration for this method :param server_url: Override the default server URL for this method :param timeout_ms: Override the default request timeout configuration for this method in milliseconds + :param http_headers: Additional headers to set or replace on requests. """ base_url = None url_variables = None @@ -1036,12 +1222,14 @@ def verify( if server_url is not None: base_url = server_url + else: + base_url = self._get_url(base_url, url_variables) if not isinstance(request, BaseModel): request = utils.unmarshal(request, models.V1KeysVerifyKeyRequest) request = cast(models.V1KeysVerifyKeyRequest, request) - req = self.build_request( + req = self._build_request( method="POST", path="/v1/keys.verifyKey", base_url=base_url, @@ -1052,6 +1240,7 @@ def verify( request_has_query_params=True, user_agent_header="user-agent", accept_header_value="application/json", + http_headers=http_headers, security=self.sdk_configuration.security, get_serialized_body=lambda: utils.serialize_request_body( request, False, False, "json", models.V1KeysVerifyKeyRequest @@ -1073,6 +1262,7 @@ def verify( http_res = self.do_request( hook_ctx=HookContext( + base_url=base_url or "", operation_id="verifyKey", oauth2_scopes=[], security_source=get_security_from_env( @@ -1086,6 +1276,7 @@ def verify( "403", "404", "409", + "412", "429", "4XX", "500", @@ -1094,7 +1285,7 @@ def verify( retry_config=retry_config, ) - data: Any = None + response_data: Any = None if utils.match_response(http_res, "200", "application/json"): return models.VerifyKeyResponse( v1_keys_verify_key_response=utils.unmarshal_json( @@ -1103,29 +1294,45 @@ def verify( http_meta=models.HTTPMetadata(request=req, response=http_res), ) if utils.match_response(http_res, "400", "application/json"): - data = utils.unmarshal_json(http_res.text, models.ErrBadRequestData) - raise models.ErrBadRequest(data=data) + response_data = utils.unmarshal_json( + http_res.text, models.ErrBadRequestData + ) + raise models.ErrBadRequest(data=response_data) if utils.match_response(http_res, "401", "application/json"): - data = utils.unmarshal_json(http_res.text, models.ErrUnauthorizedData) - raise models.ErrUnauthorized(data=data) + response_data = utils.unmarshal_json( + http_res.text, models.ErrUnauthorizedData + ) + raise models.ErrUnauthorized(data=response_data) if utils.match_response(http_res, "403", "application/json"): - data = utils.unmarshal_json(http_res.text, models.ErrForbiddenData) - raise models.ErrForbidden(data=data) + response_data = utils.unmarshal_json(http_res.text, models.ErrForbiddenData) + raise models.ErrForbidden(data=response_data) if utils.match_response(http_res, "404", "application/json"): - data = utils.unmarshal_json(http_res.text, models.ErrNotFoundData) - raise models.ErrNotFound(data=data) + response_data = utils.unmarshal_json(http_res.text, models.ErrNotFoundData) + raise models.ErrNotFound(data=response_data) if utils.match_response(http_res, "409", "application/json"): - data = utils.unmarshal_json(http_res.text, models.ErrConflictData) - raise models.ErrConflict(data=data) + response_data = utils.unmarshal_json(http_res.text, models.ErrConflictData) + raise models.ErrConflict(data=response_data) + if utils.match_response(http_res, "412", "application/json"): + response_data = utils.unmarshal_json( + http_res.text, models.ErrPreconditionFailedData + ) + raise models.ErrPreconditionFailed(data=response_data) if utils.match_response(http_res, "429", "application/json"): - data = utils.unmarshal_json(http_res.text, models.ErrTooManyRequestsData) - raise models.ErrTooManyRequests(data=data) + response_data = utils.unmarshal_json( + http_res.text, models.ErrTooManyRequestsData + ) + raise models.ErrTooManyRequests(data=response_data) if utils.match_response(http_res, "500", "application/json"): - data = utils.unmarshal_json( + response_data = utils.unmarshal_json( http_res.text, models.ErrInternalServerErrorData ) - raise models.ErrInternalServerError(data=data) - if utils.match_response(http_res, ["4XX", "5XX"], "*"): + raise models.ErrInternalServerError(data=response_data) + if utils.match_response(http_res, "4XX", "*"): + http_res_text = utils.stream_to_text(http_res) + raise models.SDKError( + "API error occurred", http_res.status_code, http_res_text, http_res + ) + if utils.match_response(http_res, "5XX", "*"): http_res_text = utils.stream_to_text(http_res) raise models.SDKError( "API error occurred", http_res.status_code, http_res_text, http_res @@ -1149,12 +1356,14 @@ async def verify_async( retries: OptionalNullable[utils.RetryConfig] = UNSET, server_url: Optional[str] = None, timeout_ms: Optional[int] = None, + http_headers: Optional[Mapping[str, str]] = None, ) -> models.VerifyKeyResponse: r""" :param request: The request object to send. :param retries: Override the default retry configuration for this method :param server_url: Override the default server URL for this method :param timeout_ms: Override the default request timeout configuration for this method in milliseconds + :param http_headers: Additional headers to set or replace on requests. """ base_url = None url_variables = None @@ -1163,12 +1372,14 @@ async def verify_async( if server_url is not None: base_url = server_url + else: + base_url = self._get_url(base_url, url_variables) if not isinstance(request, BaseModel): request = utils.unmarshal(request, models.V1KeysVerifyKeyRequest) request = cast(models.V1KeysVerifyKeyRequest, request) - req = self.build_request_async( + req = self._build_request_async( method="POST", path="/v1/keys.verifyKey", base_url=base_url, @@ -1179,6 +1390,7 @@ async def verify_async( request_has_query_params=True, user_agent_header="user-agent", accept_header_value="application/json", + http_headers=http_headers, security=self.sdk_configuration.security, get_serialized_body=lambda: utils.serialize_request_body( request, False, False, "json", models.V1KeysVerifyKeyRequest @@ -1200,6 +1412,7 @@ async def verify_async( http_res = await self.do_request_async( hook_ctx=HookContext( + base_url=base_url or "", operation_id="verifyKey", oauth2_scopes=[], security_source=get_security_from_env( @@ -1213,6 +1426,7 @@ async def verify_async( "403", "404", "409", + "412", "429", "4XX", "500", @@ -1221,7 +1435,7 @@ async def verify_async( retry_config=retry_config, ) - data: Any = None + response_data: Any = None if utils.match_response(http_res, "200", "application/json"): return models.VerifyKeyResponse( v1_keys_verify_key_response=utils.unmarshal_json( @@ -1230,29 +1444,45 @@ async def verify_async( http_meta=models.HTTPMetadata(request=req, response=http_res), ) if utils.match_response(http_res, "400", "application/json"): - data = utils.unmarshal_json(http_res.text, models.ErrBadRequestData) - raise models.ErrBadRequest(data=data) + response_data = utils.unmarshal_json( + http_res.text, models.ErrBadRequestData + ) + raise models.ErrBadRequest(data=response_data) if utils.match_response(http_res, "401", "application/json"): - data = utils.unmarshal_json(http_res.text, models.ErrUnauthorizedData) - raise models.ErrUnauthorized(data=data) + response_data = utils.unmarshal_json( + http_res.text, models.ErrUnauthorizedData + ) + raise models.ErrUnauthorized(data=response_data) if utils.match_response(http_res, "403", "application/json"): - data = utils.unmarshal_json(http_res.text, models.ErrForbiddenData) - raise models.ErrForbidden(data=data) + response_data = utils.unmarshal_json(http_res.text, models.ErrForbiddenData) + raise models.ErrForbidden(data=response_data) if utils.match_response(http_res, "404", "application/json"): - data = utils.unmarshal_json(http_res.text, models.ErrNotFoundData) - raise models.ErrNotFound(data=data) + response_data = utils.unmarshal_json(http_res.text, models.ErrNotFoundData) + raise models.ErrNotFound(data=response_data) if utils.match_response(http_res, "409", "application/json"): - data = utils.unmarshal_json(http_res.text, models.ErrConflictData) - raise models.ErrConflict(data=data) + response_data = utils.unmarshal_json(http_res.text, models.ErrConflictData) + raise models.ErrConflict(data=response_data) + if utils.match_response(http_res, "412", "application/json"): + response_data = utils.unmarshal_json( + http_res.text, models.ErrPreconditionFailedData + ) + raise models.ErrPreconditionFailed(data=response_data) if utils.match_response(http_res, "429", "application/json"): - data = utils.unmarshal_json(http_res.text, models.ErrTooManyRequestsData) - raise models.ErrTooManyRequests(data=data) + response_data = utils.unmarshal_json( + http_res.text, models.ErrTooManyRequestsData + ) + raise models.ErrTooManyRequests(data=response_data) if utils.match_response(http_res, "500", "application/json"): - data = utils.unmarshal_json( + response_data = utils.unmarshal_json( http_res.text, models.ErrInternalServerErrorData ) - raise models.ErrInternalServerError(data=data) - if utils.match_response(http_res, ["4XX", "5XX"], "*"): + raise models.ErrInternalServerError(data=response_data) + if utils.match_response(http_res, "4XX", "*"): + http_res_text = await utils.stream_to_text_async(http_res) + raise models.SDKError( + "API error occurred", http_res.status_code, http_res_text, http_res + ) + if utils.match_response(http_res, "5XX", "*"): http_res_text = await utils.stream_to_text_async(http_res) raise models.SDKError( "API error occurred", http_res.status_code, http_res_text, http_res @@ -1276,12 +1506,14 @@ def update( retries: OptionalNullable[utils.RetryConfig] = UNSET, server_url: Optional[str] = None, timeout_ms: Optional[int] = None, + http_headers: Optional[Mapping[str, str]] = None, ) -> models.UpdateKeyResponse: r""" :param request: The request object to send. :param retries: Override the default retry configuration for this method :param server_url: Override the default server URL for this method :param timeout_ms: Override the default request timeout configuration for this method in milliseconds + :param http_headers: Additional headers to set or replace on requests. """ base_url = None url_variables = None @@ -1290,12 +1522,14 @@ def update( if server_url is not None: base_url = server_url + else: + base_url = self._get_url(base_url, url_variables) if not isinstance(request, BaseModel): request = utils.unmarshal(request, models.UpdateKeyRequestBody) request = cast(models.UpdateKeyRequestBody, request) - req = self.build_request( + req = self._build_request( method="POST", path="/v1/keys.updateKey", base_url=base_url, @@ -1306,6 +1540,7 @@ def update( request_has_query_params=True, user_agent_header="user-agent", accept_header_value="application/json", + http_headers=http_headers, security=self.sdk_configuration.security, get_serialized_body=lambda: utils.serialize_request_body( request, False, False, "json", models.UpdateKeyRequestBody @@ -1327,6 +1562,7 @@ def update( http_res = self.do_request( hook_ctx=HookContext( + base_url=base_url or "", operation_id="updateKey", oauth2_scopes=[], security_source=get_security_from_env( @@ -1340,6 +1576,7 @@ def update( "403", "404", "409", + "412", "429", "4XX", "500", @@ -1348,7 +1585,7 @@ def update( retry_config=retry_config, ) - data: Any = None + response_data: Any = None if utils.match_response(http_res, "200", "application/json"): return models.UpdateKeyResponse( object=utils.unmarshal_json( @@ -1357,29 +1594,45 @@ def update( http_meta=models.HTTPMetadata(request=req, response=http_res), ) if utils.match_response(http_res, "400", "application/json"): - data = utils.unmarshal_json(http_res.text, models.ErrBadRequestData) - raise models.ErrBadRequest(data=data) + response_data = utils.unmarshal_json( + http_res.text, models.ErrBadRequestData + ) + raise models.ErrBadRequest(data=response_data) if utils.match_response(http_res, "401", "application/json"): - data = utils.unmarshal_json(http_res.text, models.ErrUnauthorizedData) - raise models.ErrUnauthorized(data=data) + response_data = utils.unmarshal_json( + http_res.text, models.ErrUnauthorizedData + ) + raise models.ErrUnauthorized(data=response_data) if utils.match_response(http_res, "403", "application/json"): - data = utils.unmarshal_json(http_res.text, models.ErrForbiddenData) - raise models.ErrForbidden(data=data) + response_data = utils.unmarshal_json(http_res.text, models.ErrForbiddenData) + raise models.ErrForbidden(data=response_data) if utils.match_response(http_res, "404", "application/json"): - data = utils.unmarshal_json(http_res.text, models.ErrNotFoundData) - raise models.ErrNotFound(data=data) + response_data = utils.unmarshal_json(http_res.text, models.ErrNotFoundData) + raise models.ErrNotFound(data=response_data) if utils.match_response(http_res, "409", "application/json"): - data = utils.unmarshal_json(http_res.text, models.ErrConflictData) - raise models.ErrConflict(data=data) + response_data = utils.unmarshal_json(http_res.text, models.ErrConflictData) + raise models.ErrConflict(data=response_data) + if utils.match_response(http_res, "412", "application/json"): + response_data = utils.unmarshal_json( + http_res.text, models.ErrPreconditionFailedData + ) + raise models.ErrPreconditionFailed(data=response_data) if utils.match_response(http_res, "429", "application/json"): - data = utils.unmarshal_json(http_res.text, models.ErrTooManyRequestsData) - raise models.ErrTooManyRequests(data=data) + response_data = utils.unmarshal_json( + http_res.text, models.ErrTooManyRequestsData + ) + raise models.ErrTooManyRequests(data=response_data) if utils.match_response(http_res, "500", "application/json"): - data = utils.unmarshal_json( + response_data = utils.unmarshal_json( http_res.text, models.ErrInternalServerErrorData ) - raise models.ErrInternalServerError(data=data) - if utils.match_response(http_res, ["4XX", "5XX"], "*"): + raise models.ErrInternalServerError(data=response_data) + if utils.match_response(http_res, "4XX", "*"): + http_res_text = utils.stream_to_text(http_res) + raise models.SDKError( + "API error occurred", http_res.status_code, http_res_text, http_res + ) + if utils.match_response(http_res, "5XX", "*"): http_res_text = utils.stream_to_text(http_res) raise models.SDKError( "API error occurred", http_res.status_code, http_res_text, http_res @@ -1403,12 +1656,14 @@ async def update_async( retries: OptionalNullable[utils.RetryConfig] = UNSET, server_url: Optional[str] = None, timeout_ms: Optional[int] = None, + http_headers: Optional[Mapping[str, str]] = None, ) -> models.UpdateKeyResponse: r""" :param request: The request object to send. :param retries: Override the default retry configuration for this method :param server_url: Override the default server URL for this method :param timeout_ms: Override the default request timeout configuration for this method in milliseconds + :param http_headers: Additional headers to set or replace on requests. """ base_url = None url_variables = None @@ -1417,12 +1672,14 @@ async def update_async( if server_url is not None: base_url = server_url + else: + base_url = self._get_url(base_url, url_variables) if not isinstance(request, BaseModel): request = utils.unmarshal(request, models.UpdateKeyRequestBody) request = cast(models.UpdateKeyRequestBody, request) - req = self.build_request_async( + req = self._build_request_async( method="POST", path="/v1/keys.updateKey", base_url=base_url, @@ -1433,6 +1690,7 @@ async def update_async( request_has_query_params=True, user_agent_header="user-agent", accept_header_value="application/json", + http_headers=http_headers, security=self.sdk_configuration.security, get_serialized_body=lambda: utils.serialize_request_body( request, False, False, "json", models.UpdateKeyRequestBody @@ -1454,6 +1712,7 @@ async def update_async( http_res = await self.do_request_async( hook_ctx=HookContext( + base_url=base_url or "", operation_id="updateKey", oauth2_scopes=[], security_source=get_security_from_env( @@ -1467,6 +1726,7 @@ async def update_async( "403", "404", "409", + "412", "429", "4XX", "500", @@ -1475,7 +1735,7 @@ async def update_async( retry_config=retry_config, ) - data: Any = None + response_data: Any = None if utils.match_response(http_res, "200", "application/json"): return models.UpdateKeyResponse( object=utils.unmarshal_json( @@ -1484,29 +1744,45 @@ async def update_async( http_meta=models.HTTPMetadata(request=req, response=http_res), ) if utils.match_response(http_res, "400", "application/json"): - data = utils.unmarshal_json(http_res.text, models.ErrBadRequestData) - raise models.ErrBadRequest(data=data) + response_data = utils.unmarshal_json( + http_res.text, models.ErrBadRequestData + ) + raise models.ErrBadRequest(data=response_data) if utils.match_response(http_res, "401", "application/json"): - data = utils.unmarshal_json(http_res.text, models.ErrUnauthorizedData) - raise models.ErrUnauthorized(data=data) + response_data = utils.unmarshal_json( + http_res.text, models.ErrUnauthorizedData + ) + raise models.ErrUnauthorized(data=response_data) if utils.match_response(http_res, "403", "application/json"): - data = utils.unmarshal_json(http_res.text, models.ErrForbiddenData) - raise models.ErrForbidden(data=data) + response_data = utils.unmarshal_json(http_res.text, models.ErrForbiddenData) + raise models.ErrForbidden(data=response_data) if utils.match_response(http_res, "404", "application/json"): - data = utils.unmarshal_json(http_res.text, models.ErrNotFoundData) - raise models.ErrNotFound(data=data) + response_data = utils.unmarshal_json(http_res.text, models.ErrNotFoundData) + raise models.ErrNotFound(data=response_data) if utils.match_response(http_res, "409", "application/json"): - data = utils.unmarshal_json(http_res.text, models.ErrConflictData) - raise models.ErrConflict(data=data) + response_data = utils.unmarshal_json(http_res.text, models.ErrConflictData) + raise models.ErrConflict(data=response_data) + if utils.match_response(http_res, "412", "application/json"): + response_data = utils.unmarshal_json( + http_res.text, models.ErrPreconditionFailedData + ) + raise models.ErrPreconditionFailed(data=response_data) if utils.match_response(http_res, "429", "application/json"): - data = utils.unmarshal_json(http_res.text, models.ErrTooManyRequestsData) - raise models.ErrTooManyRequests(data=data) + response_data = utils.unmarshal_json( + http_res.text, models.ErrTooManyRequestsData + ) + raise models.ErrTooManyRequests(data=response_data) if utils.match_response(http_res, "500", "application/json"): - data = utils.unmarshal_json( + response_data = utils.unmarshal_json( http_res.text, models.ErrInternalServerErrorData ) - raise models.ErrInternalServerError(data=data) - if utils.match_response(http_res, ["4XX", "5XX"], "*"): + raise models.ErrInternalServerError(data=response_data) + if utils.match_response(http_res, "4XX", "*"): + http_res_text = await utils.stream_to_text_async(http_res) + raise models.SDKError( + "API error occurred", http_res.status_code, http_res_text, http_res + ) + if utils.match_response(http_res, "5XX", "*"): http_res_text = await utils.stream_to_text_async(http_res) raise models.SDKError( "API error occurred", http_res.status_code, http_res_text, http_res @@ -1531,12 +1807,14 @@ def update_remaining( retries: OptionalNullable[utils.RetryConfig] = UNSET, server_url: Optional[str] = None, timeout_ms: Optional[int] = None, + http_headers: Optional[Mapping[str, str]] = None, ) -> models.UpdateRemainingResponse: r""" :param request: The request object to send. :param retries: Override the default retry configuration for this method :param server_url: Override the default server URL for this method :param timeout_ms: Override the default request timeout configuration for this method in milliseconds + :param http_headers: Additional headers to set or replace on requests. """ base_url = None url_variables = None @@ -1545,12 +1823,14 @@ def update_remaining( if server_url is not None: base_url = server_url + else: + base_url = self._get_url(base_url, url_variables) if not isinstance(request, BaseModel): request = utils.unmarshal(request, models.UpdateRemainingRequestBody) request = cast(models.UpdateRemainingRequestBody, request) - req = self.build_request( + req = self._build_request( method="POST", path="/v1/keys.updateRemaining", base_url=base_url, @@ -1561,6 +1841,7 @@ def update_remaining( request_has_query_params=True, user_agent_header="user-agent", accept_header_value="application/json", + http_headers=http_headers, security=self.sdk_configuration.security, get_serialized_body=lambda: utils.serialize_request_body( request, False, False, "json", models.UpdateRemainingRequestBody @@ -1582,6 +1863,7 @@ def update_remaining( http_res = self.do_request( hook_ctx=HookContext( + base_url=base_url or "", operation_id="updateRemaining", oauth2_scopes=[], security_source=get_security_from_env( @@ -1595,6 +1877,7 @@ def update_remaining( "403", "404", "409", + "412", "429", "4XX", "500", @@ -1603,7 +1886,7 @@ def update_remaining( retry_config=retry_config, ) - data: Any = None + response_data: Any = None if utils.match_response(http_res, "200", "application/json"): return models.UpdateRemainingResponse( object=utils.unmarshal_json( @@ -1612,29 +1895,45 @@ def update_remaining( http_meta=models.HTTPMetadata(request=req, response=http_res), ) if utils.match_response(http_res, "400", "application/json"): - data = utils.unmarshal_json(http_res.text, models.ErrBadRequestData) - raise models.ErrBadRequest(data=data) + response_data = utils.unmarshal_json( + http_res.text, models.ErrBadRequestData + ) + raise models.ErrBadRequest(data=response_data) if utils.match_response(http_res, "401", "application/json"): - data = utils.unmarshal_json(http_res.text, models.ErrUnauthorizedData) - raise models.ErrUnauthorized(data=data) + response_data = utils.unmarshal_json( + http_res.text, models.ErrUnauthorizedData + ) + raise models.ErrUnauthorized(data=response_data) if utils.match_response(http_res, "403", "application/json"): - data = utils.unmarshal_json(http_res.text, models.ErrForbiddenData) - raise models.ErrForbidden(data=data) + response_data = utils.unmarshal_json(http_res.text, models.ErrForbiddenData) + raise models.ErrForbidden(data=response_data) if utils.match_response(http_res, "404", "application/json"): - data = utils.unmarshal_json(http_res.text, models.ErrNotFoundData) - raise models.ErrNotFound(data=data) + response_data = utils.unmarshal_json(http_res.text, models.ErrNotFoundData) + raise models.ErrNotFound(data=response_data) if utils.match_response(http_res, "409", "application/json"): - data = utils.unmarshal_json(http_res.text, models.ErrConflictData) - raise models.ErrConflict(data=data) + response_data = utils.unmarshal_json(http_res.text, models.ErrConflictData) + raise models.ErrConflict(data=response_data) + if utils.match_response(http_res, "412", "application/json"): + response_data = utils.unmarshal_json( + http_res.text, models.ErrPreconditionFailedData + ) + raise models.ErrPreconditionFailed(data=response_data) if utils.match_response(http_res, "429", "application/json"): - data = utils.unmarshal_json(http_res.text, models.ErrTooManyRequestsData) - raise models.ErrTooManyRequests(data=data) + response_data = utils.unmarshal_json( + http_res.text, models.ErrTooManyRequestsData + ) + raise models.ErrTooManyRequests(data=response_data) if utils.match_response(http_res, "500", "application/json"): - data = utils.unmarshal_json( + response_data = utils.unmarshal_json( http_res.text, models.ErrInternalServerErrorData ) - raise models.ErrInternalServerError(data=data) - if utils.match_response(http_res, ["4XX", "5XX"], "*"): + raise models.ErrInternalServerError(data=response_data) + if utils.match_response(http_res, "4XX", "*"): + http_res_text = utils.stream_to_text(http_res) + raise models.SDKError( + "API error occurred", http_res.status_code, http_res_text, http_res + ) + if utils.match_response(http_res, "5XX", "*"): http_res_text = utils.stream_to_text(http_res) raise models.SDKError( "API error occurred", http_res.status_code, http_res_text, http_res @@ -1659,12 +1958,14 @@ async def update_remaining_async( retries: OptionalNullable[utils.RetryConfig] = UNSET, server_url: Optional[str] = None, timeout_ms: Optional[int] = None, + http_headers: Optional[Mapping[str, str]] = None, ) -> models.UpdateRemainingResponse: r""" :param request: The request object to send. :param retries: Override the default retry configuration for this method :param server_url: Override the default server URL for this method :param timeout_ms: Override the default request timeout configuration for this method in milliseconds + :param http_headers: Additional headers to set or replace on requests. """ base_url = None url_variables = None @@ -1673,12 +1974,14 @@ async def update_remaining_async( if server_url is not None: base_url = server_url + else: + base_url = self._get_url(base_url, url_variables) if not isinstance(request, BaseModel): request = utils.unmarshal(request, models.UpdateRemainingRequestBody) request = cast(models.UpdateRemainingRequestBody, request) - req = self.build_request_async( + req = self._build_request_async( method="POST", path="/v1/keys.updateRemaining", base_url=base_url, @@ -1689,6 +1992,7 @@ async def update_remaining_async( request_has_query_params=True, user_agent_header="user-agent", accept_header_value="application/json", + http_headers=http_headers, security=self.sdk_configuration.security, get_serialized_body=lambda: utils.serialize_request_body( request, False, False, "json", models.UpdateRemainingRequestBody @@ -1710,6 +2014,7 @@ async def update_remaining_async( http_res = await self.do_request_async( hook_ctx=HookContext( + base_url=base_url or "", operation_id="updateRemaining", oauth2_scopes=[], security_source=get_security_from_env( @@ -1723,6 +2028,7 @@ async def update_remaining_async( "403", "404", "409", + "412", "429", "4XX", "500", @@ -1731,7 +2037,7 @@ async def update_remaining_async( retry_config=retry_config, ) - data: Any = None + response_data: Any = None if utils.match_response(http_res, "200", "application/json"): return models.UpdateRemainingResponse( object=utils.unmarshal_json( @@ -1740,29 +2046,45 @@ async def update_remaining_async( http_meta=models.HTTPMetadata(request=req, response=http_res), ) if utils.match_response(http_res, "400", "application/json"): - data = utils.unmarshal_json(http_res.text, models.ErrBadRequestData) - raise models.ErrBadRequest(data=data) + response_data = utils.unmarshal_json( + http_res.text, models.ErrBadRequestData + ) + raise models.ErrBadRequest(data=response_data) if utils.match_response(http_res, "401", "application/json"): - data = utils.unmarshal_json(http_res.text, models.ErrUnauthorizedData) - raise models.ErrUnauthorized(data=data) + response_data = utils.unmarshal_json( + http_res.text, models.ErrUnauthorizedData + ) + raise models.ErrUnauthorized(data=response_data) if utils.match_response(http_res, "403", "application/json"): - data = utils.unmarshal_json(http_res.text, models.ErrForbiddenData) - raise models.ErrForbidden(data=data) + response_data = utils.unmarshal_json(http_res.text, models.ErrForbiddenData) + raise models.ErrForbidden(data=response_data) if utils.match_response(http_res, "404", "application/json"): - data = utils.unmarshal_json(http_res.text, models.ErrNotFoundData) - raise models.ErrNotFound(data=data) + response_data = utils.unmarshal_json(http_res.text, models.ErrNotFoundData) + raise models.ErrNotFound(data=response_data) if utils.match_response(http_res, "409", "application/json"): - data = utils.unmarshal_json(http_res.text, models.ErrConflictData) - raise models.ErrConflict(data=data) + response_data = utils.unmarshal_json(http_res.text, models.ErrConflictData) + raise models.ErrConflict(data=response_data) + if utils.match_response(http_res, "412", "application/json"): + response_data = utils.unmarshal_json( + http_res.text, models.ErrPreconditionFailedData + ) + raise models.ErrPreconditionFailed(data=response_data) if utils.match_response(http_res, "429", "application/json"): - data = utils.unmarshal_json(http_res.text, models.ErrTooManyRequestsData) - raise models.ErrTooManyRequests(data=data) + response_data = utils.unmarshal_json( + http_res.text, models.ErrTooManyRequestsData + ) + raise models.ErrTooManyRequests(data=response_data) if utils.match_response(http_res, "500", "application/json"): - data = utils.unmarshal_json( + response_data = utils.unmarshal_json( http_res.text, models.ErrInternalServerErrorData ) - raise models.ErrInternalServerError(data=data) - if utils.match_response(http_res, ["4XX", "5XX"], "*"): + raise models.ErrInternalServerError(data=response_data) + if utils.match_response(http_res, "4XX", "*"): + http_res_text = await utils.stream_to_text_async(http_res) + raise models.SDKError( + "API error occurred", http_res.status_code, http_res_text, http_res + ) + if utils.match_response(http_res, "5XX", "*"): http_res_text = await utils.stream_to_text_async(http_res) raise models.SDKError( "API error occurred", http_res.status_code, http_res_text, http_res @@ -1781,17 +2103,20 @@ def get_verifications( self, *, request: Union[ - models.GetVerificationsRequest, models.GetVerificationsRequestTypedDict - ] = models.GetVerificationsRequest(), + models.KeysGetVerificationsRequest, + models.KeysGetVerificationsRequestTypedDict, + ] = models.KeysGetVerificationsRequest(), retries: OptionalNullable[utils.RetryConfig] = UNSET, server_url: Optional[str] = None, timeout_ms: Optional[int] = None, - ) -> models.GetVerificationsResponse: + http_headers: Optional[Mapping[str, str]] = None, + ) -> models.KeysGetVerificationsResponse: r""" :param request: The request object to send. :param retries: Override the default retry configuration for this method :param server_url: Override the default server URL for this method :param timeout_ms: Override the default request timeout configuration for this method in milliseconds + :param http_headers: Additional headers to set or replace on requests. """ base_url = None url_variables = None @@ -1800,12 +2125,14 @@ def get_verifications( if server_url is not None: base_url = server_url + else: + base_url = self._get_url(base_url, url_variables) if not isinstance(request, BaseModel): - request = utils.unmarshal(request, models.GetVerificationsRequest) - request = cast(models.GetVerificationsRequest, request) + request = utils.unmarshal(request, models.KeysGetVerificationsRequest) + request = cast(models.KeysGetVerificationsRequest, request) - req = self.build_request( + req = self._build_request( method="GET", path="/v1/keys.getVerifications", base_url=base_url, @@ -1816,6 +2143,7 @@ def get_verifications( request_has_query_params=True, user_agent_header="user-agent", accept_header_value="application/json", + http_headers=http_headers, security=self.sdk_configuration.security, timeout_ms=timeout_ms, ) @@ -1834,7 +2162,8 @@ def get_verifications( http_res = self.do_request( hook_ctx=HookContext( - operation_id="getVerifications", + base_url=base_url or "", + operation_id="keys.getVerifications", oauth2_scopes=[], security_source=get_security_from_env( self.sdk_configuration.security, models.Security @@ -1847,6 +2176,7 @@ def get_verifications( "403", "404", "409", + "412", "429", "4XX", "500", @@ -1855,38 +2185,54 @@ def get_verifications( retry_config=retry_config, ) - data: Any = None + response_data: Any = None if utils.match_response(http_res, "200", "application/json"): - return models.GetVerificationsResponse( + return models.KeysGetVerificationsResponse( object=utils.unmarshal_json( - http_res.text, Optional[models.GetVerificationsResponseBody] + http_res.text, Optional[models.KeysGetVerificationsResponseBody] ), http_meta=models.HTTPMetadata(request=req, response=http_res), ) if utils.match_response(http_res, "400", "application/json"): - data = utils.unmarshal_json(http_res.text, models.ErrBadRequestData) - raise models.ErrBadRequest(data=data) + response_data = utils.unmarshal_json( + http_res.text, models.ErrBadRequestData + ) + raise models.ErrBadRequest(data=response_data) if utils.match_response(http_res, "401", "application/json"): - data = utils.unmarshal_json(http_res.text, models.ErrUnauthorizedData) - raise models.ErrUnauthorized(data=data) + response_data = utils.unmarshal_json( + http_res.text, models.ErrUnauthorizedData + ) + raise models.ErrUnauthorized(data=response_data) if utils.match_response(http_res, "403", "application/json"): - data = utils.unmarshal_json(http_res.text, models.ErrForbiddenData) - raise models.ErrForbidden(data=data) + response_data = utils.unmarshal_json(http_res.text, models.ErrForbiddenData) + raise models.ErrForbidden(data=response_data) if utils.match_response(http_res, "404", "application/json"): - data = utils.unmarshal_json(http_res.text, models.ErrNotFoundData) - raise models.ErrNotFound(data=data) + response_data = utils.unmarshal_json(http_res.text, models.ErrNotFoundData) + raise models.ErrNotFound(data=response_data) if utils.match_response(http_res, "409", "application/json"): - data = utils.unmarshal_json(http_res.text, models.ErrConflictData) - raise models.ErrConflict(data=data) + response_data = utils.unmarshal_json(http_res.text, models.ErrConflictData) + raise models.ErrConflict(data=response_data) + if utils.match_response(http_res, "412", "application/json"): + response_data = utils.unmarshal_json( + http_res.text, models.ErrPreconditionFailedData + ) + raise models.ErrPreconditionFailed(data=response_data) if utils.match_response(http_res, "429", "application/json"): - data = utils.unmarshal_json(http_res.text, models.ErrTooManyRequestsData) - raise models.ErrTooManyRequests(data=data) + response_data = utils.unmarshal_json( + http_res.text, models.ErrTooManyRequestsData + ) + raise models.ErrTooManyRequests(data=response_data) if utils.match_response(http_res, "500", "application/json"): - data = utils.unmarshal_json( + response_data = utils.unmarshal_json( http_res.text, models.ErrInternalServerErrorData ) - raise models.ErrInternalServerError(data=data) - if utils.match_response(http_res, ["4XX", "5XX"], "*"): + raise models.ErrInternalServerError(data=response_data) + if utils.match_response(http_res, "4XX", "*"): + http_res_text = utils.stream_to_text(http_res) + raise models.SDKError( + "API error occurred", http_res.status_code, http_res_text, http_res + ) + if utils.match_response(http_res, "5XX", "*"): http_res_text = utils.stream_to_text(http_res) raise models.SDKError( "API error occurred", http_res.status_code, http_res_text, http_res @@ -1905,17 +2251,20 @@ async def get_verifications_async( self, *, request: Union[ - models.GetVerificationsRequest, models.GetVerificationsRequestTypedDict - ] = models.GetVerificationsRequest(), + models.KeysGetVerificationsRequest, + models.KeysGetVerificationsRequestTypedDict, + ] = models.KeysGetVerificationsRequest(), retries: OptionalNullable[utils.RetryConfig] = UNSET, server_url: Optional[str] = None, timeout_ms: Optional[int] = None, - ) -> models.GetVerificationsResponse: + http_headers: Optional[Mapping[str, str]] = None, + ) -> models.KeysGetVerificationsResponse: r""" :param request: The request object to send. :param retries: Override the default retry configuration for this method :param server_url: Override the default server URL for this method :param timeout_ms: Override the default request timeout configuration for this method in milliseconds + :param http_headers: Additional headers to set or replace on requests. """ base_url = None url_variables = None @@ -1924,12 +2273,14 @@ async def get_verifications_async( if server_url is not None: base_url = server_url + else: + base_url = self._get_url(base_url, url_variables) if not isinstance(request, BaseModel): - request = utils.unmarshal(request, models.GetVerificationsRequest) - request = cast(models.GetVerificationsRequest, request) + request = utils.unmarshal(request, models.KeysGetVerificationsRequest) + request = cast(models.KeysGetVerificationsRequest, request) - req = self.build_request_async( + req = self._build_request_async( method="GET", path="/v1/keys.getVerifications", base_url=base_url, @@ -1940,6 +2291,7 @@ async def get_verifications_async( request_has_query_params=True, user_agent_header="user-agent", accept_header_value="application/json", + http_headers=http_headers, security=self.sdk_configuration.security, timeout_ms=timeout_ms, ) @@ -1958,7 +2310,8 @@ async def get_verifications_async( http_res = await self.do_request_async( hook_ctx=HookContext( - operation_id="getVerifications", + base_url=base_url or "", + operation_id="keys.getVerifications", oauth2_scopes=[], security_source=get_security_from_env( self.sdk_configuration.security, models.Security @@ -1971,6 +2324,7 @@ async def get_verifications_async( "403", "404", "409", + "412", "429", "4XX", "500", @@ -1979,38 +2333,54 @@ async def get_verifications_async( retry_config=retry_config, ) - data: Any = None + response_data: Any = None if utils.match_response(http_res, "200", "application/json"): - return models.GetVerificationsResponse( + return models.KeysGetVerificationsResponse( object=utils.unmarshal_json( - http_res.text, Optional[models.GetVerificationsResponseBody] + http_res.text, Optional[models.KeysGetVerificationsResponseBody] ), http_meta=models.HTTPMetadata(request=req, response=http_res), ) if utils.match_response(http_res, "400", "application/json"): - data = utils.unmarshal_json(http_res.text, models.ErrBadRequestData) - raise models.ErrBadRequest(data=data) + response_data = utils.unmarshal_json( + http_res.text, models.ErrBadRequestData + ) + raise models.ErrBadRequest(data=response_data) if utils.match_response(http_res, "401", "application/json"): - data = utils.unmarshal_json(http_res.text, models.ErrUnauthorizedData) - raise models.ErrUnauthorized(data=data) + response_data = utils.unmarshal_json( + http_res.text, models.ErrUnauthorizedData + ) + raise models.ErrUnauthorized(data=response_data) if utils.match_response(http_res, "403", "application/json"): - data = utils.unmarshal_json(http_res.text, models.ErrForbiddenData) - raise models.ErrForbidden(data=data) + response_data = utils.unmarshal_json(http_res.text, models.ErrForbiddenData) + raise models.ErrForbidden(data=response_data) if utils.match_response(http_res, "404", "application/json"): - data = utils.unmarshal_json(http_res.text, models.ErrNotFoundData) - raise models.ErrNotFound(data=data) + response_data = utils.unmarshal_json(http_res.text, models.ErrNotFoundData) + raise models.ErrNotFound(data=response_data) if utils.match_response(http_res, "409", "application/json"): - data = utils.unmarshal_json(http_res.text, models.ErrConflictData) - raise models.ErrConflict(data=data) + response_data = utils.unmarshal_json(http_res.text, models.ErrConflictData) + raise models.ErrConflict(data=response_data) + if utils.match_response(http_res, "412", "application/json"): + response_data = utils.unmarshal_json( + http_res.text, models.ErrPreconditionFailedData + ) + raise models.ErrPreconditionFailed(data=response_data) if utils.match_response(http_res, "429", "application/json"): - data = utils.unmarshal_json(http_res.text, models.ErrTooManyRequestsData) - raise models.ErrTooManyRequests(data=data) + response_data = utils.unmarshal_json( + http_res.text, models.ErrTooManyRequestsData + ) + raise models.ErrTooManyRequests(data=response_data) if utils.match_response(http_res, "500", "application/json"): - data = utils.unmarshal_json( + response_data = utils.unmarshal_json( http_res.text, models.ErrInternalServerErrorData ) - raise models.ErrInternalServerError(data=data) - if utils.match_response(http_res, ["4XX", "5XX"], "*"): + raise models.ErrInternalServerError(data=response_data) + if utils.match_response(http_res, "4XX", "*"): + http_res_text = await utils.stream_to_text_async(http_res) + raise models.SDKError( + "API error occurred", http_res.status_code, http_res_text, http_res + ) + if utils.match_response(http_res, "5XX", "*"): http_res_text = await utils.stream_to_text_async(http_res) raise models.SDKError( "API error occurred", http_res.status_code, http_res_text, http_res @@ -2034,12 +2404,14 @@ def add_permissions( retries: OptionalNullable[utils.RetryConfig] = UNSET, server_url: Optional[str] = None, timeout_ms: Optional[int] = None, + http_headers: Optional[Mapping[str, str]] = None, ) -> models.AddPermissionsResponse: r""" :param request: The request object to send. :param retries: Override the default retry configuration for this method :param server_url: Override the default server URL for this method :param timeout_ms: Override the default request timeout configuration for this method in milliseconds + :param http_headers: Additional headers to set or replace on requests. """ base_url = None url_variables = None @@ -2048,12 +2420,14 @@ def add_permissions( if server_url is not None: base_url = server_url + else: + base_url = self._get_url(base_url, url_variables) if not isinstance(request, BaseModel): request = utils.unmarshal(request, models.AddPermissionsRequestBody) request = cast(models.AddPermissionsRequestBody, request) - req = self.build_request( + req = self._build_request( method="POST", path="/v1/keys.addPermissions", base_url=base_url, @@ -2064,6 +2438,7 @@ def add_permissions( request_has_query_params=True, user_agent_header="user-agent", accept_header_value="application/json", + http_headers=http_headers, security=self.sdk_configuration.security, get_serialized_body=lambda: utils.serialize_request_body( request, False, False, "json", models.AddPermissionsRequestBody @@ -2085,6 +2460,7 @@ def add_permissions( http_res = self.do_request( hook_ctx=HookContext( + base_url=base_url or "", operation_id="addPermissions", oauth2_scopes=[], security_source=get_security_from_env( @@ -2098,6 +2474,7 @@ def add_permissions( "403", "404", "409", + "412", "429", "4XX", "500", @@ -2106,7 +2483,7 @@ def add_permissions( retry_config=retry_config, ) - data: Any = None + response_data: Any = None if utils.match_response(http_res, "200", "application/json"): return models.AddPermissionsResponse( response_bodies=utils.unmarshal_json( @@ -2115,29 +2492,45 @@ def add_permissions( http_meta=models.HTTPMetadata(request=req, response=http_res), ) if utils.match_response(http_res, "400", "application/json"): - data = utils.unmarshal_json(http_res.text, models.ErrBadRequestData) - raise models.ErrBadRequest(data=data) + response_data = utils.unmarshal_json( + http_res.text, models.ErrBadRequestData + ) + raise models.ErrBadRequest(data=response_data) if utils.match_response(http_res, "401", "application/json"): - data = utils.unmarshal_json(http_res.text, models.ErrUnauthorizedData) - raise models.ErrUnauthorized(data=data) + response_data = utils.unmarshal_json( + http_res.text, models.ErrUnauthorizedData + ) + raise models.ErrUnauthorized(data=response_data) if utils.match_response(http_res, "403", "application/json"): - data = utils.unmarshal_json(http_res.text, models.ErrForbiddenData) - raise models.ErrForbidden(data=data) + response_data = utils.unmarshal_json(http_res.text, models.ErrForbiddenData) + raise models.ErrForbidden(data=response_data) if utils.match_response(http_res, "404", "application/json"): - data = utils.unmarshal_json(http_res.text, models.ErrNotFoundData) - raise models.ErrNotFound(data=data) + response_data = utils.unmarshal_json(http_res.text, models.ErrNotFoundData) + raise models.ErrNotFound(data=response_data) if utils.match_response(http_res, "409", "application/json"): - data = utils.unmarshal_json(http_res.text, models.ErrConflictData) - raise models.ErrConflict(data=data) + response_data = utils.unmarshal_json(http_res.text, models.ErrConflictData) + raise models.ErrConflict(data=response_data) + if utils.match_response(http_res, "412", "application/json"): + response_data = utils.unmarshal_json( + http_res.text, models.ErrPreconditionFailedData + ) + raise models.ErrPreconditionFailed(data=response_data) if utils.match_response(http_res, "429", "application/json"): - data = utils.unmarshal_json(http_res.text, models.ErrTooManyRequestsData) - raise models.ErrTooManyRequests(data=data) + response_data = utils.unmarshal_json( + http_res.text, models.ErrTooManyRequestsData + ) + raise models.ErrTooManyRequests(data=response_data) if utils.match_response(http_res, "500", "application/json"): - data = utils.unmarshal_json( + response_data = utils.unmarshal_json( http_res.text, models.ErrInternalServerErrorData ) - raise models.ErrInternalServerError(data=data) - if utils.match_response(http_res, ["4XX", "5XX"], "*"): + raise models.ErrInternalServerError(data=response_data) + if utils.match_response(http_res, "4XX", "*"): + http_res_text = utils.stream_to_text(http_res) + raise models.SDKError( + "API error occurred", http_res.status_code, http_res_text, http_res + ) + if utils.match_response(http_res, "5XX", "*"): http_res_text = utils.stream_to_text(http_res) raise models.SDKError( "API error occurred", http_res.status_code, http_res_text, http_res @@ -2161,12 +2554,14 @@ async def add_permissions_async( retries: OptionalNullable[utils.RetryConfig] = UNSET, server_url: Optional[str] = None, timeout_ms: Optional[int] = None, + http_headers: Optional[Mapping[str, str]] = None, ) -> models.AddPermissionsResponse: r""" :param request: The request object to send. :param retries: Override the default retry configuration for this method :param server_url: Override the default server URL for this method :param timeout_ms: Override the default request timeout configuration for this method in milliseconds + :param http_headers: Additional headers to set or replace on requests. """ base_url = None url_variables = None @@ -2175,12 +2570,14 @@ async def add_permissions_async( if server_url is not None: base_url = server_url + else: + base_url = self._get_url(base_url, url_variables) if not isinstance(request, BaseModel): request = utils.unmarshal(request, models.AddPermissionsRequestBody) request = cast(models.AddPermissionsRequestBody, request) - req = self.build_request_async( + req = self._build_request_async( method="POST", path="/v1/keys.addPermissions", base_url=base_url, @@ -2191,6 +2588,7 @@ async def add_permissions_async( request_has_query_params=True, user_agent_header="user-agent", accept_header_value="application/json", + http_headers=http_headers, security=self.sdk_configuration.security, get_serialized_body=lambda: utils.serialize_request_body( request, False, False, "json", models.AddPermissionsRequestBody @@ -2212,6 +2610,7 @@ async def add_permissions_async( http_res = await self.do_request_async( hook_ctx=HookContext( + base_url=base_url or "", operation_id="addPermissions", oauth2_scopes=[], security_source=get_security_from_env( @@ -2225,6 +2624,7 @@ async def add_permissions_async( "403", "404", "409", + "412", "429", "4XX", "500", @@ -2233,7 +2633,7 @@ async def add_permissions_async( retry_config=retry_config, ) - data: Any = None + response_data: Any = None if utils.match_response(http_res, "200", "application/json"): return models.AddPermissionsResponse( response_bodies=utils.unmarshal_json( @@ -2242,29 +2642,45 @@ async def add_permissions_async( http_meta=models.HTTPMetadata(request=req, response=http_res), ) if utils.match_response(http_res, "400", "application/json"): - data = utils.unmarshal_json(http_res.text, models.ErrBadRequestData) - raise models.ErrBadRequest(data=data) + response_data = utils.unmarshal_json( + http_res.text, models.ErrBadRequestData + ) + raise models.ErrBadRequest(data=response_data) if utils.match_response(http_res, "401", "application/json"): - data = utils.unmarshal_json(http_res.text, models.ErrUnauthorizedData) - raise models.ErrUnauthorized(data=data) + response_data = utils.unmarshal_json( + http_res.text, models.ErrUnauthorizedData + ) + raise models.ErrUnauthorized(data=response_data) if utils.match_response(http_res, "403", "application/json"): - data = utils.unmarshal_json(http_res.text, models.ErrForbiddenData) - raise models.ErrForbidden(data=data) + response_data = utils.unmarshal_json(http_res.text, models.ErrForbiddenData) + raise models.ErrForbidden(data=response_data) if utils.match_response(http_res, "404", "application/json"): - data = utils.unmarshal_json(http_res.text, models.ErrNotFoundData) - raise models.ErrNotFound(data=data) + response_data = utils.unmarshal_json(http_res.text, models.ErrNotFoundData) + raise models.ErrNotFound(data=response_data) if utils.match_response(http_res, "409", "application/json"): - data = utils.unmarshal_json(http_res.text, models.ErrConflictData) - raise models.ErrConflict(data=data) + response_data = utils.unmarshal_json(http_res.text, models.ErrConflictData) + raise models.ErrConflict(data=response_data) + if utils.match_response(http_res, "412", "application/json"): + response_data = utils.unmarshal_json( + http_res.text, models.ErrPreconditionFailedData + ) + raise models.ErrPreconditionFailed(data=response_data) if utils.match_response(http_res, "429", "application/json"): - data = utils.unmarshal_json(http_res.text, models.ErrTooManyRequestsData) - raise models.ErrTooManyRequests(data=data) + response_data = utils.unmarshal_json( + http_res.text, models.ErrTooManyRequestsData + ) + raise models.ErrTooManyRequests(data=response_data) if utils.match_response(http_res, "500", "application/json"): - data = utils.unmarshal_json( + response_data = utils.unmarshal_json( http_res.text, models.ErrInternalServerErrorData ) - raise models.ErrInternalServerError(data=data) - if utils.match_response(http_res, ["4XX", "5XX"], "*"): + raise models.ErrInternalServerError(data=response_data) + if utils.match_response(http_res, "4XX", "*"): + http_res_text = await utils.stream_to_text_async(http_res) + raise models.SDKError( + "API error occurred", http_res.status_code, http_res_text, http_res + ) + if utils.match_response(http_res, "5XX", "*"): http_res_text = await utils.stream_to_text_async(http_res) raise models.SDKError( "API error occurred", http_res.status_code, http_res_text, http_res @@ -2289,12 +2705,14 @@ def remove_permissions( retries: OptionalNullable[utils.RetryConfig] = UNSET, server_url: Optional[str] = None, timeout_ms: Optional[int] = None, + http_headers: Optional[Mapping[str, str]] = None, ) -> models.RemovePermissionsResponse: r""" :param request: The request object to send. :param retries: Override the default retry configuration for this method :param server_url: Override the default server URL for this method :param timeout_ms: Override the default request timeout configuration for this method in milliseconds + :param http_headers: Additional headers to set or replace on requests. """ base_url = None url_variables = None @@ -2303,12 +2721,14 @@ def remove_permissions( if server_url is not None: base_url = server_url + else: + base_url = self._get_url(base_url, url_variables) if not isinstance(request, BaseModel): request = utils.unmarshal(request, models.RemovePermissionsRequestBody) request = cast(models.RemovePermissionsRequestBody, request) - req = self.build_request( + req = self._build_request( method="POST", path="/v1/keys.removePermissions", base_url=base_url, @@ -2319,6 +2739,7 @@ def remove_permissions( request_has_query_params=True, user_agent_header="user-agent", accept_header_value="application/json", + http_headers=http_headers, security=self.sdk_configuration.security, get_serialized_body=lambda: utils.serialize_request_body( request, False, False, "json", models.RemovePermissionsRequestBody @@ -2340,6 +2761,7 @@ def remove_permissions( http_res = self.do_request( hook_ctx=HookContext( + base_url=base_url or "", operation_id="removePermissions", oauth2_scopes=[], security_source=get_security_from_env( @@ -2353,6 +2775,7 @@ def remove_permissions( "403", "404", "409", + "412", "429", "4XX", "500", @@ -2361,7 +2784,7 @@ def remove_permissions( retry_config=retry_config, ) - data: Any = None + response_data: Any = None if utils.match_response(http_res, "200", "application/json"): return models.RemovePermissionsResponse( object=utils.unmarshal_json( @@ -2370,29 +2793,45 @@ def remove_permissions( http_meta=models.HTTPMetadata(request=req, response=http_res), ) if utils.match_response(http_res, "400", "application/json"): - data = utils.unmarshal_json(http_res.text, models.ErrBadRequestData) - raise models.ErrBadRequest(data=data) + response_data = utils.unmarshal_json( + http_res.text, models.ErrBadRequestData + ) + raise models.ErrBadRequest(data=response_data) if utils.match_response(http_res, "401", "application/json"): - data = utils.unmarshal_json(http_res.text, models.ErrUnauthorizedData) - raise models.ErrUnauthorized(data=data) + response_data = utils.unmarshal_json( + http_res.text, models.ErrUnauthorizedData + ) + raise models.ErrUnauthorized(data=response_data) if utils.match_response(http_res, "403", "application/json"): - data = utils.unmarshal_json(http_res.text, models.ErrForbiddenData) - raise models.ErrForbidden(data=data) + response_data = utils.unmarshal_json(http_res.text, models.ErrForbiddenData) + raise models.ErrForbidden(data=response_data) if utils.match_response(http_res, "404", "application/json"): - data = utils.unmarshal_json(http_res.text, models.ErrNotFoundData) - raise models.ErrNotFound(data=data) + response_data = utils.unmarshal_json(http_res.text, models.ErrNotFoundData) + raise models.ErrNotFound(data=response_data) if utils.match_response(http_res, "409", "application/json"): - data = utils.unmarshal_json(http_res.text, models.ErrConflictData) - raise models.ErrConflict(data=data) + response_data = utils.unmarshal_json(http_res.text, models.ErrConflictData) + raise models.ErrConflict(data=response_data) + if utils.match_response(http_res, "412", "application/json"): + response_data = utils.unmarshal_json( + http_res.text, models.ErrPreconditionFailedData + ) + raise models.ErrPreconditionFailed(data=response_data) if utils.match_response(http_res, "429", "application/json"): - data = utils.unmarshal_json(http_res.text, models.ErrTooManyRequestsData) - raise models.ErrTooManyRequests(data=data) + response_data = utils.unmarshal_json( + http_res.text, models.ErrTooManyRequestsData + ) + raise models.ErrTooManyRequests(data=response_data) if utils.match_response(http_res, "500", "application/json"): - data = utils.unmarshal_json( + response_data = utils.unmarshal_json( http_res.text, models.ErrInternalServerErrorData ) - raise models.ErrInternalServerError(data=data) - if utils.match_response(http_res, ["4XX", "5XX"], "*"): + raise models.ErrInternalServerError(data=response_data) + if utils.match_response(http_res, "4XX", "*"): + http_res_text = utils.stream_to_text(http_res) + raise models.SDKError( + "API error occurred", http_res.status_code, http_res_text, http_res + ) + if utils.match_response(http_res, "5XX", "*"): http_res_text = utils.stream_to_text(http_res) raise models.SDKError( "API error occurred", http_res.status_code, http_res_text, http_res @@ -2417,12 +2856,14 @@ async def remove_permissions_async( retries: OptionalNullable[utils.RetryConfig] = UNSET, server_url: Optional[str] = None, timeout_ms: Optional[int] = None, + http_headers: Optional[Mapping[str, str]] = None, ) -> models.RemovePermissionsResponse: r""" :param request: The request object to send. :param retries: Override the default retry configuration for this method :param server_url: Override the default server URL for this method :param timeout_ms: Override the default request timeout configuration for this method in milliseconds + :param http_headers: Additional headers to set or replace on requests. """ base_url = None url_variables = None @@ -2431,12 +2872,14 @@ async def remove_permissions_async( if server_url is not None: base_url = server_url + else: + base_url = self._get_url(base_url, url_variables) if not isinstance(request, BaseModel): request = utils.unmarshal(request, models.RemovePermissionsRequestBody) request = cast(models.RemovePermissionsRequestBody, request) - req = self.build_request_async( + req = self._build_request_async( method="POST", path="/v1/keys.removePermissions", base_url=base_url, @@ -2447,6 +2890,7 @@ async def remove_permissions_async( request_has_query_params=True, user_agent_header="user-agent", accept_header_value="application/json", + http_headers=http_headers, security=self.sdk_configuration.security, get_serialized_body=lambda: utils.serialize_request_body( request, False, False, "json", models.RemovePermissionsRequestBody @@ -2468,6 +2912,7 @@ async def remove_permissions_async( http_res = await self.do_request_async( hook_ctx=HookContext( + base_url=base_url or "", operation_id="removePermissions", oauth2_scopes=[], security_source=get_security_from_env( @@ -2481,6 +2926,7 @@ async def remove_permissions_async( "403", "404", "409", + "412", "429", "4XX", "500", @@ -2489,7 +2935,7 @@ async def remove_permissions_async( retry_config=retry_config, ) - data: Any = None + response_data: Any = None if utils.match_response(http_res, "200", "application/json"): return models.RemovePermissionsResponse( object=utils.unmarshal_json( @@ -2498,29 +2944,45 @@ async def remove_permissions_async( http_meta=models.HTTPMetadata(request=req, response=http_res), ) if utils.match_response(http_res, "400", "application/json"): - data = utils.unmarshal_json(http_res.text, models.ErrBadRequestData) - raise models.ErrBadRequest(data=data) + response_data = utils.unmarshal_json( + http_res.text, models.ErrBadRequestData + ) + raise models.ErrBadRequest(data=response_data) if utils.match_response(http_res, "401", "application/json"): - data = utils.unmarshal_json(http_res.text, models.ErrUnauthorizedData) - raise models.ErrUnauthorized(data=data) + response_data = utils.unmarshal_json( + http_res.text, models.ErrUnauthorizedData + ) + raise models.ErrUnauthorized(data=response_data) if utils.match_response(http_res, "403", "application/json"): - data = utils.unmarshal_json(http_res.text, models.ErrForbiddenData) - raise models.ErrForbidden(data=data) + response_data = utils.unmarshal_json(http_res.text, models.ErrForbiddenData) + raise models.ErrForbidden(data=response_data) if utils.match_response(http_res, "404", "application/json"): - data = utils.unmarshal_json(http_res.text, models.ErrNotFoundData) - raise models.ErrNotFound(data=data) + response_data = utils.unmarshal_json(http_res.text, models.ErrNotFoundData) + raise models.ErrNotFound(data=response_data) if utils.match_response(http_res, "409", "application/json"): - data = utils.unmarshal_json(http_res.text, models.ErrConflictData) - raise models.ErrConflict(data=data) + response_data = utils.unmarshal_json(http_res.text, models.ErrConflictData) + raise models.ErrConflict(data=response_data) + if utils.match_response(http_res, "412", "application/json"): + response_data = utils.unmarshal_json( + http_res.text, models.ErrPreconditionFailedData + ) + raise models.ErrPreconditionFailed(data=response_data) if utils.match_response(http_res, "429", "application/json"): - data = utils.unmarshal_json(http_res.text, models.ErrTooManyRequestsData) - raise models.ErrTooManyRequests(data=data) + response_data = utils.unmarshal_json( + http_res.text, models.ErrTooManyRequestsData + ) + raise models.ErrTooManyRequests(data=response_data) if utils.match_response(http_res, "500", "application/json"): - data = utils.unmarshal_json( + response_data = utils.unmarshal_json( http_res.text, models.ErrInternalServerErrorData ) - raise models.ErrInternalServerError(data=data) - if utils.match_response(http_res, ["4XX", "5XX"], "*"): + raise models.ErrInternalServerError(data=response_data) + if utils.match_response(http_res, "4XX", "*"): + http_res_text = await utils.stream_to_text_async(http_res) + raise models.SDKError( + "API error occurred", http_res.status_code, http_res_text, http_res + ) + if utils.match_response(http_res, "5XX", "*"): http_res_text = await utils.stream_to_text_async(http_res) raise models.SDKError( "API error occurred", http_res.status_code, http_res_text, http_res @@ -2544,12 +3006,14 @@ def set_permissions( retries: OptionalNullable[utils.RetryConfig] = UNSET, server_url: Optional[str] = None, timeout_ms: Optional[int] = None, + http_headers: Optional[Mapping[str, str]] = None, ) -> models.SetPermissionsResponse: r""" :param request: The request object to send. :param retries: Override the default retry configuration for this method :param server_url: Override the default server URL for this method :param timeout_ms: Override the default request timeout configuration for this method in milliseconds + :param http_headers: Additional headers to set or replace on requests. """ base_url = None url_variables = None @@ -2558,12 +3022,14 @@ def set_permissions( if server_url is not None: base_url = server_url + else: + base_url = self._get_url(base_url, url_variables) if not isinstance(request, BaseModel): request = utils.unmarshal(request, models.SetPermissionsRequestBody) request = cast(models.SetPermissionsRequestBody, request) - req = self.build_request( + req = self._build_request( method="POST", path="/v1/keys.setPermissions", base_url=base_url, @@ -2574,6 +3040,7 @@ def set_permissions( request_has_query_params=True, user_agent_header="user-agent", accept_header_value="application/json", + http_headers=http_headers, security=self.sdk_configuration.security, get_serialized_body=lambda: utils.serialize_request_body( request, False, False, "json", models.SetPermissionsRequestBody @@ -2595,6 +3062,7 @@ def set_permissions( http_res = self.do_request( hook_ctx=HookContext( + base_url=base_url or "", operation_id="setPermissions", oauth2_scopes=[], security_source=get_security_from_env( @@ -2608,6 +3076,7 @@ def set_permissions( "403", "404", "409", + "412", "429", "4XX", "500", @@ -2616,7 +3085,7 @@ def set_permissions( retry_config=retry_config, ) - data: Any = None + response_data: Any = None if utils.match_response(http_res, "200", "application/json"): return models.SetPermissionsResponse( response_bodies=utils.unmarshal_json( @@ -2625,29 +3094,45 @@ def set_permissions( http_meta=models.HTTPMetadata(request=req, response=http_res), ) if utils.match_response(http_res, "400", "application/json"): - data = utils.unmarshal_json(http_res.text, models.ErrBadRequestData) - raise models.ErrBadRequest(data=data) + response_data = utils.unmarshal_json( + http_res.text, models.ErrBadRequestData + ) + raise models.ErrBadRequest(data=response_data) if utils.match_response(http_res, "401", "application/json"): - data = utils.unmarshal_json(http_res.text, models.ErrUnauthorizedData) - raise models.ErrUnauthorized(data=data) + response_data = utils.unmarshal_json( + http_res.text, models.ErrUnauthorizedData + ) + raise models.ErrUnauthorized(data=response_data) if utils.match_response(http_res, "403", "application/json"): - data = utils.unmarshal_json(http_res.text, models.ErrForbiddenData) - raise models.ErrForbidden(data=data) + response_data = utils.unmarshal_json(http_res.text, models.ErrForbiddenData) + raise models.ErrForbidden(data=response_data) if utils.match_response(http_res, "404", "application/json"): - data = utils.unmarshal_json(http_res.text, models.ErrNotFoundData) - raise models.ErrNotFound(data=data) + response_data = utils.unmarshal_json(http_res.text, models.ErrNotFoundData) + raise models.ErrNotFound(data=response_data) if utils.match_response(http_res, "409", "application/json"): - data = utils.unmarshal_json(http_res.text, models.ErrConflictData) - raise models.ErrConflict(data=data) + response_data = utils.unmarshal_json(http_res.text, models.ErrConflictData) + raise models.ErrConflict(data=response_data) + if utils.match_response(http_res, "412", "application/json"): + response_data = utils.unmarshal_json( + http_res.text, models.ErrPreconditionFailedData + ) + raise models.ErrPreconditionFailed(data=response_data) if utils.match_response(http_res, "429", "application/json"): - data = utils.unmarshal_json(http_res.text, models.ErrTooManyRequestsData) - raise models.ErrTooManyRequests(data=data) + response_data = utils.unmarshal_json( + http_res.text, models.ErrTooManyRequestsData + ) + raise models.ErrTooManyRequests(data=response_data) if utils.match_response(http_res, "500", "application/json"): - data = utils.unmarshal_json( + response_data = utils.unmarshal_json( http_res.text, models.ErrInternalServerErrorData ) - raise models.ErrInternalServerError(data=data) - if utils.match_response(http_res, ["4XX", "5XX"], "*"): + raise models.ErrInternalServerError(data=response_data) + if utils.match_response(http_res, "4XX", "*"): + http_res_text = utils.stream_to_text(http_res) + raise models.SDKError( + "API error occurred", http_res.status_code, http_res_text, http_res + ) + if utils.match_response(http_res, "5XX", "*"): http_res_text = utils.stream_to_text(http_res) raise models.SDKError( "API error occurred", http_res.status_code, http_res_text, http_res @@ -2671,12 +3156,14 @@ async def set_permissions_async( retries: OptionalNullable[utils.RetryConfig] = UNSET, server_url: Optional[str] = None, timeout_ms: Optional[int] = None, + http_headers: Optional[Mapping[str, str]] = None, ) -> models.SetPermissionsResponse: r""" :param request: The request object to send. :param retries: Override the default retry configuration for this method :param server_url: Override the default server URL for this method :param timeout_ms: Override the default request timeout configuration for this method in milliseconds + :param http_headers: Additional headers to set or replace on requests. """ base_url = None url_variables = None @@ -2685,12 +3172,14 @@ async def set_permissions_async( if server_url is not None: base_url = server_url + else: + base_url = self._get_url(base_url, url_variables) if not isinstance(request, BaseModel): request = utils.unmarshal(request, models.SetPermissionsRequestBody) request = cast(models.SetPermissionsRequestBody, request) - req = self.build_request_async( + req = self._build_request_async( method="POST", path="/v1/keys.setPermissions", base_url=base_url, @@ -2701,6 +3190,7 @@ async def set_permissions_async( request_has_query_params=True, user_agent_header="user-agent", accept_header_value="application/json", + http_headers=http_headers, security=self.sdk_configuration.security, get_serialized_body=lambda: utils.serialize_request_body( request, False, False, "json", models.SetPermissionsRequestBody @@ -2722,6 +3212,7 @@ async def set_permissions_async( http_res = await self.do_request_async( hook_ctx=HookContext( + base_url=base_url or "", operation_id="setPermissions", oauth2_scopes=[], security_source=get_security_from_env( @@ -2735,6 +3226,7 @@ async def set_permissions_async( "403", "404", "409", + "412", "429", "4XX", "500", @@ -2743,7 +3235,7 @@ async def set_permissions_async( retry_config=retry_config, ) - data: Any = None + response_data: Any = None if utils.match_response(http_res, "200", "application/json"): return models.SetPermissionsResponse( response_bodies=utils.unmarshal_json( @@ -2752,29 +3244,45 @@ async def set_permissions_async( http_meta=models.HTTPMetadata(request=req, response=http_res), ) if utils.match_response(http_res, "400", "application/json"): - data = utils.unmarshal_json(http_res.text, models.ErrBadRequestData) - raise models.ErrBadRequest(data=data) + response_data = utils.unmarshal_json( + http_res.text, models.ErrBadRequestData + ) + raise models.ErrBadRequest(data=response_data) if utils.match_response(http_res, "401", "application/json"): - data = utils.unmarshal_json(http_res.text, models.ErrUnauthorizedData) - raise models.ErrUnauthorized(data=data) + response_data = utils.unmarshal_json( + http_res.text, models.ErrUnauthorizedData + ) + raise models.ErrUnauthorized(data=response_data) if utils.match_response(http_res, "403", "application/json"): - data = utils.unmarshal_json(http_res.text, models.ErrForbiddenData) - raise models.ErrForbidden(data=data) + response_data = utils.unmarshal_json(http_res.text, models.ErrForbiddenData) + raise models.ErrForbidden(data=response_data) if utils.match_response(http_res, "404", "application/json"): - data = utils.unmarshal_json(http_res.text, models.ErrNotFoundData) - raise models.ErrNotFound(data=data) + response_data = utils.unmarshal_json(http_res.text, models.ErrNotFoundData) + raise models.ErrNotFound(data=response_data) if utils.match_response(http_res, "409", "application/json"): - data = utils.unmarshal_json(http_res.text, models.ErrConflictData) - raise models.ErrConflict(data=data) + response_data = utils.unmarshal_json(http_res.text, models.ErrConflictData) + raise models.ErrConflict(data=response_data) + if utils.match_response(http_res, "412", "application/json"): + response_data = utils.unmarshal_json( + http_res.text, models.ErrPreconditionFailedData + ) + raise models.ErrPreconditionFailed(data=response_data) if utils.match_response(http_res, "429", "application/json"): - data = utils.unmarshal_json(http_res.text, models.ErrTooManyRequestsData) - raise models.ErrTooManyRequests(data=data) + response_data = utils.unmarshal_json( + http_res.text, models.ErrTooManyRequestsData + ) + raise models.ErrTooManyRequests(data=response_data) if utils.match_response(http_res, "500", "application/json"): - data = utils.unmarshal_json( + response_data = utils.unmarshal_json( http_res.text, models.ErrInternalServerErrorData ) - raise models.ErrInternalServerError(data=data) - if utils.match_response(http_res, ["4XX", "5XX"], "*"): + raise models.ErrInternalServerError(data=response_data) + if utils.match_response(http_res, "4XX", "*"): + http_res_text = await utils.stream_to_text_async(http_res) + raise models.SDKError( + "API error occurred", http_res.status_code, http_res_text, http_res + ) + if utils.match_response(http_res, "5XX", "*"): http_res_text = await utils.stream_to_text_async(http_res) raise models.SDKError( "API error occurred", http_res.status_code, http_res_text, http_res @@ -2796,12 +3304,14 @@ def add_roles( retries: OptionalNullable[utils.RetryConfig] = UNSET, server_url: Optional[str] = None, timeout_ms: Optional[int] = None, + http_headers: Optional[Mapping[str, str]] = None, ) -> models.AddRolesResponse: r""" :param request: The request object to send. :param retries: Override the default retry configuration for this method :param server_url: Override the default server URL for this method :param timeout_ms: Override the default request timeout configuration for this method in milliseconds + :param http_headers: Additional headers to set or replace on requests. """ base_url = None url_variables = None @@ -2810,12 +3320,14 @@ def add_roles( if server_url is not None: base_url = server_url + else: + base_url = self._get_url(base_url, url_variables) if not isinstance(request, BaseModel): request = utils.unmarshal(request, models.AddRolesRequestBody) request = cast(models.AddRolesRequestBody, request) - req = self.build_request( + req = self._build_request( method="POST", path="/v1/keys.addRoles", base_url=base_url, @@ -2826,6 +3338,7 @@ def add_roles( request_has_query_params=True, user_agent_header="user-agent", accept_header_value="application/json", + http_headers=http_headers, security=self.sdk_configuration.security, get_serialized_body=lambda: utils.serialize_request_body( request, False, False, "json", models.AddRolesRequestBody @@ -2847,6 +3360,7 @@ def add_roles( http_res = self.do_request( hook_ctx=HookContext( + base_url=base_url or "", operation_id="addRoles", oauth2_scopes=[], security_source=get_security_from_env( @@ -2860,6 +3374,7 @@ def add_roles( "403", "404", "409", + "412", "429", "4XX", "500", @@ -2868,7 +3383,7 @@ def add_roles( retry_config=retry_config, ) - data: Any = None + response_data: Any = None if utils.match_response(http_res, "200", "application/json"): return models.AddRolesResponse( response_bodies=utils.unmarshal_json( @@ -2877,29 +3392,45 @@ def add_roles( http_meta=models.HTTPMetadata(request=req, response=http_res), ) if utils.match_response(http_res, "400", "application/json"): - data = utils.unmarshal_json(http_res.text, models.ErrBadRequestData) - raise models.ErrBadRequest(data=data) + response_data = utils.unmarshal_json( + http_res.text, models.ErrBadRequestData + ) + raise models.ErrBadRequest(data=response_data) if utils.match_response(http_res, "401", "application/json"): - data = utils.unmarshal_json(http_res.text, models.ErrUnauthorizedData) - raise models.ErrUnauthorized(data=data) + response_data = utils.unmarshal_json( + http_res.text, models.ErrUnauthorizedData + ) + raise models.ErrUnauthorized(data=response_data) if utils.match_response(http_res, "403", "application/json"): - data = utils.unmarshal_json(http_res.text, models.ErrForbiddenData) - raise models.ErrForbidden(data=data) + response_data = utils.unmarshal_json(http_res.text, models.ErrForbiddenData) + raise models.ErrForbidden(data=response_data) if utils.match_response(http_res, "404", "application/json"): - data = utils.unmarshal_json(http_res.text, models.ErrNotFoundData) - raise models.ErrNotFound(data=data) + response_data = utils.unmarshal_json(http_res.text, models.ErrNotFoundData) + raise models.ErrNotFound(data=response_data) if utils.match_response(http_res, "409", "application/json"): - data = utils.unmarshal_json(http_res.text, models.ErrConflictData) - raise models.ErrConflict(data=data) + response_data = utils.unmarshal_json(http_res.text, models.ErrConflictData) + raise models.ErrConflict(data=response_data) + if utils.match_response(http_res, "412", "application/json"): + response_data = utils.unmarshal_json( + http_res.text, models.ErrPreconditionFailedData + ) + raise models.ErrPreconditionFailed(data=response_data) if utils.match_response(http_res, "429", "application/json"): - data = utils.unmarshal_json(http_res.text, models.ErrTooManyRequestsData) - raise models.ErrTooManyRequests(data=data) + response_data = utils.unmarshal_json( + http_res.text, models.ErrTooManyRequestsData + ) + raise models.ErrTooManyRequests(data=response_data) if utils.match_response(http_res, "500", "application/json"): - data = utils.unmarshal_json( + response_data = utils.unmarshal_json( http_res.text, models.ErrInternalServerErrorData ) - raise models.ErrInternalServerError(data=data) - if utils.match_response(http_res, ["4XX", "5XX"], "*"): + raise models.ErrInternalServerError(data=response_data) + if utils.match_response(http_res, "4XX", "*"): + http_res_text = utils.stream_to_text(http_res) + raise models.SDKError( + "API error occurred", http_res.status_code, http_res_text, http_res + ) + if utils.match_response(http_res, "5XX", "*"): http_res_text = utils.stream_to_text(http_res) raise models.SDKError( "API error occurred", http_res.status_code, http_res_text, http_res @@ -2921,12 +3452,14 @@ async def add_roles_async( retries: OptionalNullable[utils.RetryConfig] = UNSET, server_url: Optional[str] = None, timeout_ms: Optional[int] = None, + http_headers: Optional[Mapping[str, str]] = None, ) -> models.AddRolesResponse: r""" :param request: The request object to send. :param retries: Override the default retry configuration for this method :param server_url: Override the default server URL for this method :param timeout_ms: Override the default request timeout configuration for this method in milliseconds + :param http_headers: Additional headers to set or replace on requests. """ base_url = None url_variables = None @@ -2935,12 +3468,14 @@ async def add_roles_async( if server_url is not None: base_url = server_url + else: + base_url = self._get_url(base_url, url_variables) if not isinstance(request, BaseModel): request = utils.unmarshal(request, models.AddRolesRequestBody) request = cast(models.AddRolesRequestBody, request) - req = self.build_request_async( + req = self._build_request_async( method="POST", path="/v1/keys.addRoles", base_url=base_url, @@ -2951,6 +3486,7 @@ async def add_roles_async( request_has_query_params=True, user_agent_header="user-agent", accept_header_value="application/json", + http_headers=http_headers, security=self.sdk_configuration.security, get_serialized_body=lambda: utils.serialize_request_body( request, False, False, "json", models.AddRolesRequestBody @@ -2972,6 +3508,7 @@ async def add_roles_async( http_res = await self.do_request_async( hook_ctx=HookContext( + base_url=base_url or "", operation_id="addRoles", oauth2_scopes=[], security_source=get_security_from_env( @@ -2985,6 +3522,7 @@ async def add_roles_async( "403", "404", "409", + "412", "429", "4XX", "500", @@ -2993,7 +3531,7 @@ async def add_roles_async( retry_config=retry_config, ) - data: Any = None + response_data: Any = None if utils.match_response(http_res, "200", "application/json"): return models.AddRolesResponse( response_bodies=utils.unmarshal_json( @@ -3002,29 +3540,45 @@ async def add_roles_async( http_meta=models.HTTPMetadata(request=req, response=http_res), ) if utils.match_response(http_res, "400", "application/json"): - data = utils.unmarshal_json(http_res.text, models.ErrBadRequestData) - raise models.ErrBadRequest(data=data) + response_data = utils.unmarshal_json( + http_res.text, models.ErrBadRequestData + ) + raise models.ErrBadRequest(data=response_data) if utils.match_response(http_res, "401", "application/json"): - data = utils.unmarshal_json(http_res.text, models.ErrUnauthorizedData) - raise models.ErrUnauthorized(data=data) + response_data = utils.unmarshal_json( + http_res.text, models.ErrUnauthorizedData + ) + raise models.ErrUnauthorized(data=response_data) if utils.match_response(http_res, "403", "application/json"): - data = utils.unmarshal_json(http_res.text, models.ErrForbiddenData) - raise models.ErrForbidden(data=data) + response_data = utils.unmarshal_json(http_res.text, models.ErrForbiddenData) + raise models.ErrForbidden(data=response_data) if utils.match_response(http_res, "404", "application/json"): - data = utils.unmarshal_json(http_res.text, models.ErrNotFoundData) - raise models.ErrNotFound(data=data) + response_data = utils.unmarshal_json(http_res.text, models.ErrNotFoundData) + raise models.ErrNotFound(data=response_data) if utils.match_response(http_res, "409", "application/json"): - data = utils.unmarshal_json(http_res.text, models.ErrConflictData) - raise models.ErrConflict(data=data) + response_data = utils.unmarshal_json(http_res.text, models.ErrConflictData) + raise models.ErrConflict(data=response_data) + if utils.match_response(http_res, "412", "application/json"): + response_data = utils.unmarshal_json( + http_res.text, models.ErrPreconditionFailedData + ) + raise models.ErrPreconditionFailed(data=response_data) if utils.match_response(http_res, "429", "application/json"): - data = utils.unmarshal_json(http_res.text, models.ErrTooManyRequestsData) - raise models.ErrTooManyRequests(data=data) + response_data = utils.unmarshal_json( + http_res.text, models.ErrTooManyRequestsData + ) + raise models.ErrTooManyRequests(data=response_data) if utils.match_response(http_res, "500", "application/json"): - data = utils.unmarshal_json( + response_data = utils.unmarshal_json( http_res.text, models.ErrInternalServerErrorData ) - raise models.ErrInternalServerError(data=data) - if utils.match_response(http_res, ["4XX", "5XX"], "*"): + raise models.ErrInternalServerError(data=response_data) + if utils.match_response(http_res, "4XX", "*"): + http_res_text = await utils.stream_to_text_async(http_res) + raise models.SDKError( + "API error occurred", http_res.status_code, http_res_text, http_res + ) + if utils.match_response(http_res, "5XX", "*"): http_res_text = await utils.stream_to_text_async(http_res) raise models.SDKError( "API error occurred", http_res.status_code, http_res_text, http_res @@ -3048,12 +3602,14 @@ def remove_roles( retries: OptionalNullable[utils.RetryConfig] = UNSET, server_url: Optional[str] = None, timeout_ms: Optional[int] = None, + http_headers: Optional[Mapping[str, str]] = None, ) -> models.RemoveRolesResponse: r""" :param request: The request object to send. :param retries: Override the default retry configuration for this method :param server_url: Override the default server URL for this method :param timeout_ms: Override the default request timeout configuration for this method in milliseconds + :param http_headers: Additional headers to set or replace on requests. """ base_url = None url_variables = None @@ -3062,12 +3618,14 @@ def remove_roles( if server_url is not None: base_url = server_url + else: + base_url = self._get_url(base_url, url_variables) if not isinstance(request, BaseModel): request = utils.unmarshal(request, models.RemoveRolesRequestBody) request = cast(models.RemoveRolesRequestBody, request) - req = self.build_request( + req = self._build_request( method="POST", path="/v1/keys.removeRoles", base_url=base_url, @@ -3078,6 +3636,7 @@ def remove_roles( request_has_query_params=True, user_agent_header="user-agent", accept_header_value="application/json", + http_headers=http_headers, security=self.sdk_configuration.security, get_serialized_body=lambda: utils.serialize_request_body( request, False, False, "json", models.RemoveRolesRequestBody @@ -3099,6 +3658,7 @@ def remove_roles( http_res = self.do_request( hook_ctx=HookContext( + base_url=base_url or "", operation_id="removeRoles", oauth2_scopes=[], security_source=get_security_from_env( @@ -3112,6 +3672,7 @@ def remove_roles( "403", "404", "409", + "412", "429", "4XX", "500", @@ -3120,7 +3681,7 @@ def remove_roles( retry_config=retry_config, ) - data: Any = None + response_data: Any = None if utils.match_response(http_res, "200", "application/json"): return models.RemoveRolesResponse( object=utils.unmarshal_json( @@ -3129,29 +3690,45 @@ def remove_roles( http_meta=models.HTTPMetadata(request=req, response=http_res), ) if utils.match_response(http_res, "400", "application/json"): - data = utils.unmarshal_json(http_res.text, models.ErrBadRequestData) - raise models.ErrBadRequest(data=data) + response_data = utils.unmarshal_json( + http_res.text, models.ErrBadRequestData + ) + raise models.ErrBadRequest(data=response_data) if utils.match_response(http_res, "401", "application/json"): - data = utils.unmarshal_json(http_res.text, models.ErrUnauthorizedData) - raise models.ErrUnauthorized(data=data) + response_data = utils.unmarshal_json( + http_res.text, models.ErrUnauthorizedData + ) + raise models.ErrUnauthorized(data=response_data) if utils.match_response(http_res, "403", "application/json"): - data = utils.unmarshal_json(http_res.text, models.ErrForbiddenData) - raise models.ErrForbidden(data=data) + response_data = utils.unmarshal_json(http_res.text, models.ErrForbiddenData) + raise models.ErrForbidden(data=response_data) if utils.match_response(http_res, "404", "application/json"): - data = utils.unmarshal_json(http_res.text, models.ErrNotFoundData) - raise models.ErrNotFound(data=data) + response_data = utils.unmarshal_json(http_res.text, models.ErrNotFoundData) + raise models.ErrNotFound(data=response_data) if utils.match_response(http_res, "409", "application/json"): - data = utils.unmarshal_json(http_res.text, models.ErrConflictData) - raise models.ErrConflict(data=data) + response_data = utils.unmarshal_json(http_res.text, models.ErrConflictData) + raise models.ErrConflict(data=response_data) + if utils.match_response(http_res, "412", "application/json"): + response_data = utils.unmarshal_json( + http_res.text, models.ErrPreconditionFailedData + ) + raise models.ErrPreconditionFailed(data=response_data) if utils.match_response(http_res, "429", "application/json"): - data = utils.unmarshal_json(http_res.text, models.ErrTooManyRequestsData) - raise models.ErrTooManyRequests(data=data) + response_data = utils.unmarshal_json( + http_res.text, models.ErrTooManyRequestsData + ) + raise models.ErrTooManyRequests(data=response_data) if utils.match_response(http_res, "500", "application/json"): - data = utils.unmarshal_json( + response_data = utils.unmarshal_json( http_res.text, models.ErrInternalServerErrorData ) - raise models.ErrInternalServerError(data=data) - if utils.match_response(http_res, ["4XX", "5XX"], "*"): + raise models.ErrInternalServerError(data=response_data) + if utils.match_response(http_res, "4XX", "*"): + http_res_text = utils.stream_to_text(http_res) + raise models.SDKError( + "API error occurred", http_res.status_code, http_res_text, http_res + ) + if utils.match_response(http_res, "5XX", "*"): http_res_text = utils.stream_to_text(http_res) raise models.SDKError( "API error occurred", http_res.status_code, http_res_text, http_res @@ -3175,12 +3752,14 @@ async def remove_roles_async( retries: OptionalNullable[utils.RetryConfig] = UNSET, server_url: Optional[str] = None, timeout_ms: Optional[int] = None, + http_headers: Optional[Mapping[str, str]] = None, ) -> models.RemoveRolesResponse: r""" :param request: The request object to send. :param retries: Override the default retry configuration for this method :param server_url: Override the default server URL for this method :param timeout_ms: Override the default request timeout configuration for this method in milliseconds + :param http_headers: Additional headers to set or replace on requests. """ base_url = None url_variables = None @@ -3189,12 +3768,14 @@ async def remove_roles_async( if server_url is not None: base_url = server_url + else: + base_url = self._get_url(base_url, url_variables) if not isinstance(request, BaseModel): request = utils.unmarshal(request, models.RemoveRolesRequestBody) request = cast(models.RemoveRolesRequestBody, request) - req = self.build_request_async( + req = self._build_request_async( method="POST", path="/v1/keys.removeRoles", base_url=base_url, @@ -3205,6 +3786,7 @@ async def remove_roles_async( request_has_query_params=True, user_agent_header="user-agent", accept_header_value="application/json", + http_headers=http_headers, security=self.sdk_configuration.security, get_serialized_body=lambda: utils.serialize_request_body( request, False, False, "json", models.RemoveRolesRequestBody @@ -3226,6 +3808,7 @@ async def remove_roles_async( http_res = await self.do_request_async( hook_ctx=HookContext( + base_url=base_url or "", operation_id="removeRoles", oauth2_scopes=[], security_source=get_security_from_env( @@ -3239,6 +3822,7 @@ async def remove_roles_async( "403", "404", "409", + "412", "429", "4XX", "500", @@ -3247,7 +3831,7 @@ async def remove_roles_async( retry_config=retry_config, ) - data: Any = None + response_data: Any = None if utils.match_response(http_res, "200", "application/json"): return models.RemoveRolesResponse( object=utils.unmarshal_json( @@ -3256,29 +3840,45 @@ async def remove_roles_async( http_meta=models.HTTPMetadata(request=req, response=http_res), ) if utils.match_response(http_res, "400", "application/json"): - data = utils.unmarshal_json(http_res.text, models.ErrBadRequestData) - raise models.ErrBadRequest(data=data) + response_data = utils.unmarshal_json( + http_res.text, models.ErrBadRequestData + ) + raise models.ErrBadRequest(data=response_data) if utils.match_response(http_res, "401", "application/json"): - data = utils.unmarshal_json(http_res.text, models.ErrUnauthorizedData) - raise models.ErrUnauthorized(data=data) + response_data = utils.unmarshal_json( + http_res.text, models.ErrUnauthorizedData + ) + raise models.ErrUnauthorized(data=response_data) if utils.match_response(http_res, "403", "application/json"): - data = utils.unmarshal_json(http_res.text, models.ErrForbiddenData) - raise models.ErrForbidden(data=data) + response_data = utils.unmarshal_json(http_res.text, models.ErrForbiddenData) + raise models.ErrForbidden(data=response_data) if utils.match_response(http_res, "404", "application/json"): - data = utils.unmarshal_json(http_res.text, models.ErrNotFoundData) - raise models.ErrNotFound(data=data) + response_data = utils.unmarshal_json(http_res.text, models.ErrNotFoundData) + raise models.ErrNotFound(data=response_data) if utils.match_response(http_res, "409", "application/json"): - data = utils.unmarshal_json(http_res.text, models.ErrConflictData) - raise models.ErrConflict(data=data) + response_data = utils.unmarshal_json(http_res.text, models.ErrConflictData) + raise models.ErrConflict(data=response_data) + if utils.match_response(http_res, "412", "application/json"): + response_data = utils.unmarshal_json( + http_res.text, models.ErrPreconditionFailedData + ) + raise models.ErrPreconditionFailed(data=response_data) if utils.match_response(http_res, "429", "application/json"): - data = utils.unmarshal_json(http_res.text, models.ErrTooManyRequestsData) - raise models.ErrTooManyRequests(data=data) + response_data = utils.unmarshal_json( + http_res.text, models.ErrTooManyRequestsData + ) + raise models.ErrTooManyRequests(data=response_data) if utils.match_response(http_res, "500", "application/json"): - data = utils.unmarshal_json( + response_data = utils.unmarshal_json( http_res.text, models.ErrInternalServerErrorData ) - raise models.ErrInternalServerError(data=data) - if utils.match_response(http_res, ["4XX", "5XX"], "*"): + raise models.ErrInternalServerError(data=response_data) + if utils.match_response(http_res, "4XX", "*"): + http_res_text = await utils.stream_to_text_async(http_res) + raise models.SDKError( + "API error occurred", http_res.status_code, http_res_text, http_res + ) + if utils.match_response(http_res, "5XX", "*"): http_res_text = await utils.stream_to_text_async(http_res) raise models.SDKError( "API error occurred", http_res.status_code, http_res_text, http_res @@ -3300,12 +3900,14 @@ def set_roles( retries: OptionalNullable[utils.RetryConfig] = UNSET, server_url: Optional[str] = None, timeout_ms: Optional[int] = None, + http_headers: Optional[Mapping[str, str]] = None, ) -> models.SetRolesResponse: r""" :param request: The request object to send. :param retries: Override the default retry configuration for this method :param server_url: Override the default server URL for this method :param timeout_ms: Override the default request timeout configuration for this method in milliseconds + :param http_headers: Additional headers to set or replace on requests. """ base_url = None url_variables = None @@ -3314,12 +3916,14 @@ def set_roles( if server_url is not None: base_url = server_url + else: + base_url = self._get_url(base_url, url_variables) if not isinstance(request, BaseModel): request = utils.unmarshal(request, models.SetRolesRequestBody) request = cast(models.SetRolesRequestBody, request) - req = self.build_request( + req = self._build_request( method="POST", path="/v1/keys.setRoles", base_url=base_url, @@ -3330,6 +3934,7 @@ def set_roles( request_has_query_params=True, user_agent_header="user-agent", accept_header_value="application/json", + http_headers=http_headers, security=self.sdk_configuration.security, get_serialized_body=lambda: utils.serialize_request_body( request, False, False, "json", models.SetRolesRequestBody @@ -3351,6 +3956,7 @@ def set_roles( http_res = self.do_request( hook_ctx=HookContext( + base_url=base_url or "", operation_id="setRoles", oauth2_scopes=[], security_source=get_security_from_env( @@ -3364,6 +3970,7 @@ def set_roles( "403", "404", "409", + "412", "429", "4XX", "500", @@ -3372,7 +3979,7 @@ def set_roles( retry_config=retry_config, ) - data: Any = None + response_data: Any = None if utils.match_response(http_res, "200", "application/json"): return models.SetRolesResponse( response_bodies=utils.unmarshal_json( @@ -3381,29 +3988,45 @@ def set_roles( http_meta=models.HTTPMetadata(request=req, response=http_res), ) if utils.match_response(http_res, "400", "application/json"): - data = utils.unmarshal_json(http_res.text, models.ErrBadRequestData) - raise models.ErrBadRequest(data=data) + response_data = utils.unmarshal_json( + http_res.text, models.ErrBadRequestData + ) + raise models.ErrBadRequest(data=response_data) if utils.match_response(http_res, "401", "application/json"): - data = utils.unmarshal_json(http_res.text, models.ErrUnauthorizedData) - raise models.ErrUnauthorized(data=data) + response_data = utils.unmarshal_json( + http_res.text, models.ErrUnauthorizedData + ) + raise models.ErrUnauthorized(data=response_data) if utils.match_response(http_res, "403", "application/json"): - data = utils.unmarshal_json(http_res.text, models.ErrForbiddenData) - raise models.ErrForbidden(data=data) + response_data = utils.unmarshal_json(http_res.text, models.ErrForbiddenData) + raise models.ErrForbidden(data=response_data) if utils.match_response(http_res, "404", "application/json"): - data = utils.unmarshal_json(http_res.text, models.ErrNotFoundData) - raise models.ErrNotFound(data=data) + response_data = utils.unmarshal_json(http_res.text, models.ErrNotFoundData) + raise models.ErrNotFound(data=response_data) if utils.match_response(http_res, "409", "application/json"): - data = utils.unmarshal_json(http_res.text, models.ErrConflictData) - raise models.ErrConflict(data=data) + response_data = utils.unmarshal_json(http_res.text, models.ErrConflictData) + raise models.ErrConflict(data=response_data) + if utils.match_response(http_res, "412", "application/json"): + response_data = utils.unmarshal_json( + http_res.text, models.ErrPreconditionFailedData + ) + raise models.ErrPreconditionFailed(data=response_data) if utils.match_response(http_res, "429", "application/json"): - data = utils.unmarshal_json(http_res.text, models.ErrTooManyRequestsData) - raise models.ErrTooManyRequests(data=data) + response_data = utils.unmarshal_json( + http_res.text, models.ErrTooManyRequestsData + ) + raise models.ErrTooManyRequests(data=response_data) if utils.match_response(http_res, "500", "application/json"): - data = utils.unmarshal_json( + response_data = utils.unmarshal_json( http_res.text, models.ErrInternalServerErrorData ) - raise models.ErrInternalServerError(data=data) - if utils.match_response(http_res, ["4XX", "5XX"], "*"): + raise models.ErrInternalServerError(data=response_data) + if utils.match_response(http_res, "4XX", "*"): + http_res_text = utils.stream_to_text(http_res) + raise models.SDKError( + "API error occurred", http_res.status_code, http_res_text, http_res + ) + if utils.match_response(http_res, "5XX", "*"): http_res_text = utils.stream_to_text(http_res) raise models.SDKError( "API error occurred", http_res.status_code, http_res_text, http_res @@ -3425,12 +4048,14 @@ async def set_roles_async( retries: OptionalNullable[utils.RetryConfig] = UNSET, server_url: Optional[str] = None, timeout_ms: Optional[int] = None, + http_headers: Optional[Mapping[str, str]] = None, ) -> models.SetRolesResponse: r""" :param request: The request object to send. :param retries: Override the default retry configuration for this method :param server_url: Override the default server URL for this method :param timeout_ms: Override the default request timeout configuration for this method in milliseconds + :param http_headers: Additional headers to set or replace on requests. """ base_url = None url_variables = None @@ -3439,12 +4064,14 @@ async def set_roles_async( if server_url is not None: base_url = server_url + else: + base_url = self._get_url(base_url, url_variables) if not isinstance(request, BaseModel): request = utils.unmarshal(request, models.SetRolesRequestBody) request = cast(models.SetRolesRequestBody, request) - req = self.build_request_async( + req = self._build_request_async( method="POST", path="/v1/keys.setRoles", base_url=base_url, @@ -3455,6 +4082,7 @@ async def set_roles_async( request_has_query_params=True, user_agent_header="user-agent", accept_header_value="application/json", + http_headers=http_headers, security=self.sdk_configuration.security, get_serialized_body=lambda: utils.serialize_request_body( request, False, False, "json", models.SetRolesRequestBody @@ -3476,6 +4104,7 @@ async def set_roles_async( http_res = await self.do_request_async( hook_ctx=HookContext( + base_url=base_url or "", operation_id="setRoles", oauth2_scopes=[], security_source=get_security_from_env( @@ -3489,6 +4118,7 @@ async def set_roles_async( "403", "404", "409", + "412", "429", "4XX", "500", @@ -3497,7 +4127,7 @@ async def set_roles_async( retry_config=retry_config, ) - data: Any = None + response_data: Any = None if utils.match_response(http_res, "200", "application/json"): return models.SetRolesResponse( response_bodies=utils.unmarshal_json( @@ -3506,29 +4136,45 @@ async def set_roles_async( http_meta=models.HTTPMetadata(request=req, response=http_res), ) if utils.match_response(http_res, "400", "application/json"): - data = utils.unmarshal_json(http_res.text, models.ErrBadRequestData) - raise models.ErrBadRequest(data=data) + response_data = utils.unmarshal_json( + http_res.text, models.ErrBadRequestData + ) + raise models.ErrBadRequest(data=response_data) if utils.match_response(http_res, "401", "application/json"): - data = utils.unmarshal_json(http_res.text, models.ErrUnauthorizedData) - raise models.ErrUnauthorized(data=data) + response_data = utils.unmarshal_json( + http_res.text, models.ErrUnauthorizedData + ) + raise models.ErrUnauthorized(data=response_data) if utils.match_response(http_res, "403", "application/json"): - data = utils.unmarshal_json(http_res.text, models.ErrForbiddenData) - raise models.ErrForbidden(data=data) + response_data = utils.unmarshal_json(http_res.text, models.ErrForbiddenData) + raise models.ErrForbidden(data=response_data) if utils.match_response(http_res, "404", "application/json"): - data = utils.unmarshal_json(http_res.text, models.ErrNotFoundData) - raise models.ErrNotFound(data=data) + response_data = utils.unmarshal_json(http_res.text, models.ErrNotFoundData) + raise models.ErrNotFound(data=response_data) if utils.match_response(http_res, "409", "application/json"): - data = utils.unmarshal_json(http_res.text, models.ErrConflictData) - raise models.ErrConflict(data=data) + response_data = utils.unmarshal_json(http_res.text, models.ErrConflictData) + raise models.ErrConflict(data=response_data) + if utils.match_response(http_res, "412", "application/json"): + response_data = utils.unmarshal_json( + http_res.text, models.ErrPreconditionFailedData + ) + raise models.ErrPreconditionFailed(data=response_data) if utils.match_response(http_res, "429", "application/json"): - data = utils.unmarshal_json(http_res.text, models.ErrTooManyRequestsData) - raise models.ErrTooManyRequests(data=data) + response_data = utils.unmarshal_json( + http_res.text, models.ErrTooManyRequestsData + ) + raise models.ErrTooManyRequests(data=response_data) if utils.match_response(http_res, "500", "application/json"): - data = utils.unmarshal_json( + response_data = utils.unmarshal_json( http_res.text, models.ErrInternalServerErrorData ) - raise models.ErrInternalServerError(data=data) - if utils.match_response(http_res, ["4XX", "5XX"], "*"): + raise models.ErrInternalServerError(data=response_data) + if utils.match_response(http_res, "4XX", "*"): + http_res_text = await utils.stream_to_text_async(http_res) + raise models.SDKError( + "API error occurred", http_res.status_code, http_res_text, http_res + ) + if utils.match_response(http_res, "5XX", "*"): http_res_text = await utils.stream_to_text_async(http_res) raise models.SDKError( "API error occurred", http_res.status_code, http_res_text, http_res diff --git a/src/unkey_py/liveness.py b/src/unkey_py/liveness.py index 629732f..8d046fb 100644 --- a/src/unkey_py/liveness.py +++ b/src/unkey_py/liveness.py @@ -1,7 +1,7 @@ """Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT.""" from .basesdk import BaseSDK -from typing import Any, Optional +from typing import Any, Mapping, Optional from unkey_py import models, utils from unkey_py._hooks import HookContext from unkey_py.types import OptionalNullable, UNSET @@ -15,11 +15,13 @@ def check( retries: OptionalNullable[utils.RetryConfig] = UNSET, server_url: Optional[str] = None, timeout_ms: Optional[int] = None, + http_headers: Optional[Mapping[str, str]] = None, ) -> models.V1LivenessResponse: r""" :param retries: Override the default retry configuration for this method :param server_url: Override the default server URL for this method :param timeout_ms: Override the default request timeout configuration for this method in milliseconds + :param http_headers: Additional headers to set or replace on requests. """ base_url = None url_variables = None @@ -28,7 +30,9 @@ def check( if server_url is not None: base_url = server_url - req = self.build_request( + else: + base_url = self._get_url(base_url, url_variables) + req = self._build_request( method="GET", path="/v1/liveness", base_url=base_url, @@ -39,6 +43,7 @@ def check( request_has_query_params=True, user_agent_header="user-agent", accept_header_value="application/json", + http_headers=http_headers, security=self.sdk_configuration.security, timeout_ms=timeout_ms, ) @@ -57,6 +62,7 @@ def check( http_res = self.do_request( hook_ctx=HookContext( + base_url=base_url or "", operation_id="v1.liveness", oauth2_scopes=[], security_source=get_security_from_env( @@ -70,6 +76,7 @@ def check( "403", "404", "409", + "412", "429", "4XX", "500", @@ -78,7 +85,7 @@ def check( retry_config=retry_config, ) - data: Any = None + response_data: Any = None if utils.match_response(http_res, "200", "application/json"): return models.V1LivenessResponse( object=utils.unmarshal_json( @@ -87,29 +94,45 @@ def check( http_meta=models.HTTPMetadata(request=req, response=http_res), ) if utils.match_response(http_res, "400", "application/json"): - data = utils.unmarshal_json(http_res.text, models.ErrBadRequestData) - raise models.ErrBadRequest(data=data) + response_data = utils.unmarshal_json( + http_res.text, models.ErrBadRequestData + ) + raise models.ErrBadRequest(data=response_data) if utils.match_response(http_res, "401", "application/json"): - data = utils.unmarshal_json(http_res.text, models.ErrUnauthorizedData) - raise models.ErrUnauthorized(data=data) + response_data = utils.unmarshal_json( + http_res.text, models.ErrUnauthorizedData + ) + raise models.ErrUnauthorized(data=response_data) if utils.match_response(http_res, "403", "application/json"): - data = utils.unmarshal_json(http_res.text, models.ErrForbiddenData) - raise models.ErrForbidden(data=data) + response_data = utils.unmarshal_json(http_res.text, models.ErrForbiddenData) + raise models.ErrForbidden(data=response_data) if utils.match_response(http_res, "404", "application/json"): - data = utils.unmarshal_json(http_res.text, models.ErrNotFoundData) - raise models.ErrNotFound(data=data) + response_data = utils.unmarshal_json(http_res.text, models.ErrNotFoundData) + raise models.ErrNotFound(data=response_data) if utils.match_response(http_res, "409", "application/json"): - data = utils.unmarshal_json(http_res.text, models.ErrConflictData) - raise models.ErrConflict(data=data) + response_data = utils.unmarshal_json(http_res.text, models.ErrConflictData) + raise models.ErrConflict(data=response_data) + if utils.match_response(http_res, "412", "application/json"): + response_data = utils.unmarshal_json( + http_res.text, models.ErrPreconditionFailedData + ) + raise models.ErrPreconditionFailed(data=response_data) if utils.match_response(http_res, "429", "application/json"): - data = utils.unmarshal_json(http_res.text, models.ErrTooManyRequestsData) - raise models.ErrTooManyRequests(data=data) + response_data = utils.unmarshal_json( + http_res.text, models.ErrTooManyRequestsData + ) + raise models.ErrTooManyRequests(data=response_data) if utils.match_response(http_res, "500", "application/json"): - data = utils.unmarshal_json( + response_data = utils.unmarshal_json( http_res.text, models.ErrInternalServerErrorData ) - raise models.ErrInternalServerError(data=data) - if utils.match_response(http_res, ["4XX", "5XX"], "*"): + raise models.ErrInternalServerError(data=response_data) + if utils.match_response(http_res, "4XX", "*"): + http_res_text = utils.stream_to_text(http_res) + raise models.SDKError( + "API error occurred", http_res.status_code, http_res_text, http_res + ) + if utils.match_response(http_res, "5XX", "*"): http_res_text = utils.stream_to_text(http_res) raise models.SDKError( "API error occurred", http_res.status_code, http_res_text, http_res @@ -130,11 +153,13 @@ async def check_async( retries: OptionalNullable[utils.RetryConfig] = UNSET, server_url: Optional[str] = None, timeout_ms: Optional[int] = None, + http_headers: Optional[Mapping[str, str]] = None, ) -> models.V1LivenessResponse: r""" :param retries: Override the default retry configuration for this method :param server_url: Override the default server URL for this method :param timeout_ms: Override the default request timeout configuration for this method in milliseconds + :param http_headers: Additional headers to set or replace on requests. """ base_url = None url_variables = None @@ -143,7 +168,9 @@ async def check_async( if server_url is not None: base_url = server_url - req = self.build_request_async( + else: + base_url = self._get_url(base_url, url_variables) + req = self._build_request_async( method="GET", path="/v1/liveness", base_url=base_url, @@ -154,6 +181,7 @@ async def check_async( request_has_query_params=True, user_agent_header="user-agent", accept_header_value="application/json", + http_headers=http_headers, security=self.sdk_configuration.security, timeout_ms=timeout_ms, ) @@ -172,6 +200,7 @@ async def check_async( http_res = await self.do_request_async( hook_ctx=HookContext( + base_url=base_url or "", operation_id="v1.liveness", oauth2_scopes=[], security_source=get_security_from_env( @@ -185,6 +214,7 @@ async def check_async( "403", "404", "409", + "412", "429", "4XX", "500", @@ -193,7 +223,7 @@ async def check_async( retry_config=retry_config, ) - data: Any = None + response_data: Any = None if utils.match_response(http_res, "200", "application/json"): return models.V1LivenessResponse( object=utils.unmarshal_json( @@ -202,29 +232,45 @@ async def check_async( http_meta=models.HTTPMetadata(request=req, response=http_res), ) if utils.match_response(http_res, "400", "application/json"): - data = utils.unmarshal_json(http_res.text, models.ErrBadRequestData) - raise models.ErrBadRequest(data=data) + response_data = utils.unmarshal_json( + http_res.text, models.ErrBadRequestData + ) + raise models.ErrBadRequest(data=response_data) if utils.match_response(http_res, "401", "application/json"): - data = utils.unmarshal_json(http_res.text, models.ErrUnauthorizedData) - raise models.ErrUnauthorized(data=data) + response_data = utils.unmarshal_json( + http_res.text, models.ErrUnauthorizedData + ) + raise models.ErrUnauthorized(data=response_data) if utils.match_response(http_res, "403", "application/json"): - data = utils.unmarshal_json(http_res.text, models.ErrForbiddenData) - raise models.ErrForbidden(data=data) + response_data = utils.unmarshal_json(http_res.text, models.ErrForbiddenData) + raise models.ErrForbidden(data=response_data) if utils.match_response(http_res, "404", "application/json"): - data = utils.unmarshal_json(http_res.text, models.ErrNotFoundData) - raise models.ErrNotFound(data=data) + response_data = utils.unmarshal_json(http_res.text, models.ErrNotFoundData) + raise models.ErrNotFound(data=response_data) if utils.match_response(http_res, "409", "application/json"): - data = utils.unmarshal_json(http_res.text, models.ErrConflictData) - raise models.ErrConflict(data=data) + response_data = utils.unmarshal_json(http_res.text, models.ErrConflictData) + raise models.ErrConflict(data=response_data) + if utils.match_response(http_res, "412", "application/json"): + response_data = utils.unmarshal_json( + http_res.text, models.ErrPreconditionFailedData + ) + raise models.ErrPreconditionFailed(data=response_data) if utils.match_response(http_res, "429", "application/json"): - data = utils.unmarshal_json(http_res.text, models.ErrTooManyRequestsData) - raise models.ErrTooManyRequests(data=data) + response_data = utils.unmarshal_json( + http_res.text, models.ErrTooManyRequestsData + ) + raise models.ErrTooManyRequests(data=response_data) if utils.match_response(http_res, "500", "application/json"): - data = utils.unmarshal_json( + response_data = utils.unmarshal_json( http_res.text, models.ErrInternalServerErrorData ) - raise models.ErrInternalServerError(data=data) - if utils.match_response(http_res, ["4XX", "5XX"], "*"): + raise models.ErrInternalServerError(data=response_data) + if utils.match_response(http_res, "4XX", "*"): + http_res_text = await utils.stream_to_text_async(http_res) + raise models.SDKError( + "API error occurred", http_res.status_code, http_res_text, http_res + ) + if utils.match_response(http_res, "5XX", "*"): http_res_text = await utils.stream_to_text_async(http_res) raise models.SDKError( "API error occurred", http_res.status_code, http_res_text, http_res diff --git a/src/unkey_py/migrations.py b/src/unkey_py/migrations.py index a2c69e9..efda79b 100644 --- a/src/unkey_py/migrations.py +++ b/src/unkey_py/migrations.py @@ -1,7 +1,7 @@ """Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT.""" from .basesdk import BaseSDK -from typing import Any, List, Optional, Union, cast +from typing import Any, List, Mapping, Optional, Union, cast from unkey_py import models, utils from unkey_py._hooks import HookContext from unkey_py.types import BaseModel, OptionalNullable, UNSET @@ -16,12 +16,14 @@ def create_keys( retries: OptionalNullable[utils.RetryConfig] = UNSET, server_url: Optional[str] = None, timeout_ms: Optional[int] = None, + http_headers: Optional[Mapping[str, str]] = None, ) -> models.V1MigrationsCreateKeysResponse: r""" :param request: The request object to send. :param retries: Override the default retry configuration for this method :param server_url: Override the default server URL for this method :param timeout_ms: Override the default request timeout configuration for this method in milliseconds + :param http_headers: Additional headers to set or replace on requests. """ base_url = None url_variables = None @@ -30,12 +32,14 @@ def create_keys( if server_url is not None: base_url = server_url + else: + base_url = self._get_url(base_url, url_variables) if not isinstance(request, BaseModel): request = utils.unmarshal(request, List[models.RequestBody]) request = cast(List[models.RequestBody], request) - req = self.build_request( + req = self._build_request( method="POST", path="/v1/migrations.createKeys", base_url=base_url, @@ -46,6 +50,7 @@ def create_keys( request_has_query_params=True, user_agent_header="user-agent", accept_header_value="application/json", + http_headers=http_headers, security=self.sdk_configuration.security, get_serialized_body=lambda: utils.serialize_request_body( request, False, False, "json", List[models.RequestBody] @@ -67,6 +72,7 @@ def create_keys( http_res = self.do_request( hook_ctx=HookContext( + base_url=base_url or "", operation_id="v1.migrations.createKeys", oauth2_scopes=[], security_source=get_security_from_env( @@ -80,6 +86,7 @@ def create_keys( "403", "404", "409", + "412", "429", "4XX", "500", @@ -88,7 +95,7 @@ def create_keys( retry_config=retry_config, ) - data: Any = None + response_data: Any = None if utils.match_response(http_res, "200", "application/json"): return models.V1MigrationsCreateKeysResponse( object=utils.unmarshal_json( @@ -97,29 +104,45 @@ def create_keys( http_meta=models.HTTPMetadata(request=req, response=http_res), ) if utils.match_response(http_res, "400", "application/json"): - data = utils.unmarshal_json(http_res.text, models.ErrBadRequestData) - raise models.ErrBadRequest(data=data) + response_data = utils.unmarshal_json( + http_res.text, models.ErrBadRequestData + ) + raise models.ErrBadRequest(data=response_data) if utils.match_response(http_res, "401", "application/json"): - data = utils.unmarshal_json(http_res.text, models.ErrUnauthorizedData) - raise models.ErrUnauthorized(data=data) + response_data = utils.unmarshal_json( + http_res.text, models.ErrUnauthorizedData + ) + raise models.ErrUnauthorized(data=response_data) if utils.match_response(http_res, "403", "application/json"): - data = utils.unmarshal_json(http_res.text, models.ErrForbiddenData) - raise models.ErrForbidden(data=data) + response_data = utils.unmarshal_json(http_res.text, models.ErrForbiddenData) + raise models.ErrForbidden(data=response_data) if utils.match_response(http_res, "404", "application/json"): - data = utils.unmarshal_json(http_res.text, models.ErrNotFoundData) - raise models.ErrNotFound(data=data) + response_data = utils.unmarshal_json(http_res.text, models.ErrNotFoundData) + raise models.ErrNotFound(data=response_data) if utils.match_response(http_res, "409", "application/json"): - data = utils.unmarshal_json(http_res.text, models.ErrConflictData) - raise models.ErrConflict(data=data) + response_data = utils.unmarshal_json(http_res.text, models.ErrConflictData) + raise models.ErrConflict(data=response_data) + if utils.match_response(http_res, "412", "application/json"): + response_data = utils.unmarshal_json( + http_res.text, models.ErrPreconditionFailedData + ) + raise models.ErrPreconditionFailed(data=response_data) if utils.match_response(http_res, "429", "application/json"): - data = utils.unmarshal_json(http_res.text, models.ErrTooManyRequestsData) - raise models.ErrTooManyRequests(data=data) + response_data = utils.unmarshal_json( + http_res.text, models.ErrTooManyRequestsData + ) + raise models.ErrTooManyRequests(data=response_data) if utils.match_response(http_res, "500", "application/json"): - data = utils.unmarshal_json( + response_data = utils.unmarshal_json( http_res.text, models.ErrInternalServerErrorData ) - raise models.ErrInternalServerError(data=data) - if utils.match_response(http_res, ["4XX", "5XX"], "*"): + raise models.ErrInternalServerError(data=response_data) + if utils.match_response(http_res, "4XX", "*"): + http_res_text = utils.stream_to_text(http_res) + raise models.SDKError( + "API error occurred", http_res.status_code, http_res_text, http_res + ) + if utils.match_response(http_res, "5XX", "*"): http_res_text = utils.stream_to_text(http_res) raise models.SDKError( "API error occurred", http_res.status_code, http_res_text, http_res @@ -141,12 +164,14 @@ async def create_keys_async( retries: OptionalNullable[utils.RetryConfig] = UNSET, server_url: Optional[str] = None, timeout_ms: Optional[int] = None, + http_headers: Optional[Mapping[str, str]] = None, ) -> models.V1MigrationsCreateKeysResponse: r""" :param request: The request object to send. :param retries: Override the default retry configuration for this method :param server_url: Override the default server URL for this method :param timeout_ms: Override the default request timeout configuration for this method in milliseconds + :param http_headers: Additional headers to set or replace on requests. """ base_url = None url_variables = None @@ -155,12 +180,14 @@ async def create_keys_async( if server_url is not None: base_url = server_url + else: + base_url = self._get_url(base_url, url_variables) if not isinstance(request, BaseModel): request = utils.unmarshal(request, List[models.RequestBody]) request = cast(List[models.RequestBody], request) - req = self.build_request_async( + req = self._build_request_async( method="POST", path="/v1/migrations.createKeys", base_url=base_url, @@ -171,6 +198,7 @@ async def create_keys_async( request_has_query_params=True, user_agent_header="user-agent", accept_header_value="application/json", + http_headers=http_headers, security=self.sdk_configuration.security, get_serialized_body=lambda: utils.serialize_request_body( request, False, False, "json", List[models.RequestBody] @@ -192,6 +220,7 @@ async def create_keys_async( http_res = await self.do_request_async( hook_ctx=HookContext( + base_url=base_url or "", operation_id="v1.migrations.createKeys", oauth2_scopes=[], security_source=get_security_from_env( @@ -205,6 +234,7 @@ async def create_keys_async( "403", "404", "409", + "412", "429", "4XX", "500", @@ -213,7 +243,7 @@ async def create_keys_async( retry_config=retry_config, ) - data: Any = None + response_data: Any = None if utils.match_response(http_res, "200", "application/json"): return models.V1MigrationsCreateKeysResponse( object=utils.unmarshal_json( @@ -222,29 +252,45 @@ async def create_keys_async( http_meta=models.HTTPMetadata(request=req, response=http_res), ) if utils.match_response(http_res, "400", "application/json"): - data = utils.unmarshal_json(http_res.text, models.ErrBadRequestData) - raise models.ErrBadRequest(data=data) + response_data = utils.unmarshal_json( + http_res.text, models.ErrBadRequestData + ) + raise models.ErrBadRequest(data=response_data) if utils.match_response(http_res, "401", "application/json"): - data = utils.unmarshal_json(http_res.text, models.ErrUnauthorizedData) - raise models.ErrUnauthorized(data=data) + response_data = utils.unmarshal_json( + http_res.text, models.ErrUnauthorizedData + ) + raise models.ErrUnauthorized(data=response_data) if utils.match_response(http_res, "403", "application/json"): - data = utils.unmarshal_json(http_res.text, models.ErrForbiddenData) - raise models.ErrForbidden(data=data) + response_data = utils.unmarshal_json(http_res.text, models.ErrForbiddenData) + raise models.ErrForbidden(data=response_data) if utils.match_response(http_res, "404", "application/json"): - data = utils.unmarshal_json(http_res.text, models.ErrNotFoundData) - raise models.ErrNotFound(data=data) + response_data = utils.unmarshal_json(http_res.text, models.ErrNotFoundData) + raise models.ErrNotFound(data=response_data) if utils.match_response(http_res, "409", "application/json"): - data = utils.unmarshal_json(http_res.text, models.ErrConflictData) - raise models.ErrConflict(data=data) + response_data = utils.unmarshal_json(http_res.text, models.ErrConflictData) + raise models.ErrConflict(data=response_data) + if utils.match_response(http_res, "412", "application/json"): + response_data = utils.unmarshal_json( + http_res.text, models.ErrPreconditionFailedData + ) + raise models.ErrPreconditionFailed(data=response_data) if utils.match_response(http_res, "429", "application/json"): - data = utils.unmarshal_json(http_res.text, models.ErrTooManyRequestsData) - raise models.ErrTooManyRequests(data=data) + response_data = utils.unmarshal_json( + http_res.text, models.ErrTooManyRequestsData + ) + raise models.ErrTooManyRequests(data=response_data) if utils.match_response(http_res, "500", "application/json"): - data = utils.unmarshal_json( + response_data = utils.unmarshal_json( http_res.text, models.ErrInternalServerErrorData ) - raise models.ErrInternalServerError(data=data) - if utils.match_response(http_res, ["4XX", "5XX"], "*"): + raise models.ErrInternalServerError(data=response_data) + if utils.match_response(http_res, "4XX", "*"): + http_res_text = await utils.stream_to_text_async(http_res) + raise models.SDKError( + "API error occurred", http_res.status_code, http_res_text, http_res + ) + if utils.match_response(http_res, "5XX", "*"): http_res_text = await utils.stream_to_text_async(http_res) raise models.SDKError( "API error occurred", http_res.status_code, http_res_text, http_res @@ -269,12 +315,14 @@ def enqueue( retries: OptionalNullable[utils.RetryConfig] = UNSET, server_url: Optional[str] = None, timeout_ms: Optional[int] = None, + http_headers: Optional[Mapping[str, str]] = None, ) -> models.V1MigrationsEnqueueKeysResponse: r""" :param request: The request object to send. :param retries: Override the default retry configuration for this method :param server_url: Override the default server URL for this method :param timeout_ms: Override the default request timeout configuration for this method in milliseconds + :param http_headers: Additional headers to set or replace on requests. """ base_url = None url_variables = None @@ -283,6 +331,8 @@ def enqueue( if server_url is not None: base_url = server_url + else: + base_url = self._get_url(base_url, url_variables) if not isinstance(request, BaseModel): request = utils.unmarshal( @@ -290,7 +340,7 @@ def enqueue( ) request = cast(models.V1MigrationsEnqueueKeysRequestBody, request) - req = self.build_request( + req = self._build_request( method="POST", path="/v1/migrations.enqueueKeys", base_url=base_url, @@ -301,6 +351,7 @@ def enqueue( request_has_query_params=True, user_agent_header="user-agent", accept_header_value="application/json", + http_headers=http_headers, security=self.sdk_configuration.security, get_serialized_body=lambda: utils.serialize_request_body( request, False, False, "json", models.V1MigrationsEnqueueKeysRequestBody @@ -322,6 +373,7 @@ def enqueue( http_res = self.do_request( hook_ctx=HookContext( + base_url=base_url or "", operation_id="v1.migrations.enqueueKeys", oauth2_scopes=[], security_source=get_security_from_env( @@ -335,6 +387,7 @@ def enqueue( "403", "404", "409", + "412", "429", "4XX", "500", @@ -343,7 +396,7 @@ def enqueue( retry_config=retry_config, ) - data: Any = None + response_data: Any = None if utils.match_response(http_res, "202", "application/json"): return models.V1MigrationsEnqueueKeysResponse( object=utils.unmarshal_json( @@ -352,29 +405,45 @@ def enqueue( http_meta=models.HTTPMetadata(request=req, response=http_res), ) if utils.match_response(http_res, "400", "application/json"): - data = utils.unmarshal_json(http_res.text, models.ErrBadRequestData) - raise models.ErrBadRequest(data=data) + response_data = utils.unmarshal_json( + http_res.text, models.ErrBadRequestData + ) + raise models.ErrBadRequest(data=response_data) if utils.match_response(http_res, "401", "application/json"): - data = utils.unmarshal_json(http_res.text, models.ErrUnauthorizedData) - raise models.ErrUnauthorized(data=data) + response_data = utils.unmarshal_json( + http_res.text, models.ErrUnauthorizedData + ) + raise models.ErrUnauthorized(data=response_data) if utils.match_response(http_res, "403", "application/json"): - data = utils.unmarshal_json(http_res.text, models.ErrForbiddenData) - raise models.ErrForbidden(data=data) + response_data = utils.unmarshal_json(http_res.text, models.ErrForbiddenData) + raise models.ErrForbidden(data=response_data) if utils.match_response(http_res, "404", "application/json"): - data = utils.unmarshal_json(http_res.text, models.ErrNotFoundData) - raise models.ErrNotFound(data=data) + response_data = utils.unmarshal_json(http_res.text, models.ErrNotFoundData) + raise models.ErrNotFound(data=response_data) if utils.match_response(http_res, "409", "application/json"): - data = utils.unmarshal_json(http_res.text, models.ErrConflictData) - raise models.ErrConflict(data=data) + response_data = utils.unmarshal_json(http_res.text, models.ErrConflictData) + raise models.ErrConflict(data=response_data) + if utils.match_response(http_res, "412", "application/json"): + response_data = utils.unmarshal_json( + http_res.text, models.ErrPreconditionFailedData + ) + raise models.ErrPreconditionFailed(data=response_data) if utils.match_response(http_res, "429", "application/json"): - data = utils.unmarshal_json(http_res.text, models.ErrTooManyRequestsData) - raise models.ErrTooManyRequests(data=data) + response_data = utils.unmarshal_json( + http_res.text, models.ErrTooManyRequestsData + ) + raise models.ErrTooManyRequests(data=response_data) if utils.match_response(http_res, "500", "application/json"): - data = utils.unmarshal_json( + response_data = utils.unmarshal_json( http_res.text, models.ErrInternalServerErrorData ) - raise models.ErrInternalServerError(data=data) - if utils.match_response(http_res, ["4XX", "5XX"], "*"): + raise models.ErrInternalServerError(data=response_data) + if utils.match_response(http_res, "4XX", "*"): + http_res_text = utils.stream_to_text(http_res) + raise models.SDKError( + "API error occurred", http_res.status_code, http_res_text, http_res + ) + if utils.match_response(http_res, "5XX", "*"): http_res_text = utils.stream_to_text(http_res) raise models.SDKError( "API error occurred", http_res.status_code, http_res_text, http_res @@ -399,12 +468,14 @@ async def enqueue_async( retries: OptionalNullable[utils.RetryConfig] = UNSET, server_url: Optional[str] = None, timeout_ms: Optional[int] = None, + http_headers: Optional[Mapping[str, str]] = None, ) -> models.V1MigrationsEnqueueKeysResponse: r""" :param request: The request object to send. :param retries: Override the default retry configuration for this method :param server_url: Override the default server URL for this method :param timeout_ms: Override the default request timeout configuration for this method in milliseconds + :param http_headers: Additional headers to set or replace on requests. """ base_url = None url_variables = None @@ -413,6 +484,8 @@ async def enqueue_async( if server_url is not None: base_url = server_url + else: + base_url = self._get_url(base_url, url_variables) if not isinstance(request, BaseModel): request = utils.unmarshal( @@ -420,7 +493,7 @@ async def enqueue_async( ) request = cast(models.V1MigrationsEnqueueKeysRequestBody, request) - req = self.build_request_async( + req = self._build_request_async( method="POST", path="/v1/migrations.enqueueKeys", base_url=base_url, @@ -431,6 +504,7 @@ async def enqueue_async( request_has_query_params=True, user_agent_header="user-agent", accept_header_value="application/json", + http_headers=http_headers, security=self.sdk_configuration.security, get_serialized_body=lambda: utils.serialize_request_body( request, False, False, "json", models.V1MigrationsEnqueueKeysRequestBody @@ -452,6 +526,7 @@ async def enqueue_async( http_res = await self.do_request_async( hook_ctx=HookContext( + base_url=base_url or "", operation_id="v1.migrations.enqueueKeys", oauth2_scopes=[], security_source=get_security_from_env( @@ -465,6 +540,7 @@ async def enqueue_async( "403", "404", "409", + "412", "429", "4XX", "500", @@ -473,7 +549,7 @@ async def enqueue_async( retry_config=retry_config, ) - data: Any = None + response_data: Any = None if utils.match_response(http_res, "202", "application/json"): return models.V1MigrationsEnqueueKeysResponse( object=utils.unmarshal_json( @@ -482,29 +558,45 @@ async def enqueue_async( http_meta=models.HTTPMetadata(request=req, response=http_res), ) if utils.match_response(http_res, "400", "application/json"): - data = utils.unmarshal_json(http_res.text, models.ErrBadRequestData) - raise models.ErrBadRequest(data=data) + response_data = utils.unmarshal_json( + http_res.text, models.ErrBadRequestData + ) + raise models.ErrBadRequest(data=response_data) if utils.match_response(http_res, "401", "application/json"): - data = utils.unmarshal_json(http_res.text, models.ErrUnauthorizedData) - raise models.ErrUnauthorized(data=data) + response_data = utils.unmarshal_json( + http_res.text, models.ErrUnauthorizedData + ) + raise models.ErrUnauthorized(data=response_data) if utils.match_response(http_res, "403", "application/json"): - data = utils.unmarshal_json(http_res.text, models.ErrForbiddenData) - raise models.ErrForbidden(data=data) + response_data = utils.unmarshal_json(http_res.text, models.ErrForbiddenData) + raise models.ErrForbidden(data=response_data) if utils.match_response(http_res, "404", "application/json"): - data = utils.unmarshal_json(http_res.text, models.ErrNotFoundData) - raise models.ErrNotFound(data=data) + response_data = utils.unmarshal_json(http_res.text, models.ErrNotFoundData) + raise models.ErrNotFound(data=response_data) if utils.match_response(http_res, "409", "application/json"): - data = utils.unmarshal_json(http_res.text, models.ErrConflictData) - raise models.ErrConflict(data=data) + response_data = utils.unmarshal_json(http_res.text, models.ErrConflictData) + raise models.ErrConflict(data=response_data) + if utils.match_response(http_res, "412", "application/json"): + response_data = utils.unmarshal_json( + http_res.text, models.ErrPreconditionFailedData + ) + raise models.ErrPreconditionFailed(data=response_data) if utils.match_response(http_res, "429", "application/json"): - data = utils.unmarshal_json(http_res.text, models.ErrTooManyRequestsData) - raise models.ErrTooManyRequests(data=data) + response_data = utils.unmarshal_json( + http_res.text, models.ErrTooManyRequestsData + ) + raise models.ErrTooManyRequests(data=response_data) if utils.match_response(http_res, "500", "application/json"): - data = utils.unmarshal_json( + response_data = utils.unmarshal_json( http_res.text, models.ErrInternalServerErrorData ) - raise models.ErrInternalServerError(data=data) - if utils.match_response(http_res, ["4XX", "5XX"], "*"): + raise models.ErrInternalServerError(data=response_data) + if utils.match_response(http_res, "4XX", "*"): + http_res_text = await utils.stream_to_text_async(http_res) + raise models.SDKError( + "API error occurred", http_res.status_code, http_res_text, http_res + ) + if utils.match_response(http_res, "5XX", "*"): http_res_text = await utils.stream_to_text_async(http_res) raise models.SDKError( "API error occurred", http_res.status_code, http_res_text, http_res diff --git a/src/unkey_py/models/__init__.py b/src/unkey_py/models/__init__.py index a20d5f4..016eddc 100644 --- a/src/unkey_py/models/__init__.py +++ b/src/unkey_py/models/__init__.py @@ -59,14 +59,20 @@ CreatePermissionResponseBody, CreatePermissionResponseBodyTypedDict, CreatePermissionResponseTypedDict, + Description, + DescriptionTypedDict, + Two, ) from .createroleop import ( + CreateRoleDescription, + CreateRoleDescriptionTypedDict, CreateRoleRequestBody, CreateRoleRequestBodyTypedDict, CreateRoleResponse, CreateRoleResponseBody, CreateRoleResponseBodyTypedDict, CreateRoleResponseTypedDict, + Description2, ) from .deleteapiop import ( DeleteAPIRequestBody, @@ -166,6 +172,13 @@ ErrNotFoundError, ErrNotFoundErrorTypedDict, ) +from .errpreconditionfailed import ( + ErrPreconditionFailed, + ErrPreconditionFailedCode, + ErrPreconditionFailedData, + ErrPreconditionFailedError, + ErrPreconditionFailedErrorTypedDict, +) from .errtoomanyrequests import ( ErrTooManyRequests, ErrTooManyRequestsCode, @@ -229,15 +242,24 @@ GetRoleResponseTypedDict, ) from .getverificationsop import ( + GetVerificationsIdentity, + GetVerificationsIdentityTypedDict, GetVerificationsRequest, GetVerificationsRequestTypedDict, GetVerificationsResponse, GetVerificationsResponseBody, GetVerificationsResponseBodyTypedDict, GetVerificationsResponseTypedDict, - Granularity, - Verifications, - VerificationsTypedDict, + GroupBy, + GroupByTypedDict, + KeyID, + KeyIDTypedDict, + One, + Order, + OrderBy, + QueryParam2, + Tag, + TagTypedDict, ) from .httpmetadata import HTTPMetadata, HTTPMetadataTypedDict from .key import ( @@ -252,6 +274,17 @@ RefillTypedDict, Type, ) +from .keys_getverificationsop import ( + Granularity, + KeysGetVerificationsRequest, + KeysGetVerificationsRequestTypedDict, + KeysGetVerificationsResponse, + KeysGetVerificationsResponseBody, + KeysGetVerificationsResponseBodyTypedDict, + KeysGetVerificationsResponseTypedDict, + Verifications, + VerificationsTypedDict, +) from .limitop import ( LimitRequestBody, LimitRequestBodyTypedDict, @@ -312,14 +345,6 @@ PermissionQuery, PermissionQueryTypedDict, ) -from .ratelimit_setoverrideop import ( - RatelimitSetOverrideRequestBody, - RatelimitSetOverrideRequestBodyTypedDict, - RatelimitSetOverrideResponse, - RatelimitSetOverrideResponseBody, - RatelimitSetOverrideResponseBodyTypedDict, - RatelimitSetOverrideResponseTypedDict, -) from .removepermissionsop import ( RemovePermissionsPermissions, RemovePermissionsPermissionsTypedDict, @@ -342,6 +367,14 @@ ) from .sdkerror import SDKError from .security import Security, SecurityTypedDict +from .setoverrideop import ( + SetOverrideRequestBody, + SetOverrideRequestBodyTypedDict, + SetOverrideResponse, + SetOverrideResponseBody, + SetOverrideResponseBodyTypedDict, + SetOverrideResponseTypedDict, +) from .setpermissionsop import ( SetPermissionsPermissions, SetPermissionsPermissionsTypedDict, @@ -450,6 +483,8 @@ AuthorizationTypedDict, RatelimitsModel, RatelimitsModelTypedDict, + Remaining, + RemainingTypedDict, V1KeysVerifyKeyRequest, V1KeysVerifyKeyRequestRatelimit, V1KeysVerifyKeyRequestRatelimitTypedDict, @@ -476,6 +511,10 @@ WhoamiResponseTypedDict, ) +# Pydantic models with forward references +Or.model_rebuild() +And.model_rebuild() + __all__ = [ "AddPermissionsPermissions", "AddPermissionsPermissionsTypedDict", @@ -528,6 +567,8 @@ "CreatePermissionResponseBody", "CreatePermissionResponseBodyTypedDict", "CreatePermissionResponseTypedDict", + "CreateRoleDescription", + "CreateRoleDescriptionTypedDict", "CreateRoleRequestBody", "CreateRoleRequestBodyTypedDict", "CreateRoleResponse", @@ -576,6 +617,9 @@ "DeleteRoleResponseBody", "DeleteRoleResponseBodyTypedDict", "DeleteRoleResponseTypedDict", + "Description", + "Description2", + "DescriptionTypedDict", "ErrBadRequest", "ErrBadRequestCode", "ErrBadRequestData", @@ -604,6 +648,11 @@ "ErrNotFoundData", "ErrNotFoundError", "ErrNotFoundErrorTypedDict", + "ErrPreconditionFailed", + "ErrPreconditionFailedCode", + "ErrPreconditionFailedData", + "ErrPreconditionFailedError", + "ErrPreconditionFailedErrorTypedDict", "ErrTooManyRequests", "ErrTooManyRequestsCode", "ErrTooManyRequestsData", @@ -652,6 +701,8 @@ "GetRoleResponseBody", "GetRoleResponseBodyTypedDict", "GetRoleResponseTypedDict", + "GetVerificationsIdentity", + "GetVerificationsIdentityTypedDict", "GetVerificationsRequest", "GetVerificationsRequestTypedDict", "GetVerificationsResponse", @@ -659,6 +710,8 @@ "GetVerificationsResponseBodyTypedDict", "GetVerificationsResponseTypedDict", "Granularity", + "GroupBy", + "GroupByTypedDict", "HTTPMetadata", "HTTPMetadataTypedDict", "Hash", @@ -667,7 +720,15 @@ "IdentityTypedDict", "Interval", "Key", + "KeyID", + "KeyIDTypedDict", "KeyTypedDict", + "KeysGetVerificationsRequest", + "KeysGetVerificationsRequestTypedDict", + "KeysGetVerificationsResponse", + "KeysGetVerificationsResponseBody", + "KeysGetVerificationsResponseBodyTypedDict", + "KeysGetVerificationsResponseTypedDict", "LimitRequestBody", "LimitRequestBodyTypedDict", "LimitResponse", @@ -704,25 +765,25 @@ "ListRolesResponseBody", "ListRolesResponseBodyTypedDict", "ListRolesResponseTypedDict", + "One", "Op", "Or", "OrTypedDict", + "Order", + "OrderBy", "Overrides", "OverridesTypedDict", "PermissionQuery", "PermissionQueryTypedDict", + "QueryParam2", "RatelimitModel", "RatelimitModelTypedDict", - "RatelimitSetOverrideRequestBody", - "RatelimitSetOverrideRequestBodyTypedDict", - "RatelimitSetOverrideResponse", - "RatelimitSetOverrideResponseBody", - "RatelimitSetOverrideResponseBodyTypedDict", - "RatelimitSetOverrideResponseTypedDict", "RatelimitsModel", "RatelimitsModelTypedDict", "Refill", "RefillTypedDict", + "Remaining", + "RemainingTypedDict", "RemovePermissionsPermissions", "RemovePermissionsPermissionsTypedDict", "RemovePermissionsRequestBody", @@ -752,6 +813,12 @@ "SecurityTypedDict", "Services", "ServicesTypedDict", + "SetOverrideRequestBody", + "SetOverrideRequestBodyTypedDict", + "SetOverrideResponse", + "SetOverrideResponseBody", + "SetOverrideResponseBodyTypedDict", + "SetOverrideResponseTypedDict", "SetPermissionsPermissions", "SetPermissionsPermissionsTypedDict", "SetPermissionsRequestBody", @@ -768,6 +835,9 @@ "SetRolesResponseTypedDict", "SetRolesRoles", "SetRolesRolesTypedDict", + "Tag", + "TagTypedDict", + "Two", "Type", "UpdateIdentityIdentitiesRatelimits", "UpdateIdentityIdentitiesRatelimitsTypedDict", diff --git a/src/unkey_py/models/createidentityop.py b/src/unkey_py/models/createidentityop.py index 9009e3d..6fb7356 100644 --- a/src/unkey_py/models/createidentityop.py +++ b/src/unkey_py/models/createidentityop.py @@ -5,7 +5,7 @@ import pydantic from typing import Any, Dict, List, Optional from typing_extensions import Annotated, NotRequired, TypedDict -from unkey_py.types import BaseModel +from unkey_py.types import BaseModel, Nullable class CreateIdentityRatelimitsTypedDict(TypedDict): @@ -35,10 +35,10 @@ class CreateIdentityRequestBodyTypedDict(TypedDict): This usually comes from your authentication provider and could be a userId, organisationId or even an email. It does not matter what you use, as long as it uniquely identifies something in your application. - `externalId`s are unique across your workspace and therefore a `PRECONDITION_FAILED` error is returned when you try to create duplicates. + `externalId`s are unique across your workspace and therefore a `CONFLICT` error is returned when you try to create duplicates. """ - meta: NotRequired[Dict[str, Any]] + meta: NotRequired[Dict[str, Nullable[Any]]] r"""Attach metadata to this identity that you need to have access to when verifying a key. This will be returned as part of the `verifyKey` response. @@ -58,11 +58,11 @@ class CreateIdentityRequestBody(BaseModel): This usually comes from your authentication provider and could be a userId, organisationId or even an email. It does not matter what you use, as long as it uniquely identifies something in your application. - `externalId`s are unique across your workspace and therefore a `PRECONDITION_FAILED` error is returned when you try to create duplicates. + `externalId`s are unique across your workspace and therefore a `CONFLICT` error is returned when you try to create duplicates. """ - meta: Optional[Dict[str, Any]] = None + meta: Optional[Dict[str, Nullable[Any]]] = None r"""Attach metadata to this identity that you need to have access to when verifying a key. This will be returned as part of the `verifyKey` response. diff --git a/src/unkey_py/models/createkeyop.py b/src/unkey_py/models/createkeyop.py index 2262ccb..232deba 100644 --- a/src/unkey_py/models/createkeyop.py +++ b/src/unkey_py/models/createkeyop.py @@ -6,7 +6,7 @@ import pydantic from typing import Any, Dict, List, Optional from typing_extensions import Annotated, NotRequired, TypedDict, deprecated -from unkey_py.types import BaseModel +from unkey_py.types import BaseModel, Nullable class CreateKeyInterval(str, Enum): @@ -141,7 +141,7 @@ class CreateKeyRequestBodyTypedDict(TypedDict): r"""Your user's Id. This will provide a link between Unkey and your customer record. When validating a key, we will return this back to you, so you can clearly identify your user from their api key. """ - meta: NotRequired[Dict[str, Any]] + meta: NotRequired[Dict[str, Nullable[Any]]] r"""This is a place for dynamic meta data, anything that feels useful for you should go here""" roles: NotRequired[List[str]] r"""A list of roles that this key should have. If the role does not exist, an error is thrown""" @@ -212,7 +212,7 @@ class CreateKeyRequestBody(BaseModel): When validating a key, we will return this back to you, so you can clearly identify your user from their api key. """ - meta: Optional[Dict[str, Any]] = None + meta: Optional[Dict[str, Nullable[Any]]] = None r"""This is a place for dynamic meta data, anything that feels useful for you should go here""" roles: Optional[List[str]] = None diff --git a/src/unkey_py/models/createpermissionop.py b/src/unkey_py/models/createpermissionop.py index f7140fb..a598823 100644 --- a/src/unkey_py/models/createpermissionop.py +++ b/src/unkey_py/models/createpermissionop.py @@ -2,16 +2,29 @@ from __future__ import annotations from .httpmetadata import HTTPMetadata, HTTPMetadataTypedDict +from enum import Enum import pydantic -from typing import Optional -from typing_extensions import Annotated, NotRequired, TypedDict +from typing import Optional, Union +from typing_extensions import Annotated, NotRequired, TypeAliasType, TypedDict from unkey_py.types import BaseModel +class Two(str, Enum): + UNKNOWN = "" + + +DescriptionTypedDict = TypeAliasType("DescriptionTypedDict", Union[str, Two]) +r"""Explain what this permission does. This is just for your team, your users will not see this.""" + + +Description = TypeAliasType("Description", Union[str, Two]) +r"""Explain what this permission does. This is just for your team, your users will not see this.""" + + class CreatePermissionRequestBodyTypedDict(TypedDict): name: str r"""The unique name of your permission.""" - description: NotRequired[str] + description: NotRequired[DescriptionTypedDict] r"""Explain what this permission does. This is just for your team, your users will not see this.""" @@ -19,7 +32,7 @@ class CreatePermissionRequestBody(BaseModel): name: str r"""The unique name of your permission.""" - description: Optional[str] = None + description: Optional[Description] = None r"""Explain what this permission does. This is just for your team, your users will not see this.""" diff --git a/src/unkey_py/models/createroleop.py b/src/unkey_py/models/createroleop.py index bbe68f5..0ab6032 100644 --- a/src/unkey_py/models/createroleop.py +++ b/src/unkey_py/models/createroleop.py @@ -2,16 +2,31 @@ from __future__ import annotations from .httpmetadata import HTTPMetadata, HTTPMetadataTypedDict +from enum import Enum import pydantic -from typing import Optional -from typing_extensions import Annotated, NotRequired, TypedDict +from typing import Optional, Union +from typing_extensions import Annotated, NotRequired, TypeAliasType, TypedDict from unkey_py.types import BaseModel +class Description2(str, Enum): + UNKNOWN = "" + + +CreateRoleDescriptionTypedDict = TypeAliasType( + "CreateRoleDescriptionTypedDict", Union[str, Description2] +) +r"""Explain what this role does. This is just for your team, your users will not see this.""" + + +CreateRoleDescription = TypeAliasType("CreateRoleDescription", Union[str, Description2]) +r"""Explain what this role does. This is just for your team, your users will not see this.""" + + class CreateRoleRequestBodyTypedDict(TypedDict): name: str r"""The unique name of your role.""" - description: NotRequired[str] + description: NotRequired[CreateRoleDescriptionTypedDict] r"""Explain what this role does. This is just for your team, your users will not see this.""" @@ -19,7 +34,7 @@ class CreateRoleRequestBody(BaseModel): name: str r"""The unique name of your role.""" - description: Optional[str] = None + description: Optional[CreateRoleDescription] = None r"""Explain what this role does. This is just for your team, your users will not see this.""" diff --git a/src/unkey_py/models/deletekeyop.py b/src/unkey_py/models/deletekeyop.py index 19f6036..4997528 100644 --- a/src/unkey_py/models/deletekeyop.py +++ b/src/unkey_py/models/deletekeyop.py @@ -11,12 +11,17 @@ class DeleteKeyRequestBodyTypedDict(TypedDict): key_id: str r"""The id of the key to revoke""" + permanent: NotRequired[bool] + r"""By default Unkey soft deletes keys, so they may be recovered later. If you want to permanently delete it, set permanent=true. This might be necessary if you run into CONFLICT errors during key migration.""" class DeleteKeyRequestBody(BaseModel): key_id: Annotated[str, pydantic.Field(alias="keyId")] r"""The id of the key to revoke""" + permanent: Optional[bool] = False + r"""By default Unkey soft deletes keys, so they may be recovered later. If you want to permanently delete it, set permanent=true. This might be necessary if you run into CONFLICT errors during key migration.""" + class DeleteKeyResponseBodyTypedDict(TypedDict): r"""The key was successfully revoked, it may take up to 30s for this to take effect in all regions""" diff --git a/src/unkey_py/models/errpreconditionfailed.py b/src/unkey_py/models/errpreconditionfailed.py new file mode 100644 index 0000000..228a2bb --- /dev/null +++ b/src/unkey_py/models/errpreconditionfailed.py @@ -0,0 +1,53 @@ +"""Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT.""" + +from __future__ import annotations +from enum import Enum +import pydantic +from typing_extensions import Annotated, TypedDict +from unkey_py import utils +from unkey_py.types import BaseModel + + +class ErrPreconditionFailedCode(str, Enum): + r"""A machine readable error code.""" + + PRECONDITION_FAILED = "PRECONDITION_FAILED" + + +class ErrPreconditionFailedErrorTypedDict(TypedDict): + code: ErrPreconditionFailedCode + r"""A machine readable error code.""" + docs: str + r"""A link to our documentation with more details about this error code""" + message: str + r"""A human readable explanation of what went wrong""" + request_id: str + r"""Please always include the requestId in your error report""" + + +class ErrPreconditionFailedError(BaseModel): + code: ErrPreconditionFailedCode + r"""A machine readable error code.""" + + docs: str + r"""A link to our documentation with more details about this error code""" + + message: str + r"""A human readable explanation of what went wrong""" + + request_id: Annotated[str, pydantic.Field(alias="requestId")] + r"""Please always include the requestId in your error report""" + + +class ErrPreconditionFailedData(BaseModel): + error: ErrPreconditionFailedError + + +class ErrPreconditionFailed(Exception): + data: ErrPreconditionFailedData + + def __init__(self, data: ErrPreconditionFailedData): + self.data = data + + def __str__(self) -> str: + return utils.marshal_json(self.data, ErrPreconditionFailedData) diff --git a/src/unkey_py/models/getidentityop.py b/src/unkey_py/models/getidentityop.py index b42ee76..f465b1a 100644 --- a/src/unkey_py/models/getidentityop.py +++ b/src/unkey_py/models/getidentityop.py @@ -5,7 +5,7 @@ import pydantic from typing import Any, Dict, List, Optional from typing_extensions import Annotated, NotRequired, TypedDict -from unkey_py.types import BaseModel +from unkey_py.types import BaseModel, Nullable from unkey_py.utils import FieldMetadata, QueryParamMetadata @@ -55,7 +55,7 @@ class GetIdentityResponseBodyTypedDict(TypedDict): r"""The id of this identity. Used to interact with unkey's API""" external_id: str r"""The id in your system""" - meta: Dict[str, Any] + meta: Dict[str, Nullable[Any]] r"""The meta object defined for this identity.""" ratelimits: List[GetIdentityRatelimitsTypedDict] r"""When verifying keys, you can specify which limits you want to use and all keys attached to this identity, will share the limits.""" @@ -70,7 +70,7 @@ class GetIdentityResponseBody(BaseModel): external_id: Annotated[str, pydantic.Field(alias="externalId")] r"""The id in your system""" - meta: Dict[str, Any] + meta: Dict[str, Nullable[Any]] r"""The meta object defined for this identity.""" ratelimits: List[GetIdentityRatelimits] diff --git a/src/unkey_py/models/getkeyop.py b/src/unkey_py/models/getkeyop.py index 594fcb8..fba7215 100644 --- a/src/unkey_py/models/getkeyop.py +++ b/src/unkey_py/models/getkeyop.py @@ -38,7 +38,7 @@ def serialize_model(self, handler): m = {} - for n, f in self.model_fields.items(): + for n, f in type(self).model_fields.items(): k = f.alias or n val = serialized.get(k) serialized.pop(k, None) diff --git a/src/unkey_py/models/getoverrideop.py b/src/unkey_py/models/getoverrideop.py index b9cc3d2..eee0129 100644 --- a/src/unkey_py/models/getoverrideop.py +++ b/src/unkey_py/models/getoverrideop.py @@ -67,7 +67,7 @@ def serialize_model(self, handler): m = {} - for n, f in self.model_fields.items(): + for n, f in type(self).model_fields.items(): k = f.alias or n val = serialized.get(k) serialized.pop(k, None) diff --git a/src/unkey_py/models/getverificationsop.py b/src/unkey_py/models/getverificationsop.py index 5703b08..dbd384f 100644 --- a/src/unkey_py/models/getverificationsop.py +++ b/src/unkey_py/models/getverificationsop.py @@ -5,39 +5,163 @@ from enum import Enum import pydantic from pydantic import model_serializer -from typing import List, Optional -from typing_extensions import Annotated, NotRequired, TypedDict +from typing import List, Optional, Union +from typing_extensions import Annotated, NotRequired, TypeAliasType, TypedDict from unkey_py.types import BaseModel, Nullable, OptionalNullable, UNSET, UNSET_SENTINEL from unkey_py.utils import FieldMetadata, QueryParamMetadata -class Granularity(str, Enum): - r"""The granularity of the usage data to fetch, currently only `day` is supported""" +KeyIDTypedDict = TypeAliasType("KeyIDTypedDict", Union[str, List[str]]) +r"""Only include data for a specific key or keys. +When you are providing zero or more than one key ids, all usage counts are aggregated and summed up. Send multiple requests with one keyId each if you need counts per key. + + +""" + + +KeyID = TypeAliasType("KeyID", Union[str, List[str]]) +r"""Only include data for a specific key or keys. + +When you are providing zero or more than one key ids, all usage counts are aggregated and summed up. Send multiple requests with one keyId each if you need counts per key. + + +""" + + +TagTypedDict = TypeAliasType("TagTypedDict", Union[str, List[str]]) +r"""Only include data for a specific tag or tags. + +When you are providing zero or more than one tag, all usage counts are aggregated and summed up. Send multiple requests with one tag each if you need counts per tag. +""" + + +Tag = TypeAliasType("Tag", Union[str, List[str]]) +r"""Only include data for a specific tag or tags. + +When you are providing zero or more than one tag, all usage counts are aggregated and summed up. Send multiple requests with one tag each if you need counts per tag. +""" + + +class QueryParam2(str, Enum): + KEY = "key" + IDENTITY = "identity" + TAGS = "tags" + TAG = "tag" + MONTH = "month" DAY = "day" + HOUR = "hour" + + +class One(str, Enum): + KEY = "key" + IDENTITY = "identity" + TAGS = "tags" + TAG = "tag" + MONTH = "month" + DAY = "day" + HOUR = "hour" + + +GroupByTypedDict = TypeAliasType("GroupByTypedDict", Union[One, List[QueryParam2]]) +r"""By default, datapoints are not aggregated, however you probably want to get a breakdown per time, key or identity. + +Grouping by tags and by tag is mutually exclusive. +""" + + +GroupBy = TypeAliasType("GroupBy", Union[One, List[QueryParam2]]) +r"""By default, datapoints are not aggregated, however you probably want to get a breakdown per time, key or identity. + +Grouping by tags and by tag is mutually exclusive. +""" + + +class OrderBy(str, Enum): + r"""Sort the output by a specific value. You can use this in combination with the `order` param.""" + + TIME = "time" + VALID = "valid" + NOT_FOUND = "notFound" + FORBIDDEN = "forbidden" + USAGE_EXCEEDED = "usageExceeded" + RATE_LIMITED = "rateLimited" + UNAUTHORIZED = "unauthorized" + DISABLED = "disabled" + INSUFFICIENT_PERMISSIONS = "insufficientPermissions" + EXPIRED = "expired" + TOTAL = "total" + + +class Order(str, Enum): + r"""Define the order of sorting. Use this in combination with `orderBy`""" + + ASC = "asc" + DESC = "desc" class GetVerificationsRequestTypedDict(TypedDict): - key_id: NotRequired[str] - owner_id: NotRequired[str] + api_id: str + external_id: NotRequired[str] + key_id: NotRequired[KeyIDTypedDict] + r"""Only include data for a specific key or keys. + + When you are providing zero or more than one key ids, all usage counts are aggregated and summed up. Send multiple requests with one keyId each if you need counts per key. + + + """ + tag: NotRequired[TagTypedDict] + r"""Only include data for a specific tag or tags. + + When you are providing zero or more than one tag, all usage counts are aggregated and summed up. Send multiple requests with one tag each if you need counts per tag. + """ start: NotRequired[Nullable[int]] end: NotRequired[Nullable[int]] - granularity: NotRequired[Granularity] - r"""The granularity of the usage data to fetch, currently only `day` is supported""" + group_by: NotRequired[GroupByTypedDict] + r"""By default, datapoints are not aggregated, however you probably want to get a breakdown per time, key or identity. + + Grouping by tags and by tag is mutually exclusive. + """ + limit: NotRequired[int] + order_by: NotRequired[OrderBy] + r"""Sort the output by a specific value. You can use this in combination with the `order` param.""" + order: NotRequired[Order] + r"""Define the order of sorting. Use this in combination with `orderBy`""" class GetVerificationsRequest(BaseModel): - key_id: Annotated[ + api_id: Annotated[ + str, + pydantic.Field(alias="apiId"), + FieldMetadata(query=QueryParamMetadata(style="form", explode=True)), + ] + + external_id: Annotated[ Optional[str], + pydantic.Field(alias="externalId"), + FieldMetadata(query=QueryParamMetadata(style="form", explode=True)), + ] = None + + key_id: Annotated[ + Optional[KeyID], pydantic.Field(alias="keyId"), FieldMetadata(query=QueryParamMetadata(style="form", explode=True)), ] = None + r"""Only include data for a specific key or keys. - owner_id: Annotated[ - Optional[str], - pydantic.Field(alias="ownerId"), + When you are providing zero or more than one key ids, all usage counts are aggregated and summed up. Send multiple requests with one keyId each if you need counts per key. + + + """ + + tag: Annotated[ + Optional[Tag], FieldMetadata(query=QueryParamMetadata(style="form", explode=True)), ] = None + r"""Only include data for a specific tag or tags. + + When you are providing zero or more than one tag, all usage counts are aggregated and summed up. Send multiple requests with one tag each if you need counts per tag. + """ start: Annotated[ OptionalNullable[int], @@ -47,17 +171,49 @@ class GetVerificationsRequest(BaseModel): end: Annotated[ OptionalNullable[int], FieldMetadata(query=QueryParamMetadata(style="form", explode=True)), - ] = UNSET + ] = 1746232062261 + + group_by: Annotated[ + Optional[GroupBy], + pydantic.Field(alias="groupBy"), + FieldMetadata(query=QueryParamMetadata(style="form", explode=True)), + ] = None + r"""By default, datapoints are not aggregated, however you probably want to get a breakdown per time, key or identity. + + Grouping by tags and by tag is mutually exclusive. + """ - granularity: Annotated[ - Optional[Granularity], + limit: Annotated[ + Optional[int], FieldMetadata(query=QueryParamMetadata(style="form", explode=True)), - ] = Granularity.DAY - r"""The granularity of the usage data to fetch, currently only `day` is supported""" + ] = None + + order_by: Annotated[ + Optional[OrderBy], + pydantic.Field(alias="orderBy"), + FieldMetadata(query=QueryParamMetadata(style="form", explode=True)), + ] = None + r"""Sort the output by a specific value. You can use this in combination with the `order` param.""" + + order: Annotated[ + Optional[Order], + FieldMetadata(query=QueryParamMetadata(style="form", explode=True)), + ] = Order.ASC + r"""Define the order of sorting. Use this in combination with `orderBy`""" @model_serializer(mode="wrap") def serialize_model(self, handler): - optional_fields = ["keyId", "ownerId", "start", "end", "granularity"] + optional_fields = [ + "externalId", + "keyId", + "tag", + "start", + "end", + "groupBy", + "limit", + "orderBy", + "order", + ] nullable_fields = ["start", "end"] null_default_fields = [] @@ -65,7 +221,7 @@ def serialize_model(self, handler): m = {} - for n, f in self.model_fields.items(): + for n, f in type(self).model_fields.items(): k = f.alias or n val = serialized.get(k) serialized.pop(k, None) @@ -86,51 +242,107 @@ def serialize_model(self, handler): return m -class VerificationsTypedDict(TypedDict): - time: int - r"""The timestamp of the usage data""" - success: int - r"""The number of successful requests""" - rate_limited: int - r"""The number of requests that were rate limited""" - usage_exceeded: int - r"""The number of requests that exceeded the usage limit""" +class GetVerificationsIdentityTypedDict(TypedDict): + r"""Only available when specifying groupBy=identity in the query. + In this case there would be one datapoint per time and groupBy target. + """ + id: str + external_id: str -class Verifications(BaseModel): - time: int - r"""The timestamp of the usage data""" - success: int - r"""The number of successful requests""" +class GetVerificationsIdentity(BaseModel): + r"""Only available when specifying groupBy=identity in the query. + In this case there would be one datapoint per time and groupBy target. + """ - rate_limited: Annotated[int, pydantic.Field(alias="rateLimited")] - r"""The number of requests that were rate limited""" + id: str - usage_exceeded: Annotated[int, pydantic.Field(alias="usageExceeded")] - r"""The number of requests that exceeded the usage limit""" + external_id: Annotated[str, pydantic.Field(alias="externalId")] class GetVerificationsResponseBodyTypedDict(TypedDict): - r"""Usage numbers over time""" - - verifications: List[VerificationsTypedDict] + total: int + r"""Total number of verifications in the current time slice, regardless of outcome.""" + time: NotRequired[int] + r"""Unix timestamp in milliseconds of the start of the current time slice.""" + valid: NotRequired[int] + not_found: NotRequired[int] + forbidden: NotRequired[int] + usage_exceeded: NotRequired[int] + rate_limited: NotRequired[int] + unauthorized: NotRequired[int] + disabled: NotRequired[int] + insufficient_permissions: NotRequired[int] + expired: NotRequired[int] + tag: NotRequired[str] + r"""Only available when grouping by tag.""" + tags: NotRequired[List[str]] + r"""Filter by one or multiple tags. If multiple tags are provided""" + key_id: NotRequired[str] + r"""Only available when specifying groupBy=key in the query. + In this case there would be one datapoint per time and groupBy target. + """ + identity: NotRequired[GetVerificationsIdentityTypedDict] + r"""Only available when specifying groupBy=identity in the query. + In this case there would be one datapoint per time and groupBy target. + """ class GetVerificationsResponseBody(BaseModel): - r"""Usage numbers over time""" + total: int + r"""Total number of verifications in the current time slice, regardless of outcome.""" + + time: Optional[int] = None + r"""Unix timestamp in milliseconds of the start of the current time slice.""" + + valid: Optional[int] = None + + not_found: Annotated[Optional[int], pydantic.Field(alias="notFound")] = None + + forbidden: Optional[int] = None + + usage_exceeded: Annotated[Optional[int], pydantic.Field(alias="usageExceeded")] = ( + None + ) + + rate_limited: Annotated[Optional[int], pydantic.Field(alias="rateLimited")] = None + + unauthorized: Optional[int] = None + + disabled: Optional[int] = None + + insufficient_permissions: Annotated[ + Optional[int], pydantic.Field(alias="insufficientPermissions") + ] = None + + expired: Optional[int] = None + + tag: Optional[str] = None + r"""Only available when grouping by tag.""" + + tags: Optional[List[str]] = None + r"""Filter by one or multiple tags. If multiple tags are provided""" + + key_id: Annotated[Optional[str], pydantic.Field(alias="keyId")] = None + r"""Only available when specifying groupBy=key in the query. + In this case there would be one datapoint per time and groupBy target. + """ - verifications: List[Verifications] + identity: Optional[GetVerificationsIdentity] = None + r"""Only available when specifying groupBy=identity in the query. + In this case there would be one datapoint per time and groupBy target. + """ class GetVerificationsResponseTypedDict(TypedDict): http_meta: HTTPMetadataTypedDict - object: NotRequired[GetVerificationsResponseBodyTypedDict] - r"""Usage numbers over time""" + response_bodies: NotRequired[List[GetVerificationsResponseBodyTypedDict]] + r"""Retrieve all required data to build end-user facing dashboards and drive your usage-based billing.""" class GetVerificationsResponse(BaseModel): http_meta: Annotated[Optional[HTTPMetadata], pydantic.Field(exclude=True)] = None - object: Optional[GetVerificationsResponseBody] = None - r"""Usage numbers over time""" + response_bodies: Optional[List[GetVerificationsResponseBody]] = None + r"""Retrieve all required data to build end-user facing dashboards and drive your usage-based billing.""" diff --git a/src/unkey_py/models/key.py b/src/unkey_py/models/key.py index 3e72ba6..537550f 100644 --- a/src/unkey_py/models/key.py +++ b/src/unkey_py/models/key.py @@ -58,7 +58,7 @@ def serialize_model(self, handler): m = {} - for n, f in self.model_fields.items(): + for n, f in type(self).model_fields.items(): k = f.alias or n val = serialized.get(k) serialized.pop(k, None) @@ -138,7 +138,7 @@ class IdentityTypedDict(TypedDict): r"""The id of the identity""" external_id: str r"""The external id of the identity""" - meta: NotRequired[Dict[str, Any]] + meta: NotRequired[Dict[str, Nullable[Any]]] r"""Any additional metadata attached to the identity""" @@ -151,7 +151,7 @@ class Identity(BaseModel): external_id: Annotated[str, pydantic.Field(alias="externalId")] r"""The external id of the identity""" - meta: Optional[Dict[str, Any]] = None + meta: Optional[Dict[str, Nullable[Any]]] = None r"""Any additional metadata attached to the identity""" @@ -170,7 +170,7 @@ class KeyTypedDict(TypedDict): r"""The name of the key, give keys a name to easily identify their purpose""" owner_id: NotRequired[str] r"""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.""" - meta: NotRequired[Dict[str, Any]] + meta: NotRequired[Dict[str, Nullable[Any]]] r"""Any additional metadata you want to store with the key""" updated_at: NotRequired[int] r"""The unix timestamp in milliseconds when the key was last updated""" @@ -216,7 +216,7 @@ class Key(BaseModel): owner_id: Annotated[Optional[str], pydantic.Field(alias="ownerId")] = None r"""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.""" - meta: Optional[Dict[str, Any]] = None + meta: Optional[Dict[str, Nullable[Any]]] = None r"""Any additional metadata you want to store with the key""" updated_at: Annotated[Optional[int], pydantic.Field(alias="updatedAt")] = None diff --git a/src/unkey_py/models/keys_getverificationsop.py b/src/unkey_py/models/keys_getverificationsop.py new file mode 100644 index 0000000..b96563a --- /dev/null +++ b/src/unkey_py/models/keys_getverificationsop.py @@ -0,0 +1,136 @@ +"""Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT.""" + +from __future__ import annotations +from .httpmetadata import HTTPMetadata, HTTPMetadataTypedDict +from enum import Enum +import pydantic +from pydantic import model_serializer +from typing import List, Optional +from typing_extensions import Annotated, NotRequired, TypedDict +from unkey_py.types import BaseModel, Nullable, OptionalNullable, UNSET, UNSET_SENTINEL +from unkey_py.utils import FieldMetadata, QueryParamMetadata + + +class Granularity(str, Enum): + r"""The granularity of the usage data to fetch, currently only `day` is supported""" + + DAY = "day" + + +class KeysGetVerificationsRequestTypedDict(TypedDict): + key_id: NotRequired[str] + owner_id: NotRequired[str] + start: NotRequired[Nullable[int]] + end: NotRequired[Nullable[int]] + granularity: NotRequired[Granularity] + r"""The granularity of the usage data to fetch, currently only `day` is supported""" + + +class KeysGetVerificationsRequest(BaseModel): + key_id: Annotated[ + Optional[str], + pydantic.Field(alias="keyId"), + FieldMetadata(query=QueryParamMetadata(style="form", explode=True)), + ] = None + + owner_id: Annotated[ + Optional[str], + pydantic.Field(alias="ownerId"), + FieldMetadata(query=QueryParamMetadata(style="form", explode=True)), + ] = None + + start: Annotated[ + OptionalNullable[int], + FieldMetadata(query=QueryParamMetadata(style="form", explode=True)), + ] = UNSET + + end: Annotated[ + OptionalNullable[int], + FieldMetadata(query=QueryParamMetadata(style="form", explode=True)), + ] = UNSET + + granularity: Annotated[ + Optional[Granularity], + FieldMetadata(query=QueryParamMetadata(style="form", explode=True)), + ] = Granularity.DAY + r"""The granularity of the usage data to fetch, currently only `day` is supported""" + + @model_serializer(mode="wrap") + def serialize_model(self, handler): + optional_fields = ["keyId", "ownerId", "start", "end", "granularity"] + nullable_fields = ["start", "end"] + null_default_fields = [] + + serialized = handler(self) + + m = {} + + for n, f in type(self).model_fields.items(): + k = f.alias or n + val = serialized.get(k) + serialized.pop(k, None) + + optional_nullable = k in optional_fields and k in nullable_fields + is_set = ( + self.__pydantic_fields_set__.intersection({n}) + or k in null_default_fields + ) # pylint: disable=no-member + + if val is not None and val != UNSET_SENTINEL: + m[k] = val + elif val != UNSET_SENTINEL and ( + not k in optional_fields or (optional_nullable and is_set) + ): + m[k] = val + + return m + + +class VerificationsTypedDict(TypedDict): + time: int + r"""The timestamp of the usage data""" + success: int + r"""The number of successful requests""" + rate_limited: int + r"""The number of requests that were rate limited""" + usage_exceeded: int + r"""The number of requests that exceeded the usage limit""" + + +class Verifications(BaseModel): + time: int + r"""The timestamp of the usage data""" + + success: int + r"""The number of successful requests""" + + rate_limited: Annotated[int, pydantic.Field(alias="rateLimited")] + r"""The number of requests that were rate limited""" + + usage_exceeded: Annotated[int, pydantic.Field(alias="usageExceeded")] + r"""The number of requests that exceeded the usage limit""" + + +class KeysGetVerificationsResponseBodyTypedDict(TypedDict): + r"""Usage numbers over time""" + + verifications: List[VerificationsTypedDict] + + +class KeysGetVerificationsResponseBody(BaseModel): + r"""Usage numbers over time""" + + verifications: List[Verifications] + + +class KeysGetVerificationsResponseTypedDict(TypedDict): + http_meta: HTTPMetadataTypedDict + object: NotRequired[KeysGetVerificationsResponseBodyTypedDict] + r"""Usage numbers over time""" + + +class KeysGetVerificationsResponse(BaseModel): + http_meta: Annotated[Optional[HTTPMetadata], pydantic.Field(exclude=True)] = None + + object: Optional[KeysGetVerificationsResponseBody] = None + r"""Usage numbers over time""" diff --git a/src/unkey_py/models/limitop.py b/src/unkey_py/models/limitop.py index ec4beb7..52b7811 100644 --- a/src/unkey_py/models/limitop.py +++ b/src/unkey_py/models/limitop.py @@ -5,7 +5,7 @@ import pydantic from typing import Any, Dict, List, Optional from typing_extensions import Annotated, NotRequired, TypedDict -from unkey_py.types import BaseModel +from unkey_py.types import BaseModel, Nullable class ResourcesTypedDict(TypedDict): @@ -15,7 +15,7 @@ class ResourcesTypedDict(TypedDict): r"""The unique identifier for the resource""" name: NotRequired[str] r"""A human readable name for this resource""" - meta: NotRequired[Dict[str, Any]] + meta: NotRequired[Dict[str, Nullable[Any]]] r"""Attach any metadata to this resources""" @@ -29,7 +29,7 @@ class Resources(BaseModel): name: Optional[str] = None r"""A human readable name for this resource""" - meta: Optional[Dict[str, Any]] = None + meta: Optional[Dict[str, Nullable[Any]]] = None r"""Attach any metadata to this resources""" @@ -50,7 +50,7 @@ class LimitRequestBodyTypedDict(TypedDict): """ async_: NotRequired[bool] r"""Async will return a response immediately, lowering latency at the cost of accuracy.""" - meta: NotRequired[Dict[str, Any]] + meta: NotRequired[Dict[str, Nullable[Any]]] r"""Attach any metadata to this request""" resources: NotRequired[List[ResourcesTypedDict]] r"""Resources that are about to be accessed by the user""" @@ -79,7 +79,7 @@ class LimitRequestBody(BaseModel): async_: Annotated[Optional[bool], pydantic.Field(alias="async")] = False r"""Async will return a response immediately, lowering latency at the cost of accuracy.""" - meta: Optional[Dict[str, Any]] = None + meta: Optional[Dict[str, Nullable[Any]]] = None r"""Attach any metadata to this request""" resources: Optional[List[Resources]] = None diff --git a/src/unkey_py/models/listkeysop.py b/src/unkey_py/models/listkeysop.py index c9d3ec2..e43705f 100644 --- a/src/unkey_py/models/listkeysop.py +++ b/src/unkey_py/models/listkeysop.py @@ -78,7 +78,7 @@ def serialize_model(self, handler): m = {} - for n, f in self.model_fields.items(): + for n, f in type(self).model_fields.items(): k = f.alias or n val = serialized.get(k) serialized.pop(k, None) @@ -104,7 +104,7 @@ class ListKeysResponseBodyTypedDict(TypedDict): keys: List[KeyTypedDict] total: int - r"""The total number of keys for this api""" + r"""The total number of keys for this api. This is an approximation and may lag behind up to 5 minutes.""" cursor: NotRequired[str] r"""The cursor to use for the next page of results, if no cursor is returned, there are no more results""" @@ -115,7 +115,7 @@ class ListKeysResponseBody(BaseModel): keys: List[Key] total: int - r"""The total number of keys for this api""" + r"""The total number of keys for this api. This is an approximation and may lag behind up to 5 minutes.""" cursor: Optional[str] = None r"""The cursor to use for the next page of results, if no cursor is returned, there are no more results""" diff --git a/src/unkey_py/models/listoverridesop.py b/src/unkey_py/models/listoverridesop.py index 92af781..8770f93 100644 --- a/src/unkey_py/models/listoverridesop.py +++ b/src/unkey_py/models/listoverridesop.py @@ -70,7 +70,7 @@ def serialize_model(self, handler): m = {} - for n, f in self.model_fields.items(): + for n, f in type(self).model_fields.items(): k = f.alias or n val = serialized.get(k) serialized.pop(k, None) diff --git a/src/unkey_py/models/permissionquery.py b/src/unkey_py/models/permissionquery.py index 49c7e53..e346fde 100644 --- a/src/unkey_py/models/permissionquery.py +++ b/src/unkey_py/models/permissionquery.py @@ -4,30 +4,30 @@ import pydantic from typing import List, Union from typing_extensions import Annotated, TypeAliasType, TypedDict -from unkey_py.types import BaseModel +from unkey_py.types import BaseModel, Nullable class OrTypedDict(TypedDict): - or_: List[PermissionQueryTypedDict] + or_: List[Nullable[PermissionQueryTypedDict]] class Or(BaseModel): - or_: Annotated[List[PermissionQuery], pydantic.Field(alias="or")] + or_: Annotated[List[Nullable[PermissionQuery]], pydantic.Field(alias="or")] class AndTypedDict(TypedDict): - and_: List[PermissionQueryTypedDict] + and_: List[Nullable[PermissionQueryTypedDict]] class And(BaseModel): - and_: Annotated[List[PermissionQuery], pydantic.Field(alias="and")] + and_: Annotated[List[Nullable[PermissionQuery]], pydantic.Field(alias="and")] PermissionQueryTypedDict = TypeAliasType( - "PermissionQueryTypedDict", Union[AndTypedDict, OrTypedDict, str] + "PermissionQueryTypedDict", Union["AndTypedDict", "OrTypedDict", str] ) r"""A query for which permissions you require""" -PermissionQuery = TypeAliasType("PermissionQuery", Union[And, Or, str]) +PermissionQuery = TypeAliasType("PermissionQuery", Union["And", "Or", str]) r"""A query for which permissions you require""" diff --git a/src/unkey_py/models/ratelimit_setoverrideop.py b/src/unkey_py/models/setoverrideop.py similarity index 86% rename from src/unkey_py/models/ratelimit_setoverrideop.py rename to src/unkey_py/models/setoverrideop.py index 5e9197d..5fd1c14 100644 --- a/src/unkey_py/models/ratelimit_setoverrideop.py +++ b/src/unkey_py/models/setoverrideop.py @@ -8,7 +8,7 @@ from unkey_py.types import BaseModel -class RatelimitSetOverrideRequestBodyTypedDict(TypedDict): +class SetOverrideRequestBodyTypedDict(TypedDict): identifier: str r"""Identifier of your user, this can be their userId, an email, an ip or anything else. Wildcards ( * ) can be used to match multiple identifiers, More info can be found at https://www.unkey.com/docs/ratelimiting/overrides#wildcard-rules""" limit: int @@ -23,7 +23,7 @@ class RatelimitSetOverrideRequestBodyTypedDict(TypedDict): r"""Async will return a response immediately, lowering latency at the cost of accuracy.""" -class RatelimitSetOverrideRequestBody(BaseModel): +class SetOverrideRequestBody(BaseModel): identifier: str r"""Identifier of your user, this can be their userId, an email, an ip or anything else. Wildcards ( * ) can be used to match multiple identifiers, More info can be found at https://www.unkey.com/docs/ratelimiting/overrides#wildcard-rules""" @@ -45,28 +45,28 @@ class RatelimitSetOverrideRequestBody(BaseModel): r"""Async will return a response immediately, lowering latency at the cost of accuracy.""" -class RatelimitSetOverrideResponseBodyTypedDict(TypedDict): +class SetOverrideResponseBodyTypedDict(TypedDict): r"""Sucessfully created a ratelimit override""" override_id: str r"""The id of the override. This is used internally""" -class RatelimitSetOverrideResponseBody(BaseModel): +class SetOverrideResponseBody(BaseModel): r"""Sucessfully created a ratelimit override""" override_id: Annotated[str, pydantic.Field(alias="overrideId")] r"""The id of the override. This is used internally""" -class RatelimitSetOverrideResponseTypedDict(TypedDict): +class SetOverrideResponseTypedDict(TypedDict): http_meta: HTTPMetadataTypedDict - object: NotRequired[RatelimitSetOverrideResponseBodyTypedDict] + object: NotRequired[SetOverrideResponseBodyTypedDict] r"""Sucessfully created a ratelimit override""" -class RatelimitSetOverrideResponse(BaseModel): +class SetOverrideResponse(BaseModel): http_meta: Annotated[Optional[HTTPMetadata], pydantic.Field(exclude=True)] = None - object: Optional[RatelimitSetOverrideResponseBody] = None + object: Optional[SetOverrideResponseBody] = None r"""Sucessfully created a ratelimit override""" diff --git a/src/unkey_py/models/updateidentityop.py b/src/unkey_py/models/updateidentityop.py index a37eb11..bd7b9a7 100644 --- a/src/unkey_py/models/updateidentityop.py +++ b/src/unkey_py/models/updateidentityop.py @@ -5,7 +5,7 @@ import pydantic from typing import Any, Dict, List, Optional from typing_extensions import Annotated, NotRequired, TypedDict -from unkey_py.types import BaseModel +from unkey_py.types import BaseModel, Nullable class UpdateIdentityRatelimitsTypedDict(TypedDict): @@ -35,7 +35,7 @@ class UpdateIdentityRequestBodyTypedDict(TypedDict): r"""The externalId of the identity to update, use either `identityId` or `externalId`, if both are provided, `identityId` takes precedence.""" environment: NotRequired[str] r"""This is not yet used but here for future compatibility.""" - meta: NotRequired[Dict[str, Any]] + meta: NotRequired[Dict[str, Nullable[Any]]] r"""Attach metadata to this identity that you need to have access to when verifying a key. Set to `{}` to clear. @@ -63,7 +63,7 @@ class UpdateIdentityRequestBody(BaseModel): environment: Optional[str] = "default" r"""This is not yet used but here for future compatibility.""" - meta: Optional[Dict[str, Any]] = None + meta: Optional[Dict[str, Nullable[Any]]] = None r"""Attach metadata to this identity that you need to have access to when verifying a key. Set to `{}` to clear. @@ -109,7 +109,7 @@ class UpdateIdentityResponseBodyTypedDict(TypedDict): r"""The id of the identity.""" external_id: str r"""The externalId of the identity.""" - meta: Dict[str, Any] + meta: Dict[str, Nullable[Any]] r"""The metadata attached to this identity.""" ratelimits: List[UpdateIdentityIdentitiesRatelimitsTypedDict] @@ -123,7 +123,7 @@ class UpdateIdentityResponseBody(BaseModel): external_id: Annotated[str, pydantic.Field(alias="externalId")] r"""The externalId of the identity.""" - meta: Dict[str, Any] + meta: Dict[str, Nullable[Any]] r"""The metadata attached to this identity.""" ratelimits: List[UpdateIdentityIdentitiesRatelimits] diff --git a/src/unkey_py/models/updatekeyop.py b/src/unkey_py/models/updatekeyop.py index 26ba832..5cb6fda 100644 --- a/src/unkey_py/models/updatekeyop.py +++ b/src/unkey_py/models/updatekeyop.py @@ -198,7 +198,7 @@ class UpdateKeyRequestBodyTypedDict(TypedDict): Under the hood this upserts and connects an `ìdentity` for you. To disconnect the key from an identity, set `externalId: null`. """ - meta: NotRequired[Nullable[Dict[str, Any]]] + meta: NotRequired[Nullable[Dict[str, Nullable[Any]]]] r"""Any additional metadata you want to store with the key""" expires: NotRequired[Nullable[int]] r"""The unix timestamp in milliseconds when the key will expire. If this field is null or undefined, the key is not expiring.""" @@ -250,7 +250,7 @@ class UpdateKeyRequestBody(BaseModel): To disconnect the key from an identity, set `externalId: null`. """ - meta: OptionalNullable[Dict[str, Any]] = UNSET + meta: OptionalNullable[Dict[str, Nullable[Any]]] = UNSET r"""Any additional metadata you want to store with the key""" expires: OptionalNullable[int] = UNSET @@ -309,7 +309,7 @@ def serialize_model(self, handler): m = {} - for n, f in self.model_fields.items(): + for n, f in type(self).model_fields.items(): k = f.alias or n val = serialized.get(k) serialized.pop(k, None) diff --git a/src/unkey_py/models/updateremainingop.py b/src/unkey_py/models/updateremainingop.py index b1c6016..d7c5937 100644 --- a/src/unkey_py/models/updateremainingop.py +++ b/src/unkey_py/models/updateremainingop.py @@ -47,7 +47,7 @@ def serialize_model(self, handler): m = {} - for n, f in self.model_fields.items(): + for n, f in type(self).model_fields.items(): k = f.alias or n val = serialized.get(k) serialized.pop(k, None) @@ -91,7 +91,7 @@ def serialize_model(self, handler): m = {} - for n, f in self.model_fields.items(): + for n, f in type(self).model_fields.items(): k = f.alias or n val = serialized.get(k) serialized.pop(k, None) diff --git a/src/unkey_py/models/v1_migrations_createkeysop.py b/src/unkey_py/models/v1_migrations_createkeysop.py index b13cc73..416c77f 100644 --- a/src/unkey_py/models/v1_migrations_createkeysop.py +++ b/src/unkey_py/models/v1_migrations_createkeysop.py @@ -6,7 +6,7 @@ import pydantic from typing import Any, Dict, List, Optional from typing_extensions import Annotated, NotRequired, TypedDict, deprecated -from unkey_py.types import BaseModel +from unkey_py.types import BaseModel, Nullable class Variant(str, Enum): @@ -156,10 +156,12 @@ class RequestBodyTypedDict(TypedDict): start: NotRequired[str] r"""The first 4 characters of the key. If a prefix is used, it should be the prefix plus 4 characters.""" owner_id: NotRequired[str] + r"""Deprecated, use `externalId`""" + external_id: NotRequired[str] r"""Your user’s Id. This will provide a link between Unkey and your customer record. When validating a key, we will return this back to you, so you can clearly identify your user from their api key. """ - meta: NotRequired[Dict[str, Any]] + meta: NotRequired[Dict[str, Nullable[Any]]] r"""This is a place for dynamic meta data, anything that feels useful for you should go here""" roles: NotRequired[List[str]] r"""A list of roles that this key should have. If the role does not exist, an error is thrown""" @@ -215,12 +217,21 @@ class RequestBody(BaseModel): start: Optional[str] = None r"""The first 4 characters of the key. If a prefix is used, it should be the prefix plus 4 characters.""" - owner_id: Annotated[Optional[str], pydantic.Field(alias="ownerId")] = None + owner_id: Annotated[ + Optional[str], + pydantic.Field( + deprecated="warning: ** DEPRECATED ** - This will be removed in a future release, please migrate away from it as soon as possible.", + alias="ownerId", + ), + ] = None + r"""Deprecated, use `externalId`""" + + external_id: Annotated[Optional[str], pydantic.Field(alias="externalId")] = None r"""Your user’s Id. This will provide a link between Unkey and your customer record. When validating a key, we will return this back to you, so you can clearly identify your user from their api key. """ - meta: Optional[Dict[str, Any]] = None + meta: Optional[Dict[str, Nullable[Any]]] = None r"""This is a place for dynamic meta data, anything that feels useful for you should go here""" roles: Optional[List[str]] = None diff --git a/src/unkey_py/models/v1_migrations_enqueuekeysop.py b/src/unkey_py/models/v1_migrations_enqueuekeysop.py index 226d476..ba12b4a 100644 --- a/src/unkey_py/models/v1_migrations_enqueuekeysop.py +++ b/src/unkey_py/models/v1_migrations_enqueuekeysop.py @@ -6,7 +6,7 @@ import pydantic from typing import Any, Dict, List, Optional from typing_extensions import Annotated, NotRequired, TypedDict, deprecated -from unkey_py.types import BaseModel +from unkey_py.types import BaseModel, Nullable class V1MigrationsEnqueueKeysVariant(str, Enum): @@ -162,7 +162,7 @@ class V1MigrationsEnqueueKeysKeysTypedDict(TypedDict): r"""Your user’s Id. This will provide a link between Unkey and your customer record. When validating a key, we will return this back to you, so you can clearly identify your user from their api key. """ - meta: NotRequired[Dict[str, Any]] + meta: NotRequired[Dict[str, Nullable[Any]]] r"""This is a place for dynamic meta data, anything that feels useful for you should go here""" roles: NotRequired[List[str]] r"""A list of roles that this key should have. If the role does not exist, an error is thrown""" @@ -220,7 +220,7 @@ class V1MigrationsEnqueueKeysKeys(BaseModel): When validating a key, we will return this back to you, so you can clearly identify your user from their api key. """ - meta: Optional[Dict[str, Any]] = None + meta: Optional[Dict[str, Nullable[Any]]] = None r"""This is a place for dynamic meta data, anything that feels useful for you should go here""" roles: Optional[List[str]] = None diff --git a/src/unkey_py/models/v1keysverifykeyrequest.py b/src/unkey_py/models/v1keysverifykeyrequest.py index 8bea650..c44523c 100644 --- a/src/unkey_py/models/v1keysverifykeyrequest.py +++ b/src/unkey_py/models/v1keysverifykeyrequest.py @@ -32,7 +32,7 @@ def serialize_model(self, handler): m = {} - for n, f in self.model_fields.items(): + for n, f in type(self).model_fields.items(): k = f.alias or n val = serialized.get(k) serialized.pop(k, None) @@ -53,6 +53,20 @@ def serialize_model(self, handler): return m +class RemainingTypedDict(TypedDict): + r"""Customize the behaviour of deducting remaining uses. When some of your endpoints are more expensive than others, you can set a custom `cost` for each.""" + + cost: NotRequired[int] + r"""How many tokens should be deducted from the current `remaining` value. Set it to 0, to make it free.""" + + +class Remaining(BaseModel): + r"""Customize the behaviour of deducting remaining uses. When some of your endpoints are more expensive than others, you can set a custom `cost` for each.""" + + cost: Optional[int] = 1 + r"""How many tokens should be deducted from the current `remaining` value. Set it to 0, to make it free.""" + + @deprecated( "warning: ** DEPRECATED ** - This will be removed in a future release, please migrate away from it as soon as possible." ) @@ -104,9 +118,19 @@ class V1KeysVerifyKeyRequestTypedDict(TypedDict): api_id: NotRequired[str] r"""The id of the api where the key belongs to. This is optional for now but will be required soon. The key will be verified against the api's configuration. If the key does not belong to the api, the verification will fail. + """ + tags: NotRequired[List[str]] + r"""Tags do not influence the outcome of a verification. + They can be added to filter or aggregate historical verification data for your analytics needs. + To unkey, a tag is simply a string, we don't enforce any schema but leave that up to you. + The only exception is that each tag must be between 1 and 128 characters long. + A typical setup would be to add key-value pairs of resources or locations, that you need later when querying. + """ authorization: NotRequired[AuthorizationTypedDict] r"""Perform RBAC checks""" + remaining: NotRequired[RemainingTypedDict] + r"""Customize the behaviour of deducting remaining uses. When some of your endpoints are more expensive than others, you can set a custom `cost` for each.""" ratelimit: NotRequired[V1KeysVerifyKeyRequestRatelimitTypedDict] r"""Use 'ratelimits' with `[{ name: \"default\", cost: 2}]`""" ratelimits: NotRequired[List[RatelimitsModelTypedDict]] @@ -125,9 +149,21 @@ class V1KeysVerifyKeyRequest(BaseModel): The key will be verified against the api's configuration. If the key does not belong to the api, the verification will fail. """ + tags: Optional[List[str]] = None + r"""Tags do not influence the outcome of a verification. + They can be added to filter or aggregate historical verification data for your analytics needs. + To unkey, a tag is simply a string, we don't enforce any schema but leave that up to you. + The only exception is that each tag must be between 1 and 128 characters long. + A typical setup would be to add key-value pairs of resources or locations, that you need later when querying. + + """ + authorization: Optional[Authorization] = None r"""Perform RBAC checks""" + remaining: Optional[Remaining] = None + r"""Customize the behaviour of deducting remaining uses. When some of your endpoints are more expensive than others, you can set a custom `cost` for each.""" + ratelimit: Annotated[ Optional[V1KeysVerifyKeyRequestRatelimit], pydantic.Field( diff --git a/src/unkey_py/models/v1keysverifykeyresponse.py b/src/unkey_py/models/v1keysverifykeyresponse.py index 60f70fc..f358724 100644 --- a/src/unkey_py/models/v1keysverifykeyresponse.py +++ b/src/unkey_py/models/v1keysverifykeyresponse.py @@ -5,7 +5,7 @@ import pydantic from typing import Any, Dict, List, Optional from typing_extensions import Annotated, NotRequired, TypedDict -from unkey_py.types import BaseModel +from unkey_py.types import BaseModel, Nullable class V1KeysVerifyKeyResponseRatelimitTypedDict(TypedDict): @@ -65,7 +65,7 @@ class V1KeysVerifyKeyResponseIdentityTypedDict(TypedDict): id: str external_id: str - meta: Dict[str, Any] + meta: Dict[str, Nullable[Any]] class V1KeysVerifyKeyResponseIdentity(BaseModel): @@ -75,7 +75,7 @@ class V1KeysVerifyKeyResponseIdentity(BaseModel): external_id: Annotated[str, pydantic.Field(alias="externalId")] - meta: Dict[str, Any] + meta: Dict[str, Nullable[Any]] class V1KeysVerifyKeyResponseTypedDict(TypedDict): @@ -99,13 +99,15 @@ class V1KeysVerifyKeyResponseTypedDict(TypedDict): These are validation codes, the HTTP status will be 200. """ + request_id: str + r"""A unique id for this request, please provide it to Unkey support to help us debug your issue.""" key_id: NotRequired[str] r"""The id of the key""" name: NotRequired[str] r"""The name of the key, give keys a name to easily identifiy their purpose""" owner_id: NotRequired[str] r"""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.""" - meta: NotRequired[Dict[str, Any]] + meta: NotRequired[Dict[str, Nullable[Any]]] r"""Any additional metadata you want to store with the key""" expires: NotRequired[int] r"""The unix timestamp in milliseconds when the key will expire. If this field is null or undefined, the key is not expiring.""" @@ -117,6 +119,8 @@ class V1KeysVerifyKeyResponseTypedDict(TypedDict): r"""Sets the key to be enabled or disabled. Disabled keys will not verify.""" permissions: NotRequired[List[str]] r"""A list of all the permissions this key is connected to.""" + roles: NotRequired[List[str]] + r"""A list of all the roles this key is connected to.""" environment: NotRequired[str] r"""The environment of the key, this is what what you set when you crated the key""" identity: NotRequired[V1KeysVerifyKeyResponseIdentityTypedDict] @@ -146,6 +150,9 @@ class V1KeysVerifyKeyResponse(BaseModel): """ + request_id: Annotated[str, pydantic.Field(alias="requestId")] + r"""A unique id for this request, please provide it to Unkey support to help us debug your issue.""" + key_id: Annotated[Optional[str], pydantic.Field(alias="keyId")] = None r"""The id of the key""" @@ -155,7 +162,7 @@ class V1KeysVerifyKeyResponse(BaseModel): owner_id: Annotated[Optional[str], pydantic.Field(alias="ownerId")] = None r"""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.""" - meta: Optional[Dict[str, Any]] = None + meta: Optional[Dict[str, Nullable[Any]]] = None r"""Any additional metadata you want to store with the key""" expires: Optional[int] = None @@ -173,6 +180,9 @@ class V1KeysVerifyKeyResponse(BaseModel): permissions: Optional[List[str]] = None r"""A list of all the permissions this key is connected to.""" + roles: Optional[List[str]] = None + r"""A list of all the roles this key is connected to.""" + environment: Optional[str] = None r"""The environment of the key, this is what what you set when you crated the key""" diff --git a/src/unkey_py/models/whoamiop.py b/src/unkey_py/models/whoamiop.py index 26e9e13..eb3ca66 100644 --- a/src/unkey_py/models/whoamiop.py +++ b/src/unkey_py/models/whoamiop.py @@ -5,7 +5,7 @@ import pydantic from typing import Any, Dict, Optional from typing_extensions import Annotated, NotRequired, TypedDict -from unkey_py.types import BaseModel +from unkey_py.types import BaseModel, Nullable class WhoamiRequestBodyTypedDict(TypedDict): @@ -52,7 +52,7 @@ class WhoamiResponseBodyTypedDict(TypedDict): r"""The remaining number of requests for the key""" identity: NotRequired[WhoamiIdentityTypedDict] r"""The identity object associated with the key""" - meta: NotRequired[Dict[str, Any]] + meta: NotRequired[Dict[str, Nullable[Any]]] r"""Metadata associated with the key""" environment: NotRequired[str] r"""The environment the key is associated with""" @@ -79,7 +79,7 @@ class WhoamiResponseBody(BaseModel): identity: Optional[WhoamiIdentity] = None r"""The identity object associated with the key""" - meta: Optional[Dict[str, Any]] = None + meta: Optional[Dict[str, Nullable[Any]]] = None r"""Metadata associated with the key""" environment: Optional[str] = None diff --git a/src/unkey_py/permissions.py b/src/unkey_py/permissions.py index 655b0dd..a9ac3bc 100644 --- a/src/unkey_py/permissions.py +++ b/src/unkey_py/permissions.py @@ -1,7 +1,7 @@ """Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT.""" from .basesdk import BaseSDK -from typing import Any, List, Optional, Union, cast +from typing import Any, List, Mapping, Optional, Union, cast from unkey_py import models, utils from unkey_py._hooks import HookContext from unkey_py.types import BaseModel, OptionalNullable, UNSET @@ -19,12 +19,14 @@ def create( retries: OptionalNullable[utils.RetryConfig] = UNSET, server_url: Optional[str] = None, timeout_ms: Optional[int] = None, + http_headers: Optional[Mapping[str, str]] = None, ) -> models.CreatePermissionResponse: r""" :param request: The request object to send. :param retries: Override the default retry configuration for this method :param server_url: Override the default server URL for this method :param timeout_ms: Override the default request timeout configuration for this method in milliseconds + :param http_headers: Additional headers to set or replace on requests. """ base_url = None url_variables = None @@ -33,12 +35,14 @@ def create( if server_url is not None: base_url = server_url + else: + base_url = self._get_url(base_url, url_variables) if not isinstance(request, BaseModel): request = utils.unmarshal(request, models.CreatePermissionRequestBody) request = cast(models.CreatePermissionRequestBody, request) - req = self.build_request( + req = self._build_request( method="POST", path="/v1/permissions.createPermission", base_url=base_url, @@ -49,6 +53,7 @@ def create( request_has_query_params=True, user_agent_header="user-agent", accept_header_value="application/json", + http_headers=http_headers, security=self.sdk_configuration.security, get_serialized_body=lambda: utils.serialize_request_body( request, False, False, "json", models.CreatePermissionRequestBody @@ -70,6 +75,7 @@ def create( http_res = self.do_request( hook_ctx=HookContext( + base_url=base_url or "", operation_id="createPermission", oauth2_scopes=[], security_source=get_security_from_env( @@ -83,6 +89,7 @@ def create( "403", "404", "409", + "412", "429", "4XX", "500", @@ -91,7 +98,7 @@ def create( retry_config=retry_config, ) - data: Any = None + response_data: Any = None if utils.match_response(http_res, "200", "application/json"): return models.CreatePermissionResponse( object=utils.unmarshal_json( @@ -100,29 +107,45 @@ def create( http_meta=models.HTTPMetadata(request=req, response=http_res), ) if utils.match_response(http_res, "400", "application/json"): - data = utils.unmarshal_json(http_res.text, models.ErrBadRequestData) - raise models.ErrBadRequest(data=data) + response_data = utils.unmarshal_json( + http_res.text, models.ErrBadRequestData + ) + raise models.ErrBadRequest(data=response_data) if utils.match_response(http_res, "401", "application/json"): - data = utils.unmarshal_json(http_res.text, models.ErrUnauthorizedData) - raise models.ErrUnauthorized(data=data) + response_data = utils.unmarshal_json( + http_res.text, models.ErrUnauthorizedData + ) + raise models.ErrUnauthorized(data=response_data) if utils.match_response(http_res, "403", "application/json"): - data = utils.unmarshal_json(http_res.text, models.ErrForbiddenData) - raise models.ErrForbidden(data=data) + response_data = utils.unmarshal_json(http_res.text, models.ErrForbiddenData) + raise models.ErrForbidden(data=response_data) if utils.match_response(http_res, "404", "application/json"): - data = utils.unmarshal_json(http_res.text, models.ErrNotFoundData) - raise models.ErrNotFound(data=data) + response_data = utils.unmarshal_json(http_res.text, models.ErrNotFoundData) + raise models.ErrNotFound(data=response_data) if utils.match_response(http_res, "409", "application/json"): - data = utils.unmarshal_json(http_res.text, models.ErrConflictData) - raise models.ErrConflict(data=data) + response_data = utils.unmarshal_json(http_res.text, models.ErrConflictData) + raise models.ErrConflict(data=response_data) + if utils.match_response(http_res, "412", "application/json"): + response_data = utils.unmarshal_json( + http_res.text, models.ErrPreconditionFailedData + ) + raise models.ErrPreconditionFailed(data=response_data) if utils.match_response(http_res, "429", "application/json"): - data = utils.unmarshal_json(http_res.text, models.ErrTooManyRequestsData) - raise models.ErrTooManyRequests(data=data) + response_data = utils.unmarshal_json( + http_res.text, models.ErrTooManyRequestsData + ) + raise models.ErrTooManyRequests(data=response_data) if utils.match_response(http_res, "500", "application/json"): - data = utils.unmarshal_json( + response_data = utils.unmarshal_json( http_res.text, models.ErrInternalServerErrorData ) - raise models.ErrInternalServerError(data=data) - if utils.match_response(http_res, ["4XX", "5XX"], "*"): + raise models.ErrInternalServerError(data=response_data) + if utils.match_response(http_res, "4XX", "*"): + http_res_text = utils.stream_to_text(http_res) + raise models.SDKError( + "API error occurred", http_res.status_code, http_res_text, http_res + ) + if utils.match_response(http_res, "5XX", "*"): http_res_text = utils.stream_to_text(http_res) raise models.SDKError( "API error occurred", http_res.status_code, http_res_text, http_res @@ -147,12 +170,14 @@ async def create_async( retries: OptionalNullable[utils.RetryConfig] = UNSET, server_url: Optional[str] = None, timeout_ms: Optional[int] = None, + http_headers: Optional[Mapping[str, str]] = None, ) -> models.CreatePermissionResponse: r""" :param request: The request object to send. :param retries: Override the default retry configuration for this method :param server_url: Override the default server URL for this method :param timeout_ms: Override the default request timeout configuration for this method in milliseconds + :param http_headers: Additional headers to set or replace on requests. """ base_url = None url_variables = None @@ -161,12 +186,14 @@ async def create_async( if server_url is not None: base_url = server_url + else: + base_url = self._get_url(base_url, url_variables) if not isinstance(request, BaseModel): request = utils.unmarshal(request, models.CreatePermissionRequestBody) request = cast(models.CreatePermissionRequestBody, request) - req = self.build_request_async( + req = self._build_request_async( method="POST", path="/v1/permissions.createPermission", base_url=base_url, @@ -177,6 +204,7 @@ async def create_async( request_has_query_params=True, user_agent_header="user-agent", accept_header_value="application/json", + http_headers=http_headers, security=self.sdk_configuration.security, get_serialized_body=lambda: utils.serialize_request_body( request, False, False, "json", models.CreatePermissionRequestBody @@ -198,6 +226,7 @@ async def create_async( http_res = await self.do_request_async( hook_ctx=HookContext( + base_url=base_url or "", operation_id="createPermission", oauth2_scopes=[], security_source=get_security_from_env( @@ -211,6 +240,7 @@ async def create_async( "403", "404", "409", + "412", "429", "4XX", "500", @@ -219,7 +249,7 @@ async def create_async( retry_config=retry_config, ) - data: Any = None + response_data: Any = None if utils.match_response(http_res, "200", "application/json"): return models.CreatePermissionResponse( object=utils.unmarshal_json( @@ -228,29 +258,45 @@ async def create_async( http_meta=models.HTTPMetadata(request=req, response=http_res), ) if utils.match_response(http_res, "400", "application/json"): - data = utils.unmarshal_json(http_res.text, models.ErrBadRequestData) - raise models.ErrBadRequest(data=data) + response_data = utils.unmarshal_json( + http_res.text, models.ErrBadRequestData + ) + raise models.ErrBadRequest(data=response_data) if utils.match_response(http_res, "401", "application/json"): - data = utils.unmarshal_json(http_res.text, models.ErrUnauthorizedData) - raise models.ErrUnauthorized(data=data) + response_data = utils.unmarshal_json( + http_res.text, models.ErrUnauthorizedData + ) + raise models.ErrUnauthorized(data=response_data) if utils.match_response(http_res, "403", "application/json"): - data = utils.unmarshal_json(http_res.text, models.ErrForbiddenData) - raise models.ErrForbidden(data=data) + response_data = utils.unmarshal_json(http_res.text, models.ErrForbiddenData) + raise models.ErrForbidden(data=response_data) if utils.match_response(http_res, "404", "application/json"): - data = utils.unmarshal_json(http_res.text, models.ErrNotFoundData) - raise models.ErrNotFound(data=data) + response_data = utils.unmarshal_json(http_res.text, models.ErrNotFoundData) + raise models.ErrNotFound(data=response_data) if utils.match_response(http_res, "409", "application/json"): - data = utils.unmarshal_json(http_res.text, models.ErrConflictData) - raise models.ErrConflict(data=data) + response_data = utils.unmarshal_json(http_res.text, models.ErrConflictData) + raise models.ErrConflict(data=response_data) + if utils.match_response(http_res, "412", "application/json"): + response_data = utils.unmarshal_json( + http_res.text, models.ErrPreconditionFailedData + ) + raise models.ErrPreconditionFailed(data=response_data) if utils.match_response(http_res, "429", "application/json"): - data = utils.unmarshal_json(http_res.text, models.ErrTooManyRequestsData) - raise models.ErrTooManyRequests(data=data) + response_data = utils.unmarshal_json( + http_res.text, models.ErrTooManyRequestsData + ) + raise models.ErrTooManyRequests(data=response_data) if utils.match_response(http_res, "500", "application/json"): - data = utils.unmarshal_json( + response_data = utils.unmarshal_json( http_res.text, models.ErrInternalServerErrorData ) - raise models.ErrInternalServerError(data=data) - if utils.match_response(http_res, ["4XX", "5XX"], "*"): + raise models.ErrInternalServerError(data=response_data) + if utils.match_response(http_res, "4XX", "*"): + http_res_text = await utils.stream_to_text_async(http_res) + raise models.SDKError( + "API error occurred", http_res.status_code, http_res_text, http_res + ) + if utils.match_response(http_res, "5XX", "*"): http_res_text = await utils.stream_to_text_async(http_res) raise models.SDKError( "API error occurred", http_res.status_code, http_res_text, http_res @@ -275,12 +321,14 @@ def delete( retries: OptionalNullable[utils.RetryConfig] = UNSET, server_url: Optional[str] = None, timeout_ms: Optional[int] = None, + http_headers: Optional[Mapping[str, str]] = None, ) -> models.DeletePermissionResponse: r""" :param request: The request object to send. :param retries: Override the default retry configuration for this method :param server_url: Override the default server URL for this method :param timeout_ms: Override the default request timeout configuration for this method in milliseconds + :param http_headers: Additional headers to set or replace on requests. """ base_url = None url_variables = None @@ -289,12 +337,14 @@ def delete( if server_url is not None: base_url = server_url + else: + base_url = self._get_url(base_url, url_variables) if not isinstance(request, BaseModel): request = utils.unmarshal(request, models.DeletePermissionRequestBody) request = cast(models.DeletePermissionRequestBody, request) - req = self.build_request( + req = self._build_request( method="POST", path="/v1/permissions.deletePermission", base_url=base_url, @@ -305,6 +355,7 @@ def delete( request_has_query_params=True, user_agent_header="user-agent", accept_header_value="application/json", + http_headers=http_headers, security=self.sdk_configuration.security, get_serialized_body=lambda: utils.serialize_request_body( request, False, False, "json", models.DeletePermissionRequestBody @@ -326,6 +377,7 @@ def delete( http_res = self.do_request( hook_ctx=HookContext( + base_url=base_url or "", operation_id="deletePermission", oauth2_scopes=[], security_source=get_security_from_env( @@ -339,6 +391,7 @@ def delete( "403", "404", "409", + "412", "429", "4XX", "500", @@ -347,7 +400,7 @@ def delete( retry_config=retry_config, ) - data: Any = None + response_data: Any = None if utils.match_response(http_res, "200", "application/json"): return models.DeletePermissionResponse( object=utils.unmarshal_json( @@ -356,29 +409,45 @@ def delete( http_meta=models.HTTPMetadata(request=req, response=http_res), ) if utils.match_response(http_res, "400", "application/json"): - data = utils.unmarshal_json(http_res.text, models.ErrBadRequestData) - raise models.ErrBadRequest(data=data) + response_data = utils.unmarshal_json( + http_res.text, models.ErrBadRequestData + ) + raise models.ErrBadRequest(data=response_data) if utils.match_response(http_res, "401", "application/json"): - data = utils.unmarshal_json(http_res.text, models.ErrUnauthorizedData) - raise models.ErrUnauthorized(data=data) + response_data = utils.unmarshal_json( + http_res.text, models.ErrUnauthorizedData + ) + raise models.ErrUnauthorized(data=response_data) if utils.match_response(http_res, "403", "application/json"): - data = utils.unmarshal_json(http_res.text, models.ErrForbiddenData) - raise models.ErrForbidden(data=data) + response_data = utils.unmarshal_json(http_res.text, models.ErrForbiddenData) + raise models.ErrForbidden(data=response_data) if utils.match_response(http_res, "404", "application/json"): - data = utils.unmarshal_json(http_res.text, models.ErrNotFoundData) - raise models.ErrNotFound(data=data) + response_data = utils.unmarshal_json(http_res.text, models.ErrNotFoundData) + raise models.ErrNotFound(data=response_data) if utils.match_response(http_res, "409", "application/json"): - data = utils.unmarshal_json(http_res.text, models.ErrConflictData) - raise models.ErrConflict(data=data) + response_data = utils.unmarshal_json(http_res.text, models.ErrConflictData) + raise models.ErrConflict(data=response_data) + if utils.match_response(http_res, "412", "application/json"): + response_data = utils.unmarshal_json( + http_res.text, models.ErrPreconditionFailedData + ) + raise models.ErrPreconditionFailed(data=response_data) if utils.match_response(http_res, "429", "application/json"): - data = utils.unmarshal_json(http_res.text, models.ErrTooManyRequestsData) - raise models.ErrTooManyRequests(data=data) + response_data = utils.unmarshal_json( + http_res.text, models.ErrTooManyRequestsData + ) + raise models.ErrTooManyRequests(data=response_data) if utils.match_response(http_res, "500", "application/json"): - data = utils.unmarshal_json( + response_data = utils.unmarshal_json( http_res.text, models.ErrInternalServerErrorData ) - raise models.ErrInternalServerError(data=data) - if utils.match_response(http_res, ["4XX", "5XX"], "*"): + raise models.ErrInternalServerError(data=response_data) + if utils.match_response(http_res, "4XX", "*"): + http_res_text = utils.stream_to_text(http_res) + raise models.SDKError( + "API error occurred", http_res.status_code, http_res_text, http_res + ) + if utils.match_response(http_res, "5XX", "*"): http_res_text = utils.stream_to_text(http_res) raise models.SDKError( "API error occurred", http_res.status_code, http_res_text, http_res @@ -403,12 +472,14 @@ async def delete_async( retries: OptionalNullable[utils.RetryConfig] = UNSET, server_url: Optional[str] = None, timeout_ms: Optional[int] = None, + http_headers: Optional[Mapping[str, str]] = None, ) -> models.DeletePermissionResponse: r""" :param request: The request object to send. :param retries: Override the default retry configuration for this method :param server_url: Override the default server URL for this method :param timeout_ms: Override the default request timeout configuration for this method in milliseconds + :param http_headers: Additional headers to set or replace on requests. """ base_url = None url_variables = None @@ -417,12 +488,14 @@ async def delete_async( if server_url is not None: base_url = server_url + else: + base_url = self._get_url(base_url, url_variables) if not isinstance(request, BaseModel): request = utils.unmarshal(request, models.DeletePermissionRequestBody) request = cast(models.DeletePermissionRequestBody, request) - req = self.build_request_async( + req = self._build_request_async( method="POST", path="/v1/permissions.deletePermission", base_url=base_url, @@ -433,6 +506,7 @@ async def delete_async( request_has_query_params=True, user_agent_header="user-agent", accept_header_value="application/json", + http_headers=http_headers, security=self.sdk_configuration.security, get_serialized_body=lambda: utils.serialize_request_body( request, False, False, "json", models.DeletePermissionRequestBody @@ -454,6 +528,7 @@ async def delete_async( http_res = await self.do_request_async( hook_ctx=HookContext( + base_url=base_url or "", operation_id="deletePermission", oauth2_scopes=[], security_source=get_security_from_env( @@ -467,6 +542,7 @@ async def delete_async( "403", "404", "409", + "412", "429", "4XX", "500", @@ -475,7 +551,7 @@ async def delete_async( retry_config=retry_config, ) - data: Any = None + response_data: Any = None if utils.match_response(http_res, "200", "application/json"): return models.DeletePermissionResponse( object=utils.unmarshal_json( @@ -484,29 +560,45 @@ async def delete_async( http_meta=models.HTTPMetadata(request=req, response=http_res), ) if utils.match_response(http_res, "400", "application/json"): - data = utils.unmarshal_json(http_res.text, models.ErrBadRequestData) - raise models.ErrBadRequest(data=data) + response_data = utils.unmarshal_json( + http_res.text, models.ErrBadRequestData + ) + raise models.ErrBadRequest(data=response_data) if utils.match_response(http_res, "401", "application/json"): - data = utils.unmarshal_json(http_res.text, models.ErrUnauthorizedData) - raise models.ErrUnauthorized(data=data) + response_data = utils.unmarshal_json( + http_res.text, models.ErrUnauthorizedData + ) + raise models.ErrUnauthorized(data=response_data) if utils.match_response(http_res, "403", "application/json"): - data = utils.unmarshal_json(http_res.text, models.ErrForbiddenData) - raise models.ErrForbidden(data=data) + response_data = utils.unmarshal_json(http_res.text, models.ErrForbiddenData) + raise models.ErrForbidden(data=response_data) if utils.match_response(http_res, "404", "application/json"): - data = utils.unmarshal_json(http_res.text, models.ErrNotFoundData) - raise models.ErrNotFound(data=data) + response_data = utils.unmarshal_json(http_res.text, models.ErrNotFoundData) + raise models.ErrNotFound(data=response_data) if utils.match_response(http_res, "409", "application/json"): - data = utils.unmarshal_json(http_res.text, models.ErrConflictData) - raise models.ErrConflict(data=data) + response_data = utils.unmarshal_json(http_res.text, models.ErrConflictData) + raise models.ErrConflict(data=response_data) + if utils.match_response(http_res, "412", "application/json"): + response_data = utils.unmarshal_json( + http_res.text, models.ErrPreconditionFailedData + ) + raise models.ErrPreconditionFailed(data=response_data) if utils.match_response(http_res, "429", "application/json"): - data = utils.unmarshal_json(http_res.text, models.ErrTooManyRequestsData) - raise models.ErrTooManyRequests(data=data) + response_data = utils.unmarshal_json( + http_res.text, models.ErrTooManyRequestsData + ) + raise models.ErrTooManyRequests(data=response_data) if utils.match_response(http_res, "500", "application/json"): - data = utils.unmarshal_json( + response_data = utils.unmarshal_json( http_res.text, models.ErrInternalServerErrorData ) - raise models.ErrInternalServerError(data=data) - if utils.match_response(http_res, ["4XX", "5XX"], "*"): + raise models.ErrInternalServerError(data=response_data) + if utils.match_response(http_res, "4XX", "*"): + http_res_text = await utils.stream_to_text_async(http_res) + raise models.SDKError( + "API error occurred", http_res.status_code, http_res_text, http_res + ) + if utils.match_response(http_res, "5XX", "*"): http_res_text = await utils.stream_to_text_async(http_res) raise models.SDKError( "API error occurred", http_res.status_code, http_res_text, http_res @@ -528,12 +620,14 @@ def get( retries: OptionalNullable[utils.RetryConfig] = UNSET, server_url: Optional[str] = None, timeout_ms: Optional[int] = None, + http_headers: Optional[Mapping[str, str]] = None, ) -> models.GetPermissionResponse: r""" :param permission_id: :param retries: Override the default retry configuration for this method :param server_url: Override the default server URL for this method :param timeout_ms: Override the default request timeout configuration for this method in milliseconds + :param http_headers: Additional headers to set or replace on requests. """ base_url = None url_variables = None @@ -542,12 +636,14 @@ def get( if server_url is not None: base_url = server_url + else: + base_url = self._get_url(base_url, url_variables) request = models.GetPermissionRequest( permission_id=permission_id, ) - req = self.build_request( + req = self._build_request( method="GET", path="/v1/permissions.getPermission", base_url=base_url, @@ -558,6 +654,7 @@ def get( request_has_query_params=True, user_agent_header="user-agent", accept_header_value="application/json", + http_headers=http_headers, security=self.sdk_configuration.security, timeout_ms=timeout_ms, ) @@ -576,6 +673,7 @@ def get( http_res = self.do_request( hook_ctx=HookContext( + base_url=base_url or "", operation_id="getPermission", oauth2_scopes=[], security_source=get_security_from_env( @@ -589,6 +687,7 @@ def get( "403", "404", "409", + "412", "429", "4XX", "500", @@ -597,7 +696,7 @@ def get( retry_config=retry_config, ) - data: Any = None + response_data: Any = None if utils.match_response(http_res, "200", "application/json"): return models.GetPermissionResponse( object=utils.unmarshal_json( @@ -606,29 +705,45 @@ def get( http_meta=models.HTTPMetadata(request=req, response=http_res), ) if utils.match_response(http_res, "400", "application/json"): - data = utils.unmarshal_json(http_res.text, models.ErrBadRequestData) - raise models.ErrBadRequest(data=data) + response_data = utils.unmarshal_json( + http_res.text, models.ErrBadRequestData + ) + raise models.ErrBadRequest(data=response_data) if utils.match_response(http_res, "401", "application/json"): - data = utils.unmarshal_json(http_res.text, models.ErrUnauthorizedData) - raise models.ErrUnauthorized(data=data) + response_data = utils.unmarshal_json( + http_res.text, models.ErrUnauthorizedData + ) + raise models.ErrUnauthorized(data=response_data) if utils.match_response(http_res, "403", "application/json"): - data = utils.unmarshal_json(http_res.text, models.ErrForbiddenData) - raise models.ErrForbidden(data=data) + response_data = utils.unmarshal_json(http_res.text, models.ErrForbiddenData) + raise models.ErrForbidden(data=response_data) if utils.match_response(http_res, "404", "application/json"): - data = utils.unmarshal_json(http_res.text, models.ErrNotFoundData) - raise models.ErrNotFound(data=data) + response_data = utils.unmarshal_json(http_res.text, models.ErrNotFoundData) + raise models.ErrNotFound(data=response_data) if utils.match_response(http_res, "409", "application/json"): - data = utils.unmarshal_json(http_res.text, models.ErrConflictData) - raise models.ErrConflict(data=data) + response_data = utils.unmarshal_json(http_res.text, models.ErrConflictData) + raise models.ErrConflict(data=response_data) + if utils.match_response(http_res, "412", "application/json"): + response_data = utils.unmarshal_json( + http_res.text, models.ErrPreconditionFailedData + ) + raise models.ErrPreconditionFailed(data=response_data) if utils.match_response(http_res, "429", "application/json"): - data = utils.unmarshal_json(http_res.text, models.ErrTooManyRequestsData) - raise models.ErrTooManyRequests(data=data) + response_data = utils.unmarshal_json( + http_res.text, models.ErrTooManyRequestsData + ) + raise models.ErrTooManyRequests(data=response_data) if utils.match_response(http_res, "500", "application/json"): - data = utils.unmarshal_json( + response_data = utils.unmarshal_json( http_res.text, models.ErrInternalServerErrorData ) - raise models.ErrInternalServerError(data=data) - if utils.match_response(http_res, ["4XX", "5XX"], "*"): + raise models.ErrInternalServerError(data=response_data) + if utils.match_response(http_res, "4XX", "*"): + http_res_text = utils.stream_to_text(http_res) + raise models.SDKError( + "API error occurred", http_res.status_code, http_res_text, http_res + ) + if utils.match_response(http_res, "5XX", "*"): http_res_text = utils.stream_to_text(http_res) raise models.SDKError( "API error occurred", http_res.status_code, http_res_text, http_res @@ -650,12 +765,14 @@ async def get_async( retries: OptionalNullable[utils.RetryConfig] = UNSET, server_url: Optional[str] = None, timeout_ms: Optional[int] = None, + http_headers: Optional[Mapping[str, str]] = None, ) -> models.GetPermissionResponse: r""" :param permission_id: :param retries: Override the default retry configuration for this method :param server_url: Override the default server URL for this method :param timeout_ms: Override the default request timeout configuration for this method in milliseconds + :param http_headers: Additional headers to set or replace on requests. """ base_url = None url_variables = None @@ -664,12 +781,14 @@ async def get_async( if server_url is not None: base_url = server_url + else: + base_url = self._get_url(base_url, url_variables) request = models.GetPermissionRequest( permission_id=permission_id, ) - req = self.build_request_async( + req = self._build_request_async( method="GET", path="/v1/permissions.getPermission", base_url=base_url, @@ -680,6 +799,7 @@ async def get_async( request_has_query_params=True, user_agent_header="user-agent", accept_header_value="application/json", + http_headers=http_headers, security=self.sdk_configuration.security, timeout_ms=timeout_ms, ) @@ -698,6 +818,7 @@ async def get_async( http_res = await self.do_request_async( hook_ctx=HookContext( + base_url=base_url or "", operation_id="getPermission", oauth2_scopes=[], security_source=get_security_from_env( @@ -711,6 +832,7 @@ async def get_async( "403", "404", "409", + "412", "429", "4XX", "500", @@ -719,7 +841,7 @@ async def get_async( retry_config=retry_config, ) - data: Any = None + response_data: Any = None if utils.match_response(http_res, "200", "application/json"): return models.GetPermissionResponse( object=utils.unmarshal_json( @@ -728,29 +850,45 @@ async def get_async( http_meta=models.HTTPMetadata(request=req, response=http_res), ) if utils.match_response(http_res, "400", "application/json"): - data = utils.unmarshal_json(http_res.text, models.ErrBadRequestData) - raise models.ErrBadRequest(data=data) + response_data = utils.unmarshal_json( + http_res.text, models.ErrBadRequestData + ) + raise models.ErrBadRequest(data=response_data) if utils.match_response(http_res, "401", "application/json"): - data = utils.unmarshal_json(http_res.text, models.ErrUnauthorizedData) - raise models.ErrUnauthorized(data=data) + response_data = utils.unmarshal_json( + http_res.text, models.ErrUnauthorizedData + ) + raise models.ErrUnauthorized(data=response_data) if utils.match_response(http_res, "403", "application/json"): - data = utils.unmarshal_json(http_res.text, models.ErrForbiddenData) - raise models.ErrForbidden(data=data) + response_data = utils.unmarshal_json(http_res.text, models.ErrForbiddenData) + raise models.ErrForbidden(data=response_data) if utils.match_response(http_res, "404", "application/json"): - data = utils.unmarshal_json(http_res.text, models.ErrNotFoundData) - raise models.ErrNotFound(data=data) + response_data = utils.unmarshal_json(http_res.text, models.ErrNotFoundData) + raise models.ErrNotFound(data=response_data) if utils.match_response(http_res, "409", "application/json"): - data = utils.unmarshal_json(http_res.text, models.ErrConflictData) - raise models.ErrConflict(data=data) + response_data = utils.unmarshal_json(http_res.text, models.ErrConflictData) + raise models.ErrConflict(data=response_data) + if utils.match_response(http_res, "412", "application/json"): + response_data = utils.unmarshal_json( + http_res.text, models.ErrPreconditionFailedData + ) + raise models.ErrPreconditionFailed(data=response_data) if utils.match_response(http_res, "429", "application/json"): - data = utils.unmarshal_json(http_res.text, models.ErrTooManyRequestsData) - raise models.ErrTooManyRequests(data=data) + response_data = utils.unmarshal_json( + http_res.text, models.ErrTooManyRequestsData + ) + raise models.ErrTooManyRequests(data=response_data) if utils.match_response(http_res, "500", "application/json"): - data = utils.unmarshal_json( + response_data = utils.unmarshal_json( http_res.text, models.ErrInternalServerErrorData ) - raise models.ErrInternalServerError(data=data) - if utils.match_response(http_res, ["4XX", "5XX"], "*"): + raise models.ErrInternalServerError(data=response_data) + if utils.match_response(http_res, "4XX", "*"): + http_res_text = await utils.stream_to_text_async(http_res) + raise models.SDKError( + "API error occurred", http_res.status_code, http_res_text, http_res + ) + if utils.match_response(http_res, "5XX", "*"): http_res_text = await utils.stream_to_text_async(http_res) raise models.SDKError( "API error occurred", http_res.status_code, http_res_text, http_res @@ -771,11 +909,13 @@ def list( retries: OptionalNullable[utils.RetryConfig] = UNSET, server_url: Optional[str] = None, timeout_ms: Optional[int] = None, + http_headers: Optional[Mapping[str, str]] = None, ) -> models.ListPermissionsResponse: r""" :param retries: Override the default retry configuration for this method :param server_url: Override the default server URL for this method :param timeout_ms: Override the default request timeout configuration for this method in milliseconds + :param http_headers: Additional headers to set or replace on requests. """ base_url = None url_variables = None @@ -784,7 +924,9 @@ def list( if server_url is not None: base_url = server_url - req = self.build_request( + else: + base_url = self._get_url(base_url, url_variables) + req = self._build_request( method="GET", path="/v1/permissions.listPermissions", base_url=base_url, @@ -795,6 +937,7 @@ def list( request_has_query_params=True, user_agent_header="user-agent", accept_header_value="application/json", + http_headers=http_headers, security=self.sdk_configuration.security, timeout_ms=timeout_ms, ) @@ -813,6 +956,7 @@ def list( http_res = self.do_request( hook_ctx=HookContext( + base_url=base_url or "", operation_id="listPermissions", oauth2_scopes=[], security_source=get_security_from_env( @@ -826,6 +970,7 @@ def list( "403", "404", "409", + "412", "429", "4XX", "500", @@ -834,7 +979,7 @@ def list( retry_config=retry_config, ) - data: Any = None + response_data: Any = None if utils.match_response(http_res, "200", "application/json"): return models.ListPermissionsResponse( response_bodies=utils.unmarshal_json( @@ -843,29 +988,45 @@ def list( http_meta=models.HTTPMetadata(request=req, response=http_res), ) if utils.match_response(http_res, "400", "application/json"): - data = utils.unmarshal_json(http_res.text, models.ErrBadRequestData) - raise models.ErrBadRequest(data=data) + response_data = utils.unmarshal_json( + http_res.text, models.ErrBadRequestData + ) + raise models.ErrBadRequest(data=response_data) if utils.match_response(http_res, "401", "application/json"): - data = utils.unmarshal_json(http_res.text, models.ErrUnauthorizedData) - raise models.ErrUnauthorized(data=data) + response_data = utils.unmarshal_json( + http_res.text, models.ErrUnauthorizedData + ) + raise models.ErrUnauthorized(data=response_data) if utils.match_response(http_res, "403", "application/json"): - data = utils.unmarshal_json(http_res.text, models.ErrForbiddenData) - raise models.ErrForbidden(data=data) + response_data = utils.unmarshal_json(http_res.text, models.ErrForbiddenData) + raise models.ErrForbidden(data=response_data) if utils.match_response(http_res, "404", "application/json"): - data = utils.unmarshal_json(http_res.text, models.ErrNotFoundData) - raise models.ErrNotFound(data=data) + response_data = utils.unmarshal_json(http_res.text, models.ErrNotFoundData) + raise models.ErrNotFound(data=response_data) if utils.match_response(http_res, "409", "application/json"): - data = utils.unmarshal_json(http_res.text, models.ErrConflictData) - raise models.ErrConflict(data=data) + response_data = utils.unmarshal_json(http_res.text, models.ErrConflictData) + raise models.ErrConflict(data=response_data) + if utils.match_response(http_res, "412", "application/json"): + response_data = utils.unmarshal_json( + http_res.text, models.ErrPreconditionFailedData + ) + raise models.ErrPreconditionFailed(data=response_data) if utils.match_response(http_res, "429", "application/json"): - data = utils.unmarshal_json(http_res.text, models.ErrTooManyRequestsData) - raise models.ErrTooManyRequests(data=data) + response_data = utils.unmarshal_json( + http_res.text, models.ErrTooManyRequestsData + ) + raise models.ErrTooManyRequests(data=response_data) if utils.match_response(http_res, "500", "application/json"): - data = utils.unmarshal_json( + response_data = utils.unmarshal_json( http_res.text, models.ErrInternalServerErrorData ) - raise models.ErrInternalServerError(data=data) - if utils.match_response(http_res, ["4XX", "5XX"], "*"): + raise models.ErrInternalServerError(data=response_data) + if utils.match_response(http_res, "4XX", "*"): + http_res_text = utils.stream_to_text(http_res) + raise models.SDKError( + "API error occurred", http_res.status_code, http_res_text, http_res + ) + if utils.match_response(http_res, "5XX", "*"): http_res_text = utils.stream_to_text(http_res) raise models.SDKError( "API error occurred", http_res.status_code, http_res_text, http_res @@ -886,11 +1047,13 @@ async def list_async( retries: OptionalNullable[utils.RetryConfig] = UNSET, server_url: Optional[str] = None, timeout_ms: Optional[int] = None, + http_headers: Optional[Mapping[str, str]] = None, ) -> models.ListPermissionsResponse: r""" :param retries: Override the default retry configuration for this method :param server_url: Override the default server URL for this method :param timeout_ms: Override the default request timeout configuration for this method in milliseconds + :param http_headers: Additional headers to set or replace on requests. """ base_url = None url_variables = None @@ -899,7 +1062,9 @@ async def list_async( if server_url is not None: base_url = server_url - req = self.build_request_async( + else: + base_url = self._get_url(base_url, url_variables) + req = self._build_request_async( method="GET", path="/v1/permissions.listPermissions", base_url=base_url, @@ -910,6 +1075,7 @@ async def list_async( request_has_query_params=True, user_agent_header="user-agent", accept_header_value="application/json", + http_headers=http_headers, security=self.sdk_configuration.security, timeout_ms=timeout_ms, ) @@ -928,6 +1094,7 @@ async def list_async( http_res = await self.do_request_async( hook_ctx=HookContext( + base_url=base_url or "", operation_id="listPermissions", oauth2_scopes=[], security_source=get_security_from_env( @@ -941,6 +1108,7 @@ async def list_async( "403", "404", "409", + "412", "429", "4XX", "500", @@ -949,7 +1117,7 @@ async def list_async( retry_config=retry_config, ) - data: Any = None + response_data: Any = None if utils.match_response(http_res, "200", "application/json"): return models.ListPermissionsResponse( response_bodies=utils.unmarshal_json( @@ -958,29 +1126,45 @@ async def list_async( http_meta=models.HTTPMetadata(request=req, response=http_res), ) if utils.match_response(http_res, "400", "application/json"): - data = utils.unmarshal_json(http_res.text, models.ErrBadRequestData) - raise models.ErrBadRequest(data=data) + response_data = utils.unmarshal_json( + http_res.text, models.ErrBadRequestData + ) + raise models.ErrBadRequest(data=response_data) if utils.match_response(http_res, "401", "application/json"): - data = utils.unmarshal_json(http_res.text, models.ErrUnauthorizedData) - raise models.ErrUnauthorized(data=data) + response_data = utils.unmarshal_json( + http_res.text, models.ErrUnauthorizedData + ) + raise models.ErrUnauthorized(data=response_data) if utils.match_response(http_res, "403", "application/json"): - data = utils.unmarshal_json(http_res.text, models.ErrForbiddenData) - raise models.ErrForbidden(data=data) + response_data = utils.unmarshal_json(http_res.text, models.ErrForbiddenData) + raise models.ErrForbidden(data=response_data) if utils.match_response(http_res, "404", "application/json"): - data = utils.unmarshal_json(http_res.text, models.ErrNotFoundData) - raise models.ErrNotFound(data=data) + response_data = utils.unmarshal_json(http_res.text, models.ErrNotFoundData) + raise models.ErrNotFound(data=response_data) if utils.match_response(http_res, "409", "application/json"): - data = utils.unmarshal_json(http_res.text, models.ErrConflictData) - raise models.ErrConflict(data=data) + response_data = utils.unmarshal_json(http_res.text, models.ErrConflictData) + raise models.ErrConflict(data=response_data) + if utils.match_response(http_res, "412", "application/json"): + response_data = utils.unmarshal_json( + http_res.text, models.ErrPreconditionFailedData + ) + raise models.ErrPreconditionFailed(data=response_data) if utils.match_response(http_res, "429", "application/json"): - data = utils.unmarshal_json(http_res.text, models.ErrTooManyRequestsData) - raise models.ErrTooManyRequests(data=data) + response_data = utils.unmarshal_json( + http_res.text, models.ErrTooManyRequestsData + ) + raise models.ErrTooManyRequests(data=response_data) if utils.match_response(http_res, "500", "application/json"): - data = utils.unmarshal_json( + response_data = utils.unmarshal_json( http_res.text, models.ErrInternalServerErrorData ) - raise models.ErrInternalServerError(data=data) - if utils.match_response(http_res, ["4XX", "5XX"], "*"): + raise models.ErrInternalServerError(data=response_data) + if utils.match_response(http_res, "4XX", "*"): + http_res_text = await utils.stream_to_text_async(http_res) + raise models.SDKError( + "API error occurred", http_res.status_code, http_res_text, http_res + ) + if utils.match_response(http_res, "5XX", "*"): http_res_text = await utils.stream_to_text_async(http_res) raise models.SDKError( "API error occurred", http_res.status_code, http_res_text, http_res @@ -1004,12 +1188,14 @@ def create_role( retries: OptionalNullable[utils.RetryConfig] = UNSET, server_url: Optional[str] = None, timeout_ms: Optional[int] = None, + http_headers: Optional[Mapping[str, str]] = None, ) -> models.CreateRoleResponse: r""" :param request: The request object to send. :param retries: Override the default retry configuration for this method :param server_url: Override the default server URL for this method :param timeout_ms: Override the default request timeout configuration for this method in milliseconds + :param http_headers: Additional headers to set or replace on requests. """ base_url = None url_variables = None @@ -1018,12 +1204,14 @@ def create_role( if server_url is not None: base_url = server_url + else: + base_url = self._get_url(base_url, url_variables) if not isinstance(request, BaseModel): request = utils.unmarshal(request, models.CreateRoleRequestBody) request = cast(models.CreateRoleRequestBody, request) - req = self.build_request( + req = self._build_request( method="POST", path="/v1/permissions.createRole", base_url=base_url, @@ -1034,6 +1222,7 @@ def create_role( request_has_query_params=True, user_agent_header="user-agent", accept_header_value="application/json", + http_headers=http_headers, security=self.sdk_configuration.security, get_serialized_body=lambda: utils.serialize_request_body( request, False, False, "json", models.CreateRoleRequestBody @@ -1055,6 +1244,7 @@ def create_role( http_res = self.do_request( hook_ctx=HookContext( + base_url=base_url or "", operation_id="createRole", oauth2_scopes=[], security_source=get_security_from_env( @@ -1068,6 +1258,7 @@ def create_role( "403", "404", "409", + "412", "429", "4XX", "500", @@ -1076,7 +1267,7 @@ def create_role( retry_config=retry_config, ) - data: Any = None + response_data: Any = None if utils.match_response(http_res, "200", "application/json"): return models.CreateRoleResponse( object=utils.unmarshal_json( @@ -1085,29 +1276,45 @@ def create_role( http_meta=models.HTTPMetadata(request=req, response=http_res), ) if utils.match_response(http_res, "400", "application/json"): - data = utils.unmarshal_json(http_res.text, models.ErrBadRequestData) - raise models.ErrBadRequest(data=data) + response_data = utils.unmarshal_json( + http_res.text, models.ErrBadRequestData + ) + raise models.ErrBadRequest(data=response_data) if utils.match_response(http_res, "401", "application/json"): - data = utils.unmarshal_json(http_res.text, models.ErrUnauthorizedData) - raise models.ErrUnauthorized(data=data) + response_data = utils.unmarshal_json( + http_res.text, models.ErrUnauthorizedData + ) + raise models.ErrUnauthorized(data=response_data) if utils.match_response(http_res, "403", "application/json"): - data = utils.unmarshal_json(http_res.text, models.ErrForbiddenData) - raise models.ErrForbidden(data=data) + response_data = utils.unmarshal_json(http_res.text, models.ErrForbiddenData) + raise models.ErrForbidden(data=response_data) if utils.match_response(http_res, "404", "application/json"): - data = utils.unmarshal_json(http_res.text, models.ErrNotFoundData) - raise models.ErrNotFound(data=data) + response_data = utils.unmarshal_json(http_res.text, models.ErrNotFoundData) + raise models.ErrNotFound(data=response_data) if utils.match_response(http_res, "409", "application/json"): - data = utils.unmarshal_json(http_res.text, models.ErrConflictData) - raise models.ErrConflict(data=data) + response_data = utils.unmarshal_json(http_res.text, models.ErrConflictData) + raise models.ErrConflict(data=response_data) + if utils.match_response(http_res, "412", "application/json"): + response_data = utils.unmarshal_json( + http_res.text, models.ErrPreconditionFailedData + ) + raise models.ErrPreconditionFailed(data=response_data) if utils.match_response(http_res, "429", "application/json"): - data = utils.unmarshal_json(http_res.text, models.ErrTooManyRequestsData) - raise models.ErrTooManyRequests(data=data) + response_data = utils.unmarshal_json( + http_res.text, models.ErrTooManyRequestsData + ) + raise models.ErrTooManyRequests(data=response_data) if utils.match_response(http_res, "500", "application/json"): - data = utils.unmarshal_json( + response_data = utils.unmarshal_json( http_res.text, models.ErrInternalServerErrorData ) - raise models.ErrInternalServerError(data=data) - if utils.match_response(http_res, ["4XX", "5XX"], "*"): + raise models.ErrInternalServerError(data=response_data) + if utils.match_response(http_res, "4XX", "*"): + http_res_text = utils.stream_to_text(http_res) + raise models.SDKError( + "API error occurred", http_res.status_code, http_res_text, http_res + ) + if utils.match_response(http_res, "5XX", "*"): http_res_text = utils.stream_to_text(http_res) raise models.SDKError( "API error occurred", http_res.status_code, http_res_text, http_res @@ -1131,12 +1338,14 @@ async def create_role_async( retries: OptionalNullable[utils.RetryConfig] = UNSET, server_url: Optional[str] = None, timeout_ms: Optional[int] = None, + http_headers: Optional[Mapping[str, str]] = None, ) -> models.CreateRoleResponse: r""" :param request: The request object to send. :param retries: Override the default retry configuration for this method :param server_url: Override the default server URL for this method :param timeout_ms: Override the default request timeout configuration for this method in milliseconds + :param http_headers: Additional headers to set or replace on requests. """ base_url = None url_variables = None @@ -1145,12 +1354,14 @@ async def create_role_async( if server_url is not None: base_url = server_url + else: + base_url = self._get_url(base_url, url_variables) if not isinstance(request, BaseModel): request = utils.unmarshal(request, models.CreateRoleRequestBody) request = cast(models.CreateRoleRequestBody, request) - req = self.build_request_async( + req = self._build_request_async( method="POST", path="/v1/permissions.createRole", base_url=base_url, @@ -1161,6 +1372,7 @@ async def create_role_async( request_has_query_params=True, user_agent_header="user-agent", accept_header_value="application/json", + http_headers=http_headers, security=self.sdk_configuration.security, get_serialized_body=lambda: utils.serialize_request_body( request, False, False, "json", models.CreateRoleRequestBody @@ -1182,6 +1394,7 @@ async def create_role_async( http_res = await self.do_request_async( hook_ctx=HookContext( + base_url=base_url or "", operation_id="createRole", oauth2_scopes=[], security_source=get_security_from_env( @@ -1195,6 +1408,7 @@ async def create_role_async( "403", "404", "409", + "412", "429", "4XX", "500", @@ -1203,7 +1417,7 @@ async def create_role_async( retry_config=retry_config, ) - data: Any = None + response_data: Any = None if utils.match_response(http_res, "200", "application/json"): return models.CreateRoleResponse( object=utils.unmarshal_json( @@ -1212,29 +1426,45 @@ async def create_role_async( http_meta=models.HTTPMetadata(request=req, response=http_res), ) if utils.match_response(http_res, "400", "application/json"): - data = utils.unmarshal_json(http_res.text, models.ErrBadRequestData) - raise models.ErrBadRequest(data=data) + response_data = utils.unmarshal_json( + http_res.text, models.ErrBadRequestData + ) + raise models.ErrBadRequest(data=response_data) if utils.match_response(http_res, "401", "application/json"): - data = utils.unmarshal_json(http_res.text, models.ErrUnauthorizedData) - raise models.ErrUnauthorized(data=data) + response_data = utils.unmarshal_json( + http_res.text, models.ErrUnauthorizedData + ) + raise models.ErrUnauthorized(data=response_data) if utils.match_response(http_res, "403", "application/json"): - data = utils.unmarshal_json(http_res.text, models.ErrForbiddenData) - raise models.ErrForbidden(data=data) + response_data = utils.unmarshal_json(http_res.text, models.ErrForbiddenData) + raise models.ErrForbidden(data=response_data) if utils.match_response(http_res, "404", "application/json"): - data = utils.unmarshal_json(http_res.text, models.ErrNotFoundData) - raise models.ErrNotFound(data=data) + response_data = utils.unmarshal_json(http_res.text, models.ErrNotFoundData) + raise models.ErrNotFound(data=response_data) if utils.match_response(http_res, "409", "application/json"): - data = utils.unmarshal_json(http_res.text, models.ErrConflictData) - raise models.ErrConflict(data=data) + response_data = utils.unmarshal_json(http_res.text, models.ErrConflictData) + raise models.ErrConflict(data=response_data) + if utils.match_response(http_res, "412", "application/json"): + response_data = utils.unmarshal_json( + http_res.text, models.ErrPreconditionFailedData + ) + raise models.ErrPreconditionFailed(data=response_data) if utils.match_response(http_res, "429", "application/json"): - data = utils.unmarshal_json(http_res.text, models.ErrTooManyRequestsData) - raise models.ErrTooManyRequests(data=data) + response_data = utils.unmarshal_json( + http_res.text, models.ErrTooManyRequestsData + ) + raise models.ErrTooManyRequests(data=response_data) if utils.match_response(http_res, "500", "application/json"): - data = utils.unmarshal_json( + response_data = utils.unmarshal_json( http_res.text, models.ErrInternalServerErrorData ) - raise models.ErrInternalServerError(data=data) - if utils.match_response(http_res, ["4XX", "5XX"], "*"): + raise models.ErrInternalServerError(data=response_data) + if utils.match_response(http_res, "4XX", "*"): + http_res_text = await utils.stream_to_text_async(http_res) + raise models.SDKError( + "API error occurred", http_res.status_code, http_res_text, http_res + ) + if utils.match_response(http_res, "5XX", "*"): http_res_text = await utils.stream_to_text_async(http_res) raise models.SDKError( "API error occurred", http_res.status_code, http_res_text, http_res @@ -1258,12 +1488,14 @@ def delete_role( retries: OptionalNullable[utils.RetryConfig] = UNSET, server_url: Optional[str] = None, timeout_ms: Optional[int] = None, + http_headers: Optional[Mapping[str, str]] = None, ) -> models.DeleteRoleResponse: r""" :param request: The request object to send. :param retries: Override the default retry configuration for this method :param server_url: Override the default server URL for this method :param timeout_ms: Override the default request timeout configuration for this method in milliseconds + :param http_headers: Additional headers to set or replace on requests. """ base_url = None url_variables = None @@ -1272,12 +1504,14 @@ def delete_role( if server_url is not None: base_url = server_url + else: + base_url = self._get_url(base_url, url_variables) if not isinstance(request, BaseModel): request = utils.unmarshal(request, models.DeleteRoleRequestBody) request = cast(models.DeleteRoleRequestBody, request) - req = self.build_request( + req = self._build_request( method="POST", path="/v1/permissions.deleteRole", base_url=base_url, @@ -1288,6 +1522,7 @@ def delete_role( request_has_query_params=True, user_agent_header="user-agent", accept_header_value="application/json", + http_headers=http_headers, security=self.sdk_configuration.security, get_serialized_body=lambda: utils.serialize_request_body( request, False, False, "json", models.DeleteRoleRequestBody @@ -1309,6 +1544,7 @@ def delete_role( http_res = self.do_request( hook_ctx=HookContext( + base_url=base_url or "", operation_id="deleteRole", oauth2_scopes=[], security_source=get_security_from_env( @@ -1322,6 +1558,7 @@ def delete_role( "403", "404", "409", + "412", "429", "4XX", "500", @@ -1330,7 +1567,7 @@ def delete_role( retry_config=retry_config, ) - data: Any = None + response_data: Any = None if utils.match_response(http_res, "200", "application/json"): return models.DeleteRoleResponse( object=utils.unmarshal_json( @@ -1339,29 +1576,45 @@ def delete_role( http_meta=models.HTTPMetadata(request=req, response=http_res), ) if utils.match_response(http_res, "400", "application/json"): - data = utils.unmarshal_json(http_res.text, models.ErrBadRequestData) - raise models.ErrBadRequest(data=data) + response_data = utils.unmarshal_json( + http_res.text, models.ErrBadRequestData + ) + raise models.ErrBadRequest(data=response_data) if utils.match_response(http_res, "401", "application/json"): - data = utils.unmarshal_json(http_res.text, models.ErrUnauthorizedData) - raise models.ErrUnauthorized(data=data) + response_data = utils.unmarshal_json( + http_res.text, models.ErrUnauthorizedData + ) + raise models.ErrUnauthorized(data=response_data) if utils.match_response(http_res, "403", "application/json"): - data = utils.unmarshal_json(http_res.text, models.ErrForbiddenData) - raise models.ErrForbidden(data=data) + response_data = utils.unmarshal_json(http_res.text, models.ErrForbiddenData) + raise models.ErrForbidden(data=response_data) if utils.match_response(http_res, "404", "application/json"): - data = utils.unmarshal_json(http_res.text, models.ErrNotFoundData) - raise models.ErrNotFound(data=data) + response_data = utils.unmarshal_json(http_res.text, models.ErrNotFoundData) + raise models.ErrNotFound(data=response_data) if utils.match_response(http_res, "409", "application/json"): - data = utils.unmarshal_json(http_res.text, models.ErrConflictData) - raise models.ErrConflict(data=data) + response_data = utils.unmarshal_json(http_res.text, models.ErrConflictData) + raise models.ErrConflict(data=response_data) + if utils.match_response(http_res, "412", "application/json"): + response_data = utils.unmarshal_json( + http_res.text, models.ErrPreconditionFailedData + ) + raise models.ErrPreconditionFailed(data=response_data) if utils.match_response(http_res, "429", "application/json"): - data = utils.unmarshal_json(http_res.text, models.ErrTooManyRequestsData) - raise models.ErrTooManyRequests(data=data) + response_data = utils.unmarshal_json( + http_res.text, models.ErrTooManyRequestsData + ) + raise models.ErrTooManyRequests(data=response_data) if utils.match_response(http_res, "500", "application/json"): - data = utils.unmarshal_json( + response_data = utils.unmarshal_json( http_res.text, models.ErrInternalServerErrorData ) - raise models.ErrInternalServerError(data=data) - if utils.match_response(http_res, ["4XX", "5XX"], "*"): + raise models.ErrInternalServerError(data=response_data) + if utils.match_response(http_res, "4XX", "*"): + http_res_text = utils.stream_to_text(http_res) + raise models.SDKError( + "API error occurred", http_res.status_code, http_res_text, http_res + ) + if utils.match_response(http_res, "5XX", "*"): http_res_text = utils.stream_to_text(http_res) raise models.SDKError( "API error occurred", http_res.status_code, http_res_text, http_res @@ -1385,12 +1638,14 @@ async def delete_role_async( retries: OptionalNullable[utils.RetryConfig] = UNSET, server_url: Optional[str] = None, timeout_ms: Optional[int] = None, + http_headers: Optional[Mapping[str, str]] = None, ) -> models.DeleteRoleResponse: r""" :param request: The request object to send. :param retries: Override the default retry configuration for this method :param server_url: Override the default server URL for this method :param timeout_ms: Override the default request timeout configuration for this method in milliseconds + :param http_headers: Additional headers to set or replace on requests. """ base_url = None url_variables = None @@ -1399,12 +1654,14 @@ async def delete_role_async( if server_url is not None: base_url = server_url + else: + base_url = self._get_url(base_url, url_variables) if not isinstance(request, BaseModel): request = utils.unmarshal(request, models.DeleteRoleRequestBody) request = cast(models.DeleteRoleRequestBody, request) - req = self.build_request_async( + req = self._build_request_async( method="POST", path="/v1/permissions.deleteRole", base_url=base_url, @@ -1415,6 +1672,7 @@ async def delete_role_async( request_has_query_params=True, user_agent_header="user-agent", accept_header_value="application/json", + http_headers=http_headers, security=self.sdk_configuration.security, get_serialized_body=lambda: utils.serialize_request_body( request, False, False, "json", models.DeleteRoleRequestBody @@ -1436,6 +1694,7 @@ async def delete_role_async( http_res = await self.do_request_async( hook_ctx=HookContext( + base_url=base_url or "", operation_id="deleteRole", oauth2_scopes=[], security_source=get_security_from_env( @@ -1449,6 +1708,7 @@ async def delete_role_async( "403", "404", "409", + "412", "429", "4XX", "500", @@ -1457,7 +1717,7 @@ async def delete_role_async( retry_config=retry_config, ) - data: Any = None + response_data: Any = None if utils.match_response(http_res, "200", "application/json"): return models.DeleteRoleResponse( object=utils.unmarshal_json( @@ -1466,29 +1726,45 @@ async def delete_role_async( http_meta=models.HTTPMetadata(request=req, response=http_res), ) if utils.match_response(http_res, "400", "application/json"): - data = utils.unmarshal_json(http_res.text, models.ErrBadRequestData) - raise models.ErrBadRequest(data=data) + response_data = utils.unmarshal_json( + http_res.text, models.ErrBadRequestData + ) + raise models.ErrBadRequest(data=response_data) if utils.match_response(http_res, "401", "application/json"): - data = utils.unmarshal_json(http_res.text, models.ErrUnauthorizedData) - raise models.ErrUnauthorized(data=data) + response_data = utils.unmarshal_json( + http_res.text, models.ErrUnauthorizedData + ) + raise models.ErrUnauthorized(data=response_data) if utils.match_response(http_res, "403", "application/json"): - data = utils.unmarshal_json(http_res.text, models.ErrForbiddenData) - raise models.ErrForbidden(data=data) + response_data = utils.unmarshal_json(http_res.text, models.ErrForbiddenData) + raise models.ErrForbidden(data=response_data) if utils.match_response(http_res, "404", "application/json"): - data = utils.unmarshal_json(http_res.text, models.ErrNotFoundData) - raise models.ErrNotFound(data=data) + response_data = utils.unmarshal_json(http_res.text, models.ErrNotFoundData) + raise models.ErrNotFound(data=response_data) if utils.match_response(http_res, "409", "application/json"): - data = utils.unmarshal_json(http_res.text, models.ErrConflictData) - raise models.ErrConflict(data=data) + response_data = utils.unmarshal_json(http_res.text, models.ErrConflictData) + raise models.ErrConflict(data=response_data) + if utils.match_response(http_res, "412", "application/json"): + response_data = utils.unmarshal_json( + http_res.text, models.ErrPreconditionFailedData + ) + raise models.ErrPreconditionFailed(data=response_data) if utils.match_response(http_res, "429", "application/json"): - data = utils.unmarshal_json(http_res.text, models.ErrTooManyRequestsData) - raise models.ErrTooManyRequests(data=data) + response_data = utils.unmarshal_json( + http_res.text, models.ErrTooManyRequestsData + ) + raise models.ErrTooManyRequests(data=response_data) if utils.match_response(http_res, "500", "application/json"): - data = utils.unmarshal_json( + response_data = utils.unmarshal_json( http_res.text, models.ErrInternalServerErrorData ) - raise models.ErrInternalServerError(data=data) - if utils.match_response(http_res, ["4XX", "5XX"], "*"): + raise models.ErrInternalServerError(data=response_data) + if utils.match_response(http_res, "4XX", "*"): + http_res_text = await utils.stream_to_text_async(http_res) + raise models.SDKError( + "API error occurred", http_res.status_code, http_res_text, http_res + ) + if utils.match_response(http_res, "5XX", "*"): http_res_text = await utils.stream_to_text_async(http_res) raise models.SDKError( "API error occurred", http_res.status_code, http_res_text, http_res @@ -1510,12 +1786,14 @@ def get_role( retries: OptionalNullable[utils.RetryConfig] = UNSET, server_url: Optional[str] = None, timeout_ms: Optional[int] = None, + http_headers: Optional[Mapping[str, str]] = None, ) -> models.GetRoleResponse: r""" :param role_id: :param retries: Override the default retry configuration for this method :param server_url: Override the default server URL for this method :param timeout_ms: Override the default request timeout configuration for this method in milliseconds + :param http_headers: Additional headers to set or replace on requests. """ base_url = None url_variables = None @@ -1524,12 +1802,14 @@ def get_role( if server_url is not None: base_url = server_url + else: + base_url = self._get_url(base_url, url_variables) request = models.GetRoleRequest( role_id=role_id, ) - req = self.build_request( + req = self._build_request( method="GET", path="/v1/permissions.getRole", base_url=base_url, @@ -1540,6 +1820,7 @@ def get_role( request_has_query_params=True, user_agent_header="user-agent", accept_header_value="application/json", + http_headers=http_headers, security=self.sdk_configuration.security, timeout_ms=timeout_ms, ) @@ -1558,6 +1839,7 @@ def get_role( http_res = self.do_request( hook_ctx=HookContext( + base_url=base_url or "", operation_id="getRole", oauth2_scopes=[], security_source=get_security_from_env( @@ -1571,6 +1853,7 @@ def get_role( "403", "404", "409", + "412", "429", "4XX", "500", @@ -1579,7 +1862,7 @@ def get_role( retry_config=retry_config, ) - data: Any = None + response_data: Any = None if utils.match_response(http_res, "200", "application/json"): return models.GetRoleResponse( object=utils.unmarshal_json( @@ -1588,29 +1871,45 @@ def get_role( http_meta=models.HTTPMetadata(request=req, response=http_res), ) if utils.match_response(http_res, "400", "application/json"): - data = utils.unmarshal_json(http_res.text, models.ErrBadRequestData) - raise models.ErrBadRequest(data=data) + response_data = utils.unmarshal_json( + http_res.text, models.ErrBadRequestData + ) + raise models.ErrBadRequest(data=response_data) if utils.match_response(http_res, "401", "application/json"): - data = utils.unmarshal_json(http_res.text, models.ErrUnauthorizedData) - raise models.ErrUnauthorized(data=data) + response_data = utils.unmarshal_json( + http_res.text, models.ErrUnauthorizedData + ) + raise models.ErrUnauthorized(data=response_data) if utils.match_response(http_res, "403", "application/json"): - data = utils.unmarshal_json(http_res.text, models.ErrForbiddenData) - raise models.ErrForbidden(data=data) + response_data = utils.unmarshal_json(http_res.text, models.ErrForbiddenData) + raise models.ErrForbidden(data=response_data) if utils.match_response(http_res, "404", "application/json"): - data = utils.unmarshal_json(http_res.text, models.ErrNotFoundData) - raise models.ErrNotFound(data=data) + response_data = utils.unmarshal_json(http_res.text, models.ErrNotFoundData) + raise models.ErrNotFound(data=response_data) if utils.match_response(http_res, "409", "application/json"): - data = utils.unmarshal_json(http_res.text, models.ErrConflictData) - raise models.ErrConflict(data=data) + response_data = utils.unmarshal_json(http_res.text, models.ErrConflictData) + raise models.ErrConflict(data=response_data) + if utils.match_response(http_res, "412", "application/json"): + response_data = utils.unmarshal_json( + http_res.text, models.ErrPreconditionFailedData + ) + raise models.ErrPreconditionFailed(data=response_data) if utils.match_response(http_res, "429", "application/json"): - data = utils.unmarshal_json(http_res.text, models.ErrTooManyRequestsData) - raise models.ErrTooManyRequests(data=data) + response_data = utils.unmarshal_json( + http_res.text, models.ErrTooManyRequestsData + ) + raise models.ErrTooManyRequests(data=response_data) if utils.match_response(http_res, "500", "application/json"): - data = utils.unmarshal_json( + response_data = utils.unmarshal_json( http_res.text, models.ErrInternalServerErrorData ) - raise models.ErrInternalServerError(data=data) - if utils.match_response(http_res, ["4XX", "5XX"], "*"): + raise models.ErrInternalServerError(data=response_data) + if utils.match_response(http_res, "4XX", "*"): + http_res_text = utils.stream_to_text(http_res) + raise models.SDKError( + "API error occurred", http_res.status_code, http_res_text, http_res + ) + if utils.match_response(http_res, "5XX", "*"): http_res_text = utils.stream_to_text(http_res) raise models.SDKError( "API error occurred", http_res.status_code, http_res_text, http_res @@ -1632,12 +1931,14 @@ async def get_role_async( retries: OptionalNullable[utils.RetryConfig] = UNSET, server_url: Optional[str] = None, timeout_ms: Optional[int] = None, + http_headers: Optional[Mapping[str, str]] = None, ) -> models.GetRoleResponse: r""" :param role_id: :param retries: Override the default retry configuration for this method :param server_url: Override the default server URL for this method :param timeout_ms: Override the default request timeout configuration for this method in milliseconds + :param http_headers: Additional headers to set or replace on requests. """ base_url = None url_variables = None @@ -1646,12 +1947,14 @@ async def get_role_async( if server_url is not None: base_url = server_url + else: + base_url = self._get_url(base_url, url_variables) request = models.GetRoleRequest( role_id=role_id, ) - req = self.build_request_async( + req = self._build_request_async( method="GET", path="/v1/permissions.getRole", base_url=base_url, @@ -1662,6 +1965,7 @@ async def get_role_async( request_has_query_params=True, user_agent_header="user-agent", accept_header_value="application/json", + http_headers=http_headers, security=self.sdk_configuration.security, timeout_ms=timeout_ms, ) @@ -1680,6 +1984,7 @@ async def get_role_async( http_res = await self.do_request_async( hook_ctx=HookContext( + base_url=base_url or "", operation_id="getRole", oauth2_scopes=[], security_source=get_security_from_env( @@ -1693,6 +1998,7 @@ async def get_role_async( "403", "404", "409", + "412", "429", "4XX", "500", @@ -1701,7 +2007,7 @@ async def get_role_async( retry_config=retry_config, ) - data: Any = None + response_data: Any = None if utils.match_response(http_res, "200", "application/json"): return models.GetRoleResponse( object=utils.unmarshal_json( @@ -1710,29 +2016,45 @@ async def get_role_async( http_meta=models.HTTPMetadata(request=req, response=http_res), ) if utils.match_response(http_res, "400", "application/json"): - data = utils.unmarshal_json(http_res.text, models.ErrBadRequestData) - raise models.ErrBadRequest(data=data) + response_data = utils.unmarshal_json( + http_res.text, models.ErrBadRequestData + ) + raise models.ErrBadRequest(data=response_data) if utils.match_response(http_res, "401", "application/json"): - data = utils.unmarshal_json(http_res.text, models.ErrUnauthorizedData) - raise models.ErrUnauthorized(data=data) + response_data = utils.unmarshal_json( + http_res.text, models.ErrUnauthorizedData + ) + raise models.ErrUnauthorized(data=response_data) if utils.match_response(http_res, "403", "application/json"): - data = utils.unmarshal_json(http_res.text, models.ErrForbiddenData) - raise models.ErrForbidden(data=data) + response_data = utils.unmarshal_json(http_res.text, models.ErrForbiddenData) + raise models.ErrForbidden(data=response_data) if utils.match_response(http_res, "404", "application/json"): - data = utils.unmarshal_json(http_res.text, models.ErrNotFoundData) - raise models.ErrNotFound(data=data) + response_data = utils.unmarshal_json(http_res.text, models.ErrNotFoundData) + raise models.ErrNotFound(data=response_data) if utils.match_response(http_res, "409", "application/json"): - data = utils.unmarshal_json(http_res.text, models.ErrConflictData) - raise models.ErrConflict(data=data) + response_data = utils.unmarshal_json(http_res.text, models.ErrConflictData) + raise models.ErrConflict(data=response_data) + if utils.match_response(http_res, "412", "application/json"): + response_data = utils.unmarshal_json( + http_res.text, models.ErrPreconditionFailedData + ) + raise models.ErrPreconditionFailed(data=response_data) if utils.match_response(http_res, "429", "application/json"): - data = utils.unmarshal_json(http_res.text, models.ErrTooManyRequestsData) - raise models.ErrTooManyRequests(data=data) + response_data = utils.unmarshal_json( + http_res.text, models.ErrTooManyRequestsData + ) + raise models.ErrTooManyRequests(data=response_data) if utils.match_response(http_res, "500", "application/json"): - data = utils.unmarshal_json( + response_data = utils.unmarshal_json( http_res.text, models.ErrInternalServerErrorData ) - raise models.ErrInternalServerError(data=data) - if utils.match_response(http_res, ["4XX", "5XX"], "*"): + raise models.ErrInternalServerError(data=response_data) + if utils.match_response(http_res, "4XX", "*"): + http_res_text = await utils.stream_to_text_async(http_res) + raise models.SDKError( + "API error occurred", http_res.status_code, http_res_text, http_res + ) + if utils.match_response(http_res, "5XX", "*"): http_res_text = await utils.stream_to_text_async(http_res) raise models.SDKError( "API error occurred", http_res.status_code, http_res_text, http_res @@ -1753,11 +2075,13 @@ def list_roles( retries: OptionalNullable[utils.RetryConfig] = UNSET, server_url: Optional[str] = None, timeout_ms: Optional[int] = None, + http_headers: Optional[Mapping[str, str]] = None, ) -> models.ListRolesResponse: r""" :param retries: Override the default retry configuration for this method :param server_url: Override the default server URL for this method :param timeout_ms: Override the default request timeout configuration for this method in milliseconds + :param http_headers: Additional headers to set or replace on requests. """ base_url = None url_variables = None @@ -1766,7 +2090,9 @@ def list_roles( if server_url is not None: base_url = server_url - req = self.build_request( + else: + base_url = self._get_url(base_url, url_variables) + req = self._build_request( method="GET", path="/v1/permissions.listRoles", base_url=base_url, @@ -1777,6 +2103,7 @@ def list_roles( request_has_query_params=True, user_agent_header="user-agent", accept_header_value="application/json", + http_headers=http_headers, security=self.sdk_configuration.security, timeout_ms=timeout_ms, ) @@ -1795,6 +2122,7 @@ def list_roles( http_res = self.do_request( hook_ctx=HookContext( + base_url=base_url or "", operation_id="listRoles", oauth2_scopes=[], security_source=get_security_from_env( @@ -1808,6 +2136,7 @@ def list_roles( "403", "404", "409", + "412", "429", "4XX", "500", @@ -1816,7 +2145,7 @@ def list_roles( retry_config=retry_config, ) - data: Any = None + response_data: Any = None if utils.match_response(http_res, "200", "application/json"): return models.ListRolesResponse( response_bodies=utils.unmarshal_json( @@ -1825,29 +2154,45 @@ def list_roles( http_meta=models.HTTPMetadata(request=req, response=http_res), ) if utils.match_response(http_res, "400", "application/json"): - data = utils.unmarshal_json(http_res.text, models.ErrBadRequestData) - raise models.ErrBadRequest(data=data) + response_data = utils.unmarshal_json( + http_res.text, models.ErrBadRequestData + ) + raise models.ErrBadRequest(data=response_data) if utils.match_response(http_res, "401", "application/json"): - data = utils.unmarshal_json(http_res.text, models.ErrUnauthorizedData) - raise models.ErrUnauthorized(data=data) + response_data = utils.unmarshal_json( + http_res.text, models.ErrUnauthorizedData + ) + raise models.ErrUnauthorized(data=response_data) if utils.match_response(http_res, "403", "application/json"): - data = utils.unmarshal_json(http_res.text, models.ErrForbiddenData) - raise models.ErrForbidden(data=data) + response_data = utils.unmarshal_json(http_res.text, models.ErrForbiddenData) + raise models.ErrForbidden(data=response_data) if utils.match_response(http_res, "404", "application/json"): - data = utils.unmarshal_json(http_res.text, models.ErrNotFoundData) - raise models.ErrNotFound(data=data) + response_data = utils.unmarshal_json(http_res.text, models.ErrNotFoundData) + raise models.ErrNotFound(data=response_data) if utils.match_response(http_res, "409", "application/json"): - data = utils.unmarshal_json(http_res.text, models.ErrConflictData) - raise models.ErrConflict(data=data) + response_data = utils.unmarshal_json(http_res.text, models.ErrConflictData) + raise models.ErrConflict(data=response_data) + if utils.match_response(http_res, "412", "application/json"): + response_data = utils.unmarshal_json( + http_res.text, models.ErrPreconditionFailedData + ) + raise models.ErrPreconditionFailed(data=response_data) if utils.match_response(http_res, "429", "application/json"): - data = utils.unmarshal_json(http_res.text, models.ErrTooManyRequestsData) - raise models.ErrTooManyRequests(data=data) + response_data = utils.unmarshal_json( + http_res.text, models.ErrTooManyRequestsData + ) + raise models.ErrTooManyRequests(data=response_data) if utils.match_response(http_res, "500", "application/json"): - data = utils.unmarshal_json( + response_data = utils.unmarshal_json( http_res.text, models.ErrInternalServerErrorData ) - raise models.ErrInternalServerError(data=data) - if utils.match_response(http_res, ["4XX", "5XX"], "*"): + raise models.ErrInternalServerError(data=response_data) + if utils.match_response(http_res, "4XX", "*"): + http_res_text = utils.stream_to_text(http_res) + raise models.SDKError( + "API error occurred", http_res.status_code, http_res_text, http_res + ) + if utils.match_response(http_res, "5XX", "*"): http_res_text = utils.stream_to_text(http_res) raise models.SDKError( "API error occurred", http_res.status_code, http_res_text, http_res @@ -1868,11 +2213,13 @@ async def list_roles_async( retries: OptionalNullable[utils.RetryConfig] = UNSET, server_url: Optional[str] = None, timeout_ms: Optional[int] = None, + http_headers: Optional[Mapping[str, str]] = None, ) -> models.ListRolesResponse: r""" :param retries: Override the default retry configuration for this method :param server_url: Override the default server URL for this method :param timeout_ms: Override the default request timeout configuration for this method in milliseconds + :param http_headers: Additional headers to set or replace on requests. """ base_url = None url_variables = None @@ -1881,7 +2228,9 @@ async def list_roles_async( if server_url is not None: base_url = server_url - req = self.build_request_async( + else: + base_url = self._get_url(base_url, url_variables) + req = self._build_request_async( method="GET", path="/v1/permissions.listRoles", base_url=base_url, @@ -1892,6 +2241,7 @@ async def list_roles_async( request_has_query_params=True, user_agent_header="user-agent", accept_header_value="application/json", + http_headers=http_headers, security=self.sdk_configuration.security, timeout_ms=timeout_ms, ) @@ -1910,6 +2260,7 @@ async def list_roles_async( http_res = await self.do_request_async( hook_ctx=HookContext( + base_url=base_url or "", operation_id="listRoles", oauth2_scopes=[], security_source=get_security_from_env( @@ -1923,6 +2274,7 @@ async def list_roles_async( "403", "404", "409", + "412", "429", "4XX", "500", @@ -1931,7 +2283,7 @@ async def list_roles_async( retry_config=retry_config, ) - data: Any = None + response_data: Any = None if utils.match_response(http_res, "200", "application/json"): return models.ListRolesResponse( response_bodies=utils.unmarshal_json( @@ -1940,29 +2292,45 @@ async def list_roles_async( http_meta=models.HTTPMetadata(request=req, response=http_res), ) if utils.match_response(http_res, "400", "application/json"): - data = utils.unmarshal_json(http_res.text, models.ErrBadRequestData) - raise models.ErrBadRequest(data=data) + response_data = utils.unmarshal_json( + http_res.text, models.ErrBadRequestData + ) + raise models.ErrBadRequest(data=response_data) if utils.match_response(http_res, "401", "application/json"): - data = utils.unmarshal_json(http_res.text, models.ErrUnauthorizedData) - raise models.ErrUnauthorized(data=data) + response_data = utils.unmarshal_json( + http_res.text, models.ErrUnauthorizedData + ) + raise models.ErrUnauthorized(data=response_data) if utils.match_response(http_res, "403", "application/json"): - data = utils.unmarshal_json(http_res.text, models.ErrForbiddenData) - raise models.ErrForbidden(data=data) + response_data = utils.unmarshal_json(http_res.text, models.ErrForbiddenData) + raise models.ErrForbidden(data=response_data) if utils.match_response(http_res, "404", "application/json"): - data = utils.unmarshal_json(http_res.text, models.ErrNotFoundData) - raise models.ErrNotFound(data=data) + response_data = utils.unmarshal_json(http_res.text, models.ErrNotFoundData) + raise models.ErrNotFound(data=response_data) if utils.match_response(http_res, "409", "application/json"): - data = utils.unmarshal_json(http_res.text, models.ErrConflictData) - raise models.ErrConflict(data=data) + response_data = utils.unmarshal_json(http_res.text, models.ErrConflictData) + raise models.ErrConflict(data=response_data) + if utils.match_response(http_res, "412", "application/json"): + response_data = utils.unmarshal_json( + http_res.text, models.ErrPreconditionFailedData + ) + raise models.ErrPreconditionFailed(data=response_data) if utils.match_response(http_res, "429", "application/json"): - data = utils.unmarshal_json(http_res.text, models.ErrTooManyRequestsData) - raise models.ErrTooManyRequests(data=data) + response_data = utils.unmarshal_json( + http_res.text, models.ErrTooManyRequestsData + ) + raise models.ErrTooManyRequests(data=response_data) if utils.match_response(http_res, "500", "application/json"): - data = utils.unmarshal_json( + response_data = utils.unmarshal_json( http_res.text, models.ErrInternalServerErrorData ) - raise models.ErrInternalServerError(data=data) - if utils.match_response(http_res, ["4XX", "5XX"], "*"): + raise models.ErrInternalServerError(data=response_data) + if utils.match_response(http_res, "4XX", "*"): + http_res_text = await utils.stream_to_text_async(http_res) + raise models.SDKError( + "API error occurred", http_res.status_code, http_res_text, http_res + ) + if utils.match_response(http_res, "5XX", "*"): http_res_text = await utils.stream_to_text_async(http_res) raise models.SDKError( "API error occurred", http_res.status_code, http_res_text, http_res diff --git a/src/unkey_py/ratelimit.py b/src/unkey_py/ratelimit.py index 473fdc0..89c423d 100644 --- a/src/unkey_py/ratelimit.py +++ b/src/unkey_py/ratelimit.py @@ -1,7 +1,7 @@ """Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT.""" from .basesdk import BaseSDK -from typing import Any, Optional, Union, cast +from typing import Any, Mapping, Optional, Union, cast from unkey_py import models, utils from unkey_py._hooks import HookContext from unkey_py.types import BaseModel, OptionalNullable, UNSET @@ -9,22 +9,23 @@ class Ratelimit(BaseSDK): - def ratelimit_set_override( + def set_override( self, *, request: Union[ - models.RatelimitSetOverrideRequestBody, - models.RatelimitSetOverrideRequestBodyTypedDict, + models.SetOverrideRequestBody, models.SetOverrideRequestBodyTypedDict ], retries: OptionalNullable[utils.RetryConfig] = UNSET, server_url: Optional[str] = None, timeout_ms: Optional[int] = None, - ) -> models.RatelimitSetOverrideResponse: + http_headers: Optional[Mapping[str, str]] = None, + ) -> models.SetOverrideResponse: r""" :param request: The request object to send. :param retries: Override the default retry configuration for this method :param server_url: Override the default server URL for this method :param timeout_ms: Override the default request timeout configuration for this method in milliseconds + :param http_headers: Additional headers to set or replace on requests. """ base_url = None url_variables = None @@ -33,12 +34,14 @@ def ratelimit_set_override( if server_url is not None: base_url = server_url + else: + base_url = self._get_url(base_url, url_variables) if not isinstance(request, BaseModel): - request = utils.unmarshal(request, models.RatelimitSetOverrideRequestBody) - request = cast(models.RatelimitSetOverrideRequestBody, request) + request = utils.unmarshal(request, models.SetOverrideRequestBody) + request = cast(models.SetOverrideRequestBody, request) - req = self.build_request( + req = self._build_request( method="POST", path="/v1/ratelimits.setOverride", base_url=base_url, @@ -49,9 +52,10 @@ def ratelimit_set_override( request_has_query_params=True, user_agent_header="user-agent", accept_header_value="application/json", + http_headers=http_headers, security=self.sdk_configuration.security, get_serialized_body=lambda: utils.serialize_request_body( - request, False, False, "json", models.RatelimitSetOverrideRequestBody + request, False, False, "json", models.SetOverrideRequestBody ), timeout_ms=timeout_ms, ) @@ -70,7 +74,8 @@ def ratelimit_set_override( http_res = self.do_request( hook_ctx=HookContext( - operation_id="ratelimit.setOverride", + base_url=base_url or "", + operation_id="setOverride", oauth2_scopes=[], security_source=get_security_from_env( self.sdk_configuration.security, models.Security @@ -83,6 +88,7 @@ def ratelimit_set_override( "403", "404", "409", + "412", "429", "4XX", "500", @@ -91,38 +97,54 @@ def ratelimit_set_override( retry_config=retry_config, ) - data: Any = None + response_data: Any = None if utils.match_response(http_res, "200", "application/json"): - return models.RatelimitSetOverrideResponse( + return models.SetOverrideResponse( object=utils.unmarshal_json( - http_res.text, Optional[models.RatelimitSetOverrideResponseBody] + http_res.text, Optional[models.SetOverrideResponseBody] ), http_meta=models.HTTPMetadata(request=req, response=http_res), ) if utils.match_response(http_res, "400", "application/json"): - data = utils.unmarshal_json(http_res.text, models.ErrBadRequestData) - raise models.ErrBadRequest(data=data) + response_data = utils.unmarshal_json( + http_res.text, models.ErrBadRequestData + ) + raise models.ErrBadRequest(data=response_data) if utils.match_response(http_res, "401", "application/json"): - data = utils.unmarshal_json(http_res.text, models.ErrUnauthorizedData) - raise models.ErrUnauthorized(data=data) + response_data = utils.unmarshal_json( + http_res.text, models.ErrUnauthorizedData + ) + raise models.ErrUnauthorized(data=response_data) if utils.match_response(http_res, "403", "application/json"): - data = utils.unmarshal_json(http_res.text, models.ErrForbiddenData) - raise models.ErrForbidden(data=data) + response_data = utils.unmarshal_json(http_res.text, models.ErrForbiddenData) + raise models.ErrForbidden(data=response_data) if utils.match_response(http_res, "404", "application/json"): - data = utils.unmarshal_json(http_res.text, models.ErrNotFoundData) - raise models.ErrNotFound(data=data) + response_data = utils.unmarshal_json(http_res.text, models.ErrNotFoundData) + raise models.ErrNotFound(data=response_data) if utils.match_response(http_res, "409", "application/json"): - data = utils.unmarshal_json(http_res.text, models.ErrConflictData) - raise models.ErrConflict(data=data) + response_data = utils.unmarshal_json(http_res.text, models.ErrConflictData) + raise models.ErrConflict(data=response_data) + if utils.match_response(http_res, "412", "application/json"): + response_data = utils.unmarshal_json( + http_res.text, models.ErrPreconditionFailedData + ) + raise models.ErrPreconditionFailed(data=response_data) if utils.match_response(http_res, "429", "application/json"): - data = utils.unmarshal_json(http_res.text, models.ErrTooManyRequestsData) - raise models.ErrTooManyRequests(data=data) + response_data = utils.unmarshal_json( + http_res.text, models.ErrTooManyRequestsData + ) + raise models.ErrTooManyRequests(data=response_data) if utils.match_response(http_res, "500", "application/json"): - data = utils.unmarshal_json( + response_data = utils.unmarshal_json( http_res.text, models.ErrInternalServerErrorData ) - raise models.ErrInternalServerError(data=data) - if utils.match_response(http_res, ["4XX", "5XX"], "*"): + raise models.ErrInternalServerError(data=response_data) + if utils.match_response(http_res, "4XX", "*"): + http_res_text = utils.stream_to_text(http_res) + raise models.SDKError( + "API error occurred", http_res.status_code, http_res_text, http_res + ) + if utils.match_response(http_res, "5XX", "*"): http_res_text = utils.stream_to_text(http_res) raise models.SDKError( "API error occurred", http_res.status_code, http_res_text, http_res @@ -137,22 +159,23 @@ def ratelimit_set_override( http_res, ) - async def ratelimit_set_override_async( + async def set_override_async( self, *, request: Union[ - models.RatelimitSetOverrideRequestBody, - models.RatelimitSetOverrideRequestBodyTypedDict, + models.SetOverrideRequestBody, models.SetOverrideRequestBodyTypedDict ], retries: OptionalNullable[utils.RetryConfig] = UNSET, server_url: Optional[str] = None, timeout_ms: Optional[int] = None, - ) -> models.RatelimitSetOverrideResponse: + http_headers: Optional[Mapping[str, str]] = None, + ) -> models.SetOverrideResponse: r""" :param request: The request object to send. :param retries: Override the default retry configuration for this method :param server_url: Override the default server URL for this method :param timeout_ms: Override the default request timeout configuration for this method in milliseconds + :param http_headers: Additional headers to set or replace on requests. """ base_url = None url_variables = None @@ -161,12 +184,14 @@ async def ratelimit_set_override_async( if server_url is not None: base_url = server_url + else: + base_url = self._get_url(base_url, url_variables) if not isinstance(request, BaseModel): - request = utils.unmarshal(request, models.RatelimitSetOverrideRequestBody) - request = cast(models.RatelimitSetOverrideRequestBody, request) + request = utils.unmarshal(request, models.SetOverrideRequestBody) + request = cast(models.SetOverrideRequestBody, request) - req = self.build_request_async( + req = self._build_request_async( method="POST", path="/v1/ratelimits.setOverride", base_url=base_url, @@ -177,9 +202,10 @@ async def ratelimit_set_override_async( request_has_query_params=True, user_agent_header="user-agent", accept_header_value="application/json", + http_headers=http_headers, security=self.sdk_configuration.security, get_serialized_body=lambda: utils.serialize_request_body( - request, False, False, "json", models.RatelimitSetOverrideRequestBody + request, False, False, "json", models.SetOverrideRequestBody ), timeout_ms=timeout_ms, ) @@ -198,7 +224,8 @@ async def ratelimit_set_override_async( http_res = await self.do_request_async( hook_ctx=HookContext( - operation_id="ratelimit.setOverride", + base_url=base_url or "", + operation_id="setOverride", oauth2_scopes=[], security_source=get_security_from_env( self.sdk_configuration.security, models.Security @@ -211,6 +238,7 @@ async def ratelimit_set_override_async( "403", "404", "409", + "412", "429", "4XX", "500", @@ -219,38 +247,54 @@ async def ratelimit_set_override_async( retry_config=retry_config, ) - data: Any = None + response_data: Any = None if utils.match_response(http_res, "200", "application/json"): - return models.RatelimitSetOverrideResponse( + return models.SetOverrideResponse( object=utils.unmarshal_json( - http_res.text, Optional[models.RatelimitSetOverrideResponseBody] + http_res.text, Optional[models.SetOverrideResponseBody] ), http_meta=models.HTTPMetadata(request=req, response=http_res), ) if utils.match_response(http_res, "400", "application/json"): - data = utils.unmarshal_json(http_res.text, models.ErrBadRequestData) - raise models.ErrBadRequest(data=data) + response_data = utils.unmarshal_json( + http_res.text, models.ErrBadRequestData + ) + raise models.ErrBadRequest(data=response_data) if utils.match_response(http_res, "401", "application/json"): - data = utils.unmarshal_json(http_res.text, models.ErrUnauthorizedData) - raise models.ErrUnauthorized(data=data) + response_data = utils.unmarshal_json( + http_res.text, models.ErrUnauthorizedData + ) + raise models.ErrUnauthorized(data=response_data) if utils.match_response(http_res, "403", "application/json"): - data = utils.unmarshal_json(http_res.text, models.ErrForbiddenData) - raise models.ErrForbidden(data=data) + response_data = utils.unmarshal_json(http_res.text, models.ErrForbiddenData) + raise models.ErrForbidden(data=response_data) if utils.match_response(http_res, "404", "application/json"): - data = utils.unmarshal_json(http_res.text, models.ErrNotFoundData) - raise models.ErrNotFound(data=data) + response_data = utils.unmarshal_json(http_res.text, models.ErrNotFoundData) + raise models.ErrNotFound(data=response_data) if utils.match_response(http_res, "409", "application/json"): - data = utils.unmarshal_json(http_res.text, models.ErrConflictData) - raise models.ErrConflict(data=data) + response_data = utils.unmarshal_json(http_res.text, models.ErrConflictData) + raise models.ErrConflict(data=response_data) + if utils.match_response(http_res, "412", "application/json"): + response_data = utils.unmarshal_json( + http_res.text, models.ErrPreconditionFailedData + ) + raise models.ErrPreconditionFailed(data=response_data) if utils.match_response(http_res, "429", "application/json"): - data = utils.unmarshal_json(http_res.text, models.ErrTooManyRequestsData) - raise models.ErrTooManyRequests(data=data) + response_data = utils.unmarshal_json( + http_res.text, models.ErrTooManyRequestsData + ) + raise models.ErrTooManyRequests(data=response_data) if utils.match_response(http_res, "500", "application/json"): - data = utils.unmarshal_json( + response_data = utils.unmarshal_json( http_res.text, models.ErrInternalServerErrorData ) - raise models.ErrInternalServerError(data=data) - if utils.match_response(http_res, ["4XX", "5XX"], "*"): + raise models.ErrInternalServerError(data=response_data) + if utils.match_response(http_res, "4XX", "*"): + http_res_text = await utils.stream_to_text_async(http_res) + raise models.SDKError( + "API error occurred", http_res.status_code, http_res_text, http_res + ) + if utils.match_response(http_res, "5XX", "*"): http_res_text = await utils.stream_to_text_async(http_res) raise models.SDKError( "API error occurred", http_res.status_code, http_res_text, http_res @@ -275,6 +319,7 @@ def list_overrides( retries: OptionalNullable[utils.RetryConfig] = UNSET, server_url: Optional[str] = None, timeout_ms: Optional[int] = None, + http_headers: Optional[Mapping[str, str]] = None, ) -> models.ListOverridesResponse: r""" :param namespace_id: @@ -284,6 +329,7 @@ def list_overrides( :param retries: Override the default retry configuration for this method :param server_url: Override the default server URL for this method :param timeout_ms: Override the default request timeout configuration for this method in milliseconds + :param http_headers: Additional headers to set or replace on requests. """ base_url = None url_variables = None @@ -292,6 +338,8 @@ def list_overrides( if server_url is not None: base_url = server_url + else: + base_url = self._get_url(base_url, url_variables) request = models.ListOverridesRequest( namespace_id=namespace_id, @@ -300,7 +348,7 @@ def list_overrides( cursor=cursor, ) - req = self.build_request( + req = self._build_request( method="GET", path="/v1/ratelimits.listOverrides", base_url=base_url, @@ -311,6 +359,7 @@ def list_overrides( request_has_query_params=True, user_agent_header="user-agent", accept_header_value="application/json", + http_headers=http_headers, security=self.sdk_configuration.security, timeout_ms=timeout_ms, ) @@ -329,6 +378,7 @@ def list_overrides( http_res = self.do_request( hook_ctx=HookContext( + base_url=base_url or "", operation_id="listOverrides", oauth2_scopes=[], security_source=get_security_from_env( @@ -342,6 +392,7 @@ def list_overrides( "403", "404", "409", + "412", "429", "4XX", "500", @@ -350,7 +401,7 @@ def list_overrides( retry_config=retry_config, ) - data: Any = None + response_data: Any = None if utils.match_response(http_res, "200", "application/json"): return models.ListOverridesResponse( object=utils.unmarshal_json( @@ -359,29 +410,45 @@ def list_overrides( http_meta=models.HTTPMetadata(request=req, response=http_res), ) if utils.match_response(http_res, "400", "application/json"): - data = utils.unmarshal_json(http_res.text, models.ErrBadRequestData) - raise models.ErrBadRequest(data=data) + response_data = utils.unmarshal_json( + http_res.text, models.ErrBadRequestData + ) + raise models.ErrBadRequest(data=response_data) if utils.match_response(http_res, "401", "application/json"): - data = utils.unmarshal_json(http_res.text, models.ErrUnauthorizedData) - raise models.ErrUnauthorized(data=data) + response_data = utils.unmarshal_json( + http_res.text, models.ErrUnauthorizedData + ) + raise models.ErrUnauthorized(data=response_data) if utils.match_response(http_res, "403", "application/json"): - data = utils.unmarshal_json(http_res.text, models.ErrForbiddenData) - raise models.ErrForbidden(data=data) + response_data = utils.unmarshal_json(http_res.text, models.ErrForbiddenData) + raise models.ErrForbidden(data=response_data) if utils.match_response(http_res, "404", "application/json"): - data = utils.unmarshal_json(http_res.text, models.ErrNotFoundData) - raise models.ErrNotFound(data=data) + response_data = utils.unmarshal_json(http_res.text, models.ErrNotFoundData) + raise models.ErrNotFound(data=response_data) if utils.match_response(http_res, "409", "application/json"): - data = utils.unmarshal_json(http_res.text, models.ErrConflictData) - raise models.ErrConflict(data=data) + response_data = utils.unmarshal_json(http_res.text, models.ErrConflictData) + raise models.ErrConflict(data=response_data) + if utils.match_response(http_res, "412", "application/json"): + response_data = utils.unmarshal_json( + http_res.text, models.ErrPreconditionFailedData + ) + raise models.ErrPreconditionFailed(data=response_data) if utils.match_response(http_res, "429", "application/json"): - data = utils.unmarshal_json(http_res.text, models.ErrTooManyRequestsData) - raise models.ErrTooManyRequests(data=data) + response_data = utils.unmarshal_json( + http_res.text, models.ErrTooManyRequestsData + ) + raise models.ErrTooManyRequests(data=response_data) if utils.match_response(http_res, "500", "application/json"): - data = utils.unmarshal_json( + response_data = utils.unmarshal_json( http_res.text, models.ErrInternalServerErrorData ) - raise models.ErrInternalServerError(data=data) - if utils.match_response(http_res, ["4XX", "5XX"], "*"): + raise models.ErrInternalServerError(data=response_data) + if utils.match_response(http_res, "4XX", "*"): + http_res_text = utils.stream_to_text(http_res) + raise models.SDKError( + "API error occurred", http_res.status_code, http_res_text, http_res + ) + if utils.match_response(http_res, "5XX", "*"): http_res_text = utils.stream_to_text(http_res) raise models.SDKError( "API error occurred", http_res.status_code, http_res_text, http_res @@ -406,6 +473,7 @@ async def list_overrides_async( retries: OptionalNullable[utils.RetryConfig] = UNSET, server_url: Optional[str] = None, timeout_ms: Optional[int] = None, + http_headers: Optional[Mapping[str, str]] = None, ) -> models.ListOverridesResponse: r""" :param namespace_id: @@ -415,6 +483,7 @@ async def list_overrides_async( :param retries: Override the default retry configuration for this method :param server_url: Override the default server URL for this method :param timeout_ms: Override the default request timeout configuration for this method in milliseconds + :param http_headers: Additional headers to set or replace on requests. """ base_url = None url_variables = None @@ -423,6 +492,8 @@ async def list_overrides_async( if server_url is not None: base_url = server_url + else: + base_url = self._get_url(base_url, url_variables) request = models.ListOverridesRequest( namespace_id=namespace_id, @@ -431,7 +502,7 @@ async def list_overrides_async( cursor=cursor, ) - req = self.build_request_async( + req = self._build_request_async( method="GET", path="/v1/ratelimits.listOverrides", base_url=base_url, @@ -442,6 +513,7 @@ async def list_overrides_async( request_has_query_params=True, user_agent_header="user-agent", accept_header_value="application/json", + http_headers=http_headers, security=self.sdk_configuration.security, timeout_ms=timeout_ms, ) @@ -460,6 +532,7 @@ async def list_overrides_async( http_res = await self.do_request_async( hook_ctx=HookContext( + base_url=base_url or "", operation_id="listOverrides", oauth2_scopes=[], security_source=get_security_from_env( @@ -473,6 +546,7 @@ async def list_overrides_async( "403", "404", "409", + "412", "429", "4XX", "500", @@ -481,7 +555,7 @@ async def list_overrides_async( retry_config=retry_config, ) - data: Any = None + response_data: Any = None if utils.match_response(http_res, "200", "application/json"): return models.ListOverridesResponse( object=utils.unmarshal_json( @@ -490,29 +564,45 @@ async def list_overrides_async( http_meta=models.HTTPMetadata(request=req, response=http_res), ) if utils.match_response(http_res, "400", "application/json"): - data = utils.unmarshal_json(http_res.text, models.ErrBadRequestData) - raise models.ErrBadRequest(data=data) + response_data = utils.unmarshal_json( + http_res.text, models.ErrBadRequestData + ) + raise models.ErrBadRequest(data=response_data) if utils.match_response(http_res, "401", "application/json"): - data = utils.unmarshal_json(http_res.text, models.ErrUnauthorizedData) - raise models.ErrUnauthorized(data=data) + response_data = utils.unmarshal_json( + http_res.text, models.ErrUnauthorizedData + ) + raise models.ErrUnauthorized(data=response_data) if utils.match_response(http_res, "403", "application/json"): - data = utils.unmarshal_json(http_res.text, models.ErrForbiddenData) - raise models.ErrForbidden(data=data) + response_data = utils.unmarshal_json(http_res.text, models.ErrForbiddenData) + raise models.ErrForbidden(data=response_data) if utils.match_response(http_res, "404", "application/json"): - data = utils.unmarshal_json(http_res.text, models.ErrNotFoundData) - raise models.ErrNotFound(data=data) + response_data = utils.unmarshal_json(http_res.text, models.ErrNotFoundData) + raise models.ErrNotFound(data=response_data) if utils.match_response(http_res, "409", "application/json"): - data = utils.unmarshal_json(http_res.text, models.ErrConflictData) - raise models.ErrConflict(data=data) + response_data = utils.unmarshal_json(http_res.text, models.ErrConflictData) + raise models.ErrConflict(data=response_data) + if utils.match_response(http_res, "412", "application/json"): + response_data = utils.unmarshal_json( + http_res.text, models.ErrPreconditionFailedData + ) + raise models.ErrPreconditionFailed(data=response_data) if utils.match_response(http_res, "429", "application/json"): - data = utils.unmarshal_json(http_res.text, models.ErrTooManyRequestsData) - raise models.ErrTooManyRequests(data=data) + response_data = utils.unmarshal_json( + http_res.text, models.ErrTooManyRequestsData + ) + raise models.ErrTooManyRequests(data=response_data) if utils.match_response(http_res, "500", "application/json"): - data = utils.unmarshal_json( + response_data = utils.unmarshal_json( http_res.text, models.ErrInternalServerErrorData ) - raise models.ErrInternalServerError(data=data) - if utils.match_response(http_res, ["4XX", "5XX"], "*"): + raise models.ErrInternalServerError(data=response_data) + if utils.match_response(http_res, "4XX", "*"): + http_res_text = await utils.stream_to_text_async(http_res) + raise models.SDKError( + "API error occurred", http_res.status_code, http_res_text, http_res + ) + if utils.match_response(http_res, "5XX", "*"): http_res_text = await utils.stream_to_text_async(http_res) raise models.SDKError( "API error occurred", http_res.status_code, http_res_text, http_res @@ -536,6 +626,7 @@ def get_override( retries: OptionalNullable[utils.RetryConfig] = UNSET, server_url: Optional[str] = None, timeout_ms: Optional[int] = None, + http_headers: Optional[Mapping[str, str]] = None, ) -> models.GetOverrideResponse: r""" :param identifier: @@ -544,6 +635,7 @@ def get_override( :param retries: Override the default retry configuration for this method :param server_url: Override the default server URL for this method :param timeout_ms: Override the default request timeout configuration for this method in milliseconds + :param http_headers: Additional headers to set or replace on requests. """ base_url = None url_variables = None @@ -552,6 +644,8 @@ def get_override( if server_url is not None: base_url = server_url + else: + base_url = self._get_url(base_url, url_variables) request = models.GetOverrideRequest( namespace_id=namespace_id, @@ -559,7 +653,7 @@ def get_override( identifier=identifier, ) - req = self.build_request( + req = self._build_request( method="GET", path="/v1/ratelimits.getOverride", base_url=base_url, @@ -570,6 +664,7 @@ def get_override( request_has_query_params=True, user_agent_header="user-agent", accept_header_value="application/json", + http_headers=http_headers, security=self.sdk_configuration.security, timeout_ms=timeout_ms, ) @@ -588,6 +683,7 @@ def get_override( http_res = self.do_request( hook_ctx=HookContext( + base_url=base_url or "", operation_id="getOverride", oauth2_scopes=[], security_source=get_security_from_env( @@ -601,6 +697,7 @@ def get_override( "403", "404", "409", + "412", "429", "4XX", "500", @@ -609,7 +706,7 @@ def get_override( retry_config=retry_config, ) - data: Any = None + response_data: Any = None if utils.match_response(http_res, "200", "application/json"): return models.GetOverrideResponse( object=utils.unmarshal_json( @@ -618,29 +715,45 @@ def get_override( http_meta=models.HTTPMetadata(request=req, response=http_res), ) if utils.match_response(http_res, "400", "application/json"): - data = utils.unmarshal_json(http_res.text, models.ErrBadRequestData) - raise models.ErrBadRequest(data=data) + response_data = utils.unmarshal_json( + http_res.text, models.ErrBadRequestData + ) + raise models.ErrBadRequest(data=response_data) if utils.match_response(http_res, "401", "application/json"): - data = utils.unmarshal_json(http_res.text, models.ErrUnauthorizedData) - raise models.ErrUnauthorized(data=data) + response_data = utils.unmarshal_json( + http_res.text, models.ErrUnauthorizedData + ) + raise models.ErrUnauthorized(data=response_data) if utils.match_response(http_res, "403", "application/json"): - data = utils.unmarshal_json(http_res.text, models.ErrForbiddenData) - raise models.ErrForbidden(data=data) + response_data = utils.unmarshal_json(http_res.text, models.ErrForbiddenData) + raise models.ErrForbidden(data=response_data) if utils.match_response(http_res, "404", "application/json"): - data = utils.unmarshal_json(http_res.text, models.ErrNotFoundData) - raise models.ErrNotFound(data=data) + response_data = utils.unmarshal_json(http_res.text, models.ErrNotFoundData) + raise models.ErrNotFound(data=response_data) if utils.match_response(http_res, "409", "application/json"): - data = utils.unmarshal_json(http_res.text, models.ErrConflictData) - raise models.ErrConflict(data=data) + response_data = utils.unmarshal_json(http_res.text, models.ErrConflictData) + raise models.ErrConflict(data=response_data) + if utils.match_response(http_res, "412", "application/json"): + response_data = utils.unmarshal_json( + http_res.text, models.ErrPreconditionFailedData + ) + raise models.ErrPreconditionFailed(data=response_data) if utils.match_response(http_res, "429", "application/json"): - data = utils.unmarshal_json(http_res.text, models.ErrTooManyRequestsData) - raise models.ErrTooManyRequests(data=data) + response_data = utils.unmarshal_json( + http_res.text, models.ErrTooManyRequestsData + ) + raise models.ErrTooManyRequests(data=response_data) if utils.match_response(http_res, "500", "application/json"): - data = utils.unmarshal_json( + response_data = utils.unmarshal_json( http_res.text, models.ErrInternalServerErrorData ) - raise models.ErrInternalServerError(data=data) - if utils.match_response(http_res, ["4XX", "5XX"], "*"): + raise models.ErrInternalServerError(data=response_data) + if utils.match_response(http_res, "4XX", "*"): + http_res_text = utils.stream_to_text(http_res) + raise models.SDKError( + "API error occurred", http_res.status_code, http_res_text, http_res + ) + if utils.match_response(http_res, "5XX", "*"): http_res_text = utils.stream_to_text(http_res) raise models.SDKError( "API error occurred", http_res.status_code, http_res_text, http_res @@ -664,6 +777,7 @@ async def get_override_async( retries: OptionalNullable[utils.RetryConfig] = UNSET, server_url: Optional[str] = None, timeout_ms: Optional[int] = None, + http_headers: Optional[Mapping[str, str]] = None, ) -> models.GetOverrideResponse: r""" :param identifier: @@ -672,6 +786,7 @@ async def get_override_async( :param retries: Override the default retry configuration for this method :param server_url: Override the default server URL for this method :param timeout_ms: Override the default request timeout configuration for this method in milliseconds + :param http_headers: Additional headers to set or replace on requests. """ base_url = None url_variables = None @@ -680,6 +795,8 @@ async def get_override_async( if server_url is not None: base_url = server_url + else: + base_url = self._get_url(base_url, url_variables) request = models.GetOverrideRequest( namespace_id=namespace_id, @@ -687,7 +804,7 @@ async def get_override_async( identifier=identifier, ) - req = self.build_request_async( + req = self._build_request_async( method="GET", path="/v1/ratelimits.getOverride", base_url=base_url, @@ -698,6 +815,7 @@ async def get_override_async( request_has_query_params=True, user_agent_header="user-agent", accept_header_value="application/json", + http_headers=http_headers, security=self.sdk_configuration.security, timeout_ms=timeout_ms, ) @@ -716,6 +834,7 @@ async def get_override_async( http_res = await self.do_request_async( hook_ctx=HookContext( + base_url=base_url or "", operation_id="getOverride", oauth2_scopes=[], security_source=get_security_from_env( @@ -729,6 +848,7 @@ async def get_override_async( "403", "404", "409", + "412", "429", "4XX", "500", @@ -737,7 +857,7 @@ async def get_override_async( retry_config=retry_config, ) - data: Any = None + response_data: Any = None if utils.match_response(http_res, "200", "application/json"): return models.GetOverrideResponse( object=utils.unmarshal_json( @@ -746,29 +866,45 @@ async def get_override_async( http_meta=models.HTTPMetadata(request=req, response=http_res), ) if utils.match_response(http_res, "400", "application/json"): - data = utils.unmarshal_json(http_res.text, models.ErrBadRequestData) - raise models.ErrBadRequest(data=data) + response_data = utils.unmarshal_json( + http_res.text, models.ErrBadRequestData + ) + raise models.ErrBadRequest(data=response_data) if utils.match_response(http_res, "401", "application/json"): - data = utils.unmarshal_json(http_res.text, models.ErrUnauthorizedData) - raise models.ErrUnauthorized(data=data) + response_data = utils.unmarshal_json( + http_res.text, models.ErrUnauthorizedData + ) + raise models.ErrUnauthorized(data=response_data) if utils.match_response(http_res, "403", "application/json"): - data = utils.unmarshal_json(http_res.text, models.ErrForbiddenData) - raise models.ErrForbidden(data=data) + response_data = utils.unmarshal_json(http_res.text, models.ErrForbiddenData) + raise models.ErrForbidden(data=response_data) if utils.match_response(http_res, "404", "application/json"): - data = utils.unmarshal_json(http_res.text, models.ErrNotFoundData) - raise models.ErrNotFound(data=data) + response_data = utils.unmarshal_json(http_res.text, models.ErrNotFoundData) + raise models.ErrNotFound(data=response_data) if utils.match_response(http_res, "409", "application/json"): - data = utils.unmarshal_json(http_res.text, models.ErrConflictData) - raise models.ErrConflict(data=data) + response_data = utils.unmarshal_json(http_res.text, models.ErrConflictData) + raise models.ErrConflict(data=response_data) + if utils.match_response(http_res, "412", "application/json"): + response_data = utils.unmarshal_json( + http_res.text, models.ErrPreconditionFailedData + ) + raise models.ErrPreconditionFailed(data=response_data) if utils.match_response(http_res, "429", "application/json"): - data = utils.unmarshal_json(http_res.text, models.ErrTooManyRequestsData) - raise models.ErrTooManyRequests(data=data) + response_data = utils.unmarshal_json( + http_res.text, models.ErrTooManyRequestsData + ) + raise models.ErrTooManyRequests(data=response_data) if utils.match_response(http_res, "500", "application/json"): - data = utils.unmarshal_json( + response_data = utils.unmarshal_json( http_res.text, models.ErrInternalServerErrorData ) - raise models.ErrInternalServerError(data=data) - if utils.match_response(http_res, ["4XX", "5XX"], "*"): + raise models.ErrInternalServerError(data=response_data) + if utils.match_response(http_res, "4XX", "*"): + http_res_text = await utils.stream_to_text_async(http_res) + raise models.SDKError( + "API error occurred", http_res.status_code, http_res_text, http_res + ) + if utils.match_response(http_res, "5XX", "*"): http_res_text = await utils.stream_to_text_async(http_res) raise models.SDKError( "API error occurred", http_res.status_code, http_res_text, http_res diff --git a/src/unkey_py/ratelimits.py b/src/unkey_py/ratelimits.py index a144249..e4e93df 100644 --- a/src/unkey_py/ratelimits.py +++ b/src/unkey_py/ratelimits.py @@ -1,7 +1,7 @@ """Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT.""" from .basesdk import BaseSDK -from typing import Any, Optional, Union, cast +from typing import Any, Mapping, Optional, Union, cast from unkey_py import models, utils from unkey_py._hooks import HookContext from unkey_py.types import BaseModel, OptionalNullable, UNSET @@ -16,12 +16,14 @@ def limit( retries: OptionalNullable[utils.RetryConfig] = UNSET, server_url: Optional[str] = None, timeout_ms: Optional[int] = None, + http_headers: Optional[Mapping[str, str]] = None, ) -> models.LimitResponse: r""" :param request: The request object to send. :param retries: Override the default retry configuration for this method :param server_url: Override the default server URL for this method :param timeout_ms: Override the default request timeout configuration for this method in milliseconds + :param http_headers: Additional headers to set or replace on requests. """ base_url = None url_variables = None @@ -30,12 +32,14 @@ def limit( if server_url is not None: base_url = server_url + else: + base_url = self._get_url(base_url, url_variables) if not isinstance(request, BaseModel): request = utils.unmarshal(request, models.LimitRequestBody) request = cast(models.LimitRequestBody, request) - req = self.build_request( + req = self._build_request( method="POST", path="/v1/ratelimits.limit", base_url=base_url, @@ -46,6 +50,7 @@ def limit( request_has_query_params=True, user_agent_header="user-agent", accept_header_value="application/json", + http_headers=http_headers, security=self.sdk_configuration.security, get_serialized_body=lambda: utils.serialize_request_body( request, False, False, "json", models.LimitRequestBody @@ -67,6 +72,7 @@ def limit( http_res = self.do_request( hook_ctx=HookContext( + base_url=base_url or "", operation_id="limit", oauth2_scopes=[], security_source=get_security_from_env( @@ -80,6 +86,7 @@ def limit( "403", "404", "409", + "412", "429", "4XX", "500", @@ -88,7 +95,7 @@ def limit( retry_config=retry_config, ) - data: Any = None + response_data: Any = None if utils.match_response(http_res, "200", "application/json"): return models.LimitResponse( object=utils.unmarshal_json( @@ -97,29 +104,45 @@ def limit( http_meta=models.HTTPMetadata(request=req, response=http_res), ) if utils.match_response(http_res, "400", "application/json"): - data = utils.unmarshal_json(http_res.text, models.ErrBadRequestData) - raise models.ErrBadRequest(data=data) + response_data = utils.unmarshal_json( + http_res.text, models.ErrBadRequestData + ) + raise models.ErrBadRequest(data=response_data) if utils.match_response(http_res, "401", "application/json"): - data = utils.unmarshal_json(http_res.text, models.ErrUnauthorizedData) - raise models.ErrUnauthorized(data=data) + response_data = utils.unmarshal_json( + http_res.text, models.ErrUnauthorizedData + ) + raise models.ErrUnauthorized(data=response_data) if utils.match_response(http_res, "403", "application/json"): - data = utils.unmarshal_json(http_res.text, models.ErrForbiddenData) - raise models.ErrForbidden(data=data) + response_data = utils.unmarshal_json(http_res.text, models.ErrForbiddenData) + raise models.ErrForbidden(data=response_data) if utils.match_response(http_res, "404", "application/json"): - data = utils.unmarshal_json(http_res.text, models.ErrNotFoundData) - raise models.ErrNotFound(data=data) + response_data = utils.unmarshal_json(http_res.text, models.ErrNotFoundData) + raise models.ErrNotFound(data=response_data) if utils.match_response(http_res, "409", "application/json"): - data = utils.unmarshal_json(http_res.text, models.ErrConflictData) - raise models.ErrConflict(data=data) + response_data = utils.unmarshal_json(http_res.text, models.ErrConflictData) + raise models.ErrConflict(data=response_data) + if utils.match_response(http_res, "412", "application/json"): + response_data = utils.unmarshal_json( + http_res.text, models.ErrPreconditionFailedData + ) + raise models.ErrPreconditionFailed(data=response_data) if utils.match_response(http_res, "429", "application/json"): - data = utils.unmarshal_json(http_res.text, models.ErrTooManyRequestsData) - raise models.ErrTooManyRequests(data=data) + response_data = utils.unmarshal_json( + http_res.text, models.ErrTooManyRequestsData + ) + raise models.ErrTooManyRequests(data=response_data) if utils.match_response(http_res, "500", "application/json"): - data = utils.unmarshal_json( + response_data = utils.unmarshal_json( http_res.text, models.ErrInternalServerErrorData ) - raise models.ErrInternalServerError(data=data) - if utils.match_response(http_res, ["4XX", "5XX"], "*"): + raise models.ErrInternalServerError(data=response_data) + if utils.match_response(http_res, "4XX", "*"): + http_res_text = utils.stream_to_text(http_res) + raise models.SDKError( + "API error occurred", http_res.status_code, http_res_text, http_res + ) + if utils.match_response(http_res, "5XX", "*"): http_res_text = utils.stream_to_text(http_res) raise models.SDKError( "API error occurred", http_res.status_code, http_res_text, http_res @@ -141,12 +164,14 @@ async def limit_async( retries: OptionalNullable[utils.RetryConfig] = UNSET, server_url: Optional[str] = None, timeout_ms: Optional[int] = None, + http_headers: Optional[Mapping[str, str]] = None, ) -> models.LimitResponse: r""" :param request: The request object to send. :param retries: Override the default retry configuration for this method :param server_url: Override the default server URL for this method :param timeout_ms: Override the default request timeout configuration for this method in milliseconds + :param http_headers: Additional headers to set or replace on requests. """ base_url = None url_variables = None @@ -155,12 +180,14 @@ async def limit_async( if server_url is not None: base_url = server_url + else: + base_url = self._get_url(base_url, url_variables) if not isinstance(request, BaseModel): request = utils.unmarshal(request, models.LimitRequestBody) request = cast(models.LimitRequestBody, request) - req = self.build_request_async( + req = self._build_request_async( method="POST", path="/v1/ratelimits.limit", base_url=base_url, @@ -171,6 +198,7 @@ async def limit_async( request_has_query_params=True, user_agent_header="user-agent", accept_header_value="application/json", + http_headers=http_headers, security=self.sdk_configuration.security, get_serialized_body=lambda: utils.serialize_request_body( request, False, False, "json", models.LimitRequestBody @@ -192,6 +220,7 @@ async def limit_async( http_res = await self.do_request_async( hook_ctx=HookContext( + base_url=base_url or "", operation_id="limit", oauth2_scopes=[], security_source=get_security_from_env( @@ -205,6 +234,7 @@ async def limit_async( "403", "404", "409", + "412", "429", "4XX", "500", @@ -213,7 +243,7 @@ async def limit_async( retry_config=retry_config, ) - data: Any = None + response_data: Any = None if utils.match_response(http_res, "200", "application/json"): return models.LimitResponse( object=utils.unmarshal_json( @@ -222,29 +252,45 @@ async def limit_async( http_meta=models.HTTPMetadata(request=req, response=http_res), ) if utils.match_response(http_res, "400", "application/json"): - data = utils.unmarshal_json(http_res.text, models.ErrBadRequestData) - raise models.ErrBadRequest(data=data) + response_data = utils.unmarshal_json( + http_res.text, models.ErrBadRequestData + ) + raise models.ErrBadRequest(data=response_data) if utils.match_response(http_res, "401", "application/json"): - data = utils.unmarshal_json(http_res.text, models.ErrUnauthorizedData) - raise models.ErrUnauthorized(data=data) + response_data = utils.unmarshal_json( + http_res.text, models.ErrUnauthorizedData + ) + raise models.ErrUnauthorized(data=response_data) if utils.match_response(http_res, "403", "application/json"): - data = utils.unmarshal_json(http_res.text, models.ErrForbiddenData) - raise models.ErrForbidden(data=data) + response_data = utils.unmarshal_json(http_res.text, models.ErrForbiddenData) + raise models.ErrForbidden(data=response_data) if utils.match_response(http_res, "404", "application/json"): - data = utils.unmarshal_json(http_res.text, models.ErrNotFoundData) - raise models.ErrNotFound(data=data) + response_data = utils.unmarshal_json(http_res.text, models.ErrNotFoundData) + raise models.ErrNotFound(data=response_data) if utils.match_response(http_res, "409", "application/json"): - data = utils.unmarshal_json(http_res.text, models.ErrConflictData) - raise models.ErrConflict(data=data) + response_data = utils.unmarshal_json(http_res.text, models.ErrConflictData) + raise models.ErrConflict(data=response_data) + if utils.match_response(http_res, "412", "application/json"): + response_data = utils.unmarshal_json( + http_res.text, models.ErrPreconditionFailedData + ) + raise models.ErrPreconditionFailed(data=response_data) if utils.match_response(http_res, "429", "application/json"): - data = utils.unmarshal_json(http_res.text, models.ErrTooManyRequestsData) - raise models.ErrTooManyRequests(data=data) + response_data = utils.unmarshal_json( + http_res.text, models.ErrTooManyRequestsData + ) + raise models.ErrTooManyRequests(data=response_data) if utils.match_response(http_res, "500", "application/json"): - data = utils.unmarshal_json( + response_data = utils.unmarshal_json( http_res.text, models.ErrInternalServerErrorData ) - raise models.ErrInternalServerError(data=data) - if utils.match_response(http_res, ["4XX", "5XX"], "*"): + raise models.ErrInternalServerError(data=response_data) + if utils.match_response(http_res, "4XX", "*"): + http_res_text = await utils.stream_to_text_async(http_res) + raise models.SDKError( + "API error occurred", http_res.status_code, http_res_text, http_res + ) + if utils.match_response(http_res, "5XX", "*"): http_res_text = await utils.stream_to_text_async(http_res) raise models.SDKError( "API error occurred", http_res.status_code, http_res_text, http_res @@ -268,12 +314,14 @@ def delete_override( retries: OptionalNullable[utils.RetryConfig] = UNSET, server_url: Optional[str] = None, timeout_ms: Optional[int] = None, + http_headers: Optional[Mapping[str, str]] = None, ) -> models.DeleteOverrideResponse: r""" :param request: The request object to send. :param retries: Override the default retry configuration for this method :param server_url: Override the default server URL for this method :param timeout_ms: Override the default request timeout configuration for this method in milliseconds + :param http_headers: Additional headers to set or replace on requests. """ base_url = None url_variables = None @@ -282,12 +330,14 @@ def delete_override( if server_url is not None: base_url = server_url + else: + base_url = self._get_url(base_url, url_variables) if not isinstance(request, BaseModel): request = utils.unmarshal(request, models.DeleteOverrideRequestBody) request = cast(models.DeleteOverrideRequestBody, request) - req = self.build_request( + req = self._build_request( method="POST", path="/v1/ratelimits.deleteOverride", base_url=base_url, @@ -298,6 +348,7 @@ def delete_override( request_has_query_params=True, user_agent_header="user-agent", accept_header_value="application/json", + http_headers=http_headers, security=self.sdk_configuration.security, get_serialized_body=lambda: utils.serialize_request_body( request, False, False, "json", models.DeleteOverrideRequestBody @@ -319,6 +370,7 @@ def delete_override( http_res = self.do_request( hook_ctx=HookContext( + base_url=base_url or "", operation_id="deleteOverride", oauth2_scopes=[], security_source=get_security_from_env( @@ -332,6 +384,7 @@ def delete_override( "403", "404", "409", + "412", "429", "4XX", "500", @@ -340,7 +393,7 @@ def delete_override( retry_config=retry_config, ) - data: Any = None + response_data: Any = None if utils.match_response(http_res, "200", "application/json"): return models.DeleteOverrideResponse( object=utils.unmarshal_json( @@ -349,29 +402,45 @@ def delete_override( http_meta=models.HTTPMetadata(request=req, response=http_res), ) if utils.match_response(http_res, "400", "application/json"): - data = utils.unmarshal_json(http_res.text, models.ErrBadRequestData) - raise models.ErrBadRequest(data=data) + response_data = utils.unmarshal_json( + http_res.text, models.ErrBadRequestData + ) + raise models.ErrBadRequest(data=response_data) if utils.match_response(http_res, "401", "application/json"): - data = utils.unmarshal_json(http_res.text, models.ErrUnauthorizedData) - raise models.ErrUnauthorized(data=data) + response_data = utils.unmarshal_json( + http_res.text, models.ErrUnauthorizedData + ) + raise models.ErrUnauthorized(data=response_data) if utils.match_response(http_res, "403", "application/json"): - data = utils.unmarshal_json(http_res.text, models.ErrForbiddenData) - raise models.ErrForbidden(data=data) + response_data = utils.unmarshal_json(http_res.text, models.ErrForbiddenData) + raise models.ErrForbidden(data=response_data) if utils.match_response(http_res, "404", "application/json"): - data = utils.unmarshal_json(http_res.text, models.ErrNotFoundData) - raise models.ErrNotFound(data=data) + response_data = utils.unmarshal_json(http_res.text, models.ErrNotFoundData) + raise models.ErrNotFound(data=response_data) if utils.match_response(http_res, "409", "application/json"): - data = utils.unmarshal_json(http_res.text, models.ErrConflictData) - raise models.ErrConflict(data=data) + response_data = utils.unmarshal_json(http_res.text, models.ErrConflictData) + raise models.ErrConflict(data=response_data) + if utils.match_response(http_res, "412", "application/json"): + response_data = utils.unmarshal_json( + http_res.text, models.ErrPreconditionFailedData + ) + raise models.ErrPreconditionFailed(data=response_data) if utils.match_response(http_res, "429", "application/json"): - data = utils.unmarshal_json(http_res.text, models.ErrTooManyRequestsData) - raise models.ErrTooManyRequests(data=data) + response_data = utils.unmarshal_json( + http_res.text, models.ErrTooManyRequestsData + ) + raise models.ErrTooManyRequests(data=response_data) if utils.match_response(http_res, "500", "application/json"): - data = utils.unmarshal_json( + response_data = utils.unmarshal_json( http_res.text, models.ErrInternalServerErrorData ) - raise models.ErrInternalServerError(data=data) - if utils.match_response(http_res, ["4XX", "5XX"], "*"): + raise models.ErrInternalServerError(data=response_data) + if utils.match_response(http_res, "4XX", "*"): + http_res_text = utils.stream_to_text(http_res) + raise models.SDKError( + "API error occurred", http_res.status_code, http_res_text, http_res + ) + if utils.match_response(http_res, "5XX", "*"): http_res_text = utils.stream_to_text(http_res) raise models.SDKError( "API error occurred", http_res.status_code, http_res_text, http_res @@ -395,12 +464,14 @@ async def delete_override_async( retries: OptionalNullable[utils.RetryConfig] = UNSET, server_url: Optional[str] = None, timeout_ms: Optional[int] = None, + http_headers: Optional[Mapping[str, str]] = None, ) -> models.DeleteOverrideResponse: r""" :param request: The request object to send. :param retries: Override the default retry configuration for this method :param server_url: Override the default server URL for this method :param timeout_ms: Override the default request timeout configuration for this method in milliseconds + :param http_headers: Additional headers to set or replace on requests. """ base_url = None url_variables = None @@ -409,12 +480,14 @@ async def delete_override_async( if server_url is not None: base_url = server_url + else: + base_url = self._get_url(base_url, url_variables) if not isinstance(request, BaseModel): request = utils.unmarshal(request, models.DeleteOverrideRequestBody) request = cast(models.DeleteOverrideRequestBody, request) - req = self.build_request_async( + req = self._build_request_async( method="POST", path="/v1/ratelimits.deleteOverride", base_url=base_url, @@ -425,6 +498,7 @@ async def delete_override_async( request_has_query_params=True, user_agent_header="user-agent", accept_header_value="application/json", + http_headers=http_headers, security=self.sdk_configuration.security, get_serialized_body=lambda: utils.serialize_request_body( request, False, False, "json", models.DeleteOverrideRequestBody @@ -446,6 +520,7 @@ async def delete_override_async( http_res = await self.do_request_async( hook_ctx=HookContext( + base_url=base_url or "", operation_id="deleteOverride", oauth2_scopes=[], security_source=get_security_from_env( @@ -459,6 +534,7 @@ async def delete_override_async( "403", "404", "409", + "412", "429", "4XX", "500", @@ -467,7 +543,7 @@ async def delete_override_async( retry_config=retry_config, ) - data: Any = None + response_data: Any = None if utils.match_response(http_res, "200", "application/json"): return models.DeleteOverrideResponse( object=utils.unmarshal_json( @@ -476,29 +552,45 @@ async def delete_override_async( http_meta=models.HTTPMetadata(request=req, response=http_res), ) if utils.match_response(http_res, "400", "application/json"): - data = utils.unmarshal_json(http_res.text, models.ErrBadRequestData) - raise models.ErrBadRequest(data=data) + response_data = utils.unmarshal_json( + http_res.text, models.ErrBadRequestData + ) + raise models.ErrBadRequest(data=response_data) if utils.match_response(http_res, "401", "application/json"): - data = utils.unmarshal_json(http_res.text, models.ErrUnauthorizedData) - raise models.ErrUnauthorized(data=data) + response_data = utils.unmarshal_json( + http_res.text, models.ErrUnauthorizedData + ) + raise models.ErrUnauthorized(data=response_data) if utils.match_response(http_res, "403", "application/json"): - data = utils.unmarshal_json(http_res.text, models.ErrForbiddenData) - raise models.ErrForbidden(data=data) + response_data = utils.unmarshal_json(http_res.text, models.ErrForbiddenData) + raise models.ErrForbidden(data=response_data) if utils.match_response(http_res, "404", "application/json"): - data = utils.unmarshal_json(http_res.text, models.ErrNotFoundData) - raise models.ErrNotFound(data=data) + response_data = utils.unmarshal_json(http_res.text, models.ErrNotFoundData) + raise models.ErrNotFound(data=response_data) if utils.match_response(http_res, "409", "application/json"): - data = utils.unmarshal_json(http_res.text, models.ErrConflictData) - raise models.ErrConflict(data=data) + response_data = utils.unmarshal_json(http_res.text, models.ErrConflictData) + raise models.ErrConflict(data=response_data) + if utils.match_response(http_res, "412", "application/json"): + response_data = utils.unmarshal_json( + http_res.text, models.ErrPreconditionFailedData + ) + raise models.ErrPreconditionFailed(data=response_data) if utils.match_response(http_res, "429", "application/json"): - data = utils.unmarshal_json(http_res.text, models.ErrTooManyRequestsData) - raise models.ErrTooManyRequests(data=data) + response_data = utils.unmarshal_json( + http_res.text, models.ErrTooManyRequestsData + ) + raise models.ErrTooManyRequests(data=response_data) if utils.match_response(http_res, "500", "application/json"): - data = utils.unmarshal_json( + response_data = utils.unmarshal_json( http_res.text, models.ErrInternalServerErrorData ) - raise models.ErrInternalServerError(data=data) - if utils.match_response(http_res, ["4XX", "5XX"], "*"): + raise models.ErrInternalServerError(data=response_data) + if utils.match_response(http_res, "4XX", "*"): + http_res_text = await utils.stream_to_text_async(http_res) + raise models.SDKError( + "API error occurred", http_res.status_code, http_res_text, http_res + ) + if utils.match_response(http_res, "5XX", "*"): http_res_text = await utils.stream_to_text_async(http_res) raise models.SDKError( "API error occurred", http_res.status_code, http_res_text, http_res diff --git a/src/unkey_py/sdk.py b/src/unkey_py/sdk.py index 2b7cf83..e372c5b 100644 --- a/src/unkey_py/sdk.py +++ b/src/unkey_py/sdk.py @@ -1,14 +1,15 @@ """Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT.""" from .basesdk import BaseSDK -from .httpclient import AsyncHttpClient, HttpClient +from .httpclient import AsyncHttpClient, ClientOwner, HttpClient, close_clients from .sdkconfiguration import SDKConfiguration from .utils.logger import Logger, get_default_logger from .utils.retries import RetryConfig import httpx -from typing import Any, Callable, Dict, Optional, Union +from typing import Any, Callable, Dict, Optional, Union, cast from unkey_py import models, utils from unkey_py._hooks import SDKHooks +from unkey_py.analytics import Analytics from unkey_py.apis import Apis from unkey_py.identities import Identities from unkey_py.keys import Keys @@ -18,6 +19,7 @@ from unkey_py.ratelimit import Ratelimit from unkey_py.ratelimits import Ratelimits from unkey_py.types import OptionalNullable, UNSET +import weakref class Unkey(BaseSDK): @@ -29,6 +31,7 @@ class Unkey(BaseSDK): migrations: Migrations permissions: Permissions identities: Identities + analytics: Analytics def __init__( self, @@ -53,15 +56,19 @@ def __init__( :param retry_config: The retry configuration to use for all supported methods :param timeout_ms: Optional request timeout applied to each operation in milliseconds """ + client_supplied = True if client is None: client = httpx.Client() + client_supplied = False assert issubclass( type(client), HttpClient ), "The provided client must implement the HttpClient protocol." + async_client_supplied = True if async_client is None: async_client = httpx.AsyncClient() + async_client_supplied = False if debug_logger is None: debug_logger = get_default_logger() @@ -72,7 +79,8 @@ def __init__( security: Any = None if callable(bearer_auth): - security = lambda: models.Security(bearer_auth=bearer_auth()) # pylint: disable=unnecessary-lambda-assignment + # pylint: disable=unnecessary-lambda-assignment + security = lambda: models.Security(bearer_auth=bearer_auth()) else: security = models.Security(bearer_auth=bearer_auth) @@ -84,7 +92,9 @@ def __init__( self, SDKConfiguration( client=client, + client_supplied=client_supplied, async_client=async_client, + async_client_supplied=async_client_supplied, security=security, server_url=server_url, server_idx=server_idx, @@ -98,7 +108,7 @@ def __init__( current_server_url, *_ = self.sdk_configuration.get_server_details() server_url, self.sdk_configuration.client = hooks.sdk_init( - current_server_url, self.sdk_configuration.client + current_server_url, client ) if current_server_url != server_url: self.sdk_configuration.server_url = server_url @@ -106,6 +116,16 @@ def __init__( # pylint: disable=protected-access self.sdk_configuration.__dict__["_hooks"] = hooks + weakref.finalize( + self, + close_clients, + cast(ClientOwner, self.sdk_configuration), + self.sdk_configuration.client, + self.sdk_configuration.client_supplied, + self.sdk_configuration.async_client, + self.sdk_configuration.async_client_supplied, + ) + self._init_sdks() def _init_sdks(self): @@ -117,6 +137,7 @@ def _init_sdks(self): self.migrations = Migrations(self.sdk_configuration) self.permissions = Permissions(self.sdk_configuration) self.identities = Identities(self.sdk_configuration) + self.analytics = Analytics(self.sdk_configuration) def __enter__(self): return self @@ -125,9 +146,17 @@ async def __aenter__(self): return self def __exit__(self, exc_type, exc_val, exc_tb): - if self.sdk_configuration.client is not None: + if ( + self.sdk_configuration.client is not None + and not self.sdk_configuration.client_supplied + ): self.sdk_configuration.client.close() + self.sdk_configuration.client = None async def __aexit__(self, exc_type, exc_val, exc_tb): - if self.sdk_configuration.async_client is not None: + if ( + self.sdk_configuration.async_client is not None + and not self.sdk_configuration.async_client_supplied + ): await self.sdk_configuration.async_client.aclose() + self.sdk_configuration.async_client = None diff --git a/src/unkey_py/sdkconfiguration.py b/src/unkey_py/sdkconfiguration.py index 74075e3..270e8dd 100644 --- a/src/unkey_py/sdkconfiguration.py +++ b/src/unkey_py/sdkconfiguration.py @@ -1,6 +1,12 @@ """Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT.""" from ._hooks import SDKHooks +from ._version import ( + __gen_version__, + __openapi_doc_version__, + __user_agent__, + __version__, +) from .httpclient import AsyncHttpClient, HttpClient from .utils import Logger, RetryConfig, remove_suffix from dataclasses import dataclass @@ -19,17 +25,19 @@ @dataclass class SDKConfiguration: - client: HttpClient - async_client: AsyncHttpClient + client: Union[HttpClient, None] + client_supplied: bool + async_client: Union[AsyncHttpClient, None] + async_client_supplied: bool debug_logger: Logger security: Optional[Union[models.Security, Callable[[], models.Security]]] = None server_url: Optional[str] = "" server_idx: Optional[int] = 0 language: str = "python" - openapi_doc_version: str = "1.0.0" - sdk_version: str = "0.9.0" - gen_version: str = "2.474.6" - user_agent: str = "speakeasy-sdk/python 0.9.0 2.474.6 1.0.0 unkey.py" + openapi_doc_version: str = __openapi_doc_version__ + sdk_version: str = __version__ + gen_version: str = __gen_version__ + user_agent: str = __user_agent__ retry_config: OptionalNullable[RetryConfig] = Field(default_factory=lambda: UNSET) timeout_ms: Optional[int] = None diff --git a/src/unkey_py/types/basemodel.py b/src/unkey_py/types/basemodel.py index a6187ef..231c2e3 100644 --- a/src/unkey_py/types/basemodel.py +++ b/src/unkey_py/types/basemodel.py @@ -2,7 +2,7 @@ from pydantic import ConfigDict, model_serializer from pydantic import BaseModel as PydanticBaseModel -from typing import TYPE_CHECKING, Literal, Optional, TypeVar, Union, NewType +from typing import TYPE_CHECKING, Literal, Optional, TypeVar, Union from typing_extensions import TypeAliasType, TypeAlias @@ -35,5 +35,5 @@ def __bool__(self) -> Literal[False]: "OptionalNullable", Union[Optional[Nullable[T]], Unset], type_params=(T,) ) -UnrecognizedInt = NewType("UnrecognizedInt", int) -UnrecognizedStr = NewType("UnrecognizedStr", str) +UnrecognizedInt: TypeAlias = int +UnrecognizedStr: TypeAlias = str diff --git a/src/unkey_py/utils/__init__.py b/src/unkey_py/utils/__init__.py index 151c87d..94dd31a 100644 --- a/src/unkey_py/utils/__init__.py +++ b/src/unkey_py/utils/__init__.py @@ -1,6 +1,7 @@ """Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT.""" from .annotations import get_discriminator +from .datetimes import parse_datetime from .enums import OpenEnumMeta from .headers import get_headers, get_response_headers from .metadata import ( @@ -43,6 +44,7 @@ match_content_type, match_status_codes, match_response, + cast_partial, ) from .logger import Logger, get_body_content, get_default_logger @@ -96,4 +98,5 @@ "validate_float", "validate_int", "validate_open_enum", + "cast_partial", ] diff --git a/src/unkey_py/utils/datetimes.py b/src/unkey_py/utils/datetimes.py new file mode 100644 index 0000000..a6c52cd --- /dev/null +++ b/src/unkey_py/utils/datetimes.py @@ -0,0 +1,23 @@ +"""Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT.""" + +from datetime import datetime +import sys + + +def parse_datetime(datetime_string: str) -> datetime: + """ + Convert a RFC 3339 / ISO 8601 formatted string into a datetime object. + Python versions 3.11 and later support parsing RFC 3339 directly with + datetime.fromisoformat(), but for earlier versions, this function + encapsulates the necessary extra logic. + """ + # Python 3.11 and later can parse RFC 3339 directly + if sys.version_info >= (3, 11): + return datetime.fromisoformat(datetime_string) + + # For Python 3.10 and earlier, a common ValueError is trailing 'Z' suffix, + # so fix that upfront. + if datetime_string.endswith("Z"): + datetime_string = datetime_string[:-1] + "+00:00" + + return datetime.fromisoformat(datetime_string) diff --git a/src/unkey_py/utils/enums.py b/src/unkey_py/utils/enums.py index c650b10..c3bc13c 100644 --- a/src/unkey_py/utils/enums.py +++ b/src/unkey_py/utils/enums.py @@ -1,34 +1,74 @@ """Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT.""" import enum - +import sys class OpenEnumMeta(enum.EnumMeta): - def __call__( - cls, value, names=None, *, module=None, qualname=None, type=None, start=1 - ): - # The `type` kwarg also happens to be a built-in that pylint flags as - # redeclared. Safe to ignore this lint rule with this scope. - # pylint: disable=redefined-builtin + # The __call__ method `boundary` kwarg was added in 3.11 and must be present + # for pyright. Refer also: https://github.com/pylint-dev/pylint/issues/9622 + # pylint: disable=unexpected-keyword-arg + # The __call__ method `values` varg must be named for pyright. + # pylint: disable=keyword-arg-before-vararg + + if sys.version_info >= (3, 11): + def __call__( + cls, value, names=None, *values, module=None, qualname=None, type=None, start=1, boundary=None + ): + # The `type` kwarg also happens to be a built-in that pylint flags as + # redeclared. Safe to ignore this lint rule with this scope. + # pylint: disable=redefined-builtin + + if names is not None: + return super().__call__( + value, + names=names, + *values, + module=module, + qualname=qualname, + type=type, + start=start, + boundary=boundary, + ) + + try: + return super().__call__( + value, + names=names, # pyright: ignore[reportArgumentType] + *values, + module=module, + qualname=qualname, + type=type, + start=start, + boundary=boundary, + ) + except ValueError: + return value + else: + def __call__( + cls, value, names=None, *, module=None, qualname=None, type=None, start=1 + ): + # The `type` kwarg also happens to be a built-in that pylint flags as + # redeclared. Safe to ignore this lint rule with this scope. + # pylint: disable=redefined-builtin - if names is not None: - return super().__call__( - value, - names=names, - module=module, - qualname=qualname, - type=type, - start=start, - ) + if names is not None: + return super().__call__( + value, + names=names, + module=module, + qualname=qualname, + type=type, + start=start, + ) - try: - return super().__call__( - value, - names=names, # pyright: ignore[reportArgumentType] - module=module, - qualname=qualname, - type=type, - start=start, - ) - except ValueError: - return value + try: + return super().__call__( + value, + names=names, # pyright: ignore[reportArgumentType] + module=module, + qualname=qualname, + type=type, + start=start, + ) + except ValueError: + return value diff --git a/src/unkey_py/utils/forms.py b/src/unkey_py/utils/forms.py index 9f5a731..0472aba 100644 --- a/src/unkey_py/utils/forms.py +++ b/src/unkey_py/utils/forms.py @@ -109,13 +109,12 @@ def serialize_multipart_form( if not field_metadata: continue - f_name = field.alias if field.alias is not None else name + f_name = field.alias if field.alias else name if field_metadata.file: file_fields: Dict[str, FieldInfo] = val.__class__.model_fields file_name = "" - field_name = "" content = None content_type = None @@ -131,20 +130,15 @@ def serialize_multipart_form( elif file_field_name == "content_type": content_type = getattr(val, file_field_name, None) else: - field_name = ( - file_field.alias - if file_field.alias is not None - else file_field_name - ) file_name = getattr(val, file_field_name) - if field_name == "" or file_name == "" or content is None: + if file_name == "" or content is None: raise ValueError("invalid multipart/form-data file") if content_type is not None: - files[field_name] = (file_name, content, content_type) + files[f_name] = (file_name, content, content_type) else: - files[field_name] = (file_name, content) + files[f_name] = (file_name, content) elif field_metadata.json: files[f_name] = ( None, diff --git a/src/unkey_py/utils/serializers.py b/src/unkey_py/utils/serializers.py index c5eb365..76e44d7 100644 --- a/src/unkey_py/utils/serializers.py +++ b/src/unkey_py/utils/serializers.py @@ -1,20 +1,24 @@ """Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT.""" from decimal import Decimal +import functools import json -from typing import Any, Dict, List, Union, get_args -import httpx +import typing +from typing import Any, Dict, List, Tuple, Union, get_args +import typing_extensions from typing_extensions import get_origin + +import httpx from pydantic import ConfigDict, create_model from pydantic_core import from_json -from typing_inspect import is_optional_type from ..types.basemodel import BaseModel, Nullable, OptionalNullable, Unset def serialize_decimal(as_str: bool): def serialize(d): - if is_optional_type(type(d)) and d is None: + # Optional[T] is a Union[T, None] + if is_union(type(d)) and type(None) in get_args(type(d)) and d is None: return None if isinstance(d, Unset): return d @@ -42,7 +46,8 @@ def validate_decimal(d): def serialize_float(as_str: bool): def serialize(f): - if is_optional_type(type(f)) and f is None: + # Optional[T] is a Union[T, None] + if is_union(type(f)) and type(None) in get_args(type(f)) and f is None: return None if isinstance(f, Unset): return f @@ -70,7 +75,8 @@ def validate_float(f): def serialize_int(as_str: bool): def serialize(i): - if is_optional_type(type(i)) and i is None: + # Optional[T] is a Union[T, None] + if is_union(type(i)) and type(None) in get_args(type(i)) and i is None: return None if isinstance(i, Unset): return i @@ -118,7 +124,8 @@ def validate(e): def validate_const(v): def validate(c): - if is_optional_type(type(c)) and c is None: + # Optional[T] is a Union[T, None] + if is_union(type(c)) and type(None) in get_args(type(c)) and c is None: return None if v != c: @@ -163,7 +170,7 @@ def marshal_json(val, typ): if len(d) == 0: return "" - return json.dumps(d[next(iter(d))], separators=(",", ":"), sort_keys=True) + return json.dumps(d[next(iter(d))], separators=(",", ":")) def is_nullable(field): @@ -181,6 +188,13 @@ def is_nullable(field): return False +def is_union(obj: object) -> bool: + """ + Returns True if the given object is a typing.Union or typing_extensions.Union. + """ + return any(obj is typing_obj for typing_obj in _get_typing_objects_by_name_of("Union")) + + def stream_to_text(stream: httpx.Response) -> str: return "".join(stream.iter_text()) @@ -213,3 +227,22 @@ def _contains_pydantic_model(data: Any) -> bool: return any(_contains_pydantic_model(value) for value in data.values()) return False + + +@functools.cache +def _get_typing_objects_by_name_of(name: str) -> Tuple[Any, ...]: + """ + Get typing objects by name from typing and typing_extensions. + Reference: https://typing-extensions.readthedocs.io/en/latest/#runtime-use-of-types + """ + result = tuple( + getattr(module, name) + for module in (typing, typing_extensions) + if hasattr(module, name) + ) + if not result: + raise ValueError( + f"Neither typing nor typing_extensions has an object called {name!r}" + ) + return result + diff --git a/src/unkey_py/utils/values.py b/src/unkey_py/utils/values.py index 2b4b683..dae01a4 100644 --- a/src/unkey_py/utils/values.py +++ b/src/unkey_py/utils/values.py @@ -3,8 +3,9 @@ from datetime import datetime from enum import Enum from email.message import Message +from functools import partial import os -from typing import Any, Callable, Dict, List, Optional, Tuple, TypeVar, Union +from typing import Any, Callable, Dict, List, Optional, Tuple, TypeVar, Union, cast from httpx import Response from pydantic import BaseModel @@ -51,6 +52,8 @@ def match_status_codes(status_codes: List[str], status_code: int) -> bool: T = TypeVar("T") +def cast_partial(typ): + return partial(cast, typ) def get_global_from_env( value: Optional[T], env_key: str, type_cast: Callable[[str], T]