• 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/WorkflowSchemeDrafts.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 WorkflowSchemeDrafts
10
{
11
    /**
12
     * Create a draft workflow scheme from an active workflow scheme, by copying the active workflow scheme.
13
     * Note that an active workflow scheme can only have one draft workflow scheme
14
     * 
15
     * **"Permissions" required:** *Administer Jira* "global permission".
16
     * 
17
     * @link https://confluence.atlassian.com/x/x4dKLg
18
     * 
19
     * @param int $id The ID of the active workflow scheme that the draft is created from.
20
     */
21
    public function createWorkflowSchemeDraftFromParent(
×
22
        int $id,
23
    ): Schema\WorkflowScheme {
24
        return $this->call(
×
25
            uri: '/rest/api/3/workflowscheme/{id}/createdraft',
×
26
            method: 'post',
×
27
            path: compact('id'),
×
28
            success: 201,
×
29
            schema: Schema\WorkflowScheme::class,
×
30
        );
×
31
    }
32

33
    /**
34
     * Returns the draft workflow scheme for an active workflow scheme.
35
     * Draft workflow schemes allow changes to be made to the active workflow schemes: When an active workflow scheme is updated, a draft copy is created.
36
     * The draft is modified, then the changes in the draft are copied back to the active workflow scheme.
37
     * See "Configuring workflow schemes" for more information.
38
     *  
39
     * Note that:
40
     * 
41
     *  - Only active workflow schemes can have draft workflow schemes
42
     *  - An active workflow scheme can only have one draft workflow scheme
43
     * 
44
     * **"Permissions" required:** *Administer Jira* "global permission".
45
     * 
46
     * @link https://confluence.atlassian.com/x/tohKLg
47
     * @link https://confluence.atlassian.com/x/x4dKLg
48
     * 
49
     * @param int $id The ID of the active workflow scheme that the draft was created from.
50
     */
51
    public function getWorkflowSchemeDraft(
×
52
        int $id,
53
    ): Schema\WorkflowScheme {
54
        return $this->call(
×
55
            uri: '/rest/api/3/workflowscheme/{id}/draft',
×
56
            method: 'get',
×
57
            path: compact('id'),
×
58
            success: 200,
×
59
            schema: Schema\WorkflowScheme::class,
×
60
        );
×
61
    }
62

63
    /**
64
     * Updates a draft workflow scheme.
65
     * If a draft workflow scheme does not exist for the active workflow scheme, then a draft is created.
66
     * Note that an active workflow scheme can only have one draft workflow scheme
67
     * 
68
     * **"Permissions" required:** *Administer Jira* "global permission".
69
     * 
70
     * @link https://confluence.atlassian.com/x/x4dKLg
71
     * 
72
     * @param int $id The ID of the active workflow scheme that the draft was created from.
73
     */
74
    public function updateWorkflowSchemeDraft(
×
75
        Schema\WorkflowScheme $request,
76
        int $id,
77
    ): Schema\WorkflowScheme {
78
        return $this->call(
×
79
            uri: '/rest/api/3/workflowscheme/{id}/draft',
×
80
            method: 'put',
×
81
            body: $request,
×
82
            path: compact('id'),
×
83
            success: 200,
×
84
            schema: Schema\WorkflowScheme::class,
×
85
        );
×
86
    }
87

88
    /**
89
     * Deletes a draft workflow scheme
90
     * 
91
     * **"Permissions" required:** *Administer Jira* "global permission".
92
     * 
93
     * @link https://confluence.atlassian.com/x/x4dKLg
94
     * 
95
     * @param int $id The ID of the active workflow scheme that the draft was created from.
96
     */
97
    public function deleteWorkflowSchemeDraft(
×
98
        int $id,
99
    ): true {
100
        return $this->call(
×
101
            uri: '/rest/api/3/workflowscheme/{id}/draft',
×
102
            method: 'delete',
×
103
            path: compact('id'),
×
104
            success: 204,
×
105
            schema: true,
×
106
        );
×
107
    }
108

109
    /**
110
     * Returns the default workflow for a workflow scheme's draft.
111
     * The default workflow is the workflow that is assigned any issue types that have not been mapped to any other workflow.
112
     * The default workflow has *All Unassigned Issue Types* listed in its issue types for the workflow scheme in Jira
113
     * 
114
     * **"Permissions" required:** *Administer Jira* "global permission".
115
     * 
116
     * @link https://confluence.atlassian.com/x/x4dKLg
117
     * 
118
     * @param int $id The ID of the workflow scheme that the draft belongs to.
119
     */
120
    public function getDraftDefaultWorkflow(
×
121
        int $id,
122
    ): Schema\DefaultWorkflow {
123
        return $this->call(
×
124
            uri: '/rest/api/3/workflowscheme/{id}/draft/default',
×
125
            method: 'get',
×
126
            path: compact('id'),
×
127
            success: 200,
×
128
            schema: Schema\DefaultWorkflow::class,
×
129
        );
×
130
    }
131

132
    /**
133
     * Sets the default workflow for a workflow scheme's draft
134
     * 
135
     * **"Permissions" required:** *Administer Jira* "global permission".
136
     * 
137
     * @link https://confluence.atlassian.com/x/x4dKLg
138
     * 
139
     * @param int $id The ID of the workflow scheme that the draft belongs to.
140
     */
141
    public function updateDraftDefaultWorkflow(
×
142
        Schema\DefaultWorkflow $request,
143
        int $id,
144
    ): Schema\WorkflowScheme {
145
        return $this->call(
×
146
            uri: '/rest/api/3/workflowscheme/{id}/draft/default',
×
147
            method: 'put',
×
148
            body: $request,
×
149
            path: compact('id'),
×
150
            success: 200,
×
151
            schema: Schema\WorkflowScheme::class,
×
152
        );
×
153
    }
154

155
    /**
156
     * Resets the default workflow for a workflow scheme's draft.
157
     * That is, the default workflow is set to Jira's system workflow (the *jira* workflow)
158
     * 
159
     * **"Permissions" required:** *Administer Jira* "global permission".
160
     * 
161
     * @link https://confluence.atlassian.com/x/x4dKLg
162
     * 
163
     * @param int $id The ID of the workflow scheme that the draft belongs to.
164
     */
165
    public function deleteDraftDefaultWorkflow(
×
166
        int $id,
167
    ): Schema\WorkflowScheme {
168
        return $this->call(
×
169
            uri: '/rest/api/3/workflowscheme/{id}/draft/default',
×
170
            method: 'delete',
×
171
            path: compact('id'),
×
172
            success: 200,
×
173
            schema: Schema\WorkflowScheme::class,
×
174
        );
×
175
    }
176

177
    /**
178
     * Returns the issue type-workflow mapping for an issue type in a workflow scheme's draft
179
     * 
180
     * **"Permissions" required:** *Administer Jira* "global permission".
181
     * 
182
     * @link https://confluence.atlassian.com/x/x4dKLg
183
     * 
184
     * @param int $id The ID of the workflow scheme that the draft belongs to.
185
     * @param string $issueType The ID of the issue type.
186
     */
187
    public function getWorkflowSchemeDraftIssueType(
×
188
        int $id,
189
        string $issueType,
190
    ): Schema\IssueTypeWorkflowMapping {
191
        return $this->call(
×
192
            uri: '/rest/api/3/workflowscheme/{id}/draft/issuetype/{issueType}',
×
193
            method: 'get',
×
194
            path: compact('id', 'issueType'),
×
195
            success: 200,
×
196
            schema: Schema\IssueTypeWorkflowMapping::class,
×
197
        );
×
198
    }
199

200
    /**
201
     * Sets the workflow for an issue type in a workflow scheme's draft
202
     * 
203
     * **"Permissions" required:** *Administer Jira* "global permission".
204
     * 
205
     * @link https://confluence.atlassian.com/x/x4dKLg
206
     * 
207
     * @param int $id The ID of the workflow scheme that the draft belongs to.
208
     * @param string $issueType The ID of the issue type.
209
     */
210
    public function setWorkflowSchemeDraftIssueType(
×
211
        Schema\IssueTypeWorkflowMapping $request,
212
        int $id,
213
        string $issueType,
214
    ): Schema\WorkflowScheme {
215
        return $this->call(
×
216
            uri: '/rest/api/3/workflowscheme/{id}/draft/issuetype/{issueType}',
×
217
            method: 'put',
×
218
            body: $request,
×
219
            path: compact('id', 'issueType'),
×
220
            success: 200,
×
221
            schema: Schema\WorkflowScheme::class,
×
222
        );
×
223
    }
224

225
    /**
226
     * Deletes the issue type-workflow mapping for an issue type in a workflow scheme's draft
227
     * 
228
     * **"Permissions" required:** *Administer Jira* "global permission".
229
     * 
230
     * @link https://confluence.atlassian.com/x/x4dKLg
231
     * 
232
     * @param int $id The ID of the workflow scheme that the draft belongs to.
233
     * @param string $issueType The ID of the issue type.
234
     */
235
    public function deleteWorkflowSchemeDraftIssueType(
×
236
        int $id,
237
        string $issueType,
238
    ): Schema\WorkflowScheme {
239
        return $this->call(
×
240
            uri: '/rest/api/3/workflowscheme/{id}/draft/issuetype/{issueType}',
×
241
            method: 'delete',
×
242
            path: compact('id', 'issueType'),
×
243
            success: 200,
×
244
            schema: Schema\WorkflowScheme::class,
×
245
        );
×
246
    }
247

248
    /**
249
     * Publishes a draft workflow scheme
250
     * 
251
     * Where the draft workflow includes new workflow statuses for an issue type, mappings are provided to update issues with the original workflow status to the new workflow status
252
     * 
253
     * This operation is "asynchronous".
254
     * Follow the `location` link in the response to determine the status of the task and use "Get task" to obtain updates
255
     * 
256
     * **"Permissions" required:** *Administer Jira* "global permission".
257
     * 
258
     * @link https://confluence.atlassian.com/x/x4dKLg
259
     * 
260
     * @param int $id The ID of the workflow scheme that the draft belongs to.
261
     * @param bool $validateOnly Whether the request only performs a validation.
262
     */
263
    public function publishDraftWorkflowScheme(
×
264
        Schema\PublishDraftWorkflowScheme $request,
265
        int $id,
266
        ?bool $validateOnly = false,
267
    ): true {
268
        return $this->call(
×
269
            uri: '/rest/api/3/workflowscheme/{id}/draft/publish',
×
270
            method: 'post',
×
271
            body: $request,
×
272
            query: compact('validateOnly'),
×
273
            path: compact('id'),
×
274
            success: 204,
×
275
            schema: true,
×
276
        );
×
277
    }
278

279
    /**
280
     * Returns the workflow-issue type mappings for a workflow scheme's draft
281
     * 
282
     * **"Permissions" required:** *Administer Jira* "global permission".
283
     * 
284
     * @link https://confluence.atlassian.com/x/x4dKLg
285
     * 
286
     * @param int $id The ID of the workflow scheme that the draft belongs to.
287
     * @param string $workflowName The name of a workflow in the scheme.
288
     *                             Limits the results to the workflow-issue type mapping for the specified workflow.
289
     */
290
    public function getDraftWorkflow(
×
291
        int $id,
292
        ?string $workflowName = null,
293
    ): Schema\IssueTypesWorkflowMapping {
294
        return $this->call(
×
295
            uri: '/rest/api/3/workflowscheme/{id}/draft/workflow',
×
296
            method: 'get',
×
297
            query: compact('workflowName'),
×
298
            path: compact('id'),
×
299
            success: 200,
×
300
            schema: Schema\IssueTypesWorkflowMapping::class,
×
301
        );
×
302
    }
303

304
    /**
305
     * Sets the issue types for a workflow in a workflow scheme's draft.
306
     * The workflow can also be set as the default workflow for the draft workflow scheme.
307
     * Unmapped issues types are mapped to the default workflow
308
     * 
309
     * **"Permissions" required:** *Administer Jira* "global permission".
310
     * 
311
     * @link https://confluence.atlassian.com/x/x4dKLg
312
     * 
313
     * @param int $id The ID of the workflow scheme that the draft belongs to.
314
     * @param string $workflowName The name of the workflow.
315
     */
316
    public function updateDraftWorkflowMapping(
×
317
        Schema\IssueTypesWorkflowMapping $request,
318
        int $id,
319
        string $workflowName,
320
    ): Schema\WorkflowScheme {
321
        return $this->call(
×
322
            uri: '/rest/api/3/workflowscheme/{id}/draft/workflow',
×
323
            method: 'put',
×
324
            body: $request,
×
325
            query: compact('workflowName'),
×
326
            path: compact('id'),
×
327
            success: 200,
×
328
            schema: Schema\WorkflowScheme::class,
×
329
        );
×
330
    }
331

332
    /**
333
     * Deletes the workflow-issue type mapping for a workflow in a workflow scheme's draft
334
     * 
335
     * **"Permissions" required:** *Administer Jira* "global permission".
336
     * 
337
     * @link https://confluence.atlassian.com/x/x4dKLg
338
     * 
339
     * @param int $id The ID of the workflow scheme that the draft belongs to.
340
     * @param string $workflowName The name of the workflow.
341
     */
342
    public function deleteDraftWorkflowMapping(
×
343
        int $id,
344
        string $workflowName,
345
    ): true {
346
        return $this->call(
×
347
            uri: '/rest/api/3/workflowscheme/{id}/draft/workflow',
×
348
            method: 'delete',
×
349
            query: compact('workflowName'),
×
350
            path: compact('id'),
×
351
            success: 200,
×
352
            schema: true,
×
353
        );
×
354
    }
355
}
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