Polarex.Discounts (Polarex v0.3.0)
View SourceProvides API endpoints related to discounts
Summary
Functions
@spec discounts_create( body :: Polarex.DiscountFixedCreate.t() | Polarex.DiscountPercentageCreate.t(), opts :: 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
Request Body
Content Types: application/json
@spec discounts_delete(id :: String.t(), opts :: keyword()) :: :ok | {:error, Polarex.HTTPValidationError.t() | Polarex.ResourceNotFound.t()}
Delete Discount
Delete a discount.
Scopes: discounts:write
@spec discounts_get(id :: String.t(), opts :: 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(opts :: 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( id :: String.t(), body :: Polarex.DiscountUpdate.t(), opts :: 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
Request Body
Content Types: application/json