Documentation ¶
Overview ¶
Package whereby contains a client for communicating with the Whereby API.
Index ¶
Examples ¶
Constants ¶
This section is empty.
Variables ¶
var ErrInvalidCredentials = errors.New("invalid credentials")
var ErrNotFound = errors.New("meeting not found")
Functions ¶
This section is empty.
Types ¶
type Client ¶
type Client struct {
// contains filtered or unexported fields
}
Client is the Whereby client. It must be created using NewClient.
func (*Client) CreateMeeting ¶
func (c *Client) CreateMeeting(ctx context.Context, input CreateMeetingInput) (CreateMeetingOutput, error)
CreateMeeting creates a meeting as specified. It will also create a transient room that is guaranteed to be available for specified start and end time. Some time after the meeting has ended, the transient room will be automatically deleted. The URL to this room is present in the response.
See https://whereby.dev/http-api/#/paths/~1meetings/post for more details.
Example ¶
Create a meeting and print the URL to stdout
wb := whereby.NewClient(os.Getenv("WHEREBY_API_KEY")) meeting, err := wb.CreateMeeting(context.Background(), whereby.CreateMeetingInput{ End: time.Now().Add(time.Hour), }) if err != nil { log.Printf("Something went wrong: %v\n", err) } fmt.Println(meeting.URL)
Output:
func (*Client) DeleteMeeting ¶
DeleteMeeting deletes the specified meeting. The endpoint is idempotent, meaning it will return the same response even if the meeting has already been deleted.
See https://whereby.dev/http-api/#/paths/~1meetings~1{meetingId}/delete for more details.
func (*Client) GetMeeting ¶
func (c *Client) GetMeeting(ctx context.Context, meetingID string, opts ...GetMeetingOpt) (GetMeetingOutput, error)
GetMeeting returns the specified meeting.
See https://whereby.dev/http-api/#/paths/~1meetings~1{meetingId}/get for more details.
type CreateMeetingInput ¶
type CreateMeetingInput struct { // The initial lock state of the room. If true, only hosts will be able to // let in other participants and change lock state. IsLocked bool // This will be used as the prefix for the room name. The string should be // lowercase, and spaces will be automatically removed. RoomNamePrefix string // The format of the randomly generated room name. uuid is the default room // name pattern and follows the usual 8-4-4-4-12 pattern. human-short // generates a shorter string made up of six distinguishable characters. RoomNamePattern RoomNamePattern // The mode of the created transient room. normal is the default room mode // and should be used for meetings up to 4 participants. group should be // used for meetings that require more than 4 participants. RoomMode RoomMode // When the meeting starts. By default in UTC but a timezone can be // specified, e.g. 2021-05-07T17:42:49-05:00. This date must be in // the future. // // Deprecated: Value is ignored Start time.Time // When the meeting ends. By default in UTC but a timezone can be // specified, e.g. 2021-05-07T17:42:49-05:00. This has to be the same or // after the current date. End time.Time // Include hostRoomUrl field in the meeting response. WithHostURL bool }
type CreateMeetingOutput ¶
type CreateMeetingOutput = GetMeetingOutput
type GetMeetingOpt ¶
type GetMeetingOpt func(*getMeetingOpts) error
GetMeetingOpt is an option for GetMeeting.
func WithHostURL ¶
func WithHostURL(include bool) GetMeetingOpt
type GetMeetingOutput ¶
type GetMeetingOutput struct { // The ID of the meeting. MeetingID string // When the meeting starts. Always in UTC, regardless of the input timezone. Start time.Time // When the meeting ends. Always in UTC, regardless of the input timezone. End time.Time // The URL to room where the meeting will be hosted. URL string // The URL to room where the meeting will be hosted which will also make // the user the host of the meeting. A host will get additional privileges // like locking the room, and removing and muting participants, so you //should be careful with whom you share this URL. The user will only become // a host if the meeting is on-going (some additional slack is added to // allow a host joining the meeting ahead of time or if the meeting goes // over time). This field is optional and will only provided if requested // through fields parameter. HostURL string }
type RateLimitedError ¶
type RateLimitedError struct {
// contains filtered or unexported fields
}
func (RateLimitedError) Error ¶
func (e RateLimitedError) Error() string
func (RateLimitedError) TimeLeft ¶
func (e RateLimitedError) TimeLeft() time.Duration
type RoomNamePattern ¶
type RoomNamePattern string
const ( DefaultNamePattern RoomNamePattern = "" UUIDNamePattern RoomNamePattern = "uuid" HumanReadableNamePattern RoomNamePattern = "human-short" )