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

tylernathanreed / jira-client-php / 13857440588

14 Mar 2025 01:18PM UTC coverage: 70.825% (-0.06%) from 70.885%
13857440588

push

github

tylernathanreed
~ Fixed nested objects in test examples

9 of 9 new or added lines in 1 file covered. (100.0%)

524 existing lines in 407 files now uncovered.

4826 of 6814 relevant lines covered (70.82%)

8.59 hits per line

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

11.43
/src/Operations/IssueCustomFieldOptionsApps.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 IssueCustomFieldOptionsApps
10
{
11
    /**
12
     * Returns a "paginated" list of all the options of a select list issue field.
13
     * A select list issue field is a type of "issue field" that enables a user to select a value from a list of options
14
     * 
15
     * Note that this operation **only works for issue field select list options added by Connect apps**, it cannot be used with issue field select list options created in Jira or using operations from the "Issue custom field options" resource
16
     * 
17
     * **"Permissions" required:** *Administer Jira* "global permission".
18
     * Jira permissions are not required for the app providing the field.
19
     * 
20
     * @link https://developer.atlassian.com/cloud/jira/platform/modules/issue-field/
21
     * @link https://confluence.atlassian.com/x/x4dKLg
22
     * 
23
     * @param string $fieldKey The field key is specified in the following format: **$(app-key)\_\_$(field-key)**.
24
     *                         For example, *example-add-on\_\_example-issue-field*.
25
     *                         To determine the `fieldKey` value, do one of the following:
26
     *                          - open the app's plugin descriptor, then **app-key** is the key at the top and **field-key** is the key in the `jiraIssueFields` module.
27
     *                         **app-key** can also be found in the app listing in the Atlassian Universal Plugin Manager
28
     *                          - run "Get fields" and in the field details the value is returned in `key`.
29
     *                         For example, `"key": "teams-add-on__team-issue-field"`
30
     * @param int $startAt The index of the first item to return in a page of results (page offset).
31
     * @param int $maxResults The maximum number of items to return per page.
32
     */
UNCOV
33
    public function getAllIssueFieldOptions(
×
34
        string $fieldKey,
35
        ?int $startAt = 0,
36
        ?int $maxResults = 50,
37
    ): Schema\PageBeanIssueFieldOption {
38
        return $this->call(
×
39
            uri: '/rest/api/3/field/{fieldKey}/option',
×
40
            method: 'get',
×
41
            query: compact('startAt', 'maxResults'),
×
42
            path: compact('fieldKey'),
×
43
            success: 200,
×
44
            schema: Schema\PageBeanIssueFieldOption::class,
×
45
        );
×
46
    }
47

48
    /**
49
     * Creates an option for a select list issue field
50
     * 
51
     * Note that this operation **only works for issue field select list options added by Connect apps**, it cannot be used with issue field select list options created in Jira or using operations from the "Issue custom field options" resource
52
     * 
53
     * Each field can have a maximum of 10000 options, and each option can have a maximum of 10000 scopes
54
     * 
55
     * **"Permissions" required:** *Administer Jira* "global permission".
56
     * Jira permissions are not required for the app providing the field.
57
     * 
58
     * @link https://confluence.atlassian.com/x/x4dKLg
59
     * 
60
     * @param string $fieldKey The field key is specified in the following format: **$(app-key)\_\_$(field-key)**.
61
     *                         For example, *example-add-on\_\_example-issue-field*.
62
     *                         To determine the `fieldKey` value, do one of the following:
63
     *                          - open the app's plugin descriptor, then **app-key** is the key at the top and **field-key** is the key in the `jiraIssueFields` module.
64
     *                         **app-key** can also be found in the app listing in the Atlassian Universal Plugin Manager
65
     *                          - run "Get fields" and in the field details the value is returned in `key`.
66
     *                         For example, `"key": "teams-add-on__team-issue-field"`
67
     */
UNCOV
68
    public function createIssueFieldOption(
×
69
        Schema\IssueFieldOptionCreateBean $request,
70
        string $fieldKey,
71
    ): Schema\IssueFieldOption {
72
        return $this->call(
×
73
            uri: '/rest/api/3/field/{fieldKey}/option',
×
74
            method: 'post',
×
75
            body: $request,
×
76
            path: compact('fieldKey'),
×
77
            success: 200,
×
78
            schema: Schema\IssueFieldOption::class,
×
79
        );
×
80
    }
81

82
    /**
83
     * Returns a "paginated" list of options for a select list issue field that can be viewed and selected by the user
84
     * 
85
     * Note that this operation **only works for issue field select list options added by Connect apps**, it cannot be used with issue field select list options created in Jira or using operations from the "Issue custom field options" resource
86
     * 
87
     * **"Permissions" required:** Permission to access Jira.
88
     * 
89
     * @param string $fieldKey The field key is specified in the following format: **$(app-key)\_\_$(field-key)**.
90
     *                         For example, *example-add-on\_\_example-issue-field*.
91
     *                         To determine the `fieldKey` value, do one of the following:
92
     *                          - open the app's plugin descriptor, then **app-key** is the key at the top and **field-key** is the key in the `jiraIssueFields` module.
93
     *                         **app-key** can also be found in the app listing in the Atlassian Universal Plugin Manager
94
     *                          - run "Get fields" and in the field details the value is returned in `key`.
95
     *                         For example, `"key": "teams-add-on__team-issue-field"`
96
     * @param int $startAt The index of the first item to return in a page of results (page offset).
97
     * @param int $maxResults The maximum number of items to return per page.
98
     * @param int $projectId Filters the results to options that are only available in the specified project.
99
     */
UNCOV
100
    public function getSelectableIssueFieldOptions(
×
101
        string $fieldKey,
102
        ?int $startAt = 0,
103
        ?int $maxResults = 50,
104
        ?int $projectId = null,
105
    ): Schema\PageBeanIssueFieldOption {
106
        return $this->call(
×
107
            uri: '/rest/api/3/field/{fieldKey}/option/suggestions/edit',
×
108
            method: 'get',
×
109
            query: compact('startAt', 'maxResults', 'projectId'),
×
110
            path: compact('fieldKey'),
×
111
            success: 200,
×
112
            schema: Schema\PageBeanIssueFieldOption::class,
×
113
        );
×
114
    }
115

116
    /**
117
     * Returns a "paginated" list of options for a select list issue field that can be viewed by the user
118
     * 
119
     * Note that this operation **only works for issue field select list options added by Connect apps**, it cannot be used with issue field select list options created in Jira or using operations from the "Issue custom field options" resource
120
     * 
121
     * **"Permissions" required:** Permission to access Jira.
122
     * 
123
     * @param string $fieldKey The field key is specified in the following format: **$(app-key)\_\_$(field-key)**.
124
     *                         For example, *example-add-on\_\_example-issue-field*.
125
     *                         To determine the `fieldKey` value, do one of the following:
126
     *                          - open the app's plugin descriptor, then **app-key** is the key at the top and **field-key** is the key in the `jiraIssueFields` module.
127
     *                         **app-key** can also be found in the app listing in the Atlassian Universal Plugin Manager
128
     *                          - run "Get fields" and in the field details the value is returned in `key`.
129
     *                         For example, `"key": "teams-add-on__team-issue-field"`
130
     * @param int $startAt The index of the first item to return in a page of results (page offset).
131
     * @param int $maxResults The maximum number of items to return per page.
132
     * @param int $projectId Filters the results to options that are only available in the specified project.
133
     */
UNCOV
134
    public function getVisibleIssueFieldOptions(
×
135
        string $fieldKey,
136
        ?int $startAt = 0,
137
        ?int $maxResults = 50,
138
        ?int $projectId = null,
139
    ): Schema\PageBeanIssueFieldOption {
140
        return $this->call(
×
141
            uri: '/rest/api/3/field/{fieldKey}/option/suggestions/search',
×
142
            method: 'get',
×
143
            query: compact('startAt', 'maxResults', 'projectId'),
×
144
            path: compact('fieldKey'),
×
145
            success: 200,
×
146
            schema: Schema\PageBeanIssueFieldOption::class,
×
147
        );
×
148
    }
149

150
    /**
151
     * Returns an option from a select list issue field
152
     * 
153
     * Note that this operation **only works for issue field select list options added by Connect apps**, it cannot be used with issue field select list options created in Jira or using operations from the "Issue custom field options" resource
154
     * 
155
     * **"Permissions" required:** *Administer Jira* "global permission".
156
     * Jira permissions are not required for the app providing the field.
157
     * 
158
     * @link https://confluence.atlassian.com/x/x4dKLg
159
     * 
160
     * @param string $fieldKey The field key is specified in the following format: **$(app-key)\_\_$(field-key)**.
161
     *                         For example, *example-add-on\_\_example-issue-field*.
162
     *                         To determine the `fieldKey` value, do one of the following:
163
     *                          - open the app's plugin descriptor, then **app-key** is the key at the top and **field-key** is the key in the `jiraIssueFields` module.
164
     *                         **app-key** can also be found in the app listing in the Atlassian Universal Plugin Manager
165
     *                          - run "Get fields" and in the field details the value is returned in `key`.
166
     *                         For example, `"key": "teams-add-on__team-issue-field"`
167
     * @param int $optionId The ID of the option to be returned.
168
     */
UNCOV
169
    public function getIssueFieldOption(
×
170
        string $fieldKey,
171
        int $optionId,
172
    ): Schema\IssueFieldOption {
173
        return $this->call(
×
174
            uri: '/rest/api/3/field/{fieldKey}/option/{optionId}',
×
175
            method: 'get',
×
176
            path: compact('fieldKey', 'optionId'),
×
177
            success: 200,
×
178
            schema: Schema\IssueFieldOption::class,
×
179
        );
×
180
    }
181

182
    /**
183
     * Updates or creates an option for a select list issue field.
184
     * This operation requires that the option ID is provided when creating an option, therefore, the option ID needs to be specified as a path and body parameter.
185
     * The option ID provided in the path and body must be identical
186
     * 
187
     * Note that this operation **only works for issue field select list options added by Connect apps**, it cannot be used with issue field select list options created in Jira or using operations from the "Issue custom field options" resource
188
     * 
189
     * **"Permissions" required:** *Administer Jira* "global permission".
190
     * Jira permissions are not required for the app providing the field.
191
     * 
192
     * @link https://confluence.atlassian.com/x/x4dKLg
193
     * 
194
     * @param string $fieldKey The field key is specified in the following format: **$(app-key)\_\_$(field-key)**.
195
     *                         For example, *example-add-on\_\_example-issue-field*.
196
     *                         To determine the `fieldKey` value, do one of the following:
197
     *                          - open the app's plugin descriptor, then **app-key** is the key at the top and **field-key** is the key in the `jiraIssueFields` module.
198
     *                         **app-key** can also be found in the app listing in the Atlassian Universal Plugin Manager
199
     *                          - run "Get fields" and in the field details the value is returned in `key`.
200
     *                         For example, `"key": "teams-add-on__team-issue-field"`
201
     * @param int $optionId The ID of the option to be updated.
202
     */
UNCOV
203
    public function updateIssueFieldOption(
×
204
        Schema\IssueFieldOption $request,
205
        string $fieldKey,
206
        int $optionId,
207
    ): Schema\IssueFieldOption {
208
        return $this->call(
×
209
            uri: '/rest/api/3/field/{fieldKey}/option/{optionId}',
×
210
            method: 'put',
×
211
            body: $request,
×
212
            path: compact('fieldKey', 'optionId'),
×
213
            success: 200,
×
214
            schema: Schema\IssueFieldOption::class,
×
215
        );
×
216
    }
217

218
    /**
219
     * Deletes an option from a select list issue field
220
     * 
221
     * Note that this operation **only works for issue field select list options added by Connect apps**, it cannot be used with issue field select list options created in Jira or using operations from the "Issue custom field options" resource
222
     * 
223
     * **"Permissions" required:** *Administer Jira* "global permission".
224
     * Jira permissions are not required for the app providing the field.
225
     * 
226
     * @link https://confluence.atlassian.com/x/x4dKLg
227
     * 
228
     * @param string $fieldKey The field key is specified in the following format: **$(app-key)\_\_$(field-key)**.
229
     *                         For example, *example-add-on\_\_example-issue-field*.
230
     *                         To determine the `fieldKey` value, do one of the following:
231
     *                          - open the app's plugin descriptor, then **app-key** is the key at the top and **field-key** is the key in the `jiraIssueFields` module.
232
     *                         **app-key** can also be found in the app listing in the Atlassian Universal Plugin Manager
233
     *                          - run "Get fields" and in the field details the value is returned in `key`.
234
     *                         For example, `"key": "teams-add-on__team-issue-field"`
235
     * @param int $optionId The ID of the option to be deleted.
236
     */
237
    public function deleteIssueFieldOption(
1✔
238
        string $fieldKey,
239
        int $optionId,
240
    ): true {
241
        return $this->call(
1✔
242
            uri: '/rest/api/3/field/{fieldKey}/option/{optionId}',
1✔
243
            method: 'delete',
1✔
244
            path: compact('fieldKey', 'optionId'),
1✔
245
            success: 204,
1✔
246
            schema: true,
1✔
247
        );
1✔
248
    }
249

250
    /**
251
     * Deselects an issue-field select-list option from all issues where it is selected.
252
     * A different option can be selected to replace the deselected option.
253
     * The update can also be limited to a smaller set of issues by using a JQL query
254
     * 
255
     * Connect and Forge app users with *Administer Jira* "global permission" can override the screen security configuration using `overrideScreenSecurity` and `overrideEditableFlag`
256
     * 
257
     * This is an "asynchronous operation".
258
     * The response object contains a link to the long-running task
259
     * 
260
     * Note that this operation **only works for issue field select list options added by Connect apps**, it cannot be used with issue field select list options created in Jira or using operations from the "Issue custom field options" resource
261
     * 
262
     * **"Permissions" required:** *Administer Jira* "global permission".
263
     * Jira permissions are not required for the app providing the field.
264
     * 
265
     * @link https://confluence.atlassian.com/x/x4dKLg
266
     * 
267
     * @param string $fieldKey The field key is specified in the following format: **$(app-key)\_\_$(field-key)**.
268
     *                         For example, *example-add-on\_\_example-issue-field*.
269
     *                         To determine the `fieldKey` value, do one of the following:
270
     *                          - open the app's plugin descriptor, then **app-key** is the key at the top and **field-key** is the key in the `jiraIssueFields` module.
271
     *                         **app-key** can also be found in the app listing in the Atlassian Universal Plugin Manager
272
     *                          - run "Get fields" and in the field details the value is returned in `key`.
273
     *                         For example, `"key": "teams-add-on__team-issue-field"`
274
     * @param int $optionId The ID of the option to be deselected.
275
     * @param int $replaceWith The ID of the option that will replace the currently selected option.
276
     * @param string $jql A JQL query that specifies the issues to be updated.
277
     *                    For example, *project=10000*.
278
     * @param bool $overrideScreenSecurity Whether screen security is overridden to enable hidden fields to be edited.
279
     *                                     Available to Connect and Forge app users with admin permission.
280
     * @param bool $overrideEditableFlag Whether screen security is overridden to enable uneditable fields to be edited.
281
     *                                   Available to Connect and Forge app users with *Administer Jira* "global permission".
282
     *                                   @link https://confluence.atlassian.com/x/x4dKLg
283
     */
UNCOV
284
    public function replaceIssueFieldOption(
×
285
        string $fieldKey,
286
        int $optionId,
287
        ?int $replaceWith = null,
288
        ?string $jql = null,
289
        ?bool $overrideScreenSecurity = false,
290
        ?bool $overrideEditableFlag = false,
291
    ): Schema\TaskProgressBeanRemoveOptionFromIssuesResult {
292
        return $this->call(
×
293
            uri: '/rest/api/3/field/{fieldKey}/option/{optionId}/issue',
×
294
            method: 'delete',
×
295
            query: compact('replaceWith', 'jql', 'overrideScreenSecurity', 'overrideEditableFlag'),
×
296
            path: compact('fieldKey', 'optionId'),
×
297
            success: 303,
×
298
            schema: Schema\TaskProgressBeanRemoveOptionFromIssuesResult::class,
×
299
        );
×
300
    }
301
}
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