openapi_github/models/git_create_tree_request.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 GitCreateTreeRequest {
16 /// Objects (of `path`, `mode`, `type`, and `sha`) specifying a tree structure.
17 #[serde(rename = "tree")]
18 pub tree: Vec<models::GitCreateTreeRequestTreeInner>,
19 /// The SHA1 of an existing Git tree object which will be used as the base for the new tree. If provided, a new Git tree object will be created from entries in the Git tree object pointed to by `base_tree` and entries defined in the `tree` parameter. Entries defined in the `tree` parameter will overwrite items from `base_tree` with the same `path`. If you're creating new changes on a branch, then normally you'd set `base_tree` to the SHA1 of the Git tree object of the current latest commit on the branch you're working on. If not provided, GitHub will create a new Git tree object from only the entries defined in the `tree` parameter. If you create a new commit pointing to such a tree, then all files which were a part of the parent commit's tree and were not defined in the `tree` parameter will be listed as deleted by the new commit.
20 #[serde(rename = "base_tree", skip_serializing_if = "Option::is_none")]
21 pub base_tree: Option<String>,
22}
23
24impl GitCreateTreeRequest {
25 pub fn new(tree: Vec<models::GitCreateTreeRequestTreeInner>) -> GitCreateTreeRequest {
26 GitCreateTreeRequest {
27 tree,
28 base_tree: None,
29 }
30 }
31}
32