-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathresponse.go
More file actions
39 lines (34 loc) · 988 Bytes
/
response.go
File metadata and controls
39 lines (34 loc) · 988 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
package hcm
import (
"errors"
)
const (
RespCodeSuccess = "80000000"
RespCodePartialSuccess = "80100000"
)
var (
ErrOAuth = errors.New("oauth authentication error")
ErrTokenExpired = errors.New("token expired")
ErrInvalidMsg = errors.New("incorrect message structure.")
ErrMessageTooBig = errors.New("message body size exceeded the default value (4 KB)")
ErrCannotSend = errors.New("messages cannot be sent to the app")
ErrInvalidToken = errors.New("invalid token")
ErrUnknown = errors.New("unknown error")
)
var (
errMap = map[string]error{
"80200001": ErrOAuth,
"80200003": ErrTokenExpired,
"80100003": ErrInvalidMsg,
"80300008": ErrMessageTooBig,
"80300002": ErrCannotSend,
"80300007": ErrInvalidToken,
}
)
// Response represents the FCM server's response to the application
// server's sent message.
type Response struct {
Code string `json:"code"`
Message string `json:"msg"`
RequestID string `json:"request_id"`
}