-
Notifications
You must be signed in to change notification settings - Fork 0
/
structs.go
49 lines (41 loc) · 1.09 KB
/
structs.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
46
47
48
49
package main
import jwt "github.com/dgrijalva/jwt-go"
// ErrorResponse is struct for sending error message with code.
type ErrorResponse struct {
Code int
Message string
}
// SuccessResponse is struct for sending error message with code.
type SuccessResponse struct {
Code int
Message string
Response interface{}
}
// Claims is a struct that will be encoded to a JWT.
// jwt.StandardClaims is an embedded type to provide expiry time
type Claims struct {
Email string
jwt.StandardClaims
}
// RegistationParams is struct to read the request body
type RegistationParams struct {
Name string `json:"name"`
Email string `json:"email"`
Password string `json:"password"`
}
// LoginParams is struct to read the request body
type LoginParams struct {
Email string `json:"email"`
Password string `json:"password"`
}
// SuccessfulLoginResponse is struct to send the request response
type SuccessfulLoginResponse struct {
Email string
AuthToken string
}
// UserDetails is struct used for user details
type UserDetails struct {
Name string
Email string
Password string
}