Skip to content
This repository has been archived by the owner on Sep 15, 2022. It is now read-only.

Commit

Permalink
Implement GetWebinarPanelist endpoint
Browse files Browse the repository at this point in the history
  • Loading branch information
Rafe Colton committed Dec 4, 2018
1 parent 530f795 commit 872df3c
Show file tree
Hide file tree
Showing 6 changed files with 77 additions and 67 deletions.
4 changes: 2 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -33,13 +33,13 @@ As with any major API update, there are some breaking changes:
- [x] `GetUser`
- [x] `GetUserByEmail` *(deprecated)*
- [x] `GetWebinarInfo`
- [ ] `GetWebinarPanelist`
- [x] `GetWebinarPanelist`
- [x] `GetWebinarRegistrationInfo` *(deprecated)*
- [x] `ListRegistrants`
- [x] `ListRegistrationWebinars` *(deprecated)*
- [x] `ListUsers`
- [x] `ListWebinars`
- [ ] `RegisterForWebinar`
- [x] `RegisterForWebinar`

## About

Expand Down
Binary file modified _example/_example
Binary file not shown.
7 changes: 7 additions & 0 deletions _example/webinar.go
Original file line number Diff line number Diff line change
Expand Up @@ -89,4 +89,11 @@ func main() {
}

log.Printf("Got registration information: %+v\n", registrationInfo)

panelists, err := zoom.GetWebinarPanelists(webinar.ID)
if err != nil {
log.Fatalf("got error listing webinar panelists for webinar %d: %+v\n", webinar.ID, err)
}

log.Printf("Got webinar panelists: %+v\n", panelists)
}
57 changes: 31 additions & 26 deletions webinar.go
Original file line number Diff line number Diff line change
Expand Up @@ -8,11 +8,39 @@ const (

// GetWebinarInfoPath - v2 path for retrieving info on a single webinar
GetWebinarInfoPath = "/webinars/%d"

// GetWebinarPanelistsPath - v1 path for listing panelists for a webinar
GetWebinarPanelistsPath = "/webinar/panelists"
)

// 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"`
Expand Down Expand Up @@ -61,26 +89,3 @@ func (c *Client) GetWebinarInfo(webinarID int) (Webinar, error) {
Ret: &ret,
})
}

// GetWebinarPanelistsOptions - options for retrieving webinar panelist info
type GetWebinarPanelistsOptions struct {
WebinarID int `url:"id"`
HostID string `url:"host_id"`
}

// GetWebinarPanelistsResponse - response from call to /webinar/panelists
type GetWebinarPanelistsResponse struct {
TotalRecords int `json:"total_records"`
Panelists []WebinarPanelist `json:"panelists"`
}

// GetWebinarPanelists calls /webinar/panelists using the default client
func GetWebinarPanelists(opts ...GetWebinarPanelistsOptions) (GetWebinarPanelistsResponse, error) {
return defaultClient.GetWebinarPanelists(opts...)
}

// GetWebinarPanelists calls /webinar/panelists using client c
func (c *Client) GetWebinarPanelists(opts ...GetWebinarPanelistsOptions) (GetWebinarPanelistsResponse, error) {
var ret = GetWebinarPanelistsResponse{}
return ret, request(c, GetWebinarPanelistsPath, opts, &ret)
}
37 changes: 37 additions & 0 deletions webinar_panelist.go
Original file line number Diff line number Diff line change
@@ -0,0 +1,37 @@
package zoom

import "fmt"

const (
// GetWebinarPanelistsPath - v2 path for listing panelists for a webinar
GetWebinarPanelistsPath = "/webinars/%d/panelists"
)

// WebinarPanelist contains information returned by /webinar/panelists
type WebinarPanelist struct {
ID string `json:"id"`
Name string `json:"name"`
Email string `json:"email"`
JoinURL *URL `json:"join_url"`
}

// GetWebinarPanelistsResponse - response from call to /webinar/panelists
type GetWebinarPanelistsResponse struct {
TotalRecords int `json:"total_records"`
Panelists []WebinarPanelist `json:"panelists"`
}

// GetWebinarPanelists calls /webinar/panelists using the default client
func GetWebinarPanelists(webinarID int) (GetWebinarPanelistsResponse, error) {
return defaultClient.GetWebinarPanelists(webinarID)
}

// GetWebinarPanelists calls /webinar/panelists using client c
func (c *Client) GetWebinarPanelists(webinarID int) (GetWebinarPanelistsResponse, error) {
var ret = GetWebinarPanelistsResponse{}
return ret, c.requestV2(requestV2Opts{
Method: Get,
Path: fmt.Sprintf(GetWebinarPanelistsPath, webinarID),
Ret: &ret,
})
}
39 changes: 0 additions & 39 deletions webinar_type.go

This file was deleted.

0 comments on commit 872df3c

Please sign in to comment.