Skip to content

Latest commit

 

History

History
265 lines (201 loc) · 15.2 KB

README.md

File metadata and controls

265 lines (201 loc) · 15.2 KB

Identities

(identities)

Overview

Available Operations

create

Example Usage

from unkey_py import Unkey

with Unkey(
    bearer_auth="UNKEY_ROOT_KEY",
) as s:
    res = s.identities.create(request={
        "external_id": "user_123",
        "ratelimits": [
            {
                "name": "tokens",
                "limit": 10,
                "duration": 1000,
            },
            {
                "name": "tokens",
                "limit": 10,
                "duration": 1000,
            },
        ],
    })

    if res.object is not None:
        # handle response
        pass

Parameters

Parameter Type Required Description
request models.CreateIdentityRequestBody ✔️ The request object to use for the request.
retries Optional[utils.RetryConfig] Configuration to override the default retry behavior of the client.

Response

models.CreateIdentityResponse

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.ErrTooManyRequests 429 application/json
models.ErrInternalServerError 500 application/json
models.SDKError 4XX, 5XX */*

get

Example Usage

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")

    if res.object is not None:
        # handle response
        pass

Parameters

Parameter Type Required Description Example
identity_id Optional[str] N/A id_1234
external_id Optional[str] N/A id_1234
retries Optional[utils.RetryConfig] Configuration to override the default retry behavior of the client.

Response

models.GetIdentityResponse

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.ErrTooManyRequests 429 application/json
models.ErrInternalServerError 500 application/json
models.SDKError 4XX, 5XX */*

list

Example Usage

from unkey_py import Unkey

with Unkey(
    bearer_auth="UNKEY_ROOT_KEY",
) as s:
    res = s.identities.list(limit=100)

    if res.object is not None:
        while True:
            # handle items

            res = res.next()
            if res is None:
                break

Parameters

Parameter Type Required Description Example
environment Optional[str] N/A
limit Optional[int] N/A 100
cursor Optional[str] N/A
retries Optional[utils.RetryConfig] Configuration to override the default retry behavior of the client.

Response

models.ListIdentitiesResponse

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.ErrTooManyRequests 429 application/json
models.ErrInternalServerError 500 application/json
models.SDKError 4XX, 5XX */*

update

Example Usage

from unkey_py import Unkey

with Unkey(
    bearer_auth="UNKEY_ROOT_KEY",
) as s:
    res = s.identities.update(request={
        "identity_id": "id_1234",
        "external_id": "user_1234",
        "ratelimits": [
            {
                "name": "tokens",
                "limit": 10,
                "duration": 1000,
            },
            {
                "name": "tokens",
                "limit": 10,
                "duration": 1000,
            },
            {
                "name": "tokens",
                "limit": 10,
                "duration": 1000,
            },
        ],
    })

    if res.object is not None:
        # handle response
        pass

Parameters

Parameter Type Required Description
request models.UpdateIdentityRequestBody ✔️ The request object to use for the request.
retries Optional[utils.RetryConfig] Configuration to override the default retry behavior of the client.

Response

models.UpdateIdentityResponse

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.ErrTooManyRequests 429 application/json
models.ErrInternalServerError 500 application/json
models.SDKError 4XX, 5XX */*

delete

Example Usage

from unkey_py import Unkey

with Unkey(
    bearer_auth="UNKEY_ROOT_KEY",
) as s:
    res = s.identities.delete(request={
        "identity_id": "id_1234",
    })

    if res.object is not None:
        # handle response
        pass

Parameters

Parameter Type Required Description
request models.DeleteIdentityRequestBody ✔️ The request object to use for the request.
retries Optional[utils.RetryConfig] Configuration to override the default retry behavior of the client.

Response

models.DeleteIdentityResponse

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.ErrTooManyRequests 429 application/json
models.ErrInternalServerError 500 application/json
models.SDKError 4XX, 5XX */*