ExNudge.Subscription (ExNudge v1.0.1)
View SourceSubscription from a client.
Summary
Functions
Creates a new subscription from a JSON. You can use metadata to pass around some form of identification of the subscription. Metadata is NOT sent with the push notification request.
Validates that a subscription has all required fields and valid format.
Types
Functions
Creates a new subscription from a JSON. You can use metadata to pass around some form of identification of the subscription. Metadata is NOT sent with the push notification request.
Examples
iex> data = %{
...> "endpoint" => "https://fcm.googleapis.com/...",
...> "keys" => %{
...> "p256dh" => "client_public_key",
...> "auth" => "client_auth_secret"
...> }
...> }
iex> ExNudge.Subscription.from_map(data)
{:ok, %ExNudge.Subscription{...}}
iex> data = %{
...> "endpoint" => "https://fcm.googleapis.com/...",
...> "keys" => %{
...> "p256dh" => "client_public_key",
...> "auth" => "client_auth_secret"
...> }
...> }
iex> metadata = "subscription_id_1"
iex> ExNudge.Subscription.from_map(data, metadata)
{:ok, %ExNudge.Subscription{...}}
Validates that a subscription has all required fields and valid format.