Documentation ¶
Index ¶
Constants ¶
View Source
const ( NotificationTitleKey = "notification_title" NotificationBodyKey = "notification_body" NotificationImageKey = "notification_image" ApplicationIDKey = "application_id" ApplicationNameKey = "application_name" )
View Source
const (
EnvCredentialsFilePath = "FIREBASE_CREDENTIALS_FILE_PATH"
)
Variables ¶
This section is empty.
Functions ¶
func SignNotification ¶
func SignNotification(notification types.Notification, secretKey string) (string, error)
SignNotification signs the given notification using the given secret key
func VerifyNotificationSignature ¶
func VerifyNotificationSignature(notification types.Notification, signature string, secretKey string) (bool, error)
VerifyNotificationSignature verifies that the given signature is valid for the given notification
Types ¶
type Client ¶
type Client struct {
// contains filtered or unexported fields
}
func NewClientFromEnvVariables ¶
NewClientFromEnvVariables returns a new Client instance by using the environment variables
func (*Client) SendNotificationToApp ¶
func (c *Client) SendNotificationToApp(appID string, notification types.Notification) error
SendNotificationToApp allows to send the given notification to the application having the given id
func (*Client) SendNotificationToUsers ¶
func (c *Client) SendNotificationToUsers(app *types.Application, usersAddresses []string, notification *types.Notification) error
SendNotificationToUsers sends the given notification to the devices of the users having the given addresses
type Config ¶
type Config struct {
CredentialsFilePath string `json:"credentials_file_path" yaml:"credentials_file_path" toml:"credentials_file_path"`
}
type SentNotificationBody ¶
type SentNotificationBody struct { // Notification contains the notification to send Notification types.Notification `json:"notification"` // Signature contains the signature of the notification. // This is achieved by signing the Notification's JSON representation // using the application's secret key Signature string `json:"signature"` }
Click to show internal directories.
Click to hide internal directories.