@@ -93,4 +93,90 @@ public function create(Field $field)
9393
9494 return $ cf ;
9595 }
96+
97+ /**
98+ * @param int $fieldId The custom field Id
99+ *
100+ * @throws \JiraCloud\JiraException
101+ *
102+ * @return string|bool
103+ */
104+ public function getCustomFieldContexts (int $ fieldId )
105+ {
106+ $ url = sprintf ('%s/customfield_%s/contexts ' , $ this ->uri , $ fieldId );
107+ $ ret = $ this ->exec ($ url );
108+
109+ $ this ->log ->debug ("get custom Field Contexts= \n" .$ ret );
110+
111+ return $ ret ;
112+ }
113+
114+ /**
115+ * Get a custom fields options.
116+ *
117+ * @param int $fieldId The custom field Id
118+ * @param int $contextId Context ID related to the custom field
119+ * @param array $paramArray Query parameters like 'startAt' and 'maxResults'
120+ *
121+ * @see https://developer.atlassian.com/cloud/jira/platform/rest/v3/api-group-issue-custom-field-options/#api-rest-api-3-field-fieldid-context-contextid-option-get
122+ *
123+ * @throws \JiraCloud\JiraException
124+ *
125+ * @return string
126+ */
127+ public function getCustomFieldOptions (int $ fieldId , int $ contextId , array $ paramArray = [])
128+ {
129+ $ url = sprintf ('%s/customfield_%s/context/%s/option%s ' , $ this ->uri , $ fieldId , $ contextId , $ this ->toHttpQueryParameter ($ paramArray ));
130+ $ ret = $ this ->exec ($ url );
131+
132+ $ this ->log ->debug ("get custom Field Options= \n" .$ ret );
133+
134+ return $ ret ;
135+ }
136+
137+ /**
138+ * Create custom field options.
139+ *
140+ * @param int $fieldId The custom field Id to add options to
141+ * @param int $contextId Context ID related to the custom field
142+ * @param array $options The options array
143+ *
144+ * @see https://developer.atlassian.com/cloud/jira/platform/rest/v3/api-group-issue-custom-field-options/#api-rest-api-3-field-fieldid-context-contextid-option-post
145+ *
146+ * @throws \JiraCloud\JiraException
147+ *
148+ * @return string
149+ */
150+ public function createCustomFieldOptions (int $ fieldId , int $ contextId , array $ options = [])
151+ {
152+ $ url = sprintf ('%s/customfield_%s/context/%s/option ' , $ this ->uri , $ fieldId , $ contextId );
153+ $ ret = $ this ->exec ($ url , json_encode ($ options ), 'POST ' );
154+
155+ $ this ->log ->debug ("create custom Field Options= \n" .$ ret );
156+
157+ return $ ret ;
158+ }
159+
160+ /**
161+ * Update a custom field options.
162+ *
163+ * @param int $fieldId The custom field Id
164+ * @param int $contextId Context ID related to the custom field
165+ * @param array $options The new options array
166+ *
167+ * @see https://developer.atlassian.com/cloud/jira/platform/rest/v3/api-group-issue-custom-field-options/#api-rest-api-3-field-fieldid-context-contextid-option-put
168+ *
169+ * @throws \JiraCloud\JiraException
170+ *
171+ * @return string
172+ */
173+ public function updateCustomFieldOptions (int $ fieldId , int $ contextId , array $ options = [])
174+ {
175+ $ url = sprintf ('%s/customfield_%s/context/%s/option ' , $ this ->uri , $ fieldId , $ contextId );
176+ $ ret = $ this ->exec ($ url , json_encode ($ options ), 'PUT ' );
177+
178+ $ this ->log ->debug ("update custom Field Options= \n" .$ ret );
179+
180+ return $ ret ;
181+ }
96182}
0 commit comments