Go to file
Anders Kaseorg 47442c57a2 README: Migrate Travis badge to travis-ci.com.
Signed-off-by: Anders Kaseorg <anders@zulip.com>
2021-02-14 20:56:15 -08:00
.github Create a pull request template. 2018-04-08 20:19:41 -07:00
assets Add a Zulip logo to the heading in the README. 2018-04-01 08:22:49 -07:00
bots Rename folders to use their actual target name. 2018-04-28 11:55:21 -07:00
docs Fix all URLs to point to the `zulip` organization. 2018-05-09 18:34:35 -07:00
example/SwiftZulipAPIExample Rename folders to use their actual target name. 2018-04-28 11:55:21 -07:00
sources/SwiftZulipAPI Make API functions `public`. 2018-04-14 08:44:46 -07:00
tests/SwiftZulipAPITests Rename folders to use their actual target name. 2018-04-28 11:55:21 -07:00
.gitignore Add `Package.resolved` to the gitignore. 2018-04-01 15:24:41 -07:00
.travis.yml Update Travis to use Swift 4.1 through Xcode 9.3. 2018-05-10 06:49:20 -07:00
CONTRIBUTING.md Rename the entire project to `swift-zulip-api`. 2018-04-10 18:56:50 -07:00
LICENSE.md Add the MIT license. 2018-04-01 08:41:21 -07:00
Package.swift Update the minimum Swift version in Package.swift. 2018-05-10 06:33:30 -07:00
README.md README: Migrate Travis badge to travis-ci.com. 2021-02-14 20:56:15 -08:00
swift-zulip-api.podspec Add a minimum Swift version to the podspec. 2018-05-10 06:13:36 -07:00

README.md

swift-zulip-api Swift logo Swift logo

Travis CI build status GitHub tag language badge

A library to access the Zulip API with Swift.

Installation

Swift Package Manager

swift-zulip-api can be installed with the Swift Package Manager.

In your dependencies, add https://github.com/zulip/swift-zulip-api.git:

dependencies: [
    .package(
        url: "https://github.com/zulip/swift-zulip-api.git",
        from: "0.3.0"
    )
]

CocoaPods

swift-zulip-api can also be installed with CocoaPods.

In your Podfile, add swift-zulip-api.

pod 'swift-zulip-api'

Then run pod install from the terminal.

pod install

Usage

Set-up

import SwiftZulipAPI

// Set up a Zulip configuration.
let config = Config(
    emailAddress: "email@example.com",
    apiKey: "yourapikey",
    realmURL: "https://example.com"
)

// Create the Zulip client.
let zulip = Zulip(config: config)

Functions

swift-zulip-api is split into a few different namespaces, each with their own functions:

messages:

let messages = zulip.messages()

See the full messages docs.

streams:

let streams = zulip.streams()

See the full streams docs.

users:

let users = zulip.users()

See the full users docs.

events:

let events = zulip.events()

See the full events docs.

Examples

Each of the function docs has examples for how to use the functions. There is also a full Swift example file if you want to see every function being used in an actual example program. The example can be run by using

swift run SwiftZulipAPIExample

from the terminal.

Bots

swift-zulip-api supports writing Bots to automatically respond to users. Each bot will respond when it is mentioned in a message.

See the full bots docs.