diff --git a/SlackAPI.Console/Program.cs b/SlackAPI.Console/Program.cs index 9df9ec0..f5e62a6 100644 --- a/SlackAPI.Console/Program.cs +++ b/SlackAPI.Console/Program.cs @@ -1,10 +1,5 @@ -using SlackAPI; -using System; -using System.Collections.Generic; +using System; using System.Diagnostics; -using System.Linq; -using System.Text; -using System.Threading.Tasks; using System.Web; namespace SlackAPI diff --git a/SlackAPI.Tests/Configuration/IntegrationCollection.cs b/SlackAPI.Tests/Configuration/IntegrationCollection.cs index 2b8c8e0..1bd0a18 100644 --- a/SlackAPI.Tests/Configuration/IntegrationCollection.cs +++ b/SlackAPI.Tests/Configuration/IntegrationCollection.cs @@ -2,8 +2,8 @@ namespace SlackAPI.Tests.Configuration { - [CollectionDefinition("Integration tests")] - public class IntegrationCollection : ICollectionFixture - { - } + [CollectionDefinition("Integration tests")] + public class IntegrationCollection : ICollectionFixture + { + } } diff --git a/SlackAPI.Tests/Configuration/IntegrationFixture.cs b/SlackAPI.Tests/Configuration/IntegrationFixture.cs index 2ee925d..f8ac8cf 100755 --- a/SlackAPI.Tests/Configuration/IntegrationFixture.cs +++ b/SlackAPI.Tests/Configuration/IntegrationFixture.cs @@ -1,8 +1,8 @@ -using System; +using Newtonsoft.Json; +using SlackAPI.Tests.Helpers; +using System; using System.IO; using System.Reflection; -using Newtonsoft.Json; -using SlackAPI.Tests.Helpers; using Xunit; namespace SlackAPI.Tests.Configuration @@ -35,7 +35,7 @@ private SlackConfig GetConfig() string fileName = Path.Combine(assemblyDirectory, @"configuration\config.json"); string json = System.IO.File.ReadAllText(fileName); - var jsonObject = new {slack = (SlackConfig)null }; + var jsonObject = new { slack = (SlackConfig)null }; return JsonConvert.DeserializeAnonymousType(json, jsonObject).slack; } diff --git a/SlackAPI.Tests/Connect.cs b/SlackAPI.Tests/Connect.cs index 175ef0f..a0863eb 100644 --- a/SlackAPI.Tests/Connect.cs +++ b/SlackAPI.Tests/Connect.cs @@ -34,7 +34,7 @@ public void TestGetAccessToken() // act var accessTokenResponse = GetAccessToken(clientId, clientSecret, "", authCode); - + // assert Assert.NotNull(accessTokenResponse); Assert.NotNull(accessTokenResponse.bot); diff --git a/SlackAPI.Tests/Helpers/InSync.cs b/SlackAPI.Tests/Helpers/InSync.cs index 184680f..f8355d5 100644 --- a/SlackAPI.Tests/Helpers/InSync.cs +++ b/SlackAPI.Tests/Helpers/InSync.cs @@ -1,6 +1,6 @@ using System; -using System.Threading; using System.Runtime.CompilerServices; +using System.Threading; using Xunit; namespace SlackAPI.Tests.Helpers diff --git a/SlackAPI.Tests/JoinDirectMessageChannel.cs b/SlackAPI.Tests/JoinDirectMessageChannel.cs index 237ede3..1b4c851 100644 --- a/SlackAPI.Tests/JoinDirectMessageChannel.cs +++ b/SlackAPI.Tests/JoinDirectMessageChannel.cs @@ -32,7 +32,7 @@ public void ShouldJoinDirectMessageChannel() client.JoinDirectMessageChannel(response => { actual = response; - sync.Proceed();; + sync.Proceed(); ; }, user); } diff --git a/SlackAPI.Tests/Update.cs b/SlackAPI.Tests/Update.cs index d02d1a5..8853e19 100644 --- a/SlackAPI.Tests/Update.cs +++ b/SlackAPI.Tests/Update.cs @@ -5,7 +5,7 @@ namespace SlackAPI.Tests { [Collection("Integration tests")] - public class Update + public class Update { private readonly IntegrationFixture fixture; diff --git a/SlackAPI.Tests/Users.cs b/SlackAPI.Tests/Users.cs index 99ec23f..3cb85f6 100644 --- a/SlackAPI.Tests/Users.cs +++ b/SlackAPI.Tests/Users.cs @@ -1,6 +1,6 @@ -using System.Linq; -using SlackAPI.Tests.Configuration; +using SlackAPI.Tests.Configuration; using SlackAPI.Tests.Helpers; +using System.Linq; using Xunit; namespace SlackAPI.Tests diff --git a/SlackAPI/Attachment.cs b/SlackAPI/Attachment.cs index 25ae63f..30fb8b7 100644 --- a/SlackAPI/Attachment.cs +++ b/SlackAPI/Attachment.cs @@ -14,7 +14,7 @@ public class Attachment public string title_link; public string text; public Field[] fields; - + public string image_url; public string thumb_url; public string[] mrkdwn_in; @@ -24,7 +24,8 @@ public class Attachment public string footer_icon; } - public class Field{ + public class Field + { public string title; public string value; public bool @short; diff --git a/SlackAPI/Bot.cs b/SlackAPI/Bot.cs index 4c6f900..d941a09 100644 --- a/SlackAPI/Bot.cs +++ b/SlackAPI/Bot.cs @@ -1,10 +1,8 @@ -using System; - -namespace SlackAPI +namespace SlackAPI { public class Bot { - public string emoji; + public string emoji; public string image_24; public string image_32; public string image_48; diff --git a/SlackAPI/Channel.cs b/SlackAPI/Channel.cs index 7335e8b..21ea977 100644 --- a/SlackAPI/Channel.cs +++ b/SlackAPI/Channel.cs @@ -1,10 +1,4 @@ -using System; -using System.Collections.Generic; -using System.Linq; -using System.Text; -using System.Threading.Tasks; - -namespace SlackAPI +namespace SlackAPI { public class Channel : Conversation { diff --git a/SlackAPI/ContextMessage.cs b/SlackAPI/ContextMessage.cs index 764c17a..f1347a3 100644 --- a/SlackAPI/ContextMessage.cs +++ b/SlackAPI/ContextMessage.cs @@ -1,10 +1,4 @@ -using System; -using System.Collections.Generic; -using System.Linq; -using System.Text; -using System.Threading.Tasks; - -namespace SlackAPI +namespace SlackAPI { public class ContextMessage : Message { diff --git a/SlackAPI/Conversation.cs b/SlackAPI/Conversation.cs index def8d1a..5b5c013 100644 --- a/SlackAPI/Conversation.cs +++ b/SlackAPI/Conversation.cs @@ -1,8 +1,4 @@ using System; -using System.Collections.Generic; -using System.Linq; -using System.Text; -using System.Threading.Tasks; namespace SlackAPI { diff --git a/SlackAPI/DirectMessageConversation.cs b/SlackAPI/DirectMessageConversation.cs index 2241fe6..9debbd3 100644 --- a/SlackAPI/DirectMessageConversation.cs +++ b/SlackAPI/DirectMessageConversation.cs @@ -1,10 +1,4 @@ -using System; -using System.Collections.Generic; -using System.Linq; -using System.Text; -using System.Threading.Tasks; - -namespace SlackAPI +namespace SlackAPI { public class DirectMessageConversation : Conversation { diff --git a/SlackAPI/Extensions.cs b/SlackAPI/Extensions.cs index 194a948..04206ed 100644 --- a/SlackAPI/Extensions.cs +++ b/SlackAPI/Extensions.cs @@ -1,6 +1,6 @@ -using System; +using Newtonsoft.Json; +using System; using System.Collections.Generic; -using Newtonsoft.Json; namespace SlackAPI { diff --git a/SlackAPI/JavascriptBotsToArray.cs b/SlackAPI/JavascriptBotsToArray.cs index c8d0a38..c8f3e15 100644 --- a/SlackAPI/JavascriptBotsToArray.cs +++ b/SlackAPI/JavascriptBotsToArray.cs @@ -1,8 +1,5 @@ using System; using System.Collections.Generic; -using System.Linq; -using System.Text; -using System.Threading.Tasks; namespace SlackAPI { diff --git a/SlackAPI/JavascriptDateTimeConverter.cs b/SlackAPI/JavascriptDateTimeConverter.cs index d70d374..d37fa13 100644 --- a/SlackAPI/JavascriptDateTimeConverter.cs +++ b/SlackAPI/JavascriptDateTimeConverter.cs @@ -1,9 +1,5 @@ using System; -using System.Collections.Generic; using System.Globalization; -using System.Linq; -using System.Text; -using System.Threading.Tasks; namespace SlackAPI { @@ -20,8 +16,8 @@ public override object ReadJson(Newtonsoft.Json.JsonReader reader, Type objectTy DateTime res = new DateTime(621355968000000000 + (long)(value * 10000000m)).ToLocalTime(); System.Diagnostics.Debug.Assert( Decimal.Equals( - Decimal.Parse(res.ToProperTimeStamp()), - Decimal.Parse(reader.Value.ToString(), CultureInfo.InvariantCulture)), + Decimal.Parse(res.ToProperTimeStamp()), + Decimal.Parse(reader.Value.ToString(), CultureInfo.InvariantCulture)), "Precision loss :("); return res; } diff --git a/SlackAPI/Message.cs b/SlackAPI/Message.cs index d829245..d9b11d6 100644 --- a/SlackAPI/Message.cs +++ b/SlackAPI/Message.cs @@ -1,8 +1,4 @@ using System; -using System.Collections.Generic; -using System.Linq; -using System.Text; -using System.Threading.Tasks; namespace SlackAPI { diff --git a/SlackAPI/MimeTypes.cs b/SlackAPI/MimeTypes.cs index 9fb7794..172c856 100644 --- a/SlackAPI/MimeTypes.cs +++ b/SlackAPI/MimeTypes.cs @@ -1,8 +1,5 @@ using System; using System.Collections.Generic; -using System.Linq; -using System.Text; -using System.Threading.Tasks; namespace SlackAPI { @@ -10,498 +7,498 @@ public static class MimeType { private static Dictionary MimeTypeDict = new Dictionary() - { - { "ez", "application/andrew-inset" }, - { "anx", "application/annodex" }, - { "atom", "application/atom+xml" }, - { "atomcat", "application/atomcat+xml" }, - { "atomsrv", "application/atomserv+xml" }, - { "lin", "application/bbolin" }, - { "cap", "application/cap" }, - { "pcap", "application/cap" }, - { "cu", "application/cu-seeme" }, - { "davmount", "application/davmount+xml" }, - { "tsp", "application/dsptype" }, - { "es", "application/ecmascript" }, - { "spl", "application/futuresplash" }, - { "hta", "application/hta" }, - { "jar", "application/java-archive" }, - { "ser", "application/java-serialized-object" }, - { "class", "application/java-vm" }, - { "js", "application/javascript" }, - { "json", "application/json" }, - { "m3g", "application/m3g" }, - { "hqx", "application/mac-binhex40" }, - { "cpt", "application/mac-compactpro" }, - { "nb", "application/mathematica" }, - { "nbp", "application/mathematica" }, - { "mdb", "application/msaccess" }, - { "doc", "application/msword" }, - { "dot", "application/msword" }, - { "mxf", "application/mxf" }, - { "bin", "application/octet-stream" }, - { "oda", "application/oda" }, - { "ogx", "application/ogg" }, - { "pdf", "application/pdf" }, - { "key", "application/pgp-keys" }, - { "pgp", "application/pgp-signature" }, - { "prf", "application/pics-rules" }, - { "ps", "application/postscript" }, - { "ai", "application/postscript" }, - { "eps", "application/postscript" }, - { "epsi", "application/postscript" }, - { "epsf", "application/postscript" }, - { "eps2", "application/postscript" }, - { "eps3", "application/postscript" }, - { "rar", "application/rar" }, - { "rdf", "application/rdf+xml" }, - { "rss", "application/rss+xml" }, - { "rtf", "application/rtf" }, - { "smi", "application/smil" }, - { "smil", "application/smil" }, - { "xhtml", "application/xhtml+xml" }, - { "xht", "application/xhtml+xml" }, - { "xml", "application/xml" }, - { "xsl", "application/xml" }, - { "xsd", "application/xml" }, - { "xspf", "application/xspf+xml" }, - { "zip", "application/zip" }, - { "apk", "application/vnd.android.package-archive" }, - { "cdy", "application/vnd.cinderella" }, - { "kml", "application/vnd.google-earth.kml+xml" }, - { "kmz", "application/vnd.google-earth.kmz" }, - { "xul", "application/vnd.mozilla.xul+xml" }, - { "xls", "application/vnd.ms-excel" }, - { "xlb", "application/vnd.ms-excel" }, - { "xlt", "application/vnd.ms-excel" }, - { "cat", "application/vnd.ms-pki.seccat" }, - { "stl", "application/vnd.ms-pki.stl" }, - { "ppt", "application/vnd.ms-powerpoint" }, - { "pps", "application/vnd.ms-powerpoint" }, - { "odc", "application/vnd.oasis.opendocument.chart" }, - { "odb", "application/vnd.oasis.opendocument.database" }, - { "odf", "application/vnd.oasis.opendocument.formula" }, - { "odg", "application/vnd.oasis.opendocument.graphics" }, - { "otg", "application/vnd.oasis.opendocument.graphics-template" }, - { "odi", "application/vnd.oasis.opendocument.image" }, - { "odp", "application/vnd.oasis.opendocument.presentation" }, - { "otp", "application/vnd.oasis.opendocument.presentation-template" }, - { "ods", "application/vnd.oasis.opendocument.spreadsheet" }, - { "ots", "application/vnd.oasis.opendocument.spreadsheet-template" }, - { "odt", "application/vnd.oasis.opendocument.text" }, - { "odm", "application/vnd.oasis.opendocument.text-master" }, - { "ott", "application/vnd.oasis.opendocument.text-template" }, - { "oth", "application/vnd.oasis.opendocument.text-web" }, - { "xlsx", "application/vnd.openxmlformats-officedocument.spreadsheetml.sheet" }, - { "xltx", "application/vnd.openxmlformats-officedocument.spreadsheetml.template" }, - { "pptx", "application/vnd.openxmlformats-officedocument.presentationml.presentation" }, - { "ppsx", "application/vnd.openxmlformats-officedocument.presentationml.slideshow" }, - { "potx", "application/vnd.openxmlformats-officedocument.presentationml.template" }, - { "docx", "application/vnd.openxmlformats-officedocument.wordprocessingml.document" }, - { "dotx", "application/vnd.openxmlformats-officedocument.wordprocessingml.template" }, - { "cod", "application/vnd.rim.cod" }, - { "mmf", "application/vnd.smaf" }, - { "sdc", "application/vnd.stardivision.calc" }, - { "sds", "application/vnd.stardivision.chart" }, - { "sda", "application/vnd.stardivision.draw" }, - { "sdd", "application/vnd.stardivision.impress" }, - { "sdf", "application/vnd.stardivision.math" }, - { "sdw", "application/vnd.stardivision.writer" }, - { "sgl", "application/vnd.stardivision.writer-global" }, - { "sxc", "application/vnd.sun.xml.calc" }, - { "stc", "application/vnd.sun.xml.calc.template" }, - { "sxd", "application/vnd.sun.xml.draw" }, - { "std", "application/vnd.sun.xml.draw.template" }, - { "sxi", "application/vnd.sun.xml.impress" }, - { "sti", "application/vnd.sun.xml.impress.template" }, - { "sxm", "application/vnd.sun.xml.math" }, - { "sxw", "application/vnd.sun.xml.writer" }, - { "sxg", "application/vnd.sun.xml.writer.global" }, - { "stw", "application/vnd.sun.xml.writer.template" }, - { "sis", "application/vnd.symbian.install" }, - { "vsd", "application/vnd.visio" }, - { "wbxml", "application/vnd.wap.wbxml" }, - { "wmlc", "application/vnd.wap.wmlc" }, - { "wmlsc", "application/vnd.wap.wmlscriptc" }, - { "wpd", "application/vnd.wordperfect" }, - { "wp5", "application/vnd.wordperfect5.1" }, - { "wk", "application/x-123" }, - { "7z", "application/x-7z-compressed" }, - { "abw", "application/x-abiword" }, - { "dmg", "application/x-apple-diskimage" }, - { "bcpio", "application/x-bcpio" }, - { "torrent", "application/x-bittorrent" }, - { "cab", "application/x-cab" }, - { "cbr", "application/x-cbr" }, - { "cbz", "application/x-cbz" }, - { "cdf", "application/x-cdf" }, - { "cda", "application/x-cdf" }, - { "vcd", "application/x-cdlink" }, - { "pgn", "application/x-chess-pgn" }, - { "cpio", "application/x-cpio" }, - { "csh", "application/x-csh" }, - { "deb", "application/x-debian-package" }, - { "udeb", "application/x-debian-package" }, - { "dcr", "application/x-director" }, - { "dir", "application/x-director" }, - { "dxr", "application/x-director" }, - { "dms", "application/x-dms" }, - { "wad", "application/x-doom" }, - { "dvi", "application/x-dvi" }, - { "rhtml", "application/x-httpd-eruby" }, - { "pfa", "application/x-font" }, - { "pfb", "application/x-font" }, - { "gsf", "application/x-font" }, - { "pcf", "application/x-font" }, - { "pcf.Z", "application/x-font" }, - { "mm", "application/x-freemind" }, - { "gnumeric", "application/x-gnumeric" }, - { "sgf", "application/x-go-sgf" }, - { "gcf", "application/x-graphing-calculator" }, - { "gtar", "application/x-gtar" }, - { "tgz", "application/x-gtar" }, - { "taz", "application/x-gtar" }, - { "hdf", "application/x-hdf" }, - { "phtml", "application/x-httpd-php" }, - { "pht", "application/x-httpd-php" }, - { "php", "application/x-httpd-php" }, - { "phps", "application/x-httpd-php-source" }, - { "php3", "application/x-httpd-php3" }, - { "php3p", "application/x-httpd-php3-preprocessed" }, - { "php4", "application/x-httpd-php4" }, - { "php5", "application/x-httpd-php5" }, - { "ica", "application/x-ica" }, - { "info", "application/x-info" }, - { "ins", "application/x-internet-signup" }, - { "isp", "application/x-internet-signup" }, - { "iii", "application/x-iphone" }, - { "iso", "application/x-iso9660-image" }, - { "jam", "application/x-jam" }, - { "jnlp", "application/x-java-jnlp-file" }, - { "jmz", "application/x-jmol" }, - { "chrt", "application/x-kchart" }, - { "kil", "application/x-killustrator" }, - { "skp", "application/x-koan" }, - { "skd", "application/x-koan" }, - { "skt", "application/x-koan" }, - { "skm", "application/x-koan" }, - { "kpr", "application/x-kpresenter" }, - { "kpt", "application/x-kpresenter" }, - { "ksp", "application/x-kspread" }, - { "kwd", "application/x-kword" }, - { "kwt", "application/x-kword" }, - { "latex", "application/x-latex" }, - { "lha", "application/x-lha" }, - { "lyx", "application/x-lyx" }, - { "lzh", "application/x-lzh" }, - { "lzx", "application/x-lzx" }, - { "frm", "application/x-maker" }, - { "maker", "application/x-maker" }, - { "frame", "application/x-maker" }, - { "fm", "application/x-maker" }, - { "fb", "application/x-maker" }, - { "book", "application/x-maker" }, - { "fbdoc", "application/x-maker" }, - { "mif", "application/x-mif" }, - { "wmd", "application/x-ms-wmd" }, - { "wmz", "application/x-ms-wmz" }, - { "com", "application/x-msdos-program" }, - { "exe", "application/x-msdos-program" }, - { "bat", "application/x-msdos-program" }, - { "dll", "application/x-msdos-program" }, - { "msi", "application/x-msi" }, - { "nc", "application/x-netcdf" }, - { "pac", "application/x-ns-proxy-autoconfig" }, - { "dat", "application/x-ns-proxy-autoconfig" }, - { "nwc", "application/x-nwc" }, - { "o", "application/x-object" }, - { "oza", "application/x-oz-application" }, - { "p7r", "application/x-pkcs7-certreqresp" }, - { "crl", "application/x-pkcs7-crl" }, - { "pyc", "application/x-python-code" }, - { "pyo", "application/x-python-code" }, - { "qgs", "application/x-qgis" }, - { "shp", "application/x-qgis" }, - { "shx", "application/x-qgis" }, - { "qtl", "application/x-quicktimeplayer" }, - { "rpm", "application/x-redhat-package-manager" }, - { "rb", "application/x-ruby" }, - { "sh", "application/x-sh" }, - { "shar", "application/x-shar" }, - { "swf", "application/x-shockwave-flash" }, - { "swfl", "application/x-shockwave-flash" }, - { "scr", "application/x-silverlight" }, - { "sit", "application/x-stuffit" }, - { "sitx", "application/x-stuffit" }, - { "sv4cpio", "application/x-sv4cpio" }, - { "sv4crc", "application/x-sv4crc" }, - { "tar", "application/x-tar" }, - { "tcl", "application/x-tcl" }, - { "gf", "application/x-tex-gf" }, - { "pk", "application/x-tex-pk" }, - { "texinfo", "application/x-texinfo" }, - { "texi", "application/x-texinfo" }, - { "~", "application/x-trash" }, - { "%", "application/x-trash" }, - { "bak", "application/x-trash" }, - { "old", "application/x-trash" }, - { "sik", "application/x-trash" }, - { "t", "application/x-troff" }, - { "tr", "application/x-troff" }, - { "roff", "application/x-troff" }, - { "man", "application/x-troff-man" }, - { "me", "application/x-troff-me" }, - { "ms", "application/x-troff-ms" }, - { "ustar", "application/x-ustar" }, - { "src", "application/x-wais-source" }, - { "wz", "application/x-wingz" }, - { "crt", "application/x-x509-ca-cert" }, - { "xcf", "application/x-xcf" }, - { "fig", "application/x-xfig" }, - { "xpi", "application/x-xpinstall" }, - { "amr", "audio/amr" }, - { "awb", "audio/amr-wb" }, - { "axa", "audio/annodex" }, - { "au", "audio/basic" }, - { "snd", "audio/basic" }, - { "flac", "audio/flac" }, - { "mid", "audio/midi" }, - { "midi", "audio/midi" }, - { "kar", "audio/midi" }, - { "mpga", "audio/mpeg" }, - { "mpega", "audio/mpeg" }, - { "mp2", "audio/mpeg" }, - { "mp3", "audio/mpeg" }, - { "m4a", "audio/mpeg" }, - { "m3u", "audio/mpegurl" }, - { "oga", "audio/ogg" }, - { "ogg", "audio/ogg" }, - { "spx", "audio/ogg" }, - { "sid", "audio/prs.sid" }, - { "aif", "audio/x-aiff" }, - { "aiff", "audio/x-aiff" }, - { "aifc", "audio/x-aiff" }, - { "gsm", "audio/x-gsm" }, - { "wma", "audio/x-ms-wma" }, - { "wax", "audio/x-ms-wax" }, - { "ra", "audio/x-pn-realaudio" }, - { "rm", "audio/x-pn-realaudio" }, - { "ram", "audio/x-pn-realaudio" }, - { "pls", "audio/x-scpls" }, - { "sd2", "audio/x-sd2" }, - { "wav", "audio/x-wav" }, - { "alc", "chemical/x-alchemy" }, - { "cac", "chemical/x-cache" }, - { "cache", "chemical/x-cache" }, - { "csf", "chemical/x-cache-csf" }, - { "cbin", "chemical/x-cactvs-binary" }, - { "cascii", "chemical/x-cactvs-binary" }, - { "ctab", "chemical/x-cactvs-binary" }, - { "cdx", "chemical/x-cdx" }, - { "cer", "chemical/x-cerius" }, - { "c3d", "chemical/x-chem3d" }, - { "chm", "chemical/x-chemdraw" }, - { "cif", "chemical/x-cif" }, - { "cmdf", "chemical/x-cmdf" }, - { "cml", "chemical/x-cml" }, - { "cpa", "chemical/x-compass" }, - { "bsd", "chemical/x-crossfire" }, - { "csml", "chemical/x-csml" }, - { "csm", "chemical/x-csml" }, - { "ctx", "chemical/x-ctx" }, - { "cxf", "chemical/x-cxf" }, - { "cef", "chemical/x-cxf" }, - { "emb", "chemical/x-embl-dl-nucleotide" }, - { "embl", "chemical/x-embl-dl-nucleotide" }, - { "spc", "chemical/x-galactic-spc" }, - { "inp", "chemical/x-gamess-input" }, - { "gam", "chemical/x-gamess-input" }, - { "gamin", "chemical/x-gamess-input" }, - { "fch", "chemical/x-gaussian-checkpoint" }, - { "fchk", "chemical/x-gaussian-checkpoint" }, - { "cub", "chemical/x-gaussian-cube" }, - { "gau", "chemical/x-gaussian-input" }, - { "gjc", "chemical/x-gaussian-input" }, - { "gjf", "chemical/x-gaussian-input" }, - { "gal", "chemical/x-gaussian-log" }, - { "gcg", "chemical/x-gcg8-sequence" }, - { "gen", "chemical/x-genbank" }, - { "hin", "chemical/x-hin" }, - { "istr", "chemical/x-isostar" }, - { "ist", "chemical/x-isostar" }, - { "jdx", "chemical/x-jcamp-dx" }, - { "dx", "chemical/x-jcamp-dx" }, - { "kin", "chemical/x-kinemage" }, - { "mcm", "chemical/x-macmolecule" }, - { "mmd", "chemical/x-macromodel-input" }, - { "mmod", "chemical/x-macromodel-input" }, - { "mol", "chemical/x-mdl-molfile" }, - { "rd", "chemical/x-mdl-rdfile" }, - { "rxn", "chemical/x-mdl-rxnfile" }, - { "sd", "chemical/x-mdl-sdfile" }, - { "tgf", "chemical/x-mdl-tgf" }, - { "mcif", "chemical/x-mmcif" }, - { "mol2", "chemical/x-mol2" }, - { "b", "chemical/x-molconn-Z" }, - { "gpt", "chemical/x-mopac-graph" }, - { "mop", "chemical/x-mopac-input" }, - { "mopcrt", "chemical/x-mopac-input" }, - { "mpc", "chemical/x-mopac-input" }, - { "zmt", "chemical/x-mopac-input" }, - { "moo", "chemical/x-mopac-out" }, - { "mvb", "chemical/x-mopac-vib" }, - { "asn", "chemical/x-ncbi-asn1" }, - { "prt", "chemical/x-ncbi-asn1-ascii" }, - { "ent", "chemical/x-ncbi-asn1-ascii" }, - { "val", "chemical/x-ncbi-asn1-binary" }, - { "aso", "chemical/x-ncbi-asn1-binary" }, - { "pdb", "chemical/x-pdb" }, - { "ros", "chemical/x-rosdal" }, - { "sw", "chemical/x-swissprot" }, - { "vms", "chemical/x-vamas-iso14976" }, - { "vmd", "chemical/x-vmd" }, - { "xtel", "chemical/x-xtel" }, - { "xyz", "chemical/x-xyz" }, - { "gif", "image/gif" }, - { "ief", "image/ief" }, - { "jpeg", "image/jpeg" }, - { "jpg", "image/jpeg" }, - { "jpe", "image/jpeg" }, - { "pcx", "image/pcx" }, - { "png", "image/png" }, - { "svg", "image/svg+xml" }, - { "svgz", "image/svg+xml" }, - { "tiff", "image/tiff" }, - { "tif", "image/tiff" }, - { "djvu", "image/vnd.djvu" }, - { "djv", "image/vnd.djvu" }, - { "wbmp", "image/vnd.wap.wbmp" }, - { "cr2", "image/x-canon-cr2" }, - { "crw", "image/x-canon-crw" }, - { "ras", "image/x-cmu-raster" }, - { "cdr", "image/x-coreldraw" }, - { "pat", "image/x-coreldrawpattern" }, - { "cdt", "image/x-coreldrawtemplate" }, - { "erf", "image/x-epson-erf" }, - { "ico", "image/x-icon" }, - { "art", "image/x-jg" }, - { "jng", "image/x-jng" }, - { "bmp", "image/x-ms-bmp" }, - { "nef", "image/x-nikon-nef" }, - { "orf", "image/x-olympus-orf" }, - { "psd", "image/x-photoshop" }, - { "pnm", "image/x-portable-anymap" }, - { "pbm", "image/x-portable-bitmap" }, - { "pgm", "image/x-portable-graymap" }, - { "ppm", "image/x-portable-pixmap" }, - { "rgb", "image/x-rgb" }, - { "xbm", "image/x-xbitmap" }, - { "xpm", "image/x-xpixmap" }, - { "xwd", "image/x-xwindowdump" }, - { "eml", "message/rfc822" }, - { "igs", "model/iges" }, - { "iges", "model/iges" }, - { "msh", "model/mesh" }, - { "mesh", "model/mesh" }, - { "silo", "model/mesh" }, - { "wrl", "model/vrml" }, - { "vrml", "model/vrml" }, - { "x3dv", "model/x3d+vrml" }, - { "x3d", "model/x3d+xml" }, - { "x3db", "model/x3d+binary" }, - { "manifest", "text/cache-manifest" }, - { "ics", "text/calendar" }, - { "icz", "text/calendar" }, - { "css", "text/css" }, - { "csv", "text/csv" }, - { "323", "text/h323" }, - { "html", "text/html" }, - { "htm", "text/html" }, - { "shtml", "text/html" }, - { "uls", "text/iuls" }, - { "mml", "text/mathml" }, - { "asc", "text/plain" }, - { "txt", "text/plain" }, - { "text", "text/plain" }, - { "pot", "text/plain" }, - { "brf", "text/plain" }, - { "rtx", "text/richtext" }, - { "sct", "text/scriptlet" }, - { "wsc", "text/scriptlet" }, - { "tm", "text/texmacs" }, - { "ts", "text/texmacs" }, - { "tsv", "text/tab-separated-values" }, - { "jad", "text/vnd.sun.j2me.app-descriptor" }, - { "wml", "text/vnd.wap.wml" }, - { "wmls", "text/vnd.wap.wmlscript" }, - { "bib", "text/x-bibtex" }, - { "boo", "text/x-boo" }, - { "h++", "text/x-c++hdr" }, - { "hpp", "text/x-c++hdr" }, - { "hxx", "text/x-c++hdr" }, - { "hh", "text/x-c++hdr" }, - { "c++", "text/x-c++src" }, - { "cpp", "text/x-c++src" }, - { "cxx", "text/x-c++src" }, - { "cc", "text/x-c++src" }, - { "h", "text/x-chdr" }, - { "htc", "text/x-component" }, - { "c", "text/x-csrc" }, - { "d", "text/x-dsrc" }, - { "diff", "text/x-diff" }, - { "patch", "text/x-diff" }, - { "hs", "text/x-haskell" }, - { "java", "text/x-java" }, - { "lhs", "text/x-literate-haskell" }, - { "moc", "text/x-moc" }, - { "p", "text/x-pascal" }, - { "pas", "text/x-pascal" }, - { "gcd", "text/x-pcs-gcd" }, - { "pl", "text/x-perl" }, - { "pm", "text/x-perl" }, - { "py", "text/x-python" }, - { "scala", "text/x-scala" }, - { "etx", "text/x-setext" }, - { "tk", "text/x-tcl" }, - { "tex", "text/x-tex" }, - { "ltx", "text/x-tex" }, - { "sty", "text/x-tex" }, - { "cls", "text/x-tex" }, - { "vcs", "text/x-vcalendar" }, - { "vcf", "text/x-vcard" }, - { "3gp", "video/3gpp" }, - { "axv", "video/annodex" }, - { "dl", "video/dl" }, - { "dif", "video/dv" }, - { "dv", "video/dv" }, - { "fli", "video/fli" }, - { "gl", "video/gl" }, - { "mpeg", "video/mpeg" }, - { "mpg", "video/mpeg" }, - { "mpe", "video/mpeg" }, - { "mp4", "video/mp4" }, - { "qt", "video/quicktime" }, - { "mov", "video/quicktime" }, - { "ogv", "video/ogg" }, - { "mxu", "video/vnd.mpegurl" }, - { "flv", "video/x-flv" }, - { "lsf", "video/x-la-asf" }, - { "lsx", "video/x-la-asf" }, - { "mng", "video/x-mng" }, - { "asf", "video/x-ms-asf" }, - { "asx", "video/x-ms-asf" }, - { "wm", "video/x-ms-wm" }, - { "wmv", "video/x-ms-wmv" }, - { "wmx", "video/x-ms-wmx" }, - { "wvx", "video/x-ms-wvx" }, - { "avi", "video/x-msvideo" }, - { "movie", "video/x-sgi-movie" }, - { "mpv", "video/x-matroska" }, - { "mkv", "video/x-matroska" }, - { "ice", "x-conference/x-cooltalk" }, - { "sisx", "x-epoc/x-sisx-app" }, - { "vrm", "x-world/x-vrml" } - }; + { + { "ez", "application/andrew-inset" }, + { "anx", "application/annodex" }, + { "atom", "application/atom+xml" }, + { "atomcat", "application/atomcat+xml" }, + { "atomsrv", "application/atomserv+xml" }, + { "lin", "application/bbolin" }, + { "cap", "application/cap" }, + { "pcap", "application/cap" }, + { "cu", "application/cu-seeme" }, + { "davmount", "application/davmount+xml" }, + { "tsp", "application/dsptype" }, + { "es", "application/ecmascript" }, + { "spl", "application/futuresplash" }, + { "hta", "application/hta" }, + { "jar", "application/java-archive" }, + { "ser", "application/java-serialized-object" }, + { "class", "application/java-vm" }, + { "js", "application/javascript" }, + { "json", "application/json" }, + { "m3g", "application/m3g" }, + { "hqx", "application/mac-binhex40" }, + { "cpt", "application/mac-compactpro" }, + { "nb", "application/mathematica" }, + { "nbp", "application/mathematica" }, + { "mdb", "application/msaccess" }, + { "doc", "application/msword" }, + { "dot", "application/msword" }, + { "mxf", "application/mxf" }, + { "bin", "application/octet-stream" }, + { "oda", "application/oda" }, + { "ogx", "application/ogg" }, + { "pdf", "application/pdf" }, + { "key", "application/pgp-keys" }, + { "pgp", "application/pgp-signature" }, + { "prf", "application/pics-rules" }, + { "ps", "application/postscript" }, + { "ai", "application/postscript" }, + { "eps", "application/postscript" }, + { "epsi", "application/postscript" }, + { "epsf", "application/postscript" }, + { "eps2", "application/postscript" }, + { "eps3", "application/postscript" }, + { "rar", "application/rar" }, + { "rdf", "application/rdf+xml" }, + { "rss", "application/rss+xml" }, + { "rtf", "application/rtf" }, + { "smi", "application/smil" }, + { "smil", "application/smil" }, + { "xhtml", "application/xhtml+xml" }, + { "xht", "application/xhtml+xml" }, + { "xml", "application/xml" }, + { "xsl", "application/xml" }, + { "xsd", "application/xml" }, + { "xspf", "application/xspf+xml" }, + { "zip", "application/zip" }, + { "apk", "application/vnd.android.package-archive" }, + { "cdy", "application/vnd.cinderella" }, + { "kml", "application/vnd.google-earth.kml+xml" }, + { "kmz", "application/vnd.google-earth.kmz" }, + { "xul", "application/vnd.mozilla.xul+xml" }, + { "xls", "application/vnd.ms-excel" }, + { "xlb", "application/vnd.ms-excel" }, + { "xlt", "application/vnd.ms-excel" }, + { "cat", "application/vnd.ms-pki.seccat" }, + { "stl", "application/vnd.ms-pki.stl" }, + { "ppt", "application/vnd.ms-powerpoint" }, + { "pps", "application/vnd.ms-powerpoint" }, + { "odc", "application/vnd.oasis.opendocument.chart" }, + { "odb", "application/vnd.oasis.opendocument.database" }, + { "odf", "application/vnd.oasis.opendocument.formula" }, + { "odg", "application/vnd.oasis.opendocument.graphics" }, + { "otg", "application/vnd.oasis.opendocument.graphics-template" }, + { "odi", "application/vnd.oasis.opendocument.image" }, + { "odp", "application/vnd.oasis.opendocument.presentation" }, + { "otp", "application/vnd.oasis.opendocument.presentation-template" }, + { "ods", "application/vnd.oasis.opendocument.spreadsheet" }, + { "ots", "application/vnd.oasis.opendocument.spreadsheet-template" }, + { "odt", "application/vnd.oasis.opendocument.text" }, + { "odm", "application/vnd.oasis.opendocument.text-master" }, + { "ott", "application/vnd.oasis.opendocument.text-template" }, + { "oth", "application/vnd.oasis.opendocument.text-web" }, + { "xlsx", "application/vnd.openxmlformats-officedocument.spreadsheetml.sheet" }, + { "xltx", "application/vnd.openxmlformats-officedocument.spreadsheetml.template" }, + { "pptx", "application/vnd.openxmlformats-officedocument.presentationml.presentation" }, + { "ppsx", "application/vnd.openxmlformats-officedocument.presentationml.slideshow" }, + { "potx", "application/vnd.openxmlformats-officedocument.presentationml.template" }, + { "docx", "application/vnd.openxmlformats-officedocument.wordprocessingml.document" }, + { "dotx", "application/vnd.openxmlformats-officedocument.wordprocessingml.template" }, + { "cod", "application/vnd.rim.cod" }, + { "mmf", "application/vnd.smaf" }, + { "sdc", "application/vnd.stardivision.calc" }, + { "sds", "application/vnd.stardivision.chart" }, + { "sda", "application/vnd.stardivision.draw" }, + { "sdd", "application/vnd.stardivision.impress" }, + { "sdf", "application/vnd.stardivision.math" }, + { "sdw", "application/vnd.stardivision.writer" }, + { "sgl", "application/vnd.stardivision.writer-global" }, + { "sxc", "application/vnd.sun.xml.calc" }, + { "stc", "application/vnd.sun.xml.calc.template" }, + { "sxd", "application/vnd.sun.xml.draw" }, + { "std", "application/vnd.sun.xml.draw.template" }, + { "sxi", "application/vnd.sun.xml.impress" }, + { "sti", "application/vnd.sun.xml.impress.template" }, + { "sxm", "application/vnd.sun.xml.math" }, + { "sxw", "application/vnd.sun.xml.writer" }, + { "sxg", "application/vnd.sun.xml.writer.global" }, + { "stw", "application/vnd.sun.xml.writer.template" }, + { "sis", "application/vnd.symbian.install" }, + { "vsd", "application/vnd.visio" }, + { "wbxml", "application/vnd.wap.wbxml" }, + { "wmlc", "application/vnd.wap.wmlc" }, + { "wmlsc", "application/vnd.wap.wmlscriptc" }, + { "wpd", "application/vnd.wordperfect" }, + { "wp5", "application/vnd.wordperfect5.1" }, + { "wk", "application/x-123" }, + { "7z", "application/x-7z-compressed" }, + { "abw", "application/x-abiword" }, + { "dmg", "application/x-apple-diskimage" }, + { "bcpio", "application/x-bcpio" }, + { "torrent", "application/x-bittorrent" }, + { "cab", "application/x-cab" }, + { "cbr", "application/x-cbr" }, + { "cbz", "application/x-cbz" }, + { "cdf", "application/x-cdf" }, + { "cda", "application/x-cdf" }, + { "vcd", "application/x-cdlink" }, + { "pgn", "application/x-chess-pgn" }, + { "cpio", "application/x-cpio" }, + { "csh", "application/x-csh" }, + { "deb", "application/x-debian-package" }, + { "udeb", "application/x-debian-package" }, + { "dcr", "application/x-director" }, + { "dir", "application/x-director" }, + { "dxr", "application/x-director" }, + { "dms", "application/x-dms" }, + { "wad", "application/x-doom" }, + { "dvi", "application/x-dvi" }, + { "rhtml", "application/x-httpd-eruby" }, + { "pfa", "application/x-font" }, + { "pfb", "application/x-font" }, + { "gsf", "application/x-font" }, + { "pcf", "application/x-font" }, + { "pcf.Z", "application/x-font" }, + { "mm", "application/x-freemind" }, + { "gnumeric", "application/x-gnumeric" }, + { "sgf", "application/x-go-sgf" }, + { "gcf", "application/x-graphing-calculator" }, + { "gtar", "application/x-gtar" }, + { "tgz", "application/x-gtar" }, + { "taz", "application/x-gtar" }, + { "hdf", "application/x-hdf" }, + { "phtml", "application/x-httpd-php" }, + { "pht", "application/x-httpd-php" }, + { "php", "application/x-httpd-php" }, + { "phps", "application/x-httpd-php-source" }, + { "php3", "application/x-httpd-php3" }, + { "php3p", "application/x-httpd-php3-preprocessed" }, + { "php4", "application/x-httpd-php4" }, + { "php5", "application/x-httpd-php5" }, + { "ica", "application/x-ica" }, + { "info", "application/x-info" }, + { "ins", "application/x-internet-signup" }, + { "isp", "application/x-internet-signup" }, + { "iii", "application/x-iphone" }, + { "iso", "application/x-iso9660-image" }, + { "jam", "application/x-jam" }, + { "jnlp", "application/x-java-jnlp-file" }, + { "jmz", "application/x-jmol" }, + { "chrt", "application/x-kchart" }, + { "kil", "application/x-killustrator" }, + { "skp", "application/x-koan" }, + { "skd", "application/x-koan" }, + { "skt", "application/x-koan" }, + { "skm", "application/x-koan" }, + { "kpr", "application/x-kpresenter" }, + { "kpt", "application/x-kpresenter" }, + { "ksp", "application/x-kspread" }, + { "kwd", "application/x-kword" }, + { "kwt", "application/x-kword" }, + { "latex", "application/x-latex" }, + { "lha", "application/x-lha" }, + { "lyx", "application/x-lyx" }, + { "lzh", "application/x-lzh" }, + { "lzx", "application/x-lzx" }, + { "frm", "application/x-maker" }, + { "maker", "application/x-maker" }, + { "frame", "application/x-maker" }, + { "fm", "application/x-maker" }, + { "fb", "application/x-maker" }, + { "book", "application/x-maker" }, + { "fbdoc", "application/x-maker" }, + { "mif", "application/x-mif" }, + { "wmd", "application/x-ms-wmd" }, + { "wmz", "application/x-ms-wmz" }, + { "com", "application/x-msdos-program" }, + { "exe", "application/x-msdos-program" }, + { "bat", "application/x-msdos-program" }, + { "dll", "application/x-msdos-program" }, + { "msi", "application/x-msi" }, + { "nc", "application/x-netcdf" }, + { "pac", "application/x-ns-proxy-autoconfig" }, + { "dat", "application/x-ns-proxy-autoconfig" }, + { "nwc", "application/x-nwc" }, + { "o", "application/x-object" }, + { "oza", "application/x-oz-application" }, + { "p7r", "application/x-pkcs7-certreqresp" }, + { "crl", "application/x-pkcs7-crl" }, + { "pyc", "application/x-python-code" }, + { "pyo", "application/x-python-code" }, + { "qgs", "application/x-qgis" }, + { "shp", "application/x-qgis" }, + { "shx", "application/x-qgis" }, + { "qtl", "application/x-quicktimeplayer" }, + { "rpm", "application/x-redhat-package-manager" }, + { "rb", "application/x-ruby" }, + { "sh", "application/x-sh" }, + { "shar", "application/x-shar" }, + { "swf", "application/x-shockwave-flash" }, + { "swfl", "application/x-shockwave-flash" }, + { "scr", "application/x-silverlight" }, + { "sit", "application/x-stuffit" }, + { "sitx", "application/x-stuffit" }, + { "sv4cpio", "application/x-sv4cpio" }, + { "sv4crc", "application/x-sv4crc" }, + { "tar", "application/x-tar" }, + { "tcl", "application/x-tcl" }, + { "gf", "application/x-tex-gf" }, + { "pk", "application/x-tex-pk" }, + { "texinfo", "application/x-texinfo" }, + { "texi", "application/x-texinfo" }, + { "~", "application/x-trash" }, + { "%", "application/x-trash" }, + { "bak", "application/x-trash" }, + { "old", "application/x-trash" }, + { "sik", "application/x-trash" }, + { "t", "application/x-troff" }, + { "tr", "application/x-troff" }, + { "roff", "application/x-troff" }, + { "man", "application/x-troff-man" }, + { "me", "application/x-troff-me" }, + { "ms", "application/x-troff-ms" }, + { "ustar", "application/x-ustar" }, + { "src", "application/x-wais-source" }, + { "wz", "application/x-wingz" }, + { "crt", "application/x-x509-ca-cert" }, + { "xcf", "application/x-xcf" }, + { "fig", "application/x-xfig" }, + { "xpi", "application/x-xpinstall" }, + { "amr", "audio/amr" }, + { "awb", "audio/amr-wb" }, + { "axa", "audio/annodex" }, + { "au", "audio/basic" }, + { "snd", "audio/basic" }, + { "flac", "audio/flac" }, + { "mid", "audio/midi" }, + { "midi", "audio/midi" }, + { "kar", "audio/midi" }, + { "mpga", "audio/mpeg" }, + { "mpega", "audio/mpeg" }, + { "mp2", "audio/mpeg" }, + { "mp3", "audio/mpeg" }, + { "m4a", "audio/mpeg" }, + { "m3u", "audio/mpegurl" }, + { "oga", "audio/ogg" }, + { "ogg", "audio/ogg" }, + { "spx", "audio/ogg" }, + { "sid", "audio/prs.sid" }, + { "aif", "audio/x-aiff" }, + { "aiff", "audio/x-aiff" }, + { "aifc", "audio/x-aiff" }, + { "gsm", "audio/x-gsm" }, + { "wma", "audio/x-ms-wma" }, + { "wax", "audio/x-ms-wax" }, + { "ra", "audio/x-pn-realaudio" }, + { "rm", "audio/x-pn-realaudio" }, + { "ram", "audio/x-pn-realaudio" }, + { "pls", "audio/x-scpls" }, + { "sd2", "audio/x-sd2" }, + { "wav", "audio/x-wav" }, + { "alc", "chemical/x-alchemy" }, + { "cac", "chemical/x-cache" }, + { "cache", "chemical/x-cache" }, + { "csf", "chemical/x-cache-csf" }, + { "cbin", "chemical/x-cactvs-binary" }, + { "cascii", "chemical/x-cactvs-binary" }, + { "ctab", "chemical/x-cactvs-binary" }, + { "cdx", "chemical/x-cdx" }, + { "cer", "chemical/x-cerius" }, + { "c3d", "chemical/x-chem3d" }, + { "chm", "chemical/x-chemdraw" }, + { "cif", "chemical/x-cif" }, + { "cmdf", "chemical/x-cmdf" }, + { "cml", "chemical/x-cml" }, + { "cpa", "chemical/x-compass" }, + { "bsd", "chemical/x-crossfire" }, + { "csml", "chemical/x-csml" }, + { "csm", "chemical/x-csml" }, + { "ctx", "chemical/x-ctx" }, + { "cxf", "chemical/x-cxf" }, + { "cef", "chemical/x-cxf" }, + { "emb", "chemical/x-embl-dl-nucleotide" }, + { "embl", "chemical/x-embl-dl-nucleotide" }, + { "spc", "chemical/x-galactic-spc" }, + { "inp", "chemical/x-gamess-input" }, + { "gam", "chemical/x-gamess-input" }, + { "gamin", "chemical/x-gamess-input" }, + { "fch", "chemical/x-gaussian-checkpoint" }, + { "fchk", "chemical/x-gaussian-checkpoint" }, + { "cub", "chemical/x-gaussian-cube" }, + { "gau", "chemical/x-gaussian-input" }, + { "gjc", "chemical/x-gaussian-input" }, + { "gjf", "chemical/x-gaussian-input" }, + { "gal", "chemical/x-gaussian-log" }, + { "gcg", "chemical/x-gcg8-sequence" }, + { "gen", "chemical/x-genbank" }, + { "hin", "chemical/x-hin" }, + { "istr", "chemical/x-isostar" }, + { "ist", "chemical/x-isostar" }, + { "jdx", "chemical/x-jcamp-dx" }, + { "dx", "chemical/x-jcamp-dx" }, + { "kin", "chemical/x-kinemage" }, + { "mcm", "chemical/x-macmolecule" }, + { "mmd", "chemical/x-macromodel-input" }, + { "mmod", "chemical/x-macromodel-input" }, + { "mol", "chemical/x-mdl-molfile" }, + { "rd", "chemical/x-mdl-rdfile" }, + { "rxn", "chemical/x-mdl-rxnfile" }, + { "sd", "chemical/x-mdl-sdfile" }, + { "tgf", "chemical/x-mdl-tgf" }, + { "mcif", "chemical/x-mmcif" }, + { "mol2", "chemical/x-mol2" }, + { "b", "chemical/x-molconn-Z" }, + { "gpt", "chemical/x-mopac-graph" }, + { "mop", "chemical/x-mopac-input" }, + { "mopcrt", "chemical/x-mopac-input" }, + { "mpc", "chemical/x-mopac-input" }, + { "zmt", "chemical/x-mopac-input" }, + { "moo", "chemical/x-mopac-out" }, + { "mvb", "chemical/x-mopac-vib" }, + { "asn", "chemical/x-ncbi-asn1" }, + { "prt", "chemical/x-ncbi-asn1-ascii" }, + { "ent", "chemical/x-ncbi-asn1-ascii" }, + { "val", "chemical/x-ncbi-asn1-binary" }, + { "aso", "chemical/x-ncbi-asn1-binary" }, + { "pdb", "chemical/x-pdb" }, + { "ros", "chemical/x-rosdal" }, + { "sw", "chemical/x-swissprot" }, + { "vms", "chemical/x-vamas-iso14976" }, + { "vmd", "chemical/x-vmd" }, + { "xtel", "chemical/x-xtel" }, + { "xyz", "chemical/x-xyz" }, + { "gif", "image/gif" }, + { "ief", "image/ief" }, + { "jpeg", "image/jpeg" }, + { "jpg", "image/jpeg" }, + { "jpe", "image/jpeg" }, + { "pcx", "image/pcx" }, + { "png", "image/png" }, + { "svg", "image/svg+xml" }, + { "svgz", "image/svg+xml" }, + { "tiff", "image/tiff" }, + { "tif", "image/tiff" }, + { "djvu", "image/vnd.djvu" }, + { "djv", "image/vnd.djvu" }, + { "wbmp", "image/vnd.wap.wbmp" }, + { "cr2", "image/x-canon-cr2" }, + { "crw", "image/x-canon-crw" }, + { "ras", "image/x-cmu-raster" }, + { "cdr", "image/x-coreldraw" }, + { "pat", "image/x-coreldrawpattern" }, + { "cdt", "image/x-coreldrawtemplate" }, + { "erf", "image/x-epson-erf" }, + { "ico", "image/x-icon" }, + { "art", "image/x-jg" }, + { "jng", "image/x-jng" }, + { "bmp", "image/x-ms-bmp" }, + { "nef", "image/x-nikon-nef" }, + { "orf", "image/x-olympus-orf" }, + { "psd", "image/x-photoshop" }, + { "pnm", "image/x-portable-anymap" }, + { "pbm", "image/x-portable-bitmap" }, + { "pgm", "image/x-portable-graymap" }, + { "ppm", "image/x-portable-pixmap" }, + { "rgb", "image/x-rgb" }, + { "xbm", "image/x-xbitmap" }, + { "xpm", "image/x-xpixmap" }, + { "xwd", "image/x-xwindowdump" }, + { "eml", "message/rfc822" }, + { "igs", "model/iges" }, + { "iges", "model/iges" }, + { "msh", "model/mesh" }, + { "mesh", "model/mesh" }, + { "silo", "model/mesh" }, + { "wrl", "model/vrml" }, + { "vrml", "model/vrml" }, + { "x3dv", "model/x3d+vrml" }, + { "x3d", "model/x3d+xml" }, + { "x3db", "model/x3d+binary" }, + { "manifest", "text/cache-manifest" }, + { "ics", "text/calendar" }, + { "icz", "text/calendar" }, + { "css", "text/css" }, + { "csv", "text/csv" }, + { "323", "text/h323" }, + { "html", "text/html" }, + { "htm", "text/html" }, + { "shtml", "text/html" }, + { "uls", "text/iuls" }, + { "mml", "text/mathml" }, + { "asc", "text/plain" }, + { "txt", "text/plain" }, + { "text", "text/plain" }, + { "pot", "text/plain" }, + { "brf", "text/plain" }, + { "rtx", "text/richtext" }, + { "sct", "text/scriptlet" }, + { "wsc", "text/scriptlet" }, + { "tm", "text/texmacs" }, + { "ts", "text/texmacs" }, + { "tsv", "text/tab-separated-values" }, + { "jad", "text/vnd.sun.j2me.app-descriptor" }, + { "wml", "text/vnd.wap.wml" }, + { "wmls", "text/vnd.wap.wmlscript" }, + { "bib", "text/x-bibtex" }, + { "boo", "text/x-boo" }, + { "h++", "text/x-c++hdr" }, + { "hpp", "text/x-c++hdr" }, + { "hxx", "text/x-c++hdr" }, + { "hh", "text/x-c++hdr" }, + { "c++", "text/x-c++src" }, + { "cpp", "text/x-c++src" }, + { "cxx", "text/x-c++src" }, + { "cc", "text/x-c++src" }, + { "h", "text/x-chdr" }, + { "htc", "text/x-component" }, + { "c", "text/x-csrc" }, + { "d", "text/x-dsrc" }, + { "diff", "text/x-diff" }, + { "patch", "text/x-diff" }, + { "hs", "text/x-haskell" }, + { "java", "text/x-java" }, + { "lhs", "text/x-literate-haskell" }, + { "moc", "text/x-moc" }, + { "p", "text/x-pascal" }, + { "pas", "text/x-pascal" }, + { "gcd", "text/x-pcs-gcd" }, + { "pl", "text/x-perl" }, + { "pm", "text/x-perl" }, + { "py", "text/x-python" }, + { "scala", "text/x-scala" }, + { "etx", "text/x-setext" }, + { "tk", "text/x-tcl" }, + { "tex", "text/x-tex" }, + { "ltx", "text/x-tex" }, + { "sty", "text/x-tex" }, + { "cls", "text/x-tex" }, + { "vcs", "text/x-vcalendar" }, + { "vcf", "text/x-vcard" }, + { "3gp", "video/3gpp" }, + { "axv", "video/annodex" }, + { "dl", "video/dl" }, + { "dif", "video/dv" }, + { "dv", "video/dv" }, + { "fli", "video/fli" }, + { "gl", "video/gl" }, + { "mpeg", "video/mpeg" }, + { "mpg", "video/mpeg" }, + { "mpe", "video/mpeg" }, + { "mp4", "video/mp4" }, + { "qt", "video/quicktime" }, + { "mov", "video/quicktime" }, + { "ogv", "video/ogg" }, + { "mxu", "video/vnd.mpegurl" }, + { "flv", "video/x-flv" }, + { "lsf", "video/x-la-asf" }, + { "lsx", "video/x-la-asf" }, + { "mng", "video/x-mng" }, + { "asf", "video/x-ms-asf" }, + { "asx", "video/x-ms-asf" }, + { "wm", "video/x-ms-wm" }, + { "wmv", "video/x-ms-wmv" }, + { "wmx", "video/x-ms-wmx" }, + { "wvx", "video/x-ms-wvx" }, + { "avi", "video/x-msvideo" }, + { "movie", "video/x-sgi-movie" }, + { "mpv", "video/x-matroska" }, + { "mkv", "video/x-matroska" }, + { "ice", "x-conference/x-cooltalk" }, + { "sisx", "x-epoc/x-sisx-app" }, + { "vrm", "x-world/x-vrml" } + }; /// /// Returns the mime type for the requested file extension. Returns diff --git a/SlackAPI/OwnedStampedMessage.cs b/SlackAPI/OwnedStampedMessage.cs index d756e4b..ec05877 100644 --- a/SlackAPI/OwnedStampedMessage.cs +++ b/SlackAPI/OwnedStampedMessage.cs @@ -1,10 +1,4 @@ -using System; -using System.Collections.Generic; -using System.Linq; -using System.Text; -using System.Threading.Tasks; - -namespace SlackAPI +namespace SlackAPI { public class OwnedStampedMessage { diff --git a/SlackAPI/Preferences.cs b/SlackAPI/Preferences.cs index 92f48a5..08cd6ce 100644 --- a/SlackAPI/Preferences.cs +++ b/SlackAPI/Preferences.cs @@ -1,6 +1,4 @@ -using System; - -namespace SlackAPI +namespace SlackAPI { public class Preferences { diff --git a/SlackAPI/RPCMessages/AccessTokenResponse.cs b/SlackAPI/RPCMessages/AccessTokenResponse.cs index ebf9fb9..7a19d6c 100644 --- a/SlackAPI/RPCMessages/AccessTokenResponse.cs +++ b/SlackAPI/RPCMessages/AccessTokenResponse.cs @@ -1,10 +1,4 @@ -using System; -using System.Collections.Generic; -using System.Linq; -using System.Text; -using System.Threading.Tasks; - -namespace SlackAPI +namespace SlackAPI { [RequestPath("oauth.access")] public class AccessTokenResponse : Response diff --git a/SlackAPI/RPCMessages/AdminDeleteResponse.cs b/SlackAPI/RPCMessages/AdminDeleteResponse.cs new file mode 100644 index 0000000..2db14c1 --- /dev/null +++ b/SlackAPI/RPCMessages/AdminDeleteResponse.cs @@ -0,0 +1,7 @@ +namespace SlackAPI +{ + [RequestPath("users.admin.delete")] + public class AdminDeleteResponse : Response + { + } +} diff --git a/SlackAPI/RPCMessages/AdminInviteResponse.cs b/SlackAPI/RPCMessages/AdminInviteResponse.cs new file mode 100644 index 0000000..6134e25 --- /dev/null +++ b/SlackAPI/RPCMessages/AdminInviteResponse.cs @@ -0,0 +1,7 @@ +namespace SlackAPI +{ + [RequestPath("users.admin.invite")] + public class AdminInviteResponse : Response + { + } +} diff --git a/SlackAPI/RPCMessages/AdminSetInactiveResponse.cs b/SlackAPI/RPCMessages/AdminSetInactiveResponse.cs new file mode 100644 index 0000000..0495adf --- /dev/null +++ b/SlackAPI/RPCMessages/AdminSetInactiveResponse.cs @@ -0,0 +1,7 @@ +namespace SlackAPI +{ + [RequestPath("users.admin.setInactive")] + public class AdminSetInactiveResponse : Response + { + } +} diff --git a/SlackAPI/RPCMessages/AuthSigninResponse.cs b/SlackAPI/RPCMessages/AuthSigninResponse.cs index c086581..30e5fde 100644 --- a/SlackAPI/RPCMessages/AuthSigninResponse.cs +++ b/SlackAPI/RPCMessages/AuthSigninResponse.cs @@ -1,6 +1,4 @@ -using System; - -namespace SlackAPI +namespace SlackAPI { [RequestPath("auth.signin")] public class AuthSigninResponse : Response diff --git a/SlackAPI/RPCMessages/AuthStartResponse.cs b/SlackAPI/RPCMessages/AuthStartResponse.cs index 93dde36..70b7c92 100644 --- a/SlackAPI/RPCMessages/AuthStartResponse.cs +++ b/SlackAPI/RPCMessages/AuthStartResponse.cs @@ -1,6 +1,4 @@ -using System; - -namespace SlackAPI +namespace SlackAPI { [RequestPath("auth.start")] public class AuthStartResponse : Response diff --git a/SlackAPI/RPCMessages/AuthTestResponse.cs b/SlackAPI/RPCMessages/AuthTestResponse.cs index 2e9657e..7fb89e6 100644 --- a/SlackAPI/RPCMessages/AuthTestResponse.cs +++ b/SlackAPI/RPCMessages/AuthTestResponse.cs @@ -1,10 +1,4 @@ -using System; -using System.Collections.Generic; -using System.Linq; -using System.Text; -using System.Threading.Tasks; - -namespace SlackAPI +namespace SlackAPI { [RequestPath("auth.test", true)] public class AuthTestResponse : Response diff --git a/SlackAPI/RPCMessages/ChannelArchiveResponse.cs b/SlackAPI/RPCMessages/ChannelArchiveResponse.cs new file mode 100644 index 0000000..dc16d61 --- /dev/null +++ b/SlackAPI/RPCMessages/ChannelArchiveResponse.cs @@ -0,0 +1,7 @@ +namespace SlackAPI +{ + [RequestPath("channels.archive")] + public class ChannelArchiveResponse : Response + { + } +} diff --git a/SlackAPI/RPCMessages/ChannelCreateResponse.cs b/SlackAPI/RPCMessages/ChannelCreateResponse.cs index b527365..87c22be 100644 --- a/SlackAPI/RPCMessages/ChannelCreateResponse.cs +++ b/SlackAPI/RPCMessages/ChannelCreateResponse.cs @@ -1,6 +1,4 @@ -using System; - -namespace SlackAPI +namespace SlackAPI { [RequestPath("channels.create")] public class ChannelCreateResponse : Response diff --git a/SlackAPI/RPCMessages/ChannelInviteResponse.cs b/SlackAPI/RPCMessages/ChannelInviteResponse.cs new file mode 100644 index 0000000..adb47e7 --- /dev/null +++ b/SlackAPI/RPCMessages/ChannelInviteResponse.cs @@ -0,0 +1,7 @@ +namespace SlackAPI +{ + [RequestPath("channels.invite")] + public class ChannelInviteResponse : ChannelResponse + { + } +} diff --git a/SlackAPI/RPCMessages/ChannelListResponse.cs b/SlackAPI/RPCMessages/ChannelListResponse.cs index 22280c1..0e3d5c1 100644 --- a/SlackAPI/RPCMessages/ChannelListResponse.cs +++ b/SlackAPI/RPCMessages/ChannelListResponse.cs @@ -1,6 +1,4 @@ -using System; - -namespace SlackAPI +namespace SlackAPI { [RequestPath("channels.list")] public class ChannelListResponse : Response diff --git a/SlackAPI/RPCMessages/ChannelMessageHistory.cs b/SlackAPI/RPCMessages/ChannelMessageHistory.cs index 27fb059..b8af5cb 100644 --- a/SlackAPI/RPCMessages/ChannelMessageHistory.cs +++ b/SlackAPI/RPCMessages/ChannelMessageHistory.cs @@ -1,10 +1,4 @@ -using System; -using System.Collections.Generic; -using System.Linq; -using System.Text; -using System.Threading.Tasks; - -namespace SlackAPI +namespace SlackAPI { [RequestPath("channels.history")] public class ChannelMessageHistory : MessageHistory diff --git a/SlackAPI/RPCMessages/ChannelRenameResponse.cs b/SlackAPI/RPCMessages/ChannelRenameResponse.cs new file mode 100644 index 0000000..4788e9e --- /dev/null +++ b/SlackAPI/RPCMessages/ChannelRenameResponse.cs @@ -0,0 +1,10 @@ +namespace SlackAPI +{ + // https://api.slack.com/methods/channels.rename + [RequestPath("channels.rename")] + public class ChannelRenameResponse : Response + { + public string name; + public string created; + } +} diff --git a/SlackAPI/RPCMessages/ChannelResponse.cs b/SlackAPI/RPCMessages/ChannelResponse.cs new file mode 100644 index 0000000..c8e84c9 --- /dev/null +++ b/SlackAPI/RPCMessages/ChannelResponse.cs @@ -0,0 +1,7 @@ +namespace SlackAPI +{ + public class ChannelResponse : Response + { + public Channel channel; + } +} diff --git a/SlackAPI/RPCMessages/ChannelSetPurposeResponse.cs b/SlackAPI/RPCMessages/ChannelSetPurposeResponse.cs new file mode 100644 index 0000000..22cb96b --- /dev/null +++ b/SlackAPI/RPCMessages/ChannelSetPurposeResponse.cs @@ -0,0 +1,9 @@ +namespace SlackAPI +{ + // https://api.slack.com/methods/channels.setPurpose + [RequestPath("channels.setPurpose")] + public class ChannelSetPurposeResponse : Response + { + public string purpose; + } +} diff --git a/SlackAPI/RPCMessages/ChannelUnarchiveResponse.cs b/SlackAPI/RPCMessages/ChannelUnarchiveResponse.cs new file mode 100644 index 0000000..7043501 --- /dev/null +++ b/SlackAPI/RPCMessages/ChannelUnarchiveResponse.cs @@ -0,0 +1,7 @@ +namespace SlackAPI +{ + [RequestPath("channels.unarchive")] + public class ChannelUnarchiveResponse : Response + { + } +} diff --git a/SlackAPI/RPCMessages/DeletedResponse.cs b/SlackAPI/RPCMessages/DeletedResponse.cs index 89b5af8..59bd7a9 100644 --- a/SlackAPI/RPCMessages/DeletedResponse.cs +++ b/SlackAPI/RPCMessages/DeletedResponse.cs @@ -1,8 +1,4 @@ using System; -using System.Collections.Generic; -using System.Linq; -using System.Text; -using System.Threading.Tasks; namespace SlackAPI { diff --git a/SlackAPI/RPCMessages/DirectMessageConversationListResponse.cs b/SlackAPI/RPCMessages/DirectMessageConversationListResponse.cs index 59746ad..8f9ccd5 100644 --- a/SlackAPI/RPCMessages/DirectMessageConversationListResponse.cs +++ b/SlackAPI/RPCMessages/DirectMessageConversationListResponse.cs @@ -1,10 +1,4 @@ -using System; -using System.Collections.Generic; -using System.Linq; -using System.Text; -using System.Threading.Tasks; - -namespace SlackAPI +namespace SlackAPI { [RequestPath("im.list")] public class DirectMessageConversationListResponse : Response diff --git a/SlackAPI/RPCMessages/FileInfoResponse.cs b/SlackAPI/RPCMessages/FileInfoResponse.cs index 38270a8..41455c6 100644 --- a/SlackAPI/RPCMessages/FileInfoResponse.cs +++ b/SlackAPI/RPCMessages/FileInfoResponse.cs @@ -1,10 +1,4 @@ -using System; -using System.Collections.Generic; -using System.Linq; -using System.Text; -using System.Threading.Tasks; - -namespace SlackAPI +namespace SlackAPI { [RequestPath("files.info")] public class FileInfoResponse : Response diff --git a/SlackAPI/RPCMessages/FileListResponse.cs b/SlackAPI/RPCMessages/FileListResponse.cs index 2771aba..6b1968b 100644 --- a/SlackAPI/RPCMessages/FileListResponse.cs +++ b/SlackAPI/RPCMessages/FileListResponse.cs @@ -1,10 +1,4 @@ -using System; -using System.Collections.Generic; -using System.Linq; -using System.Text; -using System.Threading.Tasks; - -namespace SlackAPI +namespace SlackAPI { [RequestPath("files.list")] public class FileListResponse : Response diff --git a/SlackAPI/RPCMessages/FileUploadResponse.cs b/SlackAPI/RPCMessages/FileUploadResponse.cs index dcf80f4..9ca74bd 100644 --- a/SlackAPI/RPCMessages/FileUploadResponse.cs +++ b/SlackAPI/RPCMessages/FileUploadResponse.cs @@ -1,10 +1,4 @@ -using System; -using System.Collections.Generic; -using System.Linq; -using System.Text; -using System.Threading.Tasks; - -namespace SlackAPI +namespace SlackAPI { [RequestPath("files.upload")] public class FileUploadResponse : Response diff --git a/SlackAPI/RPCMessages/FindTeamResponse.cs b/SlackAPI/RPCMessages/FindTeamResponse.cs index d0b2d09..261e84f 100644 --- a/SlackAPI/RPCMessages/FindTeamResponse.cs +++ b/SlackAPI/RPCMessages/FindTeamResponse.cs @@ -1,10 +1,4 @@ -using System; -using System.Collections.Generic; -using System.Linq; -using System.Text; -using System.Threading.Tasks; - -namespace SlackAPI +namespace SlackAPI { /// /// This is an undocumented response from an undocumented API. If anyone finds more info on this, please create a pull request. diff --git a/SlackAPI/RPCMessages/GroupArchiveResponse.cs b/SlackAPI/RPCMessages/GroupArchiveResponse.cs index d043012..545bfea 100644 --- a/SlackAPI/RPCMessages/GroupArchiveResponse.cs +++ b/SlackAPI/RPCMessages/GroupArchiveResponse.cs @@ -1,10 +1,4 @@ -using System; -using System.Collections.Generic; -using System.Linq; -using System.Text; -using System.Threading.Tasks; - -namespace SlackAPI +namespace SlackAPI { [RequestPath("groups.archive")] public class GroupArchiveResponse : Response diff --git a/SlackAPI/RPCMessages/GroupCloseResponse.cs b/SlackAPI/RPCMessages/GroupCloseResponse.cs index d0fdcd2..61ec8e6 100644 --- a/SlackAPI/RPCMessages/GroupCloseResponse.cs +++ b/SlackAPI/RPCMessages/GroupCloseResponse.cs @@ -1,10 +1,4 @@ -using System; -using System.Collections.Generic; -using System.Linq; -using System.Text; -using System.Threading.Tasks; - -namespace SlackAPI +namespace SlackAPI { [RequestPath("groups.close")] public class GroupCloseResponse : Response diff --git a/SlackAPI/RPCMessages/GroupCreateChildResponse.cs b/SlackAPI/RPCMessages/GroupCreateChildResponse.cs index 51d495e..59380fc 100644 --- a/SlackAPI/RPCMessages/GroupCreateChildResponse.cs +++ b/SlackAPI/RPCMessages/GroupCreateChildResponse.cs @@ -1,10 +1,4 @@ -using System; -using System.Collections.Generic; -using System.Linq; -using System.Text; -using System.Threading.Tasks; - -namespace SlackAPI +namespace SlackAPI { [RequestPath("groups.createChild")] public class GroupCreateChildResponse : GroupResponse diff --git a/SlackAPI/RPCMessages/GroupCreateResponse.cs b/SlackAPI/RPCMessages/GroupCreateResponse.cs index b5082e0..3fa0805 100644 --- a/SlackAPI/RPCMessages/GroupCreateResponse.cs +++ b/SlackAPI/RPCMessages/GroupCreateResponse.cs @@ -1,10 +1,4 @@ -using System; -using System.Collections.Generic; -using System.Linq; -using System.Text; -using System.Threading.Tasks; - -namespace SlackAPI +namespace SlackAPI { [RequestPath("groups.create")] public class GroupCreateResponse : GroupResponse diff --git a/SlackAPI/RPCMessages/GroupInviteResponse.cs b/SlackAPI/RPCMessages/GroupInviteResponse.cs index 2155178..7496678 100644 --- a/SlackAPI/RPCMessages/GroupInviteResponse.cs +++ b/SlackAPI/RPCMessages/GroupInviteResponse.cs @@ -1,10 +1,4 @@ -using System; -using System.Collections.Generic; -using System.Linq; -using System.Text; -using System.Threading.Tasks; - -namespace SlackAPI +namespace SlackAPI { [RequestPath("groups.invite")] public class GroupInviteResponse : GroupResponse diff --git a/SlackAPI/RPCMessages/GroupKickResponse.cs b/SlackAPI/RPCMessages/GroupKickResponse.cs index 3213fb2..e67d7db 100644 --- a/SlackAPI/RPCMessages/GroupKickResponse.cs +++ b/SlackAPI/RPCMessages/GroupKickResponse.cs @@ -1,10 +1,4 @@ -using System; -using System.Collections.Generic; -using System.Linq; -using System.Text; -using System.Threading.Tasks; - -namespace SlackAPI +namespace SlackAPI { [RequestPath("groups.kick")] public class GroupKickResponse : Response diff --git a/SlackAPI/RPCMessages/GroupLeaveResponse.cs b/SlackAPI/RPCMessages/GroupLeaveResponse.cs index 9c96122..93afe7e 100644 --- a/SlackAPI/RPCMessages/GroupLeaveResponse.cs +++ b/SlackAPI/RPCMessages/GroupLeaveResponse.cs @@ -1,10 +1,4 @@ -using System; -using System.Collections.Generic; -using System.Linq; -using System.Text; -using System.Threading.Tasks; - -namespace SlackAPI +namespace SlackAPI { [RequestPath("groups.leave")] public class GroupLeaveResponse : Response diff --git a/SlackAPI/RPCMessages/GroupListResponse.cs b/SlackAPI/RPCMessages/GroupListResponse.cs index d8ad777..99d351f 100644 --- a/SlackAPI/RPCMessages/GroupListResponse.cs +++ b/SlackAPI/RPCMessages/GroupListResponse.cs @@ -1,10 +1,4 @@ -using System; -using System.Collections.Generic; -using System.Linq; -using System.Text; -using System.Threading.Tasks; - -namespace SlackAPI +namespace SlackAPI { [RequestPath("groups.list")] public class GroupListResponse : Response diff --git a/SlackAPI/RPCMessages/GroupMarkResponse.cs b/SlackAPI/RPCMessages/GroupMarkResponse.cs index b4cb742..930e32f 100644 --- a/SlackAPI/RPCMessages/GroupMarkResponse.cs +++ b/SlackAPI/RPCMessages/GroupMarkResponse.cs @@ -1,10 +1,4 @@ -using System; -using System.Collections.Generic; -using System.Linq; -using System.Text; -using System.Threading.Tasks; - -namespace SlackAPI +namespace SlackAPI { [RequestPath("groups.mark")] public class GroupMarkResponse : Response diff --git a/SlackAPI/RPCMessages/GroupMessageHistory.cs b/SlackAPI/RPCMessages/GroupMessageHistory.cs index 5708ca8..934f364 100644 --- a/SlackAPI/RPCMessages/GroupMessageHistory.cs +++ b/SlackAPI/RPCMessages/GroupMessageHistory.cs @@ -1,6 +1,4 @@ -using System; - -namespace SlackAPI +namespace SlackAPI { [RequestPath("groups.history")] public class GroupMessageHistory : MessageHistory diff --git a/SlackAPI/RPCMessages/GroupOpenResponse.cs b/SlackAPI/RPCMessages/GroupOpenResponse.cs index 70c2ffc..23c307b 100644 --- a/SlackAPI/RPCMessages/GroupOpenResponse.cs +++ b/SlackAPI/RPCMessages/GroupOpenResponse.cs @@ -1,10 +1,4 @@ -using System; -using System.Collections.Generic; -using System.Linq; -using System.Text; -using System.Threading.Tasks; - -namespace SlackAPI +namespace SlackAPI { [RequestPath("groups.open")] public class GroupOpenResponse : Response diff --git a/SlackAPI/RPCMessages/GroupRenameResponse.cs b/SlackAPI/RPCMessages/GroupRenameResponse.cs index 6590576..6e34419 100644 --- a/SlackAPI/RPCMessages/GroupRenameResponse.cs +++ b/SlackAPI/RPCMessages/GroupRenameResponse.cs @@ -1,10 +1,4 @@ -using System; -using System.Collections.Generic; -using System.Linq; -using System.Text; -using System.Threading.Tasks; - -namespace SlackAPI +namespace SlackAPI { [RequestPath("groups.rename")] public class GroupRenameResponse : Response diff --git a/SlackAPI/RPCMessages/GroupResponse.cs b/SlackAPI/RPCMessages/GroupResponse.cs index f8834bc..c17623e 100644 --- a/SlackAPI/RPCMessages/GroupResponse.cs +++ b/SlackAPI/RPCMessages/GroupResponse.cs @@ -1,10 +1,4 @@ -using System; -using System.Collections.Generic; -using System.Linq; -using System.Text; -using System.Threading.Tasks; - -namespace SlackAPI +namespace SlackAPI { public class GroupResponse : Response { diff --git a/SlackAPI/RPCMessages/GroupSetPurposeResponse.cs b/SlackAPI/RPCMessages/GroupSetPurposeResponse.cs index 93a061c..306096b 100644 --- a/SlackAPI/RPCMessages/GroupSetPurposeResponse.cs +++ b/SlackAPI/RPCMessages/GroupSetPurposeResponse.cs @@ -1,10 +1,4 @@ -using System; -using System.Collections.Generic; -using System.Linq; -using System.Text; -using System.Threading.Tasks; - -namespace SlackAPI +namespace SlackAPI { [RequestPath("groups.setPurpose")] public class GroupSetPurposeResponse : Response diff --git a/SlackAPI/RPCMessages/GroupSetTopicResponse.cs b/SlackAPI/RPCMessages/GroupSetTopicResponse.cs index f8adab9..fcfff18 100644 --- a/SlackAPI/RPCMessages/GroupSetTopicResponse.cs +++ b/SlackAPI/RPCMessages/GroupSetTopicResponse.cs @@ -1,10 +1,4 @@ -using System; -using System.Collections.Generic; -using System.Linq; -using System.Text; -using System.Threading.Tasks; - -namespace SlackAPI +namespace SlackAPI { [RequestPath("groups.setTopic")] public class GroupSetTopicResponse : Response diff --git a/SlackAPI/RPCMessages/GroupUnarchiveResponse.cs b/SlackAPI/RPCMessages/GroupUnarchiveResponse.cs index d68061c..639d5ad 100644 --- a/SlackAPI/RPCMessages/GroupUnarchiveResponse.cs +++ b/SlackAPI/RPCMessages/GroupUnarchiveResponse.cs @@ -1,10 +1,4 @@ -using System; -using System.Collections.Generic; -using System.Linq; -using System.Text; -using System.Threading.Tasks; - -namespace SlackAPI +namespace SlackAPI { [RequestPath("groups.unarchive")] public class GroupUnarchiveResponse : Response diff --git a/SlackAPI/RPCMessages/LoginResponse.cs b/SlackAPI/RPCMessages/LoginResponse.cs index d048f31..23b9392 100644 --- a/SlackAPI/RPCMessages/LoginResponse.cs +++ b/SlackAPI/RPCMessages/LoginResponse.cs @@ -1,12 +1,8 @@ using System; -using System.Collections.Generic; -using System.Linq; -using System.Text; -using System.Threading.Tasks; namespace SlackAPI { - [RequestPath("rtm.start")] + [RequestPath("rtm.start")] public class LoginResponse : Response { public Bot[] bots; diff --git a/SlackAPI/RPCMessages/MarkResponse.cs b/SlackAPI/RPCMessages/MarkResponse.cs index 976b0c9..24fbaae 100644 --- a/SlackAPI/RPCMessages/MarkResponse.cs +++ b/SlackAPI/RPCMessages/MarkResponse.cs @@ -1,10 +1,4 @@ -using System; -using System.Collections.Generic; -using System.Linq; -using System.Text; -using System.Threading.Tasks; - -namespace SlackAPI +namespace SlackAPI { /// /// This is used for moving the read cursor in the channel. diff --git a/SlackAPI/RPCMessages/MessageHistory.cs b/SlackAPI/RPCMessages/MessageHistory.cs index ba2541c..f0785f2 100644 --- a/SlackAPI/RPCMessages/MessageHistory.cs +++ b/SlackAPI/RPCMessages/MessageHistory.cs @@ -1,5 +1,4 @@ using System; -using Newtonsoft.Json.Serialization; namespace SlackAPI { diff --git a/SlackAPI/RPCMessages/PinListResponse.cs b/SlackAPI/RPCMessages/PinListResponse.cs new file mode 100644 index 0000000..f1cb9d0 --- /dev/null +++ b/SlackAPI/RPCMessages/PinListResponse.cs @@ -0,0 +1,19 @@ +namespace SlackAPI +{ + // https://api.slack.com/methods/pins.list + [RequestPath("pins.list")] + public class PinListResponse : Response + { + public class PinItem + { + public string type; // message, file, file_comment + public Message message; // message + public string channel; // message + public File file; // file, file_comment + public string file_comment; // file_comment + public long created; + } + + public PinItem[] items; + } +} diff --git a/SlackAPI/RPCMessages/PinRemoveResponse.cs b/SlackAPI/RPCMessages/PinRemoveResponse.cs new file mode 100644 index 0000000..9398b03 --- /dev/null +++ b/SlackAPI/RPCMessages/PinRemoveResponse.cs @@ -0,0 +1,8 @@ +namespace SlackAPI +{ + // https://api.slack.com/methods/pins.remove + [RequestPath("pins.remove")] + public class PinRemoveResponse : Response + { + } +} diff --git a/SlackAPI/RPCMessages/PresenseResponse.cs b/SlackAPI/RPCMessages/PresenseResponse.cs index 5c3c333..09730c6 100644 --- a/SlackAPI/RPCMessages/PresenseResponse.cs +++ b/SlackAPI/RPCMessages/PresenseResponse.cs @@ -1,10 +1,4 @@ -using System; -using System.Collections.Generic; -using System.Linq; -using System.Text; -using System.Threading.Tasks; - -namespace SlackAPI +namespace SlackAPI { [RequestPath("users.setPresence")] public class PresenceResponse : Response diff --git a/SlackAPI/RPCMessages/ProfileSetRespose.cs b/SlackAPI/RPCMessages/ProfileSetRespose.cs new file mode 100644 index 0000000..3fa60a9 --- /dev/null +++ b/SlackAPI/RPCMessages/ProfileSetRespose.cs @@ -0,0 +1,8 @@ +namespace SlackAPI +{ + [RequestPath("users.profile.set")] + public class ProfileSetRespose : Response + { + public UserProfile profile; + } +} diff --git a/SlackAPI/RPCMessages/SearchResponseAll.cs b/SlackAPI/RPCMessages/SearchResponseAll.cs index 80d224b..0094ff9 100644 --- a/SlackAPI/RPCMessages/SearchResponseAll.cs +++ b/SlackAPI/RPCMessages/SearchResponseAll.cs @@ -1,6 +1,4 @@ -using System; - -namespace SlackAPI +namespace SlackAPI { [RequestPath("search.all")] public class SearchResponseAll : Response diff --git a/SlackAPI/RPCMessages/SearchResponseFiles.cs b/SlackAPI/RPCMessages/SearchResponseFiles.cs index 9b8b284..fe9551e 100644 --- a/SlackAPI/RPCMessages/SearchResponseFiles.cs +++ b/SlackAPI/RPCMessages/SearchResponseFiles.cs @@ -1,10 +1,4 @@ -using System; -using System.Collections.Generic; -using System.Linq; -using System.Text; -using System.Threading.Tasks; - -namespace SlackAPI +namespace SlackAPI { [RequestPath("search.files")] public class SearchResponseFiles : Response diff --git a/SlackAPI/RPCMessages/SearchResponseMessages.cs b/SlackAPI/RPCMessages/SearchResponseMessages.cs index 6131f94..8f60216 100644 --- a/SlackAPI/RPCMessages/SearchResponseMessages.cs +++ b/SlackAPI/RPCMessages/SearchResponseMessages.cs @@ -1,10 +1,4 @@ -using System; -using System.Collections.Generic; -using System.Linq; -using System.Text; -using System.Threading.Tasks; - -namespace SlackAPI +namespace SlackAPI { [RequestPath("search.messages")] public class SearchResponseMessages : Response diff --git a/SlackAPI/RPCMessages/StarListResponse.cs b/SlackAPI/RPCMessages/StarListResponse.cs index 2fe3e7d..14cfd37 100644 --- a/SlackAPI/RPCMessages/StarListResponse.cs +++ b/SlackAPI/RPCMessages/StarListResponse.cs @@ -1,6 +1,4 @@ -using System; - -namespace SlackAPI +namespace SlackAPI { [RequestPath("stars.list")] public class StarListResponse : Response diff --git a/SlackAPI/RPCMessages/UserCountsResponse.cs b/SlackAPI/RPCMessages/UserCountsResponse.cs index 2e82026..a4b0cd9 100644 --- a/SlackAPI/RPCMessages/UserCountsResponse.cs +++ b/SlackAPI/RPCMessages/UserCountsResponse.cs @@ -1,10 +1,4 @@ -using System; -using System.Collections.Generic; -using System.Linq; -using System.Text; -using System.Threading.Tasks; - -namespace SlackAPI +namespace SlackAPI { [RequestPath("users.counts")] public class UserCountsResponse : Response diff --git a/SlackAPI/RPCMessages/UserListResponse.cs b/SlackAPI/RPCMessages/UserListResponse.cs index 4e2a3ec..50ad988 100644 --- a/SlackAPI/RPCMessages/UserListResponse.cs +++ b/SlackAPI/RPCMessages/UserListResponse.cs @@ -1,10 +1,4 @@ -using System; -using System.Collections.Generic; -using System.Linq; -using System.Text; -using System.Threading.Tasks; - -namespace SlackAPI +namespace SlackAPI { [RequestPath("users.list")] public class UserListResponse : Response diff --git a/SlackAPI/RPCMessages/UserPreferencesResponse.cs b/SlackAPI/RPCMessages/UserPreferencesResponse.cs index f8f69c0..1648917 100644 --- a/SlackAPI/RPCMessages/UserPreferencesResponse.cs +++ b/SlackAPI/RPCMessages/UserPreferencesResponse.cs @@ -1,10 +1,4 @@ -using System; -using System.Collections.Generic; -using System.Linq; -using System.Text; -using System.Threading.Tasks; - -namespace SlackAPI +namespace SlackAPI { [RequestPath("users.prefs.get")] public class UserPreferencesResponse: Response diff --git a/SlackAPI/ReactionAddedResponse.cs b/SlackAPI/ReactionAddedResponse.cs index b641ac3..92beccb 100644 --- a/SlackAPI/ReactionAddedResponse.cs +++ b/SlackAPI/ReactionAddedResponse.cs @@ -1,14 +1,7 @@ -using System; -using System.Collections.Generic; -using System.Linq; -using System.Text; -using System.Threading.Tasks; - -namespace SlackAPI +namespace SlackAPI { [RequestPath("reactions.add")] public class ReactionAddedResponse : Response { - } } diff --git a/SlackAPI/Request.cs b/SlackAPI/Request.cs index e6f0567..5a84971 100644 --- a/SlackAPI/Request.cs +++ b/SlackAPI/Request.cs @@ -1,11 +1,8 @@ -using Newtonsoft.Json; -using System; +using System; using System.Collections.Generic; using System.IO; using System.Net; using System.Reflection; -using System.Text; -using System.Threading; namespace SlackAPI { @@ -55,7 +52,7 @@ public void GotRequest(IAsyncResult result) { if (!first) writer.Write(','); - + writer.Write(string.Format("{0}={1}", Uri.EscapeDataString(postEntry.Item1), Uri.EscapeDataString(postEntry.Item2))); first = false; @@ -76,14 +73,14 @@ internal void GotResponse(IAsyncResult result) { // If we don't get a response, let the exception bubble up as we can't do anything if (we.Response == null) throw we; - + //Anything that doesn't return error 200 throws an exception. Sucks. :l response = (HttpWebResponse)we.Response; //TODO: Handle timeouts, etc? } K responseObj; - + using (Stream responseReading = response.GetResponseStream()) using (StreamReader reader = new StreamReader(responseReading)) { @@ -91,12 +88,12 @@ internal void GotResponse(IAsyncResult result) responseObj = responseData.Deserialize(); } - if(callback != null) + if (callback != null) callback(responseObj); } } - [AttributeUsage(AttributeTargets.Class, Inherited=false)] + [AttributeUsage(AttributeTargets.Class, Inherited = false)] public class RequestPath : Attribute { //See notes in Slack:APIRequest diff --git a/SlackAPI/RequestStateForTask.cs b/SlackAPI/RequestStateForTask.cs index 63075b7..6ffc955 100644 --- a/SlackAPI/RequestStateForTask.cs +++ b/SlackAPI/RequestStateForTask.cs @@ -1,10 +1,6 @@ -using Newtonsoft.Json; -using System; -using System.Collections.Generic; +using System; using System.IO; -using System.Linq; using System.Net; -using System.Text; using System.Threading.Tasks; namespace SlackAPI diff --git a/SlackAPI/Response.cs b/SlackAPI/Response.cs index 6c60a0d..0c9e355 100644 --- a/SlackAPI/Response.cs +++ b/SlackAPI/Response.cs @@ -1,8 +1,4 @@ using System; -using System.Collections.Generic; -using System.Linq; -using System.Text; -using System.Threading.Tasks; namespace SlackAPI { diff --git a/SlackAPI/SlackAPI.csproj b/SlackAPI/SlackAPI.csproj index c2ccdea..e1c54aa 100644 --- a/SlackAPI/SlackAPI.csproj +++ b/SlackAPI/SlackAPI.csproj @@ -63,6 +63,18 @@ + + + + + + + + + + + + diff --git a/SlackAPI/SlackClient.cs b/SlackAPI/SlackClient.cs index c38eba1..dfc0c08 100644 --- a/SlackAPI/SlackClient.cs +++ b/SlackAPI/SlackClient.cs @@ -1,4 +1,5 @@ using Newtonsoft.Json; +using SlackAPI.RPCMessages; using System; using System.Collections.Generic; using System.IO; @@ -7,7 +8,6 @@ using System.Net.Http; using System.Text; using System.Threading; -using SlackAPI.RPCMessages; namespace SlackAPI { @@ -62,12 +62,12 @@ public SlackClient(string token) APIToken = token; } - public virtual void Connect(Action onConnected = null, Action onSocketConnected = null) + public virtual void Connect(Action onConnected = null, Action onSocketConnected = null) { EmitLogin((loginDetails) => { - if(loginDetails.ok) - Connected(loginDetails); + if (loginDetails.ok) + Connected(loginDetails); if (onConnected != null) onConnected(loginDetails); }); @@ -121,25 +121,12 @@ internal static Uri GetSlackUri(string path, Tuple[] getParamete { string parameters = getParameters .Where(x => x.Item2 != null) - .Select(new Func, string>(a => - { - try - { - return string.Format("{0}={1}", Uri.EscapeDataString(a.Item1), Uri.EscapeDataString(a.Item2)); - } - catch (Exception ex) - { - throw new InvalidOperationException(string.Format("Failed when processing '{0}'.", a), ex); - } - })) - .Aggregate((a, b) => + .Select(new Func, string>(a => { - if (string.IsNullOrEmpty(a)) - return b; - else - return string.Format("{0}&{1}", a, b); - }); - + try { return string.Format("{0}={1}", Uri.EscapeDataString(a.Item1), Uri.EscapeDataString(a.Item2)); } + catch (Exception ex) { throw new InvalidOperationException(string.Format("Failed when processing '{0}'.", a), ex); } + })) + .Aggregate((a, b) => (string.IsNullOrEmpty(a) ? b : string.Format("{0}&{1}", a, b))); Uri requestUri = new Uri(string.Format("{0}?{1}", path, parameters)); return requestUri; } @@ -165,7 +152,7 @@ public static void APIGetRequest(Action callback, params Tuple(callback, getParameters, new Tuple[0]); } - public void APIRequestWithToken(Action callback, params Tuple[] getParameters) + public void APIRequestWithToken(Action callback, params Tuple[] getParameters) where K : Response { Tuple[] tokenArray = new Tuple[]{ @@ -194,7 +181,7 @@ public static void FindTeam(Action callback, string team) public static void AuthSignin(Action callback, string userId, string teamId, string password) { - APIRequest(callback, new Tuple[] { + APIRequest(callback, new Tuple[] { new Tuple("user", userId), new Tuple("team", teamId), new Tuple("password", password) @@ -210,10 +197,11 @@ public void GetUserList(Action callback) { APIRequestWithToken(callback); } - public void ChannelsCreate(Action callback, string name) { - APIRequestWithToken(callback, new Tuple("name", name)); - } - public void GetChannelList(Action callback, bool ExcludeArchived = true) + public void ChannelsCreate(Action callback, string name) + { + APIRequestWithToken(callback, new Tuple("name", name)); + } + public void GetChannelList(Action callback, bool ExcludeArchived = true) { APIRequestWithToken(callback, new Tuple("exclude_archived", ExcludeArchived ? "1" : "0")); } @@ -233,7 +221,7 @@ public void GetFiles(Action callback, string userId = null, Da List> parameters = new List>(); if (!string.IsNullOrEmpty(userId)) - parameters.Add(new Tuple("user", userId)); + parameters.Add(new Tuple("user", userId)); if (from.HasValue) parameters.Add(new Tuple("ts_from", from.Value.ToProperTimeStamp())); @@ -244,7 +232,7 @@ public void GetFiles(Action callback, string userId = null, Da if (!types.HasFlag(FileTypes.all)) { FileTypes[] values = (FileTypes[])Enum.GetValues(typeof(FileTypes)); - + StringBuilder building = new StringBuilder(); bool first = true; for (int i = 0; i < values.Length; ++i) @@ -275,15 +263,15 @@ public void GetFiles(Action callback, string userId = null, Da void GetHistory(Action historyCallback, string channel, DateTime? latest = null, DateTime? oldest = null, int? count = null) where K : MessageHistory { - List> parameters = new List>(); + List> parameters = new List>(); parameters.Add(new Tuple("channel", channel)); - - if(latest.HasValue) + + if (latest.HasValue) parameters.Add(new Tuple("latest", latest.Value.ToProperTimeStamp())); - if(oldest.HasValue) + if (oldest.HasValue) parameters.Add(new Tuple("oldest", oldest.Value.ToProperTimeStamp())); - if(count.HasValue) - parameters.Add(new Tuple("count", count.Value.ToString())); + if (count.HasValue) + parameters.Add(new Tuple("count", count.Value.ToString())); APIRequestWithToken(historyCallback, parameters.ToArray()); } @@ -313,12 +301,12 @@ public void MarkChannel(Action callback, string channelId, DateTim public void GetFileInfo(Action callback, string fileId, int? page = null, int? count = null) { - List> parameters = new List>(); + List> parameters = new List>(); + + parameters.Add(new Tuple("file", fileId)); - parameters.Add(new Tuple("file", fileId)); - - if(count.HasValue) - parameters.Add(new Tuple("count", count.Value.ToString())); + if (count.HasValue) + parameters.Add(new Tuple("count", count.Value.ToString())); if (page.HasValue) parameters.Add(new Tuple("page", page.Value.ToString())); @@ -487,17 +475,18 @@ public void SearchFiles(Action callback, string query, Sear APIRequestWithToken(callback, parameters.ToArray()); } - public void GetStars(Action callback, string userId = null, int? count = null, int? page = null){ - List> parameters = new List>(); - - if(!string.IsNullOrEmpty(userId)) - parameters.Add(new Tuple("user", userId)); + public void GetStars(Action callback, string userId = null, int? count = null, int? page = null) + { + List> parameters = new List>(); - if(count.HasValue) - parameters.Add(new Tuple("count", count.Value.ToString())); + if (!string.IsNullOrEmpty(userId)) + parameters.Add(new Tuple("user", userId)); - if(page.HasValue) - parameters.Add(new Tuple("page", page.Value.ToString())); + if (count.HasValue) + parameters.Add(new Tuple("count", count.Value.ToString())); + + if (page.HasValue) + parameters.Add(new Tuple("page", page.Value.ToString())); APIRequestWithToken(callback, parameters.ToArray()); } @@ -599,15 +588,15 @@ public void PostMessage( string icon_url = null, string icon_emoji = null, bool as_user = false, - string thread_ts = null) + string thread_ts = null) { - List> parameters = new List>(); + List> parameters = new List>(); - parameters.Add(new Tuple("channel", channelId)); - parameters.Add(new Tuple("text", text)); + parameters.Add(new Tuple("channel", channelId)); + parameters.Add(new Tuple("text", text)); - if(!string.IsNullOrEmpty(botName)) - parameters.Add(new Tuple("username", botName)); + if (!string.IsNullOrEmpty(botName)) + parameters.Add(new Tuple("username", botName)); if (!string.IsNullOrEmpty(parse)) parameters.Add(new Tuple("parse", parse)); @@ -633,7 +622,7 @@ public void PostMessage( parameters.Add(new Tuple("icon_emoji", icon_emoji)); parameters.Add(new Tuple("as_user", as_user.ToString())); - + if (!string.IsNullOrEmpty(thread_ts)) parameters.Add(new Tuple("thread_ts", thread_ts)); @@ -683,7 +672,7 @@ public void UploadFile(Action callback, byte[] fileData, str parameters.Add(string.Format("{0}={1}", "channels", string.Join(",", channelIds))); - using(HttpClient client = new HttpClient()) + using (HttpClient client = new HttpClient()) using (MultipartFormDataContent form = new MultipartFormDataContent()) { form.Add(new ByteArrayContent(fileData), "file", fileName); @@ -700,25 +689,25 @@ private static string BuildScope(SlackScope scope) builder.Append("identify"); if ((int)(scope & SlackScope.Read) != 0) { - if(builder.Length > 0) + if (builder.Length > 0) builder.Append(","); builder.Append("read"); } if ((int)(scope & SlackScope.Post) != 0) { - if(builder.Length > 0) + if (builder.Length > 0) builder.Append(","); builder.Append("post"); } if ((int)(scope & SlackScope.Client) != 0) { - if(builder.Length > 0) + if (builder.Length > 0) builder.Append(","); builder.Append("client"); } if ((int)(scope & SlackScope.Admin) != 0) { - if(builder.Length > 0) + if (builder.Length > 0) builder.Append(","); builder.Append("admin"); } @@ -732,8 +721,8 @@ public static Uri GetAuthorizeUri(string clientId, SlackScope scopes, string red return GetSlackUri("https://slack.com/oauth/authorize", new Tuple[] { new Tuple("client_id", clientId), new Tuple("redirect_uri", redirectUri), - new Tuple("state", state), - new Tuple("scope", theScopes), + new Tuple("state", state), + new Tuple("scope", theScopes), new Tuple("team", team)}); } @@ -741,7 +730,7 @@ public static void GetAccessToken(Action callback, string c { APIRequest(callback, new Tuple[] { new Tuple("client_id", clientId), new Tuple("client_secret", clientSecret), new Tuple("code", code), - new Tuple("redirect_uri", redirectUri) }, new Tuple[] {}); + new Tuple("redirect_uri", redirectUri) }, new Tuple[] { }); } public static void RegisterConverter(JsonConverter converter) diff --git a/SlackAPI/SlackScope.cs b/SlackAPI/SlackScope.cs index 3819c05..f110e62 100644 --- a/SlackAPI/SlackScope.cs +++ b/SlackAPI/SlackScope.cs @@ -1,8 +1,4 @@ using System; -using System.Collections.Generic; -using System.Linq; -using System.Text; -using System.Threading.Tasks; namespace SlackAPI { diff --git a/SlackAPI/SlackSocket.cs b/SlackAPI/SlackSocket.cs index dc541eb..ced070c 100644 --- a/SlackAPI/SlackSocket.cs +++ b/SlackAPI/SlackSocket.cs @@ -1,14 +1,14 @@ -using System.IO; -using Newtonsoft.Json; +using Newtonsoft.Json; using SlackAPI.Utilities; using System; using System.Collections.Generic; +using System.IO; +using System.Linq; using System.Net.WebSockets; using System.Reflection; using System.Text; using System.Threading; using System.Threading.Tasks; -using System.Linq; #if NETSTANDARD1_6 using Microsoft.Extensions.DependencyModel; @@ -42,7 +42,7 @@ static SlackSocket() { routing = new Dictionary>(); #if NET45 - var assemblies = AppDomain.CurrentDomain.GetAssemblies().Where(x => x.GlobalAssemblyCache == false); + var assemblies = AppDomain.CurrentDomain.GetAssemblies().Where(x => x.GlobalAssemblyCache == false); #elif NETSTANDARD1_6 var assemblies = DependencyContext.Default.GetDefaultAssemblyNames().Select(Assembly.Load); #elif NETSTANDARD1_3 @@ -90,7 +90,7 @@ static SlackSocket() } } - public SlackSocket(LoginResponse loginDetails, object routingTo, Action onConnected = null) + public SlackSocket(LoginResponse loginDetails, object routingTo, Action onConnected = null) { BuildRoutes(routingTo); socket = new ClientWebSocket(); @@ -100,7 +100,7 @@ public SlackSocket(LoginResponse loginDetails, object routingTo, Action onConnec cts = new CancellationTokenSource(); socket.ConnectAsync(new Uri(string.Format("{0}?svn_rev={1}&login_with_boot_data-0-{2}&on_login-0-{2}&connect-1-{2}", loginDetails.url, loginDetails.svn_rev, DateTime.Now.Subtract(new DateTime(1970, 1, 1)).TotalSeconds)), cts.Token).Wait(); - if(onConnected != null) + if (onConnected != null) onConnected(); SetupReceiving(); } @@ -157,7 +157,8 @@ public void Send(SlackSocketMessage message) message.id = Interlocked.Increment(ref currentId); //socket.Send(JsonConvert.SerializeObject(message)); - if (string.IsNullOrEmpty(message.type)){ + if (string.IsNullOrEmpty(message.type)) + { IEnumerable routes = message.GetType().GetTypeInfo().GetCustomAttributes(); SlackSocketRouting route = null; @@ -173,7 +174,7 @@ public void Send(SlackSocketMessage message) } } - sendingQueue.Push(JsonConvert.SerializeObject(message, Formatting.None, new JsonSerializerSettings { NullValueHandling = NullValueHandling.Ignore })); + sendingQueue.Push(JsonConvert.SerializeObject(message, Formatting.None, new JsonSerializerSettings { NullValueHandling = NullValueHandling.Ignore })); if (Interlocked.CompareExchange(ref currentlySending, 1, 0) == 0) Task.Factory.StartNew(HandleSending); } @@ -325,8 +326,8 @@ void HandleSending() currentlySending = 0; } - public void Close() - { + public void Close() + { try { this.socket.Abort(); @@ -338,7 +339,7 @@ public void Close() if (Interlocked.CompareExchange(ref closedEmitted, 1, 0) == 0 && ConnectionClosed != null) ConnectionClosed(); - } + } } public class SlackSocketMessage diff --git a/SlackAPI/SlackSocketClient.cs b/SlackAPI/SlackSocketClient.cs index 53b708a..5c296b0 100644 --- a/SlackAPI/SlackSocketClient.cs +++ b/SlackAPI/SlackSocketClient.cs @@ -1,8 +1,7 @@ -using System.Net.WebSockets; +using SlackAPI.WebSocketMessages; using System; -using System.Diagnostics; +using System.Net.WebSockets; using System.Threading; -using SlackAPI.WebSocketMessages; namespace SlackAPI { @@ -24,7 +23,7 @@ public class SlackSocketClient : SlackClient public bool IsConnected { get { return underlyingSocket != null && underlyingSocket.Connected; } } public event Action OnHello; - internal LoginResponse loginDetails; + internal LoginResponse loginDetails; public SlackSocketClient(string token) : base(token) @@ -32,23 +31,25 @@ public SlackSocketClient(string token) } - public override void Connect(Action onConnected, Action onSocketConnected = null) - { - base.Connect((s) => { - ConnectSocket(onSocketConnected); - onConnected(s); - }); - } + public override void Connect(Action onConnected, Action onSocketConnected = null) + { + base.Connect((s) => + { + ConnectSocket(onSocketConnected); + onConnected(s); + }); + } protected override void Connected(LoginResponse loginDetails) - { - this.loginDetails = loginDetails; - base.Connected(loginDetails); - } + { + this.loginDetails = loginDetails; + base.Connected(loginDetails); + } - public void ConnectSocket(Action onSocketConnected){ - underlyingSocket = new SlackSocket(loginDetails, this, onSocketConnected); - } + public void ConnectSocket(Action onSocketConnected) + { + underlyingSocket = new SlackSocket(loginDetails, this, onSocketConnected); + } public void ErrorReceiving(Action callback) { @@ -92,9 +93,12 @@ public void SendMessage(Action onSent, string channelId, string userName = MySelf.id; } - if (onSent != null) { - underlyingSocket.Send( new Message() {channel = channelId, text = textData, user = userName, type = "message"}, onSent); - } else { + if (onSent != null) + { + underlyingSocket.Send(new Message() { channel = channelId, text = textData, user = userName, type = "message" }, onSent); + } + else + { underlyingSocket.Send(new Message() { channel = channelId, text = textData, user = userName, type = "message" }); } } @@ -113,7 +117,7 @@ public void HandlePongReceived(Pong pong) public void HandleReactionAdded(ReactionAdded reactionAdded) { if (OnReactionAdded != null) - OnReactionAdded(reactionAdded); + OnReactionAdded(reactionAdded); } public void HandleHello(Hello hello) @@ -227,9 +231,9 @@ public void ChannelMarked(ChannelMarked m) } - public void CloseSocket() - { - underlyingSocket.Close(); - } + public void CloseSocket() + { + underlyingSocket.Close(); + } } } diff --git a/SlackAPI/SlackTaskClient.cs b/SlackAPI/SlackTaskClient.cs index be50ad4..e1c8574 100644 --- a/SlackAPI/SlackTaskClient.cs +++ b/SlackAPI/SlackTaskClient.cs @@ -6,7 +6,6 @@ using System.Net; using System.Net.Http; using System.Text; -using System.Threading; using System.Threading.Tasks; namespace SlackAPI @@ -56,11 +55,11 @@ public SlackTaskClient(string token) APIToken = token; } - public virtual async Task ConnectAsync() + public virtual async Task ConnectAsync() { var loginDetails = await EmitLoginAsync(); - if(loginDetails.ok) - Connected(loginDetails); + if (loginDetails.ok) + Connected(loginDetails); return loginDetails; } @@ -122,8 +121,8 @@ public Task APIRequestWithTokenAsync() { return APIRequestWithTokenAsync(new Tuple[] { }); } - - public Task APIRequestWithTokenAsync(params Tuple[] postParameters) + + public Task APIRequestWithTokenAsync(params Tuple[] postParameters) where K : Response { Tuple[] tokenArray = new Tuple[]{ @@ -149,7 +148,7 @@ public static Task FindTeam(string team) public static Task AuthSignin(string userId, string teamId, string password) { - return APIRequestAsync(new Tuple[] { + return APIRequestAsync(new Tuple[] { new Tuple("user", userId), new Tuple("team", teamId), new Tuple("password", password) @@ -186,7 +185,7 @@ public Task GetFilesAsync(string userId = null, DateTime? from List> parameters = new List>(); if (!string.IsNullOrEmpty(userId)) - parameters.Add(new Tuple("user", userId)); + parameters.Add(new Tuple("user", userId)); if (from.HasValue) parameters.Add(new Tuple("ts_from", from.Value.ToProperTimeStamp())); @@ -197,7 +196,7 @@ public Task GetFilesAsync(string userId = null, DateTime? from if (!types.HasFlag(FileTypes.all)) { FileTypes[] values = (FileTypes[])Enum.GetValues(typeof(FileTypes)); - + StringBuilder building = new StringBuilder(); bool first = true; for (int i = 0; i < values.Length; ++i) @@ -228,15 +227,15 @@ public Task GetFilesAsync(string userId = null, DateTime? from private Task GetHistoryAsync(string channel, DateTime? latest = null, DateTime? oldest = null, int? count = null) where K : MessageHistory { - List> parameters = new List>(); + List> parameters = new List>(); parameters.Add(new Tuple("channel", channel)); - - if(latest.HasValue) + + if (latest.HasValue) parameters.Add(new Tuple("latest", latest.Value.ToProperTimeStamp())); - if(oldest.HasValue) + if (oldest.HasValue) parameters.Add(new Tuple("oldest", oldest.Value.ToProperTimeStamp())); - if(count.HasValue) - parameters.Add(new Tuple("count", count.Value.ToString())); + if (count.HasValue) + parameters.Add(new Tuple("count", count.Value.ToString())); return APIRequestWithTokenAsync(parameters.ToArray()); } @@ -265,12 +264,12 @@ public Task MarkChannelAsync(string channelId, DateTime ts) public Task GetFileInfoAsync(string fileId, int? page = null, int? count = null) { - List> parameters = new List>(); + List> parameters = new List>(); - parameters.Add(new Tuple("file", fileId)); - - if(count.HasValue) - parameters.Add(new Tuple("count", count.Value.ToString())); + parameters.Add(new Tuple("file", fileId)); + + if (count.HasValue) + parameters.Add(new Tuple("count", count.Value.ToString())); if (page.HasValue) parameters.Add(new Tuple("page", page.Value.ToString())); @@ -439,17 +438,18 @@ public Task SearchFilesAsync(string query, SearchSort? sort return APIRequestWithTokenAsync(parameters.ToArray()); } - public Task GetStarsAsync(string userId = null, int? count = null, int? page = null){ - List> parameters = new List>(); - - if(!string.IsNullOrEmpty(userId)) - parameters.Add(new Tuple("user", userId)); + public Task GetStarsAsync(string userId = null, int? count = null, int? page = null) + { + List> parameters = new List>(); - if(count.HasValue) - parameters.Add(new Tuple("count", count.Value.ToString())); + if (!string.IsNullOrEmpty(userId)) + parameters.Add(new Tuple("user", userId)); - if(page.HasValue) - parameters.Add(new Tuple("page", page.Value.ToString())); + if (count.HasValue) + parameters.Add(new Tuple("count", count.Value.ToString())); + + if (page.HasValue) + parameters.Add(new Tuple("page", page.Value.ToString())); return APIRequestWithTokenAsync(parameters.ToArray()); } @@ -503,13 +503,13 @@ public Task PostMessageAsync( string icon_emoji = null, bool as_user = false) { - List> parameters = new List>(); + List> parameters = new List>(); - parameters.Add(new Tuple("channel", channelId)); - parameters.Add(new Tuple("text", text)); + parameters.Add(new Tuple("channel", channelId)); + parameters.Add(new Tuple("text", text)); - if(!string.IsNullOrEmpty(botName)) - parameters.Add(new Tuple("username", botName)); + if (!string.IsNullOrEmpty(botName)) + parameters.Add(new Tuple("username", botName)); if (!string.IsNullOrEmpty(parse)) parameters.Add(new Tuple("parse", parse)); @@ -556,7 +556,7 @@ public Task UploadFileAsync(byte[] fileData, string fileName parameters.Add(string.Format("{0}={1}", "channels", string.Join(",", channelIds))); - using(HttpClient client = new HttpClient()) + using (HttpClient client = new HttpClient()) using (MultipartFormDataContent form = new MultipartFormDataContent()) { form.Add(new ByteArrayContent(fileData), "file", fileName); @@ -573,5 +573,147 @@ public Task ChannelSetTopicAsync(string channelId, stri new Tuple("channel", channelId), new Tuple("topic", newTopic)); } + + #region Channel + + public Task ChannelsCreateAsync(string name) + { + return APIRequestWithTokenAsync(new Tuple("name", name)); + } + + public Task ChannelsInviteAsync(string userId, string channelId) + { + var parameters = new List>() + { + new Tuple("channel", channelId), + new Tuple("user", userId), + }; + return APIRequestWithTokenAsync(parameters.ToArray()); + } + + public Task ChannelsSetPurposeAsync(string channelId, string purpose) + { + var parameters = new List>() + { + new Tuple("channel", channelId), + new Tuple("purpose", purpose), + }; + return APIRequestWithTokenAsync(parameters.ToArray()); + } + + public Task ChannelsRenameAsync(string channelId, string name) + { + var parameters = new List>() + { + new Tuple("channel", channelId), + new Tuple("name", name), + }; + return APIRequestWithTokenAsync(parameters.ToArray()); + } + + public Task ChannelsArchiveAsync(string channelId) + { + return APIRequestWithTokenAsync(new Tuple("channel", channelId)); + } + + public Task ChannelsUnarchiveAsync(string channelId) + { + return APIRequestWithTokenAsync(new Tuple("channel", channelId)); + } + + #endregion + + #region Pin + + public Task PinsListAsync(string channelId) + { + var parameters = new List>() + { + new Tuple("channel", channelId), + }; + return APIRequestWithTokenAsync(parameters.ToArray()); + } + + public Task PinsRemoveAsync(string channelId, long? timestamp) + { + var parameters = new List>() + { + new Tuple("channel", channelId), + new Tuple("timestamp", (timestamp != null ? timestamp.Value.ToString() : null)), + }; + return APIRequestWithTokenAsync(parameters.ToArray()); + } + + #endregion + + #region User + + // https://levels.io/slack-typeform-auto-invite-sign-ups/ + public Task AddUserAsync(string email, string firstName, bool restricted, string[] channelIds) + { + var parameters = new List>() + { + new Tuple("email", email), + new Tuple("first_name", firstName), + new Tuple("channels", (channelIds != null ? string.Join(",", channelIds) : null)) + }; + if (restricted) + parameters.Add(new Tuple("restricted", "1")); + return APIRequestWithTokenAsync(parameters.ToArray()); + } + + public Task DeleteUserAsync(string userId) + { + var parameters = new List>() + { + new Tuple("userId", userId) + }; + return APIRequestWithTokenAsync(parameters.ToArray()); + } + + public Task SetInactiveUserAsync(string userId) + { + var parameters = new List>() + { + new Tuple("user", userId), + new Tuple("set_active", "true") + }; + return APIRequestWithTokenAsync(parameters.ToArray()); + } + + public Task SetUserProfileEmailAsync(string userId, string email) + { + var parameters = new List>() + { + new Tuple("user", userId), + new Tuple("profile", "{\"email\":\"" + email + "\"}"), + new Tuple("set_active", "true") + }; + return APIRequestWithTokenAsync(parameters.ToArray()); + } + + public Task SetUserProfileFullNameAsync(string userId, string firstName, string lastName) + { + var parameters = new List>() + { + new Tuple("user", userId), + new Tuple("profile", "{\"first_name\":\"" + firstName + "\",\"last_name\": \"" + lastName +"\"}"), + new Tuple("set_active", "true") + }; + return APIRequestWithTokenAsync(parameters.ToArray()); + } + + public Task SetUserProfileUserNameAsync(string userId, string userName) + { + var parameters = new List>() + { + new Tuple("user", userId), + new Tuple("profile", "{\"username\":\"" + userName + "\"}"), + new Tuple("set_active", "true") + }; + return APIRequestWithTokenAsync(parameters.ToArray()); + } + + #endregion } } \ No newline at end of file diff --git a/SlackAPI/TeamPreferences.cs b/SlackAPI/TeamPreferences.cs index c7da545..58b08b2 100644 --- a/SlackAPI/TeamPreferences.cs +++ b/SlackAPI/TeamPreferences.cs @@ -1,10 +1,4 @@ -using System; -using System.Collections.Generic; -using System.Linq; -using System.Text; -using System.Threading.Tasks; - -namespace SlackAPI +namespace SlackAPI { public class TeamPreferences { diff --git a/SlackAPI/User.cs b/SlackAPI/User.cs index eba1f1a..a756316 100644 --- a/SlackAPI/User.cs +++ b/SlackAPI/User.cs @@ -1,8 +1,4 @@ using System; -using System.Collections.Generic; -using System.Linq; -using System.Text; -using System.Threading.Tasks; namespace SlackAPI { diff --git a/SlackAPI/UserProfile.cs b/SlackAPI/UserProfile.cs index d6579ad..cf184ee 100644 --- a/SlackAPI/UserProfile.cs +++ b/SlackAPI/UserProfile.cs @@ -1,10 +1,4 @@ -using System; -using System.Collections.Generic; -using System.Linq; -using System.Text; -using System.Threading.Tasks; - -namespace SlackAPI +namespace SlackAPI { public class UserProfile { @@ -21,10 +15,24 @@ public class UserProfile public string image_48; public string image_72; public string image_192; + public string image_512; public override string ToString() { return real_name; } + + public string image_max + { + get + { + if (!string.IsNullOrEmpty(image_512)) return image_512; + if (!string.IsNullOrEmpty(image_192)) return image_192; + if (!string.IsNullOrEmpty(image_72)) return image_72; + if (!string.IsNullOrEmpty(image_32)) return image_32; + if (!string.IsNullOrEmpty(image_24)) return image_24; + return null; + } + } } } diff --git a/SlackAPI/UserTeamCombo.cs b/SlackAPI/UserTeamCombo.cs index 95a19c7..87a58fb 100644 --- a/SlackAPI/UserTeamCombo.cs +++ b/SlackAPI/UserTeamCombo.cs @@ -1,10 +1,4 @@ -using System; -using System.Collections.Generic; -using System.Linq; -using System.Text; -using System.Threading.Tasks; - -namespace SlackAPI +namespace SlackAPI { public class UserTeamCombo { diff --git a/SlackAPI/Utilities/ILockFree.cs b/SlackAPI/Utilities/ILockFree.cs index 781e073..5f7bdbf 100644 --- a/SlackAPI/Utilities/ILockFree.cs +++ b/SlackAPI/Utilities/ILockFree.cs @@ -1,6 +1,4 @@ -using System; - -namespace SlackAPI.Utilities +namespace SlackAPI.Utilities { public abstract class ILockFree where T : class { diff --git a/SlackAPI/WebSocketMessages/GroupJoined.cs b/SlackAPI/WebSocketMessages/GroupJoined.cs index 12518c9..30b354a 100644 --- a/SlackAPI/WebSocketMessages/GroupJoined.cs +++ b/SlackAPI/WebSocketMessages/GroupJoined.cs @@ -6,4 +6,3 @@ public class GroupJoined : SlackSocketMessage public Channel channel; } } - diff --git a/SlackAPI/WebSocketMessages/GroupLeft.cs b/SlackAPI/WebSocketMessages/GroupLeft.cs index 988bbd3..170d0f8 100644 --- a/SlackAPI/WebSocketMessages/GroupLeft.cs +++ b/SlackAPI/WebSocketMessages/GroupLeft.cs @@ -6,4 +6,3 @@ public class GroupLeft : SlackSocketMessage public string channel; } } - diff --git a/SlackAPI/WebSocketMessages/GroupOpen.cs b/SlackAPI/WebSocketMessages/GroupOpen.cs index e86a7fe..97c1a0e 100644 --- a/SlackAPI/WebSocketMessages/GroupOpen.cs +++ b/SlackAPI/WebSocketMessages/GroupOpen.cs @@ -7,4 +7,3 @@ public class GroupOpen : SlackSocketMessage public string channel; } } - diff --git a/SlackAPI/WebSocketMessages/GroupRename.cs b/SlackAPI/WebSocketMessages/GroupRename.cs index 13a5a46..9208b81 100644 --- a/SlackAPI/WebSocketMessages/GroupRename.cs +++ b/SlackAPI/WebSocketMessages/GroupRename.cs @@ -6,4 +6,3 @@ public class GroupRename : SlackSocketMessage public Channel channel; } } - diff --git a/SlackAPI/WebSocketMessages/GroupUnarchive.cs b/SlackAPI/WebSocketMessages/GroupUnarchive.cs index 37a69d5..db6d0d7 100644 --- a/SlackAPI/WebSocketMessages/GroupUnarchive.cs +++ b/SlackAPI/WebSocketMessages/GroupUnarchive.cs @@ -6,4 +6,3 @@ public class GroupUnarchive : SlackSocketMessage public string channel; } } - diff --git a/SlackAPI/WebSocketMessages/ReactionAdded.cs b/SlackAPI/WebSocketMessages/ReactionAdded.cs index 277e721..50b2e19 100644 --- a/SlackAPI/WebSocketMessages/ReactionAdded.cs +++ b/SlackAPI/WebSocketMessages/ReactionAdded.cs @@ -28,4 +28,3 @@ public class Item public string ts; } } -