Copyright | (c) Naoto Shimazaki 2017 |
---|---|
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 Spark 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 Spark 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. Also those functions transform chunky response into seamless stream of elements.
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 $ streamEntityWithFilter 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
Support for Lens
This package provides many of records representing objects communicated via Cisco Spark 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
- newtype Authorization = Authorization ByteString
- data CiscoSparkRequest = CiscoSparkRequest {}
- 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, SparkDetail key) => Authorization -> CiscoSparkRequest -> key -> m (Response (ToResponse key))
- getDetailEither :: (MonadIO m, SparkDetail key) => Authorization -> CiscoSparkRequest -> key -> m (Response (Either JSONException (ToResponse key)))
- streamEntityWithFilter :: (MonadIO m, SparkFilter filter, SparkListItem (ToResponse filter)) => Authorization -> CiscoSparkRequest -> filter -> ConduitT () (ToResponse filter) m ()
- streamTeamList :: MonadIO m => Authorization -> CiscoSparkRequest -> ConduitT () Team m ()
- streamOrganizationList :: MonadIO m => Authorization -> CiscoSparkRequest -> ConduitT () Organization m ()
- streamRoleList :: MonadIO m => Authorization -> CiscoSparkRequest -> ConduitT () Role m ()
- createEntity :: (MonadIO m, SparkCreate createParams) => Authorization -> CiscoSparkRequest -> createParams -> m (Response (ToResponse createParams))
- createEntityEither :: (MonadIO m, SparkCreate createParams) => Authorization -> CiscoSparkRequest -> createParams -> m (Response (Either JSONException (ToResponse createParams)))
- updateEntity :: (MonadIO m, SparkUpdate updateParams) => Authorization -> CiscoSparkRequest -> updateParams -> m (Response (ToResponse updateParams))
- updateEntityEither :: (MonadIO m, SparkUpdate updateParams) => Authorization -> CiscoSparkRequest -> updateParams -> m (Response (Either JSONException (ToResponse updateParams)))
- defaultMessageFilter :: RoomId -> MessageFilter
- defaultTeamMembershipFilter :: TeamId -> TeamMembershipFilter
- deleteRoom :: MonadIO m => Authorization -> CiscoSparkRequest -> RoomId -> m (Response ())
- deleteMembership :: MonadIO m => Authorization -> CiscoSparkRequest -> MembershipId -> m (Response ())
- deleteMessage :: MonadIO m => Authorization -> CiscoSparkRequest -> MessageId -> m (Response ())
- deleteTeam :: MonadIO m => Authorization -> CiscoSparkRequest -> TeamId -> m (Response ())
- deleteTeamMembership :: MonadIO m => Authorization -> CiscoSparkRequest -> TeamMembershipId -> m (Response ())
Types
Common Types
newtype Authorization Source #
Authorization string against Spark API to be contained in HTTP Authorization header of every request.
Instances
Eq Authorization Source # | |
Defined in Network.CiscoSpark (==) :: Authorization -> Authorization -> Bool # (/=) :: Authorization -> Authorization -> Bool # | |
Show Authorization Source # | |
Defined in Network.CiscoSpark showsPrec :: Int -> Authorization -> ShowS # show :: Authorization -> String # showList :: [Authorization] -> ShowS # |
data CiscoSparkRequest Source #
Wrapping Request
in order to provide easy default value specifically for Cisco Spark public API.
CiscoSparkRequest | |
|
Instances
Show CiscoSparkRequest Source # | |
Defined in Network.CiscoSpark showsPrec :: Int -> CiscoSparkRequest -> ShowS # show :: CiscoSparkRequest -> String # showList :: [CiscoSparkRequest] -> ShowS # | |
Default CiscoSparkRequest Source # | Default parameters for HTTP request to Cisco Spark REST API. |
Defined in Network.CiscoSpark |
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.CiscoSpark.Types (==) :: ErrorTitle -> ErrorTitle -> Bool # (/=) :: ErrorTitle -> ErrorTitle -> Bool # | |
Show ErrorTitle Source # | |
Defined in Network.CiscoSpark.Types showsPrec :: Int -> ErrorTitle -> ShowS # show :: ErrorTitle -> String # showList :: [ErrorTitle] -> ShowS # | |
ToJSON ErrorTitle Source # | |
Defined in Network.CiscoSpark.Types toJSON :: ErrorTitle -> Value # toEncoding :: ErrorTitle -> Encoding # toJSONList :: [ErrorTitle] -> Value # toEncodingList :: [ErrorTitle] -> Encoding # | |
FromJSON ErrorTitle Source # |
|
Defined in Network.CiscoSpark.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 Cisco Spark 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.CiscoSpark.Types | |
FromJSON Person Source # |
|
SparkListItem Person Source # |
|
type ToList Person Source # | |
Defined in Network.CiscoSpark.Types |
Identifying Person
describing detail of Cisco Spark user or bot.
Instances
Eq PersonId Source # | |
Show PersonId Source # | |
Generic PersonId Source # | |
ToJSON PersonId Source # | |
Defined in Network.CiscoSpark.Types | |
FromJSON PersonId Source # | |
SparkDetail PersonId Source # | User can get detail of a person. |
SparkResponse PersonId Source # | Get detail for a person API uses "PersonId' and responses |
Defined in Network.CiscoSpark.Types type ToResponse PersonId :: Type Source # | |
SparkApiPath PersonId Source # | Get detail for a person API uses |
Defined in Network.CiscoSpark.Types apiPath :: PersonId -> ByteString Source # | |
type Rep PersonId Source # | |
Defined in Network.CiscoSpark.Types | |
type ToResponse PersonId Source # | |
Defined in Network.CiscoSpark.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.CiscoSpark.Types (==) :: PersonType -> PersonType -> Bool # (/=) :: PersonType -> PersonType -> Bool # | |
Show PersonType Source # | |
Defined in Network.CiscoSpark.Types showsPrec :: Int -> PersonType -> ShowS # show :: PersonType -> String # showList :: [PersonType] -> ShowS # | |
ToJSON PersonType Source # | |
Defined in Network.CiscoSpark.Types toJSON :: PersonType -> Value # toEncoding :: PersonType -> Encoding # toJSONList :: [PersonType] -> Value # toEncodingList :: [PersonType] -> Encoding # | |
FromJSON PersonType Source # |
|
Defined in Network.CiscoSpark.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.CiscoSpark.Types (==) :: PersonList -> PersonList -> Bool # (/=) :: PersonList -> PersonList -> Bool # | |
Show PersonList Source # | |
Defined in Network.CiscoSpark.Types showsPrec :: Int -> PersonList -> ShowS # show :: PersonList -> String # showList :: [PersonList] -> ShowS # | |
ToJSON PersonList Source # | |
Defined in Network.CiscoSpark.Types toJSON :: PersonList -> Value # toEncoding :: PersonList -> Encoding # toJSONList :: [PersonList] -> Value # toEncodingList :: [PersonList] -> Encoding # | |
FromJSON PersonList Source # |
|
Defined in Network.CiscoSpark.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 Cisco Spark 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 Spark.
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.CiscoSpark.Types | |
FromJSON RoomId Source # | |
SparkDetail RoomId Source # | User can get detail of a room. |
SparkResponse RoomId Source # | Get detail for a room API uses "RoomId' and responses |
Defined in Network.CiscoSpark.Types type ToResponse RoomId :: Type Source # | |
SparkApiPath RoomId Source # | Get detail for a room API uses |
Defined in Network.CiscoSpark.Types apiPath :: RoomId -> ByteString Source # | |
type Rep RoomId Source # | |
Defined in Network.CiscoSpark.Types | |
type ToResponse RoomId Source # | |
Defined in Network.CiscoSpark.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.CiscoSpark.Types (==) :: RoomFilterSortBy -> RoomFilterSortBy -> Bool # (/=) :: RoomFilterSortBy -> RoomFilterSortBy -> Bool # | |
Show RoomFilterSortBy Source # | |
Defined in Network.CiscoSpark.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.CiscoSpark.Types (==) :: MembershipList -> MembershipList -> Bool # (/=) :: MembershipList -> MembershipList -> Bool # | |
Show MembershipList Source # | |
Defined in Network.CiscoSpark.Types showsPrec :: Int -> MembershipList -> ShowS # show :: MembershipList -> String # showList :: [MembershipList] -> ShowS # | |
ToJSON MembershipList Source # | |
Defined in Network.CiscoSpark.Types toJSON :: MembershipList -> Value # toEncoding :: MembershipList -> Encoding # toJSONList :: [MembershipList] -> Value # toEncodingList :: [MembershipList] -> Encoding # | |
FromJSON MembershipList Source # |
|
Defined in Network.CiscoSpark.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.CiscoSpark.Types | |
FromJSON Message Source # |
|
SparkListItem Message Source # |
|
type ToList Message Source # | |
Defined in Network.CiscoSpark.Types |
Identifying Message
.
Instances
Eq MessageId Source # | |
Show MessageId Source # | |
Generic MessageId Source # | |
ToJSON MessageId Source # | |
Defined in Network.CiscoSpark.Types | |
FromJSON MessageId Source # | |
SparkDetail MessageId Source # | User can get detail of a message. |
SparkResponse MessageId Source # | Get detail for a message API uses "MessageId' and responses |
Defined in Network.CiscoSpark.Types type ToResponse MessageId :: Type Source # | |
SparkApiPath MessageId Source # | Get detail for message API uses |
Defined in Network.CiscoSpark.Types apiPath :: MessageId -> ByteString Source # | |
type Rep MessageId Source # | |
Defined in Network.CiscoSpark.Types | |
type ToResponse MessageId Source # | |
Defined in Network.CiscoSpark.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.CiscoSpark.Types (==) :: MessageList -> MessageList -> Bool # (/=) :: MessageList -> MessageList -> Bool # | |
Show MessageList Source # | |
Defined in Network.CiscoSpark.Types showsPrec :: Int -> MessageList -> ShowS # show :: MessageList -> String # showList :: [MessageList] -> ShowS # | |
ToJSON MessageList Source # | |
Defined in Network.CiscoSpark.Types toJSON :: MessageList -> Value # toEncoding :: MessageList -> Encoding # toJSONList :: [MessageList] -> Value # toEncodingList :: [MessageList] -> Encoding # | |
FromJSON MessageList Source # |
|
Defined in Network.CiscoSpark.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.CiscoSpark.Types (==) :: MessageFilter -> MessageFilter -> Bool # (/=) :: MessageFilter -> MessageFilter -> Bool # | |
Show MessageFilter Source # | |
Defined in Network.CiscoSpark.Types showsPrec :: Int -> MessageFilter -> ShowS # show :: MessageFilter -> String # showList :: [MessageFilter] -> ShowS # | |
SparkFilter MessageFilter Source # | User can list messages with filter parameter. |
Defined in Network.CiscoSpark.Types toFilterList :: MessageFilter -> [(ByteString, Maybe ByteString)] Source # | |
SparkResponse MessageFilter Source # | List messages API uses |
Defined in Network.CiscoSpark.Types type ToResponse MessageFilter :: Type Source # | |
SparkApiPath MessageFilter Source # | List messages API uses |
Defined in Network.CiscoSpark.Types apiPath :: MessageFilter -> ByteString Source # | |
type ToResponse MessageFilter Source # | |
Defined in Network.CiscoSpark.Types |
data MentionedPeople Source #
Sum type for mentionedPeople query string. It can be "me" or PersonId
.
Instances
Eq MentionedPeople Source # | |
Defined in Network.CiscoSpark.Types (==) :: MentionedPeople -> MentionedPeople -> Bool # (/=) :: MentionedPeople -> MentionedPeople -> Bool # | |
Show MentionedPeople Source # | |
Defined in Network.CiscoSpark.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.CiscoSpark.Types | |
FromJSON TeamId Source # | |
SparkDetail TeamId Source # | User can get detail of a team. |
SparkResponse TeamId Source # | Get detail for a team API uses "TeamId' and responses |
Defined in Network.CiscoSpark.Types type ToResponse TeamId :: Type Source # | |
SparkApiPath TeamId Source # | Get detail for a team API uses |
Defined in Network.CiscoSpark.Types apiPath :: TeamId -> ByteString Source # | |
type Rep TeamId Source # | |
Defined in Network.CiscoSpark.Types | |
type ToResponse TeamId Source # | |
Defined in Network.CiscoSpark.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.CiscoSpark.Types (==) :: TeamMembershipList -> TeamMembershipList -> Bool # (/=) :: TeamMembershipList -> TeamMembershipList -> Bool # | |
Show TeamMembershipList Source # | |
Defined in Network.CiscoSpark.Types showsPrec :: Int -> TeamMembershipList -> ShowS # show :: TeamMembershipList -> String # showList :: [TeamMembershipList] -> ShowS # | |
ToJSON TeamMembershipList Source # | |
Defined in Network.CiscoSpark.Types toJSON :: TeamMembershipList -> Value # toEncoding :: TeamMembershipList -> Encoding # toJSONList :: [TeamMembershipList] -> Value # toEncodingList :: [TeamMembershipList] -> Encoding # | |
FromJSON TeamMembershipList Source # |
|
Defined in Network.CiscoSpark.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 Cisco Spark 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.CiscoSpark.Types | |
Show OrganizationDisplayName Source # | |
Defined in Network.CiscoSpark.Types showsPrec :: Int -> OrganizationDisplayName -> ShowS # show :: OrganizationDisplayName -> String # showList :: [OrganizationDisplayName] -> ShowS # | |
Generic OrganizationDisplayName Source # | |
Defined in Network.CiscoSpark.Types type Rep OrganizationDisplayName :: Type -> Type # | |
ToJSON OrganizationDisplayName Source # | |
Defined in Network.CiscoSpark.Types | |
FromJSON OrganizationDisplayName Source # | |
Defined in Network.CiscoSpark.Types | |
type Rep OrganizationDisplayName Source # | |
Defined in Network.CiscoSpark.Types type Rep OrganizationDisplayName = D1 (MetaData "OrganizationDisplayName" "Network.CiscoSpark.Types" "cisco-spark-api-0.1.0.4-7N32BESAftiBRSGVOsHhQ" 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.CiscoSpark.Types (==) :: OrganizationList -> OrganizationList -> Bool # (/=) :: OrganizationList -> OrganizationList -> Bool # | |
Show OrganizationList Source # | |
Defined in Network.CiscoSpark.Types showsPrec :: Int -> OrganizationList -> ShowS # show :: OrganizationList -> String # showList :: [OrganizationList] -> ShowS # | |
ToJSON OrganizationList Source # | |
Defined in Network.CiscoSpark.Types toJSON :: OrganizationList -> Value # toEncoding :: OrganizationList -> Encoding # toJSONList :: [OrganizationList] -> Value # toEncodingList :: [OrganizationList] -> Encoding # | |
FromJSON OrganizationList Source # |
|
Defined in Network.CiscoSpark.Types parseJSON :: Value -> Parser OrganizationList # parseJSONList :: Value -> Parser [OrganizationList] # |
License related types
License
is allowance for features and services of Cisco Spark 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.CiscoSpark.Types | |
FromJSON License Source # |
|
SparkListItem License Source # |
|
type ToList License Source # | |
Defined in Network.CiscoSpark.Types |
Instances
Eq LicenseId Source # | |
Show LicenseId Source # | |
Generic LicenseId Source # | |
ToJSON LicenseId Source # | |
Defined in Network.CiscoSpark.Types | |
FromJSON LicenseId Source # | |
SparkDetail LicenseId Source # | User can get detail of a license. |
SparkResponse LicenseId Source # | Get detail for a license API uses "LicenseId' and responses |
Defined in Network.CiscoSpark.Types type ToResponse LicenseId :: Type Source # | |
SparkApiPath LicenseId Source # | Get detail for license API uses |
Defined in Network.CiscoSpark.Types apiPath :: LicenseId -> ByteString Source # | |
type Rep LicenseId Source # | |
Defined in Network.CiscoSpark.Types | |
type ToResponse LicenseId Source # | |
Defined in Network.CiscoSpark.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.CiscoSpark.Types (==) :: LicenseList -> LicenseList -> Bool # (/=) :: LicenseList -> LicenseList -> Bool # | |
Show LicenseList Source # | |
Defined in Network.CiscoSpark.Types showsPrec :: Int -> LicenseList -> ShowS # show :: LicenseList -> String # showList :: [LicenseList] -> ShowS # | |
ToJSON LicenseList Source # | |
Defined in Network.CiscoSpark.Types toJSON :: LicenseList -> Value # toEncoding :: LicenseList -> Encoding # toJSONList :: [LicenseList] -> Value # toEncodingList :: [LicenseList] -> Encoding # | |
FromJSON LicenseList Source # |
|
Defined in Network.CiscoSpark.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.CiscoSpark.Types | |
FromJSON RoleId Source # | |
SparkDetail RoleId Source # | User can get detail of a role. |
SparkResponse RoleId Source # | Get detail for a role API uses "RoleId' and responses |
Defined in Network.CiscoSpark.Types type ToResponse RoleId :: Type Source # | |
SparkApiPath RoleId Source # | Get detail for role API uses |
Defined in Network.CiscoSpark.Types apiPath :: RoleId -> ByteString Source # | |
type Rep RoleId Source # | |
Defined in Network.CiscoSpark.Types | |
type ToResponse RoleId Source # | |
Defined in Network.CiscoSpark.Types |
Name of Role
.
RoleList | |
|
Functions
Getting detail of an entity
:: (MonadIO m, SparkDetail key) | |
=> Authorization | Authorization string against Spark API. |
-> CiscoSparkRequest | Predefined part of |
-> key | One of PersonId, RoomId, MembershipId, MessageId, TeamId, TeamMembershipId, OrganizationId, LicenseId and RoleId. |
-> m (Response (ToResponse key)) |
Get details of a Spark 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, SparkDetail key) => Authorization -> CiscoSparkRequest -> key -> m (Response (Either JSONException (ToResponse key))) Source #
Get details of a Spark entity. A Left value will be returned on an JSON parse errors.
Streaming response of List API with auto pagenation
streamEntityWithFilter :: (MonadIO m, SparkFilter filter, SparkListItem (ToResponse filter)) => Authorization -> CiscoSparkRequest -> filter -> ConduitT () (ToResponse filter) m () Source #
Get list of entities with query parameter and stream it into Conduit pipe. It automatically performs pagination.
streamTeamList :: MonadIO m => Authorization -> CiscoSparkRequest -> ConduitT () Team m () Source #
List of Team
and stream it into Conduit pipe. It automatically performs pagination.
streamOrganizationList :: MonadIO m => Authorization -> CiscoSparkRequest -> ConduitT () Organization m () Source #
Filter list of Organization
and stream it into Conduit pipe. It automatically performs pagination.
streamRoleList :: MonadIO m => Authorization -> CiscoSparkRequest -> ConduitT () Role m () Source #
List of Role
and stream it into Conduit pipe. It automatically performs pagination.
Creating an entity
:: (MonadIO m, SparkCreate createParams) | |
=> Authorization | Authorization string against Spark API. |
-> CiscoSparkRequest | Predefined part of |
-> createParams | One of |
-> m (Response (ToResponse createParams)) |
Create a Spark entity with given parameters.
Creating a new entity of Spark 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, SparkCreate createParams) => Authorization -> CiscoSparkRequest -> createParams -> m (Response (Either JSONException (ToResponse createParams))) Source #
Create a Spark entity with given parameters. A Left value will be returned on an JSON parse errors.
Updating an entity
:: (MonadIO m, SparkUpdate updateParams) | |
=> Authorization | Authorization string against Spark API. |
-> CiscoSparkRequest | Predefined part of |
-> updateParams | One of |
-> m (Response (ToResponse updateParams)) |
Update a Spark entity with given parameters.
Creating a new entity of Spark 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, SparkUpdate updateParams) => Authorization -> CiscoSparkRequest -> updateParams -> m (Response (Either JSONException (ToResponse updateParams))) Source #
Update a Spark 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 Spark API. |
-> CiscoSparkRequest | Predefined part of |
-> RoomId | Identifier of a space to be deleted. |
-> m (Response ()) |
Deletes a room, by ID.
:: MonadIO m | |
=> Authorization | Authorization string against Spark API. |
-> CiscoSparkRequest | Predefined part of |
-> MembershipId | Identifier of a space to be deleted. |
-> m (Response ()) |
Deletes a membership, by ID.
:: MonadIO m | |
=> Authorization | Authorization string against Spark API. |
-> CiscoSparkRequest | Predefined part of |
-> MessageId | Identifier of a space to be deleted. |
-> m (Response ()) |
Deletes a message, by ID.
:: MonadIO m | |
=> Authorization | Authorization string against Spark API. |
-> CiscoSparkRequest | Predefined part of |
-> TeamId | Identifier of a space to be deleted. |
-> m (Response ()) |
Deletes a team, by ID.
:: MonadIO m | |
=> Authorization | Authorization string against Spark API. |
-> CiscoSparkRequest | Predefined part of |
-> TeamMembershipId | Identifier of a space to be deleted. |
-> m (Response ()) |
Deletes a teamMembership, by ID.