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

tylernathanreed / jira-client-php / 13678007438

05 Mar 2025 02:15PM UTC coverage: 2.081% (+0.01%) from 2.067%
13678007438

push

github

tylernathanreed
Merge branch 'master' of github.com:tylernathanreed/jira-client-php

141 of 6775 relevant lines covered (2.08%)

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
     * @return list<Schema\DeprecatedWorkflow>
26
     */
27
    public function getAllWorkflows(
×
28
        ?string $workflowName = null,
29
    ): array {
30
        return $this->call(
×
31
            uri: '/rest/api/3/workflow',
×
32
            method: 'get',
×
33
            query: compact('workflowName'),
×
34
            success: 200,
×
35
            schema: [Schema\DeprecatedWorkflow::class],
×
36
        );
×
37
    }
38

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

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

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

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

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

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

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

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

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

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

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

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

1737
    /**
1738
     * Validate the payload for bulk update workflows
1739
     * 
1740
     * **"Permissions" required:**
1741
     * 
1742
     *  - *Administer Jira* project permission to create all, including global-scoped, workflows
1743
     *  - *Administer projects* project permissions to create project-scoped workflows
1744
     */
1745
    public function validateUpdateWorkflows(
×
1746
        Schema\WorkflowUpdateValidateRequestBean $request,
1747
    ): Schema\WorkflowValidationErrorList {
1748
        return $this->call(
×
1749
            uri: '/rest/api/3/workflows/update/validation',
×
1750
            method: 'post',
×
1751
            body: $request,
×
1752
            success: 200,
×
1753
            schema: Schema\WorkflowValidationErrorList::class,
×
1754
        );
×
1755
    }
1756
}
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