gitea_client/models/
create_file_options.rs

1/*
2 * Gitea API
3 *
4 * This documentation describes the Gitea API.
5 *
6 * The version of the OpenAPI document: 1.22.1
7 * 
8 * Generated by: https://openapi-generator.tech
9 */
10
11use crate::models;
12use serde::{Deserialize, Serialize};
13
14/// CreateFileOptions : CreateFileOptions options for creating files Note: `author` and `committer` are optional (if only one is given, it will be used for the other, otherwise the authenticated user will be used)
15#[derive(Clone, Default, Debug, PartialEq, Serialize, Deserialize)]
16pub struct CreateFileOptions {
17    #[serde(rename = "author", skip_serializing_if = "Option::is_none")]
18    pub author: Option<Box<models::Identity>>,
19    /// branch (optional) to base this file from. if not given, the default branch is used
20    #[serde(rename = "branch", skip_serializing_if = "Option::is_none")]
21    pub branch: Option<String>,
22    #[serde(rename = "committer", skip_serializing_if = "Option::is_none")]
23    pub committer: Option<Box<models::Identity>>,
24    /// content must be base64 encoded
25    #[serde(rename = "content")]
26    pub content: String,
27    #[serde(rename = "dates", skip_serializing_if = "Option::is_none")]
28    pub dates: Option<Box<models::CommitDateOptions>>,
29    /// message (optional) for the commit of this file. if not supplied, a default message will be used
30    #[serde(rename = "message", skip_serializing_if = "Option::is_none")]
31    pub message: Option<String>,
32    /// new_branch (optional) will make a new branch from `branch` before creating the file
33    #[serde(rename = "new_branch", skip_serializing_if = "Option::is_none")]
34    pub new_branch: Option<String>,
35    /// Add a Signed-off-by trailer by the committer at the end of the commit log message.
36    #[serde(rename = "signoff", skip_serializing_if = "Option::is_none")]
37    pub signoff: Option<bool>,
38}
39
40impl CreateFileOptions {
41    /// CreateFileOptions options for creating files Note: `author` and `committer` are optional (if only one is given, it will be used for the other, otherwise the authenticated user will be used)
42    pub fn new(content: String) -> CreateFileOptions {
43        CreateFileOptions {
44            author: None,
45            branch: None,
46            committer: None,
47            content,
48            dates: None,
49            message: None,
50            new_branch: None,
51            signoff: None,
52        }
53    }
54}
55