-
Notifications
You must be signed in to change notification settings - Fork 0
/
helper.go
45 lines (40 loc) · 1.06 KB
/
helper.go
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
40
41
42
43
44
45
package api
// CreateHealthCheck returns a health check response
func CreateHealthCheck() *HealthCheck {
return &HealthCheck{
ReturnCode: "SUCCESS",
Version: Version,
}
}
// DefaultChecksumError returns a default checksum error
func DefaultChecksumError() *Error {
return CreateError("checksumError", "You did not pass the checksum security check")
}
// CreateError returns an error response given a message key and message
func CreateError(key string, message string) *Error {
return &Error{
Response{
ReturnCode: "FAILED",
MessageKey: key,
Message: message,
},
}
}
// CreateJSONError returns an error response given a message key and message
func CreateJSONError(key string, message string) *JSONResponse {
return &JSONResponse{
Response{
ReturnCode: "FAILED",
MessageKey: key,
Message: message,
},
}
}
// CreateChecksum returns a checksum given a secret, action and params
func CreateChecksum(secret string, action string, params string) *Checksum {
return &Checksum{
Secret: secret,
Action: action,
Params: params,
}
}