Polar::Api::Benefits
API client for benefits operations
Constants
Constructors
Creates a new Benefits instance
@param client [Client] The Polar API client instance
Instance methods
Create Benefit
Create a benefit.
Scopes: benefits:write
Endpoint: POST /v1/benefits/
Parameters:
body(required): Request body as Polar::Models::BenefitCreate
Returns: Polar::Models::Benefit
Raises:
ResourceNotFoundErroron 404NotPermittedErroron 403HTTPValidationErroron 422PolarErroron other errors
Delete Benefit
Delete a benefit.
[!WARNING] Every grants associated with the benefit will be revoked. Users will lose access to the benefit.
Scopes: benefits:write
Endpoint: DELETE /v1/benefits/{id}
Parameters:
id(required): Path parameter
Returns: JSON response string
Raises:
ResourceNotFoundErroron 404NotPermittedErroron 403HTTPValidationErroron 422PolarErroron other errors
Get Benefit
Get a benefit by ID.
Scopes: benefits:read benefits:write
Endpoint: GET /v1/benefits/{id}
Parameters:
id(required): Path parameter
Returns: Polar::Models::Benefit
Raises:
ResourceNotFoundErroron 404NotPermittedErroron 403HTTPValidationErroron 422PolarErroron other errors
List Benefit Grants
List the individual grants for a benefit.
It's especially useful to check if a user has been granted a benefit.
Scopes: benefits:read benefits:write
Endpoint: GET /v1/benefits/{id}/grants
Parameters:
id(required): Path parameteris_granted(optional): Filter by granted status. If true, only granted benefits will be returned. If false, only revoked benefits will be returned.customer_id(optional): Filter by customer.page(optional): Page number, defaults to 1.limit(optional): Size of a page, defaults to 10. Maximum is 100.
Returns: Polar::Models::ListResource(Polar::Models::BenefitGrant)
Raises:
ResourceNotFoundErroron 404NotPermittedErroron 403HTTPValidationErroron 422PolarErroron other errors
List Benefits
List benefits.
Scopes: benefits:read benefits:write
Endpoint: GET /v1/benefits/
Parameters:
organization_id(optional): Filter by organization ID.type(optional): Filter by benefit type.query(optional): Filter by description.page(optional): Page number, defaults to 1.limit(optional): Size of a page, defaults to 10. Maximum is 100.sorting(optional): 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.metadata(optional): Filter by metadata key-value pairs. It uses the deepObject style, e.g. ?metadata[key]=value.
Returns: Polar::Models::ListResource(Polar::Models::Benefit)
Raises:
ResourceNotFoundErroron 404NotPermittedErroron 403HTTPValidationErroron 422PolarErroron other errors
Update Benefit
Update a benefit.
Scopes: benefits:write
Endpoint: PATCH /v1/benefits/{id}
Parameters:
id(required): Path parameterbody(required): Request body as Polar::Models::BenefitCustomUpdate
Returns: Polar::Models::Benefit
Raises:
ResourceNotFoundErroron 404NotPermittedErroron 403HTTPValidationErroron 422PolarErroron other errors