feat(remote): sketch out interface, stub github/gitlab remotes
This commit is contained in:
parent
fe160fa53e
commit
7af3f35baf
|
@ -0,0 +1,44 @@
|
|||
import { NotImplementedError } from '@apextoaster/js-utils';
|
||||
|
||||
import { IssueUpdate, LabelUpdate, Remote } from '.';
|
||||
|
||||
/**
|
||||
* Github/Octokit API implementation of the `Remote` contract.
|
||||
*/
|
||||
export class GithubRemote implements Remote {
|
||||
public async createComment() {
|
||||
throw new NotImplementedError();
|
||||
}
|
||||
|
||||
public async createLabel(): Promise<LabelUpdate> {
|
||||
throw new NotImplementedError();
|
||||
}
|
||||
|
||||
public async deleteLabel(): Promise<LabelUpdate> {
|
||||
throw new NotImplementedError();
|
||||
}
|
||||
|
||||
public async getIssue(): Promise<Array<IssueUpdate>> {
|
||||
throw new NotImplementedError();
|
||||
}
|
||||
|
||||
public async getLabel(): Promise<Array<LabelUpdate>> {
|
||||
throw new NotImplementedError();
|
||||
}
|
||||
|
||||
public async listIssues(): Promise<Array<IssueUpdate>> {
|
||||
throw new NotImplementedError();
|
||||
}
|
||||
|
||||
public async listLabels(): Promise<Array<LabelUpdate>> {
|
||||
throw new NotImplementedError();
|
||||
}
|
||||
|
||||
public async updateIssue(): Promise<IssueUpdate> {
|
||||
throw new NotImplementedError();
|
||||
}
|
||||
|
||||
public async updateLabel(): Promise<LabelUpdate> {
|
||||
throw new NotImplementedError();
|
||||
}
|
||||
}
|
|
@ -0,0 +1,45 @@
|
|||
import { NotImplementedError } from '@apextoaster/js-utils';
|
||||
|
||||
import { IssueUpdate, LabelUpdate, Remote } from '.';
|
||||
|
||||
/**
|
||||
* Gitlab API implementation of the `Remote` contract.
|
||||
*/
|
||||
export class GitlabRemote implements Remote {
|
||||
public async createComment() {
|
||||
throw new NotImplementedError();
|
||||
}
|
||||
|
||||
public async createLabel(): Promise<LabelUpdate> {
|
||||
throw new NotImplementedError();
|
||||
}
|
||||
|
||||
public async deleteLabel(): Promise<LabelUpdate> {
|
||||
throw new NotImplementedError();
|
||||
}
|
||||
|
||||
public async getIssue(): Promise<Array<IssueUpdate>> {
|
||||
throw new NotImplementedError();
|
||||
}
|
||||
|
||||
public async getLabel(): Promise<Array<LabelUpdate>> {
|
||||
throw new NotImplementedError();
|
||||
}
|
||||
|
||||
public async listIssues(): Promise<Array<IssueUpdate>> {
|
||||
throw new NotImplementedError();
|
||||
}
|
||||
|
||||
public async listLabels(): Promise<Array<LabelUpdate>> {
|
||||
throw new NotImplementedError();
|
||||
}
|
||||
|
||||
public async updateIssue(): Promise<IssueUpdate> {
|
||||
throw new NotImplementedError();
|
||||
}
|
||||
|
||||
public async updateLabel(): Promise<LabelUpdate> {
|
||||
throw new NotImplementedError();
|
||||
}
|
||||
}
|
||||
|
|
@ -0,0 +1,70 @@
|
|||
export interface LabelQuery {
|
||||
project: string;
|
||||
name: string;
|
||||
}
|
||||
|
||||
export interface IssueQuery {
|
||||
project: string;
|
||||
issue: string;
|
||||
}
|
||||
|
||||
export interface CommentUpdate extends IssueQuery {
|
||||
comment: string;
|
||||
}
|
||||
|
||||
export interface IssueUpdate extends IssueQuery {
|
||||
labels: Array<string>;
|
||||
name: string;
|
||||
}
|
||||
|
||||
export interface LabelUpdate extends LabelQuery {
|
||||
color: string;
|
||||
desc: string;
|
||||
}
|
||||
|
||||
/**
|
||||
* Basic functions which every remote API must provide.
|
||||
*/
|
||||
export interface Remote {
|
||||
/**
|
||||
* Add a comment to an issue (for attribution and auditing).
|
||||
*/
|
||||
createComment(options: CommentUpdate): Promise<unknown>;
|
||||
|
||||
/**
|
||||
* Create a new label.
|
||||
*/
|
||||
createLabel(options: LabelQuery): Promise<LabelUpdate>;
|
||||
|
||||
/**
|
||||
* Delete an existing label.
|
||||
*/
|
||||
deleteLabel(options: LabelQuery): Promise<LabelUpdate>;
|
||||
|
||||
/**
|
||||
* Get details of a single issue.
|
||||
*/
|
||||
getIssue(options: IssueQuery): Promise<Array<IssueUpdate>>;
|
||||
|
||||
/**
|
||||
* Get details of a single label.
|
||||
*/
|
||||
getLabel(options: LabelQuery): Promise<Array<LabelUpdate>>;
|
||||
|
||||
/**
|
||||
* List all issues.
|
||||
*/
|
||||
listIssues(): Promise<Array<IssueUpdate>>;
|
||||
|
||||
/**
|
||||
* List all labels.
|
||||
*/
|
||||
listLabels(): Promise<Array<LabelUpdate>>;
|
||||
|
||||
/**
|
||||
* Set labels on an issue.
|
||||
*/
|
||||
updateIssue(options: IssueUpdate): Promise<IssueUpdate>;
|
||||
|
||||
updateLabel(options: LabelUpdate): Promise<LabelUpdate>;
|
||||
}
|
Loading…
Reference in New Issue