-
Notifications
You must be signed in to change notification settings - Fork 39
/
user.go
53 lines (41 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
41
42
43
44
45
46
47
48
49
50
51
52
53
package notion
type UserType string
const (
UserTypePerson UserType = "person"
UserTypeBot UserType = "bot"
)
type Person struct {
Email string `json:"email"`
}
type Bot struct {
Owner BotOwner `json:"owner"`
}
type BotOwnerType string
const (
BotOwnerTypeWorkspace BotOwnerType = "workspace"
BotOwnerTypeUser BotOwnerType = "user"
)
type BotOwner struct {
Type BotOwnerType `json:"type"`
Workspace bool `json:"workspace"`
User *User `json:"user"`
}
// BaseUser contains the fields that are always returned for user objects.
// See: https://developers.notion.com/reference/user#where-user-objects-appear-in-the-api
type BaseUser struct {
ID string `json:"id"`
}
type User struct {
BaseUser
Type UserType `json:"type"`
Name string `json:"name"`
AvatarURL string `json:"avatar_url"`
Person *Person `json:"person"`
Bot *Bot `json:"bot"`
}
// ListUsersResponse contains results (users) and pagination data returned from a list request.
type ListUsersResponse struct {
Results []User `json:"results"`
HasMore bool `json:"has_more"`
NextCursor *string `json:"next_cursor"`
}