octocrate 2.1.0

A comprehensive GitHub REST API library based on Rust.
Documentation
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
use octocrate_core::*;
#[allow(unused_imports)]
use octocrate_types::*;
#[allow(unused_imports)]
use serde::{Deserialize, Serialize};
#[allow(unused_imports)]
use typed_builder::TypedBuilder;

pub mod create {
  #[allow(unused_imports)]
  use super::*;

  pub type Response = CheckRun;

  #[allow(clippy::large_enum_variant)]
  #[derive(Debug, Clone, Serialize, Deserialize, PartialEq, Copy)]
  pub enum RequestItem1Status {
    #[serde(rename = "completed")]
    Completed,
  }

  impl std::fmt::Display for RequestItem1Status {
    fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result {
      match self {
        RequestItem1Status::Completed => write!(f, "completed"),
      }
    }
  }

  #[allow(clippy::large_enum_variant)]
  #[derive(Debug, Clone, Serialize, Deserialize, PartialEq, Copy)]
  pub enum RequestItem2Status {
    #[serde(rename = "queued")]
    Queued,
    #[serde(rename = "in_progress")]
    InProgress,
  }

  impl std::fmt::Display for RequestItem2Status {
    fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result {
      match self {
        RequestItem2Status::Queued => write!(f, "queued"),
        RequestItem2Status::InProgress => write!(f, "in_progress"),
      }
    }
  }

  #[allow(clippy::large_enum_variant)]
  #[derive(Debug, Clone, Serialize, Deserialize)]
  #[serde(untagged)]
  pub enum Request {
    RequestItem1(RequestItem1),
    RequestItem2(RequestItem2),
  }

  #[derive(Debug, Clone, Serialize, Deserialize, TypedBuilder)]
  #[builder(field_defaults(setter(into)))]
  pub struct RequestItem1 {
    pub status: RequestItem1Status,
  }

  #[derive(Debug, Clone, Serialize, Deserialize, TypedBuilder)]
  #[builder(field_defaults(setter(into)))]
  pub struct RequestItem2 {
    #[serde(skip_serializing_if = "Option::is_none")]
    #[builder(default, setter(strip_option))]
    pub status: Option<RequestItem2Status>,
  }
}

pub mod get {
  #[allow(unused_imports)]
  use super::*;

  pub type Response = CheckRun;
}

pub mod update {
  #[allow(unused_imports)]
  use super::*;

  pub type Response = CheckRun;

  #[allow(clippy::large_enum_variant)]
  #[derive(Debug, Clone, Serialize, Deserialize, PartialEq, Copy)]
  pub enum RequestItem1Status {
    #[serde(rename = "completed")]
    Completed,
  }

  impl std::fmt::Display for RequestItem1Status {
    fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result {
      match self {
        RequestItem1Status::Completed => write!(f, "completed"),
      }
    }
  }

  #[allow(clippy::large_enum_variant)]
  #[derive(Debug, Clone, Serialize, Deserialize, PartialEq, Copy)]
  pub enum RequestItem2Status {
    #[serde(rename = "queued")]
    Queued,
    #[serde(rename = "in_progress")]
    InProgress,
  }

  impl std::fmt::Display for RequestItem2Status {
    fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result {
      match self {
        RequestItem2Status::Queued => write!(f, "queued"),
        RequestItem2Status::InProgress => write!(f, "in_progress"),
      }
    }
  }

  #[allow(clippy::large_enum_variant)]
  #[derive(Debug, Clone, Serialize, Deserialize)]
  #[serde(untagged)]
  pub enum Request {
    RequestItem1(RequestItem1),
    RequestItem2(RequestItem2),
  }

  #[derive(Debug, Clone, Serialize, Deserialize, TypedBuilder)]
  #[builder(field_defaults(setter(into)))]
  pub struct RequestItem1 {
    #[serde(skip_serializing_if = "Option::is_none")]
    #[builder(default, setter(strip_option))]
    pub status: Option<RequestItem1Status>,
  }

  #[derive(Debug, Clone, Serialize, Deserialize, TypedBuilder)]
  #[builder(field_defaults(setter(into)))]
  pub struct RequestItem2 {
    #[serde(skip_serializing_if = "Option::is_none")]
    #[builder(default, setter(strip_option))]
    pub status: Option<RequestItem2Status>,
  }
}

pub mod list_annotations {
  #[allow(unused_imports)]
  use super::*;

  pub type Response = Vec<CheckAnnotation>;

