Skip to main content

ephemeris_forge_github/operation/
repository.rs

1use std::fmt;
2
3use crate::api::request::RepositoryPatch;
4
5/// One write to the repository's own settings.
6#[derive(Clone, Debug, Eq, PartialEq)]
7pub enum Operation {
8    /// Patch the changed repository fields.
9    PatchRepository(RepositoryPatch),
10    /// Replace the repository's topics.
11    ReplaceTopics(Vec<String>),
12    /// Enable or disable immutable releases.
13    SetImmutableReleases(bool),
14    /// Archive or unarchive the repository.
15    SetArchived(bool),
16}
17
18impl fmt::Display for Operation {
19    fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result {
20        match self {
21            Self::PatchRepository(_) => f.write_str("repository"),
22            Self::ReplaceTopics(_) => f.write_str("repository topics"),
23            Self::SetImmutableReleases(_) => f.write_str("repository immutable releases"),
24            Self::SetArchived(true) => f.write_str("repository archive"),
25            Self::SetArchived(false) => f.write_str("repository unarchive"),
26        }
27    }
28}