summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--.woodpecker/integration.yml5
-rw-r--r--generator/src/methods.rs12
-rw-r--r--src/generated/methods.rs547
-rw-r--r--src/generated/structs.rs318
-rw-r--r--swagger.v1.json1523
-rw-r--r--tests/organization.rs58
-rw-r--r--tests/repo.rs103
-rw-r--r--tests/user.rs44
8 files changed, 2583 insertions, 27 deletions
diff --git a/.woodpecker/integration.yml b/.woodpecker/integration.yml
index 5ace7f7..8dd4e3e 100644
--- a/.woodpecker/integration.yml
+++ b/.woodpecker/integration.yml
@@ -5,10 +5,11 @@ steps:
image: rust
environment:
- "FORGEJO_API_CI_INSTANCE_URL=http://forgejo-testing:3000/"
- - FORGEJO_API_CI_TOKEN=3906093e3d85cf0402623eb4a5287bc0f828e820
+ - FORGEJO_API_CI_TOKEN=e4f301dffd4993a3389f601761c0103291e58d85
commands:
- cargo test
services:
forgejo-testing:
- image: code.cartoon-aa.xyz/cyborus/ci-forgejo:7.0.1
+ pull: true
+ image: code.cartoon-aa.xyz/cyborus/ci-forgejo:8.0.0
diff --git a/generator/src/methods.rs b/generator/src/methods.rs
index 8039f96..93d5f57 100644
--- a/generator/src/methods.rs
+++ b/generator/src/methods.rs
@@ -555,14 +555,18 @@ impl ResponseType {
fn merge(self, other: Self) -> eyre::Result<Self> {
let headers = match (self.headers, other.headers) {
(Some(a), Some(b)) if a != b => eyre::bail!("incompatible header types in response"),
- (Some(a), None) => Some(format!("Option<{a}>")),
- (None, Some(b)) => Some(format!("Option<{b}>")),
+ (Some(a), None) if !a.starts_with("Option<") => Some(format!("Option<{a}>")),
+ (None, Some(b)) if !b.starts_with("Option<") => Some(format!("Option<{b}>")),
(a, b) => a.or(b),
};
let body = match (self.body.as_deref(), other.body.as_deref()) {
(Some(a), Some(b)) if a != b => eyre::bail!("incompatible header types in response"),
- (Some(a), Some("()") | None) => Some(format!("Option<{a}>")),
- (Some("()") | None, Some(b)) => Some(format!("Option<{b}>")),
+ (Some(a), Some("()") | None) if !a.starts_with("Option<") => {
+ Some(format!("Option<{a}>"))
+ }
+ (Some("()") | None, Some(b)) if !b.starts_with("Option<") => {
+ Some(format!("Option<{b}>"))
+ }
(_, _) => self.body.or(other.body),
};
use ResponseKind::*;
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<ActivityPub, ForgejoError> {
+ 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<Vec<ActionVariable>, 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<ActionVariable, ForgejoError> {
+ 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<Option<ActionVariable>, 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<Vec<Secret>, 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<ActionTaskResponse, ForgejoError> {
+ 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<Vec<ActionVariable>, 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<ActionVariable, ForgejoError> {
+ 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<Option<ActionVariable>, 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<Compare, ForgejoError> {
+ 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<Vec<TagProtection>, 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<TagProtection, ForgejoError> {
+ 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<TagProtection, ForgejoError> {
+ 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<TagProtection, ForgejoError> {
+ 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<Vec<ActionVariable>, 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<ActionVariable, ForgejoError> {
+ 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<String>,
}
+/// 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<time::OffsetDateTime>,
+ pub display_title: Option<String>,
+ pub event: Option<String>,
+ pub head_branch: Option<String>,
+ pub head_sha: Option<String>,
+ pub id: Option<i64>,
+ pub name: Option<String>,
+ pub run_number: Option<i64>,
+ #[serde(with = "time::serde::rfc3339::option")]
+ pub run_started_at: Option<time::OffsetDateTime>,
+ pub status: Option<String>,
+ #[serde(with = "time::serde::rfc3339::option")]
+ pub updated_at: Option<time::OffsetDateTime>,
+ #[serde(deserialize_with = "crate::none_if_blank_url")]
+ pub url: Option<url::Url>,
+ pub workflow_id: Option<String>,
+}
+
+/// ActionTaskResponse returns a ActionTask
+#[derive(Debug, Clone, PartialEq, serde::Serialize, serde::Deserialize)]
+pub struct ActionTaskResponse {
+ pub total_count: Option<i64>,
+ pub workflow_runs: Option<Vec<ActionTask>>,
+}
+
+/// 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<String>,
+ /// the name of the variable
+ pub name: Option<String>,
+ /// the owner to which the variable belongs
+ pub owner_id: Option<i64>,
+ /// the repository to which the variable belongs
+ pub repo_id: Option<i64>,
+}
+
#[derive(Debug, Clone, PartialEq, serde::Serialize, serde::Deserialize)]
pub struct Activity {
pub act_user: Option<User>,
@@ -28,13 +70,73 @@ pub struct Activity {
pub created: Option<time::OffsetDateTime>,
pub id: Option<i64>,
pub is_private: Option<bool>,
- pub op_type: Option<String>,
+ /// the type of action
+ pub op_type: Option<ActivityOpType>,
pub ref_name: Option<String>,
pub repo: Option<Repository>,
pub repo_id: Option<i64>,
pub user_id: Option<i64>,
}
+/// 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<TagArchiveDownloadCount>,
pub message: Option<String>,
pub object: Option<AnnotatedTagObject>,
pub sha: Option<String>,
@@ -331,6 +434,12 @@ pub struct CommitUser {
pub name: Option<String>,
}
+#[derive(Debug, Clone, PartialEq, serde::Serialize, serde::Deserialize)]
+pub struct Compare {
+ pub commits: Option<Vec<Commit>>,
+ pub total_commits: Option<i64>,
+}
+
/// 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<String>,
pub draft: Option<bool>,
+ pub hide_archive_links: Option<bool>,
pub name: Option<String>,
pub prerelease: Option<bool>,
pub tag_name: String,
@@ -730,6 +840,14 @@ pub struct CreateTagOption {
pub target: Option<String>,
}
+/// CreateTagProtectionOption options for creating a tag protection
+#[derive(Debug, Clone, PartialEq, serde::Serialize, serde::Deserialize)]
+pub struct CreateTagProtectionOption {
+ pub name_pattern: Option<String>,
+ pub whitelist_teams: Option<Vec<String>>,
+ pub whitelist_usernames: Option<Vec<String>>,
+}
+
/// 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<String>,
}
+/// 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<bool>,
}
+/// 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<BTreeMap<String, String>>,
+ /// 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<String>,
pub draft: Option<bool>,
+ pub hide_archive_links: Option<bool>,
pub name: Option<String>,
pub prerelease: Option<bool>,
pub tag_name: Option<String>,
@@ -1058,10 +1194,12 @@ pub struct EditRepoOption {
pub default_merge_style: Option<DefaultMergeStyle>,
/// a short description of the repository.
pub description: Option<String>,
- /// enable prune - remove obsolete remote-tracking references
+ /// enable prune - remove obsolete remote-tracking references when mirroring
pub enable_prune: Option<bool>,
pub external_tracker: Option<ExternalTracker>,
pub external_wiki: Option<ExternalWiki>,
+ /// set the globally editable state of the wiki
+ pub globally_editable_wiki: Option<bool>,
/// either `true` to enable actions unit, or `false` to disable them.
pub has_actions: Option<bool>,
/// either `true` to enable issues for this repository or `false` to disable them.
@@ -1097,6 +1235,14 @@ pub struct EditRepoOption {
pub wiki_branch: Option<String>,
}
+/// EditTagProtectionOption options for editing a tag protection
+#[derive(Debug, Clone, PartialEq, serde::Serialize, serde::Deserialize)]
+pub struct EditTagProtectionOption {
+ pub name_pattern: Option<String>,
+ pub whitelist_teams: Option<Vec<String>>,
+ pub whitelist_usernames: Option<Vec<String>>,
+}
+
/// 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<String>,
pub full_name: Option<String>,
pub location: Option<String>,
- pub login_name: String,
+ pub login_name: Option<String>,
pub max_repo_creation: Option<i64>,
pub must_change_password: Option<bool>,
pub password: Option<String>,
pub prohibit_login: Option<bool>,
pub pronouns: Option<String>,
pub restricted: Option<bool>,
- pub source_id: i64,
+ pub source_id: Option<i64>,
pub visibility: Option<String>,
pub website: Option<String>,
}
@@ -1223,6 +1369,10 @@ pub struct FilesResponse {
pub verification: Option<PayloadCommitVerification>,
}
+/// 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<Vec<i64>>,
+ /// Labels can be a list of integers representing label IDs
+ ///
+ /// or a list of strings representing label names
+ pub labels: Option<Vec<serde_json::Value>>,
#[serde(with = "time::serde::rfc3339::option")]
pub updated_at: Option<time::OffsetDateTime>,
}
@@ -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<i64>,
pub allow_maintainer_edit: Option<bool>,
pub assignee: Option<User>,
pub assignees: Option<Vec<User>>,
pub base: Option<PRBranchInfo>,
pub body: Option<String>,
+ pub changed_files: Option<i64>,
#[serde(with = "time::serde::rfc3339::option")]
pub closed_at: Option<time::OffsetDateTime>,
pub comments: Option<i64>,
#[serde(with = "time::serde::rfc3339::option")]
pub created_at: Option<time::OffsetDateTime>,
+ pub deletions: Option<i64>,
#[serde(deserialize_with = "crate::none_if_blank_url")]
pub diff_url: Option<url::Url>,
+ pub draft: Option<bool>,
#[serde(with = "time::serde::rfc3339::option")]
pub due_date: Option<time::OffsetDateTime>,
pub head: Option<PRBranchInfo>,
@@ -2036,6 +2192,8 @@ pub struct PullRequest {
pub pin_order: Option<i64>,
#[serde(deserialize_with = "crate::requested_reviewers_ignore_null")]
pub requested_reviewers: Option<Vec<User>>,
+ /// 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<i64>,
pub state: Option<StateType>,
pub title: Option<String>,
#[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<bool>,
+ #[serde(deserialize_with = "crate::none_if_blank_url")]
+ pub html_url: Option<url::Url>,
pub merged: Option<bool>,
#[serde(with = "time::serde::rfc3339::option")]
pub merged_at: Option<time::OffsetDateTime>,
@@ -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<TagArchiveDownloadCount>,
pub assets: Option<Vec<Attachment>>,
pub author: Option<User>,
pub body: Option<String>,
#[serde(with = "time::serde::rfc3339::option")]
pub created_at: Option<time::OffsetDateTime>,
pub draft: Option<bool>,
+ pub hide_archive_links: Option<bool>,
#[serde(deserialize_with = "crate::none_if_blank_url")]
pub html_url: Option<url::Url>,
pub id: Option<i64>,
@@ -2245,6 +2407,7 @@ pub struct Repository {
pub fork: Option<bool>,
pub forks_count: Option<i64>,
pub full_name: Option<String>,
+ pub globally_editable_wiki: Option<bool>,
pub has_actions: Option<bool>,
pub has_issues: Option<bool>,
pub has_packages: Option<bool>,
@@ -2283,6 +2446,7 @@ pub struct Repository {
pub ssh_url: Option<url::Url>,
pub stars_count: Option<i64>,
pub template: Option<bool>,
+ pub topics: Option<Vec<String>>,
#[serde(with = "time::serde::rfc3339::option")]
pub updated_at: Option<time::OffsetDateTime>,
#[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<TagArchiveDownloadCount>,
pub commit: Option<CommitMeta>,
pub id: Option<String>,
pub message: Option<String>,
@@ -2369,6 +2534,26 @@ pub struct Tag {
pub zipball_url: Option<url::Url>,
}
+/// TagArchiveDownloadCount counts how many times a archive was downloaded
+#[derive(Debug, Clone, PartialEq, serde::Serialize, serde::Deserialize)]
+pub struct TagArchiveDownloadCount {
+ pub tar_gz: Option<i64>,
+ pub zip: Option<i64>,
+}
+
+/// 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<time::OffsetDateTime>,
+ pub id: Option<i64>,
+ pub name_pattern: Option<String>,
+ #[serde(with = "time::serde::rfc3339::option")]
+ pub updated_at: Option<time::OffsetDateTime>,
+ pub whitelist_teams: Option<Vec<String>>,
+ pub whitelist_usernames: Option<Vec<String>>,
+}
+
/// 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<String>,
}
+/// 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<String>,
+ /// 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<i64>,
/// the user's full name
pub full_name: Option<String>,
+ #[serde(deserialize_with = "crate::none_if_blank_url")]
+ /// URL to the user's gitea page
+ pub html_url: Option<url::Url>,
/// the user's id
pub id: Option<i64>,
/// Is the user an administrator
@@ -2560,6 +2757,8 @@ pub struct User {
pub pronouns: Option<String>,
/// Is user restricted
pub restricted: Option<bool>,
+ /// The ID of the user's Authentication Source
+ pub source_id: Option<i64>,
pub starred_repos_count: Option<i64>,
/// User visibility level option: public, limited, private
pub visibility: Option<String>,
@@ -3323,6 +3522,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<u32>,
+ /// page size of results
+ pub limit: Option<u32>,
+}
+
+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
pub date: Option<time::Date>,
@@ -3777,7 +3997,7 @@ pub struct RepoSearchQuery {
pub mode: Option<String>,
/// if `uid` is given, search only for repos that the user owns
pub exclusive: Option<bool>,
- /// 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<String>,
/// sort order, either "asc" (ascending) or "desc" (descending). Default is "asc", ignored if "sort" is not specified.
pub order: Option<String>,
@@ -3846,6 +4066,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<u32>,
+ /// page size of results
+ pub limit: Option<u32>,
+}
+
+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<u32>,
+ /// page size of results, default maximum page size is 50
+ pub limit: Option<u32>,
+}
+
+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<u32>,
+ /// page size of results
+ pub limit: Option<u32>,
+}
+
+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
pub date: Option<time::Date>,
@@ -5593,6 +5876,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<u32>,
+ /// page size of results
+ pub limit: Option<u32>,
+}
+
+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)
pub page: Option<u32>,
diff --git a/swagger.v1.json b/swagger.v1.json
index 6611d2a..a32491a 100644
--- a/swagger.v1.json
+++ b/swagger.v1.json
@@ -10,10 +10,61 @@
"name": "MIT",
"url": "http://opensource.org/licenses/MIT"
},
- "version": "7.0.1+gitea-1.22.0"
+ "version": "8.0.0-dev-1514-f9ad844fd6+gitea-1.22.0"
},
"basePath": "/api/v1",
"paths": {
+ "/activitypub/repository-id/{repository-id}": {
+ "get": {
+ "produces": ["application/json"],
+ "tags": ["activitypub"],
+ "summary": "Returns the Repository actor for a repo",
+ "operationId": "activitypubRepository",
+ "parameters": [
+ {
+ "type": "integer",
+ "description": "repository ID of the repo",
+ "name": "repository-id",
+ "in": "path",
+ "required": true
+ }
+ ],
+ "responses": {
+ "200": {
+ "$ref": "#/responses/ActivityPub"
+ }
+ }
+ }
+ },
+ "/activitypub/repository-id/{repository-id}/inbox": {
+ "post": {
+ "produces": ["application/json"],
+ "tags": ["activitypub"],
+ "summary": "Send to the inbox",
+ "operationId": "activitypubRepositoryInbox",
+ "parameters": [
+ {
+ "type": "integer",
+ "description": "repository ID of the repo",
+ "name": "repository-id",
+ "in": "path",
+ "required": true
+ },
+ {
+ "name": "body",
+ "in": "body",
+ "schema": {
+ "$ref": "#/definitions/ForgeLike"
+ }
+ }
+ ],
+ "responses": {
+ "204": {
+ "$ref": "#/responses/empty"
+ }
+ }
+ }
+ },
"/activitypub/user-id/{user-id}": {
"get": {
"produces": ["application/json"],
@@ -1511,6 +1562,208 @@
}
}
},
+ "/orgs/{org}/actions/variables": {
+ "get": {
+ "produces": ["application/json"],
+ "tags": ["organization"],
+ "summary": "Get an org-level variables list",
+ "operationId": "getOrgVariablesList",
+ "parameters": [
+ {
+ "type": "string",
+ "description": "name of the organization",
+ "name": "org",
+ "in": "path",
+ "required": true
+ },
+ {
+ "type": "integer",
+ "description": "page number of results to return (1-based)",
+ "name": "page",
+ "in": "query"
+ },
+ {
+ "type": "integer",
+ "description": "page size of results",
+ "name": "limit",
+ "in": "query"
+ }
+ ],
+ "responses": {
+ "200": {
+ "$ref": "#/responses/VariableList"
+ },
+ "400": {
+ "$ref": "#/responses/error"
+ },
+ "404": {
+ "$ref": "#/responses/notFound"
+ }
+ }
+ }
+ },
+ "/orgs/{org}/actions/variables/{variablename}": {
+ "get": {
+ "produces": ["application/json"],
+ "tags": ["organization"],
+ "summary": "Get an org-level variable",
+ "operationId": "getOrgVariable",
+ "parameters": [
+ {
+ "type": "string",
+ "description": "name of the organization",
+ "name": "org",
+ "in": "path",
+ "required": true
+ },
+ {
+ "type": "string",
+ "description": "name of the variable",
+ "name": "variablename",
+ "in": "path",
+ "required": true
+ }
+ ],
+ "responses": {
+ "200": {
+ "$ref": "#/responses/ActionVariable"
+ },
+ "400": {
+ "$ref": "#/responses/error"
+ },
+ "404": {
+ "$ref": "#/responses/notFound"
+ }
+ }
+ },
+ "put": {
+ "consumes": ["application/json"],
+ "produces": ["application/json"],
+ "tags": ["organization"],
+ "summary": "Update an org-level variable",
+ "operationId": "updateOrgVariable",
+ "parameters": [
+ {
+ "type": "string",
+ "description": "name of the organization",
+ "name": "org",
+ "in": "path",
+ "required": true
+ },
+ {
+ "type": "string",
+ "description": "name of the variable",
+ "name": "variablename",
+ "in": "path",
+ "required": true
+ },
+ {
+ "name": "body",
+ "in": "body",
+ "schema": {
+ "$ref": "#/definitions/UpdateVariableOption"
+ }
+ }
+ ],
+ "responses": {
+ "201": {
+ "description": "response when updating an org-level variable"
+ },
+ "204": {
+ "description": "response when updating an org-level variable"
+ },
+ "400": {
+ "$ref": "#/responses/error"
+ },
+ "404": {
+ "$ref": "#/responses/notFound"
+ }
+ }
+ },
+ "post": {
+ "consumes": ["application/json"],
+ "produces": ["application/json"],
+ "tags": ["organization"],
+ "summary": "Create an org-level variable",
+ "operationId": "createOrgVariable",
+ "parameters": [
+ {
+ "type": "string",
+ "description": "name of the organization",
+ "name": "org",
+ "in": "path",
+ "required": true
+ },
+ {
+ "type": "string",
+ "description": "name of the variable",
+ "name": "variablename",
+ "in": "path",
+ "required": true
+ },
+ {
+ "name": "body",
+ "in": "body",
+ "schema": {
+ "$ref": "#/definitions/CreateVariableOption"
+ }
+ }
+ ],
+ "responses": {
+ "201": {
+ "description": "response when creating an org-level variable"
+ },
+ "204": {
+ "description": "response when creating an org-level variable"
+ },
+ "400": {
+ "$ref": "#/responses/error"
+ },
+ "404": {
+ "$ref": "#/responses/notFound"
+ }
+ }
+ },
+ "delete": {
+ "produces": ["application/json"],
+ "tags": ["organization"],
+ "summary": "Delete an org-level variable",
+ "operationId": "deleteOrgVariable",
+ "parameters": [
+ {
+ "type": "string",
+ "description": "name of the organization",
+ "name": "org",
+ "in": "path",
+ "required": true
+ },
+ {
+ "type": "string",
+ "description": "name of the variable",
+ "name": "variablename",
+ "in": "path",
+ "required": true
+ }
+ ],
+ "responses": {
+ "200": {
+ "$ref": "#/responses/ActionVariable"
+ },
+ "201": {
+ "description": "response when deleting a variable"
+ },
+ "204": {
+ "description": "response when deleting a variable"
+ },
+ "400": {
+ "$ref": "#/responses/error"
+ },
+ "404": {
+ "$ref": "#/responses/notFound"
+ }
+ }
+ }
+ },
"/orgs/{org}/activities/feeds": {
"get": {
"produces": ["application/json"],
@@ -2977,7 +3230,7 @@
},
{
"type": "string",
- "description": "sort repos by attribute. Supported values are \"alpha\", \"created\", \"updated\", \"size\", and \"id\". Default is \"alpha\"",
+ "description": "sort repos by attribute. Supported values are \"alpha\", \"created\", \"updated\", \"size\", \"git_size\", \"lfs_size\", \"stars\", \"forks\" and \"id\". Default is \"alpha\"",
"name": "sort",
"in": "query"
},
@@ -3121,6 +3374,50 @@
}
}
},
+ "/repos/{owner}/{repo}/actions/secrets": {
+ "get": {
+ "produces": ["application/json"],
+ "tags": ["repository"],
+ "summary": "List an repo's actions secrets",
+ "operationId": "repoListActionsSecrets",
+ "parameters": [
+ {
+ "type": "string",
+ "description": "owner of the repository",
+ "name": "owner",
+ "in": "path",
+ "required": true
+ },
+ {
+ "type": "string",
+ "description": "name of the repository",
+ "name": "repo",
+ "in": "path",
+ "required": true
+ },
+ {
+ "type": "integer",
+ "description": "page number of results to return (1-based)",
+ "name": "page",
+ "in": "query"
+ },
+ {
+ "type": "integer",
+ "description": "page size of results",
+ "name": "limit",
+ "in": "query"
+ }
+ ],
+ "responses": {
+ "200": {
+ "$ref": "#/responses/SecretList"
+ },
+ "404": {
+ "$ref": "#/responses/notFound"
+ }
+ }
+ }
+ },
"/repos/{owner}/{repo}/actions/secrets/{secretname}": {
"put": {
"consumes": ["application/json"],
@@ -3215,6 +3512,343 @@
}
}
},
+ "/repos/{owner}/{repo}/actions/tasks": {
+ "get": {
+ "produces": ["application/json"],
+ "tags": ["repository"],
+ "summary": "List a repository's action tasks",
+ "operationId": "ListActionTasks",
+ "parameters": [
+ {
+ "type": "string",
+ "description": "owner of the repo",
+ "name": "owner",
+ "in": "path",
+ "required": true
+ },
+ {
+ "type": "string",
+ "description": "name of the repo",
+ "name": "repo",
+ "in": "path",
+ "required": true
+ },
+ {
+ "type": "integer",
+ "description": "page number of results to return (1-based)",
+ "name": "page",
+ "in": "query"
+ },
+ {
+ "type": "integer",
+ "description": "page size of results, default maximum page size is 50",
+ "name": "limit",
+ "in": "query"
+ }
+ ],
+ "responses": {
+ "200": {
+ "$ref": "#/responses/TasksList"
+ },
+ "400": {
+ "$ref": "#/responses/error"
+ },
+ "403": {
+ "$ref": "#/responses/forbidden"
+ },
+ "404": {
+ "$ref": "#/responses/notFound"
+ },
+ "409": {
+ "$ref": "#/responses/conflict"
+ },
+ "422": {
+ "$ref": "#/responses/validationError"
+ }
+ }
+ }
+ },
+ "/repos/{owner}/{repo}/actions/variables": {
+ "get": {
+ "produces": ["application/json"],
+ "tags": ["repository"],
+ "summary": "Get repo-level variables list",
+ "operationId": "getRepoVariablesList",
+ "parameters": [
+ {
+ "type": "string",
+ "description": "name of the owner",
+ "name": "owner",
+ "in": "path",
+ "required": true
+ },
+ {
+ "type": "string",
+ "description": "name of the repository",
+ "name": "repo",
+ "in": "path",
+ "required": true
+ },
+ {
+ "type": "integer",
+ "description": "page number of results to return (1-based)",
+ "name": "page",
+ "in": "query"
+ },
+ {
+ "type": "integer",
+ "description": "page size of results",
+ "name": "limit",
+ "in": "query"
+ }
+ ],
+ "responses": {
+ "200": {
+ "$ref": "#/responses/VariableList"
+ },
+ "400": {
+ "$ref": "#/responses/error"
+ },
+ "404": {
+ "$ref": "#/responses/notFound"
+ }
+ }
+ }
+ },
+ "/repos/{owner}/{repo}/actions/variables/{variablename}": {
+ "get": {
+ "produces": ["application/json"],
+ "tags": ["repository"],
+ "summary": "Get a repo-level variable",
+ "operationId": "getRepoVariable",
+ "parameters": [
+ {
+ "type": "string",
+ "description": "name of the owner",
+ "name": "owner",
+ "in": "path",
+ "required": true
+ },
+ {
+ "type": "string",
+ "description": "name of the repository",
+ "name": "repo",
+ "in": "path",
+ "required": true
+ },
+ {
+ "type": "string",
+ "description": "name of the variable",
+ "name": "variablename",
+ "in": "path",
+ "required": true
+ }
+ ],
+ "responses": {
+ "200": {
+ "$ref": "#/responses/ActionVariable"
+ },
+ "400": {
+ "$ref": "#/responses/error"
+ },
+ "404": {
+ "$ref": "#/responses/notFound"
+ }
+ }
+ },
+ "put": {
+ "produces": ["application/json"],
+ "tags": ["repository"],
+ "summary": "Update a repo-level variable",
+ "operationId": "updateRepoVariable",
+ "parameters": [
+ {
+ "type": "string",
+ "description": "name of the owner",
+ "name": "owner",
+ "in": "path",
+ "required": true
+ },
+ {
+ "type": "string",
+ "description": "name of the repository",
+ "name": "repo",
+ "in": "path",
+ "required": true
+ },
+ {
+ "type": "string",
+ "description": "name of the variable",
+ "name": "variablename",
+ "in": "path",
+ "required": true
+ },
+ {
+ "name": "body",
+ "in": "body",
+ "schema": {
+ "$ref": "#/definitions/UpdateVariableOption"
+ }
+ }
+ ],
+ "responses": {
+ "201": {
+ "description": "response when updating a repo-level variable"
+ },
+ "204": {
+ "description": "response when updating a repo-level variable"
+ },
+ "400": {
+ "$ref": "#/responses/error"
+ },
+ "404": {
+ "$ref": "#/responses/notFound"
+ }
+ }
+ },
+ "post": {
+ "produces": ["application/json"],
+ "tags": ["repository"],
+ "summary": "Create a repo-level variable",
+ "operationId": "createRepoVariable",
+ "parameters": [
+ {
+ "type": "string",
+ "description": "name of the owner",
+ "name": "owner",
+ "in": "path",
+ "required": true
+ },
+ {
+ "type": "string",
+ "description": "name of the repository",
+ "name": "repo",
+ "in": "path",
+ "required": true
+ },
+ {
+ "type": "string",
+ "description": "name of the variable",
+ "name": "variablename",
+ "in": "path",
+ "required": true
+ },
+ {
+ "name": "body",
+ "in": "body",
+ "schema": {
+ "$ref": "#/definitions/CreateVariableOption"
+ }
+ }
+ ],
+ "responses": {
+ "201": {
+ "description": "response when creating a repo-level variable"
+ },
+ "204": {
+ "description": "response when creating a repo-level variable"
+ },
+ "400": {
+ "$ref": "#/responses/error"
+ },
+ "404": {
+ "$ref": "#/responses/notFound"
+ }
+ }
+ },
+ "delete": {
+ "produces": ["application/json"],
+ "tags": ["repository"],
+ "summary": "Delete a repo-level variable",
+ "operationId": "deleteRepoVariable",
+ "parameters": [
+ {
+ "type": "string",
+ "description": "name of the owner",
+ "name": "owner",
+ "in": "path",
+ "required": true
+ },
+ {
+ "type": "string",
+ "description": "name of the repository",
+ "name": "repo",
+ "in": "path",
+ "required": true
+ },
+ {
+ "type": "string",
+ "description": "name of the variable",
+ "name": "variablename",
+ "in": "path",
+ "required": true
+ }
+ ],
+ "responses": {
+ "200": {
+ "$ref": "#/responses/ActionVariable"
+ },
+ "201": {
+ "description": "response when deleting a variable"
+ },
+ "204": {
+ "description": "response when deleting a variable"
+ },
+ "400": {
+ "$ref": "#/responses/error"
+ },
+ "404": {
+ "$ref": "#/responses/notFound"
+ }
+ }
+ }
+ },
+ "/repos/{owner}/{repo}/actions/workflows/{workflowname}/dispatches": {
+ "post": {
+ "consumes": ["application/json"],
+ "tags": ["repository"],
+ "summary": "Dispatches a workflow",
+ "operationId": "DispatchWorkflow",
+ "parameters": [
+ {
+ "type": "string",
+ "description": "owner of the repo",
+ "name": "owner",
+ "in": "path",
+ "required": true
+ },
+ {
+ "type": "string",
+ "description": "name of the repo",
+ "name": "repo",
+ "in": "path",
+ "required": true
+ },
+ {
+ "type": "string",
+ "description": "name of the workflow",
+ "name": "workflowname",
+ "in": "path",
+ "required": true
+ },
+ {
+ "name": "body",
+ "in": "body",
+ "schema": {
+ "$ref": "#/definitions/DispatchWorkflowOption"
+ }
+ }
+ ],
+ "responses": {
+ "204": {
+ "$ref": "#/responses/empty"
+ },
+ "404": {
+ "$ref": "#/responses/notFound"
+ }
+ }
+ }
+ },
"/repos/{owner}/{repo}/activities/feeds": {
"get": {
"produces": ["application/json"],
@@ -4263,6 +4897,45 @@
}
}
},
+ "/repos/{owner}/{repo}/compare/{basehead}": {
+ "get": {
+ "produces": ["application/json"],
+ "tags": ["repository"],
+ "summary": "Get commit comparison information",
+ "operationId": "repoCompareDiff",
+ "parameters": [
+ {
+ "type": "string",
+ "description": "owner of the repo",
+ "name": "owner",
+ "in": "path",
+ "required": true
+ },
+ {
+ "type": "string",
+ "description": "name of the repo",
+ "name": "repo",
+ "in": "path",
+ "required": true
+ },
+ {
+ "type": "string",
+ "description": "compare two branches or commits",
+ "name": "basehead",
+ "in": "path",
+ "required": true
+ }
+ ],
+ "responses": {
+ "200": {
+ "$ref": "#/responses/Compare"
+ },
+ "404": {
+ "$ref": "#/responses/notFound"
+ }
+ }
+ }
+ },
"/repos/{owner}/{repo}/contents": {
"get": {
"produces": ["application/json"],
@@ -6310,6 +6983,9 @@
"404": {
"$ref": "#/responses/error"
},
+ "422": {
+ "$ref": "#/responses/validationError"
+ },
"423": {
"$ref": "#/responses/repoArchivedError"
}
@@ -6878,6 +7554,9 @@
"404": {
"$ref": "#/responses/error"
},
+ "422": {
+ "$ref": "#/responses/validationError"
+ },
"423": {
"$ref": "#/responses/repoArchivedError"
}
@@ -11407,6 +12086,9 @@
},
"409": {
"$ref": "#/responses/error"
+ },
+ "422": {
+ "$ref": "#/responses/validationError"
}
}
}
@@ -11515,8 +12197,8 @@
"404": {
"$ref": "#/responses/notFound"
},
- "405": {
- "$ref": "#/responses/empty"
+ "422": {
+ "$ref": "#/responses/validationError"
}
}
}
@@ -11595,8 +12277,8 @@
"404": {
"$ref": "#/responses/notFound"
},
- "405": {
- "$ref": "#/responses/empty"
+ "422": {
+ "$ref": "#/responses/validationError"
}
}
},
@@ -12286,6 +12968,209 @@
}
}
},
+ "/repos/{owner}/{repo}/tag_protections": {
+ "get": {
+ "produces": ["application/json"],
+ "tags": ["repository"],
+ "summary": "List tag protections for a repository",
+ "operationId": "repoListTagProtection",
+ "parameters": [
+ {
+ "type": "string",
+ "description": "owner of the repo",
+ "name": "owner",
+ "in": "path",
+ "required": true
+ },
+ {
+ "type": "string",
+ "description": "name of the repo",
+ "name": "repo",
+ "in": "path",
+ "required": true
+ }
+ ],
+ "responses": {
+ "200": {
+ "$ref": "#/responses/TagProtectionList"
+ }
+ }
+ },
+ "post": {
+ "consumes": ["application/json"],
+ "produces": ["application/json"],
+ "tags": ["repository"],
+ "summary": "Create a tag protections for a repository",
+ "operationId": "repoCreateTagProtection",
+ "parameters": [
+ {
+ "type": "string",
+ "description": "owner of the repo",
+ "name": "owner",
+ "in": "path",
+ "required": true
+ },
+ {
+ "type": "string",
+ "description": "name of the repo",
+ "name": "repo",
+ "in": "path",
+ "required": true
+ },
+ {
+ "name": "body",
+ "in": "body",
+ "schema": {
+ "$ref": "#/definitions/CreateTagProtectionOption"
+ }
+ }
+ ],
+ "responses": {
+ "201": {
+ "$ref": "#/responses/TagProtection"
+ },
+ "403": {
+ "$ref": "#/responses/forbidden"
+ },
+ "404": {
+ "$ref": "#/responses/notFound"
+ },
+ "422": {
+ "$ref": "#/responses/validationError"
+ },
+ "423": {
+ "$ref": "#/responses/repoArchivedError"
+ }
+ }
+ }
+ },
+ "/repos/{owner}/{repo}/tag_protections/{id}": {
+ "get": {
+ "produces": ["application/json"],
+ "tags": ["repository"],
+ "summary": "Get a specific tag protection for the repository",
+ "operationId": "repoGetTagProtection",
+ "parameters": [
+ {
+ "type": "string",
+ "description": "owner of the repo",
+ "name": "owner",
+ "in": "path",
+ "required": true
+ },
+ {
+ "type": "string",
+ "description": "name of the repo",
+ "name": "repo",
+ "in": "path",
+ "required": true
+ },
+ {
+ "type": "integer",
+ "description": "id of the tag protect to get",
+ "name": "id",
+ "in": "path",
+ "required": true
+ }
+ ],
+ "responses": {
+ "200": {
+ "$ref": "#/responses/TagProtection"
+ },
+ "404": {
+ "$ref": "#/responses/notFound"
+ }
+ }
+ },
+ "delete": {
+ "produces": ["application/json"],
+ "tags": ["repository"],
+ "summary": "Delete a specific tag protection for the repository",
+ "operationId": "repoDeleteTagProtection",
+ "parameters": [
+ {
+ "type": "string",
+ "description": "owner of the repo",
+ "name": "owner",
+ "in": "path",
+ "required": true
+ },
+ {
+ "type": "string",
+ "description": "name of the repo",
+ "name": "repo",
+ "in": "path",
+ "required": true
+ },
+ {
+ "type": "integer",
+ "description": "id of protected tag",
+ "name": "id",
+ "in": "path",
+ "required": true
+ }
+ ],
+ "responses": {
+ "204": {
+ "$ref": "#/responses/empty"
+ },
+ "404": {
+ "$ref": "#/responses/notFound"
+ }
+ }
+ },
+ "patch": {
+ "consumes": ["application/json"],
+ "produces": ["application/json"],
+ "tags": ["repository"],
+ "summary": "Edit a tag protections for a repository. Only fields that are set will be changed",
+ "operationId": "repoEditTagProtection",
+ "parameters": [
+ {
+ "type": "string",
+ "description": "owner of the repo",
+ "name": "owner",
+ "in": "path",
+ "required": true
+ },
+ {
+ "type": "string",
+ "description": "name of the repo",
+ "name": "repo",
+ "in": "path",
+ "required": true
+ },
+ {
+ "type": "integer",
+ "description": "id of protected tag",
+ "name": "id",
+ "in": "path",
+ "required": true
+ },
+ {
+ "name": "body",
+ "in": "body",
+ "schema": {
+ "$ref": "#/definitions/EditTagProtectionOption"
+ }
+ }
+ ],
+ "responses": {
+ "200": {
+ "$ref": "#/responses/TagProtection"
+ },
+ "404": {
+ "$ref": "#/responses/notFound"
+ },
+ "422": {
+ "$ref": "#/responses/validationError"
+ },
+ "423": {
+ "$ref": "#/responses/repoArchivedError"
+ }
+ }
+ }
+ },
"/repos/{owner}/{repo}/tags": {
"get": {
"produces": ["application/json"],
@@ -12372,6 +13257,9 @@
"409": {
"$ref": "#/responses/conflict"
},
+ "422": {
+ "$ref": "#/responses/validationError"
+ },
"423": {
"$ref": "#/responses/repoArchivedError"
}
@@ -12457,6 +13345,9 @@
"409": {
"$ref": "#/responses/conflict"
},
+ "422": {
+ "$ref": "#/responses/validationError"
+ },
"423": {
"$ref": "#/responses/repoArchivedError"
}
@@ -14002,6 +14893,170 @@
}
}
},
+ "/user/actions/variables": {
+ "get": {
+ "produces": ["application/json"],
+ "tags": ["user"],
+ "summary": "Get the user-level list of variables which is created by current doer",
+ "operationId": "getUserVariablesList",
+ "parameters": [
+ {
+ "type": "integer",
+ "description": "page number of results to return (1-based)",
+ "name": "page",
+ "in": "query"
+ },
+ {
+ "type": "integer",
+ "description": "page size of results",
+ "name": "limit",
+ "in": "query"
+ }
+ ],
+ "responses": {
+ "200": {
+ "$ref": "#/responses/VariableList"
+ },
+ "400": {
+ "$ref": "#/responses/error"
+ },
+ "404": {
+ "$ref": "#/responses/notFound"
+ }
+ }
+ }
+ },
+ "/user/actions/variables/{variablename}": {
+ "get": {
+ "produces": ["application/json"],
+ "tags": ["user"],
+ "summary": "Get a user-level variable which is created by current doer",
+ "operationId": "getUserVariable",
+ "parameters": [
+ {
+ "type": "string",
+ "description": "name of the variable",
+ "name": "variablename",
+ "in": "path",
+ "required": true
+ }
+ ],
+ "responses": {
+ "200": {
+ "$ref": "#/responses/ActionVariable"
+ },
+ "400": {
+ "$ref": "#/responses/error"
+ },
+ "404": {
+ "$ref": "#/responses/notFound"
+ }
+ }
+ },
+ "put": {
+ "consumes": ["application/json"],
+ "produces": ["application/json"],
+ "tags": ["user"],
+ "summary": "Update a user-level variable which is created by current doer",
+ "operationId": "updateUserVariable",
+ "parameters": [
+ {
+ "type": "string",
+ "description": "name of the variable",
+ "name": "variablename",
+ "in": "path",
+ "required": true
+ },
+ {
+ "name": "body",
+ "in": "body",
+ "schema": {
+ "$ref": "#/definitions/UpdateVariableOption"
+ }
+ }
+ ],
+ "responses": {
+ "201": {
+ "description": "response when updating a variable"
+ },
+ "204": {
+ "description": "response when updating a variable"
+ },
+ "400": {
+ "$ref": "#/responses/error"
+ },
+ "404": {
+ "$ref": "#/responses/notFound"
+ }
+ }
+ },
+ "post": {
+ "consumes": ["application/json"],
+ "produces": ["application/json"],
+ "tags": ["user"],
+ "summary": "Create a user-level variable",
+ "operationId": "createUserVariable",
+ "parameters": [
+ {
+ "type": "string",
+ "description": "name of the variable",
+ "name": "variablename",
+ "in": "path",
+ "required": true
+ },
+ {
+ "name": "body",
+ "in": "body",
+ "schema": {
+ "$ref": "#/definitions/CreateVariableOption"
+ }
+ }
+ ],
+ "responses": {
+ "201": {
+ "description": "response when creating a variable"
+ },
+ "204": {
+ "description": "response when creating a variable"
+ },
+ "400": {
+ "$ref": "#/responses/error"
+ },
+ "404": {
+ "$ref": "#/responses/notFound"
+ }
+ }
+ },
+ "delete": {
+ "produces": ["application/json"],
+ "tags": ["user"],
+ "summary": "Delete a user-level variable which is created by current doer",
+ "operationId": "deleteUserVariable",
+ "parameters": [
+ {
+ "type": "string",
+ "description": "name of the variable",
+ "name": "variablename",
+ "in": "path",
+ "required": true
+ }
+ ],
+ "responses": {
+ "201": {
+ "description": "response when deleting a variable"
+ },
+ "204": {
+ "description": "response when deleting a variable"
+ },
+ "400": {
+ "$ref": "#/responses/error"
+ },
+ "404": {
+ "$ref": "#/responses/notFound"
+ }
+ }
+ }
+ },
"/user/applications/oauth2": {
"get": {
"produces": ["application/json"],
@@ -15911,6 +16966,118 @@
},
"x-go-package": "code.gitea.io/gitea/modules/structs"
},
+ "ActionTask": {
+ "description": "ActionTask represents a ActionTask",
+ "type": "object",
+ "properties": {
+ "created_at": {
+ "type": "string",
+ "format": "date-time",
+ "x-go-name": "CreatedAt"
+ },
+ "display_title": {
+ "type": "string",
+ "x-go-name": "DisplayTitle"
+ },
+ "event": {
+ "type": "string",
+ "x-go-name": "Event"
+ },
+ "head_branch": {
+ "type": "string",
+ "x-go-name": "HeadBranch"
+ },
+ "head_sha": {
+ "type": "string",
+ "x-go-name": "HeadSHA"
+ },
+ "id": {
+ "type": "integer",
+ "format": "int64",
+ "x-go-name": "ID"
+ },
+ "name": {
+ "type": "string",
+ "x-go-name": "Name"
+ },
+ "run_number": {
+ "type": "integer",
+ "format": "int64",
+ "x-go-name": "RunNumber"
+ },
+ "run_started_at": {
+ "type": "string",
+ "format": "date-time",
+ "x-go-name": "RunStartedAt"
+ },
+ "status": {
+ "type": "string",
+ "x-go-name": "Status"
+ },
+ "updated_at": {
+ "type": "string",
+ "format": "date-time",
+ "x-go-name": "UpdatedAt"
+ },
+ "url": {
+ "type": "string",
+ "x-go-name": "URL"
+ },
+ "workflow_id": {
+ "type": "string",
+ "x-go-name": "WorkflowID"
+ }
+ },
+ "x-go-package": "code.gitea.io/gitea/modules/structs"
+ },
+ "ActionTaskResponse": {
+ "description": "ActionTaskResponse returns a ActionTask",
+ "type": "object",
+ "properties": {
+ "total_count": {
+ "type": "integer",
+ "format": "int64",
+ "x-go-name": "TotalCount"
+ },
+ "workflow_runs": {
+ "type": "array",
+ "items": {
+ "$ref": "#/definitions/ActionTask"
+ },
+ "x-go-name": "Entries"
+ }
+ },
+ "x-go-package": "code.gitea.io/gitea/modules/structs"
+ },
+ "ActionVariable": {
+ "description": "ActionVariable return value of the query API",
+ "type": "object",
+ "properties": {
+ "data": {
+ "description": "the value of the variable",
+ "type": "string",
+ "x-go-name": "Data"
+ },
+ "name": {
+ "description": "the name of the variable",
+ "type": "string",
+ "x-go-name": "Name"
+ },
+ "owner_id": {
+ "description": "the owner to which the variable belongs",
+ "type": "integer",
+ "format": "int64",
+ "x-go-name": "OwnerID"
+ },
+ "repo_id": {
+ "description": "the repository to which the variable belongs",
+ "type": "integer",
+ "format": "int64",
+ "x-go-name": "RepoID"
+ }
+ },
+ "x-go-package": "code.gitea.io/gitea/modules/structs"
+ },
"Activity": {
"type": "object",
"properties": {
@@ -15949,7 +17116,37 @@
"x-go-name": "IsPrivate"
},
"op_type": {
+ "description": "the type of action",
"type": "string",
+ "enum": [
+ "create_repo",
+ "rename_repo",
+ "star_repo",
+ "watch_repo",
+ "commit_repo",
+ "create_issue",
+ "create_pull_request",
+ "transfer_repo",
+ "push_tag",
+ "comment_issue",
+ "merge_pull_request",
+ "close_issue",
+ "reopen_issue",
+ "close_pull_request",
+ "reopen_pull_request",
+ "delete_tag",
+ "delete_branch",
+ "mirror_sync_push",
+ "mirror_sync_create",
+ "mirror_sync_delete",
+ "approve_pull_request",
+ "reject_pull_request",
+ "comment_pull",
+ "publish_release",
+ "pull_review_dismissed",
+ "pull_request_ready_for_review",
+ "auto_merge_pull_request"
+ ],
"x-go-name": "OpType"
},
"ref_name": {
@@ -16022,6 +17219,9 @@
"description": "AnnotatedTag represents an annotated tag",
"type": "object",
"properties": {
+ "archive_download_count": {
+ "$ref": "#/definitions/TagArchiveDownloadCount"
+ },
"message": {
"type": "string",
"x-go-name": "Message"
@@ -16723,6 +17923,25 @@
},
"x-go-package": "code.gitea.io/gitea/modules/structs"
},
+ "Compare": {
+ "type": "object",
+ "title": "Compare represents a comparison between two commits.",
+ "properties": {
+ "commits": {
+ "type": "array",
+ "items": {
+ "$ref": "#/definitions/Commit"
+ },
+ "x-go-name": "Commits"
+ },
+ "total_commits": {
+ "type": "integer",
+ "format": "int64",
+ "x-go-name": "TotalCommits"
+ }
+ },
+ "x-go-package": "code.gitea.io/gitea/modules/structs"
+ },
"ContentsResponse": {
"description": "ContentsResponse contains information about a repo's entry's (dir, file, symlink, submodule) metadata and content",
"type": "object",
@@ -17507,6 +18726,10 @@
"type": "boolean",
"x-go-name": "IsDraft"
},
+ "hide_archive_links": {
+ "type": "boolean",
+ "x-go-name": "HideArchiveLinks"
+ },
"name": {
"type": "string",
"x-go-name": "Title"
@@ -17641,6 +18864,31 @@
},
"x-go-package": "code.gitea.io/gitea/modules/structs"
},
+ "CreateTagProtectionOption": {
+ "description": "CreateTagProtectionOption options for creating a tag protection",
+ "type": "object",
+ "properties": {
+ "name_pattern": {
+ "type": "string",
+ "x-go-name": "NamePattern"
+ },
+ "whitelist_teams": {
+ "type": "array",
+ "items": {
+ "type": "string"
+ },
+ "x-go-name": "WhitelistTeams"
+ },
+ "whitelist_usernames": {
+ "type": "array",
+ "items": {
+ "type": "string"
+ },
+ "x-go-name": "WhitelistUsernames"
+ }
+ },
+ "x-go-package": "code.gitea.io/gitea/modules/structs"
+ },
"CreateTeamOption": {
"description": "CreateTeamOption options for creating a team",
"type": "object",
@@ -17753,6 +19001,19 @@
},
"x-go-package": "code.gitea.io/gitea/modules/structs"
},
+ "CreateVariableOption": {
+ "description": "CreateVariableOption the option when creating variable",
+ "type": "object",
+ "required": ["value"],
+ "properties": {
+ "value": {
+ "description": "Value of the variable to create",
+ "type": "string",
+ "x-go-name": "Value"
+ }
+ },
+ "x-go-package": "code.gitea.io/gitea/modules/structs"
+ },
"CreateWikiPageOptions": {
"description": "CreateWikiPageOptions form for creating wiki",
"type": "object",
@@ -17938,6 +19199,27 @@
},
"x-go-package": "code.gitea.io/gitea/modules/structs"
},
+ "DispatchWorkflowOption": {
+ "description": "DispatchWorkflowOption options when dispatching a workflow",
+ "type": "object",
+ "required": ["ref"],
+ "properties": {
+ "inputs": {
+ "description": "Input keys and values configured in the workflow file.",
+ "type": "object",
+ "additionalProperties": {
+ "type": "string"
+ },
+ "x-go-name": "Inputs"
+ },
+ "ref": {
+ "description": "Git reference for the workflow",
+ "type": "string",
+ "x-go-name": "Ref"
+ }
+ },
+ "x-go-package": "code.gitea.io/gitea/modules/structs"
+ },
"EditAttachmentOptions": {
"description": "EditAttachmentOptions options for editing attachments",
"type": "object",
@@ -18372,6 +19654,10 @@
"type": "boolean",
"x-go-name": "IsDraft"
},
+ "hide_archive_links": {
+ "type": "boolean",
+ "x-go-name": "HideArchiveLinks"
+ },
"name": {
"type": "string",
"x-go-name": "Title"
@@ -18464,7 +19750,7 @@
"x-go-name": "Description"
},
"enable_prune": {
- "description": "enable prune - remove obsolete remote-tracking references",
+ "description": "enable prune - remove obsolete remote-tracking references when mirroring",
"type": "boolean",
"x-go-name": "EnablePrune"
},
@@ -18474,6 +19760,11 @@
"external_wiki": {
"$ref": "#/definitions/ExternalWiki"
},
+ "globally_editable_wiki": {
+ "description": "set the globally editable state of the wiki",
+ "type": "boolean",
+ "x-go-name": "GloballyEditableWiki"
+ },
"has_actions": {
"description": "either `true` to enable actions unit, or `false` to disable them.",
"type": "boolean",
@@ -18551,6 +19842,31 @@
},
"x-go-package": "code.gitea.io/gitea/modules/structs"
},
+ "EditTagProtectionOption": {
+ "description": "EditTagProtectionOption options for editing a tag protection",
+ "type": "object",
+ "properties": {
+ "name_pattern": {
+ "type": "string",
+ "x-go-name": "NamePattern"
+ },
+ "whitelist_teams": {
+ "type": "array",
+ "items": {
+ "type": "string"
+ },
+ "x-go-name": "WhitelistTeams"
+ },
+ "whitelist_usernames": {
+ "type": "array",
+ "items": {
+ "type": "string"
+ },
+ "x-go-name": "WhitelistUsernames"
+ }
+ },
+ "x-go-package": "code.gitea.io/gitea/modules/structs"
+ },
"EditTeamOption": {
"description": "EditTeamOption options for editing a team",
"type": "object",
@@ -18617,7 +19933,6 @@
"EditUserOption": {
"description": "EditUserOption edit user options",
"type": "object",
- "required": ["source_id", "login_name"],
"properties": {
"active": {
"type": "boolean",
@@ -18884,6 +20199,11 @@
},
"x-go-package": "code.gitea.io/gitea/modules/structs"
},
+ "ForgeLike": {
+ "description": "ForgeLike activity data type",
+ "type": "object",
+ "x-go-package": "code.gitea.io/gitea/modules/forgefed"
+ },
"GPGKey": {
"description": "GPGKey a user GPG key to sign commit and tag in repository",
"type": "object",
@@ -19625,12 +20945,9 @@
"type": "object",
"properties": {
"labels": {
- "description": "list of label IDs",
+ "description": "Labels can be a list of integers representing label IDs\nor a list of strings representing label names",
"type": "array",
- "items": {
- "type": "integer",
- "format": "int64"
- },
+ "items": {},
"x-go-name": "Labels"
},
"updated_at": {
@@ -20702,6 +22019,11 @@
"description": "PullRequest represents a pull request",
"type": "object",
"properties": {
+ "additions": {
+ "type": "integer",
+ "format": "int64",
+ "x-go-name": "Additions"
+ },
"allow_maintainer_edit": {
"type": "boolean",
"x-go-name": "AllowMaintainerEdit"
@@ -20723,6 +22045,11 @@
"type": "string",
"x-go-name": "Body"
},
+ "changed_files": {
+ "type": "integer",
+ "format": "int64",
+ "x-go-name": "ChangedFiles"
+ },
"closed_at": {
"type": "string",
"format": "date-time",
@@ -20738,10 +22065,19 @@
"format": "date-time",
"x-go-name": "Created"
},
+ "deletions": {
+ "type": "integer",
+ "format": "int64",
+ "x-go-name": "Deletions"
+ },
"diff_url": {
"type": "string",
"x-go-name": "DiffURL"
},
+ "draft": {
+ "type": "boolean",
+ "x-go-name": "Draft"
+ },
"due_date": {
"type": "string",
"format": "date-time",
@@ -20818,6 +22154,12 @@
},
"x-go-name": "RequestedReviewers"
},
+ "review_comments": {
+ "description": "number of review comments made on the diff of a PR review (not including comments on commits or issues in a PR)",
+ "type": "integer",
+ "format": "int64",
+ "x-go-name": "ReviewComments"
+ },
"state": {
"$ref": "#/definitions/StateType"
},
@@ -20851,6 +22193,10 @@
"type": "boolean",
"x-go-name": "IsWorkInProgress"
},
+ "html_url": {
+ "type": "string",
+ "x-go-name": "HTMLURL"
+ },
"merged": {
"type": "boolean",
"x-go-name": "HasMerged"
@@ -21101,6 +22447,9 @@
"description": "Release represents a repository release",
"type": "object",
"properties": {
+ "archive_download_count": {
+ "$ref": "#/definitions/TagArchiveDownloadCount"
+ },
"assets": {
"type": "array",
"items": {
@@ -21124,6 +22473,10 @@
"type": "boolean",
"x-go-name": "IsDraft"
},
+ "hide_archive_links": {
+ "type": "boolean",
+ "x-go-name": "HideArchiveLinks"
+ },
"html_url": {
"type": "string",
"x-go-name": "HTMLURL"
@@ -21373,6 +22726,10 @@
"type": "string",
"x-go-name": "FullName"
},
+ "globally_editable_wiki": {
+ "type": "boolean",
+ "x-go-name": "GloballyEditableWiki"
+ },
"has_actions": {
"type": "boolean",
"x-go-name": "HasActions"
@@ -21506,6 +22863,13 @@
"type": "boolean",
"x-go-name": "Template"
},
+ "topics": {
+ "type": "array",
+ "items": {
+ "type": "string"
+ },
+ "x-go-name": "Topics"
+ },
"updated_at": {
"type": "string",
"format": "date-time",
@@ -21671,6 +23035,9 @@
"description": "Tag represents a repository tag",
"type": "object",
"properties": {
+ "archive_download_count": {
+ "$ref": "#/definitions/TagArchiveDownloadCount"
+ },
"commit": {
"$ref": "#/definitions/CommitMeta"
},
@@ -21697,6 +23064,63 @@
},
"x-go-package": "code.gitea.io/gitea/modules/structs"
},
+ "TagArchiveDownloadCount": {
+ "description": "TagArchiveDownloadCount counts how many times a archive was downloaded",
+ "type": "object",
+ "properties": {
+ "tar_gz": {
+ "type": "integer",
+ "format": "int64",
+ "x-go-name": "TarGz"
+ },
+ "zip": {
+ "type": "integer",
+ "format": "int64",
+ "x-go-name": "Zip"
+ }
+ },
+ "x-go-package": "code.gitea.io/gitea/modules/structs"
+ },
+ "TagProtection": {
+ "description": "TagProtection represents a tag protection",
+ "type": "object",
+ "properties": {
+ "created_at": {
+ "type": "string",
+ "format": "date-time",
+ "x-go-name": "Created"
+ },
+ "id": {
+ "type": "integer",
+ "format": "int64",
+ "x-go-name": "ID"
+ },
+ "name_pattern": {
+ "type": "string",
+ "x-go-name": "NamePattern"
+ },
+ "updated_at": {
+ "type": "string",
+ "format": "date-time",
+ "x-go-name": "Updated"
+ },
+ "whitelist_teams": {
+ "type": "array",
+ "items": {
+ "type": "string"
+ },
+ "x-go-name": "WhitelistTeams"
+ },
+ "whitelist_usernames": {
+ "type": "array",
+ "items": {
+ "type": "string"
+ },
+ "x-go-name": "WhitelistUsernames"
+ }
+ },
+ "x-go-package": "code.gitea.io/gitea/modules/structs"
+ },
"Team": {
"description": "Team represents a team in an organization",
"type": "object",
@@ -22077,6 +23501,24 @@
},
"x-go-package": "code.gitea.io/gitea/modules/structs"
},
+ "UpdateVariableOption": {
+ "description": "UpdateVariableOption the option when updating variable",
+ "type": "object",
+ "required": ["value"],
+ "properties": {
+ "name": {
+ "description": "New name for the variable. If the field is empty, the variable name won't be updated.",
+ "type": "string",
+ "x-go-name": "Name"
+ },
+ "value": {
+ "description": "Value of the variable to update",
+ "type": "string",
+ "x-go-name": "Value"
+ }
+ },
+ "x-go-package": "code.gitea.io/gitea/modules/structs"
+ },
"User": {
"description": "User represents a user",
"type": "object",
@@ -22122,6 +23564,11 @@
"type": "string",
"x-go-name": "FullName"
},
+ "html_url": {
+ "description": "URL to the user's gitea page",
+ "type": "string",
+ "x-go-name": "HTMLURL"
+ },
"id": {
"description": "the user's id",
"type": "integer",
@@ -22174,6 +23621,12 @@
"type": "boolean",
"x-go-name": "Restricted"
},
+ "source_id": {
+ "description": "The ID of the user's Authentication Source",
+ "type": "integer",
+ "format": "int64",
+ "x-go-name": "SourceID"
+ },
"starred_repos_count": {
"type": "integer",
"format": "int64",
@@ -22461,6 +23914,12 @@
}
}
},
+ "ActionVariable": {
+ "description": "ActionVariable",
+ "schema": {
+ "$ref": "#/definitions/ActionVariable"
+ }
+ },
"ActivityFeedsList": {
"description": "ActivityFeedsList",
"schema": {
@@ -22648,6 +24107,12 @@
}
}
},
+ "Compare": {
+ "description": "",
+ "schema": {
+ "$ref": "#/definitions/Compare"
+ }
+ },
"ContentsListResponse": {
"description": "ContentsListResponse",
"schema": {
@@ -23257,6 +24722,27 @@
}
}
},
+ "TagProtection": {
+ "description": "TagProtection",
+ "schema": {
+ "$ref": "#/definitions/TagProtection"
+ }
+ },
+ "TagProtectionList": {
+ "description": "TagProtectionList",
+ "schema": {
+ "type": "array",
+ "items": {
+ "$ref": "#/definitions/TagProtection"
+ }
+ }
+ },
+ "TasksList": {
+ "description": "TasksList",
+ "schema": {
+ "$ref": "#/definitions/ActionTaskResponse"
+ }
+ },
"Team": {
"description": "Team",
"schema": {
@@ -23341,6 +24827,15 @@
"$ref": "#/definitions/UserSettings"
}
},
+ "VariableList": {
+ "description": "VariableList",
+ "schema": {
+ "type": "array",
+ "items": {
+ "$ref": "#/definitions/ActionVariable"
+ }
+ }
+ },
"WatchInfo": {
"description": "WatchInfo",
"schema": {
@@ -23416,7 +24911,7 @@
"parameterBodies": {
"description": "parameterBodies",
"schema": {
- "$ref": "#/definitions/CreateOrUpdateSecretOption"
+ "$ref": "#/definitions/DispatchWorkflowOption"
}
},
"redirect": {
diff --git a/tests/organization.rs b/tests/organization.rs
new file mode 100644
index 0000000..c5ced99
--- /dev/null
+++ b/tests/organization.rs
@@ -0,0 +1,58 @@
+use forgejo_api::structs::*;
+
+mod common;
+
+#[tokio::test]
+async fn org_vars() {
+ let api = common::login();
+ let org_opt = CreateOrgOption {
+ description: Some("Testing organization variables".into()),
+ email: None,
+ full_name: Some("Org Variables".into()),
+ location: Some("The Lab".into()),
+ repo_admin_change_team_access: None,
+ username: "org-vars".into(),
+ visibility: None,
+ website: None,
+ };
+ api.org_create(org_opt).await.expect("failed to create org");
+
+ let query = GetOrgVariablesListQuery::default();
+ let var_list = api
+ .get_org_variables_list("org-vars", query)
+ .await
+ .expect("failed to list org vars");
+ assert!(var_list.is_empty());
+
+ let opt = CreateVariableOption {
+ value: "false".into(),
+ };
+ api.create_org_variable("org-vars", "want_pizza", opt)
+ .await
+ .expect("failed to create org var");
+
+ let new_var = api
+ .get_org_variable("org-vars", "want_pizza")
+ .await
+ .expect("failed to get org var");
+ assert_eq!(new_var.data.as_deref(), Some("false"));
+
+ // no no no we definitely do want pizza
+ let opt = UpdateVariableOption {
+ name: Some("really_want_pizza".into()),
+ value: "true".into(),
+ };
+ api.update_org_variable("org-vars", "want_pizza", opt)
+ .await
+ .expect("failed to update org variable");
+
+ let new_var = api
+ .get_org_variable("org-vars", "really_want_pizza")
+ .await
+ .expect("failed to get org var");
+ assert_eq!(new_var.data.as_deref(), Some("true"));
+
+ api.delete_org_variable("org-vars", "really_want_pizza")
+ .await
+ .expect("failed to delete org var");
+}
diff --git a/tests/repo.rs b/tests/repo.rs
index c9d6894..3a0377c 100644
--- a/tests/repo.rs
+++ b/tests/repo.rs
@@ -232,6 +232,7 @@ async fn release() {
prerelease: Some(false),
tag_name: "v1.0".into(),
target_commitish: None,
+ hide_archive_links: None,
};
let release = api
.repo_create_release("TestingAdmin", "release-test", release_opt)
@@ -244,6 +245,7 @@ async fn release() {
prerelease: None,
tag_name: None,
target_commitish: None,
+ hide_archive_links: None,
};
api.repo_edit_release(
"TestingAdmin",
@@ -390,3 +392,104 @@ async fn team_pr_review_request() {
.expect("couldn't get pr");
assert_eq!(pr.requested_reviewers, Some(Vec::new()));
}
+
+#[tokio::test]
+async fn tag_protection() {
+ let api = common::login();
+ let git = Git::new("./test_repos/tag-protect");
+ let _ = basic_repo(&api, &git, "tag-protect").await;
+
+ let tag_protections = api
+ .repo_list_tag_protection("TestingAdmin", "tag-protect")
+ .await
+ .expect("failed to list tag protections");
+ assert!(tag_protections.is_empty());
+
+ let protection_opt = CreateTagProtectionOption {
+ name_pattern: Some("v*".into()),
+ whitelist_teams: None,
+ whitelist_usernames: Some(vec!["TestingAdmin".into()]),
+ };
+ let new_protection = api
+ .repo_create_tag_protection("TestingAdmin", "tag-protect", protection_opt)
+ .await
+ .expect("failed to create tag protection");
+ let pattern = new_protection
+ .name_pattern
+ .as_deref()
+ .expect("protection does not have pattern");
+ assert_eq!(pattern, "v*");
+ let id = new_protection.id.expect("protection does not have id") as u32;
+
+ let protection_get = api
+ .repo_get_tag_protection("TestingAdmin", "tag-protect", id)
+ .await
+ .expect("failed to get tag protection");
+ assert_eq!(new_protection, protection_get);
+
+ let edit_opt = EditTagProtectionOption {
+ name_pattern: Some("v*.*.*".into()),
+ whitelist_teams: None,
+ whitelist_usernames: Some(vec![]),
+ };
+ let edited = api
+ .repo_edit_tag_protection("TestingAdmin", "tag-protect", id, edit_opt)
+ .await
+ .expect("failed to edit tag protection");
+ let pattern = edited
+ .name_pattern
+ .as_deref()
+ .expect("protection does not have pattern");
+ assert_eq!(pattern, "v*.*.*");
+
+ api.repo_delete_tag_protection("TestingAdmin", "tag-protect", id)
+ .await
+ .expect("failed to delete tag protection");
+}
+
+#[tokio::test]
+async fn repo_vars() {
+ let api = common::login();
+ let git = Git::new("./test_repos/repo-vars");
+ let _ = basic_repo(&api, &git, "repo-vars").await;
+
+ let query = GetRepoVariablesListQuery::default();
+ let var_list = api
+ .get_repo_variables_list("TestingAdmin", "repo-vars", query)
+ .await
+ .expect("failed to list repo vars");
+ assert!(var_list.is_empty());
+
+ let opt = CreateVariableOption {
+ value: "false".into(),
+ };
+ api.create_repo_variable("TestingAdmin", "repo-vars", "very_cool", opt)
+ .await
+ .expect("failed to create repo var");
+
+ let new_var = api
+ .get_repo_variable("TestingAdmin", "repo-vars", "very_cool")
+ .await
+ .expect("failed to get repo var");
+ assert_eq!(new_var.data.as_deref(), Some("false"));
+
+ // wait, that's not right. you ARE very cool!
+ // gotta fix that
+ let opt = UpdateVariableOption {
+ name: Some("extremely_cool".into()),
+ value: "true".into(),
+ };
+ api.update_repo_variable("TestingAdmin", "repo-vars", "very_cool", opt)
+ .await
+ .expect("failed to update repo variable");
+
+ let new_var = api
+ .get_repo_variable("TestingAdmin", "repo-vars", "extremely_cool")
+ .await
+ .expect("failed to get repo var");
+ assert_eq!(new_var.data.as_deref(), Some("true"));
+
+ api.delete_repo_variable("TestingAdmin", "repo-vars", "extremely_cool")
+ .await
+ .expect("failed to delete repo var");
+}
diff --git a/tests/user.rs b/tests/user.rs
index 9ca808d..3b6e0e3 100644
--- a/tests/user.rs
+++ b/tests/user.rs
@@ -191,3 +191,47 @@ async fn oauth2_login() {
let myself = token_api.user_get_current().await.unwrap();
assert_eq!(myself.login.as_deref(), Some("TestingAdmin"));
}
+
+#[tokio::test]
+async fn user_vars() {
+ let api = common::login();
+
+ let query = GetUserVariablesListQuery::default();
+ let var_list = api
+ .get_user_variables_list(query)
+ .await
+ .expect("failed to list user vars");
+ assert!(var_list.is_empty());
+
+ let opt = CreateVariableOption {
+ value: "false".into(),
+ };
+ api.create_user_variable("likes_dogs", opt)
+ .await
+ .expect("failed to create user var");
+
+ let new_var = api
+ .get_user_variable("likes_dogs")
+ .await
+ .expect("failed to get user var");
+ assert_eq!(new_var.data.as_deref(), Some("false"));
+
+ // what??? totally wrong. I love dogs!
+ let opt = UpdateVariableOption {
+ name: Some("loves_dogs".into()),
+ value: "true".into(),
+ };
+ api.update_user_variable("likes_dogs", opt)
+ .await
+ .expect("failed to update user variable");
+
+ let new_var = api
+ .get_user_variable("loves_dogs")
+ .await
+ .expect("failed to get user var");
+ assert_eq!(new_var.data.as_deref(), Some("true"));
+
+ api.delete_user_variable("loves_dogs")
+ .await
+ .expect("failed to delete user var");
+}