forked from MrRefactoring/jira.js
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathissueLinks.ts
149 lines (142 loc) · 6.98 KB
/
issueLinks.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
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
import * as Models from './models';
import * as Parameters from './parameters';
import { Callback } from '../callback';
import { Client } from '../clients';
import { RequestConfig } from '../requestConfig';
export class IssueLinks {
constructor(private client: Client) {}
/**
* Creates a link between two issues. Use this operation to indicate a relationship between two issues and optionally
* add a comment to the from (outward) issue. To use this resource the site must have [Issue
* Linking](https://confluence.atlassian.com/x/yoXKM) enabled.
*
* This resource returns nothing on the creation of an issue link. To obtain the ID of the issue link, use
* `https://your-domain.atlassian.net/rest/api/3/issue/[linked issue key]?fields=issuelinks`.
*
* If the link request duplicates a link, the response indicates that the issue link was created. If the request
* included a comment, the comment is added.
*
* This operation can be accessed anonymously.
*
* **[Permissions](https://developer.atlassian.com/cloud/jira/platform/rest/v3/intro/#permissions) required:**
*
* - _Browse project_ [project permission](https://confluence.atlassian.com/x/yodKLg) for all the projects containing
* the issues to be linked,
* - _Link issues_ [project permission](https://confluence.atlassian.com/x/yodKLg) on the project containing the from
* (outward) issue,
* - If [issue-level security](https://confluence.atlassian.com/x/J4lKLg) is configured, issue-level security permission
* to view the issue.
* - If the comment has visibility restrictions, belongs to the group or has the role visibility is restricted to.
*/
async linkIssues<T = void>(parameters: Parameters.LinkIssues | undefined, callback: Callback<T>): Promise<void>;
/**
* Creates a link between two issues. Use this operation to indicate a relationship between two issues and optionally
* add a comment to the from (outward) issue. To use this resource the site must have [Issue
* Linking](https://confluence.atlassian.com/x/yoXKM) enabled.
*
* This resource returns nothing on the creation of an issue link. To obtain the ID of the issue link, use
* `https://your-domain.atlassian.net/rest/api/3/issue/[linked issue key]?fields=issuelinks`.
*
* If the link request duplicates a link, the response indicates that the issue link was created. If the request
* included a comment, the comment is added.
*
* This operation can be accessed anonymously.
*
* **[Permissions](https://developer.atlassian.com/cloud/jira/platform/rest/v3/intro/#permissions) required:**
*
* - _Browse project_ [project permission](https://confluence.atlassian.com/x/yodKLg) for all the projects containing
* the issues to be linked,
* - _Link issues_ [project permission](https://confluence.atlassian.com/x/yodKLg) on the project containing the from
* (outward) issue,
* - If [issue-level security](https://confluence.atlassian.com/x/J4lKLg) is configured, issue-level security permission
* to view the issue.
* - If the comment has visibility restrictions, belongs to the group or has the role visibility is restricted to.
*/
async linkIssues<T = void>(parameters?: Parameters.LinkIssues, callback?: never): Promise<T>;
async linkIssues<T = void>(parameters?: Parameters.LinkIssues, callback?: Callback<T>): Promise<void | T> {
const config: RequestConfig = {
url: '/rest/api/3/issueLink',
method: 'POST',
data: {
type: parameters?.type,
inwardIssue: parameters?.inwardIssue,
outwardIssue: parameters?.outwardIssue,
comment: parameters?.comment,
},
};
return this.client.sendRequest(config, callback);
}
/**
* Returns an issue link.
*
* This operation can be accessed anonymously.
*
* **[Permissions](https://developer.atlassian.com/cloud/jira/platform/rest/v3/intro/#permissions) required:**
*
* - _Browse project_ [project permission](https://confluence.atlassian.com/x/yodKLg) for all the projects containing
* the linked issues.
* - If [issue-level security](https://confluence.atlassian.com/x/J4lKLg) is configured, permission to view both of the
* issues.
*/
async getIssueLink<T = Models.IssueLink>(parameters: Parameters.GetIssueLink, callback: Callback<T>): Promise<void>;
/**
* Returns an issue link.
*
* This operation can be accessed anonymously.
*
* **[Permissions](https://developer.atlassian.com/cloud/jira/platform/rest/v3/intro/#permissions) required:**
*
* - _Browse project_ [project permission](https://confluence.atlassian.com/x/yodKLg) for all the projects containing
* the linked issues.
* - If [issue-level security](https://confluence.atlassian.com/x/J4lKLg) is configured, permission to view both of the
* issues.
*/
async getIssueLink<T = Models.IssueLink>(parameters: Parameters.GetIssueLink, callback?: never): Promise<T>;
async getIssueLink<T = Models.IssueLink>(
parameters: Parameters.GetIssueLink,
callback?: Callback<T>,
): Promise<void | T> {
const config: RequestConfig = {
url: `/rest/api/3/issueLink/${parameters.linkId}`,
method: 'GET',
};
return this.client.sendRequest(config, callback);
}
/**
* Deletes an issue link.
*
* This operation can be accessed anonymously.
*
* **[Permissions](https://developer.atlassian.com/cloud/jira/platform/rest/v3/intro/#permissions) required:**
*
* - Browse project [project permission](https://confluence.atlassian.com/x/yodKLg) for all the projects containing the
* issues in the link.
* - _Link issues_ [project permission](https://confluence.atlassian.com/x/yodKLg) for at least one of the projects
* containing issues in the link.
* - If [issue-level security](https://confluence.atlassian.com/x/J4lKLg) is configured, permission to view both of the
* issues.
*/
async deleteIssueLink<T = void>(parameters: Parameters.DeleteIssueLink, callback: Callback<T>): Promise<void>;
/**
* Deletes an issue link.
*
* This operation can be accessed anonymously.
*
* **[Permissions](https://developer.atlassian.com/cloud/jira/platform/rest/v3/intro/#permissions) required:**
*
* - Browse project [project permission](https://confluence.atlassian.com/x/yodKLg) for all the projects containing the
* issues in the link.
* - _Link issues_ [project permission](https://confluence.atlassian.com/x/yodKLg) for at least one of the projects
* containing issues in the link.
* - If [issue-level security](https://confluence.atlassian.com/x/J4lKLg) is configured, permission to view both of the
* issues.
*/
async deleteIssueLink<T = void>(parameters: Parameters.DeleteIssueLink, callback?: never): Promise<T>;
async deleteIssueLink<T = void>(parameters: Parameters.DeleteIssueLink, callback?: Callback<T>): Promise<void | T> {
const config: RequestConfig = {
url: `/rest/api/3/issueLink/${parameters.linkId}`,
method: 'DELETE',
};
return this.client.sendRequest(config, callback);
}
}