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
use crate::models::actions::{ConcurrencyGroupDetails, ConcurrencyGroupsResponse};
use crate::models::RunId;
use crate::{Octocrab, Result};
/// Handler for Actions Concurrency Groups for a repository.
pub struct RepoActionsConcurrencyGroupsHandler<'octo> {
crab: &'octo Octocrab,
owner: String,
repo: String,
}
impl<'octo> RepoActionsConcurrencyGroupsHandler<'octo> {
pub(crate) fn new(crab: &'octo Octocrab, owner: String, repo: String) -> Self {
Self { crab, owner, repo }
}
/// List concurrency groups for a repository.
///
/// See: [GitHub API Documentation](https://docs.github.com/en/rest/actions/concurrency-groups?apiVersion=2022-11-28#list-concurrency-groups-for-a-repository)
pub async fn list(&self) -> Result<ConcurrencyGroupsResponse> {
let route = format!(
"/repos/{}/{}/actions/concurrency_groups",
self.owner, self.repo
);
self.crab.get(route, None::<&()>).await
}
/// Get a concurrency group for a repository.
///
/// See: [GitHub API Documentation](https://docs.github.com/en/rest/actions/concurrency-groups?apiVersion=2022-11-28#get-a-concurrency-group-for-a-repository)
pub async fn get(
&self,
concurrency_group_name: impl AsRef<str>,
) -> Result<ConcurrencyGroupDetails> {
let route = format!(
"/repos/{}/{}/actions/concurrency_groups/{}",
self.owner,
self.repo,
concurrency_group_name.as_ref()
);
self.crab.get(route, None::<&()>).await
}
/// List concurrency groups for a workflow run.
///
/// See: [GitHub API Documentation](https://docs.github.com/en/rest/actions/concurrency-groups?apiVersion=2022-11-28#list-concurrency-groups-for-a-workflow-run)
pub async fn list_for_run(
&self,
run_id: impl Into<RunId>,
) -> Result<ConcurrencyGroupsResponse> {
let route = format!(
"/repos/{}/{}/actions/runs/{}/concurrency_groups",
self.owner,
self.repo,
run_id.into()
);
self.crab.get(route, None::<&()>).await
}
}