openapi_github/apis/
git_api.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
11
12use reqwest;
13use serde::{Deserialize, Serialize};
14use crate::{apis::ResponseContent, models};
15use super::{Error, configuration};
16
17
18/// struct for typed errors of method [`git_slash_create_blob`]
19#[derive(Debug, Clone, Serialize, Deserialize)]
20#[serde(untagged)]
21pub enum GitSlashCreateBlobError {
22    Status403(models::BasicError),
23    Status404(models::BasicError),
24    Status409(models::BasicError),
25    Status422(models::ValidationError),
26    UnknownValue(serde_json::Value),
27}
28
29/// struct for typed errors of method [`git_slash_create_commit`]
30#[derive(Debug, Clone, Serialize, Deserialize)]
31#[serde(untagged)]
32pub enum GitSlashCreateCommitError {
33    Status404(models::BasicError),
34    Status409(models::BasicError),
35    Status422(models::ValidationError),
36    UnknownValue(serde_json::Value),
37}
38
39/// struct for typed errors of method [`git_slash_create_ref`]
40#[derive(Debug, Clone, Serialize, Deserialize)]
41#[serde(untagged)]
42pub enum GitSlashCreateRefError {
43    Status409(models::BasicError),
44    Status422(models::ValidationError),
45    UnknownValue(serde_json::Value),
46}
47
48/// struct for typed errors of method [`git_slash_create_tag`]
49#[derive(Debug, Clone, Serialize, Deserialize)]
50#[serde(untagged)]
51pub enum GitSlashCreateTagError {
52    Status409(models::BasicError),
53    Status422(models::ValidationError),
54    UnknownValue(serde_json::Value),
55}
56
57/// struct for typed errors of method [`git_slash_create_tree`]
58#[derive(Debug, Clone, Serialize, Deserialize)]
59#[serde(untagged)]
60pub enum GitSlashCreateTreeError {
61    Status403(models::BasicError),
62    Status404(models::BasicError),
63    Status409(models::BasicError),
64    Status422(models::ValidationError),
65    UnknownValue(serde_json::Value),
66}
67
68/// struct for typed errors of method [`git_slash_delete_ref`]
69#[derive(Debug, Clone, Serialize, Deserialize)]
70#[serde(untagged)]
71pub enum GitSlashDeleteRefError {
72    Status409(models::BasicError),
73    Status422(models::ValidationError),
74    UnknownValue(serde_json::Value),
75}
76
77/// struct for typed errors of method [`git_slash_get_blob`]
78#[derive(Debug, Clone, Serialize, Deserialize)]
79#[serde(untagged)]
80pub enum GitSlashGetBlobError {
81    Status403(models::BasicError),
82    Status404(models::BasicError),
83    Status409(models::BasicError),
84    Status422(models::ValidationError),
85    UnknownValue(serde_json::Value),
86}
87
88/// struct for typed errors of method [`git_slash_get_commit`]
89#[derive(Debug, Clone, Serialize, Deserialize)]
90#[serde(untagged)]
91pub enum GitSlashGetCommitError {
92    Status404(models::BasicError),
93    Status409(models::BasicError),
94    UnknownValue(serde_json::Value),
95}
96
97/// struct for typed errors of method [`git_slash_get_ref`]
98#[derive(Debug, Clone, Serialize, Deserialize)]
99#[serde(untagged)]
100pub enum GitSlashGetRefError {
101    Status404(models::BasicError),
102    Status409(models::BasicError),
103    UnknownValue(serde_json::Value),
104}
105
106/// struct for typed errors of method [`git_slash_get_tag`]
107#[derive(Debug, Clone, Serialize, Deserialize)]
108#[serde(untagged)]
109pub enum GitSlashGetTagError {
110    Status404(models::BasicError),
111    Status409(models::BasicError),
112    UnknownValue(serde_json::Value),
113}
114
115/// struct for typed errors of method [`git_slash_get_tree`]
116#[derive(Debug, Clone, Serialize, Deserialize)]
117#[serde(untagged)]
118pub enum GitSlashGetTreeError {
119    Status404(models::BasicError),
120    Status409(models::BasicError),
121    Status422(models::ValidationError),
122    UnknownValue(serde_json::Value),
123}
124
125/// struct for typed errors of method [`git_slash_list_matching_refs`]
126#[derive(Debug, Clone, Serialize, Deserialize)]
127#[serde(untagged)]
128pub enum GitSlashListMatchingRefsError {
129    Status409(models::BasicError),
130    UnknownValue(serde_json::Value),
131}
132
133/// struct for typed errors of method [`git_slash_update_ref`]
134#[derive(Debug, Clone, Serialize, Deserialize)]
135#[serde(untagged)]
136pub enum GitSlashUpdateRefError {
137    Status409(models::BasicError),
138    Status422(models::ValidationError),
139    UnknownValue(serde_json::Value),
140}
141
142
143/// 
144pub async fn git_slash_create_blob(configuration: &configuration::Configuration, owner: &str, repo: &str, git_create_blob_request: models::GitCreateBlobRequest) -> Result<models::ShortBlob, Error<GitSlashCreateBlobError>> {
145    let local_var_configuration = configuration;
146
147    let local_var_client = &local_var_configuration.client;
148
149    let local_var_uri_str = format!("{}/repos/{owner}/{repo}/git/blobs", local_var_configuration.base_path, owner=crate::apis::urlencode(owner), repo=crate::apis::urlencode(repo));
150    let mut local_var_req_builder = local_var_client.request(reqwest::Method::POST, local_var_uri_str.as_str());
151
152    if let Some(ref local_var_user_agent) = local_var_configuration.user_agent {
153        local_var_req_builder = local_var_req_builder.header(reqwest::header::USER_AGENT, local_var_user_agent.clone());
154    }
155    local_var_req_builder = local_var_req_builder.json(&git_create_blob_request);
156
157    let local_var_req = local_var_req_builder.build()?;
158    let local_var_resp = local_var_client.execute(local_var_req).await?;
159
160    let local_var_status = local_var_resp.status();
161    let local_var_content = local_var_resp.text().await?;
162
163    if !local_var_status.is_client_error() && !local_var_status.is_server_error() {
164        serde_json::from_str(&local_var_content).map_err(Error::from)
165    } else {
166        let local_var_entity: Option<GitSlashCreateBlobError> = serde_json::from_str(&local_var_content).ok();
167        let local_var_error = ResponseContent { status: local_var_status, content: local_var_content, entity: local_var_entity };
168        Err(Error::ResponseError(local_var_error))
169    }
170}
171
172/// Creates a new Git [commit object](https://git-scm.com/book/en/v2/Git-Internals-Git-Objects).  **Signature verification object**  The response will include a `verification` object that describes the result of verifying the commit's signature. The following fields are included in the `verification` object:  | Name | Type | Description | | ---- | ---- | ----------- | | `verified` | `boolean` | Indicates whether GitHub considers the signature in this commit to be verified. | | `reason` | `string` | The reason for verified value. Possible values and their meanings are enumerated in the table below. | | `signature` | `string` | The signature that was extracted from the commit. | | `payload` | `string` | The value that was signed. |  These are the possible values for `reason` in the `verification` object:  | Value | Description | | ----- | ----------- | | `expired_key` | The key that made the signature is expired. | | `not_signing_key` | The \"signing\" flag is not among the usage flags in the GPG key that made the signature. | | `gpgverify_error` | There was an error communicating with the signature verification service. | | `gpgverify_unavailable` | The signature verification service is currently unavailable. | | `unsigned` | The object does not include a signature. | | `unknown_signature_type` | A non-PGP signature was found in the commit. | | `no_user` | No user was associated with the `committer` email address in the commit. | | `unverified_email` | The `committer` email address in the commit was associated with a user, but the email address is not verified on their account. | | `bad_email` | The `committer` email address in the commit is not included in the identities of the PGP key that made the signature. | | `unknown_key` | The key that made the signature has not been registered with any user's account. | | `malformed_signature` | There was an error parsing the signature. | | `invalid` | The signature could not be cryptographically verified using the key whose key-id was found in the signature. | | `valid` | None of the above errors applied, so the signature is considered to be verified. |
173pub async fn git_slash_create_commit(configuration: &configuration::Configuration, owner: &str, repo: &str, git_create_commit_request: models::GitCreateCommitRequest) -> Result<models::GitCommit, Error<GitSlashCreateCommitError>> {
174    let local_var_configuration = configuration;
175
176    let local_var_client = &local_var_configuration.client;
177
178    let local_var_uri_str = format!("{}/repos/{owner}/{repo}/git/commits", local_var_configuration.base_path, owner=crate::apis::urlencode(owner), repo=crate::apis::urlencode(repo));
179    let mut local_var_req_builder = local_var_client.request(reqwest::Method::POST, local_var_uri_str.as_str());
180
181    if let Some(ref local_var_user_agent) = local_var_configuration.user_agent {
182        local_var_req_builder = local_var_req_builder.header(reqwest::header::USER_AGENT, local_var_user_agent.clone());
183    }
184    local_var_req_builder = local_var_req_builder.json(&git_create_commit_request);
185
186    let local_var_req = local_var_req_builder.build()?;
187    let local_var_resp = local_var_client.execute(local_var_req).await?;
188
189    let local_var_status = local_var_resp.status();
190    let local_var_content = local_var_resp.text().await?;
191
192    if !local_var_status.is_client_error() && !local_var_status.is_server_error() {
193        serde_json::from_str(&local_var_content).map_err(Error::from)
194    } else {
195        let local_var_entity: Option<GitSlashCreateCommitError> = serde_json::from_str(&local_var_content).ok();
196        let local_var_error = ResponseContent { status: local_var_status, content: local_var_content, entity: local_var_entity };
197        Err(Error::ResponseError(local_var_error))
198    }
199}
200
201/// Creates a reference for your repository. You are unable to create new references for empty repositories, even if the commit SHA-1 hash used exists. Empty repositories are repositories without branches.
202pub async fn git_slash_create_ref(configuration: &configuration::Configuration, owner: &str, repo: &str, git_create_ref_request: models::GitCreateRefRequest) -> Result<models::GitRef, Error<GitSlashCreateRefError>> {
203    let local_var_configuration = configuration;
204
205    let local_var_client = &local_var_configuration.client;
206
207    let local_var_uri_str = format!("{}/repos/{owner}/{repo}/git/refs", local_var_configuration.base_path, owner=crate::apis::urlencode(owner), repo=crate::apis::urlencode(repo));
208    let mut local_var_req_builder = local_var_client.request(reqwest::Method::POST, local_var_uri_str.as_str());
209
210    if let Some(ref local_var_user_agent) = local_var_configuration.user_agent {
211        local_var_req_builder = local_var_req_builder.header(reqwest::header::USER_AGENT, local_var_user_agent.clone());
212    }
213    local_var_req_builder = local_var_req_builder.json(&git_create_ref_request);
214
215    let local_var_req = local_var_req_builder.build()?;
216    let local_var_resp = local_var_client.execute(local_var_req).await?;
217
218    let local_var_status = local_var_resp.status();
219    let local_var_content = local_var_resp.text().await?;
220
221    if !local_var_status.is_client_error() && !local_var_status.is_server_error() {
222        serde_json::from_str(&local_var_content).map_err(Error::from)
223    } else {
224        let local_var_entity: Option<GitSlashCreateRefError> = serde_json::from_str(&local_var_content).ok();
225        let local_var_error = ResponseContent { status: local_var_status, content: local_var_content, entity: local_var_entity };
226        Err(Error::ResponseError(local_var_error))
227    }
228}
229
230/// Note that creating a tag object does not create the reference that makes a tag in Git. If you want to create an annotated tag in Git, you have to do this call to create the tag object, and then [create](https://docs.github.com/rest/git/refs#create-a-reference) the `refs/tags/[tag]` reference. If you want to create a lightweight tag, you only have to [create](https://docs.github.com/rest/git/refs#create-a-reference) the tag reference - this call would be unnecessary.  **Signature verification object**  The response will include a `verification` object that describes the result of verifying the commit's signature. The following fields are included in the `verification` object:  | Name | Type | Description | | ---- | ---- | ----------- | | `verified` | `boolean` | Indicates whether GitHub considers the signature in this commit to be verified. | | `reason` | `string` | The reason for verified value. Possible values and their meanings are enumerated in table below. | | `signature` | `string` | The signature that was extracted from the commit. | | `payload` | `string` | The value that was signed. |  These are the possible values for `reason` in the `verification` object:  | Value | Description | | ----- | ----------- | | `expired_key` | The key that made the signature is expired. | | `not_signing_key` | The \"signing\" flag is not among the usage flags in the GPG key that made the signature. | | `gpgverify_error` | There was an error communicating with the signature verification service. | | `gpgverify_unavailable` | The signature verification service is currently unavailable. | | `unsigned` | The object does not include a signature. | | `unknown_signature_type` | A non-PGP signature was found in the commit. | | `no_user` | No user was associated with the `committer` email address in the commit. | | `unverified_email` | The `committer` email address in the commit was associated with a user, but the email address is not verified on their account. | | `bad_email` | The `committer` email address in the commit is not included in the identities of the PGP key that made the signature. | | `unknown_key` | The key that made the signature has not been registered with any user's account. | | `malformed_signature` | There was an error parsing the signature. | | `invalid` | The signature could not be cryptographically verified using the key whose key-id was found in the signature. | | `valid` | None of the above errors applied, so the signature is considered to be verified. |
231pub async fn git_slash_create_tag(configuration: &configuration::Configuration, owner: &str, repo: &str, git_create_tag_request: models::GitCreateTagRequest) -> Result<models::GitTag, Error<GitSlashCreateTagError>> {
232    let local_var_configuration = configuration;
233
234    let local_var_client = &local_var_configuration.client;
235
236    let local_var_uri_str = format!("{}/repos/{owner}/{repo}/git/tags", local_var_configuration.base_path, owner=crate::apis::urlencode(owner), repo=crate::apis::urlencode(repo));
237    let mut local_var_req_builder = local_var_client.request(reqwest::Method::POST, local_var_uri_str.as_str());
238
239    if let Some(ref local_var_user_agent) = local_var_configuration.user_agent {
240        local_var_req_builder = local_var_req_builder.header(reqwest::header::USER_AGENT, local_var_user_agent.clone());
241    }
242    local_var_req_builder = local_var_req_builder.json(&git_create_tag_request);
243
244    let local_var_req = local_var_req_builder.build()?;
245    let local_var_resp = local_var_client.execute(local_var_req).await?;
246
247    let local_var_status = local_var_resp.status();
248    let local_var_content = local_var_resp.text().await?;
249
250    if !local_var_status.is_client_error() && !local_var_status.is_server_error() {
251        serde_json::from_str(&local_var_content).map_err(Error::from)
252    } else {
253        let local_var_entity: Option<GitSlashCreateTagError> = serde_json::from_str(&local_var_content).ok();
254        let local_var_error = ResponseContent { status: local_var_status, content: local_var_content, entity: local_var_entity };
255        Err(Error::ResponseError(local_var_error))
256    }
257}
258
259/// The tree creation API accepts nested entries. If you specify both a tree and a nested path modifying that tree, this endpoint will overwrite the contents of the tree with the new path contents, and create a new tree structure.  If you use this endpoint to add, delete, or modify the file contents in a tree, you will need to commit the tree and then update a branch to point to the commit. For more information see \"[Create a commit](https://docs.github.com/rest/git/commits#create-a-commit)\" and \"[Update a reference](https://docs.github.com/rest/git/refs#update-a-reference).\"  Returns an error if you try to delete a file that does not exist.
260pub async fn git_slash_create_tree(configuration: &configuration::Configuration, owner: &str, repo: &str, git_create_tree_request: models::GitCreateTreeRequest) -> Result<models::GitTree, Error<GitSlashCreateTreeError>> {
261    let local_var_configuration = configuration;
262
263    let local_var_client = &local_var_configuration.client;
264
265    let local_var_uri_str = format!("{}/repos/{owner}/{repo}/git/trees", local_var_configuration.base_path, owner=crate::apis::urlencode(owner), repo=crate::apis::urlencode(repo));
266    let mut local_var_req_builder = local_var_client.request(reqwest::Method::POST, local_var_uri_str.as_str());
267
268    if let Some(ref local_var_user_agent) = local_var_configuration.user_agent {
269        local_var_req_builder = local_var_req_builder.header(reqwest::header::USER_AGENT, local_var_user_agent.clone());
270    }
271    local_var_req_builder = local_var_req_builder.json(&git_create_tree_request);
272
273    let local_var_req = local_var_req_builder.build()?;
274    let local_var_resp = local_var_client.execute(local_var_req).await?;
275
276    let local_var_status = local_var_resp.status();
277    let local_var_content = local_var_resp.text().await?;
278
279    if !local_var_status.is_client_error() && !local_var_status.is_server_error() {
280        serde_json::from_str(&local_var_content).map_err(Error::from)
281    } else {
282        let local_var_entity: Option<GitSlashCreateTreeError> = serde_json::from_str(&local_var_content).ok();
283        let local_var_error = ResponseContent { status: local_var_status, content: local_var_content, entity: local_var_entity };
284        Err(Error::ResponseError(local_var_error))
285    }
286}
287
288/// Deletes the provided reference.
289pub async fn git_slash_delete_ref(configuration: &configuration::Configuration, owner: &str, repo: &str, r#ref: &str) -> Result<(), Error<GitSlashDeleteRefError>> {
290    let local_var_configuration = configuration;
291
292    let local_var_client = &local_var_configuration.client;
293
294    let local_var_uri_str = format!("{}/repos/{owner}/{repo}/git/refs/{ref}", local_var_configuration.base_path, owner=crate::apis::urlencode(owner), repo=crate::apis::urlencode(repo), ref=crate::apis::urlencode(r#ref));
295    let mut local_var_req_builder = local_var_client.request(reqwest::Method::DELETE, local_var_uri_str.as_str());
296
297    if let Some(ref local_var_user_agent) = local_var_configuration.user_agent {
298        local_var_req_builder = local_var_req_builder.header(reqwest::header::USER_AGENT, local_var_user_agent.clone());
299    }
300
301    let local_var_req = local_var_req_builder.build()?;
302    let local_var_resp = local_var_client.execute(local_var_req).await?;
303
304    let local_var_status = local_var_resp.status();
305    let local_var_content = local_var_resp.text().await?;
306
307    if !local_var_status.is_client_error() && !local_var_status.is_server_error() {
308        Ok(())
309    } else {
310        let local_var_entity: Option<GitSlashDeleteRefError> = serde_json::from_str(&local_var_content).ok();
311        let local_var_error = ResponseContent { status: local_var_status, content: local_var_content, entity: local_var_entity };
312        Err(Error::ResponseError(local_var_error))
313    }
314}
315
316/// The `content` in the response will always be Base64 encoded.  This endpoint supports the following custom media types. For more information, see \"[Media types](https://docs.github.com/rest/using-the-rest-api/getting-started-with-the-rest-api#media-types).\"  - **`application/vnd.github.raw+json`**: Returns the raw blob data. - **`application/vnd.github+json`**: Returns a JSON representation of the blob with `content` as a base64 encoded string. This is the default if no media type is specified.  **Note** This endpoint supports blobs up to 100 megabytes in size.
317pub async fn git_slash_get_blob(configuration: &configuration::Configuration, owner: &str, repo: &str, file_sha: &str) -> Result<models::Blob, Error<GitSlashGetBlobError>> {
318    let local_var_configuration = configuration;
319
320    let local_var_client = &local_var_configuration.client;
321
322    let local_var_uri_str = format!("{}/repos/{owner}/{repo}/git/blobs/{file_sha}", local_var_configuration.base_path, owner=crate::apis::urlencode(owner), repo=crate::apis::urlencode(repo), file_sha=crate::apis::urlencode(file_sha));
323    let mut local_var_req_builder = local_var_client.request(reqwest::Method::GET, local_var_uri_str.as_str());
324
325    if let Some(ref local_var_user_agent) = local_var_configuration.user_agent {
326        local_var_req_builder = local_var_req_builder.header(reqwest::header::USER_AGENT, local_var_user_agent.clone());
327    }
328
329    let local_var_req = local_var_req_builder.build()?;
330    let local_var_resp = local_var_client.execute(local_var_req).await?;
331
332    let local_var_status = local_var_resp.status();
333    let local_var_content = local_var_resp.text().await?;
334
335    if !local_var_status.is_client_error() && !local_var_status.is_server_error() {
336        serde_json::from_str(&local_var_content).map_err(Error::from)
337    } else {
338        let local_var_entity: Option<GitSlashGetBlobError> = serde_json::from_str(&local_var_content).ok();
339        let local_var_error = ResponseContent { status: local_var_status, content: local_var_content, entity: local_var_entity };
340        Err(Error::ResponseError(local_var_error))
341    }
342}
343
344/// Gets a Git [commit object](https://git-scm.com/book/en/v2/Git-Internals-Git-Objects).  To get the contents of a commit, see \"[Get a commit](/rest/commits/commits#get-a-commit).\"  **Signature verification object**  The response will include a `verification` object that describes the result of verifying the commit's signature. The following fields are included in the `verification` object:  | Name | Type | Description | | ---- | ---- | ----------- | | `verified` | `boolean` | Indicates whether GitHub considers the signature in this commit to be verified. | | `reason` | `string` | The reason for verified value. Possible values and their meanings are enumerated in the table below. | | `signature` | `string` | The signature that was extracted from the commit. | | `payload` | `string` | The value that was signed. |  These are the possible values for `reason` in the `verification` object:  | Value | Description | | ----- | ----------- | | `expired_key` | The key that made the signature is expired. | | `not_signing_key` | The \"signing\" flag is not among the usage flags in the GPG key that made the signature. | | `gpgverify_error` | There was an error communicating with the signature verification service. | | `gpgverify_unavailable` | The signature verification service is currently unavailable. | | `unsigned` | The object does not include a signature. | | `unknown_signature_type` | A non-PGP signature was found in the commit. | | `no_user` | No user was associated with the `committer` email address in the commit. | | `unverified_email` | The `committer` email address in the commit was associated with a user, but the email address is not verified on their account. | | `bad_email` | The `committer` email address in the commit is not included in the identities of the PGP key that made the signature. | | `unknown_key` | The key that made the signature has not been registered with any user's account. | | `malformed_signature` | There was an error parsing the signature. | | `invalid` | The signature could not be cryptographically verified using the key whose key-id was found in the signature. | | `valid` | None of the above errors applied, so the signature is considered to be verified. |
345pub async fn git_slash_get_commit(configuration: &configuration::Configuration, owner: &str, repo: &str, commit_sha: &str) -> Result<models::GitCommit, Error<GitSlashGetCommitError>> {
346    let local_var_configuration = configuration;
347
348    let local_var_client = &local_var_configuration.client;
349
350    let local_var_uri_str = format!("{}/repos/{owner}/{repo}/git/commits/{commit_sha}", local_var_configuration.base_path, owner=crate::apis::urlencode(owner), repo=crate::apis::urlencode(repo), commit_sha=crate::apis::urlencode(commit_sha));
351    let mut local_var_req_builder = local_var_client.request(reqwest::Method::GET, local_var_uri_str.as_str());
352
353    if let Some(ref local_var_user_agent) = local_var_configuration.user_agent {
354        local_var_req_builder = local_var_req_builder.header(reqwest::header::USER_AGENT, local_var_user_agent.clone());
355    }
356
357    let local_var_req = local_var_req_builder.build()?;
358    let local_var_resp = local_var_client.execute(local_var_req).await?;
359
360    let local_var_status = local_var_resp.status();
361    let local_var_content = local_var_resp.text().await?;
362
363    if !local_var_status.is_client_error() && !local_var_status.is_server_error() {
364        serde_json::from_str(&local_var_content).map_err(Error::from)
365    } else {
366        let local_var_entity: Option<GitSlashGetCommitError> = serde_json::from_str(&local_var_content).ok();
367        let local_var_error = ResponseContent { status: local_var_status, content: local_var_content, entity: local_var_entity };
368        Err(Error::ResponseError(local_var_error))
369    }
370}
371
372/// Returns a single reference from your Git database. The `:ref` in the URL must be formatted as `heads/<branch name>` for branches and `tags/<tag name>` for tags. If the `:ref` doesn't match an existing ref, a `404` is returned.  **Note:** You need to explicitly [request a pull request](https://docs.github.com/rest/pulls/pulls#get-a-pull-request) to trigger a test merge commit, which checks the mergeability of pull requests. For more information, see \"[Checking mergeability of pull requests](https://docs.github.com/rest/guides/getting-started-with-the-git-database-api#checking-mergeability-of-pull-requests)\".
373pub async fn git_slash_get_ref(configuration: &configuration::Configuration, owner: &str, repo: &str, r#ref: &str) -> Result<models::GitRef, Error<GitSlashGetRefError>> {
374    let local_var_configuration = configuration;
375
376    let local_var_client = &local_var_configuration.client;
377
378    let local_var_uri_str = format!("{}/repos/{owner}/{repo}/git/ref/{ref}", local_var_configuration.base_path, owner=crate::apis::urlencode(owner), repo=crate::apis::urlencode(repo), ref=crate::apis::urlencode(r#ref));
379    let mut local_var_req_builder = local_var_client.request(reqwest::Method::GET, local_var_uri_str.as_str());
380
381    if let Some(ref local_var_user_agent) = local_var_configuration.user_agent {
382        local_var_req_builder = local_var_req_builder.header(reqwest::header::USER_AGENT, local_var_user_agent.clone());
383    }
384
385    let local_var_req = local_var_req_builder.build()?;
386    let local_var_resp = local_var_client.execute(local_var_req).await?;
387
388    let local_var_status = local_var_resp.status();
389    let local_var_content = local_var_resp.text().await?;
390
391    if !local_var_status.is_client_error() && !local_var_status.is_server_error() {
392        serde_json::from_str(&local_var_content).map_err(Error::from)
393    } else {
394        let local_var_entity: Option<GitSlashGetRefError> = serde_json::from_str(&local_var_content).ok();
395        let local_var_error = ResponseContent { status: local_var_status, content: local_var_content, entity: local_var_entity };
396        Err(Error::ResponseError(local_var_error))
397    }
398}
399
400/// **Signature verification object**  The response will include a `verification` object that describes the result of verifying the commit's signature. The following fields are included in the `verification` object:  | Name | Type | Description | | ---- | ---- | ----------- | | `verified` | `boolean` | Indicates whether GitHub considers the signature in this commit to be verified. | | `reason` | `string` | The reason for verified value. Possible values and their meanings are enumerated in table below. | | `signature` | `string` | The signature that was extracted from the commit. | | `payload` | `string` | The value that was signed. |  These are the possible values for `reason` in the `verification` object:  | Value | Description | | ----- | ----------- | | `expired_key` | The key that made the signature is expired. | | `not_signing_key` | The \"signing\" flag is not among the usage flags in the GPG key that made the signature. | | `gpgverify_error` | There was an error communicating with the signature verification service. | | `gpgverify_unavailable` | The signature verification service is currently unavailable. | | `unsigned` | The object does not include a signature. | | `unknown_signature_type` | A non-PGP signature was found in the commit. | | `no_user` | No user was associated with the `committer` email address in the commit. | | `unverified_email` | The `committer` email address in the commit was associated with a user, but the email address is not verified on their account. | | `bad_email` | The `committer` email address in the commit is not included in the identities of the PGP key that made the signature. | | `unknown_key` | The key that made the signature has not been registered with any user's account. | | `malformed_signature` | There was an error parsing the signature. | | `invalid` | The signature could not be cryptographically verified using the key whose key-id was found in the signature. | | `valid` | None of the above errors applied, so the signature is considered to be verified. |
401pub async fn git_slash_get_tag(configuration: &configuration::Configuration, owner: &str, repo: &str, tag_sha: &str) -> Result<models::GitTag, Error<GitSlashGetTagError>> {
402    let local_var_configuration = configuration;
403
404    let local_var_client = &local_var_configuration.client;
405
406    let local_var_uri_str = format!("{}/repos/{owner}/{repo}/git/tags/{tag_sha}", local_var_configuration.base_path, owner=crate::apis::urlencode(owner), repo=crate::apis::urlencode(repo), tag_sha=crate::apis::urlencode(tag_sha));
407    let mut local_var_req_builder = local_var_client.request(reqwest::Method::GET, local_var_uri_str.as_str());
408
409    if let Some(ref local_var_user_agent) = local_var_configuration.user_agent {
410        local_var_req_builder = local_var_req_builder.header(reqwest::header::USER_AGENT, local_var_user_agent.clone());
411    }
412
413    let local_var_req = local_var_req_builder.build()?;
414    let local_var_resp = local_var_client.execute(local_var_req).await?;
415
416    let local_var_status = local_var_resp.status();
417    let local_var_content = local_var_resp.text().await?;
418
419    if !local_var_status.is_client_error() && !local_var_status.is_server_error() {
420        serde_json::from_str(&local_var_content).map_err(Error::from)
421    } else {
422        let local_var_entity: Option<GitSlashGetTagError> = serde_json::from_str(&local_var_content).ok();
423        let local_var_error = ResponseContent { status: local_var_status, content: local_var_content, entity: local_var_entity };
424        Err(Error::ResponseError(local_var_error))
425    }
426}
427
428/// Returns a single tree using the SHA1 value or ref name for that tree.  If `truncated` is `true` in the response then the number of items in the `tree` array exceeded our maximum limit. If you need to fetch more items, use the non-recursive method of fetching trees, and fetch one sub-tree at a time.   **Note**: The limit for the `tree` array is 100,000 entries with a maximum size of 7 MB when using the `recursive` parameter.
429pub async fn git_slash_get_tree(configuration: &configuration::Configuration, owner: &str, repo: &str, tree_sha: &str, recursive: Option<&str>) -> Result<models::GitTree, Error<GitSlashGetTreeError>> {
430    let local_var_configuration = configuration;
431
432    let local_var_client = &local_var_configuration.client;
433
434    let local_var_uri_str = format!("{}/repos/{owner}/{repo}/git/trees/{tree_sha}", local_var_configuration.base_path, owner=crate::apis::urlencode(owner), repo=crate::apis::urlencode(repo), tree_sha=crate::apis::urlencode(tree_sha));
435    let mut local_var_req_builder = local_var_client.request(reqwest::Method::GET, local_var_uri_str.as_str());
436
437    if let Some(ref local_var_str) = recursive {
438        local_var_req_builder = local_var_req_builder.query(&[("recursive", &local_var_str.to_string())]);
439    }
440    if let Some(ref local_var_user_agent) = local_var_configuration.user_agent {
441        local_var_req_builder = local_var_req_builder.header(reqwest::header::USER_AGENT, local_var_user_agent.clone());
442    }
443
444    let local_var_req = local_var_req_builder.build()?;
445    let local_var_resp = local_var_client.execute(local_var_req).await?;
446
447    let local_var_status = local_var_resp.status();
448    let local_var_content = local_var_resp.text().await?;
449
450    if !local_var_status.is_client_error() && !local_var_status.is_server_error() {
451        serde_json::from_str(&local_var_content).map_err(Error::from)
452    } else {
453        let local_var_entity: Option<GitSlashGetTreeError> = serde_json::from_str(&local_var_content).ok();
454        let local_var_error = ResponseContent { status: local_var_status, content: local_var_content, entity: local_var_entity };
455        Err(Error::ResponseError(local_var_error))
456    }
457}
458
459/// Returns an array of references from your Git database that match the supplied name. The `:ref` in the URL must be formatted as `heads/<branch name>` for branches and `tags/<tag name>` for tags. If the `:ref` doesn't exist in the repository, but existing refs start with `:ref`, they will be returned as an array.  When you use this endpoint without providing a `:ref`, it will return an array of all the references from your Git database, including notes and stashes if they exist on the server. Anything in the namespace is returned, not just `heads` and `tags`.  **Note:** You need to explicitly [request a pull request](https://docs.github.com/rest/pulls/pulls#get-a-pull-request) to trigger a test merge commit, which checks the mergeability of pull requests. For more information, see \"[Checking mergeability of pull requests](https://docs.github.com/rest/guides/getting-started-with-the-git-database-api#checking-mergeability-of-pull-requests)\".  If you request matching references for a branch named `feature` but the branch `feature` doesn't exist, the response can still include other matching head refs that start with the word `feature`, such as `featureA` and `featureB`.
460pub async fn git_slash_list_matching_refs(configuration: &configuration::Configuration, owner: &str, repo: &str, r#ref: &str) -> Result<Vec<models::GitRef>, Error<GitSlashListMatchingRefsError>> {
461    let local_var_configuration = configuration;
462
463    let local_var_client = &local_var_configuration.client;
464
465    let local_var_uri_str = format!("{}/repos/{owner}/{repo}/git/matching-refs/{ref}", local_var_configuration.base_path, owner=crate::apis::urlencode(owner), repo=crate::apis::urlencode(repo), ref=crate::apis::urlencode(r#ref));
466    let mut local_var_req_builder = local_var_client.request(reqwest::Method::GET, local_var_uri_str.as_str());
467
468    if let Some(ref local_var_user_agent) = local_var_configuration.user_agent {
469        local_var_req_builder = local_var_req_builder.header(reqwest::header::USER_AGENT, local_var_user_agent.clone());
470    }
471
472    let local_var_req = local_var_req_builder.build()?;
473    let local_var_resp = local_var_client.execute(local_var_req).await?;
474
475    let local_var_status = local_var_resp.status();
476    let local_var_content = local_var_resp.text().await?;
477
478    if !local_var_status.is_client_error() && !local_var_status.is_server_error() {
479        serde_json::from_str(&local_var_content).map_err(Error::from)
480    } else {
481        let local_var_entity: Option<GitSlashListMatchingRefsError> = serde_json::from_str(&local_var_content).ok();
482        let local_var_error = ResponseContent { status: local_var_status, content: local_var_content, entity: local_var_entity };
483        Err(Error::ResponseError(local_var_error))
484    }
485}
486
487/// Updates the provided reference to point to a new SHA. For more information, see \"[Git References](https://git-scm.com/book/en/v2/Git-Internals-Git-References)\" in the Git documentation.
488pub async fn git_slash_update_ref(configuration: &configuration::Configuration, owner: &str, repo: &str, r#ref: &str, git_update_ref_request: models::GitUpdateRefRequest) -> Result<models::GitRef, Error<GitSlashUpdateRefError>> {
489    let local_var_configuration = configuration;
490
491    let local_var_client = &local_var_configuration.client;
492
493    let local_var_uri_str = format!("{}/repos/{owner}/{repo}/git/refs/{ref}", local_var_configuration.base_path, owner=crate::apis::urlencode(owner), repo=crate::apis::urlencode(repo), ref=crate::apis::urlencode(r#ref));
494    let mut local_var_req_builder = local_var_client.request(reqwest::Method::PATCH, local_var_uri_str.as_str());
495
496    if let Some(ref local_var_user_agent) = local_var_configuration.user_agent {
497        local_var_req_builder = local_var_req_builder.header(reqwest::header::USER_AGENT, local_var_user_agent.clone());
498    }
499    local_var_req_builder = local_var_req_builder.json(&git_update_ref_request);
500
501    let local_var_req = local_var_req_builder.build()?;
502    let local_var_resp = local_var_client.execute(local_var_req).await?;
503
504    let local_var_status = local_var_resp.status();
505    let local_var_content = local_var_resp.text().await?;
506
507    if !local_var_status.is_client_error() && !local_var_status.is_server_error() {
508        serde_json::from_str(&local_var_content).map_err(Error::from)
509    } else {
510        let local_var_entity: Option<GitSlashUpdateRefError> = serde_json::from_str(&local_var_content).ok();
511        let local_var_error = ResponseContent { status: local_var_status, content: local_var_content, entity: local_var_entity };
512        Err(Error::ResponseError(local_var_error))
513    }
514}
515