Skip to main content

ephemeris_forge_forgejo/operation/
actions_variables.rs

1use std::fmt;
2
3use crate::api::request::{CreateVariableOption, UpdateVariableOption};
4
5/// One write to the repository's Actions variables.
6#[derive(Clone, Debug, Eq, PartialEq)]
7pub enum Operation {
8    /// Create a variable.
9    Create {
10        /// The variable's name, in upper case.
11        name: String,
12        /// The request body.
13        body: CreateVariableOption,
14    },
15    /// Change the value of a variable.
16    Update {
17        /// The variable's name, in upper case.
18        name: String,
19        /// The request body.
20        body: UpdateVariableOption,
21    },
22    /// Delete a variable.
23    Delete {
24        /// The variable's name.
25        name: String,
26    },
27}
28
29impl fmt::Display for Operation {
30    fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result {
31        match self {
32            Self::Create { name, body: _ }
33            | Self::Update { name, body: _ }
34            | Self::Delete { name } => write!(f, "actions variable {name}"),
35        }
36    }
37}