ADD [gitea] sync mirrored repo service
This commit is contained in:
parent
02b384fa2f
commit
3158a879a4
|
@ -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
|
Loading…
Reference in New Issue