@gitkraken/provider-apis 0.9.0 → 0.11.0

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.
@@ -1 +1,2 @@
1
- export declare const getIssueUniqueId: (resourceId: string, projectId: string, issueId: string, domain?: string) => string;
1
+ export declare const getIssueUniqueId: (resourceId: string, projectId: string, issueId: string) => string;
2
+ export declare const getJiraServerIssueUniqueId: (projectId: string, issueId: string, domain: string) => string;
@@ -1,7 +1,8 @@
1
1
  import { PagedResult, Result } from '../../types';
2
- import { CursorPageInput, EnterpriseOptions, GetRepoInput, GitProvider, GitPullRequest, GitRepository, NumberedPageInput, Options } from '../gitProvider';
2
+ import { CursorPageInput, EnterpriseOptions, GetRepoErrorData, GetRepoInput, GitProvider, GitPullRequest, GitRepository, NumberedPageInput, Options } from '../gitProvider';
3
3
  import { Issue } from '../issueProvider';
4
4
  import { Provider } from '../provider';
5
+ import { WorkItemType } from './azureDevOpsTypes';
5
6
  export interface AzureGetRepoInput extends GetRepoInput {
6
7
  project: string;
7
8
  }
@@ -18,6 +19,13 @@ export interface AzureOrganization {
18
19
  id: string;
19
20
  name: string;
20
21
  }
