//! The type that represents a response of `files.remote.add`.
//!
//! <https://api.slack.com/methods/files.remote.add>

use crate::generated::files_remote_add::FilesRemoteAddResponse as Generated;
use crate::Error;
use serde::Deserialize;

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

impl FilesRemoteAddResponse {
    /// 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 FilesRemoteAddResponse {
    type Error = Error;

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