jira_api_v2/apis/
issue_custom_field_options_api.rs

1/*
2 * The Jira Cloud platform REST API
3 *
4 * Jira Cloud platform REST API documentation
5 *
6 * The version of the OpenAPI document: 1001.0.0-SNAPSHOT
7 * Contact: ecosystem@atlassian.com
8 * Generated by: https://openapi-generator.tech
9 */
10
11
12use reqwest;
13use serde::{Deserialize, Serialize};
14use crate::{apis::ResponseContent, models};
15use super::{Error, configuration};
16
17
18/// struct for typed errors of method [`create_custom_field_option`]
19#[derive(Debug, Clone, Serialize, Deserialize)]
20#[serde(untagged)]
21pub enum CreateCustomFieldOptionError {
22    Status400(),
23    Status401(),
24    Status403(),
25    Status404(),
26    UnknownValue(serde_json::Value),
27}
28
29/// struct for typed errors of method [`create_custom_field_options`]
30#[derive(Debug, Clone, Serialize, Deserialize)]
31#[serde(untagged)]
32pub enum CreateCustomFieldOptionsError {
33    Status400(models::ErrorCollection),
34    Status401(models::ErrorCollection),
35    Status404(models::ErrorCollection),
36    UnknownValue(serde_json::Value),
37}
38
39/// struct for typed errors of method [`delete_custom_field_option`]
40#[derive(Debug, Clone, Serialize, Deserialize)]
41#[serde(untagged)]
42pub enum DeleteCustomFieldOptionError {
43    Status400(),
44    Status401(),
45    Status403(),
46    Status404(),
47    UnknownValue(serde_json::Value),
48}
49
50/// struct for typed errors of method [`get_custom_field_option`]
51#[derive(Debug, Clone, Serialize, Deserialize)]
52#[serde(untagged)]
53pub enum GetCustomFieldOptionError {
54    Status401(),
55    Status404(),
56    UnknownValue(serde_json::Value),
57}
58
59/// struct for typed errors of method [`get_options_for_context`]
60#[derive(Debug, Clone, Serialize, Deserialize)]
61#[serde(untagged)]
62pub enum GetOptionsForContextError {
63    Status400(),
64    Status401(),
65    Status403(),
66    Status404(),
67    UnknownValue(serde_json::Value),
68}
69
70/// struct for typed errors of method [`get_options_for_field`]
71#[derive(Debug, Clone, Serialize, Deserialize)]
72#[serde(untagged)]
73pub enum GetOptionsForFieldError {
74    Status400(),
75    Status401(),
76    Status404(),
77    UnknownValue(serde_json::Value),
78}
79
80/// struct for typed errors of method [`reorder_custom_field_options`]
81#[derive(Debug, Clone, Serialize, Deserialize)]
82#[serde(untagged)]
83pub enum ReorderCustomFieldOptionsError {
84    Status400(),
85    Status401(),
86    Status403(),
87    Status404(),
88    UnknownValue(serde_json::Value),
89}
90
91/// struct for typed errors of method [`update_custom_field_option`]
92#[derive(Debug, Clone, Serialize, Deserialize)]
93#[serde(untagged)]
94pub enum UpdateCustomFieldOptionError {
95    Status400(),
96    Status401(),
97    Status403(),
98    Status404(),
99    UnknownValue(serde_json::Value),
100}
101
102/// struct for typed errors of method [`update_custom_field_options`]
103#[derive(Debug, Clone, Serialize, Deserialize)]
104#[serde(untagged)]
105pub enum UpdateCustomFieldOptionsError {
106    Status400(models::ErrorCollection),
107    Status401(models::ErrorCollection),
108    Status404(models::ErrorCollection),
109    UnknownValue(serde_json::Value),
110}
111
112
113/// Creates options and, where the custom select field is of the type Select List (cascading), cascading options for a custom select field. The options are added to a context of the field.  The maximum number of options that can be created per request is 1000 and each field can have a maximum of 10000 options.  This operation works for custom field options created in Jira or the operations from this resource. **To work with issue field select list options created for Connect apps use the [Issue custom field options (apps)](#api-group-issue-custom-field-options--apps-) operations.**  **[Permissions](#permissions) required:** *Administer Jira* [global permission](https://confluence.atlassian.com/x/x4dKLg).
114pub async fn create_custom_field_option(configuration: &configuration::Configuration, field_id: &str, context_id: i64, bulk_custom_field_option_create_request: models::BulkCustomFieldOptionCreateRequest) -> Result<models::CustomFieldCreatedContextOptionsList, Error<CreateCustomFieldOptionError>> {
115    // add a prefix to parameters to efficiently prevent name collisions
116    let p_field_id = field_id;
117    let p_context_id = context_id;
118    let p_bulk_custom_field_option_create_request = bulk_custom_field_option_create_request;
119
120    let uri_str = format!("{}/rest/api/2/field/{fieldId}/context/{contextId}/option", configuration.base_path, fieldId=crate::apis::urlencode(p_field_id), contextId=p_context_id);
121    let mut req_builder = configuration.client.request(reqwest::Method::POST, &uri_str);
122
123    if let Some(ref user_agent) = configuration.user_agent {
124        req_builder = req_builder.header(reqwest::header::USER_AGENT, user_agent.clone());
125    }
126    if let Some(ref token) = configuration.oauth_access_token {
127        req_builder = req_builder.bearer_auth(token.to_owned());
128    };
129    if let Some(ref auth_conf) = configuration.basic_auth {
130        req_builder = req_builder.basic_auth(auth_conf.0.to_owned(), auth_conf.1.to_owned());
131    };
132    req_builder = req_builder.json(&p_bulk_custom_field_option_create_request);
133
134    let req = req_builder.build()?;
135    let resp = configuration.client.execute(req).await?;
136
137    let status = resp.status();
138
139    if !status.is_client_error() && !status.is_server_error() {
140        let content = resp.text().await?;
141        serde_json::from_str(&content).map_err(Error::from)
142    } else {
143        let content = resp.text().await?;
144        let entity: Option<CreateCustomFieldOptionError> = serde_json::from_str(&content).ok();
145        Err(Error::ResponseError(ResponseContent { status, content, entity }))
146    }
147}
148
149/// This operation is deprecated and becomes unavailable on 8 May 2021. Use [Create custom field options (context)](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) instead. See [Deprecation of custom field options](https://developer.atlassian.com/cloud/jira/platform/deprecation-notice-removal-of-custom-field-options-operations/) for details.  Creates options and, where the custom select field is of the type *Select List (cascading)*, cascading options for a custom select field. The options are added to the global context of the field.  Note that this operation **only works for issue field select list options created in Jira or using operations from the [Issue custom field options](#api-group-Issue-custom-field-options) resource**, it cannot be used with issue field select list options created by Connect apps.  **[Permissions](#permissions) required:** *Administer Jira* [global permission](https://confluence.atlassian.com/x/x4dKLg).
150pub async fn create_custom_field_options(configuration: &configuration::Configuration, field_id: i64, bulk_create_custom_field_option_request: models::BulkCreateCustomFieldOptionRequest) -> Result<serde_json::Value, Error<CreateCustomFieldOptionsError>> {
151    // add a prefix to parameters to efficiently prevent name collisions
152    let p_field_id = field_id;
153    let p_bulk_create_custom_field_option_request = bulk_create_custom_field_option_request;
154
155    let uri_str = format!("{}/rest/api/2/customField/{fieldId}/option", configuration.base_path, fieldId=p_field_id);
156    let mut req_builder = configuration.client.request(reqwest::Method::POST, &uri_str);
157
158    if let Some(ref user_agent) = configuration.user_agent {
159        req_builder = req_builder.header(reqwest::header::USER_AGENT, user_agent.clone());
160    }
161    if let Some(ref token) = configuration.oauth_access_token {
162        req_builder = req_builder.bearer_auth(token.to_owned());
163    };
164    if let Some(ref auth_conf) = configuration.basic_auth {
165        req_builder = req_builder.basic_auth(auth_conf.0.to_owned(), auth_conf.1.to_owned());
166    };
167    req_builder = req_builder.json(&p_bulk_create_custom_field_option_request);
168
169    let req = req_builder.build()?;
170    let resp = configuration.client.execute(req).await?;
171
172    let status = resp.status();
173
174    if !status.is_client_error() && !status.is_server_error() {
175        let content = resp.text().await?;
176        serde_json::from_str(&content).map_err(Error::from)
177    } else {
178        let content = resp.text().await?;
179        let entity: Option<CreateCustomFieldOptionsError> = serde_json::from_str(&content).ok();
180        Err(Error::ResponseError(ResponseContent { status, content, entity }))
181    }
182}
183
184/// Deletes a custom field option.  Options with cascading options cannot be deleted without deleting the cascading options first.  This operation works for custom field options created in Jira or the operations from this resource. **To work with issue field select list options created for Connect apps use the [Issue custom field options (apps)](#api-group-issue-custom-field-options--apps-) operations.**  **[Permissions](#permissions) required:** *Administer Jira* [global permission](https://confluence.atlassian.com/x/x4dKLg).
185pub async fn delete_custom_field_option(configuration: &configuration::Configuration, field_id: &str, context_id: i64, option_id: i64) -> Result<(), Error<DeleteCustomFieldOptionError>> {
186    // add a prefix to parameters to efficiently prevent name collisions
187    let p_field_id = field_id;
188    let p_context_id = context_id;
189    let p_option_id = option_id;
190
191    let uri_str = format!("{}/rest/api/2/field/{fieldId}/context/{contextId}/option/{optionId}", configuration.base_path, fieldId=crate::apis::urlencode(p_field_id), contextId=p_context_id, optionId=p_option_id);
192    let mut req_builder = configuration.client.request(reqwest::Method::DELETE, &uri_str);
193
194    if let Some(ref user_agent) = configuration.user_agent {
195        req_builder = req_builder.header(reqwest::header::USER_AGENT, user_agent.clone());
196    }
197    if let Some(ref token) = configuration.oauth_access_token {
198        req_builder = req_builder.bearer_auth(token.to_owned());
199    };
200    if let Some(ref auth_conf) = configuration.basic_auth {
201        req_builder = req_builder.basic_auth(auth_conf.0.to_owned(), auth_conf.1.to_owned());
202    };
203
204    let req = req_builder.build()?;
205    let resp = configuration.client.execute(req).await?;
206
207    let status = resp.status();
208
209    if !status.is_client_error() && !status.is_server_error() {
210        Ok(())
211    } else {
212        let content = resp.text().await?;
213        let entity: Option<DeleteCustomFieldOptionError> = serde_json::from_str(&content).ok();
214        Err(Error::ResponseError(ResponseContent { status, content, entity }))
215    }
216}
217
218/// This operation is deprecated and becomes unavailable on 8 May 2021. Use [Get custom field options (context)](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) instead. See [Deprecation of custom field options](https://developer.atlassian.com/cloud/jira/platform/deprecation-notice-removal-of-custom-field-options-operations/) for details.  Returns a custom field option. For example, an option in a select list.  Note that this operation **only works for issue field select list options created in Jira or using operations from the [Issue custom field options](#api-group-Issue-custom-field-options) resource**, it cannot be used with issue field select list options created by Connect apps.  This operation can be accessed anonymously.  **[Permissions](#permissions) required:** The custom field option is returned as follows:   *  if the user has the *Administer Jira* [global permission](https://confluence.atlassian.com/x/x4dKLg).  *  if the user has the *Browse projects* [project permission](https://confluence.atlassian.com/x/yodKLg) for at least one project the custom field is used in, and the field is visible in at least one layout the user has permission to view.
219pub async fn get_custom_field_option(configuration: &configuration::Configuration, id: &str) -> Result<models::CustomFieldOption, Error<GetCustomFieldOptionError>> {
220    // add a prefix to parameters to efficiently prevent name collisions
221    let p_id = id;
222
223    let uri_str = format!("{}/rest/api/2/customFieldOption/{id}", configuration.base_path, id=crate::apis::urlencode(p_id));
224    let mut req_builder = configuration.client.request(reqwest::Method::GET, &uri_str);
225
226    if let Some(ref user_agent) = configuration.user_agent {
227        req_builder = req_builder.header(reqwest::header::USER_AGENT, user_agent.clone());
228    }
229    if let Some(ref token) = configuration.oauth_access_token {
230        req_builder = req_builder.bearer_auth(token.to_owned());
231    };
232    if let Some(ref auth_conf) = configuration.basic_auth {
233        req_builder = req_builder.basic_auth(auth_conf.0.to_owned(), auth_conf.1.to_owned());
234    };
235
236    let req = req_builder.build()?;
237    let resp = configuration.client.execute(req).await?;
238
239    let status = resp.status();
240
241    if !status.is_client_error() && !status.is_server_error() {
242        let content = resp.text().await?;
243        serde_json::from_str(&content).map_err(Error::from)
244    } else {
245        let content = resp.text().await?;
246        let entity: Option<GetCustomFieldOptionError> = serde_json::from_str(&content).ok();
247        Err(Error::ResponseError(ResponseContent { status, content, entity }))
248    }
249}
250
251/// Returns a [paginated](#pagination) list of all custom field option for a context. Options are returned first then cascading options, in the order they display in Jira.  This operation works for custom field options created in Jira or the operations from this resource. **To work with issue field select list options created for Connect apps use the [Issue custom field options (apps)](#api-group-issue-custom-field-options--apps-) operations.**  **[Permissions](#permissions) required:** *Administer Jira* [global permission](https://confluence.atlassian.com/x/x4dKLg).
252pub async fn get_options_for_context(configuration: &configuration::Configuration, field_id: &str, context_id: i64, option_id: Option<i64>, only_options: Option<bool>, start_at: Option<i64>, max_results: Option<i32>) -> Result<models::PageBeanCustomFieldContextOption, Error<GetOptionsForContextError>> {
253    // add a prefix to parameters to efficiently prevent name collisions
254    let p_field_id = field_id;
255    let p_context_id = context_id;
256    let p_option_id = option_id;
257    let p_only_options = only_options;
258    let p_start_at = start_at;
259    let p_max_results = max_results;
260
261    let uri_str = format!("{}/rest/api/2/field/{fieldId}/context/{contextId}/option", configuration.base_path, fieldId=crate::apis::urlencode(p_field_id), contextId=p_context_id);
262    let mut req_builder = configuration.client.request(reqwest::Method::GET, &uri_str);
263
264    if let Some(ref param_value) = p_option_id {
265        req_builder = req_builder.query(&[("optionId", &param_value.to_string())]);
266    }
267    if let Some(ref param_value) = p_only_options {
268        req_builder = req_builder.query(&[("onlyOptions", &param_value.to_string())]);
269    }
270    if let Some(ref param_value) = p_start_at {
271        req_builder = req_builder.query(&[("startAt", &param_value.to_string())]);
272    }
273    if let Some(ref param_value) = p_max_results {
274        req_builder = req_builder.query(&[("maxResults", &param_value.to_string())]);
275    }
276    if let Some(ref user_agent) = configuration.user_agent {
277        req_builder = req_builder.header(reqwest::header::USER_AGENT, user_agent.clone());
278    }
279    if let Some(ref token) = configuration.oauth_access_token {
280        req_builder = req_builder.bearer_auth(token.to_owned());
281    };
282    if let Some(ref auth_conf) = configuration.basic_auth {
283        req_builder = req_builder.basic_auth(auth_conf.0.to_owned(), auth_conf.1.to_owned());
284    };
285
286    let req = req_builder.build()?;
287    let resp = configuration.client.execute(req).await?;
288
289    let status = resp.status();
290
291    if !status.is_client_error() && !status.is_server_error() {
292        let content = resp.text().await?;
293        serde_json::from_str(&content).map_err(Error::from)
294    } else {
295        let content = resp.text().await?;
296        let entity: Option<GetOptionsForContextError> = serde_json::from_str(&content).ok();
297        Err(Error::ResponseError(ResponseContent { status, content, entity }))
298    }
299}
300
301/// This operation is deprecated and becomes unavailable on 8 May 2021. Use [Get custom field options (context)](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) instead. See [Deprecation of custom field options](https://developer.atlassian.com/cloud/jira/platform/deprecation-notice-removal-of-custom-field-options-operations/) for details.  Returns a [paginated](#pagination) list of options and, where the custom select field is of the type *Select List (cascading)*, cascading options for custom select fields. Cascading options are included in the item count when determining pagination. Only options from the global context are returned.  Note that this operation **only works for issue field select list options created in Jira or using operations from the [Issue custom field options](#api-group-Issue-custom-field-options) resource**, it cannot be used with issue field select list options created by Connect apps.  **[Permissions](#permissions) required:** *Administer Jira* [global permission](https://confluence.atlassian.com/x/x4dKLg).
302pub async fn get_options_for_field(configuration: &configuration::Configuration, field_id: i64, start_at: Option<i64>, max_results: Option<i32>) -> Result<models::PageBeanCustomFieldOptionDetails, Error<GetOptionsForFieldError>> {
303    // add a prefix to parameters to efficiently prevent name collisions
304    let p_field_id = field_id;
305    let p_start_at = start_at;
306    let p_max_results = max_results;
307
308    let uri_str = format!("{}/rest/api/2/customField/{fieldId}/option", configuration.base_path, fieldId=p_field_id);
309    let mut req_builder = configuration.client.request(reqwest::Method::GET, &uri_str);
310
311    if let Some(ref param_value) = p_start_at {
312        req_builder = req_builder.query(&[("startAt", &param_value.to_string())]);
313    }
314    if let Some(ref param_value) = p_max_results {
315        req_builder = req_builder.query(&[("maxResults", &param_value.to_string())]);
316    }
317    if let Some(ref user_agent) = configuration.user_agent {
318        req_builder = req_builder.header(reqwest::header::USER_AGENT, user_agent.clone());
319    }
320    if let Some(ref token) = configuration.oauth_access_token {
321        req_builder = req_builder.bearer_auth(token.to_owned());
322    };
323    if let Some(ref auth_conf) = configuration.basic_auth {
324        req_builder = req_builder.basic_auth(auth_conf.0.to_owned(), auth_conf.1.to_owned());
325    };
326
327    let req = req_builder.build()?;
328    let resp = configuration.client.execute(req).await?;
329
330    let status = resp.status();
331
332    if !status.is_client_error() && !status.is_server_error() {
333        let content = resp.text().await?;
334        serde_json::from_str(&content).map_err(Error::from)
335    } else {
336        let content = resp.text().await?;
337        let entity: Option<GetOptionsForFieldError> = serde_json::from_str(&content).ok();
338        Err(Error::ResponseError(ResponseContent { status, content, entity }))
339    }
340}
341
342/// Changes the order of custom field options or cascading options in a context.  This operation works for custom field options created in Jira or the operations from this resource. **To work with issue field select list options created for Connect apps use the [Issue custom field options (apps)](#api-group-issue-custom-field-options--apps-) operations.**  **[Permissions](#permissions) required:** *Administer Jira* [global permission](https://confluence.atlassian.com/x/x4dKLg).
343pub async fn reorder_custom_field_options(configuration: &configuration::Configuration, field_id: &str, context_id: i64, order_of_custom_field_options: models::OrderOfCustomFieldOptions) -> Result<serde_json::Value, Error<ReorderCustomFieldOptionsError>> {
344    // add a prefix to parameters to efficiently prevent name collisions
345    let p_field_id = field_id;
346    let p_context_id = context_id;
347    let p_order_of_custom_field_options = order_of_custom_field_options;
348
349    let uri_str = format!("{}/rest/api/2/field/{fieldId}/context/{contextId}/option/move", configuration.base_path, fieldId=crate::apis::urlencode(p_field_id), contextId=p_context_id);
350    let mut req_builder = configuration.client.request(reqwest::Method::PUT, &uri_str);
351
352    if let Some(ref user_agent) = configuration.user_agent {
353        req_builder = req_builder.header(reqwest::header::USER_AGENT, user_agent.clone());
354    }
355    if let Some(ref token) = configuration.oauth_access_token {
356        req_builder = req_builder.bearer_auth(token.to_owned());
357    };
358    if let Some(ref auth_conf) = configuration.basic_auth {
359        req_builder = req_builder.basic_auth(auth_conf.0.to_owned(), auth_conf.1.to_owned());
360    };
361    req_builder = req_builder.json(&p_order_of_custom_field_options);
362
363    let req = req_builder.build()?;
364    let resp = configuration.client.execute(req).await?;
365
366    let status = resp.status();
367
368    if !status.is_client_error() && !status.is_server_error() {
369        let content = resp.text().await?;
370        serde_json::from_str(&content).map_err(Error::from)
371    } else {
372        let content = resp.text().await?;
373        let entity: Option<ReorderCustomFieldOptionsError> = serde_json::from_str(&content).ok();
374        Err(Error::ResponseError(ResponseContent { status, content, entity }))
375    }
376}
377
378/// Updates the options of a custom field.  If any of the options are not found, no options are updated. Options where the values in the request match the current values aren't updated and aren't reported in the response.  Note that this operation **only works for issue field select list options created in Jira or using operations from the [Issue custom field options](#api-group-Issue-custom-field-options) resource**, it cannot be used with issue field select list options created by Connect apps.  **[Permissions](#permissions) required:** *Administer Jira* [global permission](https://confluence.atlassian.com/x/x4dKLg).
379pub async fn update_custom_field_option(configuration: &configuration::Configuration, field_id: &str, context_id: i64, bulk_custom_field_option_update_request: models::BulkCustomFieldOptionUpdateRequest) -> Result<models::CustomFieldUpdatedContextOptionsList, Error<UpdateCustomFieldOptionError>> {
380    // add a prefix to parameters to efficiently prevent name collisions
381    let p_field_id = field_id;
382    let p_context_id = context_id;
383    let p_bulk_custom_field_option_update_request = bulk_custom_field_option_update_request;
384
385    let uri_str = format!("{}/rest/api/2/field/{fieldId}/context/{contextId}/option", configuration.base_path, fieldId=crate::apis::urlencode(p_field_id), contextId=p_context_id);
386    let mut req_builder = configuration.client.request(reqwest::Method::PUT, &uri_str);
387
388    if let Some(ref user_agent) = configuration.user_agent {
389        req_builder = req_builder.header(reqwest::header::USER_AGENT, user_agent.clone());
390    }
391    if let Some(ref token) = configuration.oauth_access_token {
392        req_builder = req_builder.bearer_auth(token.to_owned());
393    };
394    if let Some(ref auth_conf) = configuration.basic_auth {
395        req_builder = req_builder.basic_auth(auth_conf.0.to_owned(), auth_conf.1.to_owned());
396    };
397    req_builder = req_builder.json(&p_bulk_custom_field_option_update_request);
398
399    let req = req_builder.build()?;
400    let resp = configuration.client.execute(req).await?;
401
402    let status = resp.status();
403
404    if !status.is_client_error() && !status.is_server_error() {
405        let content = resp.text().await?;
406        serde_json::from_str(&content).map_err(Error::from)
407    } else {
408        let content = resp.text().await?;
409        let entity: Option<UpdateCustomFieldOptionError> = serde_json::from_str(&content).ok();
410        Err(Error::ResponseError(ResponseContent { status, content, entity }))
411    }
412}
413
414/// This operation is deprecated and becomes unavailable on 8 May 2021. Use [Update custom field options (context)](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) instead. See [Deprecation of custom field options](https://developer.atlassian.com/cloud/jira/platform/deprecation-notice-removal-of-custom-field-options-operations/) for details.  Updates the options on a custom select field. Where an updated option is in use on an issue, the value on the issue is also updated. Options that are not found are ignored. A maximum of 1000 options, including sub-options of *Select List (cascading)* fields, can be updated per request. The options are updated on the global context of the field.  Note that this operation **only works for issue field select list options created in Jira or using operations from the [Issue custom field options](#api-group-Issue-custom-field-options) resource**, it cannot be used with issue field select list options created by Connect apps.  **[Permissions](#permissions) required:** *Administer Jira* [global permission](https://confluence.atlassian.com/x/x4dKLg).
415pub async fn update_custom_field_options(configuration: &configuration::Configuration, field_id: i64, update_custom_field_option: models::UpdateCustomFieldOption) -> Result<serde_json::Value, Error<UpdateCustomFieldOptionsError>> {
416    // add a prefix to parameters to efficiently prevent name collisions
417    let p_field_id = field_id;
418    let p_update_custom_field_option = update_custom_field_option;
419
420    let uri_str = format!("{}/rest/api/2/customField/{fieldId}/option", configuration.base_path, fieldId=p_field_id);
421    let mut req_builder = configuration.client.request(reqwest::Method::PUT, &uri_str);
422
423    if let Some(ref user_agent) = configuration.user_agent {
424        req_builder = req_builder.header(reqwest::header::USER_AGENT, user_agent.clone());
425    }
426    if let Some(ref token) = configuration.oauth_access_token {
427        req_builder = req_builder.bearer_auth(token.to_owned());
428    };
429    if let Some(ref auth_conf) = configuration.basic_auth {
430        req_builder = req_builder.basic_auth(auth_conf.0.to_owned(), auth_conf.1.to_owned());
431    };
432    req_builder = req_builder.json(&p_update_custom_field_option);
433
434    let req = req_builder.build()?;
435    let resp = configuration.client.execute(req).await?;
436
437    let status = resp.status();
438
439    if !status.is_client_error() && !status.is_server_error() {
440        let content = resp.text().await?;
441        serde_json::from_str(&content).map_err(Error::from)
442    } else {
443        let content = resp.text().await?;
444        let entity: Option<UpdateCustomFieldOptionsError> = serde_json::from_str(&content).ok();
445        Err(Error::ResponseError(ResponseContent { status, content, entity }))
446    }
447}
448