  #[derive(Debug, Clone, Serialize, Deserialize, TypedBuilder)]
  #[builder(field_defaults(setter(into)))]
  pub struct Query {
    /// The number of results per page (max 100). For more information, see "[Using pagination in the REST API](https://docs.github.com/rest/using-the-rest-api/using-pagination-in-the-rest-api)."
    #[serde(skip_serializing_if = "Option::is_none")]
    #[builder(default, setter(strip_option))]
    pub per_page: Option<i64>,
    /// The page number of the results to fetch. For more information, see "[Using pagination in the REST API](https://docs.github.com/rest/using-the-rest-api/using-pagination-in-the-rest-api)."
    #[serde(skip_serializing_if = "Option::is_none")]
    #[builder(default, setter(strip_option))]
    pub page: Option<i64>,
  }
}

pub mod rerequest_run {
  #[allow(unused_imports)]
  use super::*;

  pub type Response = EmptyObject;
}

pub mod create_suite {
  #[allow(unused_imports)]
  use super::*;

  pub type Response = CheckSuite;

  #[derive(Debug, Clone, Serialize, Deserialize, TypedBuilder)]
  #[builder(field_defaults(setter(into)))]
  pub struct Request {
    /// The sha of the head commit.
    pub head_sha: String,
  }
}

pub mod set_suites_preferences {
  #[allow(unused_imports)]
  use super::*;

  pub type Response = CheckSuitePreference;

  #[derive(Debug, Clone, Serialize, Deserialize, TypedBuilder)]
  #[builder(field_defaults(setter(into)))]
  pub struct RequestAutoTriggerChecks {
    /// The `id` of the GitHub App.
    pub app_id: i64,
    /// Set to `true` to enable automatic creation of CheckSuite events upon pushes to the repository, or `false` to disable them.
    pub setting: bool,
  }

  #[derive(Debug, Clone, Serialize, Deserialize, TypedBuilder)]
  #[builder(field_defaults(setter(into)))]
  pub struct Request {
    /// Enables or disables automatic creation of CheckSuite events upon pushes to the repository. Enabled by default.
    #[serde(skip_serializing_if = "Option::is_none")]
    #[builder(default, setter(strip_option))]
    pub auto_trigger_checks: Option<Vec<RequestAutoTriggerChecks>>,
  }
}

pub mod get_suite {
  #[allow(unused_imports)]
  use super::*;

  pub type Response = CheckSuite;
}

pub mod list_for_suite {
  #[allow(unused_imports)]
  use super::*;

  #[allow(clippy::large_enum_variant)]
  #[derive(Debug, Clone, Serialize, Deserialize, PartialEq, Copy)]
  pub enum QueryFilter {
    #[serde(rename = "latest")]
    Latest,
    #[serde(rename = "all")]
    All,
  }

  impl std::fmt::Display for QueryFilter {
    fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result {
      match self {
        QueryFilter::Latest => write!(f, "latest"),
        QueryFilter::All => write!(f, "all"),
      }
    }
  }

  #[derive(Debug, Clone, Serialize, Deserialize, TypedBuilder)]
  #[builder(field_defaults(setter(into)))]
  pub struct Query {
    /// Returns check runs with the specified `name`.
    #[serde(skip_serializing_if = "Option::is_none")]
    #[builder(default, setter(strip_option))]
    pub check_name: Option<String>,
    /// Returns check runs with the specified `status`.
    #[serde(skip_serializing_if = "Option::is_none")]
    #[builder(default, setter(strip_option))]
    pub status: Option<parameters::Status>,
    /// Filters check runs by their `completed_at` timestamp. `latest` returns the most recent check runs.
    #[serde(skip_serializing_if = "Option::is_none")]
    #[builder(default, setter(strip_option))]
    pub filter: Option<QueryFilter>,
    /// The number of results per page (max 100). For more information, see "[Using pagination in the REST API](https://docs.github.com/rest/using-the-rest-api/using-pagination-in-the-rest-api)."
    #[serde(skip_serializing_if = "Option::is_none")]
    #[builder(default, setter(strip_option))]
    pub per_page: Option<i64>,
    /// The page number of the results to fetch. For more information, see "[Using pagination in the REST API](https://docs.github.com/rest/using-the-rest-api/using-pagination-in-the-rest-api)."
    #[serde(skip_serializing_if = "Option::is_none")]
    #[builder(default, setter(strip_option))]
    pub page: Option<i64>,
  }

  #[derive(Debug, Clone, Serialize, Deserialize, TypedBuilder)]
  #[builder(field_defaults(setter(into)))]
  pub struct Response {
    pub check_runs: Vec<CheckRun>,
    pub total_count: i64,
  }
}

