add: gitea api admin

This commit is contained in:
viletyy 2022-05-05 15:22:35 +08:00
parent 2cff9bd157
commit 1ffd21ae0d
3 changed files with 63 additions and 0 deletions

View File

@ -6,6 +6,7 @@ require_relative 'api/user'
require_relative 'api/organization'
require_relative 'api/notification'
require_relative 'api/miscellaneous'
require_relative 'api/admin'
require_relative 'api/client'
require_relative 'api/config'
require_relative 'api/exception'

61
lib/gitea/api/admin.rb Normal file
View File

@ -0,0 +1,61 @@
module Gitea
module Api
module Admin
def get_admin_cron(opt={})
@http.get("/admin/cron", opt)
end
def post_admin_cron_by_task(task, opt={})
@http.post("/admin/cron/#{task}", opt)
end
def get_admin_orgs(opt={})
@http.get("/admin/orgs", opt)
end
def get_admin_unadopted(opt={})
@http.get("/admin/unadopted", opt)
end
def post_admin_unadopted_by_owner_repo(owner, repo, opt={})
@http.post("/admin/unadopted/#{owner}/#{repo}", opt)
end
def delete_admin_unadopted_by_owner_repo(owner, repo, opt={})
@http.delete("/admin/unadopted/#{owner}/#{repo}", opt)
end
def get_admin_users(opt={})
@http.get("/admin/users", opt)
end
def post_admin_users(opt={})
@http.post("/admin/users", opt)
end
def delete_admin_users_by_username(username, opt={})
@http.delete("/admin/users/#{username}", opt)
end
def patch_admin_users_by_username(username, opt={})
@http.patch("/admin/users/#{username}", opt)
end
def post_admin_users_keys_by_username(username, opt={})
@http.post("/admin/users/#{username}/keys", opt)
end
def delete_admin_users_keys_by_username_id(username, id, opt={})
@http.delete("/admin/users/#{username}/keys/#{id}", opt)
end
def post_admin_users_orgs_by_username(username, opt={})
@http.post("/admin/users/#{username}/orgs", opt)
end
def post_admin_users_repos_by_username(username, opt={})
@http.post("/admin/users/#{username}/repos", opt)
end
end # Admin
end # Api
end # Gitea

View File

@ -23,6 +23,7 @@ module Gitea
include Gitea::Api::Organization
include Gitea::Api::Notification
include Gitea::Api::Miscellaneous
include Gitea::Api::Admin
end
end # User
end # Gitea