forked from MrRefactoring/jira.js
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathworkflowTransitionRules.ts
195 lines (188 loc) · 9.54 KB
/
workflowTransitionRules.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
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
import * as Models from './models';
import * as Parameters from './parameters';
import { Callback } from '../callback';
import { Client } from '../clients';
import { RequestConfig } from '../requestConfig';
export class WorkflowTransitionRules {
constructor(private client: Client) {}
/**
* Returns a [paginated](https://developer.atlassian.com/cloud/jira/platform/rest/v2/intro/#pagination) list of
* workflows with transition rules. The workflows can be filtered to return only those containing workflow transition
* rules:
*
* - Of one or more transition rule types, such as [workflow post
* functions](https://developer.atlassian.com/cloud/jira/platform/modules/workflow-post-function/).
* - Matching one or more transition rule keys.
*
* Only workflows containing transition rules created by the calling
* [Connect](https://developer.atlassian.com/cloud/jira/platform/index/#connect-apps) or
* [Forge](https://developer.atlassian.com/cloud/jira/platform/index/#forge-apps) app are returned.
*
* Due to server-side optimizations, workflows with an empty list of rules may be returned; these workflows can be
* ignored.
*
* **[Permissions](https://developer.atlassian.com/cloud/jira/platform/rest/v2/intro/#permissions) required:** Only
* [Connect](https://developer.atlassian.com/cloud/jira/platform/index/#connect-apps) or
* [Forge](https://developer.atlassian.com/cloud/jira/platform/index/#forge-apps) apps can use this operation.
*/
async getWorkflowTransitionRuleConfigurations<T = Models.PageWorkflowTransitionRules>(
parameters: Parameters.GetWorkflowTransitionRuleConfigurations,
callback: Callback<T>,
): Promise<void>;
/**
* Returns a [paginated](https://developer.atlassian.com/cloud/jira/platform/rest/v2/intro/#pagination) list of
* workflows with transition rules. The workflows can be filtered to return only those containing workflow transition
* rules:
*
* - Of one or more transition rule types, such as [workflow post
* functions](https://developer.atlassian.com/cloud/jira/platform/modules/workflow-post-function/).
* - Matching one or more transition rule keys.
*
* Only workflows containing transition rules created by the calling
* [Connect](https://developer.atlassian.com/cloud/jira/platform/index/#connect-apps) or
* [Forge](https://developer.atlassian.com/cloud/jira/platform/index/#forge-apps) app are returned.
*
* Due to server-side optimizations, workflows with an empty list of rules may be returned; these workflows can be
* ignored.
*
* **[Permissions](https://developer.atlassian.com/cloud/jira/platform/rest/v2/intro/#permissions) required:** Only
* [Connect](https://developer.atlassian.com/cloud/jira/platform/index/#connect-apps) or
* [Forge](https://developer.atlassian.com/cloud/jira/platform/index/#forge-apps) apps can use this operation.
*/
async getWorkflowTransitionRuleConfigurations<T = Models.PageWorkflowTransitionRules>(
parameters: Parameters.GetWorkflowTransitionRuleConfigurations,
callback?: never,
): Promise<T>;
async getWorkflowTransitionRuleConfigurations<T = Models.PageWorkflowTransitionRules>(
parameters: Parameters.GetWorkflowTransitionRuleConfigurations,
callback?: Callback<T>,
): Promise<void | T> {
const config: RequestConfig = {
url: '/rest/api/2/workflow/rule/config',
method: 'GET',
params: {
startAt: parameters.startAt,
maxResults: parameters.maxResults,
types: parameters.types,
keys: parameters.keys,
workflowNames: parameters.workflowNames,
withTags: parameters.withTags,
draft: parameters.draft,
expand: parameters.expand,
},
};
return this.client.sendRequest(config, callback);
}
/**
* Updates configuration of workflow transition rules. The following rule types are supported:
*
* - [post functions](https://developer.atlassian.com/cloud/jira/platform/modules/workflow-post-function/)
* - [conditions](https://developer.atlassian.com/cloud/jira/platform/modules/workflow-condition/)
* - [validators](https://developer.atlassian.com/cloud/jira/platform/modules/workflow-validator/)
*
* Only rules created by the calling
* [Connect](https://developer.atlassian.com/cloud/jira/platform/index/#connect-apps) or
* [Forge](https://developer.atlassian.com/cloud/jira/platform/index/#forge-apps) app can be updated.
*
* To assist with app migration, this operation can be used to:
*
* - Disable a rule.
* - Add a `tag`. Use this to filter rules in the [Get workflow transition rule
* configurations](https://developer.atlassian.com/cloud/jira/platform/rest/v3/api-group-workflow-transition-rules/#api-rest-api-3-workflow-rule-config-get).
*
* Rules are enabled if the `disabled` parameter is not provided.
*
* **[Permissions](https://developer.atlassian.com/cloud/jira/platform/rest/v2/intro/#permissions) required:** Only
* [Connect](https://developer.atlassian.com/cloud/jira/platform/index/#connect-apps) or
* [Forge](https://developer.atlassian.com/cloud/jira/platform/index/#forge-apps) apps can use this operation.
*/
async updateWorkflowTransitionRuleConfigurations<T = Models.WorkflowTransitionRulesUpdateErrors>(
parameters: Parameters.UpdateWorkflowTransitionRuleConfigurations,
callback: Callback<T>,
): Promise<void>;
/**
* Updates configuration of workflow transition rules. The following rule types are supported:
*
* - [post functions](https://developer.atlassian.com/cloud/jira/platform/modules/workflow-post-function/)
* - [conditions](https://developer.atlassian.com/cloud/jira/platform/modules/workflow-condition/)
* - [validators](https://developer.atlassian.com/cloud/jira/platform/modules/workflow-validator/)
*
* Only rules created by the calling
* [Connect](https://developer.atlassian.com/cloud/jira/platform/index/#connect-apps) or
* [Forge](https://developer.atlassian.com/cloud/jira/platform/index/#forge-apps) app can be updated.
*
* To assist with app migration, this operation can be used to:
*
* - Disable a rule.
* - Add a `tag`. Use this to filter rules in the [Get workflow transition rule
* configurations](https://developer.atlassian.com/cloud/jira/platform/rest/v3/api-group-workflow-transition-rules/#api-rest-api-3-workflow-rule-config-get).
*
* Rules are enabled if the `disabled` parameter is not provided.
*
* **[Permissions](https://developer.atlassian.com/cloud/jira/platform/rest/v2/intro/#permissions) required:** Only
* [Connect](https://developer.atlassian.com/cloud/jira/platform/index/#connect-apps) or
* [Forge](https://developer.atlassian.com/cloud/jira/platform/index/#forge-apps) apps can use this operation.
*/
async updateWorkflowTransitionRuleConfigurations<T = Models.WorkflowTransitionRulesUpdateErrors>(
parameters: Parameters.UpdateWorkflowTransitionRuleConfigurations,
callback?: never,
): Promise<T>;
async updateWorkflowTransitionRuleConfigurations<T = Models.WorkflowTransitionRulesUpdateErrors>(
parameters: Parameters.UpdateWorkflowTransitionRuleConfigurations,
callback?: Callback<T>,
): Promise<void | T> {
const config: RequestConfig = {
url: '/rest/api/2/workflow/rule/config',
method: 'PUT',
data: {
workflows: parameters.workflows,
},
};
return this.client.sendRequest(config, callback);
}
/**
* Deletes workflow transition rules from one or more workflows. These rule types are supported:
*
* - [post functions](https://developer.atlassian.com/cloud/jira/platform/modules/workflow-post-function/)
* - [conditions](https://developer.atlassian.com/cloud/jira/platform/modules/workflow-condition/)
* - [validators](https://developer.atlassian.com/cloud/jira/platform/modules/workflow-validator/)
*
* Only rules created by the calling Connect app can be deleted.
*
* **[Permissions](https://developer.atlassian.com/cloud/jira/platform/rest/v2/intro/#permissions) required:** Only
* Connect apps can use this operation.
*/
async deleteWorkflowTransitionRuleConfigurations<T = Models.WorkflowTransitionRulesUpdateErrors>(
parameters: Parameters.DeleteWorkflowTransitionRuleConfigurations | undefined,
callback: Callback<T>,
): Promise<void>;
/**
* Deletes workflow transition rules from one or more workflows. These rule types are supported:
*
* - [post functions](https://developer.atlassian.com/cloud/jira/platform/modules/workflow-post-function/)
* - [conditions](https://developer.atlassian.com/cloud/jira/platform/modules/workflow-condition/)
* - [validators](https://developer.atlassian.com/cloud/jira/platform/modules/workflow-validator/)
*
* Only rules created by the calling Connect app can be deleted.
*
* **[Permissions](https://developer.atlassian.com/cloud/jira/platform/rest/v2/intro/#permissions) required:** Only
* Connect apps can use this operation.
*/
async deleteWorkflowTransitionRuleConfigurations<T = Models.WorkflowTransitionRulesUpdateErrors>(
parameters?: Parameters.DeleteWorkflowTransitionRuleConfigurations,
callback?: never,
): Promise<T>;
async deleteWorkflowTransitionRuleConfigurations<T = Models.WorkflowTransitionRulesUpdateErrors>(
parameters?: Parameters.DeleteWorkflowTransitionRuleConfigurations,
callback?: Callback<T>,
): Promise<void | T> {
const config: RequestConfig = {
url: '/rest/api/2/workflow/rule/config/delete',
method: 'PUT',
data: {
workflows: parameters?.workflows,
},
};
return this.client.sendRequest(config, callback);
}
}