Copyright | (c) Naoto Shimazaki 20172018 |
---|---|
License | MIT (see the file LICENSE) |
Maintainer | https://github.com/nshimaza |
Stability | experimental |
Safe Haskell | None |
Language | Haskell2010 |
This module provides types and functions for accessing Cisco Webex Teams REST API.
The module is designed to improve type safety over the API. Each entity is separately typed. JSON messages contained in REST responses are decoded into appropriate type of Haskell record. JSON messages sent in REST requests are encoded only from correct type of record.
Some Webex Teams REST API return list of objects. Those APIs require HTTP Link Header based pagination. Haskell functions for those APIs automatically request subsequent pages as needed.
Examples
-- Sending a message to a room. let auth = Authorization "your authorization token" roomId = RoomId "Room ID your message to be sent" messageText = MessageText "your message" message = CreateMessage (Just roomId) Nothing Nothing (Just messageText) Nothing Nothing createEntity auth def createMessage >>= print . getResponseBody -- Obtaining detail of a user. let personId = PersonId "your person ID" getDetail auth def personId >>= print . getResponseBody -- Obtaining membership of a room as stream of object representing each membership relation. let filter = MembershipFilter yourRoomId Nothing Nothing runConduit $ streamListWithFilter auth def filter .| takeC 200 .| mapM_C print -- Create a room. let createRoom = CreateRoom "Title of the new room" Nothing createEntity auth def createRoom >>= print . getResponseBody -- Delete a room. deleteRoom auth def roomId >>= print . getResponseBody
List and steaming
The WebexTeams
module doesn't provide streaming API for REST response returning list of entities.
It is because the author of the package wants to keep it streaming library agnostic. Instead, it provides
ListReader
IO action to read list responses with automatic pagenation. Streaming APIs can be found in
separate packages like webex-teams-pipes or webex-teams-conduit.
Support for Lens
This package provides many of records representing objects communicated via Webex Teams REST API. Those records are designed to allow create lenses by Control.Lens.TH.makeFields.
Following example creates overloaded accessors for Person
, Room
and Team
.
makeFields ''Person makeFields ''Room makeFields ''Team
You can access personId
, roomId
and teamId
via overloaded accessor function id
like this.
let yourPersonId = yourPerson ^. id yourRoomId = yourRoom ^. id yourTeamId = yourTeam ^. id
This package does not provide pre-generated lenses for you because not everyone need it but you can make it by yourself so easily as described.
Synopsis
- class (WebexTeamsApiPath a, WebexTeamsResponse a) => WebexTeamsFilter a
- class FromJSON (ToList i) => WebexTeamsListItem i
- type family ToResponse a :: *
- newtype Authorization = Authorization ByteString
- type CiscoSparkRequest = WebexTeamsRequest
- data WebexTeamsRequest = WebexTeamsRequest {}
- newtype Timestamp = Timestamp Text
- newtype ErrorCode = ErrorCode Text
- data ErrorTitle = ErrorTitle {}
- newtype Errors = Errors {}
- data Person = Person {
- personId :: PersonId
- personErrors :: Maybe Errors
- personEmails :: Maybe [Email]
- personDisplayName :: Maybe DisplayName
- personNickName :: Maybe NickName
- personFirstName :: Maybe FirstName
- personLastName :: Maybe LastName
- personAvatar :: Maybe AvatarUrl
- personOrgId :: Maybe OrganizationId
- personRoles :: Maybe [RoleId]
- personLicenses :: Maybe [LicenseId]
- personCreated :: Maybe Timestamp
- personTimezone :: Maybe Timezone
- personLastActivity :: Maybe Timestamp
- personStatus :: Maybe PersonStatus
- personInvitePending :: Maybe Bool
- personLoginEnabled :: Maybe Bool
- personType :: Maybe PersonType
- newtype PersonId = PersonId Text
- newtype Email = Email Text
- newtype DisplayName = DisplayName Text
- newtype NickName = NickName Text
- newtype FirstName = FirstName Text
- newtype LastName = LastName Text
- newtype AvatarUrl = AvatarUrl Text
- newtype Timezone = Timezone Text
- data PersonStatus
- data PersonType
- newtype PersonList = PersonList {
- personListItems :: [Person]
- data PersonFilter = PersonFilter {}
- data CreatePerson = CreatePerson {
- createPersonEmails :: Maybe [Email]
- createPersonDisplayName :: Maybe DisplayName
- createPersonFirstName :: Maybe FirstName
- createPersonLastName :: Maybe LastName
- createPersonAvatar :: Maybe AvatarUrl
- createPersonOrgId :: Maybe OrganizationId
- createPersonRoles :: Maybe [RoleId]
- createPersonLicenses :: Maybe [LicenseId]
- data UpdatePerson = UpdatePerson {}
- data Room = Room {}
- newtype RoomId = RoomId Text
- newtype RoomTitle = RoomTitle Text
- data RoomType
- newtype SipAddr = SipAddr Text
- newtype RoomList = RoomList {
- roomListItems :: [Room]
- data RoomFilter = RoomFilter {}
- data RoomFilterSortBy
- data CreateRoom = CreateRoom {}
- newtype UpdateRoom = UpdateRoom {}
- data Membership = Membership {
- membershipId :: MembershipId
- membershipErrors :: Maybe Errors
- membershipRoomId :: Maybe RoomId
- membershipPersonId :: Maybe PersonId
- membershipPersonEmail :: Maybe Email
- membershipPersonDisplayName :: Maybe DisplayName
- membershipPersonOrgId :: Maybe OrganizationId
- membershipIsModerator :: Maybe Bool
- membershipIsMonitor :: Maybe Bool
- membershipCreated :: Maybe Timestamp
- newtype MembershipId = MembershipId Text
- newtype MembershipList = MembershipList {}
- data MembershipFilter = MembershipFilter {}
- data CreateMembership = CreateMembership {}
- newtype UpdateMembership = UpdateMembership {}
- data Message = Message {
- messageId :: MessageId
- messageErrors :: Maybe Errors
- messageRoomId :: Maybe RoomId
- messageRoomType :: Maybe RoomType
- messageToPersonId :: Maybe PersonId
- messageToPersonEmail :: Maybe Email
- messageText :: Maybe MessageText
- messageHtml :: Maybe MessageHtml
- messageFiles :: Maybe [FileUrl]
- messagePersonId :: Maybe PersonId
- messagePersonEmail :: Maybe Email
- messageCreated :: Maybe Timestamp
- messageMentionedPeople :: Maybe [PersonId]
- newtype MessageId = MessageId Text
- newtype MessageText = MessageText Text
- newtype MessageHtml = MessageHtml Text
- newtype MessageMarkdown = MessageMarkdown Text
- newtype FileUrl = FileUrl Text
- newtype MessageList = MessageList {
- messageListItems :: [Message]
- data MessageFilter = MessageFilter {}
- data MentionedPeople
- data CreateMessage = CreateMessage {}
- newtype TeamName = TeamName Text
- newtype TeamId = TeamId Text
- data Team = Team {}
- newtype TeamList = TeamList {
- teamListItems :: [Team]
- newtype CreateTeam = CreateTeam {}
- newtype UpdateTeam = UpdateTeam {}
- data TeamMembership = TeamMembership {
- teamMembershipId :: TeamMembershipId
- teamMembershipErrors :: Maybe Errors
- teamMembershipTeamId :: Maybe TeamId
- teamMembershipPersonId :: Maybe PersonId
- teamMembershipPersonEmail :: Maybe Email
- teamMembershipPersonDisplayName :: Maybe DisplayName
- teamMembershipPersonOrgId :: Maybe OrganizationId
- teamMembershipIsModerator :: Maybe Bool
- teamMembershipCreated :: Maybe Timestamp
- newtype TeamMembershipId = TeamMembershipId Text
- newtype TeamMembershipList = TeamMembershipList {}
- newtype TeamMembershipFilter = TeamMembershipFilter {}
- data CreateTeamMembership = CreateTeamMembership {}
- newtype UpdateTeamMembership = UpdateTeamMembership {}
- data Organization = Organization {}
- newtype OrganizationId = OrganizationId Text
- newtype OrganizationDisplayName = OrganizationDisplayName Text
- newtype OrganizationList = OrganizationList {}
- data License = License {}
- newtype LicenseId = LicenseId Text
- newtype LicenseName = LicenseName Text
- newtype LicenseUnit = LicenseUnit Integer
- newtype LicenseList = LicenseList {
- licenseListItems :: [License]
- newtype LicenseFilter = LicenseFilter {}
- data Role = Role {}
- newtype RoleId = RoleId Text
- newtype RoleName = RoleName Text
- newtype RoleList = RoleList {
- roleListItems :: [Role]
- getDetail :: (MonadIO m, WebexTeamsDetail key) => Authorization -> WebexTeamsRequest -> key -> m (Response (ToResponse key))
- getDetailEither :: (MonadIO m, WebexTeamsDetail key) => Authorization -> WebexTeamsRequest -> key -> m (Response (Either JSONException (ToResponse key)))
- type ListReader a = IO [a]
- getListWithFilter :: (MonadIO m, WebexTeamsFilter filter, WebexTeamsListItem (ToResponse filter)) => Authorization -> WebexTeamsRequest -> filter -> m (ListReader (ToResponse filter))
- getTeamList :: MonadIO m => Authorization -> WebexTeamsRequest -> m (ListReader Team)
- getOrganizationList :: MonadIO m => Authorization -> WebexTeamsRequest -> m (ListReader Organization)
- getRoleList :: MonadIO m => Authorization -> WebexTeamsRequest -> m (ListReader Role)
- streamEntityWithFilter :: (MonadIO m, WebexTeamsFilter filter, WebexTeamsListItem (ToResponse filter)) => Authorization -> WebexTeamsRequest -> filter -> ConduitT () (ToResponse filter) m ()
- streamTeamList :: MonadIO m => Authorization -> WebexTeamsRequest -> ConduitT () Team m ()
- streamOrganizationList :: MonadIO m => Authorization -> WebexTeamsRequest -> ConduitT () Organization m ()
- streamRoleList :: MonadIO m => Authorization -> WebexTeamsRequest -> ConduitT () Role m ()
- createEntity :: (MonadIO m, WebexTeamsCreate createParams) => Authorization -> WebexTeamsRequest -> createParams -> m (Response (ToResponse createParams))
- createEntityEither :: (MonadIO m, WebexTeamsCreate createParams) => Authorization -> WebexTeamsRequest -> createParams -> m (Response (Either JSONException (ToResponse createParams)))
- updateEntity :: (MonadIO m, WebexTeamsUpdate updateParams) => Authorization -> WebexTeamsRequest -> updateParams -> m (Response (ToResponse updateParams))
- updateEntityEither :: (MonadIO m, WebexTeamsUpdate updateParams) => Authorization -> WebexTeamsRequest -> updateParams -> m (Response (Either JSONException (ToResponse updateParams)))
- defaultMessageFilter :: RoomId -> MessageFilter
- defaultTeamMembershipFilter :: TeamId -> TeamMembershipFilter
- deleteRoom :: MonadIO m => Authorization -> WebexTeamsRequest -> RoomId -> m (Response ())
- deleteMembership :: MonadIO m => Authorization -> WebexTeamsRequest -> MembershipId -> m (Response ())
- deleteMessage :: MonadIO m => Authorization -> WebexTeamsRequest -> MessageId -> m (Response ())
- deleteTeam :: MonadIO m => Authorization -> WebexTeamsRequest -> TeamId -> m (Response ())
- deleteTeamMembership :: MonadIO m => Authorization -> WebexTeamsRequest -> TeamMembershipId -> m (Response ())
Types
Class and Type Families
class (WebexTeamsApiPath a, WebexTeamsResponse a) => WebexTeamsFilter a Source #
Convert given filter condition parameter in a concrete type to HTTP query strings.
Instances
class FromJSON (ToList i) => WebexTeamsListItem i Source #
WebexTeamsListItem is a type class grouping types with following common usage.
- It is used for return value of get-detail APIs.
- It is used for element of return value of list APIs.
WebexTeamsListItem also associates the above type to wrapping list type (e.g. associates Person
to PersonList
).
Wrapping type (PersonList in this case) is necessary for parsing JSON from REST API but what we are
interested in is bare list such like [Person]. Type family association defined in this class
is used for type translation from type of items to type of wrapper.
Instances
WebexTeamsListItem Person Source # |
|
WebexTeamsListItem Team Source # | |
WebexTeamsListItem TeamMembership Source # | |
Defined in Network.WebexTeams.Types type ToList TeamMembership :: Type Source # unwrap :: ToList TeamMembership -> [TeamMembership] Source # | |
WebexTeamsListItem Room Source # | |
WebexTeamsListItem Membership Source # |
|
Defined in Network.WebexTeams.Types type ToList Membership :: Type Source # unwrap :: ToList Membership -> [Membership] Source # | |
WebexTeamsListItem Message Source # |
|
WebexTeamsListItem Organization Source # |
|
Defined in Network.WebexTeams.Types type ToList Organization :: Type Source # unwrap :: ToList Organization -> [Organization] Source # | |
WebexTeamsListItem License Source # |
|
WebexTeamsListItem Role Source # | |
WebexTeamsListItem Webhook Source # |
|
type family ToResponse a :: * Source #
Associate response type to input parameter type such as filter criteria, entity key or create / update parameters.
Instances
Common Types
newtype Authorization Source #
Authorization string against Webex Teams API to be contained in HTTP Authorization header of every request.
Instances
Eq Authorization Source # | |
Defined in Network.WebexTeams (==) :: Authorization -> Authorization -> Bool # (/=) :: Authorization -> Authorization -> Bool # | |
Show Authorization Source # | |
Defined in Network.WebexTeams showsPrec :: Int -> Authorization -> ShowS # show :: Authorization -> String # showList :: [Authorization] -> ShowS # |
type CiscoSparkRequest = WebexTeamsRequest Source #
Type synonym for backward compatibility.
data WebexTeamsRequest Source #
Wrapping Request
in order to provide easy default value specifically for Webex Teams public API.
WebexTeamsRequest | |
|
Instances
Show WebexTeamsRequest Source # | |
Defined in Network.WebexTeams showsPrec :: Int -> WebexTeamsRequest -> ShowS # show :: WebexTeamsRequest -> String # showList :: [WebexTeamsRequest] -> ShowS # | |
Default WebexTeamsRequest Source # | Default parameters for HTTP request to Webex Teams REST API. |
Defined in Network.WebexTeams |
Type representing timestamp. For now, it is just copied from API response JSON.
Error code for element level error potentially contained in List API responses.
data ErrorTitle Source #
ErrorTitle
represent concrete error code and reason. It appears in Errors
.
ErrorTitle | |
|
Instances
Eq ErrorTitle Source # | |
Defined in Network.WebexTeams.Types (==) :: ErrorTitle -> ErrorTitle -> Bool # (/=) :: ErrorTitle -> ErrorTitle -> Bool # | |
Show ErrorTitle Source # | |
Defined in Network.WebexTeams.Types showsPrec :: Int -> ErrorTitle -> ShowS # show :: ErrorTitle -> String # showList :: [ErrorTitle] -> ShowS # | |
ToJSON ErrorTitle Source # | |
Defined in Network.WebexTeams.Types toJSON :: ErrorTitle -> Value # toEncoding :: ErrorTitle -> Encoding # toJSONList :: [ErrorTitle] -> Value # toEncodingList :: [ErrorTitle] -> Encoding # | |
FromJSON ErrorTitle Source # |
|
Defined in Network.WebexTeams.Types parseJSON :: Value -> Parser ErrorTitle # parseJSONList :: Value -> Parser [ErrorTitle] # |
Errors
is used for element level error in List API.
When list API failed to retrieve an element, it returns this object for the element
and response API status as successful instead of failing entire API request.
Refer to API Document for more detail.
People related types
Person
is detail description of Webex Teams user or bot.
Person is decoded from response JSON of Get Person Details REST call.
It is also element type of response of List People call.
Person | |
|
Instances
Eq Person Source # | |
Show Person Source # | |
ToJSON Person Source # | |
Defined in Network.WebexTeams.Types | |
FromJSON Person Source # |
|
WebexTeamsListItem Person Source # |
|
type ToList Person Source # | |
Defined in Network.WebexTeams.Types |
Identifying Person
describing detail of Webex Teams user or bot.
Instances
Eq PersonId Source # | |
Show PersonId Source # | |
Generic PersonId Source # | |
ToJSON PersonId Source # | |
Defined in Network.WebexTeams.Types | |
FromJSON PersonId Source # | |
WebexTeamsDetail PersonId Source # | User can get detail of a person. |
WebexTeamsResponse PersonId Source # | Get detail for a person API uses "PersonId' and responses |
Defined in Network.WebexTeams.Types type ToResponse PersonId :: Type Source # | |
WebexTeamsApiPath PersonId Source # | Get detail for a person API uses |
Defined in Network.WebexTeams.Types apiPath :: PersonId -> ByteString Source # | |
type Rep PersonId Source # | |
Defined in Network.WebexTeams.Types | |
type ToResponse PersonId Source # | |
Defined in Network.WebexTeams.Types |
Email address of user.
newtype DisplayName Source #
Display name of user.
Instances
Nickname of user.
First name of user.
Last name of user.
URL pointing to image file of Avatar.
Timezone in timezone name.
data PersonStatus Source #
Current status of Person
.
It can be updated automatically by recent activity or explicitly updated by user's operation
or propagated from vacation setting on email system.
PersonStatusActive | The |
PersonStatusInactive | The |
PersonStatusOutOfOffice | Email system of the |
PersonStatusDoNotDisturb | The |
PersonStatusUnknown | The status of the |
Instances
data PersonType Source #
PersonType
indicates whether the Person is real human or bot.
PersonTypePerson | The |
PersonTypeBot | The |
Instances
Eq PersonType Source # | |
Defined in Network.WebexTeams.Types (==) :: PersonType -> PersonType -> Bool # (/=) :: PersonType -> PersonType -> Bool # | |
Show PersonType Source # | |
Defined in Network.WebexTeams.Types showsPrec :: Int -> PersonType -> ShowS # show :: PersonType -> String # showList :: [PersonType] -> ShowS # | |
ToJSON PersonType Source # | |
Defined in Network.WebexTeams.Types toJSON :: PersonType -> Value # toEncoding :: PersonType -> Encoding # toJSONList :: [PersonType] -> Value # toEncodingList :: [PersonType] -> Encoding # | |
FromJSON PersonType Source # |
|
Defined in Network.WebexTeams.Types parseJSON :: Value -> Parser PersonType # parseJSONList :: Value -> Parser [PersonType] # |
newtype PersonList Source #
PersonList
is decoded from response JSON of List People REST call. It is list of Person
.
Instances
Eq PersonList Source # | |
Defined in Network.WebexTeams.Types (==) :: PersonList -> PersonList -> Bool # (/=) :: PersonList -> PersonList -> Bool # | |
Show PersonList Source # | |
Defined in Network.WebexTeams.Types showsPrec :: Int -> PersonList -> ShowS # show :: PersonList -> String # showList :: [PersonList] -> ShowS # | |
ToJSON PersonList Source # | |
Defined in Network.WebexTeams.Types toJSON :: PersonList -> Value # toEncoding :: PersonList -> Encoding # toJSONList :: [PersonList] -> Value # toEncodingList :: [PersonList] -> Encoding # | |
FromJSON PersonList Source # |
|
Defined in Network.WebexTeams.Types parseJSON :: Value -> Parser PersonList # parseJSONList :: Value -> Parser [PersonList] # |
data PersonFilter Source #
Optional query strings for people list API.
PersonFilter | |
|
Instances
data CreatePerson Source #
CreatePerson
is encoded to request body JSON of Create a Person REST call.
CreatePerson | |
|
Instances
data UpdatePerson Source #
UpdatePerson
is encoded to request body JSON of Update a Person REST call.
UpdatePerson | |
|
Instances
Room related types
Room
is communication space in Webex Teams and called "Space" on UI.
Historically it was called Room on UI too but UI has been changed to "Space" in order to avoid
confusion with the concept "Room" associated to hardware facility of video conferencing on Webex Teams.
The name of Room is kept unchanged for backward compatibility.
Room is decoded from response JSON of Get Room Details REST call. It is also element type of response of List Rooms call.
Room | |
|
Identifying Room
.
Instances
Eq RoomId Source # | |
Show RoomId Source # | |
Generic RoomId Source # | |
ToJSON RoomId Source # | |
Defined in Network.WebexTeams.Types | |
FromJSON RoomId Source # | |
WebexTeamsDetail RoomId Source # | User can get detail of a room. |
WebexTeamsResponse RoomId Source # | Get detail for a room API uses "RoomId' and responses |
Defined in Network.WebexTeams.Types type ToResponse RoomId :: Type Source # | |
WebexTeamsApiPath RoomId Source # | Get detail for a room API uses |
Defined in Network.WebexTeams.Types apiPath :: RoomId -> ByteString Source # | |
type Rep RoomId Source # | |
Defined in Network.WebexTeams.Types | |
type ToResponse RoomId Source # | |
Defined in Network.WebexTeams.Types |
Title text of Room
.
RoomTypeDirect | The Room is for 1:1. Decoded from "direct". |
RoomTypeGroup | The Room is for group. Decoded from "group". |
SIP address.
RoomList | |
|
data RoomFilter Source #
Optional query strings for room list API
RoomFilter | |
|
Instances
data RoomFilterSortBy Source #
Sorting option for room list API.
Instances
Eq RoomFilterSortBy Source # | |
Defined in Network.WebexTeams.Types (==) :: RoomFilterSortBy -> RoomFilterSortBy -> Bool # (/=) :: RoomFilterSortBy -> RoomFilterSortBy -> Bool # | |
Show RoomFilterSortBy Source # | |
Defined in Network.WebexTeams.Types showsPrec :: Int -> RoomFilterSortBy -> ShowS # show :: RoomFilterSortBy -> String # showList :: [RoomFilterSortBy] -> ShowS # |
data CreateRoom Source #
CreateRoom
is encoded to request body JSON of Create a Room REST call.
CreateRoom | |
|
Instances
newtype UpdateRoom Source #
UpdateRoom
is encoded to request body JSON of Update a Room REST call.
Instances
Membership related types
data Membership Source #
Membership
is association between Room
and Person
.
It can be N:N relation. A Person can belong to multiple Room.
Membership is decoded from response JSON of Get Membership Details REST call.
It is also element type of response of List Memberships call.
Membership | |
|
Instances
newtype MembershipId Source #
Identifying Membership
.
Instances
newtype MembershipList Source #
MembershipList
is decoded from response JSON of List Memberships REST call. It is list of Membership
.
Instances
Eq MembershipList Source # | |
Defined in Network.WebexTeams.Types (==) :: MembershipList -> MembershipList -> Bool # (/=) :: MembershipList -> MembershipList -> Bool # | |
Show MembershipList Source # | |
Defined in Network.WebexTeams.Types showsPrec :: Int -> MembershipList -> ShowS # show :: MembershipList -> String # showList :: [MembershipList] -> ShowS # | |
ToJSON MembershipList Source # | |
Defined in Network.WebexTeams.Types toJSON :: MembershipList -> Value # toEncoding :: MembershipList -> Encoding # toJSONList :: [MembershipList] -> Value # toEncodingList :: [MembershipList] -> Encoding # | |
FromJSON MembershipList Source # |
|
Defined in Network.WebexTeams.Types parseJSON :: Value -> Parser MembershipList # parseJSONList :: Value -> Parser [MembershipList] # |
data MembershipFilter Source #
Optional query strings for room membership list API
MembershipFilter | |
|
Instances
data CreateMembership Source #
CreateMembership
is encoded to request body JSON of Create a Membership REST call.
CreateMembership | |
|
Instances
newtype UpdateMembership Source #
UpdateMembership
is encoded to request body JSON of Update a Membership REST call.
Instances
Message related types
Message
is a message posted to a Room
by some Person
.
Room is decoded from response JSON of Get Message Details REST call.
It is also element type of response of List Messages call.
Message | |
|
Instances
Eq Message Source # | |
Show Message Source # | |
ToJSON Message Source # | |
Defined in Network.WebexTeams.Types | |
FromJSON Message Source # |
|
WebexTeamsListItem Message Source # |
|
type ToList Message Source # | |
Defined in Network.WebexTeams.Types |
Identifying Message
.
Instances
Eq MessageId Source # | |
Show MessageId Source # | |
Generic MessageId Source # | |
ToJSON MessageId Source # | |
Defined in Network.WebexTeams.Types | |
FromJSON MessageId Source # | |
WebexTeamsDetail MessageId Source # | User can get detail of a message. |
WebexTeamsResponse MessageId Source # | Get detail for a message API uses "MessageId' and responses |
Defined in Network.WebexTeams.Types type ToResponse MessageId :: Type Source # | |
WebexTeamsApiPath MessageId Source # | Get detail for message API uses |
Defined in Network.WebexTeams.Types apiPath :: MessageId -> ByteString Source # | |
type Rep MessageId Source # | |
Defined in Network.WebexTeams.Types | |
type ToResponse MessageId Source # | |
Defined in Network.WebexTeams.Types |
newtype MessageText Source #
Body of message in plain text.
Instances
newtype MessageHtml Source #
Body of message in html.
Instances
newtype MessageMarkdown Source #
Body of message in markdown.
Instances
URL pointing attached file of message.
newtype MessageList Source #
MessageList
is decoded from response JSON of List Messages REST call. It is list of Message
.
Instances
Eq MessageList Source # | |
Defined in Network.WebexTeams.Types (==) :: MessageList -> MessageList -> Bool # (/=) :: MessageList -> MessageList -> Bool # | |
Show MessageList Source # | |
Defined in Network.WebexTeams.Types showsPrec :: Int -> MessageList -> ShowS # show :: MessageList -> String # showList :: [MessageList] -> ShowS # | |
ToJSON MessageList Source # | |
Defined in Network.WebexTeams.Types toJSON :: MessageList -> Value # toEncoding :: MessageList -> Encoding # toJSONList :: [MessageList] -> Value # toEncodingList :: [MessageList] -> Encoding # | |
FromJSON MessageList Source # |
|
Defined in Network.WebexTeams.Types parseJSON :: Value -> Parser MessageList # parseJSONList :: Value -> Parser [MessageList] # |
data MessageFilter Source #
Optional query strings for message list API
MessageFilter | |
|
Instances
Eq MessageFilter Source # | |
Defined in Network.WebexTeams.Types (==) :: MessageFilter -> MessageFilter -> Bool # (/=) :: MessageFilter -> MessageFilter -> Bool # | |
Show MessageFilter Source # | |
Defined in Network.WebexTeams.Types showsPrec :: Int -> MessageFilter -> ShowS # show :: MessageFilter -> String # showList :: [MessageFilter] -> ShowS # | |
WebexTeamsFilter MessageFilter Source # | User can list messages with filter parameter. |
Defined in Network.WebexTeams.Types toFilterList :: MessageFilter -> [(ByteString, Maybe ByteString)] Source # | |
WebexTeamsResponse MessageFilter Source # | List messages API uses |
Defined in Network.WebexTeams.Types type ToResponse MessageFilter :: Type Source # | |
WebexTeamsApiPath MessageFilter Source # | List messages API uses |
Defined in Network.WebexTeams.Types apiPath :: MessageFilter -> ByteString Source # | |
type ToResponse MessageFilter Source # | |
Defined in Network.WebexTeams.Types |
data MentionedPeople Source #
Sum type for mentionedPeople query string. It can be "me" or PersonId
.
Instances
Eq MentionedPeople Source # | |
Defined in Network.WebexTeams.Types (==) :: MentionedPeople -> MentionedPeople -> Bool # (/=) :: MentionedPeople -> MentionedPeople -> Bool # | |
Show MentionedPeople Source # | |
Defined in Network.WebexTeams.Types showsPrec :: Int -> MentionedPeople -> ShowS # show :: MentionedPeople -> String # showList :: [MentionedPeople] -> ShowS # |
data CreateMessage Source #
CreateMessage
is encoded to request body JSON of Create a Message REST call.
CreateMessage | |
|
Instances
Team related types
Name of Team
Identifying Team.
Instances
Eq TeamId Source # | |
Show TeamId Source # | |
Generic TeamId Source # | |
ToJSON TeamId Source # | |
Defined in Network.WebexTeams.Types | |
FromJSON TeamId Source # | |
WebexTeamsDetail TeamId Source # | User can get detail of a team. |
WebexTeamsResponse TeamId Source # | Get detail for a team API uses "TeamId' and responses |
Defined in Network.WebexTeams.Types type ToResponse TeamId :: Type Source # | |
WebexTeamsApiPath TeamId Source # | Get detail for a team API uses |
Defined in Network.WebexTeams.Types apiPath :: TeamId -> ByteString Source # | |
type Rep TeamId Source # | |
Defined in Network.WebexTeams.Types | |
type ToResponse TeamId Source # | |
Defined in Network.WebexTeams.Types |
Team
is group of Person
and group of Room
.
A Person can belong to multiple Team but a Room can belong to at most one Team.
Team is decoded from response JSON of Get Team Details REST call.
It is also element type of response of List Teams call.
Team | |
|
TeamList | |
|
newtype CreateTeam Source #
CreateTeam
is encoded to request body JSON of Create a Team REST call.
Instances
newtype UpdateTeam Source #
UpdateTeam
is encoded to request body JSON of Update a Team REST call.
Instances
Team Membership related types
data TeamMembership Source #
TeamMembership
is association between Team
and Person
.
It can be N:N relation. A Person can belong to multiple Team.
TeamMembership is decoded from response JSON of Get Team Membership Details REST call.
It is also element type of response of List Team Memberships call.
TeamMembership | |
|
Instances
newtype TeamMembershipId Source #
Identifying TeamMembership.
Instances
newtype TeamMembershipList Source #
TeamMembershipList
is decoded from response JSON of List Team Memberships REST call. It is list of TeamMembership
.
Instances
Eq TeamMembershipList Source # | |
Defined in Network.WebexTeams.Types (==) :: TeamMembershipList -> TeamMembershipList -> Bool # (/=) :: TeamMembershipList -> TeamMembershipList -> Bool # | |
Show TeamMembershipList Source # | |
Defined in Network.WebexTeams.Types showsPrec :: Int -> TeamMembershipList -> ShowS # show :: TeamMembershipList -> String # showList :: [TeamMembershipList] -> ShowS # | |
ToJSON TeamMembershipList Source # | |
Defined in Network.WebexTeams.Types toJSON :: TeamMembershipList -> Value # toEncoding :: TeamMembershipList -> Encoding # toJSONList :: [TeamMembershipList] -> Value # toEncodingList :: [TeamMembershipList] -> Encoding # | |
FromJSON TeamMembershipList Source # |
|
Defined in Network.WebexTeams.Types parseJSON :: Value -> Parser TeamMembershipList # parseJSONList :: Value -> Parser [TeamMembershipList] # |
newtype TeamMembershipFilter Source #
Optional query strings for team membership list API
TeamMembershipFilter | |
|
Instances
data CreateTeamMembership Source #
CreateTeamMembership
is encoded to request body JSON of Create a Team Membership REST call.
CreateTeamMembership | |
|
Instances
newtype UpdateTeamMembership Source #
UpdateTeamMembership
is encoded to request body JSON of Update a Team Membership REST call.
Instances
Organization related types
data Organization Source #
Organization
is an administrative group of Webex Teams users.
Each Person
belongs to one Organization.
Organization is decoded from response JSON of Get Organization Details REST call.
It is also element type of response of List Organizations call.
Organization | |
|
Instances
newtype OrganizationId Source #
Organization
identifier which user or team belongs to.
Instances
newtype OrganizationDisplayName Source #
Display name of Organization
Instances
Eq OrganizationDisplayName Source # | |
Defined in Network.WebexTeams.Types | |
Show OrganizationDisplayName Source # | |
Defined in Network.WebexTeams.Types showsPrec :: Int -> OrganizationDisplayName -> ShowS # show :: OrganizationDisplayName -> String # showList :: [OrganizationDisplayName] -> ShowS # | |
Generic OrganizationDisplayName Source # | |
Defined in Network.WebexTeams.Types type Rep OrganizationDisplayName :: Type -> Type # | |
ToJSON OrganizationDisplayName Source # | |
Defined in Network.WebexTeams.Types | |
FromJSON OrganizationDisplayName Source # | |
Defined in Network.WebexTeams.Types | |
type Rep OrganizationDisplayName Source # | |
Defined in Network.WebexTeams.Types type Rep OrganizationDisplayName = D1 (MetaData "OrganizationDisplayName" "Network.WebexTeams.Types" "webex-teams-api-0.2.0.1-q6fXIzP74m9qzihYCvefh" True) (C1 (MetaCons "OrganizationDisplayName" PrefixI False) (S1 (MetaSel (Nothing :: Maybe Symbol) NoSourceUnpackedness NoSourceStrictness DecidedLazy) (Rec0 Text))) |
newtype OrganizationList Source #
OrganizationList
is decoded from response JSON of List Organizations REST call. It is list of Organization
.
Instances
Eq OrganizationList Source # | |
Defined in Network.WebexTeams.Types (==) :: OrganizationList -> OrganizationList -> Bool # (/=) :: OrganizationList -> OrganizationList -> Bool # | |
Show OrganizationList Source # | |
Defined in Network.WebexTeams.Types showsPrec :: Int -> OrganizationList -> ShowS # show :: OrganizationList -> String # showList :: [OrganizationList] -> ShowS # | |
ToJSON OrganizationList Source # | |
Defined in Network.WebexTeams.Types toJSON :: OrganizationList -> Value # toEncoding :: OrganizationList -> Encoding # toJSONList :: [OrganizationList] -> Value # toEncodingList :: [OrganizationList] -> Encoding # | |
FromJSON OrganizationList Source # |
|
Defined in Network.WebexTeams.Types parseJSON :: Value -> Parser OrganizationList # parseJSONList :: Value -> Parser [OrganizationList] # |
License related types
License
is allowance for features and services of Webex Teams subscription.
License is decoded from response JSON of Get License Details REST call.
It is also element type of response of List Licenses call.
License | |
|
Instances
Eq License Source # | |
Show License Source # | |
ToJSON License Source # | |
Defined in Network.WebexTeams.Types | |
FromJSON License Source # |
|
WebexTeamsListItem License Source # |
|
type ToList License Source # | |
Defined in Network.WebexTeams.Types |
Instances
Eq LicenseId Source # | |
Show LicenseId Source # | |
Generic LicenseId Source # | |
ToJSON LicenseId Source # | |
Defined in Network.WebexTeams.Types | |
FromJSON LicenseId Source # | |
WebexTeamsDetail LicenseId Source # | User can get detail of a license. |
WebexTeamsResponse LicenseId Source # | Get detail for a license API uses "LicenseId' and responses |
Defined in Network.WebexTeams.Types type ToResponse LicenseId :: Type Source # | |
WebexTeamsApiPath LicenseId Source # | Get detail for license API uses |
Defined in Network.WebexTeams.Types apiPath :: LicenseId -> ByteString Source # | |
type Rep LicenseId Source # | |
Defined in Network.WebexTeams.Types | |
type ToResponse LicenseId Source # | |
Defined in Network.WebexTeams.Types |
newtype LicenseName Source #
Display name of License
Instances
newtype LicenseUnit Source #
Counting number of granted or consumed License
Instances
newtype LicenseList Source #
LicenseList
is decoded from response JSON of List Licenses REST call. It is list of License
.
Instances
Eq LicenseList Source # | |
Defined in Network.WebexTeams.Types (==) :: LicenseList -> LicenseList -> Bool # (/=) :: LicenseList -> LicenseList -> Bool # | |
Show LicenseList Source # | |
Defined in Network.WebexTeams.Types showsPrec :: Int -> LicenseList -> ShowS # show :: LicenseList -> String # showList :: [LicenseList] -> ShowS # | |
ToJSON LicenseList Source # | |
Defined in Network.WebexTeams.Types toJSON :: LicenseList -> Value # toEncoding :: LicenseList -> Encoding # toJSONList :: [LicenseList] -> Value # toEncodingList :: [LicenseList] -> Encoding # | |
FromJSON LicenseList Source # |
|
Defined in Network.WebexTeams.Types parseJSON :: Value -> Parser LicenseList # parseJSONList :: Value -> Parser [LicenseList] # |
newtype LicenseFilter Source #
Optional query strings for license list API
LicenseFilter | |
|
Instances
Role related types
A persona for an authenticated user, corresponding to a set of privileges within an organization. Role is decoded from response JSON of Get Role Details REST call. It is also element type of response of List Roles call.
Instances
Eq RoleId Source # | |
Show RoleId Source # | |
Generic RoleId Source # | |
ToJSON RoleId Source # | |
Defined in Network.WebexTeams.Types | |
FromJSON RoleId Source # | |
WebexTeamsDetail RoleId Source # | User can get detail of a role. |
WebexTeamsResponse RoleId Source # | Get detail for a role API uses "RoleId' and responses |
Defined in Network.WebexTeams.Types type ToResponse RoleId :: Type Source # | |
WebexTeamsApiPath RoleId Source # | Get detail for role API uses |
Defined in Network.WebexTeams.Types apiPath :: RoleId -> ByteString Source # | |
type Rep RoleId Source # | |
Defined in Network.WebexTeams.Types | |
type ToResponse RoleId Source # | |
Defined in Network.WebexTeams.Types |
Name of Role
.
RoleList | |
|
Functions
Getting detail of an entity
:: (MonadIO m, WebexTeamsDetail key) | |
=> Authorization | Authorization string against Webex Teams API. |
-> WebexTeamsRequest | Predefined part of |
-> key | One of PersonId, RoomId, MembershipId, MessageId, TeamId, TeamMembershipId, OrganizationId, LicenseId and RoleId. |
-> m (Response (ToResponse key)) |
Get details of a Webex Teams entity.
Obtaining detail of an entity identified by key. The key can be a value in one of
following types: PersonId
, RoomId
, MembershipId
, MessageId
, TeamId
, TeamMembershipId
,
OrganizationId
, LicenseId
, RoleId
. API is automatically selected by type of the key.
A JSONException runtime exception will be thrown on an JSON parse errors.
getDetailEither :: (MonadIO m, WebexTeamsDetail key) => Authorization -> WebexTeamsRequest -> key -> m (Response (Either JSONException (ToResponse key))) Source #
Get details of a Webex Teams entity. A Left value will be returned on an JSON parse errors.
Streaming response of List API with auto pagenation
type ListReader a = IO [a] Source #
ListReader
is IO action returned by functions for list API (getListWithFilter
, getTeamList
etc).
It is containing URL inside to be accessed. When you call the IO action, it accesses to Webex Teams REST API,
parse next page URL if available, then return new IO action. The new IO action contains list of responded items and
new URL for next page so you can call the new IO action to get the next page.
Following example demonstrates how you can get all items into single list.
readAllList :: ListReader i -> IO [i] readAllList reader = go [] where go xs = reader >>= chunk -> case chunk of [] -> pure xs ys -> go (xs <> ys)
Note that this example is only for explaining how ListReader
works. Practically you should not do the above
because it eagerly creates entire list. You should use streaming APIs instead. Streaming APIs are available via
webex-teams-conduit and webex-teams-pipes package.
getListWithFilter :: (MonadIO m, WebexTeamsFilter filter, WebexTeamsListItem (ToResponse filter)) => Authorization -> WebexTeamsRequest -> filter -> m (ListReader (ToResponse filter)) Source #
Get list with query parameter.
getTeamList :: MonadIO m => Authorization -> WebexTeamsRequest -> m (ListReader Team) Source #
Return ListReader
for Team
.
getOrganizationList :: MonadIO m => Authorization -> WebexTeamsRequest -> m (ListReader Organization) Source #
Return ListReader
for Team
.
getRoleList :: MonadIO m => Authorization -> WebexTeamsRequest -> m (ListReader Role) Source #
Return ListReader
for Team
.
streamEntityWithFilter :: (MonadIO m, WebexTeamsFilter filter, WebexTeamsListItem (ToResponse filter)) => Authorization -> WebexTeamsRequest -> filter -> ConduitT () (ToResponse filter) m () Source #
Deprecated: Use getListWithFilter or streamListWithFilter of webex-teams-conduit
Get list of entities with query parameter and stream it into Conduit pipe. It automatically performs pagination.
streamTeamList :: MonadIO m => Authorization -> WebexTeamsRequest -> ConduitT () Team m () Source #
Deprecated: Use getTeamList or streamTeamList of webex-teams-conduit
List of Team
and stream it into Conduit pipe. It automatically performs pagination.
streamOrganizationList :: MonadIO m => Authorization -> WebexTeamsRequest -> ConduitT () Organization m () Source #
Deprecated: Use getOrganizationList or streamOrganizationList of webex-teams-conduit
Filter list of Organization
and stream it into Conduit pipe. It automatically performs pagination.
streamRoleList :: MonadIO m => Authorization -> WebexTeamsRequest -> ConduitT () Role m () Source #
Deprecated: Use getRoleList or streamRoleList of webex-teams-conduit
List of Role
and stream it into Conduit pipe. It automatically performs pagination.
Creating an entity
:: (MonadIO m, WebexTeamsCreate createParams) | |
=> Authorization | Authorization string against Webex Teams API. |
-> WebexTeamsRequest | Predefined part of |
-> createParams | One of |
-> m (Response (ToResponse createParams)) |
Create a Webex Teams entity with given parameters.
Creating a new entity of Webex Teams such as space, team, membership or message. REST API path is automatically selected by type of createParams. A JSONException runtime exception will be thrown on an JSON parse errors.
createEntityEither :: (MonadIO m, WebexTeamsCreate createParams) => Authorization -> WebexTeamsRequest -> createParams -> m (Response (Either JSONException (ToResponse createParams))) Source #
Create a Webex Teams entity with given parameters. A Left value will be returned on an JSON parse errors.
Updating an entity
:: (MonadIO m, WebexTeamsUpdate updateParams) | |
=> Authorization | Authorization string against Webex Teams API. |
-> WebexTeamsRequest | Predefined part of |
-> updateParams | One of |
-> m (Response (ToResponse updateParams)) |
Update a Webex Teams entity with given parameters.
Creating a new entity of Webex Teams such as space, team, or membership. REST API path is automatically selected by type of updateParams. A JSONException runtime exception will be thrown on an JSON parse errors.
updateEntityEither :: (MonadIO m, WebexTeamsUpdate updateParams) => Authorization -> WebexTeamsRequest -> updateParams -> m (Response (Either JSONException (ToResponse updateParams))) Source #
Update a Webex Teams entity with given parameters. A Left value will be returned on an JSON parse errors.
Creating default filter spec from mandatory field
defaultMessageFilter :: RoomId -> MessageFilter Source #
Default value of query strings for message list API.
Because RoomId
is mandatory, user have to supply it in order to get rest of defaults.
defaultTeamMembershipFilter :: TeamId -> TeamMembershipFilter Source #
Default value of query strings for team membership list API.
Because TeamId
is mandatory, user have to supply it in order to get rest of defaults.
As of writing, there is no filter parameter other than TeamId but TeamMembershipFilter
is
used for providing consistent API like streamEntityWithFilter
.
Deleting an entity
:: MonadIO m | |
=> Authorization | Authorization string against Webex Teams API. |
-> WebexTeamsRequest | Predefined part of |
-> RoomId | Identifier of a space to be deleted. |
-> m (Response ()) |
Deletes a room, by ID.
:: MonadIO m | |
=> Authorization | Authorization string against Webex Teams API. |
-> WebexTeamsRequest | Predefined part of |
-> MembershipId | Identifier of a space to be deleted. |
-> m (Response ()) |
Deletes a membership, by ID.
:: MonadIO m | |
=> Authorization | Authorization string against Webex Teams API. |
-> WebexTeamsRequest | Predefined part of |
-> MessageId | Identifier of a space to be deleted. |
-> m (Response ()) |
Deletes a message, by ID.
:: MonadIO m | |
=> Authorization | Authorization string against Webex Teams API. |
-> WebexTeamsRequest | Predefined part of |
-> TeamId | Identifier of a space to be deleted. |
-> m (Response ()) |
Deletes a team, by ID.
:: MonadIO m | |
=> Authorization | Authorization string against Webex Teams API. |
-> WebexTeamsRequest | Predefined part of |
-> TeamMembershipId | Identifier of a space to be deleted. |
-> m (Response ()) |
Deletes a teamMembership, by ID.