ADD [gitea] sync mirrored repo service

This commit is contained in:
Jasder 2020-05-18 18:20:06 +08:00
parent 02b384fa2f
commit 3158a879a4
1 changed files with 30 additions and 0 deletions

View 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