/*
* Zernio API
*
* API reference for Zernio. Authenticate with a Bearer API key. Base URL: https://zernio.com/api Versioning and deprecation: all endpoints are versioned in the URL path (current version: /v1). Breaking changes only ship in a new path version; existing versions keep working. Deprecated operations are marked 'deprecated: true' in this spec and announced in the changelog (https://zernio.com/changelog) before removal. Errors: every 4xx/5xx response is application/json with a machine-readable 'code' and a human-readable 'error' message (see the ErrorResponse schema). Request ids: responses carry an X-Request-Id header with the id we log the request under. Quote it when reporting a problem. A valid x-request-id you send is reused as that id.
*
* The version of the OpenAPI document: 1.605.0
* Contact: support@zernio.com
* Generated by: https://openapi-generator.tech
*/
use crate::models;
use serde::{Deserialize, Serialize};
/// FileItem : A file or folder in a connected Google Drive or OneDrive. Ids are the provider's own.
#[derive(Clone, Default, Debug, PartialEq, Serialize, Deserialize)]
pub struct FileItem {
#[serde(rename = "id")]
pub id: String,
#[serde(rename = "accountId")]
pub account_id: String,
#[serde(rename = "provider")]
pub provider: Provider,
#[serde(rename = "name")]
pub name: String,
#[serde(rename = "kind")]
pub kind: Kind,
#[serde(rename = "mimeType", deserialize_with = "Option::deserialize")]
pub mime_type: Option<String>,
/// Bytes; null for folders and Google editors files.
#[serde(rename = "size", deserialize_with = "Option::deserialize")]
pub size: Option<i32>,
#[serde(rename = "parentId", deserialize_with = "Option::deserialize")]
pub parent_id: Option<String>,
/// The provider's own link to open the item.
#[serde(rename = "webUrl", deserialize_with = "Option::deserialize")]
pub web_url: Option<String>,
/// False for folders and for Drive files whose owner disabled downloading.
#[serde(rename = "downloadable")]
pub downloadable: bool,
/// Google Docs, Slides and Drawings download as PDF/PNG and Sheets as XLSX; this is the type the download carries.
#[serde(
rename = "exportMimeType",
default,
with = "::serde_with::rust::double_option",
skip_serializing_if = "Option::is_none"
)]
pub export_mime_type: Option<Option<String>>,
#[serde(rename = "createdAt", deserialize_with = "Option::deserialize")]
pub created_at: Option<String>,
#[serde(rename = "modifiedAt", deserialize_with = "Option::deserialize")]
pub modified_at: Option<String>,
#[serde(rename = "trashed")]
pub trashed: bool,
}
impl FileItem {
/// A file or folder in a connected Google Drive or OneDrive. Ids are the provider's own.
pub fn new(
id: String,
account_id: String,
provider: Provider,
name: String,
kind: Kind,
mime_type: Option<String>,
size: Option<i32>,
parent_id: Option<String>,
web_url: Option<String>,
downloadable: bool,
created_at: Option<String>,
modified_at: Option<String>,
trashed: bool,
) -> FileItem {
FileItem {
id,
account_id,
provider,
name,
kind,
mime_type,
size,
parent_id,
web_url,
downloadable,
export_mime_type: None,
created_at,
modified_at,
trashed,
}
}
}
///
#[derive(Clone, Copy, Debug, Eq, PartialEq, Ord, PartialOrd, Hash, Serialize, Deserialize)]
pub enum Provider {
#[serde(rename = "google")]
Google,
#[serde(rename = "microsoft")]
Microsoft,
}
impl Default for Provider {
fn default() -> Provider {
Self::Google
}
}
///
#[derive(Clone, Copy, Debug, Eq, PartialEq, Ord, PartialOrd, Hash, Serialize, Deserialize)]
pub enum Kind {
#[serde(rename = "file")]
File,
#[serde(rename = "folder")]
Folder,
}
impl Default for Kind {
fn default() -> Kind {
Self::File
}
}