Polarex.Products (Polarex v0.3.0)
View SourceProvides API endpoints related to products
Summary
Functions
@spec products_create( body :: Polarex.ProductCreateOneTime.t() | Polarex.ProductCreateRecurring.t(), opts :: keyword() ) :: {:ok, Polarex.Product.t()} | {:error, Polarex.HTTPValidationError.t()}
Create Product
Create a product.
Scopes: products:write
Request Body
Content Types: application/json
@spec products_get(id :: String.t(), opts :: keyword()) :: {:ok, Polarex.Product.t()} | {:error, Polarex.HTTPValidationError.t() | Polarex.ResourceNotFound.t()}
Get Product
Get a product by ID.
Scopes: products:read products:write
@spec products_list(opts :: keyword()) :: {:ok, Polarex.ListResourceProduct.t()} | {:error, Polarex.HTTPValidationError.t()}
List Products
List products.
Scopes: products:read products:write
Options
id: Filter by product ID.organization_id: Filter by organization ID.query: Filter by product name.is_archived: Filter on archived products.is_recurring: Filter on recurring products. Iftrue, only subscriptions tiers are returned. Iffalse, only one-time purchase products are returned.benefit_id: Filter products granting specific benefit.visibility: Filter by visibility.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.metadata: Filter by metadata key-value pairs. It uses thedeepObjectstyle, e.g.?metadata[key]=value.
@spec products_update( id :: String.t(), body :: Polarex.ProductUpdate.t(), opts :: keyword() ) :: {:ok, Polarex.Product.t()} | {:error, Polarex.HTTPValidationError.t() | Polarex.NotPermitted.t() | Polarex.ResourceNotFound.t()}
Update Product
Update a product.
Scopes: products:write
Request Body
Content Types: application/json
@spec products_update_benefits( id :: String.t(), body :: Polarex.ProductBenefitsUpdate.t(), opts :: keyword() ) :: {:ok, Polarex.Product.t()} | {:error, Polarex.HTTPValidationError.t() | Polarex.NotPermitted.t() | Polarex.ResourceNotFound.t()}
Update Product Benefits
Update benefits granted by a product.
Scopes: products:write
Request Body
Content Types: application/json