Documentation
¶
Index ¶
Constants ¶
const ( ErrorCodeMissingRegistration = "MissingRegistration" ErrorCodeInvalidRegistration = "InvalidRegistration" )
const ErrorCodeFailedToReadResponse = "FailedToReadResponse"
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Client ¶
type Client struct {
// contains filtered or unexported fields
}
Client (legacy/gcm) https://firebase.google.com/docs/cloud-messaging/http-server-ref Legacy FCM/GCM API (https://firebase.google.com/docs/cloud-messaging/migrate-v1): 1. copy server key from: https://console.firebase.google.com/project/_/settings/cloudmessaging/ 2. add to request header: Authorization:key=<server key>
type Notification ¶
type Notification struct {
Title string `json:"title,omitempty"`
Body string `json:"body,omitempty"`
AndroidChannelID string `json:"android_channel_id,omitempty"`
Icon string `json:"icon,omitempty"`
Sound string `json:"sound,omitempty"`
Tag string `json:"tag,omitempty"`
Color string `json:"color,omitempty"`
ClickAction string `json:"click_action,omitempty"`
BodyLocKey string `json:"body_loc_key,omitempty"`
BodyLocArgs json.RawMessage `json:"body_loc_args,omitempty"`
TitleLocKey string `json:"title_loc_key,omitempty"`
TitleLocArgs json.RawMessage `json:"title_loc_args,omitempty"`
}
Table 2b: https://firebase.google.com/docs/cloud-messaging/http-server-ref#notification-payload-support
func (Notification) MarshalEasyJSON ¶
func (v Notification) MarshalEasyJSON(w *jwriter.Writer)
MarshalEasyJSON supports easyjson.Marshaler interface
func (Notification) MarshalJSON ¶
func (v Notification) MarshalJSON() ([]byte, error)
MarshalJSON supports json.Marshaler interface
func (*Notification) UnmarshalEasyJSON ¶
func (v *Notification) UnmarshalEasyJSON(l *jlexer.Lexer)
UnmarshalEasyJSON supports easyjson.Unmarshaler interface
func (*Notification) UnmarshalJSON ¶
func (v *Notification) UnmarshalJSON(data []byte) error
UnmarshalJSON supports json.Unmarshaler interface
type Request ¶
type Request struct {
To string `json:"to"`
RegistrationIDs []string `json:"registration_ids,omitempty"`
Condition string `json:"condition,omitempty"`
NotificationKey string `json:"notification_key,omitempty"`
CollapseKey string `json:"collapse_key,omitempty"`
Priority string `json:"priority,omitempty"`
ContentAvailable bool `json:"content_available,omitempty"`
MutableContent json.RawMessage `json:"mutable_content,omitempty"`
TimeToLive int `json:"time_to_live,omitempty"`
RestrictedPackageName string `json:"restricted_package_name,omitempty"`
DryRun bool `json:"dry_run,omitempty"`
Data json.RawMessage `json:"data,omitempty"`
Notification json.RawMessage `json:"notification,omitempty"`
}
https://firebase.google.com/docs/cloud-messaging/http-server-ref#downstream-http-messages-json
func (Request) MarshalEasyJSON ¶
MarshalEasyJSON supports easyjson.Marshaler interface
func (Request) MarshalJSON ¶
MarshalJSON supports json.Marshaler interface
func (*Request) ShouldIgnore ¶ added in v1.0.2
func (*Request) UnmarshalEasyJSON ¶
UnmarshalEasyJSON supports easyjson.Unmarshaler interface
func (*Request) UnmarshalJSON ¶
UnmarshalJSON supports json.Unmarshaler interface
type Response ¶
type Response struct {
MulticastID int `json:"multicast_id"`
Success int `json:"success"`
Failure int `json:"failure"`
StatusCode int `json:"-"`
Results []*ResponseResult `json:"results"`
}
func (Response) MarshalEasyJSON ¶
MarshalEasyJSON supports easyjson.Marshaler interface
func (Response) MarshalJSON ¶
MarshalJSON supports json.Marshaler interface
func (*Response) UnmarshalEasyJSON ¶
UnmarshalEasyJSON supports easyjson.Unmarshaler interface
func (*Response) UnmarshalJSON ¶
UnmarshalJSON supports json.Unmarshaler interface
type ResponseResult ¶
type ResponseResult struct {
MessageID string `json:"message_id"`
RegistrationID string `json:"registration_id"`
// error codes:
// https://firebase.google.com/docs/cloud-messaging/http-server-ref#table9
Error string `json:"error"`
}
func (ResponseResult) MarshalEasyJSON ¶
func (v ResponseResult) MarshalEasyJSON(w *jwriter.Writer)
MarshalEasyJSON supports easyjson.Marshaler interface
func (ResponseResult) MarshalJSON ¶
func (v ResponseResult) MarshalJSON() ([]byte, error)
MarshalJSON supports json.Marshaler interface
func (*ResponseResult) UnmarshalEasyJSON ¶
func (v *ResponseResult) UnmarshalEasyJSON(l *jlexer.Lexer)
UnmarshalEasyJSON supports easyjson.Unmarshaler interface
func (*ResponseResult) UnmarshalJSON ¶
func (v *ResponseResult) UnmarshalJSON(data []byte) error
UnmarshalJSON supports json.Unmarshaler interface