-
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathindex.ts
59 lines (46 loc) · 1.21 KB
/
index.ts
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
import { GithubClient } from "./clients/github";
import { ParamsInterface } from "./interfaces";
// GitStory
export default class GitStory {
private clientName: string;
private client;
constructor(clientName: string) {
this.clientName = clientName;
}
/**
* Git client init
* @param params
*/
init(params: ParamsInterface) {
switch (this.clientName.toLowerCase()) {
case "github":
this.client = new GithubClient();
this.client.init(params);
break;
case "gitlab":
break;
}
}
/**
* Git Functions
* Available Features/endpoints
*/
async getFirstCommit() {
return this.client.getFirstCommit();
}
async getFirstCommitDate() {
return this.client.getFirstCommitDate();
}
async getCommitDate(commit_sha) {
return this.client.getCommitDate(commit_sha);
}
async getCommitsBetweenDates(startDate, endDate, per_page: number, page: number) {
return this.client.getCommitsBetween(startDate, endDate, per_page, page);
}
async getCommitsUntilDate(date, per_page: number, page: number) {
return this.client.getCommitsUntil(date, per_page, page);
}
async yearsActive() {
return this.client.yearsActive();
}
}