-
Notifications
You must be signed in to change notification settings - Fork 1
/
user.go
40 lines (35 loc) · 1.14 KB
/
user.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
package payloads
import (
"io"
)
type UserEmail struct {
Value string `json:"value"`
Type string `json:"type"`
Primary bool `json:"primary"`
}
type CreateScimUserPayload struct {
Schemas []string `json:"schemas"`
Username string `json:"userName"`
ID string `json:"id"`
ExternalID string `json:"externalId"`
Name map[string]string `json:"name"`
Emails []UserEmail `json:"emails"`
Nickname string `json:"nickName"`
DisplayName string `json:"displayName"`
Active bool `json:"active"`
PreferredLanguage string `json:"preferredLanguage"`
Locale string `json:"locale"`
Title string `json:"title"`
UserType string `json:"userType"`
Timezone string `json:"timezone"`
}
func Parse(r io.Reader) (*CreateScimUserPayload, error) {
payload := CreateScimUserPayload{
Active: true,
}
err := decodeJSON(r, &payload)
if err != nil {
return nil, err
}
return &payload, nil
}