Polarex.Benefits (Polarex v0.1.0)

View Source

Provides API endpoints related to benefits

Summary

Functions

benefits_create(body, opts \\ [])

Create Benefit

Create a benefit.

Scopes: benefits:write

benefits_delete(id, opts \\ [])

@spec benefits_delete(
  String.t(),
  keyword()
) ::
  :ok
  | {:error,
     Polarex.HTTPValidationError.t()
     | Polarex.NotPermitted.t()
     | Polarex.ResourceNotFound.t()}

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

benefits_get(id, opts \\ [])

Get Benefit

Get a benefit by ID.

Scopes: benefits:read benefits:write

benefits_grants(id, opts \\ [])

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

Options

  • is_granted: Filter by granted status. If true, only granted benefits will be returned. If false, only revoked benefits will be returned.
  • customer_id: Filter by customer.
  • page: Page number, defaults to 1.
  • limit: Size of a page, defaults to 10. Maximum is 100.

benefits_list(opts \\ [])

@spec benefits_list(keyword()) ::
  {:ok, Polarex.ListResourceBenefit.t()}
  | {:error, Polarex.HTTPValidationError.t()}

List Benefits

List benefits.

Scopes: benefits:read benefits:write

Options

  • organization_id: Filter by organization ID.
  • type: Filter by benefit type.
  • query: Filter by description.
  • page: Page number, defaults to 1.
  • limit: Size of a page, defaults to 10. Maximum is 100.
  • sorting: 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.

benefits_update(id, body, opts \\ [])

Update Benefit

Update a benefit.

Scopes: benefits:write