sfr_types/response/
files_upload.rs

1//! The type that represents a response of `files.upload`.
2//!
3//! <https://api.slack.com/methods/files.upload>
4
5use crate::generated::files_upload::FilesUploadResponse as Generated;
6use crate::Error;
7use serde::Deserialize;
8
9/// The type that represents a response of `files.upload`.
10///
11/// <https://api.slack.com/methods/files.upload>
12#[derive(Debug, Deserialize)]
13pub struct FilesUploadResponse(Generated);
14
15impl FilesUploadResponse {
16    /// Converts to generated type.
17    pub fn into_inner(self) -> Generated {
18        self.0
19    }
20
21    /// Takes `ok`.
22    pub fn ok(&self) -> Option<bool> {
23        self.0.ok
24    }
25}
26
27impl TryFrom<serde_json::Value> for FilesUploadResponse {
28    type Error = Error;
29
30    fn try_from(value: serde_json::Value) -> Result<Self, Self::Error> {
31        serde_json::from_value(value).map_err(Error::DeserializeJson)
32    }
33}