新增:合并请求详情接口

This commit is contained in:
2022-07-25 18:23:06 +08:00
parent 5463c22518
commit 3f5754a3a5
6 changed files with 65 additions and 4 deletions

View File

@@ -0,0 +1,32 @@
class Api::V1::Projects::Pulls::GetService < ApplicationService
attr_reader :project, :pull_request, :owner, :repo, :index, :token
attr_accessor :gitea_data
def initialize(project, pull_request, token = nil)
@project = project
@pull_request = pull_request
@owner = project&.owner.login
@repo = project&.identifier
@index = pull_request.gitea_number
@token = token
end
def call
load_gitea_data
gitea_data
end
private
def request_params
{
access_token: token
}
end
def load_gitea_data
@gitea_data = $gitea_client.get_repos_pulls_by_owner_repo_index(owner, repo, index, {query: request_params})
# raise Error, '获取合并请求失败!' unless @gitea_data.is_a?(Hash)
end
end