mirror of
https://gitlink.org.cn/Gitlink/forgeplus.git
synced 2026-05-03 03:40:49 +08:00
ADD [gitea] sync mirrored repo service
This commit is contained in:
30
app/services/gitea/repository/sync_mirrored_service.rb
Normal file
30
app/services/gitea/repository/sync_mirrored_service.rb
Normal file
@@ -0,0 +1,30 @@
|
||||
# Sync a mirrored repository
|
||||
class Gitea::Repository::SyncMirroredService < Gitea::ClientService
|
||||
attr_reader :token, :owner, :repo
|
||||
|
||||
# owner *
|
||||
# owner of the repo to sync
|
||||
# repo *
|
||||
# name of the repo to sync
|
||||
# example:
|
||||
# Gitea::Repository::SyncMirroredService.new(owner.login, repo.identifier, user.gitea_token).call
|
||||
def initialize(owner, repo, token=nil)
|
||||
@token = token
|
||||
@owner = owner
|
||||
@repo = repo
|
||||
end
|
||||
|
||||
def call
|
||||
post(url, request_params)
|
||||
end
|
||||
|
||||
private
|
||||
|
||||
def request_params
|
||||
Hash.new.merge(token: token)
|
||||
end
|
||||
|
||||
def url
|
||||
"/repos/#{owner}/#{repo}/mirror-sync".freeze
|
||||
end
|
||||
end
|
||||
Reference in New Issue
Block a user