Files
gitks/api/workspace/mod.rs
T
zhenyi cec6dce955 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
2026-06-10 18:49:27 +08:00

278 lines
9.3 KiB
Rust

pub mod accept_invitation;
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;
pub mod create_webhook;
pub mod delete;
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;
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;
pub mod transfer_owner;
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;
pub mod update_webhook;
pub mod upload_avatar;
pub mod verify_domain;
use actix_web::web;
pub fn configure(cfg: &mut web::ServiceConfig) {
cfg.service(
web::scope("/workspaces")
.route("", web::get().to(list::handle))
.route("", web::post().to(create::handle))
.route(
"/invitations/accept",
web::post().to(accept_invitation::handle),
)
.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",
web::post().to(unarchive::handle),
)
.route(
"/{workspace_name}/transfer-owner",
web::post().to(transfer_owner::handle),
)
.route(
"/{workspace_name}/avatar",
web::post().to(upload_avatar::handle),
)
// Members
.route(
"/{workspace_name}/members",
web::get().to(list_members::handle),
)
.route(
"/{workspace_name}/members",
web::post().to(add_member::handle),
)
.route(
"/{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),
)
.route("/{workspace_name}/leave", web::post().to(leave::handle))
// Invitations
.route(
"/{workspace_name}/invitations",
web::get().to(list_invitations::handle),
)
.route(
"/{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),
)
// Billing
.route(
"/{workspace_name}/billing",
web::get().to(get_billing::handle),
)
.route(
"/{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",
web::get().to(get_branding::handle),
)
.route(
"/{workspace_name}/branding",
web::put().to(update_branding::handle),
)
// Settings
.route(
"/{workspace_name}/settings",
web::get().to(get_settings::handle),
)
.route(
"/{workspace_name}/settings",
web::put().to(update_settings::handle),
)
// Stats
.route("/{workspace_name}/stats", web::get().to(get_stats::handle))
.route(
"/{workspace_name}/stats/refresh",
web::post().to(refresh_stats::handle),
)
// Integrations
.route(
"/{workspace_name}/integrations",
web::get().to(list_integrations::handle),
)
.route(
"/{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),
)
.route(
"/{workspace_name}/integrations/{integration_id}",
web::delete().to(delete_integration::handle),
)
// Webhooks
.route(
"/{workspace_name}/webhooks",
web::get().to(list_webhooks::handle),
)
.route(
"/{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),
)
.route(
"/{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",
web::get().to(list_domains::handle),
)
.route(
"/{workspace_name}/domains",
web::post().to(add_domain::handle),
)
.route(
"/{workspace_name}/domains/{domain_id}/verify",
web::post().to(verify_domain::handle),
)
.route(
"/{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),
)
// Approvals
.route(
"/{workspace_name}/approvals",
web::get().to(list_approvals::handle),
)
.route(
"/{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),
)
// Audit
.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),
),
);
}