slack_web_api/api/
api_test.rs1#![allow(unused_imports)]
4
5use crate::objects::*;
6use crate::{
7 CursorPaginated, NextCursor, ResponseMetadata, SlackApiMethod, SlackClient, SlackError,
8};
9use serde::{Deserialize, Serialize};
10
11#[doc(alias = "api.test")]
15#[derive(Debug, Clone, PartialEq, Serialize, Default)]
16#[non_exhaustive]
17pub struct ApiTestRequest {
18 #[serde(skip_serializing_if = "Option::is_none")]
20 pub error: Option<String>,
21}
22
23impl ApiTestRequest {
24 pub fn new() -> Self {
25 Self { error: None }
26 }
27
28 pub fn error(mut self, error: impl Into<String>) -> Self {
29 self.error = Some(error.into());
30 self
31 }
32}
33
34impl SlackApiMethod for ApiTestRequest {
35 const METHOD: &'static str = "api.test";
36 type Response = ApiTestResponse;
37}
38
39#[doc(alias = "api.test")]
41#[derive(Debug, Clone, Default, PartialEq, Serialize, Deserialize)]
42pub struct ApiTestResponse {
43 #[serde(
44 default,
45 deserialize_with = "crate::de::opt_object",
46 skip_serializing_if = "Option::is_none"
47 )]
48 pub args: Option<ApiTestResponseArgs>,
49 #[serde(
50 default,
51 deserialize_with = "crate::de::opt_object",
52 skip_serializing_if = "Option::is_none"
53 )]
54 pub response_metadata: Option<ResponseMetadata>,
55 #[serde(
56 default,
57 deserialize_with = "crate::de::opt_string",
58 skip_serializing_if = "Option::is_none"
59 )]
60 pub warning: Option<String>,
61}
62
63#[derive(Debug, Clone, Default, PartialEq, Serialize, Deserialize)]
64pub struct ApiTestResponseArgs {
65 #[serde(
66 default,
67 deserialize_with = "crate::de::opt_string",
68 skip_serializing_if = "Option::is_none"
69 )]
70 pub foo: Option<String>,
71}
72
73impl SlackClient {
74 #[doc(alias = "api.test")]
82 pub async fn api_test(&self, request: &ApiTestRequest) -> Result<ApiTestResponse, SlackError> {
83 self.call(request).await
84 }
85}