Pigeon v0.13.0 Pigeon.GCM.Notification
Defines GCM notification struct and convenience constructor functions.
Summary
Functions
Creates GCM.Notification
struct with device registration IDs and optional
notification and data payloads
Updates "data"
key in push payload
Updates "notification"
key in push payload
Types
Functions
Creates GCM.Notification
struct with device registration IDs and optional
notification and data payloads.
Examples
iex> Pigeon.GCM.Notification.new("reg ID")
%Pigeon.GCM.Notification{
message_id: nil,
payload: %{},
registration_id: "reg ID",
updated_registration_id: nil
}
iex> Pigeon.GCM.Notification.new("reg ID", %{"body" => "test message"})
%Pigeon.GCM.Notification{
message_id: nil,
payload: %{"notification" => %{"body" => "test message"}},
registration_id: "reg ID",
updated_registration_id: nil
}
iex> Pigeon.GCM.Notification.new("reg ID", %{"body" => "test message"}, %{"key" => "value"})
%Pigeon.GCM.Notification{
message_id: nil,
payload: %{
"data" => %{"key" => "value"},
"notification" => %{"body" => "test message"}
},
registration_id: "reg ID",
updated_registration_id: nil
}
Updates "data"
key in push payload.
Examples
iex> Pigeon.GCM.Notification.put_data(%Pigeon.GCM.Notification{}, %{"key" => 1234})
%Pigeon.GCM.Notification{
message_id: nil,
payload: %{"data" => %{"key" => 1234}},
registration_id: nil,
updated_registration_id: nil
}
Updates "notification"
key in push payload.
Examples
iex> Pigeon.GCM.Notification.put_notification(%Pigeon.GCM.Notification{},
...> %{"body" => "message"})
%Pigeon.GCM.Notification{
message_id: nil,
payload: %{"notification" => %{"body" => "message"}},
registration_id: nil,
updated_registration_id: nil
}