support Device Group HTTP POST Request (#299)
* support Device Group HTTP POST Request Signed-off-by: Bo-Yi Wu <appleboy.tw@gmail.com> * fix vendor Signed-off-by: Bo-Yi Wu <appleboy.tw@gmail.com> * check error exist Signed-off-by: Bo-Yi Wu <appleboy.tw@gmail.com>
This commit is contained in:
19
vendor/github.com/appleboy/go-fcm/response.go
generated
vendored
19
vendor/github.com/appleboy/go-fcm/response.go
generated
vendored
@@ -49,6 +49,9 @@ var (
|
||||
|
||||
// ErrInvalidParameters occurs when provided parameters have the right name and type
|
||||
ErrInvalidParameters = errors.New("check that the provided parameters have the right name and type")
|
||||
|
||||
// ErrUnknown for unknown error type
|
||||
ErrUnknown = errors.New("unknown error type")
|
||||
)
|
||||
|
||||
var (
|
||||
@@ -147,7 +150,13 @@ func (r *Response) UnmarshalJSON(data []byte) error {
|
||||
r.Success = response.Success
|
||||
r.FailedRegistrationIDs = response.FailedRegistrationIDs
|
||||
r.MessageID = response.MessageID
|
||||
r.Error = errMap[response.Error]
|
||||
if response.Error != "" {
|
||||
if val, ok := errMap[response.Error]; ok {
|
||||
r.Error = val
|
||||
} else {
|
||||
r.Error = ErrUnknown
|
||||
}
|
||||
}
|
||||
|
||||
return nil
|
||||
}
|
||||
@@ -173,7 +182,13 @@ func (r *Result) UnmarshalJSON(data []byte) error {
|
||||
|
||||
r.MessageID = result.MessageID
|
||||
r.RegistrationID = result.RegistrationID
|
||||
r.Error = errMap[result.Error]
|
||||
if result.Error != "" {
|
||||
if val, ok := errMap[result.Error]; ok {
|
||||
r.Error = val
|
||||
} else {
|
||||
r.Error = ErrUnknown
|
||||
}
|
||||
}
|
||||
|
||||
return nil
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user