MyNixOS website logo
Description

DEPRECATED in favor of webex-teams-api.

Please see the README on Github at https://github.com/nshimaza/webex-teams-api#readme

cisco-spark-api (DEPRECATED)

Deprecated in favor of webex-teams-api.

License: MIT Build Status Hackage Stackage Nightly Stackage LTS

A Haskell bindings for Cisco Webex Teams (formerly Cisco Spark) API

Cisco-spark-api package provides types and functions for accessing Cisco Webex Teams REST API. The detail of the API is available from developer site of Cisco Webex

This package 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. Also those functions transform chunky response into seamless stream of elements.

This package also provides some sample usage in command line application style. See source under app directory of the source package.

Sample Usage

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

Following example is calling List Membership API which returns membership between Rooms and users (Person). You can extract each Membership from Conduit pipe. The streamEntityWithFilter automatically performs pagenation when it is asked more element and last response indicated subsequent page in HTTP Link Header.

    let auth   = Authorization "your authorization token"
        filter = MembershipFilter yourRoomId Nothing Nothing
    runConduit $ streamEntityWithFilter auth def filter .| takeC 200 .| mapM_C print

You can find more examples in app/Main.hs

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.

Limitation

  • WebHook API is not yet implemented.
  • Relative reference in Link Header is not recognized as next page.
Metadata

Version

0.1.0.4

License

Executables (1)

  • bin/cisco-spark-api-exe

Platforms (75)

    Darwin
    FreeBSD
    Genode
    GHCJS
    Linux
    MMIXware
    NetBSD
    none
    OpenBSD
    Redox
    Solaris
    WASI
    Windows
Show all
  • aarch64-darwin
  • aarch64-genode
  • aarch64-linux
  • aarch64-netbsd
  • aarch64-none
  • aarch64_be-none
  • arm-none
  • armv5tel-linux
  • armv6l-linux
  • armv6l-netbsd
  • armv6l-none
  • armv7a-darwin
  • armv7a-linux
  • armv7a-netbsd
  • armv7l-linux
  • armv7l-netbsd
  • avr-none
  • i686-cygwin
  • i686-darwin
  • i686-freebsd
  • i686-genode
  • i686-linux
  • i686-netbsd
  • i686-none
  • i686-openbsd
  • i686-windows
  • javascript-ghcjs
  • loongarch64-linux
  • m68k-linux
  • m68k-netbsd
  • m68k-none
  • microblaze-linux
  • microblaze-none
  • microblazeel-linux
  • microblazeel-none
  • mips-linux
  • mips-none
  • mips64-linux
  • mips64-none
  • mips64el-linux
  • mipsel-linux
  • mipsel-netbsd
  • mmix-mmixware
  • msp430-none
  • or1k-none
  • powerpc-netbsd
  • powerpc-none
  • powerpc64-linux
  • powerpc64le-linux
  • powerpcle-none
  • riscv32-linux
  • riscv32-netbsd
  • riscv32-none
  • riscv64-linux
  • riscv64-netbsd
  • riscv64-none
  • rx-none
  • s390-linux
  • s390-none
  • s390x-linux
  • s390x-none
  • vc4-none
  • wasm32-wasi
  • wasm64-wasi
  • x86_64-cygwin
  • x86_64-darwin
  • x86_64-freebsd
  • x86_64-genode
  • x86_64-linux
  • x86_64-netbsd
  • x86_64-none
  • x86_64-openbsd
  • x86_64-redox
  • x86_64-solaris
  • x86_64-windows