jira_api_v2/apis/
dashboards_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 [`copy_dashboard`]
19#[derive(Debug, Clone, Serialize, Deserialize)]
20#[serde(untagged)]
21pub enum CopyDashboardError {
22    Status400(models::ErrorCollection),
23    Status401(models::ErrorCollection),
24    Status404(models::ErrorCollection),
25    UnknownValue(serde_json::Value),
26}
27
28/// struct for typed errors of method [`create_dashboard`]
29#[derive(Debug, Clone, Serialize, Deserialize)]
30#[serde(untagged)]
31pub enum CreateDashboardError {
32    Status400(models::ErrorCollection),
33    Status401(models::ErrorCollection),
34    UnknownValue(serde_json::Value),
35}
36
37/// struct for typed errors of method [`delete_dashboard`]
38#[derive(Debug, Clone, Serialize, Deserialize)]
39#[serde(untagged)]
40pub enum DeleteDashboardError {
41    Status400(models::ErrorCollection),
42    Status401(models::ErrorCollection),
43    UnknownValue(serde_json::Value),
44}
45
46/// struct for typed errors of method [`delete_dashboard_item_property`]
47#[derive(Debug, Clone, Serialize, Deserialize)]
48#[serde(untagged)]
49pub enum DeleteDashboardItemPropertyError {
50    Status400(),
51    Status401(),
52    Status403(),
53    Status404(),
54    UnknownValue(serde_json::Value),
55}
56
57/// struct for typed errors of method [`get_all_dashboards`]
58#[derive(Debug, Clone, Serialize, Deserialize)]
59#[serde(untagged)]
60pub enum GetAllDashboardsError {
61    Status400(models::ErrorCollection),
62    Status401(models::ErrorCollection),
63    UnknownValue(serde_json::Value),
64}
65
66/// struct for typed errors of method [`get_dashboard`]
67#[derive(Debug, Clone, Serialize, Deserialize)]
68#[serde(untagged)]
69pub enum GetDashboardError {
70    Status400(models::ErrorCollection),
71    Status401(models::ErrorCollection),
72    Status404(),
73    UnknownValue(serde_json::Value),
74}
75
76/// struct for typed errors of method [`get_dashboard_item_property`]
77#[derive(Debug, Clone, Serialize, Deserialize)]
78#[serde(untagged)]
79pub enum GetDashboardItemPropertyError {
80    Status401(),
81    Status404(),
82    UnknownValue(serde_json::Value),
83}
84
85/// struct for typed errors of method [`get_dashboard_item_property_keys`]
86#[derive(Debug, Clone, Serialize, Deserialize)]
87#[serde(untagged)]
88pub enum GetDashboardItemPropertyKeysError {
89    Status401(),
90    Status404(),
91    UnknownValue(serde_json::Value),
92}
93
94/// struct for typed errors of method [`get_dashboards_paginated`]
95#[derive(Debug, Clone, Serialize, Deserialize)]
96#[serde(untagged)]
97pub enum GetDashboardsPaginatedError {
98    Status400(models::ErrorCollection),
99    Status401(models::ErrorCollection),
100    UnknownValue(serde_json::Value),
101}
102
103/// struct for typed errors of method [`set_dashboard_item_property`]
104#[derive(Debug, Clone, Serialize, Deserialize)]
105#[serde(untagged)]
106pub enum SetDashboardItemPropertyError {
107    Status400(),
108    Status401(),
109    Status403(),
110    Status404(),
111    UnknownValue(serde_json::Value),
112}
113
114/// struct for typed errors of method [`update_dashboard`]
115#[derive(Debug, Clone, Serialize, Deserialize)]
116#[serde(untagged)]
117pub enum UpdateDashboardError {
118    Status400(models::ErrorCollection),
119    Status401(models::ErrorCollection),
120    Status404(models::ErrorCollection),
121    UnknownValue(serde_json::Value),
122}
123
124
125/// Copies a dashboard. Any values provided in the `dashboard` parameter replace those in the copied dashboard.  **[Permissions](#permissions) required:** None  The dashboard to be copied must be owned by or shared with the user.
126pub async fn copy_dashboard(configuration: &configuration::Configuration, id: &str, dashboard_details: models::DashboardDetails) -> Result<models::Dashboard, Error<CopyDashboardError>> {
127    // add a prefix to parameters to efficiently prevent name collisions
128    let p_id = id;
129    let p_dashboard_details = dashboard_details;
130
131    let uri_str = format!("{}/rest/api/2/dashboard/{id}/copy", configuration.base_path, id=crate::apis::urlencode(p_id));
132    let mut req_builder = configuration.client.request(reqwest::Method::POST, &uri_str);
133
134    if let Some(ref user_agent) = configuration.user_agent {
135        req_builder = req_builder.header(reqwest::header::USER_AGENT, user_agent.clone());
136    }
137    if let Some(ref token) = configuration.oauth_access_token {
138        req_builder = req_builder.bearer_auth(token.to_owned());
139    };
140    if let Some(ref auth_conf) = configuration.basic_auth {
141        req_builder = req_builder.basic_auth(auth_conf.0.to_owned(), auth_conf.1.to_owned());
142    };
143    req_builder = req_builder.json(&p_dashboard_details);
144
145    let req = req_builder.build()?;
146    let resp = configuration.client.execute(req).await?;
147
148    let status = resp.status();
149
150    if !status.is_client_error() && !status.is_server_error() {
151        let content = resp.text().await?;
152        serde_json::from_str(&content).map_err(Error::from)
153    } else {
154        let content = resp.text().await?;
155        let entity: Option<CopyDashboardError> = serde_json::from_str(&content).ok();
156        Err(Error::ResponseError(ResponseContent { status, content, entity }))
157    }
158}
159
160/// Creates a dashboard.  **[Permissions](#permissions) required:** None.
161pub async fn create_dashboard(configuration: &configuration::Configuration, dashboard_details: models::DashboardDetails) -> Result<models::Dashboard, Error<CreateDashboardError>> {
162    // add a prefix to parameters to efficiently prevent name collisions
163    let p_dashboard_details = dashboard_details;
164
165    let uri_str = format!("{}/rest/api/2/dashboard", configuration.base_path);
166    let mut req_builder = configuration.client.request(reqwest::Method::POST, &uri_str);
167
168    if let Some(ref user_agent) = configuration.user_agent {
169        req_builder = req_builder.header(reqwest::header::USER_AGENT, user_agent.clone());
170    }
171    if let Some(ref token) = configuration.oauth_access_token {
172        req_builder = req_builder.bearer_auth(token.to_owned());
173    };
174    if let Some(ref auth_conf) = configuration.basic_auth {
175        req_builder = req_builder.basic_auth(auth_conf.0.to_owned(), auth_conf.1.to_owned());
176    };
177    req_builder = req_builder.json(&p_dashboard_details);
178
179    let req = req_builder.build()?;
180    let resp = configuration.client.execute(req).await?;
181
182    let status = resp.status();
183
184    if !status.is_client_error() && !status.is_server_error() {
185        let content = resp.text().await?;
186        serde_json::from_str(&content).map_err(Error::from)
187    } else {
188        let content = resp.text().await?;
189        let entity: Option<CreateDashboardError> = serde_json::from_str(&content).ok();
190        Err(Error::ResponseError(ResponseContent { status, content, entity }))
191    }
192}
193
194/// Deletes a dashboard.  **[Permissions](#permissions) required:** None  The dashboard to be deleted must be owned by the user.
195pub async fn delete_dashboard(configuration: &configuration::Configuration, id: &str) -> Result<(), Error<DeleteDashboardError>> {
196    // add a prefix to parameters to efficiently prevent name collisions
197    let p_id = id;
198
199    let uri_str = format!("{}/rest/api/2/dashboard/{id}", configuration.base_path, id=crate::apis::urlencode(p_id));
200    let mut req_builder = configuration.client.request(reqwest::Method::DELETE, &uri_str);
201
202    if let Some(ref user_agent) = configuration.user_agent {
203        req_builder = req_builder.header(reqwest::header::USER_AGENT, user_agent.clone());
204    }
205    if let Some(ref token) = configuration.oauth_access_token {
206        req_builder = req_builder.bearer_auth(token.to_owned());
207    };
208    if let Some(ref auth_conf) = configuration.basic_auth {
209        req_builder = req_builder.basic_auth(auth_conf.0.to_owned(), auth_conf.1.to_owned());
210    };
211
212    let req = req_builder.build()?;
213    let resp = configuration.client.execute(req).await?;
214
215    let status = resp.status();
216
217    if !status.is_client_error() && !status.is_server_error() {
218        Ok(())
219    } else {
220        let content = resp.text().await?;
221        let entity: Option<DeleteDashboardError> = serde_json::from_str(&content).ok();
222        Err(Error::ResponseError(ResponseContent { status, content, entity }))
223    }
224}
225
226/// Deletes a dashboard item property.  This operation can be accessed anonymously.  **[Permissions](#permissions) required:** The user must be the owner of the dashboard. Note, users with the *Administer Jira* [global permission](https://confluence.atlassian.com/x/x4dKLg) are considered owners of the System dashboard.
227pub async fn delete_dashboard_item_property(configuration: &configuration::Configuration, dashboard_id: &str, item_id: &str, property_key: &str) -> Result<(), Error<DeleteDashboardItemPropertyError>> {
228    // add a prefix to parameters to efficiently prevent name collisions
229    let p_dashboard_id = dashboard_id;
230    let p_item_id = item_id;
231    let p_property_key = property_key;
232
233    let uri_str = format!("{}/rest/api/2/dashboard/{dashboardId}/items/{itemId}/properties/{propertyKey}", configuration.base_path, dashboardId=crate::apis::urlencode(p_dashboard_id), itemId=crate::apis::urlencode(p_item_id), propertyKey=crate::apis::urlencode(p_property_key));
234    let mut req_builder = configuration.client.request(reqwest::Method::DELETE, &uri_str);
235
236    if let Some(ref user_agent) = configuration.user_agent {
237        req_builder = req_builder.header(reqwest::header::USER_AGENT, user_agent.clone());
238    }
239    if let Some(ref token) = configuration.oauth_access_token {
240        req_builder = req_builder.bearer_auth(token.to_owned());
241    };
242    if let Some(ref auth_conf) = configuration.basic_auth {
243        req_builder = req_builder.basic_auth(auth_conf.0.to_owned(), auth_conf.1.to_owned());
244    };
245
246    let req = req_builder.build()?;
247    let resp = configuration.client.execute(req).await?;
248
249    let status = resp.status();
250
251    if !status.is_client_error() && !status.is_server_error() {
252        Ok(())
253    } else {
254        let content = resp.text().await?;
255        let entity: Option<DeleteDashboardItemPropertyError> = serde_json::from_str(&content).ok();
256        Err(Error::ResponseError(ResponseContent { status, content, entity }))
257    }
258}
259
260/// Returns a list of dashboards owned by or shared with the user. The list may be filtered to include only favorite or owned dashboards.  This operation can be accessed anonymously.  **[Permissions](#permissions) required:** None.
261pub async fn get_all_dashboards(configuration: &configuration::Configuration, filter: Option<&str>, start_at: Option<i32>, max_results: Option<i32>) -> Result<models::PageOfDashboards, Error<GetAllDashboardsError>> {
262    // add a prefix to parameters to efficiently prevent name collisions
263    let p_filter = filter;
264    let p_start_at = start_at;
265    let p_max_results = max_results;
266
267    let uri_str = format!("{}/rest/api/2/dashboard", configuration.base_path);
268    let mut req_builder = configuration.client.request(reqwest::Method::GET, &uri_str);
269
270    if let Some(ref param_value) = p_filter {
271        req_builder = req_builder.query(&[("filter", &param_value.to_string())]);
272    }
273    if let Some(ref param_value) = p_start_at {
274        req_builder = req_builder.query(&[("startAt", &param_value.to_string())]);
275    }
276    if let Some(ref param_value) = p_max_results {
277        req_builder = req_builder.query(&[("maxResults", &param_value.to_string())]);
278    }
279    if let Some(ref user_agent) = configuration.user_agent {
280        req_builder = req_builder.header(reqwest::header::USER_AGENT, user_agent.clone());
281    }
282    if let Some(ref token) = configuration.oauth_access_token {
283        req_builder = req_builder.bearer_auth(token.to_owned());
284    };
285    if let Some(ref auth_conf) = configuration.basic_auth {
286        req_builder = req_builder.basic_auth(auth_conf.0.to_owned(), auth_conf.1.to_owned());
287    };
288
289    let req = req_builder.build()?;
290    let resp = configuration.client.execute(req).await?;
291
292    let status = resp.status();
293
294    if !status.is_client_error() && !status.is_server_error() {
295        let content = resp.text().await?;
296        serde_json::from_str(&content).map_err(Error::from)
297    } else {
298        let content = resp.text().await?;
299        let entity: Option<GetAllDashboardsError> = serde_json::from_str(&content).ok();
300        Err(Error::ResponseError(ResponseContent { status, content, entity }))
301    }
302}
303
304/// Returns a dashboard.  This operation can be accessed anonymously.  **[Permissions](#permissions) required:** None.  However, to get a dashboard, the dashboard must be shared with the user or the user must own it. Note, users with the *Administer Jira* [global permission](https://confluence.atlassian.com/x/x4dKLg) are considered owners of the System dashboard. The System dashboard is considered to be shared with all other users.
305pub async fn get_dashboard(configuration: &configuration::Configuration, id: &str) -> Result<models::Dashboard, Error<GetDashboardError>> {
306    // add a prefix to parameters to efficiently prevent name collisions
307    let p_id = id;
308
309    let uri_str = format!("{}/rest/api/2/dashboard/{id}", configuration.base_path, id=crate::apis::urlencode(p_id));
310    let mut req_builder = configuration.client.request(reqwest::Method::GET, &uri_str);
311
312    if let Some(ref user_agent) = configuration.user_agent {
313        req_builder = req_builder.header(reqwest::header::USER_AGENT, user_agent.clone());
314    }
315    if let Some(ref token) = configuration.oauth_access_token {
316        req_builder = req_builder.bearer_auth(token.to_owned());
317    };
318    if let Some(ref auth_conf) = configuration.basic_auth {
319        req_builder = req_builder.basic_auth(auth_conf.0.to_owned(), auth_conf.1.to_owned());
320    };
321
322    let req = req_builder.build()?;
323    let resp = configuration.client.execute(req).await?;
324
325    let status = resp.status();
326
327    if !status.is_client_error() && !status.is_server_error() {
328        let content = resp.text().await?;
329        serde_json::from_str(&content).map_err(Error::from)
330    } else {
331        let content = resp.text().await?;
332        let entity: Option<GetDashboardError> = serde_json::from_str(&content).ok();
333        Err(Error::ResponseError(ResponseContent { status, content, entity }))
334    }
335}
336
337/// Returns the key and value of a dashboard item property.  A dashboard item enables an app to add user-specific information to a user dashboard. Dashboard items are exposed to users as gadgets that users can add to their dashboards. For more information on how users do this, see [Adding and customizing gadgets](https://confluence.atlassian.com/x/7AeiLQ).  When an app creates a dashboard item it registers a callback to receive the dashboard item ID. The callback fires whenever the item is rendered or, where the item is configurable, the user edits the item. The app then uses this resource to store the item's content or configuration details. For more information on working with dashboard items, see [ Building a dashboard item for a JIRA Connect add-on](https://developer.atlassian.com/server/jira/platform/guide-building-a-dashboard-item-for-a-jira-connect-add-on-33746254/) and the [Dashboard Item](https://developer.atlassian.com/cloud/jira/platform/modules/dashboard-item/) documentation.  There is no resource to set or get dashboard items.  This operation can be accessed anonymously.  **[Permissions](#permissions) required:** The user must be the owner of the dashboard or be shared the dashboard. Note, users with the *Administer Jira* [global permission](https://confluence.atlassian.com/x/x4dKLg) are considered owners of the System dashboard. The System dashboard is considered to be shared with all other users.
338pub async fn get_dashboard_item_property(configuration: &configuration::Configuration, dashboard_id: &str, item_id: &str, property_key: &str) -> Result<models::EntityProperty, Error<GetDashboardItemPropertyError>> {
339    // add a prefix to parameters to efficiently prevent name collisions
340    let p_dashboard_id = dashboard_id;
341    let p_item_id = item_id;
342    let p_property_key = property_key;
343
344    let uri_str = format!("{}/rest/api/2/dashboard/{dashboardId}/items/{itemId}/properties/{propertyKey}", configuration.base_path, dashboardId=crate::apis::urlencode(p_dashboard_id), itemId=crate::apis::urlencode(p_item_id), propertyKey=crate::apis::urlencode(p_property_key));
345    let mut req_builder = configuration.client.request(reqwest::Method::GET, &uri_str);
346
347    if let Some(ref user_agent) = configuration.user_agent {
348        req_builder = req_builder.header(reqwest::header::USER_AGENT, user_agent.clone());
349    }
350    if let Some(ref token) = configuration.oauth_access_token {
351        req_builder = req_builder.bearer_auth(token.to_owned());
352    };
353    if let Some(ref auth_conf) = configuration.basic_auth {
354        req_builder = req_builder.basic_auth(auth_conf.0.to_owned(), auth_conf.1.to_owned());
355    };
356
357    let req = req_builder.build()?;
358    let resp = configuration.client.execute(req).await?;
359
360    let status = resp.status();
361
362    if !status.is_client_error() && !status.is_server_error() {
363        let content = resp.text().await?;
364        serde_json::from_str(&content).map_err(Error::from)
365    } else {
366        let content = resp.text().await?;
367        let entity: Option<GetDashboardItemPropertyError> = serde_json::from_str(&content).ok();
368        Err(Error::ResponseError(ResponseContent { status, content, entity }))
369    }
370}
371
372/// Returns the keys of all properties for a dashboard item.  This operation can be accessed anonymously.  **[Permissions](#permissions) required:** The user must be the owner of the dashboard or be shared the dashboard. Note, users with the *Administer Jira* [global permission](https://confluence.atlassian.com/x/x4dKLg) are considered owners of the System dashboard. The System dashboard is considered to be shared with all other users.
373pub async fn get_dashboard_item_property_keys(configuration: &configuration::Configuration, dashboard_id: &str, item_id: &str) -> Result<models::PropertyKeys, Error<GetDashboardItemPropertyKeysError>> {
374    // add a prefix to parameters to efficiently prevent name collisions
375    let p_dashboard_id = dashboard_id;
376    let p_item_id = item_id;
377
378    let uri_str = format!("{}/rest/api/2/dashboard/{dashboardId}/items/{itemId}/properties", configuration.base_path, dashboardId=crate::apis::urlencode(p_dashboard_id), itemId=crate::apis::urlencode(p_item_id));
379    let mut req_builder = configuration.client.request(reqwest::Method::GET, &uri_str);
380
381    if let Some(ref user_agent) = configuration.user_agent {
382        req_builder = req_builder.header(reqwest::header::USER_AGENT, user_agent.clone());
383    }
384    if let Some(ref token) = configuration.oauth_access_token {
385        req_builder = req_builder.bearer_auth(token.to_owned());
386    };
387    if let Some(ref auth_conf) = configuration.basic_auth {
388        req_builder = req_builder.basic_auth(auth_conf.0.to_owned(), auth_conf.1.to_owned());
389    };
390
391    let req = req_builder.build()?;
392    let resp = configuration.client.execute(req).await?;
393
394    let status = resp.status();
395
396    if !status.is_client_error() && !status.is_server_error() {
397        let content = resp.text().await?;
398        serde_json::from_str(&content).map_err(Error::from)
399    } else {
400        let content = resp.text().await?;
401        let entity: Option<GetDashboardItemPropertyKeysError> = serde_json::from_str(&content).ok();
402        Err(Error::ResponseError(ResponseContent { status, content, entity }))
403    }
404}
405
406/// Returns a [paginated](#pagination) list of dashboards. This operation is similar to [Get dashboards](#api-rest-api-2-dashboard-get) except that the results can be refined to include dashboards that have specific attributes. For example, dashboards with a particular name. When multiple attributes are specified only filters matching all attributes are returned.  This operation can be accessed anonymously.  **[Permissions](#permissions) required:** The following dashboards that match the query parameters are returned:   *  Dashboards owned by the user. Not returned for anonymous users.  *  Dashboards shared with a group that the user is a member of. Not returned for anonymous users.  *  Dashboards shared with a private project that the user can browse. Not returned for anonymous users.  *  Dashboards shared with a public project.  *  Dashboards shared with the public.
407pub async fn get_dashboards_paginated(configuration: &configuration::Configuration, dashboard_name: Option<&str>, account_id: Option<&str>, owner: Option<&str>, groupname: Option<&str>, project_id: Option<i64>, order_by: Option<&str>, start_at: Option<i64>, max_results: Option<i32>, expand: Option<&str>) -> Result<models::PageBeanDashboard, Error<GetDashboardsPaginatedError>> {
408    // add a prefix to parameters to efficiently prevent name collisions
409    let p_dashboard_name = dashboard_name;
410    let p_account_id = account_id;
411    let p_owner = owner;
412    let p_groupname = groupname;
413    let p_project_id = project_id;
414    let p_order_by = order_by;
415    let p_start_at = start_at;
416    let p_max_results = max_results;
417    let p_expand = expand;
418
419    let uri_str = format!("{}/rest/api/2/dashboard/search", configuration.base_path);
420    let mut req_builder = configuration.client.request(reqwest::Method::GET, &uri_str);
421
422    if let Some(ref param_value) = p_dashboard_name {
423        req_builder = req_builder.query(&[("dashboardName", &param_value.to_string())]);
424    }
425    if let Some(ref param_value) = p_account_id {
426        req_builder = req_builder.query(&[("accountId", &param_value.to_string())]);
427    }
428    if let Some(ref param_value) = p_owner {
429        req_builder = req_builder.query(&[("owner", &param_value.to_string())]);
430    }
431    if let Some(ref param_value) = p_groupname {
432        req_builder = req_builder.query(&[("groupname", &param_value.to_string())]);
433    }
434    if let Some(ref param_value) = p_project_id {
435        req_builder = req_builder.query(&[("projectId", &param_value.to_string())]);
436    }
437    if let Some(ref param_value) = p_order_by {
438        req_builder = req_builder.query(&[("orderBy", &param_value.to_string())]);
439    }
440    if let Some(ref param_value) = p_start_at {
441        req_builder = req_builder.query(&[("startAt", &param_value.to_string())]);
442    }
443    if let Some(ref param_value) = p_max_results {
444        req_builder = req_builder.query(&[("maxResults", &param_value.to_string())]);
445    }
446    if let Some(ref param_value) = p_expand {
447        req_builder = req_builder.query(&[("expand", &param_value.to_string())]);
448    }
449    if let Some(ref user_agent) = configuration.user_agent {
450        req_builder = req_builder.header(reqwest::header::USER_AGENT, user_agent.clone());
451    }
452    if let Some(ref token) = configuration.oauth_access_token {
453        req_builder = req_builder.bearer_auth(token.to_owned());
454    };
455    if let Some(ref auth_conf) = configuration.basic_auth {
456        req_builder = req_builder.basic_auth(auth_conf.0.to_owned(), auth_conf.1.to_owned());
457    };
458
459    let req = req_builder.build()?;
460    let resp = configuration.client.execute(req).await?;
461
462    let status = resp.status();
463
464    if !status.is_client_error() && !status.is_server_error() {
465        let content = resp.text().await?;
466        serde_json::from_str(&content).map_err(Error::from)
467    } else {
468        let content = resp.text().await?;
469        let entity: Option<GetDashboardsPaginatedError> = serde_json::from_str(&content).ok();
470        Err(Error::ResponseError(ResponseContent { status, content, entity }))
471    }
472}
473
474/// Sets the value of a dashboard item property. Use this resource in apps to store custom data against a dashboard item.  A dashboard item enables an app to add user-specific information to a user dashboard. Dashboard items are exposed to users as gadgets that users can add to their dashboards. For more information on how users do this, see [Adding and customizing gadgets](https://confluence.atlassian.com/x/7AeiLQ).  When an app creates a dashboard item it registers a callback to receive the dashboard item ID. The callback fires whenever the item is rendered or, where the item is configurable, the user edits the item. The app then uses this resource to store the item's content or configuration details. For more information on working with dashboard items, see [ Building a dashboard item for a JIRA Connect add-on](https://developer.atlassian.com/server/jira/platform/guide-building-a-dashboard-item-for-a-jira-connect-add-on-33746254/) and the [Dashboard Item](https://developer.atlassian.com/cloud/jira/platform/modules/dashboard-item/) documentation.  There is no resource to set or get dashboard items.  The value of the request body must be a [valid](http://tools.ietf.org/html/rfc4627), non-empty JSON blob. The maximum length is 32768 characters.  This operation can be accessed anonymously.  **[Permissions](#permissions) required:** The user must be the owner of the dashboard. Note, users with the *Administer Jira* [global permission](https://confluence.atlassian.com/x/x4dKLg) are considered owners of the System dashboard.
475pub async fn set_dashboard_item_property(configuration: &configuration::Configuration, dashboard_id: &str, item_id: &str, property_key: &str, body: Option<serde_json::Value>) -> Result<serde_json::Value, Error<SetDashboardItemPropertyError>> {
476    // add a prefix to parameters to efficiently prevent name collisions
477    let p_dashboard_id = dashboard_id;
478    let p_item_id = item_id;
479    let p_property_key = property_key;
480    let p_body = body;
481
482    let uri_str = format!("{}/rest/api/2/dashboard/{dashboardId}/items/{itemId}/properties/{propertyKey}", configuration.base_path, dashboardId=crate::apis::urlencode(p_dashboard_id), itemId=crate::apis::urlencode(p_item_id), propertyKey=crate::apis::urlencode(p_property_key));
483    let mut req_builder = configuration.client.request(reqwest::Method::PUT, &uri_str);
484
485    if let Some(ref user_agent) = configuration.user_agent {
486        req_builder = req_builder.header(reqwest::header::USER_AGENT, user_agent.clone());
487    }
488    if let Some(ref token) = configuration.oauth_access_token {
489        req_builder = req_builder.bearer_auth(token.to_owned());
490    };
491    if let Some(ref auth_conf) = configuration.basic_auth {
492        req_builder = req_builder.basic_auth(auth_conf.0.to_owned(), auth_conf.1.to_owned());
493    };
494    req_builder = req_builder.json(&p_body);
495
496    let req = req_builder.build()?;
497    let resp = configuration.client.execute(req).await?;
498
499    let status = resp.status();
500
501    if !status.is_client_error() && !status.is_server_error() {
502        let content = resp.text().await?;
503        serde_json::from_str(&content).map_err(Error::from)
504    } else {
505        let content = resp.text().await?;
506        let entity: Option<SetDashboardItemPropertyError> = serde_json::from_str(&content).ok();
507        Err(Error::ResponseError(ResponseContent { status, content, entity }))
508    }
509}
510
511/// Updates a dashboard, replacing all the dashboard details with those provided.  **[Permissions](#permissions) required:** None  The dashboard to be updated must be owned by the user.
512pub async fn update_dashboard(configuration: &configuration::Configuration, id: &str, dashboard_details: models::DashboardDetails) -> Result<models::Dashboard, Error<UpdateDashboardError>> {
513    // add a prefix to parameters to efficiently prevent name collisions
514    let p_id = id;
515    let p_dashboard_details = dashboard_details;
516
517    let uri_str = format!("{}/rest/api/2/dashboard/{id}", configuration.base_path, id=crate::apis::urlencode(p_id));
518    let mut req_builder = configuration.client.request(reqwest::Method::PUT, &uri_str);
519
520    if let Some(ref user_agent) = configuration.user_agent {
521        req_builder = req_builder.header(reqwest::header::USER_AGENT, user_agent.clone());
522    }
523    if let Some(ref token) = configuration.oauth_access_token {
524        req_builder = req_builder.bearer_auth(token.to_owned());
525    };
526    if let Some(ref auth_conf) = configuration.basic_auth {
527        req_builder = req_builder.basic_auth(auth_conf.0.to_owned(), auth_conf.1.to_owned());
528    };
529    req_builder = req_builder.json(&p_dashboard_details);
530
531    let req = req_builder.build()?;
532    let resp = configuration.client.execute(req).await?;
533
534    let status = resp.status();
535
536    if !status.is_client_error() && !status.is_server_error() {
537        let content = resp.text().await?;
538        serde_json::from_str(&content).map_err(Error::from)
539    } else {
540        let content = resp.text().await?;
541        let entity: Option<UpdateDashboardError> = serde_json::from_str(&content).ok();
542        Err(Error::ResponseError(ResponseContent { status, content, entity }))
543    }
544}
545