#![allow(unused_imports)]
use crate::objects::*;
use crate::{
CursorPaginated, NextCursor, ResponseMetadata, SlackApiMethod, SlackClient, SlackError,
};
use serde::{Deserialize, Serialize};
#[doc(alias = "files.comments.delete")]
#[derive(Debug, Clone, PartialEq, Serialize)]
#[non_exhaustive]
pub struct FilesCommentsDeleteRequest {
pub file: String,
pub id: String,
}
impl FilesCommentsDeleteRequest {
pub fn new(file: impl Into<String>, id: impl Into<String>) -> Self {
Self {
file: file.into(),
id: id.into(),
}
}
}
impl SlackApiMethod for FilesCommentsDeleteRequest {
const METHOD: &'static str = "files.comments.delete";
type Response = FilesCommentsDeleteResponse;
}
#[doc(alias = "files.comments.delete")]
#[derive(Debug, Clone, Default, PartialEq, Serialize, Deserialize)]
pub struct FilesCommentsDeleteResponse {
#[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 = "files.completeUploadExternal")]
#[derive(Debug, Clone, PartialEq, Serialize)]
#[non_exhaustive]
pub struct FilesCompleteUploadExternalRequest {
#[serde(serialize_with = "crate::form::as_json")]
pub files: Vec<serde_json::Value>,
#[serde(skip_serializing_if = "Option::is_none")]
pub channel_id: Option<String>,
#[serde(skip_serializing_if = "Option::is_none")]
pub thread_ts: Option<String>,
#[serde(skip_serializing_if = "Option::is_none")]
pub channels: Option<String>,
#[serde(skip_serializing_if = "Option::is_none")]
pub initial_comment: Option<String>,
#[serde(
skip_serializing_if = "Option::is_none",
serialize_with = "crate::form::as_json"
)]
pub blocks: Option<Vec<crate::blocks::Block>>,
#[serde(skip_serializing_if = "Option::is_none")]
pub username: Option<String>,
#[serde(skip_serializing_if = "Option::is_none")]
pub icon_url: Option<String>,
#[serde(skip_serializing_if = "Option::is_none")]
pub icon_emoji: Option<String>,
}
impl FilesCompleteUploadExternalRequest {
pub fn new(files: Vec<serde_json::Value>) -> Self {
Self {
files,
channel_id: None,
thread_ts: None,
channels: None,
initial_comment: None,
blocks: None,
username: None,
icon_url: None,
icon_emoji: None,
}
}
pub fn channel_id(mut self, channel_id: impl Into<String>) -> Self {
self.channel_id = Some(channel_id.into());
self
}
pub fn thread_ts(mut self, thread_ts: impl Into<String>) -> Self {
self.thread_ts = Some(thread_ts.into());
self
}
pub fn channels(mut self, channels: impl Into<String>) -> Self {
self.channels = Some(channels.into());
self
}
pub fn initial_comment(mut self, initial_comment: impl Into<String>) -> Self {
self.initial_comment = Some(initial_comment.into());
self
}
pub fn blocks(mut self, blocks: Vec<crate::blocks::Block>) -> Self {
self.blocks = Some(blocks);
self
}
pub fn username(mut self, username: impl Into<String>) -> Self {
self.username = Some(username.into());
self
}
pub fn icon_url(mut self, icon_url: impl Into<String>) -> Self {
self.icon_url = Some(icon_url.into());
self
}
pub fn icon_emoji(mut self, icon_emoji: impl Into<String>) -> Self {
self.icon_emoji = Some(icon_emoji.into());
self
}
}
impl SlackApiMethod for FilesCompleteUploadExternalRequest {
const METHOD: &'static str = "files.completeUploadExternal";
type Response = FilesCompleteUploadExternalResponse;
}
#[doc(alias = "files.completeUploadExternal")]
#[derive(Debug, Clone, Default, PartialEq, Serialize, Deserialize)]
pub struct FilesCompleteUploadExternalResponse {
#[serde(
default,
deserialize_with = "crate::de::vec",
skip_serializing_if = "Vec::is_empty"
)]
pub files: Vec<FilesCompleteUploadExternalResponseFiles>,
#[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>,
}
#[derive(Debug, Clone, Default, PartialEq, Serialize, Deserialize)]
pub struct FilesCompleteUploadExternalResponseFiles {
#[serde(
default,
deserialize_with = "crate::de::opt_string",
skip_serializing_if = "Option::is_none"
)]
pub id: Option<String>,
#[serde(
default,
deserialize_with = "crate::de::opt_string",
skip_serializing_if = "Option::is_none"
)]
pub title: Option<String>,
}
#[doc(alias = "files.delete")]
#[derive(Debug, Clone, PartialEq, Serialize)]
#[non_exhaustive]
pub struct FilesDeleteRequest {
pub file: String,
}
impl FilesDeleteRequest {
pub fn new(file: impl Into<String>) -> Self {
Self { file: file.into() }
}
}
impl SlackApiMethod for FilesDeleteRequest {
const METHOD: &'static str = "files.delete";
type Response = FilesDeleteResponse;
}
#[doc(alias = "files.delete")]
#[derive(Debug, Clone, Default, PartialEq, Serialize, Deserialize)]
pub struct FilesDeleteResponse {
#[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 = "files.getUploadURLExternal")]
#[derive(Debug, Clone, PartialEq, Serialize)]
#[non_exhaustive]
pub struct FilesGetUploadUrlExternalRequest {
pub length: i64,
pub filename: String,
#[serde(skip_serializing_if = "Option::is_none")]
pub snippet_type: Option<String>,
#[serde(skip_serializing_if = "Option::is_none")]
pub alt_txt: Option<String>,
}
impl FilesGetUploadUrlExternalRequest {
pub fn new(length: i64, filename: impl Into<String>) -> Self {
Self {
length,
filename: filename.into(),
snippet_type: None,
alt_txt: None,
}
}
pub fn snippet_type(mut self, snippet_type: impl Into<String>) -> Self {
self.snippet_type = Some(snippet_type.into());
self
}
pub fn alt_txt(mut self, alt_txt: impl Into<String>) -> Self {
self.alt_txt = Some(alt_txt.into());
self
}
}
impl SlackApiMethod for FilesGetUploadUrlExternalRequest {
const METHOD: &'static str = "files.getUploadURLExternal";
type Response = FilesGetUploadUrlExternalResponse;
}
#[doc(alias = "files.getUploadURLExternal")]
#[derive(Debug, Clone, Default, PartialEq, Serialize, Deserialize)]
pub struct FilesGetUploadUrlExternalResponse {
#[serde(
default,
deserialize_with = "crate::de::opt_string",
skip_serializing_if = "Option::is_none"
)]
pub upload_url: Option<String>,
#[serde(
default,
deserialize_with = "crate::de::opt_string",
skip_serializing_if = "Option::is_none"
)]
pub file_id: Option<String>,
#[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 = "files.info")]
#[derive(Debug, Clone, PartialEq, Serialize)]
#[non_exhaustive]
pub struct FilesInfoRequest {
pub file: String,
#[serde(skip_serializing_if = "Option::is_none")]
pub count: Option<i64>,
#[serde(skip_serializing_if = "Option::is_none")]
pub cursor: Option<String>,
#[serde(skip_serializing_if = "Option::is_none")]
pub limit: Option<i64>,
#[serde(skip_serializing_if = "Option::is_none")]
pub page: Option<i64>,
}
impl FilesInfoRequest {
pub fn new(file: impl Into<String>) -> Self {
Self {
file: file.into(),
count: None,
cursor: None,
limit: None,
page: None,
}
}
pub fn count(mut self, count: i64) -> Self {
self.count = Some(count);
self
}
pub fn cursor(mut self, cursor: impl Into<String>) -> Self {
self.cursor = Some(cursor.into());
self
}
pub fn limit(mut self, limit: i64) -> Self {
self.limit = Some(limit);
self
}
pub fn page(mut self, page: i64) -> Self {
self.page = Some(page);
self
}
}
impl SlackApiMethod for FilesInfoRequest {
const METHOD: &'static str = "files.info";
type Response = FilesInfoResponse;
}
impl CursorPaginated for FilesInfoRequest {
fn set_cursor(&mut self, cursor: String) {
self.cursor = Some(cursor);
}
}
impl NextCursor for FilesInfoResponse {
fn next_cursor(&self) -> Option<&str> {
self.response_metadata.as_ref()?.next_cursor.as_deref()
}
}
#[doc(alias = "files.info")]
#[derive(Debug, Clone, Default, PartialEq, Serialize, Deserialize)]
pub struct FilesInfoResponse {
#[serde(
default,
deserialize_with = "crate::de::opt_object",
skip_serializing_if = "Option::is_none"
)]
pub file: Option<File>,
#[serde(
default,
deserialize_with = "crate::de::vec",
skip_serializing_if = "Vec::is_empty"
)]
pub comments: Vec<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 = "files.list")]
#[derive(Debug, Clone, PartialEq, Serialize, Default)]
#[non_exhaustive]
pub struct FilesListRequest {
#[serde(skip_serializing_if = "Option::is_none")]
pub channel: Option<String>,
#[serde(skip_serializing_if = "Option::is_none")]
pub count: Option<i64>,
#[serde(skip_serializing_if = "Option::is_none")]
pub page: Option<i64>,
#[serde(skip_serializing_if = "Option::is_none")]
pub show_files_hidden_by_limit: Option<bool>,
#[serde(skip_serializing_if = "Option::is_none")]
pub team_id: Option<String>,
#[serde(skip_serializing_if = "Option::is_none")]
pub ts_from: Option<String>,
#[serde(skip_serializing_if = "Option::is_none")]
pub ts_to: Option<String>,
#[serde(skip_serializing_if = "Option::is_none")]
pub types: Option<String>,
#[serde(skip_serializing_if = "Option::is_none")]
pub user: Option<String>,
}
impl FilesListRequest {
pub fn new() -> Self {
Self {
channel: None,
count: None,
page: None,
show_files_hidden_by_limit: None,
team_id: None,
ts_from: None,
ts_to: None,
types: None,
user: None,
}
}
pub fn channel(mut self, channel: impl Into<String>) -> Self {
self.channel = Some(channel.into());
self
}
pub fn count(mut self, count: i64) -> Self {
self.count = Some(count);
self
}
pub fn page(mut self, page: i64) -> Self {
self.page = Some(page);
self
}
pub fn show_files_hidden_by_limit(mut self, show_files_hidden_by_limit: bool) -> Self {
self.show_files_hidden_by_limit = Some(show_files_hidden_by_limit);
self
}
pub fn team_id(mut self, team_id: impl Into<String>) -> Self {
self.team_id = Some(team_id.into());
self
}
pub fn ts_from(mut self, ts_from: impl Into<String>) -> Self {
self.ts_from = Some(ts_from.into());
self
}
pub fn ts_to(mut self, ts_to: impl Into<String>) -> Self {
self.ts_to = Some(ts_to.into());
self
}
pub fn types(mut self, types: impl Into<String>) -> Self {
self.types = Some(types.into());
self
}
pub fn user(mut self, user: impl Into<String>) -> Self {
self.user = Some(user.into());
self
}
}
impl SlackApiMethod for FilesListRequest {
const METHOD: &'static str = "files.list";
type Response = FilesListResponse;
}
#[doc(alias = "files.list")]
#[derive(Debug, Clone, Default, PartialEq, Serialize, Deserialize)]
pub struct FilesListResponse {
#[serde(
default,
deserialize_with = "crate::de::vec",
skip_serializing_if = "Vec::is_empty"
)]
pub files: Vec<File>,
#[serde(
default,
deserialize_with = "crate::de::opt_object",
skip_serializing_if = "Option::is_none"
)]
pub paging: Option<FilesListResponsePaging>,
#[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>,
}
#[derive(Debug, Clone, Default, PartialEq, Serialize, Deserialize)]
pub struct FilesListResponsePaging {
#[serde(
default,
deserialize_with = "crate::de::opt_i64",
skip_serializing_if = "Option::is_none"
)]
pub count: Option<i64>,
#[serde(
default,
deserialize_with = "crate::de::opt_i64",
skip_serializing_if = "Option::is_none"
)]
pub total: Option<i64>,
#[serde(
default,
deserialize_with = "crate::de::opt_i64",
skip_serializing_if = "Option::is_none"
)]
pub page: Option<i64>,
#[serde(
default,
deserialize_with = "crate::de::opt_i64",
skip_serializing_if = "Option::is_none"
)]
pub pages: Option<i64>,
}
#[doc(alias = "files.remote.add")]
#[derive(Debug, Clone, PartialEq, Serialize)]
#[non_exhaustive]
pub struct FilesRemoteAddRequest {
pub external_id: String,
pub external_url: String,
pub title: String,
#[serde(skip_serializing_if = "Option::is_none")]
pub filetype: Option<String>,
#[serde(skip_serializing_if = "Option::is_none")]
pub indexable_file_contents: Option<String>,
#[serde(skip_serializing_if = "Option::is_none")]
pub preview_image: Option<String>,
}
impl FilesRemoteAddRequest {
pub fn new(
external_id: impl Into<String>,
external_url: impl Into<String>,
title: impl Into<String>,
) -> Self {
Self {
external_id: external_id.into(),
external_url: external_url.into(),
title: title.into(),
filetype: None,
indexable_file_contents: None,
preview_image: None,
}
}
pub fn filetype(mut self, filetype: impl Into<String>) -> Self {
self.filetype = Some(filetype.into());
self
}
pub fn indexable_file_contents(mut self, indexable_file_contents: impl Into<String>) -> Self {
self.indexable_file_contents = Some(indexable_file_contents.into());
self
}
pub fn preview_image(mut self, preview_image: impl Into<String>) -> Self {
self.preview_image = Some(preview_image.into());
self
}
}
impl SlackApiMethod for FilesRemoteAddRequest {
const METHOD: &'static str = "files.remote.add";
type Response = FilesRemoteAddResponse;
}
#[doc(alias = "files.remote.add")]
#[derive(Debug, Clone, Default, PartialEq, Serialize, Deserialize)]
pub struct FilesRemoteAddResponse {
#[serde(
default,
deserialize_with = "crate::de::opt_object",
skip_serializing_if = "Option::is_none"
)]
pub file: Option<File>,
#[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 = "files.remote.info")]
#[derive(Debug, Clone, PartialEq, Serialize, Default)]
#[non_exhaustive]
pub struct FilesRemoteInfoRequest {
#[serde(skip_serializing_if = "Option::is_none")]
pub external_id: Option<String>,
#[serde(skip_serializing_if = "Option::is_none")]
pub file: Option<String>,
}
impl FilesRemoteInfoRequest {
pub fn new() -> Self {
Self {
external_id: None,
file: None,
}
}
pub fn external_id(mut self, external_id: impl Into<String>) -> Self {
self.external_id = Some(external_id.into());
self
}
pub fn file(mut self, file: impl Into<String>) -> Self {
self.file = Some(file.into());
self
}
}
impl SlackApiMethod for FilesRemoteInfoRequest {
const METHOD: &'static str = "files.remote.info";
type Response = FilesRemoteInfoResponse;
}
#[doc(alias = "files.remote.info")]
#[derive(Debug, Clone, Default, PartialEq, Serialize, Deserialize)]
pub struct FilesRemoteInfoResponse {
#[serde(
default,
deserialize_with = "crate::de::opt_object",
skip_serializing_if = "Option::is_none"
)]
pub file: Option<File>,
#[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 = "files.remote.list")]
#[derive(Debug, Clone, PartialEq, Serialize, Default)]
#[non_exhaustive]
pub struct FilesRemoteListRequest {
#[serde(skip_serializing_if = "Option::is_none")]
pub channel: Option<String>,
#[serde(skip_serializing_if = "Option::is_none")]
pub cursor: Option<String>,
#[serde(skip_serializing_if = "Option::is_none")]
pub limit: Option<i64>,
#[serde(skip_serializing_if = "Option::is_none")]
pub ts_from: Option<String>,
#[serde(skip_serializing_if = "Option::is_none")]
pub ts_to: Option<String>,
}
impl FilesRemoteListRequest {
pub fn new() -> Self {
Self {
channel: None,
cursor: None,
limit: None,
ts_from: None,
ts_to: None,
}
}
pub fn channel(mut self, channel: impl Into<String>) -> Self {
self.channel = Some(channel.into());
self
}
pub fn cursor(mut self, cursor: impl Into<String>) -> Self {
self.cursor = Some(cursor.into());
self
}
pub fn limit(mut self, limit: i64) -> Self {
self.limit = Some(limit);
self
}
pub fn ts_from(mut self, ts_from: impl Into<String>) -> Self {
self.ts_from = Some(ts_from.into());
self
}
pub fn ts_to(mut self, ts_to: impl Into<String>) -> Self {
self.ts_to = Some(ts_to.into());
self
}
}
impl SlackApiMethod for FilesRemoteListRequest {
const METHOD: &'static str = "files.remote.list";
type Response = FilesRemoteListResponse;
}
impl CursorPaginated for FilesRemoteListRequest {
fn set_cursor(&mut self, cursor: String) {
self.cursor = Some(cursor);
}
}
impl NextCursor for FilesRemoteListResponse {
fn next_cursor(&self) -> Option<&str> {
self.response_metadata.as_ref()?.next_cursor.as_deref()
}
}
#[doc(alias = "files.remote.list")]
#[derive(Debug, Clone, Default, PartialEq, Serialize, Deserialize)]
pub struct FilesRemoteListResponse {
#[serde(
default,
deserialize_with = "crate::de::vec",
skip_serializing_if = "Vec::is_empty"
)]
pub files: Vec<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 = "files.remote.remove")]
#[derive(Debug, Clone, PartialEq, Serialize, Default)]
#[non_exhaustive]
pub struct FilesRemoteRemoveRequest {
#[serde(skip_serializing_if = "Option::is_none")]
pub external_id: Option<String>,
#[serde(skip_serializing_if = "Option::is_none")]
pub file: Option<String>,
}
impl FilesRemoteRemoveRequest {
pub fn new() -> Self {
Self {
external_id: None,
file: None,
}
}
pub fn external_id(mut self, external_id: impl Into<String>) -> Self {
self.external_id = Some(external_id.into());
self
}
pub fn file(mut self, file: impl Into<String>) -> Self {
self.file = Some(file.into());
self
}
}
impl SlackApiMethod for FilesRemoteRemoveRequest {
const METHOD: &'static str = "files.remote.remove";
type Response = FilesRemoteRemoveResponse;
}
#[doc(alias = "files.remote.remove")]
#[derive(Debug, Clone, Default, PartialEq, Serialize, Deserialize)]
pub struct FilesRemoteRemoveResponse {
#[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 = "files.remote.share")]
#[derive(Debug, Clone, PartialEq, Serialize)]
#[non_exhaustive]
pub struct FilesRemoteShareRequest {
pub channels: String,
#[serde(skip_serializing_if = "Option::is_none")]
pub external_id: Option<String>,
#[serde(skip_serializing_if = "Option::is_none")]
pub file: Option<String>,
}
impl FilesRemoteShareRequest {
pub fn new(channels: impl Into<String>) -> Self {
Self {
channels: channels.into(),
external_id: None,
file: None,
}
}
pub fn external_id(mut self, external_id: impl Into<String>) -> Self {
self.external_id = Some(external_id.into());
self
}
pub fn file(mut self, file: impl Into<String>) -> Self {
self.file = Some(file.into());
self
}
}
impl SlackApiMethod for FilesRemoteShareRequest {
const METHOD: &'static str = "files.remote.share";
type Response = FilesRemoteShareResponse;
}
#[doc(alias = "files.remote.share")]
#[derive(Debug, Clone, Default, PartialEq, Serialize, Deserialize)]
pub struct FilesRemoteShareResponse {
#[serde(
default,
deserialize_with = "crate::de::opt_object",
skip_serializing_if = "Option::is_none"
)]
pub file: Option<File>,
#[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 = "files.remote.update")]
#[derive(Debug, Clone, PartialEq, Serialize, Default)]
#[non_exhaustive]
pub struct FilesRemoteUpdateRequest {
#[serde(skip_serializing_if = "Option::is_none")]
pub external_id: Option<String>,
#[serde(skip_serializing_if = "Option::is_none")]
pub external_url: Option<String>,
#[serde(skip_serializing_if = "Option::is_none")]
pub file: Option<String>,
#[serde(skip_serializing_if = "Option::is_none")]
pub filetype: Option<String>,
#[serde(skip_serializing_if = "Option::is_none")]
pub indexable_file_contents: Option<String>,
#[serde(skip_serializing_if = "Option::is_none")]
pub preview_image: Option<String>,
#[serde(skip_serializing_if = "Option::is_none")]
pub title: Option<String>,
}
impl FilesRemoteUpdateRequest {
pub fn new() -> Self {
Self {
external_id: None,
external_url: None,
file: None,
filetype: None,
indexable_file_contents: None,
preview_image: None,
title: None,
}
}
pub fn external_id(mut self, external_id: impl Into<String>) -> Self {
self.external_id = Some(external_id.into());
self
}
pub fn external_url(mut self, external_url: impl Into<String>) -> Self {
self.external_url = Some(external_url.into());
self
}
pub fn file(mut self, file: impl Into<String>) -> Self {
self.file = Some(file.into());
self
}
pub fn filetype(mut self, filetype: impl Into<String>) -> Self {
self.filetype = Some(filetype.into());
self
}
pub fn indexable_file_contents(mut self, indexable_file_contents: impl Into<String>) -> Self {
self.indexable_file_contents = Some(indexable_file_contents.into());
self
}
pub fn preview_image(mut self, preview_image: impl Into<String>) -> Self {
self.preview_image = Some(preview_image.into());
self
}
pub fn title(mut self, title: impl Into<String>) -> Self {
self.title = Some(title.into());
self
}
}
impl SlackApiMethod for FilesRemoteUpdateRequest {
const METHOD: &'static str = "files.remote.update";
type Response = FilesRemoteUpdateResponse;
}
#[doc(alias = "files.remote.update")]
#[derive(Debug, Clone, Default, PartialEq, Serialize, Deserialize)]
pub struct FilesRemoteUpdateResponse {
#[serde(
default,
deserialize_with = "crate::de::opt_object",
skip_serializing_if = "Option::is_none"
)]
pub file: Option<File>,
#[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 = "files.revokePublicURL")]
#[derive(Debug, Clone, PartialEq, Serialize)]
#[non_exhaustive]
pub struct FilesRevokePublicUrlRequest {
pub file: String,
}
impl FilesRevokePublicUrlRequest {
pub fn new(file: impl Into<String>) -> Self {
Self { file: file.into() }
}
}
impl SlackApiMethod for FilesRevokePublicUrlRequest {
const METHOD: &'static str = "files.revokePublicURL";
type Response = FilesRevokePublicUrlResponse;
}
#[doc(alias = "files.revokePublicURL")]
#[derive(Debug, Clone, Default, PartialEq, Serialize, Deserialize)]
pub struct FilesRevokePublicUrlResponse {
#[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 = "files.sharedPublicURL")]
#[derive(Debug, Clone, PartialEq, Serialize)]
#[non_exhaustive]
pub struct FilesSharedPublicUrlRequest {
pub file: String,
}
impl FilesSharedPublicUrlRequest {
pub fn new(file: impl Into<String>) -> Self {
Self { file: file.into() }
}
}
impl SlackApiMethod for FilesSharedPublicUrlRequest {
const METHOD: &'static str = "files.sharedPublicURL";
type Response = FilesSharedPublicUrlResponse;
}
#[doc(alias = "files.sharedPublicURL")]
#[derive(Debug, Clone, Default, PartialEq, Serialize, Deserialize)]
pub struct FilesSharedPublicUrlResponse {
#[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>,
}
impl SlackClient {
#[doc(alias = "files.comments.delete")]
pub async fn files_comments_delete(
&self,
request: &FilesCommentsDeleteRequest,
) -> Result<FilesCommentsDeleteResponse, SlackError> {
self.call(request).await
}
#[doc(alias = "files.completeUploadExternal")]
pub async fn files_complete_upload_external(
&self,
request: &FilesCompleteUploadExternalRequest,
) -> Result<FilesCompleteUploadExternalResponse, SlackError> {
self.call(request).await
}
#[doc(alias = "files.delete")]
pub async fn files_delete(
&self,
request: &FilesDeleteRequest,
) -> Result<FilesDeleteResponse, SlackError> {
self.call(request).await
}
#[doc(alias = "files.getUploadURLExternal")]
pub async fn files_get_upload_url_external(
&self,
request: &FilesGetUploadUrlExternalRequest,
) -> Result<FilesGetUploadUrlExternalResponse, SlackError> {
self.call(request).await
}
#[doc(alias = "files.info")]
pub async fn files_info(
&self,
request: &FilesInfoRequest,
) -> Result<FilesInfoResponse, SlackError> {
self.call(request).await
}
#[doc(alias = "files.list")]
pub async fn files_list(
&self,
request: &FilesListRequest,
) -> Result<FilesListResponse, SlackError> {
self.call(request).await
}
#[doc(alias = "files.remote.add")]
pub async fn files_remote_add(
&self,
request: &FilesRemoteAddRequest,
) -> Result<FilesRemoteAddResponse, SlackError> {
self.call(request).await
}
#[doc(alias = "files.remote.info")]
pub async fn files_remote_info(
&self,
request: &FilesRemoteInfoRequest,
) -> Result<FilesRemoteInfoResponse, SlackError> {
self.call(request).await
}
#[doc(alias = "files.remote.list")]
pub async fn files_remote_list(
&self,
request: &FilesRemoteListRequest,
) -> Result<FilesRemoteListResponse, SlackError> {
self.call(request).await
}
#[doc(alias = "files.remote.remove")]
pub async fn files_remote_remove(
&self,
request: &FilesRemoteRemoveRequest,
) -> Result<FilesRemoteRemoveResponse, SlackError> {
self.call(request).await
}
#[doc(alias = "files.remote.share")]
pub async fn files_remote_share(
&self,
request: &FilesRemoteShareRequest,
) -> Result<FilesRemoteShareResponse, SlackError> {
self.call(request).await
}
#[doc(alias = "files.remote.update")]
pub async fn files_remote_update(
&self,
request: &FilesRemoteUpdateRequest,
) -> Result<FilesRemoteUpdateResponse, SlackError> {
self.call(request).await
}
#[doc(alias = "files.revokePublicURL")]
pub async fn files_revoke_public_url(
&self,
request: &FilesRevokePublicUrlRequest,
) -> Result<FilesRevokePublicUrlResponse, SlackError> {
self.call(request).await
}
#[doc(alias = "files.sharedPublicURL")]
pub async fn files_shared_public_url(
&self,
request: &FilesSharedPublicUrlRequest,
) -> Result<FilesSharedPublicUrlResponse, SlackError> {
self.call(request).await
}
}