Files
gitks/api/user/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

156 lines
5.3 KiB
Rust

pub mod add_gpg_key;
pub mod add_ssh_key;
pub mod block_user;
pub mod create_personal_access_token;
pub mod delete_account;
pub mod delete_device;
pub mod delete_gpg_key;
pub mod delete_ssh_key;
pub mod follow_user;
pub mod get_account;
pub mod get_appearance;
pub mod get_notifications;
pub mod get_presence;
pub mod get_profile;
pub mod list_blocks;
pub mod list_devices;
pub mod list_follows;
pub mod list_gpg_keys;
pub mod list_oauth_accounts;
pub mod list_personal_access_tokens;
pub mod list_security_logs;
pub mod list_sessions;
pub mod list_ssh_keys;
pub mod restore_account;
pub mod revoke_personal_access_token;
pub mod revoke_session;
pub mod unblock_user;
pub mod unfollow_user;
pub mod unlink_oauth;
pub mod update_account;
pub mod update_appearance;
pub mod update_notifications;
pub mod update_presence;
pub mod update_profile;
pub mod upload_avatar;
use actix_web::web;
pub fn configure(cfg: &mut web::ServiceConfig) {
cfg.service(
web::scope("/user")
// Account
.route("/account", web::get().to(get_account::get_account))
.route("/account", web::put().to(update_account::update_account))
.route(
"/account/avatar",
web::post().to(upload_avatar::upload_avatar),
)
.route("/account", web::delete().to(delete_account::delete_account))
.route(
"/account/restore",
web::post().to(restore_account::restore_account),
)
// Appearance
.route("/appearance", web::get().to(get_appearance::get_appearance))
.route(
"/appearance",
web::put().to(update_appearance::update_appearance),
)
// Profile
.route("/profile", web::get().to(get_profile::get_profile))
.route("/profile", web::put().to(update_profile::update_profile))
// Notifications
.route(
"/notifications",
web::get().to(get_notifications::get_notifications),
)
.route(
"/notifications",
web::put().to(update_notifications::update_notifications),
)
// SSH Keys
.route("/keys/ssh", web::get().to(list_ssh_keys::list_ssh_keys))
.route("/keys/ssh", web::post().to(add_ssh_key::add_ssh_key))
.route(
"/keys/ssh/{key_id}",
web::delete().to(delete_ssh_key::delete_ssh_key),
)
// GPG Keys
.route("/keys/gpg", web::get().to(list_gpg_keys::list_gpg_keys))
.route("/keys/gpg", web::post().to(add_gpg_key::add_gpg_key))
.route(
"/keys/gpg/{key_id}",
web::delete().to(delete_gpg_key::delete_gpg_key),
)
// Security - Sessions
.route(
"/security/sessions",
web::get().to(list_sessions::list_sessions),
)
.route(
"/security/sessions/{session_id}",
web::delete().to(revoke_session::revoke_session),
)
// Security - Devices
.route(
"/security/devices",
web::get().to(list_devices::list_devices),
)
.route(
"/security/devices/{device_id}",
web::delete().to(delete_device::delete_device),
)
// Security - OAuth
.route(
"/security/oauth",
web::get().to(list_oauth_accounts::list_oauth_accounts),
)
.route(
"/security/oauth/{oauth_id}",
web::delete().to(unlink_oauth::unlink_oauth),
)
// Security - Logs
.route(
"/security/logs",
web::get().to(list_security_logs::list_security_logs),
)
// Security - Personal Access Tokens
.route(
"/security/tokens",
web::get().to(list_personal_access_tokens::list_tokens),
)
.route(
"/security/tokens",
web::post().to(create_personal_access_token::create_token),
)
.route(
"/security/tokens/{token_id}",
web::delete().to(revoke_personal_access_token::revoke_token),
)
// Presence
.route("/presence", web::get().to(get_presence::get_presence))
.route("/presence", web::put().to(update_presence::update_presence))
// Blocks
.route("/blocks", web::get().to(list_blocks::list_blocks))
.route(
"/blocks/{target_user_id}",
web::post().to(block_user::block_user),
)
.route(
"/blocks/{target_user_id}",
web::delete().to(unblock_user::unblock_user),
)
// Follows
.route("/follows", web::get().to(list_follows::list_follows))
.route(
"/follows/{target_user_id}",
web::post().to(follow_user::follow_user),
)
.route(
"/follows/{target_user_id}",
web::delete().to(unfollow_user::unfollow_user),
),
);
}