Documentation ¶
Index ¶
- Constants
- func CheckResponse(r *http.Response) error
- func CreateSessionEndpoint() *url.URL
- func Decode(r *http.Request, data interface{}) error
- func Endpoint(parts ...string) *url.URL
- func IsZero(v reflect.Value) bool
- type Archive
- type ArchiveList
- type ArchiveMode
- type Claims
- type Exception
- type OpenTok
- func (openT *OpenTok) AuthenticationKey() (string, error)
- func (openT *OpenTok) CreateSession(location, archiveMode string) (*Session, error)
- func (openT *OpenTok) New(apiKey int, apiSecret string, httpClient *http.Client) *OpenTok
- func (openT *OpenTok) NewRequest(method string, u *url.URL, body io.Reader, withAuth bool) (*http.Request, error)
- type Pagination
- type Response
- type Session
- type Timestamp
Constants ¶
const (
// TokenSentinel ...
TokenSentinel = "T1=="
)
Variables ¶
This section is empty.
Functions ¶
func CreateSessionEndpoint ¶
CreateSessionEndpoint constuct create session API endpoint, which should return an *url.URL.
Types ¶
type Archive ¶
type Archive struct { // CreatedAt represents unix timestamp that specified when the archive was // created. CreatedAt int64 `json:"createdAt"` // Duration of the archive in seconds. Duration int64 `json:"duration"` // ID of the archive. This is a unique id identifier for the archive. // It's used to stop, retrieve and delete archives. ID string `json:"id"` // Name for the archive. The user can choose any name but it doesn't // necessarily need to be different between archives. Name string `json:"name"` // APIKey to which the archive belongs. APIKey int `json:"partnerId"` // SessionID to which the archive belongs. SessionID string `json:"sessionId"` // Size of the archives in KB. Size int `json:"size"` // URL from where the archive can be retrieved. This is only useful if the // archive is in status available in the OpenTok S3 Account. URL string `json:"url"` // Status of the Archive. // The possibilities are: // - `started`: if the archive is being recorded // - `stopped`: if the archive has been stopped and it hasn't been uploaded or available // - `deleted`: if the archive has been deleted. Only available archives can be deleted // - `uploaded`: if the archive has been uploaded to the partner storage account // - `paused`: if the archive has not been stopped but it is not recording. It can transition to Started again // - `available`: if the archive has been uploaded to the OpenTok S3 account // - `expired`: available archives are removed from the OpenTok S3 account after 3 days. Their status become expired. Status string `json:"status"` // HasAudio tells whether the archive contains an audio stream. HasAudio bool `json:"hasAudio"` // HasVideo tells whether the archive contains a video stream. HasVideo bool `json:"hasVideo"` }
Archive holds all the information retrieved from the server.
type ArchiveList ¶
ArchiveList will hold the list of archives retrieved from opentok service.
type ArchiveMode ¶
type ArchiveMode string
ArchiveMode denotes different modes for an archive. Ref: https://tokbox.com/developer/rest/#start_archive
const ( // ArchiveModeManual is the string representation of archive mode status `manual`. ArchiveModeManual ArchiveMode = "manual" // ArchiveModeAlways is the string representation of archive mode status `always`. ArchiveModeAlways ArchiveMode = "always" )
type Claims ¶
type Claims struct { IST string `json:"ist,omitempty"` jwt.StandardClaims }
Claims ... Ref: https://tokbox.com/developer/rest/#authentication
type Exception ¶
type Exception struct { Status int `json:"status"` Message string `json:"message"` Code int `json:"code"` MoreInfo string `json:"more_info"` }
Exception holds information about error response.
type OpenTok ¶
type OpenTok struct { // APIKey that you get after creating a project at the `OpenTok Dashboard`. APIKey int // APISecret that you get after creating a project with the `OpenTok Dashboard`. APISecret string // PartnerAuth ... PartnerAuth string // UserAgent ... UserAgent string Client httpClient }
OpenTok holds all the necessary information to create sessions and interact with the OpenTok platform.
func (*OpenTok) AuthenticationKey ¶
AuthenticationKey ...
func (*OpenTok) CreateSession ¶
CreateSession should generate a new session. Sample Response: [
{ "properties": null, "session_id": "1_MX40NjEwNTE4Mn5-MTUyNTAzMTQzNTUyMX4wczhaSThsS3VoVzY2eWxiRkFlN2srZFB-fg", "project_id": "46105182", "partner_id": "46105182", "create_dt": "Sun Apr 29 12:50:35 PDT 2018", "session_status": null, "status_invalid": null, "media_server_hostname": null, "messaging_server_url": null, "messaging_url": null, "symphony_address": null, "ice_server": null, "ice_servers": null, "ice_credential_expiration": 86100 }
]
type Pagination ¶
type Pagination struct { Page int `json:"page"` NumPages int `json:"num_pages"` PageSize int `json:"page_size"` Total int `json:"total"` Start int `json:"start"` End int `json:"end"` URI string `json:"uri"` FirstPageURI string `json:"first_page_uri"` PreviousPageURI string `json:"previous_page_uri"` NextPageURI string `json:"next_page_uri"` LastPageURI string `json:"last_page_uri"` }
Pagination ...
type Session ¶
type Session struct { Properties string `json:"properties,omitempty"` SessionID string `json:"session_id,omitempty"` ProjectID string `json:"project_id,omitempty"` PartnerID string `json:"partner_id,omitempty"` CreateDate string `json:"create_dt"` SessionStatus string `json:"session_status,omitempty"` SessionInvalid string `json:"session_invalid,omitempty"` MediaServerHostname string `json:"media_server_hostname,omitempty"` MessagingServerURL string `json:"messaging_server_url,omitempty"` MessagingURL string `json:"messaging_url,omitempty"` SymphonyAddress string `json:"symphony_address,omitempty"` IceServer string `json:"ice_server,omitempty"` IceServers string `json:"ice_servers,omitempty"` IceCredentialExpiration int `json:"ice_credential_expiration,omitempty"` }
Session represents a single session for the clients to communicate.