diff --git a/src/provider/gitlab/api.ts b/src/provider/gitlab/api.ts index ed410c9f..ef2f5ac6 100644 --- a/src/provider/gitlab/api.ts +++ b/src/provider/gitlab/api.ts @@ -9,6 +9,7 @@ import { export interface GitLab { getProject(id: string): Promise>; getMergeRequests(id: string, parameters?: GetMergeRequestParameters): Promise>; + getMergeRequest(id: string, mr_iid: number): Promise>; } export interface GitLabResponse { @@ -104,6 +105,8 @@ namespace impl { public getProject(): any {/* */} @Get('/projects/:id/merge_requests', true) public getMergeRequests(): any {/* */} + @Get('/projects/:id/merge_requests/:merge_request_iid') + public getMergeRequest(): any {/* */} } } diff --git a/src/provider/gitlab/repository.ts b/src/provider/gitlab/repository.ts index dd3b03c0..3cb36ffe 100644 --- a/src/provider/gitlab/repository.ts +++ b/src/provider/gitlab/repository.ts @@ -90,8 +90,14 @@ export class GitLabRepository implements Repository { }; } - public async getPullRequest(_id: number): Promise> { - throw new Error('Method not implemented.'); + public async getPullRequest(id: number): Promise> { + const response = await this.client.getMergeRequest( + encodeURIComponent(this.project.path_with_namespace), + id + ); + return { + body: new GitLabMergeRequest(this.client, this, response.body) + }; } public async createPullRequest(_body: CreatePullRequestBody): Promise> {