@@ -644,3 +644,61 @@ func (c *Client) JoinedPrivateArchivedThreadsBefore(
644644 before discord.Timestamp , limit uint ) (* ArchivedThreads , error ) {
645645 return c .JoinedPrivateArchivedThreads (channelID , before , limit )
646646}
647+
648+ type ThreadTagSetting string
649+
650+ const (
651+ MatchSome ThreadTagSetting = "match_some"
652+ MatchAll ThreadTagSetting = "all"
653+ )
654+
655+ type ThreadSortBy string
656+
657+ const (
658+ LastMessageTime ThreadSortBy = "last_message_time"
659+ ArchiveTime ThreadSortBy = "archive_time"
660+ Relevance ThreadSortBy = "relevance"
661+ CreationTime ThreadSortBy = "creation_time"
662+ )
663+
664+ type ThreadSortOrder string
665+
666+ const (
667+ SortAscending ThreadSortOrder = "asc"
668+ SortDescending ThreadSortOrder = "desc"
669+ )
670+
671+ type (
672+ SearchThreadsData struct {
673+ Name string `schema:"name,omitempty"`
674+ Slop int `schema:"slop,omitempty"`
675+ Tag []discord.Snowflake `schema:"tag,omitempty"`
676+ // Default: MatchSome
677+ TagSetting ThreadTagSetting `schema:"tag_setting,omitempty"`
678+ Archived bool `schema:"archived,omitempty"`
679+ SortBy ThreadSortBy `schema:"sort_by,omitempty"`
680+ // Default: desc
681+ SortOrder ThreadSortOrder `schema:"sort_order"`
682+ Limit int `schema:"limit"`
683+ Offset int `schema:"offset,omitempty"`
684+ MaxID discord.Snowflake `schema:"max_id,omitempty"`
685+ MinID discord.Snowflake `schema:"min_id,omitempty"`
686+ }
687+
688+ SearchThreadsResponse struct {
689+ Threads []discord.Channel `json:"threads"`
690+ Members []discord.ThreadMember `json:"members"`
691+ HasMore bool `json:"has_more"`
692+ TotalResults int `json:"total_results"`
693+ FirstMessages []discord.Message `json:"first_messages,omitempty"`
694+ }
695+ )
696+
697+ func (c * Client ) SearchThreads (channelID discord.ChannelID , data SearchThreadsData ) (SearchThreadsResponse , error ) {
698+ var resp SearchThreadsResponse
699+ return resp , c .RequestJSON (
700+ & resp , "GET" ,
701+ EndpointChannels + channelID .String ()+ "/threads/search" ,
702+ httputil .WithSchema (c , data ),
703+ )
704+ }
0 commit comments