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

Commit

Permalink
feat: add interfaces and stubs for gitlab
Browse files Browse the repository at this point in the history
Relates to #166
  • Loading branch information
KnisterPeter committed Sep 23, 2017
1 parent 87f1cce commit 802623f
Show file tree
Hide file tree
Showing 4 changed files with 98 additions and 0 deletions.
10 changes: 10 additions & 0 deletions src/provider/gitlab/client.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
import { Client, Response } from '../client';
import { GitlabRepository } from './repository';

export class GitlabClient implements Client {

public async getRepository(_rid: string): Promise<Response<GitlabRepository>> {
throw new Error('Method not implemented.');
}

}
47 changes: 47 additions & 0 deletions src/provider/gitlab/merge-request.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,47 @@
import { Response } from '../client';
import {
PullRequest,
MergeBody,
MergeResult,
RequestReviewBody,
CancelReviewBody,
Comment
} from '../pull-request';
import { GitlabUser } from './user';

export class GitlabMergeRequest implements PullRequest {

public id: number;
public number: number;
public state: 'open' | 'closed';
public title: string;
public body: string;
public url: string;
public sourceBranch: string;
public targetBranch: string;
public mergeable?: boolean | null | undefined;

public async getComments(): Promise<Response<Comment[]>> {
throw new Error('Method not implemented.');
}

public async merge(_body: MergeBody): Promise<Response<MergeResult>> {
throw new Error('Method not implemented.');
}

public async assign(_assignees: GitlabUser[]): Promise<void> {
throw new Error('Method not implemented.');
}

public async unassign(): Promise<void> {
throw new Error('Method not implemented.');
}

public async requestReview(_body: RequestReviewBody): Promise<void> {
throw new Error('Method not implemented.');
}

public async cancelReview(_body: CancelReviewBody): Promise<void> {
throw new Error('Method not implemented.');
}
}
36 changes: 36 additions & 0 deletions src/provider/gitlab/repository.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,36 @@
import { Response } from '../client';
import { Issue } from '../issue';
import {
Repository,
ListPullRequestsParameters,
CreatePullRequestBody,
IssuesParameters
} from '../repository';
import { GitlabMergeRequest } from './merge-request';

export class GitlabRepository implements Repository {

public name: string;
public defaultBranch: string;
public allowMergeCommits: boolean;
public allowSquashCommits: boolean;
public allowRebaseCommits: boolean;
public parent: Repository | undefined;

public async getPullRequests(_parameters?: ListPullRequestsParameters | undefined):
Promise<Response<GitlabMergeRequest[]>> {
throw new Error('Method not implemented.');
}

public async getPullRequest(_id: number): Promise<Response<GitlabMergeRequest>> {
throw new Error('Method not implemented.');
}

public async createPullRequest(_body: CreatePullRequestBody): Promise<Response<GitlabMergeRequest>> {
throw new Error('Method not implemented.');
}

public async getIssues(_parameters?: IssuesParameters | undefined): Promise<Response<Issue[]>> {
throw new Error('Method not implemented.');
}
}
5 changes: 5 additions & 0 deletions src/provider/gitlab/user.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
import { User } from '../user';

export class GitlabUser implements User<number> {
public id: number;
}

0 comments on commit 802623f

Please sign in to comment.