pub mod rerequest_suite {
  #[allow(unused_imports)]
  use super::*;

  pub type Response = EmptyObject;
}

pub mod list_for_ref {
  #[allow(unused_imports)]
  use super::*;

  #[allow(clippy::large_enum_variant)]
  #[derive(Debug, Clone, Serialize, Deserialize, PartialEq, Copy)]
  pub enum QueryFilter {
    #[serde(rename = "latest")]
    Latest,
    #[serde(rename = "all")]
    All,
  }

  impl std::fmt::Display for QueryFilter {
    fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result {
      match self {
        QueryFilter::Latest => write!(f, "latest"),
        QueryFilter::All => write!(f, "all"),
      }
    }
  }

  #[derive(Debug, Clone, Serialize, Deserialize, TypedBuilder)]
  #[builder(field_defaults(setter(into)))]
  pub struct Query {
    /// Returns check runs with the specified `name`.
    #[serde(skip_serializing_if = "Option::is_none")]
    #[builder(default, setter(strip_option))]
    pub check_name: Option<String>,
    /// Returns check runs with the specified `status`.
    #[serde(skip_serializing_if = "Option::is_none")]
    #[builder(default, setter(strip_option))]
    pub status: Option<parameters::Status>,
    /// Filters check runs by their `completed_at` timestamp. `latest` returns the most recent check runs.
    #[serde(skip_serializing_if = "Option::is_none")]
    #[builder(default, setter(strip_option))]
    pub filter: Option<QueryFilter>,
    /// The number of results per page (max 100). For more information, see "[Using pagination in the REST API](https://docs.github.com/rest/using-the-rest-api/using-pagination-in-the-rest-api)."
    #[serde(skip_serializing_if = "Option::is_none")]
    #[builder(default, setter(strip_option))]
    pub per_page: Option<i64>,
    /// The page number of the results to fetch. For more information, see "[Using pagination in the REST API](https://docs.github.com/rest/using-the-rest-api/using-pagination-in-the-rest-api)."
    #[serde(skip_serializing_if = "Option::is_none")]
    #[builder(default, setter(strip_option))]
    pub page: Option<i64>,
    #[serde(skip_serializing_if = "Option::is_none")]
    #[builder(default, setter(strip_option))]
    pub app_id: Option<i64>,
  }

  #[derive(Debug, Clone, Serialize, Deserialize, TypedBuilder)]
  #[builder(field_defaults(setter(into)))]
  pub struct Response {
    pub check_runs: Vec<CheckRun>,
    pub total_count: i64,
  }
}

pub mod list_suites_for_ref {
  #[allow(unused_imports)]
  use super::*;

  #[derive(Debug, Clone, Serialize, Deserialize, TypedBuilder)]
  #[builder(field_defaults(setter(into)))]
  pub struct Query {
    /// Filters check suites by GitHub App `id`.
    #[serde(skip_serializing_if = "Option::is_none")]
    #[builder(default, setter(strip_option))]
    pub app_id: Option<i64>,
    /// Returns check runs with the specified `name`.
    #[serde(skip_serializing_if = "Option::is_none")]
    #[builder(default, setter(strip_option))]
    pub check_name: Option<String>,
    /// The number of results per page (max 100). For more information, see "[Using pagination in the REST API](https://docs.github.com/rest/using-the-rest-api/using-pagination-in-the-rest-api)."
    #[serde(skip_serializing_if = "Option::is_none")]
    #[builder(default, setter(strip_option))]
    pub per_page: Option<i64>,
    /// The page number of the results to fetch. For more information, see "[Using pagination in the REST API](https://docs.github.com/rest/using-the-rest-api/using-pagination-in-the-rest-api)."
    #[serde(skip_serializing_if = "Option::is_none")]
    #[builder(default, setter(strip_option))]
    pub page: Option<i64>,
  }

  #[derive(Debug, Clone, Serialize, Deserialize, TypedBuilder)]
  #[builder(field_defaults(setter(into)))]
  pub struct Response {
    pub check_suites: Vec<CheckSuite>,
    pub total_count: i64,
  }
}

/// Rich interactions with checks run by your integrations.
pub struct GitHubChecksAPI {
  config: SharedAPIConfig,
}

impl GitHubChecksAPI {
  pub fn new(config: &SharedAPIConfig) -> Self {
    Self {
      config: config.clone(),
    }
  }

