Skip to content
This repository has been archived by the owner on Nov 27, 2023. It is now read-only.

Commit

Permalink
feat: load single merge request
Browse files Browse the repository at this point in the history
Relates to #166
  • Loading branch information
KnisterPeter committed Sep 23, 2017
1 parent 9508c15 commit 84d04d6
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 2 deletions.
3 changes: 3 additions & 0 deletions src/provider/gitlab/api.ts
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@ import {
export interface GitLab {
getProject(id: string): Promise<GitLabResponse<Project>>;
getMergeRequests(id: string, parameters?: GetMergeRequestParameters): Promise<GitLabResponse<MergeRequest[]>>;
getMergeRequest(id: string, mr_iid: number): Promise<GitLabResponse<MergeRequest>>;
}

export interface GitLabResponse<T> {
Expand Down Expand Up @@ -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 {/* */}
}

}
10 changes: 8 additions & 2 deletions src/provider/gitlab/repository.ts
Original file line number Diff line number Diff line change
Expand Up @@ -90,8 +90,14 @@ export class GitLabRepository implements Repository {
};
}

public async getPullRequest(_id: number): Promise<Response<GitLabMergeRequest>> {
throw new Error('Method not implemented.');
public async getPullRequest(id: number): Promise<Response<GitLabMergeRequest>> {
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<Response<GitLabMergeRequest>> {
Expand Down

0 comments on commit 84d04d6

Please sign in to comment.