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 pathreport_webinars.go
64 lines (57 loc) · 1.84 KB
/
report_webinars.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
// Report endpoints
package zoom
import (
"fmt"
"strconv"
)
const (
ParticipantReportPath = "/report/webinars/%s/participants"
)
// WebinarParticipant represents a participant for a particular webinar
type WebinarParticipant struct {
ID string `json:"id"`
UserID string `json:"user_id"`
Name string `json:"name"`
UserEmail string `json:"user_email"`
JoinTime Time `json:"join_time"`
LeaveTime Time `json:"leave_time"`
Duration int `json:"duration"`
}
// ParticipantsOptions contains options for Participants.
type ParticipantsOptions struct {
WebinarID int `url:"-"`
WebinarUUID string `url:"-"`
PageSize int `json:"page_size"`
NextPageToken string `json:"next_page_token"`
}
// ParticipantsResponse represents the response from the API
type ParticipantsResponse struct {
PageCount int `json:"page_count"`
PageSize int `json:"page_size"`
TotalRecords int `json:"total_records"`
NextPageToken string `json:"next_page_token"`
Participants []WebinarParticipant `json:"participants"`
}
// Participants delegates to the Client method of the same name
func Participants(opts ParticipantsOptions) (ParticipantsResponse, error) {
return defaultClient.Participants(opts)
}
// Participants calls /report/webinars/{webinarId}/participants,
// listing all participants for the given webinar
func (c *Client) Participants(opts ParticipantsOptions) (ParticipantsResponse, error) {
var (
ret = ParticipantsResponse{}
path string
)
if len(opts.WebinarUUID) > 0 {
path = fmt.Sprintf(ParticipantReportPath, opts.WebinarUUID)
} else {
path = fmt.Sprintf(ParticipantReportPath, strconv.Itoa(opts.WebinarID))
}
return ret, c.requestV2(requestV2Opts{
Method: Get,
Path: path,
URLParameters: &opts,
Ret: &ret,
})
}