1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65
//! The builder for [`FilesCompleteUploadExternal`].
use sfr_types as st;
use crate::api::files_complete_upload_external::FilesCompleteUploadExternal;
/// The builder for [`FilesCompleteUploadExternal`].
#[derive(Debug, Default)]
pub struct FilesCompleteUploadExternalBuilder {
/// The [`files`][`st::FilesCompleteUploadExternalRequest::files`].
files: Vec<st::FilesCompleteUploadExternalRequestFile>,
/// The [`channel_id`][`st::FilesCompleteUploadExternalRequest::channel_id`].
channel_id: Option<String>,
/// The [`initial_comment`][`st::FilesCompleteUploadExternalRequest::initial_comment`].
initial_comment: Option<String>,
/// The [`thread_ts`][`st::FilesCompleteUploadExternalRequest::thread_ts`].
thread_ts: Option<String>,
}
impl FilesCompleteUploadExternalBuilder {
/// The constructor.
pub fn new() -> Self {
Self::default()
}
/// Builds [`FilesCompleteUploadExternal`].
pub fn build(self) -> FilesCompleteUploadExternal {
let result = st::FilesCompleteUploadExternalRequest {
files: self.files,
channel_id: self.channel_id,
initial_comment: self.initial_comment,
thread_ts: self.thread_ts,
};
result.into()
}
/// Adds [`st::FilesCompleteUploadExternalRequestFile`] element to [`files`][`st::FilesCompleteUploadExternalRequest::files`].
pub fn add_file(mut self, id: String, title: Option<String>) -> Self {
self.files
.push(st::FilesCompleteUploadExternalRequestFile { id, title });
self
}
/// Sets [`channel_id`][`st::FilesCompleteUploadExternalRequest::channel_id`].
pub fn channel_id(mut self, channel_id: Option<String>) -> Self {
self.channel_id = channel_id;
self
}
/// Sets [`initial_comment`][`st::FilesCompleteUploadExternalRequest::initial_comment`].
pub fn initial_comment(mut self, initial_comment: Option<String>) -> Self {
self.initial_comment = initial_comment;
self
}
/// Sets [`thread_ts`][`st::FilesCompleteUploadExternalRequest::thread_ts`].
pub fn thread_ts(mut self, thread_ts: Option<String>) -> Self {
self.thread_ts = thread_ts;
self
}
}