22
+ export type StatusByWorkItemIdByStatusId = {
23
+ [workItemType: string]: {
24
+ [statusId: string]: {
25
+ title: string;
26
+ };
27
+ };
28
+ };
21
29
  export declare class AzureDevOps extends Provider implements GitProvider {
22
30
  /** Note: PATs are not supported for this function, only OAuth tokens are. */
23
31
  getCurrentUser(options?: EnterpriseOptions): Promise<{
@@ -61,6 +69,7 @@ export declare class AzureDevOps extends Provider implements GitProvider {
61
69
  }>;
62
70
  getRepos(inputs: AzureGetRepoInput[], options?: Options): Promise<{
63
71
  data: GitRepository[];
72
+ errors: GetRepoErrorData[];
64
73
  }>;
65
74
  getReposForAzureProject(input: AzureGetReposInput, options?: Options): Promise<{
66
75
  data: GitRepository[];
@@ -117,12 +126,28 @@ export declare class AzureDevOps extends Provider implements GitProvider {
117
126
  }, options?: EnterpriseOptions): Promise<{
118
127
  data: GitPullRequest[];
119
128
  }>;
129
+ private updatePullRequest;
130
+ closePullRequest(input: {
131
+ repo: GetRepoInput;
132
+ pullRequestId: string;
133
+ }, options?: EnterpriseOptions): Promise<void>;
134
+ mergePullRequest(input: {
135
+ repo: GetRepoInput;
136
+ pullRequestId: string;
137
+ expectedSourceSha: string;
138
+ }, options?: EnterpriseOptions): Promise<void>;
139
+ setPullRequestAsDraft(input: {
140
+ repo: GetRepoInput;
141
+ pullRequestId: string;
142
+ isDraft: boolean;
143
+ }, options?: EnterpriseOptions): Promise<void>;
120
144
  getIssuesForAzureProject(input: {
121
145
  namespace: string;
122
146
  project: string;
123
147
  assigneeLogins?: string[];
124
148
  authorLogin?: string;
125
149
  mentionLogin?: string;
150
+ statusByWorkItemIdByStatusId?: StatusByWorkItemIdByStatusId;
126
151
  } & NumberedPageInput, options?: EnterpriseOptions): Promise<{
127
152
  pageInfo: {
128
153
  hasNextPage: boolean;
@@ -136,4 +161,27 @@ export declare class AzureDevOps extends Provider implements GitProvider {
136
161
  };
137
162
  data: Issue[];
138
163
  }>;
164
+ setIssueStatus(input: {
165
+ namespace: string;
166
+ project: string;
167
+ issueId: string;
168
+ status: string;
169
+ }, options?: EnterpriseOptions): Promise<void>;
170
+ getIssueTypesForAzureProject(input: {
171
+ namespace: string;
172
+ project: string;
173
+ }, options?: EnterpriseOptions): Promise<{
174
+ data: WorkItemType[];
175
+ }>;
176
+ getLabelsForProject(input: {
177
+ namespace: string;
178
+ project: string;
179
+ }, options?: EnterpriseOptions): Promise<{
180
+ data: {
181
+ color: null;
182
+ description: null;
183
+ id: string;
184
+ name: string;
185
+ }[];
186
+ }>;
139
187
  }
@@ -72,6 +72,12 @@ export interface Ref {
72
72
  creator: CreatedBy;
73
73
  url: string;
74
74
  }
75
+ export interface WorkItemTagDefinition {
76
+ id: string;
77
+ lastUpdated: string;
78
+ name: string;
79
+ url: string;
80
+ }
75
81
  interface Label {
76
82
  id: string;
77
83
  name: string;
@@ -191,4 +197,34 @@ export interface AzureIssue {
191
197
  };
192
198
  url: string;
193
199
  }
200
+ export interface WorkItemTypeField {
201
+ helpText: string;
202
+ alwaysRequired: boolean;
203
+ referenceName: string;
204
+ name: string;
205
+ url: string;
206
+ }
207
+ export interface WorkItemTypeTransition {
208
+ to: string;
209
+ actions: string[] | null;
210
+ }
211
+ export interface WorkItemType {
212
+ name: string;
213
+ referenceName: string;
214
+ description: string;
215
+ color: string;
216
+ icon: {
217
+ id: string;
218
+ url: string;
219
+ };
220
+ isDisabled: boolean;
221
+ xmlForm: string;
222
+ fields: WorkItemTypeField[];
223
+ fieldInstances: WorkItemTypeField[];
224
+ transitions: [string: WorkItemTypeTransition];
225
+ url: string;
226
+ }
227
+ export interface UpdatePullRequestResponse {
228
+ status: string;
229
+ }
194
230
  export {};
@@ -1,4 +1,4 @@
1
- import { Account, CursorPageInput, GetRepoInput, GitProvider, GitPullRequest, GitRepository, NumberedPageInput, Options } from '../gitProvider';
1
+ import { Account, CursorPageInput, GetRepoErrorData, GetRepoInput, GitProvider, GitPullRequest, GitRepository, NumberedPageInput, Options } from '../gitProvider';
2
2
  import { Provider } from '../provider';
3
3
  export interface RefreshTokenResponse {
4
4
  access_token: string;
@@ -33,6 +33,7 @@ export declare class Bitbucket extends Provider implements GitProvider {
33
33
  }>;
34
34
  getRepos(inputs: GetRepoInput[], options?: Options): Promise<{
35
35
  data: GitRepository[];
36
+ errors: GetRepoErrorData[];
36
37
  }>;
37
38
  getReposForCurrentUser(inputs?: CursorPageInput, options?: Options): Promise<{
38
39
  pageInfo: {
@@ -90,4 +91,13 @@ export declare class Bitbucket extends Provider implements GitProvider {
90
91
  }, options?: Options): Promise<{
91
92
  data: GitPullRequest[];
92
93
  }>;
94
+ closePullRequest(input: {
95
+ repo: GetRepoInput;
96
+ pullRequestId: string;
97
+ }, options?: Options): Promise<void>;
98
+ mergePullRequest(input: {
99
+ repo: GetRepoInput;
100
+ pullRequestId: string;
101
+ expectedSourceSha: string;
102
+ }, options?: Options): Promise<void>;
93
103
  }
@@ -1,4 +1,4 @@
1
- import { EnterpriseOptions, GetRepoInput, GitProvider } from '../gitProvider';
1
+ import { EnterpriseOptions, GetRepoErrorData, GetRepoInput, GitProvider, GitRepository } from '../gitProvider';
2
2
  import { EnterpriseProvider } from '../provider';
3
3
  export declare class BitbucketServer extends EnterpriseProvider implements GitProvider {
4
4
  private getBaseUrl;
@@ -16,15 +16,7 @@ export declare class BitbucketServer extends EnterpriseProvider implements GitPr
16
16
  };
17
17
  }>;
18
18
  getRepos(inputs: GetRepoInput[], options?: EnterpriseOptions): Promise<{
19
- data: {
20
- id: string;
21
- namespace: string;
22
- name: string;
23
- webUrl: string;
24
- httpsUrl: string | null;
25
- sshUrl: string | null;
26
- defaultBranch: null;
27
- permission: null;
28
- }[];
19
+ data: GitRepository[];
20
+ errors: GetRepoErrorData[];
29
21
  }>;
30
22
  }
@@ -24,6 +24,24 @@ export interface Organization {
24
24
  email: string | null;
25
25
  avatarUrl: string;
26
26
  }
27
+ export interface GitLabel {
28
+ color: string | null;
29
+ description: string | null;
30
+ graphQLId?: string;
31
+ id: string | null;
32
+ name: string;
33
+ }
34
+ export interface GitMilestone {
35
+ id: string;
36
+ graphQLId?: string;
37
+ number: number;
38
+ title: string;
39
+ description: string | null;
40
+ isOpen: boolean;
41
+ url: string;
42
+ startDate: Date | null;
43
+ dueDate: Date | null;
44
+ }
27
45
  export interface GitRepository {
28
46
  id: string;
29
47
  graphQLId?: string;
@@ -128,6 +146,8 @@ export interface GitPullRequest {
128
146
  } | null;
129
147
  } | null;
130
148
  mergeableState: GitPullRequestMergeableState;
149
+ milestone?: GitMilestone | null;
150
+ labels?: GitLabel[];
131
151
  }
