Search documentation of polar_express

# PolarExpress.Services.BenefitsService (polar_express v0.1.5)

Copy Markdown View Source

Benefits

Benefits API operations.

## Summary

### Functions

create_benefit(client, params \\ %{}, opts \\ [])

Create Benefit

delete_benefit(client, id, params \\ %{}, opts \\ [])

Delete Benefit

get_benefit(client, id, params \\ %{}, opts \\ [])

Get Benefit

list_benefit_grants(client, id, params \\ %{}, opts \\ [])

List Benefit Grants

list_benefits(client, params \\ %{}, opts \\ [])

List Benefits

update_benefit(client, id, params \\ %{}, opts \\ [])

Update Benefit

## Functions

# create_benefit(client, params \\ %{}, opts \\ [])

    @spec create_benefit(PolarExpress.Client.t(), map(), keyword()) ::
      {:ok, PolarExpress.Schemas.Benefit.t()} | {:error, PolarExpress.Error.t()}

Create Benefit

Create a benefit.

Scopes: `benefits:write`

See `PolarExpress.Params.BenefitsCreateBenefitParams` for parameter details.

# delete_benefit(client, id, params \\ %{}, opts \\ [])

    @spec delete_benefit(PolarExpress.Client.t(), String.t(), map(), keyword()) ::
      {:ok, term()} | {:error, PolarExpress.Error.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`

See `PolarExpress.Params.BenefitsDeleteBenefitParams` for parameter details.

# get_benefit(client, id, params \\ %{}, opts \\ [])

    @spec get_benefit(PolarExpress.Client.t(), String.t(), map(), keyword()) ::
      {:ok, PolarExpress.Schemas.Benefit.t()} | {:error, PolarExpress.Error.t()}

Get Benefit

Get a benefit by ID.

Scopes: `benefits:read` `benefits:write`

See `PolarExpress.Params.BenefitsGetBenefitParams` for parameter details.

# list_benefit_grants(client, id, params \\ %{}, opts \\ [])

    @spec list_benefit_grants(PolarExpress.Client.t(), String.t(), map(), keyword()) ::
      {:ok, PolarExpress.ListObject.t()} | {:error, PolarExpress.Error.t()}

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`

See `PolarExpress.Params.BenefitsListBenefitGrantsParams` for parameter details.

# list_benefits(client, params \\ %{}, opts \\ [])

    @spec list_benefits(PolarExpress.Client.t(), map(), keyword()) ::
      {:ok, PolarExpress.ListObject.t()} | {:error, PolarExpress.Error.t()}

List Benefits

List benefits.

Scopes: `benefits:read` `benefits:write`

See `PolarExpress.Params.BenefitsListBenefitsParams` for parameter details.

# update_benefit(client, id, params \\ %{}, opts \\ [])

    @spec update_benefit(PolarExpress.Client.t(), String.t(), map(), keyword()) ::
      {:ok, PolarExpress.Schemas.Benefit.t()} | {:error, PolarExpress.Error.t()}

Update Benefit

Update a benefit.

Scopes: `benefits:write`

See `PolarExpress.Params.BenefitsUpdateBenefitParams` for parameter details.