Skip to content

Latest commit

 

History

History
159 lines (107 loc) · 17.8 KB

File metadata and controls

159 lines (107 loc) · 17.8 KB

PolarBenefitGrants

(customer_portal.benefit_grants)

Overview

Available Operations

  • list - List Benefit Grants
  • get - Get Benefit Grant
  • update - Update Benefit Grant

list

List benefits grants of the authenticated customer.

Scopes: customer_portal:read customer_portal:write

Example Usage

import polar_sdk
from polar_sdk import Polar


with Polar() as polar:

    res = polar.customer_portal.benefit_grants.list(security=polar_sdk.CustomerPortalBenefitGrantsListSecurity(
        customer_session="<YOUR_BEARER_TOKEN_HERE>",
    ), page=1, limit=10)

    while res is not None:
        # Handle items

        res = res.next()

Parameters

Parameter Type Required Description
security models.CustomerPortalBenefitGrantsListSecurity ✔️ N/A
query OptionalNullable[str] Filter by benefit description.
type_filter OptionalNullable[models.QueryParamBenefitTypeFilter] Filter by benefit type.
benefit_id OptionalNullable[models.CustomerPortalBenefitGrantsListQueryParamBenefitIDFilter] Filter by benefit ID.
checkout_id OptionalNullable[models.QueryParamCheckoutIDFilter] Filter by checkout ID.
order_id OptionalNullable[models.CustomerPortalBenefitGrantsListQueryParamOrderIDFilter] Filter by order ID.
subscription_id OptionalNullable[models.CustomerPortalBenefitGrantsListQueryParamSubscriptionIDFilter] Filter by subscription ID.
member_id OptionalNullable[models.QueryParamMemberIDFilter] Filter by member ID.
page Optional[int] Page number, defaults to 1.
limit Optional[int] Size of a page, defaults to 10. Maximum is 100.
sorting List[models.CustomerBenefitGrantSortProperty] Sorting criterion. Several criteria can be used simultaneously and will be applied in order. Add a minus sign - before the criteria name to sort by descending order.
retries Optional[utils.RetryConfig] Configuration to override the default retry behavior of the client.

Response

models.CustomerPortalBenefitGrantsListResponse

Errors

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

get

Get a benefit grant by ID for the authenticated customer.

Scopes: customer_portal:read customer_portal:write

Example Usage

import polar_sdk
from polar_sdk import Polar


with Polar() as polar:

    res = polar.customer_portal.benefit_grants.get(security=polar_sdk.CustomerPortalBenefitGrantsGetSecurity(
        customer_session="<YOUR_BEARER_TOKEN_HERE>",
    ), id="<value>")

    # Handle response
    print(res)

Parameters

Parameter Type Required Description
security models.CustomerPortalBenefitGrantsGetSecurity ✔️ N/A
id str ✔️ The benefit grant ID.
retries Optional[utils.RetryConfig] Configuration to override the default retry behavior of the client.

Response

models.CustomerBenefitGrant

Errors

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

update

Update a benefit grant for the authenticated customer.

Scopes: customer_portal:write

Example Usage

import polar_sdk
from polar_sdk import Polar


with Polar() as polar:

    res = polar.customer_portal.benefit_grants.update(security=polar_sdk.CustomerPortalBenefitGrantsUpdateSecurity(
        customer_session="<YOUR_BEARER_TOKEN_HERE>",
    ), id="<value>", customer_benefit_grant_update={
        "benefit_type": "license_keys",
    })

    # Handle response
    print(res)

Parameters

Parameter Type Required Description
security models.CustomerPortalBenefitGrantsUpdateSecurity ✔️ N/A
id str ✔️ The benefit grant ID.
customer_benefit_grant_update models.CustomerBenefitGrantUpdate ✔️ N/A
retries Optional[utils.RetryConfig] Configuration to override the default retry behavior of the client.

Response

models.CustomerBenefitGrant

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 */*