{-# LANGUAGE OverloadedStrings #-}
module OpenTok
( OpenTok(apiKey, secret)
, opentok
, createSession
, generateToken
, Token
, TokenOptions
, tokenOpts
, startArchive
, stopArchive
, listArchives
, deleteArchive
)
where
import Prelude ( )
import Prelude.Compat
import Data.Semigroup ( (<>) )
import OpenTok.Archive
import OpenTok.Session
import OpenTok.Token
import OpenTok.Client
import OpenTok.Types
data OpenTok = OpenTok {
apiKey :: APIKey,
secret :: APISecret,
client :: Client
}
instance Show OpenTok where
show ot = "OpenTok { APIKey: " <> OpenTok.apiKey ot <> ", Secret: *_*_*_*_*_* }"
opentok :: APIKey -> APISecret -> OpenTok
opentok k s = OpenTok k s (OpenTok.Client.Client k s)
createSession :: OpenTok -> SessionOptions -> IO (Either OTError Session)
createSession ot = OpenTok.Session.create (client ot)
generateToken :: OpenTok -> SessionId -> TokenOptions -> IO (Either OTError Token)
generateToken ot = OpenTok.Token.generate (OpenTok.apiKey ot) (OpenTok.secret ot)
startArchive :: OpenTok -> ArchiveOptions -> IO (Either OTError Archive)
startArchive ot = OpenTok.Archive.start (client ot)
stopArchive :: OpenTok -> ArchiveId -> IO (Either OTError Archive)
stopArchive ot = OpenTok.Archive.stop (client ot)
listArchives :: OpenTok -> ListArchiveOptions -> IO (Either OTError ArchiveCollection)
listArchives ot = OpenTok.Archive.list (client ot)
deleteArchive :: OpenTok -> ArchiveId -> IO (Either OTError ArchiveId)
deleteArchive ot = OpenTok.Archive.delete (client ot)