@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.
@@ -0,0 +1,116 @@
1
+ import { BasicOptions, CursorPageInput, GetRepoInput, GitProvider, GitPullRequest, GitRepository, NumberedPageInput, SharedOptions } from '../gitProvider';
2
+ import { Issue } from '../issueProvider';
3
+ export interface AzureGetRepoInput extends GetRepoInput {
4
+ project: string;
5
+ }
6
+ export interface AzureGetReposInput {
7
+ namespace: string;
8
+ project: string;
9
+ }
10
+ export declare class AzureDevOps extends GitProvider {
11
+ /** Note: PATs are not supported for this function, only OAuth tokens are. */
12
+ getCurrentUser(options?: BasicOptions): Promise<{
13
+ data: {
14
+ id: string;
15
+ name: string;
16
+ username: string;
17
+ email: string;
18
+ avatarUrl: null;
19
+ };
20
+ }>;
21
+ getCurrentUserForInstance(input: {
22
+ namespace: string;
23
+ }, options?: SharedOptions): Promise<{
24
+ data: {
25
+ id: string;
26
+ name: string;
27
+ username: string;
28
+ email: string;
29
+ avatarUrl: null;
30
+ };
31
+ }>;
32
+ getUserForCommit(input: {
33
+ repo: GetRepoInput;
34
+ oid: string;
35
+ }, options?: SharedOptions): Promise<{
36
+ data: {
37
+ name: string;
38
+ email: string | null;
39
+ avatarUrl: string;
40
+ };
41
+ }>;
42
+ getRepo(input: AzureGetRepoInput, options?: SharedOptions): Promise<{
43
+ data: GitRepository;
44
+ }>;
45
+ getRepos(inputs: AzureGetRepoInput[], options?: SharedOptions): Promise<{
46
+ data: GitRepository[];
47
+ }>;
48
+ getReposForAzureProject(input: AzureGetReposInput, options?: SharedOptions): Promise<{
49
+ data: GitRepository[];
50
+ }>;
51
+ private getRefs;
52
+ getBranches(inputs: {
53
+ repo: GetRepoInput;
54
+ } & CursorPageInput, options?: SharedOptions): Promise<{
55
+ pageInfo: {
56
+ hasNextPage: boolean;
57
+ endCursor: string | null;
58
+ };
59
+ data: {
60
+ name: string;
61
+ commit: {
62
+ oid: string;
63
+ authoredDate: null;
64
+ committedDate: null;
65
+ };
66
+ }[];
67
+ }>;
68
+ getTags(inputs: {
69
+ repo: GetRepoInput;
70
+ } & CursorPageInput, options?: SharedOptions): Promise<{
71
+ pageInfo: {
72
+ hasNextPage: boolean;
73
+ endCursor: string | null;
74
+ };
75
+ data: {
76
+ name: string;
77
+ commit: {
78
+ oid: string;
79
+ authoredDate: null;
80
+ committedDate: null;
81
+ };
82
+ }[];
83
+ }>;
84
+ private getPullRequestsForRepoBase;
85
+ getPullRequestsForRepo(input: {
86
+ repo: GetRepoInput;
87
+ assigneeLogins?: string[];
88
+ authorLogin?: string;
89
+ } & NumberedPageInput, options?: BasicOptions): Promise<{
90
+ pageInfo: {
91
+ hasNextPage: boolean;
92
+ nextPage: number;
93
+ };
94
+ data: GitPullRequest[];
95
+ }>;
96
+ getPullRequestsForRepos(input: {
97
+ repos: GetRepoInput[];
98
+ assigneeLogins?: string[];
99
+ authorLogin?: string;
100
+ }, options?: BasicOptions): Promise<{
101
+ data: GitPullRequest[];
102
+ }>;
103
+ getIssuesForAzureProject(input: {
104
+ namespace: string;
105
+ project: string;
106
+ assigneeLogins?: string[];
107
+ authorLogin?: string;
108
+ mentionLogin?: string;
109
+ } & NumberedPageInput, options?: BasicOptions): Promise<{
110
+ pageInfo: {
111
+ hasNextPage: boolean;
112
+ nextPage: number;
113
+ };
114
+ data: Issue[];
115
+ }>;
116
+ }
@@ -0,0 +1,3 @@
1
+ import { ProviderConfig } from '../../types';
2
+ import { SharedOptions } from '../gitProvider';
3
+ export declare const getAzureRequestHeaders: (config: ProviderConfig, options?: SharedOptions) => Record<string, string>;
@@ -0,0 +1,198 @@
1
+ export interface AzurePagedResponse<T> {
2
+ count: number;
3
+ value: T[];
4
+ }
5
+ export declare enum AzurePullRequestReviewState {
6
+ Approved = 10,
7
+ ApprovedWithSuggestions = 5,
8
+ ReviewRequested = 0,
9
+ ChangesRequested = -5,
10
+ Rejected = -10
11
+ }
12
+ interface Link {
13
+ href: string;
14
+ }
15
+ interface RepositoryBase {
16
+ id: string;
17
+ name: string;
18
+ url: string;
19
+ }
20
+ export interface Repository extends RepositoryBase {
21
+ project: {
22
+ id: string;
23
+ name: string;
24
+ url: string;
25
+ state: string;
26
+ revision: number;
27
+ visibility: string;
28
+ lastUpdateTime: string;
29
+ };
30
+ defaultBranch?: string;
31
+ size: number;
32
+ remoteUrl: string;
33
+ sshUrl: string;
34
+ webUrl: string;
35
+ _links: {
36
+ self: Link;
37
+ project: Link;
38
+ web: Link;
39
+ ssh: Link;
40
+ commits: Link;
41
+ refs: Link;
42
+ pullRequests: Link;
43
+ items: Link;
44
+ pushes: Link;
45
+ };
46
+ isDisabled: boolean;
47
+ isInMaintenance: boolean;
48
+ }
49
+ interface ProjectBase {
50
+ id: string;
51
+ name: string;
52
+ state: string;
53
+ visibility: string;
54
+ lastUpdateTime: string;
55
+ }
56
+ export interface AzureUser {
57
+ displayName: string;
58
+ url: string;
59
+ _links: {
60
+ avatar: Link;
61
+ };
62
+ id: string;
63
+ uniqueName: string | null;
64
+ imageUrl: string | null;
65
+ }
66
+ interface CreatedBy extends AzureUser {
67
+ descriptor: string;
68
+ }
69
+ interface CommitBase {
70
+ commitId: string;
71
+ url: string;
72
+ }
73
+ export interface Ref {
74
+ name: string;
75
+ objectId: string;
76
+ creator: CreatedBy;
77
+ url: string;
78
+ }
79
+ interface Label {
80
+ id: string;
81
+ name: string;
82
+ active: boolean;
83
+ }
84
+ export interface AzureReviewer extends AzureUser {
85
+ reviewerUrl: string;
86
+ vote: AzurePullRequestReviewState;
87
+ hasDeclined: boolean;
88
+ isFlagged: boolean;
89
+ }
90
+ interface CompletionOptions {
91
+ mergeCommitMessage: string;
92
+ deleteSourceBranch: boolean;
93
+ mergeStrategy: string;
94
+ transitionWorkItems: boolean;
95
+ autoCompleteIgnoreConfigIds: unknown[];
96
+ }
97
+ export type PullRequestState = 'active' | 'completed' | 'abandoned';
98
+ export interface AzurePullRequest {
99
+ repository: RepositoryBase & {
100
+ project: ProjectBase;
101
+ };
102
+ pullRequestId: number;
103
+ codeReviewId: number;
104
+ status: PullRequestState;
105
+ createdBy: CreatedBy;
106
+ creationDate: string;
107
+ closedDate?: string;
108
+ title: string;
109
+ description?: string;
110
+ sourceRefName: string;
111
+ targetRefName: string;
112
+ mergeStatus: string;
113
+ isDraft: boolean;
114
+ mergeId: string;
115
+ lastMergeSourceCommit: CommitBase;
116
+ lastMergeTargetCommit: CommitBase;
117
+ lastMergeCommit: CommitBase;
118
+ reviewers: AzureReviewer[];
119
+ labels?: Label[];
120
+ url: string;
121
+ completionOptions: CompletionOptions;
122
+ supportsIterations: boolean;
123
+ }
124
+ interface Link {
125
+ href: string;
126
+ }
127
+ interface Identity {
128
+ descriptor: string;
129
+ displayName: string;
130
+ id: string;
131
+ imageUrl: string;
132
+ uniqueName: string;
133
+ url: string;
134
+ _links: {
135
+ avatar: Link;
136
+ };
137
+ }
138
+ interface WIQLColumnOrField {
139
+ referenceName: string;
140
+ name: string;
141
+ url: string;
142
+ }
143
+ export interface WIQL {
144
+ queryType: string;
145
+ queryResultType: string;
146
+ asOf: string;
147
+ columns: WIQLColumnOrField[];
148
+ sortColumns: {
149
+ field: WIQLColumnOrField;
150
+ descending: boolean;
151
+ }[];
152
+ workItems: {
153
+ id: number;
154
+ url: string;
155
+ }[];
156
+ }
157
+ export interface AzureIssue {
158
+ id: number;
159
+ rev: number;
160
+ fields: {
161
+ 'System.AreaPath': string;
162
+ 'System.AssignedTo'?: Identity;
163
+ 'System.TeamProject': string;
164
+ 'System.IterationPath': string;
165
+ 'System.WorkItemType': string;
166
+ 'System.State': string;
167
+ 'System.Reason': string;
168
+ 'System.CreatedDate': string;
169
+ 'System.CreatedBy': Identity;
170
+ 'System.ChangedDate': string;
171
+ 'System.ChangedBy': Identity;
172
+ 'System.CommentCount': number;
173
+ 'System.Title': string;
174
+ 'System.BoardColumn': string;
175
+ 'System.BoardColumnDone': boolean;
176
+ 'System.Tags'?: string;
177
+ 'Microsoft.VSTS.Common.StateChangeDate': string;
178
+ 'Microsoft.VSTS.Common.ClosedDate'?: string;
179
+ 'Microsoft.VSTS.Common.ClosedBy'?: Identity;
180
+ 'Microsoft.VSTS.Common.ResolvedDate'?: string;
181
+ 'Microsoft.VSTS.Common.ResolvedBy'?: Identity;
182
+ 'Microsoft.VSTS.Common.ActivatedDate'?: string;
183
+ 'Microsoft.VSTS.Common.ActivatedBy'?: Identity;
184
+ 'Microsoft.VSTS.Common.Priority': number;
185
+ 'System.Description'?: string;
186
+ };
187
+ _links: {
188
+ self: Link;
189
+ workItemUpdates: Link;
190
+ workItemRevisions: Link;
191
+ workItemComments: Link;
192
+ html: Link;
193
+ workItemType: Link;
194
+ fields: Link;
195
+ };
196
+ url: string;
197
+ }
198
+ export {};
@@ -0,0 +1,107 @@
1
+ import { Account, BasicOptions, CursorPageInput, GetRepoInput, GitProvider, GitPullRequest, NumberedPageInput, SharedOptions } from '../gitProvider';
2
+ export interface RefreshTokenResponse {
3
+ access_token: string;
4
+ scopes: string;
5
+ token_type: string;
6
+ expires_in: number;
7
+ state: string;
8
+ refresh_token: string;
9
+ }
10
+ export declare class Bitbucket extends GitProvider {
11
+ refreshToken(data: {
12
+ refreshToken: string;
13
+ base64ClientIDColonClientSecret: string;
14
+ }): Promise<{
15
+ data: RefreshTokenResponse;
16
+ }>;
17
+ getCurrentUser(options?: SharedOptions): Promise<{
18
+ data: Account;
19
+ }>;
20
+ getUserForCommit(input: {
21
+ repo: GetRepoInput;
22
+ oid: string;
23
+ }, options?: SharedOptions): Promise<{
24
+ data: {
25
+ name: string | null;
26
+ email: string | null;
27
+ avatarUrl: string | null;
28
+ };
29
+ }>;
30
+ getRepo(inputs: GetRepoInput, options?: SharedOptions): Promise<{
31
+ data: {
32
+ id: string;
33
+ namespace: string;
34
+ name: string;
35
+ webUrl: string;
36
+ httpsUrl: string | null;
37
+ sshUrl: string | null;
38
+ defaultBranch: {
39
+ name: string;
40
+ };
41
+ permission: null;
42
+ };
43
+ }>;
44
+ getRepos(inputs: GetRepoInput[], options?: SharedOptions): Promise<{
45
+ data: {
46
+ id: string;
47
+ namespace: string;
48
+ name: string;
49
+ webUrl: string;
50
+ httpsUrl: string | null;
51
+ sshUrl: string | null;
52
+ defaultBranch: {
53
+ name: string;
54
+ };
55
+ permission: null;
56
+ }[];
57
+ }>;
58
+ getBranches(input: {
59
+ repo: GetRepoInput;
60
+ } & NumberedPageInput, options?: SharedOptions): Promise<{
61
+ pageInfo: {
62
+ hasNextPage: boolean;
63
+ nextPage: number | null;
64
+ };
65
+ data: {
66
+ name: string;
67
+ commit: {
68
+ oid: string;
69
+ authoredDate: Date;
70
+ committedDate: Date;
71
+ };
72
+ }[];
73
+ }>;
74
+ getTags(input: {
75
+ repo: GetRepoInput;
76
+ } & CursorPageInput, options?: SharedOptions): Promise<{
77
+ pageInfo: {
78
+ hasNextPage: boolean;
79
+ endCursor: string | null;
80
+ };
81
+ data: {
82
+ name: string;
83
+ commit: {
84
+ oid: string;
85
+ authoredDate: Date;
86
+ committedDate: Date;
87
+ };
88
+ }[];
89
+ }>;
90
+ private getPullRequestsForRepoBase;
91
+ getPullRequestsForRepo(input: {
92
+ repo: GetRepoInput;
93
+ authorLogin?: string;
94
+ } & NumberedPageInput, options?: BasicOptions): Promise<{
95
+ pageInfo: {
96
+ hasNextPage: boolean;
97
+ nextPage: number | null;
98
+ };
99
+ data: GitPullRequest[];
100
+ }>;
101
+ getPullRequestsForRepos(input: {
102
+ repos: GetRepoInput[];
103
+ authorLogin?: string;
104
+ }, options?: BasicOptions): Promise<{
105
+ data: GitPullRequest[];
106
+ }>;
107
+ }
@@ -0,0 +1,3 @@
1
+ import { ProviderConfig } from '../../types';
2
+ import { SharedOptions } from '../gitProvider';
3
+ export declare const getBitbucketRequestHeaders: (config: ProviderConfig, options?: SharedOptions) => Record<string, string>;
@@ -0,0 +1,181 @@
1
+ export interface BitbucketPagedResponse<T> {
2
+ pagelen: number;
3
+ size: number;
4
+ values: T[];
5
+ page: number;
6
+ next?: string;
7
+ previous?: string;
8
+ }
9
+ interface Link {
10
+ href: string;
11
+ }
12
+ interface NamedLink<T extends string = string> extends Link {
13
+ name: T;
14
+ }
15
+ interface CommonLinks {
16
+ self: Link;
17
+ html: Link;
18
+ }
19
+ interface CommitStub {
20
+ type: 'commit';
21
+ hash: string;
22
+ links: CommonLinks;
23
+ }
24
+ interface AuthorStub {
25
+ type: 'author';
26
+ raw: string;
27
+ user?: UserStub;
28
+ }
29
+ export interface Commit extends CommitStub {
30
+ date: string;
31
+ author: AuthorStub;
32
+ message: string;
33
+ links: CommonLinks & {
34
+ diff: Link;
35
+ approve: Link;
36
+ comments: Link;
37
+ statuses: Link;
38
+ patch: Link;
39
+ };
40
+ parents: CommitStub[];
41
+ repository: RepositoryStub;
42
+ }
43
+ export interface Ref {
44
+ name: string;
45
+ target: Commit;
46
+ links: CommonLinks & {
47
+ commits: Link;
48
+ };
49
+ }
50
+ export interface Branch extends Ref {
51
+ type: 'branch';
52
+ merge_strategies: string[];
53
+ default_merge_strategy: string;
54
+ }
55
+ export interface Tag extends Ref {
56
+ type: 'tag';
57
+ message: unknown;
58
+ date: unknown;
59
+ tagger: unknown;
60
+ target: Commit & {
61
+ author: AuthorStub & {
62
+ user: UserStub;
63
+ };
64
+ };
65
+ }
66
+ interface RepositoryStub {
67
+ links: CommonLinks & {
68
+ avatar: Link;
69
+ };
70
+ type: 'repository';
71
+ name: string;
72
+ full_name: string;
73
+ uuid: string;
74
+ }
75
+ export interface Repository extends RepositoryStub {
76
+ links: CommonLinks & {
77
+ avatar: Link;
78
+ pullrequests: Link;
79
+ commits: Link;
80
+ forks: Link;
81
+ watchers: Link;
82
+ branches: Link;
83
+ tags: Link;
84
+ downloads: Link;
85
+ source: Link;
86
+ clone: [NamedLink<'https'>, NamedLink<'ssh'>];
87
+ hooks: Link;
88
+ };
89
+ slug: string;
90
+ description: string;
91
+ scm: string;
92
+ website: string | null;
93
+ owner: unknown;
94
+ workspace: {
95
+ type: 'workspace';
96
+ uuid: string;
97
+ name: string;
98
+ slug: string;
99
+ links: CommonLinks & {
100
+ avatar: Link;
101
+ };
102
+ };
103
+ is_private: boolean;
104
+ project: unknown;
105
+ fork_policy: string;
106
+ created_on: string;
107
+ updated_on: string;
108
+ size: number;
109
+ language: string;
110
+ has_issues: boolean;
111
+ has_wiki: boolean;
112
+ mainbranch: {
113
+ type: 'branch';
114
+ name: string;
115
+ };
116
+ override_settings: unknown;
117
+ }
118
+ interface DestinationSource {
119
+ commit: CommitStub;
120
+ repository: RepositoryStub;
121
+ branch: {
122
+ name: string;
123
+ };
124
+ }
125
+ interface Summary {
126
+ raw: string;
127
+ markup: string;
128
+ html: string;
129
+ type: string;
130
+ }
131
+ interface PullRequestLinks extends CommonLinks {
132
+ decline: Link;
133
+ diffstat: Link;
134
+ commits: Link;
135
+ comments: Link;
136
+ merge: Link;
137
+ activity: Link;
138
+ diff: Link;
139
+ approve: Link;
140
+ 'request-changes': Link;
141
+ statuses: Link;
142
+ }
143
+ export interface UserStub {
144
+ display_name: string;
145
+ uuid: string;
146
+ links: CommonLinks & {
147
+ avatar: Link;
148
+ };
149
+ nickname: string;
150
+ type: 'user';
151
+ account_id: string;
152
+ }
153
+ export interface User extends UserStub {
154
+ created_on: string;
155
+ has_2fa_enabled: boolean | null;
156
+ is_staff: boolean;
157
+ account_status: string;
158
+ location: string | null;
159
+ }
160
+ export type PullRequestState = 'OPEN' | 'MERGED' | 'DECLINED';
161
+ export interface BitbucketPullRequest {
162
+ description: string;
163
+ links: PullRequestLinks;
164
+ title: string;
165
+ close_source_branch: boolean;
166
+ type: 'pullrequest';
167
+ id: number;
168
+ destination: DestinationSource;
169
+ created_on: string;
170
+ summary: Summary;
171
+ source: DestinationSource;
172
+ comment_count: number;
173
+ state: PullRequestState;
174
+ task_count: number;
175
+ reason: string;
176
+ updated_on: string;
177
+ author: UserStub;
178
+ merge_commit: CommitStub | null;
179
+ closed_by: UserStub | null;
180
+ }
181
+ export {};