Skip to content

Latest commit

 

History

History
222 lines (155 loc) · 13.4 KB

README.md

File metadata and controls

222 lines (155 loc) · 13.4 KB

PolarLicenseKeys

(users.license_keys)

Overview

Available Operations

list

List License Keys

Example Usage

from polar_sdk import Polar

with Polar(
    access_token="<YOUR_BEARER_TOKEN_HERE>",
) as s:
    res = s.users.license_keys.list()

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

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

Parameters

Parameter Type Required Description
organization_id OptionalNullable[models.UsersLicenseKeysListQueryParamOrganizationIDFilter] Filter by organization ID.
benefit_id OptionalNullable[str] Filter by a specific benefit
page Optional[int] Page number, defaults to 1.
limit Optional[int] Size of a page, defaults to 10. Maximum is 100.
retries Optional[utils.RetryConfig] Configuration to override the default retry behavior of the client.

Response

models.UsersLicenseKeysListResponse

Errors

Error Type Status Code Content Type
models.Unauthorized 401 application/json
models.ResourceNotFound 404 application/json
models.HTTPValidationError 422 application/json
models.SDKError 4XX, 5XX */*

get

Get a license key.

Example Usage

from polar_sdk import Polar

with Polar(
    access_token="<YOUR_BEARER_TOKEN_HERE>",
) as s:
    res = s.users.license_keys.get(id="<value>")

    if res is not None:
        # handle response
        pass

Parameters

Parameter Type Required Description
id str ✔️ N/A
retries Optional[utils.RetryConfig] Configuration to override the default retry behavior of the client.

Response

models.LicenseKeyWithActivations

Errors

Error Type Status Code Content Type
models.Unauthorized 401 application/json
models.ResourceNotFound 404 application/json
models.HTTPValidationError 422 application/json
models.SDKError 4XX, 5XX */*

validate

Validate a license key.

Example Usage

from polar_sdk import Polar

with Polar(
    access_token="<YOUR_BEARER_TOKEN_HERE>",
) as s:
    res = s.users.license_keys.validate(request={
        "key": "<key>",
        "organization_id": "<value>",
    })

    if res is not None:
        # handle response
        pass

Parameters

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

Response

models.ValidatedLicenseKey

Errors

Error Type Status Code Content Type
models.ResourceNotFound 404 application/json
models.HTTPValidationError 422 application/json
models.SDKError 4XX, 5XX */*

activate

Activate a license key instance.

Example Usage

from polar_sdk import Polar

with Polar(
    access_token="<YOUR_BEARER_TOKEN_HERE>",
) as s:
    res = s.users.license_keys.activate(request={
        "key": "<key>",
        "organization_id": "<value>",
        "label": "<value>",
    })

    if res is not None:
        # handle response
        pass

Parameters

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

Response

models.LicenseKeyActivationRead

Errors

Error Type Status Code Content Type
models.NotPermitted 403 application/json
models.ResourceNotFound 404 application/json
models.HTTPValidationError 422 application/json
models.SDKError 4XX, 5XX */*

deactivate

Deactivate a license key instance.

Example Usage

from polar_sdk import Polar

with Polar(
    access_token="<YOUR_BEARER_TOKEN_HERE>",
) as s:
    s.users.license_keys.deactivate(request={
        "key": "<key>",
        "organization_id": "<value>",
        "activation_id": "<value>",
    })

    # Use the SDK ...

Parameters

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

Errors

Error Type Status Code Content Type
models.ResourceNotFound 404 application/json
models.HTTPValidationError 422 application/json
models.SDKError 4XX, 5XX */*