Inumedia / SlackAPI

.NET Implementation of the Slack team communication platform API.
MIT License
452 stars 243 forks source link

SlackApiClient.Connect doesn`t work #199

Closed ruslanmogilevskiy closed 5 years ago

ruslanmogilevskiy commented 5 years ago

When doing SlackApiClient.Connect the following error thrown: Newtonsoft.Json.JsonSerializationException: 'Error converting value "recentMessages" to type 'SlackAPI.SearchSort'. Path 'self.prefs.search_sort', line 1, position 351.'

It is related to a bug in SlackAPI, described in #182, #177, #183 because of SlackAPI.Preferences.search_sort field is enum instead of to be a string. And when its new value returned from Slack your library fails on connection. Solution (permanent): make SlackAPI.Preferences.search_sort of string type.

Inumedia commented 5 years ago

Oof. Yeah, that might be the best fix going forward, I think this is the third time they've introduced a new value for that. My biggest issue with turning it into a string is that then it could be any value and it might not all be documented.

ruslanmogilevskiy commented 5 years ago

I'm afraid there is no other easy way (except completely remove this field at all). When Slack introduces new value, your library is totally broken. Don't know when and what for this property is used (in your project it is not used at all). If its purpose just to propagate a value to your library's clients then don't see any issues to make it as string, even if Slack could return any value there. Your quick fix is very appreciated. Notice, I could create a PR for you with 'string' field.

Inumedia commented 5 years ago

This was fixed in cbc739e5f0ed4ca1dad0666b8493c1e98d375f6b

and is/will be available with https://www.nuget.org/packages/SlackAPI/1.1.2