Skip to main content

mesa_dev/models/
repo.rs

1//! Repository models.
2
3use serde::{Deserialize, Serialize};
4
5/// A repository.
6#[derive(Debug, Clone, Deserialize)]
7pub struct Repo {
8    /// Unique repository identifier.
9    pub id: String,
10    /// Organization that owns this repository.
11    pub org: String,
12    /// Repository name.
13    pub name: String,
14    /// Name of the default branch.
15    pub default_branch: String,
16    /// Size in bytes.
17    pub size_bytes: u64,
18    /// Timestamp of the last push, if any.
19    pub last_push_at: Option<String>,
20    /// Creation timestamp.
21    pub created_at: String,
22}
23
24/// Request body for creating a repository.
25#[derive(Debug, Clone, Serialize)]
26pub struct CreateRepoRequest {
27    /// Repository name.
28    pub name: String,
29    /// Optional default branch name (defaults to `"main"` on the server).
30    #[serde(skip_serializing_if = "Option::is_none")]
31    pub default_branch: Option<String>,
32}
33
34/// Request body for renaming a repository.
35#[derive(Debug, Clone, Serialize)]
36pub struct RenameRepoRequest {
37    /// New repository name.
38    pub name: String,
39}
40
41/// Paginated list of repositories.
42#[derive(Debug, Clone, Deserialize)]
43pub struct ListReposResponse {
44    /// The repositories in this page.
45    pub repos: Vec<Repo>,
46    /// Cursor for the next page, if more results exist.
47    pub next_cursor: Option<String>,
48    /// Whether more results are available.
49    pub has_more: bool,
50}