diff --git a/Channel.cs b/Channel.cs
index bdb562a..d42e7f3 100644
--- a/Channel.cs
+++ b/Channel.cs
@@ -19,6 +19,7 @@ public class Channel
public bool is_member;
public bool is_general;
public bool is_starred;
+ public bool is_channel;
public bool IsPrivateGroup { get { return id != null && id[0] == 'G'; } }
public int num_members;
diff --git a/Group.cs b/Group.cs
new file mode 100644
index 0000000..74c0a37
--- /dev/null
+++ b/Group.cs
@@ -0,0 +1,27 @@
+using System;
+
+namespace SlackAPI
+{
+ public class Group
+ {
+ public string id;
+
+ public string name;
+ public bool is_group;
+ public DateTime created;
+ public string creator;
+ public bool is_archived;
+ public bool is_open;
+
+ public string[] members;
+
+ public OwnedStampedMessage topic;
+ public OwnedStampedMessage purpose;
+
+ public DateTime last_read;
+ public Message latest;
+
+ public int unread_count;
+ public int unread_count_display;
+ }
+}
diff --git a/RPCMessages/GroupArchiveResponse.cs b/RPCMessages/GroupArchiveResponse.cs
new file mode 100644
index 0000000..d043012
--- /dev/null
+++ b/RPCMessages/GroupArchiveResponse.cs
@@ -0,0 +1,13 @@
+using System;
+using System.Collections.Generic;
+using System.Linq;
+using System.Text;
+using System.Threading.Tasks;
+
+namespace SlackAPI
+{
+ [RequestPath("groups.archive")]
+ public class GroupArchiveResponse : Response
+ {
+ }
+}
diff --git a/RPCMessages/GroupCloseResponse.cs b/RPCMessages/GroupCloseResponse.cs
new file mode 100644
index 0000000..d0fdcd2
--- /dev/null
+++ b/RPCMessages/GroupCloseResponse.cs
@@ -0,0 +1,15 @@
+using System;
+using System.Collections.Generic;
+using System.Linq;
+using System.Text;
+using System.Threading.Tasks;
+
+namespace SlackAPI
+{
+ [RequestPath("groups.close")]
+ public class GroupCloseResponse : Response
+ {
+ public string no_op;
+ public string already_closed;
+ }
+}
diff --git a/RPCMessages/GroupCreateChildResponse.cs b/RPCMessages/GroupCreateChildResponse.cs
new file mode 100644
index 0000000..51d495e
--- /dev/null
+++ b/RPCMessages/GroupCreateChildResponse.cs
@@ -0,0 +1,13 @@
+using System;
+using System.Collections.Generic;
+using System.Linq;
+using System.Text;
+using System.Threading.Tasks;
+
+namespace SlackAPI
+{
+ [RequestPath("groups.createChild")]
+ public class GroupCreateChildResponse : GroupResponse
+ {
+ }
+}
diff --git a/RPCMessages/GroupCreateResponse.cs b/RPCMessages/GroupCreateResponse.cs
new file mode 100644
index 0000000..b5082e0
--- /dev/null
+++ b/RPCMessages/GroupCreateResponse.cs
@@ -0,0 +1,13 @@
+using System;
+using System.Collections.Generic;
+using System.Linq;
+using System.Text;
+using System.Threading.Tasks;
+
+namespace SlackAPI
+{
+ [RequestPath("groups.create")]
+ public class GroupCreateResponse : GroupResponse
+ {
+ }
+}
diff --git a/RPCMessages/GroupInviteResponse.cs b/RPCMessages/GroupInviteResponse.cs
new file mode 100644
index 0000000..2155178
--- /dev/null
+++ b/RPCMessages/GroupInviteResponse.cs
@@ -0,0 +1,13 @@
+using System;
+using System.Collections.Generic;
+using System.Linq;
+using System.Text;
+using System.Threading.Tasks;
+
+namespace SlackAPI
+{
+ [RequestPath("groups.invite")]
+ public class GroupInviteResponse : GroupResponse
+ {
+ }
+}
diff --git a/RPCMessages/GroupKickResponse.cs b/RPCMessages/GroupKickResponse.cs
new file mode 100644
index 0000000..3213fb2
--- /dev/null
+++ b/RPCMessages/GroupKickResponse.cs
@@ -0,0 +1,13 @@
+using System;
+using System.Collections.Generic;
+using System.Linq;
+using System.Text;
+using System.Threading.Tasks;
+
+namespace SlackAPI
+{
+ [RequestPath("groups.kick")]
+ public class GroupKickResponse : Response
+ {
+ }
+}
diff --git a/RPCMessages/GroupLeaveResponse.cs b/RPCMessages/GroupLeaveResponse.cs
new file mode 100644
index 0000000..9c96122
--- /dev/null
+++ b/RPCMessages/GroupLeaveResponse.cs
@@ -0,0 +1,13 @@
+using System;
+using System.Collections.Generic;
+using System.Linq;
+using System.Text;
+using System.Threading.Tasks;
+
+namespace SlackAPI
+{
+ [RequestPath("groups.leave")]
+ public class GroupLeaveResponse : Response
+ {
+ }
+}
diff --git a/RPCMessages/GroupMarkResponse.cs b/RPCMessages/GroupMarkResponse.cs
new file mode 100644
index 0000000..b4cb742
--- /dev/null
+++ b/RPCMessages/GroupMarkResponse.cs
@@ -0,0 +1,13 @@
+using System;
+using System.Collections.Generic;
+using System.Linq;
+using System.Text;
+using System.Threading.Tasks;
+
+namespace SlackAPI
+{
+ [RequestPath("groups.mark")]
+ public class GroupMarkResponse : Response
+ {
+ }
+}
diff --git a/RPCMessages/GroupOpenResponse.cs b/RPCMessages/GroupOpenResponse.cs
new file mode 100644
index 0000000..70c2ffc
--- /dev/null
+++ b/RPCMessages/GroupOpenResponse.cs
@@ -0,0 +1,15 @@
+using System;
+using System.Collections.Generic;
+using System.Linq;
+using System.Text;
+using System.Threading.Tasks;
+
+namespace SlackAPI
+{
+ [RequestPath("groups.open")]
+ public class GroupOpenResponse : Response
+ {
+ public string no_op;
+ public string already_closed;
+ }
+}
diff --git a/RPCMessages/GroupRenameResponse.cs b/RPCMessages/GroupRenameResponse.cs
new file mode 100644
index 0000000..6590576
--- /dev/null
+++ b/RPCMessages/GroupRenameResponse.cs
@@ -0,0 +1,14 @@
+using System;
+using System.Collections.Generic;
+using System.Linq;
+using System.Text;
+using System.Threading.Tasks;
+
+namespace SlackAPI
+{
+ [RequestPath("groups.rename")]
+ public class GroupRenameResponse : Response
+ {
+ public Channel channel;
+ }
+}
diff --git a/RPCMessages/GroupResponse.cs b/RPCMessages/GroupResponse.cs
new file mode 100644
index 0000000..b4a8ce1
--- /dev/null
+++ b/RPCMessages/GroupResponse.cs
@@ -0,0 +1,13 @@
+using System;
+using System.Collections.Generic;
+using System.Linq;
+using System.Text;
+using System.Threading.Tasks;
+
+namespace SlackAPI
+{
+ public class GroupResponse : Response
+ {
+ public Group group;
+ }
+}
diff --git a/RPCMessages/GroupSetPurposeResponse.cs b/RPCMessages/GroupSetPurposeResponse.cs
new file mode 100644
index 0000000..93a061c
--- /dev/null
+++ b/RPCMessages/GroupSetPurposeResponse.cs
@@ -0,0 +1,14 @@
+using System;
+using System.Collections.Generic;
+using System.Linq;
+using System.Text;
+using System.Threading.Tasks;
+
+namespace SlackAPI
+{
+ [RequestPath("groups.setPurpose")]
+ public class GroupSetPurposeResponse : Response
+ {
+ public string purpose;
+ }
+}
diff --git a/RPCMessages/GroupSetTopicResponse.cs b/RPCMessages/GroupSetTopicResponse.cs
new file mode 100644
index 0000000..f8adab9
--- /dev/null
+++ b/RPCMessages/GroupSetTopicResponse.cs
@@ -0,0 +1,14 @@
+using System;
+using System.Collections.Generic;
+using System.Linq;
+using System.Text;
+using System.Threading.Tasks;
+
+namespace SlackAPI
+{
+ [RequestPath("groups.setTopic")]
+ public class GroupSetTopicResponse : Response
+ {
+ public string topic;
+ }
+}
diff --git a/RPCMessages/GroupUnarchiveResponse.cs b/RPCMessages/GroupUnarchiveResponse.cs
new file mode 100644
index 0000000..d68061c
--- /dev/null
+++ b/RPCMessages/GroupUnarchiveResponse.cs
@@ -0,0 +1,13 @@
+using System;
+using System.Collections.Generic;
+using System.Linq;
+using System.Text;
+using System.Threading.Tasks;
+
+namespace SlackAPI
+{
+ [RequestPath("groups.unarchive")]
+ public class GroupUnarchiveResponse : Response
+ {
+ }
+}
diff --git a/RPCMessages/MarkResponse.cs b/RPCMessages/MarkResponse.cs
index 982fbbc..976b0c9 100644
--- a/RPCMessages/MarkResponse.cs
+++ b/RPCMessages/MarkResponse.cs
@@ -9,7 +9,7 @@ namespace SlackAPI
///
/// This is used for moving the read cursor in the channel.
///
- [RequestPath("channels.marks")]
+ [RequestPath("channels.mark")]
public class MarkResponse : Response
{
}
diff --git a/Response.cs b/Response.cs
index 3627fa7..ba2c401 100644
--- a/Response.cs
+++ b/Response.cs
@@ -14,12 +14,8 @@ public abstract class Response
public bool ok;
///
- /// Purely speculative. Might not be bools, and might not always be included when a request fails.
+ /// if ok is false, then this is the reason-code
///
- public bool invalid_auth;
- ///
- /// Purely speculative. Might not be bools, and might not always be included when a request fails.
- ///
- public bool account_inactive;
+ public string error;
}
}
diff --git a/SlackAPI.csproj b/SlackAPI.csproj
index 57c1c1c..5a0af0c 100644
--- a/SlackAPI.csproj
+++ b/SlackAPI.csproj
@@ -47,6 +47,7 @@
+
@@ -56,6 +57,20 @@
+
+
+
+
+
+
+
+
+
+
+
+
+
+
diff --git a/SlackClient.cs b/SlackClient.cs
index 9ea3eb7..f347bee 100644
--- a/SlackClient.cs
+++ b/SlackClient.cs
@@ -283,6 +283,98 @@ public void GetFileInfo(Action callback, string fileId, int? p
APIRequestWithToken(callback, parameters.ToArray());
}
+ #region group
+ public void GroupsArchive(Action callback, string channelId)
+ {
+ APIRequestWithToken(callback, new Tuple("channel", channelId));
+ }
+
+ public void GroupsClose(Action callback, string channelId)
+ {
+ APIRequestWithToken(callback, new Tuple("channel", channelId));
+ }
+
+ public void GroupsCreate(Action callback, string name)
+ {
+ APIRequestWithToken(callback, new Tuple("name", name));
+ }
+
+ public void GroupsCreateChild(Action callback, string channelId)
+ {
+ APIRequestWithToken(callback, new Tuple("channel", channelId));
+ }
+
+ public void GroupsInvite(Action callback, string userId, string channelId)
+ {
+ List> parameters = new List>();
+
+ parameters.Add(new Tuple("channel", channelId));
+ parameters.Add(new Tuple("user", userId));
+
+ APIRequestWithToken(callback, parameters.ToArray());
+ }
+
+ public void GroupsKick(Action callback, string userId, string channelId)
+ {
+ List> parameters = new List>();
+
+ parameters.Add(new Tuple("channel", channelId));
+ parameters.Add(new Tuple("user", userId));
+
+ APIRequestWithToken(callback, parameters.ToArray());
+ }
+
+ public void GroupsLeave(Action callback, string channelId)
+ {
+ APIRequestWithToken(callback, new Tuple("channel", channelId));
+ }
+
+ public void GroupsMark(Action callback, string channelId, DateTime ts)
+ {
+ APIRequestWithToken(callback, new Tuple("channel", channelId), new Tuple("ts", ts.ToProperTimeStamp()));
+ }
+
+ public void GroupsOpen(Action callback, string channelId)
+ {
+ APIRequestWithToken(callback, new Tuple("channel", channelId));
+ }
+
+ public void GroupsRename(Action callback, string channelId, string name)
+ {
+ List> parameters = new List>();
+
+ parameters.Add(new Tuple("channel", channelId));
+ parameters.Add(new Tuple("name", name));
+
+ APIRequestWithToken(callback, parameters.ToArray());
+ }
+
+ public void GroupsSetPurpose(Action callback, string channelId, string purpose)
+ {
+ List> parameters = new List>();
+
+ parameters.Add(new Tuple("channel", channelId));
+ parameters.Add(new Tuple("purpose", purpose));
+
+ APIRequestWithToken(callback, parameters.ToArray());
+ }
+
+ public void GroupsSetTopic(Action callback, string channelId, string topic)
+ {
+ List> parameters = new List>();
+
+ parameters.Add(new Tuple("channel", channelId));
+ parameters.Add(new Tuple("topic", topic));
+
+ APIRequestWithToken(callback, parameters.ToArray());
+ }
+
+ public void GroupsUnarchive(Action callback, string channelId)
+ {
+ APIRequestWithToken(callback, new Tuple("channel", channelId));
+ }
+
+ #endregion
public void SearchAll(Action callback, string query, SearchSort? sorting = null, SearchSortDirection? direction = null, bool enableHighlights = false, int? count = null, int? page = null)
{
@@ -409,7 +501,7 @@ public void PostMessage(
APIRequestWithToken(callback, parameters.ToArray());
}
- public void UploadFile(Action callback, byte[] fileData, string fileName, string[] channelIds, string title = null, string initialComment = null, bool useAsync = false)
+ public void UploadFile(Action callback, byte[] fileData, string fileName, string[] channelIds, string title = null, string initialComment = null, bool useAsync = false, string fileType = null)
{
Uri target = new Uri(Path.Combine(APIBaseLocation, useAsync ? "files.uploadAsync" : "files.upload"));
@@ -417,7 +509,8 @@ public void UploadFile(Action callback, byte[] fileData, str
parameters.Add(string.Format("token={0}", APIToken));
//File/Content
- //FileType?
+ if (!string.IsNullOrEmpty(fileType))
+ parameters.Add(string.Format("{0}={1}", "filetype", fileType));
if (!string.IsNullOrEmpty(fileName))
parameters.Add(string.Format("{0}={1}", "filename", fileName));