jira_api_v2/apis/jira_settings_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 [`get_advanced_settings`]
19#[derive(Debug, Clone, Serialize, Deserialize)]
20#[serde(untagged)]
21pub enum GetAdvancedSettingsError {
22 Status401(),
23 Status403(),
24 UnknownValue(serde_json::Value),
25}
26
27/// struct for typed errors of method [`get_application_property`]
28#[derive(Debug, Clone, Serialize, Deserialize)]
29#[serde(untagged)]
30pub enum GetApplicationPropertyError {
31 Status401(),
32 Status404(),
33 UnknownValue(serde_json::Value),
34}
35
36/// struct for typed errors of method [`get_configuration`]
37#[derive(Debug, Clone, Serialize, Deserialize)]
38#[serde(untagged)]
39pub enum GetConfigurationError {
40 Status401(),
41 UnknownValue(serde_json::Value),
42}
43
44/// struct for typed errors of method [`set_application_property`]
45#[derive(Debug, Clone, Serialize, Deserialize)]
46#[serde(untagged)]
47pub enum SetApplicationPropertyError {
48 Status400(),
49 Status401(),
50 Status403(),
51 Status404(),
52 UnknownValue(serde_json::Value),
53}
54
55
56/// Returns the application properties that are accessible on the *Advanced Settings* page. To navigate to the *Advanced Settings* page in Jira, choose the Jira icon > **Jira settings** > **System**, **General Configuration** and then click **Advanced Settings** (in the upper right). **[Permissions](#permissions) required:** *Administer Jira* [global permission](https://confluence.atlassian.com/x/x4dKLg).
57pub async fn get_advanced_settings(configuration: &configuration::Configuration, ) -> Result<Vec<models::ApplicationProperty>, Error<GetAdvancedSettingsError>> {
58
59 let uri_str = format!("{}/rest/api/2/application-properties/advanced-settings", configuration.base_path);
60 let mut req_builder = configuration.client.request(reqwest::Method::GET, &uri_str);
61
62 if let Some(ref user_agent) = configuration.user_agent {
63 req_builder = req_builder.header(reqwest::header::USER_AGENT, user_agent.clone());
64 }
65 if let Some(ref token) = configuration.oauth_access_token {
66 req_builder = req_builder.bearer_auth(token.to_owned());
67 };
68 if let Some(ref auth_conf) = configuration.basic_auth {
69 req_builder = req_builder.basic_auth(auth_conf.0.to_owned(), auth_conf.1.to_owned());
70 };
71
72 let req = req_builder.build()?;
73 let resp = configuration.client.execute(req).await?;
74
75 let status = resp.status();
76
77 if !status.is_client_error() && !status.is_server_error() {
78 let content = resp.text().await?;
79 serde_json::from_str(&content).map_err(Error::from)
80 } else {
81 let content = resp.text().await?;
82 let entity: Option<GetAdvancedSettingsError> = serde_json::from_str(&content).ok();
83 Err(Error::ResponseError(ResponseContent { status, content, entity }))
84 }
85}
86
87/// Returns all application properties or an application property. If you specify a value for the `key` parameter, then an application property is returned as an object (not in an array). Otherwise, an array of all editable application properties is returned. See [Set application property](#api-rest-api-2-application-properties-id-put) for descriptions of editable properties. **[Permissions](#permissions) required:** *Administer Jira* [global permission](https://confluence.atlassian.com/x/x4dKLg).
88pub async fn get_application_property(configuration: &configuration::Configuration, key: Option<&str>, permission_level: Option<&str>, key_filter: Option<&str>) -> Result<Vec<models::ApplicationProperty>, Error<GetApplicationPropertyError>> {
89 // add a prefix to parameters to efficiently prevent name collisions
90 let p_key = key;
91 let p_permission_level = permission_level;
92 let p_key_filter = key_filter;
93
94 let uri_str = format!("{}/rest/api/2/application-properties", configuration.base_path);
95 let mut req_builder = configuration.client.request(reqwest::Method::GET, &uri_str);
96
97 if let Some(ref param_value) = p_key {
98 req_builder = req_builder.query(&[("key", ¶m_value.to_string())]);
99 }
100 if let Some(ref param_value) = p_permission_level {
101 req_builder = req_builder.query(&[("permissionLevel", ¶m_value.to_string())]);
102 }
103 if let Some(ref param_value) = p_key_filter {
104 req_builder = req_builder.query(&[("keyFilter", ¶m_value.to_string())]);
105 }
106 if let Some(ref user_agent) = configuration.user_agent {
107 req_builder = req_builder.header(reqwest::header::USER_AGENT, user_agent.clone());
108 }
109 if let Some(ref token) = configuration.oauth_access_token {
110 req_builder = req_builder.bearer_auth(token.to_owned());
111 };
112 if let Some(ref auth_conf) = configuration.basic_auth {
113 req_builder = req_builder.basic_auth(auth_conf.0.to_owned(), auth_conf.1.to_owned());
114 };
115
116 let req = req_builder.build()?;
117 let resp = configuration.client.execute(req).await?;
118
119 let status = resp.status();
120
121 if !status.is_client_error() && !status.is_server_error() {
122 let content = resp.text().await?;
123 serde_json::from_str(&content).map_err(Error::from)
124 } else {
125 let content = resp.text().await?;
126 let entity: Option<GetApplicationPropertyError> = serde_json::from_str(&content).ok();
127 Err(Error::ResponseError(ResponseContent { status, content, entity }))
128 }
129}
130
131/// Returns the [global settings](https://confluence.atlassian.com/x/qYXKM) in Jira. These settings determine whether optional features (for example, subtasks, time tracking, and others) are enabled. If time tracking is enabled, this operation also returns the time tracking configuration. This operation can be accessed anonymously. **[Permissions](#permissions) required:** None.
132pub async fn get_configuration(configuration: &configuration::Configuration, ) -> Result<models::Configuration, Error<GetConfigurationError>> {
133
134 let uri_str = format!("{}/rest/api/2/configuration", configuration.base_path);
135 let mut req_builder = configuration.client.request(reqwest::Method::GET, &uri_str);
136
137 if let Some(ref user_agent) = configuration.user_agent {
138 req_builder = req_builder.header(reqwest::header::USER_AGENT, user_agent.clone());
139 }
140 if let Some(ref token) = configuration.oauth_access_token {
141 req_builder = req_builder.bearer_auth(token.to_owned());
142 };
143 if let Some(ref auth_conf) = configuration.basic_auth {
144 req_builder = req_builder.basic_auth(auth_conf.0.to_owned(), auth_conf.1.to_owned());
145 };
146
147 let req = req_builder.build()?;
148 let resp = configuration.client.execute(req).await?;
149
150 let status = resp.status();
151
152 if !status.is_client_error() && !status.is_server_error() {
153 let content = resp.text().await?;
154 serde_json::from_str(&content).map_err(Error::from)
155 } else {
156 let content = resp.text().await?;
157 let entity: Option<GetConfigurationError> = serde_json::from_str(&content).ok();
158 Err(Error::ResponseError(ResponseContent { status, content, entity }))
159 }
160}
161
162/// Changes the value of an application property. For example, you can change the value of the `jira.clone.prefix` from its default value of *CLONE -* to *Clone -* if you prefer sentence case capitalization. Editable properties are described below along with their default values. #### Advanced settings #### The advanced settings below are also accessible in [Jira](https://confluence.atlassian.com/x/vYXKM). | Key | Description | Default value | | -- | -- | -- | | `jira.clone.prefix` | The string of text prefixed to the title of a cloned issue. | `CLONE -` | | `jira.date.picker.java.format` | The date format for the Java (server-side) generated dates. This must be the same as the `jira.date.picker.javascript.format` format setting. | `d/MMM/yy` | | `jira.date.picker.javascript.format` | The date format for the JavaScript (client-side) generated dates. This must be the same as the `jira.date.picker.java.format` format setting. | `%e/%b/%y` | | `jira.date.time.picker.java.format` | The date format for the Java (server-side) generated date times. This must be the same as the `jira.date.time.picker.javascript.format` format setting. | `dd/MMM/yy h:mm a` | | `jira.date.time.picker.javascript.format` | The date format for the JavaScript (client-side) generated date times. This must be the same as the `jira.date.time.picker.java.format` format setting. | `%e/%b/%y %I:%M %p` | | `jira.issue.actions.order` | The default order of actions (such as *Comments* or *Change history*) displayed on the issue view. | `asc` | | `jira.table.cols.subtasks` | The columns to show while viewing subtask issues in a table. For example, a list of subtasks on an issue. | `issuetype, status, assignee, progress` | | `jira.view.issue.links.sort.order` | The sort order of the list of issue links on the issue view. | `type, status, priority` | | `jira.comment.collapsing.minimum.hidden` | The minimum number of comments required for comment collapsing to occur. A value of `0` disables comment collapsing. | `4` | | `jira.newsletter.tip.delay.days` | The number of days before a prompt to sign up to the Jira Insiders newsletter is shown. A value of `-1` disables this feature. | `7` | #### Look and feel #### The settings listed below adjust the [look and feel](https://confluence.atlassian.com/x/VwCLLg). | Key | Description | Default value | | -- | -- | -- | | `jira.lf.date.time` | The [ time format](https://docs.oracle.com/javase/6/docs/api/index.html?java/text/SimpleDateFormat.html). | `h:mm a` | | `jira.lf.date.day` | The [ day format](https://docs.oracle.com/javase/6/docs/api/index.html?java/text/SimpleDateFormat.html). | `EEEE h:mm a` | | `jira.lf.date.complete` | The [ date and time format](https://docs.oracle.com/javase/6/docs/api/index.html?java/text/SimpleDateFormat.html). | `dd/MMM/yy h:mm a` | | `jira.lf.date.dmy` | The [ date format](https://docs.oracle.com/javase/6/docs/api/index.html?java/text/SimpleDateFormat.html). | `dd/MMM/yy` | | `jira.date.time.picker.use.iso8061` | When enabled, sets Monday as the first day of the week in the date picker, as specified by the ISO8601 standard. | `false` | | `jira.lf.logo.url` | The URL of the logo image file. | `/images/icon-jira-logo.png` | | `jira.lf.logo.show.application.title` | Controls the visibility of the application title on the sidebar. | `false` | | `jira.lf.favicon.url` | The URL of the favicon. | `/favicon.ico` | | `jira.lf.favicon.hires.url` | The URL of the high-resolution favicon. | `/images/64jira.png` | | `jira.lf.top.adg3.bgcolour` | The background color of the sidebar. | `#0747A6` | | `jira.lf.top.adg3.textcolour` | The color of the text and logo of the sidebar. | `#DEEBFF` | | `jira.lf.hero.button.base.bg.colour` | The background color of the hero button. | `#3b7fc4` | | `jira.title` | The text for the application title. The application title can also be set in *General settings*. | `Jira` | | `jira.option.globalsharing` | Whether filters and dashboards can be shared with anyone signed into Jira. | `true` | | `xflow.product.suggestions.enabled` | Whether to expose product suggestions for other Atlassian products within Jira. | `true` | #### Other settings #### | Key | Description | Default value | | -- | -- | -- | | `jira.issuenav.criteria.autoupdate` | Whether instant updates to search criteria is active. | `true` | *Note: Be careful when changing [application properties and advanced settings](https://confluence.atlassian.com/x/vYXKM).* **[Permissions](#permissions) required:** *Administer Jira* [global permission](https://confluence.atlassian.com/x/x4dKLg).
163pub async fn set_application_property(configuration: &configuration::Configuration, id: &str, simple_application_property_bean: models::SimpleApplicationPropertyBean) -> Result<models::ApplicationProperty, Error<SetApplicationPropertyError>> {
164 // add a prefix to parameters to efficiently prevent name collisions
165 let p_id = id;
166 let p_simple_application_property_bean = simple_application_property_bean;
167
168 let uri_str = format!("{}/rest/api/2/application-properties/{id}", configuration.base_path, id=crate::apis::urlencode(p_id));
169 let mut req_builder = configuration.client.request(reqwest::Method::PUT, &uri_str);
170
171 if let Some(ref user_agent) = configuration.user_agent {
172 req_builder = req_builder.header(reqwest::header::USER_AGENT, user_agent.clone());
173 }
174 if let Some(ref token) = configuration.oauth_access_token {
175 req_builder = req_builder.bearer_auth(token.to_owned());
176 };
177 if let Some(ref auth_conf) = configuration.basic_auth {
178 req_builder = req_builder.basic_auth(auth_conf.0.to_owned(), auth_conf.1.to_owned());
179 };
180 req_builder = req_builder.json(&p_simple_application_property_bean);
181
182 let req = req_builder.build()?;
183 let resp = configuration.client.execute(req).await?;
184
185 let status = resp.status();
186
187 if !status.is_client_error() && !status.is_server_error() {
188 let content = resp.text().await?;
189 serde_json::from_str(&content).map_err(Error::from)
190 } else {
191 let content = resp.text().await?;
192 let entity: Option<SetApplicationPropertyError> = serde_json::from_str(&content).ok();
193 Err(Error::ResponseError(ResponseContent { status, content, entity }))
194 }
195}
196