132
152
  export interface GetRepoInput {
133
153
  namespace: string;
@@ -147,6 +167,10 @@ export interface NumberedPageInput {
147
167
  page?: number | null;
148
168
  }
149
169
  export type PageInput = CursorPageInput | NumberedPageInput;
170
+ export interface GetRepoErrorData {
171
+ input: GetRepoInput;
172
+ error?: Error;
173
+ }
150
174
  export interface GitProvider {
151
175
  getCurrentUser?(options: Options): Promise<Result<Account>>;
152
176
  getUserForCommit?(input: {
@@ -160,7 +184,9 @@ export interface GitProvider {
160
184
  username: string;
161
185
  }, options: Options): Promise<Result<Account>>;
162
186
  getRepo(input: GetRepoInput, options: Options): Promise<Result<GitRepository>>;
163
- getRepos(inputs: GetRepoInput[], options: Options): Promise<Result<GitRepository[]>>;
187
+ getRepos(inputs: GetRepoInput[], options: Options): Promise<Result<GitRepository[]> & {
188
+ errors?: GetRepoErrorData[];
189
+ }>;
164
190
  getReposForCurrentUser?(inputs: CursorPageInput, options: Options): Promise<PagedResult<GitRepository>>;
165
191
  getBranches?(input: {
166
192
  repo: GetRepoInput;
@@ -1,5 +1,4 @@
1
- import { PagedResult } from '../../types';
2
- import { Account, CursorPageInput, EnterpriseOptions, GetRepoInput, GitProvider, GitPullRequest, GitRepository, Organization } from '../gitProvider';
1
+ import { Account, CursorPageInput, EnterpriseOptions, GetRepoErrorData, GetRepoInput, GitLabel, GitMilestone, GitProvider, GitPullRequest, GitRepository, Organization } from '../gitProvider';
3
2
  import { Issue } from '../issueProvider';
4
3
  import { EnterpriseProvider } from '../provider';
5
4
  import { FetchIssuesData, FetchPullRequestsData } from './githubTypes';
@@ -36,12 +35,26 @@ export declare class GitHub extends EnterpriseProvider implements GitProvider {
36
35
  }, options?: EnterpriseOptions): Promise<{
37
36
  data: Account;
38
37
  }>;
39
- getOrgsForCurrentUser(input?: CursorPageInput, options?: EnterpriseOptions): Promise<PagedResult<Organization>>;
38
+ getOrgsForCurrentUser(input?: CursorPageInput, options?: EnterpriseOptions): Promise<{
39
+ pageInfo: {
40
+ endCursor: string | null;
41
+ hasNextPage: boolean;
42
+ };
43
+ data: {
44
+ id: string;
45
+ graphQLId: string;
46
+ username: string;
47
+ name: string | null;
48
+ email: string | null;
49
+ avatarUrl: string;
50
+ }[];
51
+ }>;
40
52
  getRepo(input: GetRepoInput, options?: EnterpriseOptions): Promise<{
41
53
  data: GitRepository;
42
54
  }>;
43
55
  getRepos(inputs: GetRepoInput[], options?: EnterpriseOptions): Promise<{
44
56
  data: GitRepository[];
57
+ errors: GetRepoErrorData[];
45
58
  }>;
46
59
  getReposForUsernames(input: {
47
60
  usernames: string[];
@@ -126,18 +139,108 @@ export declare class GitHub extends EnterpriseProvider implements GitProvider {
126
139
  }[];
127
140
  };
128
141
  }>;
129
- getPullRequestsForRepos(input: FetchPullRequestsData & CursorPageInput, options?: EnterpriseOptions): Promise<{
142
+ searchPullRequests(input: {
143
+ query: string;
144
+ isDraft?: boolean;
145
+ } & CursorPageInput, options?: EnterpriseOptions): Promise<{
130
146
  pageInfo: {
147
+ hasNextPage: boolean;
131
148
  endCursor: string | null;
149
+ };
150
+ data: GitPullRequest[];
151
+ }>;
152
+ searchIssues(input: {
153
+ query: string;
154
+ } & CursorPageInput, options?: EnterpriseOptions): Promise<{
155
+ pageInfo: {
132
156
  hasNextPage: boolean;
133
- } | undefined;
157
+ endCursor: string | null;
158
+ };
159
+ data: Issue[];
160
+ }>;
161
+ /**
162
+ * Returns pull requests that were created by, are assigned to, or have been requested to be reviewed by the user.
163
+ */
164
+ getPullRequestsAssociatedWithUser(input: {
165
+ username: string;
166
+ } & CursorPageInput, options?: EnterpriseOptions): Promise<{
167
+ pageInfo: {
168
+ hasNextPage: boolean;
169
+ endCursor: string;
170
+ };
134
171
  data: GitPullRequest[];
135
172
  }>;
136
- getIssuesForRepos(input: FetchIssuesData & CursorPageInput, options?: EnterpriseOptions): Promise<{
173
+ getPullRequestsForRepos(input: FetchPullRequestsData & CursorPageInput, options?: EnterpriseOptions): Promise<{
137
174
  pageInfo: {
175
+ hasNextPage: boolean;
138
176
  endCursor: string | null;
177
+ };
178
+ data: GitPullRequest[];
179
+ }>;
180
+ closePullRequest(input: {
181
+ pullRequestGraphQLId: string;
182
+ }, options?: EnterpriseOptions): Promise<void>;
183
+ mergePullRequest(input: {
184
+ pullRequestGraphQLId: string;
185
+ expectedSourceSha: string;
186
+ }, options?: EnterpriseOptions): Promise<void>;
187
+ setPullRequestMilestone(input: {
188
+ pullRequestGraphQLId: string;
189
+ milestoneGraphQLId: string | null;
190
+ }, options?: EnterpriseOptions): Promise<void>;
191
+ private markPullRequestReadyForReview;
192
+ private convertPullRequestToDraft;
193
+ setPullRequestAsDraft(input: {
194
+ pullRequestGraphQLId: string;
195
+ isDraft: boolean;
196
+ }, options?: EnterpriseOptions): Promise<void>;
197
+ /**
198
+ * Returns issues that were created by or are assigned to the user.
199
+ */
200
+ getIssuesAssociatedWithUser(input: {
201
+ username: string;
202
+ } & CursorPageInput, options?: EnterpriseOptions): Promise<{
203
+ pageInfo: {
204
+ hasNextPage: boolean;
205
+ endCursor: string;
206
+ };
207
+ data: Issue[];
208
+ }>;
209
+ getIssuesForRepos(input: FetchIssuesData & CursorPageInput, options?: EnterpriseOptions): Promise<{
210
+ pageInfo: {
139
211
  hasNextPage: boolean;
212
+ endCursor: string | null;
140
213
  };
141
214
  data: Issue[];
142
215
  }>;
216
+ private closeIssueWithReason;
217
+ private closeIssueWithoutReason;
218
+ private reopenIssue;
219
+ setIssueStatus(input: {
220
+ issueGraphQLId: string;
221
+ status: 'OPEN' | 'CLOSED';
222
+ closeReason?: 'COMPLETED' | 'NOT_PLANNED';
223
+ }, options?: EnterpriseOptions): Promise<void>;
224
+ setIssueMilestone(input: {
225
+ issueGraphQLId: string;
226
+ milestoneGraphQLId: string | null;
227
+ }, options?: EnterpriseOptions): Promise<void>;
228
+ getMilestonesForRepo(input: {
229
+ repo: GetRepoInput;
230
+ } & CursorPageInput, options?: EnterpriseOptions): Promise<{
231
+ pageInfo: {
232
+ endCursor: string | null;
233
+ hasNextPage: boolean;
234
+ };
235
+ data: GitMilestone[];
236
+ }>;
237
+ getLabelsForRepo(input: {
238
+ repo: GetRepoInput;
239
+ } & CursorPageInput, options?: EnterpriseOptions): Promise<{
240
+ pageInfo: {
241
+ endCursor: string | null;
242
+ hasNextPage: boolean;
243
+ };
244
+ data: GitLabel[];
245
+ }>;
143
246
  }
@@ -1,21 +1,17 @@
1
- import { GraphQLBody, GraphQLResponse, ProviderConfig } from '../../types';
2
- import { CursorPageInput, EnterpriseOptions } from '../gitProvider';
3
- import { FetchPullRequestsData, GraphQLPullRequest } from './githubTypes';
1
+ import { GraphQLBody, GraphQLError, GraphQLResponse, ProviderConfig } from '../../types';
2
+ import { EnterpriseOptions } from '../gitProvider';
4
3
  export declare const GITHUB_API_URL = "https://api.github.com";
5
4
  export declare const GITHUB_GRAPHQL_API_URL: string;
5
+ export declare const GRAPHQL_MILESTONE_FIELDS = "\ndescription\ndueOn\nid\nnumber\nstate\ntitle\nurl\n";
6
+ export declare const GRAPHQL_LABEL_FIELDS = "\ncolor\ndescription\nid\nname\n";
6
7
  export declare const getGraphQLEndpoint: (config: ProviderConfig, options: EnterpriseOptions) => string;
7
8
  export declare const makeGitHubGraphQLRequest: <T>(config: ProviderConfig, data: GraphQLBody, options: EnterpriseOptions) => Promise<import("../../types").Response<GraphQLResponse<T>>>;
8
9
  export declare const hasEmailScope: (scopes: string[]) => boolean;
9
10
  export declare const getAccountFields: (withAvatarSizeVar?: boolean, includeEmail?: boolean) => string;
10
11
  export declare const getBotFields: (withAvatarSizeVar?: boolean) => string;
12
+ export declare const getPullRequestFields: (isDraftPullRequestSupported: boolean, includeEmail?: boolean) => string;
13
+ export declare const getIssueFields: (includeEmail?: boolean) => string;
11
14
  export declare const GithubSearchSyntaxQualifiers: Record<string, string>;
12
15
  export declare const getProjectGithubSearchSyntax: (search: string) => string[];
13
- export declare const fetchPullRequests: (config: ProviderConfig, input: FetchPullRequestsData & CursorPageInput, options: EnterpriseOptions, shouldFetchDraft?: boolean, includeEmail?: boolean) => Promise<import("../../types").Response<GraphQLResponse<{
14
- [key: string]: {
15
- pageInfo: {
16
- endCursor: string | null;
17
- hasNextPage: boolean;
18
- };
19
- nodes?: GraphQLPullRequest[] | undefined;
20
- };
21
- }>>>;
16
+ export declare const makeSearchIssuesOrPRsGraphQLBody: (type: 'issue' | 'pr', query: string, cursor: string | null | undefined, supportsEmail: boolean, supportsDrafts?: boolean) => GraphQLBody;
17
+ export declare const hasDraftsNotSupportedError: (errors?: GraphQLError[]) => boolean;
@@ -6,6 +6,12 @@ export declare enum GraphQLViewerPermission {
6
6
  TRIAGE = "TRIAGE",
7
7
  WRITE = "WRITE"
8
8
  }
9
+ export interface GraphQLLabel {
10
+ color: string;
11
+ description: string | null;
12
+ id: string;
13
+ name: string;
14
+ }
9
15
  export interface GraphQLRepository {
10
16
  id: string;
11
17
  databaseId: number;
@@ -26,6 +32,10 @@ export declare enum GitHubPullRequestReviewState {
26
32
  Commented = "COMMENTED",
27
33
  ReviewRequested = "REVIEW_REQUESTED"
28
34
  }
35
+ export declare enum GithubIssueState {
36
+ Open = "OPEN",
37
+ Closed = "CLOSED"
38
+ }
29
39
  export declare enum GitHubPullRequestMergeableState {
30
40
  Mergeable = "MERGEABLE",
31
41
  Conflicting = "CONFLICTING",
@@ -135,6 +145,10 @@ export interface GraphQLPullRequest {
135
145
  url: string;
136
146
  updatedAt: string;
137
147
  mergeable: GitHubPullRequestMergeableState;
148
+ milestone: GraphQLMilestone | null;
149
+ labels: {
150
+ nodes: GraphQLLabel[] | null;
151
+ } | null;
138
152
  }
139
153
  export interface GraphQLIssue {
140
154
  id: string;
@@ -142,6 +156,7 @@ export interface GraphQLIssue {
142
156
  number: string;
143
157
  title: string;
144
158
  url: string;
159
+ state: GithubIssueState;
145
160
  repository: {
146
161
  name: string;
147
162
  owner: {
@@ -160,6 +175,19 @@ export interface GraphQLIssue {
160
175
  reactions: {
161
176
  totalCount: number;
162
177
  };
178
+ milestone: GraphQLMilestone | null;
179
+ labels: {
180
+ nodes: GraphQLLabel[] | null;
181
+ } | null;
182
+ }
183
+ export interface GraphQLMilestone {
184
+ description: string | null;
185
+ dueOn: string | null;
186
+ id: string;
187
+ number: number;
188
+ state: string;
189
+ title: string;
190
+ url: string;
163
191
  }
164
192
  export interface FetchPullRequestsData {
165
193
  repos: GetRepoInput[];
@@ -1,4 +1,4 @@
1
- import { Account, CursorPageInput, EnterpriseOptions, GetRepoInput, GitProvider, GitPullRequest, GitRepository, NumberedPageInput } from '../gitProvider';
1
+ import { Account, CursorPageInput, EnterpriseOptions, GetRepoErrorData, GetRepoInput, GitLabel, GitProvider, GitPullRequest, GitRepository, NumberedPageInput } from '../gitProvider';
2
2
  import { GetIssueInput, Issue, IssueProvider } from '../issueProvider';
3
3
  import { EnterpriseProvider } from '../provider';
4
4
  export type PullRequestState = 'opened' | 'merged' | 'closed';
@@ -31,6 +31,7 @@ export declare class GitLab extends EnterpriseProvider implements GitProvider, I
31
31
  }>;
32
32
  getRepos(inputs: GetRepoInput[], options?: EnterpriseOptions): Promise<{
33
33
  data: GitRepository[];
34
+ errors: GetRepoErrorData[];
34
35
  }>;
35
36
  getReposForCurrentUser(input?: CursorPageInput, options?: EnterpriseOptions): Promise<{
36
37
  pageInfo: {
@@ -133,6 +134,25 @@ export declare class GitLab extends EnterpriseProvider implements GitProvider, I
133
134
  } | undefined;
134
135
  data: GitPullRequest[];
135
136
  }>;
137
+ closePullRequest(input: {
138
+ repo: GetRepoInput;
139
+ pullRequestId: string;
140
+ }, options?: EnterpriseOptions): Promise<void>;
141
+ mergePullRequest(input: {
142
+ repo: GetRepoInput;
143
+ pullRequestId: string;
144
+ expectedSourceSha: string;
145
+ }, options?: EnterpriseOptions): Promise<void>;
146
+ setPullRequestMilestone(input: {
147
+ repo: GetRepoInput;
148
+ pullRequestId: string;
149
+ milestoneGraphQLId: string | null;
150
+ }, options?: EnterpriseOptions): Promise<void>;
151
+ setPullRequestAsDraft(input: {
152
+ repo: GetRepoInput;
153
+ pullRequestId: string;
154
+ isDraft: boolean;
155
+ }, options?: EnterpriseOptions): Promise<void>;
136
156
  getIssue(input: GetIssueInput, options?: EnterpriseOptions): Promise<{
137
157
  data: Issue;
138
158
  }>;
@@ -161,4 +181,42 @@ export declare class GitLab extends EnterpriseProvider implements GitProvider, I
161
181
  } | undefined;
162
182
  data: Issue[];
163
183
  }>;
184
+ setIssueStatus(input: {
185
+ repo: GetRepoInput;
186
+ issueId: string;
187
+ status: 'CLOSE' | 'REOPEN';
188
+ }, options?: EnterpriseOptions): Promise<void>;
189
+ setIssueMilestone(input: {
190
+ repo: GetRepoInput;
191
+ issueId: string;
192
+ milestoneGraphQLId: string | null;
193
+ }, options?: EnterpriseOptions): Promise<void>;
194
+ getMilestonesForRepo(input: {
195
+ repo: GetRepoInput;
196
+ } & CursorPageInput, options?: EnterpriseOptions): Promise<{
197
+ pageInfo: {
198
+ endCursor: string | null;
199
+ hasNextPage: boolean;
200
+ };
201
+ data: {
202
+ id: string;
203
+ graphQLId: string;
204
+ number: number;
205
+ title: string;
206
+ description: string | null;
207
+ isOpen: boolean;
208
+ url: string;
209
+ startDate: Date | null;
210
+ dueDate: Date | null;
211
+ }[];
212
+ }>;
213
+ getLabelsForRepo(input: {
214
+ repo: GetRepoInput;
215
+ } & CursorPageInput, options?: EnterpriseOptions): Promise<{
216
+ pageInfo: {
217
+ endCursor: string | null;
218
+ hasNextPage: boolean;
219
+ };
220
+ data: GitLabel[];
221
+ }>;
164
222
  }
@@ -1,5 +1,9 @@
1
1
  import { Result } from '../types';
2
- import { Account, GetReposInput, Options } from './gitProvider';
2
+ import { Account, GetReposInput, GitLabel, GitMilestone, Options } from './gitProvider';
3
+ export declare enum GitIssueState {
4
+ Open = "OPEN",
5
+ Closed = "CLOSED"
6
+ }
3
7
  export interface GetIssueInput {
4
8
  id: string;
5
9
  name: string;
@@ -9,6 +13,10 @@ export interface GetIssueInput {
9
13
  export type GetIssuesForReposInput = GetReposInput | {
10
14
  repoIds: (string | number)[];
11
15
  };
16
+ export interface IssueTransition {
17
+ id: string;
18
+ name: string;
19
+ }
12
20
  export interface Issue {
13
21
  author: Account | null;
14
22
  assignees: Account[];
@@ -17,6 +25,7 @@ export interface Issue {
17
25
  description: string | null;
18
26
  graphQLId?: string;
19
27
  id: string;
28
+ labels: GitLabel[];
20
29
  number: string;
21
30
  repository: {
22
31
  name: string;
@@ -24,12 +33,17 @@ export interface Issue {
24
33
  login?: string;
25
34
  };
26
35
  } | null;
27
- state: string | null;
36
+ state: {
37
+ name: string;
38
+ color: string | null;
39
+ } | null;
40
+ statusTransitions?: IssueTransition[];
28
41
  title: string;
29
42
  type: string | null;
30
43
  updatedDate: Date | null;
31
44
  upvoteCount: number | null;
32
45
  url: string;
46
+ milestone?: GitMilestone | null;
33
47
  }
34
48
  export interface IssueProvider {
35
49
  getIssue(input: GetIssueInput, options: Options): Promise<Result<Issue>>;
@@ -37,4 +37,23 @@ export declare class Jira extends Provider {
37
37
  }, options?: EnterpriseOptions): Promise<{
38
38
  data: Issue[];
39
39
  }>;
40
+ setIssueStatus(input: {
41
+ resourceId: string;
42
+ issueId: string;
43
+ status: string;
44
+ }, options?: EnterpriseOptions): Promise<void>;
45
+ getLabelsForResource(input: {
46
+ resourceId: string;
47
+ } & CursorPageInput, options?: EnterpriseOptions): Promise<{
48
+ pageInfo: {
49
+ hasNextPage: boolean;
50
+ endCursor: string;
51
+ };
52
+ data: {
53
+ color: null;
54
+ description: null;
55
+ id: null;
56
+ name: string;
57
+ }[];
58
+ }>;
40
59
  }