  /// **Create a check run**
  ///
  /// Creates a new check run for a specific commit in a repository.
  ///
  /// To create a check run, you must use a GitHub App. OAuth apps and authenticated users are not able to create a check suite.
  ///
  /// 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.
  ///
  /// **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.
  ///
  /// *Documentation*: [https://docs.github.com/rest/checks/runs#create-a-check-run](https://docs.github.com/rest/checks/runs#create-a-check-run)
  pub fn create(
    &self,
    owner: impl Into<String>,
    repo: impl Into<String>,
  ) -> Request<create::Request, (), create::Response> {
    let owner = owner.into();
    let repo = repo.into();
    let url = format!("/repos/{owner}/{repo}/check-runs");

    Request::<create::Request, (), create::Response>::builder(&self.config)
      .post(url)
      .build()
  }

  /// **Get a check run**
  ///
  /// 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.
  ///
  /// *Documentation*: [https://docs.github.com/rest/checks/runs#get-a-check-run](https://docs.github.com/rest/checks/runs#get-a-check-run)
  pub fn get(
    &self,
    owner: impl Into<String>,
    repo: impl Into<String>,
    check_run_id: impl Into<i64>,
  ) -> Request<(), (), get::Response> {
    let owner = owner.into();
    let repo = repo.into();
    let check_run_id = check_run_id.into();
    let url = format!("/repos/{owner}/{repo}/check-runs/{check_run_id}");

    Request::<(), (), get::Response>::builder(&self.config)
      .get(url)
      .build()
  }

  /// **Update a check run**
  ///
  /// 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.
  ///
  /// *Documentation*: [https://docs.github.com/rest/checks/runs#update-a-check-run](https://docs.github.com/rest/checks/runs#update-a-check-run)
  pub fn update(
    &self,
    owner: impl Into<String>,
    repo: impl Into<String>,
    check_run_id: impl Into<i64>,
  ) -> Request<update::Request, (), update::Response> {
    let owner = owner.into();
    let repo = repo.into();
    let check_run_id = check_run_id.into();
    let url = format!("/repos/{owner}/{repo}/check-runs/{check_run_id}");

    Request::<update::Request, (), update::Response>::builder(&self.config)
      .patch(url)
      .build()
  }

  /// **List check run annotations**
  ///
  /// 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.
  ///
  /// *Documentation*: [https://docs.github.com/rest/checks/runs#list-check-run-annotations](https://docs.github.com/rest/checks/runs#list-check-run-annotations)
  pub fn list_annotations(
    &self,
    owner: impl Into<String>,
    repo: impl Into<String>,
    check_run_id: impl Into<i64>,
  ) -> Request<(), list_annotations::Query, list_annotations::Response> {
    let owner = owner.into();
    let repo = repo.into();
    let check_run_id = check_run_id.into();
    let url = format!("/repos/{owner}/{repo}/check-runs/{check_run_id}/annotations");

    Request::<(), list_annotations::Query, list_annotations::Response>::builder(&self.config)
      .get(url)
      .build()
  }

  /// **Rerequest a check run**
  ///
  /// 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.
  ///
  /// *Documentation*: [https://docs.github.com/rest/checks/runs#rerequest-a-check-run](https://docs.github.com/rest/checks/runs#rerequest-a-check-run)
  pub fn rerequest_run(
    &self,
    owner: impl Into<String>,
    repo: impl Into<String>,
    check_run_id: impl Into<i64>,
  ) -> Request<(), (), rerequest_run::Response> {
    let owner = owner.into();
    let repo = repo.into();
    let check_run_id = check_run_id.into();
    let url = format!("/repos/{owner}/{repo}/check-runs/{check_run_id}/rerequest");

    Request::<(), (), rerequest_run::Response>::builder(&self.config)
      .post(url)
      .build()
  }

  /// **Create a check suite**
  ///
  /// 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.
  ///
  /// *Documentation*: [https://docs.github.com/rest/checks/suites#create-a-check-suite](https://docs.github.com/rest/checks/suites#create-a-check-suite)
  pub fn create_suite(
    &self,
    owner: impl Into<String>,
    repo: impl Into<String>,
  ) -> Request<create_suite::Request, (), create_suite::Response> {
    let owner = owner.into();
    let repo = repo.into();
    let url = format!("/repos/{owner}/{repo}/check-suites");

    Request::<create_suite::Request, (), create_suite::Response>::builder(&self.config)
      .post(url)
      .build()
  }

