sfr-types 0.1.2

The crate has shared types in `slack-framework-rs`.
Documentation
//! The type that represents a response of `files.upload`.
//!
//! <https://api.slack.com/methods/files.upload>

use crate::generated::files_upload::FilesUploadResponse as Generated;
use crate::Error;
use serde::Deserialize;

/// The type that represents a response of `files.upload`.
///
/// <https://api.slack.com/methods/files.upload>
#[derive(Debug, Deserialize)]
pub struct FilesUploadResponse(Generated);

impl FilesUploadResponse {
    /// Converts to generated type.
    pub fn into_inner(self) -> Generated {
        self.0
    }

    /// Takes `ok`.
    pub fn ok(&self) -> Option<bool> {
        self.0.ok
    }
}

impl TryFrom<serde_json::Value> for FilesUploadResponse {
    type Error = Error;

    fn try_from(value: serde_json::Value) -> Result<Self, Self::Error> {
        serde_json::from_value(value).map_err(Error::DeserializeJson)
    }
}