Skip to content
This repository was archived by the owner on Jan 28, 2019. It is now read-only.

Commit 21e0166

Browse files
committed
ConversationType as enum
1 parent a4559c8 commit 21e0166

File tree

1 file changed

+6
-2
lines changed

1 file changed

+6
-2
lines changed

Sources/WebAPI.swift

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -53,6 +53,10 @@ public final class WebAPI {
5353
case channel, group, im
5454
}
5555

56+
public enum ConversationType: String {
57+
case public_channel, private_channel, mpim, im
58+
}
59+
5660
fileprivate let networkInterface: NetworkInterface
5761
fileprivate let token: String
5862

@@ -1103,7 +1107,7 @@ extension WebAPI {
11031107
excludeArchived: Bool = false,
11041108
cursor: String? = nil,
11051109
limit: Int? = nil,
1106-
types: [String]? = nil,
1110+
types: [ConversationType]? = nil,
11071111
success: ((_ channels: [[String: Any]]?) -> Void)?,
11081112
failure: FailureClosure?
11091113
) {
@@ -1115,7 +1119,7 @@ extension WebAPI {
11151119
parameters["limit"] = limit
11161120
}
11171121
if let types = types {
1118-
parameters["types"] = types.joined(separator: ",")
1122+
parameters["types"] = types.map({ $0.rawValue }).joined(separator: ",")
11191123
}
11201124
networkInterface.request(.conversationsList, parameters: parameters, successClosure: {(response) in
11211125
success?(response["channels"] as? [[String: Any]])

0 commit comments

Comments
 (0)