Skip to main content

slack_web_api/api/
assistant.rs

1// このファイルは codegen/generate.py が生成する。手で編集しない
2
3#![allow(unused_imports)]
4
5use crate::objects::*;
6use crate::{
7    CursorPaginated, NextCursor, ResponseMetadata, SlackApiMethod, SlackClient, SlackError,
8};
9use serde::{Deserialize, Serialize};
10
11/// Arguments for the Slack Web API method [`assistant.search.context`](https://docs.slack.dev/reference/methods/assistant.search.context): Searches messages, files, channels and users across your Slack organization.
12///
13/// Send it with [`SlackClient::assistant_search_context`].
14#[doc(alias = "assistant.search.context")]
15#[derive(Debug, Clone, PartialEq, Serialize)]
16#[non_exhaustive]
17pub struct AssistantSearchContextRequest {
18    /// User prompt or search query
19    pub query: String,
20    /// Send `action_token` as received in a message event.
21    #[serde(skip_serializing_if = "Option::is_none")]
22    pub action_token: Option<String>,
23    /// Mix and match channel types by providing a comma-separated list of any combination of `public_channel`, `private_channel`, `mpim`, `im`.
24    #[serde(skip_serializing_if = "Option::is_none")]
25    pub channel_types: Option<Vec<String>>,
26    /// Content types to include, a comma-separated list of any combination of `messages`, `files`, `channels`, `users`.
27    #[serde(skip_serializing_if = "Option::is_none")]
28    pub content_types: Option<Vec<String>>,
29    /// Whether the results should include bots.
30    #[serde(skip_serializing_if = "Option::is_none")]
31    pub include_bots: Option<bool>,
32    /// Whether to include deleted users in the user search results. Defaults to false.
33    #[serde(skip_serializing_if = "Option::is_none")]
34    pub include_deleted_users: Option<bool>,
35    /// UNIX timestamp filter. If present, filters for results before this date.
36    #[serde(skip_serializing_if = "Option::is_none")]
37    pub before: Option<i64>,
38    /// UNIX timestamp filter. If present, filters for results after this date.
39    #[serde(skip_serializing_if = "Option::is_none")]
40    pub after: Option<i64>,
41    /// Whether to include context messages surrounding the main message result. Defaults to false if unspecified.
42    #[serde(skip_serializing_if = "Option::is_none")]
43    pub include_context_messages: Option<bool>,
44    /// Context channel ID to support scoping the search when applicable.
45    #[serde(skip_serializing_if = "Option::is_none")]
46    pub context_channel_id: Option<String>,
47    /// The cursor returned by the API. Leave this blank for the first request and use this to get the next page of results.
48    #[serde(skip_serializing_if = "Option::is_none")]
49    pub cursor: Option<String>,
50    /// Number of results to return, up to a max of 20. Defaults to 20.
51    #[serde(skip_serializing_if = "Option::is_none")]
52    pub limit: Option<i64>,
53    /// The field to sort the results by. Defaults to score. Can be one of: score, timestamp.
54    #[serde(skip_serializing_if = "Option::is_none")]
55    pub sort: Option<String>,
56    /// The direction to sort the results by. Defaults to desc.
57    #[serde(skip_serializing_if = "Option::is_none")]
58    pub sort_dir: Option<String>,
59    /// Whether to return the message blocks in the response.
60    #[serde(skip_serializing_if = "Option::is_none")]
61    pub include_message_blocks: Option<bool>,
62    /// Whether to highlight the search query in the results. Defaults to false if unspecified.
63    #[serde(skip_serializing_if = "Option::is_none")]
64    pub highlight: Option<bool>,
65    /// A list of term clauses. A term clause is a string with search terms. Search results returned will match every term clause specified (i.e., conjunctive normal form).
66    #[serde(
67        skip_serializing_if = "Option::is_none",
68        serialize_with = "crate::form::as_json"
69    )]
70    pub term_clauses: Option<Vec<serde_json::Value>>,
71    /// A string containing only modifiers in the format of `modifier:value`. Search results returned will match the modifier value. For now modifiers only affect term clauses.
72    #[serde(skip_serializing_if = "Option::is_none")]
73    pub modifiers: Option<String>,
74    /// Whether to include archived channels in the search results.
75    #[serde(skip_serializing_if = "Option::is_none")]
76    pub include_archived_channels: Option<bool>,
77    /// Whether to disable semantic search. When true, only keyword-based search is used. Defaults to false.
78    #[serde(skip_serializing_if = "Option::is_none")]
79    pub disable_semantic_search: Option<bool>,
80}
81
82impl AssistantSearchContextRequest {
83    pub fn new(query: impl Into<String>) -> Self {
84        Self {
85            query: query.into(),
86            action_token: None,
87            channel_types: None,
88            content_types: None,
89            include_bots: None,
90            include_deleted_users: None,
91            before: None,
92            after: None,
93            include_context_messages: None,
94            context_channel_id: None,
95            cursor: None,
96            limit: None,
97            sort: None,
98            sort_dir: None,
99            include_message_blocks: None,
100            highlight: None,
101            term_clauses: None,
102            modifiers: None,
103            include_archived_channels: None,
104            disable_semantic_search: None,
105        }
106    }
107
108    pub fn action_token(mut self, action_token: impl Into<String>) -> Self {
109        self.action_token = Some(action_token.into());
110        self
111    }
112
113    pub fn channel_types(mut self, channel_types: Vec<String>) -> Self {
114        self.channel_types = Some(channel_types);
115        self
116    }
117
118    pub fn content_types(mut self, content_types: Vec<String>) -> Self {
119        self.content_types = Some(content_types);
120        self
121    }
122
123    pub fn include_bots(mut self, include_bots: bool) -> Self {
124        self.include_bots = Some(include_bots);
125        self
126    }
127
128    pub fn include_deleted_users(mut self, include_deleted_users: bool) -> Self {
129        self.include_deleted_users = Some(include_deleted_users);
130        self
131    }
132
133    pub fn before(mut self, before: i64) -> Self {
134        self.before = Some(before);
135        self
136    }
137
138    pub fn after(mut self, after: i64) -> Self {
139        self.after = Some(after);
140        self
141    }
142
143    pub fn include_context_messages(mut self, include_context_messages: bool) -> Self {
144        self.include_context_messages = Some(include_context_messages);
145        self
146    }
147
148    pub fn context_channel_id(mut self, context_channel_id: impl Into<String>) -> Self {
149        self.context_channel_id = Some(context_channel_id.into());
150        self
151    }
152
153    pub fn cursor(mut self, cursor: impl Into<String>) -> Self {
154        self.cursor = Some(cursor.into());
155        self
156    }
157
158    pub fn limit(mut self, limit: i64) -> Self {
159        self.limit = Some(limit);
160        self
161    }
162
163    pub fn sort(mut self, sort: impl Into<String>) -> Self {
164        self.sort = Some(sort.into());
165        self
166    }
167
168    pub fn sort_dir(mut self, sort_dir: impl Into<String>) -> Self {
169        self.sort_dir = Some(sort_dir.into());
170        self
171    }
172
173    pub fn include_message_blocks(mut self, include_message_blocks: bool) -> Self {
174        self.include_message_blocks = Some(include_message_blocks);
175        self
176    }
177
178    pub fn highlight(mut self, highlight: bool) -> Self {
179        self.highlight = Some(highlight);
180        self
181    }
182
183    pub fn term_clauses(mut self, term_clauses: Vec<serde_json::Value>) -> Self {
184        self.term_clauses = Some(term_clauses);
185        self
186    }
187
188    pub fn modifiers(mut self, modifiers: impl Into<String>) -> Self {
189        self.modifiers = Some(modifiers.into());
190        self
191    }
192
193    pub fn include_archived_channels(mut self, include_archived_channels: bool) -> Self {
194        self.include_archived_channels = Some(include_archived_channels);
195        self
196    }
197
198    pub fn disable_semantic_search(mut self, disable_semantic_search: bool) -> Self {
199        self.disable_semantic_search = Some(disable_semantic_search);
200        self
201    }
202}
203
204impl SlackApiMethod for AssistantSearchContextRequest {
205    const METHOD: &'static str = "assistant.search.context";
206    type Response = AssistantSearchContextResponse;
207}
208
209impl CursorPaginated for AssistantSearchContextRequest {
210    fn set_cursor(&mut self, cursor: String) {
211        self.cursor = Some(cursor);
212    }
213}
214
215impl NextCursor for AssistantSearchContextResponse {
216    fn next_cursor(&self) -> Option<&str> {
217        self.response_metadata.as_ref()?.next_cursor.as_deref()
218    }
219}
220
221/// Successful response of the Slack Web API method [`assistant.search.context`](https://docs.slack.dev/reference/methods/assistant.search.context).
222#[doc(alias = "assistant.search.context")]
223#[derive(Debug, Clone, Default, PartialEq, Serialize, Deserialize)]
224pub struct AssistantSearchContextResponse {
225    #[serde(
226        default,
227        deserialize_with = "crate::de::opt_object",
228        skip_serializing_if = "Option::is_none"
229    )]
230    pub results: Option<AssistantSearchContextResponseResults>,
231    #[serde(
232        default,
233        deserialize_with = "crate::de::opt_object",
234        skip_serializing_if = "Option::is_none"
235    )]
236    pub response_metadata: Option<ResponseMetadata>,
237    #[serde(
238        default,
239        deserialize_with = "crate::de::opt_string",
240        skip_serializing_if = "Option::is_none"
241    )]
242    pub warning: Option<String>,
243}
244
245#[derive(Debug, Clone, Default, PartialEq, Serialize, Deserialize)]
246pub struct AssistantSearchContextResponseResults {
247    #[serde(
248        default,
249        deserialize_with = "crate::de::vec",
250        skip_serializing_if = "Vec::is_empty"
251    )]
252    pub messages: Vec<AssistantSearchContextResponseResultsMessages>,
253    #[serde(
254        default,
255        deserialize_with = "crate::de::vec",
256        skip_serializing_if = "Vec::is_empty"
257    )]
258    pub files: Vec<AssistantSearchContextResponseResultsFiles>,
259    #[serde(
260        default,
261        deserialize_with = "crate::de::vec",
262        skip_serializing_if = "Vec::is_empty"
263    )]
264    pub channels: Vec<AssistantSearchContextResponseResultsChannels>,
265}
266
267#[derive(Debug, Clone, Default, PartialEq, Serialize, Deserialize)]
268pub struct AssistantSearchContextResponseResultsMessages {
269    #[serde(
270        default,
271        deserialize_with = "crate::de::opt_string",
272        skip_serializing_if = "Option::is_none"
273    )]
274    pub author_name: Option<String>,
275    #[serde(
276        default,
277        deserialize_with = "crate::de::opt_string",
278        skip_serializing_if = "Option::is_none"
279    )]
280    pub author_user_id: Option<String>,
281    #[serde(
282        default,
283        deserialize_with = "crate::de::opt_string",
284        skip_serializing_if = "Option::is_none"
285    )]
286    pub team_id: Option<String>,
287    #[serde(
288        default,
289        deserialize_with = "crate::de::opt_string",
290        skip_serializing_if = "Option::is_none"
291    )]
292    pub channel_id: Option<String>,
293    #[serde(
294        default,
295        deserialize_with = "crate::de::opt_string",
296        skip_serializing_if = "Option::is_none"
297    )]
298    pub channel_name: Option<String>,
299    #[serde(
300        default,
301        deserialize_with = "crate::de::opt_string",
302        skip_serializing_if = "Option::is_none"
303    )]
304    pub message_ts: Option<String>,
305    #[serde(
306        default,
307        deserialize_with = "crate::de::opt_string",
308        skip_serializing_if = "Option::is_none"
309    )]
310    pub content: Option<String>,
311    #[serde(
312        default,
313        deserialize_with = "crate::de::opt_bool",
314        skip_serializing_if = "Option::is_none"
315    )]
316    pub is_author_bot: Option<bool>,
317    #[serde(
318        default,
319        deserialize_with = "crate::de::opt_string",
320        skip_serializing_if = "Option::is_none"
321    )]
322    pub permalink: Option<String>,
323    #[serde(
324        default,
325        deserialize_with = "crate::de::vec",
326        skip_serializing_if = "Vec::is_empty"
327    )]
328    pub blocks: Vec<crate::blocks::Block>,
329    #[serde(
330        default,
331        deserialize_with = "crate::de::opt_object",
332        skip_serializing_if = "Option::is_none"
333    )]
334    pub context_messages: Option<AssistantSearchContextResponseResultsMessagesContextMessages>,
335}
336
337#[derive(Debug, Clone, Default, PartialEq, Serialize, Deserialize)]
338pub struct AssistantSearchContextResponseResultsMessagesContextMessages {
339    #[serde(
340        default,
341        deserialize_with = "crate::de::vec",
342        skip_serializing_if = "Vec::is_empty"
343    )]
344    pub before: Vec<AssistantSearchContextResponseResultsMessagesContextMessagesBefore>,
345    #[serde(
346        default,
347        deserialize_with = "crate::de::vec",
348        skip_serializing_if = "Vec::is_empty"
349    )]
350    pub after: Vec<AssistantSearchContextResponseResultsMessagesContextMessagesAfter>,
351}
352
353#[derive(Debug, Clone, Default, PartialEq, Serialize, Deserialize)]
354pub struct AssistantSearchContextResponseResultsMessagesContextMessagesBefore {
355    #[serde(
356        default,
357        deserialize_with = "crate::de::opt_string",
358        skip_serializing_if = "Option::is_none"
359    )]
360    pub text: Option<String>,
361    #[serde(
362        rename = "user_id:",
363        default,
364        deserialize_with = "crate::de::opt_string",
365        skip_serializing_if = "Option::is_none"
366    )]
367    pub user_id: Option<String>,
368    #[serde(
369        default,
370        deserialize_with = "crate::de::opt_string",
371        skip_serializing_if = "Option::is_none"
372    )]
373    pub ts: Option<String>,
374    #[serde(
375        default,
376        deserialize_with = "crate::de::vec",
377        skip_serializing_if = "Vec::is_empty"
378    )]
379    pub blocks: Vec<crate::blocks::Block>,
380}
381
382#[derive(Debug, Clone, Default, PartialEq, Serialize, Deserialize)]
383pub struct AssistantSearchContextResponseResultsMessagesContextMessagesAfter {
384    #[serde(
385        default,
386        deserialize_with = "crate::de::opt_string",
387        skip_serializing_if = "Option::is_none"
388    )]
389    pub text: Option<String>,
390    #[serde(
391        rename = "user_id:",
392        default,
393        deserialize_with = "crate::de::opt_string",
394        skip_serializing_if = "Option::is_none"
395    )]
396    pub user_id: Option<String>,
397    #[serde(
398        default,
399        deserialize_with = "crate::de::opt_string",
400        skip_serializing_if = "Option::is_none"
401    )]
402    pub ts: Option<String>,
403    #[serde(
404        default,
405        deserialize_with = "crate::de::vec",
406        skip_serializing_if = "Vec::is_empty"
407    )]
408    pub blocks: Vec<crate::blocks::Block>,
409}
410
411#[derive(Debug, Clone, Default, PartialEq, Serialize, Deserialize)]
412pub struct AssistantSearchContextResponseResultsFiles {
413    #[serde(
414        default,
415        deserialize_with = "crate::de::opt_string",
416        skip_serializing_if = "Option::is_none"
417    )]
418    pub uploader_user_id: Option<String>,
419    #[serde(
420        default,
421        deserialize_with = "crate::de::opt_string",
422        skip_serializing_if = "Option::is_none"
423    )]
424    pub author_user_id: Option<String>,
425    #[serde(
426        default,
427        deserialize_with = "crate::de::opt_string",
428        skip_serializing_if = "Option::is_none"
429    )]
430    pub author_name: Option<String>,
431    #[serde(
432        default,
433        deserialize_with = "crate::de::opt_string",
434        skip_serializing_if = "Option::is_none"
435    )]
436    pub team_id: Option<String>,
437    #[serde(
438        default,
439        deserialize_with = "crate::de::opt_string",
440        skip_serializing_if = "Option::is_none"
441    )]
442    pub file_id: Option<String>,
443    #[serde(
444        default,
445        deserialize_with = "crate::de::opt_i64",
446        skip_serializing_if = "Option::is_none"
447    )]
448    pub date_created: Option<i64>,
449    #[serde(
450        default,
451        deserialize_with = "crate::de::opt_i64",
452        skip_serializing_if = "Option::is_none"
453    )]
454    pub date_updated: Option<i64>,
455    #[serde(
456        default,
457        deserialize_with = "crate::de::opt_string",
458        skip_serializing_if = "Option::is_none"
459    )]
460    pub title: Option<String>,
461    #[serde(
462        default,
463        deserialize_with = "crate::de::opt_string",
464        skip_serializing_if = "Option::is_none"
465    )]
466    pub file_type: Option<String>,
467    #[serde(
468        default,
469        deserialize_with = "crate::de::opt_string",
470        skip_serializing_if = "Option::is_none"
471    )]
472    pub permalink: Option<String>,
473    #[serde(
474        default,
475        deserialize_with = "crate::de::opt_string",
476        skip_serializing_if = "Option::is_none"
477    )]
478    pub content: Option<String>,
479}
480
481#[derive(Debug, Clone, Default, PartialEq, Serialize, Deserialize)]
482pub struct AssistantSearchContextResponseResultsChannels {
483    #[serde(
484        default,
485        deserialize_with = "crate::de::opt_string",
486        skip_serializing_if = "Option::is_none"
487    )]
488    pub team_id: Option<String>,
489    #[serde(
490        default,
491        deserialize_with = "crate::de::opt_string",
492        skip_serializing_if = "Option::is_none"
493    )]
494    pub creator_user_id: Option<String>,
495    #[serde(
496        default,
497        deserialize_with = "crate::de::opt_string",
498        skip_serializing_if = "Option::is_none"
499    )]
500    pub creator_name: Option<String>,
501    #[serde(
502        default,
503        deserialize_with = "crate::de::opt_i64",
504        skip_serializing_if = "Option::is_none"
505    )]
506    pub date_created: Option<i64>,
507    #[serde(
508        default,
509        deserialize_with = "crate::de::opt_i64",
510        skip_serializing_if = "Option::is_none"
511    )]
512    pub date_updated: Option<i64>,
513    #[serde(
514        default,
515        deserialize_with = "crate::de::opt_string",
516        skip_serializing_if = "Option::is_none"
517    )]
518    pub name: Option<String>,
519    #[serde(
520        default,
521        deserialize_with = "crate::de::opt_string",
522        skip_serializing_if = "Option::is_none"
523    )]
524    pub topic: Option<String>,
525    #[serde(
526        default,
527        deserialize_with = "crate::de::opt_string",
528        skip_serializing_if = "Option::is_none"
529    )]
530    pub purpose: Option<String>,
531    #[serde(
532        default,
533        deserialize_with = "crate::de::opt_string",
534        skip_serializing_if = "Option::is_none"
535    )]
536    pub permalink: Option<String>,
537}
538
539/// Arguments for the Slack Web API method [`assistant.search.info`](https://docs.slack.dev/reference/methods/assistant.search.info): Returns search capabilities on a given team.
540///
541/// Send it with [`SlackClient::assistant_search_info`].
542#[doc(alias = "assistant.search.info")]
543#[derive(Debug, Clone, PartialEq, Serialize, Default)]
544#[non_exhaustive]
545pub struct AssistantSearchInfoRequest {}
546
547impl AssistantSearchInfoRequest {
548    pub fn new() -> Self {
549        Self {}
550    }
551}
552
553impl SlackApiMethod for AssistantSearchInfoRequest {
554    const METHOD: &'static str = "assistant.search.info";
555    type Response = AssistantSearchInfoResponse;
556}
557
558/// Successful response of the Slack Web API method [`assistant.search.info`](https://docs.slack.dev/reference/methods/assistant.search.info).
559#[doc(alias = "assistant.search.info")]
560#[derive(Debug, Clone, Default, PartialEq, Serialize, Deserialize)]
561pub struct AssistantSearchInfoResponse {
562    #[serde(
563        default,
564        deserialize_with = "crate::de::opt_bool",
565        skip_serializing_if = "Option::is_none"
566    )]
567    pub is_ai_search_enabled: Option<bool>,
568    #[serde(
569        default,
570        deserialize_with = "crate::de::opt_object",
571        skip_serializing_if = "Option::is_none"
572    )]
573    pub response_metadata: Option<ResponseMetadata>,
574    #[serde(
575        default,
576        deserialize_with = "crate::de::opt_string",
577        skip_serializing_if = "Option::is_none"
578    )]
579    pub warning: Option<String>,
580}
581
582/// Arguments for the Slack Web API method [`assistant.threads.setStatus`](https://docs.slack.dev/reference/methods/assistant.threads.setStatus): Set the status for an AI assistant thread.
583///
584/// Send it with [`SlackClient::assistant_threads_set_status`].
585#[doc(alias = "assistant.threads.setStatus")]
586#[derive(Debug, Clone, PartialEq, Serialize)]
587#[non_exhaustive]
588pub struct AssistantThreadsSetStatusRequest {
589    /// Channel ID containing the assistant thread.
590    pub channel_id: String,
591    /// Message timestamp of the thread of where to set the status.
592    pub thread_ts: String,
593    /// Status of the specified bot user, e.g., 'is thinking...'. A two minute timeout applies, which will cause the status to be removed if no message has been sent.
594    pub status: String,
595    /// The list of messages to rotate through as a loading indicator. Maximum of 10 messages.
596    #[serde(
597        skip_serializing_if = "Option::is_none",
598        serialize_with = "crate::form::as_json"
599    )]
600    pub loading_messages: Option<Vec<serde_json::Value>>,
601    /// Emoji to use as the icon for this message. Overrides `icon_url`.
602    #[serde(skip_serializing_if = "Option::is_none")]
603    pub icon_emoji: Option<String>,
604    /// Image URL to use as the icon for this message.
605    #[serde(skip_serializing_if = "Option::is_none")]
606    pub icon_url: Option<String>,
607    /// The bot's username to display.
608    #[serde(skip_serializing_if = "Option::is_none")]
609    pub username: Option<String>,
610}
611
612impl AssistantThreadsSetStatusRequest {
613    pub fn new(
614        channel_id: impl Into<String>,
615        thread_ts: impl Into<String>,
616        status: impl Into<String>,
617    ) -> Self {
618        Self {
619            channel_id: channel_id.into(),
620            thread_ts: thread_ts.into(),
621            status: status.into(),
622            loading_messages: None,
623            icon_emoji: None,
624            icon_url: None,
625            username: None,
626        }
627    }
628
629    pub fn loading_messages(mut self, loading_messages: Vec<serde_json::Value>) -> Self {
630        self.loading_messages = Some(loading_messages);
631        self
632    }
633
634    pub fn icon_emoji(mut self, icon_emoji: impl Into<String>) -> Self {
635        self.icon_emoji = Some(icon_emoji.into());
636        self
637    }
638
639    pub fn icon_url(mut self, icon_url: impl Into<String>) -> Self {
640        self.icon_url = Some(icon_url.into());
641        self
642    }
643
644    pub fn username(mut self, username: impl Into<String>) -> Self {
645        self.username = Some(username.into());
646        self
647    }
648}
649
650impl SlackApiMethod for AssistantThreadsSetStatusRequest {
651    const METHOD: &'static str = "assistant.threads.setStatus";
652    type Response = AssistantThreadsSetStatusResponse;
653}
654
655/// Successful response of the Slack Web API method [`assistant.threads.setStatus`](https://docs.slack.dev/reference/methods/assistant.threads.setStatus).
656#[doc(alias = "assistant.threads.setStatus")]
657#[derive(Debug, Clone, Default, PartialEq, Serialize, Deserialize)]
658pub struct AssistantThreadsSetStatusResponse {
659    /// Fields returned by Slack. This method has no documented response example.
660    #[serde(flatten)]
661    pub extra: serde_json::Map<String, serde_json::Value>,
662    #[serde(
663        default,
664        deserialize_with = "crate::de::opt_object",
665        skip_serializing_if = "Option::is_none"
666    )]
667    pub response_metadata: Option<ResponseMetadata>,
668    #[serde(
669        default,
670        deserialize_with = "crate::de::opt_string",
671        skip_serializing_if = "Option::is_none"
672    )]
673    pub warning: Option<String>,
674}
675
676/// Arguments for the Slack Web API method [`assistant.threads.setSuggestedPrompts`](https://docs.slack.dev/reference/methods/assistant.threads.setSuggestedPrompts): Set suggested prompts for the given assistant thread
677///
678/// Send it with [`SlackClient::assistant_threads_set_suggested_prompts`].
679#[doc(alias = "assistant.threads.setSuggestedPrompts")]
680#[derive(Debug, Clone, PartialEq, Serialize)]
681#[non_exhaustive]
682pub struct AssistantThreadsSetSuggestedPromptsRequest {
683    /// Channel ID containing the assistant thread.
684    pub channel_id: String,
685    /// Each prompt should be supplied with its `title` and `message` attribute.
686    pub prompts: String,
687    /// Message timestamp of the thread to set suggested prompts for. If not provided, the prompts will be set for the latest message in the channel.
688    #[serde(skip_serializing_if = "Option::is_none")]
689    pub thread_ts: Option<String>,
690    /// Title for the list of provided prompts. For example: Suggested Prompts, Related Questions.
691    #[serde(skip_serializing_if = "Option::is_none")]
692    pub title: Option<String>,
693}
694
695impl AssistantThreadsSetSuggestedPromptsRequest {
696    pub fn new(channel_id: impl Into<String>, prompts: impl Into<String>) -> Self {
697        Self {
698            channel_id: channel_id.into(),
699            prompts: prompts.into(),
700            thread_ts: None,
701            title: None,
702        }
703    }
704
705    pub fn thread_ts(mut self, thread_ts: impl Into<String>) -> Self {
706        self.thread_ts = Some(thread_ts.into());
707        self
708    }
709
710    pub fn title(mut self, title: impl Into<String>) -> Self {
711        self.title = Some(title.into());
712        self
713    }
714}
715
716impl SlackApiMethod for AssistantThreadsSetSuggestedPromptsRequest {
717    const METHOD: &'static str = "assistant.threads.setSuggestedPrompts";
718    type Response = AssistantThreadsSetSuggestedPromptsResponse;
719}
720
721/// Successful response of the Slack Web API method [`assistant.threads.setSuggestedPrompts`](https://docs.slack.dev/reference/methods/assistant.threads.setSuggestedPrompts).
722#[doc(alias = "assistant.threads.setSuggestedPrompts")]
723#[derive(Debug, Clone, Default, PartialEq, Serialize, Deserialize)]
724pub struct AssistantThreadsSetSuggestedPromptsResponse {
725    /// Fields returned by Slack. This method has no documented response example.
726    #[serde(flatten)]
727    pub extra: serde_json::Map<String, serde_json::Value>,
728    #[serde(
729        default,
730        deserialize_with = "crate::de::opt_object",
731        skip_serializing_if = "Option::is_none"
732    )]
733    pub response_metadata: Option<ResponseMetadata>,
734    #[serde(
735        default,
736        deserialize_with = "crate::de::opt_string",
737        skip_serializing_if = "Option::is_none"
738    )]
739    pub warning: Option<String>,
740}
741
742/// Arguments for the Slack Web API method [`assistant.threads.setTitle`](https://docs.slack.dev/reference/methods/assistant.threads.setTitle): Set the title for the given assistant thread
743///
744/// Send it with [`SlackClient::assistant_threads_set_title`].
745#[doc(alias = "assistant.threads.setTitle")]
746#[derive(Debug, Clone, PartialEq, Serialize)]
747#[non_exhaustive]
748pub struct AssistantThreadsSetTitleRequest {
749    /// Channel ID containing the assistant thread.
750    pub channel_id: String,
751    /// Message timestamp of the thread to set suggested prompts for.
752    pub thread_ts: String,
753    /// The title to use for the thread.
754    pub title: String,
755}
756
757impl AssistantThreadsSetTitleRequest {
758    pub fn new(
759        channel_id: impl Into<String>,
760        thread_ts: impl Into<String>,
761        title: impl Into<String>,
762    ) -> Self {
763        Self {
764            channel_id: channel_id.into(),
765            thread_ts: thread_ts.into(),
766            title: title.into(),
767        }
768    }
769}
770
771impl SlackApiMethod for AssistantThreadsSetTitleRequest {
772    const METHOD: &'static str = "assistant.threads.setTitle";
773    type Response = AssistantThreadsSetTitleResponse;
774}
775
776/// Successful response of the Slack Web API method [`assistant.threads.setTitle`](https://docs.slack.dev/reference/methods/assistant.threads.setTitle).
777#[doc(alias = "assistant.threads.setTitle")]
778#[derive(Debug, Clone, Default, PartialEq, Serialize, Deserialize)]
779pub struct AssistantThreadsSetTitleResponse {
780    /// Fields returned by Slack. This method has no documented response example.
781    #[serde(flatten)]
782    pub extra: serde_json::Map<String, serde_json::Value>,
783    #[serde(
784        default,
785        deserialize_with = "crate::de::opt_object",
786        skip_serializing_if = "Option::is_none"
787    )]
788    pub response_metadata: Option<ResponseMetadata>,
789    #[serde(
790        default,
791        deserialize_with = "crate::de::opt_string",
792        skip_serializing_if = "Option::is_none"
793    )]
794    pub warning: Option<String>,
795}
796
797impl SlackClient {
798    /// Calls the Slack Web API method [`assistant.search.context`](https://docs.slack.dev/reference/methods/assistant.search.context): Searches messages, files, channels and users across your Slack organization.
799    ///
800    /// Required scopes:
801    ///
802    /// - bot token: `search:read.public`, `search:read.files`, `search:read.users`
803    /// - user token: `search:read.public`, `search:read.private`, `search:read.im`, `search:read.mpim`, `search:read.files`, `search:read.users`
804    ///
805    /// Rate limit: Tier 5 (<https://docs.slack.dev/apis/web-api/rate-limits>).
806    ///
807    /// # Errors
808    ///
809    /// Returns [`SlackError::Api`] when Slack answers `"ok": false`; see [`SlackClient::call`] for the other cases.
810    #[doc(alias = "assistant.search.context")]
811    pub async fn assistant_search_context(
812        &self,
813        request: &AssistantSearchContextRequest,
814    ) -> Result<AssistantSearchContextResponse, SlackError> {
815        self.call(request).await
816    }
817
818    /// Calls the Slack Web API method [`assistant.search.info`](https://docs.slack.dev/reference/methods/assistant.search.info): Returns search capabilities on a given team.
819    ///
820    /// Required scopes:
821    ///
822    /// - bot token: `search:read.public`
823    /// - user token: `search:read.public`
824    ///
825    /// Rate limit: Tier 2 (<https://docs.slack.dev/apis/web-api/rate-limits>).
826    ///
827    /// # Errors
828    ///
829    /// Returns [`SlackError::Api`] when Slack answers `"ok": false`; see [`SlackClient::call`] for the other cases.
830    #[doc(alias = "assistant.search.info")]
831    pub async fn assistant_search_info(
832        &self,
833        request: &AssistantSearchInfoRequest,
834    ) -> Result<AssistantSearchInfoResponse, SlackError> {
835        self.call(request).await
836    }
837
838    /// Calls the Slack Web API method [`assistant.threads.setStatus`](https://docs.slack.dev/reference/methods/assistant.threads.setStatus): Set the status for an AI assistant thread.
839    ///
840    /// Required scopes:
841    ///
842    /// - bot token: `chat:write`
843    ///
844    /// Rate limit: Tier 5 (<https://docs.slack.dev/apis/web-api/rate-limits>).
845    ///
846    /// # Errors
847    ///
848    /// Returns [`SlackError::Api`] when Slack answers `"ok": false`; see [`SlackClient::call`] for the other cases.
849    #[doc(alias = "assistant.threads.setStatus")]
850    pub async fn assistant_threads_set_status(
851        &self,
852        request: &AssistantThreadsSetStatusRequest,
853    ) -> Result<AssistantThreadsSetStatusResponse, SlackError> {
854        self.call(request).await
855    }
856
857    /// Calls the Slack Web API method [`assistant.threads.setSuggestedPrompts`](https://docs.slack.dev/reference/methods/assistant.threads.setSuggestedPrompts): Set suggested prompts for the given assistant thread
858    ///
859    /// Required scopes:
860    ///
861    /// - bot token: `assistant:write`
862    ///
863    /// Rate limit: Tier 4 (<https://docs.slack.dev/apis/web-api/rate-limits>).
864    ///
865    /// # Errors
866    ///
867    /// Returns [`SlackError::Api`] when Slack answers `"ok": false`; see [`SlackClient::call`] for the other cases.
868    #[doc(alias = "assistant.threads.setSuggestedPrompts")]
869    pub async fn assistant_threads_set_suggested_prompts(
870        &self,
871        request: &AssistantThreadsSetSuggestedPromptsRequest,
872    ) -> Result<AssistantThreadsSetSuggestedPromptsResponse, SlackError> {
873        self.call(request).await
874    }
875
876    /// Calls the Slack Web API method [`assistant.threads.setTitle`](https://docs.slack.dev/reference/methods/assistant.threads.setTitle): Set the title for the given assistant thread
877    ///
878    /// Required scopes:
879    ///
880    /// - bot token: `assistant:write`
881    ///
882    /// Rate limit: Tier 4 (<https://docs.slack.dev/apis/web-api/rate-limits>).
883    ///
884    /// # Errors
885    ///
886    /// Returns [`SlackError::Api`] when Slack answers `"ok": false`; see [`SlackClient::call`] for the other cases.
887    #[doc(alias = "assistant.threads.setTitle")]
888    pub async fn assistant_threads_set_title(
889        &self,
890        request: &AssistantThreadsSetTitleRequest,
891    ) -> Result<AssistantThreadsSetTitleResponse, SlackError> {
892        self.call(request).await
893    }
894}