{-# LANGUAGE OverloadedStrings #-}
module OpenTok
( OpenTok(apiKey, secret)
, opentok
, createSession
, generateToken
, Token
, TokenOptions
, tokenOpts
, startArchive
, stopArchive
)
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: " <> 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 (apiKey ot) (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)