Skip to main content

ephemeris_forge_github/api/operations/
rulesets.rs

1use ephemeris_forge::RepoRef;
2use facet_value::Value;
3
4use crate::Ruleset as Definition;
5use crate::api::error::ForgeError;
6use crate::api::model::Ruleset;
7
8/// The rulesets operations of the GitHub API.
9pub trait RulesetsApi {
10    /// Create a ruleset with its complete desired configuration.
11    fn create_ruleset(
12        &self,
13        repository: &RepoRef,
14        name: &str,
15        ruleset: &Definition,
16    ) -> impl Future<Output = Result<(), ForgeError>> + Send;
17
18    /// Delete the ruleset `id`.
19    fn delete_ruleset(
20        &self,
21        repository: &RepoRef,
22        id: u64,
23    ) -> impl Future<Output = Result<(), ForgeError>> + Send;
24
25    /// Read the repository's current rulesets.
26    fn rulesets(
27        &self,
28        repository: &RepoRef,
29    ) -> impl Future<Output = Result<Vec<Ruleset>, ForgeError>> + Send;
30
31    /// Replace the ruleset `id` with its complete desired configuration and
32    /// the live rules that the configuration cannot declare.
33    fn update_ruleset(
34        &self,
35        repository: &RepoRef,
36        id: u64,
37        name: &str,
38        ruleset: &Definition,
39        unmanaged_rules: &[Value],
40    ) -> impl Future<Output = Result<(), ForgeError>> + Send;
41}