From bf054f1c2aebbd5612701e5688915281accf3b7d Mon Sep 17 00:00:00 2001 From: clockworkcoding Date: Fri, 22 Feb 2019 23:39:30 -0500 Subject: [PATCH 1/2] Updated AccessTokenResponse to include the BotTokenResponse and team_id --- SlackAPI/RPCMessages/AccessTokenResponse.cs | 20 +++++++++++++++++++- 1 file changed, 19 insertions(+), 1 deletion(-) diff --git a/SlackAPI/RPCMessages/AccessTokenResponse.cs b/SlackAPI/RPCMessages/AccessTokenResponse.cs index ebf9fb9..865d9fa 100644 --- a/SlackAPI/RPCMessages/AccessTokenResponse.cs +++ b/SlackAPI/RPCMessages/AccessTokenResponse.cs @@ -12,6 +12,24 @@ public class AccessTokenResponse : Response public string access_token; public string scope; public string team_name; - public Bot bot; + public string team_id { get; set; } + public BotTokenResponse bot; + } + + public class BotTokenResponse + { + public string emoji; + public string image_24; + public string image_32; + public string image_48; + public string image_72; + public string image_192; + + public bool deleted; + public UserProfile icons; + public string id; + public string name; + public string bot_user_id; + public string bot_access_token; } } From 0948badfd1946fa17020ecf2b85ac1c13e509ef8 Mon Sep 17 00:00:00 2001 From: Sergey Nechaev Date: Tue, 12 Mar 2019 21:48:07 +0700 Subject: [PATCH 2/2] Fixes timestamp serialization issue (#170) --- SlackAPI/Extensions.cs | 5 +++-- SlackAPI/JavascriptDateTimeConverter.cs | 2 +- 2 files changed, 4 insertions(+), 3 deletions(-) diff --git a/SlackAPI/Extensions.cs b/SlackAPI/Extensions.cs index 194a948..02d8d6e 100644 --- a/SlackAPI/Extensions.cs +++ b/SlackAPI/Extensions.cs @@ -1,5 +1,6 @@ using System; using System.Collections.Generic; +using System.Globalization; using Newtonsoft.Json; namespace SlackAPI @@ -17,10 +18,10 @@ public static string ToProperTimeStamp(this DateTime that, bool toUTC = true) { if (toUTC) { - return ((that.ToUniversalTime().Ticks - 621355968000000000m) / 10000000m).ToString("F6"); + return ((that.ToUniversalTime().Ticks - 621355968000000000m) / 10000000m).ToString("F6", CultureInfo.InvariantCulture); } else - return that.Subtract(new DateTime(1970, 1, 1)).TotalSeconds.ToString(); + return that.Subtract(new DateTime(1970, 1, 1)).TotalSeconds.ToString(CultureInfo.InvariantCulture); } public static K Deserialize(this string data) diff --git a/SlackAPI/JavascriptDateTimeConverter.cs b/SlackAPI/JavascriptDateTimeConverter.cs index d70d374..29117ba 100644 --- a/SlackAPI/JavascriptDateTimeConverter.cs +++ b/SlackAPI/JavascriptDateTimeConverter.cs @@ -20,7 +20,7 @@ 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(res.ToProperTimeStamp(), CultureInfo.InvariantCulture), Decimal.Parse(reader.Value.ToString(), CultureInfo.InvariantCulture)), "Precision loss :("); return res;