This repository was archived by the owner on Jan 28, 2019. It is now read-only.
File tree Expand file tree Collapse file tree 2 files changed +29
-0
lines changed
Expand file tree Collapse file tree 2 files changed +29
-0
lines changed Original file line number Diff line number Diff line change @@ -37,6 +37,7 @@ public enum Endpoint: String {
3737 case chatPostMessage = " chat.postMessage "
3838 case chatMeMessage = " chat.meMessage "
3939 case chatUpdate = " chat.update "
40+ case conversationsList = " conversations.list "
4041 case dndInfo = " dnd.info "
4142 case dndTeamInfo = " dnd.teamInfo "
4243 case emojiList = " emoji.list "
Original file line number Diff line number Diff line change @@ -1097,6 +1097,34 @@ extension WebAPI {
10971097 }
10981098}
10991099
1100+ // MARK: - Conversations
1101+ extension WebAPI {
1102+ public func conversationsList(
1103+ excludeArchived: Bool = false ,
1104+ cursor: String ? = nil ,
1105+ limit: Int ? = nil ,
1106+ types: [ String ] ? = nil ,
1107+ success: ( ( _ channels: [ [ String : Any ] ] ? ) -> Void ) ? ,
1108+ failure: FailureClosure ?
1109+ ) {
1110+ var parameters : [ String : Any ] = [ " token " : token, " exclude_archived " : excludeArchived]
1111+ if let cursor = cursor {
1112+ parameters [ " cursor " ] = cursor
1113+ }
1114+ if let limit = limit {
1115+ parameters [ " limit " ] = limit
1116+ }
1117+ if let types = types {
1118+ parameters [ " types " ] = types. joined ( separator: " , " )
1119+ }
1120+ networkInterface. request ( . conversationsList, parameters: parameters, successClosure: { ( response) in
1121+ success ? ( response [ " channels " ] as? [ [ String : Any ] ] )
1122+ } ) { ( error) in
1123+ failure ? ( error)
1124+ }
1125+ }
1126+ }
1127+
11001128// MARK: - Utilities
11011129extension WebAPI {
11021130 fileprivate func encodeAttachments( _ attachments: [ Attachment ? ] ? ) -> String ? {
You can’t perform that action at this time.
0 commit comments