From 40528973bec5cd4bf0a2a151f24f03b3679fc940 Mon Sep 17 00:00:00 2001 From: Cyborus Date: Sun, 14 Jul 2024 16:33:58 -0400 Subject: chore: generate --- src/generated/methods.rs | 547 +++++++++++++++++++++++++++++++++++++++++++++++ src/generated/structs.rs | 318 ++++++++++++++++++++++++++- 2 files changed, 858 insertions(+), 7 deletions(-) diff --git a/src/generated/methods.rs b/src/generated/methods.rs index 7eeb1b0..b9657c5 100644 --- a/src/generated/methods.rs +++ b/src/generated/methods.rs @@ -3,6 +3,43 @@ use crate::ForgejoError; use std::collections::BTreeMap; impl crate::Forgejo { + /// Returns the Repository actor for a repo + /// + /// - `repository-id`: repository ID of the repo + pub async fn activitypub_repository( + &self, + repository_id: u32, + ) -> Result { + let request = self + .get(&format!("activitypub/repository-id/{repository_id}")) + .build()?; + let response = self.execute(request).await?; + match response.status().as_u16() { + 200 => Ok(response.json().await?), + _ => Err(ForgejoError::UnexpectedStatusCode(response.status())), + } + } + + /// Send to the inbox + /// + /// - `repository-id`: repository ID of the repo + /// - `body`: See [`ForgeLike`] + pub async fn activitypub_repository_inbox( + &self, + repository_id: u32, + body: ForgeLike, + ) -> Result<(), ForgejoError> { + let request = self + .post(&format!("activitypub/repository-id/{repository_id}/inbox")) + .json(&body) + .build()?; + let response = self.execute(request).await?; + match response.status().as_u16() { + 204 => Ok(()), + _ => Err(ForgejoError::UnexpectedStatusCode(response.status())), + } + } + /// Returns the Person actor for a user /// /// - `user-id`: user ID of the user @@ -749,6 +786,110 @@ impl crate::Forgejo { } } + /// Get an org-level variables list + /// + /// - `org`: name of the organization + pub async fn get_org_variables_list( + &self, + org: &str, + query: GetOrgVariablesListQuery, + ) -> Result, ForgejoError> { + let request = self + .get(&format!("orgs/{org}/actions/variables?{query}")) + .build()?; + let response = self.execute(request).await?; + match response.status().as_u16() { + 200 => Ok(response.json().await?), + _ => Err(ForgejoError::UnexpectedStatusCode(response.status())), + } + } + + /// Get an org-level variable + /// + /// - `org`: name of the organization + /// - `variablename`: name of the variable + pub async fn get_org_variable( + &self, + org: &str, + variablename: &str, + ) -> Result { + let request = self + .get(&format!("orgs/{org}/actions/variables/{variablename}")) + .build()?; + let response = self.execute(request).await?; + match response.status().as_u16() { + 200 => Ok(response.json().await?), + _ => Err(ForgejoError::UnexpectedStatusCode(response.status())), + } + } + + /// Update an org-level variable + /// + /// - `org`: name of the organization + /// - `variablename`: name of the variable + /// - `body`: See [`UpdateVariableOption`] + pub async fn update_org_variable( + &self, + org: &str, + variablename: &str, + body: UpdateVariableOption, + ) -> Result<(), ForgejoError> { + let request = self + .put(&format!("orgs/{org}/actions/variables/{variablename}")) + .json(&body) + .build()?; + let response = self.execute(request).await?; + match response.status().as_u16() { + 201 => Ok(()), + 204 => Ok(()), + _ => Err(ForgejoError::UnexpectedStatusCode(response.status())), + } + } + + /// Create an org-level variable + /// + /// - `org`: name of the organization + /// - `variablename`: name of the variable + /// - `body`: See [`CreateVariableOption`] + pub async fn create_org_variable( + &self, + org: &str, + variablename: &str, + body: CreateVariableOption, + ) -> Result<(), ForgejoError> { + let request = self + .post(&format!("orgs/{org}/actions/variables/{variablename}")) + .json(&body) + .build()?; + let response = self.execute(request).await?; + match response.status().as_u16() { + 201 => Ok(()), + 204 => Ok(()), + _ => Err(ForgejoError::UnexpectedStatusCode(response.status())), + } + } + + /// Delete an org-level variable + /// + /// - `org`: name of the organization + /// - `variablename`: name of the variable + pub async fn delete_org_variable( + &self, + org: &str, + variablename: &str, + ) -> Result, ForgejoError> { + let request = self + .delete(&format!("orgs/{org}/actions/variables/{variablename}")) + .build()?; + let response = self.execute(request).await?; + match response.status().as_u16() { + 200 => Ok(Some(response.json().await?)), + 201 => Ok(None), + 204 => Ok(None), + _ => Err(ForgejoError::UnexpectedStatusCode(response.status())), + } + } + /// List an organization's activity feeds /// /// - `org`: name of the org @@ -1392,6 +1533,26 @@ impl crate::Forgejo { } } + /// List an repo's actions secrets + /// + /// - `owner`: owner of the repository + /// - `repo`: name of the repository + pub async fn repo_list_actions_secrets( + &self, + owner: &str, + repo: &str, + query: RepoListActionsSecretsQuery, + ) -> Result, ForgejoError> { + let request = self + .get(&format!("repos/{owner}/{repo}/actions/secrets?{query}")) + .build()?; + let response = self.execute(request).await?; + match response.status().as_u16() { + 200 => Ok(response.json().await?), + _ => Err(ForgejoError::UnexpectedStatusCode(response.status())), + } + } + /// Create or Update a secret value in a repository /// /// - `owner`: owner of the repository @@ -1442,6 +1603,174 @@ impl crate::Forgejo { } } + /// List a repository's action tasks + /// + /// - `owner`: owner of the repo + /// - `repo`: name of the repo + pub async fn list_action_tasks( + &self, + owner: &str, + repo: &str, + query: ListActionTasksQuery, + ) -> Result { + let request = self + .get(&format!("repos/{owner}/{repo}/actions/tasks?{query}")) + .build()?; + let response = self.execute(request).await?; + match response.status().as_u16() { + 200 => Ok(response.json().await?), + _ => Err(ForgejoError::UnexpectedStatusCode(response.status())), + } + } + + /// Get repo-level variables list + /// + /// - `owner`: name of the owner + /// - `repo`: name of the repository + pub async fn get_repo_variables_list( + &self, + owner: &str, + repo: &str, + query: GetRepoVariablesListQuery, + ) -> Result, ForgejoError> { + let request = self + .get(&format!("repos/{owner}/{repo}/actions/variables?{query}")) + .build()?; + let response = self.execute(request).await?; + match response.status().as_u16() { + 200 => Ok(response.json().await?), + _ => Err(ForgejoError::UnexpectedStatusCode(response.status())), + } + } + + /// Get a repo-level variable + /// + /// - `owner`: name of the owner + /// - `repo`: name of the repository + /// - `variablename`: name of the variable + pub async fn get_repo_variable( + &self, + owner: &str, + repo: &str, + variablename: &str, + ) -> Result { + let request = self + .get(&format!( + "repos/{owner}/{repo}/actions/variables/{variablename}" + )) + .build()?; + let response = self.execute(request).await?; + match response.status().as_u16() { + 200 => Ok(response.json().await?), + _ => Err(ForgejoError::UnexpectedStatusCode(response.status())), + } + } + + /// Update a repo-level variable + /// + /// - `owner`: name of the owner + /// - `repo`: name of the repository + /// - `variablename`: name of the variable + /// - `body`: See [`UpdateVariableOption`] + pub async fn update_repo_variable( + &self, + owner: &str, + repo: &str, + variablename: &str, + body: UpdateVariableOption, + ) -> Result<(), ForgejoError> { + let request = self + .put(&format!( + "repos/{owner}/{repo}/actions/variables/{variablename}" + )) + .json(&body) + .build()?; + let response = self.execute(request).await?; + match response.status().as_u16() { + 201 => Ok(()), + 204 => Ok(()), + _ => Err(ForgejoError::UnexpectedStatusCode(response.status())), + } + } + + /// Create a repo-level variable + /// + /// - `owner`: name of the owner + /// - `repo`: name of the repository + /// - `variablename`: name of the variable + /// - `body`: See [`CreateVariableOption`] + pub async fn create_repo_variable( + &self, + owner: &str, + repo: &str, + variablename: &str, + body: CreateVariableOption, + ) -> Result<(), ForgejoError> { + let request = self + .post(&format!( + "repos/{owner}/{repo}/actions/variables/{variablename}" + )) + .json(&body) + .build()?; + let response = self.execute(request).await?; + match response.status().as_u16() { + 201 => Ok(()), + 204 => Ok(()), + _ => Err(ForgejoError::UnexpectedStatusCode(response.status())), + } + } + + /// Delete a repo-level variable + /// + /// - `owner`: name of the owner + /// - `repo`: name of the repository + /// - `variablename`: name of the variable + pub async fn delete_repo_variable( + &self, + owner: &str, + repo: &str, + variablename: &str, + ) -> Result, ForgejoError> { + let request = self + .delete(&format!( + "repos/{owner}/{repo}/actions/variables/{variablename}" + )) + .build()?; + let response = self.execute(request).await?; + match response.status().as_u16() { + 200 => Ok(Some(response.json().await?)), + 201 => Ok(None), + 204 => Ok(None), + _ => Err(ForgejoError::UnexpectedStatusCode(response.status())), + } + } + + /// Dispatches a workflow + /// + /// - `owner`: owner of the repo + /// - `repo`: name of the repo + /// - `workflowname`: name of the workflow + /// - `body`: See [`DispatchWorkflowOption`] + pub async fn dispatch_workflow( + &self, + owner: &str, + repo: &str, + workflowname: &str, + body: DispatchWorkflowOption, + ) -> Result<(), ForgejoError> { + let request = self + .post(&format!( + "repos/{owner}/{repo}/actions/workflows/{workflowname}/dispatches" + )) + .json(&body) + .build()?; + let response = self.execute(request).await?; + match response.status().as_u16() { + 204 => Ok(()), + _ => Err(ForgejoError::UnexpectedStatusCode(response.status())), + } + } + /// List a repository's activity feeds /// /// - `owner`: owner of the repo @@ -1934,6 +2263,27 @@ impl crate::Forgejo { } } + /// Get commit comparison information + /// + /// - `owner`: owner of the repo + /// - `repo`: name of the repo + /// - `basehead`: compare two branches or commits + pub async fn repo_compare_diff( + &self, + owner: &str, + repo: &str, + basehead: &str, + ) -> Result { + let request = self + .get(&format!("repos/{owner}/{repo}/compare/{basehead}")) + .build()?; + let response = self.execute(request).await?; + match response.status().as_u16() { + 200 => Ok(response.json().await?), + _ => Err(ForgejoError::UnexpectedStatusCode(response.status())), + } + } + /// Gets the metadata of all the entries of the root dir /// /// - `owner`: owner of the repo @@ -5745,6 +6095,113 @@ impl crate::Forgejo { } } + /// List tag protections for a repository + /// + /// - `owner`: owner of the repo + /// - `repo`: name of the repo + pub async fn repo_list_tag_protection( + &self, + owner: &str, + repo: &str, + ) -> Result, ForgejoError> { + let request = self + .get(&format!("repos/{owner}/{repo}/tag_protections")) + .build()?; + let response = self.execute(request).await?; + match response.status().as_u16() { + 200 => Ok(response.json().await?), + _ => Err(ForgejoError::UnexpectedStatusCode(response.status())), + } + } + + /// Create a tag protections for a repository + /// + /// - `owner`: owner of the repo + /// - `repo`: name of the repo + /// - `body`: See [`CreateTagProtectionOption`] + pub async fn repo_create_tag_protection( + &self, + owner: &str, + repo: &str, + body: CreateTagProtectionOption, + ) -> Result { + let request = self + .post(&format!("repos/{owner}/{repo}/tag_protections")) + .json(&body) + .build()?; + let response = self.execute(request).await?; + match response.status().as_u16() { + 201 => Ok(response.json().await?), + _ => Err(ForgejoError::UnexpectedStatusCode(response.status())), + } + } + + /// Get a specific tag protection for the repository + /// + /// - `owner`: owner of the repo + /// - `repo`: name of the repo + /// - `id`: id of the tag protect to get + pub async fn repo_get_tag_protection( + &self, + owner: &str, + repo: &str, + id: u32, + ) -> Result { + let request = self + .get(&format!("repos/{owner}/{repo}/tag_protections/{id}")) + .build()?; + let response = self.execute(request).await?; + match response.status().as_u16() { + 200 => Ok(response.json().await?), + _ => Err(ForgejoError::UnexpectedStatusCode(response.status())), + } + } + + /// Delete a specific tag protection for the repository + /// + /// - `owner`: owner of the repo + /// - `repo`: name of the repo + /// - `id`: id of protected tag + pub async fn repo_delete_tag_protection( + &self, + owner: &str, + repo: &str, + id: u32, + ) -> Result<(), ForgejoError> { + let request = self + .delete(&format!("repos/{owner}/{repo}/tag_protections/{id}")) + .build()?; + let response = self.execute(request).await?; + match response.status().as_u16() { + 204 => Ok(()), + _ => Err(ForgejoError::UnexpectedStatusCode(response.status())), + } + } + + /// Edit a tag protections for a repository. Only fields that are set will be changed + /// + /// - `owner`: owner of the repo + /// - `repo`: name of the repo + /// - `id`: id of protected tag + /// - `body`: See [`EditTagProtectionOption`] + pub async fn repo_edit_tag_protection( + &self, + owner: &str, + repo: &str, + id: u32, + body: EditTagProtectionOption, + ) -> Result { + let request = self + .patch(&format!("repos/{owner}/{repo}/tag_protections/{id}")) + .json(&body) + .build()?; + let response = self.execute(request).await?; + match response.status().as_u16() { + 200 => Ok(response.json().await?), + _ => Err(ForgejoError::UnexpectedStatusCode(response.status())), + } + } + /// List a repository's tags /// /// - `owner`: owner of the repo @@ -6592,6 +7049,96 @@ impl crate::Forgejo { } } + /// Get the user-level list of variables which is created by current doer + /// + pub async fn get_user_variables_list( + &self, + query: GetUserVariablesListQuery, + ) -> Result, ForgejoError> { + let request = self + .get(&format!("user/actions/variables?{query}")) + .build()?; + let response = self.execute(request).await?; + match response.status().as_u16() { + 200 => Ok(response.json().await?), + _ => Err(ForgejoError::UnexpectedStatusCode(response.status())), + } + } + + /// Get a user-level variable which is created by current doer + /// + /// - `variablename`: name of the variable + pub async fn get_user_variable( + &self, + variablename: &str, + ) -> Result { + let request = self + .get(&format!("user/actions/variables/{variablename}")) + .build()?; + let response = self.execute(request).await?; + match response.status().as_u16() { + 200 => Ok(response.json().await?), + _ => Err(ForgejoError::UnexpectedStatusCode(response.status())), + } + } + + /// Update a user-level variable which is created by current doer + /// + /// - `variablename`: name of the variable + /// - `body`: See [`UpdateVariableOption`] + pub async fn update_user_variable( + &self, + variablename: &str, + body: UpdateVariableOption, + ) -> Result<(), ForgejoError> { + let request = self + .put(&format!("user/actions/variables/{variablename}")) + .json(&body) + .build()?; + let response = self.execute(request).await?; + match response.status().as_u16() { + 201 => Ok(()), + 204 => Ok(()), + _ => Err(ForgejoError::UnexpectedStatusCode(response.status())), + } + } + + /// Create a user-level variable + /// + /// - `variablename`: name of the variable + /// - `body`: See [`CreateVariableOption`] + pub async fn create_user_variable( + &self, + variablename: &str, + body: CreateVariableOption, + ) -> Result<(), ForgejoError> { + let request = self + .post(&format!("user/actions/variables/{variablename}")) + .json(&body) + .build()?; + let response = self.execute(request).await?; + match response.status().as_u16() { + 201 => Ok(()), + 204 => Ok(()), + _ => Err(ForgejoError::UnexpectedStatusCode(response.status())), + } + } + + /// Delete a user-level variable which is created by current doer + /// + /// - `variablename`: name of the variable + pub async fn delete_user_variable(&self, variablename: &str) -> Result<(), ForgejoError> { + let request = self + .delete(&format!("user/actions/variables/{variablename}")) + .build()?; + let response = self.execute(request).await?; + match response.status().as_u16() { + 201 => Ok(()), + 204 => Ok(()), + _ => Err(ForgejoError::UnexpectedStatusCode(response.status())), + } + } + /// List the authenticated user's oauth2 applications /// pub async fn user_get_oauth2_applications( diff --git a/src/generated/structs.rs b/src/generated/structs.rs index b08b0ee..48d1326 100644 --- a/src/generated/structs.rs +++ b/src/generated/structs.rs @@ -17,6 +17,48 @@ pub struct AccessToken { pub token_last_eight: Option, } +/// ActionTask represents a ActionTask +#[derive(Debug, Clone, PartialEq, serde::Serialize, serde::Deserialize)] +pub struct ActionTask { + #[serde(with = "time::serde::rfc3339::option")] + pub created_at: Option, + pub display_title: Option, + pub event: Option, + pub head_branch: Option, + pub head_sha: Option, + pub id: Option, + pub name: Option, + pub run_number: Option, + #[serde(with = "time::serde::rfc3339::option")] + pub run_started_at: Option, + pub status: Option, + #[serde(with = "time::serde::rfc3339::option")] + pub updated_at: Option, + #[serde(deserialize_with = "crate::none_if_blank_url")] + pub url: Option, + pub workflow_id: Option, +} + +/// ActionTaskResponse returns a ActionTask +#[derive(Debug, Clone, PartialEq, serde::Serialize, serde::Deserialize)] +pub struct ActionTaskResponse { + pub total_count: Option, + pub workflow_runs: Option>, +} + +/// ActionVariable return value of the query API +#[derive(Debug, Clone, PartialEq, serde::Serialize, serde::Deserialize)] +pub struct ActionVariable { + /// the value of the variable + pub data: Option, + /// the name of the variable + pub name: Option, + /// the owner to which the variable belongs + pub owner_id: Option, + /// the repository to which the variable belongs + pub repo_id: Option, +} + #[derive(Debug, Clone, PartialEq, serde::Serialize, serde::Deserialize)] pub struct Activity { pub act_user: Option, @@ -28,13 +70,73 @@ pub struct Activity { pub created: Option, pub id: Option, pub is_private: Option, - pub op_type: Option, + /// the type of action + pub op_type: Option, pub ref_name: Option, pub repo: Option, pub repo_id: Option, pub user_id: Option, } +/// the type of action + +#[derive(Debug, Clone, Copy, PartialEq, Eq, serde::Serialize, serde::Deserialize)] +pub enum ActivityOpType { + #[serde(rename = "create_repo")] + CreateRepo, + #[serde(rename = "rename_repo")] + RenameRepo, + #[serde(rename = "star_repo")] + StarRepo, + #[serde(rename = "watch_repo")] + WatchRepo, + #[serde(rename = "commit_repo")] + CommitRepo, + #[serde(rename = "create_issue")] + CreateIssue, + #[serde(rename = "create_pull_request")] + CreatePullRequest, + #[serde(rename = "transfer_repo")] + TransferRepo, + #[serde(rename = "push_tag")] + PushTag, + #[serde(rename = "comment_issue")] + CommentIssue, + #[serde(rename = "merge_pull_request")] + MergePullRequest, + #[serde(rename = "close_issue")] + CloseIssue, + #[serde(rename = "reopen_issue")] + ReopenIssue, + #[serde(rename = "close_pull_request")] + ClosePullRequest, + #[serde(rename = "reopen_pull_request")] + ReopenPullRequest, + #[serde(rename = "delete_tag")] + DeleteTag, + #[serde(rename = "delete_branch")] + DeleteBranch, + #[serde(rename = "mirror_sync_push")] + MirrorSyncPush, + #[serde(rename = "mirror_sync_create")] + MirrorSyncCreate, + #[serde(rename = "mirror_sync_delete")] + MirrorSyncDelete, + #[serde(rename = "approve_pull_request")] + ApprovePullRequest, + #[serde(rename = "reject_pull_request")] + RejectPullRequest, + #[serde(rename = "comment_pull")] + CommentPull, + #[serde(rename = "publish_release")] + PublishRelease, + #[serde(rename = "pull_review_dismissed")] + PullReviewDismissed, + #[serde(rename = "pull_request_ready_for_review")] + PullRequestReadyForReview, + #[serde(rename = "auto_merge_pull_request")] + AutoMergePullRequest, +} /// ActivityPub type #[derive(Debug, Clone, PartialEq, serde::Serialize, serde::Deserialize)] pub struct ActivityPub { @@ -62,6 +164,7 @@ pub struct AddTimeOption { /// AnnotatedTag represents an annotated tag #[derive(Debug, Clone, PartialEq, serde::Serialize, serde::Deserialize)] pub struct AnnotatedTag { + pub archive_download_count: Option, pub message: Option, pub object: Option, pub sha: Option, @@ -331,6 +434,12 @@ pub struct CommitUser { pub name: Option, } +#[derive(Debug, Clone, PartialEq, serde::Serialize, serde::Deserialize)] +pub struct Compare { + pub commits: Option>, + pub total_commits: 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 { @@ -665,6 +774,7 @@ pub struct CreatePushMirrorOption { pub struct CreateReleaseOption { pub body: Option, pub draft: Option, + pub hide_archive_links: Option, pub name: Option, pub prerelease: Option, pub tag_name: String, @@ -730,6 +840,14 @@ pub struct CreateTagOption { pub target: Option, } +/// CreateTagProtectionOption options for creating a tag protection +#[derive(Debug, Clone, PartialEq, serde::Serialize, serde::Deserialize)] +pub struct CreateTagProtectionOption { + pub name_pattern: Option, + pub whitelist_teams: Option>, + pub whitelist_usernames: Option>, +} + /// CreateTeamOption options for creating a team #[derive(Debug, Clone, PartialEq, serde::Serialize, serde::Deserialize)] pub struct CreateTeamOption { @@ -773,6 +891,13 @@ pub struct CreateUserOption { pub visibility: Option, } +/// CreateVariableOption the option when creating variable +#[derive(Debug, Clone, PartialEq, serde::Serialize, serde::Deserialize)] +pub struct CreateVariableOption { + /// Value of the variable to create + pub value: String, +} + /// CreateWikiPageOptions form for creating wiki #[derive(Debug, Clone, PartialEq, serde::Serialize, serde::Deserialize)] pub struct CreateWikiPageOptions { @@ -866,6 +991,16 @@ pub struct DismissPullReviewOptions { pub priors: Option, } +/// DispatchWorkflowOption options when dispatching a workflow +#[derive(Debug, Clone, PartialEq, serde::Serialize, serde::Deserialize)] +pub struct DispatchWorkflowOption { + /// Input keys and values configured in the workflow file. + pub inputs: Option>, + /// Git reference for the workflow + #[serde(rename = "ref")] + pub r#ref: String, +} + /// EditAttachmentOptions options for editing attachments #[derive(Debug, Clone, PartialEq, serde::Serialize, serde::Deserialize)] pub struct EditAttachmentOptions { @@ -1022,6 +1157,7 @@ pub struct EditReactionOption { pub struct EditReleaseOption { pub body: Option, pub draft: Option, + pub hide_archive_links: Option, pub name: Option, pub prerelease: Option, pub tag_name: Option, @@ -1058,10 +1194,12 @@ pub struct EditRepoOption { pub default_merge_style: Option, /// a short description of the repository. pub description: Option, - /// enable prune - remove obsolete remote-tracking references + /// enable prune - remove obsolete remote-tracking references when mirroring pub enable_prune: Option, pub external_tracker: Option, pub external_wiki: Option, + /// set the globally editable state of the wiki + pub globally_editable_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. @@ -1097,6 +1235,14 @@ pub struct EditRepoOption { pub wiki_branch: Option, } +/// EditTagProtectionOption options for editing a tag protection +#[derive(Debug, Clone, PartialEq, serde::Serialize, serde::Deserialize)] +pub struct EditTagProtectionOption { + pub name_pattern: Option, + pub whitelist_teams: Option>, + pub whitelist_usernames: Option>, +} + /// EditTeamOption options for editing a team #[derive(Debug, Clone, PartialEq, serde::Serialize, serde::Deserialize)] pub struct EditTeamOption { @@ -1130,14 +1276,14 @@ pub struct EditUserOption { pub email: Option, pub full_name: Option, pub location: Option, - pub login_name: String, + pub login_name: Option, pub max_repo_creation: Option, pub must_change_password: Option, pub password: Option, pub prohibit_login: Option, pub pronouns: Option, pub restricted: Option, - pub source_id: i64, + pub source_id: Option, pub visibility: Option, pub website: Option, } @@ -1223,6 +1369,10 @@ pub struct FilesResponse { pub verification: Option, } +/// ForgeLike activity data type +#[derive(Debug, Clone, PartialEq, serde::Serialize, serde::Deserialize)] +pub struct ForgeLike {} + /// GPGKey a user GPG key to sign commit and tag in repository #[derive(Debug, Clone, PartialEq, serde::Serialize, serde::Deserialize)] pub struct GPGKey { @@ -1502,8 +1652,10 @@ pub struct IssueFormFieldVisible {} /// IssueLabelsOption a collection of labels #[derive(Debug, Clone, PartialEq, serde::Serialize, serde::Deserialize)] pub struct IssueLabelsOption { - /// list of label IDs - pub labels: Option>, + /// Labels can be a list of integers representing label IDs + /// + /// or a list of strings representing label names + pub labels: Option>, #[serde(with = "time::serde::rfc3339::option")] pub updated_at: Option, } @@ -2002,18 +2154,22 @@ pub struct PublicKey { /// PullRequest represents a pull request #[derive(Debug, Clone, PartialEq, serde::Serialize, serde::Deserialize)] pub struct PullRequest { + pub additions: Option, pub allow_maintainer_edit: Option, pub assignee: Option, pub assignees: Option>, pub base: Option, pub body: Option, + pub changed_files: Option, #[serde(with = "time::serde::rfc3339::option")] pub closed_at: Option, pub comments: Option, #[serde(with = "time::serde::rfc3339::option")] pub created_at: Option, + pub deletions: Option, #[serde(deserialize_with = "crate::none_if_blank_url")] pub diff_url: Option, + pub draft: Option, #[serde(with = "time::serde::rfc3339::option")] pub due_date: Option, pub head: Option, @@ -2036,6 +2192,8 @@ pub struct PullRequest { pub pin_order: Option, #[serde(deserialize_with = "crate::requested_reviewers_ignore_null")] pub requested_reviewers: Option>, + /// number of review comments made on the diff of a PR review (not including comments on commits or issues in a PR) + pub review_comments: Option, pub state: Option, pub title: Option, #[serde(with = "time::serde::rfc3339::option")] @@ -2049,6 +2207,8 @@ pub struct PullRequest { #[derive(Debug, Clone, PartialEq, serde::Serialize, serde::Deserialize)] pub struct PullRequestMeta { pub draft: Option, + #[serde(deserialize_with = "crate::none_if_blank_url")] + pub html_url: Option, pub merged: Option, #[serde(with = "time::serde::rfc3339::option")] pub merged_at: Option, @@ -2144,12 +2304,14 @@ pub struct Reference { /// Release represents a repository release #[derive(Debug, Clone, PartialEq, serde::Serialize, serde::Deserialize)] pub struct Release { + pub archive_download_count: Option, pub assets: Option>, pub author: Option, pub body: Option, #[serde(with = "time::serde::rfc3339::option")] pub created_at: Option, pub draft: Option, + pub hide_archive_links: Option, #[serde(deserialize_with = "crate::none_if_blank_url")] pub html_url: Option, pub id: Option, @@ -2245,6 +2407,7 @@ pub struct Repository { pub fork: Option, pub forks_count: Option, pub full_name: Option, + pub globally_editable_wiki: Option, pub has_actions: Option, pub has_issues: Option, pub has_packages: Option, @@ -2283,6 +2446,7 @@ pub struct Repository { pub ssh_url: Option, pub stars_count: Option, pub template: Option, + pub topics: Option>, #[serde(with = "time::serde::rfc3339::option")] pub updated_at: Option, #[serde(deserialize_with = "crate::none_if_blank_url")] @@ -2359,6 +2523,7 @@ pub struct SubmitPullReviewOptions { /// Tag represents a repository tag #[derive(Debug, Clone, PartialEq, serde::Serialize, serde::Deserialize)] pub struct Tag { + pub archive_download_count: Option, pub commit: Option, pub id: Option, pub message: Option, @@ -2369,6 +2534,26 @@ pub struct Tag { pub zipball_url: Option, } +/// TagArchiveDownloadCount counts how many times a archive was downloaded +#[derive(Debug, Clone, PartialEq, serde::Serialize, serde::Deserialize)] +pub struct TagArchiveDownloadCount { + pub tar_gz: Option, + pub zip: Option, +} + +/// TagProtection represents a tag protection +#[derive(Debug, Clone, PartialEq, serde::Serialize, serde::Deserialize)] +pub struct TagProtection { + #[serde(with = "time::serde::rfc3339::option")] + pub created_at: Option, + pub id: Option, + pub name_pattern: Option, + #[serde(with = "time::serde::rfc3339::option")] + pub updated_at: Option, + pub whitelist_teams: Option>, + pub whitelist_usernames: Option>, +} + /// Team represents a team in an organization #[derive(Debug, Clone, PartialEq, serde::Serialize, serde::Deserialize)] pub struct Team { @@ -2522,6 +2707,15 @@ pub struct UpdateUserAvatarOption { pub image: Option, } +/// UpdateVariableOption the option when updating variable +#[derive(Debug, Clone, PartialEq, serde::Serialize, serde::Deserialize)] +pub struct UpdateVariableOption { + /// New name for the variable. If the field is empty, the variable name won't be updated. + pub name: Option, + /// Value of the variable to update + pub value: String, +} + /// User represents a user #[derive(Debug, Clone, PartialEq, serde::Serialize, serde::Deserialize)] pub struct User { @@ -2540,6 +2734,9 @@ pub struct User { pub following_count: Option, /// the user's full name pub full_name: Option, + #[serde(deserialize_with = "crate::none_if_blank_url")] + /// URL to the user's gitea page + pub html_url: Option, /// the user's id pub id: Option, /// Is the user an administrator @@ -2560,6 +2757,8 @@ pub struct User { pub pronouns: Option, /// Is user restricted pub restricted: Option, + /// The ID of the user's Authentication Source + pub source_id: Option, pub starred_repos_count: Option, /// User visibility level option: public, limited, private pub visibility: Option, @@ -3322,6 +3521,27 @@ impl std::fmt::Display for OrgListActionsSecretsQuery { } } +#[derive(Debug, Clone, PartialEq, Default)] +pub struct GetOrgVariablesListQuery { + /// page number of results to return (1-based) + pub page: Option, + /// page size of results + pub limit: Option, +} + +impl std::fmt::Display for GetOrgVariablesListQuery { + fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result { + if let Some(page) = &self.page { + write!(f, "page={page}&")?; + } + if let Some(limit) = &self.limit { + write!(f, "limit={limit}&")?; + } + + Ok(()) + } +} + #[derive(Debug, Clone, PartialEq, Default)] pub struct OrgListActivityFeedsQuery { /// the date of the activities to be found @@ -3777,7 +3997,7 @@ pub struct RepoSearchQuery { pub mode: Option, /// if `uid` is given, search only for repos that the user owns pub exclusive: Option, - /// sort repos by attribute. Supported values are "alpha", "created", "updated", "size", and "id". Default is "alpha" + /// sort repos by attribute. Supported values are "alpha", "created", "updated", "size", "git_size", "lfs_size", "stars", "forks" and "id". Default is "alpha" pub sort: Option, /// sort order, either "asc" (ascending) or "desc" (descending). Default is "asc", ignored if "sort" is not specified. pub order: Option, @@ -3845,6 +4065,69 @@ impl std::fmt::Display for RepoSearchQuery { } } +#[derive(Debug, Clone, PartialEq, Default)] +pub struct RepoListActionsSecretsQuery { + /// page number of results to return (1-based) + pub page: Option, + /// page size of results + pub limit: Option, +} + +impl std::fmt::Display for RepoListActionsSecretsQuery { + fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result { + if let Some(page) = &self.page { + write!(f, "page={page}&")?; + } + if let Some(limit) = &self.limit { + write!(f, "limit={limit}&")?; + } + + Ok(()) + } +} + +#[derive(Debug, Clone, PartialEq, Default)] +pub struct ListActionTasksQuery { + /// page number of results to return (1-based) + pub page: Option, + /// page size of results, default maximum page size is 50 + pub limit: Option, +} + +impl std::fmt::Display for ListActionTasksQuery { + fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result { + if let Some(page) = &self.page { + write!(f, "page={page}&")?; + } + if let Some(limit) = &self.limit { + write!(f, "limit={limit}&")?; + } + + Ok(()) + } +} + +#[derive(Debug, Clone, PartialEq, Default)] +pub struct GetRepoVariablesListQuery { + /// page number of results to return (1-based) + pub page: Option, + /// page size of results + pub limit: Option, +} + +impl std::fmt::Display for GetRepoVariablesListQuery { + fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result { + if let Some(page) = &self.page { + write!(f, "page={page}&")?; + } + if let Some(limit) = &self.limit { + write!(f, "limit={limit}&")?; + } + + Ok(()) + } +} + #[derive(Debug, Clone, PartialEq, Default)] pub struct RepoListActivityFeedsQuery { /// the date of the activities to be found @@ -5592,6 +5875,27 @@ impl std::fmt::Display for TopicSearchQuery { } } +#[derive(Debug, Clone, PartialEq, Default)] +pub struct GetUserVariablesListQuery { + /// page number of results to return (1-based) + pub page: Option, + /// page size of results + pub limit: Option, +} + +impl std::fmt::Display for GetUserVariablesListQuery { + fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result { + if let Some(page) = &self.page { + write!(f, "page={page}&")?; + } + if let Some(limit) = &self.limit { + write!(f, "limit={limit}&")?; + } + + Ok(()) + } +} + #[derive(Debug, Clone, PartialEq, Default)] pub struct UserGetOAuth2ApplicationsQuery { /// page number of results to return (1-based) -- cgit v1.2.3