room

package
v0.0.0-...-7f9836d Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: May 21, 2023 License: BSD-3-Clause Imports: 15 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (
	ErrFailUnmarshal  = errors.New("failed to unmarshal response body into Room")
	ErrFailRoomDelete = errors.New("failed to delete room")
)

Functions

func Delete

func Delete(creds auth.Creds, roomName string) error

func GetRoomPropsKeys

func GetRoomPropsKeys() []string

func NewErrFailRoomDelete

func NewErrFailRoomDelete(deleteErr error) error

func NewErrFailUnmarshal

func NewErrFailUnmarshal(unmarshalErr error) error

func SendAppMessage

func SendAppMessage(creds auth.Creds, params SendAppMessageParams) error

func Update

func Update(params UpdateParams) error

Types

type CreateParams

type CreateParams struct {
	Name            string
	IsPrivate       bool
	Props           Props
	AdditionalProps map[string]interface{}
	Prefix          string
}

type GetManyParams

type GetManyParams struct {
	Limit         int    `json:"limit"`
	EndingBefore  string `json:"ending_before"`
	StartingAfter string `json:"starting_after"`
}

type Privacy

type Privacy string
const (
	PrivacyPrivate Privacy = "private"
	PrivacyPublic          = "public"
)

type Props

type Props struct {
	// Exp should be a Unix timestamp, but we'll provide
	// some helper methods to let caller work with time.Time
	// as well
	Exp             int64 `json:"exp,omitempty"`
	MaxParticipants int   `json:"max_participants,omitempty"`
	StartAudioOff   bool  `json:"start_audio_off"`
	StartVideoOff   bool  `json:"start_video_off"`
}

Props represents common properties the user can set when creating or updating a room. This does not represent _all_ properties supported by Daily rooms.

func (*Props) GetExpiry

func (p *Props) GetExpiry() time.Time

GetExpiry retrieves the room expiry

func (*Props) SetExpiry

func (p *Props) SetExpiry(expiry time.Time)

SetExpiry sets the room expiry as a Unix timestamp

type Room

type Room struct {
	ID              string    `json:"id"`
	Name            string    `json:"name"`
	Url             string    `json:"url"`
	Privacy         Privacy   `json:"privacy"`
	CreatedAt       time.Time `json:"created_at"`
	Config          Props     `json:"config"`
	AdditionalProps map[string]interface{}
}

Room represents a Daily room

func Create

func Create(creds auth.Creds, params CreateParams) (*Room, error)

func CreateWithPrefix

func CreateWithPrefix(creds auth.Creds, params CreateParams) (*Room, error)

CreateWithPrefix creates a room with the name containing the specified prefix. The rest of the name is randomized.

func GetMany

func GetMany(creds auth.Creds, params *GetManyParams) ([]Room, error)

func GetManyWithRegex

func GetManyWithRegex(creds auth.Creds, params *GetManyParams, regex *regexp.Regexp) ([]Room, error)

func GetOne

func GetOne(creds auth.Creds, roomName string) (*Room, error)

func (*Room) UnmarshalJSON

func (r *Room) UnmarshalJSON(data []byte) error

type SendAppMessageParams

type SendAppMessageParams struct {
	RoomName  string
	Data      string
	Recipient string
}

type UpdateParams

type UpdateParams struct {
	Creds           auth.Creds
	Name            string
	Privacy         *Privacy
	Props           Props
	AdditionalProps map[string]interface{}
}

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL