use std::hash::Hash;
use derive_builder::Builder;
use serde::{Deserialize, Serialize};
#[allow(unused)]
#[derive(Debug)]
pub struct PullRequest {
pub number: u64,
pub sha: String,
pub body: String,
}
#[derive(Debug, PartialEq)]
pub struct GetFileContentRequest {
pub branch: Option<String>,
pub path: String,
}
#[derive(Debug)]
pub struct GetPrRequest {
pub head_branch: String,
pub base_branch: String,
}
#[derive(Debug)]
pub struct CreatePrRequest {
pub head_branch: String,
pub base_branch: String,
pub title: String,
pub body: String,
}
#[derive(Debug)]
pub struct UpdatePrRequest {
pub pr_number: u64,
pub title: String,
pub body: String,
}
#[derive(Debug, Default, Serialize)]
pub struct ReleaseByTagResponse {
pub tag: String,
pub sha: String,
pub notes: String,
}
#[derive(Debug)]
pub struct PrLabelsRequest {
pub pr_number: u64,
pub labels: Vec<String>,
}
#[derive(Debug, Clone, Default, Eq, Builder)]
#[builder(setter(into, strip_option), default)]
pub struct ForgeCommit {
pub id: String,
pub short_id: String,
pub link: String,
pub author_name: String,
pub author_email: String,
pub merge_commit: bool,
pub message: String,
pub timestamp: i64,
pub files: Vec<String>,
}
impl PartialEq for ForgeCommit {
fn eq(&self, other: &Self) -> bool {
self.id == other.id
}
}
impl Hash for ForgeCommit {
fn hash<H: std::hash::Hasher>(&self, state: &mut H) {
self.id.hash(state);
}
}
#[allow(unused)]
#[derive(Debug, Copy, Clone, Serialize, PartialEq)]
pub enum FileUpdateType {
Replace,
Prepend,
}
#[derive(Debug, Clone, Serialize)]
pub struct FileChange {
pub path: String,
pub content: String,
pub update_type: FileUpdateType,
}
#[derive(Debug)]
pub struct CreateReleaseBranchRequest {
pub base_branch: String,
pub release_branch: String,
pub message: String,
pub file_changes: Vec<FileChange>,
}
#[derive(Debug)]
pub struct CreateCommitRequest {
pub target_branch: String,
pub message: String,
pub file_changes: Vec<FileChange>,
}
#[derive(Debug, Deserialize)]
pub struct Commit {
pub sha: String,
}