public static WWWForm GenerateUploadFileForm(string token, string channel, string username, string text, string filename, byte[] filedata) { // NOTE: // This implementation is a small set. There is more info in API. // https://api.slack.com/methods/files.upload WWWForm wwwForm = SlackAPI.GenerateBaseForm(token); wwwForm.AddField("channels", channel); // Required wwwForm.AddField("username", username); // Optional if (text != null) { wwwForm.AddField("initial_comment", text); // Optional } wwwForm.AddField("link_names", 1); // Optional wwwForm.AddBinaryData("file", filedata, filename); // Optional return(wwwForm); }
public static WWWForm GenerateUserListForm(string token) { // NOTE: // https://api.slack.com/methods/users.list return(SlackAPI.GenerateBaseForm(token)); }
public static IEnumerator GetUsersList(string token, Action <UnityWebRequest> onSuccess = null, Action <UnityWebRequest> onError = null) { yield return(SlackAPI.PostToSlack(SlackAPI.UsersListURL, SlackAPI.GenerateUserListForm(token), onSuccess, onError)); }
public virtual void PostMessage(string text, Action <UnityWebRequest> onSuccess = null, Action <UnityWebRequest> onError = null) { StartCoroutine(SlackAPI.PostMessage(this.token, this.channel, this.userName, text, onSuccess, onError)); }
public static IEnumerator PostMessage(string token, string channel, string username, string text, Action <UnityWebRequest> onSuccess = null, Action <UnityWebRequest> onError = null) { yield return(SlackAPI.PostToSlack (SlackAPI.PostMessageURL, SlackAPI.GeneratePostMessageForm(token, channel, username, text), onSuccess, onError)); }
public virtual void UploadScreenshot(string text = null, string filename = null, Action <UnityWebRequest> onSuccess = null, Action <UnityWebRequest> onError = null) { string baseName = System.DateTime.Now.ToString("yyyyMMdd_HHmmss") + ".png"; StartCoroutine(SlackAPI.UploadScreenshot(this.token, this.channel, this.userName, text, filename ?? baseName, onSuccess, onError)); }
public virtual void UploadTexture(string text, string filename, Texture2D texture, Action <UnityWebRequest> onSuccess = null, Action <UnityWebRequest> onError = null) { StartCoroutine(SlackAPI.UploadTexture(this.token, this.channel, this.userName, text, filename, texture, onSuccess, onError)); }
public static IEnumerator UploadFile(string token, string channel, string username, string text, string filename, byte[] filedata, Action <UnityWebRequest> onSuccess = null, Action <UnityWebRequest> onError = null) { yield return(PostToSlack (SlackAPI.UploadFileURL, SlackAPI.GenerateUploadFileForm(token, channel, username, text, filename, filedata), onSuccess, onError)); }
public static WWWForm GeneratePostMessageForm(string token, string channel, string username, string text) { // NOTE: // This implementation is a small set. There is more info in API. // https://api.slack.com/methods/chat.postMessage // NOTE: // "link_names" is needed to make "#channel" text into link. WWWForm wwwForm = SlackAPI.GenerateBaseForm(token); wwwForm.AddField("channel", channel); // Required wwwForm.AddField("text", text); // Required wwwForm.AddField("username", username); // Optional wwwForm.AddField("link_names", 1); // Optional return(wwwForm); }