From 7938d81544efa9159646dc10bd9b7699b438c983 Mon Sep 17 00:00:00 2001 From: Cyborus Date: Fri, 9 Feb 2024 23:28:23 -0500 Subject: [PATCH] split generation into method and struct files --- generator/src/main.rs | 30 +- generator/src/methods.rs | 2 + generator/src/structs.rs | 3 - src/{generated.rs => generated/methods.rs} | 6026 +------------------- src/generated/mod.rs | 2 + src/generated/structs.rs | 6021 +++++++++++++++++++ 6 files changed, 6046 insertions(+), 6038 deletions(-) rename src/{generated.rs => generated/methods.rs} (52%) create mode 100644 src/generated/mod.rs create mode 100644 src/generated/structs.rs diff --git a/generator/src/main.rs b/generator/src/main.rs index 3c384c3..986c21f 100644 --- a/generator/src/main.rs +++ b/generator/src/main.rs @@ -1,4 +1,4 @@ -use std::ffi::{OsStr, OsString}; +use std::{ffi::OsString, path::PathBuf}; mod methods; mod openapi; @@ -9,10 +9,12 @@ use openapi::*; fn main() -> eyre::Result<()> { let spec = get_spec()?; - let mut s = String::new(); - s.push_str(&methods::create_methods(&spec)?); - s.push_str(&structs::create_structs(&spec)?); - save_generated(&s)?; + let files = [ + ("mod.rs".into(), "pub mod structs;\npub mod methods;".into()), + ("methods.rs".into(), methods::create_methods(&spec)?), + ("structs.rs".into(), structs::create_structs(&spec)?), + ]; + save_generated(&files)?; Ok(()) } @@ -25,15 +27,21 @@ fn get_spec() -> eyre::Result { Ok(spec) } -fn save_generated(contents: &str) -> eyre::Result<()> { - let path = std::env::var_os("FORGEJO_API_GENERATED_PATH") - .unwrap_or_else(|| OsString::from("./src/generated.rs")); - std::fs::write(path.as_os_str(), contents)?; - run_rustfmt_on(path.as_os_str()); +fn save_generated(files: &[(String, String)]) -> eyre::Result<()> { + let root_path = PathBuf::from( + std::env::var_os("FORGEJO_API_GENERATED_PATH") + .unwrap_or_else(|| OsString::from("./src/generated/")), + ); + for (path, file) in files { + let path = root_path.join(path); + std::fs::create_dir_all(path.parent().ok_or_else(|| eyre::eyre!("no parent dir"))?)?; + std::fs::write(&path, file)?; + run_rustfmt_on(&path); + } Ok(()) } -fn run_rustfmt_on(path: &OsStr) { +fn run_rustfmt_on(path: &std::path::Path) { let mut rustfmt = std::process::Command::new("rustfmt"); rustfmt.arg(path); diff --git a/generator/src/methods.rs b/generator/src/methods.rs index 70ebe99..c0f614c 100644 --- a/generator/src/methods.rs +++ b/generator/src/methods.rs @@ -6,6 +6,8 @@ use std::fmt::Write; pub fn create_methods(spec: &OpenApiV2) -> eyre::Result { let mut s = String::new(); s.push_str("use crate::ForgejoError;\n"); + s.push_str("use super::structs::*;\n"); + s.push_str("\n"); s.push_str("impl crate::Forgejo {\n"); for (path, item) in &spec.paths { s.push_str(&create_methods_for_path(&spec, path, item).wrap_err_with(|| path.clone())?); diff --git a/generator/src/structs.rs b/generator/src/structs.rs index 84655e9..04d3039 100644 --- a/generator/src/structs.rs +++ b/generator/src/structs.rs @@ -5,8 +5,6 @@ use std::fmt::Write; pub fn create_structs(spec: &OpenApiV2) -> eyre::Result { let mut s = String::new(); - s.push_str("use structs::*;\n"); - s.push_str("pub mod structs {\n"); s.push_str("use crate::StructureError;"); if let Some(definitions) = &spec.definitions { for (name, schema) in definitions { @@ -32,7 +30,6 @@ pub fn create_structs(spec: &OpenApiV2) -> eyre::Result { let strukt = create_response_structs(spec, item)?; s.push_str(&strukt); } - s.push_str("\n}"); Ok(s) } diff --git a/src/generated.rs b/src/generated/methods.rs similarity index 52% rename from src/generated.rs rename to src/generated/methods.rs index a1475a5..45a1a2c 100644 --- a/src/generated.rs +++ b/src/generated/methods.rs @@ -1,4 +1,6 @@ +use super::structs::*; use crate::ForgejoError; + impl crate::Forgejo { /// Returns the Person actor for a user /// @@ -7221,6027 +7223,3 @@ impl crate::Forgejo { } } } -use structs::*; -pub mod structs { - use crate::StructureError; - /// APIError is an api error with a message - #[derive(Debug, Clone, PartialEq, serde::Serialize, serde::Deserialize)] - pub struct APIError { - pub message: Option, - #[serde(deserialize_with = "crate::none_if_blank_url")] - pub url: Option, - } - - #[derive(Debug, Clone, PartialEq, serde::Serialize, serde::Deserialize)] - pub struct AccessToken { - pub id: Option, - pub name: Option, - pub scopes: Option>, - pub sha1: Option, - pub token_last_eight: Option, - } - - #[derive(Debug, Clone, PartialEq, serde::Serialize, serde::Deserialize)] - pub struct Activity { - pub act_user: Option, - pub act_user_id: Option, - pub comment: Option, - pub comment_id: Option, - pub content: Option, - #[serde(with = "time::serde::rfc3339::option")] - pub created: Option, - pub id: Option, - pub is_private: Option, - pub op_type: Option, - pub ref_name: Option, - pub repo: Option, - pub repo_id: Option, - pub user_id: Option, - } - - /// ActivityPub type - #[derive(Debug, Clone, PartialEq, serde::Serialize, serde::Deserialize)] - pub struct ActivityPub { - #[serde(rename = "@context")] - pub context: Option, - } - - /// AddCollaboratorOption options when adding a user as a collaborator of a repository - #[derive(Debug, Clone, PartialEq, serde::Serialize, serde::Deserialize)] - pub struct AddCollaboratorOption { - pub permission: Option, - } - - /// AddTimeOption options for adding time to an issue - #[derive(Debug, Clone, PartialEq, serde::Serialize, serde::Deserialize)] - pub struct AddTimeOption { - #[serde(with = "time::serde::rfc3339::option")] - pub created: Option, - /// time in seconds - pub time: u64, - /// User who spent the time (optional) - pub user_name: Option, - } - - /// AnnotatedTag represents an annotated tag - #[derive(Debug, Clone, PartialEq, serde::Serialize, serde::Deserialize)] - pub struct AnnotatedTag { - pub message: Option, - pub object: Option, - pub sha: Option, - pub tag: Option, - pub tagger: Option, - #[serde(deserialize_with = "crate::none_if_blank_url")] - pub url: Option, - pub verification: Option, - } - - /// AnnotatedTagObject contains meta information of the tag object - #[derive(Debug, Clone, PartialEq, serde::Serialize, serde::Deserialize)] - pub struct AnnotatedTagObject { - pub sha: Option, - #[serde(rename = "type")] - pub r#type: Option, - #[serde(deserialize_with = "crate::none_if_blank_url")] - pub url: Option, - } - - /// Attachment a generic attachment - #[derive(Debug, Clone, PartialEq, serde::Serialize, serde::Deserialize)] - pub struct Attachment { - #[serde(deserialize_with = "crate::none_if_blank_url")] - pub browser_download_url: Option, - #[serde(with = "time::serde::rfc3339::option")] - pub created_at: Option, - pub download_count: Option, - pub id: Option, - pub name: Option, - pub size: Option, - pub uuid: Option, - } - - #[derive(Debug, Clone, PartialEq, serde::Serialize, serde::Deserialize)] - pub struct BlockedUser { - pub block_id: Option, - #[serde(with = "time::serde::rfc3339::option")] - pub created_at: Option, - } - - /// Branch represents a repository branch - #[derive(Debug, Clone, PartialEq, serde::Serialize, serde::Deserialize)] - pub struct Branch { - pub commit: Option, - pub effective_branch_protection_name: Option, - pub enable_status_check: Option, - pub name: Option, - pub protected: Option, - pub required_approvals: Option, - pub status_check_contexts: Option>, - pub user_can_merge: Option, - pub user_can_push: Option, - } - - /// BranchProtection represents a branch protection for a repository - #[derive(Debug, Clone, PartialEq, serde::Serialize, serde::Deserialize)] - pub struct BranchProtection { - pub approvals_whitelist_teams: Option>, - pub approvals_whitelist_username: Option>, - pub block_on_official_review_requests: Option, - pub block_on_outdated_branch: Option, - pub block_on_rejected_reviews: Option, - /// Deprecated: true - pub branch_name: Option, - #[serde(with = "time::serde::rfc3339::option")] - pub created_at: Option, - pub dismiss_stale_approvals: Option, - pub enable_approvals_whitelist: Option, - pub enable_merge_whitelist: Option, - pub enable_push: Option, - pub enable_push_whitelist: Option, - pub enable_status_check: Option, - pub merge_whitelist_teams: Option>, - pub merge_whitelist_usernames: Option>, - pub protected_file_patterns: Option, - pub push_whitelist_deploy_keys: Option, - pub push_whitelist_teams: Option>, - pub push_whitelist_usernames: Option>, - pub require_signed_commits: Option, - pub required_approvals: Option, - pub rule_name: Option, - pub status_check_contexts: Option>, - pub unprotected_file_patterns: Option, - #[serde(with = "time::serde::rfc3339::option")] - pub updated_at: Option, - } - - /// ChangeFileOperation for creating, updating or deleting a file - #[derive(Debug, Clone, PartialEq, serde::Serialize, serde::Deserialize)] - pub struct ChangeFileOperation { - /// new or updated file content, must be base64 encoded - pub content: Option, - /// old path of the file to move - pub from_path: Option, - /// indicates what to do with the file - pub operation: ChangeFileOperationOperation, - /// path to the existing or new file - pub path: String, - /// sha is the SHA for the file that already exists, required for update or delete - pub sha: Option, - } - - /// indicates what to do with the file - - #[derive(Debug, Clone, PartialEq, serde::Serialize, serde::Deserialize)] - pub enum ChangeFileOperationOperation { - Create, - Update, - Delete, - } - - impl ChangeFileOperationOperation { - fn as_str(&self) -> &'static str { - match self { - ChangeFileOperationOperation::Create => "create", - ChangeFileOperationOperation::Update => "update", - ChangeFileOperationOperation::Delete => "delete", - } - } - } - /// ChangeFilesOptions options for creating, updating or deleting multiple files - /// - /// Note: `author` and `committer` are optional (if only one is given, it will be used for the other, otherwise the authenticated user will be used) - #[derive(Debug, Clone, PartialEq, serde::Serialize, serde::Deserialize)] - pub struct ChangeFilesOptions { - pub author: Option, - /// branch (optional) to base this file from. if not given, the default branch is used - pub branch: Option, - pub committer: Option, - pub dates: Option, - /// list of file operations - pub files: Vec, - /// message (optional) for the commit of this file. if not supplied, a default message will be used - pub message: Option, - /// new_branch (optional) will make a new branch from `branch` before creating the file - pub new_branch: Option, - /// Add a Signed-off-by trailer by the committer at the end of the commit log message. - pub signoff: Option, - } - - /// ChangedFile store information about files affected by the pull request - #[derive(Debug, Clone, PartialEq, serde::Serialize, serde::Deserialize)] - pub struct ChangedFile { - pub additions: Option, - pub changes: Option, - #[serde(deserialize_with = "crate::none_if_blank_url")] - pub contents_url: Option, - pub deletions: Option, - pub filename: Option, - #[serde(deserialize_with = "crate::none_if_blank_url")] - pub html_url: Option, - pub previous_filename: Option, - #[serde(deserialize_with = "crate::none_if_blank_url")] - pub raw_url: Option, - pub status: Option, - } - - /// CombinedStatus holds the combined state of several statuses for a single commit - #[derive(Debug, Clone, PartialEq, serde::Serialize, serde::Deserialize)] - pub struct CombinedStatus { - #[serde(deserialize_with = "crate::none_if_blank_url")] - pub commit_url: Option, - pub repository: Option, - pub sha: Option, - pub state: Option, - pub statuses: Option>, - pub total_count: Option, - #[serde(deserialize_with = "crate::none_if_blank_url")] - pub url: Option, - } - - /// Comment represents a comment on a commit or issue - #[derive(Debug, Clone, PartialEq, serde::Serialize, serde::Deserialize)] - pub struct Comment { - pub assets: Option>, - pub body: Option, - #[serde(with = "time::serde::rfc3339::option")] - pub created_at: Option, - #[serde(deserialize_with = "crate::none_if_blank_url")] - pub html_url: Option, - pub id: Option, - #[serde(deserialize_with = "crate::none_if_blank_url")] - pub issue_url: Option, - pub original_author: Option, - pub original_author_id: Option, - #[serde(deserialize_with = "crate::none_if_blank_url")] - pub pull_request_url: Option, - #[serde(with = "time::serde::rfc3339::option")] - pub updated_at: Option, - pub user: Option, - } - - #[derive(Debug, Clone, PartialEq, serde::Serialize, serde::Deserialize)] - pub struct Commit { - pub author: Option, - pub commit: Option, - pub committer: Option, - #[serde(with = "time::serde::rfc3339::option")] - pub created: Option, - pub files: Option>, - #[serde(deserialize_with = "crate::none_if_blank_url")] - pub html_url: Option, - pub parents: Option>, - pub sha: Option, - pub stats: Option, - #[serde(deserialize_with = "crate::none_if_blank_url")] - pub url: Option, - } - - /// CommitAffectedFiles store information about files affected by the commit - #[derive(Debug, Clone, PartialEq, serde::Serialize, serde::Deserialize)] - pub struct CommitAffectedFiles { - pub filename: Option, - pub status: Option, - } - - /// CommitDateOptions store dates for GIT_AUTHOR_DATE and GIT_COMMITTER_DATE - #[derive(Debug, Clone, PartialEq, serde::Serialize, serde::Deserialize)] - pub struct CommitDateOptions { - #[serde(with = "time::serde::rfc3339::option")] - pub author: Option, - #[serde(with = "time::serde::rfc3339::option")] - pub committer: Option, - } - - #[derive(Debug, Clone, PartialEq, serde::Serialize, serde::Deserialize)] - pub struct CommitMeta { - #[serde(with = "time::serde::rfc3339::option")] - pub created: Option, - pub sha: Option, - #[serde(deserialize_with = "crate::none_if_blank_url")] - pub url: Option, - } - - /// CommitStats is statistics for a RepoCommit - #[derive(Debug, Clone, PartialEq, serde::Serialize, serde::Deserialize)] - pub struct CommitStats { - pub additions: Option, - pub deletions: Option, - pub total: Option, - } - - /// CommitStatus holds a single status of a single Commit - #[derive(Debug, Clone, PartialEq, serde::Serialize, serde::Deserialize)] - pub struct CommitStatus { - pub context: Option, - #[serde(with = "time::serde::rfc3339::option")] - pub created_at: Option, - pub creator: Option, - pub description: Option, - pub id: Option, - pub status: Option, - #[serde(deserialize_with = "crate::none_if_blank_url")] - pub target_url: Option, - #[serde(with = "time::serde::rfc3339::option")] - pub updated_at: Option, - #[serde(deserialize_with = "crate::none_if_blank_url")] - pub url: Option, - } - - /// CommitStatusState holds the state of a CommitStatus - /// - /// It can be "pending", "success", "error" and "failure" - #[derive(Debug, Clone, PartialEq, serde::Serialize, serde::Deserialize)] - pub struct CommitStatusState {} - - #[derive(Debug, Clone, PartialEq, serde::Serialize, serde::Deserialize)] - pub struct CommitUser { - pub date: Option, - pub email: Option, - pub name: Option, - } - - /// ContentsResponse contains information about a repo's entry's (dir, file, symlink, submodule) metadata and content - #[derive(Debug, Clone, PartialEq, serde::Serialize, serde::Deserialize)] - pub struct ContentsResponse { - #[serde(rename = "_links")] - pub links: Option, - /// `content` is populated when `type` is `file`, otherwise null - pub content: Option, - #[serde(deserialize_with = "crate::none_if_blank_url")] - pub download_url: Option, - /// `encoding` is populated when `type` is `file`, otherwise null - pub encoding: Option, - #[serde(deserialize_with = "crate::none_if_blank_url")] - pub git_url: Option, - #[serde(deserialize_with = "crate::none_if_blank_url")] - pub html_url: Option, - pub last_commit_sha: Option, - pub name: Option, - pub path: Option, - pub sha: Option, - pub size: Option, - #[serde(deserialize_with = "crate::none_if_blank_url")] - /// `submodule_git_url` is populated when `type` is `submodule`, otherwise null - pub submodule_git_url: Option, - /// `target` is populated when `type` is `symlink`, otherwise null - pub target: Option, - /// `type` will be `file`, `dir`, `symlink`, or `submodule` - #[serde(rename = "type")] - pub r#type: Option, - #[serde(deserialize_with = "crate::none_if_blank_url")] - pub url: Option, - } - - /// CreateAccessTokenOption options when create access token - #[derive(Debug, Clone, PartialEq, serde::Serialize, serde::Deserialize)] - pub struct CreateAccessTokenOption { - pub name: String, - pub scopes: Option>, - } - - /// CreateBranchProtectionOption options for creating a branch protection - #[derive(Debug, Clone, PartialEq, serde::Serialize, serde::Deserialize)] - pub struct CreateBranchProtectionOption { - pub approvals_whitelist_teams: Option>, - pub approvals_whitelist_username: Option>, - pub block_on_official_review_requests: Option, - pub block_on_outdated_branch: Option, - pub block_on_rejected_reviews: Option, - /// Deprecated: true - pub branch_name: Option, - pub dismiss_stale_approvals: Option, - pub enable_approvals_whitelist: Option, - pub enable_merge_whitelist: Option, - pub enable_push: Option, - pub enable_push_whitelist: Option, - pub enable_status_check: Option, - pub merge_whitelist_teams: Option>, - pub merge_whitelist_usernames: Option>, - pub protected_file_patterns: Option, - pub push_whitelist_deploy_keys: Option, - pub push_whitelist_teams: Option>, - pub push_whitelist_usernames: Option>, - pub require_signed_commits: Option, - pub required_approvals: Option, - pub rule_name: Option, - pub status_check_contexts: Option>, - pub unprotected_file_patterns: Option, - } - - /// CreateBranchRepoOption options when creating a branch in a repository - #[derive(Debug, Clone, PartialEq, serde::Serialize, serde::Deserialize)] - pub struct CreateBranchRepoOption { - /// Name of the branch to create - pub new_branch_name: String, - /// Deprecated: true - /// - /// Name of the old branch to create from - pub old_branch_name: Option, - /// Name of the old branch/tag/commit to create from - pub old_ref_name: Option, - } - - /// CreateEmailOption options when creating email addresses - #[derive(Debug, Clone, PartialEq, serde::Serialize, serde::Deserialize)] - pub struct CreateEmailOption { - /// email addresses to add - pub emails: Option>, - } - - /// CreateFileOptions options for creating files - /// - /// Note: `author` and `committer` are optional (if only one is given, it will be used for the other, otherwise the authenticated user will be used) - #[derive(Debug, Clone, PartialEq, serde::Serialize, serde::Deserialize)] - pub struct CreateFileOptions { - pub author: Option, - /// branch (optional) to base this file from. if not given, the default branch is used - pub branch: Option, - pub committer: Option, - /// content must be base64 encoded - pub content: String, - pub dates: Option, - /// message (optional) for the commit of this file. if not supplied, a default message will be used - pub message: Option, - /// new_branch (optional) will make a new branch from `branch` before creating the file - pub new_branch: Option, - /// Add a Signed-off-by trailer by the committer at the end of the commit log message. - pub signoff: Option, - } - - /// CreateForkOption options for creating a fork - #[derive(Debug, Clone, PartialEq, serde::Serialize, serde::Deserialize)] - pub struct CreateForkOption { - /// name of the forked repository - pub name: Option, - /// organization name, if forking into an organization - pub organization: Option, - } - - /// CreateGPGKeyOption options create user GPG key - #[derive(Debug, Clone, PartialEq, serde::Serialize, serde::Deserialize)] - pub struct CreateGPGKeyOption { - /// An armored GPG key to add - pub armored_public_key: String, - pub armored_signature: Option, - } - - /// CreateHookOption options when create a hook - #[derive(Debug, Clone, PartialEq, serde::Serialize, serde::Deserialize)] - pub struct CreateHookOption { - pub active: Option, - pub authorization_header: Option, - pub branch_filter: Option, - pub config: CreateHookOptionConfig, - pub events: Option>, - #[serde(rename = "type")] - pub r#type: CreateHookOptionType, - } - - #[derive(Debug, Clone, PartialEq, serde::Serialize, serde::Deserialize)] - pub enum CreateHookOptionType { - Forgejo, - Dingtalk, - Discord, - Gitea, - Gogs, - Msteams, - Slack, - Telegram, - Feishu, - Wechatwork, - Packagist, - } - - impl CreateHookOptionType { - fn as_str(&self) -> &'static str { - match self { - CreateHookOptionType::Forgejo => "forgejo", - CreateHookOptionType::Dingtalk => "dingtalk", - CreateHookOptionType::Discord => "discord", - CreateHookOptionType::Gitea => "gitea", - CreateHookOptionType::Gogs => "gogs", - CreateHookOptionType::Msteams => "msteams", - CreateHookOptionType::Slack => "slack", - CreateHookOptionType::Telegram => "telegram", - CreateHookOptionType::Feishu => "feishu", - CreateHookOptionType::Wechatwork => "wechatwork", - CreateHookOptionType::Packagist => "packagist", - } - } - } - /// CreateHookOptionConfig has all config options in it - /// - /// required are "content_type" and "url" Required - #[derive(Debug, Clone, PartialEq, serde::Serialize, serde::Deserialize)] - pub struct CreateHookOptionConfig { - #[serde(flatten)] - pub additional: std::collections::BTreeMap, - } - - /// CreateIssueCommentOption options for creating a comment on an issue - #[derive(Debug, Clone, PartialEq, serde::Serialize, serde::Deserialize)] - pub struct CreateIssueCommentOption { - pub body: String, - #[serde(with = "time::serde::rfc3339::option")] - pub updated_at: Option, - } - - /// CreateIssueOption options to create one issue - #[derive(Debug, Clone, PartialEq, serde::Serialize, serde::Deserialize)] - pub struct CreateIssueOption { - /// deprecated - pub assignee: Option, - pub assignees: Option>, - pub body: Option, - pub closed: Option, - #[serde(with = "time::serde::rfc3339::option")] - pub due_date: Option, - /// list of label ids - pub labels: Option>, - /// milestone id - pub milestone: Option, - #[serde(rename = "ref")] - pub r#ref: Option, - pub title: String, - } - - /// CreateKeyOption options when creating a key - #[derive(Debug, Clone, PartialEq, serde::Serialize, serde::Deserialize)] - pub struct CreateKeyOption { - /// An armored SSH key to add - pub key: String, - /// Describe if the key has only read access or read/write - pub read_only: Option, - /// Title of the key to add - pub title: String, - } - - /// CreateLabelOption options for creating a label - #[derive(Debug, Clone, PartialEq, serde::Serialize, serde::Deserialize)] - pub struct CreateLabelOption { - pub color: String, - pub description: Option, - pub exclusive: Option, - pub is_archived: Option, - pub name: String, - } - - /// CreateMilestoneOption options for creating a milestone - #[derive(Debug, Clone, PartialEq, serde::Serialize, serde::Deserialize)] - pub struct CreateMilestoneOption { - pub description: Option, - #[serde(with = "time::serde::rfc3339::option")] - pub due_on: Option, - pub state: Option, - pub title: Option, - } - - #[derive(Debug, Clone, PartialEq, serde::Serialize, serde::Deserialize)] - pub enum CreateMilestoneOptionState { - Open, - Closed, - } - - impl CreateMilestoneOptionState { - fn as_str(&self) -> &'static str { - match self { - CreateMilestoneOptionState::Open => "open", - CreateMilestoneOptionState::Closed => "closed", - } - } - } - /// CreateOAuth2ApplicationOptions holds options to create an oauth2 application - #[derive(Debug, Clone, PartialEq, serde::Serialize, serde::Deserialize)] - pub struct CreateOAuth2ApplicationOptions { - pub confidential_client: Option, - pub name: Option, - pub redirect_uris: Option>, - } - - /// CreateOrUpdateSecretOption options when creating or updating secret - #[derive(Debug, Clone, PartialEq, serde::Serialize, serde::Deserialize)] - pub struct CreateOrUpdateSecretOption { - /// Data of the secret to update - pub data: String, - } - - /// CreateOrgOption options for creating an organization - #[derive(Debug, Clone, PartialEq, serde::Serialize, serde::Deserialize)] - pub struct CreateOrgOption { - pub description: Option, - pub email: Option, - pub full_name: Option, - pub location: Option, - pub repo_admin_change_team_access: Option, - pub username: String, - /// possible values are `public` (default), `limited` or `private` - pub visibility: Option, - pub website: Option, - } - - /// possible values are `public` (default), `limited` or `private` - - #[derive(Debug, Clone, PartialEq, serde::Serialize, serde::Deserialize)] - pub enum CreateOrgOptionVisibility { - Public, - Limited, - Private, - } - - impl CreateOrgOptionVisibility { - fn as_str(&self) -> &'static str { - match self { - CreateOrgOptionVisibility::Public => "public", - CreateOrgOptionVisibility::Limited => "limited", - CreateOrgOptionVisibility::Private => "private", - } - } - } - /// CreatePullRequestOption options when creating a pull request - #[derive(Debug, Clone, PartialEq, serde::Serialize, serde::Deserialize)] - pub struct CreatePullRequestOption { - pub assignee: Option, - pub assignees: Option>, - pub base: Option, - pub body: Option, - #[serde(with = "time::serde::rfc3339::option")] - pub due_date: Option, - pub head: Option, - pub labels: Option>, - pub milestone: Option, - pub title: Option, - } - - /// CreatePullReviewComment represent a review comment for creation api - #[derive(Debug, Clone, PartialEq, serde::Serialize, serde::Deserialize)] - pub struct CreatePullReviewComment { - pub body: Option, - /// if comment to new file line or 0 - pub new_position: Option, - /// if comment to old file line or 0 - pub old_position: Option, - /// the tree path - pub path: Option, - } - - /// CreatePullReviewOptions are options to create a pull review - #[derive(Debug, Clone, PartialEq, serde::Serialize, serde::Deserialize)] - pub struct CreatePullReviewOptions { - pub body: Option, - pub comments: Option>, - pub commit_id: Option, - pub event: Option, - } - - #[derive(Debug, Clone, PartialEq, serde::Serialize, serde::Deserialize)] - pub struct CreatePushMirrorOption { - pub interval: Option, - pub remote_address: Option, - pub remote_password: Option, - pub remote_username: Option, - pub sync_on_commit: Option, - } - - /// CreateReleaseOption options when creating a release - #[derive(Debug, Clone, PartialEq, serde::Serialize, serde::Deserialize)] - pub struct CreateReleaseOption { - pub body: Option, - pub draft: Option, - pub name: Option, - pub prerelease: Option, - pub tag_name: String, - pub target_commitish: Option, - } - - /// CreateRepoOption options when creating repository - #[derive(Debug, Clone, PartialEq, serde::Serialize, serde::Deserialize)] - pub struct CreateRepoOption { - /// Whether the repository should be auto-initialized? - pub auto_init: Option, - /// DefaultBranch of the repository (used when initializes and in template) - pub default_branch: Option, - /// Description of the repository to create - pub description: Option, - /// Gitignores to use - pub gitignores: Option, - /// Label-Set to use - pub issue_labels: Option, - /// License to use - pub license: Option, - /// Name of the repository to create - pub name: String, - /// Whether the repository is private - pub private: Option, - /// Readme of the repository to create - pub readme: Option, - /// Whether the repository is template - pub template: Option, - /// TrustModel of the repository - pub trust_model: Option, - } - - /// TrustModel of the repository - - #[derive(Debug, Clone, PartialEq, serde::Serialize, serde::Deserialize)] - pub enum CreateRepoOptionTrustModel { - Default, - Collaborator, - Committer, - Collaboratorcommitter, - } - - impl CreateRepoOptionTrustModel { - fn as_str(&self) -> &'static str { - match self { - CreateRepoOptionTrustModel::Default => "default", - CreateRepoOptionTrustModel::Collaborator => "collaborator", - CreateRepoOptionTrustModel::Committer => "committer", - CreateRepoOptionTrustModel::Collaboratorcommitter => "collaboratorcommitter", - } - } - } - /// CreateStatusOption holds the information needed to create a new CommitStatus for a Commit - #[derive(Debug, Clone, PartialEq, serde::Serialize, serde::Deserialize)] - pub struct CreateStatusOption { - pub context: Option, - pub description: Option, - pub state: Option, - #[serde(deserialize_with = "crate::none_if_blank_url")] - pub target_url: Option, - } - - /// CreateTagOption options when creating a tag - #[derive(Debug, Clone, PartialEq, serde::Serialize, serde::Deserialize)] - pub struct CreateTagOption { - pub message: Option, - pub tag_name: String, - pub target: Option, - } - - /// CreateTeamOption options for creating a team - #[derive(Debug, Clone, PartialEq, serde::Serialize, serde::Deserialize)] - pub struct CreateTeamOption { - pub can_create_org_repo: Option, - pub description: Option, - pub includes_all_repositories: Option, - pub name: String, - pub permission: Option, - pub units: Option>, - pub units_map: Option, - } - - #[derive(Debug, Clone, PartialEq, serde::Serialize, serde::Deserialize)] - pub enum CreateTeamOptionPermission { - Read, - Write, - Admin, - } - - impl CreateTeamOptionPermission { - fn as_str(&self) -> &'static str { - match self { - CreateTeamOptionPermission::Read => "read", - CreateTeamOptionPermission::Write => "write", - CreateTeamOptionPermission::Admin => "admin", - } - } - } - #[derive(Debug, Clone, PartialEq, serde::Serialize, serde::Deserialize)] - pub struct CreateTeamOptionUnitsMap { - #[serde(flatten)] - pub additional: std::collections::BTreeMap, - } - - /// CreateUserOption create user options - #[derive(Debug, Clone, PartialEq, serde::Serialize, serde::Deserialize)] - pub struct CreateUserOption { - #[serde(with = "time::serde::rfc3339::option")] - /// For explicitly setting the user creation timestamp. Useful when users are - /// - /// migrated from other systems. When omitted, the user's creation timestamp - /// - /// will be set to "now". - pub created_at: Option, - pub email: String, - pub full_name: Option, - pub login_name: Option, - pub must_change_password: Option, - pub password: Option, - pub restricted: Option, - pub send_notify: Option, - pub source_id: Option, - pub username: String, - pub visibility: Option, - } - - /// CreateWikiPageOptions form for creating wiki - #[derive(Debug, Clone, PartialEq, serde::Serialize, serde::Deserialize)] - pub struct CreateWikiPageOptions { - /// content must be base64 encoded - pub content_base64: Option, - /// optional commit message summarizing the change - pub message: Option, - /// page title. leave empty to keep unchanged - pub title: Option, - } - - /// Cron represents a Cron task - #[derive(Debug, Clone, PartialEq, serde::Serialize, serde::Deserialize)] - pub struct Cron { - pub exec_times: Option, - pub name: Option, - #[serde(with = "time::serde::rfc3339::option")] - pub next: Option, - #[serde(with = "time::serde::rfc3339::option")] - pub prev: Option, - pub schedule: Option, - } - - /// DeleteEmailOption options when deleting email addresses - #[derive(Debug, Clone, PartialEq, serde::Serialize, serde::Deserialize)] - pub struct DeleteEmailOption { - /// email addresses to delete - pub emails: Option>, - } - - /// DeleteFileOptions options for deleting files (used for other File structs below) - /// - /// Note: `author` and `committer` are optional (if only one is given, it will be used for the other, otherwise the authenticated user will be used) - #[derive(Debug, Clone, PartialEq, serde::Serialize, serde::Deserialize)] - pub struct DeleteFileOptions { - pub author: Option, - /// branch (optional) to base this file from. if not given, the default branch is used - pub branch: Option, - pub committer: Option, - pub dates: Option, - /// message (optional) for the commit of this file. if not supplied, a default message will be used - pub message: Option, - /// new_branch (optional) will make a new branch from `branch` before creating the file - pub new_branch: Option, - /// sha is the SHA for the file that already exists - pub sha: String, - /// Add a Signed-off-by trailer by the committer at the end of the commit log message. - pub signoff: Option, - } - - /// DeleteLabelOption options for deleting a label - #[derive(Debug, Clone, PartialEq, serde::Serialize, serde::Deserialize)] - pub struct DeleteLabelsOption { - #[serde(with = "time::serde::rfc3339::option")] - pub updated_at: Option, - } - - /// DeployKey a deploy key - #[derive(Debug, Clone, PartialEq, serde::Serialize, serde::Deserialize)] - pub struct DeployKey { - #[serde(with = "time::serde::rfc3339::option")] - pub created_at: Option, - pub fingerprint: Option, - pub id: Option, - pub key: Option, - pub key_id: Option, - pub read_only: Option, - pub repository: Option, - pub title: Option, - #[serde(deserialize_with = "crate::none_if_blank_url")] - pub url: Option, - } - - /// DismissPullReviewOptions are options to dismiss a pull review - #[derive(Debug, Clone, PartialEq, serde::Serialize, serde::Deserialize)] - pub struct DismissPullReviewOptions { - pub message: Option, - pub priors: Option, - } - - /// EditAttachmentOptions options for editing attachments - #[derive(Debug, Clone, PartialEq, serde::Serialize, serde::Deserialize)] - pub struct EditAttachmentOptions { - pub name: Option, - } - - /// EditBranchProtectionOption options for editing a branch protection - #[derive(Debug, Clone, PartialEq, serde::Serialize, serde::Deserialize)] - pub struct EditBranchProtectionOption { - pub approvals_whitelist_teams: Option>, - pub approvals_whitelist_username: Option>, - pub block_on_official_review_requests: Option, - pub block_on_outdated_branch: Option, - pub block_on_rejected_reviews: Option, - pub dismiss_stale_approvals: Option, - pub enable_approvals_whitelist: Option, - pub enable_merge_whitelist: Option, - pub enable_push: Option, - pub enable_push_whitelist: Option, - pub enable_status_check: Option, - pub merge_whitelist_teams: Option>, - pub merge_whitelist_usernames: Option>, - pub protected_file_patterns: Option, - pub push_whitelist_deploy_keys: Option, - pub push_whitelist_teams: Option>, - pub push_whitelist_usernames: Option>, - pub require_signed_commits: Option, - pub required_approvals: Option, - pub status_check_contexts: Option>, - pub unprotected_file_patterns: Option, - } - - /// EditDeadlineOption options for creating a deadline - #[derive(Debug, Clone, PartialEq, serde::Serialize, serde::Deserialize)] - pub struct EditDeadlineOption { - #[serde(with = "time::serde::rfc3339")] - pub due_date: time::OffsetDateTime, - } - - /// EditGitHookOption options when modifying one Git hook - #[derive(Debug, Clone, PartialEq, serde::Serialize, serde::Deserialize)] - pub struct EditGitHookOption { - pub content: Option, - } - - /// EditHookOption options when modify one hook - #[derive(Debug, Clone, PartialEq, serde::Serialize, serde::Deserialize)] - pub struct EditHookOption { - pub active: Option, - pub authorization_header: Option, - pub branch_filter: Option, - pub config: Option, - pub events: Option>, - } - - #[derive(Debug, Clone, PartialEq, serde::Serialize, serde::Deserialize)] - pub struct EditHookOptionConfig { - #[serde(flatten)] - pub additional: std::collections::BTreeMap, - } - - /// EditIssueCommentOption options for editing a comment - #[derive(Debug, Clone, PartialEq, serde::Serialize, serde::Deserialize)] - pub struct EditIssueCommentOption { - pub body: String, - #[serde(with = "time::serde::rfc3339::option")] - pub updated_at: Option, - } - - /// EditIssueOption options for editing an issue - #[derive(Debug, Clone, PartialEq, serde::Serialize, serde::Deserialize)] - pub struct EditIssueOption { - /// deprecated - pub assignee: Option, - pub assignees: Option>, - pub body: Option, - #[serde(with = "time::serde::rfc3339::option")] - pub due_date: Option, - pub milestone: Option, - #[serde(rename = "ref")] - pub r#ref: Option, - pub state: Option, - pub title: Option, - pub unset_due_date: Option, - #[serde(with = "time::serde::rfc3339::option")] - pub updated_at: Option, - } - - /// EditLabelOption options for editing a label - #[derive(Debug, Clone, PartialEq, serde::Serialize, serde::Deserialize)] - pub struct EditLabelOption { - pub color: Option, - pub description: Option, - pub exclusive: Option, - pub is_archived: Option, - pub name: Option, - } - - /// EditMilestoneOption options for editing a milestone - #[derive(Debug, Clone, PartialEq, serde::Serialize, serde::Deserialize)] - pub struct EditMilestoneOption { - pub description: Option, - #[serde(with = "time::serde::rfc3339::option")] - pub due_on: Option, - pub state: Option, - pub title: Option, - } - - /// EditOrgOption options for editing an organization - #[derive(Debug, Clone, PartialEq, serde::Serialize, serde::Deserialize)] - pub struct EditOrgOption { - pub description: Option, - pub email: Option, - pub full_name: Option, - pub location: Option, - pub repo_admin_change_team_access: Option, - /// possible values are `public`, `limited` or `private` - pub visibility: Option, - pub website: Option, - } - - /// possible values are `public`, `limited` or `private` - - #[derive(Debug, Clone, PartialEq, serde::Serialize, serde::Deserialize)] - pub enum EditOrgOptionVisibility { - Public, - Limited, - Private, - } - - impl EditOrgOptionVisibility { - fn as_str(&self) -> &'static str { - match self { - EditOrgOptionVisibility::Public => "public", - EditOrgOptionVisibility::Limited => "limited", - EditOrgOptionVisibility::Private => "private", - } - } - } - /// EditPullRequestOption options when modify pull request - #[derive(Debug, Clone, PartialEq, serde::Serialize, serde::Deserialize)] - pub struct EditPullRequestOption { - pub allow_maintainer_edit: Option, - pub assignee: Option, - pub assignees: Option>, - pub base: Option, - pub body: Option, - #[serde(with = "time::serde::rfc3339::option")] - pub due_date: Option, - pub labels: Option>, - pub milestone: Option, - pub state: Option, - pub title: Option, - pub unset_due_date: Option, - } - - /// EditReactionOption contain the reaction type - #[derive(Debug, Clone, PartialEq, serde::Serialize, serde::Deserialize)] - pub struct EditReactionOption { - pub content: Option, - } - - /// EditReleaseOption options when editing a release - #[derive(Debug, Clone, PartialEq, serde::Serialize, serde::Deserialize)] - pub struct EditReleaseOption { - pub body: Option, - pub draft: Option, - pub name: Option, - pub prerelease: Option, - pub tag_name: Option, - pub target_commitish: Option, - } - - /// EditRepoOption options when editing a repository's properties - #[derive(Debug, Clone, PartialEq, serde::Serialize, serde::Deserialize)] - pub struct EditRepoOption { - /// either `true` to allow mark pr as merged manually, or `false` to prevent it. - pub allow_manual_merge: Option, - /// either `true` to allow merging pull requests with a merge commit, or `false` to prevent merging pull requests with merge commits. - pub allow_merge_commits: Option, - /// either `true` to allow rebase-merging pull requests, or `false` to prevent rebase-merging. - pub allow_rebase: Option, - /// either `true` to allow rebase with explicit merge commits (--no-ff), or `false` to prevent rebase with explicit merge commits. - pub allow_rebase_explicit: Option, - /// either `true` to allow updating pull request branch by rebase, or `false` to prevent it. - pub allow_rebase_update: Option, - /// either `true` to allow squash-merging pull requests, or `false` to prevent squash-merging. - pub allow_squash_merge: Option, - /// set to `true` to archive this repository. - pub archived: Option, - /// either `true` to enable AutodetectManualMerge, or `false` to prevent it. Note: In some special cases, misjudgments can occur. - pub autodetect_manual_merge: Option, - /// set to `true` to allow edits from maintainers by default - pub default_allow_maintainer_edit: Option, - /// sets the default branch for this repository. - pub default_branch: Option, - /// set to `true` to delete pr branch after merge by default - pub default_delete_branch_after_merge: Option, - /// set to a merge style to be used by this repository: "merge", "rebase", "rebase-merge", or "squash". - pub default_merge_style: Option, - /// a short description of the repository. - pub description: Option, - /// enable prune - remove obsolete remote-tracking references - pub enable_prune: Option, - pub external_tracker: Option, - pub external_wiki: Option, - /// either `true` to enable actions unit, or `false` to disable them. - pub has_actions: Option, - /// either `true` to enable issues for this repository or `false` to disable them. - pub has_issues: Option, - /// either `true` to enable packages unit, or `false` to disable them. - pub has_packages: Option, - /// either `true` to enable project unit, or `false` to disable them. - pub has_projects: Option, - /// either `true` to allow pull requests, or `false` to prevent pull request. - pub has_pull_requests: Option, - /// either `true` to enable releases unit, or `false` to disable them. - pub has_releases: Option, - /// either `true` to enable the wiki for this repository or `false` to disable it. - pub has_wiki: Option, - /// either `true` to ignore whitespace for conflicts, or `false` to not ignore whitespace. - pub ignore_whitespace_conflicts: Option, - pub internal_tracker: Option, - /// set to a string like `8h30m0s` to set the mirror interval time - pub mirror_interval: Option, - /// name of the repository - pub name: Option, - /// either `true` to make the repository private or `false` to make it public. - /// - /// Note: you will get a 422 error if the organization restricts changing repository visibility to organization - /// - /// owners and a non-owner tries to change the value of private. - pub private: Option, - /// either `true` to make this repository a template or `false` to make it a normal repository - pub template: Option, - /// a URL with more information about the repository. - pub website: Option, - } - - /// EditTeamOption options for editing a team - #[derive(Debug, Clone, PartialEq, serde::Serialize, serde::Deserialize)] - pub struct EditTeamOption { - pub can_create_org_repo: Option, - pub description: Option, - pub includes_all_repositories: Option, - pub name: String, - pub permission: Option, - pub units: Option>, - pub units_map: Option, - } - - #[derive(Debug, Clone, PartialEq, serde::Serialize, serde::Deserialize)] - pub enum EditTeamOptionPermission { - Read, - Write, - Admin, - } - - impl EditTeamOptionPermission { - fn as_str(&self) -> &'static str { - match self { - EditTeamOptionPermission::Read => "read", - EditTeamOptionPermission::Write => "write", - EditTeamOptionPermission::Admin => "admin", - } - } - } - #[derive(Debug, Clone, PartialEq, serde::Serialize, serde::Deserialize)] - pub struct EditTeamOptionUnitsMap { - #[serde(flatten)] - pub additional: std::collections::BTreeMap, - } - - /// EditUserOption edit user options - #[derive(Debug, Clone, PartialEq, serde::Serialize, serde::Deserialize)] - pub struct EditUserOption { - pub active: Option, - pub admin: Option, - pub allow_create_organization: Option, - pub allow_git_hook: Option, - pub allow_import_local: Option, - pub description: Option, - pub email: Option, - pub full_name: Option, - pub location: Option, - pub login_name: String, - pub max_repo_creation: Option, - pub must_change_password: Option, - pub password: Option, - pub prohibit_login: Option, - pub restricted: Option, - pub source_id: u64, - pub visibility: Option, - pub website: Option, - } - - /// Email an email address belonging to a user - #[derive(Debug, Clone, PartialEq, serde::Serialize, serde::Deserialize)] - pub struct Email { - pub email: Option, - pub primary: Option, - pub user_id: Option, - pub username: Option, - pub verified: Option, - } - - /// ExternalTracker represents settings for external tracker - #[derive(Debug, Clone, PartialEq, serde::Serialize, serde::Deserialize)] - pub struct ExternalTracker { - /// External Issue Tracker URL Format. Use the placeholders {user}, {repo} and {index} for the username, repository name and issue index. - pub external_tracker_format: Option, - /// External Issue Tracker issue regular expression - pub external_tracker_regexp_pattern: Option, - /// External Issue Tracker Number Format, either `numeric`, `alphanumeric`, or `regexp` - pub external_tracker_style: Option, - #[serde(deserialize_with = "crate::none_if_blank_url")] - /// URL of external issue tracker. - pub external_tracker_url: Option, - } - - /// ExternalWiki represents setting for external wiki - #[derive(Debug, Clone, PartialEq, serde::Serialize, serde::Deserialize)] - pub struct ExternalWiki { - #[serde(deserialize_with = "crate::none_if_blank_url")] - /// URL of external wiki. - pub external_wiki_url: Option, - } - - #[derive(Debug, Clone, PartialEq, serde::Serialize, serde::Deserialize)] - pub struct FileCommitResponse { - pub author: Option, - pub committer: Option, - #[serde(with = "time::serde::rfc3339::option")] - pub created: Option, - #[serde(deserialize_with = "crate::none_if_blank_url")] - pub html_url: Option, - pub message: Option, - pub parents: Option>, - pub sha: Option, - pub tree: Option, - #[serde(deserialize_with = "crate::none_if_blank_url")] - pub url: Option, - } - - /// FileDeleteResponse contains information about a repo's file that was deleted - #[derive(Debug, Clone, PartialEq, serde::Serialize, serde::Deserialize)] - pub struct FileDeleteResponse { - pub commit: Option, - pub content: Option<()>, - pub verification: Option, - } - - /// FileLinksResponse contains the links for a repo's file - #[derive(Debug, Clone, PartialEq, serde::Serialize, serde::Deserialize)] - pub struct FileLinksResponse { - pub git: Option, - pub html: Option, - #[serde(rename = "self")] - pub this: Option, - } - - /// FileResponse contains information about a repo's file - #[derive(Debug, Clone, PartialEq, serde::Serialize, serde::Deserialize)] - pub struct FileResponse { - pub commit: Option, - pub content: Option, - pub verification: Option, - } - - /// FilesResponse contains information about multiple files from a repo - #[derive(Debug, Clone, PartialEq, serde::Serialize, serde::Deserialize)] - pub struct FilesResponse { - pub commit: Option, - pub files: Option>, - pub verification: Option, - } - - /// GPGKey a user GPG key to sign commit and tag in repository - #[derive(Debug, Clone, PartialEq, serde::Serialize, serde::Deserialize)] - pub struct GPGKey { - pub can_certify: Option, - pub can_encrypt_comms: Option, - pub can_encrypt_storage: Option, - pub can_sign: Option, - #[serde(with = "time::serde::rfc3339::option")] - pub created_at: Option, - pub emails: Option>, - #[serde(with = "time::serde::rfc3339::option")] - pub expires_at: Option, - pub id: Option, - pub key_id: Option, - pub primary_key_id: Option, - pub public_key: Option, - pub subkeys: Option>, - pub verified: Option, - } - - /// GPGKeyEmail an email attached to a GPGKey - #[derive(Debug, Clone, PartialEq, serde::Serialize, serde::Deserialize)] - pub struct GPGKeyEmail { - pub email: Option, - pub verified: Option, - } - - /// GeneralAPISettings contains global api settings exposed by it - #[derive(Debug, Clone, PartialEq, serde::Serialize, serde::Deserialize)] - pub struct GeneralAPISettings { - pub default_git_trees_per_page: Option, - pub default_max_blob_size: Option, - pub default_paging_num: Option, - pub max_response_items: Option, - } - - /// GeneralAttachmentSettings contains global Attachment settings exposed by API - #[derive(Debug, Clone, PartialEq, serde::Serialize, serde::Deserialize)] - pub struct GeneralAttachmentSettings { - pub allowed_types: Option, - pub enabled: Option, - pub max_files: Option, - pub max_size: Option, - } - - /// GeneralRepoSettings contains global repository settings exposed by API - #[derive(Debug, Clone, PartialEq, serde::Serialize, serde::Deserialize)] - pub struct GeneralRepoSettings { - pub http_git_disabled: Option, - pub lfs_disabled: Option, - pub migrations_disabled: Option, - pub mirrors_disabled: Option, - pub stars_disabled: Option, - pub time_tracking_disabled: Option, - } - - /// GeneralUISettings contains global ui settings exposed by API - #[derive(Debug, Clone, PartialEq, serde::Serialize, serde::Deserialize)] - pub struct GeneralUISettings { - pub allowed_reactions: Option>, - pub custom_emojis: Option>, - pub default_theme: Option, - } - - /// GenerateRepoOption options when creating repository using a template - #[derive(Debug, Clone, PartialEq, serde::Serialize, serde::Deserialize)] - pub struct GenerateRepoOption { - /// include avatar of the template repo - pub avatar: Option, - /// Default branch of the new repository - pub default_branch: Option, - /// Description of the repository to create - pub description: Option, - /// include git content of default branch in template repo - pub git_content: Option, - /// include git hooks in template repo - pub git_hooks: Option, - /// include labels in template repo - pub labels: Option, - /// Name of the repository to create - pub name: String, - /// The organization or person who will own the new repository - pub owner: String, - /// Whether the repository is private - pub private: Option, - /// include protected branches in template repo - pub protected_branch: Option, - /// include topics in template repo - pub topics: Option, - /// include webhooks in template repo - pub webhooks: Option, - } - - /// GitBlobResponse represents a git blob - #[derive(Debug, Clone, PartialEq, serde::Serialize, serde::Deserialize)] - pub struct GitBlobResponse { - pub content: Option, - pub encoding: Option, - pub sha: Option, - pub size: Option, - #[serde(deserialize_with = "crate::none_if_blank_url")] - pub url: Option, - } - - /// GitEntry represents a git tree - #[derive(Debug, Clone, PartialEq, serde::Serialize, serde::Deserialize)] - pub struct GitEntry { - pub mode: Option, - pub path: Option, - pub sha: Option, - pub size: Option, - #[serde(rename = "type")] - pub r#type: Option, - #[serde(deserialize_with = "crate::none_if_blank_url")] - pub url: Option, - } - - /// GitHook represents a Git repository hook - #[derive(Debug, Clone, PartialEq, serde::Serialize, serde::Deserialize)] - pub struct GitHook { - pub content: Option, - pub is_active: Option, - pub name: Option, - } - - #[derive(Debug, Clone, PartialEq, serde::Serialize, serde::Deserialize)] - pub struct GitObject { - pub sha: Option, - #[serde(rename = "type")] - pub r#type: Option, - #[serde(deserialize_with = "crate::none_if_blank_url")] - pub url: Option, - } - - /// GitTreeResponse returns a git tree - #[derive(Debug, Clone, PartialEq, serde::Serialize, serde::Deserialize)] - pub struct GitTreeResponse { - pub page: Option, - pub sha: Option, - pub total_count: Option, - pub tree: Option>, - pub truncated: Option, - #[serde(deserialize_with = "crate::none_if_blank_url")] - pub url: Option, - } - - /// GitignoreTemplateInfo name and text of a gitignore template - #[derive(Debug, Clone, PartialEq, serde::Serialize, serde::Deserialize)] - pub struct GitignoreTemplateInfo { - pub name: Option, - pub source: Option, - } - - /// Hook a hook is a web hook when one repository changed - #[derive(Debug, Clone, PartialEq, serde::Serialize, serde::Deserialize)] - pub struct Hook { - pub active: Option, - pub authorization_header: Option, - pub branch_filter: Option, - pub config: Option, - #[serde(with = "time::serde::rfc3339::option")] - pub created_at: Option, - pub events: Option>, - pub id: Option, - #[serde(rename = "type")] - pub r#type: Option, - #[serde(with = "time::serde::rfc3339::option")] - pub updated_at: Option, - } - - #[derive(Debug, Clone, PartialEq, serde::Serialize, serde::Deserialize)] - pub struct HookConfig { - #[serde(flatten)] - pub additional: std::collections::BTreeMap, - } - - /// Identity for a person's identity like an author or committer - #[derive(Debug, Clone, PartialEq, serde::Serialize, serde::Deserialize)] - pub struct Identity { - pub email: Option, - pub name: Option, - } - - /// InternalTracker represents settings for internal tracker - #[derive(Debug, Clone, PartialEq, serde::Serialize, serde::Deserialize)] - pub struct InternalTracker { - /// Let only contributors track time (Built-in issue tracker) - pub allow_only_contributors_to_track_time: Option, - /// Enable dependencies for issues and pull requests (Built-in issue tracker) - pub enable_issue_dependencies: Option, - /// Enable time tracking (Built-in issue tracker) - pub enable_time_tracker: Option, - } - - /// Issue represents an issue in a repository - #[derive(Debug, Clone, PartialEq, serde::Serialize, serde::Deserialize)] - pub struct Issue { - pub assets: Option>, - pub assignee: Option, - pub assignees: Option>, - pub body: Option, - #[serde(with = "time::serde::rfc3339::option")] - pub closed_at: Option, - pub comments: Option, - #[serde(with = "time::serde::rfc3339::option")] - pub created_at: Option, - #[serde(with = "time::serde::rfc3339::option")] - pub due_date: Option, - #[serde(deserialize_with = "crate::none_if_blank_url")] - pub html_url: Option, - pub id: Option, - pub is_locked: Option, - pub labels: Option>, - pub milestone: Option, - pub number: Option, - pub original_author: Option, - pub original_author_id: Option, - pub pin_order: Option, - pub pull_request: Option, - #[serde(rename = "ref")] - pub r#ref: Option, - pub repository: Option, - pub state: Option, - pub title: Option, - #[serde(with = "time::serde::rfc3339::option")] - pub updated_at: Option, - #[serde(deserialize_with = "crate::none_if_blank_url")] - pub url: Option, - pub user: Option, - } - - #[derive(Debug, Clone, PartialEq, serde::Serialize, serde::Deserialize)] - pub struct IssueConfig { - pub blank_issues_enabled: Option, - pub contact_links: Option>, - } - - #[derive(Debug, Clone, PartialEq, serde::Serialize, serde::Deserialize)] - pub struct IssueConfigContactLink { - pub about: Option, - pub name: Option, - #[serde(deserialize_with = "crate::none_if_blank_url")] - pub url: Option, - } - - #[derive(Debug, Clone, PartialEq, serde::Serialize, serde::Deserialize)] - pub struct IssueConfigValidation { - pub message: Option, - pub valid: Option, - } - - /// IssueDeadline represents an issue deadline - #[derive(Debug, Clone, PartialEq, serde::Serialize, serde::Deserialize)] - pub struct IssueDeadline { - #[serde(with = "time::serde::rfc3339::option")] - pub due_date: Option, - } - - /// IssueFormField represents a form field - #[derive(Debug, Clone, PartialEq, serde::Serialize, serde::Deserialize)] - pub struct IssueFormField { - pub attributes: Option, - pub id: Option, - #[serde(rename = "type")] - pub r#type: Option, - pub validations: Option, - } - - #[derive(Debug, Clone, PartialEq, serde::Serialize, serde::Deserialize)] - pub struct IssueFormFieldAttributes { - #[serde(flatten)] - pub additional: std::collections::BTreeMap, - } - - #[derive(Debug, Clone, PartialEq, serde::Serialize, serde::Deserialize)] - pub struct IssueFormFieldValidations { - #[serde(flatten)] - pub additional: std::collections::BTreeMap, - } - - #[derive(Debug, Clone, PartialEq, serde::Serialize, serde::Deserialize)] - pub struct IssueFormFieldType {} - - /// IssueLabelsOption a collection of labels - #[derive(Debug, Clone, PartialEq, serde::Serialize, serde::Deserialize)] - pub struct IssueLabelsOption { - /// list of label IDs - pub labels: Option>, - #[serde(with = "time::serde::rfc3339::option")] - pub updated_at: Option, - } - - /// IssueMeta basic issue information - #[derive(Debug, Clone, PartialEq, serde::Serialize, serde::Deserialize)] - pub struct IssueMeta { - pub index: Option, - pub owner: Option, - pub repo: Option, - } - - /// IssueTemplate represents an issue template for a repository - #[derive(Debug, Clone, PartialEq, serde::Serialize, serde::Deserialize)] - pub struct IssueTemplate { - pub about: Option, - pub body: Option>, - pub content: Option, - pub file_name: Option, - pub labels: Option>, - pub name: Option, - #[serde(rename = "ref")] - pub r#ref: Option, - pub title: Option, - } - - /// Label a label to an issue or a pr - #[derive(Debug, Clone, PartialEq, serde::Serialize, serde::Deserialize)] - pub struct Label { - pub color: Option, - pub description: Option, - pub exclusive: Option, - pub id: Option, - pub is_archived: Option, - pub name: Option, - #[serde(deserialize_with = "crate::none_if_blank_url")] - pub url: Option, - } - - /// LabelTemplate info of a Label template - #[derive(Debug, Clone, PartialEq, serde::Serialize, serde::Deserialize)] - pub struct LabelTemplate { - pub color: Option, - pub description: Option, - pub exclusive: Option, - pub name: Option, - } - - /// LicensesInfo contains information about a License - #[derive(Debug, Clone, PartialEq, serde::Serialize, serde::Deserialize)] - pub struct LicenseTemplateInfo { - pub body: Option, - pub implementation: Option, - pub key: Option, - pub name: Option, - #[serde(deserialize_with = "crate::none_if_blank_url")] - pub url: Option, - } - - /// LicensesListEntry is used for the API - #[derive(Debug, Clone, PartialEq, serde::Serialize, serde::Deserialize)] - pub struct LicensesTemplateListEntry { - pub key: Option, - pub name: Option, - #[serde(deserialize_with = "crate::none_if_blank_url")] - pub url: Option, - } - - /// MarkdownOption markdown options - #[derive(Debug, Clone, PartialEq, serde::Serialize, serde::Deserialize)] - pub struct MarkdownOption { - /// Context to render - /// - /// - /// - /// in: body - #[serde(rename = "Context")] - pub context: Option, - /// Mode to render (comment, gfm, markdown) - /// - /// - /// - /// in: body - #[serde(rename = "Mode")] - pub mode: Option, - /// Text markdown to render - /// - /// - /// - /// in: body - #[serde(rename = "Text")] - pub text: Option, - /// Is it a wiki page ? - /// - /// - /// - /// in: body - #[serde(rename = "Wiki")] - pub wiki: Option, - } - - /// MarkupOption markup options - #[derive(Debug, Clone, PartialEq, serde::Serialize, serde::Deserialize)] - pub struct MarkupOption { - /// Context to render - /// - /// - /// - /// in: body - #[serde(rename = "Context")] - pub context: Option, - /// File path for detecting extension in file mode - /// - /// - /// - /// in: body - #[serde(rename = "FilePath")] - pub file_path: Option, - /// Mode to render (comment, gfm, markdown, file) - /// - /// - /// - /// in: body - #[serde(rename = "Mode")] - pub mode: Option, - /// Text markup to render - /// - /// - /// - /// in: body - #[serde(rename = "Text")] - pub text: Option, - /// Is it a wiki page ? - /// - /// - /// - /// in: body - #[serde(rename = "Wiki")] - pub wiki: Option, - } - - /// MergePullRequestForm form for merging Pull Request - #[derive(Debug, Clone, PartialEq, serde::Serialize, serde::Deserialize)] - pub struct MergePullRequestOption { - #[serde(rename = "Do")] - pub r#do: MergePullRequestOptionDo, - #[serde(rename = "MergeCommitID")] - pub merge_commit_id: Option, - #[serde(rename = "MergeMessageField")] - pub merge_message_field: Option, - #[serde(rename = "MergeTitleField")] - pub merge_title_field: Option, - pub delete_branch_after_merge: Option, - pub force_merge: Option, - pub head_commit_id: Option, - pub merge_when_checks_succeed: Option, - } - - #[derive(Debug, Clone, PartialEq, serde::Serialize, serde::Deserialize)] - pub enum MergePullRequestOptionDo { - Merge, - Rebase, - RebaseMerge, - Squash, - ManuallyMerged, - } - - impl MergePullRequestOptionDo { - fn as_str(&self) -> &'static str { - match self { - MergePullRequestOptionDo::Merge => "merge", - MergePullRequestOptionDo::Rebase => "rebase", - MergePullRequestOptionDo::RebaseMerge => "rebase-merge", - MergePullRequestOptionDo::Squash => "squash", - MergePullRequestOptionDo::ManuallyMerged => "manually-merged", - } - } - } - /// MigrateRepoOptions options for migrating repository's - /// - /// this is used to interact with api v1 - #[derive(Debug, Clone, PartialEq, serde::Serialize, serde::Deserialize)] - pub struct MigrateRepoOptions { - pub auth_password: Option, - pub auth_token: Option, - pub auth_username: Option, - pub clone_addr: String, - pub description: Option, - pub issues: Option, - pub labels: Option, - pub lfs: Option, - pub lfs_endpoint: Option, - pub milestones: Option, - pub mirror: Option, - pub mirror_interval: Option, - pub private: Option, - pub pull_requests: Option, - pub releases: Option, - pub repo_name: String, - /// Name of User or Organisation who will own Repo after migration - pub repo_owner: Option, - pub service: Option, - /// deprecated (only for backwards compatibility) - pub uid: Option, - pub wiki: Option, - } - - #[derive(Debug, Clone, PartialEq, serde::Serialize, serde::Deserialize)] - pub enum MigrateRepoOptionsService { - Git, - Github, - Gitea, - Gitlab, - Gogs, - Onedev, - Gitbucket, - Codebase, - } - - impl MigrateRepoOptionsService { - fn as_str(&self) -> &'static str { - match self { - MigrateRepoOptionsService::Git => "git", - MigrateRepoOptionsService::Github => "github", - MigrateRepoOptionsService::Gitea => "gitea", - MigrateRepoOptionsService::Gitlab => "gitlab", - MigrateRepoOptionsService::Gogs => "gogs", - MigrateRepoOptionsService::Onedev => "onedev", - MigrateRepoOptionsService::Gitbucket => "gitbucket", - MigrateRepoOptionsService::Codebase => "codebase", - } - } - } - /// Milestone milestone is a collection of issues on one repository - #[derive(Debug, Clone, PartialEq, serde::Serialize, serde::Deserialize)] - pub struct Milestone { - #[serde(with = "time::serde::rfc3339::option")] - pub closed_at: Option, - pub closed_issues: Option, - #[serde(with = "time::serde::rfc3339::option")] - pub created_at: Option, - pub description: Option, - #[serde(with = "time::serde::rfc3339::option")] - pub due_on: Option, - pub id: Option, - pub open_issues: Option, - pub state: Option, - pub title: Option, - #[serde(with = "time::serde::rfc3339::option")] - pub updated_at: Option, - } - - /// NewIssuePinsAllowed represents an API response that says if new Issue Pins are allowed - #[derive(Debug, Clone, PartialEq, serde::Serialize, serde::Deserialize)] - pub struct NewIssuePinsAllowed { - pub issues: Option, - pub pull_requests: Option, - } - - /// NodeInfo contains standardized way of exposing metadata about a server running one of the distributed social networks - #[derive(Debug, Clone, PartialEq, serde::Serialize, serde::Deserialize)] - pub struct NodeInfo { - pub metadata: Option, - #[serde(rename = "openRegistrations")] - pub open_registrations: Option, - pub protocols: Option>, - pub services: Option, - pub software: Option, - pub usage: Option, - pub version: Option, - } - - #[derive(Debug, Clone, PartialEq, serde::Serialize, serde::Deserialize)] - pub struct NodeInfoMetadata {} - - /// NodeInfoServices contains the third party sites this server can connect to via their application API - #[derive(Debug, Clone, PartialEq, serde::Serialize, serde::Deserialize)] - pub struct NodeInfoServices { - pub inbound: Option>, - pub outbound: Option>, - } - - /// NodeInfoSoftware contains Metadata about server software in use - #[derive(Debug, Clone, PartialEq, serde::Serialize, serde::Deserialize)] - pub struct NodeInfoSoftware { - pub homepage: Option, - pub name: Option, - pub repository: Option, - pub version: Option, - } - - /// NodeInfoUsage contains usage statistics for this server - #[derive(Debug, Clone, PartialEq, serde::Serialize, serde::Deserialize)] - pub struct NodeInfoUsage { - #[serde(rename = "localComments")] - pub local_comments: Option, - #[serde(rename = "localPosts")] - pub local_posts: Option, - pub users: Option, - } - - /// NodeInfoUsageUsers contains statistics about the users of this server - #[derive(Debug, Clone, PartialEq, serde::Serialize, serde::Deserialize)] - pub struct NodeInfoUsageUsers { - #[serde(rename = "activeHalfyear")] - pub active_halfyear: Option, - #[serde(rename = "activeMonth")] - pub active_month: Option, - pub total: Option, - } - - /// Note contains information related to a git note - #[derive(Debug, Clone, PartialEq, serde::Serialize, serde::Deserialize)] - pub struct Note { - pub commit: Option, - pub message: Option, - } - - /// NotificationCount number of unread notifications - #[derive(Debug, Clone, PartialEq, serde::Serialize, serde::Deserialize)] - pub struct NotificationCount { - pub new: Option, - } - - /// NotificationSubject contains the notification subject (Issue/Pull/Commit) - #[derive(Debug, Clone, PartialEq, serde::Serialize, serde::Deserialize)] - pub struct NotificationSubject { - #[serde(deserialize_with = "crate::none_if_blank_url")] - pub html_url: Option, - #[serde(deserialize_with = "crate::none_if_blank_url")] - pub latest_comment_html_url: Option, - #[serde(deserialize_with = "crate::none_if_blank_url")] - pub latest_comment_url: Option, - pub state: Option, - pub title: Option, - #[serde(rename = "type")] - pub r#type: Option, - #[serde(deserialize_with = "crate::none_if_blank_url")] - pub url: Option, - } - - /// NotificationThread expose Notification on API - #[derive(Debug, Clone, PartialEq, serde::Serialize, serde::Deserialize)] - pub struct NotificationThread { - pub id: Option, - pub pinned: Option, - pub repository: Option, - pub subject: Option, - pub unread: Option, - #[serde(with = "time::serde::rfc3339::option")] - pub updated_at: Option, - #[serde(deserialize_with = "crate::none_if_blank_url")] - pub url: Option, - } - - /// NotifySubjectType represent type of notification subject - #[derive(Debug, Clone, PartialEq, serde::Serialize, serde::Deserialize)] - pub struct NotifySubjectType {} - - #[derive(Debug, Clone, PartialEq, serde::Serialize, serde::Deserialize)] - pub struct OAuth2Application { - pub client_id: Option, - pub client_secret: Option, - pub confidential_client: Option, - #[serde(with = "time::serde::rfc3339::option")] - pub created: Option, - pub id: Option, - pub name: Option, - pub redirect_uris: Option>, - } - - /// Organization represents an organization - #[derive(Debug, Clone, PartialEq, serde::Serialize, serde::Deserialize)] - pub struct Organization { - #[serde(deserialize_with = "crate::none_if_blank_url")] - pub avatar_url: Option, - pub description: Option, - pub email: Option, - pub full_name: Option, - pub id: Option, - pub location: Option, - pub name: Option, - pub repo_admin_change_team_access: Option, - /// deprecated - pub username: Option, - pub visibility: Option, - pub website: Option, - } - - /// OrganizationPermissions list different users permissions on an organization - #[derive(Debug, Clone, PartialEq, serde::Serialize, serde::Deserialize)] - pub struct OrganizationPermissions { - pub can_create_repository: Option, - pub can_read: Option, - pub can_write: Option, - pub is_admin: Option, - pub is_owner: Option, - } - - /// PRBranchInfo information about a branch - #[derive(Debug, Clone, PartialEq, serde::Serialize, serde::Deserialize)] - pub struct PRBranchInfo { - pub label: Option, - #[serde(rename = "ref")] - pub r#ref: Option, - pub repo: Option, - pub repo_id: Option, - pub sha: Option, - } - - /// Package represents a package - #[derive(Debug, Clone, PartialEq, serde::Serialize, serde::Deserialize)] - pub struct Package { - #[serde(with = "time::serde::rfc3339::option")] - pub created_at: Option, - pub creator: Option, - #[serde(deserialize_with = "crate::none_if_blank_url")] - pub html_url: Option, - pub id: Option, - pub name: Option, - pub owner: Option, - pub repository: Option, - #[serde(rename = "type")] - pub r#type: Option, - pub version: Option, - } - - /// PackageFile represents a package file - #[derive(Debug, Clone, PartialEq, serde::Serialize, serde::Deserialize)] - pub struct PackageFile { - #[serde(rename = "Size")] - pub size: Option, - pub id: Option, - pub md5: Option, - pub name: Option, - pub sha1: Option, - pub sha256: Option, - pub sha512: Option, - } - - /// PayloadCommit represents a commit - #[derive(Debug, Clone, PartialEq, serde::Serialize, serde::Deserialize)] - pub struct PayloadCommit { - pub added: Option>, - pub author: Option, - pub committer: Option, - /// sha1 hash of the commit - pub id: Option, - pub message: Option, - pub modified: Option>, - pub removed: Option>, - #[serde(with = "time::serde::rfc3339::option")] - pub timestamp: Option, - #[serde(deserialize_with = "crate::none_if_blank_url")] - pub url: Option, - pub verification: Option, - } - - /// PayloadCommitVerification represents the GPG verification of a commit - #[derive(Debug, Clone, PartialEq, serde::Serialize, serde::Deserialize)] - pub struct PayloadCommitVerification { - pub payload: Option, - pub reason: Option, - pub signature: Option, - pub signer: Option, - pub verified: Option, - } - - /// PayloadUser represents the author or committer of a commit - #[derive(Debug, Clone, PartialEq, serde::Serialize, serde::Deserialize)] - pub struct PayloadUser { - pub email: Option, - /// Full name of the commit author - pub name: Option, - pub username: Option, - } - - /// Permission represents a set of permissions - #[derive(Debug, Clone, PartialEq, serde::Serialize, serde::Deserialize)] - pub struct Permission { - pub admin: Option, - pub pull: Option, - pub push: Option, - } - - /// PublicKey publickey is a user key to push code to repository - #[derive(Debug, Clone, PartialEq, serde::Serialize, serde::Deserialize)] - pub struct PublicKey { - #[serde(with = "time::serde::rfc3339::option")] - pub created_at: Option, - pub fingerprint: Option, - pub id: Option, - pub key: Option, - pub key_type: Option, - pub read_only: Option, - pub title: Option, - #[serde(deserialize_with = "crate::none_if_blank_url")] - pub url: Option, - pub user: Option, - } - - /// PullRequest represents a pull request - #[derive(Debug, Clone, PartialEq, serde::Serialize, serde::Deserialize)] - pub struct PullRequest { - pub allow_maintainer_edit: Option, - pub assignee: Option, - pub assignees: Option>, - pub base: Option, - pub body: Option, - #[serde(with = "time::serde::rfc3339::option")] - pub closed_at: Option, - pub comments: Option, - #[serde(with = "time::serde::rfc3339::option")] - pub created_at: Option, - #[serde(deserialize_with = "crate::none_if_blank_url")] - pub diff_url: Option, - #[serde(with = "time::serde::rfc3339::option")] - pub due_date: Option, - pub head: Option, - #[serde(deserialize_with = "crate::none_if_blank_url")] - pub html_url: Option, - pub id: Option, - pub is_locked: Option, - pub labels: Option>, - pub merge_base: Option, - pub merge_commit_sha: Option, - pub mergeable: Option, - pub merged: Option, - #[serde(with = "time::serde::rfc3339::option")] - pub merged_at: Option, - pub merged_by: Option, - pub milestone: Option, - pub number: Option, - #[serde(deserialize_with = "crate::none_if_blank_url")] - pub patch_url: Option, - pub pin_order: Option, - pub requested_reviewers: Option>, - pub state: Option, - pub title: Option, - #[serde(with = "time::serde::rfc3339::option")] - pub updated_at: Option, - #[serde(deserialize_with = "crate::none_if_blank_url")] - pub url: Option, - pub user: Option, - } - - /// PullRequestMeta PR info if an issue is a PR - #[derive(Debug, Clone, PartialEq, serde::Serialize, serde::Deserialize)] - pub struct PullRequestMeta { - pub merged: Option, - #[serde(with = "time::serde::rfc3339::option")] - pub merged_at: Option, - } - - /// PullReview represents a pull request review - #[derive(Debug, Clone, PartialEq, serde::Serialize, serde::Deserialize)] - pub struct PullReview { - pub body: Option, - pub comments_count: Option, - pub commit_id: Option, - pub dismissed: Option, - #[serde(deserialize_with = "crate::none_if_blank_url")] - pub html_url: Option, - pub id: Option, - pub official: Option, - #[serde(deserialize_with = "crate::none_if_blank_url")] - pub pull_request_url: Option, - pub stale: Option, - pub state: Option, - #[serde(with = "time::serde::rfc3339::option")] - pub submitted_at: Option, - pub team: Option, - #[serde(with = "time::serde::rfc3339::option")] - pub updated_at: Option, - pub user: Option, - } - - /// PullReviewComment represents a comment on a pull request review - #[derive(Debug, Clone, PartialEq, serde::Serialize, serde::Deserialize)] - pub struct PullReviewComment { - pub body: Option, - pub commit_id: Option, - #[serde(with = "time::serde::rfc3339::option")] - pub created_at: Option, - pub diff_hunk: Option, - #[serde(deserialize_with = "crate::none_if_blank_url")] - pub html_url: Option, - pub id: Option, - pub original_commit_id: Option, - pub original_position: Option, - pub path: Option, - pub position: Option, - pub pull_request_review_id: Option, - #[serde(deserialize_with = "crate::none_if_blank_url")] - pub pull_request_url: Option, - pub resolver: Option, - #[serde(with = "time::serde::rfc3339::option")] - pub updated_at: Option, - pub user: Option, - } - - /// PullReviewRequestOptions are options to add or remove pull review requests - #[derive(Debug, Clone, PartialEq, serde::Serialize, serde::Deserialize)] - pub struct PullReviewRequestOptions { - pub reviewers: Option>, - pub team_reviewers: Option>, - } - - /// PushMirror represents information of a push mirror - #[derive(Debug, Clone, PartialEq, serde::Serialize, serde::Deserialize)] - pub struct PushMirror { - pub created: Option, - pub interval: Option, - pub last_error: Option, - pub last_update: Option, - pub remote_address: Option, - pub remote_name: Option, - pub repo_name: Option, - pub sync_on_commit: Option, - } - - /// Reaction contain one reaction - #[derive(Debug, Clone, PartialEq, serde::Serialize, serde::Deserialize)] - pub struct Reaction { - pub content: Option, - #[serde(with = "time::serde::rfc3339::option")] - pub created_at: Option, - pub user: Option, - } - - #[derive(Debug, Clone, PartialEq, serde::Serialize, serde::Deserialize)] - pub struct Reference { - pub object: Option, - #[serde(rename = "ref")] - pub r#ref: Option, - #[serde(deserialize_with = "crate::none_if_blank_url")] - pub url: Option, - } - - /// Release represents a repository release - #[derive(Debug, Clone, PartialEq, serde::Serialize, serde::Deserialize)] - pub struct Release { - pub assets: Option>, - pub author: Option, - pub body: Option, - #[serde(with = "time::serde::rfc3339::option")] - pub created_at: Option, - pub draft: Option, - #[serde(deserialize_with = "crate::none_if_blank_url")] - pub html_url: Option, - pub id: Option, - pub name: Option, - pub prerelease: Option, - #[serde(with = "time::serde::rfc3339::option")] - pub published_at: Option, - pub tag_name: Option, - #[serde(deserialize_with = "crate::none_if_blank_url")] - pub tarball_url: Option, - pub target_commitish: Option, - #[serde(deserialize_with = "crate::none_if_blank_url")] - pub upload_url: Option, - #[serde(deserialize_with = "crate::none_if_blank_url")] - pub url: Option, - #[serde(deserialize_with = "crate::none_if_blank_url")] - pub zipball_url: Option, - } - - /// RenameUserOption options when renaming a user - #[derive(Debug, Clone, PartialEq, serde::Serialize, serde::Deserialize)] - pub struct RenameUserOption { - /// New username for this user. This name cannot be in use yet by any other user. - pub new_username: String, - } - - /// RepoCollaboratorPermission to get repository permission for a collaborator - #[derive(Debug, Clone, PartialEq, serde::Serialize, serde::Deserialize)] - pub struct RepoCollaboratorPermission { - pub permission: Option, - pub role_name: Option, - pub user: Option, - } - - #[derive(Debug, Clone, PartialEq, serde::Serialize, serde::Deserialize)] - pub struct RepoCommit { - pub author: Option, - pub committer: Option, - pub message: Option, - pub tree: Option, - #[serde(deserialize_with = "crate::none_if_blank_url")] - pub url: Option, - pub verification: Option, - } - - /// RepoTopicOptions a collection of repo topic names - #[derive(Debug, Clone, PartialEq, serde::Serialize, serde::Deserialize)] - pub struct RepoTopicOptions { - /// list of topic names - pub topics: Option>, - } - - /// RepoTransfer represents a pending repo transfer - #[derive(Debug, Clone, PartialEq, serde::Serialize, serde::Deserialize)] - pub struct RepoTransfer { - pub doer: Option, - pub recipient: Option, - pub teams: Option>, - } - - /// Repository represents a repository - #[derive(Debug, Clone, PartialEq, serde::Serialize, serde::Deserialize)] - pub struct Repository { - pub allow_merge_commits: Option, - pub allow_rebase: Option, - pub allow_rebase_explicit: Option, - pub allow_rebase_update: Option, - pub allow_squash_merge: Option, - pub archived: Option, - #[serde(with = "time::serde::rfc3339::option")] - pub archived_at: Option, - #[serde(deserialize_with = "crate::none_if_blank_url")] - pub avatar_url: Option, - #[serde(deserialize_with = "crate::none_if_blank_url")] - pub clone_url: Option, - #[serde(with = "time::serde::rfc3339::option")] - pub created_at: Option, - pub default_allow_maintainer_edit: Option, - pub default_branch: Option, - pub default_delete_branch_after_merge: Option, - pub default_merge_style: Option, - pub description: Option, - pub empty: Option, - pub external_tracker: Option, - pub external_wiki: Option, - pub fork: Option, - pub forks_count: Option, - pub full_name: Option, - pub has_actions: Option, - pub has_issues: Option, - pub has_packages: Option, - pub has_projects: Option, - pub has_pull_requests: Option, - pub has_releases: Option, - pub has_wiki: Option, - #[serde(deserialize_with = "crate::none_if_blank_url")] - pub html_url: Option, - pub id: Option, - pub ignore_whitespace_conflicts: Option, - pub internal: Option, - pub internal_tracker: Option, - pub language: Option, - #[serde(deserialize_with = "crate::none_if_blank_url")] - pub languages_url: Option, - pub link: Option, - pub mirror: Option, - pub mirror_interval: Option, - #[serde(with = "time::serde::rfc3339::option")] - pub mirror_updated: Option, - pub name: Option, - pub open_issues_count: Option, - pub open_pr_counter: Option, - #[serde(deserialize_with = "crate::none_if_blank_url")] - pub original_url: Option, - pub owner: Option, - pub parent: Option>, - pub permissions: Option, - pub private: Option, - pub release_counter: Option, - pub repo_transfer: Option, - pub size: Option, - pub ssh_url: Option, - pub stars_count: Option, - pub template: Option, - #[serde(with = "time::serde::rfc3339::option")] - pub updated_at: Option, - #[serde(deserialize_with = "crate::none_if_blank_url")] - pub url: Option, - pub watchers_count: Option, - pub website: Option, - } - - /// RepositoryMeta basic repository information - #[derive(Debug, Clone, PartialEq, serde::Serialize, serde::Deserialize)] - pub struct RepositoryMeta { - pub full_name: Option, - pub id: Option, - pub name: Option, - pub owner: Option, - } - - /// ReviewStateType review state type - #[derive(Debug, Clone, PartialEq, serde::Serialize, serde::Deserialize)] - pub struct ReviewStateType {} - - /// SearchResults results of a successful search - #[derive(Debug, Clone, PartialEq, serde::Serialize, serde::Deserialize)] - pub struct SearchResults { - pub data: Option>, - pub ok: Option, - } - - /// Secret represents a secret - #[derive(Debug, Clone, PartialEq, serde::Serialize, serde::Deserialize)] - pub struct Secret { - #[serde(with = "time::serde::rfc3339::option")] - pub created_at: Option, - /// the secret's name - pub name: Option, - } - - /// ServerVersion wraps the version of the server - #[derive(Debug, Clone, PartialEq, serde::Serialize, serde::Deserialize)] - pub struct ServerVersion { - pub version: Option, - } - - /// StateType issue state type - #[derive(Debug, Clone, PartialEq, serde::Serialize, serde::Deserialize)] - pub struct StateType {} - - /// StopWatch represent a running stopwatch - #[derive(Debug, Clone, PartialEq, serde::Serialize, serde::Deserialize)] - pub struct StopWatch { - #[serde(with = "time::serde::rfc3339::option")] - pub created: Option, - pub duration: Option, - pub issue_index: Option, - pub issue_title: Option, - pub repo_name: Option, - pub repo_owner_name: Option, - pub seconds: Option, - } - - /// SubmitPullReviewOptions are options to submit a pending pull review - #[derive(Debug, Clone, PartialEq, serde::Serialize, serde::Deserialize)] - pub struct SubmitPullReviewOptions { - pub body: Option, - pub event: Option, - } - - /// Tag represents a repository tag - #[derive(Debug, Clone, PartialEq, serde::Serialize, serde::Deserialize)] - pub struct Tag { - pub commit: Option, - pub id: Option, - pub message: Option, - pub name: Option, - #[serde(deserialize_with = "crate::none_if_blank_url")] - pub tarball_url: Option, - #[serde(deserialize_with = "crate::none_if_blank_url")] - pub zipball_url: Option, - } - - /// Team represents a team in an organization - #[derive(Debug, Clone, PartialEq, serde::Serialize, serde::Deserialize)] - pub struct Team { - pub can_create_org_repo: Option, - pub description: Option, - pub id: Option, - pub includes_all_repositories: Option, - pub name: Option, - pub organization: Option, - pub permission: Option, - pub units: Option>, - pub units_map: Option, - } - - #[derive(Debug, Clone, PartialEq, serde::Serialize, serde::Deserialize)] - pub enum TeamPermission { - None, - Read, - Write, - Admin, - Owner, - } - - impl TeamPermission { - fn as_str(&self) -> &'static str { - match self { - TeamPermission::None => "none", - TeamPermission::Read => "read", - TeamPermission::Write => "write", - TeamPermission::Admin => "admin", - TeamPermission::Owner => "owner", - } - } - } - #[derive(Debug, Clone, PartialEq, serde::Serialize, serde::Deserialize)] - pub struct TeamUnitsMap { - #[serde(flatten)] - pub additional: std::collections::BTreeMap, - } - - /// TimeStamp defines a timestamp - #[derive(Debug, Clone, PartialEq, serde::Serialize, serde::Deserialize)] - pub struct TimeStamp {} - - /// TimelineComment represents a timeline comment (comment of any type) on a commit or issue - #[derive(Debug, Clone, PartialEq, serde::Serialize, serde::Deserialize)] - pub struct TimelineComment { - pub assignee: Option, - pub assignee_team: Option, - pub body: Option, - #[serde(with = "time::serde::rfc3339::option")] - pub created_at: Option, - pub dependent_issue: Option, - #[serde(deserialize_with = "crate::none_if_blank_url")] - pub html_url: Option, - pub id: Option, - #[serde(deserialize_with = "crate::none_if_blank_url")] - pub issue_url: Option, - pub label: Option