From 4be92375f7ba8bb1ae82b1957259b847496c14e4 Mon Sep 17 00:00:00 2001 From: Simon Oxtoby Date: Sat, 24 Dec 2022 13:13:44 +1000 Subject: [PATCH] Adding MessageSearchResult class for search results --- .../WebApi/Responses/MessageSearchResponse.cs | 6 ++-- .../WebApi/Responses/MessageSearchResult.cs | 28 +++++++++++++++++++ SlackNet/WebApi/Responses/SearchResponse.cs | 6 ++-- 3 files changed, 32 insertions(+), 8 deletions(-) create mode 100644 SlackNet/WebApi/Responses/MessageSearchResult.cs diff --git a/SlackNet/WebApi/Responses/MessageSearchResponse.cs b/SlackNet/WebApi/Responses/MessageSearchResponse.cs index 0059839..41185ae 100644 --- a/SlackNet/WebApi/Responses/MessageSearchResponse.cs +++ b/SlackNet/WebApi/Responses/MessageSearchResponse.cs @@ -1,9 +1,7 @@ -using SlackNet.Events; - -namespace SlackNet.WebApi; +namespace SlackNet.WebApi; public class MessageSearchResponse { public string Query { get; set; } - public SearchResults Messages { get; set; } + public SearchResults Messages { get; set; } } \ No newline at end of file diff --git a/SlackNet/WebApi/Responses/MessageSearchResult.cs b/SlackNet/WebApi/Responses/MessageSearchResult.cs new file mode 100644 index 0000000..0d791d7 --- /dev/null +++ b/SlackNet/WebApi/Responses/MessageSearchResult.cs @@ -0,0 +1,28 @@ +using System.Collections.Generic; +using Newtonsoft.Json; +using SlackNet.Blocks; + +namespace SlackNet.WebApi; + +public class MessageSearchResult +{ + public string Iid { get; set; } + public string Team { get; set; } + public double Score { get; set; } + public Conversation Channel { get; set; } + public string Type { get; set; } + public string User { get; set; } + public string Username { get; set; } + public string Ts { get; set; } + public IList Blocks { get; set; } = new List(); + public string Text { get; set; } + public string Permalink { get; set; } + public bool NoReactions { get; set; } + + /// + /// Anything that Slack includes in the search result that isn't covered by other properties can be accessed through this property. + /// If you find anything here, please raise an issue at https://github.com/soxtoby/SlackNet/issues so we can add it to the library. + /// + [JsonExtensionData] + public Dictionary ExtraProperties { get; set; } = new(); +} \ No newline at end of file diff --git a/SlackNet/WebApi/Responses/SearchResponse.cs b/SlackNet/WebApi/Responses/SearchResponse.cs index 9543ec9..58e280d 100644 --- a/SlackNet/WebApi/Responses/SearchResponse.cs +++ b/SlackNet/WebApi/Responses/SearchResponse.cs @@ -1,10 +1,8 @@ -using SlackNet.Events; - -namespace SlackNet.WebApi; +namespace SlackNet.WebApi; public class SearchResponse { public string Query { get; set; } - public SearchResults Messages { get; set; } + public SearchResults Messages { get; set; } public SearchResults Files { get; set; } } \ No newline at end of file