Skip to main content

ephemeris_forge_github/api/operations/
repository.rs

1use ephemeris_forge::RepoRef;
2
3use crate::api::error::ForgeError;
4use crate::api::model::{ImmutableReleases, Repository};
5use crate::api::request::RepositoryPatch;
6
7/// The repository operations of the GitHub API.
8pub trait RepositoryApi {
9    /// Read the immutable-release setting. `None` means GitHub does not offer
10    /// it for this repository.
11    fn immutable_releases(
12        &self,
13        repository: &RepoRef,
14    ) -> impl Future<Output = Result<Option<ImmutableReleases>, ForgeError>> + Send;
15
16    /// Write only the changed repository fields.
17    fn patch_repository(
18        &self,
19        repository: &RepoRef,
20        patch: &RepositoryPatch,
21    ) -> impl Future<Output = Result<(), ForgeError>> + Send;
22
23    /// Replace the repository's topic labels wholesale.
24    fn replace_topics(
25        &self,
26        repository: &RepoRef,
27        topics: &[String],
28    ) -> impl Future<Output = Result<(), ForgeError>> + Send;
29
30    /// Read the repository's current settings.
31    fn repository(
32        &self,
33        repository: &RepoRef,
34    ) -> impl Future<Output = Result<Repository, ForgeError>> + Send;
35
36    /// Enable or disable immutable releases.
37    fn set_immutable_releases(
38        &self,
39        repository: &RepoRef,
40        enabled: bool,
41    ) -> impl Future<Output = Result<(), ForgeError>> + Send;
42}