feat(api): expand API endpoints for repo, PR, user, workspace management

- Add git operation endpoints: archive, compare branches, diff, tree,
  repository extras
- Add repo endpoints: contributors, delete fork, get branch/commit
  status/deploy key/invitation/member/release/tag/webhook, topics,
  release assets, webhook deliveries/retry
- Add PR endpoints: review requests, templates
- Add user endpoints: block/unblock, follow/unfollow, presence,
  personal access tokens, account restore
- Add workspace endpoints: billing history, approvals, domains,
  integrations, invitations, members, webhooks, restore
- Add internal API, notification API, IM API modules
- Update route configuration and OpenAPI spec
This commit is contained in:
zhenyi
2026-06-10 18:49:27 +08:00
parent 4586b79cb8
commit cec6dce955
161 changed files with 7522 additions and 349 deletions
+67 -1
View File
@@ -3,6 +3,7 @@ pub mod add_domain;
pub mod add_member;
pub mod archive;
pub mod audit_logs;
pub mod billing_history;
pub mod create;
pub mod create_integration;
pub mod create_invitation;
@@ -12,10 +13,16 @@ pub mod delete_domain;
pub mod delete_integration;
pub mod delete_webhook;
pub mod get;
pub mod get_approval;
pub mod get_billing;
pub mod get_branding;
pub mod get_domain;
pub mod get_integration;
pub mod get_invitation;
pub mod get_member;
pub mod get_settings;
pub mod get_stats;
pub mod get_webhook;
pub mod leave;
pub mod list;
pub mod list_approvals;
@@ -23,10 +30,13 @@ pub mod list_domains;
pub mod list_integrations;
pub mod list_invitations;
pub mod list_members;
pub mod list_webhook_deliveries;
pub mod list_webhooks;
pub mod refresh_stats;
pub mod remove_member;
pub mod request_approval;
pub mod restore;
pub mod retry_webhook_delivery;
pub mod review_approval;
pub mod revoke_invitation;
pub mod set_primary_domain;
@@ -35,6 +45,7 @@ pub mod unarchive;
pub mod update;
pub mod update_billing;
pub mod update_branding;
pub mod update_domain;
pub mod update_integration;
pub mod update_member_role;
pub mod update_settings;
@@ -47,7 +58,6 @@ use actix_web::web;
pub fn configure(cfg: &mut web::ServiceConfig) {
cfg.service(
web::scope("/workspaces")
// Core
.route("", web::get().to(list::handle))
.route("", web::post().to(create::handle))
.route(
@@ -57,6 +67,10 @@ pub fn configure(cfg: &mut web::ServiceConfig) {
.route("/{workspace_name}", web::get().to(get::handle))
.route("/{workspace_name}", web::put().to(update::handle))
.route("/{workspace_name}", web::delete().to(delete::handle))
.route(
"/{workspace_name}/restore",
web::post().to(restore::restore_workspace),
)
.route("/{workspace_name}/archive", web::post().to(archive::handle))
.route(
"/{workspace_name}/unarchive",
@@ -83,6 +97,10 @@ pub fn configure(cfg: &mut web::ServiceConfig) {
"/{workspace_name}/members/{member_id}/role",
web::put().to(update_member_role::handle),
)
.route(
"/{workspace_name}/members/{member_id}",
web::get().to(get_member::handle),
)
.route(
"/{workspace_name}/members/{member_id}",
web::delete().to(remove_member::handle),
@@ -97,6 +115,10 @@ pub fn configure(cfg: &mut web::ServiceConfig) {
"/{workspace_name}/invitations",
web::post().to(create_invitation::handle),
)
.route(
"/{workspace_name}/invitations/{invitation_id}",
web::get().to(get_invitation::handle),
)
.route(
"/{workspace_name}/invitations/{invitation_id}",
web::delete().to(revoke_invitation::handle),
@@ -110,6 +132,10 @@ pub fn configure(cfg: &mut web::ServiceConfig) {
"/{workspace_name}/billing",
web::put().to(update_billing::handle),
)
.route(
"/{workspace_name}/billing/history",
web::get().to(billing_history::billing_history),
)
// Branding
.route(
"/{workspace_name}/branding",
@@ -143,6 +169,10 @@ pub fn configure(cfg: &mut web::ServiceConfig) {
"/{workspace_name}/integrations",
web::post().to(create_integration::handle),
)
.route(
"/{workspace_name}/integrations/{integration_id}",
web::get().to(get_integration::handle),
)
.route(
"/{workspace_name}/integrations/{integration_id}",
web::put().to(update_integration::handle),
@@ -160,6 +190,10 @@ pub fn configure(cfg: &mut web::ServiceConfig) {
"/{workspace_name}/webhooks",
web::post().to(create_webhook::handle),
)
.route(
"/{workspace_name}/webhooks/{webhook_id}",
web::get().to(get_webhook::handle),
)
.route(
"/{workspace_name}/webhooks/{webhook_id}",
web::put().to(update_webhook::handle),
@@ -168,6 +202,14 @@ pub fn configure(cfg: &mut web::ServiceConfig) {
"/{workspace_name}/webhooks/{webhook_id}",
web::delete().to(delete_webhook::handle),
)
.route(
"/{workspace_name}/webhooks/{webhook_id}/deliveries",
web::get().to(list_webhook_deliveries::handle),
)
.route(
"/{workspace_name}/webhooks/{webhook_id}/deliveries/{delivery_id}/retry",
web::post().to(retry_webhook_delivery::handle),
)
// Domains
.route(
"/{workspace_name}/domains",
@@ -185,6 +227,14 @@ pub fn configure(cfg: &mut web::ServiceConfig) {
"/{workspace_name}/domains/{domain_id}/primary",
web::put().to(set_primary_domain::handle),
)
.route(
"/{workspace_name}/domains/{domain_id}",
web::get().to(get_domain::handle),
)
.route(
"/{workspace_name}/domains/{domain_id}",
web::put().to(update_domain::update_domain),
)
.route(
"/{workspace_name}/domains/{domain_id}",
web::delete().to(delete_domain::handle),
@@ -198,6 +248,10 @@ pub fn configure(cfg: &mut web::ServiceConfig) {
"/{workspace_name}/approvals",
web::post().to(request_approval::handle),
)
.route(
"/{workspace_name}/approvals/{approval_id}",
web::get().to(get_approval::handle),
)
.route(
"/{workspace_name}/approvals/{approval_id}",
web::put().to(review_approval::handle),
@@ -206,6 +260,18 @@ pub fn configure(cfg: &mut web::ServiceConfig) {
.route(
"/{workspace_name}/audit-logs",
web::get().to(audit_logs::handle),
)
// Issues
.service(web::scope("/{workspace_name}/issues").configure(crate::api::issue::configure))
// Repos
.service(web::scope("/{workspace_name}/repos").configure(crate::api::repo::configure))
// Repo-level: PRs, Wiki, Issue labels/milestones/templates, Git
.service(
web::scope("/{workspace_name}/repos/{repo_name}")
.configure(crate::api::issue::configure_repo_level)
.configure(crate::api::pr::configure)
.configure(crate::api::wiki::configure)
.configure(crate::api::repo::git::configure),
),
);
}