rusty_box/rest_api/files/models/
file_scope_object.rs

1/*
2 * Box Platform API
3 *
4 * [Box Platform](https://box.dev) provides functionality to provide access to content stored within [Box](https://box.com). It provides endpoints for basic manipulation of files and folders, management of users within an enterprise, as well as more complex topics such as legal holds and retention policies.
5 *
6 * The version of the OpenAPI document: 2.0.0
7 * Contact: devrel@box.com
8 * Generated by: https://openapi-generator.tech
9 */
10
11use super::file_mini_all_of_file_version::FileMiniAllOfFileVersion;
12
13#[derive(Clone, Debug, PartialEq, Default, Serialize, Deserialize)]
14pub struct FileScopeObject {
15    /// The unique identifier that represent a file.  The ID for any file can be determined by visiting a file in the web application and copying the ID from the URL. For example, for the URL `https://_*.app.box.com/files/123` the `file_id` is `123`.
16    #[serde(rename = "id")]
17    pub id: String,
18    /// The HTTP `etag` of this file. This can be used within some API endpoints in the `If-Match` and `If-None-Match` headers to only perform changes on the file if (no) changes have happened.
19    #[serde(
20        rename = "etag",
21        default,
22        with = "::serde_with::rust::double_option",
23        skip_serializing_if = "Option::is_none"
24    )]
25    pub etag: Option<Option<String>>,
26    /// `file`
27    #[serde(rename = "type")]
28    pub r#type: RHashType,
29    #[serde(rename = "sequence_id", skip_serializing_if = "Option::is_none")]
30    pub sequence_id: Option<Box<String>>,
31    /// The name of the file
32    #[serde(rename = "name", skip_serializing_if = "Option::is_none")]
33    pub name: Option<String>,
34    /// The SHA1 hash of the file. This can be used to compare the contents of a file on Box with a local file.
35    #[serde(rename = "sha1", skip_serializing_if = "Option::is_none")]
36    pub sha1: Option<String>,
37    #[serde(rename = "file_version", skip_serializing_if = "Option::is_none")]
38    pub file_version: Option<Box<FileMiniAllOfFileVersion>>,
39}
40
41impl FileScopeObject {
42    pub fn new(id: String, r#type: RHashType) -> FileScopeObject {
43        FileScopeObject {
44            id,
45            etag: None,
46            r#type,
47            sequence_id: None,
48            name: None,
49            sha1: None,
50            file_version: None,
51        }
52    }
53}
54
55/// `file`
56#[derive(Clone, Copy, Debug, Eq, PartialEq, Ord, PartialOrd, Hash, Serialize, Deserialize)]
57pub enum RHashType {
58    #[serde(rename = "file")]
59    File,
60}
61
62impl Default for RHashType {
63    fn default() -> RHashType {
64        Self::File
65    }
66}