Compare commits
186 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
| 35e7ead8d1 | |||
| 0f896fdaee | |||
| 8a4fceaa00 | |||
| 6007f790db | |||
| 05e7f2baa3 | |||
| 39871172e9 | |||
| 491f80741b | |||
| 0eb9ea31e1 | |||
| 8865376c3c | |||
| d86d0108ff | |||
| b45b7085ce | |||
| 91193c6b2e | |||
| 9720b1c05c | |||
| 9766a5ad6c | |||
| 1e181e7580 | |||
| f6d6c779ae | |||
| 11bb50f8d2 | |||
| d721e0ba1a | |||
| ba6066875c | |||
| 0f1a1a9de5 | |||
| a81cebf5c8 | |||
| 94c9f7fe5a | |||
| be8a5879f3 | |||
| c657919704 | |||
| abeef21d7a | |||
| 79e3b14593 | |||
| d9a4cda9b0 | |||
| 12b316da0b | |||
| 13cade5c00 | |||
| 051e8dd6c8 | |||
| 1adea1c54e | |||
| aa51cfb2fd | |||
| 6b8885bd29 | |||
| e0fbf1ab4e | |||
| 366c6e7b77 | |||
| 378c116d9b | |||
| 58bade8ec9 | |||
| 7d7f5c40d6 | |||
| c9fd54d106 | |||
| 2f1ce799ad | |||
| 7f02f4cf99 | |||
| a9066c0d0a | |||
| 29739dba74 | |||
| d60a7094a4 | |||
| 7edd4210f6 | |||
| 2abaecbd14 | |||
| 346499e03b | |||
| bc72a52bf5 | |||
| 0ebd3cb0e7 | |||
| 5d7064ee13 | |||
| d02768ddad | |||
| dbc7b361c8 | |||
| a0de46e3c7 | |||
| 2d6e19baee | |||
| 21ec3cb2a1 | |||
| cb542da068 | |||
| 788b4e4f7a | |||
| 24b2292cba | |||
| 72866262d2 | |||
| acabbb6c03 | |||
| fff0f0befc | |||
| cf0675dac2 | |||
| 1cffa0ba74 | |||
| 9ebd8182a6 | |||
| 63a8ae7f08 | |||
| 992f94e870 | |||
| 1c476c77ad | |||
| 28bd612ca0 | |||
| 45cf2a7ac0 | |||
| f7c986c65c | |||
| ca43df4475 | |||
| ef71b6abf0 | |||
| 3ff922a2c0 | |||
| 646c371bd3 | |||
| 36401009f8 | |||
| b837554dcf | |||
| 0ba0e019ae | |||
| 8771ef3f0a | |||
| 71e7238483 | |||
| b75c10fca6 | |||
| 50f85ac103 | |||
| a7cbb84b34 | |||
| ed6789c9a5 | |||
| ca444930a4 | |||
| 21051864ec | |||
| 36d1553072 | |||
| eb14758846 | |||
| bf3a5c2422 | |||
| 98fd1342e7 | |||
| 183ed91cb8 | |||
| c241dcf1df | |||
| 8007fa6f0f | |||
| 7ab973a03b | |||
| 1889ffeeee | |||
| 987be40c91 | |||
| 2e71ac6876 | |||
| df661762a9 | |||
| c428cac537 | |||
| 18c6516df9 | |||
| fe450a7db2 | |||
| bb57f59553 | |||
| e5a4a67bdb | |||
| 1e304f1f6d | |||
| 81ebf86abd | |||
| afa16e98b3 | |||
| 6596bb2861 | |||
| fd12ab0600 | |||
| 31508e44dc | |||
| b980f371f6 | |||
| 9526d739e1 | |||
| c3af5c33be | |||
| c6258c57a0 | |||
| 45e075aca2 | |||
| 5ebe40a389 | |||
| 0a5a8f83f7 | |||
| 8f4a287ad0 | |||
| deadc8855a | |||
| 98155f00b7 | |||
| a55d3be65b | |||
| 3b8f1834f0 | |||
| 34972eb8af | |||
| f21179f567 | |||
| e1bf5a160f | |||
| c66a5fe0db | |||
| f03908bcc7 | |||
| 591b0d9d55 | |||
| 6e83fb93d8 | |||
| c1d202f433 | |||
| c7db8ac578 | |||
| d2e430e5bf | |||
| ebe169bf2a | |||
| ca36653dc4 | |||
| 94895edfac | |||
| 3ea13ac6c4 | |||
| e94adfc019 | |||
| 1291323c5a | |||
| 4ceb452e6b | |||
| 457504e786 | |||
| 6d9a939575 | |||
| efc3847a20 | |||
| 3ed139b503 | |||
| a4d9083f72 | |||
| 67b2fa95b3 | |||
| e031f85447 | |||
| 0b1dc6068e | |||
| b027b5b779 | |||
| e507c85ca2 | |||
| 145dfccfae | |||
| b4ca2bcc07 | |||
| 85b2d920ad | |||
| 6415a113ed | |||
| 3a2324b279 | |||
| d647a6b0c9 | |||
| 4230d7841c | |||
| 8995a54d15 | |||
| ba43a123ea | |||
| d00419dc18 | |||
| 15f3a30ba9 | |||
| befa53e3a9 | |||
| 35dfa840e8 | |||
| edf56e1678 | |||
| 3eab323564 | |||
| 0b2ee1d10e | |||
| 5444948940 | |||
| 13335b5de1 | |||
| c8d8e18db6 | |||
| c11321c116 | |||
| 0041a118a7 | |||
| 6cb5280cf5 | |||
| 9cad043957 | |||
| fa15ed8751 | |||
| 0c9c146d58 | |||
| 109a20fac2 | |||
| a6cf1e3cb6 | |||
| d3c16bed5f | |||
| 797d95ab75 | |||
| efb7bc9458 | |||
| 79e59f23fb | |||
| 01e199659e | |||
| 851b2f5e14 | |||
| c506512800 | |||
| 20fa05605b | |||
| 30baf1f76c | |||
| 1c3f01f861 | |||
| 47dc9b3d9f | |||
| b9e828ef3d |
+6
-5
@@ -16,11 +16,12 @@ DerivedData
|
||||
*.hmap
|
||||
*.ipa
|
||||
*.xcuserstate
|
||||
.build
|
||||
Packages/
|
||||
*.xcodeproj/
|
||||
*.DS_Store
|
||||
|
||||
# SwiftPM
|
||||
Packages/
|
||||
.build
|
||||
|
||||
# CocoaPods
|
||||
#
|
||||
# We recommend against adding the Pods directory to your .gitignore. However
|
||||
@@ -28,10 +29,10 @@ Packages/
|
||||
# http://guides.cocoapods.org/using/using-cocoapods.html#should-i-ignore-the-pods-directory-in-source-control
|
||||
#
|
||||
Pods/
|
||||
SlackKit.xcworkspace
|
||||
|
||||
# Carthage
|
||||
#
|
||||
# Add this line if you want to avoid checking in source code from Carthage dependencies.
|
||||
# Carthage/Checkouts
|
||||
|
||||
Carthage/Checkouts
|
||||
Carthage/Build
|
||||
|
||||
+1
-1
@@ -1 +1 @@
|
||||
3.0.2
|
||||
3.0
|
||||
|
||||
@@ -0,0 +1,2 @@
|
||||
github "https://github.com/daltoniam/Starscream" == 2.0.3
|
||||
github "https://github.com/httpswift/swifter" == 1.3.3
|
||||
@@ -1,9 +0,0 @@
|
||||
import PackageDescription
|
||||
|
||||
let package = Package(
|
||||
name: "echobot",
|
||||
targets: [],
|
||||
dependencies: [
|
||||
.Package(url: "https://github.com/pvzig/SlackKit.git", majorVersion: 0, minor: 0),
|
||||
]
|
||||
)
|
||||
@@ -1,35 +0,0 @@
|
||||
import Foundation
|
||||
import SlackKit
|
||||
|
||||
class Echobot: MessageEventsDelegate {
|
||||
|
||||
let client: SlackClient
|
||||
|
||||
init(token: String) {
|
||||
client = SlackClient(apiToken: token)
|
||||
client.messageEventsDelegate = self
|
||||
}
|
||||
|
||||
// MARK: MessageEventsDelegate
|
||||
func sent(_ message: Message, client: SlackClient) {}
|
||||
func changed(_ message: Message, client: SlackClient) {}
|
||||
func deleted(_ message: Message?, client: SlackClient) {}
|
||||
func received(_ message: Message, client: SlackClient) {
|
||||
listen(message: message)
|
||||
}
|
||||
|
||||
// MARK: Echobot Internal Logic
|
||||
private func listen(message: Message) {
|
||||
if let channel = message.channel, let text = message.text, let id = client.authenticatedUser?.id {
|
||||
if id != message.user && message.user != nil {
|
||||
client.webAPI.sendMessage(channel:channel, text: text, linkNames: true, success: {(response) in
|
||||
}, failure: { (error) in
|
||||
print("Echobot failed to reply due to error:\(error)")
|
||||
})
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
let echobot = Echobot(token: "xoxb-SLACK_API_TOKEN")
|
||||
echobot.client.connect()
|
||||
@@ -1,8 +0,0 @@
|
||||
import PackageDescription
|
||||
|
||||
let package = Package(
|
||||
name: "leaderboard",
|
||||
dependencies: [
|
||||
.Package(url: "https://github.com/pvzig/SlackKit.git", majorVersion: 0, minor: 0),
|
||||
]
|
||||
)
|
||||
@@ -1,141 +0,0 @@
|
||||
import Foundation
|
||||
import SlackKit
|
||||
|
||||
class Leaderboard: MessageEventsDelegate {
|
||||
|
||||
var leaderboard: [String: Int] = [String: Int]()
|
||||
let atSet = CharacterSet(charactersIn: "@")
|
||||
|
||||
let client: SlackClient
|
||||
|
||||
init(token: String) {
|
||||
client = SlackClient(apiToken: token)
|
||||
client.messageEventsDelegate = self
|
||||
}
|
||||
|
||||
enum Command: String {
|
||||
case leaderboard = "leaderboard"
|
||||
}
|
||||
|
||||
enum Trigger: String {
|
||||
case plusPlus = "++"
|
||||
case minusMinus = "--"
|
||||
}
|
||||
|
||||
// MARK: MessageEventsDelegate
|
||||
func sent(_ message: Message, client: SlackClient) {}
|
||||
func changed(_ message: Message, client: SlackClient) {}
|
||||
func deleted(_ message: Message?, client: SlackClient) {}
|
||||
func received(_ message: Message, client: SlackClient) {
|
||||
listen(message: message)
|
||||
}
|
||||
|
||||
// MARK: Leaderboard Internal Logic
|
||||
private func listen(message: Message) {
|
||||
if let id = client.authenticatedUser?.id, let text = message.text {
|
||||
if text.lowercased().contains(Command.leaderboard.rawValue) && text.contains(id) {
|
||||
handleCommand(command: .leaderboard, channel: message.channel)
|
||||
}
|
||||
}
|
||||
if message.text?.contains(Trigger.plusPlus.rawValue) == true {
|
||||
handleMessageWithTrigger(message: message, trigger: .plusPlus)
|
||||
}
|
||||
if message.text?.contains(Trigger.minusMinus.rawValue) == true {
|
||||
handleMessageWithTrigger(message: message, trigger: .minusMinus)
|
||||
}
|
||||
}
|
||||
|
||||
private func handleMessageWithTrigger(message: Message, trigger: Trigger) {
|
||||
if let text = message.text, let start = text.range(of: "@")?.lowerBound, let end = text.range(of: trigger.rawValue)?.lowerBound {
|
||||
let string = String(text.characters[start...end].dropLast().dropFirst())
|
||||
let users = client.users.values.filter{$0.id == self.userID(string: string)}
|
||||
if users.count > 0 {
|
||||
let idString = userID(string: string)
|
||||
initalizationForValue(dictionary: &leaderboard, value: idString)
|
||||
scoringForValue(dictionary: &leaderboard, value: idString, trigger: trigger)
|
||||
} else {
|
||||
initalizationForValue(dictionary: &leaderboard, value: string)
|
||||
scoringForValue(dictionary: &leaderboard, value: string, trigger: trigger)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
private func handleCommand(command: Command, channel:String?) {
|
||||
switch command {
|
||||
case .leaderboard:
|
||||
if let id = channel {
|
||||
client.webAPI.sendMessage(channel:id, text: "Leaderboard", linkNames: true, attachments: [constructLeaderboardAttachment()], success: {(response) in
|
||||
print(response)
|
||||
}, failure: { (error) in
|
||||
print("Leaderboard failed to post due to error:\(error)")
|
||||
})
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
private func initalizationForValue( dictionary: inout [String: Int], value: String) {
|
||||
if dictionary[value] == nil {
|
||||
dictionary[value] = 0
|
||||
}
|
||||
}
|
||||
|
||||
private func scoringForValue( dictionary: inout [String: Int], value: String, trigger: Trigger) {
|
||||
switch trigger {
|
||||
case .plusPlus:
|
||||
dictionary[value]?+=1
|
||||
case .minusMinus:
|
||||
dictionary[value]?-=1
|
||||
}
|
||||
}
|
||||
|
||||
// MARK: Leaderboard Interface
|
||||
private func constructLeaderboardAttachment() -> Attachment? {
|
||||
let 💯 = AttachmentField(title: "💯", value: swapIDsForNames(string: topItems(dictionary: &leaderboard)), short: true)
|
||||
let 💩 = AttachmentField(title: "💩", value: swapIDsForNames(string: bottomItems(dictionary: &leaderboard)), short: true)
|
||||
return Attachment(fallback: "Leaderboard", title: "Leaderboard", colorHex: AttachmentColor.good.rawValue, text: "", fields: [💯, 💩])
|
||||
}
|
||||
|
||||
private func topItems(dictionary: inout [String: Int]) -> String {
|
||||
let sortedKeys = dictionary.keys.sorted(by: { (k1: String, k2: String) -> Bool in
|
||||
return dictionary[k1]! > dictionary[k2]!
|
||||
}).filter({ dictionary[$0]! > 0})
|
||||
let sortedValues = dictionary.values.sorted(by: {$0 > $1}).filter({$0 > 0})
|
||||
return leaderboardString(keys: sortedKeys, values: sortedValues)
|
||||
}
|
||||
|
||||
private func bottomItems( dictionary: inout [String: Int]) -> String {
|
||||
let sortedKeys = dictionary.keys.sorted(by: { (k1: String, k2: String) -> Bool in
|
||||
return dictionary[k1]! < dictionary[k2]!
|
||||
}).filter({ dictionary[$0]! < 0})
|
||||
let sortedValues = dictionary.values.sorted(by: {$0 < $1}).filter({$0 < 0})
|
||||
return leaderboardString(keys: sortedKeys, values: sortedValues)
|
||||
}
|
||||
|
||||
private func leaderboardString(keys: [String], values: [Int]) -> String {
|
||||
var returnValue = ""
|
||||
for i in 0..<values.count {
|
||||
returnValue += keys[i] + " (" + "\(values[i])" + ")\n"
|
||||
}
|
||||
return returnValue
|
||||
}
|
||||
|
||||
// MARK: - Utilities
|
||||
private func swapIDsForNames(string: String) -> String {
|
||||
var returnString = string
|
||||
for key in client.users.keys {
|
||||
if let name = client.users[key]?.name {
|
||||
if returnString.contains(key) {
|
||||
returnString = returnString.replacingOccurrences(of: key, with: "@"+name)
|
||||
}
|
||||
}
|
||||
}
|
||||
return returnString
|
||||
}
|
||||
|
||||
private func userID(string: String) -> String {
|
||||
return string.trimmingCharacters(in: CharacterSet.alphanumerics.inverted)
|
||||
}
|
||||
}
|
||||
|
||||
let leaderboard = Leaderboard(token: "xoxb-SLACK_API_TOKEN")
|
||||
leaderboard.client.connect()
|
||||
@@ -1,9 +0,0 @@
|
||||
import PackageDescription
|
||||
|
||||
let package = Package(
|
||||
name: "robot-or-not-bot",
|
||||
targets: [],
|
||||
dependencies: [
|
||||
.Package(url: "https://github.com/pvzig/SlackKit.git", majorVersion: 0, minor: 0),
|
||||
]
|
||||
)
|
||||
@@ -1,117 +0,0 @@
|
||||
import Foundation
|
||||
import SlackKit
|
||||
|
||||
class RobotOrNotBot: MessageEventsDelegate {
|
||||
|
||||
let verdicts: [String:Bool] = [
|
||||
"Mr. Roboto" : false,
|
||||
"Service Kiosks": false,
|
||||
"Darth Vader": false,
|
||||
"K-9": true,
|
||||
"Emotions": false,
|
||||
"Self-Driving Cars": false,
|
||||
"Telepresence Robots": false,
|
||||
"Roomba": true,
|
||||
"Assembly-Line Robot": false,
|
||||
"ASIMO": false,
|
||||
"KITT": false,
|
||||
"USS Enterprise": false,
|
||||
"Transformers": true,
|
||||
"Jaegers": false,
|
||||
"The Major": false,
|
||||
"Siri": false,
|
||||
"The Terminator": true,
|
||||
"Commander Data": false,
|
||||
"Marvin the Paranoid Android": true,
|
||||
"Pinocchio": false,
|
||||
"Droids": true,
|
||||
"Hitchbot": false,
|
||||
"Mars Rovers": false,
|
||||
"Space Probes": false,
|
||||
"Sasquatch": false,
|
||||
"Toaster": false,
|
||||
"Toaster Oven": false,
|
||||
"Cylons": false,
|
||||
"V'ger": true,
|
||||
"Ilia Robot": false,
|
||||
"The TARDIS": false,
|
||||
"Johnny 5": true,
|
||||
"Twiki": true,
|
||||
"Dr. Theopolis": false,
|
||||
"robots.txt": false,
|
||||
"Lobot": false,
|
||||
"Vicki": true,
|
||||
"GlaDOS": false,
|
||||
"Turrets": true,
|
||||
"Wheatley": true,
|
||||
"Herbie the Love Bug": false,
|
||||
"Iron Man": false,
|
||||
"Ultron": false,
|
||||
"The Vision": false,
|
||||
"Clockwork Droids": false,
|
||||
"Podcasts": false,
|
||||
"Cars": false,
|
||||
"Swimming Pool Cleaners": false,
|
||||
"Burritos": false,
|
||||
"Prince Robot IV": false,
|
||||
"Daleks": false,
|
||||
"Cybermen": false,
|
||||
"The Internet of Things": false,
|
||||
"Nanobots": true,
|
||||
"Two Intermeshed Gears": false,
|
||||
"Crow T. Robot": true,
|
||||
"Tom Servo": true,
|
||||
"Thomas and Friends": false,
|
||||
"Replicants": false,
|
||||
"Chatbots": false,
|
||||
"Agents": false,
|
||||
"Lego Simulated Worm Toy": true,
|
||||
"Ghosts": false,
|
||||
"Exos": true,
|
||||
"Rasputin": false,
|
||||
"Tamagotchi": false,
|
||||
"T-1000": true,
|
||||
"The Tin Woodman": false,
|
||||
"Mic N. The Robot": true,
|
||||
"Robot Or Not Bot": false
|
||||
]
|
||||
|
||||
let client: SlackClient
|
||||
|
||||
init(token: String) {
|
||||
client = SlackClient(apiToken: token)
|
||||
client.messageEventsDelegate = self
|
||||
}
|
||||
|
||||
// MARK: MessageEventsDelegate
|
||||
func received(_ message: Message, client: SlackClient) {
|
||||
if let id = client.authenticatedUser?.id {
|
||||
if message.text?.contains(id) == true {
|
||||
handleMessage(message: message)
|
||||
}
|
||||
}
|
||||
}
|
||||
func changed(_ message: Message, client: SlackClient) {}
|
||||
func deleted(_ message: Message?, client: SlackClient) {}
|
||||
func sent(_ message: Message, client: SlackClient) {}
|
||||
|
||||
private func handleMessage(message: Message) {
|
||||
if let text = message.text?.lowercased(), let channel = message.channel {
|
||||
for (robot, verdict) in verdicts {
|
||||
let lowerbot = robot.lowercased()
|
||||
if text.contains(lowerbot) {
|
||||
if verdict == true {
|
||||
client.webAPI.addReaction(name: "robot_face", channel: channel, timestamp: message.ts, success: nil, failure: nil)
|
||||
} else {
|
||||
client.webAPI.addReaction(name: "no_entry_sign", channel: channel, timestamp: message.ts, success: nil, failure: nil)
|
||||
}
|
||||
return
|
||||
}
|
||||
}
|
||||
client.webAPI.addReaction(name: "question", channel: channel, timestamp: message.ts, success: nil, failure: nil)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
let slackbot = RobotOrNotBot(token: "xoxb-SLACK_API_TOKEN")
|
||||
slackbot.client.connect()
|
||||
+3
-27
@@ -1,34 +1,10 @@
|
||||
//
|
||||
// Package.swift
|
||||
//
|
||||
// Copyright © 2016 Peter Zignego. All rights reserved.
|
||||
//
|
||||
// Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||
// of this software and associated documentation files (the "Software"), to deal
|
||||
// in the Software without restriction, including without limitation the rights
|
||||
// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
||||
// copies of the Software, and to permit persons to whom the Software is
|
||||
// furnished to do so, subject to the following conditions:
|
||||
//
|
||||
// The above copyright notice and this permission notice shall be included in
|
||||
// all copies or substantial portions of the Software.
|
||||
//
|
||||
// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||
// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||
// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
||||
// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
||||
// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
||||
// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
|
||||
// THE SOFTWARE.
|
||||
|
||||
import PackageDescription
|
||||
|
||||
let package = Package(
|
||||
name: "SlackKit",
|
||||
targets: [],
|
||||
dependencies: [
|
||||
.Package(url: "https://github.com/Zewo/WebSocketClient", majorVersion: 0, minor: 14),
|
||||
.Package(url: "https://github.com/Zewo/HTTPClient.git", majorVersion: 0, minor: 14)
|
||||
],
|
||||
exclude: ["Examples"]
|
||||
.Package(url: "https://github.com/httpswift/swifter", majorVersion: 1),
|
||||
.Package(url: "https://github.com/daltoniam/Starscream", majorVersion: 2)
|
||||
]
|
||||
)
|
||||
|
||||
@@ -0,0 +1,18 @@
|
||||
source 'https://github.com/CocoaPods/Specs.git'
|
||||
|
||||
use_frameworks!
|
||||
|
||||
target 'SlackKit OS X' do
|
||||
pod 'Starscream', '~> 2.0.3'
|
||||
pod 'Swifter', '~> 1.3.3'
|
||||
end
|
||||
|
||||
target 'SlackKit iOS' do
|
||||
pod 'Starscream', '~> 2.0.3'
|
||||
pod 'Swifter', '~> 1.3.3'
|
||||
end
|
||||
|
||||
target 'SlackKit tvOS' do
|
||||
pod 'Starscream', '~> 2.0.3'
|
||||
pod 'Swifter', '~> 1.3.3'
|
||||
end
|
||||
@@ -1,72 +1,145 @@
|
||||

|
||||
|
||||
   [](https://github.com/apple/swift-package-manager)
|
||||
##Alpha Linux Slack Client Library
|
||||
###Description
|
||||
This is a Slack client library for Linux written in Swift. It's intended to expose all of the functionality of Slack's [Real Time Messaging API](https://api.slack.com/rtm) as well as the [web APIs](https://api.slack.com/web) that are accessible by [bot users](https://api.slack.com/bot-users).
|
||||
   [](https://cocoapods.org) [](https://github.com/Carthage/Carthage) [](https://github.com/apple/swift-package-manager)
|
||||
## SlackKit: A Swift Slack Client Library
|
||||
### Description
|
||||
|
||||
###Disclaimer: The linux version of SlackKit is a pre-release alpha. Feel free to report issues you come across.
|
||||
This is a Slack client library for OS X, iOS, and tvOS written in Swift. It's intended to expose all of the functionality of Slack's [Real Time Messaging API](https://api.slack.com/rtm) as well as the [web APIs](https://api.slack.com/web) that are accessible to [bot users](https://api.slack.com/bot-users). SlackKit also supports Slack’s [OAuth 2.0](https://api.slack.com/docs/oauth) flow including the [Add to Slack](https://api.slack.com/docs/slack-button) and [Sign in with Slack](https://api.slack.com/docs/sign-in-with-slack) buttons, [incoming webhooks](https://api.slack.com/incoming-webhooks), [slash commands](https://api.slack.com/slash-commands), and [message buttons](https://api.slack.com/docs/message-buttons).
|
||||
|
||||
###Installation
|
||||
This is the **Swift 3** branch of SlackKit. SlackKit also has support for [Swift 2.3](https://github.com/pvzig/SlackKit/tree/swift2.3) and [Linux](https://github.com/pvzig/SlackKit/tree/linux).
|
||||
|
||||
#### Building the SlackKit Framework
|
||||
To build the SlackKit project directly, first build the dependencies using Carthage or CocoaPods. To use the framework in your application, install it in one of the following ways:
|
||||
|
||||
### Installation
|
||||
|
||||
#### CocoaPods
|
||||
|
||||
Add SlackKit to your pod file:
|
||||
```
|
||||
use_frameworks!
|
||||
pod 'SlackKit'
|
||||
```
|
||||
and run
|
||||
```
|
||||
# Use CocoaPods version >= 1.1.0
|
||||
pod install
|
||||
```
|
||||
|
||||
#### Carthage
|
||||
|
||||
Add SlackKit to your Cartfile:
|
||||
```
|
||||
github "pvzig/SlackKit"
|
||||
```
|
||||
and run
|
||||
```
|
||||
carthage bootstrap
|
||||
```
|
||||
|
||||
Drag the built `SlackKit.framework` into your Xcode project.
|
||||
|
||||
#### Swift Package Manager
|
||||
|
||||
####Swift Package Manager
|
||||
Add SlackKit to your Package.swift
|
||||
|
||||
```swift
|
||||
import PackageDescription
|
||||
|
||||
|
||||
let package = Package(
|
||||
dependencies: [
|
||||
.Package(url: "https://github.com/pvzig/SlackKit.git", majorVersion: 0, minor: 0)
|
||||
]
|
||||
dependencies: [
|
||||
.Package(url: "https://github.com/pvzig/SlackKit.git", majorVersion: 3)
|
||||
]
|
||||
)
|
||||
```
|
||||
|
||||
####Development
|
||||
1. Install Homebrew: `/usr/bin/ruby -e "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/master/install)"`
|
||||
2. Install `swiftenv`: `brew install kylef/formulae/swiftenv`
|
||||
3. Configure your shell: `echo 'if which swiftenv > /dev/null; then eval "$(swiftenv init -)"; fi' >> ~/.bash_profile`
|
||||
4. Download and install the latest Zewo compatible snapshot:
|
||||
```
|
||||
swiftenv install DEVELOPMENT-SNAPSHOT-2016-05-09-a
|
||||
swiftenv local DEVELOPMENT-SNAPSHOT-2016-05-09-a
|
||||
```
|
||||
5. Install and Link OpenSSL: `brew install openssl`, `brew link openssl --force`
|
||||
|
||||
To build an application that uses SlackKit in Xcode, simply use SwiftPM. (For the 05-03 snapshot you must run `swift build` before generating an Xcode project:
|
||||
```
|
||||
swift build
|
||||
swift build -Xlinker -L$(pwd)/.build/debug/ -Xswiftc -I/usr/local/include -Xlinker -L/usr/local/lib -X
|
||||
```
|
||||
|
||||
Run `swift build` on your application’s main directory.
|
||||
|
||||
To use the library in your project import it:
|
||||
```
|
||||
import SlackKit
|
||||
```
|
||||
|
||||
####Deployment
|
||||
Deploy your application to Heroku using [this buildpack](https://github.com/pvzig/heroku-buildpack-swift). For more detailed instructions please see [this post](https://medium.com/@pvzig/building-slack-bots-in-swift-b99e243e444c).
|
||||
### Usage
|
||||
|
||||
###Usage
|
||||
To use SlackKit you'll need a bearer token which identifies a single user. You can generate a [full access token or create one using OAuth 2](https://api.slack.com/web).
|
||||
#### OAuth
|
||||
Slack has [many different oauth scopes](https://api.slack.com/docs/oauth-scopes) that can be combined in different ways. If your application does not request the proper OAuth scopes, your API calls will fail.
|
||||
|
||||
Once you have a token, initialize a client instance using it:
|
||||
If you authenticate using OAuth and the Add to Slack or Sign in with Slack buttons this is handled for you.
|
||||
|
||||
If you wish to make OAuth requests yourself, you can generate them using the `authorizeRequest` function on `SlackKit`’s `oauth` property:
|
||||
```swift
|
||||
let client = Client(apiToken: "YOUR_SLACK_API_TOKEN")
|
||||
func authorizeRequest(scope:[Scope], redirectURI: String, state: String = "slackkit", team: String? = nil)
|
||||
```
|
||||
|
||||
If you want to receive messages from the Slack RTM API, connect to it.
|
||||
For local development of things like OAuth, slash commands, and message buttons that require connecting over `https`, you may want to use a tool like [ngrok](https://ngrok.com) or [localtunnel](http://localtunnel.me).
|
||||
|
||||
#### Incoming Webhooks
|
||||
After [configuring your incoming webhook in Slack](https://my.slack.com/services/new/incoming-webhook/), initialize IncomingWebhook with the provided URL and use `postMessage` to send messages.
|
||||
```swift
|
||||
client.connect()
|
||||
let incoming = IncomingWebhook(url: "https://hooks.slack.com/services/T00000000/B00000000/XXXXXXXXXXXXXXXXXXXXXXXX")
|
||||
let message = Response(text: "Hello, World!")
|
||||
incoming.postMessage(message)
|
||||
```
|
||||
|
||||
#### Slash Commands
|
||||
After [configuring your slash command in Slack](https://my.slack.com/services/new/slash-commands) (you can also provide slash commands as part of a [Slack App](https://api.slack.com/slack-apps)), initialize a webhook server with the token for the slash command, a configured route, and a response.
|
||||
```swift
|
||||
let response = Response(text: "Hello, World!", responseType: .inChannel)
|
||||
let webhook = WebhookServer(token: "SLASH-COMMAND-TOKEN", route: "hello_world", response: response)
|
||||
webhook.start()
|
||||
```
|
||||
When a user enters that slash command, it will hit your configured route and return the response you specified.
|
||||
|
||||
To add additional routes and responses, you can use WebhookServer’s addRoute function:
|
||||
```swift
|
||||
func addRoute(route: String, response: Response)
|
||||
```
|
||||
|
||||
#### Message Buttons
|
||||
If you are developing a Slack App and are authorizing using OAuth, you can use [message buttons](https://api.slack.com/docs/message-buttons).
|
||||
|
||||
To send messages with actions, add them to an attachment:
|
||||
```swift
|
||||
let helloAction = Action(name: "hello_world", text: "Hello, World!")
|
||||
let attachment = Attachment(fallback: "Hello World Attachment", title: "Attachment with an Action Button", callbackID: "helloworld", actions: [helloAction])
|
||||
```
|
||||
|
||||
To act on message actions, initialize an instance of the `MessageActionServer` using your app’s verification token, your specified interactive messages request URL route, and a `MessageActionResponder`:
|
||||
```swift
|
||||
let action = Action(name: "hello_world", text: "Hello, World!")
|
||||
let response = Response(text: "Hello, 🌎!", responseType: .inChannel)
|
||||
let responder = MessageActionResponder(responses: [(action, response)])
|
||||
let server = MessageActionServer(token: "SLACK-APP-VERIFICATION-TOKEN", route: "actions", responder: responder)
|
||||
server.start()
|
||||
```
|
||||
|
||||
#### Bot Users
|
||||
To deploy a bot user using SlackKit you'll need a bearer token which identifies a single user. You can generate a [full access token or create one using OAuth 2](https://api.slack.com/web).
|
||||
|
||||
Initialize a SlackKit instance using your [application’s Client ID and Client Secret](https://api.slack.com/apps) to set up SlackKit for OAuth authorization:
|
||||
```swift
|
||||
let bot = SlackKit(clientID: "CLIENT_ID", clientSecret: "CLIENT_SECRET")
|
||||
```
|
||||
|
||||
or use a manually acquired token:
|
||||
```swift
|
||||
let bot = SlackKit(withAPIToken: "xoxp-YOUR-SLACK-API-TOKEN")
|
||||
```
|
||||
|
||||
#### Client Connection Options
|
||||
You can also set options for a ping/pong interval, timeout interval, and automatic reconnection:
|
||||
```swift
|
||||
let options = ClientOptions(pingInterval: 2, timeout: 10, reconnect: false)
|
||||
let bot = SlackKit(clientID: "CLIENT_ID", clientSecret: "CLIENT_SECRET", clientOptions: options)
|
||||
```
|
||||
|
||||
Once connected, the client will begin to consume any messages sent by the Slack RTM API.
|
||||
|
||||
####Web API Methods
|
||||
#### Web API Methods
|
||||
SlackKit currently supports the a subset of the Slack Web APIs that are available to bot users:
|
||||
|
||||
- api.test
|
||||
- auth.revoke
|
||||
- auth.test
|
||||
- channels.history
|
||||
- channels.info
|
||||
@@ -75,6 +148,7 @@ SlackKit currently supports the a subset of the Slack Web APIs that are availabl
|
||||
- channels.setPurpose
|
||||
- channels.setTopic
|
||||
- chat.delete
|
||||
- chat.meMessage
|
||||
- chat.postMessage
|
||||
- chat.update
|
||||
- emoji.list
|
||||
@@ -82,6 +156,7 @@ SlackKit currently supports the a subset of the Slack Web APIs that are availabl
|
||||
- files.comments.edit
|
||||
- files.comments.delete
|
||||
- files.delete
|
||||
- files.info
|
||||
- files.upload
|
||||
- groups.close
|
||||
- groups.history
|
||||
@@ -101,6 +176,7 @@ SlackKit currently supports the a subset of the Slack Web APIs that are availabl
|
||||
- mpim.list
|
||||
- mpim.mark
|
||||
- mpim.open
|
||||
- oauth.access
|
||||
- pins.add
|
||||
- pins.list
|
||||
- pins.remove
|
||||
@@ -120,112 +196,121 @@ SlackKit currently supports the a subset of the Slack Web APIs that are availabl
|
||||
|
||||
They can be accessed through a Client object’s `webAPI` property:
|
||||
```swift
|
||||
client.webAPI.authenticationTest({
|
||||
(authenticated) -> Void in
|
||||
print(authenticated)
|
||||
}){(error) -> Void in
|
||||
print(error)
|
||||
client.webAPI.authenticationTest({(auth) in
|
||||
print(auth)
|
||||
}, failure: {(error) in
|
||||
print(error)
|
||||
})
|
||||
```
|
||||
|
||||
#### Delegate methods
|
||||
|
||||
To receive delegate callbacks for events, register an object as the delegate for those events using the `onClientInitalization` block:
|
||||
```swift
|
||||
let bot = SlackKit(clientID: clientID, clientSecret: clientSecret)
|
||||
bot.onClientInitalization = { (client: Client) in
|
||||
DispatchQueue.main.async(execute: {
|
||||
client.messageEventsDelegate = self
|
||||
})
|
||||
}
|
||||
```
|
||||
|
||||
####Delegate methods
|
||||
|
||||
To receive delegate callbacks for certain events, register an object as the delegate for those events:
|
||||
```swift
|
||||
client.slackEventsDelegate = self
|
||||
```
|
||||
Delegate callbacks contain a reference to the Client where the event occurred.
|
||||
|
||||
There are a number of delegates that you can set to receive callbacks for certain events.
|
||||
|
||||
#####SlackEventsDelegate
|
||||
##### ConnectionEventsDelegate
|
||||
```swift
|
||||
func clientConnected()
|
||||
func clientDisconnected()
|
||||
func preferenceChanged(preference: String, value: AnyObject)
|
||||
func userChanged(user: User)
|
||||
func presenceChanged(user: User?, presence: String?)
|
||||
func manualPresenceChanged(user: User?, presence: String?)
|
||||
func botEvent(bot: Bot)
|
||||
connected(_ client: Client)
|
||||
disconnected(_ client: Client)
|
||||
connectionFailed(_ client: Client, error: SlackError)
|
||||
```
|
||||
##### MessageEventsDelegate
|
||||
```swift
|
||||
sent(_ message: Message, client: Client)
|
||||
received(_ message: Message, client: Client)
|
||||
changed(_ message: Message, client: Client)
|
||||
deleted(_ message: Message?, client: Client)
|
||||
```
|
||||
##### ChannelEventsDelegate
|
||||
```swift
|
||||
userTypingIn(_ channel: Channel, user: User, client: Client)
|
||||
marked(_ channel: Channel, timestamp: String, client: Client)
|
||||
created(_ channel: Channel, client: Client)
|
||||
deleted(_ channel: Channel, client: Client)
|
||||
renamed(_ channel: Channel, client: Client)
|
||||
archived(_ channel: Channel, client: Client)
|
||||
historyChanged(_ channel: Channel, client: Client)
|
||||
joined(_ channel: Channel, client: Client)
|
||||
left(_ channel: Channel, client: Client)
|
||||
```
|
||||
##### DoNotDisturbEventsDelegate
|
||||
```swift
|
||||
updated(_ status: DoNotDisturbStatus, client: Client)
|
||||
userUpdated(_ status: DoNotDisturbStatus, user: User, client: Client)
|
||||
```
|
||||
##### GroupEventsDelegate
|
||||
```swift
|
||||
opened(_ group: Channel, client: Client)
|
||||
```
|
||||
##### FileEventsDelegate
|
||||
```swift
|
||||
processed(_ file: File, client: Client)
|
||||
madePrivate(_ file: File, client: Client)
|
||||
deleted(_ file: File, client: Client)
|
||||
commentAdded(_ file: File, comment: Comment, client: Client)
|
||||
commentEdited(_ file: File, comment: Comment, client: Client)
|
||||
commentDeleted(_ file: File, comment: Comment, client: Client)
|
||||
```
|
||||
##### PinEventsDelegate
|
||||
```swift
|
||||
pinned(_ item: Item, channel: Channel?, client: Client)
|
||||
unpinned(_ item: Item, channel: Channel?, client: Client)
|
||||
```
|
||||
##### StarEventsDelegate
|
||||
```swift
|
||||
starred(_ item: Item, starred: Bool, _ client: Client)
|
||||
```
|
||||
##### ReactionEventsDelegate
|
||||
```swift
|
||||
added(_ reaction: String, item: Item, itemUser: String, client: Client)
|
||||
removed(_ reaction: String, item: Item, itemUser: String, client: Client)
|
||||
```
|
||||
##### SlackEventsDelegate
|
||||
```swift
|
||||
preferenceChanged(_ preference: String, value: Any?, client: Client)
|
||||
userChanged(_ user: User, client: Client)
|
||||
presenceChanged(_ user: User, presence: String, client: Client)
|
||||
manualPresenceChanged(_ user: User, presence: String, client: Client)
|
||||
botEvent(_ bot: Bot, client: Client)
|
||||
```
|
||||
##### TeamEventsDelegate
|
||||
```swift
|
||||
userJoined(_ user: User, client: Client)
|
||||
planChanged(_ plan: String, client: Client)
|
||||
preferencesChanged(_ preference: String, value: Any?, client: Client)
|
||||
nameChanged(_ name: String, client: Client)
|
||||
domainChanged(_ domain: String, client: Client)
|
||||
emailDomainChanged(_ domain: String, client: Client)
|
||||
emojiChanged(_ client: Client)
|
||||
```
|
||||
##### SubteamEventsDelegate
|
||||
```swift
|
||||
event(_ userGroup: UserGroup, client: Client)
|
||||
selfAdded(_ subteamID: String, client: Client)
|
||||
selfRemoved(_ subteamID: String, client: Client)
|
||||
```
|
||||
##### TeamProfileEventsDelegate
|
||||
```swift
|
||||
changed(_ profile: CustomProfile, client: Client)
|
||||
deleted(_ profile: CustomProfile, client: Client)
|
||||
reordered(_ profile: CustomProfile, client: Client)
|
||||
```
|
||||
|
||||
#####MessageEventsDelegate
|
||||
```swift
|
||||
func messageSent(message: Message)
|
||||
func messageReceived(message: Message)
|
||||
func messageChanged(message: Message)
|
||||
func messageDeleted(message: Message?)
|
||||
```
|
||||
### Examples
|
||||
[Check out example applications here.](https://github.com/pvzig/SlackKit-examples)
|
||||
|
||||
#####ChannelEventsDelegate
|
||||
```swift
|
||||
func userTyping(channel: Channel?, user: User?)
|
||||
func channelMarked(channel: Channel, timestamp: String?)
|
||||
func channelCreated(channel: Channel)
|
||||
func channelDeleted(channel: Channel)
|
||||
func channelRenamed(channel: Channel)
|
||||
func channelArchived(channel: Channel)
|
||||
func channelHistoryChanged(channel: Channel)
|
||||
func channelJoined(channel: Channel)
|
||||
func channelLeft(channel: Channel)
|
||||
```
|
||||
|
||||
#####DoNotDisturbEventsDelegate
|
||||
```swift
|
||||
doNotDisturbUpdated(dndStatus: DoNotDisturbStatus)
|
||||
doNotDisturbUserUpdated(dndStatus: DoNotDisturbStatus, user: User?)
|
||||
```
|
||||
|
||||
#####GroupEventsDelegate
|
||||
```swift
|
||||
func groupOpened(group: Channel)
|
||||
```
|
||||
|
||||
#####FileEventsDelegate
|
||||
```swift
|
||||
func fileProcessed(file: File)
|
||||
func fileMadePrivate(file: File)
|
||||
func fileDeleted(file: File)
|
||||
func fileCommentAdded(file: File, comment: Comment)
|
||||
func fileCommentEdited(file: File, comment: Comment)
|
||||
func fileCommentDeleted(file: File, comment: Comment)
|
||||
```
|
||||
|
||||
#####PinEventsDelegate
|
||||
```swift
|
||||
func itemPinned(item: Item?, channel: Channel?)
|
||||
func itemUnpinned(item: Item?, channel: Channel?)
|
||||
```
|
||||
|
||||
#####StarEventsDelegate
|
||||
```swift
|
||||
func itemStarred(item: Item, star: Bool)
|
||||
```
|
||||
|
||||
#####ReactionEventsDelegate
|
||||
```swift
|
||||
func reactionAdded(reaction: String?, item: Item?, itemUser: String?)
|
||||
func reactionRemoved(reaction: String?, item: Item?, itemUser: String?)
|
||||
```
|
||||
|
||||
#####TeamEventsDelegate
|
||||
```swift
|
||||
func teamJoined(user: User)
|
||||
func teamPlanChanged(plan: String)
|
||||
func teamPreferencesChanged(preference: String, value: AnyObject)
|
||||
func teamNameChanged(name: String)
|
||||
func teamDomainChanged(domain: String)
|
||||
func teamEmailDomainChanged(domain: String)
|
||||
func teamEmojiChanged()
|
||||
```
|
||||
|
||||
#####SubteamEventsDelegate
|
||||
```swift
|
||||
func subteamEvent(userGroup: UserGroup)
|
||||
func subteamSelfAdded(subteamID: String)
|
||||
func subteamSelfRemoved(subteamID: String)
|
||||
```
|
||||
|
||||
###Get In Touch
|
||||
### Get In Touch
|
||||
[@pvzig](https://twitter.com/pvzig)
|
||||
|
||||
<peter@launchsoft.co>
|
||||
|
||||
@@ -0,0 +1,18 @@
|
||||
Pod::Spec.new do |s|
|
||||
s.name = "SlackKit"
|
||||
s.version = "3.1.11"
|
||||
s.summary = "a Slack client library for OS X, iOS, and tvOS written in Swift"
|
||||
s.homepage = "https://github.com/pvzig/SlackKit"
|
||||
s.license = 'MIT'
|
||||
s.author = { "Peter Zignego" => "peter@launchsoft.co" }
|
||||
s.source = { :git => "https://github.com/pvzig/SlackKit.git", :tag => s.version.to_s }
|
||||
s.social_media_url = 'https://twitter.com/pvzig'
|
||||
s.ios.deployment_target = '8.0'
|
||||
s.osx.deployment_target = '10.10'
|
||||
s.tvos.deployment_target = '9.0'
|
||||
s.requires_arc = true
|
||||
s.source_files = 'Sources/SlackKit/**/*.swift'
|
||||
s.frameworks = 'Foundation'
|
||||
s.dependency 'Starscream'
|
||||
s.dependency 'Swifter'
|
||||
end
|
||||
@@ -0,0 +1,983 @@
|
||||
// !$*UTF8*$!
|
||||
{
|
||||
archiveVersion = 1;
|
||||
classes = {
|
||||
};
|
||||
objectVersion = 46;
|
||||
objects = {
|
||||
|
||||
/* Begin PBXBuildFile section */
|
||||
2659FC1B1DADC4E0003F3930 /* Starscream.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 4307A07F1CC6D0910011D5DE /* Starscream.framework */; };
|
||||
2659FC1C1DADC4E0003F3930 /* Swifter.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 26B30B6B1D289FA0004D4AB5 /* Swifter.framework */; };
|
||||
2659FC1D1DADC4F2003F3930 /* Swifter.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 26B30B6E1D289FB2004D4AB5 /* Swifter.framework */; };
|
||||
2659FC1F1DADC4F2003F3930 /* Starscream.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 2659FC1E1DADC4F2003F3930 /* Starscream.framework */; };
|
||||
2659FC201DADC4FC003F3930 /* Swifter.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 269B47CB1D3AE5670042D137 /* Swifter.framework */; };
|
||||
2659FC221DADC4FC003F3930 /* Starscream.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 2659FC211DADC4FC003F3930 /* Starscream.framework */; };
|
||||
26EAA8FB1E204DF6003F5423 /* SlackKit.h in Headers */ = {isa = PBXBuildFile; fileRef = 26EAA8FA1E204DE6003F5423 /* SlackKit.h */; settings = {ATTRIBUTES = (Public, ); }; };
|
||||
26EAA8FC1E204DF6003F5423 /* SlackKit.h in Headers */ = {isa = PBXBuildFile; fileRef = 26EAA8FA1E204DE6003F5423 /* SlackKit.h */; settings = {ATTRIBUTES = (Public, ); }; };
|
||||
26EAA8FD1E204DF7003F5423 /* SlackKit.h in Headers */ = {isa = PBXBuildFile; fileRef = 26EAA8FA1E204DE6003F5423 /* SlackKit.h */; settings = {ATTRIBUTES = (Public, ); }; };
|
||||
26EAA92E1E204E47003F5423 /* Action.swift in Sources */ = {isa = PBXBuildFile; fileRef = 26EAA8FF1E204E47003F5423 /* Action.swift */; };
|
||||
26EAA92F1E204E47003F5423 /* Action.swift in Sources */ = {isa = PBXBuildFile; fileRef = 26EAA8FF1E204E47003F5423 /* Action.swift */; };
|
||||
26EAA9301E204E47003F5423 /* Action.swift in Sources */ = {isa = PBXBuildFile; fileRef = 26EAA8FF1E204E47003F5423 /* Action.swift */; };
|
||||
26EAA9311E204E47003F5423 /* Attachment.swift in Sources */ = {isa = PBXBuildFile; fileRef = 26EAA9001E204E47003F5423 /* Attachment.swift */; };
|
||||
26EAA9321E204E47003F5423 /* Attachment.swift in Sources */ = {isa = PBXBuildFile; fileRef = 26EAA9001E204E47003F5423 /* Attachment.swift */; };
|
||||
26EAA9331E204E47003F5423 /* Attachment.swift in Sources */ = {isa = PBXBuildFile; fileRef = 26EAA9001E204E47003F5423 /* Attachment.swift */; };
|
||||
26EAA9341E204E47003F5423 /* AttachmentField.swift in Sources */ = {isa = PBXBuildFile; fileRef = 26EAA9011E204E47003F5423 /* AttachmentField.swift */; };
|
||||
26EAA9351E204E47003F5423 /* AttachmentField.swift in Sources */ = {isa = PBXBuildFile; fileRef = 26EAA9011E204E47003F5423 /* AttachmentField.swift */; };
|
||||
26EAA9361E204E47003F5423 /* AttachmentField.swift in Sources */ = {isa = PBXBuildFile; fileRef = 26EAA9011E204E47003F5423 /* AttachmentField.swift */; };
|
||||
26EAA9371E204E47003F5423 /* AuthorizeRequest.swift in Sources */ = {isa = PBXBuildFile; fileRef = 26EAA9031E204E47003F5423 /* AuthorizeRequest.swift */; };
|
||||
26EAA9381E204E47003F5423 /* AuthorizeRequest.swift in Sources */ = {isa = PBXBuildFile; fileRef = 26EAA9031E204E47003F5423 /* AuthorizeRequest.swift */; };
|
||||
26EAA9391E204E47003F5423 /* AuthorizeRequest.swift in Sources */ = {isa = PBXBuildFile; fileRef = 26EAA9031E204E47003F5423 /* AuthorizeRequest.swift */; };
|
||||
26EAA93A1E204E47003F5423 /* AuthorizeResponse.swift in Sources */ = {isa = PBXBuildFile; fileRef = 26EAA9041E204E47003F5423 /* AuthorizeResponse.swift */; };
|
||||
26EAA93B1E204E47003F5423 /* AuthorizeResponse.swift in Sources */ = {isa = PBXBuildFile; fileRef = 26EAA9041E204E47003F5423 /* AuthorizeResponse.swift */; };
|
||||
26EAA93C1E204E47003F5423 /* AuthorizeResponse.swift in Sources */ = {isa = PBXBuildFile; fileRef = 26EAA9041E204E47003F5423 /* AuthorizeResponse.swift */; };
|
||||
26EAA93D1E204E47003F5423 /* OAuthResponse.swift in Sources */ = {isa = PBXBuildFile; fileRef = 26EAA9051E204E47003F5423 /* OAuthResponse.swift */; };
|
||||
26EAA93E1E204E47003F5423 /* OAuthResponse.swift in Sources */ = {isa = PBXBuildFile; fileRef = 26EAA9051E204E47003F5423 /* OAuthResponse.swift */; };
|
||||
26EAA93F1E204E47003F5423 /* OAuthResponse.swift in Sources */ = {isa = PBXBuildFile; fileRef = 26EAA9051E204E47003F5423 /* OAuthResponse.swift */; };
|
||||
26EAA9401E204E47003F5423 /* Scope.swift in Sources */ = {isa = PBXBuildFile; fileRef = 26EAA9061E204E47003F5423 /* Scope.swift */; };
|
||||
26EAA9411E204E47003F5423 /* Scope.swift in Sources */ = {isa = PBXBuildFile; fileRef = 26EAA9061E204E47003F5423 /* Scope.swift */; };
|
||||
26EAA9421E204E47003F5423 /* Scope.swift in Sources */ = {isa = PBXBuildFile; fileRef = 26EAA9061E204E47003F5423 /* Scope.swift */; };
|
||||
26EAA9431E204E47003F5423 /* Bot.swift in Sources */ = {isa = PBXBuildFile; fileRef = 26EAA9071E204E47003F5423 /* Bot.swift */; };
|
||||
26EAA9441E204E47003F5423 /* Bot.swift in Sources */ = {isa = PBXBuildFile; fileRef = 26EAA9071E204E47003F5423 /* Bot.swift */; };
|
||||
26EAA9451E204E47003F5423 /* Bot.swift in Sources */ = {isa = PBXBuildFile; fileRef = 26EAA9071E204E47003F5423 /* Bot.swift */; };
|
||||
26EAA9461E204E47003F5423 /* Channel.swift in Sources */ = {isa = PBXBuildFile; fileRef = 26EAA9081E204E47003F5423 /* Channel.swift */; };
|
||||
26EAA9471E204E47003F5423 /* Channel.swift in Sources */ = {isa = PBXBuildFile; fileRef = 26EAA9081E204E47003F5423 /* Channel.swift */; };
|
||||
26EAA9481E204E47003F5423 /* Channel.swift in Sources */ = {isa = PBXBuildFile; fileRef = 26EAA9081E204E47003F5423 /* Channel.swift */; };
|
||||
26EAA9491E204E47003F5423 /* ClientOptions.swift in Sources */ = {isa = PBXBuildFile; fileRef = 26EAA9091E204E47003F5423 /* ClientOptions.swift */; };
|
||||
26EAA94A1E204E47003F5423 /* ClientOptions.swift in Sources */ = {isa = PBXBuildFile; fileRef = 26EAA9091E204E47003F5423 /* ClientOptions.swift */; };
|
||||
26EAA94B1E204E47003F5423 /* ClientOptions.swift in Sources */ = {isa = PBXBuildFile; fileRef = 26EAA9091E204E47003F5423 /* ClientOptions.swift */; };
|
||||
26EAA94C1E204E47003F5423 /* Comment.swift in Sources */ = {isa = PBXBuildFile; fileRef = 26EAA90A1E204E47003F5423 /* Comment.swift */; };
|
||||
26EAA94D1E204E47003F5423 /* Comment.swift in Sources */ = {isa = PBXBuildFile; fileRef = 26EAA90A1E204E47003F5423 /* Comment.swift */; };
|
||||
26EAA94E1E204E47003F5423 /* Comment.swift in Sources */ = {isa = PBXBuildFile; fileRef = 26EAA90A1E204E47003F5423 /* Comment.swift */; };
|
||||
26EAA94F1E204E47003F5423 /* CustomProfile.swift in Sources */ = {isa = PBXBuildFile; fileRef = 26EAA90B1E204E47003F5423 /* CustomProfile.swift */; };
|
||||
26EAA9501E204E47003F5423 /* CustomProfile.swift in Sources */ = {isa = PBXBuildFile; fileRef = 26EAA90B1E204E47003F5423 /* CustomProfile.swift */; };
|
||||
26EAA9511E204E47003F5423 /* CustomProfile.swift in Sources */ = {isa = PBXBuildFile; fileRef = 26EAA90B1E204E47003F5423 /* CustomProfile.swift */; };
|
||||
26EAA9521E204E47003F5423 /* CustomProfileField.swift in Sources */ = {isa = PBXBuildFile; fileRef = 26EAA90C1E204E47003F5423 /* CustomProfileField.swift */; };
|
||||
26EAA9531E204E47003F5423 /* CustomProfileField.swift in Sources */ = {isa = PBXBuildFile; fileRef = 26EAA90C1E204E47003F5423 /* CustomProfileField.swift */; };
|
||||
26EAA9541E204E47003F5423 /* CustomProfileField.swift in Sources */ = {isa = PBXBuildFile; fileRef = 26EAA90C1E204E47003F5423 /* CustomProfileField.swift */; };
|
||||
26EAA9551E204E47003F5423 /* DoNotDisturbStatus.swift in Sources */ = {isa = PBXBuildFile; fileRef = 26EAA90D1E204E47003F5423 /* DoNotDisturbStatus.swift */; };
|
||||
26EAA9561E204E47003F5423 /* DoNotDisturbStatus.swift in Sources */ = {isa = PBXBuildFile; fileRef = 26EAA90D1E204E47003F5423 /* DoNotDisturbStatus.swift */; };
|
||||
26EAA9571E204E47003F5423 /* DoNotDisturbStatus.swift in Sources */ = {isa = PBXBuildFile; fileRef = 26EAA90D1E204E47003F5423 /* DoNotDisturbStatus.swift */; };
|
||||
26EAA9581E204E47003F5423 /* Edited.swift in Sources */ = {isa = PBXBuildFile; fileRef = 26EAA90E1E204E47003F5423 /* Edited.swift */; };
|
||||
26EAA9591E204E47003F5423 /* Edited.swift in Sources */ = {isa = PBXBuildFile; fileRef = 26EAA90E1E204E47003F5423 /* Edited.swift */; };
|
||||
26EAA95A1E204E47003F5423 /* Edited.swift in Sources */ = {isa = PBXBuildFile; fileRef = 26EAA90E1E204E47003F5423 /* Edited.swift */; };
|
||||
26EAA95B1E204E47003F5423 /* Event.swift in Sources */ = {isa = PBXBuildFile; fileRef = 26EAA90F1E204E47003F5423 /* Event.swift */; };
|
||||
26EAA95C1E204E47003F5423 /* Event.swift in Sources */ = {isa = PBXBuildFile; fileRef = 26EAA90F1E204E47003F5423 /* Event.swift */; };
|
||||
26EAA95D1E204E47003F5423 /* Event.swift in Sources */ = {isa = PBXBuildFile; fileRef = 26EAA90F1E204E47003F5423 /* Event.swift */; };
|
||||
26EAA95E1E204E47003F5423 /* File.swift in Sources */ = {isa = PBXBuildFile; fileRef = 26EAA9101E204E47003F5423 /* File.swift */; };
|
||||
26EAA95F1E204E47003F5423 /* File.swift in Sources */ = {isa = PBXBuildFile; fileRef = 26EAA9101E204E47003F5423 /* File.swift */; };
|
||||
26EAA9601E204E47003F5423 /* File.swift in Sources */ = {isa = PBXBuildFile; fileRef = 26EAA9101E204E47003F5423 /* File.swift */; };
|
||||
26EAA9611E204E47003F5423 /* History.swift in Sources */ = {isa = PBXBuildFile; fileRef = 26EAA9111E204E47003F5423 /* History.swift */; };
|
||||
26EAA9621E204E47003F5423 /* History.swift in Sources */ = {isa = PBXBuildFile; fileRef = 26EAA9111E204E47003F5423 /* History.swift */; };
|
||||
26EAA9631E204E47003F5423 /* History.swift in Sources */ = {isa = PBXBuildFile; fileRef = 26EAA9111E204E47003F5423 /* History.swift */; };
|
||||
26EAA9641E204E47003F5423 /* Item.swift in Sources */ = {isa = PBXBuildFile; fileRef = 26EAA9121E204E47003F5423 /* Item.swift */; };
|
||||
26EAA9651E204E47003F5423 /* Item.swift in Sources */ = {isa = PBXBuildFile; fileRef = 26EAA9121E204E47003F5423 /* Item.swift */; };
|
||||
26EAA9661E204E47003F5423 /* Item.swift in Sources */ = {isa = PBXBuildFile; fileRef = 26EAA9121E204E47003F5423 /* Item.swift */; };
|
||||
26EAA9671E204E47003F5423 /* Message.swift in Sources */ = {isa = PBXBuildFile; fileRef = 26EAA9131E204E47003F5423 /* Message.swift */; };
|
||||
26EAA9681E204E47003F5423 /* Message.swift in Sources */ = {isa = PBXBuildFile; fileRef = 26EAA9131E204E47003F5423 /* Message.swift */; };
|
||||
26EAA9691E204E47003F5423 /* Message.swift in Sources */ = {isa = PBXBuildFile; fileRef = 26EAA9131E204E47003F5423 /* Message.swift */; };
|
||||
26EAA96A1E204E47003F5423 /* Reaction.swift in Sources */ = {isa = PBXBuildFile; fileRef = 26EAA9141E204E47003F5423 /* Reaction.swift */; };
|
||||
26EAA96B1E204E47003F5423 /* Reaction.swift in Sources */ = {isa = PBXBuildFile; fileRef = 26EAA9141E204E47003F5423 /* Reaction.swift */; };
|
||||
26EAA96C1E204E47003F5423 /* Reaction.swift in Sources */ = {isa = PBXBuildFile; fileRef = 26EAA9141E204E47003F5423 /* Reaction.swift */; };
|
||||
26EAA96D1E204E47003F5423 /* MessageActionRequest.swift in Sources */ = {isa = PBXBuildFile; fileRef = 26EAA9161E204E47003F5423 /* MessageActionRequest.swift */; };
|
||||
26EAA96E1E204E47003F5423 /* MessageActionRequest.swift in Sources */ = {isa = PBXBuildFile; fileRef = 26EAA9161E204E47003F5423 /* MessageActionRequest.swift */; };
|
||||
26EAA96F1E204E47003F5423 /* MessageActionRequest.swift in Sources */ = {isa = PBXBuildFile; fileRef = 26EAA9161E204E47003F5423 /* MessageActionRequest.swift */; };
|
||||
26EAA9701E204E47003F5423 /* Response.swift in Sources */ = {isa = PBXBuildFile; fileRef = 26EAA9171E204E47003F5423 /* Response.swift */; };
|
||||
26EAA9711E204E47003F5423 /* Response.swift in Sources */ = {isa = PBXBuildFile; fileRef = 26EAA9171E204E47003F5423 /* Response.swift */; };
|
||||
26EAA9721E204E47003F5423 /* Response.swift in Sources */ = {isa = PBXBuildFile; fileRef = 26EAA9171E204E47003F5423 /* Response.swift */; };
|
||||
26EAA9731E204E47003F5423 /* WebhookRequest.swift in Sources */ = {isa = PBXBuildFile; fileRef = 26EAA9181E204E47003F5423 /* WebhookRequest.swift */; };
|
||||
26EAA9741E204E47003F5423 /* WebhookRequest.swift in Sources */ = {isa = PBXBuildFile; fileRef = 26EAA9181E204E47003F5423 /* WebhookRequest.swift */; };
|
||||
26EAA9751E204E47003F5423 /* WebhookRequest.swift in Sources */ = {isa = PBXBuildFile; fileRef = 26EAA9181E204E47003F5423 /* WebhookRequest.swift */; };
|
||||
26EAA9761E204E47003F5423 /* SlackError.swift in Sources */ = {isa = PBXBuildFile; fileRef = 26EAA9191E204E47003F5423 /* SlackError.swift */; };
|
||||
26EAA9771E204E47003F5423 /* SlackError.swift in Sources */ = {isa = PBXBuildFile; fileRef = 26EAA9191E204E47003F5423 /* SlackError.swift */; };
|
||||
26EAA9781E204E47003F5423 /* SlackError.swift in Sources */ = {isa = PBXBuildFile; fileRef = 26EAA9191E204E47003F5423 /* SlackError.swift */; };
|
||||
26EAA9791E204E47003F5423 /* Team.swift in Sources */ = {isa = PBXBuildFile; fileRef = 26EAA91A1E204E47003F5423 /* Team.swift */; };
|
||||
26EAA97A1E204E47003F5423 /* Team.swift in Sources */ = {isa = PBXBuildFile; fileRef = 26EAA91A1E204E47003F5423 /* Team.swift */; };
|
||||
26EAA97B1E204E47003F5423 /* Team.swift in Sources */ = {isa = PBXBuildFile; fileRef = 26EAA91A1E204E47003F5423 /* Team.swift */; };
|
||||
26EAA97C1E204E47003F5423 /* TeamIcon.swift in Sources */ = {isa = PBXBuildFile; fileRef = 26EAA91B1E204E47003F5423 /* TeamIcon.swift */; };
|
||||
26EAA97D1E204E47003F5423 /* TeamIcon.swift in Sources */ = {isa = PBXBuildFile; fileRef = 26EAA91B1E204E47003F5423 /* TeamIcon.swift */; };
|
||||
26EAA97E1E204E47003F5423 /* TeamIcon.swift in Sources */ = {isa = PBXBuildFile; fileRef = 26EAA91B1E204E47003F5423 /* TeamIcon.swift */; };
|
||||
26EAA97F1E204E47003F5423 /* Topic.swift in Sources */ = {isa = PBXBuildFile; fileRef = 26EAA91C1E204E47003F5423 /* Topic.swift */; };
|
||||
26EAA9801E204E47003F5423 /* Topic.swift in Sources */ = {isa = PBXBuildFile; fileRef = 26EAA91C1E204E47003F5423 /* Topic.swift */; };
|
||||
26EAA9811E204E47003F5423 /* Topic.swift in Sources */ = {isa = PBXBuildFile; fileRef = 26EAA91C1E204E47003F5423 /* Topic.swift */; };
|
||||
26EAA9821E204E47003F5423 /* User.swift in Sources */ = {isa = PBXBuildFile; fileRef = 26EAA91D1E204E47003F5423 /* User.swift */; };
|
||||
26EAA9831E204E47003F5423 /* User.swift in Sources */ = {isa = PBXBuildFile; fileRef = 26EAA91D1E204E47003F5423 /* User.swift */; };
|
||||
26EAA9841E204E47003F5423 /* User.swift in Sources */ = {isa = PBXBuildFile; fileRef = 26EAA91D1E204E47003F5423 /* User.swift */; };
|
||||
26EAA9851E204E47003F5423 /* UserGroup.swift in Sources */ = {isa = PBXBuildFile; fileRef = 26EAA91E1E204E47003F5423 /* UserGroup.swift */; };
|
||||
26EAA9861E204E47003F5423 /* UserGroup.swift in Sources */ = {isa = PBXBuildFile; fileRef = 26EAA91E1E204E47003F5423 /* UserGroup.swift */; };
|
||||
26EAA9871E204E47003F5423 /* UserGroup.swift in Sources */ = {isa = PBXBuildFile; fileRef = 26EAA91E1E204E47003F5423 /* UserGroup.swift */; };
|
||||
26EAA9881E204E47003F5423 /* Client.swift in Sources */ = {isa = PBXBuildFile; fileRef = 26EAA91F1E204E47003F5423 /* Client.swift */; };
|
||||
26EAA9891E204E47003F5423 /* Client.swift in Sources */ = {isa = PBXBuildFile; fileRef = 26EAA91F1E204E47003F5423 /* Client.swift */; };
|
||||
26EAA98A1E204E47003F5423 /* Client.swift in Sources */ = {isa = PBXBuildFile; fileRef = 26EAA91F1E204E47003F5423 /* Client.swift */; };
|
||||
26EAA98B1E204E47003F5423 /* Client+EventDispatching.swift in Sources */ = {isa = PBXBuildFile; fileRef = 26EAA9201E204E47003F5423 /* Client+EventDispatching.swift */; };
|
||||
26EAA98C1E204E47003F5423 /* Client+EventDispatching.swift in Sources */ = {isa = PBXBuildFile; fileRef = 26EAA9201E204E47003F5423 /* Client+EventDispatching.swift */; };
|
||||
26EAA98D1E204E47003F5423 /* Client+EventDispatching.swift in Sources */ = {isa = PBXBuildFile; fileRef = 26EAA9201E204E47003F5423 /* Client+EventDispatching.swift */; };
|
||||
26EAA98E1E204E47003F5423 /* Client+EventHandling.swift in Sources */ = {isa = PBXBuildFile; fileRef = 26EAA9211E204E47003F5423 /* Client+EventHandling.swift */; };
|
||||
26EAA98F1E204E47003F5423 /* Client+EventHandling.swift in Sources */ = {isa = PBXBuildFile; fileRef = 26EAA9211E204E47003F5423 /* Client+EventHandling.swift */; };
|
||||
26EAA9901E204E47003F5423 /* Client+EventHandling.swift in Sources */ = {isa = PBXBuildFile; fileRef = 26EAA9211E204E47003F5423 /* Client+EventHandling.swift */; };
|
||||
26EAA9911E204E47003F5423 /* Client+Utilities.swift in Sources */ = {isa = PBXBuildFile; fileRef = 26EAA9221E204E47003F5423 /* Client+Utilities.swift */; };
|
||||
26EAA9921E204E47003F5423 /* Client+Utilities.swift in Sources */ = {isa = PBXBuildFile; fileRef = 26EAA9221E204E47003F5423 /* Client+Utilities.swift */; };
|
||||
26EAA9931E204E47003F5423 /* Client+Utilities.swift in Sources */ = {isa = PBXBuildFile; fileRef = 26EAA9221E204E47003F5423 /* Client+Utilities.swift */; };
|
||||
26EAA9941E204E47003F5423 /* EventDelegate.swift in Sources */ = {isa = PBXBuildFile; fileRef = 26EAA9231E204E47003F5423 /* EventDelegate.swift */; };
|
||||
26EAA9951E204E47003F5423 /* EventDelegate.swift in Sources */ = {isa = PBXBuildFile; fileRef = 26EAA9231E204E47003F5423 /* EventDelegate.swift */; };
|
||||
26EAA9961E204E47003F5423 /* EventDelegate.swift in Sources */ = {isa = PBXBuildFile; fileRef = 26EAA9231E204E47003F5423 /* EventDelegate.swift */; };
|
||||
26EAA9971E204E47003F5423 /* Extensions.swift in Sources */ = {isa = PBXBuildFile; fileRef = 26EAA9241E204E47003F5423 /* Extensions.swift */; };
|
||||
26EAA9981E204E47003F5423 /* Extensions.swift in Sources */ = {isa = PBXBuildFile; fileRef = 26EAA9241E204E47003F5423 /* Extensions.swift */; };
|
||||
26EAA9991E204E47003F5423 /* Extensions.swift in Sources */ = {isa = PBXBuildFile; fileRef = 26EAA9241E204E47003F5423 /* Extensions.swift */; };
|
||||
26EAA99A1E204E47003F5423 /* IncomingWebhook.swift in Sources */ = {isa = PBXBuildFile; fileRef = 26EAA9251E204E47003F5423 /* IncomingWebhook.swift */; };
|
||||
26EAA99B1E204E47003F5423 /* IncomingWebhook.swift in Sources */ = {isa = PBXBuildFile; fileRef = 26EAA9251E204E47003F5423 /* IncomingWebhook.swift */; };
|
||||
26EAA99C1E204E47003F5423 /* IncomingWebhook.swift in Sources */ = {isa = PBXBuildFile; fileRef = 26EAA9251E204E47003F5423 /* IncomingWebhook.swift */; };
|
||||
26EAA99D1E204E47003F5423 /* MessageActionResponder.swift in Sources */ = {isa = PBXBuildFile; fileRef = 26EAA9261E204E47003F5423 /* MessageActionResponder.swift */; };
|
||||
26EAA99E1E204E47003F5423 /* MessageActionResponder.swift in Sources */ = {isa = PBXBuildFile; fileRef = 26EAA9261E204E47003F5423 /* MessageActionResponder.swift */; };
|
||||
26EAA99F1E204E47003F5423 /* MessageActionResponder.swift in Sources */ = {isa = PBXBuildFile; fileRef = 26EAA9261E204E47003F5423 /* MessageActionResponder.swift */; };
|
||||
26EAA9A01E204E47003F5423 /* MessageActionServer.swift in Sources */ = {isa = PBXBuildFile; fileRef = 26EAA9271E204E47003F5423 /* MessageActionServer.swift */; };
|
||||
26EAA9A11E204E47003F5423 /* MessageActionServer.swift in Sources */ = {isa = PBXBuildFile; fileRef = 26EAA9271E204E47003F5423 /* MessageActionServer.swift */; };
|
||||
26EAA9A21E204E47003F5423 /* MessageActionServer.swift in Sources */ = {isa = PBXBuildFile; fileRef = 26EAA9271E204E47003F5423 /* MessageActionServer.swift */; };
|
||||
26EAA9A31E204E47003F5423 /* NetworkInterface.swift in Sources */ = {isa = PBXBuildFile; fileRef = 26EAA9281E204E47003F5423 /* NetworkInterface.swift */; };
|
||||
26EAA9A41E204E47003F5423 /* NetworkInterface.swift in Sources */ = {isa = PBXBuildFile; fileRef = 26EAA9281E204E47003F5423 /* NetworkInterface.swift */; };
|
||||
26EAA9A51E204E47003F5423 /* NetworkInterface.swift in Sources */ = {isa = PBXBuildFile; fileRef = 26EAA9281E204E47003F5423 /* NetworkInterface.swift */; };
|
||||
26EAA9A61E204E47003F5423 /* OAuthServer.swift in Sources */ = {isa = PBXBuildFile; fileRef = 26EAA9291E204E47003F5423 /* OAuthServer.swift */; };
|
||||
26EAA9A71E204E47003F5423 /* OAuthServer.swift in Sources */ = {isa = PBXBuildFile; fileRef = 26EAA9291E204E47003F5423 /* OAuthServer.swift */; };
|
||||
26EAA9A81E204E47003F5423 /* OAuthServer.swift in Sources */ = {isa = PBXBuildFile; fileRef = 26EAA9291E204E47003F5423 /* OAuthServer.swift */; };
|
||||
26EAA9A91E204E47003F5423 /* Server.swift in Sources */ = {isa = PBXBuildFile; fileRef = 26EAA92A1E204E47003F5423 /* Server.swift */; };
|
||||
26EAA9AA1E204E47003F5423 /* Server.swift in Sources */ = {isa = PBXBuildFile; fileRef = 26EAA92A1E204E47003F5423 /* Server.swift */; };
|
||||
26EAA9AB1E204E47003F5423 /* Server.swift in Sources */ = {isa = PBXBuildFile; fileRef = 26EAA92A1E204E47003F5423 /* Server.swift */; };
|
||||
26EAA9AC1E204E47003F5423 /* SlackKit.swift in Sources */ = {isa = PBXBuildFile; fileRef = 26EAA92B1E204E47003F5423 /* SlackKit.swift */; };
|
||||
26EAA9AD1E204E47003F5423 /* SlackKit.swift in Sources */ = {isa = PBXBuildFile; fileRef = 26EAA92B1E204E47003F5423 /* SlackKit.swift */; };
|
||||
26EAA9AE1E204E47003F5423 /* SlackKit.swift in Sources */ = {isa = PBXBuildFile; fileRef = 26EAA92B1E204E47003F5423 /* SlackKit.swift */; };
|
||||
26EAA9AF1E204E47003F5423 /* WebAPI.swift in Sources */ = {isa = PBXBuildFile; fileRef = 26EAA92C1E204E47003F5423 /* WebAPI.swift */; };
|
||||
26EAA9B01E204E47003F5423 /* WebAPI.swift in Sources */ = {isa = PBXBuildFile; fileRef = 26EAA92C1E204E47003F5423 /* WebAPI.swift */; };
|
||||
26EAA9B11E204E47003F5423 /* WebAPI.swift in Sources */ = {isa = PBXBuildFile; fileRef = 26EAA92C1E204E47003F5423 /* WebAPI.swift */; };
|
||||
26EAA9B21E204E47003F5423 /* WebhookServer.swift in Sources */ = {isa = PBXBuildFile; fileRef = 26EAA92D1E204E47003F5423 /* WebhookServer.swift */; };
|
||||
26EAA9B31E204E47003F5423 /* WebhookServer.swift in Sources */ = {isa = PBXBuildFile; fileRef = 26EAA92D1E204E47003F5423 /* WebhookServer.swift */; };
|
||||
26EAA9B41E204E47003F5423 /* WebhookServer.swift in Sources */ = {isa = PBXBuildFile; fileRef = 26EAA92D1E204E47003F5423 /* WebhookServer.swift */; };
|
||||
/* End PBXBuildFile section */
|
||||
|
||||
/* Begin PBXFileReference section */
|
||||
26072A341BB48B3A00CD650C /* SlackKit.framework */ = {isa = PBXFileReference; explicitFileType = wrapper.framework; includeInIndex = 0; path = SlackKit.framework; sourceTree = BUILT_PRODUCTS_DIR; };
|
||||
263993B21CE90EE0004A6E93 /* SlackKit.framework */ = {isa = PBXFileReference; explicitFileType = wrapper.framework; includeInIndex = 0; path = SlackKit.framework; sourceTree = BUILT_PRODUCTS_DIR; };
|
||||
263993D11CE90EED004A6E93 /* SlackKit.framework */ = {isa = PBXFileReference; explicitFileType = wrapper.framework; includeInIndex = 0; path = SlackKit.framework; sourceTree = BUILT_PRODUCTS_DIR; };
|
||||
2659FC1E1DADC4F2003F3930 /* Starscream.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = Starscream.framework; path = Carthage/Build/iOS/Starscream.framework; sourceTree = "<group>"; };
|
||||
2659FC211DADC4FC003F3930 /* Starscream.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = Starscream.framework; path = Carthage/Build/tvOS/Starscream.framework; sourceTree = "<group>"; };
|
||||
268E46151CE8F79D009F19CC /* Info.plist */ = {isa = PBXFileReference; lastKnownFileType = text.plist.xml; name = Info.plist; path = "Supporting Files/Info.plist"; sourceTree = "<group>"; };
|
||||
269B47CB1D3AE5670042D137 /* Swifter.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = Swifter.framework; path = Carthage/Build/tvOS/Swifter.framework; sourceTree = "<group>"; };
|
||||
26B30B6B1D289FA0004D4AB5 /* Swifter.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = Swifter.framework; path = Carthage/Build/Mac/Swifter.framework; sourceTree = "<group>"; };
|
||||
26B30B6E1D289FB2004D4AB5 /* Swifter.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = Swifter.framework; path = Carthage/Build/iOS/Swifter.framework; sourceTree = "<group>"; };
|
||||
26EAA8FA1E204DE6003F5423 /* SlackKit.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; name = SlackKit.h; path = "Supporting Files/SlackKit.h"; sourceTree = SOURCE_ROOT; };
|
||||
26EAA8FF1E204E47003F5423 /* Action.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = Action.swift; sourceTree = "<group>"; };
|
||||
26EAA9001E204E47003F5423 /* Attachment.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = Attachment.swift; sourceTree = "<group>"; };
|
||||
26EAA9011E204E47003F5423 /* AttachmentField.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = AttachmentField.swift; sourceTree = "<group>"; };
|
||||
26EAA9031E204E47003F5423 /* AuthorizeRequest.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = AuthorizeRequest.swift; sourceTree = "<group>"; };
|
||||
26EAA9041E204E47003F5423 /* AuthorizeResponse.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = AuthorizeResponse.swift; sourceTree = "<group>"; };
|
||||
26EAA9051E204E47003F5423 /* OAuthResponse.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = OAuthResponse.swift; sourceTree = "<group>"; };
|
||||
26EAA9061E204E47003F5423 /* Scope.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = Scope.swift; sourceTree = "<group>"; };
|
||||
26EAA9071E204E47003F5423 /* Bot.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = Bot.swift; sourceTree = "<group>"; };
|
||||
26EAA9081E204E47003F5423 /* Channel.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = Channel.swift; sourceTree = "<group>"; };
|
||||
26EAA9091E204E47003F5423 /* ClientOptions.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = ClientOptions.swift; sourceTree = "<group>"; };
|
||||
26EAA90A1E204E47003F5423 /* Comment.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = Comment.swift; sourceTree = "<group>"; };
|
||||
26EAA90B1E204E47003F5423 /* CustomProfile.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = CustomProfile.swift; sourceTree = "<group>"; };
|
||||
26EAA90C1E204E47003F5423 /* CustomProfileField.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = CustomProfileField.swift; sourceTree = "<group>"; };
|
||||
26EAA90D1E204E47003F5423 /* DoNotDisturbStatus.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = DoNotDisturbStatus.swift; sourceTree = "<group>"; };
|
||||
26EAA90E1E204E47003F5423 /* Edited.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = Edited.swift; sourceTree = "<group>"; };
|
||||
26EAA90F1E204E47003F5423 /* Event.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = Event.swift; sourceTree = "<group>"; };
|
||||
26EAA9101E204E47003F5423 /* File.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = File.swift; sourceTree = "<group>"; };
|
||||
26EAA9111E204E47003F5423 /* History.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = History.swift; sourceTree = "<group>"; };
|
||||
26EAA9121E204E47003F5423 /* Item.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = Item.swift; sourceTree = "<group>"; };
|
||||
26EAA9131E204E47003F5423 /* Message.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = Message.swift; sourceTree = "<group>"; };
|
||||
26EAA9141E204E47003F5423 /* Reaction.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = Reaction.swift; sourceTree = "<group>"; };
|
||||
26EAA9161E204E47003F5423 /* MessageActionRequest.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = MessageActionRequest.swift; sourceTree = "<group>"; };
|
||||
26EAA9171E204E47003F5423 /* Response.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = Response.swift; sourceTree = "<group>"; };
|
||||
26EAA9181E204E47003F5423 /* WebhookRequest.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = WebhookRequest.swift; sourceTree = "<group>"; };
|
||||
26EAA9191E204E47003F5423 /* SlackError.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = SlackError.swift; sourceTree = "<group>"; };
|
||||
26EAA91A1E204E47003F5423 /* Team.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = Team.swift; sourceTree = "<group>"; };
|
||||
26EAA91B1E204E47003F5423 /* TeamIcon.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = TeamIcon.swift; sourceTree = "<group>"; };
|
||||
26EAA91C1E204E47003F5423 /* Topic.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = Topic.swift; sourceTree = "<group>"; };
|
||||
26EAA91D1E204E47003F5423 /* User.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = User.swift; sourceTree = "<group>"; };
|
||||
26EAA91E1E204E47003F5423 /* UserGroup.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = UserGroup.swift; sourceTree = "<group>"; };
|
||||
26EAA91F1E204E47003F5423 /* Client.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; name = Client.swift; path = Sources/SlackKit/Client.swift; sourceTree = SOURCE_ROOT; };
|
||||
26EAA9201E204E47003F5423 /* Client+EventDispatching.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; name = "Client+EventDispatching.swift"; path = "Sources/SlackKit/Client+EventDispatching.swift"; sourceTree = SOURCE_ROOT; };
|
||||
26EAA9211E204E47003F5423 /* Client+EventHandling.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; name = "Client+EventHandling.swift"; path = "Sources/SlackKit/Client+EventHandling.swift"; sourceTree = SOURCE_ROOT; };
|
||||
26EAA9221E204E47003F5423 /* Client+Utilities.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; name = "Client+Utilities.swift"; path = "Sources/SlackKit/Client+Utilities.swift"; sourceTree = SOURCE_ROOT; };
|
||||
26EAA9231E204E47003F5423 /* EventDelegate.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; name = EventDelegate.swift; path = Sources/SlackKit/EventDelegate.swift; sourceTree = SOURCE_ROOT; };
|
||||
26EAA9241E204E47003F5423 /* Extensions.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; name = Extensions.swift; path = Sources/SlackKit/Extensions.swift; sourceTree = SOURCE_ROOT; };
|
||||
26EAA9251E204E47003F5423 /* IncomingWebhook.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; name = IncomingWebhook.swift; path = Sources/SlackKit/IncomingWebhook.swift; sourceTree = SOURCE_ROOT; };
|
||||
26EAA9261E204E47003F5423 /* MessageActionResponder.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; name = MessageActionResponder.swift; path = Sources/SlackKit/MessageActionResponder.swift; sourceTree = SOURCE_ROOT; };
|
||||
26EAA9271E204E47003F5423 /* MessageActionServer.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; name = MessageActionServer.swift; path = Sources/SlackKit/MessageActionServer.swift; sourceTree = SOURCE_ROOT; };
|
||||
26EAA9281E204E47003F5423 /* NetworkInterface.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; name = NetworkInterface.swift; path = Sources/SlackKit/NetworkInterface.swift; sourceTree = SOURCE_ROOT; };
|
||||
26EAA9291E204E47003F5423 /* OAuthServer.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; name = OAuthServer.swift; path = Sources/SlackKit/OAuthServer.swift; sourceTree = SOURCE_ROOT; };
|
||||
26EAA92A1E204E47003F5423 /* Server.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; name = Server.swift; path = Sources/SlackKit/Server.swift; sourceTree = SOURCE_ROOT; };
|
||||
26EAA92B1E204E47003F5423 /* SlackKit.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; name = SlackKit.swift; path = Sources/SlackKit/SlackKit.swift; sourceTree = SOURCE_ROOT; };
|
||||
26EAA92C1E204E47003F5423 /* WebAPI.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; name = WebAPI.swift; path = Sources/SlackKit/WebAPI.swift; sourceTree = SOURCE_ROOT; };
|
||||
26EAA92D1E204E47003F5423 /* WebhookServer.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; name = WebhookServer.swift; path = Sources/SlackKit/WebhookServer.swift; sourceTree = SOURCE_ROOT; };
|
||||
4307A07F1CC6D0910011D5DE /* Starscream.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = Starscream.framework; path = Carthage/Build/Mac/Starscream.framework; sourceTree = "<group>"; };
|
||||
/* End PBXFileReference section */
|
||||
|
||||
/* Begin PBXFrameworksBuildPhase section */
|
||||
26072A301BB48B3A00CD650C /* Frameworks */ = {
|
||||
isa = PBXFrameworksBuildPhase;
|
||||
buildActionMask = 2147483647;
|
||||
files = (
|
||||
2659FC1B1DADC4E0003F3930 /* Starscream.framework in Frameworks */,
|
||||
2659FC1C1DADC4E0003F3930 /* Swifter.framework in Frameworks */,
|
||||
);
|
||||
runOnlyForDeploymentPostprocessing = 0;
|
||||
};
|
||||
263993AA1CE90EE0004A6E93 /* Frameworks */ = {
|
||||
isa = PBXFrameworksBuildPhase;
|
||||
buildActionMask = 2147483647;
|
||||
files = (
|
||||
2659FC1F1DADC4F2003F3930 /* Starscream.framework in Frameworks */,
|
||||
2659FC1D1DADC4F2003F3930 /* Swifter.framework in Frameworks */,
|
||||
);
|
||||
runOnlyForDeploymentPostprocessing = 0;
|
||||
};
|
||||
263993C91CE90EED004A6E93 /* Frameworks */ = {
|
||||
isa = PBXFrameworksBuildPhase;
|
||||
buildActionMask = 2147483647;
|
||||
files = (
|
||||
2659FC221DADC4FC003F3930 /* Starscream.framework in Frameworks */,
|
||||
2659FC201DADC4FC003F3930 /* Swifter.framework in Frameworks */,
|
||||
);
|
||||
runOnlyForDeploymentPostprocessing = 0;
|
||||
};
|
||||
/* End PBXFrameworksBuildPhase section */
|
||||
|
||||
/* Begin PBXGroup section */
|
||||
26072A2A1BB48B3A00CD650C = {
|
||||
isa = PBXGroup;
|
||||
children = (
|
||||
2661A6811BBF60E60026F67B /* SlackKit */,
|
||||
26072A351BB48B3A00CD650C /* Products */,
|
||||
CA70A3A1A9A1A259960DFBCF /* Frameworks */,
|
||||
);
|
||||
sourceTree = "<group>";
|
||||
};
|
||||
26072A351BB48B3A00CD650C /* Products */ = {
|
||||
isa = PBXGroup;
|
||||
children = (
|
||||
26072A341BB48B3A00CD650C /* SlackKit.framework */,
|
||||
263993B21CE90EE0004A6E93 /* SlackKit.framework */,
|
||||
263993D11CE90EED004A6E93 /* SlackKit.framework */,
|
||||
);
|
||||
name = Products;
|
||||
sourceTree = "<group>";
|
||||
};
|
||||
2661A6811BBF60E60026F67B /* SlackKit */ = {
|
||||
isa = PBXGroup;
|
||||
children = (
|
||||
26EAA8FE1E204E47003F5423 /* Model */,
|
||||
26EAA91F1E204E47003F5423 /* Client.swift */,
|
||||
26EAA9201E204E47003F5423 /* Client+EventDispatching.swift */,
|
||||
26EAA9211E204E47003F5423 /* Client+EventHandling.swift */,
|
||||
26EAA9221E204E47003F5423 /* Client+Utilities.swift */,
|
||||
26EAA9231E204E47003F5423 /* EventDelegate.swift */,
|
||||
26EAA9241E204E47003F5423 /* Extensions.swift */,
|
||||
26EAA9251E204E47003F5423 /* IncomingWebhook.swift */,
|
||||
26EAA9261E204E47003F5423 /* MessageActionResponder.swift */,
|
||||
26EAA9271E204E47003F5423 /* MessageActionServer.swift */,
|
||||
26EAA9281E204E47003F5423 /* NetworkInterface.swift */,
|
||||
26EAA9291E204E47003F5423 /* OAuthServer.swift */,
|
||||
26EAA92A1E204E47003F5423 /* Server.swift */,
|
||||
26EAA92B1E204E47003F5423 /* SlackKit.swift */,
|
||||
26EAA92C1E204E47003F5423 /* WebAPI.swift */,
|
||||
26EAA92D1E204E47003F5423 /* WebhookServer.swift */,
|
||||
268E46161CE8F7A2009F19CC /* Supporting Files */,
|
||||
);
|
||||
path = SlackKit;
|
||||
sourceTree = "<group>";
|
||||
};
|
||||
268E46161CE8F7A2009F19CC /* Supporting Files */ = {
|
||||
isa = PBXGroup;
|
||||
children = (
|
||||
26EAA8FA1E204DE6003F5423 /* SlackKit.h */,
|
||||
268E46151CE8F79D009F19CC /* Info.plist */,
|
||||
);
|
||||
name = "Supporting Files";
|
||||
sourceTree = "<group>";
|
||||
};
|
||||
26EAA8FE1E204E47003F5423 /* Model */ = {
|
||||
isa = PBXGroup;
|
||||
children = (
|
||||
26EAA9021E204E47003F5423 /* Auth */,
|
||||
26EAA9151E204E47003F5423 /* Server */,
|
||||
26EAA8FF1E204E47003F5423 /* Action.swift */,
|
||||
26EAA9001E204E47003F5423 /* Attachment.swift */,
|
||||
26EAA9011E204E47003F5423 /* AttachmentField.swift */,
|
||||
26EAA9071E204E47003F5423 /* Bot.swift */,
|
||||
26EAA9081E204E47003F5423 /* Channel.swift */,
|
||||
26EAA9091E204E47003F5423 /* ClientOptions.swift */,
|
||||
26EAA90A1E204E47003F5423 /* Comment.swift */,
|
||||
26EAA90B1E204E47003F5423 /* CustomProfile.swift */,
|
||||
26EAA90C1E204E47003F5423 /* CustomProfileField.swift */,
|
||||
26EAA90D1E204E47003F5423 /* DoNotDisturbStatus.swift */,
|
||||
26EAA90E1E204E47003F5423 /* Edited.swift */,
|
||||
26EAA90F1E204E47003F5423 /* Event.swift */,
|
||||
26EAA9101E204E47003F5423 /* File.swift */,
|
||||
26EAA9111E204E47003F5423 /* History.swift */,
|
||||
26EAA9121E204E47003F5423 /* Item.swift */,
|
||||
26EAA9131E204E47003F5423 /* Message.swift */,
|
||||
26EAA9141E204E47003F5423 /* Reaction.swift */,
|
||||
26EAA9191E204E47003F5423 /* SlackError.swift */,
|
||||
26EAA91A1E204E47003F5423 /* Team.swift */,
|
||||
26EAA91B1E204E47003F5423 /* TeamIcon.swift */,
|
||||
26EAA91C1E204E47003F5423 /* Topic.swift */,
|
||||
26EAA91D1E204E47003F5423 /* User.swift */,
|
||||
26EAA91E1E204E47003F5423 /* UserGroup.swift */,
|
||||
);
|
||||
name = Model;
|
||||
path = Sources/SlackKit/Model;
|
||||
sourceTree = SOURCE_ROOT;
|
||||
};
|
||||
26EAA9021E204E47003F5423 /* Auth */ = {
|
||||
isa = PBXGroup;
|
||||
children = (
|
||||
26EAA9031E204E47003F5423 /* AuthorizeRequest.swift */,
|
||||
26EAA9041E204E47003F5423 /* AuthorizeResponse.swift */,
|
||||
26EAA9051E204E47003F5423 /* OAuthResponse.swift */,
|
||||
26EAA9061E204E47003F5423 /* Scope.swift */,
|
||||
);
|
||||
path = Auth;
|
||||
sourceTree = "<group>";
|
||||
};
|
||||
26EAA9151E204E47003F5423 /* Server */ = {
|
||||
isa = PBXGroup;
|
||||
children = (
|
||||
26EAA9161E204E47003F5423 /* MessageActionRequest.swift */,
|
||||
26EAA9171E204E47003F5423 /* Response.swift */,
|
||||
26EAA9181E204E47003F5423 /* WebhookRequest.swift */,
|
||||
);
|
||||
path = Server;
|
||||
sourceTree = "<group>";
|
||||
};
|
||||
CA70A3A1A9A1A259960DFBCF /* Frameworks */ = {
|
||||
isa = PBXGroup;
|
||||
children = (
|
||||
2659FC211DADC4FC003F3930 /* Starscream.framework */,
|
||||
2659FC1E1DADC4F2003F3930 /* Starscream.framework */,
|
||||
269B47CB1D3AE5670042D137 /* Swifter.framework */,
|
||||
26B30B6E1D289FB2004D4AB5 /* Swifter.framework */,
|
||||
26B30B6B1D289FA0004D4AB5 /* Swifter.framework */,
|
||||
4307A07F1CC6D0910011D5DE /* Starscream.framework */,
|
||||
);
|
||||
name = Frameworks;
|
||||
sourceTree = "<group>";
|
||||
};
|
||||
/* End PBXGroup section */
|
||||
|
||||
/* Begin PBXHeadersBuildPhase section */
|
||||
26072A311BB48B3A00CD650C /* Headers */ = {
|
||||
isa = PBXHeadersBuildPhase;
|
||||
buildActionMask = 2147483647;
|
||||
files = (
|
||||
26EAA8FD1E204DF7003F5423 /* SlackKit.h in Headers */,
|
||||
);
|
||||
runOnlyForDeploymentPostprocessing = 0;
|
||||
};
|
||||
263993AC1CE90EE0004A6E93 /* Headers */ = {
|
||||
isa = PBXHeadersBuildPhase;
|
||||
buildActionMask = 2147483647;
|
||||
files = (
|
||||
26EAA8FC1E204DF6003F5423 /* SlackKit.h in Headers */,
|
||||
);
|
||||
runOnlyForDeploymentPostprocessing = 0;
|
||||
};
|
||||
263993CB1CE90EED004A6E93 /* Headers */ = {
|
||||
isa = PBXHeadersBuildPhase;
|
||||
buildActionMask = 2147483647;
|
||||
files = (
|
||||
26EAA8FB1E204DF6003F5423 /* SlackKit.h in Headers */,
|
||||
);
|
||||
runOnlyForDeploymentPostprocessing = 0;
|
||||
};
|
||||
/* End PBXHeadersBuildPhase section */
|
||||
|
||||
/* Begin PBXNativeTarget section */
|
||||
26072A331BB48B3A00CD650C /* SlackKit OS X */ = {
|
||||
isa = PBXNativeTarget;
|
||||
buildConfigurationList = 26072A3C1BB48B3B00CD650C /* Build configuration list for PBXNativeTarget "SlackKit OS X" */;
|
||||
buildPhases = (
|
||||
26072A2F1BB48B3A00CD650C /* Sources */,
|
||||
26072A301BB48B3A00CD650C /* Frameworks */,
|
||||
26072A311BB48B3A00CD650C /* Headers */,
|
||||
26072A321BB48B3A00CD650C /* Resources */,
|
||||
);
|
||||
buildRules = (
|
||||
);
|
||||
dependencies = (
|
||||
);
|
||||
name = "SlackKit OS X";
|
||||
productName = SlackRTMKit;
|
||||
productReference = 26072A341BB48B3A00CD650C /* SlackKit.framework */;
|
||||
productType = "com.apple.product-type.framework";
|
||||
};
|
||||
263993951CE90EE0004A6E93 /* SlackKit iOS */ = {
|
||||
isa = PBXNativeTarget;
|
||||
buildConfigurationList = 263993AF1CE90EE0004A6E93 /* Build configuration list for PBXNativeTarget "SlackKit iOS" */;
|
||||
buildPhases = (
|
||||
263993961CE90EE0004A6E93 /* Sources */,
|
||||
263993AA1CE90EE0004A6E93 /* Frameworks */,
|
||||
263993AC1CE90EE0004A6E93 /* Headers */,
|
||||
263993AE1CE90EE0004A6E93 /* Resources */,
|
||||
);
|
||||
buildRules = (
|
||||
);
|
||||
dependencies = (
|
||||
);
|
||||
name = "SlackKit iOS";
|
||||
productName = SlackRTMKit;
|
||||
productReference = 263993B21CE90EE0004A6E93 /* SlackKit.framework */;
|
||||
productType = "com.apple.product-type.framework";
|
||||
};
|
||||
263993B41CE90EED004A6E93 /* SlackKit tvOS */ = {
|
||||
isa = PBXNativeTarget;
|
||||
buildConfigurationList = 263993CE1CE90EED004A6E93 /* Build configuration list for PBXNativeTarget "SlackKit tvOS" */;
|
||||
buildPhases = (
|
||||
263993B51CE90EED004A6E93 /* Sources */,
|
||||
263993C91CE90EED004A6E93 /* Frameworks */,
|
||||
263993CB1CE90EED004A6E93 /* Headers */,
|
||||
263993CD1CE90EED004A6E93 /* Resources */,
|
||||
);
|
||||
buildRules = (
|
||||
);
|
||||
dependencies = (
|
||||
);
|
||||
name = "SlackKit tvOS";
|
||||
productName = SlackRTMKit;
|
||||
productReference = 263993D11CE90EED004A6E93 /* SlackKit.framework */;
|
||||
productType = "com.apple.product-type.framework";
|
||||
};
|
||||
/* End PBXNativeTarget section */
|
||||
|
||||
/* Begin PBXProject section */
|
||||
26072A2B1BB48B3A00CD650C /* Project object */ = {
|
||||
isa = PBXProject;
|
||||
attributes = {
|
||||
LastSwiftUpdateCheck = 0730;
|
||||
LastUpgradeCheck = 0800;
|
||||
ORGANIZATIONNAME = "Launch Software LLC";
|
||||
TargetAttributes = {
|
||||
26072A331BB48B3A00CD650C = {
|
||||
CreatedOnToolsVersion = 7.0;
|
||||
LastSwiftMigration = 0820;
|
||||
};
|
||||
263993951CE90EE0004A6E93 = {
|
||||
LastSwiftMigration = 0820;
|
||||
};
|
||||
263993B41CE90EED004A6E93 = {
|
||||
LastSwiftMigration = 0820;
|
||||
};
|
||||
};
|
||||
};
|
||||
buildConfigurationList = 26072A2E1BB48B3A00CD650C /* Build configuration list for PBXProject "SlackKit" */;
|
||||
compatibilityVersion = "Xcode 3.2";
|
||||
developmentRegion = English;
|
||||
hasScannedForEncodings = 0;
|
||||
knownRegions = (
|
||||
en,
|
||||
Base,
|
||||
);
|
||||
mainGroup = 26072A2A1BB48B3A00CD650C;
|
||||
productRefGroup = 26072A351BB48B3A00CD650C /* Products */;
|
||||
projectDirPath = "";
|
||||
projectRoot = "";
|
||||
targets = (
|
||||
26072A331BB48B3A00CD650C /* SlackKit OS X */,
|
||||
263993951CE90EE0004A6E93 /* SlackKit iOS */,
|
||||
263993B41CE90EED004A6E93 /* SlackKit tvOS */,
|
||||
);
|
||||
};
|
||||
/* End PBXProject section */
|
||||
|
||||
/* Begin PBXResourcesBuildPhase section */
|
||||
26072A321BB48B3A00CD650C /* Resources */ = {
|
||||
isa = PBXResourcesBuildPhase;
|
||||
buildActionMask = 2147483647;
|
||||
files = (
|
||||
);
|
||||
runOnlyForDeploymentPostprocessing = 0;
|
||||
};
|
||||
263993AE1CE90EE0004A6E93 /* Resources */ = {
|
||||
isa = PBXResourcesBuildPhase;
|
||||
buildActionMask = 2147483647;
|
||||
files = (
|
||||
);
|
||||
runOnlyForDeploymentPostprocessing = 0;
|
||||
};
|
||||
263993CD1CE90EED004A6E93 /* Resources */ = {
|
||||
isa = PBXResourcesBuildPhase;
|
||||
buildActionMask = 2147483647;
|
||||
files = (
|
||||
);
|
||||
runOnlyForDeploymentPostprocessing = 0;
|
||||
};
|
||||
/* End PBXResourcesBuildPhase section */
|
||||
|
||||
/* Begin PBXSourcesBuildPhase section */
|
||||
26072A2F1BB48B3A00CD650C /* Sources */ = {
|
||||
isa = PBXSourcesBuildPhase;
|
||||
buildActionMask = 2147483647;
|
||||
files = (
|
||||
26EAA99A1E204E47003F5423 /* IncomingWebhook.swift in Sources */,
|
||||
26EAA98E1E204E47003F5423 /* Client+EventHandling.swift in Sources */,
|
||||
26EAA9911E204E47003F5423 /* Client+Utilities.swift in Sources */,
|
||||
26EAA9AC1E204E47003F5423 /* SlackKit.swift in Sources */,
|
||||
26EAA9611E204E47003F5423 /* History.swift in Sources */,
|
||||
26EAA9341E204E47003F5423 /* AttachmentField.swift in Sources */,
|
||||
26EAA9791E204E47003F5423 /* Team.swift in Sources */,
|
||||
26EAA9431E204E47003F5423 /* Bot.swift in Sources */,
|
||||
26EAA9401E204E47003F5423 /* Scope.swift in Sources */,
|
||||
26EAA9B21E204E47003F5423 /* WebhookServer.swift in Sources */,
|
||||
26EAA9371E204E47003F5423 /* AuthorizeRequest.swift in Sources */,
|
||||
26EAA93D1E204E47003F5423 /* OAuthResponse.swift in Sources */,
|
||||
26EAA9A61E204E47003F5423 /* OAuthServer.swift in Sources */,
|
||||
26EAA93A1E204E47003F5423 /* AuthorizeResponse.swift in Sources */,
|
||||
26EAA9821E204E47003F5423 /* User.swift in Sources */,
|
||||
26EAA9761E204E47003F5423 /* SlackError.swift in Sources */,
|
||||
26EAA9731E204E47003F5423 /* WebhookRequest.swift in Sources */,
|
||||
26EAA9581E204E47003F5423 /* Edited.swift in Sources */,
|
||||
26EAA94F1E204E47003F5423 /* CustomProfile.swift in Sources */,
|
||||
26EAA96D1E204E47003F5423 /* MessageActionRequest.swift in Sources */,
|
||||
26EAA9AF1E204E47003F5423 /* WebAPI.swift in Sources */,
|
||||
26EAA97F1E204E47003F5423 /* Topic.swift in Sources */,
|
||||
26EAA9941E204E47003F5423 /* EventDelegate.swift in Sources */,
|
||||
26EAA95B1E204E47003F5423 /* Event.swift in Sources */,
|
||||
26EAA9971E204E47003F5423 /* Extensions.swift in Sources */,
|
||||
26EAA9851E204E47003F5423 /* UserGroup.swift in Sources */,
|
||||
26EAA9521E204E47003F5423 /* CustomProfileField.swift in Sources */,
|
||||
26EAA98B1E204E47003F5423 /* Client+EventDispatching.swift in Sources */,
|
||||
26EAA99D1E204E47003F5423 /* MessageActionResponder.swift in Sources */,
|
||||
26EAA9551E204E47003F5423 /* DoNotDisturbStatus.swift in Sources */,
|
||||
26EAA95E1E204E47003F5423 /* File.swift in Sources */,
|
||||
26EAA9A91E204E47003F5423 /* Server.swift in Sources */,
|
||||
26EAA9311E204E47003F5423 /* Attachment.swift in Sources */,
|
||||
26EAA9A31E204E47003F5423 /* NetworkInterface.swift in Sources */,
|
||||
26EAA9641E204E47003F5423 /* Item.swift in Sources */,
|
||||
26EAA9491E204E47003F5423 /* ClientOptions.swift in Sources */,
|
||||
26EAA96A1E204E47003F5423 /* Reaction.swift in Sources */,
|
||||
26EAA9461E204E47003F5423 /* Channel.swift in Sources */,
|
||||
26EAA9671E204E47003F5423 /* Message.swift in Sources */,
|
||||
26EAA97C1E204E47003F5423 /* TeamIcon.swift in Sources */,
|
||||
26EAA9881E204E47003F5423 /* Client.swift in Sources */,
|
||||
26EAA9A01E204E47003F5423 /* MessageActionServer.swift in Sources */,
|
||||
26EAA9701E204E47003F5423 /* Response.swift in Sources */,
|
||||
26EAA94C1E204E47003F5423 /* Comment.swift in Sources */,
|
||||
26EAA92E1E204E47003F5423 /* Action.swift in Sources */,
|
||||
);
|
||||
runOnlyForDeploymentPostprocessing = 0;
|
||||
};
|
||||
263993961CE90EE0004A6E93 /* Sources */ = {
|
||||
isa = PBXSourcesBuildPhase;
|
||||
buildActionMask = 2147483647;
|
||||
files = (
|
||||
26EAA99B1E204E47003F5423 /* IncomingWebhook.swift in Sources */,
|
||||
26EAA98F1E204E47003F5423 /* Client+EventHandling.swift in Sources */,
|
||||
26EAA9921E204E47003F5423 /* Client+Utilities.swift in Sources */,
|
||||
26EAA9AD1E204E47003F5423 /* SlackKit.swift in Sources */,
|
||||
26EAA9621E204E47003F5423 /* History.swift in Sources */,
|
||||
26EAA9351E204E47003F5423 /* AttachmentField.swift in Sources */,
|
||||
26EAA97A1E204E47003F5423 /* Team.swift in Sources */,
|
||||
26EAA9441E204E47003F5423 /* Bot.swift in Sources */,
|
||||
26EAA9411E204E47003F5423 /* Scope.swift in Sources */,
|
||||
26EAA9B31E204E47003F5423 /* WebhookServer.swift in Sources */,
|
||||
26EAA9381E204E47003F5423 /* AuthorizeRequest.swift in Sources */,
|
||||
26EAA93E1E204E47003F5423 /* OAuthResponse.swift in Sources */,
|
||||
26EAA9A71E204E47003F5423 /* OAuthServer.swift in Sources */,
|
||||
26EAA93B1E204E47003F5423 /* AuthorizeResponse.swift in Sources */,
|
||||
26EAA9831E204E47003F5423 /* User.swift in Sources */,
|
||||
26EAA9771E204E47003F5423 /* SlackError.swift in Sources */,
|
||||
26EAA9741E204E47003F5423 /* WebhookRequest.swift in Sources */,
|
||||
26EAA9591E204E47003F5423 /* Edited.swift in Sources */,
|
||||
26EAA9501E204E47003F5423 /* CustomProfile.swift in Sources */,
|
||||
26EAA96E1E204E47003F5423 /* MessageActionRequest.swift in Sources */,
|
||||
26EAA9B01E204E47003F5423 /* WebAPI.swift in Sources */,
|
||||
26EAA9801E204E47003F5423 /* Topic.swift in Sources */,
|
||||
26EAA9951E204E47003F5423 /* EventDelegate.swift in Sources */,
|
||||
26EAA95C1E204E47003F5423 /* Event.swift in Sources */,
|
||||
26EAA9981E204E47003F5423 /* Extensions.swift in Sources */,
|
||||
26EAA9861E204E47003F5423 /* UserGroup.swift in Sources */,
|
||||
26EAA9531E204E47003F5423 /* CustomProfileField.swift in Sources */,
|
||||
26EAA98C1E204E47003F5423 /* Client+EventDispatching.swift in Sources */,
|
||||
26EAA99E1E204E47003F5423 /* MessageActionResponder.swift in Sources */,
|
||||
26EAA9561E204E47003F5423 /* DoNotDisturbStatus.swift in Sources */,
|
||||
26EAA95F1E204E47003F5423 /* File.swift in Sources */,
|
||||
26EAA9AA1E204E47003F5423 /* Server.swift in Sources */,
|
||||
26EAA9321E204E47003F5423 /* Attachment.swift in Sources */,
|
||||
26EAA9A41E204E47003F5423 /* NetworkInterface.swift in Sources */,
|
||||
26EAA9651E204E47003F5423 /* Item.swift in Sources */,
|
||||
26EAA94A1E204E47003F5423 /* ClientOptions.swift in Sources */,
|
||||
26EAA96B1E204E47003F5423 /* Reaction.swift in Sources */,
|
||||
26EAA9471E204E47003F5423 /* Channel.swift in Sources */,
|
||||
26EAA9681E204E47003F5423 /* Message.swift in Sources */,
|
||||
26EAA97D1E204E47003F5423 /* TeamIcon.swift in Sources */,
|
||||
26EAA9891E204E47003F5423 /* Client.swift in Sources */,
|
||||
26EAA9A11E204E47003F5423 /* MessageActionServer.swift in Sources */,
|
||||
26EAA9711E204E47003F5423 /* Response.swift in Sources */,
|
||||
26EAA94D1E204E47003F5423 /* Comment.swift in Sources */,
|
||||
26EAA92F1E204E47003F5423 /* Action.swift in Sources */,
|
||||
);
|
||||
runOnlyForDeploymentPostprocessing = 0;
|
||||
};
|
||||
263993B51CE90EED004A6E93 /* Sources */ = {
|
||||
isa = PBXSourcesBuildPhase;
|
||||
buildActionMask = 2147483647;
|
||||
files = (
|
||||
26EAA99C1E204E47003F5423 /* IncomingWebhook.swift in Sources */,
|
||||
26EAA9901E204E47003F5423 /* Client+EventHandling.swift in Sources */,
|
||||
26EAA9931E204E47003F5423 /* Client+Utilities.swift in Sources */,
|
||||
26EAA9AE1E204E47003F5423 /* SlackKit.swift in Sources */,
|
||||
26EAA9631E204E47003F5423 /* History.swift in Sources */,
|
||||
26EAA9361E204E47003F5423 /* AttachmentField.swift in Sources */,
|
||||
26EAA97B1E204E47003F5423 /* Team.swift in Sources */,
|
||||
26EAA9451E204E47003F5423 /* Bot.swift in Sources */,
|
||||
26EAA9421E204E47003F5423 /* Scope.swift in Sources */,
|
||||
26EAA9B41E204E47003F5423 /* WebhookServer.swift in Sources */,
|
||||
26EAA9391E204E47003F5423 /* AuthorizeRequest.swift in Sources */,
|
||||
26EAA93F1E204E47003F5423 /* OAuthResponse.swift in Sources */,
|
||||
26EAA9A81E204E47003F5423 /* OAuthServer.swift in Sources */,
|
||||
26EAA93C1E204E47003F5423 /* AuthorizeResponse.swift in Sources */,
|
||||
26EAA9841E204E47003F5423 /* User.swift in Sources */,
|
||||
26EAA9781E204E47003F5423 /* SlackError.swift in Sources */,
|
||||
26EAA9751E204E47003F5423 /* WebhookRequest.swift in Sources */,
|
||||
26EAA95A1E204E47003F5423 /* Edited.swift in Sources */,
|
||||
26EAA9511E204E47003F5423 /* CustomProfile.swift in Sources */,
|
||||
26EAA96F1E204E47003F5423 /* MessageActionRequest.swift in Sources */,
|
||||
26EAA9B11E204E47003F5423 /* WebAPI.swift in Sources */,
|
||||
26EAA9811E204E47003F5423 /* Topic.swift in Sources */,
|
||||
26EAA9961E204E47003F5423 /* EventDelegate.swift in Sources */,
|
||||
26EAA95D1E204E47003F5423 /* Event.swift in Sources */,
|
||||
26EAA9991E204E47003F5423 /* Extensions.swift in Sources */,
|
||||
26EAA9871E204E47003F5423 /* UserGroup.swift in Sources */,
|
||||
26EAA9541E204E47003F5423 /* CustomProfileField.swift in Sources */,
|
||||
26EAA98D1E204E47003F5423 /* Client+EventDispatching.swift in Sources */,
|
||||
26EAA99F1E204E47003F5423 /* MessageActionResponder.swift in Sources */,
|
||||
26EAA9571E204E47003F5423 /* DoNotDisturbStatus.swift in Sources */,
|
||||
26EAA9601E204E47003F5423 /* File.swift in Sources */,
|
||||
26EAA9AB1E204E47003F5423 /* Server.swift in Sources */,
|
||||
26EAA9331E204E47003F5423 /* Attachment.swift in Sources */,
|
||||
26EAA9A51E204E47003F5423 /* NetworkInterface.swift in Sources */,
|
||||
26EAA9661E204E47003F5423 /* Item.swift in Sources */,
|
||||
26EAA94B1E204E47003F5423 /* ClientOptions.swift in Sources */,
|
||||
26EAA96C1E204E47003F5423 /* Reaction.swift in Sources */,
|
||||
26EAA9481E204E47003F5423 /* Channel.swift in Sources */,
|
||||
26EAA9691E204E47003F5423 /* Message.swift in Sources */,
|
||||
26EAA97E1E204E47003F5423 /* TeamIcon.swift in Sources */,
|
||||
26EAA98A1E204E47003F5423 /* Client.swift in Sources */,
|
||||
26EAA9A21E204E47003F5423 /* MessageActionServer.swift in Sources */,
|
||||
26EAA9721E204E47003F5423 /* Response.swift in Sources */,
|
||||
26EAA94E1E204E47003F5423 /* Comment.swift in Sources */,
|
||||
26EAA9301E204E47003F5423 /* Action.swift in Sources */,
|
||||
);
|
||||
runOnlyForDeploymentPostprocessing = 0;
|
||||
};
|
||||
/* End PBXSourcesBuildPhase section */
|
||||
|
||||
/* Begin XCBuildConfiguration section */
|
||||
26072A3A1BB48B3B00CD650C /* Debug */ = {
|
||||
isa = XCBuildConfiguration;
|
||||
buildSettings = {
|
||||
ALWAYS_SEARCH_USER_PATHS = NO;
|
||||
CLANG_CXX_LANGUAGE_STANDARD = "gnu++0x";
|
||||
CLANG_CXX_LIBRARY = "libc++";
|
||||
CLANG_ENABLE_MODULES = YES;
|
||||
CLANG_ENABLE_OBJC_ARC = YES;
|
||||
CLANG_WARN_BOOL_CONVERSION = YES;
|
||||
CLANG_WARN_CONSTANT_CONVERSION = YES;
|
||||
CLANG_WARN_DIRECT_OBJC_ISA_USAGE = YES_ERROR;
|
||||
CLANG_WARN_EMPTY_BODY = YES;
|
||||
CLANG_WARN_ENUM_CONVERSION = YES;
|
||||
CLANG_WARN_INFINITE_RECURSION = YES;
|
||||
CLANG_WARN_INT_CONVERSION = YES;
|
||||
CLANG_WARN_OBJC_ROOT_CLASS = YES_ERROR;
|
||||
CLANG_WARN_SUSPICIOUS_MOVE = YES;
|
||||
CLANG_WARN_UNREACHABLE_CODE = YES;
|
||||
CLANG_WARN__DUPLICATE_METHOD_MATCH = YES;
|
||||
COPY_PHASE_STRIP = NO;
|
||||
CURRENT_PROJECT_VERSION = 1;
|
||||
DEBUG_INFORMATION_FORMAT = dwarf;
|
||||
ENABLE_STRICT_OBJC_MSGSEND = YES;
|
||||
ENABLE_TESTABILITY = YES;
|
||||
GCC_C_LANGUAGE_STANDARD = gnu99;
|
||||
GCC_DYNAMIC_NO_PIC = NO;
|
||||
GCC_NO_COMMON_BLOCKS = YES;
|
||||
GCC_OPTIMIZATION_LEVEL = 0;
|
||||
GCC_PREPROCESSOR_DEFINITIONS = (
|
||||
"DEBUG=1",
|
||||
"$(inherited)",
|
||||
);
|
||||
GCC_WARN_64_TO_32_BIT_CONVERSION = YES;
|
||||
GCC_WARN_ABOUT_RETURN_TYPE = YES_ERROR;
|
||||
GCC_WARN_UNDECLARED_SELECTOR = YES;
|
||||
GCC_WARN_UNINITIALIZED_AUTOS = YES_AGGRESSIVE;
|
||||
GCC_WARN_UNUSED_FUNCTION = YES;
|
||||
GCC_WARN_UNUSED_VARIABLE = YES;
|
||||
IPHONEOS_DEPLOYMENT_TARGET = 8.0;
|
||||
MACOSX_DEPLOYMENT_TARGET = 10.11;
|
||||
MTL_ENABLE_DEBUG_INFO = YES;
|
||||
ONLY_ACTIVE_ARCH = YES;
|
||||
SDKROOT = macosx;
|
||||
SWIFT_OPTIMIZATION_LEVEL = "-Onone";
|
||||
VERSIONING_SYSTEM = "apple-generic";
|
||||
VERSION_INFO_PREFIX = "";
|
||||
};
|
||||
name = Debug;
|
||||
};
|
||||
26072A3B1BB48B3B00CD650C /* Release */ = {
|
||||
isa = XCBuildConfiguration;
|
||||
buildSettings = {
|
||||
ALWAYS_SEARCH_USER_PATHS = NO;
|
||||
CLANG_CXX_LANGUAGE_STANDARD = "gnu++0x";
|
||||
CLANG_CXX_LIBRARY = "libc++";
|
||||
CLANG_ENABLE_MODULES = YES;
|
||||
CLANG_ENABLE_OBJC_ARC = YES;
|
||||
CLANG_WARN_BOOL_CONVERSION = YES;
|
||||
CLANG_WARN_CONSTANT_CONVERSION = YES;
|
||||
CLANG_WARN_DIRECT_OBJC_ISA_USAGE = YES_ERROR;
|
||||
CLANG_WARN_EMPTY_BODY = YES;
|
||||
CLANG_WARN_ENUM_CONVERSION = YES;
|
||||
CLANG_WARN_INFINITE_RECURSION = YES;
|
||||
CLANG_WARN_INT_CONVERSION = YES;
|
||||
CLANG_WARN_OBJC_ROOT_CLASS = YES_ERROR;
|
||||
CLANG_WARN_SUSPICIOUS_MOVE = YES;
|
||||
CLANG_WARN_UNREACHABLE_CODE = YES;
|
||||
CLANG_WARN__DUPLICATE_METHOD_MATCH = YES;
|
||||
COPY_PHASE_STRIP = NO;
|
||||
CURRENT_PROJECT_VERSION = 1;
|
||||
DEBUG_INFORMATION_FORMAT = "dwarf-with-dsym";
|
||||
ENABLE_NS_ASSERTIONS = NO;
|
||||
ENABLE_STRICT_OBJC_MSGSEND = YES;
|
||||
GCC_C_LANGUAGE_STANDARD = gnu99;
|
||||
GCC_NO_COMMON_BLOCKS = YES;
|
||||
GCC_WARN_64_TO_32_BIT_CONVERSION = YES;
|
||||
GCC_WARN_ABOUT_RETURN_TYPE = YES_ERROR;
|
||||
GCC_WARN_UNDECLARED_SELECTOR = YES;
|
||||
GCC_WARN_UNINITIALIZED_AUTOS = YES_AGGRESSIVE;
|
||||
GCC_WARN_UNUSED_FUNCTION = YES;
|
||||
GCC_WARN_UNUSED_VARIABLE = YES;
|
||||
IPHONEOS_DEPLOYMENT_TARGET = 8.0;
|
||||
MACOSX_DEPLOYMENT_TARGET = 10.11;
|
||||
MTL_ENABLE_DEBUG_INFO = NO;
|
||||
SDKROOT = macosx;
|
||||
VERSIONING_SYSTEM = "apple-generic";
|
||||
VERSION_INFO_PREFIX = "";
|
||||
};
|
||||
name = Release;
|
||||
};
|
||||
26072A3D1BB48B3B00CD650C /* Debug */ = {
|
||||
isa = XCBuildConfiguration;
|
||||
buildSettings = {
|
||||
CLANG_ENABLE_MODULES = YES;
|
||||
CODE_SIGN_IDENTITY = "";
|
||||
COMBINE_HIDPI_IMAGES = YES;
|
||||
DEFINES_MODULE = YES;
|
||||
DYLIB_COMPATIBILITY_VERSION = 1;
|
||||
DYLIB_CURRENT_VERSION = 1;
|
||||
DYLIB_INSTALL_NAME_BASE = "@rpath";
|
||||
FRAMEWORK_SEARCH_PATHS = (
|
||||
"$(inherited)",
|
||||
"$(PROJECT_DIR)/Carthage/Build/Mac",
|
||||
);
|
||||
FRAMEWORK_VERSION = A;
|
||||
INFOPLIST_FILE = "$(SRCROOT)/Supporting Files/Info.plist";
|
||||
INSTALL_PATH = "$(LOCAL_LIBRARY_DIR)/Frameworks";
|
||||
LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/../Frameworks @loader_path/Frameworks";
|
||||
MACOSX_DEPLOYMENT_TARGET = 10.10;
|
||||
PRODUCT_BUNDLE_IDENTIFIER = com.launchsoft.SlackKit;
|
||||
PRODUCT_NAME = SlackKit;
|
||||
SKIP_INSTALL = YES;
|
||||
SWIFT_OPTIMIZATION_LEVEL = "-Onone";
|
||||
SWIFT_VERSION = 3.0;
|
||||
};
|
||||
name = Debug;
|
||||
};
|
||||
26072A3E1BB48B3B00CD650C /* Release */ = {
|
||||
isa = XCBuildConfiguration;
|
||||
buildSettings = {
|
||||
CLANG_ENABLE_MODULES = YES;
|
||||
CODE_SIGN_IDENTITY = "";
|
||||
COMBINE_HIDPI_IMAGES = YES;
|
||||
DEFINES_MODULE = YES;
|
||||
DYLIB_COMPATIBILITY_VERSION = 1;
|
||||
DYLIB_CURRENT_VERSION = 1;
|
||||
DYLIB_INSTALL_NAME_BASE = "@rpath";
|
||||
FRAMEWORK_SEARCH_PATHS = (
|
||||
"$(inherited)",
|
||||
"$(PROJECT_DIR)/Carthage/Build/Mac",
|
||||
);
|
||||
FRAMEWORK_VERSION = A;
|
||||
INFOPLIST_FILE = "$(SRCROOT)/Supporting Files/Info.plist";
|
||||
INSTALL_PATH = "$(LOCAL_LIBRARY_DIR)/Frameworks";
|
||||
LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/../Frameworks @loader_path/Frameworks";
|
||||
MACOSX_DEPLOYMENT_TARGET = 10.10;
|
||||
PRODUCT_BUNDLE_IDENTIFIER = com.launchsoft.SlackKit;
|
||||
PRODUCT_NAME = SlackKit;
|
||||
SKIP_INSTALL = YES;
|
||||
SWIFT_OPTIMIZATION_LEVEL = "-Owholemodule";
|
||||
SWIFT_VERSION = 3.0;
|
||||
};
|
||||
name = Release;
|
||||
};
|
||||
263993B01CE90EE0004A6E93 /* Debug */ = {
|
||||
isa = XCBuildConfiguration;
|
||||
buildSettings = {
|
||||
CLANG_ENABLE_MODULES = YES;
|
||||
CODE_SIGN_IDENTITY = "iPhone Developer";
|
||||
"CODE_SIGN_IDENTITY[sdk=iphoneos*]" = "";
|
||||
COMBINE_HIDPI_IMAGES = YES;
|
||||
DEFINES_MODULE = YES;
|
||||
DYLIB_COMPATIBILITY_VERSION = 1;
|
||||
DYLIB_CURRENT_VERSION = 1;
|
||||
DYLIB_INSTALL_NAME_BASE = "@rpath";
|
||||
FRAMEWORK_SEARCH_PATHS = (
|
||||
"$(inherited)",
|
||||
"$(PROJECT_DIR)/Carthage/Build/iOS",
|
||||
);
|
||||
FRAMEWORK_VERSION = A;
|
||||
INFOPLIST_FILE = "$(SRCROOT)/Supporting Files/Info.plist";
|
||||
INSTALL_PATH = "$(LOCAL_LIBRARY_DIR)/Frameworks";
|
||||
IPHONEOS_DEPLOYMENT_TARGET = 8.0;
|
||||
LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/../Frameworks @loader_path/Frameworks";
|
||||
MACOSX_DEPLOYMENT_TARGET = 10.10;
|
||||
PRODUCT_BUNDLE_IDENTIFIER = com.launchsoft.SlackKit;
|
||||
PRODUCT_NAME = SlackKit;
|
||||
SDKROOT = iphoneos;
|
||||
SKIP_INSTALL = YES;
|
||||
SUPPORTED_PLATFORMS = "iphonesimulator iphoneos";
|
||||
SWIFT_OPTIMIZATION_LEVEL = "-Onone";
|
||||
SWIFT_VERSION = 3.0;
|
||||
};
|
||||
name = Debug;
|
||||
};
|
||||
263993B11CE90EE0004A6E93 /* Release */ = {
|
||||
isa = XCBuildConfiguration;
|
||||
buildSettings = {
|
||||
CLANG_ENABLE_MODULES = YES;
|
||||
CODE_SIGN_IDENTITY = "iPhone Developer";
|
||||
"CODE_SIGN_IDENTITY[sdk=iphoneos*]" = "";
|
||||
COMBINE_HIDPI_IMAGES = YES;
|
||||
DEFINES_MODULE = YES;
|
||||
DYLIB_COMPATIBILITY_VERSION = 1;
|
||||
DYLIB_CURRENT_VERSION = 1;
|
||||
DYLIB_INSTALL_NAME_BASE = "@rpath";
|
||||
FRAMEWORK_SEARCH_PATHS = (
|
||||
"$(inherited)",
|
||||
"$(PROJECT_DIR)/Carthage/Build/iOS",
|
||||
);
|
||||
FRAMEWORK_VERSION = A;
|
||||
INFOPLIST_FILE = "$(SRCROOT)/Supporting Files/Info.plist";
|
||||
INSTALL_PATH = "$(LOCAL_LIBRARY_DIR)/Frameworks";
|
||||
IPHONEOS_DEPLOYMENT_TARGET = 8.0;
|
||||
LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/../Frameworks @loader_path/Frameworks";
|
||||
MACOSX_DEPLOYMENT_TARGET = 10.10;
|
||||
PRODUCT_BUNDLE_IDENTIFIER = com.launchsoft.SlackKit;
|
||||
PRODUCT_NAME = SlackKit;
|
||||
SDKROOT = iphoneos;
|
||||
SKIP_INSTALL = YES;
|
||||
SUPPORTED_PLATFORMS = "iphonesimulator iphoneos";
|
||||
SWIFT_OPTIMIZATION_LEVEL = "-Owholemodule";
|
||||
SWIFT_VERSION = 3.0;
|
||||
};
|
||||
name = Release;
|
||||
};
|
||||
263993CF1CE90EED004A6E93 /* Debug */ = {
|
||||
isa = XCBuildConfiguration;
|
||||
buildSettings = {
|
||||
CLANG_ENABLE_MODULES = YES;
|
||||
"CODE_SIGN_IDENTITY[sdk=appletvos*]" = "";
|
||||
COMBINE_HIDPI_IMAGES = YES;
|
||||
DEFINES_MODULE = YES;
|
||||
DYLIB_COMPATIBILITY_VERSION = 1;
|
||||
DYLIB_CURRENT_VERSION = 1;
|
||||
DYLIB_INSTALL_NAME_BASE = "@rpath";
|
||||
FRAMEWORK_SEARCH_PATHS = (
|
||||
"$(inherited)",
|
||||
"$(PROJECT_DIR)/Carthage/Build/tvOS",
|
||||
);
|
||||
FRAMEWORK_VERSION = A;
|
||||
INFOPLIST_FILE = "$(SRCROOT)/Supporting Files/Info.plist";
|
||||
INSTALL_PATH = "$(LOCAL_LIBRARY_DIR)/Frameworks";
|
||||
LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/../Frameworks @loader_path/Frameworks";
|
||||
MACOSX_DEPLOYMENT_TARGET = 10.10;
|
||||
PRODUCT_BUNDLE_IDENTIFIER = com.launchsoft.SlackKit;
|
||||
PRODUCT_NAME = SlackKit;
|
||||
SDKROOT = appletvos;
|
||||
SKIP_INSTALL = YES;
|
||||
SUPPORTED_PLATFORMS = "appletvsimulator appletvos";
|
||||
SWIFT_OPTIMIZATION_LEVEL = "-Onone";
|
||||
SWIFT_VERSION = 3.0;
|
||||
TVOS_DEPLOYMENT_TARGET = 9.0;
|
||||
};
|
||||
name = Debug;
|
||||
};
|
||||
263993D01CE90EED004A6E93 /* Release */ = {
|
||||
isa = XCBuildConfiguration;
|
||||
buildSettings = {
|
||||
CLANG_ENABLE_MODULES = YES;
|
||||
"CODE_SIGN_IDENTITY[sdk=appletvos*]" = "";
|
||||
COMBINE_HIDPI_IMAGES = YES;
|
||||
DEFINES_MODULE = YES;
|
||||
DYLIB_COMPATIBILITY_VERSION = 1;
|
||||
DYLIB_CURRENT_VERSION = 1;
|
||||
DYLIB_INSTALL_NAME_BASE = "@rpath";
|
||||
FRAMEWORK_SEARCH_PATHS = (
|
||||
"$(inherited)",
|
||||
"$(PROJECT_DIR)/Carthage/Build/tvOS",
|
||||
);
|
||||
FRAMEWORK_VERSION = A;
|
||||
INFOPLIST_FILE = "$(SRCROOT)/Supporting Files/Info.plist";
|
||||
INSTALL_PATH = "$(LOCAL_LIBRARY_DIR)/Frameworks";
|
||||
LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/../Frameworks @loader_path/Frameworks";
|
||||
MACOSX_DEPLOYMENT_TARGET = 10.10;
|
||||
PRODUCT_BUNDLE_IDENTIFIER = com.launchsoft.SlackKit;
|
||||
PRODUCT_NAME = SlackKit;
|
||||
SDKROOT = appletvos;
|
||||
SKIP_INSTALL = YES;
|
||||
SUPPORTED_PLATFORMS = "appletvsimulator appletvos";
|
||||
SWIFT_OPTIMIZATION_LEVEL = "-Owholemodule";
|
||||
SWIFT_VERSION = 3.0;
|
||||
TVOS_DEPLOYMENT_TARGET = 9.0;
|
||||
};
|
||||
name = Release;
|
||||
};
|
||||
/* End XCBuildConfiguration section */
|
||||
|
||||
/* Begin XCConfigurationList section */
|
||||
26072A2E1BB48B3A00CD650C /* Build configuration list for PBXProject "SlackKit" */ = {
|
||||
isa = XCConfigurationList;
|
||||
buildConfigurations = (
|
||||
26072A3A1BB48B3B00CD650C /* Debug */,
|
||||
26072A3B1BB48B3B00CD650C /* Release */,
|
||||
);
|
||||
defaultConfigurationIsVisible = 0;
|
||||
defaultConfigurationName = Release;
|
||||
};
|
||||
26072A3C1BB48B3B00CD650C /* Build configuration list for PBXNativeTarget "SlackKit OS X" */ = {
|
||||
isa = XCConfigurationList;
|
||||
buildConfigurations = (
|
||||
26072A3D1BB48B3B00CD650C /* Debug */,
|
||||
26072A3E1BB48B3B00CD650C /* Release */,
|
||||
);
|
||||
defaultConfigurationIsVisible = 0;
|
||||
defaultConfigurationName = Release;
|
||||
};
|
||||
263993AF1CE90EE0004A6E93 /* Build configuration list for PBXNativeTarget "SlackKit iOS" */ = {
|
||||
isa = XCConfigurationList;
|
||||
buildConfigurations = (
|
||||
263993B01CE90EE0004A6E93 /* Debug */,
|
||||
263993B11CE90EE0004A6E93 /* Release */,
|
||||
);
|
||||
defaultConfigurationIsVisible = 0;
|
||||
defaultConfigurationName = Release;
|
||||
};
|
||||
263993CE1CE90EED004A6E93 /* Build configuration list for PBXNativeTarget "SlackKit tvOS" */ = {
|
||||
isa = XCConfigurationList;
|
||||
buildConfigurations = (
|
||||
263993CF1CE90EED004A6E93 /* Debug */,
|
||||
263993D01CE90EED004A6E93 /* Release */,
|
||||
);
|
||||
defaultConfigurationIsVisible = 0;
|
||||
defaultConfigurationName = Release;
|
||||
};
|
||||
/* End XCConfigurationList section */
|
||||
};
|
||||
rootObject = 26072A2B1BB48B3A00CD650C /* Project object */;
|
||||
}
|
||||
@@ -0,0 +1,7 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<Workspace
|
||||
version = "1.0">
|
||||
<FileRef
|
||||
location = "self:SlackKit.xcodeproj">
|
||||
</FileRef>
|
||||
</Workspace>
|
||||
@@ -0,0 +1,80 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<Scheme
|
||||
LastUpgradeVersion = "0800"
|
||||
version = "1.3">
|
||||
<BuildAction
|
||||
parallelizeBuildables = "YES"
|
||||
buildImplicitDependencies = "YES">
|
||||
<BuildActionEntries>
|
||||
<BuildActionEntry
|
||||
buildForTesting = "YES"
|
||||
buildForRunning = "YES"
|
||||
buildForProfiling = "YES"
|
||||
buildForArchiving = "YES"
|
||||
buildForAnalyzing = "YES">
|
||||
<BuildableReference
|
||||
BuildableIdentifier = "primary"
|
||||
BlueprintIdentifier = "26072A331BB48B3A00CD650C"
|
||||
BuildableName = "SlackKit.framework"
|
||||
BlueprintName = "SlackKit OS X"
|
||||
ReferencedContainer = "container:SlackKit.xcodeproj">
|
||||
</BuildableReference>
|
||||
</BuildActionEntry>
|
||||
</BuildActionEntries>
|
||||
</BuildAction>
|
||||
<TestAction
|
||||
buildConfiguration = "Debug"
|
||||
selectedDebuggerIdentifier = "Xcode.DebuggerFoundation.Debugger.LLDB"
|
||||
selectedLauncherIdentifier = "Xcode.DebuggerFoundation.Launcher.LLDB"
|
||||
shouldUseLaunchSchemeArgsEnv = "YES">
|
||||
<Testables>
|
||||
</Testables>
|
||||
<AdditionalOptions>
|
||||
</AdditionalOptions>
|
||||
</TestAction>
|
||||
<LaunchAction
|
||||
buildConfiguration = "Debug"
|
||||
selectedDebuggerIdentifier = "Xcode.DebuggerFoundation.Debugger.LLDB"
|
||||
selectedLauncherIdentifier = "Xcode.DebuggerFoundation.Launcher.LLDB"
|
||||
launchStyle = "0"
|
||||
useCustomWorkingDirectory = "NO"
|
||||
ignoresPersistentStateOnLaunch = "NO"
|
||||
debugDocumentVersioning = "YES"
|
||||
debugServiceExtension = "internal"
|
||||
allowLocationSimulation = "YES">
|
||||
<MacroExpansion>
|
||||
<BuildableReference
|
||||
BuildableIdentifier = "primary"
|
||||
BlueprintIdentifier = "26072A331BB48B3A00CD650C"
|
||||
BuildableName = "SlackKit.framework"
|
||||
BlueprintName = "SlackKit OS X"
|
||||
ReferencedContainer = "container:SlackKit.xcodeproj">
|
||||
</BuildableReference>
|
||||
</MacroExpansion>
|
||||
<AdditionalOptions>
|
||||
</AdditionalOptions>
|
||||
</LaunchAction>
|
||||
<ProfileAction
|
||||
buildConfiguration = "Release"
|
||||
shouldUseLaunchSchemeArgsEnv = "YES"
|
||||
savedToolIdentifier = ""
|
||||
useCustomWorkingDirectory = "NO"
|
||||
debugDocumentVersioning = "YES">
|
||||
<MacroExpansion>
|
||||
<BuildableReference
|
||||
BuildableIdentifier = "primary"
|
||||
BlueprintIdentifier = "26072A331BB48B3A00CD650C"
|
||||
BuildableName = "SlackKit.framework"
|
||||
BlueprintName = "SlackKit OS X"
|
||||
ReferencedContainer = "container:SlackKit.xcodeproj">
|
||||
</BuildableReference>
|
||||
</MacroExpansion>
|
||||
</ProfileAction>
|
||||
<AnalyzeAction
|
||||
buildConfiguration = "Debug">
|
||||
</AnalyzeAction>
|
||||
<ArchiveAction
|
||||
buildConfiguration = "Release"
|
||||
revealArchiveInOrganizer = "YES">
|
||||
</ArchiveAction>
|
||||
</Scheme>
|
||||
@@ -0,0 +1,80 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<Scheme
|
||||
LastUpgradeVersion = "0800"
|
||||
version = "1.3">
|
||||
<BuildAction
|
||||
parallelizeBuildables = "YES"
|
||||
buildImplicitDependencies = "YES">
|
||||
<BuildActionEntries>
|
||||
<BuildActionEntry
|
||||
buildForTesting = "YES"
|
||||
buildForRunning = "YES"
|
||||
buildForProfiling = "YES"
|
||||
buildForArchiving = "YES"
|
||||
buildForAnalyzing = "YES">
|
||||
<BuildableReference
|
||||
BuildableIdentifier = "primary"
|
||||
BlueprintIdentifier = "263993951CE90EE0004A6E93"
|
||||
BuildableName = "SlackKit.framework"
|
||||
BlueprintName = "SlackKit iOS"
|
||||
ReferencedContainer = "container:SlackKit.xcodeproj">
|
||||
</BuildableReference>
|
||||
</BuildActionEntry>
|
||||
</BuildActionEntries>
|
||||
</BuildAction>
|
||||
<TestAction
|
||||
buildConfiguration = "Debug"
|
||||
selectedDebuggerIdentifier = "Xcode.DebuggerFoundation.Debugger.LLDB"
|
||||
selectedLauncherIdentifier = "Xcode.DebuggerFoundation.Launcher.LLDB"
|
||||
shouldUseLaunchSchemeArgsEnv = "YES">
|
||||
<Testables>
|
||||
</Testables>
|
||||
<AdditionalOptions>
|
||||
</AdditionalOptions>
|
||||
</TestAction>
|
||||
<LaunchAction
|
||||
buildConfiguration = "Debug"
|
||||
selectedDebuggerIdentifier = "Xcode.DebuggerFoundation.Debugger.LLDB"
|
||||
selectedLauncherIdentifier = "Xcode.DebuggerFoundation.Launcher.LLDB"
|
||||
launchStyle = "0"
|
||||
useCustomWorkingDirectory = "NO"
|
||||
ignoresPersistentStateOnLaunch = "NO"
|
||||
debugDocumentVersioning = "YES"
|
||||
debugServiceExtension = "internal"
|
||||
allowLocationSimulation = "YES">
|
||||
<MacroExpansion>
|
||||
<BuildableReference
|
||||
BuildableIdentifier = "primary"
|
||||
BlueprintIdentifier = "263993951CE90EE0004A6E93"
|
||||
BuildableName = "SlackKit.framework"
|
||||
BlueprintName = "SlackKit iOS"
|
||||
ReferencedContainer = "container:SlackKit.xcodeproj">
|
||||
</BuildableReference>
|
||||
</MacroExpansion>
|
||||
<AdditionalOptions>
|
||||
</AdditionalOptions>
|
||||
</LaunchAction>
|
||||
<ProfileAction
|
||||
buildConfiguration = "Release"
|
||||
shouldUseLaunchSchemeArgsEnv = "YES"
|
||||
savedToolIdentifier = ""
|
||||
useCustomWorkingDirectory = "NO"
|
||||
debugDocumentVersioning = "YES">
|
||||
<MacroExpansion>
|
||||
<BuildableReference
|
||||
BuildableIdentifier = "primary"
|
||||
BlueprintIdentifier = "263993951CE90EE0004A6E93"
|
||||
BuildableName = "SlackKit.framework"
|
||||
BlueprintName = "SlackKit iOS"
|
||||
ReferencedContainer = "container:SlackKit.xcodeproj">
|
||||
</BuildableReference>
|
||||
</MacroExpansion>
|
||||
</ProfileAction>
|
||||
<AnalyzeAction
|
||||
buildConfiguration = "Debug">
|
||||
</AnalyzeAction>
|
||||
<ArchiveAction
|
||||
buildConfiguration = "Release"
|
||||
revealArchiveInOrganizer = "YES">
|
||||
</ArchiveAction>
|
||||
</Scheme>
|
||||
@@ -0,0 +1,80 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<Scheme
|
||||
LastUpgradeVersion = "0800"
|
||||
version = "1.3">
|
||||
<BuildAction
|
||||
parallelizeBuildables = "YES"
|
||||
buildImplicitDependencies = "YES">
|
||||
<BuildActionEntries>
|
||||
<BuildActionEntry
|
||||
buildForTesting = "YES"
|
||||
buildForRunning = "YES"
|
||||
buildForProfiling = "YES"
|
||||
buildForArchiving = "YES"
|
||||
buildForAnalyzing = "YES">
|
||||
<BuildableReference
|
||||
BuildableIdentifier = "primary"
|
||||
BlueprintIdentifier = "263993B41CE90EED004A6E93"
|
||||
BuildableName = "SlackKit.framework"
|
||||
BlueprintName = "SlackKit tvOS"
|
||||
ReferencedContainer = "container:SlackKit.xcodeproj">
|
||||
</BuildableReference>
|
||||
</BuildActionEntry>
|
||||
</BuildActionEntries>
|
||||
</BuildAction>
|
||||
<TestAction
|
||||
buildConfiguration = "Debug"
|
||||
selectedDebuggerIdentifier = "Xcode.DebuggerFoundation.Debugger.LLDB"
|
||||
selectedLauncherIdentifier = "Xcode.DebuggerFoundation.Launcher.LLDB"
|
||||
shouldUseLaunchSchemeArgsEnv = "YES">
|
||||
<Testables>
|
||||
</Testables>
|
||||
<AdditionalOptions>
|
||||
</AdditionalOptions>
|
||||
</TestAction>
|
||||
<LaunchAction
|
||||
buildConfiguration = "Debug"
|
||||
selectedDebuggerIdentifier = "Xcode.DebuggerFoundation.Debugger.LLDB"
|
||||
selectedLauncherIdentifier = "Xcode.DebuggerFoundation.Launcher.LLDB"
|
||||
launchStyle = "0"
|
||||
useCustomWorkingDirectory = "NO"
|
||||
ignoresPersistentStateOnLaunch = "NO"
|
||||
debugDocumentVersioning = "YES"
|
||||
debugServiceExtension = "internal"
|
||||
allowLocationSimulation = "YES">
|
||||
<MacroExpansion>
|
||||
<BuildableReference
|
||||
BuildableIdentifier = "primary"
|
||||
BlueprintIdentifier = "263993B41CE90EED004A6E93"
|
||||
BuildableName = "SlackKit.framework"
|
||||
BlueprintName = "SlackKit tvOS"
|
||||
ReferencedContainer = "container:SlackKit.xcodeproj">
|
||||
</BuildableReference>
|
||||
</MacroExpansion>
|
||||
<AdditionalOptions>
|
||||
</AdditionalOptions>
|
||||
</LaunchAction>
|
||||
<ProfileAction
|
||||
buildConfiguration = "Release"
|
||||
shouldUseLaunchSchemeArgsEnv = "YES"
|
||||
savedToolIdentifier = ""
|
||||
useCustomWorkingDirectory = "NO"
|
||||
debugDocumentVersioning = "YES">
|
||||
<MacroExpansion>
|
||||
<BuildableReference
|
||||
BuildableIdentifier = "primary"
|
||||
BlueprintIdentifier = "263993B41CE90EED004A6E93"
|
||||
BuildableName = "SlackKit.framework"
|
||||
BlueprintName = "SlackKit tvOS"
|
||||
ReferencedContainer = "container:SlackKit.xcodeproj">
|
||||
</BuildableReference>
|
||||
</MacroExpansion>
|
||||
</ProfileAction>
|
||||
<AnalyzeAction
|
||||
buildConfiguration = "Debug">
|
||||
</AnalyzeAction>
|
||||
<ArchiveAction
|
||||
buildConfiguration = "Release"
|
||||
revealArchiveInOrganizer = "YES">
|
||||
</ArchiveAction>
|
||||
</Scheme>
|
||||
@@ -1,109 +0,0 @@
|
||||
//
|
||||
// EventDelegate.swift
|
||||
//
|
||||
// Copyright © 2016 Peter Zignego. All rights reserved.
|
||||
//
|
||||
// Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||
// of this software and associated documentation files (the "Software"), to deal
|
||||
// in the Software without restriction, including without limitation the rights
|
||||
// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
||||
// copies of the Software, and to permit persons to whom the Software is
|
||||
// furnished to do so, subject to the following conditions:
|
||||
//
|
||||
// The above copyright notice and this permission notice shall be included in
|
||||
// all copies or substantial portions of the Software.
|
||||
//
|
||||
// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||
// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||
// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
||||
// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
||||
// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
||||
// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
|
||||
// THE SOFTWARE.
|
||||
|
||||
public protocol ConnectionEventsDelegate: class {
|
||||
func connected(_ client: SlackClient)
|
||||
func disconnected(_ client: SlackClient)
|
||||
func connectionFailed(_ client: SlackClient, error: SlackError)
|
||||
}
|
||||
|
||||
public protocol MessageEventsDelegate: class {
|
||||
func sent(_ message: Message, client: SlackClient)
|
||||
func received(_ message: Message, client: SlackClient)
|
||||
func changed(_ message: Message, client: SlackClient)
|
||||
func deleted(_ message: Message?, client: SlackClient)
|
||||
}
|
||||
|
||||
public protocol ChannelEventsDelegate: class {
|
||||
func userTypingIn(_ channel: Channel, user: User, client: SlackClient)
|
||||
func marked(_ channel: Channel, timestamp: String, client: SlackClient)
|
||||
func created(_ channel: Channel, client: SlackClient)
|
||||
func deleted(_ channel: Channel, client: SlackClient)
|
||||
func renamed(_ channel: Channel, client: SlackClient)
|
||||
func archived(_ channel: Channel, client: SlackClient)
|
||||
func historyChanged(_ channel: Channel, client: SlackClient)
|
||||
func joined(_ channel: Channel, client: SlackClient)
|
||||
func left(_ channel: Channel, client: SlackClient)
|
||||
}
|
||||
|
||||
public protocol DoNotDisturbEventsDelegate: class {
|
||||
func updated(_ status: DoNotDisturbStatus, client: SlackClient)
|
||||
func userUpdated(_ status: DoNotDisturbStatus, user: User, client: SlackClient)
|
||||
}
|
||||
|
||||
public protocol GroupEventsDelegate: class {
|
||||
func opened(_ group: Channel, client: SlackClient)
|
||||
}
|
||||
|
||||
public protocol FileEventsDelegate: class {
|
||||
func processed(_ file: File, client: SlackClient)
|
||||
func madePrivate(_ file: File, client: SlackClient)
|
||||
func deleted(_ file: File, client: SlackClient)
|
||||
func commentAdded(_ file: File, comment: Comment, client: SlackClient)
|
||||
func commentEdited(_ file: File, comment: Comment, client: SlackClient)
|
||||
func commentDeleted(_ file: File, comment: Comment, client: SlackClient)
|
||||
}
|
||||
|
||||
public protocol PinEventsDelegate: class {
|
||||
func pinned(_ item: Item, channel: Channel?, client: SlackClient)
|
||||
func unpinned(_ item: Item, channel: Channel?, client: SlackClient)
|
||||
}
|
||||
|
||||
public protocol StarEventsDelegate: class {
|
||||
func starred(_ item: Item, starred: Bool, _ client: SlackClient)
|
||||
}
|
||||
|
||||
public protocol ReactionEventsDelegate: class {
|
||||
func added(_ reaction: String, item: Item, itemUser: String, client: SlackClient)
|
||||
func removed(_ reaction: String, item: Item, itemUser: String, client: SlackClient)
|
||||
}
|
||||
|
||||
public protocol SlackEventsDelegate: class {
|
||||
func preferenceChanged(_ preference: String, value: Any?, client: SlackClient)
|
||||
func userChanged(_ user: User, client: SlackClient)
|
||||
func presenceChanged(_ user: User, presence: String, client: SlackClient)
|
||||
func manualPresenceChanged(_ user: User, presence: String, client: SlackClient)
|
||||
func botEvent(_ bot: Bot, client: SlackClient)
|
||||
}
|
||||
|
||||
public protocol TeamEventsDelegate: class {
|
||||
func userJoined(_ user: User, client: SlackClient)
|
||||
func planChanged(_ plan: String, client: SlackClient)
|
||||
func preferencesChanged(_ preference: String, value: Any?, client: SlackClient)
|
||||
func nameChanged(_ name: String, client: SlackClient)
|
||||
func domainChanged(_ domain: String, client: SlackClient)
|
||||
func emailDomainChanged(_ domain: String, client: SlackClient)
|
||||
func emojiChanged(_ client: SlackClient)
|
||||
}
|
||||
|
||||
public protocol SubteamEventsDelegate: class {
|
||||
func event(_ userGroup: UserGroup, client: SlackClient)
|
||||
func selfAdded(_ subteamID: String, client: SlackClient)
|
||||
func selfRemoved(_ subteamID: String, client: SlackClient)
|
||||
}
|
||||
|
||||
public protocol TeamProfileEventsDelegate: class {
|
||||
func changed(_ profile: CustomProfile, client: SlackClient)
|
||||
func deleted(_ profile: CustomProfile, client: SlackClient)
|
||||
func reordered(_ profile: CustomProfile, client: SlackClient)
|
||||
}
|
||||
@@ -1,134 +0,0 @@
|
||||
//
|
||||
// NetworkInterface.swift
|
||||
//
|
||||
// Copyright © 2016 Peter Zignego. All rights reserved.
|
||||
//
|
||||
// Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||
// of this software and associated documentation files (the "Software"), to deal
|
||||
// in the Software without restriction, including without limitation the rights
|
||||
// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
||||
// copies of the Software, and to permit persons to whom the Software is
|
||||
// furnished to do so, subject to the following conditions:
|
||||
//
|
||||
// The above copyright notice and this permission notice shall be included in
|
||||
// all copies or substantial portions of the Software.
|
||||
//
|
||||
// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||
// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||
// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
||||
// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
||||
// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
||||
// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
|
||||
// THE SOFTWARE.
|
||||
|
||||
import Foundation
|
||||
import HTTPClient
|
||||
import WebSocketClient
|
||||
|
||||
internal struct NetworkInterface {
|
||||
|
||||
private let apiUrl = "https://slack.com/api/"
|
||||
private let client: HTTPClient.Client?
|
||||
|
||||
init() {
|
||||
do {
|
||||
self.client = try Client(url: URL(string: "https://slack.com")!)
|
||||
} catch {
|
||||
self.client = nil
|
||||
}
|
||||
}
|
||||
|
||||
internal func request(_ endpoint: Endpoint, token: String, parameters: [String: Any]?, successClosure: ([String: Any])->Void, errorClosure: (SlackError)->Void) {
|
||||
var requestString = "\(apiUrl)\(endpoint.rawValue)?token=\(token)"
|
||||
if let params = parameters {
|
||||
requestString += params.requestStringFromParameters
|
||||
}
|
||||
|
||||
do {
|
||||
let contentNegotiation = ContentNegotiationMiddleware(mediaTypes: [.json, .urlEncodedForm], mode: .client)
|
||||
var response = try client?.get(requestString, middleware: [contentNegotiation])
|
||||
if let buffer = try response?.body.becomeBuffer(deadline: 3.seconds.fromNow()) {
|
||||
let data = Data(bytes: buffer.bytes)
|
||||
let json = try JSONSerialization.jsonObject(with: data, options: .allowFragments)
|
||||
if let result = json as? [String: Any] {
|
||||
if (result["ok"] as? Bool == true) {
|
||||
successClosure(result)
|
||||
} else {
|
||||
if let errorString = result["error"] as? String {
|
||||
throw SlackError(rawValue: errorString) ?? SlackError.unknownError
|
||||
} else {
|
||||
throw SlackError.unknownError
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
} catch let error {
|
||||
if let slackError = error as? SlackError {
|
||||
errorClosure(slackError)
|
||||
} else {
|
||||
errorClosure(SlackError.unknownError)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
internal func uploadRequest(token: String, data: Data, parameters: [String: Any]?, successClosure: ([String: Any])->Void, errorClosure: (SlackError)->Void) {
|
||||
var requestString = "\(apiUrl)\(Endpoint.filesUpload.rawValue)?token=\(token)"
|
||||
if let params = parameters {
|
||||
requestString = requestString + params.requestStringFromParameters
|
||||
}
|
||||
|
||||
let boundaryConstant = randomBoundary()
|
||||
let boundaryStart = "--\(boundaryConstant)\r\n"
|
||||
let boundaryEnd = "\r\n--\(boundaryConstant)--\r\n"
|
||||
let contentDispositionString = "Content-Disposition: form-data; name=\"file\"; filename=\"\(parameters!["filename"])\"\r\n"
|
||||
let contentTypeString = "Content-Type: \(parameters!["filetype"])\r\n\r\n"
|
||||
|
||||
guard let boundaryStartData = boundaryStart.data(using: .utf8), let dispositionData = contentDispositionString.data(using: .utf8), let contentTypeData = contentTypeString.data(using: .utf8), let boundaryEndData = boundaryEnd.data(using: .utf8) else {
|
||||
errorClosure(SlackError.clientNetworkError)
|
||||
return
|
||||
}
|
||||
var requestBodyData = Data()
|
||||
requestBodyData.append(contentsOf: boundaryStartData)
|
||||
requestBodyData.append(contentsOf: dispositionData)
|
||||
requestBodyData.append(contentsOf: contentTypeData)
|
||||
requestBodyData.append(contentsOf: data)
|
||||
requestBodyData.append(contentsOf: boundaryEndData)
|
||||
|
||||
let header: Headers = ["Content-Type":"multipart/form-data; boundary=\(boundaryConstant)"]
|
||||
|
||||
do {
|
||||
let body = Buffer([UInt8](requestBodyData))
|
||||
var response = try client?.post(requestString, headers: header, body: body)
|
||||
if let buffer = try response?.body.becomeBuffer(deadline: 3.seconds.fromNow()) {
|
||||
let data = Data(bytes: buffer.bytes)
|
||||
let json = try JSONSerialization.jsonObject(with: data, options: .allowFragments)
|
||||
if let result = json as? [String: Any] {
|
||||
if (result["ok"] as? Bool == true) {
|
||||
successClosure(result)
|
||||
} else {
|
||||
if let errorString = result["error"] as? String {
|
||||
throw SlackError(rawValue: errorString) ?? SlackError.unknownError
|
||||
} else {
|
||||
throw SlackError.unknownError
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
} catch let error {
|
||||
if let slackError = error as? SlackError {
|
||||
errorClosure(slackError)
|
||||
} else {
|
||||
errorClosure(SlackError.unknownError)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
private func randomBoundary() -> String {
|
||||
#if os(Linux)
|
||||
return "slackkit.boundary.\(Int(random()))\(Int(random()))"
|
||||
#else
|
||||
return "slackkit.boundary.\(arc4random())\(arc4random())"
|
||||
#endif
|
||||
}
|
||||
}
|
||||
+8
-7
@@ -21,15 +21,14 @@
|
||||
// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
|
||||
// THE SOFTWARE.
|
||||
|
||||
internal extension SlackClient {
|
||||
|
||||
internal extension Client {
|
||||
|
||||
func dispatch(_ anEvent: [String: Any]) {
|
||||
let event = Event(anEvent)
|
||||
let type = event.type ?? .unknown
|
||||
switch type {
|
||||
case .hello:
|
||||
connected = true
|
||||
pingRTMServer()
|
||||
connectionEventsDelegate?.connected(self)
|
||||
case .ok:
|
||||
messageSent(event)
|
||||
@@ -114,8 +113,8 @@ internal extension SlackClient {
|
||||
case .emojiChanged:
|
||||
emojiChanged(event)
|
||||
case .commandsChanged:
|
||||
// This functionality is only used by our web client.
|
||||
// The other APIs required to support slash command metadata are currently unstable.
|
||||
// This functionality is only used by our web client.
|
||||
// The other APIs required to support slash command metadata are currently unstable.
|
||||
// Until they are released other clients should ignore this event.
|
||||
break
|
||||
case .teamPlanChange:
|
||||
@@ -143,7 +142,7 @@ internal extension SlackClient {
|
||||
// Other clients should ignore this event.
|
||||
break
|
||||
case .teamMigrationStarted:
|
||||
connect(pingInterval: pingInterval, timeout: timeout, reconnect: reconnect)
|
||||
connect(options: options ?? ClientOptions())
|
||||
case .reconnectURL:
|
||||
// The reconnect_url event is currently unsupported and experimental.
|
||||
break
|
||||
@@ -153,8 +152,10 @@ internal extension SlackClient {
|
||||
subteamAddedSelf(event)
|
||||
case .subteamSelfRemoved:
|
||||
subteamRemovedSelf(event)
|
||||
case .error:
|
||||
print("Error: \(anEvent)")
|
||||
case .unknown:
|
||||
print("Unknown event of type: \(anEvent["type"] ?? "No Type Information")")
|
||||
print("Unsupported event of type: \(anEvent["type"] ?? "No Type Information")")
|
||||
}
|
||||
}
|
||||
|
||||
+20
-21
@@ -22,10 +22,9 @@
|
||||
// THE SOFTWARE.
|
||||
|
||||
import Foundation
|
||||
import Dispatch
|
||||
|
||||
internal extension SlackClient {
|
||||
|
||||
internal extension Client {
|
||||
|
||||
//MARK: - Pong
|
||||
func pong(_ event: Event) {
|
||||
pong = event.replyTo
|
||||
@@ -74,20 +73,20 @@ internal extension SlackClient {
|
||||
func userTyping(_ event: Event) {
|
||||
guard let channel = event.channel, let channelID = channel.id, let user = event.user, let userID = user.id ,
|
||||
channels.index(forKey: channelID) != nil && !channels[channelID]!.usersTyping.contains(userID) else {
|
||||
return
|
||||
return
|
||||
}
|
||||
|
||||
|
||||
channels[channelID]?.usersTyping.append(userID)
|
||||
channelEventsDelegate?.userTypingIn(channel, user: user, client: self)
|
||||
|
||||
let timeout = DispatchTime.now() + Double(Int64(5.0 * Double(CLOCKS_PER_SEC))) / Double(CLOCKS_PER_SEC)
|
||||
|
||||
let timeout = DispatchTime.now() + Double(Int64(5.0 * Double(NSEC_PER_SEC))) / Double(NSEC_PER_SEC)
|
||||
DispatchQueue.main.asyncAfter(deadline: timeout, execute: {
|
||||
if let index = self.channels[channelID]?.usersTyping.index(of: userID) {
|
||||
self.channels[channelID]?.usersTyping.remove(at: index)
|
||||
}
|
||||
})
|
||||
}
|
||||
|
||||
|
||||
func channelMarked(_ event: Event) {
|
||||
guard let channel = event.channel, let id = channel.id, let timestamp = event.ts else {
|
||||
return
|
||||
@@ -199,7 +198,7 @@ internal extension SlackClient {
|
||||
files[id]?.comments[commentID] = comment
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
files[id] = file
|
||||
fileEventsDelegate?.processed(file, client: self)
|
||||
}
|
||||
@@ -265,13 +264,13 @@ internal extension SlackClient {
|
||||
guard let id = event.channelID, let item = event.item else {
|
||||
return
|
||||
}
|
||||
|
||||
|
||||
if let pins = channels[id]?.pinnedItems.filter({$0 != item}) {
|
||||
channels[id]?.pinnedItems = pins
|
||||
}
|
||||
pinEventsDelegate?.unpinned(item, channel: channels[id], client: self)
|
||||
}
|
||||
|
||||
|
||||
//MARK: - Stars
|
||||
func itemStarred(_ event: Event, star: Bool) {
|
||||
guard let item = event.item, let type = item.type else {
|
||||
@@ -287,7 +286,7 @@ internal extension SlackClient {
|
||||
default:
|
||||
break
|
||||
}
|
||||
|
||||
|
||||
starEventsDelegate?.starred(item, starred: star, self)
|
||||
}
|
||||
|
||||
@@ -347,15 +346,15 @@ internal extension SlackClient {
|
||||
default:
|
||||
break
|
||||
}
|
||||
|
||||
|
||||
reactionEventsDelegate?.added(reaction, item: item, itemUser: itemUser, client: self)
|
||||
}
|
||||
|
||||
|
||||
func removedReaction(_ event: Event) {
|
||||
guard let item = event.item, let type = item.type, let key = event.reaction, let userID = event.user?.id, let itemUser = event.itemUser else {
|
||||
return
|
||||
}
|
||||
|
||||
|
||||
switch type {
|
||||
case "message":
|
||||
guard let channel = item.channel, let ts = item.ts, let message = channels[channel]?.messages[ts] else {
|
||||
@@ -375,10 +374,10 @@ internal extension SlackClient {
|
||||
default:
|
||||
break
|
||||
}
|
||||
|
||||
|
||||
reactionEventsDelegate?.removed(key, item: item, itemUser: itemUser, client: self)
|
||||
}
|
||||
|
||||
|
||||
//MARK: - Preferences
|
||||
func changePreference(_ event: Event) {
|
||||
guard let name = event.name else {
|
||||
@@ -513,7 +512,7 @@ internal extension SlackClient {
|
||||
guard let profile = event.profile else {
|
||||
return
|
||||
}
|
||||
|
||||
|
||||
for user in users {
|
||||
for key in profile.fields.keys {
|
||||
users[user.0]?.profile?.customProfile?.fields[key]?.updateProfileField(profile.fields[key])
|
||||
@@ -527,7 +526,7 @@ internal extension SlackClient {
|
||||
guard let profile = event.profile else {
|
||||
return
|
||||
}
|
||||
|
||||
|
||||
for user in users {
|
||||
if let id = profile.fields.first?.0 {
|
||||
users[user.0]?.profile?.customProfile?.fields[id] = nil
|
||||
@@ -541,13 +540,13 @@ internal extension SlackClient {
|
||||
guard let profile = event.profile else {
|
||||
return
|
||||
}
|
||||
|
||||
|
||||
for user in users {
|
||||
for key in profile.fields.keys {
|
||||
users[user.0]?.profile?.customProfile?.fields[key]?.ordering = profile.fields[key]?.ordering
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
teamProfileEventsDelegate?.reordered(profile, client: self)
|
||||
}
|
||||
|
||||
@@ -26,7 +26,7 @@ public enum ClientError: Error {
|
||||
case userDoesNotExist
|
||||
}
|
||||
|
||||
public extension SlackClient {
|
||||
public extension Client {
|
||||
|
||||
//MARK: - User & Channel
|
||||
public func getChannelIDWith(name: String) throws -> String {
|
||||
@@ -35,14 +35,14 @@ public extension SlackClient {
|
||||
}
|
||||
return id
|
||||
}
|
||||
|
||||
|
||||
public func getUserIDWith(name: String) throws -> String {
|
||||
guard let id = users.filter({$0.1.name == strip(string:name)}).first?.0 else {
|
||||
throw ClientError.userDoesNotExist
|
||||
}
|
||||
return id
|
||||
}
|
||||
|
||||
|
||||
public func getImIDForUserWith(id: String, success: @escaping (_ imID: String?)->Void, failure: @escaping (SlackError)->Void) {
|
||||
let ims = channels.filter{$0.1.isIM == true}
|
||||
let channel = ims.filter{$0.1.user == id}.first
|
||||
@@ -52,7 +52,7 @@ public extension SlackClient {
|
||||
webAPI.openIM(userID: id, success: success, failure: failure)
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
//MARK: - Utilities
|
||||
internal func strip(string: String) -> String {
|
||||
var strippedString = string
|
||||
@@ -22,13 +22,11 @@
|
||||
// THE SOFTWARE.
|
||||
|
||||
import Foundation
|
||||
import Venice
|
||||
import WebSocketClient
|
||||
import Starscream
|
||||
|
||||
public class SlackClient {
|
||||
public final class Client: WebSocketDelegate {
|
||||
|
||||
internal(set) public var connected = false
|
||||
internal(set) public var authenticated = false
|
||||
internal(set) public var authenticatedUser: User?
|
||||
internal(set) public var team: Team?
|
||||
|
||||
@@ -39,6 +37,18 @@ public class SlackClient {
|
||||
internal(set) public var files = [String: File]()
|
||||
internal(set) public var sentMessages = [String: Message]()
|
||||
|
||||
public var token = "xoxp-SLACK_AUTH_TOKEN"
|
||||
|
||||
public var webAPI: WebAPI {
|
||||
return WebAPI(token: token)
|
||||
}
|
||||
|
||||
internal var webSocket: WebSocket?
|
||||
private let pingPongQueue = DispatchQueue(label: "com.launchsoft.SlackKit")
|
||||
internal var ping: Double?
|
||||
internal var pong: Double?
|
||||
internal var options: ClientOptions?
|
||||
|
||||
//MARK: - Delegates
|
||||
public weak var connectionEventsDelegate: ConnectionEventsDelegate?
|
||||
public weak var slackEventsDelegate: SlackEventsDelegate?
|
||||
@@ -53,81 +63,53 @@ public class SlackClient {
|
||||
public weak var teamEventsDelegate: TeamEventsDelegate?
|
||||
public weak var subteamEventsDelegate: SubteamEventsDelegate?
|
||||
public weak var teamProfileEventsDelegate: TeamProfileEventsDelegate?
|
||||
|
||||
internal var token = "SLACK_AUTH_TOKEN"
|
||||
|
||||
public func setAuthToken(token: String) {
|
||||
self.token = token
|
||||
}
|
||||
|
||||
public var webAPI: SlackWebAPI {
|
||||
return SlackWebAPI(token: token)
|
||||
}
|
||||
|
||||
internal var client: WebSocketClient?
|
||||
internal var socket: WebSocket?
|
||||
|
||||
internal var ping: Double?
|
||||
internal var pong: Double?
|
||||
internal var pingInterval: Double = 30
|
||||
internal var timeout: Double = 300
|
||||
internal var reconnect: Bool = false
|
||||
|
||||
required public init(apiToken: String) {
|
||||
// If you already have an API token
|
||||
internal init(apiToken: String) {
|
||||
self.token = apiToken
|
||||
}
|
||||
|
||||
public func connect(simpleLatest: Bool? = nil, noUnreads: Bool? = nil, mpimAware: Bool? = nil, pingInterval: Double = 30, timeout: Double = 300, reconnect: Bool = false) {
|
||||
self.pingInterval = pingInterval
|
||||
self.timeout = timeout
|
||||
self.reconnect = reconnect
|
||||
webAPI.rtmStart(simpleLatest: simpleLatest, noUnreads: noUnreads, mpimAware: mpimAware, success: { (response) in
|
||||
self.initialSetup(JSON: response)
|
||||
if let socketURL = response["url"] as? String, let url = URL(string: socketURL) {
|
||||
do {
|
||||
self.client = try WebSocketClient(url: url, didConnect: { (socket) in
|
||||
self.setupSocket(socket)
|
||||
})
|
||||
try self.client?.connect()
|
||||
} catch let error {
|
||||
print("WebSocket client could not connect: \(error)")
|
||||
}
|
||||
public func setAuthToken(_ token: String) {
|
||||
self.token = token
|
||||
}
|
||||
|
||||
public func connect(options: ClientOptions = ClientOptions()) {
|
||||
self.options = options
|
||||
webAPI.rtmStart(simpleLatest: options.simpleLatest, noUnreads: options.noUnreads, mpimAware: options.mpimAware, success: {(response) in
|
||||
guard let socketURL = response["url"] as? String, let url = URL(string: socketURL) else {
|
||||
return
|
||||
}
|
||||
self.initialSetup(JSON: response)
|
||||
self.webSocket = WebSocket(url: url)
|
||||
self.webSocket?.delegate = self
|
||||
self.webSocket?.connect()
|
||||
}, failure: {(error) in
|
||||
print("rtm.start failed with error: \(error)")
|
||||
self.connectionEventsDelegate?.connectionFailed(self, error: error)
|
||||
})
|
||||
}
|
||||
|
||||
public func disconnect() {
|
||||
_ = try? socket?.close()
|
||||
webSocket?.disconnect()
|
||||
}
|
||||
|
||||
//MARK: - RTM message send
|
||||
public func sendMessage(message: String, channelID: String) {
|
||||
if connected {
|
||||
if let data = formatMessageToSlackJsonString(message: message, channel: channelID) {
|
||||
do {
|
||||
try socket?.send(data.base64EncodedString())
|
||||
} catch let error {
|
||||
print("Message failed to send: \(error)")
|
||||
}
|
||||
}
|
||||
//MARK: - RTM Message send
|
||||
public func send(message: String, channelID: String) {
|
||||
guard connected else { return }
|
||||
|
||||
if let data = try? format(message: message, channel: channelID), let string = String(data: data, encoding: String.Encoding.utf8) {
|
||||
webSocket?.write(string: string)
|
||||
}
|
||||
}
|
||||
|
||||
private func formatMessageToSlackJsonString(message: String, channel: String) -> Data? {
|
||||
private func format(message: String, channel: String) throws -> Data {
|
||||
let json: [String: Any] = [
|
||||
"id": Date().slackTimestamp,
|
||||
"type": "message",
|
||||
"channel": channel,
|
||||
"text": message.slackFormatEscaping
|
||||
]
|
||||
|
||||
do {
|
||||
return try JSONSerialization.data(withJSONObject: json, options: [])
|
||||
} catch {
|
||||
return nil
|
||||
}
|
||||
addSentMessage(json)
|
||||
return try JSONSerialization.data(withJSONObject: json, options: [])
|
||||
}
|
||||
|
||||
private func addSentMessage(_ dictionary: [String: Any]) {
|
||||
@@ -142,6 +124,49 @@ public class SlackClient {
|
||||
sentMessages[ts] = Message(dictionary: message)
|
||||
}
|
||||
|
||||
//MARK: - RTM Ping
|
||||
private func pingRTMServerAt(interval: TimeInterval) {
|
||||
let delay = DispatchTime.now() + Double(Int64(interval * Double(NSEC_PER_SEC))) / Double(NSEC_PER_SEC)
|
||||
pingPongQueue.asyncAfter(deadline: delay, execute: {
|
||||
guard self.connected && self.timeoutCheck() else {
|
||||
self.disconnect()
|
||||
return
|
||||
}
|
||||
self.sendRTMPing()
|
||||
self.pingRTMServerAt(interval: interval)
|
||||
})
|
||||
}
|
||||
|
||||
private func sendRTMPing() {
|
||||
guard connected else {
|
||||
return
|
||||
}
|
||||
let json: [String: Any] = [
|
||||
"id": Date().slackTimestamp,
|
||||
"type": "ping"
|
||||
]
|
||||
guard let data = try? JSONSerialization.data(withJSONObject: json, options: []) else {
|
||||
return
|
||||
}
|
||||
if let string = String(data: data, encoding: String.Encoding.utf8) {
|
||||
ping = json["id"] as? Double
|
||||
webSocket?.write(string: string)
|
||||
}
|
||||
}
|
||||
|
||||
private func timeoutCheck() -> Bool {
|
||||
if let pong = pong, let ping = ping, let timeout = options?.timeout {
|
||||
if pong - ping < timeout {
|
||||
return true
|
||||
} else {
|
||||
return false
|
||||
}
|
||||
// Ping-pong or timeout not configured
|
||||
} else {
|
||||
return true
|
||||
}
|
||||
}
|
||||
|
||||
//MARK: - Client setup
|
||||
private func initialSetup(JSON: [String: Any]) {
|
||||
team = Team(team: JSON["team"] as? [String: Any])
|
||||
@@ -207,90 +232,32 @@ public class SlackClient {
|
||||
}
|
||||
}
|
||||
|
||||
//MARK: - RTM Ping
|
||||
internal func pingRTMServer() {
|
||||
co {
|
||||
self.sendRTMPing()
|
||||
nap(for: self.pingInterval.seconds)
|
||||
guard self.connected && self.isConnectionTimedOut else {
|
||||
self.disconnect()
|
||||
return
|
||||
}
|
||||
self.pingRTMServer()
|
||||
// MARK: - WebSocketDelegate
|
||||
public func websocketDidConnect(socket: WebSocket) {
|
||||
if let pingInterval = options?.pingInterval {
|
||||
pingRTMServerAt(interval: pingInterval)
|
||||
}
|
||||
}
|
||||
|
||||
private func sendRTMPing() {
|
||||
guard connected else {
|
||||
return
|
||||
}
|
||||
let json: [String: Any] = [
|
||||
"id": Date().slackTimestamp,
|
||||
"type": "ping"
|
||||
]
|
||||
guard let data = try? JSONSerialization.data(withJSONObject: json, options: []) else {
|
||||
return
|
||||
}
|
||||
if let string = String(data: data, encoding: String.Encoding.utf8) {
|
||||
ping = json["id"] as? Double
|
||||
do {
|
||||
try socket?.send(string)
|
||||
} catch let error {
|
||||
print("Failed to send ping with error: \(error)")
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
var isConnectionTimedOut: Bool {
|
||||
if let pong = pong, let ping = ping {
|
||||
if pong - ping < timeout {
|
||||
return true
|
||||
} else {
|
||||
return false
|
||||
}
|
||||
} else {
|
||||
return true
|
||||
}
|
||||
}
|
||||
|
||||
// MARK: - WebSocket
|
||||
private func setupSocket(_ socket: WebSocket) {
|
||||
socket.onText {(message) in
|
||||
self.websocketDidReceive(message: message)
|
||||
}
|
||||
socket.onClose{ (code: CloseCode?, reason: String?) in
|
||||
self.websocketDidDisconnect(closeCode: code, error: reason)
|
||||
}
|
||||
socket.onPing { (data) in try socket.pong() }
|
||||
socket.onPong { (data) in try socket.ping() }
|
||||
self.socket = socket
|
||||
}
|
||||
|
||||
private func websocketDidReceive(message: String) {
|
||||
do {
|
||||
guard let message = message.data(using: .utf8) else {
|
||||
print("Failed to decode message")
|
||||
return
|
||||
}
|
||||
let json = try JSONSerialization.jsonObject(with: message, options: [])
|
||||
if let event = json as? [String: Any] {
|
||||
dispatch(event)
|
||||
}
|
||||
}
|
||||
catch let error {
|
||||
print("Failed to dispatch message: \(error)")
|
||||
}
|
||||
}
|
||||
|
||||
private func websocketDidDisconnect(closeCode: CloseCode?, error: String?) {
|
||||
public func websocketDidDisconnect(socket: WebSocket, error: NSError?) {
|
||||
connected = false
|
||||
authenticated = false
|
||||
client = nil
|
||||
socket = nil
|
||||
webSocket = nil
|
||||
authenticatedUser = nil
|
||||
connectionEventsDelegate?.disconnected(self)
|
||||
if reconnect == true {
|
||||
connect(pingInterval: pingInterval, timeout: timeout, reconnect: reconnect)
|
||||
if let options = options, options.reconnect == true {
|
||||
connect(options: options)
|
||||
}
|
||||
}
|
||||
|
||||
public func websocketDidReceiveMessage(socket: WebSocket, text: String) {
|
||||
guard let data = text.data(using: String.Encoding.utf8) else {
|
||||
return
|
||||
}
|
||||
|
||||
if let json = (try? JSONSerialization.jsonObject(with: data, options: JSONSerialization.ReadingOptions.allowFragments)) as? [String: Any] {
|
||||
dispatch(json)
|
||||
}
|
||||
}
|
||||
|
||||
public func websocketDidReceiveData(socket: WebSocket, data: Data) {}
|
||||
}
|
||||
@@ -0,0 +1,109 @@
|
||||
//
|
||||
// EventDelegate.swift
|
||||
//
|
||||
// Copyright © 2016 Peter Zignego. All rights reserved.
|
||||
//
|
||||
// Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||
// of this software and associated documentation files (the "Software"), to deal
|
||||
// in the Software without restriction, including without limitation the rights
|
||||
// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
||||
// copies of the Software, and to permit persons to whom the Software is
|
||||
// furnished to do so, subject to the following conditions:
|
||||
//
|
||||
// The above copyright notice and this permission notice shall be included in
|
||||
// all copies or substantial portions of the Software.
|
||||
//
|
||||
// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||
// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||
// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
||||
// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
||||
// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
||||
// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
|
||||
// THE SOFTWARE.
|
||||
|
||||
public protocol ConnectionEventsDelegate: class {
|
||||
func connected(_ client: Client)
|
||||
func disconnected(_ client: Client)
|
||||
func connectionFailed(_ client: Client, error: SlackError)
|
||||
}
|
||||
|
||||
public protocol MessageEventsDelegate: class {
|
||||
func sent(_ message: Message, client: Client)
|
||||
func received(_ message: Message, client: Client)
|
||||
func changed(_ message: Message, client: Client)
|
||||
func deleted(_ message: Message?, client: Client)
|
||||
}
|
||||
|
||||
public protocol ChannelEventsDelegate: class {
|
||||
func userTypingIn(_ channel: Channel, user: User, client: Client)
|
||||
func marked(_ channel: Channel, timestamp: String, client: Client)
|
||||
func created(_ channel: Channel, client: Client)
|
||||
func deleted(_ channel: Channel, client: Client)
|
||||
func renamed(_ channel: Channel, client: Client)
|
||||
func archived(_ channel: Channel, client: Client)
|
||||
func historyChanged(_ channel: Channel, client: Client)
|
||||
func joined(_ channel: Channel, client: Client)
|
||||
func left(_ channel: Channel, client: Client)
|
||||
}
|
||||
|
||||
public protocol DoNotDisturbEventsDelegate: class {
|
||||
func updated(_ status: DoNotDisturbStatus, client: Client)
|
||||
func userUpdated(_ status: DoNotDisturbStatus, user: User, client: Client)
|
||||
}
|
||||
|
||||
public protocol GroupEventsDelegate: class {
|
||||
func opened(_ group: Channel, client: Client)
|
||||
}
|
||||
|
||||
public protocol FileEventsDelegate: class {
|
||||
func processed(_ file: File, client: Client)
|
||||
func madePrivate(_ file: File, client: Client)
|
||||
func deleted(_ file: File, client: Client)
|
||||
func commentAdded(_ file: File, comment: Comment, client: Client)
|
||||
func commentEdited(_ file: File, comment: Comment, client: Client)
|
||||
func commentDeleted(_ file: File, comment: Comment, client: Client)
|
||||
}
|
||||
|
||||
public protocol PinEventsDelegate: class {
|
||||
func pinned(_ item: Item, channel: Channel?, client: Client)
|
||||
func unpinned(_ item: Item, channel: Channel?, client: Client)
|
||||
}
|
||||
|
||||
public protocol StarEventsDelegate: class {
|
||||
func starred(_ item: Item, starred: Bool, _ client: Client)
|
||||
}
|
||||
|
||||
public protocol ReactionEventsDelegate: class {
|
||||
func added(_ reaction: String, item: Item, itemUser: String, client: Client)
|
||||
func removed(_ reaction: String, item: Item, itemUser: String, client: Client)
|
||||
}
|
||||
|
||||
public protocol SlackEventsDelegate: class {
|
||||
func preferenceChanged(_ preference: String, value: Any?, client: Client)
|
||||
func userChanged(_ user: User, client: Client)
|
||||
func presenceChanged(_ user: User, presence: String, client: Client)
|
||||
func manualPresenceChanged(_ user: User, presence: String, client: Client)
|
||||
func botEvent(_ bot: Bot, client: Client)
|
||||
}
|
||||
|
||||
public protocol TeamEventsDelegate: class {
|
||||
func userJoined(_ user: User, client: Client)
|
||||
func planChanged(_ plan: String, client: Client)
|
||||
func preferencesChanged(_ preference: String, value: Any?, client: Client)
|
||||
func nameChanged(_ name: String, client: Client)
|
||||
func domainChanged(_ domain: String, client: Client)
|
||||
func emailDomainChanged(_ domain: String, client: Client)
|
||||
func emojiChanged(_ client: Client)
|
||||
}
|
||||
|
||||
public protocol SubteamEventsDelegate: class {
|
||||
func event(_ userGroup: UserGroup, client: Client)
|
||||
func selfAdded(_ subteamID: String, client: Client)
|
||||
func selfRemoved(_ subteamID: String, client: Client)
|
||||
}
|
||||
|
||||
public protocol TeamProfileEventsDelegate: class {
|
||||
func changed(_ profile: CustomProfile, client: Client)
|
||||
func deleted(_ profile: CustomProfile, client: Client)
|
||||
func reordered(_ profile: CustomProfile, client: Client)
|
||||
}
|
||||
@@ -24,7 +24,7 @@
|
||||
import Foundation
|
||||
|
||||
public extension Date {
|
||||
|
||||
|
||||
var slackTimestamp: Double {
|
||||
return NSNumber(value: timeIntervalSince1970).doubleValue
|
||||
}
|
||||
@@ -39,18 +39,3 @@ internal extension String {
|
||||
return escapedString
|
||||
}
|
||||
}
|
||||
|
||||
internal extension Dictionary where Key: ExpressibleByStringLiteral, Value: Any {
|
||||
|
||||
var requestStringFromParameters: String {
|
||||
var requestString = ""
|
||||
for key in self.keys {
|
||||
if let value = self[key] as? String, let encodedValue = value.addingPercentEncoding(withAllowedCharacters: CharacterSet.urlQueryAllowed) {
|
||||
requestString += "&\(key)=\(encodedValue)"
|
||||
} else if let value = self[key] {
|
||||
requestString += "&\(key)=\(value)"
|
||||
}
|
||||
}
|
||||
return requestString
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,71 @@
|
||||
//
|
||||
// IncomingWebhook.swift
|
||||
//
|
||||
// Copyright © 2016 Peter Zignego. All rights reserved.
|
||||
//
|
||||
// Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||
// of this software and associated documentation files (the "Software"), to deal
|
||||
// in the Software without restriction, including without limitation the rights
|
||||
// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
||||
// copies of the Software, and to permit persons to whom the Software is
|
||||
// furnished to do so, subject to the following conditions:
|
||||
//
|
||||
// The above copyright notice and this permission notice shall be included in
|
||||
// all copies or substantial portions of the Software.
|
||||
//
|
||||
// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||
// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||
// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
||||
// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
||||
// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
||||
// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
|
||||
// THE SOFTWARE.
|
||||
|
||||
import Foundation
|
||||
|
||||
public struct IncomingWebhook {
|
||||
|
||||
public let url: String?
|
||||
public let channel: String?
|
||||
public let configurationURL: String?
|
||||
public let username: String?
|
||||
public let iconEmoji: String?
|
||||
public let iconURL: String?
|
||||
|
||||
internal init(webhook: [String: Any]?) {
|
||||
url = webhook?["url"] as? String
|
||||
channel = webhook?["channel"] as? String
|
||||
configurationURL = webhook?["configuration_url"] as? String
|
||||
username = webhook?["username"] as? String
|
||||
iconEmoji = webhook?["icon_emoji"] as? String
|
||||
iconURL = webhook?["icon_url"] as? String
|
||||
}
|
||||
|
||||
public init(url: String, channel: String? = nil, username: String? = nil, iconEmoji: String? = nil, iconURL: String? = nil) {
|
||||
self.url = url
|
||||
self.channel = channel
|
||||
self.username = username
|
||||
self.iconEmoji = iconEmoji
|
||||
self.iconURL = iconURL
|
||||
self.configurationURL = nil
|
||||
}
|
||||
|
||||
public func postMessage(_ response: Response, success: ((Bool)->Void)? = nil, failure: ((SlackError)->Void)? = nil) {
|
||||
if let url = self.url, let data = try? JSONSerialization.data(withJSONObject: jsonBody(response.json), options: []) {
|
||||
NetworkInterface().customRequest(url, data: data, success: { _ in
|
||||
success?(true)
|
||||
}, errorClosure: {(error) in
|
||||
failure?(error)
|
||||
})
|
||||
}
|
||||
}
|
||||
|
||||
private func jsonBody(_ response: [String: Any]) -> [String: Any] {
|
||||
var json = response
|
||||
json["channel"] = channel
|
||||
json["username"] = username
|
||||
json["icon_emoji"] = iconEmoji
|
||||
json["icon_url"] = iconURL
|
||||
return json
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,39 @@
|
||||
//
|
||||
// MessageActionResponder.swift
|
||||
//
|
||||
// Copyright © 2016 Peter Zignego. All rights reserved.
|
||||
//
|
||||
// Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||
// of this software and associated documentation files (the "Software"), to deal
|
||||
// in the Software without restriction, including without limitation the rights
|
||||
// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
||||
// copies of the Software, and to permit persons to whom the Software is
|
||||
// furnished to do so, subject to the following conditions:
|
||||
//
|
||||
// The above copyright notice and this permission notice shall be included in
|
||||
// all copies or substantial portions of the Software.
|
||||
//
|
||||
// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||
// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||
// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
||||
// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
||||
// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
||||
// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
|
||||
// THE SOFTWARE.
|
||||
|
||||
public struct MessageActionResponder {
|
||||
|
||||
public var responses:[(Action, Response)]
|
||||
|
||||
public init(responses:[(Action, Response)]) {
|
||||
self.responses = responses
|
||||
}
|
||||
|
||||
internal func responseForRequest(_ request:MessageActionRequest) -> Reply? {
|
||||
if let response = responses.filter({$0.0.name == request.action?.name}).first?.1 {
|
||||
return Reply.json(response: response)
|
||||
} else {
|
||||
return nil
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,45 @@
|
||||
//
|
||||
// MessageActionServer.swift
|
||||
//
|
||||
// Copyright © 2016 Peter Zignego. All rights reserved.
|
||||
//
|
||||
// Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||
// of this software and associated documentation files (the "Software"), to deal
|
||||
// in the Software without restriction, including without limitation the rights
|
||||
// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
||||
// copies of the Software, and to permit persons to whom the Software is
|
||||
// furnished to do so, subject to the following conditions:
|
||||
//
|
||||
// The above copyright notice and this permission notice shall be included in
|
||||
// all copies or substantial portions of the Software.
|
||||
//
|
||||
// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||
// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||
// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
||||
// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
||||
// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
||||
// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
|
||||
// THE SOFTWARE.
|
||||
|
||||
open class MessageActionServer: Server {
|
||||
|
||||
internal let responder: MessageActionResponder
|
||||
|
||||
required public init(token: String, route: String, responder: MessageActionResponder) {
|
||||
self.responder = responder
|
||||
super.init(token: token)
|
||||
addRoute(route)
|
||||
}
|
||||
|
||||
internal func addRoute(_ route: String) {
|
||||
http.POST["/\(route)"] = { request in
|
||||
let payload = request.parseUrlencodedForm()
|
||||
let actionRequest = MessageActionRequest(response: self.jsonFromRequest(payload[0].1))
|
||||
if let reply = self.responder.responseForRequest(actionRequest), actionRequest.token == self.token {
|
||||
return self.request(actionRequest, reply: reply)
|
||||
} else {
|
||||
return .badRequest(.text("Bad request."))
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -42,6 +42,8 @@ public struct Attachment {
|
||||
public let footerIcon: String?
|
||||
public let ts: Int?
|
||||
|
||||
public let markdownEnabledFields: Set<AttachmentTextField>?
|
||||
|
||||
internal init(attachment: [String: Any]?) {
|
||||
fallback = attachment?["fallback"] as? String
|
||||
callbackID = attachment?["callback_id"] as? String
|
||||
@@ -61,9 +63,11 @@ public struct Attachment {
|
||||
ts = attachment?["ts"] as? Int
|
||||
fields = (attachment?["fields"] as? [[String: Any]])?.map { AttachmentField(field: $0) }
|
||||
actions = (attachment?["actions"] as? [[String: Any]])?.map { Action(action: $0) }
|
||||
|
||||
markdownEnabledFields = (attachment?["mrkdwn_in"] as? [String]).map { Set($0.flatMap(AttachmentTextField.init)) }
|
||||
}
|
||||
|
||||
public init(fallback: String, title:String, callbackID: String? = nil, type: String? = nil, colorHex: String? = nil, pretext: String? = nil, authorName: String? = nil, authorLink: String? = nil, authorIcon: String? = nil, titleLink: String? = nil, text: String? = nil, fields: [AttachmentField]? = nil, actions: [Action]? = nil, imageURL: String? = nil, thumbURL: String? = nil, footer: String? = nil, footerIcon:String? = nil, ts:Int? = nil) {
|
||||
public init(fallback: String, title: String?, callbackID: String? = nil, type: String? = nil, colorHex: String? = nil, pretext: String? = nil, authorName: String? = nil, authorLink: String? = nil, authorIcon: String? = nil, titleLink: String? = nil, text: String? = nil, fields: [AttachmentField]? = nil, actions: [Action]? = nil, imageURL: String? = nil, thumbURL: String? = nil, footer: String? = nil, footerIcon:String? = nil, ts:Int? = nil, markdownFields: Set<AttachmentTextField>? = nil) {
|
||||
self.fallback = fallback
|
||||
self.callbackID = callbackID
|
||||
self.type = type
|
||||
@@ -82,6 +86,7 @@ public struct Attachment {
|
||||
self.footer = footer
|
||||
self.footerIcon = footerIcon
|
||||
self.ts = ts
|
||||
self.markdownEnabledFields = markdownFields
|
||||
}
|
||||
|
||||
internal var dictionary: [String: Any] {
|
||||
@@ -91,7 +96,7 @@ public struct Attachment {
|
||||
attachment["attachment_type"] = type
|
||||
attachment["color"] = color
|
||||
attachment["pretext"] = pretext
|
||||
attachment["authorName"] = authorName
|
||||
attachment["author_name"] = authorName
|
||||
attachment["author_link"] = authorLink
|
||||
attachment["author_icon"] = authorIcon
|
||||
attachment["title"] = title
|
||||
@@ -104,6 +109,7 @@ public struct Attachment {
|
||||
attachment["footer"] = footer
|
||||
attachment["footer_icon"] = footerIcon
|
||||
attachment["ts"] = ts
|
||||
attachment["mrkdwn_in"] = markdownEnabledFields?.map { $0.rawValue }
|
||||
return attachment
|
||||
}
|
||||
}
|
||||
@@ -113,3 +119,13 @@ public enum AttachmentColor: String {
|
||||
case warning = "warning"
|
||||
case danger = "danger"
|
||||
}
|
||||
|
||||
public enum AttachmentTextField: String {
|
||||
case fallback = "fallback"
|
||||
case pretext = "pretext"
|
||||
case authorName = "author_name"
|
||||
case title = "title"
|
||||
case text = "text"
|
||||
case fields = "fields"
|
||||
case footer = "footer"
|
||||
}
|
||||
+2
-2
@@ -33,9 +33,9 @@ public struct AttachmentField {
|
||||
short = field?["short"] as? Bool
|
||||
}
|
||||
|
||||
public init(title:String, value:String, short: Bool? = nil) {
|
||||
public init(title: String?, value: String?, short: Bool? = nil) {
|
||||
self.title = title
|
||||
self.value = value.slackFormatEscaping
|
||||
self.value = value?.slackFormatEscaping
|
||||
self.short = short
|
||||
}
|
||||
|
||||
@@ -0,0 +1,47 @@
|
||||
//
|
||||
// AuthorizeRequest.swift
|
||||
//
|
||||
// Copyright © 2016 Peter Zignego. All rights reserved.
|
||||
//
|
||||
// Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||
// of this software and associated documentation files (the "Software"), to deal
|
||||
// in the Software without restriction, including without limitation the rights
|
||||
// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
||||
// copies of the Software, and to permit persons to whom the Software is
|
||||
// furnished to do so, subject to the following conditions:
|
||||
//
|
||||
// The above copyright notice and this permission notice shall be included in
|
||||
// all copies or substantial portions of the Software.
|
||||
//
|
||||
// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||
// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||
// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
||||
// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
||||
// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
||||
// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
|
||||
// THE SOFTWARE.
|
||||
|
||||
internal struct AuthorizeRequest {
|
||||
|
||||
let clientID: String
|
||||
let scope: [Scope]
|
||||
let redirectURI: String
|
||||
let state: String
|
||||
let team: String?
|
||||
|
||||
var parameters: [String: Any] {
|
||||
var json = [String : Any]()
|
||||
json["scope"] = scope.map({$0.rawValue}).joined(separator: ",")
|
||||
json["state"] = state
|
||||
json["team"] = team
|
||||
return json
|
||||
}
|
||||
|
||||
init(clientID: String, scope:[Scope], redirectURI: String, state: String = "slackkit", team: String? = nil) {
|
||||
self.clientID = clientID
|
||||
self.scope = scope
|
||||
self.redirectURI = redirectURI
|
||||
self.state = state
|
||||
self.team = team
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,36 @@
|
||||
//
|
||||
// AuthorizeResponse.swift
|
||||
//
|
||||
// Copyright © 2016 Peter Zignego. All rights reserved.
|
||||
//
|
||||
// Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||
// of this software and associated documentation files (the "Software"), to deal
|
||||
// in the Software without restriction, including without limitation the rights
|
||||
// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
||||
// copies of the Software, and to permit persons to whom the Software is
|
||||
// furnished to do so, subject to the following conditions:
|
||||
//
|
||||
// The above copyright notice and this permission notice shall be included in
|
||||
// all copies or substantial portions of the Software.
|
||||
//
|
||||
// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||
// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||
// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
||||
// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
||||
// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
||||
// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
|
||||
// THE SOFTWARE.
|
||||
|
||||
internal struct AuthorizeResponse {
|
||||
|
||||
let code: String
|
||||
let state: String
|
||||
|
||||
init?(queryParameters: [(String, String)]) {
|
||||
guard let code = queryParameters.first?.1, let state = queryParameters.last?.1 else {
|
||||
return nil
|
||||
}
|
||||
self.code = code
|
||||
self.state = state
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,44 @@
|
||||
//
|
||||
// OAuthResponse.swift
|
||||
//
|
||||
// Copyright © 2016 Peter Zignego. All rights reserved.
|
||||
//
|
||||
// Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||
// of this software and associated documentation files (the "Software"), to deal
|
||||
// in the Software without restriction, including without limitation the rights
|
||||
// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
||||
// copies of the Software, and to permit persons to whom the Software is
|
||||
// furnished to do so, subject to the following conditions:
|
||||
//
|
||||
// The above copyright notice and this permission notice shall be included in
|
||||
// all copies or substantial portions of the Software.
|
||||
//
|
||||
// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||
// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||
// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
||||
// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
||||
// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
||||
// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
|
||||
// THE SOFTWARE.
|
||||
|
||||
internal struct OAuthResponse {
|
||||
|
||||
let accessToken: String?
|
||||
let scope: [Scope]?
|
||||
let userID: String?
|
||||
let teamName: String?
|
||||
let teamID: String?
|
||||
let incomingWebhook: IncomingWebhook?
|
||||
let bot: Bot?
|
||||
|
||||
init(response: [String: Any]?) {
|
||||
accessToken = response?["access_token"] as? String
|
||||
scope = (response?["scope"] as? String)?.components(separatedBy: ",").flatMap{Scope(rawValue:$0)}
|
||||
userID = response?["user_id"] as? String
|
||||
teamName = response?["team_name"] as? String
|
||||
teamID = response?["team_id"] as? String
|
||||
incomingWebhook = IncomingWebhook(webhook: response?["incoming_webhook"] as? [String: Any])
|
||||
bot = Bot(botUser: response?["bot"] as? [String: Any])
|
||||
}
|
||||
|
||||
}
|
||||
@@ -0,0 +1,71 @@
|
||||
//
|
||||
// Scope.swift
|
||||
//
|
||||
// Copyright © 2016 Peter Zignego. All rights reserved.
|
||||
//
|
||||
// Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||
// of this software and associated documentation files (the "Software"), to deal
|
||||
// in the Software without restriction, including without limitation the rights
|
||||
// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
||||
// copies of the Software, and to permit persons to whom the Software is
|
||||
// furnished to do so, subject to the following conditions:
|
||||
//
|
||||
// The above copyright notice and this permission notice shall be included in
|
||||
// all copies or substantial portions of the Software.
|
||||
//
|
||||
// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||
// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||
// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
||||
// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
||||
// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
||||
// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
|
||||
// THE SOFTWARE.
|
||||
|
||||
public enum Scope: String {
|
||||
|
||||
case ChannelsHistory = "channels:history"
|
||||
case ChannelsRead = "channels:read"
|
||||
case ChannelsWrite = "channels:write"
|
||||
case ChatWriteBot = "chat:write:bot"
|
||||
case ChatWriteUser = "chat:write:user"
|
||||
case DNDRead = "dnd:read"
|
||||
case DNDWrite = "dnd:write"
|
||||
case EmojiRead = "emoji:read"
|
||||
case FilesRead = "files:read"
|
||||
case FilesWriteUser = "files:write:user"
|
||||
case GroupsHistory = "groups:history"
|
||||
case GroupsRead = "groups:read"
|
||||
case GroupsWrite = "groups:write"
|
||||
case IdentityBasic = "identity.basic"
|
||||
case IMHistory = "im:history"
|
||||
case IMRead = "im:read"
|
||||
case IMWrite = "im:write"
|
||||
case MPIMHistory = "mpim:history"
|
||||
case MPIMRead = "mpim:read"
|
||||
case MPIMWrite = "mpim:write"
|
||||
case PinsRead = "pins:read"
|
||||
case PinsWrite = "pins:write"
|
||||
case ReactionsRead = "reactions:read"
|
||||
case ReactionsWrite = "reactions:write"
|
||||
case RemindersRead = "reminders:read"
|
||||
case RemindersWrite = "reminders:write"
|
||||
case SearchRead = "search:read"
|
||||
case StarsRead = "stars:read"
|
||||
case StarsWrite = "stars:write"
|
||||
case TeamRead = "team:read"
|
||||
case UserGroupsRead = "usergroups:read"
|
||||
case UserGroupsWrite = "usergroups:write"
|
||||
case UserProfilesRead = "user.profiles:read"
|
||||
case UserProfilesWrite = "user.profiles:write"
|
||||
case UsersRead = "users:read"
|
||||
case UsersWrite = "users:write"
|
||||
case IncomingWebhook = "incoming-webhook"
|
||||
case Commands = "commands"
|
||||
case Bot = "bot"
|
||||
case Identify = "identify"
|
||||
case Client = "client"
|
||||
case Admin = "admin"
|
||||
//Deprecated
|
||||
case Read = "read"
|
||||
case Post = "post"
|
||||
}
|
||||
@@ -70,7 +70,7 @@ public struct Channel {
|
||||
unreadCountDisplay = channel?["unread_count_display"] as? Int
|
||||
hasPins = channel?["has_pins"] as? Bool
|
||||
members = channel?["members"] as? [String]
|
||||
|
||||
|
||||
if let latestMesssageDictionary = channel?["latest"] as? [String: Any] {
|
||||
latest = Message(dictionary: latestMesssageDictionary)
|
||||
} else {
|
||||
@@ -0,0 +1,43 @@
|
||||
//
|
||||
// ClientOptions.swift
|
||||
//
|
||||
// Copyright © 2016 Peter Zignego. All rights reserved.
|
||||
//
|
||||
// Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||
// of this software and associated documentation files (the "Software"), to deal
|
||||
// in the Software without restriction, including without limitation the rights
|
||||
// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
||||
// copies of the Software, and to permit persons to whom the Software is
|
||||
// furnished to do so, subject to the following conditions:
|
||||
//
|
||||
// The above copyright notice and this permission notice shall be included in
|
||||
// all copies or substantial portions of the Software.
|
||||
//
|
||||
// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||
// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||
// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
||||
// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
||||
// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
||||
// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
|
||||
// THE SOFTWARE.
|
||||
|
||||
import Foundation
|
||||
|
||||
public struct ClientOptions {
|
||||
|
||||
let simpleLatest: Bool?
|
||||
let noUnreads: Bool?
|
||||
let mpimAware: Bool?
|
||||
let pingInterval: TimeInterval?
|
||||
let timeout: TimeInterval?
|
||||
let reconnect: Bool?
|
||||
|
||||
public init(simpleLatest: Bool? = nil, noUnreads: Bool? = nil, mpimAware: Bool? = nil, pingInterval: TimeInterval? = nil, timeout: TimeInterval? = nil, reconnect: Bool? = nil) {
|
||||
self.simpleLatest = simpleLatest
|
||||
self.noUnreads = noUnreads
|
||||
self.mpimAware = mpimAware
|
||||
self.pingInterval = pingInterval
|
||||
self.timeout = timeout
|
||||
self.reconnect = reconnect
|
||||
}
|
||||
}
|
||||
@@ -22,7 +22,6 @@
|
||||
// THE SOFTWARE.
|
||||
|
||||
internal enum EventType: String {
|
||||
|
||||
case hello = "hello"
|
||||
case message = "message"
|
||||
case userTyping = "user_typing"
|
||||
@@ -93,11 +92,11 @@ internal enum EventType: String {
|
||||
case subteamSelfAdded = "subteam_self_added"
|
||||
case subteamSelfRemoved = "subteam_self_removed"
|
||||
case ok = "ok"
|
||||
case error = "error"
|
||||
case unknown = "unknown"
|
||||
}
|
||||
|
||||
internal enum MessageSubtype: String {
|
||||
|
||||
case botMessage = "bot_message"
|
||||
case meMessage = "me_message"
|
||||
case messageChanged = "message_changed"
|
||||
@@ -195,20 +194,20 @@ internal class Event {
|
||||
nestedMessage = Message(dictionary: event["message"] as? [String: Any])
|
||||
profile = CustomProfile(profile: event["profile"] as? [String: Any])
|
||||
file = File(id: event["file"] as? String)
|
||||
|
||||
|
||||
// Comment, Channel, and User can come across as Strings or Dictionaries
|
||||
if let commentDictionary = event["comment"] as? [String: Any] {
|
||||
comment = Comment(comment: commentDictionary)
|
||||
} else {
|
||||
comment = Comment(id: event["comment"] as? String)
|
||||
}
|
||||
|
||||
|
||||
if let userDictionary = event["user"] as? [String: Any] {
|
||||
user = User(user: userDictionary)
|
||||
} else {
|
||||
user = User(id: event["user"] as? String)
|
||||
}
|
||||
|
||||
|
||||
if let channelDictionary = event["channel"] as? [String: Any] {
|
||||
channel = Channel(channel: channelDictionary)
|
||||
} else {
|
||||
@@ -22,7 +22,7 @@
|
||||
// THE SOFTWARE.
|
||||
|
||||
public struct File: Equatable {
|
||||
|
||||
|
||||
public let id: String?
|
||||
public let created: Int?
|
||||
public let name: String?
|
||||
@@ -131,7 +131,7 @@ public struct File: Equatable {
|
||||
stars = file?["num_stars"] as? Int
|
||||
isStarred = file?["is_starred"] as? Bool
|
||||
pinnedTo = file?["pinned_to"] as? [String]
|
||||
reactions = Reaction.reactionsFromArray(file?["reactions"] as? [[String: Any]])
|
||||
reactions = Reaction.reactionsFromArray(file?["reactions"] as? [[String: Any]])
|
||||
}
|
||||
|
||||
internal init(id:String?) {
|
||||
@@ -0,0 +1,51 @@
|
||||
//
|
||||
// MessageActionRequest.swift
|
||||
//
|
||||
// Copyright © 2016 Peter Zignego. All rights reserved.
|
||||
//
|
||||
// Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||
// of this software and associated documentation files (the "Software"), to deal
|
||||
// in the Software without restriction, including without limitation the rights
|
||||
// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
||||
// copies of the Software, and to permit persons to whom the Software is
|
||||
// furnished to do so, subject to the following conditions:
|
||||
//
|
||||
// The above copyright notice and this permission notice shall be included in
|
||||
// all copies or substantial portions of the Software.
|
||||
//
|
||||
// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||
// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||
// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
||||
// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
||||
// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
||||
// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
|
||||
// THE SOFTWARE.
|
||||
|
||||
internal struct MessageActionRequest: Request {
|
||||
|
||||
let action: Action?
|
||||
let callbackID: String?
|
||||
let team: Team?
|
||||
let channel: Channel?
|
||||
let user: User?
|
||||
let actionTS: String?
|
||||
let messageTS: String?
|
||||
let attachmentID: String?
|
||||
let token: String?
|
||||
let originalMessage: Message?
|
||||
let responseURL: String
|
||||
|
||||
init(response: [String: Any]?) {
|
||||
action = (response?["actions"] as? [[String:Any]])?.map({Action(action: $0)}).first
|
||||
callbackID = response?["callback_id"] as? String
|
||||
team = Team(team: response?["team"] as? [String: Any])
|
||||
channel = Channel(channel: response?["channel"] as? [String: Any])
|
||||
user = User(user: response?["channel"] as? [String: Any])
|
||||
actionTS = response?["action_ts"] as? String
|
||||
messageTS = response?["message_ts"] as? String
|
||||
attachmentID = response?["attachment_id"] as? String
|
||||
token = response?["token"] as? String
|
||||
originalMessage = Message(dictionary: response?["original_message"] as? [String: Any])
|
||||
responseURL = response?["response_url"] as? String ?? ""
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,43 @@
|
||||
//
|
||||
// Response.swift
|
||||
//
|
||||
// Copyright © 2016 Peter Zignego. All rights reserved.
|
||||
//
|
||||
// Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||
// of this software and associated documentation files (the "Software"), to deal
|
||||
// in the Software without restriction, including without limitation the rights
|
||||
// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
||||
// copies of the Software, and to permit persons to whom the Software is
|
||||
// furnished to do so, subject to the following conditions:
|
||||
//
|
||||
// The above copyright notice and this permission notice shall be included in
|
||||
// all copies or substantial portions of the Software.
|
||||
//
|
||||
// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||
// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||
// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
||||
// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
||||
// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
||||
// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
|
||||
// THE SOFTWARE.
|
||||
|
||||
public struct Response {
|
||||
|
||||
let text: String
|
||||
let responseType: ResponseType?
|
||||
let attachments: [Attachment]?
|
||||
|
||||
public init(text: String, responseType: ResponseType? = nil, attachments: [Attachment]? = nil) {
|
||||
self.responseType = responseType
|
||||
self.text = text
|
||||
self.attachments = attachments
|
||||
}
|
||||
|
||||
internal var json: [String: Any] {
|
||||
var json = [String : Any]()
|
||||
json["text"] = text
|
||||
json["response_type"] = responseType?.rawValue
|
||||
json["attachments"] = attachments?.map({$0.dictionary})
|
||||
return json
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,49 @@
|
||||
//
|
||||
// WebhookRequest.swift
|
||||
//
|
||||
// Copyright © 2016 Peter Zignego. All rights reserved.
|
||||
//
|
||||
// Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||
// of this software and associated documentation files (the "Software"), to deal
|
||||
// in the Software without restriction, including without limitation the rights
|
||||
// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
||||
// copies of the Software, and to permit persons to whom the Software is
|
||||
// furnished to do so, subject to the following conditions:
|
||||
//
|
||||
// The above copyright notice and this permission notice shall be included in
|
||||
// all copies or substantial portions of the Software.
|
||||
//
|
||||
// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||
// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||
// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
||||
// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
||||
// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
||||
// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
|
||||
// THE SOFTWARE.
|
||||
|
||||
internal struct WebhookRequest: Request {
|
||||
|
||||
let token: String?
|
||||
let teamID: String
|
||||
let teamDomain: String
|
||||
let channelID: String
|
||||
let channelName: String
|
||||
let userID: String
|
||||
let userName: String
|
||||
let command: String
|
||||
let text: String
|
||||
let responseURL: String
|
||||
|
||||
init(request: [String: Any]?) {
|
||||
token = request?["token"] as? String
|
||||
teamID = request?["team_id"] as? String ?? ""
|
||||
teamDomain = request?["team_domain"] as? String ?? ""
|
||||
channelID = request?["channel_id"] as? String ?? ""
|
||||
channelName = request?["channel_name"] as? String ?? ""
|
||||
userID = request?["user_id"] as? String ?? ""
|
||||
userName = request?["user_name"] as? String ?? ""
|
||||
command = request?["command"] as? String ?? ""
|
||||
text = request?["text"] as? String ?? ""
|
||||
responseURL = request?["response_url"] as? String ?? ""
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,156 @@
|
||||
//
|
||||
// NetworkInterface.swift
|
||||
//
|
||||
// Copyright © 2016 Peter Zignego. All rights reserved.
|
||||
//
|
||||
// Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||
// of this software and associated documentation files (the "Software"), to deal
|
||||
// in the Software without restriction, including without limitation the rights
|
||||
// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
||||
// copies of the Software, and to permit persons to whom the Software is
|
||||
// furnished to do so, subject to the following conditions:
|
||||
//
|
||||
// The above copyright notice and this permission notice shall be included in
|
||||
// all copies or substantial portions of the Software.
|
||||
//
|
||||
// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||
// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||
// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
||||
// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
||||
// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
||||
// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
|
||||
// THE SOFTWARE.
|
||||
|
||||
import Foundation
|
||||
|
||||
internal struct NetworkInterface {
|
||||
|
||||
private let apiUrl = "https://slack.com/api/"
|
||||
|
||||
internal func request(_ endpoint: Endpoint, parameters: [String: Any?], successClosure: @escaping ([String: Any])->Void, errorClosure: @escaping (SlackError)->Void) {
|
||||
var components = URLComponents(string: "\(apiUrl)\(endpoint.rawValue)")
|
||||
if parameters.count > 0 {
|
||||
components?.queryItems = filterNilParameters(parameters).map { URLQueryItem(name: $0.0, value: "\($0.1)") }
|
||||
}
|
||||
guard let url = components?.url else {
|
||||
errorClosure(SlackError.clientNetworkError)
|
||||
return
|
||||
}
|
||||
let request = URLRequest(url: url)
|
||||
|
||||
URLSession.shared.dataTask(with: request) {(data, response, internalError) in
|
||||
do {
|
||||
successClosure(try self.handleResponse(data, response: response, internalError: internalError))
|
||||
} catch let error {
|
||||
errorClosure(error as? SlackError ?? SlackError.unknownError)
|
||||
}
|
||||
}.resume()
|
||||
}
|
||||
|
||||
internal func customRequest(_ url: String, data: Data, success: @escaping (Bool)->Void, errorClosure: @escaping (SlackError)->Void) {
|
||||
guard let string = url.removingPercentEncoding, let url = URL(string: string) else {
|
||||
errorClosure(SlackError.clientNetworkError)
|
||||
return
|
||||
}
|
||||
var request = URLRequest(url:url)
|
||||
request.httpMethod = "POST"
|
||||
let contentType = "application/json"
|
||||
request.setValue(contentType, forHTTPHeaderField: "Content-Type")
|
||||
request.httpBody = data
|
||||
|
||||
URLSession.shared.dataTask(with: request) {(data, response, internalError) in
|
||||
if internalError == nil {
|
||||
success(true)
|
||||
} else {
|
||||
errorClosure(SlackError.clientNetworkError)
|
||||
}
|
||||
}.resume()
|
||||
}
|
||||
|
||||
internal func uploadRequest(data: Data, parameters: [String: Any?], successClosure: @escaping ([String: Any])->Void, errorClosure: @escaping (SlackError)->Void) {
|
||||
var components = URLComponents(string: "\(apiUrl)\(Endpoint.filesUpload.rawValue)")
|
||||
if parameters.count > 0 {
|
||||
components?.queryItems = filterNilParameters(parameters).map { URLQueryItem(name: $0.0, value: "\($0.1)") }
|
||||
}
|
||||
guard let url = components?.url, let filename = parameters["filename"] as? String, let filetype = parameters["filetype"] as? String else {
|
||||
errorClosure(SlackError.clientNetworkError)
|
||||
return
|
||||
}
|
||||
var request = URLRequest(url:url)
|
||||
request.httpMethod = "POST"
|
||||
let boundaryConstant = randomBoundary()
|
||||
let contentType = "multipart/form-data; boundary=" + boundaryConstant
|
||||
let boundaryStart = "--\(boundaryConstant)\r\n"
|
||||
let boundaryEnd = "--\(boundaryConstant)--\r\n"
|
||||
let contentDispositionString = "Content-Disposition: form-data; name=\"file\"; filename=\"\(filename)\"\r\n"
|
||||
let contentTypeString = "Content-Type: \(filetype)\r\n\r\n"
|
||||
|
||||
var requestBodyData: Data = Data()
|
||||
requestBodyData.append(boundaryStart.data(using: String.Encoding.utf8)!)
|
||||
requestBodyData.append(contentDispositionString.data(using: String.Encoding.utf8)!)
|
||||
requestBodyData.append(contentTypeString.data(using: String.Encoding.utf8)!)
|
||||
requestBodyData.append(data)
|
||||
requestBodyData.append("\r\n".data(using: String.Encoding.utf8)!)
|
||||
requestBodyData.append(boundaryEnd.data(using: String.Encoding.utf8)!)
|
||||
|
||||
request.setValue(contentType, forHTTPHeaderField: "Content-Type")
|
||||
request.httpBody = requestBodyData as Data
|
||||
|
||||
URLSession.shared.dataTask(with: request) {(data, response, internalError) in
|
||||
do {
|
||||
successClosure(try self.handleResponse(data, response: response, internalError: internalError))
|
||||
} catch let error {
|
||||
errorClosure(error as? SlackError ?? SlackError.unknownError)
|
||||
}
|
||||
}.resume()
|
||||
}
|
||||
|
||||
private func handleResponse(_ data: Data?, response:URLResponse?, internalError:Error?) throws -> [String: Any] {
|
||||
guard let data = data, let response = response as? HTTPURLResponse else {
|
||||
throw SlackError.clientNetworkError
|
||||
}
|
||||
do {
|
||||
guard let json = try JSONSerialization.jsonObject(with: data, options: []) as? [String: Any] else {
|
||||
throw SlackError.clientJSONError
|
||||
}
|
||||
|
||||
switch response.statusCode {
|
||||
case 200:
|
||||
if (json["ok"] as! Bool == true) {
|
||||
return json
|
||||
} else {
|
||||
if let errorString = json["error"] as? String {
|
||||
throw SlackError(rawValue: errorString) ?? .unknownError
|
||||
} else {
|
||||
throw SlackError.unknownError
|
||||
}
|
||||
}
|
||||
case 429:
|
||||
throw SlackError.tooManyRequests
|
||||
default:
|
||||
throw SlackError.clientNetworkError
|
||||
}
|
||||
} catch let error {
|
||||
if let slackError = error as? SlackError {
|
||||
throw slackError
|
||||
} else {
|
||||
throw SlackError.unknownError
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
private func randomBoundary() -> String {
|
||||
return String(format: "slackkit.boundary.%08x%08x", arc4random(), arc4random())
|
||||
}
|
||||
|
||||
//MARK: - Filter Nil Parameters
|
||||
private func filterNilParameters(_ parameters: [String: Any?]) -> [String: Any] {
|
||||
var finalParameters = [String: Any]()
|
||||
for (key, value) in parameters {
|
||||
if let unwrapped = value {
|
||||
finalParameters[key] = unwrapped
|
||||
}
|
||||
}
|
||||
return finalParameters
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,97 @@
|
||||
//
|
||||
// OAuthServer.swift
|
||||
//
|
||||
// Copyright © 2016 Peter Zignego. All rights reserved.
|
||||
//
|
||||
// Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||
// of this software and associated documentation files (the "Software"), to deal
|
||||
// in the Software without restriction, including without limitation the rights
|
||||
// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
||||
// copies of the Software, and to permit persons to whom the Software is
|
||||
// furnished to do so, subject to the following conditions:
|
||||
//
|
||||
// The above copyright notice and this permission notice shall be included in
|
||||
// all copies or substantial portions of the Software.
|
||||
//
|
||||
// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||
// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||
// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
||||
// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
||||
// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
||||
// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
|
||||
// THE SOFTWARE.
|
||||
|
||||
import Foundation
|
||||
import Swifter
|
||||
|
||||
internal protocol OAuthDelegate {
|
||||
func userAuthed(_ response: OAuthResponse)
|
||||
}
|
||||
|
||||
public struct OAuthServer {
|
||||
|
||||
private let oauthURL = "https://slack.com/oauth/authorize"
|
||||
|
||||
private let http = HttpServer()
|
||||
private let clientID: String
|
||||
private let clientSecret: String
|
||||
private let state: String?
|
||||
private let redirectURI: String?
|
||||
private var delegate: OAuthDelegate?
|
||||
|
||||
internal init(clientID: String, clientSecret: String, state: String? = nil, redirectURI: String? = nil, port:in_port_t = 8080, forceIPV4: Bool = false, delegate: OAuthDelegate? = nil) throws {
|
||||
self.clientID = clientID
|
||||
self.clientSecret = clientSecret
|
||||
self.state = state ?? "state"
|
||||
self.redirectURI = redirectURI
|
||||
self.delegate = delegate
|
||||
oauthRoute()
|
||||
start(port, forceIPV4: forceIPV4)
|
||||
}
|
||||
|
||||
public func start(_ port: in_port_t = 8080, forceIPV4: Bool = false) {
|
||||
do {
|
||||
try http.start(port, forceIPv4: forceIPV4)
|
||||
} catch let error as NSError {
|
||||
print("Server failed to start with error: \(error)")
|
||||
}
|
||||
}
|
||||
|
||||
public func stop() {
|
||||
http.stop()
|
||||
}
|
||||
|
||||
private func oauthRoute() {
|
||||
http["/oauth"] = { request in
|
||||
guard let response = AuthorizeResponse(queryParameters: request.queryParams), response.state == self.state else {
|
||||
return .badRequest(.text("Bad request."))
|
||||
}
|
||||
WebAPI.oauthAccess(clientID: self.clientID, clientSecret: self.clientSecret, code: response.code, redirectURI: self.redirectURI, success: {(response) in
|
||||
self.delegate?.userAuthed(OAuthResponse(response: response))
|
||||
}, failure: {(error) in
|
||||
print("Authorization failed")
|
||||
})
|
||||
if let redirect = self.redirectURI {
|
||||
return .movedPermanently(redirect)
|
||||
}
|
||||
return .ok(.text("Authentication successful."))
|
||||
}
|
||||
}
|
||||
|
||||
private func oauthURLRequest(_ authorize: AuthorizeRequest) -> URLRequest? {
|
||||
var components = URLComponents(string: "\(oauthURL)")
|
||||
components?.queryItems = [
|
||||
URLQueryItem(name: "client_id", value: "\(authorize.clientID)"),
|
||||
URLQueryItem(name: "scope", value: "\(authorize.scope)"),
|
||||
]
|
||||
guard let url = components?.url else {
|
||||
return nil
|
||||
}
|
||||
return URLRequest(url: url)
|
||||
}
|
||||
|
||||
public func authorizeRequest(_ scope:[Scope], redirectURI: String, state: String = "slackkit", team: String? = nil) -> URLRequest? {
|
||||
let request = AuthorizeRequest(clientID: clientID, scope: scope, redirectURI: redirectURI, state: state, team: team)
|
||||
return oauthURLRequest(request)
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,90 @@
|
||||
//
|
||||
// Server.swift
|
||||
//
|
||||
// Copyright © 2016 Peter Zignego. All rights reserved.
|
||||
//
|
||||
// Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||
// of this software and associated documentation files (the "Software"), to deal
|
||||
// in the Software without restriction, including without limitation the rights
|
||||
// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
||||
// copies of the Software, and to permit persons to whom the Software is
|
||||
// furnished to do so, subject to the following conditions:
|
||||
//
|
||||
// The above copyright notice and this permission notice shall be included in
|
||||
// all copies or substantial portions of the Software.
|
||||
//
|
||||
// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||
// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||
// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
||||
// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
||||
// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
||||
// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
|
||||
// THE SOFTWARE.
|
||||
|
||||
import Foundation
|
||||
import Swifter
|
||||
|
||||
internal enum Reply {
|
||||
case json(response: Response)
|
||||
case text(body: String)
|
||||
case badRequest
|
||||
}
|
||||
|
||||
internal protocol Request {
|
||||
var responseURL: String { get }
|
||||
}
|
||||
|
||||
open class Server {
|
||||
|
||||
internal let http = HttpServer()
|
||||
internal let token: String
|
||||
|
||||
internal init(token: String) {
|
||||
self.token = token
|
||||
}
|
||||
|
||||
open func start(_ port: in_port_t = 8080, forceIPV4: Bool = false) {
|
||||
do {
|
||||
try http.start(port, forceIPv4: forceIPV4)
|
||||
} catch let error as NSError {
|
||||
print("Server failed to start with error: \(error)")
|
||||
}
|
||||
}
|
||||
|
||||
open func stop() {
|
||||
http.stop()
|
||||
}
|
||||
|
||||
internal func request(_ request:Request, reply: Reply) -> HttpResponse {
|
||||
switch reply {
|
||||
case .text(let body):
|
||||
return .ok(.text(body))
|
||||
case .json(let response):
|
||||
return .ok(.json(response.json as AnyObject))
|
||||
case .badRequest:
|
||||
return .badRequest(.text("Bad request."))
|
||||
}
|
||||
}
|
||||
|
||||
internal func dictionaryFromRequest(_ body: [UInt8]) -> [String: Any]? {
|
||||
let string = String(data: Data(bytes: UnsafePointer<UInt8>(body), count: body.count), encoding: String.Encoding.utf8)
|
||||
if let body = string?.components(separatedBy: "&") {
|
||||
var dict: [String: Any] = [:]
|
||||
for argument in body {
|
||||
let kv = argument.components(separatedBy: "=")
|
||||
if let key = kv.first, let value = kv.last {
|
||||
dict[key] = value as Any?
|
||||
}
|
||||
}
|
||||
return dict
|
||||
}
|
||||
return nil
|
||||
}
|
||||
|
||||
internal func jsonFromRequest(_ string: String) -> [String: Any]? {
|
||||
guard let data = string.data(using: String.Encoding.utf8) else {
|
||||
return nil
|
||||
}
|
||||
return (try? JSONSerialization.jsonObject(with: data, options: [])) as? [String: Any] ?? nil
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,66 @@
|
||||
//
|
||||
// SlackKit.swift
|
||||
//
|
||||
// Copyright © 2016 Peter Zignego. All rights reserved.
|
||||
//
|
||||
// Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||
// of this software and associated documentation files (the "Software"), to deal
|
||||
// in the Software without restriction, including without limitation the rights
|
||||
// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
||||
// copies of the Software, and to permit persons to whom the Software is
|
||||
// furnished to do so, subject to the following conditions:
|
||||
//
|
||||
// The above copyright notice and this permission notice shall be included in
|
||||
// all copies or substantial portions of the Software.
|
||||
//
|
||||
// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||
// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||
// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
||||
// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
||||
// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
||||
// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
|
||||
// THE SOFTWARE.
|
||||
|
||||
import Foundation
|
||||
|
||||
public final class SlackKit: OAuthDelegate {
|
||||
|
||||
internal(set) public var oauth: OAuthServer?
|
||||
internal(set) public var clients: [String: Client] = [:]
|
||||
private let clientOptions: ClientOptions
|
||||
// Initalization block
|
||||
public var onClientInitalization: ((Client) -> Void)?
|
||||
|
||||
// If you already have an API token
|
||||
public init(withAPIToken token: String, clientOptions: ClientOptions = ClientOptions()) {
|
||||
self.clientOptions = clientOptions
|
||||
let client = Client(apiToken: token)
|
||||
DispatchQueue.main.async(execute: {
|
||||
self.onClientInitalization?(client)
|
||||
})
|
||||
clients[token] = client
|
||||
client.connect(options: self.clientOptions)
|
||||
}
|
||||
|
||||
// If you're going to be receiving and/or initiating OAuth requests, provide a client ID and secret
|
||||
public init(clientID: String, clientSecret: String, state: String? = nil, redirectURI: String? = nil, port:in_port_t = 8080, forceIPV4: Bool = false, clientOptions: ClientOptions = ClientOptions()) {
|
||||
self.clientOptions = clientOptions
|
||||
oauth = try? OAuthServer(clientID: clientID, clientSecret: clientSecret, state: state, redirectURI: redirectURI, port: port, forceIPV4: forceIPV4, delegate: self)
|
||||
}
|
||||
|
||||
internal func userAuthed(_ response: OAuthResponse) {
|
||||
// User auth
|
||||
if let token = response.accessToken {
|
||||
let client = Client(apiToken: token)
|
||||
self.onClientInitalization?(client)
|
||||
clients[token] = client
|
||||
}
|
||||
// Bot User
|
||||
if let token = response.bot?.botToken {
|
||||
let client = Client(apiToken: token)
|
||||
self.onClientInitalization?(client)
|
||||
clients[token] = client
|
||||
client.connect(options: self.clientOptions)
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -1,5 +1,5 @@
|
||||
//
|
||||
// SlackWebAPI.swift
|
||||
// WebAPI.swift
|
||||
//
|
||||
// Copyright © 2016 Peter Zignego. All rights reserved.
|
||||
//
|
||||
@@ -25,6 +25,7 @@ import Foundation
|
||||
|
||||
internal enum Endpoint: String {
|
||||
case apiTest = "api.test"
|
||||
case authRevoke = "auth.revoke"
|
||||
case authTest = "auth.test"
|
||||
case channelsHistory = "channels.history"
|
||||
case channelsInfo = "channels.info"
|
||||
@@ -33,8 +34,8 @@ internal enum Endpoint: String {
|
||||
case channelsSetPurpose = "channels.setPurpose"
|
||||
case channelsSetTopic = "channels.setTopic"
|
||||
case chatDelete = "chat.delete"
|
||||
case chatMeMessage = "chat.meMessage"
|
||||
case chatPostMessage = "chat.postMessage"
|
||||
case chatMeMessage = "chat.meMessage"
|
||||
case chatUpdate = "chat.update"
|
||||
case dndInfo = "dnd.info"
|
||||
case dndTeamInfo = "dnd.teamInfo"
|
||||
@@ -63,6 +64,7 @@ internal enum Endpoint: String {
|
||||
case mpimList = "mpim.list"
|
||||
case mpimMark = "mpim.mark"
|
||||
case mpimOpen = "mpim.open"
|
||||
case oauthAccess = "oauth.access"
|
||||
case pinsAdd = "pins.add"
|
||||
case pinsRemove = "pins.remove"
|
||||
case reactionsAdd = "reactions.add"
|
||||
@@ -80,7 +82,7 @@ internal enum Endpoint: String {
|
||||
case usersSetPresence = "users.setPresence"
|
||||
}
|
||||
|
||||
public class SlackWebAPI {
|
||||
public final class WebAPI {
|
||||
|
||||
public typealias FailureClosure = (_ error: SlackError)->Void
|
||||
|
||||
@@ -107,7 +109,7 @@ public class SlackWebAPI {
|
||||
|
||||
private let networkInterface: NetworkInterface
|
||||
private let token: String
|
||||
|
||||
|
||||
public init(token: String) {
|
||||
self.networkInterface = NetworkInterface()
|
||||
self.token = token
|
||||
@@ -115,94 +117,112 @@ public class SlackWebAPI {
|
||||
|
||||
//MARK: - RTM
|
||||
public func rtmStart(simpleLatest: Bool? = nil, noUnreads: Bool? = nil, mpimAware: Bool? = nil, success: ((_ response: [String: Any])->Void)?, failure: FailureClosure?) {
|
||||
let parameters: [String: Any?] = ["simple_latest": simpleLatest, "no_unreads": noUnreads, "mpim_aware": mpimAware]
|
||||
networkInterface.request(.rtmStart, token: token, parameters: filterNilParameters(parameters), successClosure: {(response) in
|
||||
success?(response)
|
||||
}) {(error) in
|
||||
failure?(error)
|
||||
}
|
||||
let parameters: [String: Any?] = ["token": token, "simple_latest": simpleLatest, "no_unreads": noUnreads, "mpim_aware": mpimAware]
|
||||
networkInterface.request(.rtmStart, parameters: parameters, successClosure: {(response) in
|
||||
success?(response)
|
||||
}) {(error) in
|
||||
failure?(error)
|
||||
}
|
||||
}
|
||||
|
||||
//MARK: - Auth Test
|
||||
//MARK: - Auth
|
||||
public func authenticationTest(success: ((_ authenticated: Bool)->Void)?, failure: FailureClosure?) {
|
||||
networkInterface.request(.authTest, token: token, parameters: nil, successClosure: {(response) in
|
||||
success?(true)
|
||||
}) {(error) in
|
||||
failure?(error)
|
||||
networkInterface.request(.authTest, parameters: ["token": token], successClosure: {(response) in
|
||||
success?(true)
|
||||
}) {(error) in
|
||||
failure?(error)
|
||||
}
|
||||
}
|
||||
|
||||
public static func oauthAccess(clientID: String, clientSecret: String, code: String, redirectURI: String? = nil, success: ((_ response: [String: Any])->Void)?, failure: ((SlackError)->Void)?) {
|
||||
let parameters: [String: Any?] = ["client_id": clientID, "client_secret": clientSecret, "code": code, "redirect_uri": redirectURI]
|
||||
NetworkInterface().request(.oauthAccess, parameters: parameters, successClosure: {(response) in
|
||||
success?(response)
|
||||
}) {(error) in
|
||||
failure?(error)
|
||||
}
|
||||
}
|
||||
|
||||
public static func oauthRevoke(token: String, test: Bool? = nil, success: ((_ revoked:Bool)->Void)?, failure: ((SlackError)->Void)?) {
|
||||
let parameters: [String: Any?] = ["token": token, "test": test]
|
||||
NetworkInterface().request(.authRevoke, parameters: parameters, successClosure: {(response) in
|
||||
success?(true)
|
||||
}) {(error) in
|
||||
failure?(error)
|
||||
}
|
||||
}
|
||||
|
||||
//MARK: - Channels
|
||||
public func channelHistory(id: String, latest: String = "\(Date().slackTimestamp)", oldest: String = "0", inclusive: Bool = false, count: Int = 100, unreads: Bool = false, success: ((_ history: History?)->Void)?, failure: FailureClosure?) {
|
||||
public func channelHistory(id: String, latest: String = "\(Date().timeIntervalSince1970)", oldest: String = "0", inclusive: Bool = false, count: Int = 100, unreads: Bool = false, success: ((_ history: History)->Void)?, failure: FailureClosure?) {
|
||||
history(.channelsHistory, id: id, latest: latest, oldest: oldest, inclusive: inclusive, count: count, unreads: unreads, success: {(history) in
|
||||
success?(history)
|
||||
}) {(error) in
|
||||
failure?(error)
|
||||
success?(history)
|
||||
}) {(error) in
|
||||
failure?(error)
|
||||
}
|
||||
}
|
||||
|
||||
public func channelInfo(id: String, success: ((_ channel: Channel)->Void)?, failure: FailureClosure?) {
|
||||
info(.channelsInfo, type:.channel, id: id, success: {(channel) in
|
||||
success?(channel)
|
||||
}) {(error) in
|
||||
failure?(error)
|
||||
success?(channel)
|
||||
}) {(error) in
|
||||
failure?(error)
|
||||
}
|
||||
}
|
||||
|
||||
public func channelsList(excludeArchived: Bool = false, success: ((_ channels: [[String: Any]]?)->Void)?, failure: FailureClosure?) {
|
||||
list(.channelsList, type:.channel, excludeArchived: excludeArchived, success: {(channels) in
|
||||
success?(channels)
|
||||
}) {(error) in
|
||||
failure?(error)
|
||||
success?(channels)
|
||||
}) {(error) in
|
||||
failure?(error)
|
||||
}
|
||||
}
|
||||
|
||||
public func markChannel(channel: String, timestamp: String, success: ((_ ts: String)->Void)?, failure: FailureClosure?) {
|
||||
mark(.channelsMark, channel: channel, timestamp: timestamp, success: {(ts) in
|
||||
success?(timestamp)
|
||||
}) {(error) in
|
||||
failure?(error)
|
||||
success?(timestamp)
|
||||
}) {(error) in
|
||||
failure?(error)
|
||||
}
|
||||
}
|
||||
|
||||
public func setChannelPurpose(channel: String, purpose: String, success: ((_ purposeSet: Bool)->Void)?, failure: FailureClosure?) {
|
||||
setInfo(.channelsSetPurpose, type: .purpose, channel: channel, text: purpose, success: {(purposeSet) in
|
||||
success?(purposeSet)
|
||||
}) { (error) in
|
||||
failure?(error)
|
||||
success?(purposeSet)
|
||||
}) {(error) in
|
||||
failure?(error)
|
||||
}
|
||||
}
|
||||
|
||||
public func setChannelTopic(channel: String, topic: String, success: ((_ topicSet: Bool)->Void)?, failure: FailureClosure?) {
|
||||
setInfo(.channelsSetTopic, type: .topic, channel: channel, text: topic, success: {(topicSet) in
|
||||
success?(topicSet)
|
||||
}) {(error) in
|
||||
failure?(error)
|
||||
success?(topicSet)
|
||||
}) {(error) in
|
||||
failure?(error)
|
||||
}
|
||||
}
|
||||
|
||||
//MARK: - Messaging
|
||||
public func deleteMessage(channel: String, ts: String, success: ((_ deleted: Bool)->Void)?, failure: FailureClosure?) {
|
||||
let parameters: [String: Any] = ["channel": channel, "ts": ts]
|
||||
networkInterface.request(.chatDelete, token: token, parameters: parameters, successClosure: {(response) in
|
||||
success?(true)
|
||||
}) {(error) in
|
||||
failure?(error)
|
||||
let parameters: [String: Any] = ["token": token, "channel": channel, "ts": ts]
|
||||
networkInterface.request(.chatDelete, parameters: parameters, successClosure: {(response) in
|
||||
success?(true)
|
||||
}) {(error) in
|
||||
failure?(error)
|
||||
}
|
||||
}
|
||||
|
||||
public func sendMessage(channel: String, text: String, username: String? = nil, asUser: Bool? = nil, parse: ParseMode? = nil, linkNames: Bool? = nil, attachments: [Attachment?]? = nil, unfurlLinks: Bool? = nil, unfurlMedia: Bool? = nil, iconURL: String? = nil, iconEmoji: String? = nil, success: (((ts: String?, channel: String?))->Void)?, failure: FailureClosure?) {
|
||||
let parameters: [String: Any?] = ["channel":channel, "text":text.slackFormatEscaping, "as_user":asUser, "parse":parse?.rawValue, "link_names":linkNames, "unfurl_links":unfurlLinks, "unfurlMedia":unfurlMedia, "username":username, "attachments":encodeAttachments(attachments), "icon_url":iconURL, "icon_emoji":iconEmoji]
|
||||
networkInterface.request(.chatPostMessage, token: token, parameters: filterNilParameters(parameters), successClosure: {(response) in
|
||||
success?((ts: response["ts"] as? String, response["channel"] as? String))
|
||||
}) {(error) in
|
||||
failure?(error)
|
||||
let parameters: [String: Any?] = ["token": token, "channel": channel, "text": text.slackFormatEscaping, "as_user": asUser, "parse": parse?.rawValue, "link_names": linkNames, "unfurl_links": unfurlLinks, "unfurlMedia": unfurlMedia, "username": username, "icon_url": iconURL, "icon_emoji": iconEmoji, "attachments": encodeAttachments(attachments)]
|
||||
networkInterface.request(.chatPostMessage, parameters: parameters, successClosure: {(response) in
|
||||
success?((ts: response["ts"] as? String, response["channel"] as? String))
|
||||
}) {(error) in
|
||||
failure?(error)
|
||||
}
|
||||
}
|
||||
|
||||
public func sendMeMessage(_ channel: String, text: String, success: (((ts: String?, channel: String?))->Void)?, failure: FailureClosure?) {
|
||||
let parameters: [String: Any?] = ["channel": channel, "text": text.slackFormatEscaping]
|
||||
networkInterface.request(.chatMeMessage, token: token, parameters: filterNilParameters(parameters), successClosure: {(response) in
|
||||
public func sendMeMessage(channel: String, text: String, success: (((ts: String?, channel: String?))->Void)?, failure: FailureClosure?) {
|
||||
let parameters: [String: Any?] = ["token": token, "channel": channel, "text": text.slackFormatEscaping]
|
||||
networkInterface.request(.chatMeMessage, parameters: parameters, successClosure: {(response) in
|
||||
success?((ts: response["ts"] as? String, response["channel"] as? String))
|
||||
}) {(error) in
|
||||
failure?(error)
|
||||
@@ -210,59 +230,59 @@ public class SlackWebAPI {
|
||||
}
|
||||
|
||||
public func updateMessage(channel: String, ts: String, message: String, attachments: [Attachment?]? = nil, parse:ParseMode = .none, linkNames: Bool = false, success: ((_ updated: Bool)->Void)?, failure: FailureClosure?) {
|
||||
let parameters: [String: Any?] = ["channel": channel, "ts": ts, "text": message.slackFormatEscaping, "parse": parse.rawValue, "link_names": linkNames, "attachments":encodeAttachments(attachments)]
|
||||
networkInterface.request(.chatUpdate, token: token, parameters: filterNilParameters(parameters), successClosure: {(response) in
|
||||
success?(true)
|
||||
}) {(error) in
|
||||
failure?(error)
|
||||
let parameters: [String: Any?] = ["token": token, "channel": channel, "ts": ts, "text": message.slackFormatEscaping, "parse": parse.rawValue, "link_names": linkNames, "attachments": encodeAttachments(attachments)]
|
||||
networkInterface.request(.chatUpdate, parameters: parameters, successClosure: {(response) in
|
||||
success?(true)
|
||||
}) {(error) in
|
||||
failure?(error)
|
||||
}
|
||||
}
|
||||
|
||||
//MARK: - Do Not Disturb
|
||||
public func dndInfo(user: String? = nil, success: ((_ status: DoNotDisturbStatus)->Void)?, failure: FailureClosure?) {
|
||||
let parameters: [String: Any?] = ["user": user]
|
||||
networkInterface.request(.dndInfo, token: token, parameters: filterNilParameters(parameters), successClosure: {(response) in
|
||||
success?(DoNotDisturbStatus(status: response))
|
||||
}) {(error) in
|
||||
failure?(error)
|
||||
let parameters: [String: Any?] = ["token": token, "user": user]
|
||||
networkInterface.request(.dndInfo, parameters: parameters, successClosure: {(response) in
|
||||
success?(DoNotDisturbStatus(status: response))
|
||||
}) {(error) in
|
||||
failure?(error)
|
||||
}
|
||||
}
|
||||
|
||||
public func dndTeamInfo(users: [String]? = nil, success: ((_ statuses: [String: DoNotDisturbStatus])->Void)?, failure: FailureClosure?) {
|
||||
let parameters: [String: Any?] = ["users":users?.joined(separator: ",")]
|
||||
networkInterface.request(.dndTeamInfo, token: token, parameters: filterNilParameters(parameters), successClosure: {(response) in
|
||||
let parameters: [String: Any?] = ["token": token, "users": users?.joined(separator: ",")]
|
||||
networkInterface.request(.dndTeamInfo, parameters: parameters, successClosure: {(response) in
|
||||
guard let usersDictionary = response["users"] as? [String: Any] else {
|
||||
success?([:])
|
||||
return
|
||||
}
|
||||
success?(self.enumerateDNDStatuses(usersDictionary))
|
||||
}) {(error) in
|
||||
failure?(error)
|
||||
}) {(error) in
|
||||
failure?(error)
|
||||
}
|
||||
}
|
||||
|
||||
//MARK: - Emoji
|
||||
public func emojiList(success: ((_ emojiList: [String: Any]?)->Void)?, failure: FailureClosure?) {
|
||||
networkInterface.request(.emojiList, token: token, parameters: nil, successClosure: {(response) in
|
||||
success?(response["emoji"] as? [String: Any])
|
||||
}) {(error) in
|
||||
failure?(error)
|
||||
networkInterface.request(.emojiList, parameters: ["token": token], successClosure: {(response) in
|
||||
success?(response["emoji"] as? [String: Any])
|
||||
}) {(error) in
|
||||
failure?(error)
|
||||
}
|
||||
}
|
||||
|
||||
//MARK: - Files
|
||||
public func deleteFile(fileID: String, success: ((_ deleted: Bool)->Void)?, failure: FailureClosure?) {
|
||||
let parameters = ["file":fileID]
|
||||
networkInterface.request(.filesDelete, token: token, parameters: parameters, successClosure: {(response) in
|
||||
success?(true)
|
||||
}) {(error) in
|
||||
failure?(error)
|
||||
let parameters = ["token": token, "file": fileID]
|
||||
networkInterface.request(.filesDelete, parameters: parameters, successClosure: {(response) in
|
||||
success?(true)
|
||||
}) {(error) in
|
||||
failure?(error)
|
||||
}
|
||||
}
|
||||
|
||||
public func fileInfo(_ fileID: String, commentCount: Int = 100, totalPages: Int = 1, success: ((_ file: File)->Void)?, failure: FailureClosure?) {
|
||||
let parameters: [String: Any] = ["file": fileID, "count": commentCount, "totalPages": totalPages]
|
||||
networkInterface.request(.filesInfo, token: token, parameters: parameters, successClosure: {(response) in
|
||||
public func fileInfo(fileID: String, commentCount: Int = 100, totalPages: Int = 1, success: ((_ file: File)->Void)?, failure: FailureClosure?) {
|
||||
let parameters: [String: Any] = ["token": token, "file": fileID, "count": commentCount, "totalPages": totalPages]
|
||||
networkInterface.request(.filesInfo, parameters: parameters, successClosure: {(response) in
|
||||
var file = File(file: response["file"] as? [String: Any])
|
||||
(response["comments"] as? [[String: Any]])?.forEach { comment in
|
||||
let comment = Comment(comment: comment)
|
||||
@@ -276,9 +296,9 @@ public class SlackWebAPI {
|
||||
}
|
||||
}
|
||||
|
||||
public func uploadFile(_ file: Data, filename: String, filetype: String = "auto", title: String? = nil, initialComment: String? = nil, channels: [String]? = nil, success: ((_ file: File)->Void)?, failure: FailureClosure?) {
|
||||
let parameters: [String: Any?] = ["filename": filename, "filetype": filetype, "title": title, "initial_comment": initialComment, "channels": channels?.joined(separator: ",")]
|
||||
networkInterface.uploadRequest(token: token, data: file, parameters: filterNilParameters(parameters), successClosure: {(response) in
|
||||
public func uploadFile(file: Data, filename: String, filetype: String = "auto", title: String? = nil, initialComment: String? = nil, channels: [String]? = nil, success: ((_ file: File)->Void)?, failure: FailureClosure?) {
|
||||
let parameters: [String: Any?] = ["token": token, "filename": filename, "filetype": filetype, "title": title, "initial_comment": initialComment, "channels": channels?.joined(separator: ",")]
|
||||
networkInterface.uploadRequest(data: file, parameters: parameters, successClosure: {(response) in
|
||||
success?(File(file: response["file"] as? [String: Any]))
|
||||
}) {(error) in
|
||||
failure?(error)
|
||||
@@ -287,207 +307,207 @@ public class SlackWebAPI {
|
||||
|
||||
//MARK: - File Comments
|
||||
public func addFileComment(fileID: String, comment: String, success: ((_ comment: Comment)->Void)?, failure: FailureClosure?) {
|
||||
let parameters: [String: Any] = ["file":fileID, "comment":comment.slackFormatEscaping]
|
||||
networkInterface.request(.filesCommentsAdd, token: token, parameters: parameters, successClosure: {(response) in
|
||||
success?(Comment(comment: response["comment"] as? [String: Any]))
|
||||
}) {(error) in
|
||||
failure?(error)
|
||||
let parameters: [String: Any] = ["token": token, "file": fileID, "comment": comment.slackFormatEscaping]
|
||||
networkInterface.request(.filesCommentsAdd, parameters: parameters, successClosure: {(response) in
|
||||
success?(Comment(comment: response["comment"] as? [String: Any]))
|
||||
}) {(error) in
|
||||
failure?(error)
|
||||
}
|
||||
}
|
||||
|
||||
public func editFileComment(fileID: String, commentID: String, comment: String, success: ((_ comment: Comment)->Void)?, failure: FailureClosure?) {
|
||||
let parameters: [String: Any] = ["file":fileID, "id":commentID, "comment":comment.slackFormatEscaping]
|
||||
networkInterface.request(.filesCommentsEdit, token: token, parameters: parameters, successClosure: {(response) in
|
||||
let parameters: [String: Any] = ["token": token, "file": fileID, "id": commentID, "comment": comment.slackFormatEscaping]
|
||||
networkInterface.request(.filesCommentsEdit, parameters: parameters, successClosure: {(response) in
|
||||
success?(Comment(comment: response["comment"] as? [String: Any]))
|
||||
}) {(error) in
|
||||
failure?(error)
|
||||
}) {(error) in
|
||||
failure?(error)
|
||||
}
|
||||
}
|
||||
|
||||
public func deleteFileComment(fileID: String, commentID: String, success: ((_ deleted: Bool?)->Void)?, failure: FailureClosure?) {
|
||||
let parameters: [String: Any] = ["file":fileID, "id": commentID]
|
||||
networkInterface.request(.filesCommentsDelete, token: token, parameters: parameters, successClosure: {(response) in
|
||||
success?(true)
|
||||
}) {(error) in
|
||||
failure?(error)
|
||||
let parameters: [String: Any] = ["token": token, "file": fileID, "id": commentID]
|
||||
networkInterface.request(.filesCommentsDelete, parameters: parameters, successClosure: {(response) in
|
||||
success?(true)
|
||||
}) {(error) in
|
||||
failure?(error)
|
||||
}
|
||||
}
|
||||
|
||||
//MARK: - Groups
|
||||
public func closeGroup(groupID: String, success: ((_ closed: Bool)->Void)?, failure: FailureClosure?) {
|
||||
close(.groupsClose, channelID: groupID, success: {(closed) in
|
||||
success?(closed)
|
||||
}) {(error) in
|
||||
failure?(error)
|
||||
success?(closed)
|
||||
}) {(error) in
|
||||
failure?(error)
|
||||
}
|
||||
}
|
||||
|
||||
public func groupHistory(id: String, latest: String = "\(Date().slackTimestamp)", oldest: String = "0", inclusive: Bool = false, count: Int = 100, unreads: Bool = false, success: ((_ history: History?)->Void)?, failure: FailureClosure?) {
|
||||
public func groupHistory(id: String, latest: String = "\(Date().timeIntervalSince1970)", oldest: String = "0", inclusive: Bool = false, count: Int = 100, unreads: Bool = false, success: ((_ history: History)->Void)?, failure: FailureClosure?) {
|
||||
history(.groupsHistory, id: id, latest: latest, oldest: oldest, inclusive: inclusive, count: count, unreads: unreads, success: {(history) in
|
||||
success?(history)
|
||||
}) {(error) in
|
||||
failure?(error)
|
||||
success?(history)
|
||||
}) {(error) in
|
||||
failure?(error)
|
||||
}
|
||||
}
|
||||
|
||||
public func groupInfo(id: String, success: ((_ channel: Channel?)->Void)?, failure: FailureClosure?) {
|
||||
public func groupInfo(id: String, success: ((_ channel: Channel)->Void)?, failure: FailureClosure?) {
|
||||
info(.groupsInfo, type:.group, id: id, success: {(channel) in
|
||||
success?(channel)
|
||||
}) {(error) in
|
||||
failure?(error)
|
||||
success?(channel)
|
||||
}) {(error) in
|
||||
failure?(error)
|
||||
}
|
||||
}
|
||||
|
||||
public func groupsList(excludeArchived: Bool = false, success: ((_ channels: [[String: Any]]?)->Void)?, failure: FailureClosure?) {
|
||||
list(.groupsList, type:.group, excludeArchived: excludeArchived, success: {(channels) in
|
||||
success?(channels)
|
||||
}) {(error) in
|
||||
failure?(error)
|
||||
success?(channels)
|
||||
}) {(error) in
|
||||
failure?(error)
|
||||
}
|
||||
}
|
||||
|
||||
public func markGroup(channel: String, timestamp: String, success: ((_ ts: String)->Void)?, failure: FailureClosure?) {
|
||||
mark(.groupsMark, channel: channel, timestamp: timestamp, success: {(ts) in
|
||||
success?(timestamp)
|
||||
}) {(error) in
|
||||
failure?(error)
|
||||
success?(timestamp)
|
||||
}) {(error) in
|
||||
failure?(error)
|
||||
}
|
||||
}
|
||||
|
||||
public func openGroup(channel: String, success: ((_ opened: Bool)->Void)?, failure: FailureClosure?) {
|
||||
let parameters = ["channel":channel]
|
||||
networkInterface.request(.groupsOpen, token: token, parameters: parameters, successClosure: {(response) in
|
||||
success?(true)
|
||||
}) {(error) in
|
||||
failure?(error)
|
||||
let parameters = ["token": token, "channel":channel]
|
||||
networkInterface.request(.groupsOpen, parameters: parameters, successClosure: {(response) in
|
||||
success?(true)
|
||||
}) {(error) in
|
||||
failure?(error)
|
||||
}
|
||||
}
|
||||
|
||||
public func setGroupPurpose(channel: String, purpose: String, success: ((_ purposeSet: Bool)->Void)?, failure: FailureClosure?) {
|
||||
setInfo(.groupsSetPurpose, type: .purpose, channel: channel, text: purpose, success: {(purposeSet) in
|
||||
success?(purposeSet)
|
||||
}) {(error) in
|
||||
failure?(error)
|
||||
success?(purposeSet)
|
||||
}) {(error) in
|
||||
failure?(error)
|
||||
}
|
||||
}
|
||||
|
||||
public func setGroupTopic(channel: String, topic: String, success: ((_ topicSet: Bool)->Void)?, failure: FailureClosure?) {
|
||||
setInfo(.groupsSetTopic, type: .topic, channel: channel, text: topic, success: {(topicSet) in
|
||||
success?(topicSet)
|
||||
}) {(error) in
|
||||
failure?(error)
|
||||
success?(topicSet)
|
||||
}) {(error) in
|
||||
failure?(error)
|
||||
}
|
||||
}
|
||||
|
||||
//MARK: - IM
|
||||
public func closeIM(channel: String, success: ((_ closed: Bool)->Void)?, failure: FailureClosure?) {
|
||||
close(.imClose, channelID: channel, success: {(closed) in
|
||||
success?(closed)
|
||||
}) {(error) in
|
||||
failure?(error)
|
||||
success?(closed)
|
||||
}) {(error) in
|
||||
failure?(error)
|
||||
}
|
||||
}
|
||||
|
||||
public func imHistory(id: String, latest: String = "\(Date().slackTimestamp)", oldest: String = "0", inclusive: Bool = false, count: Int = 100, unreads: Bool = false, success: ((_ history: History?)->Void)?, failure: FailureClosure?) {
|
||||
public func imHistory(id: String, latest: String = "\(Date().timeIntervalSince1970)", oldest: String = "0", inclusive: Bool = false, count: Int = 100, unreads: Bool = false, success: ((_ history: History)->Void)?, failure: FailureClosure?) {
|
||||
history(.imHistory, id: id, latest: latest, oldest: oldest, inclusive: inclusive, count: count, unreads: unreads, success: {(history) in
|
||||
success?(history)
|
||||
}) {(error) in
|
||||
failure?(error)
|
||||
success?(history)
|
||||
}) {(error) in
|
||||
failure?(error)
|
||||
}
|
||||
}
|
||||
|
||||
public func imsList(excludeArchived: Bool = false, success: ((_ channels: [[String: Any]]?)->Void)?, failure: FailureClosure?) {
|
||||
list(.imList, type:.im, excludeArchived: excludeArchived, success: {(channels) in
|
||||
success?(channels)
|
||||
}) {(error) in
|
||||
failure?(error)
|
||||
success?(channels)
|
||||
}) {(error) in
|
||||
failure?(error)
|
||||
}
|
||||
}
|
||||
|
||||
public func markIM(channel: String, timestamp: String, success: ((_ ts: String)->Void)?, failure: FailureClosure?) {
|
||||
mark(.imMark, channel: channel, timestamp: timestamp, success: {(ts) in
|
||||
success?(timestamp)
|
||||
}) {(error) in
|
||||
failure?(error)
|
||||
success?(timestamp)
|
||||
}) {(error) in
|
||||
failure?(error)
|
||||
}
|
||||
}
|
||||
|
||||
public func openIM(userID: String, success: ((_ imID: String?)->Void)?, failure: FailureClosure?) {
|
||||
let parameters = ["user":userID]
|
||||
networkInterface.request(.imOpen, token: token, parameters: parameters, successClosure: {(response) in
|
||||
let group = response["channel"] as? [String: Any]
|
||||
success?(group?["id"] as? String)
|
||||
}) {(error) in
|
||||
failure?(error)
|
||||
let parameters = ["token": token, "user": userID]
|
||||
networkInterface.request(.imOpen, parameters: parameters, successClosure: {(response) in
|
||||
let group = response["channel"] as? [String: Any]
|
||||
success?(group?["id"] as? String)
|
||||
}) {(error) in
|
||||
failure?(error)
|
||||
}
|
||||
}
|
||||
|
||||
//MARK: - MPIM
|
||||
public func closeMPIM(channel: String, success: ((_ closed: Bool)->Void)?, failure: FailureClosure?) {
|
||||
close(.mpimClose, channelID: channel, success: {(closed) in
|
||||
success?(closed)
|
||||
}) {(error) in
|
||||
failure?(error)
|
||||
success?(closed)
|
||||
}) {(error) in
|
||||
failure?(error)
|
||||
}
|
||||
}
|
||||
|
||||
public func mpimHistory(id: String, latest: String = "\(Date().slackTimestamp)", oldest: String = "0", inclusive: Bool = false, count: Int = 100, unreads: Bool = false, success: ((_ history: History?)->Void)?, failure: FailureClosure?) {
|
||||
public func mpimHistory(id: String, latest: String = "\(Date().timeIntervalSince1970)", oldest: String = "0", inclusive: Bool = false, count: Int = 100, unreads: Bool = false, success: ((_ history: History)->Void)?, failure: FailureClosure?) {
|
||||
history(.mpimHistory, id: id, latest: latest, oldest: oldest, inclusive: inclusive, count: count, unreads: unreads, success: {(history) in
|
||||
success?(history)
|
||||
}) {(error) in
|
||||
failure?(error)
|
||||
success?(history)
|
||||
}) {(error) in
|
||||
failure?(error)
|
||||
}
|
||||
}
|
||||
|
||||
public func mpimsList(excludeArchived: Bool = false, success: ((_ channels: [[String: Any]]?)->Void)?, failure: FailureClosure?) {
|
||||
list(.mpimList, type:.group, excludeArchived: excludeArchived, success: {(channels) in
|
||||
success?(channels)
|
||||
}) {(error) in
|
||||
failure?(error)
|
||||
success?(channels)
|
||||
}) {(error) in
|
||||
failure?(error)
|
||||
}
|
||||
}
|
||||
|
||||
public func markMPIM(channel: String, timestamp: String, success: ((_ ts: String)->Void)?, failure: FailureClosure?) {
|
||||
mark(.mpimMark, channel: channel, timestamp: timestamp, success: {(ts) in
|
||||
success?(timestamp)
|
||||
}) {(error) in
|
||||
failure?(error)
|
||||
success?(timestamp)
|
||||
}) {(error) in
|
||||
failure?(error)
|
||||
}
|
||||
}
|
||||
|
||||
public func openMPIM(userIDs: [String], success: ((_ mpimID: String?)->Void)?, failure: FailureClosure?) {
|
||||
let parameters = ["users":userIDs.joined(separator: ",")]
|
||||
networkInterface.request(.mpimOpen, token: token, parameters: parameters, successClosure: {(response) in
|
||||
let group = response["group"] as? [String: Any]
|
||||
success?(group?["id"] as? String)
|
||||
}) {(error) in
|
||||
failure?(error)
|
||||
let parameters = ["token": token, "users": userIDs.joined(separator: ",")]
|
||||
networkInterface.request(.mpimOpen, parameters: parameters, successClosure: {(response) in
|
||||
let group = response["group"] as? [String: Any]
|
||||
success?(group?["id"] as? String)
|
||||
}) {(error) in
|
||||
failure?(error)
|
||||
}
|
||||
}
|
||||
|
||||
//MARK: - Pins
|
||||
public func pinItem(channel: String, file: String? = nil, fileComment: String? = nil, timestamp: String? = nil, success: ((_ pinned: Bool)->Void)?, failure: FailureClosure?) {
|
||||
pin(.pinsAdd, channel: channel, file: file, fileComment: fileComment, timestamp: timestamp, success: {(ok) in
|
||||
success?(ok)
|
||||
}) {(error) in
|
||||
failure?(error)
|
||||
success?(ok)
|
||||
}) {(error) in
|
||||
failure?(error)
|
||||
}
|
||||
}
|
||||
|
||||
public func unpinItem(channel: String, file: String? = nil, fileComment: String? = nil, timestamp: String? = nil, success: ((_ unpinned: Bool)->Void)?, failure: FailureClosure?) {
|
||||
pin(.pinsRemove, channel: channel, file: file, fileComment: fileComment, timestamp: timestamp, success: {(ok) in
|
||||
success?(ok)
|
||||
}) {(error) in
|
||||
failure?(error)
|
||||
success?(ok)
|
||||
}) {(error) in
|
||||
failure?(error)
|
||||
}
|
||||
}
|
||||
|
||||
private func pin(_ endpoint: Endpoint, channel: String, file: String? = nil, fileComment: String? = nil, timestamp: String? = nil, success: ((_ ok: Bool)->Void)?, failure: FailureClosure?) {
|
||||
let parameters: [String: Any?] = ["channel":channel, "file":file, "file_comment":fileComment, "timestamp":timestamp]
|
||||
networkInterface.request(endpoint, token: token, parameters: filterNilParameters(parameters), successClosure: {(response) in
|
||||
success?(true)
|
||||
}) {(error) in
|
||||
failure?(error)
|
||||
let parameters: [String: Any?] = ["token": token, "channel": channel, "file": file, "file_comment": fileComment, "timestamp": timestamp]
|
||||
networkInterface.request(endpoint, parameters: parameters, successClosure: {(response) in
|
||||
success?(true)
|
||||
}) {(error) in
|
||||
failure?(error)
|
||||
}
|
||||
}
|
||||
|
||||
@@ -495,27 +515,27 @@ public class SlackWebAPI {
|
||||
// One of file, file_comment, or the combination of channel and timestamp must be specified.
|
||||
public func addReaction(name: String, file: String? = nil, fileComment: String? = nil, channel: String? = nil, timestamp: String? = nil, success: ((_ reacted: Bool)->Void)?, failure: FailureClosure?) {
|
||||
react(.reactionsAdd, name: name, file: file, fileComment: fileComment, channel: channel, timestamp: timestamp, success: {(ok) in
|
||||
success?(ok)
|
||||
}) {(error) in
|
||||
failure?(error)
|
||||
success?(ok)
|
||||
}) {(error) in
|
||||
failure?(error)
|
||||
}
|
||||
}
|
||||
|
||||
// One of file, file_comment, or the combination of channel and timestamp must be specified.
|
||||
public func removeReaction(name: String, file: String? = nil, fileComment: String? = nil, channel: String? = nil, timestamp: String? = nil, success: ((_ unreacted: Bool)->Void)?, failure: FailureClosure?) {
|
||||
react(.reactionsRemove, name: name, file: file, fileComment: fileComment, channel: channel, timestamp: timestamp, success: {(ok) in
|
||||
success?(ok)
|
||||
}) {(error) in
|
||||
failure?(error)
|
||||
success?(ok)
|
||||
}) {(error) in
|
||||
failure?(error)
|
||||
}
|
||||
}
|
||||
|
||||
private func react(_ endpoint: Endpoint, name: String, file: String? = nil, fileComment: String? = nil, channel: String? = nil, timestamp: String? = nil, success: ((_ ok: Bool)->Void)?, failure: FailureClosure?) {
|
||||
let parameters: [String: Any?] = ["name":name, "file":file, "file_comment":fileComment, "channel":channel, "timestamp":timestamp]
|
||||
networkInterface.request(endpoint, token: token, parameters: filterNilParameters(parameters), successClosure: {(response) in
|
||||
success?(true)
|
||||
}) {(error) in
|
||||
failure?(error)
|
||||
let parameters: [String: Any?] = ["token": token, "name": name, "file": file, "file_comment": fileComment, "channel": channel, "timestamp": timestamp]
|
||||
networkInterface.request(endpoint, parameters: parameters, successClosure: {(response) in
|
||||
success?(true)
|
||||
}) {(error) in
|
||||
failure?(error)
|
||||
}
|
||||
}
|
||||
|
||||
@@ -523,137 +543,137 @@ public class SlackWebAPI {
|
||||
// One of file, file_comment, channel, or the combination of channel and timestamp must be specified.
|
||||
public func addStar(file: String? = nil, fileComment: String? = nil, channel: String? = nil, timestamp: String? = nil, success: ((_ starred: Bool)->Void)?, failure: FailureClosure?) {
|
||||
star(.starsAdd, file: file, fileComment: fileComment, channel: channel, timestamp: timestamp, success: {(ok) in
|
||||
success?(ok)
|
||||
}) {(error) in
|
||||
failure?(error)
|
||||
success?(ok)
|
||||
}) {(error) in
|
||||
failure?(error)
|
||||
}
|
||||
}
|
||||
|
||||
// One of file, file_comment, channel, or the combination of channel and timestamp must be specified.
|
||||
public func removeStar(file: String? = nil, fileComment: String? = nil, channel: String? = nil, timestamp: String? = nil, success: ((_ unstarred: Bool)->Void)?, failure: FailureClosure?) {
|
||||
star(.starsRemove, file: file, fileComment: fileComment, channel: channel, timestamp: timestamp, success: {(ok) in
|
||||
success?(ok)
|
||||
}) {(error) in
|
||||
failure?(error)
|
||||
success?(ok)
|
||||
}) {(error) in
|
||||
failure?(error)
|
||||
}
|
||||
}
|
||||
|
||||
private func star(_ endpoint: Endpoint, file: String?, fileComment: String?, channel: String?, timestamp: String?, success: ((_ ok: Bool)->Void)?, failure: FailureClosure?) {
|
||||
let parameters: [String: Any?] = ["file":file, "file_comment":fileComment, "channel":channel, "timestamp":timestamp]
|
||||
networkInterface.request(endpoint, token: token, parameters: filterNilParameters(parameters), successClosure: {(response) in
|
||||
success?(true)
|
||||
}) {(error) in
|
||||
failure?(error)
|
||||
let parameters: [String: Any?] = ["token": token, "file": file, "file_comment": fileComment, "channel": channel, "timestamp": timestamp]
|
||||
networkInterface.request(endpoint, parameters: parameters, successClosure: {(response) in
|
||||
success?(true)
|
||||
}) {(error) in
|
||||
failure?(error)
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
//MARK: - Team
|
||||
public func teamInfo(success: ((_ info: [String: Any]?)->Void)?, failure: FailureClosure?) {
|
||||
networkInterface.request(.teamInfo, token: token, parameters: nil, successClosure: {(response) in
|
||||
success?(response["team"] as? [String: Any])
|
||||
}) {(error) in
|
||||
failure?(error)
|
||||
networkInterface.request(.teamInfo, parameters: ["token": token], successClosure: {(response) in
|
||||
success?(response["team"] as? [String: Any])
|
||||
}) {(error) in
|
||||
failure?(error)
|
||||
}
|
||||
}
|
||||
|
||||
//MARK: - Users
|
||||
public func userPresence(user: String, success: ((_ presence: String?)->Void)?, failure: FailureClosure?) {
|
||||
let parameters: [String: Any] = ["user":user]
|
||||
networkInterface.request(.usersGetPresence, token: token, parameters: parameters, successClosure: {(response) in
|
||||
success?(response["presence"] as? String)
|
||||
}) {(error) in
|
||||
failure?(error)
|
||||
let parameters: [String: Any] = ["token": token, "user": user]
|
||||
networkInterface.request(.usersGetPresence, parameters: parameters, successClosure: {(response) in
|
||||
success?(response["presence"] as? String)
|
||||
}) {(error) in
|
||||
failure?(error)
|
||||
}
|
||||
}
|
||||
|
||||
public func userInfo(id: String, success: ((_ user: User)->Void)?, failure: FailureClosure?) {
|
||||
let parameters: [String: Any] = ["user":id]
|
||||
networkInterface.request(.usersInfo, token: token, parameters: parameters, successClosure: {(response) in
|
||||
success?(User(user: response["user"] as? [String: Any]))
|
||||
}) {(error) in
|
||||
failure?(error)
|
||||
let parameters: [String: Any] = ["token": token, "user": id]
|
||||
networkInterface.request(.usersInfo, parameters: parameters, successClosure: {(response) in
|
||||
success?(User(user: response["user"] as? [String: Any]))
|
||||
}) {(error) in
|
||||
failure?(error)
|
||||
}
|
||||
}
|
||||
|
||||
public func usersList(includePresence: Bool = false, success: ((_ userList: [[String: Any]]?)->Void)?, failure: FailureClosure?) {
|
||||
let parameters: [String: Any] = ["presence":includePresence]
|
||||
networkInterface.request(.usersList, token: token, parameters: parameters, successClosure: {(response) in
|
||||
success?(response["members"] as? [[String: Any]])
|
||||
}) {(error) in
|
||||
failure?(error)
|
||||
let parameters: [String: Any] = ["token": token, "presence": includePresence]
|
||||
networkInterface.request(.usersList, parameters: parameters, successClosure: {(response) in
|
||||
success?(response["members"] as? [[String: Any]])
|
||||
}) {(error) in
|
||||
failure?(error)
|
||||
}
|
||||
}
|
||||
|
||||
public func setUserActive(success: ((_ success: Bool)->Void)?, failure: FailureClosure?) {
|
||||
networkInterface.request(.usersSetActive, token: token, parameters: nil, successClosure: {(response) in
|
||||
success?(true)
|
||||
}) {(error) in
|
||||
failure?(error)
|
||||
networkInterface.request(.usersSetActive, parameters: ["token": token], successClosure: {(response) in
|
||||
success?(true)
|
||||
}) {(error) in
|
||||
failure?(error)
|
||||
}
|
||||
}
|
||||
|
||||
public func setUserPresence(presence: Presence, success: ((_ success: Bool)->Void)?, failure: FailureClosure?) {
|
||||
let parameters: [String: Any] = ["presence":presence.rawValue]
|
||||
networkInterface.request(.usersSetPresence, token: token, parameters: parameters, successClosure: {(response) in
|
||||
success?(true)
|
||||
}) {(error) in
|
||||
failure?(error)
|
||||
let parameters: [String: Any] = ["token": token, "presence": presence.rawValue]
|
||||
networkInterface.request(.usersSetPresence, parameters: parameters, successClosure: {(response) in
|
||||
success?(true)
|
||||
}) {(error) in
|
||||
failure?(error)
|
||||
}
|
||||
}
|
||||
|
||||
//MARK: - Channel Utilities
|
||||
private func close(_ endpoint: Endpoint, channelID: String, success: ((_ closed: Bool)->Void)?, failure: FailureClosure?) {
|
||||
let parameters: [String: Any] = ["channel":channelID]
|
||||
networkInterface.request(endpoint, token: token, parameters: parameters, successClosure: {(response) in
|
||||
success?(true)
|
||||
}) {(error) in
|
||||
failure?(error)
|
||||
let parameters: [String: Any] = ["token": token, "channel": channelID]
|
||||
networkInterface.request(endpoint, parameters: parameters, successClosure: {(response) in
|
||||
success?(true)
|
||||
}) {(error) in
|
||||
failure?(error)
|
||||
}
|
||||
}
|
||||
|
||||
private func history(_ endpoint: Endpoint, id: String, latest: String = "\(Date().slackTimestamp)", oldest: String = "0", inclusive: Bool = false, count: Int = 100, unreads: Bool = false, success: ((_ history: History)->Void)?, failure: FailureClosure?) {
|
||||
let parameters: [String: Any] = ["channel": id, "latest": latest, "oldest": oldest, "inclusive":inclusive, "count":count, "unreads":unreads]
|
||||
networkInterface.request(endpoint, token: token, parameters: parameters, successClosure: {(response) in
|
||||
success?(History(history: response))
|
||||
}) {(error) in
|
||||
failure?(error)
|
||||
private func history(_ endpoint: Endpoint, id: String, latest: String = "\(Date().timeIntervalSince1970)", oldest: String = "0", inclusive: Bool = false, count: Int = 100, unreads: Bool = false, success: ((_ history: History)->Void)?, failure: FailureClosure?) {
|
||||
let parameters: [String: Any] = ["token": token, "channel": id, "latest": latest, "oldest": oldest, "inclusive": inclusive, "count": count, "unreads": unreads]
|
||||
networkInterface.request(endpoint, parameters: parameters, successClosure: {(response) in
|
||||
success?(History(history: response))
|
||||
}) {(error) in
|
||||
failure?(error)
|
||||
}
|
||||
}
|
||||
|
||||
private func info(_ endpoint: Endpoint, type: ChannelType, id: String, success: ((_ channel: Channel)->Void)?, failure: FailureClosure?) {
|
||||
let parameters: [String: Any] = ["channel": id]
|
||||
networkInterface.request(endpoint, token: token, parameters: parameters, successClosure: {(response) in
|
||||
success?(Channel(channel: response[type.rawValue] as? [String: Any]))
|
||||
}) {(error) in
|
||||
failure?(error)
|
||||
let parameters: [String: Any] = ["token": token, "channel": id]
|
||||
networkInterface.request(endpoint, parameters: parameters, successClosure: {(response) in
|
||||
success?(Channel(channel: response[type.rawValue] as? [String: Any]))
|
||||
}) {(error) in
|
||||
failure?(error)
|
||||
}
|
||||
}
|
||||
|
||||
private func list(_ endpoint: Endpoint, type: ChannelType, excludeArchived: Bool = false, success: ((_ channels: [[String: Any]]?)->Void)?, failure: FailureClosure?) {
|
||||
let parameters: [String: Any] = ["exclude_archived": excludeArchived]
|
||||
networkInterface.request(endpoint, token: token, parameters: parameters, successClosure: {(response) in
|
||||
success?(response[type.rawValue+"s"] as? [[String: Any]])
|
||||
}) {(error) in
|
||||
failure?(error)
|
||||
let parameters: [String: Any] = ["token": token, "exclude_archived": excludeArchived]
|
||||
networkInterface.request(endpoint, parameters: parameters, successClosure: {(response) in
|
||||
success?(response[type.rawValue+"s"] as? [[String: Any]])
|
||||
}) {(error) in
|
||||
failure?(error)
|
||||
}
|
||||
}
|
||||
|
||||
private func mark(_ endpoint: Endpoint, channel: String, timestamp: String, success: ((_ ts: String)->Void)?, failure: FailureClosure?) {
|
||||
let parameters: [String: Any] = ["channel": channel, "ts": timestamp]
|
||||
networkInterface.request(endpoint, token: token, parameters: parameters, successClosure: {(response) in
|
||||
success?(timestamp)
|
||||
}) {(error) in
|
||||
failure?(error)
|
||||
let parameters: [String: Any] = ["token": token, "channel": channel, "ts": timestamp]
|
||||
networkInterface.request(endpoint, parameters: parameters, successClosure: {(response) in
|
||||
success?(timestamp)
|
||||
}) {(error) in
|
||||
failure?(error)
|
||||
}
|
||||
}
|
||||
|
||||
private func setInfo(_ endpoint: Endpoint, type: InfoType, channel: String, text: String, success: ((_ success: Bool)->Void)?, failure: FailureClosure?) {
|
||||
let parameters: [String: Any] = ["channel": channel, type.rawValue: text]
|
||||
networkInterface.request(endpoint, token: token, parameters: parameters, successClosure: {(response) in
|
||||
success?(true)
|
||||
}) {(error) in
|
||||
failure?(error)
|
||||
fileprivate func setInfo(_ endpoint: Endpoint, type: InfoType, channel: String, text: String, success: ((_ success: Bool)->Void)?, failure: FailureClosure?) {
|
||||
let parameters: [String: Any] = ["token": token, "channel": channel, type.rawValue: text]
|
||||
networkInterface.request(endpoint, parameters: parameters, successClosure: {(response) in
|
||||
success?(true)
|
||||
}) {(error) in
|
||||
failure?(error)
|
||||
}
|
||||
}
|
||||
|
||||
@@ -670,23 +690,12 @@ public class SlackWebAPI {
|
||||
let data = try JSONSerialization.data(withJSONObject: attachmentArray, options: [])
|
||||
return String(data: data, encoding: String.Encoding.utf8)
|
||||
} catch _ {
|
||||
print("Error encoding attachments")
|
||||
|
||||
}
|
||||
}
|
||||
return nil
|
||||
}
|
||||
|
||||
//MARK: - Filter Nil Parameters
|
||||
internal func filterNilParameters(_ parameters: [String: Any?]) -> [String: Any] {
|
||||
var finalParameters = [String: Any]()
|
||||
for (key, value) in parameters {
|
||||
if let unwrapped = value {
|
||||
finalParameters[key] = unwrapped
|
||||
}
|
||||
}
|
||||
return finalParameters
|
||||
}
|
||||
|
||||
//MARK: - Enumerate Do Not Disturb Status
|
||||
private func enumerateDNDStatuses(_ statuses: [String: Any]) -> [String: DoNotDisturbStatus] {
|
||||
var retVal = [String: DoNotDisturbStatus]()
|
||||
@@ -0,0 +1,49 @@
|
||||
//
|
||||
// WebhookServer.swift
|
||||
//
|
||||
// Copyright © 2016 Peter Zignego. All rights reserved.
|
||||
//
|
||||
// Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||
// of this software and associated documentation files (the "Software"), to deal
|
||||
// in the Software without restriction, including without limitation the rights
|
||||
// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
||||
// copies of the Software, and to permit persons to whom the Software is
|
||||
// furnished to do so, subject to the following conditions:
|
||||
//
|
||||
// The above copyright notice and this permission notice shall be included in
|
||||
// all copies or substantial portions of the Software.
|
||||
//
|
||||
// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||
// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||
// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
||||
// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
||||
// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
||||
// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
|
||||
// THE SOFTWARE.
|
||||
|
||||
open class WebhookServer: Server {
|
||||
|
||||
public init(token: String, route: String, response: Response) {
|
||||
super.init(token: token)
|
||||
addRoute(route, response: response)
|
||||
}
|
||||
|
||||
open func addRoute(_ route: String, response: Response) {
|
||||
http["/\(route)"] = { request in
|
||||
let webhookRequest = WebhookRequest(request: self.dictionaryFromRequest(request.body))
|
||||
if webhookRequest.token == self.token {
|
||||
return self.request(webhookRequest, reply: self.replyForResponse(response))
|
||||
} else {
|
||||
return .badRequest(.text("Bad request."))
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
private func replyForResponse(_ response: Response) -> Reply {
|
||||
if response.attachments == nil && response.responseType == nil {
|
||||
return Reply.text(body: response.text)
|
||||
} else {
|
||||
return Reply.json(response: response)
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -15,7 +15,7 @@
|
||||
<key>CFBundlePackageType</key>
|
||||
<string>FMWK</string>
|
||||
<key>CFBundleShortVersionString</key>
|
||||
<string>1.0.1</string>
|
||||
<string>3.1.12</string>
|
||||
<key>CFBundleSignature</key>
|
||||
<string>????</string>
|
||||
<key>CFBundleVersion</key>
|
||||
@@ -0,0 +1,30 @@
|
||||
//
|
||||
// SlackKit.h
|
||||
//
|
||||
// Copyright © 2016 Peter Zignego. All rights reserved.
|
||||
//
|
||||
// Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||
// of this software and associated documentation files (the "Software"), to deal
|
||||
// in the Software without restriction, including without limitation the rights
|
||||
// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
||||
// copies of the Software, and to permit persons to whom the Software is
|
||||
// furnished to do so, subject to the following conditions:
|
||||
//
|
||||
// The above copyright notice and this permission notice shall be included in
|
||||
// all copies or substantial portions of the Software.
|
||||
//
|
||||
// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||
// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||
// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
||||
// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
||||
// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
||||
// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
|
||||
// THE SOFTWARE.
|
||||
|
||||
#import <Foundation/Foundation.h>
|
||||
|
||||
//! Project version number for SlackKit.
|
||||
FOUNDATION_EXPORT double SlackKitVersionNumber;
|
||||
|
||||
//! Project version string for SlackKit.
|
||||
FOUNDATION_EXPORT const unsigned char SlackKitVersionString[];
|
||||
Reference in New Issue
Block a user