# `RevenueCat`

Minimal RevenueCat client.

Exposes `get_customer/1` (cached) and `fetch_customer/1` (remote).

# `entitlement_map`

```elixir
@type entitlement_map() :: map()
```

# `attribute`

```elixir
@spec attribute(RevenueCat.Customer.t(), String.t() | atom()) ::
  RevenueCat.Customer.Attribute.t() | nil
```

Fetch a single customer attribute struct by name.

# `current_offering`

```elixir
@spec current_offering(RevenueCat.Offerings.t()) ::
  RevenueCat.Offerings.Offering.t() | nil
```

Fetch the current offering struct from an Offerings struct.

# `entitlement`

```elixir
@spec entitlement(RevenueCat.Customer.t() | map(), String.t() | atom()) ::
  RevenueCat.Customer.Entitlement.t() | nil
```

Fetch a single entitlement struct by id.

# `entitlements`

```elixir
@spec entitlements(RevenueCat.Customer.t()) :: map()
```

Return the entitlements map from a customer.

Returns an empty map for non-customer inputs.

# `fetch_customer`

```elixir
@spec fetch_customer(String.t()) :: {:ok, RevenueCat.Customer.t()} | {:error, term()}
```

Fetch a customer by app user id, bypassing the customer cache.

# `fetch_offerings`

```elixir
@spec fetch_offerings(
  String.t(),
  keyword()
) :: {:ok, RevenueCat.Offerings.t()} | {:error, term()}
```

Get Offerings for a given `app_user_id`.

This endpoint can optionally take a `:platform` (string) which will be sent
as the `X-Platform` header (lower-cased to `x-platform`), e.g. `"ios"`.

# `get_customer`

```elixir
@spec get_customer(String.t()) :: {:ok, RevenueCat.Customer.t()} | {:error, term()}
```

Get a customer by app user id, using the customer cache when possible.

# `has_entitlement?`

```elixir
@spec has_entitlement?(RevenueCat.Customer.t(), String.t() | atom()) :: boolean()
```

Return true if the customer has the given entitlement id.

# `has_subscription?`

```elixir
@spec has_subscription?(RevenueCat.Customer.t(), String.t() | atom()) :: boolean()
```

Return true if the customer has the given subscription id.

# `offering`

```elixir
@spec offering(RevenueCat.Offerings.t(), String.t() | atom()) ::
  RevenueCat.Offerings.Offering.t() | nil
```

Fetch a single offering struct by id from an Offerings struct.

# `subscription`

```elixir
@spec subscription(RevenueCat.Customer.t(), String.t() | atom()) ::
  RevenueCat.Customer.Subscription.t() | nil
```

Fetch a single subscription struct by id.

# `subscriptions`

```elixir
@spec subscriptions(RevenueCat.Customer.t()) :: map()
```

Return the subscriptions map from a customer.

Returns an empty map for non-customer inputs.

# `update_customer_attributes`

```elixir
@spec update_customer_attributes(String.t(), map()) ::
  {:ok, RevenueCat.Customer.t()} | {:error, term()}
```

Update customer attributes and return the updated customer.

---

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