# `Polarex.Products`
[🔗](https://github.com/giusdp/polarex/blob/main/lib/polarex/operations/products.ex#L1)

Provides API endpoints related to products

# `products_create`

```elixir
@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`

# `products_get`

```elixir
@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`

# `products_list`

```elixir
@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. If `true`, only subscriptions tiers are returned. If `false`, 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 the `deepObject` style, e.g. `?metadata[key]=value`.

# `products_update`

```elixir
@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`

# `products_update_benefits`

```elixir
@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`

---

*Consult [api-reference.md](api-reference.md) for complete listing*
