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
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 list_global_advisories {
#[allow(unused_imports)]
use super::*;
pub type Response = Vec<GlobalAdvisory>;
#[allow(clippy::large_enum_variant)]
#[derive(Debug, Clone, Serialize, Deserialize, PartialEq, Copy)]
pub enum QueryType {
#[serde(rename = "reviewed")]
Reviewed,
#[serde(rename = "malware")]
Malware,
#[serde(rename = "unreviewed")]
Unreviewed,
}
impl std::fmt::Display for QueryType {
fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result {
match self {
QueryType::Reviewed => write!(f, "reviewed"),
QueryType::Malware => write!(f, "malware"),
QueryType::Unreviewed => write!(f, "unreviewed"),
}
}
}
#[allow(clippy::large_enum_variant)]
#[derive(Debug, Clone, Serialize, Deserialize, PartialEq, Copy)]
pub enum QuerySeverity {
#[serde(rename = "unknown")]
Unknown,
#[serde(rename = "low")]
Low,
#[serde(rename = "medium")]
Medium,
#[serde(rename = "high")]
High,
#[serde(rename = "critical")]
Critical,
}
impl std::fmt::Display for QuerySeverity {
fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result {
match self {
QuerySeverity::Unknown => write!(f, "unknown"),
QuerySeverity::Low => write!(f, "low"),
QuerySeverity::Medium => write!(f, "medium"),
QuerySeverity::High => write!(f, "high"),
QuerySeverity::Critical => write!(f, "critical"),
}
}
}
#[allow(clippy::large_enum_variant)]
#[derive(Debug, Clone, Serialize, Deserialize, PartialEq, Copy)]
pub enum QuerySort {
#[serde(rename = "updated")]
Updated,
#[serde(rename = "published")]
Published,
}
impl std::fmt::Display for QuerySort {
fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result {
match self {
QuerySort::Updated => write!(f, "updated"),
QuerySort::Published => write!(f, "published"),
}
}
}
#[derive(Debug, Clone, Serialize, Deserialize, TypedBuilder)]
#[builder(field_defaults(setter(into)))]
pub struct Query {
/// If specified, only advisories with this GHSA (GitHub Security Advisory) identifier will be returned.
#[serde(skip_serializing_if = "Option::is_none")]
#[builder(default, setter(strip_option))]
pub ghsa_id: Option<String>,
/// If specified, only advisories of this type will be returned. By default, a request with no other parameters defined will only return reviewed advisories that are not malware.
#[serde(rename = "type")]
#[serde(skip_serializing_if = "Option::is_none")]
#[builder(default, setter(strip_option))]
pub type_: Option<QueryType>,
/// If specified, only advisories with this CVE (Common Vulnerabilities and Exposures) identifier will be returned.
#[serde(skip_serializing_if = "Option::is_none")]
#[builder(default, setter(strip_option))]
pub cve_id: Option<String>,
/// If specified, only advisories for these ecosystems will be returned.
#[serde(skip_serializing_if = "Option::is_none")]
#[builder(default, setter(strip_option))]
pub ecosystem: Option<SecurityAdvisoryEcosystems>,
/// If specified, only advisories with these severities will be returned.
#[serde(skip_serializing_if = "Option::is_none")]
#[builder(default, setter(strip_option))]
pub severity: Option<QuerySeverity>,
/// If specified, only advisories with these Common Weakness Enumerations (CWEs) will be returned.
///
/// Example: `cwes=79,284,22` or `cwes[]=79&cwes[]=284&cwes[]=22`
#[serde(skip_serializing_if = "Option::is_none")]
#[builder(default, setter(strip_option))]
pub cwes: Option<Vec<String>>,
/// Whether to only return advisories that have been withdrawn.
#[serde(skip_serializing_if = "Option::is_none")]
#[builder(default, setter(strip_option))]
pub is_withdrawn: Option<bool>,
/// If specified, only return advisories that affect any of `package` or `package@version`. A maximum of 1000 packages can be specified.
/// If the query parameter causes the URL to exceed the maximum URL length supported by your client, you must specify fewer packages.
///
/// Example: `affects=package1,package2@1.0.0,package3@^2.0.0` or `affects[]=package1&affects[]=package2@1.0.0`
#[serde(skip_serializing_if = "Option::is_none")]
#[builder(default, setter(strip_option))]
pub affects: Option<Vec<String>>,
/// If specified, only return advisories that were published on a date or date range.
///
/// For more information on the syntax of the date range, see "[Understanding the search syntax](https://docs.github.com/search-github/getting-started-with-searching-on-github/understanding-the-search-syntax#query-for-dates)."
#[serde(skip_serializing_if = "Option::is_none")]
#[builder(default, setter(strip_option))]
pub published: Option<String>,
/// If specified, only return advisories that were updated on a date or date range.
///
/// For more information on the syntax of the date range, see "[Understanding the search syntax](https://docs.github.com/search-github/getting-started-with-searching-on-github/understanding-the-search-syntax#query-for-dates)."
#[serde(skip_serializing_if = "Option::is_none")]
#[builder(default, setter(strip_option))]
pub updated: Option<String>,
/// If specified, only show advisories that were updated or published on a date or date range.
///
/// For more information on the syntax of the date range, see "[Understanding the search syntax](https://docs.github.com/search-github/getting-started-with-searching-on-github/understanding-the-search-syntax#query-for-dates)."
#[serde(skip_serializing_if = "Option::is_none")]
#[builder(default, setter(strip_option))]
pub modified: Option<String>,
/// A cursor, as given in the [Link header](https://docs.github.com/rest/guides/using-pagination-in-the-rest-api#using-link-headers). If specified, the query only searches for results before this cursor. 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 before: Option<String>,
/// A cursor, as given in the [Link header](https://docs.github.com/rest/guides/using-pagination-in-the-rest-api#using-link-headers). If specified, the query only searches for results after this cursor. 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 after: Option<String>,
/// The direction to sort the results by.
#[serde(skip_serializing_if = "Option::is_none")]
#[builder(default, setter(strip_option))]
pub direction: Option<parameters::Direction>,
/// 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 property to sort the results by.
#[serde(skip_serializing_if = "Option::is_none")]
#[builder(default, setter(strip_option))]
pub sort: Option<QuerySort>,
}
}
pub mod get_global_advisory {
#[allow(unused_imports)]
use super::*;
pub type Response = GlobalAdvisory;
}
pub mod list_org_repository_advisories {
#[allow(unused_imports)]
use super::*;
pub type Response = Vec<RepositoryAdvisory>;
#[allow(clippy::large_enum_variant)]
#[derive(Debug, Clone, Serialize, Deserialize, PartialEq, Copy)]
pub enum QuerySort {
#[serde(rename = "created")]
Created,
#[serde(rename = "updated")]
Updated,
#[serde(rename = "published")]
Published,
}
impl std::fmt::Display for QuerySort {
fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result {
match self {
QuerySort::Created => write!(f, "created"),
QuerySort::Updated => write!(f, "updated"),
QuerySort::Published => write!(f, "published"),
}
}
}
#[allow(clippy::large_enum_variant)]
#[derive(Debug, Clone, Serialize, Deserialize, PartialEq, Copy)]
pub enum QueryState {
#[serde(rename = "triage")]
Triage,
#[serde(rename = "draft")]
Draft,
#[serde(rename = "published")]
Published,
#[serde(rename = "closed")]
Closed,
}
impl std::fmt::Display for QueryState {
fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result {
match self {
QueryState::Triage => write!(f, "triage"),
QueryState::Draft => write!(f, "draft"),
QueryState::Published => write!(f, "published"),
QueryState::Closed => write!(f, "closed"),
}
}
}
#[derive(Debug, Clone, Serialize, Deserialize, TypedBuilder)]
#[builder(field_defaults(setter(into)))]
pub struct Query {
/// The direction to sort the results by.
#[serde(skip_serializing_if = "Option::is_none")]
#[builder(default, setter(strip_option))]
pub direction: Option<parameters::Direction>,
/// The property to sort the results by.
#[serde(skip_serializing_if = "Option::is_none")]
#[builder(default, setter(strip_option))]
pub sort: Option<QuerySort>,
/// A cursor, as given in the [Link header](https://docs.github.com/rest/guides/using-pagination-in-the-rest-api#using-link-headers). If specified, the query only searches for results before this cursor. 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 before: Option<String>,
/// A cursor, as given in the [Link header](https://docs.github.com/rest/guides/using-pagination-in-the-rest-api#using-link-headers). If specified, the query only searches for results after this cursor. 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 after: Option<String>,
/// The number of advisories to return per page. 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>,
/// Filter by the state of the repository advisories. Only advisories of this state will be returned.
#[serde(skip_serializing_if = "Option::is_none")]
#[builder(default, setter(strip_option))]
pub state: Option<QueryState>,
}
}
pub mod list_repository_advisories {
#[allow(unused_imports)]
use super::*;
pub type Response = Vec<RepositoryAdvisory>;
#[allow(clippy::large_enum_variant)]
#[derive(Debug, Clone, Serialize, Deserialize, PartialEq, Copy)]
pub enum QuerySort {
#[serde(rename = "created")]
Created,
#[serde(rename = "updated")]
Updated,
#[serde(rename = "published")]
Published,
}
impl std::fmt::Display for QuerySort {
fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result {
match self {
QuerySort::Created => write!(f, "created"),
QuerySort::Updated => write!(f, "updated"),
QuerySort::Published => write!(f, "published"),
}
}
}
#[allow(clippy::large_enum_variant)]
#[derive(Debug, Clone, Serialize, Deserialize, PartialEq, Copy)]
pub enum QueryState {
#[serde(rename = "triage")]
Triage,
#[serde(rename = "draft")]
Draft,
#[serde(rename = "published")]
Published,
#[serde(rename = "closed")]
Closed,
}
impl std::fmt::Display for QueryState {
fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result {
match self {
QueryState::Triage => write!(f, "triage"),
QueryState::Draft => write!(f, "draft"),
QueryState::Published => write!(f, "published"),
QueryState::Closed => write!(f, "closed"),
}
}
}
#[derive(Debug, Clone, Serialize, Deserialize, TypedBuilder)]
#[builder(field_defaults(setter(into)))]
pub struct Query {
/// The direction to sort the results by.
#[serde(skip_serializing_if = "Option::is_none")]
#[builder(default, setter(strip_option))]
pub direction: Option<parameters::Direction>,
/// The property to sort the results by.
#[serde(skip_serializing_if = "Option::is_none")]
#[builder(default, setter(strip_option))]
pub sort: Option<QuerySort>,
/// A cursor, as given in the [Link header](https://docs.github.com/rest/guides/using-pagination-in-the-rest-api#using-link-headers). If specified, the query only searches for results before this cursor. 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 before: Option<String>,
/// A cursor, as given in the [Link header](https://docs.github.com/rest/guides/using-pagination-in-the-rest-api#using-link-headers). If specified, the query only searches for results after this cursor. 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 after: Option<String>,
/// The number of advisories to return per page. 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>,
/// Filter by state of the repository advisories. Only advisories of this state will be returned.
#[serde(skip_serializing_if = "Option::is_none")]
#[builder(default, setter(strip_option))]
pub state: Option<QueryState>,
}
}
pub mod create_repository_advisory {
#[allow(unused_imports)]
use super::*;
pub type Request = RepositoryAdvisoryCreate;
pub type Response = RepositoryAdvisory;
}
pub mod create_private_vulnerability_report {
#[allow(unused_imports)]
use super::*;
pub type Request = PrivateVulnerabilityReportCreate;
pub type Response = RepositoryAdvisory;
}
pub mod get_repository_advisory {
#[allow(unused_imports)]
use super::*;
pub type Response = RepositoryAdvisory;
}
pub mod update_repository_advisory {
#[allow(unused_imports)]
use super::*;
pub type Request = RepositoryAdvisoryUpdate;
pub type Response = RepositoryAdvisory;
}
pub mod create_fork {
#[allow(unused_imports)]
use super::*;
pub type Response = FullRepository;
}
pub struct GitHubSecurityAdvisoriesAPI {
config: SharedAPIConfig,
}
impl GitHubSecurityAdvisoriesAPI {
pub fn new(config: &SharedAPIConfig) -> Self {
Self {
config: config.clone(),
}
}
/// **List global security advisories**
///
/// Lists all global security advisories that match the specified parameters. If no other parameters are defined, the request will return only GitHub-reviewed advisories that are not malware.
///
/// By default, all responses will exclude advisories for malware, because malware are not standard vulnerabilities. To list advisories for malware, you must include the `type` parameter in your request, with the value `malware`. For more information about the different types of security advisories, see "[About the GitHub Advisory database](https://docs.github.com/code-security/security-advisories/global-security-advisories/about-the-github-advisory-database#about-types-of-security-advisories)."
///
/// *Documentation*: [https://docs.github.com/rest/security-advisories/global-advisories#list-global-security-advisories](https://docs.github.com/rest/security-advisories/global-advisories#list-global-security-advisories)
pub fn list_global_advisories(
&self,
) -> Request<(), list_global_advisories::Query, list_global_advisories::Response> {
let url = format!("/advisories");
Request::<(), list_global_advisories::Query, list_global_advisories::Response>::builder(
&self.config,
)
.get(url)
.build()
}
/// **Get a global security advisory**
///
/// Gets a global security advisory using its GitHub Security Advisory (GHSA) identifier.
///
/// *Documentation*: [https://docs.github.com/rest/security-advisories/global-advisories#get-a-global-security-advisory](https://docs.github.com/rest/security-advisories/global-advisories#get-a-global-security-advisory)
pub fn get_global_advisory(
&self,
ghsa_id: impl Into<String>,
) -> Request<(), (), get_global_advisory::Response> {
let ghsa_id = ghsa_id.into();
let url = format!("/advisories/{ghsa_id}");
Request::<(), (), get_global_advisory::Response>::builder(&self.config)
.get(url)
.build()
}
/// **List repository security advisories for an organization**
///
/// Lists repository security advisories for an organization.
///
/// The authenticated user must be an owner or security manager for the organization to use this endpoint.
///
/// OAuth app tokens and personal access tokens (classic) need the `repo` or `repository_advisories:write` scope to use this endpoint.
///
/// *Documentation*: [https://docs.github.com/rest/security-advisories/repository-advisories#list-repository-security-advisories-for-an-organization](https://docs.github.com/rest/security-advisories/repository-advisories#list-repository-security-advisories-for-an-organization)
pub fn list_org_repository_advisories(
&self,
org: impl Into<String>,
) -> Request<(), list_org_repository_advisories::Query, list_org_repository_advisories::Response>
{
let org = org.into();
let url = format!("/orgs/{org}/security-advisories");
Request::<(), list_org_repository_advisories::Query, list_org_repository_advisories::Response>::builder(&self.config)
.get(url)
.build()
}
/// **List repository security advisories**
///
/// Lists security advisories in a repository.
///
/// The authenticated user can access unpublished security advisories from a repository if they are a security manager or administrator of that repository, or if they are a collaborator on any security advisory.
///
/// OAuth app tokens and personal access tokens (classic) need the `repo` or `repository_advisories:read` scope to to get a published security advisory in a private repository, or any unpublished security advisory that the authenticated user has access to.
///
/// *Documentation*: [https://docs.github.com/rest/security-advisories/repository-advisories#list-repository-security-advisories](https://docs.github.com/rest/security-advisories/repository-advisories#list-repository-security-advisories)
pub fn list_repository_advisories(
&self,
owner: impl Into<String>,
repo: impl Into<String>,
) -> Request<(), list_repository_advisories::Query, list_repository_advisories::Response> {
let owner = owner.into();
let repo = repo.into();
let url = format!("/repos/{owner}/{repo}/security-advisories");
Request::<(), list_repository_advisories::Query, list_repository_advisories::Response>::builder(
&self.config,
)
.get(url)
.build()
}
/// **Create a repository security advisory**
///
/// Creates a new repository security advisory.
///
/// In order to create a draft repository security advisory, the authenticated user must be a security manager or administrator of that repository.
///
/// OAuth app tokens and personal access tokens (classic) need the `repo` or `repository_advisories:write` scope to use this endpoint.
///
/// *Documentation*: [https://docs.github.com/rest/security-advisories/repository-advisories#create-a-repository-security-advisory](https://docs.github.com/rest/security-advisories/repository-advisories#create-a-repository-security-advisory)
pub fn create_repository_advisory(
&self,
owner: impl Into<String>,
repo: impl Into<String>,
) -> Request<create_repository_advisory::Request, (), create_repository_advisory::Response> {
let owner = owner.into();
let repo = repo.into();
let url = format!("/repos/{owner}/{repo}/security-advisories");
Request::<create_repository_advisory::Request, (), create_repository_advisory::Response>::builder(&self.config)
.post(url)
.build()
}
/// **Privately report a security vulnerability**
///
/// Report a security vulnerability to the maintainers of the repository.
/// See "[Privately reporting a security vulnerability](https://docs.github.com/code-security/security-advisories/guidance-on-reporting-and-writing/privately-reporting-a-security-vulnerability)" for more information about private vulnerability reporting.
///
/// *Documentation*: [https://docs.github.com/rest/security-advisories/repository-advisories#privately-report-a-security-vulnerability](https://docs.github.com/rest/security-advisories/repository-advisories#privately-report-a-security-vulnerability)
pub fn create_private_vulnerability_report(
&self,
owner: impl Into<String>,
repo: impl Into<String>,
) -> Request<
create_private_vulnerability_report::Request,
(),
create_private_vulnerability_report::Response,
> {
let owner = owner.into();
let repo = repo.into();
let url = format!("/repos/{owner}/{repo}/security-advisories/reports");
Request::<
create_private_vulnerability_report::Request,
(),
create_private_vulnerability_report::Response,
>::builder(&self.config)
.post(url)
.build()
}
/// **Get a repository security advisory**
///
/// Get a repository security advisory using its GitHub Security Advisory (GHSA) identifier.
///
/// Anyone can access any published security advisory on a public repository.
///
/// The authenticated user can access an unpublished security advisory from a repository if they are a security manager or administrator of that repository, or if they are a
/// collaborator on the security advisory.
///
/// OAuth app tokens and personal access tokens (classic) need the `repo` or `repository_advisories:read` scope to to get a published security advisory in a private repository, or any unpublished security advisory that the authenticated user has access to.
///
/// *Documentation*: [https://docs.github.com/rest/security-advisories/repository-advisories#get-a-repository-security-advisory](https://docs.github.com/rest/security-advisories/repository-advisories#get-a-repository-security-advisory)
pub fn get_repository_advisory(
&self,
owner: impl Into<String>,
repo: impl Into<String>,
ghsa_id: impl Into<String>,
) -> Request<(), (), get_repository_advisory::Response> {
let owner = owner.into();
let repo = repo.into();
let ghsa_id = ghsa_id.into();
let url = format!("/repos/{owner}/{repo}/security-advisories/{ghsa_id}");
Request::<(), (), get_repository_advisory::Response>::builder(&self.config)
.get(url)
.build()
}
/// **Update a repository security advisory**
///
/// Update a repository security advisory using its GitHub Security Advisory (GHSA) identifier.
///
/// In order to update any security advisory, the authenticated user must be a security manager or administrator of that repository,
/// or a collaborator on the repository security advisory.
///
/// OAuth app tokens and personal access tokens (classic) need the `repo` or `repository_advisories:write` scope to use this endpoint.
///
/// *Documentation*: [https://docs.github.com/rest/security-advisories/repository-advisories#update-a-repository-security-advisory](https://docs.github.com/rest/security-advisories/repository-advisories#update-a-repository-security-advisory)
pub fn update_repository_advisory(
&self,
owner: impl Into<String>,
repo: impl Into<String>,
ghsa_id: impl Into<String>,
) -> Request<update_repository_advisory::Request, (), update_repository_advisory::Response> {
let owner = owner.into();
let repo = repo.into();
let ghsa_id = ghsa_id.into();
let url = format!("/repos/{owner}/{repo}/security-advisories/{ghsa_id}");
Request::<update_repository_advisory::Request, (), update_repository_advisory::Response>::builder(&self.config)
.patch(url)
.build()
}
/// **Request a CVE for a repository security advisory**
///
/// If you want a CVE identification number for the security vulnerability in your project, and don't already have one, you can request a CVE identification number from GitHub. For more information see "[Requesting a CVE identification number](https://docs.github.com/code-security/security-advisories/repository-security-advisories/publishing-a-repository-security-advisory#requesting-a-cve-identification-number-optional)."
///
/// You may request a CVE for public repositories, but cannot do so for private repositories.
///
/// In order to request a CVE for a repository security advisory, the authenticated user must be a security manager or administrator of that repository.
///
/// OAuth app tokens and personal access tokens (classic) need the `repo` or `repository_advisories:write` scope to use this endpoint.
///
/// *Documentation*: [https://docs.github.com/rest/security-advisories/repository-advisories#request-a-cve-for-a-repository-security-advisory](https://docs.github.com/rest/security-advisories/repository-advisories#request-a-cve-for-a-repository-security-advisory)
pub fn create_repository_advisory_cve_request(
&self,
owner: impl Into<String>,
repo: impl Into<String>,
ghsa_id: impl Into<String>,
) -> NoContentRequest<(), ()> {
let owner = owner.into();
let repo = repo.into();
let ghsa_id = ghsa_id.into();
let url = format!("/repos/{owner}/{repo}/security-advisories/{ghsa_id}/cve");
NoContentRequest::<(), ()>::builder(&self.config)
.post(url)
.build()
}
/// **Create a temporary private fork**
///
/// Create a temporary private fork to collaborate on fixing a security vulnerability in your repository.
///
/// **Note**: Forking a repository happens asynchronously. You may have to wait up to 5 minutes before you can access the fork.
///
/// *Documentation*: [https://docs.github.com/rest/security-advisories/repository-advisories#create-a-temporary-private-fork](https://docs.github.com/rest/security-advisories/repository-advisories#create-a-temporary-private-fork)
pub fn create_fork(
&self,
owner: impl Into<String>,
repo: impl Into<String>,
ghsa_id: impl Into<String>,
) -> Request<(), (), create_fork::Response> {
let owner = owner.into();
let repo = repo.into();
let ghsa_id = ghsa_id.into();
let url = format!("/repos/{owner}/{repo}/security-advisories/{ghsa_id}/forks");
Request::<(), (), create_fork::Response>::builder(&self.config)
.post(url)
.build()
}
}