• Home
  • Features
  • Pricing
  • Docs
  • Announcements
  • Sign In

tylernathanreed / jira-client-php / 13634794100

03 Mar 2025 03:19PM UTC coverage: 2.067% (-0.1%) from 2.21%
13634794100

push

github

web-flow
~ Try coveralls action

140 of 6773 relevant lines covered (2.07%)

0.03 hits per line

Source File
Press 'n' to go to next uncovered line, 'b' for previous

0.0
/src/Operations/Workflows.php
1
<?php
2

3
namespace Jira\Client\Operations;
4

5
use Jira\Client\Client;
6
use Jira\Client\Schema;
7

8
/** @phpstan-require-extends Client */
9
trait Workflows
10
{
11
    /**
12
     * Returns all workflows in Jira or a workflow.
13
     * Deprecated, use "Get workflows paginated"
14
     * 
15
     * If the `workflowName` parameter is specified, the workflow is returned as an object (not in an array).
16
     * Otherwise, an array of workflow objects is returned
17
     * 
18
     * **"Permissions" required:** *Administer Jira* "global permission".
19
     * 
20
     * @link https://confluence.atlassian.com/x/x4dKLg
21
     * 
22
     * @param string $workflowName The name of the workflow to be returned.
23
     *                             Only one workflow can be specified.
24
     */
25
    public function getAllWorkflows(
×
26
        ?string $workflowName = null,
27
    ): true {
28
        return $this->call(
×
29
            uri: '/rest/api/3/workflow',
×
30
            method: 'get',
×
31
            query: compact('workflowName'),
×
32
            success: 200,
×
33
            schema: true,
×
34
        );
×
35
    }
36

37
    /**
38
     * Creates a workflow.
39
     * You can define transition rules using the shapes detailed in the following sections.
40
     * If no transitional rules are specified the default system transition rules are used.
41
     * Note: This only applies to company-managed scoped workflows.
42
     * Use "bulk create workflows" to create both team and company-managed scoped workflows
43
     * 
44
     * #### Conditions ####
45
     * 
46
     * Conditions enable workflow rules that govern whether a transition can execute
47
     * 
48
     * ##### Always false condition #####
49
     * 
50
     * A condition that always fails
51
     * 
52
     *     {
53
     *        "type": "AlwaysFalseCondition"
54
     *      }
55
     * 
56
     * ##### Block transition until approval #####
57
     * 
58
     * A condition that blocks issue transition if there is a pending approval
59
     * 
60
     *     {
61
     *        "type": "BlockInProgressApprovalCondition"
62
     *      }
63
     * 
64
     * ##### Compare number custom field condition #####
65
     * 
66
     * A condition that allows transition if a comparison between a number custom field and a value is true
67
     * 
68
     *     {
69
     *        "type": "CompareNumberCFCondition",
70
     *        "configuration": {
71
     *          "comparator": "=",
72
     *          "fieldId": "customfield_10029",
73
     *          "fieldValue": 2
74
     *        }
75
     *      }
76
     * 
77
     *  - `comparator` One of the supported comparator: `=`, `>`, and `<`
78
     *  - `fieldId` The custom numeric field ID.
79
     * Allowed field types:
80
     *     
81
     *      - `com.atlassian.jira.plugin.system.customfieldtypes:float`
82
     *      - `com.pyxis.greenhopper.jira:jsw-story-points`
83
     *  - `fieldValue` The value for comparison
84
     * 
85
     * ##### Hide from user condition #####
86
     * 
87
     * A condition that hides a transition from users.
88
     * The transition can only be triggered from a workflow function or REST API operation
89
     * 
90
     *     {
91
     *        "type": "RemoteOnlyCondition"
92
     *      }
93
     * 
94
     * ##### Only assignee condition #####
95
     * 
96
     * A condition that allows only the assignee to execute a transition
97
     * 
98
     *     {
99
     *        "type": "AllowOnlyAssignee"
100
     *      }
101
     * 
102
     * ##### Only Bamboo notifications workflow condition (deprecated) #####
103
     * 
104
     * A condition that makes the transition available only to Bamboo build notifications
105
     * 
106
     *     {
107
     *        "type": "OnlyBambooNotificationsCondition"
108
     *      }
109
     * 
110
     * ##### Only reporter condition #####
111
     * 
112
     * A condition that allows only the reporter to execute a transition
113
     * 
114
     *     {
115
     *        "type": "AllowOnlyReporter"
116
     *      }
117
     * 
118
     * ##### Permission condition #####
119
     * 
120
     * A condition that allows only users with a permission to execute a transition
121
     * 
122
     *     {
123
     *        "type": "PermissionCondition",
124
     *        "configuration": {
125
     *            "permissionKey": "BROWSE_PROJECTS"
126
     *        }
127
     *      }
128
     * 
129
     *  - `permissionKey` The permission required to perform the transition.
130
     * Allowed values: "built-in" or app defined permissions
131
     * 
132
     * ##### Previous status condition #####
133
     * 
134
     * A condition that allows a transition based on whether an issue has or has not transitioned through a status
135
     * 
136
     *     {
137
     *        "type": "PreviousStatusCondition",
138
     *        "configuration": {
139
     *          "ignoreLoopTransitions": true,
140
     *          "includeCurrentStatus": true,
141
     *          "mostRecentStatusOnly": true,
142
     *          "reverseCondition": true,
143
     *          "previousStatus": {
144
     *            "id": "5"
145
     *          }
146
     *        }
147
     *      }
148
     * 
149
     * By default this condition allows the transition if the status, as defined by its ID in the `previousStatus` object, matches any previous issue status, unless:
150
     * 
151
     *  - `ignoreLoopTransitions` is `true`, then loop transitions (from and to the same status) are ignored
152
     *  - `includeCurrentStatus` is `true`, then the current issue status is also checked
153
     *  - `mostRecentStatusOnly` is `true`, then only the issue's preceding status (the one immediately before the current status) is checked
154
     *  - `reverseCondition` is `true`, then the status must not be present
155
     * 
156
     * ##### Separation of duties condition #####
157
     * 
158
     * A condition that prevents a user to perform the transition, if the user has already performed a transition on the issue
159
     * 
160
     *     {
161
     *        "type": "SeparationOfDutiesCondition",
162
     *        "configuration": {
163
     *          "fromStatus": {
164
     *            "id": "5"
165
     *          },
166
     *          "toStatus": {
167
     *            "id": "6"
168
     *          }
169
     *        }
170
     *      }
171
     * 
172
     *  - `fromStatus` OPTIONAL.
173
     * An object containing the ID of the source status of the transition that is blocked.
174
     * If omitted any transition to `toStatus` is blocked
175
     *  - `toStatus` An object containing the ID of the target status of the transition that is blocked
176
     * 
177
     * ##### Subtask blocking condition #####
178
     * 
179
     * A condition that blocks transition on a parent issue if any of its subtasks are in any of one or more statuses
180
     * 
181
     *     {
182
     *        "type": "SubTaskBlockingCondition",
183
     *        "configuration": {
184
     *          "statuses": [
185
     *            {
186
     *              "id": "1"
187
     *            },
188
     *            {
189
     *              "id": "3"
190
     *            }
191
     *          ]
192
     *        }
193
     *      }
194
     * 
195
     *  - `statuses` A list of objects containing status IDs
196
     * 
197
     * ##### User is in any group condition #####
198
     * 
199
     * A condition that allows users belonging to any group from a list of groups to execute a transition
200
     * 
201
     *     {
202
     *        "type": "UserInAnyGroupCondition",
203
     *        "configuration": {
204
     *          "groups": [
205
     *            "administrators",
206
     *            "atlassian-addons-admin"
207
     *          ]
208
     *        }
209
     *      }
210
     * 
211
     *  - `groups` A list of group names
212
     * 
213
     * ##### User is in any project role condition #####
214
     * 
215
     * A condition that allows only users with at least one project roles from a list of project roles to execute a transition
216
     * 
217
     *     {
218
     *        "type": "InAnyProjectRoleCondition",
219
     *        "configuration": {
220
     *          "projectRoles": [
221
     *            {
222
     *              "id": "10002"
223
     *            },
224
     *            {
225
     *              "id": "10003"
226
     *            },
227
     *            {
228
     *              "id": "10012"
229
     *            },
230
     *            {
231
     *              "id": "10013"
232
     *            }
233
     *          ]
234
     *        }
235
     *      }
236
     * 
237
     *  - `projectRoles` A list of objects containing project role IDs
238
     * 
239
     * ##### User is in custom field condition #####
240
     * 
241
     * A condition that allows only users listed in a given custom field to execute the transition
242
     * 
243
     *     {
244
     *        "type": "UserIsInCustomFieldCondition",
245
     *        "configuration": {
246
     *          "allowUserInField": false,
247
     *          "fieldId": "customfield_10010"
248
     *        }
249
     *      }
250
     * 
251
     *  - `allowUserInField` If `true` only a user who is listed in `fieldId` can perform the transition, otherwise, only a user who is not listed in `fieldId` can perform the transition
252
     *  - `fieldId` The ID of the field containing the list of users
253
     * 
254
     * ##### User is in group condition #####
255
     * 
256
     * A condition that allows users belonging to a group to execute a transition
257
     * 
258
     *     {
259
     *        "type": "UserInGroupCondition",
260
     *        "configuration": {
261
     *          "group": "administrators"
262
     *        }
263
     *      }
264
     * 
265
     *  - `group` The name of the group
266
     * 
267
     * ##### User is in group custom field condition #####
268
     * 
269
     * A condition that allows users belonging to a group specified in a custom field to execute a transition
270
     * 
271
     *     {
272
     *        "type": "InGroupCFCondition",
273
     *        "configuration": {
274
     *          "fieldId": "customfield_10012"
275
     *        }
276
     *      }
277
     * 
278
     *  - `fieldId` The ID of the field.
279
     * Allowed field types:
280
     *     
281
     *      - `com.atlassian.jira.plugin.system.customfieldtypes:multigrouppicker`
282
     *      - `com.atlassian.jira.plugin.system.customfieldtypes:grouppicker`
283
     *      - `com.atlassian.jira.plugin.system.customfieldtypes:select`
284
     *      - `com.atlassian.jira.plugin.system.customfieldtypes:multiselect`
285
     *      - `com.atlassian.jira.plugin.system.customfieldtypes:radiobuttons`
286
     *      - `com.atlassian.jira.plugin.system.customfieldtypes:multicheckboxes`
287
     *      - `com.pyxis.greenhopper.jira:gh-epic-status`
288
     * 
289
     * ##### User is in project role condition #####
290
     * 
291
     * A condition that allows users with a project role to execute a transition
292
     * 
293
     *     {
294
     *        "type": "InProjectRoleCondition",
295
     *        "configuration": {
296
     *          "projectRole": {
297
     *            "id": "10002"
298
     *          }
299
     *        }
300
     *      }
301
     * 
302
     *  - `projectRole` An object containing the ID of a project role
303
     * 
304
     * ##### Value field condition #####
305
     * 
306
     * A conditions that allows a transition to execute if the value of a field is equal to a constant value or simply set
307
     * 
308
     *     {
309
     *        "type": "ValueFieldCondition",
310
     *        "configuration": {
311
     *          "fieldId": "assignee",
312
     *          "fieldValue": "qm:6e1ecee6-8e64-4db6-8c85-916bb3275f51:54b56885-2bd2-4381-8239-78263442520f",
313
     *          "comparisonType": "NUMBER",
314
     *          "comparator": "="
315
     *        }
316
     *      }
317
     * 
318
     *  - `fieldId` The ID of a field used in the comparison
319
     *  - `fieldValue` The expected value of the field
320
     *  - `comparisonType` The type of the comparison.
321
     * Allowed values: `STRING`, `NUMBER`, `DATE`, `DATE_WITHOUT_TIME`, or `OPTIONID`
322
     *  - `comparator` One of the supported comparator: `>`, `>=`, `=`, `<=`, `<`, `!=`
323
     * 
324
     * **Notes:**
325
     * 
326
     *  - If you choose the comparison type `STRING`, only `=` and `!=` are valid options
327
     *  - You may leave `fieldValue` empty when comparison type is `!=` to indicate that a value is required in the field
328
     *  - For date fields without time format values as `yyyy-MM-dd`, and for those with time as `yyyy-MM-dd HH:mm`.
329
     * For example, for July 16 2021 use `2021-07-16`, for 8:05 AM use `2021-07-16 08:05`, and for 4 PM: `2021-07-16 16:00`
330
     * 
331
     * #### Validators ####
332
     * 
333
     * Validators check that any input made to the transition is valid before the transition is performed
334
     * 
335
     * ##### Date field validator #####
336
     * 
337
     * A validator that compares two dates
338
     * 
339
     *     {
340
     *        "type": "DateFieldValidator",
341
     *        "configuration": {
342
     *            "comparator": ">",
343
     *            "date1": "updated",
344
     *            "date2": "created",
345
     *            "expression": "1d",
346
     *            "includeTime": true
347
     *          }
348
     *      }
349
     * 
350
     *  - `comparator` One of the supported comparator: `>`, `>=`, `=`, `<=`, `<`, or `!=`
351
     *  - `date1` The date field to validate.
352
     * Allowed field types:
353
     *     
354
     *      - `com.atlassian.jira.plugin.system.customfieldtypes:datepicker`
355
     *      - `com.atlassian.jira.plugin.system.customfieldtypes:datetime`
356
     *      - `com.atlassian.jpo:jpo-custom-field-baseline-end`
357
     *      - `com.atlassian.jpo:jpo-custom-field-baseline-start`
358
     *      - `duedate`
359
     *      - `created`
360
     *      - `updated`
361
     *      - `resolutiondate`
362
     *  - `date2` The second date field.
363
     * Required, if `expression` is not passed.
364
     * Allowed field types:
365
     *     
366
     *      - `com.atlassian.jira.plugin.system.customfieldtypes:datepicker`
367
     *      - `com.atlassian.jira.plugin.system.customfieldtypes:datetime`
368
     *      - `com.atlassian.jpo:jpo-custom-field-baseline-end`
369
     *      - `com.atlassian.jpo:jpo-custom-field-baseline-start`
370
     *      - `duedate`
371
     *      - `created`
372
     *      - `updated`
373
     *      - `resolutiondate`
374
     *  - `expression` An expression specifying an offset.
375
     * Required, if `date2` is not passed.
376
     * Offsets are built with a number, with `-` as prefix for the past, and one of these time units: `d` for day, `w` for week, `m` for month, or `y` for year.
377
     * For example, -2d means two days into the past and 1w means one week into the future.
378
     * The `now` keyword enables a comparison with the current date
379
     *  - `includeTime` If `true`, then the time part of the data is included for the comparison.
380
     * If the field doesn't have a time part, 00:00:00 is used
381
     * 
382
     * ##### Windows date validator #####
383
     * 
384
     * A validator that checks that a date falls on or after a reference date and before or on the reference date plus a number of days
385
     * 
386
     *     {
387
     *        "type": "WindowsDateValidator",
388
     *        "configuration": {
389
     *            "date1": "customfield_10009",
390
     *            "date2": "created",
391
     *            "windowsDays": 5
392
     *          }
393
     *      }
394
     * 
395
     *  - `date1` The date field to validate.
396
     * Allowed field types:
397
     *     
398
     *      - `com.atlassian.jira.plugin.system.customfieldtypes:datepicker`
399
     *      - `com.atlassian.jira.plugin.system.customfieldtypes:datetime`
400
     *      - `com.atlassian.jpo:jpo-custom-field-baseline-end`
401
     *      - `com.atlassian.jpo:jpo-custom-field-baseline-start`
402
     *      - `duedate`
403
     *      - `created`
404
     *      - `updated`
405
     *      - `resolutiondate`
406
     *  - `date2` The reference date.
407
     * Allowed field types:
408
     *     
409
     *      - `com.atlassian.jira.plugin.system.customfieldtypes:datepicker`
410
     *      - `com.atlassian.jira.plugin.system.customfieldtypes:datetime`
411
     *      - `com.atlassian.jpo:jpo-custom-field-baseline-end`
412
     *      - `com.atlassian.jpo:jpo-custom-field-baseline-start`
413
     *      - `duedate`
414
     *      - `created`
415
     *      - `updated`
416
     *      - `resolutiondate`
417
     *  - `windowsDays` A positive integer indicating a number of days
418
     * 
419
     * ##### Field required validator #####
420
     * 
421
     * A validator that checks fields are not empty.
422
     * By default, if a field is not included in the current context it's ignored and not validated
423
     * 
424
     *     {
425
     *          "type": "FieldRequiredValidator",
426
     *          "configuration": {
427
     *              "ignoreContext": true,
428
     *              "errorMessage": "Hey",
429
     *              "fieldIds": [
430
     *                  "versions",
431
     *                  "customfield_10037",
432
     *                  "customfield_10003"
433
     *              ]
434
     *          }
435
     *      }
436
     * 
437
     *  - `ignoreContext` If `true`, then the context is ignored and all the fields are validated
438
     *  - `errorMessage` OPTIONAL.
439
     * The error message displayed when one or more fields are empty.
440
     * A default error message is shown if an error message is not provided
441
     *  - `fieldIds` The list of fields to validate
442
     * 
443
     * ##### Field changed validator #####
444
     * 
445
     * A validator that checks that a field value is changed.
446
     * However, this validation can be ignored for users from a list of groups
447
     * 
448
     *     {
449
     *          "type": "FieldChangedValidator",
450
     *          "configuration": {
451
     *              "fieldId": "comment",
452
     *              "errorMessage": "Hey",
453
     *              "exemptedGroups": [
454
     *                  "administrators",
455
     *                  "atlassian-addons-admin"
456
     *              ]
457
     *          }
458
     *      }
459
     * 
460
     *  - `fieldId` The ID of a field
461
     *  - `errorMessage` OPTIONAL.
462
     * The error message displayed if the field is not changed.
463
     * A default error message is shown if the error message is not provided
464
     *  - `exemptedGroups` OPTIONAL.
465
     * The list of groups
466
     * 
467
     * ##### Field has single value validator #####
468
     * 
469
     * A validator that checks that a multi-select field has only one value.
470
     * Optionally, the validation can ignore values copied from subtasks
471
     * 
472
     *     {
473
     *          "type": "FieldHasSingleValueValidator",
474
     *          "configuration": {
475
     *              "fieldId": "attachment,
476
     *              "excludeSubtasks": true
477
     *          }
478
     *      }
479
     * 
480
     *  - `fieldId` The ID of a field
481
     *  - `excludeSubtasks` If `true`, then values copied from subtasks are ignored
482
     * 
483
     * ##### Parent status validator #####
484
     * 
485
     * A validator that checks the status of the parent issue of a subtask.
486
     * ÃŒf the issue is not a subtask, no validation is performed
487
     * 
488
     *     {
489
     *          "type": "ParentStatusValidator",
490
     *          "configuration": {
491
     *              "parentStatuses": [
492
     *                  {
493
     *                    "id":"1"
494
     *                  },
495
     *                  {
496
     *                    "id":"2"
497
     *                  }
498
     *              ]
499
     *          }
500
     *      }
501
     * 
502
     *  - `parentStatus` The list of required parent issue statuses
503
     * 
504
     * ##### Permission validator #####
505
     * 
506
     * A validator that checks the user has a permission
507
     * 
508
     *     {
509
     *        "type": "PermissionValidator",
510
     *        "configuration": {
511
     *            "permissionKey": "ADMINISTER_PROJECTS"
512
     *        }
513
     *      }
514
     * 
515
     *  - `permissionKey` The permission required to perform the transition.
516
     * Allowed values: "built-in" or app defined permissions
517
     * 
518
     * ##### Previous status validator #####
519
     * 
520
     * A validator that checks if the issue has held a status
521
     * 
522
     *     {
523
     *        "type": "PreviousStatusValidator",
524
     *        "configuration": {
525
     *            "mostRecentStatusOnly": false,
526
     *            "previousStatus": {
527
     *                "id": "15"
528
     *            }
529
     *        }
530
     *      }
531
     * 
532
     *  - `mostRecentStatusOnly` If `true`, then only the issue's preceding status (the one immediately before the current status) is checked
533
     *  - `previousStatus` An object containing the ID of an issue status
534
     * 
535
     * ##### Regular expression validator #####
536
     * 
537
     * A validator that checks the content of a field against a regular expression
538
     * 
539
     *     {
540
     *        "type": "RegexpFieldValidator",
541
     *        "configuration": {
542
     *            "regExp": "[0-9]",
543
     *            "fieldId": "customfield_10029"
544
     *        }
545
     *      }
546
     * 
547
     *  - `regExp`A regular expression
548
     *  - `fieldId` The ID of a field.
549
     * Allowed field types:
550
     *     
551
     *      - `com.atlassian.jira.plugin.system.customfieldtypes:select`
552
     *      - `com.atlassian.jira.plugin.system.customfieldtypes:multiselect`
553
     *      - `com.atlassian.jira.plugin.system.customfieldtypes:radiobuttons`
554
     *      - `com.atlassian.jira.plugin.system.customfieldtypes:multicheckboxes`
555
     *      - `com.atlassian.jira.plugin.system.customfieldtypes:textarea`
556
     *      - `com.atlassian.jira.plugin.system.customfieldtypes:textfield`
557
     *      - `com.atlassian.jira.plugin.system.customfieldtypes:url`
558
     *      - `com.atlassian.jira.plugin.system.customfieldtypes:float`
559
     *      - `com.pyxis.greenhopper.jira:jsw-story-points`
560
     *      - `com.pyxis.greenhopper.jira:gh-epic-status`
561
     *      - `description`
562
     *      - `summary`
563
     * 
564
     * ##### User permission validator #####
565
     * 
566
     * A validator that checks if a user has a permission.
567
     * Obsolete.
568
     * You may encounter this validator when getting transition rules and can pass it when updating or creating rules, for example, when you want to duplicate the rules from a workflow on a new workflow
569
     * 
570
     *     {
571
     *          "type": "UserPermissionValidator",
572
     *          "configuration": {
573
     *              "permissionKey": "BROWSE_PROJECTS",
574
     *              "nullAllowed": false,
575
     *              "username": "TestUser"
576
     *          }
577
     *      }
578
     * 
579
     *  - `permissionKey` The permission to be validated.
580
     * Allowed values: "built-in" or app defined permissions
581
     *  - `nullAllowed` If `true`, allows the transition when `username` is empty
582
     *  - `username` The username to validate against the `permissionKey`
583
     * 
584
     * #### Post functions ####
585
     * 
586
     * Post functions carry out any additional processing required after a Jira workflow transition is executed
587
     * 
588
     * ##### Fire issue event function #####
589
     * 
590
     * A post function that fires an event that is processed by the listeners
591
     * 
592
     *     {
593
     *        "type": "FireIssueEventFunction",
594
     *        "configuration": {
595
     *          "event": {
596
     *            "id":"1"
597
     *          }
598
     *        }
599
     *      }
600
     * 
601
     * **Note:** If provided, this post function overrides the default `FireIssueEventFunction`.
602
     * Can be included once in a transition
603
     * 
604
     *  - `event` An object containing the ID of the issue event
605
     * 
606
     * ##### Update issue status #####
607
     * 
608
     * A post function that sets issue status to the linked status of the destination workflow status
609
     * 
610
     *     {
611
     *        "type": "UpdateIssueStatusFunction"
612
     *      }
613
     * 
614
     * **Note:** This post function is a default function in global and directed transitions.
615
     * It can only be added to the initial transition and can only be added once
616
     * 
617
     * ##### Create comment #####
618
     * 
619
     * A post function that adds a comment entered during the transition to an issue
620
     * 
621
     *     {
622
     *        "type": "CreateCommentFunction"
623
     *      }
624
     * 
625
     * **Note:** This post function is a default function in global and directed transitions.
626
     * It can only be added to the initial transition and can only be added once
627
     * 
628
     * ##### Store issue #####
629
     * 
630
     * A post function that stores updates to an issue
631
     * 
632
     *     {
633
     *        "type": "IssueStoreFunction"
634
     *      }
635
     * 
636
     * **Note:** This post function can only be added to the initial transition and can only be added once
637
     * 
638
     * ##### Assign to current user function #####
639
     * 
640
     * A post function that assigns the issue to the current user if the current user has the `ASSIGNABLE_USER` permission
641
     * 
642
     *     {
643
     *          "type": "AssignToCurrentUserFunction"
644
     *      }
645
     * 
646
     * **Note:** This post function can be included once in a transition
647
     * 
648
     * ##### Assign to lead function #####
649
     * 
650
     * A post function that assigns the issue to the project or component lead developer
651
     * 
652
     *     {
653
     *          "type": "AssignToLeadFunction"
654
     *      }
655
     * 
656
     * **Note:** This post function can be included once in a transition
657
     * 
658
     * ##### Assign to reporter function #####
659
     * 
660
     * A post function that assigns the issue to the reporter
661
     * 
662
     *     {
663
     *          "type": "AssignToReporterFunction"
664
     *      }
665
     * 
666
     * **Note:** This post function can be included once in a transition
667
     * 
668
     * ##### Clear field value function #####
669
     * 
670
     * A post function that clears the value from a field
671
     * 
672
     *     {
673
     *        "type": "ClearFieldValuePostFunction",
674
     *        "configuration": {
675
     *          "fieldId": "assignee"
676
     *        }
677
     *      }
678
     * 
679
     *  - `fieldId` The ID of the field
680
     * 
681
     * ##### Copy value from other field function #####
682
     * 
683
     * A post function that copies the value of one field to another, either within an issue or from parent to subtask
684
     * 
685
     *     {
686
     *        "type": "CopyValueFromOtherFieldPostFunction",
687
     *        "configuration": {
688
     *          "sourceFieldId": "assignee",
689
     *          "destinationFieldId": "creator",
690
     *          "copyType": "same"
691
     *        }
692
     *      }
693
     * 
694
     *  - `sourceFieldId` The ID of the source field
695
     *  - `destinationFieldId` The ID of the destination field
696
     *  - `copyType` Use `same` to copy the value from a field inside the issue, or `parent` to copy the value from the parent issue
697
     * 
698
     * ##### Create Crucible review workflow function (deprecated) #####
699
     * 
700
     * A post function that creates a Crucible review for all unreviewed code for the issue
701
     * 
702
     *     {
703
     *          "type": "CreateCrucibleReviewWorkflowFunction"
704
     *      }
705
     * 
706
     * **Note:** This post function can be included once in a transition
707
     * 
708
     * ##### Set issue security level based on user's project role function #####
709
     * 
710
     * A post function that sets the issue's security level if the current user has a project role
711
     * 
712
     *     {
713
     *        "type": "SetIssueSecurityFromRoleFunction",
714
     *        "configuration": {
715
     *          "projectRole": {
716
     *              "id":"10002"
717
     *          },
718
     *          "issueSecurityLevel": {
719
     *              "id":"10000"
720
     *          }
721
     *        }
722
     *      }
723
     * 
724
     *  - `projectRole` An object containing the ID of the project role
725
     *  - `issueSecurityLevel` OPTIONAL.
726
     * The object containing the ID of the security level.
727
     * If not passed, then the security level is set to `none`
728
     * 
729
     * ##### Trigger a webhook function #####
730
     * 
731
     * A post function that triggers a webhook
732
     * 
733
     *     {
734
     *        "type": "TriggerWebhookFunction",
735
     *        "configuration": {
736
     *          "webhook": {
737
     *            "id": "1"
738
     *          }
739
     *        }
740
     *      }
741
     * 
742
     *  - `webhook` An object containing the ID of the webhook listener to trigger
743
     * 
744
     * ##### Update issue custom field function #####
745
     * 
746
     * A post function that updates the content of an issue custom field
747
     * 
748
     *     {
749
     *        "type": "UpdateIssueCustomFieldPostFunction",
750
     *        "configuration": {
751
     *          "mode": "append",
752
     *          "fieldId": "customfield_10003",
753
     *          "fieldValue": "yikes"
754
     *        }
755
     *      }
756
     * 
757
     *  - `mode` Use `replace` to override the field content with `fieldValue` or `append` to add `fieldValue` to the end of the field content
758
     *  - `fieldId` The ID of the field
759
     *  - `fieldValue` The update content
760
     * 
761
     * ##### Update issue field function #####
762
     * 
763
     * A post function that updates a simple issue field
764
     * 
765
     *     {
766
     *        "type": "UpdateIssueFieldFunction",
767
     *        "configuration": {
768
     *          "fieldId": "assignee",
769
     *          "fieldValue": "5f0c277e70b8a90025a00776"
770
     *        }
771
     *      }
772
     * 
773
     *  - `fieldId` The ID of the field.
774
     * Allowed field types:
775
     *     
776
     *      - `assignee`
777
     *      - `description`
778
     *      - `environment`
779
     *      - `priority`
780
     *      - `resolution`
781
     *      - `summary`
782
     *      - `timeoriginalestimate`
783
     *      - `timeestimate`
784
     *      - `timespent`
785
     *  - `fieldValue` The update value
786
     *  - If the `fieldId` is `assignee`, the `fieldValue` should be one of these values:
787
     *     
788
     *      - an account ID
789
     *      - `automatic`
790
     *      - a blank string, which sets the value to `unassigned`
791
     * 
792
     * #### Connect rules ####
793
     * 
794
     * Connect rules are conditions, validators, and post functions of a transition that are registered by Connect apps.
795
     * To create a rule registered by the app, the app must be enabled and the rule's module must exist
796
     * 
797
     *     {
798
     *        "type": "appKey__moduleKey",
799
     *        "configuration": {
800
     *          "value":"{\"isValid\":\"true\"}"
801
     *        }
802
     *      }
803
     * 
804
     *  - `type` A Connect rule key in a form of `appKey__moduleKey`
805
     *  - `value` The stringified JSON configuration of a Connect rule
806
     * 
807
     * #### Forge rules ####
808
     * 
809
     * Forge transition rules are not yet supported
810
     * 
811
     * **"Permissions" required:** *Administer Jira* "global permission".
812
     * 
813
     * @link https://developer.atlassian.com/cloud/jira/platform/rest/v3/api-group-workflows/#api-rest-api-3-workflows-create-post
814
     * @link https://developer.atlassian.com/cloud/jira/platform/rest/v3/api-group-permission-schemes/#built-in-permissions
815
     * @link https://confluence.atlassian.com/x/x4dKLg
816
     */
817
    public function createWorkflow(
×
818
        Schema\CreateWorkflowDetails $request,
819
    ): Schema\WorkflowIDs {
820
        return $this->call(
×
821
            uri: '/rest/api/3/workflow',
×
822
            method: 'post',
×
823
            body: $request,
×
824
            success: 201,
×
825
            schema: Schema\WorkflowIDs::class,
×
826
        );
×
827
    }
828

829
    /**
830
     * Returns a "paginated" list of published classic workflows.
831
     * When workflow names are specified, details of those workflows are returned.
832
     * Otherwise, all published classic workflows are returned
833
     * 
834
     * This operation does not return next-gen workflows
835
     * 
836
     * **"Permissions" required:** *Administer Jira* "global permission".
837
     * 
838
     * @link https://confluence.atlassian.com/x/x4dKLg
839
     * 
840
     * @param int $startAt The index of the first item to return in a page of results (page offset).
841
     * @param int $maxResults The maximum number of items to return per page.
842
     * @param ?list<string> $workflowName The name of a workflow to return.
843
     *                                    To include multiple workflows, provide an ampersand-separated list.
844
     *                                    For example, `workflowName=name1&workflowName=name2`.
845
     * @param string $expand Use "expand" to include additional information in the response.
846
     *                       This parameter accepts a comma-separated list.
847
     *                       Expand options include:
848
     *                        - `transitions` For each workflow, returns information about the transitions inside the workflow
849
     *                        - `transitions.rules` For each workflow transition, returns information about its rules.
850
     *                       Transitions are included automatically if this expand is requested
851
     *                        - `transitions.properties` For each workflow transition, returns information about its properties.
852
     *                       Transitions are included automatically if this expand is requested
853
     *                        - `statuses` For each workflow, returns information about the statuses inside the workflow
854
     *                        - `statuses.properties` For each workflow status, returns information about its properties.
855
     *                       Statuses are included automatically if this expand is requested
856
     *                        - `default` For each workflow, returns information about whether this is the default workflow
857
     *                        - `schemes` For each workflow, returns information about the workflow schemes the workflow is assigned to
858
     *                        - `projects` For each workflow, returns information about the projects the workflow is assigned to, through workflow schemes
859
     *                        - `hasDraftWorkflow` For each workflow, returns information about whether the workflow has a draft version
860
     *                        - `operations` For each workflow, returns information about the actions that can be undertaken on the workflow.
861
     * @param string $queryString String used to perform a case-insensitive partial match with workflow name.
862
     * @param 'name'|'-name'|'+name'|'created'|'-created'|'+created'|'updated'|'+updated'|'-updated'|null $orderBy
863
     *        "Order" the results by a field:
864
     *         - `name` Sorts by workflow name
865
     *         - `created` Sorts by create time
866
     *         - `updated` Sorts by update time.
867
     * @param bool $isActive Filters active and inactive workflows.
868
     */
869
    public function getWorkflowsPaginated(
×
870
        ?int $startAt = 0,
871
        ?int $maxResults = 50,
872
        ?array $workflowName = null,
873
        ?string $expand = null,
874
        ?string $queryString = null,
875
        ?string $orderBy = null,
876
        ?bool $isActive = null,
877
    ): Schema\PageBeanWorkflow {
878
        return $this->call(
×
879
            uri: '/rest/api/3/workflow/search',
×
880
            method: 'get',
×
881
            query: compact('startAt', 'maxResults', 'workflowName', 'expand', 'queryString', 'orderBy', 'isActive'),
×
882
            success: 200,
×
883
            schema: Schema\PageBeanWorkflow::class,
×
884
        );
×
885
    }
886

887
    /**
888
     * Deletes a workflow
889
     * 
890
     * The workflow cannot be deleted if it is:
891
     * 
892
     *  - an active workflow
893
     *  - a system workflow
894
     *  - associated with any workflow scheme
895
     *  - associated with any draft workflow scheme
896
     * 
897
     * **"Permissions" required:** *Administer Jira* "global permission".
898
     * 
899
     * @link https://confluence.atlassian.com/x/x4dKLg
900
     * 
901
     * @param string $entityId The entity ID of the workflow.
902
     */
903
    public function deleteInactiveWorkflow(
×
904
        string $entityId,
905
    ): true {
906
        return $this->call(
×
907
            uri: '/rest/api/3/workflow/{entityId}',
×
908
            method: 'delete',
×
909
            path: compact('entityId'),
×
910
            success: 204,
×
911
            schema: true,
×
912
        );
×
913
    }
914

915
    /**
916
     * Returns a page of issue types using a given workflow within a project.
917
     * 
918
     * @param string $workflowId The workflow ID
919
     * @param int $projectId The project ID
920
     * @param string $nextPageToken The cursor for pagination
921
     * @param int $maxResults The maximum number of results to return.
922
     *                        Must be an integer between 1 and 200.
923
     */
924
    public function getWorkflowProjectIssueTypeUsages(
×
925
        string $workflowId,
926
        int $projectId,
927
        ?string $nextPageToken = null,
928
        ?int $maxResults = 50,
929
    ): Schema\WorkflowProjectIssueTypeUsageDTO {
930
        return $this->call(
×
931
            uri: '/rest/api/3/workflow/{workflowId}/project/{projectId}/issueTypeUsages',
×
932
            method: 'get',
×
933
            query: compact('nextPageToken', 'maxResults'),
×
934
            path: compact('workflowId', 'projectId'),
×
935
            success: 200,
×
936
            schema: Schema\WorkflowProjectIssueTypeUsageDTO::class,
×
937
        );
×
938
    }
939

940
    /**
941
     * Returns a page of projects using a given workflow.
942
     * 
943
     * @param string $workflowId The workflow ID
944
     * @param string $nextPageToken The cursor for pagination
945
     * @param int $maxResults The maximum number of results to return.
946
     *                        Must be an integer between 1 and 200.
947
     */
948
    public function getProjectUsagesForWorkflow(
×
949
        string $workflowId,
950
        ?string $nextPageToken = null,
951
        ?int $maxResults = 50,
952
    ): Schema\WorkflowProjectUsageDTO {
953
        return $this->call(
×
954
            uri: '/rest/api/3/workflow/{workflowId}/projectUsages',
×
955
            method: 'get',
×
956
            query: compact('nextPageToken', 'maxResults'),
×
957
            path: compact('workflowId'),
×
958
            success: 200,
×
959
            schema: Schema\WorkflowProjectUsageDTO::class,
×
960
        );
×
961
    }
962

963
    /**
964
     * Returns a page of workflow schemes using a given workflow.
965
     * 
966
     * @param string $workflowId The workflow ID
967
     * @param string $nextPageToken The cursor for pagination
968
     * @param int $maxResults The maximum number of results to return.
969
     *                        Must be an integer between 1 and 200.
970
     */
971
    public function getWorkflowSchemeUsagesForWorkflow(
×
972
        string $workflowId,
973
        ?string $nextPageToken = null,
974
        ?int $maxResults = 50,
975
    ): Schema\WorkflowSchemeUsageDTO {
976
        return $this->call(
×
977
            uri: '/rest/api/3/workflow/{workflowId}/workflowSchemes',
×
978
            method: 'get',
×
979
            query: compact('nextPageToken', 'maxResults'),
×
980
            path: compact('workflowId'),
×
981
            success: 200,
×
982
            schema: Schema\WorkflowSchemeUsageDTO::class,
×
983
        );
×
984
    }
985

986
    /**
987
     * Returns a list of workflows and related statuses by providing workflow names, workflow IDs, or project and issue types
988
     * 
989
     * **"Permissions" required:**
990
     * 
991
     *  - *Administer Jira* global permission to access all, including project-scoped, workflows
992
     *  - At least one of the *Administer projects* and *View (read-only) workflow* project permissions to access project-scoped workflows
993
     * 
994
     * @param string $expand Deprecated.
995
     *                       See the "deprecation notice" for details
996
     *                       Use "expand" to include additional information in the response.
997
     *                       This parameter accepts a comma-separated list.
998
     *                       Expand options include:
999
     *                        - `workflows.usages` Returns the project and issue types that each workflow is associated with
1000
     *                        - `statuses.usages` Returns the project and issue types that each status is associated with.
1001
     *                       @link https://developer.atlassian.com/cloud/jira/platform/changelog/#CHANGE-2298
1002
     * @param bool $useTransitionLinksFormat Return the new fields (`toStatusReference`/`links`) instead of the deprecated fields (`to`/`from`) for workflow transition port mappings.
1003
     * @param bool $useApprovalConfiguration Return the new field `approvalConfiguration` instead of the deprecated status properties for approval configuration.
1004
     */
1005
    public function readWorkflows(
×
1006
        Schema\WorkflowReadRequest $request,
1007
        ?string $expand = null,
1008
        ?bool $useTransitionLinksFormat = false,
1009
        ?bool $useApprovalConfiguration = false,
1010
    ): Schema\WorkflowReadResponse {
1011
        return $this->call(
×
1012
            uri: '/rest/api/3/workflows',
×
1013
            method: 'post',
×
1014
            body: $request,
×
1015
            query: compact('expand', 'useTransitionLinksFormat', 'useApprovalConfiguration'),
×
1016
            success: 200,
×
1017
            schema: Schema\WorkflowReadResponse::class,
×
1018
        );
×
1019
    }
1020

1021
    /**
1022
     * Get the list of workflow capabilities for a specific workflow using either the workflow ID, or the project and issue type ID pair.
1023
     * The response includes the scope of the workflow, defined as global/project-based, and a list of project types that the workflow is scoped to.
1024
     * It also includes all rules organised into their broad categories (conditions, validators, actions, triggers, screens) as well as the source location (Atlassian-provided, Connect, Forge)
1025
     * 
1026
     * **"Permissions" required:**
1027
     * 
1028
     *  - *Administer Jira* project permission to access all, including global-scoped, workflows
1029
     *  - *Administer projects* project permissions to access project-scoped workflows
1030
     * 
1031
     * The current list of Atlassian-provided rules:
1032
     * 
1033
     * #### Validators ####
1034
     * 
1035
     * A validator rule that checks if a user has the required permissions to execute the transition in the workflow
1036
     * 
1037
     * ##### Permission validator #####
1038
     * 
1039
     * A validator rule that checks if a user has the required permissions to execute the transition in the workflow
1040
     * 
1041
     *     {
1042
     *        "ruleKey": "system:check-permission-validator",
1043
     *        "parameters": {
1044
     *          "permissionKey": "ADMINISTER_PROJECTS"
1045
     *        }
1046
     *      }
1047
     * 
1048
     * Parameters:
1049
     * 
1050
     *  - `permissionKey` The permission required to perform the transition.
1051
     * Allowed values: "built-in Jira permissions"
1052
     * 
1053
     * ##### Parent or child blocking validator #####
1054
     * 
1055
     * A validator to block the child issue's transition depending on the parent issue's status
1056
     * 
1057
     *     {
1058
     *        "ruleKey" : "system:parent-or-child-blocking-validator"
1059
     *        "parameters" : {
1060
     *          "blocker" : "PARENT"
1061
     *          "statusIds" : "1,2,3"
1062
     *        }
1063
     *      }
1064
     * 
1065
     * Parameters:
1066
     * 
1067
     *  - `blocker` currently only supports `PARENT`
1068
     *  - `statusIds` a comma-separated list of status IDs
1069
     * 
1070
     * ##### Previous status validator #####
1071
     * 
1072
     * A validator that checks if an issue has transitioned through specified previous status(es) before allowing the current transition to occur
1073
     * 
1074
     *     {
1075
     *        "ruleKey": "system:previous-status-validator",
1076
     *        "parameters": {
1077
     *          "previousStatusIds": "10014",
1078
     *          "mostRecentStatusOnly": "true"
1079
     *        }
1080
     *      }
1081
     * 
1082
     * Parameters:
1083
     * 
1084
     *  - `previousStatusIds` a comma-separated list of status IDs, currently only support one ID
1085
     *  - `mostRecentStatusOnly` when `true` only considers the most recent status for the condition evaluation.
1086
     * Allowed values: `true`, `false`
1087
     * 
1088
     * ##### Validate a field value #####
1089
     * 
1090
     * A validation that ensures a specific field's value meets the defined criteria before allowing an issue to transition in the workflow
1091
     * 
1092
     * Depending on the rule type, the result will vary:
1093
     * 
1094
     * ###### Field required ######
1095
     * 
1096
     *     {
1097
     *        "ruleKey": "system:validate-field-value",
1098
     *        "parameters": {
1099
     *          "ruleType": "fieldRequired",
1100
     *          "fieldsRequired": "assignee",
1101
     *          "ignoreContext": "true",
1102
     *          "errorMessage": "An assignee must be set!"
1103
     *        }
1104
     *      }
1105
     * 
1106
     * Parameters:
1107
     * 
1108
     *  - `fieldsRequired` the ID of the field that is required.
1109
     * For a custom field, it would look like `customfield_123`
1110
     *  - `ignoreContext` controls the impact of context settings on field validation.
1111
     * When set to `true`, the validator doesn't check a required field if its context isn't configured for the current issue.
1112
     * When set to `false`, the validator requires a field even if its context is invalid.
1113
     * Allowed values: `true`, `false`
1114
     *  - `errorMessage` is the error message to display if the user does not provide a value during the transition.
1115
     * A default error message will be shown if you don't provide one (Optional)
1116
     * 
1117
     * ###### Field changed ######
1118
     * 
1119
     *     {
1120
     *        "ruleKey": "system:validate-field-value",
1121
     *        "parameters": {
1122
     *          "ruleType": "fieldChanged",
1123
     *          "groupsExemptFromValidation": "6862ac20-8672-4f68-896d-4854f5efb79e",
1124
     *          "fieldKey": "versions",
1125
     *          "errorMessage": "Affect versions must be modified before transition"
1126
     *        }
1127
     *      }
1128
     * 
1129
     * Parameters:
1130
     * 
1131
     *  - `groupsExemptFromValidation` a comma-separated list of group IDs to be exempt from the validation
1132
     *  - `fieldKey` the ID of the field that has changed.
1133
     * For a custom field, it would look like `customfield_123`
1134
     *  - `errorMessage` the error message to display if the user does not provide a value during the transition.
1135
     * A default error message will be shown if you don't provide one (Optional)
1136
     * 
1137
     * ###### Field has a single value ######
1138
     * 
1139
     *     {
1140
     *        "ruleKey": "system:validate-field-value",
1141
     *        "parameters": {
1142
     *          "ruleType": "fieldHasSingleValue",
1143
     *          "fieldKey": "created",
1144
     *          "excludeSubtasks": "true"
1145
     *        }
1146
     *      }
1147
     * 
1148
     * Parameters:
1149
     * 
1150
     *  - `fieldKey` the ID of the field to validate.
1151
     * For a custom field, it would look like `customfield_123`
1152
     *  - `excludeSubtasks` Option to exclude values copied from sub-tasks.
1153
     * Allowed values: `true`, `false`
1154
     * 
1155
     * ###### Field matches regular expression ######
1156
     * 
1157
     *     {
1158
     *        "ruleKey": "system:validate-field-value",
1159
     *        "parameters": {
1160
     *          "ruleType": "fieldMatchesRegularExpression",
1161
     *          "regexp": "[0-9]{4}",
1162
     *          "fieldKey": "description"
1163
     *        }
1164
     *      }
1165
     * 
1166
     * Parameters:
1167
     * 
1168
     *  - `regexp` the regular expression used to validate the field\\u2019s content
1169
     *  - `fieldKey` the ID of the field to validate.
1170
     * For a custom field, it would look like `customfield_123`
1171
     * 
1172
     * ###### Date field comparison ######
1173
     * 
1174
     *     {
1175
     *        "ruleKey": "system:validate-field-value",
1176
     *        "parameters": {
1177
     *          "ruleType": "dateFieldComparison",
1178
     *          "date1FieldKey": "duedate",
1179
     *          "date2FieldKey": "customfield_10054",
1180
     *          "includeTime": "true",
1181
     *          "conditionSelected": ">="
1182
     *        }
1183
     *      }
1184
     * 
1185
     * Parameters:
1186
     * 
1187
     *  - `date1FieldKey` the ID of the first field to compare.
1188
     * For a custom field, it would look like `customfield_123`
1189
     *  - `date2FieldKey` the ID of the second field to compare.
1190
     * For a custom field, it would look like `customfield_123`
1191
     *  - `includeTime` if `true`, compares both date and time.
1192
     * Allowed values: `true`, `false`
1193
     *  - `conditionSelected` the condition to compare with.
1194
     * Allowed values: `>`, `>=`, `=`, `<=`, `<`, `!=`
1195
     * 
1196
     * ###### Date range comparison ######
1197
     * 
1198
     *     {
1199
     *        "ruleKey": "system:validate-field-value",
1200
     *        "parameters": {
1201
     *          "ruleType": "windowDateComparison",
1202
     *          "date1FieldKey": "customfield_10009",
1203
     *          "date2FieldKey": "customfield_10054",
1204
     *          "numberOfDays": "3"
1205
     *        }
1206
     *      }
1207
     * 
1208
     * Parameters:
1209
     * 
1210
     *  - `date1FieldKey` the ID of the first field to compare.
1211
     * For a custom field, it would look like `customfield_123`
1212
     *  - `date2FieldKey` the ID of the second field to compare.
1213
     * For a custom field, it would look like `customfield_123`
1214
     *  - `numberOfDays` maximum number of days past the reference date (`date2FieldKey`) to pass validation
1215
     * 
1216
     * This rule is composed by aggregating the following legacy rules:
1217
     * 
1218
     *  - FieldRequiredValidator
1219
     *  - FieldChangedValidator
1220
     *  - FieldHasSingleValueValidator
1221
     *  - RegexpFieldValidator
1222
     *  - DateFieldValidator
1223
     *  - WindowsDateValidator
1224
     * 
1225
     * ##### Proforma: Forms attached validator #####
1226
     * 
1227
     * Validates that one or more forms are attached to the issue
1228
     * 
1229
     *     {
1230
     *        "ruleKey" : "system:proforma-forms-attached"
1231
     *        "parameters" : {}
1232
     *      }
1233
     * 
1234
     * ##### Proforma: Forms submitted validator #####
1235
     * 
1236
     * Validates that all forms attached to the issue have been submitted
1237
     * 
1238
     *     {
1239
     *        "ruleKey" : "system:proforma-forms-submitted"
1240
     *        "parameters" : {}
1241
     *      }
1242
     * 
1243
     * #### Conditions ####
1244
     * 
1245
     * Conditions enable workflow rules that govern whether a transition can execute
1246
     * 
1247
     * ##### Check field value #####
1248
     * 
1249
     * A condition rule evaluates as true if a specific field's value meets the defined criteria.
1250
     * This rule ensures that an issue can only transition to the next step in the workflow if the field's value matches the desired condition
1251
     * 
1252
     *     {
1253
     *        "ruleKey": "system:check-field-value",
1254
     *        "parameters": {
1255
     *          "fieldId": "description",
1256
     *          "fieldValue": "[\"Done\"]",
1257
     *          "comparator": "=",
1258
     *          "comparisonType": "STRING"
1259
     *        }
1260
     *      }
1261
     * 
1262
     * Parameters:
1263
     * 
1264
     *  - `fieldId` The ID of the field to check the value of.
1265
     * For non-system fields, it will look like `customfield_123`.
1266
     * Note: `fieldId` is used interchangeably with the idea of `fieldKey` here, they refer to the same field
1267
     *  - `fieldValue` the list of values to check against the field\\u2019s value
1268
     *  - `comparator` The comparison logic.
1269
     * Allowed values: `>`, `>=`, `=`, `<=`, `<`, `!=`
1270
     *  - `comparisonType` The type of data being compared.
1271
     * Allowed values: `STRING`, `NUMBER`, `DATE`, `DATE_WITHOUT_TIME`, `OPTIONID`
1272
     * 
1273
     * ##### Restrict issue transition #####
1274
     * 
1275
     * This rule ensures that issue transitions are restricted based on user accounts, roles, group memberships, and permissions, maintaining control over who can transition an issue.
1276
     * This condition evaluates as `true` if any of the following criteria is met
1277
     * 
1278
     *     {
1279
     *        "ruleKey": "system:restrict-issue-transition",
1280
     *        "parameters": {
1281
     *          "accountIds": "allow-reporter,5e68ac137d64450d01a77fa0",
1282
     *          "roleIds": "10002,10004",
1283
     *          "groupIds": "703ff44a-7dc8-4f4b-9aa6-a65bf3574fa4",
1284
     *          "permissionKeys": "ADMINISTER_PROJECTS",
1285
     *          "groupCustomFields": "customfield_10028",
1286
     *          "allowUserCustomFields": "customfield_10072,customfield_10144,customfield_10007",
1287
     *          "denyUserCustomFields": "customfield_10107"
1288
     *        }
1289
     *      }
1290
     * 
1291
     * Parameters:
1292
     * 
1293
     *  - `accountIds` a comma-separated list of the user account IDs.
1294
     * It also allows generic values like: `allow-assignee`, `allow-reporter`, and `accountIds` Note: This is only supported in team-managed projects
1295
     *  - `roleIds` a comma-separated list of role IDs
1296
     *  - `groupIds` a comma-separated list of group IDs
1297
     *  - `permissionKeys` a comma-separated list of permission keys.
1298
     * Allowed values: "built-in Jira permissions"
1299
     *  - `groupCustomFields` a comma-separated list of group custom field IDs
1300
     *  - `allowUserCustomFields` a comma-separated list of user custom field IDs to allow for issue transition
1301
     *  - `denyUserCustomFields` a comma-separated list of user custom field IDs to deny for issue transition
1302
     * 
1303
     * This rule is composed by aggregating the following legacy rules:
1304
     * 
1305
     *  - AllowOnlyAssignee
1306
     *  - AllowOnlyReporter
1307
     *  - InAnyProjectRoleCondition
1308
     *  - InProjectRoleCondition
1309
     *  - UserInAnyGroupCondition
1310
     *  - UserInGroupCondition
1311
     *  - PermissionCondtion
1312
     *  - InGroupCFCondition
1313
     *  - UserIsInCustomFieldCondition
1314
     * 
1315
     * ##### Previous status condition #####
1316
     * 
1317
     * A condition that evaluates based on an issue's previous status(es) and specific criteria
1318
     * 
1319
     *     {
1320
     *        "ruleKey" : "system:previous-status-condition"
1321
     *        "parameters" : {
1322
     *          "previousStatusIds" : "10004",
1323
     *          "not": "true",
1324
     *          "mostRecentStatusOnly" : "true",
1325
     *          "includeCurrentStatus": "true",
1326
     *          "ignoreLoopTransitions": "true"
1327
     *        }
1328
     *      }
1329
     * 
1330
     * Parameters:
1331
     * 
1332
     *  - `previousStatusIds` a comma-separated list of status IDs, current only support one ID
1333
     *  - `not` indicates if the condition should be reversed.
1334
     * When `true` it checks that the issue has not been in the selected statuses.
1335
     * Allowed values: `true`, `false`
1336
     *  - `mostRecentStatusOnly` when true only considers the most recent status for the condition evaluation.
1337
     * Allowed values: `true`, `false`
1338
     *  - `includeCurrentStatus` includes the current status when evaluating if the issue has been through the selected statuses.
1339
     * Allowed values: `true`, `false`
1340
     *  - `ignoreLoopTransitions` ignore loop transitions.
1341
     * Allowed values: `true`, `false`
1342
     * 
1343
     * ##### Parent or child blocking condition #####
1344
     * 
1345
     * A condition to block the parent\\u2019s issue transition depending on the child\\u2019s issue status
1346
     * 
1347
     *     {
1348
     *        "ruleKey" : "system:parent-or-child-blocking-condition"
1349
     *        "parameters" : {
1350
     *          "blocker" : "CHILD",
1351
     *          "statusIds" : "1,2,3"
1352
     *        }
1353
     *      }
1354
     * 
1355
     * Parameters:
1356
     * 
1357
     *  - `blocker` currently only supports `CHILD`
1358
     *  - `statusIds` a comma-separated list of status IDs
1359
     * 
1360
     * ##### Separation of duties #####
1361
     * 
1362
     * A condition preventing the user from performing, if the user has already performed a transition on the issue
1363
     * 
1364
     *     {
1365
     *        "ruleKey": "system:separation-of-duties",
1366
     *        "parameters": {
1367
     *          "fromStatusId": "10161",
1368
     *          "toStatusId": "10160"
1369
     *        }
1370
     *      }
1371
     * 
1372
     * Parameters:
1373
     * 
1374
     *  - `fromStatusId` represents the status ID from which the issue is transitioning.
1375
     * It ensures that the user performing the current transition has not performed any actions when the issue was in the specified status
1376
     *  - `toStatusId` represents the status ID to which the issue is transitioning.
1377
     * It ensures that the user performing the current transition is not the same user who has previously transitioned the issue
1378
     * 
1379
     * ##### Restrict transitions #####
1380
     * 
1381
     * A condition preventing all users from transitioning the issue can also optionally include APIs as well
1382
     * 
1383
     *     {
1384
     *        "ruleKey": "system:restrict-from-all-users",
1385
     *        "parameters": {
1386
     *          "restrictMode": "users"
1387
     *        }
1388
     *      }
1389
     * 
1390
     * Parameters:
1391
     * 
1392
     *  - `restrictMode` restricts the issue transition including/excluding APIs.
1393
     * Allowed values: `"users"`, `"usersAndAPI"`
1394
     * 
1395
     * ##### Jira Service Management block until approved #####
1396
     * 
1397
     * Block an issue transition until approval.
1398
     * Note: This is only supported in team-managed projects
1399
     * 
1400
     *     {
1401
     *        "ruleKey": "system:jsd-approvals-block-until-approved",
1402
     *        "parameters": {
1403
     *          "approvalConfigurationJson": "{"statusExternalUuid...}"
1404
     *        }
1405
     *      }
1406
     * 
1407
     * Parameters:
1408
     * 
1409
     *  - `approvalConfigurationJson` a stringified JSON holding the Jira Service Management approval configuration
1410
     * 
1411
     * ##### Jira Service Management block until rejected #####
1412
     * 
1413
     * Block an issue transition until rejected.
1414
     * Note: This is only supported in team-managed projects
1415
     * 
1416
     *     {
1417
     *        "ruleKey": "system:jsd-approvals-block-until-rejected",
1418
     *        "parameters": {
1419
     *          "approvalConfigurationJson": "{"statusExternalUuid...}"
1420
     *        }
1421
     *      }
1422
     * 
1423
     * Parameters:
1424
     * 
1425
     *  - `approvalConfigurationJson` a stringified JSON holding the Jira Service Management approval configuration
1426
     * 
1427
     * ##### Block in progress approval #####
1428
     * 
1429
     * Condition to block issue transition if there is pending approval.
1430
     * Note: This is only supported in company-managed projects
1431
     * 
1432
     *     {
1433
     *        "ruleKey": "system:block-in-progress-approval",
1434
     *        "parameters": {}
1435
     *      }
1436
     * 
1437
     * #### Post functions ####
1438
     * 
1439
     * Post functions carry out any additional processing required after a workflow transition is executed
1440
     * 
1441
     * ##### Change assignee #####
1442
     * 
1443
     * A post function rule that changes the assignee of an issue after a transition
1444
     * 
1445
     *     {
1446
     *        "ruleKey": "system:change-assignee",
1447
     *        "parameters": {
1448
     *          "type": "to-selected-user",
1449
     *          "accountId": "example-account-id"
1450
     *        }
1451
     *      }
1452
     * 
1453
     * Parameters:
1454
     * 
1455
     *  - `type` the parameter used to determine the new assignee.
1456
     * Allowed values: `to-selected-user`, `to-unassigned`, `to-current-user`, `to-current-user`, `to-default-user`, `to-default-user`
1457
     *  - `accountId` the account ID of the user to assign the issue to.
1458
     * This parameter is required only when the type is `"to-selected-user"`
1459
     * 
1460
     * ##### Copy field value #####
1461
     * 
1462
     * A post function that automates the process of copying values between fields during a specific transition, ensuring data consistency and reducing manual effort
1463
     * 
1464
     *     {
1465
     *        "ruleKey": "system:copy-value-from-other-field",
1466
     *        "parameters": {
1467
     *          "sourceFieldKey": "description",
1468
     *          "targetFieldKey": "components",
1469
     *          "issueSource": "SAME"
1470
     *        }
1471
     *      }
1472
     * 
1473
     * Parameters:
1474
     * 
1475
     *  - `sourceFieldKey` the field key to copy from.
1476
     * For a custom field, it would look like `customfield_123`
1477
     *  - `targetFieldKey` the field key to copy to.
1478
     * For a custom field, it would look like `customfield_123`
1479
     *  - `issueSource` `SAME` or `PARENT`.
1480
     * Defaults to `SAME` if no value is provided
1481
     * 
1482
     * ##### Update field #####
1483
     * 
1484
     * A post function that updates or appends a specific field with the given value
1485
     * 
1486
     *     {
1487
     *        "ruleKey": "system:update-field",
1488
     *        "parameters": {
1489
     *          "field": "customfield_10056",
1490
     *          "value": "asdf",
1491
     *          "mode": "append"
1492
     *        }
1493
     *      }
1494
     * 
1495
     * Parameters:
1496
     * 
1497
     *  - `field` the ID of the field to update.
1498
     * For a custom field, it would look like `customfield_123`
1499
     *  - `value` the value to update the field with
1500
     *  - `mode` `append` or `replace`.
1501
     * Determines if a value will be appended to the current value, or if the current value will be replaced
1502
     * 
1503
     * ##### Trigger webhook #####
1504
     * 
1505
     * A post function that automatically triggers a predefined webhook when a transition occurs in the workflow
1506
     * 
1507
     *     {
1508
     *        "ruleKey": "system:trigger-webhook",
1509
     *        "parameters": {
1510
     *          "webhookId": "1"
1511
     *        }
1512
     *      }
1513
     * 
1514
     * Parameters:
1515
     * 
1516
     *  - `webhookId` the ID of the webhook
1517
     * 
1518
     * #### Screen ####
1519
     * 
1520
     * ##### Remind people to update fields #####
1521
     * 
1522
     * A screen rule that prompts users to update a specific field when they interact with an issue screen during a transition.
1523
     * This rule is useful for ensuring that users provide or modify necessary information before moving an issue to the next step in the workflow
1524
     * 
1525
     *     {
1526
     *        "ruleKey": "system:remind-people-to-update-fields",
1527
     *        "params": {
1528
     *          "remindingFieldIds": "assignee,customfield_10025",
1529
     *          "remindingMessage": "The message",
1530
     *          "remindingAlwaysAsk": "true"
1531
     *        }
1532
     *      }
1533
     * 
1534
     * Parameters:
1535
     * 
1536
     *  - `remindingFieldIds` a comma-separated list of field IDs.
1537
     * Note: `fieldId` is used interchangeably with the idea of `fieldKey` here, they refer to the same field
1538
     *  - `remindingMessage` the message to display when prompting the users to update the fields
1539
     *  - `remindingAlwaysAsk` always remind to update fields.
1540
     * Allowed values: `true`, `false`
1541
     * 
1542
     * ##### Shared transition screen #####
1543
     * 
1544
     * A common screen that is shared between transitions in a workflow
1545
     * 
1546
     *     {
1547
     *        "ruleKey": "system:transition-screen",
1548
     *        "params": {
1549
     *          "screenId": "3"
1550
     *        }
1551
     *      }
1552
     * 
1553
     * Parameters:
1554
     * 
1555
     *  - `screenId` the ID of the screen
1556
     * 
1557
     * #### Connect & Forge ####
1558
     * 
1559
     * ##### Connect rules #####
1560
     * 
1561
     * Validator/Condition/Post function for Connect app
1562
     * 
1563
     *     {
1564
     *        "ruleKey": "connect:expression-validator",
1565
     *        "parameters": {
1566
     *          "appKey": "com.atlassian.app",
1567
     *          "config": "",
1568
     *          "id": "90ce590f-e90c-4cd3-8281-165ce41f2ac3",
1569
     *          "disabled": "false",
1570
     *          "tag": ""
1571
     *        }
1572
     *      }
1573
     * 
1574
     * Parameters:
1575
     * 
1576
     *  - `ruleKey` Validator: `connect:expression-validator`, Condition: `connect:expression-condition`, and Post function: `connect:remote-workflow-function`
1577
     *  - `appKey` the reference to the Connect app
1578
     *  - `config` a JSON payload string describing the configuration
1579
     *  - `id` the ID of the rule
1580
     *  - `disabled` determine if the Connect app is disabled.
1581
     * Allowed values: `true`, `false`
1582
     *  - `tag` additional tags for the Connect app
1583
     * 
1584
     * ##### Forge rules #####
1585
     * 
1586
     * Validator/Condition/Post function for Forge app
1587
     * 
1588
     *     {
1589
     *        "ruleKey": "forge:expression-validator",
1590
     *        "parameters": {
1591
     *          "key": "ari:cloud:ecosystem::extension/{appId}/{environmentId}/static/{moduleKey}",
1592
     *          "config": "{"searchString":"workflow validator"}",
1593
     *          "id": "a865ddf6-bb3f-4a7b-9540-c2f8b3f9f6c2"
1594
     *        }
1595
     *      }
1596
     * 
1597
     * Parameters:
1598
     * 
1599
     *  - `ruleKey` Validator: `forge:expression-validator`, Condition: `forge:expression-condition`, and Post function: `forge:workflow-post-function`
1600
     *  - `key` the identifier for the Forge app
1601
     *  - `config` the persistent stringified JSON configuration for the Forge rule
1602
     *  - `id` the ID of the Forge rule
1603
     * 
1604
     * @link https://developer.atlassian.com/cloud/jira/platform/rest/v3/api-group-permission-schemes/#built-in-permissions
1605
     * 
1606
     * @param string $workflowId 
1607
     * @param string $projectId 
1608
     * @param string $issueTypeId 
1609
     */
1610
    public function workflowCapabilities(
×
1611
        ?string $workflowId = null,
1612
        ?string $projectId = null,
1613
        ?string $issueTypeId = null,
1614
    ): Schema\WorkflowCapabilities {
1615
        return $this->call(
×
1616
            uri: '/rest/api/3/workflows/capabilities',
×
1617
            method: 'get',
×
1618
            query: compact('workflowId', 'projectId', 'issueTypeId'),
×
1619
            success: 200,
×
1620
            schema: Schema\WorkflowCapabilities::class,
×
1621
        );
×
1622
    }
1623

1624
    /**
1625
     * Create workflows and related statuses
1626
     * 
1627
     * **"Permissions" required:**
1628
     * 
1629
     *  - *Administer Jira* project permission to create all, including global-scoped, workflows
1630
     *  - *Administer projects* project permissions to create project-scoped workflows
1631
     */
1632
    public function createWorkflows(
×
1633
        Schema\WorkflowCreateRequest $request,
1634
    ): Schema\WorkflowCreateResponse {
1635
        return $this->call(
×
1636
            uri: '/rest/api/3/workflows/create',
×
1637
            method: 'post',
×
1638
            body: $request,
×
1639
            success: 200,
×
1640
            schema: Schema\WorkflowCreateResponse::class,
×
1641
        );
×
1642
    }
1643

1644
    /**
1645
     * Validate the payload for bulk create workflows
1646
     * 
1647
     * **"Permissions" required:**
1648
     * 
1649
     *  - *Administer Jira* project permission to create all, including global-scoped, workflows
1650
     *  - *Administer projects* project permissions to create project-scoped workflows
1651
     */
1652
    public function validateCreateWorkflows(
×
1653
        Schema\WorkflowCreateValidateRequest $request,
1654
    ): Schema\WorkflowValidationErrorList {
1655
        return $this->call(
×
1656
            uri: '/rest/api/3/workflows/create/validation',
×
1657
            method: 'post',
×
1658
            body: $request,
×
1659
            success: 200,
×
1660
            schema: Schema\WorkflowValidationErrorList::class,
×
1661
        );
×
1662
    }
1663

1664
    /**
1665
     * Returns a "paginated" list of global and project workflows.
1666
     * If workflow names are specified in query string, details of those workflows are returned.
1667
     * Otherwise, all workflows are returned
1668
     * 
1669
     * **"Permissions" required:**
1670
     * 
1671
     *  - *Administer Jira* global permission to access all, including project-scoped, workflows
1672
     *  - At least one of the *Administer projects* and *View (read-only) workflow* project permissions to access project-scoped workflows
1673
     * 
1674
     * @param int $startAt The index of the first item to return in a page of results (page offset).
1675
     * @param int $maxResults The maximum number of items to return per page.
1676
     * @param string $expand Use "expand" to include additional information in the response.
1677
     *                       This parameter accepts a comma-separated list.
1678
     *                       Expand options include:
1679
     *                        - `values.transitions` Returns the transitions that each workflow is associated with.
1680
     * @param string $queryString String used to perform a case-insensitive partial match with workflow name.
1681
     * @param string $orderBy "Order" the results by a field:
1682
     *                         - `name` Sorts by workflow name
1683
     *                         - `created` Sorts by create time
1684
     *                         - `updated` Sorts by update time.
1685
     * @param string $scope The scope of the workflow.
1686
     *                      Global for company-managed projects and Project for team-managed projects.
1687
     * @param bool $isActive Filters active and inactive workflows.
1688
     */
1689
    public function searchWorkflows(
×
1690
        ?int $startAt = null,
1691
        ?int $maxResults = null,
1692
        ?string $expand = null,
1693
        ?string $queryString = null,
1694
        ?string $orderBy = null,
1695
        ?string $scope = null,
1696
        ?bool $isActive = null,
1697
    ): Schema\WorkflowSearchResponse {
1698
        return $this->call(
×
1699
            uri: '/rest/api/3/workflows/search',
×
1700
            method: 'get',
×
1701
            query: compact('startAt', 'maxResults', 'expand', 'queryString', 'orderBy', 'scope', 'isActive'),
×
1702
            success: 200,
×
1703
            schema: Schema\WorkflowSearchResponse::class,
×
1704
        );
×
1705
    }
1706

1707
    /**
1708
     * Update workflows and related statuses
1709
     * 
1710
     * **"Permissions" required:**
1711
     * 
1712
     *  - *Administer Jira* project permission to create all, including global-scoped, workflows
1713
     *  - *Administer projects* project permissions to create project-scoped workflows
1714
     * 
1715
     * @param string $expand Use "expand" to include additional information in the response.
1716
     *                       This parameter accepts a comma-separated list.
1717
     *                       Expand options include:
1718
     *                        - `workflows.usages` Returns the project and issue types that each workflow is associated with
1719
     *                        - `statuses.usages` Returns the project and issue types that each status is associated with.
1720
     */
1721
    public function updateWorkflows(
×
1722
        Schema\WorkflowUpdateRequest $request,
1723
        ?string $expand = null,
1724
    ): Schema\WorkflowUpdateResponse {
1725
        return $this->call(
×
1726
            uri: '/rest/api/3/workflows/update',
×
1727
            method: 'post',
×
1728
            body: $request,
×
1729
            query: compact('expand'),
×
1730
            success: 200,
×
1731
            schema: Schema\WorkflowUpdateResponse::class,
×
1732
        );
×
1733
    }
1734

1735
    /**
1736
     * Validate the payload for bulk update workflows
1737
     * 
1738
     * **"Permissions" required:**
1739
     * 
1740
     *  - *Administer Jira* project permission to create all, including global-scoped, workflows
1741
     *  - *Administer projects* project permissions to create project-scoped workflows
1742
     */
1743
    public function validateUpdateWorkflows(
×
1744
        Schema\WorkflowUpdateValidateRequestBean $request,
1745
    ): Schema\WorkflowValidationErrorList {
1746
        return $this->call(
×
1747
            uri: '/rest/api/3/workflows/update/validation',
×
1748
            method: 'post',
×
1749
            body: $request,
×
1750
            success: 200,
×
1751
            schema: Schema\WorkflowValidationErrorList::class,
×
1752
        );
×
1753
    }
1754
}
STATUS · Troubleshooting · Open an Issue · Sales · Support · CAREERS · ENTERPRISE · START FREE · SCHEDULE DEMO
ANNOUNCEMENTS · TWITTER · TOS & SLA · Supported CI Services · What's a CI service? · Automated Testing

© 2026 Coveralls, Inc