123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220 |
- package fcm
- import "time"
- type (
- Message struct {
-
-
-
-
-
-
-
-
-
-
-
-
-
- Data interface{} `json:"data,omitempty"`
-
-
-
-
- To string `json:"to,omitempty"`
-
-
-
-
-
-
-
- RegistrationIDs []string `json:"registration_ids,omitempty"`
-
-
-
-
-
- CollapseKey string `json:"collapse_key,omitempty"`
-
-
-
-
-
-
-
-
-
- Priority string `json:"priority,omitempty"`
-
-
-
-
- Notification Notification `json:"notification,omitempty"`
-
-
-
-
- ContentAvailable bool `json:"content_available,omitempty"`
-
-
-
- DelayWhileIdle bool `json:"delay_while_idle,omitempty"`
-
-
-
-
-
- TimeToLive int `json:"time_to_live,omitempty"`
-
-
-
- RestrictedPackageName string `json:"restricted_package_name,omitempty"`
-
-
-
- DryRun bool `json:"dry_run,omitempty"`
-
-
-
-
- Condition string `json:"condition,omitempty"`
-
-
-
- MutableContent bool `json:"mutable_content,omitempty"`
- Android Android `json:"android,omitempty"`
- }
- Android struct {
- Priority string `json:"priority,omitempty"`
- }
-
- Result struct {
-
- MessageID string `json:"message_id"`
-
-
-
-
- RegistrationID string `json:"registration_id"`
-
-
-
- Error string `json:"error"`
- }
-
- Response struct {
- Ok bool
- StatusCode int
-
- MulticastID int `json:"multicast_id"`
-
- Success int `json:"success"`
-
- Fail int `json:"failure"`
-
-
-
-
- CanonicalIDs int `json:"canonical_ids"`
-
-
-
-
- Results []Result `json:"results,omitempty"`
-
- MsgID int `json:"message_id,omitempty"`
-
- Err string `json:"error,omitempty"`
-
- RetryAfter string
- }
-
- Notification struct {
-
- Title string `json:"title,omitempty"`
-
- Body string `json:"body,omitempty"`
-
-
-
-
-
- Sound string `json:"sound,omitempty"`
-
- Badge string `json:"badge,omitempty"`
-
-
-
- Icon string `json:"icon,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 string `json:"body_loc_args,omitempty"`
-
-
- TitleLocKey string `json:"title_loc_key,omitempty"`
-
-
-
- TitleLocArgs string `json:"title_loc_args,omitempty"`
- }
- )
- func (r *Response) GetRetryAfterTime() (time.Duration, error) {
- return time.ParseDuration(r.RetryAfter)
- }
|