@gitkraken/provider-apis 0.17.5 → 0.18.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.
@@ -1,13 +1,14 @@
1
- import { Result } from '../types';
2
- import { Account, GetReposInput, GitLabel, GitMilestone, Options } from './gitProvider';
1
+ import { PagedResult, Result } from '../types';
2
+ import { Account, GetRepoInput, GetReposInput, GitLabel, GitMilestone, Options, SetAccountInput, SetLabelInput, SetMilestoneInput } from './gitProvider';
3
3
  export declare enum GitIssueState {
4
4
  Open = "OPEN",
5
5
  Closed = "CLOSED"
6
6
  }
7
7
  export interface GetIssueInput {
8
- namespace: string;
8
+ resourceId?: string;
9
+ namespace?: string;
9
10
  project?: string;
10
- name: string;
11
+ name?: string;
11
12
  number: string;
12
13
  }
13
14
  export type GetIssuesForReposInput = GetReposInput | {
@@ -48,6 +49,11 @@ export interface Issue {
48
49
  login?: string;
49
50
  };
50
51
  } | null;
52
+ project?: {
53
+ namespace: string | null;
54
+ resourceId: string | null;
55
+ name: string;
56
+ };
51
57
  state: {
52
58
  id?: string;
53
59
  name: string;
@@ -63,7 +69,56 @@ export interface Issue {
63
69
  url: string | null;
64
70
  milestone?: GitMilestone | null;
65
71
  }
72
+ export interface SetIssueInput {
73
+ id: string;
74
+ graphQLId?: string;
75
+ number: string;
76
+ repository: {
77
+ name: string;
78
+ owner: {
79
+ login?: string;
80
+ };
81
+ } | null;
82
+ project?: {
83
+ namespace: string | null;
84
+ resourceId: string | null;
85
+ name: string;
86
+ };
87
+ }
88
+ export interface SetStatusInput {
89
+ name: string;
90
+ id?: string;
91
+ }
66
92
  export interface IssueProvider {
67
- getIssue(input: GetIssueInput, options: Options): Promise<Result<Issue>>;
68
- getIssuesForRepos(input: GetIssuesForReposInput, options: Options): Promise<Result<Issue[]>>;
93
+ getIssue?(input: GetIssueInput, options: Options): Promise<Result<Issue>>;
94
+ getIssuesForRepo?(input: {
95
+ repo: GetRepoInput;
96
+ }, options: Options): Promise<PagedResult<Issue>>;
97
+ getIssuesForRepos?(input: GetIssuesForReposInput, options: Options): Promise<PagedResult<Issue>>;
98
+ setIssueLabels?(input: {
99
+ issue: SetIssueInput;
100
+ labels: SetLabelInput[];
101
+ }, options: Options): Promise<void>;
102
+ setIssueAssignee?(input: {
103
+ issue: SetIssueInput;
104
+ assignee: SetAccountInput | null;
105
+ }, options: Options): Promise<void>;
106
+ setIssueAssignees?(input: {
107
+ issue: SetIssueInput;
108
+ assignees: SetAccountInput[];
109
+ }, options: Options): Promise<void>;
110
+ setIssueMilestone?(input: {
111
+ issue: SetIssueInput;
112
+ milestone: SetMilestoneInput;
113
+ }, options: Options): Promise<void>;
114
+ setIssueStatus?(input: {
115
+ issue: SetIssueInput;
116
+ status: SetStatusInput;
117
+ }, options: Options): Promise<void>;
118
+ closeIssue?(input: {
119
+ issue: SetIssueInput;
120
+ }): Promise<void>;
121
+ reOpenIssue?(input: {
122
+ issue: SetIssueInput;
123
+ }): Promise<void>;
69
124
  }
@@ -1,6 +1,8 @@
1
1
  import { Result } from '../../types';
2
- import { CursorPageInput, EnterpriseOptions, NumberedPageInput } from '../gitProvider';
2
+ import { CursorPageInput, EnterpriseOptions, NumberedPageInput, SetAccountInput, SetLabelInput } from '../gitProvider';
3
+ import { IssueProvider, SetIssueInput, SetStatusInput } from '../issueProvider';
3
4
  import { Provider } from '../provider';
5
+ import { SetComponentInput } from './sharedTypes';
4
6
  export interface JiraResource {
5
7
  id: string;
6
8
  name: string;
@@ -13,7 +15,11 @@ export interface JiraProject {
13
15
  name: string;
14
16
  resourceId: string;
15
17
  }
16
- export declare class Jira extends Provider {
18
+ export interface JiraGetIssueInput {
19
+ resourceId: string;
20
+ number: string;
21
+ }
22
+ export declare class Jira extends Provider implements IssueProvider {
17
23
  private _resourceUrlCache;
18
24
  private getResourceUrl;
19
25
  getCurrentUserForResource(input: {
@@ -69,10 +75,7 @@ export declare class Jira extends Provider {
69
75
  }, options?: EnterpriseOptions): Promise<{
70
76
  data: import("./sharedTypes").JiraComponent[];
71
77
  }>;
72
- getIssue(input: {
73
- resourceId: string;
74
- number: string;
75
- }, options?: EnterpriseOptions): Promise<{
78
+ getIssue(input: JiraGetIssueInput, options?: EnterpriseOptions): Promise<{
76
79
  data: import("../issueProvider").Issue;
77
80
  }>;
78
81
  getIssuesForProject(input: {
@@ -98,24 +101,20 @@ export declare class Jira extends Provider {
98
101
  };
99
102
  }>;
100
103
  setIssueStatus(input: {
101
- resourceId: string;
102
- issueId: string;
103
- status: string;
104
+ issue: SetIssueInput;
105
+ status: SetStatusInput;
104
106
  }, options?: EnterpriseOptions): Promise<void>;
105
107
  setIssueAssignee(input: {
106
- resourceId: string;
107
- issueId: string;
108
- assigneeId: string | null;
108
+ issue: SetIssueInput;
109
+ assignee: SetAccountInput | null;
109
110
  }, options?: EnterpriseOptions): Promise<void>;
110
111
  setIssueComponents(input: {
111
- resourceId: string;
112
- issueId: string;
113
- componentIds: string[];
112
+ issue: SetIssueInput;
113
+ components: SetComponentInput[];
114
114
  }, options?: EnterpriseOptions): Promise<void>;
115
115
  setIssueLabels(input: {
116
- resourceId: string;
117
- issueId: string;
118
- labelNames: string[];
116
+ issue: SetIssueInput;
117
+ labels: SetLabelInput[];
119
118
  }, options?: EnterpriseOptions): Promise<void>;
120
119
  getLabelsForResource(input: {
121
120
  resourceId: string;
@@ -1,8 +1,8 @@
1
1
  import { ProviderConfig } from '../../types';
2
- import { EnterpriseOptions, NumberedPageInput } from '../gitProvider';
3
- import { Issue, IssueComponent, IssueTransition } from '../issueProvider';
4
- import { JiraComponent, JiraComponentStub, JiraIssue, JiraTransition, JiraUser } from './sharedTypes';
5
- export declare const normalizeIssue: (issue: JiraIssue, resourceUrl: string | null, isServer: boolean) => Issue;
2
+ import { EnterpriseOptions, NumberedPageInput, SetLabelInput } from '../gitProvider';
3
+ import { Issue, IssueComponent, IssueTransition, SetIssueInput, SetStatusInput } from '../issueProvider';
4
+ import { JiraComponent, JiraComponentStub, JiraIssue, JiraTransition, JiraUser, SetComponentInput } from './sharedTypes';
5
+ export declare const normalizeIssue: (issue: JiraIssue, resourceUrl: string | null, resourceId?: string) => Issue;
6
6
  export declare const normalizeTransition: (transition: JiraTransition) => IssueTransition;
7
7
  export declare const normalizeComponentStub: (component: JiraComponentStub) => IssueComponent;
8
8
  export declare const normalizeUserURL: (user: JiraUser, resourceUrl: string | null, isServer: boolean) => string;
@@ -43,19 +43,16 @@ export declare const getIssuesForProject: (config: ProviderConfig, input: {
43
43
  };
44
44
  }>;
45
45
  export declare const setIssueLabels: (config: ProviderConfig, input: {
46
- resourceId?: string;
47
- issueId: string;
48
- labelNames: string[];
46
+ issue: SetIssueInput;
47
+ labels: SetLabelInput[];
49
48
  }, options?: EnterpriseOptions) => Promise<void>;
50
49
  export declare const setIssueComponents: (config: ProviderConfig, input: {
51
- resourceId?: string;
52
- issueId: string;
53
- componentIds: string[];
50
+ issue: SetIssueInput;
51
+ components: SetComponentInput[];
54
52
  }, options?: EnterpriseOptions) => Promise<void>;
55
53
  export declare const setIssueStatus: (config: ProviderConfig, input: {
56
- resourceId?: string;
57
- issueId: string;
58
- status: string;
54
+ issue: SetIssueInput;
55
+ status: SetStatusInput;
59
56
  }, options?: EnterpriseOptions) => Promise<void>;
60
57
  export declare const getComponentsForJiraProject: (config: ProviderConfig, input: {
61
58
  resourceId?: string;
@@ -1,3 +1,6 @@
1
+ export interface SetComponentInput {
2
+ id: string;
3
+ }
1
4
  export interface AvatarUrls {
2
5
  '16x16': string;
3
6
  '24x24': string;
@@ -78,6 +81,15 @@ export interface JiraIssue {
78
81
  expand: string;
79
82
  fields: {
80
83
  components?: JiraComponentStub[];
84
+ project: {
85
+ avatarUrls: AvatarUrls;
86
+ id: string;
87
+ key: string;
88
+ name: string;
89
+ projectTypeKey: string;
90
+ self: string;
91
+ simplified: boolean;
92
+ };
81
93
  status: JiraIssueStatus;
82
94
  assignee?: JiraUser;
83
95
  comment: {
@@ -1,10 +1,12 @@
1
- import { EnterpriseOptions, NumberedPageInput } from '../gitProvider';
1
+ import { EnterpriseOptions, NumberedPageInput, SetLabelInput } from '../gitProvider';
2
+ import { IssueProvider, SetIssueInput, SetStatusInput } from '../issueProvider';
3
+ import { SetComponentInput } from '../jira/sharedTypes';
2
4
  import { EnterpriseProvider } from '../provider';
3
5
  export interface JiraServerProject {
4
6
  id: string;
5
7
  name: string;
6
8
  }
7
- export declare class JiraServer extends EnterpriseProvider {
9
+ export declare class JiraServer extends EnterpriseProvider implements IssueProvider {
8
10
  getCurrentUser(options?: EnterpriseOptions): Promise<{
9
11
  data: {
10
12
  name: string;
@@ -46,16 +48,16 @@ export declare class JiraServer extends EnterpriseProvider {
46
48
  };
47
49
  }>;
48
50
  setIssueStatus(input: {
49
- issueId: string;
50
- status: string;
51
+ issue: SetIssueInput;
52
+ status: SetStatusInput;
51
53
  }, options?: EnterpriseOptions): Promise<void>;
52
54
  setIssueLabels(input: {
53
- issueId: string;
54
- labelNames: string[];
55
+ issue: SetIssueInput;
56
+ labels: SetLabelInput[];
55
57
  }, options?: EnterpriseOptions): Promise<void>;
56
58
  setIssueComponents(input: {
57
- issueId: string;
58
- componentIds: string[];
59
+ issue: SetIssueInput;
60
+ components: SetComponentInput[];
59
61
  }, options?: EnterpriseOptions): Promise<void>;
60
62
  getLabels(options?: EnterpriseOptions): Promise<{
61
63
  data: {
@@ -1,6 +1,6 @@
1
1
  import { Result } from '../../types';
2
- import { EnterpriseOptions } from '../gitProvider';
3
- import { Issue } from '../issueProvider';
2
+ import { EnterpriseOptions, SetAccountInput, SetLabelInput } from '../gitProvider';
3
+ import { Issue, IssueProvider, SetIssueInput, SetStatusInput } from '../issueProvider';
4
4
  import { Provider } from '../provider';
5
5
  interface TrelloList {
6
6
  id: string;
@@ -24,7 +24,7 @@ export interface TrelloBoard {
24
24
  id: string;
25
25
  name: string;
26
26
  }
27
- export declare class Trello extends Provider {
27
+ export declare class Trello extends Provider implements IssueProvider {
28
28
  getCurrentUser(input: {
29
29
  appKey: string;
30
30
  }, options?: EnterpriseOptions): Promise<{
@@ -73,23 +73,27 @@ export declare class Trello extends Provider {
73
73
  private updateIssue;
74
74
  setIssueStatus(input: {
75
75
  appKey: string;
76
- cardId: string;
77
- status: string;
76
+ issue: SetIssueInput;
77
+ status: SetStatusInput;
78
78
  }, options?: EnterpriseOptions): Promise<void>;
79
79
  setIssueAssignees(input: {
80
80
  appKey: string;
81
- cardId: string;
82
- assigneeIds: string[];
81
+ issue: SetIssueInput;
82
+ assignees: SetAccountInput[];
83
83
  }, options?: EnterpriseOptions): Promise<void>;
84
84
  setIssueLabels(input: {
85
85
  appKey: string;
86
- cardId: string;
87
- labelIds: string[];
86
+ issue: SetIssueInput;
87
+ labels: SetLabelInput[];
88
88
  }, options?: EnterpriseOptions): Promise<void>;
89
- setIssueArchived(input: {
89
+ private setIssueArchived;
90
+ archiveIssue(input: {
90
91
  appKey: string;
91
- cardId: string;
92
- archived: boolean;
92
+ issue: SetIssueInput;
93
+ }, options?: EnterpriseOptions): Promise<void>;
94
+ unArchiveIssue(input: {
95
+ appKey: string;
96
+ issue: SetIssueInput;
93
97
  }, options?: EnterpriseOptions): Promise<void>;
94
98
  getLabelsForBoard(input: {
95
99
  appKey: string;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@gitkraken/provider-apis",
3
- "version": "0.17.5",
3
+ "version": "0.18.1",
4
4
  "description": "An SDK around different third-party APIs that accepts and returns data in a common format.",
5
5
  "author": "Axosoft, LLC dba GitKraken",
6
6
  "license": "SEE LICENSE IN LICENSE",