@gitkraken/provider-apis 0.6.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +112 -0
- package/LICENSE +19 -0
- package/README.md +78 -0
- package/dist/defaults.d.ts +6 -0
- package/dist/fetchWrapper.d.ts +2 -0
- package/dist/index.d.ts +27 -0
- package/dist/index.js +552 -0
- package/dist/providers/azureDevops/azureDevOps.d.ts +116 -0
- package/dist/providers/azureDevops/azureDevOpsHelpers.d.ts +3 -0
- package/dist/providers/azureDevops/azureDevOpsTypes.d.ts +198 -0
- package/dist/providers/bitbucket/bitbucket.d.ts +107 -0
- package/dist/providers/bitbucket/bitbucketHelpers.d.ts +3 -0
- package/dist/providers/bitbucket/bitbucketTypes.d.ts +181 -0
- package/dist/providers/gitProvider.d.ts +166 -0
- package/dist/providers/github/github.d.ts +122 -0
- package/dist/providers/github/githubHelpers.d.ts +19 -0
- package/dist/providers/github/githubTypes.d.ts +159 -0
- package/dist/providers/gitlab/gitlab.d.ts +157 -0
- package/dist/providers/gitlab/gitlabHelpers.d.ts +4 -0
- package/dist/providers/gitlab/gitlabTypes.d.ts +33 -0
- package/dist/providers/issueProvider.d.ts +37 -0
- package/dist/providers/jira/jira.d.ts +14 -0
- package/dist/providers/provider.d.ts +6 -0
- package/dist/providers/trello/trello.d.ts +13 -0
- package/dist/types.d.ts +76 -0
- package/dist/utils.d.ts +1 -0
- package/package.json +59 -0
|
@@ -0,0 +1,166 @@
|
|
|
1
|
+
import { EnterpriseProviderConfigInit, PagedResult, ProviderConfigInit, Result } from '../types';
|
|
2
|
+
import { Provider } from './provider';
|
|
3
|
+
export interface SharedOptions {
|
|
4
|
+
token?: string;
|
|
5
|
+
isPAT?: boolean;
|
|
6
|
+
}
|
|
7
|
+
export interface BasicOptions extends SharedOptions {
|
|
8
|
+
baseUrl?: string;
|
|
9
|
+
}
|
|
10
|
+
export interface User {
|
|
11
|
+
name: string | null;
|
|
12
|
+
email: string | null;
|
|
13
|
+
avatarUrl: string | null;
|
|
14
|
+
}
|
|
15
|
+
export interface Account extends User {
|
|
16
|
+
id: string;
|
|
17
|
+
graphQLId?: string;
|
|
18
|
+
username: string | null;
|
|
19
|
+
}
|
|
20
|
+
export interface GitRepository {
|
|
21
|
+
id: string;
|
|
22
|
+
graphQLId?: string;
|
|
23
|
+
namespace: string;
|
|
24
|
+
name: string;
|
|
25
|
+
project?: string;
|
|
26
|
+
webUrl: string | null;
|
|
27
|
+
httpsUrl: string | null;
|
|
28
|
+
sshUrl: string | null;
|
|
29
|
+
defaultBranch: GitRef | null;
|
|
30
|
+
permission: string | null;
|
|
31
|
+
}
|
|
32
|
+
export interface GitRef {
|
|
33
|
+
name: string;
|
|
34
|
+
}
|
|
35
|
+
export interface GitRefWithCommit extends GitRef {
|
|
36
|
+
commit: GitCommit | null;
|
|
37
|
+
}
|
|
38
|
+
export interface GitCommit {
|
|
39
|
+
oid: string;
|
|
40
|
+
authoredDate: Date | null;
|
|
41
|
+
committedDate: Date | null;
|
|
42
|
+
}
|
|
43
|
+
export interface GitBlame {
|
|
44
|
+
ranges: {
|
|
45
|
+
startingLine: number;
|
|
46
|
+
endingLine: number;
|
|
47
|
+
commit: GitCommit & {
|
|
48
|
+
parentOids: string[];
|
|
49
|
+
message: string;
|
|
50
|
+
author: User | null;
|
|
51
|
+
committer: User | null;
|
|
52
|
+
fileCount: number | null;
|
|
53
|
+
additions: number | null;
|
|
54
|
+
deletions: number | null;
|
|
55
|
+
};
|
|
56
|
+
}[];
|
|
57
|
+
}
|
|
58
|
+
export declare enum GitPullRequestState {
|
|
59
|
+
Open = "OPEN",
|
|
60
|
+
Closed = "CLOSED",
|
|
61
|
+
Merged = "MERGED"
|
|
62
|
+
}
|
|
63
|
+
export declare enum GitPullRequestReviewState {
|
|
64
|
+
Approved = "APPROVED",
|
|
65
|
+
ChangesRequested = "CHANGES_REQUESTED",
|
|
66
|
+
Commented = "COMMENTED",
|
|
67
|
+
ReviewRequested = "REVIEW_REQUESTED"
|
|
68
|
+
}
|
|
69
|
+
export interface GitPullRequest {
|
|
70
|
+
id: string;
|
|
71
|
+
graphQLId?: string;
|
|
72
|
+
number: number;
|
|
73
|
+
title: string;
|
|
74
|
+
url: string | null;
|
|
75
|
+
state: GitPullRequestState;
|
|
76
|
+
isDraft: boolean;
|
|
77
|
+
createdDate: Date;
|
|
78
|
+
updatedDate: Date;
|
|
79
|
+
closedDate: Date | null;
|
|
80
|
+
baseRef: GitRef | null;
|
|
81
|
+
headRef: GitRef | null;
|
|
82
|
+
commentCount: number | null;
|
|
83
|
+
upvoteCount: number | null;
|
|
84
|
+
commitCount: number | null;
|
|
85
|
+
fileCount: number | null;
|
|
86
|
+
additions: number | null;
|
|
87
|
+
deletions: number | null;
|
|
88
|
+
author: Account | null;
|
|
89
|
+
assignees: Account[] | null;
|
|
90
|
+
reviews: {
|
|
91
|
+
reviewer: Account;
|
|
92
|
+
state: GitPullRequestReviewState;
|
|
93
|
+
}[] | null;
|
|
94
|
+
repository: {
|
|
95
|
+
name: string;
|
|
96
|
+
owner: {
|
|
97
|
+
login?: string;
|
|
98
|
+
};
|
|
99
|
+
};
|
|
100
|
+
headRepository: {
|
|
101
|
+
name: string;
|
|
102
|
+
owner: {
|
|
103
|
+
login: string;
|
|
104
|
+
};
|
|
105
|
+
remoteInfo: {
|
|
106
|
+
cloneUrlHTTPS: string;
|
|
107
|
+
cloneUrlSSH: string;
|
|
108
|
+
};
|
|
109
|
+
} | null;
|
|
110
|
+
headCommit: {
|
|
111
|
+
buildStatus: {
|
|
112
|
+
context: string;
|
|
113
|
+
state: string;
|
|
114
|
+
description: string;
|
|
115
|
+
targetUrl?: string;
|
|
116
|
+
} | null;
|
|
117
|
+
} | null;
|
|
118
|
+
}
|
|
119
|
+
export interface GetRepoInput {
|
|
120
|
+
namespace: string;
|
|
121
|
+
name: string;
|
|
122
|
+
project?: string;
|
|
123
|
+
}
|
|
124
|
+
export interface GetReposInput {
|
|
125
|
+
repos: GetRepoInput[];
|
|
126
|
+
}
|
|
127
|
+
export type GetPRsForReposInput = GetReposInput | {
|
|
128
|
+
repoIds: (string | number)[];
|
|
129
|
+
};
|
|
130
|
+
export interface CursorPageInput {
|
|
131
|
+
cursor?: string | null;
|
|
132
|
+
}
|
|
133
|
+
export interface NumberedPageInput {
|
|
134
|
+
page?: number | null;
|
|
135
|
+
}
|
|
136
|
+
export type PageInput = CursorPageInput | NumberedPageInput;
|
|
137
|
+
export declare abstract class GitProvider<Config extends ProviderConfigInit = ProviderConfigInit> extends Provider<Config> {
|
|
138
|
+
abstract getCurrentUser(options: SharedOptions): Promise<Result<Account>>;
|
|
139
|
+
abstract getUserForCommit(input: {
|
|
140
|
+
repo: GetRepoInput;
|
|
141
|
+
oid: string;
|
|
142
|
+
}, options: SharedOptions): Promise<Result<User>>;
|
|
143
|
+
getAccountForEmail?(input: {
|
|
144
|
+
email: string;
|
|
145
|
+
}, options: SharedOptions): Promise<Result<Account>>;
|
|
146
|
+
getAccountForUsername?(input: {
|
|
147
|
+
username: string;
|
|
148
|
+
}, options: SharedOptions): Promise<Result<Account>>;
|
|
149
|
+
abstract getRepo(input: GetRepoInput, options: SharedOptions): Promise<Result<GitRepository>>;
|
|
150
|
+
abstract getRepos(inputs: GetRepoInput[], options: SharedOptions): Promise<Result<GitRepository[]>>;
|
|
151
|
+
abstract getBranches(input: {
|
|
152
|
+
repo: GetRepoInput;
|
|
153
|
+
} & PageInput, options: SharedOptions): Promise<PagedResult<GitRefWithCommit>>;
|
|
154
|
+
abstract getTags(input: {
|
|
155
|
+
repo: GetRepoInput;
|
|
156
|
+
} & PageInput, options: SharedOptions): Promise<PagedResult<GitRefWithCommit>>;
|
|
157
|
+
getBlame?(input: {
|
|
158
|
+
repo: GetRepoInput;
|
|
159
|
+
ref: string;
|
|
160
|
+
path: string;
|
|
161
|
+
}, options: SharedOptions): Promise<Result<GitBlame>>;
|
|
162
|
+
abstract getPullRequestsForRepos(input: GetPRsForReposInput, options: SharedOptions): Promise<Result<GitPullRequest[]>>;
|
|
163
|
+
}
|
|
164
|
+
export declare abstract class EnterpriseGitProvider extends GitProvider<EnterpriseProviderConfigInit> {
|
|
165
|
+
}
|
|
166
|
+
export declare const MAX_PAGE_SIZE = 100;
|
|
@@ -0,0 +1,122 @@
|
|
|
1
|
+
import { Account, BasicOptions, CursorPageInput, EnterpriseGitProvider, GetRepoInput, GitPullRequest, GitRepository } from '../gitProvider';
|
|
2
|
+
import { Issue } from '../issueProvider';
|
|
3
|
+
import { FetchIssuesData, FetchPullRequestsData } from './githubTypes';
|
|
4
|
+
export declare class GitHub extends EnterpriseGitProvider {
|
|
5
|
+
private _scopesCache;
|
|
6
|
+
private getScopes;
|
|
7
|
+
private getEnterpriseAvatarUrlIfNeeded;
|
|
8
|
+
getCurrentUser(options?: BasicOptions): Promise<{
|
|
9
|
+
data: Account;
|
|
10
|
+
}>;
|
|
11
|
+
getUserForCommit(input: {
|
|
12
|
+
repo: GetRepoInput;
|
|
13
|
+
oid: string;
|
|
14
|
+
avatarSize?: number;
|
|
15
|
+
}, options?: BasicOptions): Promise<{
|
|
16
|
+
data: {
|
|
17
|
+
name: string | null;
|
|
18
|
+
email: string | null;
|
|
19
|
+
avatarUrl: string;
|
|
20
|
+
};
|
|
21
|
+
}>;
|
|
22
|
+
/**
|
|
23
|
+
* Note: 'email' is only returned if the token has the required scope.
|
|
24
|
+
*/
|
|
25
|
+
getAccountForEmail(input: {
|
|
26
|
+
email: string;
|
|
27
|
+
avatarSize?: number;
|
|
28
|
+
}, options?: BasicOptions): Promise<{
|
|
29
|
+
data: Account;
|
|
30
|
+
}>;
|
|
31
|
+
getAccountForUsername(input: {
|
|
32
|
+
username: string;
|
|
33
|
+
avatarSize?: number;
|
|
34
|
+
}, options?: BasicOptions): Promise<{
|
|
35
|
+
data: Account;
|
|
36
|
+
}>;
|
|
37
|
+
getRepo(input: GetRepoInput, options?: BasicOptions): Promise<{
|
|
38
|
+
data: GitRepository;
|
|
39
|
+
}>;
|
|
40
|
+
getRepos(inputs: GetRepoInput[], options?: BasicOptions): Promise<{
|
|
41
|
+
data: GitRepository[];
|
|
42
|
+
}>;
|
|
43
|
+
private getRefs;
|
|
44
|
+
getBranches(input: {
|
|
45
|
+
repo: GetRepoInput;
|
|
46
|
+
} & CursorPageInput, options?: BasicOptions): Promise<{
|
|
47
|
+
pageInfo: {
|
|
48
|
+
endCursor: string | null;
|
|
49
|
+
hasNextPage: boolean;
|
|
50
|
+
};
|
|
51
|
+
data: {
|
|
52
|
+
name: string;
|
|
53
|
+
commit: {
|
|
54
|
+
oid: string;
|
|
55
|
+
authoredDate: Date;
|
|
56
|
+
committedDate: Date;
|
|
57
|
+
} | null;
|
|
58
|
+
}[];
|
|
59
|
+
}>;
|
|
60
|
+
getTags(input: {
|
|
61
|
+
repo: GetRepoInput;
|
|
62
|
+
} & CursorPageInput, options?: BasicOptions): Promise<{
|
|
63
|
+
pageInfo: {
|
|
64
|
+
endCursor: string | null;
|
|
65
|
+
hasNextPage: boolean;
|
|
66
|
+
};
|
|
67
|
+
data: {
|
|
68
|
+
name: string;
|
|
69
|
+
commit: {
|
|
70
|
+
oid: string;
|
|
71
|
+
authoredDate: Date;
|
|
72
|
+
committedDate: Date;
|
|
73
|
+
} | null;
|
|
74
|
+
}[];
|
|
75
|
+
}>;
|
|
76
|
+
getBlame(input: {
|
|
77
|
+
repo: GetRepoInput;
|
|
78
|
+
ref: string;
|
|
79
|
+
path: string;
|
|
80
|
+
}, options?: BasicOptions): Promise<{
|
|
81
|
+
data: {
|
|
82
|
+
ranges: {
|
|
83
|
+
startingLine: number;
|
|
84
|
+
endingLine: number;
|
|
85
|
+
commit: {
|
|
86
|
+
oid: string;
|
|
87
|
+
parentOids: string[];
|
|
88
|
+
authoredDate: Date;
|
|
89
|
+
author: {
|
|
90
|
+
name: string | null;
|
|
91
|
+
email: string | null;
|
|
92
|
+
avatarUrl: string;
|
|
93
|
+
} | null;
|
|
94
|
+
committedDate: Date;
|
|
95
|
+
committer: {
|
|
96
|
+
name: string | null;
|
|
97
|
+
email: string | null;
|
|
98
|
+
avatarUrl: string;
|
|
99
|
+
} | null;
|
|
100
|
+
message: string;
|
|
101
|
+
fileCount: number | null;
|
|
102
|
+
additions: number;
|
|
103
|
+
deletions: number;
|
|
104
|
+
};
|
|
105
|
+
}[];
|
|
106
|
+
};
|
|
107
|
+
}>;
|
|
108
|
+
getPullRequestsForRepos(input: FetchPullRequestsData & CursorPageInput, options?: BasicOptions): Promise<{
|
|
109
|
+
pageInfo: {
|
|
110
|
+
endCursor: string | null;
|
|
111
|
+
hasNextPage: boolean;
|
|
112
|
+
} | undefined;
|
|
113
|
+
data: GitPullRequest[];
|
|
114
|
+
}>;
|
|
115
|
+
getIssuesForRepos(input: FetchIssuesData & CursorPageInput, options?: BasicOptions): Promise<{
|
|
116
|
+
pageInfo: {
|
|
117
|
+
endCursor: string | null;
|
|
118
|
+
hasNextPage: boolean;
|
|
119
|
+
};
|
|
120
|
+
data: Issue[];
|
|
121
|
+
}>;
|
|
122
|
+
}
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
import { GraphQLBody, GraphQLResponse, ProviderConfig } from '../../types';
|
|
2
|
+
import { BasicOptions, CursorPageInput } from '../gitProvider';
|
|
3
|
+
import { FetchPullRequestsData, GraphQLPullRequest } from './githubTypes';
|
|
4
|
+
export declare const GITHUB_API_URL = "https://api.github.com";
|
|
5
|
+
export declare const GITHUB_GRAPHQL_API_URL: string;
|
|
6
|
+
export declare const makeGitHubGraphQLRequest: <T>(config: ProviderConfig, data: GraphQLBody, options: BasicOptions) => Promise<import("../../types").Response<GraphQLResponse<T>>>;
|
|
7
|
+
export declare const hasEmailScope: (scopes: string[]) => boolean;
|
|
8
|
+
export declare const getAccountFields: (withAvatarSizeVar?: boolean, includeEmail?: boolean) => string;
|
|
9
|
+
export declare const GithubSearchSyntaxQualifiers: Record<string, string>;
|
|
10
|
+
export declare const getProjectGithubSearchSyntax: (search: string) => string[];
|
|
11
|
+
export declare const fetchPullRequests: (config: ProviderConfig, input: FetchPullRequestsData & CursorPageInput, options: BasicOptions, shouldFetchDraft?: boolean, includeEmail?: boolean) => Promise<import("../../types").Response<GraphQLResponse<{
|
|
12
|
+
[key: string]: {
|
|
13
|
+
pageInfo: {
|
|
14
|
+
endCursor: string | null;
|
|
15
|
+
hasNextPage: boolean;
|
|
16
|
+
};
|
|
17
|
+
nodes?: GraphQLPullRequest[] | undefined;
|
|
18
|
+
};
|
|
19
|
+
}>>>;
|
|
@@ -0,0 +1,159 @@
|
|
|
1
|
+
import { GetRepoInput } from '../gitProvider';
|
|
2
|
+
export declare enum GraphQLViewerPermission {
|
|
3
|
+
ADMIN = "ADMIN",
|
|
4
|
+
MAINTAIN = "MAINTAIN",
|
|
5
|
+
READ = "READ",
|
|
6
|
+
TRIAGE = "TRIAGE",
|
|
7
|
+
WRITE = "WRITE"
|
|
8
|
+
}
|
|
9
|
+
export interface GraphQLRepository {
|
|
10
|
+
id: string;
|
|
11
|
+
databaseId: number;
|
|
12
|
+
owner: {
|
|
13
|
+
login: string;
|
|
14
|
+
};
|
|
15
|
+
name: string;
|
|
16
|
+
url: string;
|
|
17
|
+
sshUrl: string;
|
|
18
|
+
defaultBranchRef: {
|
|
19
|
+
name: string;
|
|
20
|
+
} | null;
|
|
21
|
+
viewerPermission: GraphQLViewerPermission;
|
|
22
|
+
}
|
|
23
|
+
export declare enum GitHubPullRequestReviewState {
|
|
24
|
+
Approved = "APPROVED",
|
|
25
|
+
ChangesRequested = "CHANGES_REQUESTED",
|
|
26
|
+
Commented = "COMMENTED",
|
|
27
|
+
ReviewRequested = "REVIEW_REQUESTED"
|
|
28
|
+
}
|
|
29
|
+
export interface GraphQLUser {
|
|
30
|
+
id: string;
|
|
31
|
+
databaseId: number;
|
|
32
|
+
name: string | null;
|
|
33
|
+
login: string;
|
|
34
|
+
email?: string;
|
|
35
|
+
avatarUrl: string;
|
|
36
|
+
}
|
|
37
|
+
export type PullRequestState = 'OPEN' | 'CLOSED' | 'MERGED';
|
|
38
|
+
export interface GraphQLPullRequest {
|
|
39
|
+
id: string;
|
|
40
|
+
databaseId: number;
|
|
41
|
+
title: string;
|
|
42
|
+
number: number;
|
|
43
|
+
state: PullRequestState;
|
|
44
|
+
comments: {
|
|
45
|
+
totalCount: number;
|
|
46
|
+
};
|
|
47
|
+
reactions: {
|
|
48
|
+
totalCount: number;
|
|
49
|
+
};
|
|
50
|
+
createdAt: string;
|
|
51
|
+
closedAt: string | null;
|
|
52
|
+
isDraft: boolean;
|
|
53
|
+
changedFiles: number;
|
|
54
|
+
additions: number;
|
|
55
|
+
deletions: number;
|
|
56
|
+
assignees: {
|
|
57
|
+
nodes: GraphQLUser[] | null;
|
|
58
|
+
};
|
|
59
|
+
author: GraphQLUser | Record<string, never> | null;
|
|
60
|
+
commits: {
|
|
61
|
+
nodes: {
|
|
62
|
+
commit: {
|
|
63
|
+
oid: string;
|
|
64
|
+
status?: {
|
|
65
|
+
contexts?: {
|
|
66
|
+
context: string;
|
|
67
|
+
state: string;
|
|
68
|
+
description: string;
|
|
69
|
+
targetUrl?: string | undefined;
|
|
70
|
+
}[];
|
|
71
|
+
};
|
|
72
|
+
};
|
|
73
|
+
}[] | null;
|
|
74
|
+
totalCount: number;
|
|
75
|
+
};
|
|
76
|
+
baseRef: {
|
|
77
|
+
name: string;
|
|
78
|
+
target: {
|
|
79
|
+
oid: string;
|
|
80
|
+
} | null;
|
|
81
|
+
} | null;
|
|
82
|
+
headRef: {
|
|
83
|
+
name: string;
|
|
84
|
+
target: {
|
|
85
|
+
oid: string;
|
|
86
|
+
} | null;
|
|
87
|
+
} | null;
|
|
88
|
+
headRepository: {
|
|
89
|
+
name: string;
|
|
90
|
+
owner: {
|
|
91
|
+
login: string;
|
|
92
|
+
};
|
|
93
|
+
sshUrl: string;
|
|
94
|
+
url: string;
|
|
95
|
+
};
|
|
96
|
+
repository: {
|
|
97
|
+
name: string;
|
|
98
|
+
owner: {
|
|
99
|
+
login: string;
|
|
100
|
+
};
|
|
101
|
+
};
|
|
102
|
+
reviewRequests: {
|
|
103
|
+
nodes: {
|
|
104
|
+
asCodeOwner: boolean;
|
|
105
|
+
requestedReviewer: GraphQLUser;
|
|
106
|
+
}[] | null;
|
|
107
|
+
} | null;
|
|
108
|
+
latestReviews: {
|
|
109
|
+
nodes: {
|
|
110
|
+
author: GraphQLUser;
|
|
111
|
+
state: GitHubPullRequestReviewState;
|
|
112
|
+
}[] | null;
|
|
113
|
+
} | null;
|
|
114
|
+
url: string;
|
|
115
|
+
updatedAt: string;
|
|
116
|
+
}
|
|
117
|
+
export interface GraphQLIssue {
|
|
118
|
+
id: string;
|
|
119
|
+
databaseId: number;
|
|
120
|
+
number: string;
|
|
121
|
+
title: string;
|
|
122
|
+
url: string;
|
|
123
|
+
repository: {
|
|
124
|
+
name: string;
|
|
125
|
+
owner: {
|
|
126
|
+
login: string;
|
|
127
|
+
};
|
|
128
|
+
};
|
|
129
|
+
assignees: {
|
|
130
|
+
nodes: GraphQLUser[] | null;
|
|
131
|
+
};
|
|
132
|
+
author: GraphQLUser | Record<string, never> | null;
|
|
133
|
+
createdAt: string;
|
|
134
|
+
updatedAt: string;
|
|
135
|
+
comments: {
|
|
136
|
+
totalCount: number;
|
|
137
|
+
};
|
|
138
|
+
reactions: {
|
|
139
|
+
totalCount: number;
|
|
140
|
+
};
|
|
141
|
+
}
|
|
142
|
+
export interface FetchPullRequestsData {
|
|
143
|
+
repos: GetRepoInput[];
|
|
144
|
+
assigneeLogins?: string[];
|
|
145
|
+
updatedBefore?: string;
|
|
146
|
+
isDraft?: boolean;
|
|
147
|
+
authorLogin?: string;
|
|
148
|
+
mentionLogin?: string;
|
|
149
|
+
reviewRequestedLogin?: string;
|
|
150
|
+
startQuery?: string;
|
|
151
|
+
}
|
|
152
|
+
export interface FetchIssuesData {
|
|
153
|
+
repos: GetRepoInput[];
|
|
154
|
+
assigneeLogins?: string[];
|
|
155
|
+
updatedBefore?: string;
|
|
156
|
+
authorLogin?: string;
|
|
157
|
+
mentionLogin?: string;
|
|
158
|
+
startQuery?: string;
|
|
159
|
+
}
|
|
@@ -0,0 +1,157 @@
|
|
|
1
|
+
import { Account, CursorPageInput, GetRepoInput, GitProvider, GitPullRequest, GitRepository, NumberedPageInput, SharedOptions } from '../gitProvider';
|
|
2
|
+
import { GetIssueInput, Issue, IssueProvider } from '../issueProvider';
|
|
3
|
+
import { Provider } from '../provider';
|
|
4
|
+
export type PullRequestState = 'opened' | 'merged' | 'closed';
|
|
5
|
+
export declare class GitLab extends Provider implements GitProvider, IssueProvider {
|
|
6
|
+
getCurrentUser(options?: SharedOptions): Promise<{
|
|
7
|
+
data: Account;
|
|
8
|
+
}>;
|
|
9
|
+
getUserForCommit(input: {
|
|
10
|
+
repo: GetRepoInput;
|
|
11
|
+
oid: string;
|
|
12
|
+
}, options?: SharedOptions): Promise<{
|
|
13
|
+
data: {
|
|
14
|
+
name: string | null;
|
|
15
|
+
email: string | null;
|
|
16
|
+
avatarUrl: string | null;
|
|
17
|
+
};
|
|
18
|
+
}>;
|
|
19
|
+
getAccountForEmail(input: {
|
|
20
|
+
email: string;
|
|
21
|
+
}, options?: SharedOptions): Promise<{
|
|
22
|
+
data: Account;
|
|
23
|
+
}>;
|
|
24
|
+
getAccountForUsername(input: {
|
|
25
|
+
username: string;
|
|
26
|
+
}, options?: SharedOptions): Promise<{
|
|
27
|
+
data: Account;
|
|
28
|
+
}>;
|
|
29
|
+
getRepo(input: GetRepoInput, options?: SharedOptions): Promise<{
|
|
30
|
+
data: GitRepository;
|
|
31
|
+
}>;
|
|
32
|
+
getRepos(inputs: GetRepoInput[], options?: SharedOptions): Promise<{
|
|
33
|
+
data: GitRepository[];
|
|
34
|
+
}>;
|
|
35
|
+
private getRefs;
|
|
36
|
+
getBranches(input: {
|
|
37
|
+
repo: GetRepoInput;
|
|
38
|
+
} & NumberedPageInput, options?: SharedOptions): Promise<{
|
|
39
|
+
pageInfo: {
|
|
40
|
+
hasNextPage: boolean;
|
|
41
|
+
nextPage: number | null;
|
|
42
|
+
};
|
|
43
|
+
data: {
|
|
44
|
+
name: string;
|
|
45
|
+
commit: {
|
|
46
|
+
oid: string;
|
|
47
|
+
authoredDate: Date;
|
|
48
|
+
committedDate: Date;
|
|
49
|
+
};
|
|
50
|
+
}[];
|
|
51
|
+
}>;
|
|
52
|
+
getTags(input: {
|
|
53
|
+
repo: GetRepoInput;
|
|
54
|
+
} & NumberedPageInput, options?: SharedOptions): Promise<{
|
|
55
|
+
pageInfo: {
|
|
56
|
+
hasNextPage: boolean;
|
|
57
|
+
nextPage: number | null;
|
|
58
|
+
};
|
|
59
|
+
data: {
|
|
60
|
+
name: string;
|
|
61
|
+
commit: {
|
|
62
|
+
oid: string;
|
|
63
|
+
authoredDate: Date;
|
|
64
|
+
committedDate: Date;
|
|
65
|
+
};
|
|
66
|
+
}[];
|
|
67
|
+
}>;
|
|
68
|
+
getBlame(input: {
|
|
69
|
+
repo: GetRepoInput;
|
|
70
|
+
ref: string;
|
|
71
|
+
path: string;
|
|
72
|
+
}, options?: SharedOptions): Promise<{
|
|
73
|
+
data: {
|
|
74
|
+
ranges: {
|
|
75
|
+
startingLine: number;
|
|
76
|
+
endingLine: number;
|
|
77
|
+
commit: {
|
|
78
|
+
oid: string;
|
|
79
|
+
parentOids: string[];
|
|
80
|
+
authoredDate: Date;
|
|
81
|
+
author: {
|
|
82
|
+
name: string;
|
|
83
|
+
email: string;
|
|
84
|
+
avatarUrl: null;
|
|
85
|
+
};
|
|
86
|
+
committedDate: Date;
|
|
87
|
+
committer: {
|
|
88
|
+
name: string;
|
|
89
|
+
email: string;
|
|
90
|
+
avatarUrl: null;
|
|
91
|
+
};
|
|
92
|
+
message: string;
|
|
93
|
+
fileCount: null;
|
|
94
|
+
additions: null;
|
|
95
|
+
deletions: null;
|
|
96
|
+
};
|
|
97
|
+
}[];
|
|
98
|
+
};
|
|
99
|
+
}>;
|
|
100
|
+
private getVariablesForPullRequests;
|
|
101
|
+
getPullRequestsForRepo(input: {
|
|
102
|
+
repo: GetRepoInput;
|
|
103
|
+
assigneeLogins?: string[];
|
|
104
|
+
updatedBefore?: string;
|
|
105
|
+
authorLogin?: string;
|
|
106
|
+
isDraft?: boolean;
|
|
107
|
+
reviewRequestedLogin?: string;
|
|
108
|
+
} & CursorPageInput, options?: SharedOptions): Promise<{
|
|
109
|
+
pageInfo: {
|
|
110
|
+
endCursor: string | null;
|
|
111
|
+
hasNextPage: boolean;
|
|
112
|
+
} | undefined;
|
|
113
|
+
data: GitPullRequest[];
|
|
114
|
+
}>;
|
|
115
|
+
getPullRequestsForRepos(input: {
|
|
116
|
+
repoIds: (string | number)[];
|
|
117
|
+
assigneeLogins?: string[];
|
|
118
|
+
updatedBefore?: string;
|
|
119
|
+
authorLogin?: string;
|
|
120
|
+
isDraft?: boolean;
|
|
121
|
+
reviewRequestedLogin?: string;
|
|
122
|
+
} & CursorPageInput, options?: SharedOptions): Promise<{
|
|
123
|
+
pageInfo: {
|
|
124
|
+
endCursor: string | null;
|
|
125
|
+
hasNextPage: boolean;
|
|
126
|
+
} | undefined;
|
|
127
|
+
data: GitPullRequest[];
|
|
128
|
+
}>;
|
|
129
|
+
getIssue(input: GetIssueInput, options?: SharedOptions): Promise<{
|
|
130
|
+
data: Issue;
|
|
131
|
+
}>;
|
|
132
|
+
private getVariablesForIssues;
|
|
133
|
+
getIssuesForRepo(input: {
|
|
134
|
+
repo: GetRepoInput;
|
|
135
|
+
assigneeLogins?: string[];
|
|
136
|
+
updatedBefore?: string;
|
|
137
|
+
authorLogin?: string;
|
|
138
|
+
} & CursorPageInput, options?: SharedOptions): Promise<{
|
|
139
|
+
pageInfo: {
|
|
140
|
+
endCursor: string | null;
|
|
141
|
+
hasNextPage: boolean;
|
|
142
|
+
} | undefined;
|
|
143
|
+
data: Issue[];
|
|
144
|
+
}>;
|
|
145
|
+
getIssuesForRepos(input: {
|
|
146
|
+
repoIds: (string | number)[];
|
|
147
|
+
assigneeLogins?: string[];
|
|
148
|
+
updatedBefore?: string;
|
|
149
|
+
authorLogin?: string;
|
|
150
|
+
} & CursorPageInput, options?: SharedOptions): Promise<{
|
|
151
|
+
pageInfo: {
|
|
152
|
+
endCursor: string | null;
|
|
153
|
+
hasNextPage: boolean;
|
|
154
|
+
} | undefined;
|
|
155
|
+
data: Issue[];
|
|
156
|
+
}>;
|
|
157
|
+
}
|
|
@@ -0,0 +1,4 @@
|
|
|
1
|
+
import { GraphQLBody, GraphQLResponse, ProviderConfig } from '../../types';
|
|
2
|
+
import { SharedOptions } from '../gitProvider';
|
|
3
|
+
export declare const GITLAB_GRAPHQL_API_URL = "https://gitlab.com/api/graphql";
|
|
4
|
+
export declare const makeGitLabGraphQLRequest: <T>(config: ProviderConfig, data: GraphQLBody, options: SharedOptions) => Promise<import("../../types").Response<GraphQLResponse<T>>>;
|
|
@@ -0,0 +1,33 @@
|
|
|
1
|
+
export interface RESTRef {
|
|
2
|
+
name: string;
|
|
3
|
+
commit: {
|
|
4
|
+
id: string;
|
|
5
|
+
short_id: string;
|
|
6
|
+
created_at: string;
|
|
7
|
+
parent_ids: string[];
|
|
8
|
+
title: string;
|
|
9
|
+
message: string;
|
|
10
|
+
author_name: string;
|
|
11
|
+
author_email: string;
|
|
12
|
+
authored_date: string;
|
|
13
|
+
committer_name: string;
|
|
14
|
+
committer_email: string;
|
|
15
|
+
committed_date: string;
|
|
16
|
+
trailers: unknown;
|
|
17
|
+
web_url: string;
|
|
18
|
+
};
|
|
19
|
+
protected: boolean;
|
|
20
|
+
}
|
|
21
|
+
export interface RESTBranch extends RESTRef {
|
|
22
|
+
merged: boolean;
|
|
23
|
+
developers_can_push: boolean;
|
|
24
|
+
developers_can_merge: boolean;
|
|
25
|
+
can_push: boolean;
|
|
26
|
+
default: boolean;
|
|
27
|
+
web_url: string;
|
|
28
|
+
}
|
|
29
|
+
export interface RESTTag extends RESTRef {
|
|
30
|
+
message: string;
|
|
31
|
+
target: string;
|
|
32
|
+
release: unknown;
|
|
33
|
+
}
|
|
@@ -0,0 +1,37 @@
|
|
|
1
|
+
import { Result } from '../types';
|
|
2
|
+
import { Account, GetReposInput, SharedOptions } from './gitProvider';
|
|
3
|
+
import { Provider } from './provider';
|
|
4
|
+
export interface GetIssueInput {
|
|
5
|
+
id: string;
|
|
6
|
+
name: string;
|
|
7
|
+
namespace: string;
|
|
8
|
+
project: string;
|
|
9
|
+
}
|
|
10
|
+
export type GetIssuesForReposInput = GetReposInput | {
|
|
11
|
+
repoIds: (string | number)[];
|
|
12
|
+
};
|
|
13
|
+
export interface Issue {
|
|
14
|
+
author: Account | null;
|
|
15
|
+
assignees: Account[];
|
|
16
|
+
commentCount: number | null;
|
|
17
|
+
createdDate: Date;
|
|
18
|
+
description: string | null;
|
|
19
|
+
graphQLId?: string;
|
|
20
|
+
id: string;
|
|
21
|
+
number: string;
|
|
22
|
+
repository: {
|
|
23
|
+
name: string;
|
|
24
|
+
owner: {
|
|
25
|
+
login?: string;
|
|
26
|
+
};
|
|
27
|
+
} | null;
|
|
28
|
+
state: string | null;
|
|
29
|
+
title: string;
|
|
30
|
+
updatedDate: Date | null;
|
|
31
|
+
upvoteCount: number | null;
|
|
32
|
+
url: string;
|
|
33
|
+
}
|
|
34
|
+
export declare abstract class IssueProvider extends Provider {
|
|
35
|
+
abstract getIssue(input: GetIssueInput, options: SharedOptions): Promise<Result<Issue>>;
|
|
36
|
+
abstract getIssuesForRepos(input: GetIssuesForReposInput, options: SharedOptions): Promise<Result<Issue[]>>;
|
|
37
|
+
}
|