-
Notifications
You must be signed in to change notification settings - Fork 0
/
input.go
187 lines (159 loc) · 5.88 KB
/
input.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
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
package dto
import (
"github.com/savannahghi/enumutils"
"github.com/savannahghi/feedlib"
"github.com/savannahghi/profileutils"
"github.com/savannahghi/scalarutils"
)
// UserProfileInput is used to create or update a user's profile.
type UserProfileInput struct {
PhotoUploadID *string `json:"photoUploadID"`
DateOfBirth *scalarutils.Date `json:"dateOfBirth,omitempty"`
Gender *enumutils.Gender `json:"gender,omitempty"`
FirstName *string `json:"lastName"`
LastName *string `json:"firstName"`
}
// PostVisitSurveyInput is used to send the results of post-visit surveys to the
// server.
type PostVisitSurveyInput struct {
LikelyToRecommend int `json:"likelyToRecommend" firestore:"likelyToRecommend"`
Criticism string `json:"criticism" firestore:"criticism"`
Suggestions string `json:"suggestions" firestore:"suggestions"`
}
// SignUpInput represents the user information required to create a new account
type SignUpInput struct {
PhoneNumber *string `json:"phoneNumber"`
PIN *string `json:"pin"`
Flavour feedlib.Flavour `json:"flavour"`
OTP *string `json:"otp"`
}
// PhoneNumberPayload used when verifying a phone number.
type PhoneNumberPayload struct {
PhoneNumber *string `json:"phoneNumber"`
}
// SetPrimaryPhoneNumberPayload used when veriying and setting a user's primary phone number via REST
type SetPrimaryPhoneNumberPayload struct {
PhoneNumber *string `json:"phoneNumber"`
OTP *string `json:"otp"`
}
// ChangePINRequest payload to set or change PIN information
type ChangePINRequest struct {
PhoneNumber string `json:"phoneNumber"`
PIN string `json:"pin"`
OTP string `json:"otp"`
}
// LoginPayload used when calling the REST API to log a user in
type LoginPayload struct {
PhoneNumber *string `json:"phoneNumber"`
PIN *string `json:"pin"`
Flavour feedlib.Flavour `json:"flavour"`
}
// SendRetryOTPPayload is used when calling the REST API to resend an otp
type SendRetryOTPPayload struct {
Phone *string `json:"phoneNumber"`
RetryStep *int `json:"retryStep"`
AppID *string `json:"appId"`
}
// RefreshTokenExchangePayload is marshalled into JSON
// and sent to the Firebase Auth REST API when exchanging a
// refresh token for an ID token that can be used to make API calls
type RefreshTokenExchangePayload struct {
GrantType string `json:"grant_type"`
RefreshToken string `json:"refresh_token"`
}
// RefreshTokenPayload is used when calling the REST API to
// exchange a Refresh Token for new ID Token
type RefreshTokenPayload struct {
RefreshToken *string `json:"refreshToken"`
}
// UIDPayload is the user ID used in some inter-service requests
type UIDPayload struct {
UID *string `json:"uid"`
}
// UIDsPayload is an input of a slice of users' UIDs used
// for ISC requests to retrieve contact details of the users
type UIDsPayload struct {
UIDs []string `json:"uids"`
}
// UserAddressInput represents a user's geo location input
type UserAddressInput struct {
Latitude float64 `json:"latitude"`
Longitude float64 `json:"longitude"`
Locality *string `json:"locality"`
Name *string `json:"name"`
PlaceID *string `json:"placeID"`
FormattedAddress *string `json:"formattedAddress"`
}
// PushTokenPayload represents user device push token
type PushTokenPayload struct {
PushToken string `json:"pushTokens"`
UID string `json:"uid"`
}
// UserProfilePayload is used to update a user's profile.
// This payload is used for REST endpoints
type UserProfilePayload struct {
UID *string `json:"uid"`
PhotoUploadID *string `json:"photoUploadID"`
DateOfBirth *scalarutils.Date `json:"dateOfBirth,omitempty"`
Gender *enumutils.Gender `json:"gender,omitempty"`
FirstName *string `json:"lastName"`
LastName *string `json:"firstName"`
}
// PermissionInput input required to create a permission
type PermissionInput struct {
Action string
Resource string
}
// RolePayload used when adding roles to a user
type RolePayload struct {
PhoneNumber *string `json:"phoneNumber"`
Role *profileutils.RoleType `json:"role"`
}
// AssignRolePayload is the payload used to assign a role to a user
type AssignRolePayload struct {
UserID string `json:"userID"`
RoleID string `json:"roleID"`
}
// DeleteRolePayload is the payload used to delete a role
type DeleteRolePayload struct {
Name string `json:"name"`
RoleID string `json:"roleID"`
}
// RoleInput represents the information required when creating a role
type RoleInput struct {
Name string `json:"name"`
Description string `json:"description"`
Scopes []string `json:"scopes"`
}
// RolePermissionInput input required to create a permission
type RolePermissionInput struct {
RoleID string `json:"roleID"`
Scopes []string `json:"scopes"`
}
// OtpPayload used when sending OTP messages
type OtpPayload struct {
PhoneNumber *string `json:"phoneNumber"`
AppID *string `json:"appId"`
}
// RetrieveUserProfileInput will be used to fetch a user profile by either email address or phone
type RetrieveUserProfileInput struct {
Email *string `json:"email" firestore:"emailAddress"`
PhoneNumber *string `json:"phone" firestore:"phoneNumber"`
}
//ProfileSuspensionInput is the input required to suspend/unsuspend a PRO account
type ProfileSuspensionInput struct {
ID string `json:"id"`
RoleIDs []string `json:"roleIDs"`
Reason string `json:"reason"`
}
// CheckPermissionPayload is the payload used when checking if a user is authorized
type CheckPermissionPayload struct {
UID *string `json:"uid"`
Permission *profileutils.Permission `json:"permission"`
}
// RoleRevocationInput is the input when revoking a user's role
type RoleRevocationInput struct {
ProfileID string
RoleID string
Reason string
}