use std::fmt::Display; use serde::{Deserialize, Serialize}; use crate::{settings::Setting, value::GiteratedObjectValue}; use super::{Commit, Repository, RepositoryVisibility, CommitBodyType}; // pub struct RepositorySetting(pub V); // impl + Send> GiteratedOperation // for RepositorySetting // { // fn operation_name(&self) -> &'static str { // "setting_get" // } // type Success = V; // type Failure = GetValueError; // } #[derive(Debug, Hash, Clone, PartialEq, Eq, Serialize, Deserialize)] pub struct Description(pub String); impl Display for Description { fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result { f.write_str(&self.0) } } impl GiteratedObjectValue for Description { type Object = Repository; fn value_name() -> &'static str { "description" } } impl Setting for Description { fn name() -> &'static str { "description" } } #[derive(Debug, Hash, Clone, PartialEq, Eq, Serialize, Deserialize)] #[repr(transparent)] #[serde(transparent)] pub struct Visibility(pub RepositoryVisibility); impl GiteratedObjectValue for Visibility { type Object = Repository; fn value_name() -> &'static str { "visibility" } } impl Setting for Visibility { fn name() -> &'static str { "visibility" } } #[derive(Debug, Hash, Clone, PartialEq, Eq, Serialize, Deserialize)] #[serde(transparent)] #[repr(transparent)] pub struct DefaultBranch(pub String); impl Display for DefaultBranch { fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result { f.write_str(&self.0) } } impl GiteratedObjectValue for DefaultBranch { type Object = Repository; fn value_name() -> &'static str { "default_branch" } } #[derive(Debug, Hash, Clone, PartialEq, Eq, Serialize, Deserialize)] pub struct LatestCommit(pub Option); impl GiteratedObjectValue for LatestCommit { type Object = Repository; fn value_name() -> &'static str { "latest_commit" } } impl GiteratedObjectValue for CommitBodyType { type Object = Repository; fn value_name() -> &'static str { "commit_body_type" } }