forked from zoom-lib-golang/zoom-lib-golang
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathwebinar.go
91 lines (80 loc) · 3.55 KB
/
webinar.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
package zoom // Use this file for /webinar endpoints
import "fmt"
const (
// ListWebinarsPath - v2 lists all webinars
ListWebinarsPath = "/users/%s/webinars"
// GetWebinarInfoPath - v2 path for retrieving info on a single webinar
GetWebinarInfoPath = "/webinars/%d"
)
// Webinar represents a webinar object
type Webinar struct {
UUID string `json:"uuid"`
ID int `json:"id"`
StartURL string `json:"start_url"`
JoinURL string `json:"join_url"`
RegistrationURL string `json:"registration_url"`
CreatedAt *Time `json:"created_at"`
HostID string `json:"host_id"`
Topic string `json:"topic"`
Type WebinarType `json:"type"`
StartTime *Time `json:"start_time"`
Duration int `json:"duration"`
Timezone string `json:"timezone"`
Agenda string `json:"agenda"`
OptionStartType string `json:"option_start_type"`
OptionAudio string `json:"option_audio"`
OptionEnforceLogin bool `json:"option_enforce_login"`
OptionEnforceLoginDomains string `json:"option_enforce_login_domains"`
OptionAlternativeHosts string `json:"option_alternative_hosts"`
Status int `json:"status"`
Occurrences []WebinarOccurrence `json:"occurrences"`
}
// WebinarOccurrence contains recurrence data for recurring webinars
type WebinarOccurrence struct {
OccurrenceID string `json:"occurrence_id"`
StartTime *Time `json:"start_time"`
Duration int `json:"duration"`
}
// ListWebinarsResponse contains the response from a call to ListWebinars
type ListWebinarsResponse struct {
PageCount int `json:"page_count"`
TotalRecords int `json:"total_records"`
PageNumber int `json:"page_number"`
PageSize int `json:"page_size"`
Webinars []Webinar `json:"webinars"`
}
// ListWebinarsOptions contains options for ListWebinars. Also accepts email address for HostID
type ListWebinarsOptions struct {
HostID string `url:"-"`
PageSize *int `url:"page_size,omitempty"`
PageNumber *int `url:"page_number,omitempty"`
}
// ListWebinars calls /webinar/list, listing all webinars that don't require
// registration, using the default client
func ListWebinars(opts ListWebinarsOptions) (ListWebinarsResponse, error) {
return defaultClient.ListWebinars(opts)
}
// ListWebinars calls /webinar/list, listing all webinars that don't require
// registration, using the client c
func (c *Client) ListWebinars(opts ListWebinarsOptions) (ListWebinarsResponse, error) {
var ret = ListWebinarsResponse{}
return ret, c.requestV2(requestV2Opts{
Method: Get,
Path: fmt.Sprintf(ListWebinarsPath, opts.HostID),
URLParameters: &opts,
Ret: &ret,
})
}
// GetWebinarInfo gets into about a single webinar, using the default client
func GetWebinarInfo(webinarID int) (Webinar, error) {
return defaultClient.GetWebinarInfo(webinarID)
}
// GetWebinarInfo gets into about a single webinar, using client c
func (c *Client) GetWebinarInfo(webinarID int) (Webinar, error) {
var ret = Webinar{}
return ret, c.requestV2(requestV2Opts{
Method: Get,
Path: fmt.Sprintf(GetWebinarInfoPath, webinarID),
Ret: &ret,
})
}