openapi_github/models/
git_create_tree_request_tree_inner.rs

1/*
2 * GitHub's official OpenAPI spec + Octokit extension
3 *
4 * OpenAPI specs from https://github.com/github/rest-api-description with the 'x-octokit' extension required by the Octokit SDKs
5 *
6 * The version of the OpenAPI document: 16.6.0
7 * 
8 * Generated by: https://openapi-generator.tech
9 */
10
11use crate::models;
12use serde::{Deserialize, Serialize};
13
14#[derive(Clone, Default, Debug, PartialEq, Serialize, Deserialize)]
15pub struct GitCreateTreeRequestTreeInner {
16    /// The file referenced in the tree.
17    #[serde(rename = "path", skip_serializing_if = "Option::is_none")]
18    pub path: Option<String>,
19    /// The file mode; one of `100644` for file (blob), `100755` for executable (blob), `040000` for subdirectory (tree), `160000` for submodule (commit), or `120000` for a blob that specifies the path of a symlink.
20    #[serde(rename = "mode", skip_serializing_if = "Option::is_none")]
21    pub mode: Option<Mode>,
22    /// Either `blob`, `tree`, or `commit`.
23    #[serde(rename = "type", skip_serializing_if = "Option::is_none")]
24    pub r#type: Option<Type>,
25    /// The SHA1 checksum ID of the object in the tree. Also called `tree.sha`. If the value is `null` then the file will be deleted.      **Note:** Use either `tree.sha` or `content` to specify the contents of the entry. Using both `tree.sha` and `content` will return an error.
26    #[serde(rename = "sha", default, with = "::serde_with::rust::double_option", skip_serializing_if = "Option::is_none")]
27    pub sha: Option<Option<String>>,
28    /// The content you want this file to have. GitHub will write this blob out and use that SHA for this entry. Use either this, or `tree.sha`.      **Note:** Use either `tree.sha` or `content` to specify the contents of the entry. Using both `tree.sha` and `content` will return an error.
29    #[serde(rename = "content", skip_serializing_if = "Option::is_none")]
30    pub content: Option<String>,
31}
32
33impl GitCreateTreeRequestTreeInner {
34    pub fn new() -> GitCreateTreeRequestTreeInner {
35        GitCreateTreeRequestTreeInner {
36            path: None,
37            mode: None,
38            r#type: None,
39            sha: None,
40            content: None,
41        }
42    }
43}
44/// The file mode; one of `100644` for file (blob), `100755` for executable (blob), `040000` for subdirectory (tree), `160000` for submodule (commit), or `120000` for a blob that specifies the path of a symlink.
45#[derive(Clone, Copy, Debug, Eq, PartialEq, Ord, PartialOrd, Hash, Serialize, Deserialize)]
46pub enum Mode {
47    #[serde(rename = "100644")]
48    Variant100644,
49    #[serde(rename = "100755")]
50    Variant100755,
51    #[serde(rename = "040000")]
52    Variant040000,
53    #[serde(rename = "160000")]
54    Variant160000,
55    #[serde(rename = "120000")]
56    Variant120000,
57}
58
59impl Default for Mode {
60    fn default() -> Mode {
61        Self::Variant100644
62    }
63}
64/// Either `blob`, `tree`, or `commit`.
65#[derive(Clone, Copy, Debug, Eq, PartialEq, Ord, PartialOrd, Hash, Serialize, Deserialize)]
66pub enum Type {
67    #[serde(rename = "blob")]
68    Blob,
69    #[serde(rename = "tree")]
70    Tree,
71    #[serde(rename = "commit")]
72    Commit,
73}
74
75impl Default for Type {
76    fn default() -> Type {
77        Self::Blob
78    }
79}
80