#![allow(unused_imports)]
use crate::objects::*;
use crate::{
CursorPaginated, NextCursor, ResponseMetadata, SlackApiMethod, SlackClient, SlackError,
};
use serde::{Deserialize, Serialize};
#[doc(alias = "reminders.add")]
#[derive(Debug, Clone, PartialEq, Serialize)]
#[non_exhaustive]
pub struct RemindersAddRequest {
pub text: String,
pub time: String,
#[serde(skip_serializing_if = "Option::is_none")]
pub user: Option<String>,
#[serde(skip_serializing_if = "Option::is_none")]
pub team_id: Option<String>,
#[serde(skip_serializing_if = "Option::is_none")]
pub recurrence: Option<serde_json::Value>,
}
impl RemindersAddRequest {
pub fn new(text: impl Into<String>, time: impl Into<String>) -> Self {
Self {
text: text.into(),
time: time.into(),
user: None,
team_id: None,
recurrence: None,
}
}
pub fn user(mut self, user: impl Into<String>) -> Self {
self.user = Some(user.into());
self
}
pub fn team_id(mut self, team_id: impl Into<String>) -> Self {
self.team_id = Some(team_id.into());
self
}
pub fn recurrence(mut self, recurrence: serde_json::Value) -> Self {
self.recurrence = Some(recurrence);
self
}
}
impl SlackApiMethod for RemindersAddRequest {
const METHOD: &'static str = "reminders.add";
type Response = RemindersAddResponse;
}
#[doc(alias = "reminders.add")]
#[derive(Debug, Clone, Default, PartialEq, Serialize, Deserialize)]
pub struct RemindersAddResponse {
#[serde(
default,
deserialize_with = "crate::de::opt_object",
skip_serializing_if = "Option::is_none"
)]
pub reminder: Option<Reminder>,
#[serde(
default,
deserialize_with = "crate::de::opt_object",
skip_serializing_if = "Option::is_none"
)]
pub response_metadata: Option<ResponseMetadata>,
#[serde(
default,
deserialize_with = "crate::de::opt_string",
skip_serializing_if = "Option::is_none"
)]
pub warning: Option<String>,
}
#[doc(alias = "reminders.complete")]
#[derive(Debug, Clone, PartialEq, Serialize)]
#[non_exhaustive]
pub struct RemindersCompleteRequest {
pub reminder: String,
#[serde(skip_serializing_if = "Option::is_none")]
pub team_id: Option<String>,
}
impl RemindersCompleteRequest {
pub fn new(reminder: impl Into<String>) -> Self {
Self {
reminder: reminder.into(),
team_id: None,
}
}
pub fn team_id(mut self, team_id: impl Into<String>) -> Self {
self.team_id = Some(team_id.into());
self
}
}
impl SlackApiMethod for RemindersCompleteRequest {
const METHOD: &'static str = "reminders.complete";
type Response = RemindersCompleteResponse;
}
#[doc(alias = "reminders.complete")]
#[derive(Debug, Clone, Default, PartialEq, Serialize, Deserialize)]
pub struct RemindersCompleteResponse {
#[serde(flatten)]
pub extra: serde_json::Map<String, serde_json::Value>,
#[serde(
default,
deserialize_with = "crate::de::opt_object",
skip_serializing_if = "Option::is_none"
)]
pub response_metadata: Option<ResponseMetadata>,
#[serde(
default,
deserialize_with = "crate::de::opt_string",
skip_serializing_if = "Option::is_none"
)]
pub warning: Option<String>,
}
#[doc(alias = "reminders.delete")]
#[derive(Debug, Clone, PartialEq, Serialize)]
#[non_exhaustive]
pub struct RemindersDeleteRequest {
pub reminder: String,
#[serde(skip_serializing_if = "Option::is_none")]
pub team_id: Option<String>,
}
impl RemindersDeleteRequest {
pub fn new(reminder: impl Into<String>) -> Self {
Self {
reminder: reminder.into(),
team_id: None,
}
}
pub fn team_id(mut self, team_id: impl Into<String>) -> Self {
self.team_id = Some(team_id.into());
self
}
}
impl SlackApiMethod for RemindersDeleteRequest {
const METHOD: &'static str = "reminders.delete";
type Response = RemindersDeleteResponse;
}
#[doc(alias = "reminders.delete")]
#[derive(Debug, Clone, Default, PartialEq, Serialize, Deserialize)]
pub struct RemindersDeleteResponse {
#[serde(flatten)]
pub extra: serde_json::Map<String, serde_json::Value>,
#[serde(
default,
deserialize_with = "crate::de::opt_object",
skip_serializing_if = "Option::is_none"
)]
pub response_metadata: Option<ResponseMetadata>,
#[serde(
default,
deserialize_with = "crate::de::opt_string",
skip_serializing_if = "Option::is_none"
)]
pub warning: Option<String>,
}
#[doc(alias = "reminders.info")]
#[derive(Debug, Clone, PartialEq, Serialize)]
#[non_exhaustive]
pub struct RemindersInfoRequest {
pub reminder: String,
#[serde(skip_serializing_if = "Option::is_none")]
pub team_id: Option<String>,
}
impl RemindersInfoRequest {
pub fn new(reminder: impl Into<String>) -> Self {
Self {
reminder: reminder.into(),
team_id: None,
}
}
pub fn team_id(mut self, team_id: impl Into<String>) -> Self {
self.team_id = Some(team_id.into());
self
}
}
impl SlackApiMethod for RemindersInfoRequest {
const METHOD: &'static str = "reminders.info";
type Response = RemindersInfoResponse;
}
#[doc(alias = "reminders.info")]
#[derive(Debug, Clone, Default, PartialEq, Serialize, Deserialize)]
pub struct RemindersInfoResponse {
#[serde(
default,
deserialize_with = "crate::de::opt_object",
skip_serializing_if = "Option::is_none"
)]
pub reminder: Option<Reminder>,
#[serde(
default,
deserialize_with = "crate::de::opt_object",
skip_serializing_if = "Option::is_none"
)]
pub response_metadata: Option<ResponseMetadata>,
#[serde(
default,
deserialize_with = "crate::de::opt_string",
skip_serializing_if = "Option::is_none"
)]
pub warning: Option<String>,
}
#[doc(alias = "reminders.list")]
#[derive(Debug, Clone, PartialEq, Serialize, Default)]
#[non_exhaustive]
pub struct RemindersListRequest {
#[serde(skip_serializing_if = "Option::is_none")]
pub team_id: Option<String>,
}
impl RemindersListRequest {
pub fn new() -> Self {
Self { team_id: None }
}
pub fn team_id(mut self, team_id: impl Into<String>) -> Self {
self.team_id = Some(team_id.into());
self
}
}
impl SlackApiMethod for RemindersListRequest {
const METHOD: &'static str = "reminders.list";
type Response = RemindersListResponse;
}
#[doc(alias = "reminders.list")]
#[derive(Debug, Clone, Default, PartialEq, Serialize, Deserialize)]
pub struct RemindersListResponse {
#[serde(
default,
deserialize_with = "crate::de::vec",
skip_serializing_if = "Vec::is_empty"
)]
pub reminders: Vec<Reminder>,
#[serde(
default,
deserialize_with = "crate::de::opt_object",
skip_serializing_if = "Option::is_none"
)]
pub response_metadata: Option<ResponseMetadata>,
#[serde(
default,
deserialize_with = "crate::de::opt_string",
skip_serializing_if = "Option::is_none"
)]
pub warning: Option<String>,
}
impl SlackClient {
#[doc(alias = "reminders.add")]
pub async fn reminders_add(
&self,
request: &RemindersAddRequest,
) -> Result<RemindersAddResponse, SlackError> {
self.call(request).await
}
#[doc(alias = "reminders.complete")]
pub async fn reminders_complete(
&self,
request: &RemindersCompleteRequest,
) -> Result<RemindersCompleteResponse, SlackError> {
self.call(request).await
}
#[doc(alias = "reminders.delete")]
pub async fn reminders_delete(
&self,
request: &RemindersDeleteRequest,
) -> Result<RemindersDeleteResponse, SlackError> {
self.call(request).await
}
#[doc(alias = "reminders.info")]
pub async fn reminders_info(
&self,
request: &RemindersInfoRequest,
) -> Result<RemindersInfoResponse, SlackError> {
self.call(request).await
}
#[doc(alias = "reminders.list")]
pub async fn reminders_list(
&self,
request: &RemindersListRequest,
) -> Result<RemindersListResponse, SlackError> {
self.call(request).await
}
}