From d1e5fd27ca024a65784016366912d02895f9040b Mon Sep 17 00:00:00 2001 From: RobWalt Date: Sun, 22 Oct 2023 11:22:52 +0200 Subject: [PATCH] feat: implement RepositoryMeta --- src/types/api/repo_meta.rs | 31 ++++++++++++++++++++++--------- 1 file changed, 22 insertions(+), 9 deletions(-) diff --git a/src/types/api/repo_meta.rs b/src/types/api/repo_meta.rs index 2495cbf..1c4b935 100644 --- a/src/types/api/repo_meta.rs +++ b/src/types/api/repo_meta.rs @@ -1,9 +1,22 @@ -// RepositoryMeta{ -// description: -// RepositoryMeta basic repository information -// -// full_name string -// id integer($int64) -// name string -// owner string -// } +use std::fmt::Display; + +use serde::{Deserialize, Serialize}; + +/// Represents basic repository information. +#[derive(Debug, Clone, Serialize, Deserialize, PartialEq)] +pub struct RepositoryMeta { + /// The full name of the repository. + pub full_name: String, + /// The unique identifier of the repository. + pub id: usize, + /// The name of the repository. + pub name: String, + /// The owner of the repository. + pub owner: String, +} + +impl Display for RepositoryMeta { + fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result { + write!(f, "{}", self.full_name) + } +}