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
use octocrate_core::*;
#[allow(unused_imports)]
use crate::types::*;
pub struct GitHubDependencyGraphAPI {
config: SharedAPIConfig,
}
impl GitHubDependencyGraphAPI {
pub fn new(config: &SharedAPIConfig) -> Self {
Self {
config: config.clone(),
}
}
/// *** Export a software bill of materials (SBOM) for a repository. ***
///
/// Exports the software bill of materials (SBOM) for a repository in SPDX JSON format.
///
/// *Documentation*: [https://docs.github.com/rest/dependency-graph/sboms#export-a-software-bill-of-materials-sbom-for-a-repository](https://docs.github.com/rest/dependency-graph/sboms#export-a-software-bill-of-materials-sbom-for-a-repository)
pub fn export_sbom(
&self,
owner: impl Into<String>,
repo: impl Into<String>,
) -> Request<(), (), DependencyGraphSPDXSBOM> {
let owner = owner.into();
let repo = repo.into();
let url = format!("/repos/{owner}/{repo}/dependency-graph/sbom");
Request::<(), (), DependencyGraphSPDXSBOM>::builder(&self.config)
.get(url)
.build()
}
/// *** Get a diff of the dependencies between commits ***
///
/// Gets the diff of the dependency changes between two commits of a repository, based on the changes to the dependency manifests made in those commits.
///
/// *Documentation*: [https://docs.github.com/rest/dependency-graph/dependency-review#get-a-diff-of-the-dependencies-between-commits](https://docs.github.com/rest/dependency-graph/dependency-review#get-a-diff-of-the-dependencies-between-commits)
pub fn diff_range(
&self,
owner: impl Into<String>,
repo: impl Into<String>,
basehead: impl Into<String>,
) -> Request<(), DependencyGraphDiffRangeQuery, DependencyGraphDiff> {
let owner = owner.into();
let repo = repo.into();
let basehead = basehead.into();
let url = format!("/repos/{owner}/{repo}/dependency-graph/compare/{basehead}");
Request::<(), DependencyGraphDiffRangeQuery, DependencyGraphDiff>::builder(&self.config)
.get(url)
.build()
}
/// *** Create a snapshot of dependencies for a repository ***
///
/// Create a new snapshot of a repository's dependencies.
///
/// The authenticated user must have access to the repository.
///
/// OAuth app tokens and personal access tokens (classic) need the `repo` scope to use this endpoint.
///
/// *Documentation*: [https://docs.github.com/rest/dependency-graph/dependency-submission#create-a-snapshot-of-dependencies-for-a-repository](https://docs.github.com/rest/dependency-graph/dependency-submission#create-a-snapshot-of-dependencies-for-a-repository)
pub fn create_repository_snapshot(
&self,
owner: impl Into<String>,
repo: impl Into<String>,
) -> Request<Snapshot, (), DependencyGraphCreateRepositorySnapshotResponse> {
let owner = owner.into();
let repo = repo.into();
let url = format!("/repos/{owner}/{repo}/dependency-graph/snapshots");
Request::<Snapshot, (), DependencyGraphCreateRepositorySnapshotResponse>::builder(&self.config)
.post(url)
.build()
}
}