  /// **Update repository preferences for check suites**
  ///
  /// 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.
  ///
  /// *Documentation*: [https://docs.github.com/rest/checks/suites#update-repository-preferences-for-check-suites](https://docs.github.com/rest/checks/suites#update-repository-preferences-for-check-suites)
  pub fn set_suites_preferences(
    &self,
    owner: impl Into<String>,
    repo: impl Into<String>,
  ) -> Request<set_suites_preferences::Request, (), set_suites_preferences::Response> {
    let owner = owner.into();
    let repo = repo.into();
    let url = format!("/repos/{owner}/{repo}/check-suites/preferences");

    Request::<set_suites_preferences::Request, (), set_suites_preferences::Response>::builder(
      &self.config,
    )
    .patch(url)
    .build()
  }

  /// **Get a check suite**
  ///
  /// 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.
  ///
  /// *Documentation*: [https://docs.github.com/rest/checks/suites#get-a-check-suite](https://docs.github.com/rest/checks/suites#get-a-check-suite)
  pub fn get_suite(
    &self,
    owner: impl Into<String>,
    repo: impl Into<String>,
    check_suite_id: impl Into<i64>,
  ) -> Request<(), (), get_suite::Response> {
    let owner = owner.into();
    let repo = repo.into();
    let check_suite_id = check_suite_id.into();
    let url = format!("/repos/{owner}/{repo}/check-suites/{check_suite_id}");

    Request::<(), (), get_suite::Response>::builder(&self.config)
      .get(url)
      .build()
  }

  /// **List check runs in a check suite**
  ///
  /// 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.
  ///
  /// *Documentation*: [https://docs.github.com/rest/checks/runs#list-check-runs-in-a-check-suite](https://docs.github.com/rest/checks/runs#list-check-runs-in-a-check-suite)
  pub fn list_for_suite(
    &self,
    owner: impl Into<String>,
    repo: impl Into<String>,
    check_suite_id: impl Into<i64>,
  ) -> Request<(), list_for_suite::Query, list_for_suite::Response> {
    let owner = owner.into();
    let repo = repo.into();
    let check_suite_id = check_suite_id.into();
    let url = format!("/repos/{owner}/{repo}/check-suites/{check_suite_id}/check-runs");

    Request::<(), list_for_suite::Query, list_for_suite::Response>::builder(&self.config)
      .get(url)
      .build()
  }

  /// **Rerequest a check suite**
  ///
  /// 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.
  ///
  /// *Documentation*: [https://docs.github.com/rest/checks/suites#rerequest-a-check-suite](https://docs.github.com/rest/checks/suites#rerequest-a-check-suite)
  pub fn rerequest_suite(
    &self,
    owner: impl Into<String>,
    repo: impl Into<String>,
    check_suite_id: impl Into<i64>,
  ) -> Request<(), (), rerequest_suite::Response> {
    let owner = owner.into();
    let repo = repo.into();
    let check_suite_id = check_suite_id.into();
    let url = format!("/repos/{owner}/{repo}/check-suites/{check_suite_id}/rerequest");

    Request::<(), (), rerequest_suite::Response>::builder(&self.config)
      .post(url)
      .build()
  }

  /// **List check runs for a Git reference**
  ///
  /// 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.
  ///
  /// *Documentation*: [https://docs.github.com/rest/checks/runs#list-check-runs-for-a-git-reference](https://docs.github.com/rest/checks/runs#list-check-runs-for-a-git-reference)
  pub fn list_for_ref(
    &self,
    owner: impl Into<String>,
    repo: impl Into<String>,
    ref_: impl Into<String>,
  ) -> Request<(), list_for_ref::Query, list_for_ref::Response> {
    let owner = owner.into();
    let repo = repo.into();
    let ref_ = ref_.into();
    let url = format!("/repos/{owner}/{repo}/commits/{ref_}/check-runs");

    Request::<(), list_for_ref::Query, list_for_ref::Response>::builder(&self.config)
      .get(url)
      .build()
  }

  /// **List check suites for a Git reference**
  ///
  /// 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.
  ///
  /// *Documentation*: [https://docs.github.com/rest/checks/suites#list-check-suites-for-a-git-reference](https://docs.github.com/rest/checks/suites#list-check-suites-for-a-git-reference)
  pub fn list_suites_for_ref(
    &self,
    owner: impl Into<String>,
    repo: impl Into<String>,
    ref_: impl Into<String>,
  ) -> Request<(), list_suites_for_ref::Query, list_suites_for_ref::Response> {
    let owner = owner.into();
    let repo = repo.into();
    let ref_ = ref_.into();
    let url = format!("/repos/{owner}/{repo}/commits/{ref_}/check-suites");

    Request::<(), list_suites_for_ref::Query, list_suites_for_ref::Response>::builder(&self.config)
      .get(url)
      .build()
  }
}