openapi_github/apis/
checks_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 [`checks_slash_create`]
19#[derive(Debug, Clone, Serialize, Deserialize)]
20#[serde(untagged)]
21pub enum ChecksSlashCreateError {
22    UnknownValue(serde_json::Value),
23}
24
25/// struct for typed errors of method [`checks_slash_create_suite`]
26#[derive(Debug, Clone, Serialize, Deserialize)]
27#[serde(untagged)]
28pub enum ChecksSlashCreateSuiteError {
29    UnknownValue(serde_json::Value),
30}
31
32/// struct for typed errors of method [`checks_slash_get`]
33#[derive(Debug, Clone, Serialize, Deserialize)]
34#[serde(untagged)]
35pub enum ChecksSlashGetError {
36    UnknownValue(serde_json::Value),
37}
38
39/// struct for typed errors of method [`checks_slash_get_suite`]
40#[derive(Debug, Clone, Serialize, Deserialize)]
41#[serde(untagged)]
42pub enum ChecksSlashGetSuiteError {
43    UnknownValue(serde_json::Value),
44}
45
46/// struct for typed errors of method [`checks_slash_list_annotations`]
47#[derive(Debug, Clone, Serialize, Deserialize)]
48#[serde(untagged)]
49pub enum ChecksSlashListAnnotationsError {
50    UnknownValue(serde_json::Value),
51}
52
53/// struct for typed errors of method [`checks_slash_list_for_ref`]
54#[derive(Debug, Clone, Serialize, Deserialize)]
55#[serde(untagged)]
56pub enum ChecksSlashListForRefError {
57    UnknownValue(serde_json::Value),
58}
59
60/// struct for typed errors of method [`checks_slash_list_for_suite`]
61#[derive(Debug, Clone, Serialize, Deserialize)]
62#[serde(untagged)]
63pub enum ChecksSlashListForSuiteError {
64    UnknownValue(serde_json::Value),
65}
66
67/// struct for typed errors of method [`checks_slash_list_suites_for_ref`]
68#[derive(Debug, Clone, Serialize, Deserialize)]
69#[serde(untagged)]
70pub enum ChecksSlashListSuitesForRefError {
71    UnknownValue(serde_json::Value),
72}
73
74/// struct for typed errors of method [`checks_slash_rerequest_run`]
75#[derive(Debug, Clone, Serialize, Deserialize)]
76#[serde(untagged)]
77pub enum ChecksSlashRerequestRunError {
78    Status403(models::BasicError),
79    Status404(models::BasicError),
80    Status422(models::BasicError),
81    UnknownValue(serde_json::Value),
82}
83
84/// struct for typed errors of method [`checks_slash_rerequest_suite`]
85#[derive(Debug, Clone, Serialize, Deserialize)]
86#[serde(untagged)]
87pub enum ChecksSlashRerequestSuiteError {
88    UnknownValue(serde_json::Value),
89}
90
91/// struct for typed errors of method [`checks_slash_set_suites_preferences`]
92#[derive(Debug, Clone, Serialize, Deserialize)]
93#[serde(untagged)]
94pub enum ChecksSlashSetSuitesPreferencesError {
95    UnknownValue(serde_json::Value),
96}
97
98/// struct for typed errors of method [`checks_slash_update`]
99#[derive(Debug, Clone, Serialize, Deserialize)]
100#[serde(untagged)]
101pub enum ChecksSlashUpdateError {
102    UnknownValue(serde_json::Value),
103}
104
105
106/// **Note:** The Checks API only looks for pushes in the repository where the check suite or check run were created. Pushes to a branch in a forked repository are not detected and return an empty `pull_requests` array.  Creates a new check run for a specific commit in a repository. Your GitHub App must have the `checks:write` permission to create check runs.  In a check suite, GitHub limits the number of check runs with the same name to 1000. Once these check runs exceed 1000, GitHub will start to automatically delete older check runs.
107pub async fn checks_slash_create(configuration: &configuration::Configuration, owner: &str, repo: &str, checks_create_request: models::ChecksCreateRequest) -> Result<models::CheckRun, Error<ChecksSlashCreateError>> {
108    let local_var_configuration = configuration;
109
110    let local_var_client = &local_var_configuration.client;
111
112    let local_var_uri_str = format!("{}/repos/{owner}/{repo}/check-runs", local_var_configuration.base_path, owner=crate::apis::urlencode(owner), repo=crate::apis::urlencode(repo));
113    let mut local_var_req_builder = local_var_client.request(reqwest::Method::POST, local_var_uri_str.as_str());
114
115    if let Some(ref local_var_user_agent) = local_var_configuration.user_agent {
116        local_var_req_builder = local_var_req_builder.header(reqwest::header::USER_AGENT, local_var_user_agent.clone());
117    }
118    local_var_req_builder = local_var_req_builder.json(&checks_create_request);
119
120    let local_var_req = local_var_req_builder.build()?;
121    let local_var_resp = local_var_client.execute(local_var_req).await?;
122
123    let local_var_status = local_var_resp.status();
124    let local_var_content = local_var_resp.text().await?;
125
126    if !local_var_status.is_client_error() && !local_var_status.is_server_error() {
127        serde_json::from_str(&local_var_content).map_err(Error::from)
128    } else {
129        let local_var_entity: Option<ChecksSlashCreateError> = serde_json::from_str(&local_var_content).ok();
130        let local_var_error = ResponseContent { status: local_var_status, content: local_var_content, entity: local_var_entity };
131        Err(Error::ResponseError(local_var_error))
132    }
133}
134
135/// Creates a check suite manually. By default, check suites are automatically created when you create a [check run](https://docs.github.com/rest/checks/runs). You only need to use this endpoint for manually creating check suites when you've disabled automatic creation using \"[Update repository preferences for check suites](https://docs.github.com/rest/checks/suites#update-repository-preferences-for-check-suites)\".  **Note:** The Checks API only looks for pushes in the repository where the check suite or check run were created. Pushes to a branch in a forked repository are not detected and return an empty `pull_requests` array and a `null` value for `head_branch`.  OAuth apps and personal access tokens (classic) cannot use this endpoint.
136pub async fn checks_slash_create_suite(configuration: &configuration::Configuration, owner: &str, repo: &str, checks_create_suite_request: models::ChecksCreateSuiteRequest) -> Result<models::CheckSuite, Error<ChecksSlashCreateSuiteError>> {
137    let local_var_configuration = configuration;
138
139    let local_var_client = &local_var_configuration.client;
140
141    let local_var_uri_str = format!("{}/repos/{owner}/{repo}/check-suites", local_var_configuration.base_path, owner=crate::apis::urlencode(owner), repo=crate::apis::urlencode(repo));
142    let mut local_var_req_builder = local_var_client.request(reqwest::Method::POST, local_var_uri_str.as_str());
143
144    if let Some(ref local_var_user_agent) = local_var_configuration.user_agent {
145        local_var_req_builder = local_var_req_builder.header(reqwest::header::USER_AGENT, local_var_user_agent.clone());
146    }
147    local_var_req_builder = local_var_req_builder.json(&checks_create_suite_request);
148
149    let local_var_req = local_var_req_builder.build()?;
150    let local_var_resp = local_var_client.execute(local_var_req).await?;
151
152    let local_var_status = local_var_resp.status();
153    let local_var_content = local_var_resp.text().await?;
154
155    if !local_var_status.is_client_error() && !local_var_status.is_server_error() {
156        serde_json::from_str(&local_var_content).map_err(Error::from)
157    } else {
158        let local_var_entity: Option<ChecksSlashCreateSuiteError> = serde_json::from_str(&local_var_content).ok();
159        let local_var_error = ResponseContent { status: local_var_status, content: local_var_content, entity: local_var_entity };
160        Err(Error::ResponseError(local_var_error))
161    }
162}
163
164/// Gets a single check run using its `id`.  **Note:** The Checks API only looks for pushes in the repository where the check suite or check run were created. Pushes to a branch in a forked repository are not detected and return an empty `pull_requests` array.  OAuth app tokens and personal access tokens (classic) need the `repo` scope to use this endpoint on a private repository.
165pub async fn checks_slash_get(configuration: &configuration::Configuration, owner: &str, repo: &str, check_run_id: i32) -> Result<models::CheckRun, Error<ChecksSlashGetError>> {
166    let local_var_configuration = configuration;
167
168    let local_var_client = &local_var_configuration.client;
169
170    let local_var_uri_str = format!("{}/repos/{owner}/{repo}/check-runs/{check_run_id}", local_var_configuration.base_path, owner=crate::apis::urlencode(owner), repo=crate::apis::urlencode(repo), check_run_id=check_run_id);
171    let mut local_var_req_builder = local_var_client.request(reqwest::Method::GET, local_var_uri_str.as_str());
172
173    if let Some(ref local_var_user_agent) = local_var_configuration.user_agent {
174        local_var_req_builder = local_var_req_builder.header(reqwest::header::USER_AGENT, local_var_user_agent.clone());
175    }
176
177    let local_var_req = local_var_req_builder.build()?;
178    let local_var_resp = local_var_client.execute(local_var_req).await?;
179
180    let local_var_status = local_var_resp.status();
181    let local_var_content = local_var_resp.text().await?;
182
183    if !local_var_status.is_client_error() && !local_var_status.is_server_error() {
184        serde_json::from_str(&local_var_content).map_err(Error::from)
185    } else {
186        let local_var_entity: Option<ChecksSlashGetError> = serde_json::from_str(&local_var_content).ok();
187        let local_var_error = ResponseContent { status: local_var_status, content: local_var_content, entity: local_var_entity };
188        Err(Error::ResponseError(local_var_error))
189    }
190}
191
192/// Gets a single check suite using its `id`.  **Note:** The Checks API only looks for pushes in the repository where the check suite or check run were created. Pushes to a branch in a forked repository are not detected and return an empty `pull_requests` array and a `null` value for `head_branch`.  OAuth app tokens and personal access tokens (classic) need the `repo` scope to use this endpoint on a private repository.
193pub async fn checks_slash_get_suite(configuration: &configuration::Configuration, owner: &str, repo: &str, check_suite_id: i32) -> Result<models::CheckSuite, Error<ChecksSlashGetSuiteError>> {
194    let local_var_configuration = configuration;
195
196    let local_var_client = &local_var_configuration.client;
197
198    let local_var_uri_str = format!("{}/repos/{owner}/{repo}/check-suites/{check_suite_id}", local_var_configuration.base_path, owner=crate::apis::urlencode(owner), repo=crate::apis::urlencode(repo), check_suite_id=check_suite_id);
199    let mut local_var_req_builder = local_var_client.request(reqwest::Method::GET, local_var_uri_str.as_str());
200
201    if let Some(ref local_var_user_agent) = local_var_configuration.user_agent {
202        local_var_req_builder = local_var_req_builder.header(reqwest::header::USER_AGENT, local_var_user_agent.clone());
203    }
204
205    let local_var_req = local_var_req_builder.build()?;
206    let local_var_resp = local_var_client.execute(local_var_req).await?;
207
208    let local_var_status = local_var_resp.status();
209    let local_var_content = local_var_resp.text().await?;
210
211    if !local_var_status.is_client_error() && !local_var_status.is_server_error() {
212        serde_json::from_str(&local_var_content).map_err(Error::from)
213    } else {
214        let local_var_entity: Option<ChecksSlashGetSuiteError> = serde_json::from_str(&local_var_content).ok();
215        let local_var_error = ResponseContent { status: local_var_status, content: local_var_content, entity: local_var_entity };
216        Err(Error::ResponseError(local_var_error))
217    }
218}
219
220/// Lists annotations for a check run using the annotation `id`.  OAuth app tokens and personal access tokens (classic) need the `repo` scope to use this endpoint on a private repository.
221pub async fn checks_slash_list_annotations(configuration: &configuration::Configuration, owner: &str, repo: &str, check_run_id: i32, per_page: Option<i32>, page: Option<i32>) -> Result<Vec<models::CheckAnnotation>, Error<ChecksSlashListAnnotationsError>> {
222    let local_var_configuration = configuration;
223
224    let local_var_client = &local_var_configuration.client;
225
226    let local_var_uri_str = format!("{}/repos/{owner}/{repo}/check-runs/{check_run_id}/annotations", local_var_configuration.base_path, owner=crate::apis::urlencode(owner), repo=crate::apis::urlencode(repo), check_run_id=check_run_id);
227    let mut local_var_req_builder = local_var_client.request(reqwest::Method::GET, local_var_uri_str.as_str());
228
229    if let Some(ref local_var_str) = per_page {
230        local_var_req_builder = local_var_req_builder.query(&[("per_page", &local_var_str.to_string())]);
231    }
232    if let Some(ref local_var_str) = page {
233        local_var_req_builder = local_var_req_builder.query(&[("page", &local_var_str.to_string())]);
234    }
235    if let Some(ref local_var_user_agent) = local_var_configuration.user_agent {
236        local_var_req_builder = local_var_req_builder.header(reqwest::header::USER_AGENT, local_var_user_agent.clone());
237    }
238
239    let local_var_req = local_var_req_builder.build()?;
240    let local_var_resp = local_var_client.execute(local_var_req).await?;
241
242    let local_var_status = local_var_resp.status();
243    let local_var_content = local_var_resp.text().await?;
244
245    if !local_var_status.is_client_error() && !local_var_status.is_server_error() {
246        serde_json::from_str(&local_var_content).map_err(Error::from)
247    } else {
248        let local_var_entity: Option<ChecksSlashListAnnotationsError> = serde_json::from_str(&local_var_content).ok();
249        let local_var_error = ResponseContent { status: local_var_status, content: local_var_content, entity: local_var_entity };
250        Err(Error::ResponseError(local_var_error))
251    }
252}
253
254/// Lists check runs for a commit ref. The `ref` can be a SHA, branch name, or a tag name.  **Note:** The endpoints to manage checks only look for pushes in the repository where the check suite or check run were created. Pushes to a branch in a forked repository are not detected and return an empty `pull_requests` array.  If there are more than 1000 check suites on a single git reference, this endpoint will limit check runs to the 1000 most recent check suites. To iterate over all possible check runs, use the [List check suites for a Git reference](https://docs.github.com/rest/reference/checks#list-check-suites-for-a-git-reference) endpoint and provide the `check_suite_id` parameter to the [List check runs in a check suite](https://docs.github.com/rest/reference/checks#list-check-runs-in-a-check-suite) endpoint.  OAuth app tokens and personal access tokens (classic) need the `repo` scope to use this endpoint on a private repository.
255pub async fn checks_slash_list_for_ref(configuration: &configuration::Configuration, owner: &str, repo: &str, r#ref: &str, check_name: Option<&str>, status: Option<&str>, filter: Option<&str>, per_page: Option<i32>, page: Option<i32>, app_id: Option<i32>) -> Result<models::ChecksListForSuite200Response, Error<ChecksSlashListForRefError>> {
256    let local_var_configuration = configuration;
257
258    let local_var_client = &local_var_configuration.client;
259
260    let local_var_uri_str = format!("{}/repos/{owner}/{repo}/commits/{ref}/check-runs", local_var_configuration.base_path, owner=crate::apis::urlencode(owner), repo=crate::apis::urlencode(repo), ref=crate::apis::urlencode(r#ref));
261    let mut local_var_req_builder = local_var_client.request(reqwest::Method::GET, local_var_uri_str.as_str());
262
263    if let Some(ref local_var_str) = check_name {
264        local_var_req_builder = local_var_req_builder.query(&[("check_name", &local_var_str.to_string())]);
265    }
266    if let Some(ref local_var_str) = status {
267        local_var_req_builder = local_var_req_builder.query(&[("status", &local_var_str.to_string())]);
268    }
269    if let Some(ref local_var_str) = filter {
270        local_var_req_builder = local_var_req_builder.query(&[("filter", &local_var_str.to_string())]);
271    }
272    if let Some(ref local_var_str) = per_page {
273        local_var_req_builder = local_var_req_builder.query(&[("per_page", &local_var_str.to_string())]);
274    }
275    if let Some(ref local_var_str) = page {
276        local_var_req_builder = local_var_req_builder.query(&[("page", &local_var_str.to_string())]);
277    }
278    if let Some(ref local_var_str) = app_id {
279        local_var_req_builder = local_var_req_builder.query(&[("app_id", &local_var_str.to_string())]);
280    }
281    if let Some(ref local_var_user_agent) = local_var_configuration.user_agent {
282        local_var_req_builder = local_var_req_builder.header(reqwest::header::USER_AGENT, local_var_user_agent.clone());
283    }
284
285    let local_var_req = local_var_req_builder.build()?;
286    let local_var_resp = local_var_client.execute(local_var_req).await?;
287
288    let local_var_status = local_var_resp.status();
289    let local_var_content = local_var_resp.text().await?;
290
291    if !local_var_status.is_client_error() && !local_var_status.is_server_error() {
292        serde_json::from_str(&local_var_content).map_err(Error::from)
293    } else {
294        let local_var_entity: Option<ChecksSlashListForRefError> = serde_json::from_str(&local_var_content).ok();
295        let local_var_error = ResponseContent { status: local_var_status, content: local_var_content, entity: local_var_entity };
296        Err(Error::ResponseError(local_var_error))
297    }
298}
299
300/// Lists check runs for a check suite using its `id`.  **Note:** The endpoints to manage checks only look for pushes in the repository where the check suite or check run were created. Pushes to a branch in a forked repository are not detected and return an empty `pull_requests` array.  OAuth app tokens and personal access tokens (classic) need the `repo` scope to use this endpoint on a private repository.
301pub async fn checks_slash_list_for_suite(configuration: &configuration::Configuration, owner: &str, repo: &str, check_suite_id: i32, check_name: Option<&str>, status: Option<&str>, filter: Option<&str>, per_page: Option<i32>, page: Option<i32>) -> Result<models::ChecksListForSuite200Response, Error<ChecksSlashListForSuiteError>> {
302    let local_var_configuration = configuration;
303
304    let local_var_client = &local_var_configuration.client;
305
306    let local_var_uri_str = format!("{}/repos/{owner}/{repo}/check-suites/{check_suite_id}/check-runs", local_var_configuration.base_path, owner=crate::apis::urlencode(owner), repo=crate::apis::urlencode(repo), check_suite_id=check_suite_id);
307    let mut local_var_req_builder = local_var_client.request(reqwest::Method::GET, local_var_uri_str.as_str());
308
309    if let Some(ref local_var_str) = check_name {
310        local_var_req_builder = local_var_req_builder.query(&[("check_name", &local_var_str.to_string())]);
311    }
312    if let Some(ref local_var_str) = status {
313        local_var_req_builder = local_var_req_builder.query(&[("status", &local_var_str.to_string())]);
314    }
315    if let Some(ref local_var_str) = filter {
316        local_var_req_builder = local_var_req_builder.query(&[("filter", &local_var_str.to_string())]);
317    }
318    if let Some(ref local_var_str) = per_page {
319        local_var_req_builder = local_var_req_builder.query(&[("per_page", &local_var_str.to_string())]);
320    }
321    if let Some(ref local_var_str) = page {
322        local_var_req_builder = local_var_req_builder.query(&[("page", &local_var_str.to_string())]);
323    }
324    if let Some(ref local_var_user_agent) = local_var_configuration.user_agent {
325        local_var_req_builder = local_var_req_builder.header(reqwest::header::USER_AGENT, local_var_user_agent.clone());
326    }
327
328    let local_var_req = local_var_req_builder.build()?;
329    let local_var_resp = local_var_client.execute(local_var_req).await?;
330
331    let local_var_status = local_var_resp.status();
332    let local_var_content = local_var_resp.text().await?;
333
334    if !local_var_status.is_client_error() && !local_var_status.is_server_error() {
335        serde_json::from_str(&local_var_content).map_err(Error::from)
336    } else {
337        let local_var_entity: Option<ChecksSlashListForSuiteError> = serde_json::from_str(&local_var_content).ok();
338        let local_var_error = ResponseContent { status: local_var_status, content: local_var_content, entity: local_var_entity };
339        Err(Error::ResponseError(local_var_error))
340    }
341}
342
343/// Lists check suites for a commit `ref`. The `ref` can be a SHA, branch name, or a tag name.  **Note:** The endpoints to manage checks only look for pushes in the repository where the check suite or check run were created. Pushes to a branch in a forked repository are not detected and return an empty `pull_requests` array and a `null` value for `head_branch`.  OAuth app tokens and personal access tokens (classic) need the `repo` scope to use this endpoint on a private repository.
344pub async fn checks_slash_list_suites_for_ref(configuration: &configuration::Configuration, owner: &str, repo: &str, r#ref: &str, app_id: Option<i32>, check_name: Option<&str>, per_page: Option<i32>, page: Option<i32>) -> Result<models::ChecksListSuitesForRef200Response, Error<ChecksSlashListSuitesForRefError>> {
345    let local_var_configuration = configuration;
346
347    let local_var_client = &local_var_configuration.client;
348
349    let local_var_uri_str = format!("{}/repos/{owner}/{repo}/commits/{ref}/check-suites", local_var_configuration.base_path, owner=crate::apis::urlencode(owner), repo=crate::apis::urlencode(repo), ref=crate::apis::urlencode(r#ref));
350    let mut local_var_req_builder = local_var_client.request(reqwest::Method::GET, local_var_uri_str.as_str());
351
352    if let Some(ref local_var_str) = app_id {
353        local_var_req_builder = local_var_req_builder.query(&[("app_id", &local_var_str.to_string())]);
354    }
355    if let Some(ref local_var_str) = check_name {
356        local_var_req_builder = local_var_req_builder.query(&[("check_name", &local_var_str.to_string())]);
357    }
358    if let Some(ref local_var_str) = per_page {
359        local_var_req_builder = local_var_req_builder.query(&[("per_page", &local_var_str.to_string())]);
360    }
361    if let Some(ref local_var_str) = page {
362        local_var_req_builder = local_var_req_builder.query(&[("page", &local_var_str.to_string())]);
363    }
364    if let Some(ref local_var_user_agent) = local_var_configuration.user_agent {
365        local_var_req_builder = local_var_req_builder.header(reqwest::header::USER_AGENT, local_var_user_agent.clone());
366    }
367
368    let local_var_req = local_var_req_builder.build()?;
369    let local_var_resp = local_var_client.execute(local_var_req).await?;
370
371    let local_var_status = local_var_resp.status();
372    let local_var_content = local_var_resp.text().await?;
373
374    if !local_var_status.is_client_error() && !local_var_status.is_server_error() {
375        serde_json::from_str(&local_var_content).map_err(Error::from)
376    } else {
377        let local_var_entity: Option<ChecksSlashListSuitesForRefError> = serde_json::from_str(&local_var_content).ok();
378        let local_var_error = ResponseContent { status: local_var_status, content: local_var_content, entity: local_var_entity };
379        Err(Error::ResponseError(local_var_error))
380    }
381}
382
383/// Triggers GitHub to rerequest an existing check run, without pushing new code to a repository. This endpoint will trigger the [`check_run` webhook](https://docs.github.com/webhooks/event-payloads/#check_run) event with the action `rerequested`. When a check run is `rerequested`, its `status` is reset to `queued` and the `conclusion` is cleared.  For more information about how to re-run GitHub Actions jobs, see \"[Re-run a job from a workflow run](https://docs.github.com/rest/actions/workflow-runs#re-run-a-job-from-a-workflow-run)\".  OAuth apps and personal access tokens (classic) cannot use this endpoint.
384pub async fn checks_slash_rerequest_run(configuration: &configuration::Configuration, owner: &str, repo: &str, check_run_id: i32) -> Result<serde_json::Value, Error<ChecksSlashRerequestRunError>> {
385    let local_var_configuration = configuration;
386
387    let local_var_client = &local_var_configuration.client;
388
389    let local_var_uri_str = format!("{}/repos/{owner}/{repo}/check-runs/{check_run_id}/rerequest", local_var_configuration.base_path, owner=crate::apis::urlencode(owner), repo=crate::apis::urlencode(repo), check_run_id=check_run_id);
390    let mut local_var_req_builder = local_var_client.request(reqwest::Method::POST, local_var_uri_str.as_str());
391
392    if let Some(ref local_var_user_agent) = local_var_configuration.user_agent {
393        local_var_req_builder = local_var_req_builder.header(reqwest::header::USER_AGENT, local_var_user_agent.clone());
394    }
395
396    let local_var_req = local_var_req_builder.build()?;
397    let local_var_resp = local_var_client.execute(local_var_req).await?;
398
399    let local_var_status = local_var_resp.status();
400    let local_var_content = local_var_resp.text().await?;
401
402    if !local_var_status.is_client_error() && !local_var_status.is_server_error() {
403        serde_json::from_str(&local_var_content).map_err(Error::from)
404    } else {
405        let local_var_entity: Option<ChecksSlashRerequestRunError> = serde_json::from_str(&local_var_content).ok();
406        let local_var_error = ResponseContent { status: local_var_status, content: local_var_content, entity: local_var_entity };
407        Err(Error::ResponseError(local_var_error))
408    }
409}
410
411/// Triggers GitHub to rerequest an existing check suite, without pushing new code to a repository. This endpoint will trigger the [`check_suite` webhook](https://docs.github.com/webhooks/event-payloads/#check_suite) event with the action `rerequested`. When a check suite is `rerequested`, its `status` is reset to `queued` and the `conclusion` is cleared.  OAuth apps and personal access tokens (classic) cannot use this endpoint.
412pub async fn checks_slash_rerequest_suite(configuration: &configuration::Configuration, owner: &str, repo: &str, check_suite_id: i32) -> Result<serde_json::Value, Error<ChecksSlashRerequestSuiteError>> {
413    let local_var_configuration = configuration;
414
415    let local_var_client = &local_var_configuration.client;
416
417    let local_var_uri_str = format!("{}/repos/{owner}/{repo}/check-suites/{check_suite_id}/rerequest", local_var_configuration.base_path, owner=crate::apis::urlencode(owner), repo=crate::apis::urlencode(repo), check_suite_id=check_suite_id);
418    let mut local_var_req_builder = local_var_client.request(reqwest::Method::POST, local_var_uri_str.as_str());
419
420    if let Some(ref local_var_user_agent) = local_var_configuration.user_agent {
421        local_var_req_builder = local_var_req_builder.header(reqwest::header::USER_AGENT, local_var_user_agent.clone());
422    }
423
424    let local_var_req = local_var_req_builder.build()?;
425    let local_var_resp = local_var_client.execute(local_var_req).await?;
426
427    let local_var_status = local_var_resp.status();
428    let local_var_content = local_var_resp.text().await?;
429
430    if !local_var_status.is_client_error() && !local_var_status.is_server_error() {
431        serde_json::from_str(&local_var_content).map_err(Error::from)
432    } else {
433        let local_var_entity: Option<ChecksSlashRerequestSuiteError> = serde_json::from_str(&local_var_content).ok();
434        let local_var_error = ResponseContent { status: local_var_status, content: local_var_content, entity: local_var_entity };
435        Err(Error::ResponseError(local_var_error))
436    }
437}
438
439/// Changes the default automatic flow when creating check suites. By default, a check suite is automatically created each time code is pushed to a repository. When you disable the automatic creation of check suites, you can manually [Create a check suite](https://docs.github.com/rest/checks/suites#create-a-check-suite). You must have admin permissions in the repository to set preferences for check suites.
440pub async fn checks_slash_set_suites_preferences(configuration: &configuration::Configuration, owner: &str, repo: &str, checks_set_suites_preferences_request: models::ChecksSetSuitesPreferencesRequest) -> Result<models::CheckSuitePreference, Error<ChecksSlashSetSuitesPreferencesError>> {
441    let local_var_configuration = configuration;
442
443    let local_var_client = &local_var_configuration.client;
444
445    let local_var_uri_str = format!("{}/repos/{owner}/{repo}/check-suites/preferences", local_var_configuration.base_path, owner=crate::apis::urlencode(owner), repo=crate::apis::urlencode(repo));
446    let mut local_var_req_builder = local_var_client.request(reqwest::Method::PATCH, local_var_uri_str.as_str());
447
448    if let Some(ref local_var_user_agent) = local_var_configuration.user_agent {
449        local_var_req_builder = local_var_req_builder.header(reqwest::header::USER_AGENT, local_var_user_agent.clone());
450    }
451    local_var_req_builder = local_var_req_builder.json(&checks_set_suites_preferences_request);
452
453    let local_var_req = local_var_req_builder.build()?;
454    let local_var_resp = local_var_client.execute(local_var_req).await?;
455
456    let local_var_status = local_var_resp.status();
457    let local_var_content = local_var_resp.text().await?;
458
459    if !local_var_status.is_client_error() && !local_var_status.is_server_error() {
460        serde_json::from_str(&local_var_content).map_err(Error::from)
461    } else {
462        let local_var_entity: Option<ChecksSlashSetSuitesPreferencesError> = serde_json::from_str(&local_var_content).ok();
463        let local_var_error = ResponseContent { status: local_var_status, content: local_var_content, entity: local_var_entity };
464        Err(Error::ResponseError(local_var_error))
465    }
466}
467
468/// Updates a check run for a specific commit in a repository.  **Note:** The endpoints to manage checks only look for pushes in the repository where the check suite or check run were created. Pushes to a branch in a forked repository are not detected and return an empty `pull_requests` array.  OAuth apps and personal access tokens (classic) cannot use this endpoint.
469pub async fn checks_slash_update(configuration: &configuration::Configuration, owner: &str, repo: &str, check_run_id: i32, checks_update_request: models::ChecksUpdateRequest) -> Result<models::CheckRun, Error<ChecksSlashUpdateError>> {
470    let local_var_configuration = configuration;
471
472    let local_var_client = &local_var_configuration.client;
473
474    let local_var_uri_str = format!("{}/repos/{owner}/{repo}/check-runs/{check_run_id}", local_var_configuration.base_path, owner=crate::apis::urlencode(owner), repo=crate::apis::urlencode(repo), check_run_id=check_run_id);
475    let mut local_var_req_builder = local_var_client.request(reqwest::Method::PATCH, local_var_uri_str.as_str());
476
477    if let Some(ref local_var_user_agent) = local_var_configuration.user_agent {
478        local_var_req_builder = local_var_req_builder.header(reqwest::header::USER_AGENT, local_var_user_agent.clone());
479    }
480    local_var_req_builder = local_var_req_builder.json(&checks_update_request);
481
482    let local_var_req = local_var_req_builder.build()?;
483    let local_var_resp = local_var_client.execute(local_var_req).await?;
484
485    let local_var_status = local_var_resp.status();
486    let local_var_content = local_var_resp.text().await?;
487
488    if !local_var_status.is_client_error() && !local_var_status.is_server_error() {
489        serde_json::from_str(&local_var_content).map_err(Error::from)
490    } else {
491        let local_var_entity: Option<ChecksSlashUpdateError> = serde_json::from_str(&local_var_content).ok();
492        let local_var_error = ResponseContent { status: local_var_status, content: local_var_content, entity: local_var_entity };
493        Err(Error::ResponseError(local_var_error))
494    }
495}
496