This repository has been archived by the owner on Sep 15, 2022. It is now read-only.
forked from zoom-lib-golang/zoom-lib-golang
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathuser.go
65 lines (55 loc) · 1.94 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
54
55
56
57
58
59
60
61
62
63
64
65
package zoom // Use this file for /user endpoints
import "fmt"
const (
// ListUsersPath - v2 path for listing users
ListUsersPath = "/users"
// GetUserPath - v2 path for getting a specific user
GetUserPath = "/users/%s"
)
// ListUsersResponse contains the response from a call to ListUsers
type ListUsersResponse struct {
TotalRecords int `json:"total_records"`
PageCount int `json:"page_count"`
PageNumber int `json:"page_number"`
PageSize int `json:"page_size"`
Users []User `json:"users"`
}
// ListUsersOptions contains options for ListUsers
type ListUsersOptions struct {
PageSize int `url:"page_size"`
PageNumber int `url:"page_number"`
Status *UserStatus `url:"status,omitempty"`
}
// ListUsers calls /user/list, listing all users, using the default client
func ListUsers(opts ListUsersOptions) (ListUsersResponse, error) {
return defaultClient.ListUsers(opts)
}
// ListUsers calls /user/list, listing all users, using client c
func (c *Client) ListUsers(opts ListUsersOptions) (ListUsersResponse, error) {
var ret = ListUsersResponse{}
return ret, c.requestV2(requestV2Opts{
Method: Get,
Path: ListUsersPath,
URLParameters: opts,
Ret: &ret,
})
}
// GetUserOpts contains options for GetUser
type GetUserOpts struct {
EmailOrID string `url:"-"`
LoginType *UserLoginType `url:"login_type,omitempty"` // use pointer so it can be null
}
// GetUser calls /users/{userId}, searching for a user by ID or email, using the default client
func GetUser(opts GetUserOpts) (User, error) {
return defaultClient.GetUser(opts)
}
// GetUser calls /users/{userId}, searching for a user by ID or email, using a specific client
func (c *Client) GetUser(opts GetUserOpts) (User, error) {
var ret = User{}
return ret, c.requestV2(requestV2Opts{
Method: Get,
Path: fmt.Sprintf(GetUserPath, opts.EmailOrID),
URLParameters: opts,
Ret: &ret,
})
}