-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathusers.go
243 lines (207 loc) · 6.36 KB
/
users.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
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
// This file was auto-generated by Fern from our API Definition.
package api
import (
json "encoding/json"
fmt "fmt"
core "github.com/FlatFilers/flatfile-go/core"
)
type ListUsersRequest struct {
// Email of guest to return
Email *string `json:"-" url:"email,omitempty"`
// String to search for users by name and email
Search *string `json:"-" url:"search,omitempty"`
// Field to sort users by
SortField *ListUsersSortField `json:"-" url:"sortField,omitempty"`
// Direction of sorting
SortDirection *SortDirection `json:"-" url:"sortDirection,omitempty"`
// Number of users to return in a page (default 20)
PageSize *int `json:"-" url:"pageSize,omitempty"`
// Based on pageSize, which page of users to return
PageNumber *int `json:"-" url:"pageNumber,omitempty"`
}
type ListUsersResponse struct {
Data []*User `json:"data,omitempty" url:"data,omitempty"`
Pagination *Pagination `json:"pagination,omitempty" url:"pagination,omitempty"`
extraProperties map[string]interface{}
_rawJSON json.RawMessage
}
func (l *ListUsersResponse) GetExtraProperties() map[string]interface{} {
return l.extraProperties
}
func (l *ListUsersResponse) UnmarshalJSON(data []byte) error {
type unmarshaler ListUsersResponse
var value unmarshaler
if err := json.Unmarshal(data, &value); err != nil {
return err
}
*l = ListUsersResponse(value)
extraProperties, err := core.ExtractExtraProperties(data, *l)
if err != nil {
return err
}
l.extraProperties = extraProperties
l._rawJSON = json.RawMessage(data)
return nil
}
func (l *ListUsersResponse) String() string {
if len(l._rawJSON) > 0 {
if value, err := core.StringifyJSON(l._rawJSON); err == nil {
return value
}
}
if value, err := core.StringifyJSON(l); err == nil {
return value
}
return fmt.Sprintf("%#v", l)
}
type ListUsersSortField string
const (
ListUsersSortFieldEmail ListUsersSortField = "email"
ListUsersSortFieldName ListUsersSortField = "name"
ListUsersSortFieldId ListUsersSortField = "id"
ListUsersSortFieldIdp ListUsersSortField = "idp"
ListUsersSortFieldIdpRef ListUsersSortField = "idp_ref"
ListUsersSortFieldCreatedAt ListUsersSortField = "created_at"
ListUsersSortFieldUpdatedAt ListUsersSortField = "updated_at"
ListUsersSortFieldLastSeenAt ListUsersSortField = "last_seen_at"
ListUsersSortFieldDashboard ListUsersSortField = "dashboard"
)
func NewListUsersSortFieldFromString(s string) (ListUsersSortField, error) {
switch s {
case "email":
return ListUsersSortFieldEmail, nil
case "name":
return ListUsersSortFieldName, nil
case "id":
return ListUsersSortFieldId, nil
case "idp":
return ListUsersSortFieldIdp, nil
case "idp_ref":
return ListUsersSortFieldIdpRef, nil
case "created_at":
return ListUsersSortFieldCreatedAt, nil
case "updated_at":
return ListUsersSortFieldUpdatedAt, nil
case "last_seen_at":
return ListUsersSortFieldLastSeenAt, nil
case "dashboard":
return ListUsersSortFieldDashboard, nil
}
var t ListUsersSortField
return "", fmt.Errorf("%s is not a valid %T", s, t)
}
func (l ListUsersSortField) Ptr() *ListUsersSortField {
return &l
}
// Properties used to create a new user
type UserConfig struct {
Email string `json:"email" url:"email"`
Name string `json:"name" url:"name"`
AccountId AccountId `json:"accountId" url:"accountId"`
extraProperties map[string]interface{}
_rawJSON json.RawMessage
}
func (u *UserConfig) GetExtraProperties() map[string]interface{} {
return u.extraProperties
}
func (u *UserConfig) UnmarshalJSON(data []byte) error {
type unmarshaler UserConfig
var value unmarshaler
if err := json.Unmarshal(data, &value); err != nil {
return err
}
*u = UserConfig(value)
extraProperties, err := core.ExtractExtraProperties(data, *u)
if err != nil {
return err
}
u.extraProperties = extraProperties
u._rawJSON = json.RawMessage(data)
return nil
}
func (u *UserConfig) String() string {
if len(u._rawJSON) > 0 {
if value, err := core.StringifyJSON(u._rawJSON); err == nil {
return value
}
}
if value, err := core.StringifyJSON(u); err == nil {
return value
}
return fmt.Sprintf("%#v", u)
}
// Properties used to create a new user
type UserCreateAndInviteRequest struct {
Email string `json:"email" url:"email"`
Name string `json:"name" url:"name"`
ActorRoles []*AssignActorRoleRequest `json:"actorRoles,omitempty" url:"actorRoles,omitempty"`
extraProperties map[string]interface{}
_rawJSON json.RawMessage
}
func (u *UserCreateAndInviteRequest) GetExtraProperties() map[string]interface{} {
return u.extraProperties
}
func (u *UserCreateAndInviteRequest) UnmarshalJSON(data []byte) error {
type unmarshaler UserCreateAndInviteRequest
var value unmarshaler
if err := json.Unmarshal(data, &value); err != nil {
return err
}
*u = UserCreateAndInviteRequest(value)
extraProperties, err := core.ExtractExtraProperties(data, *u)
if err != nil {
return err
}
u.extraProperties = extraProperties
u._rawJSON = json.RawMessage(data)
return nil
}
func (u *UserCreateAndInviteRequest) String() string {
if len(u._rawJSON) > 0 {
if value, err := core.StringifyJSON(u._rawJSON); err == nil {
return value
}
}
if value, err := core.StringifyJSON(u); err == nil {
return value
}
return fmt.Sprintf("%#v", u)
}
type UserWithRolesResponse struct {
Data *UserWithRoles `json:"data,omitempty" url:"data,omitempty"`
extraProperties map[string]interface{}
_rawJSON json.RawMessage
}
func (u *UserWithRolesResponse) GetExtraProperties() map[string]interface{} {
return u.extraProperties
}
func (u *UserWithRolesResponse) UnmarshalJSON(data []byte) error {
type unmarshaler UserWithRolesResponse
var value unmarshaler
if err := json.Unmarshal(data, &value); err != nil {
return err
}
*u = UserWithRolesResponse(value)
extraProperties, err := core.ExtractExtraProperties(data, *u)
if err != nil {
return err
}
u.extraProperties = extraProperties
u._rawJSON = json.RawMessage(data)
return nil
}
func (u *UserWithRolesResponse) String() string {
if len(u._rawJSON) > 0 {
if value, err := core.StringifyJSON(u._rawJSON); err == nil {
return value
}
}
if value, err := core.StringifyJSON(u); err == nil {
return value
}
return fmt.Sprintf("%#v", u)
}
type UpdateUserRequest struct {
Name *string `json:"name,omitempty" url:"-"`
Dashboard *int `json:"dashboard,omitempty" url:"-"`
}