Polarex.Discounts (Polarex v0.2.1)
View SourceProvides API endpoints related to discounts
Summary
Functions
@spec discounts_create( Polarex.DiscountFixedOnceForeverDurationCreate.t() | Polarex.DiscountFixedRepeatDurationCreate.t() | Polarex.DiscountPercentageOnceForeverDurationCreate.t() | Polarex.DiscountPercentageRepeatDurationCreate.t(), keyword() ) :: {:ok, Polarex.DiscountFixedOnceForeverDuration.t() | Polarex.DiscountFixedRepeatDuration.t() | Polarex.DiscountPercentageOnceForeverDuration.t() | Polarex.DiscountPercentageRepeatDuration.t()} | {:error, Polarex.HTTPValidationError.t()}
Create Discount
Create a discount.
Scopes: discounts:write
@spec discounts_delete( String.t(), keyword() ) :: :ok | {:error, Polarex.HTTPValidationError.t() | Polarex.ResourceNotFound.t()}
Delete Discount
Delete a discount.
Scopes: discounts:write
@spec discounts_get( String.t(), keyword() ) :: {:ok, Polarex.DiscountFixedOnceForeverDuration.t() | Polarex.DiscountFixedRepeatDuration.t() | Polarex.DiscountPercentageOnceForeverDuration.t() | Polarex.DiscountPercentageRepeatDuration.t()} | {:error, Polarex.HTTPValidationError.t() | Polarex.ResourceNotFound.t()}
Get Discount
Get a discount by ID.
Scopes: discounts:read
discounts:write
@spec discounts_list(keyword()) :: {:ok, Polarex.ListResourceDiscount.t()} | {:error, Polarex.HTTPValidationError.t()}
List Discounts
List discounts.
Scopes: discounts:read
discounts:write
Options
organization_id
: Filter by organization ID.query
: Filter by name.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.
@spec discounts_update(String.t(), Polarex.DiscountUpdate.t(), keyword()) :: {:ok, Polarex.DiscountFixedOnceForeverDuration.t() | Polarex.DiscountFixedRepeatDuration.t() | Polarex.DiscountPercentageOnceForeverDuration.t() | Polarex.DiscountPercentageRepeatDuration.t()} | {:error, Polarex.HTTPValidationError.t() | Polarex.ResourceNotFound.t()}
Update Discount
Update a discount.
Scopes: discounts:write