mesa_dev/models/
commit.rs1use serde::{Deserialize, Serialize};
4
5#[derive(Debug, Clone, Serialize, Deserialize)]
7pub struct Author {
8 pub name: String,
10 pub email: String,
12 #[serde(skip_serializing_if = "Option::is_none")]
14 pub date: Option<String>,
15}
16
17#[derive(Debug, Clone, Serialize)]
19#[serde(rename_all = "lowercase")]
20pub enum CommitFileAction {
21 Upsert,
23 Delete,
25}
26
27#[derive(Debug, Clone, Serialize)]
29pub struct CommitFile {
30 pub action: CommitFileAction,
32 pub path: String,
34 #[serde(skip_serializing_if = "Option::is_none")]
36 pub content: Option<String>,
37}
38
39#[derive(Debug, Clone, Serialize)]
41pub struct CreateCommitRequest {
42 pub branch: String,
44 pub message: String,
46 pub author: Author,
48 pub files: Vec<CommitFile>,
50 #[serde(skip_serializing_if = "Option::is_none")]
52 pub base_sha: Option<String>,
53}
54
55#[derive(Debug, Clone, Deserialize)]
57pub struct CommitSummary {
58 pub sha: String,
60 pub message: String,
62}
63
64#[derive(Debug, Clone, Deserialize)]
66pub struct Commit {
67 pub sha: String,
69 pub message: String,
71 pub author: Author,
73 pub committer: Author,
75}
76
77#[derive(Debug, Clone, Deserialize)]
79pub struct ListCommitsResponse {
80 pub commits: Vec<CommitSummary>,
82 pub next_cursor: Option<String>,
84 pub has_more: bool,
86}