use crate::client::SlackClient;
use crate::error::Result;
use serde::{Deserialize, Serialize};
use std::collections::HashMap;
pub struct ApiApi {
client: SlackClient,
}
impl ApiApi {
pub(crate) fn new(client: SlackClient) -> Self {
Self { client }
}
pub async fn test(&self) -> Result<ApiTestResponse> {
let params = ApiTestRequest {
args: HashMap::new(),
};
self.client.post("api.test", ¶ms).await
}
pub async fn test_with_args(&self, args: HashMap<String, String>) -> Result<ApiTestResponse> {
let params = ApiTestRequest { args };
self.client.post("api.test", ¶ms).await
}
}
impl ApiTestResponse {
pub fn ok(&self) -> bool {
true }
}
#[derive(Debug, Serialize, Default)]
pub struct ApiTestRequest {
#[serde(flatten)]
pub args: HashMap<String, String>,
}
#[derive(Debug, Deserialize)]
pub struct ApiTestResponse {
#[serde(flatten)]
pub args: HashMap<String, serde_json::Value>,
}