Pigeon.FCM.Notification (Pigeon v2.0.0-rc.0) View Source
Defines FCM notification struct and convenience constructor functions.
Link to this section Summary
Functions
Creates FCM.Notification
struct with given target and optional
notification and data payloads.
Link to this section Types
Specs
error_response() :: :unspecified_error | :invalid_argument | :unregistered | :sender_id_mismatch | :quota_exceeded | :unavailable | :internal | :third_party_auth_error
Specs
t() :: %Pigeon.FCM.Notification{ __meta__: Pigeon.Metadata.t(), android: map() | nil, apns: map() | nil, data: map() | nil, error: map() | nil, fcm_options: map() | nil, name: binary() | nil, notification: map() | nil, response: atom() | nil, target: target(), validate_only: boolean() | nil, webpush: map() | nil }
Specs
FCM notification target. Must be one of the following:
{:token, "string"}
- Registration token to send a message to.{:topic, "string"}
- Topic name to send a message to, e.g. "weather". Note: "/topics/" prefix should not be provided.{:condition, "string"}
- Condition to send a message to, e.g. "'foo' in topics && 'bar' in topics".
Link to this section Functions
Creates FCM.Notification
struct with given target and optional
notification and data payloads.
Examples
iex> Pigeon.FCM.Notification.new({:token, "reg ID"})
%Pigeon.FCM.Notification{
data: nil,
notification: nil,
target: {:token, "reg ID"}
}
iex> Pigeon.FCM.Notification.new({:topic, "example"})
%Pigeon.FCM.Notification{
data: nil,
notification: nil,
target: {:topic, "example"}
}
iex> Pigeon.FCM.Notification.new({:token, "reg ID"}, %{"body" => "test message"})
%Pigeon.FCM.Notification{
data: nil,
notification: %{"body" => "test message"},
target: {:token, "reg ID"}
}
iex> Pigeon.FCM.Notification.new({:token, "reg ID"}, %{"body" => "test message"},
...> %{"key" => "value"})
%Pigeon.FCM.Notification{
data: %{"key" => "value"},
notification: %{"body" => "test message"},
target: {:token, "reg ID"}
}