hi_jira2/apis/
project_roles_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;
13
14use crate::apis::ResponseContent;
15use super::{Error, configuration};
16
17/// struct for passing parameters to the method [`create_project_role`]
18#[derive(Clone, Debug, Default)]
19pub struct CreateProjectRoleParams {
20    pub create_update_role_request_bean: crate::models::CreateUpdateRoleRequestBean
21}
22
23/// struct for passing parameters to the method [`delete_project_role`]
24#[derive(Clone, Debug, Default)]
25pub struct DeleteProjectRoleParams {
26    /// The ID of the project role to delete. Use [Get all project roles](#api-rest-api-2-role-get) to get a list of project role IDs.
27    pub id: i64,
28    /// The ID of the project role that will replace the one being deleted.
29    pub swap: Option<i64>
30}
31
32/// struct for passing parameters to the method [`fully_update_project_role`]
33#[derive(Clone, Debug, Default)]
34pub struct FullyUpdateProjectRoleParams {
35    /// The ID of the project role. Use [Get all project roles](#api-rest-api-2-role-get) to get a list of project role IDs.
36    pub id: i64,
37    pub create_update_role_request_bean: crate::models::CreateUpdateRoleRequestBean
38}
39
40/// struct for passing parameters to the method [`get_project_role`]
41#[derive(Clone, Debug, Default)]
42pub struct GetProjectRoleParams {
43    /// The project ID or project key (case sensitive).
44    pub project_id_or_key: String,
45    /// The ID of the project role. Use [Get all project roles](#api-rest-api-2-role-get) to get a list of project role IDs.
46    pub id: i64,
47    /// Exclude inactive users.
48    pub exclude_inactive_users: Option<bool>
49}
50
51/// struct for passing parameters to the method [`get_project_role_by_id`]
52#[derive(Clone, Debug, Default)]
53pub struct GetProjectRoleByIdParams {
54    /// The ID of the project role. Use [Get all project roles](#api-rest-api-2-role-get) to get a list of project role IDs.
55    pub id: i64
56}
57
58/// struct for passing parameters to the method [`get_project_role_details`]
59#[derive(Clone, Debug, Default)]
60pub struct GetProjectRoleDetailsParams {
61    /// The project ID or project key (case sensitive).
62    pub project_id_or_key: String,
63    /// Whether the roles should be filtered to include only those the user is assigned to.
64    pub current_member: Option<bool>,
65    pub exclude_connect_addons: Option<bool>
66}
67
68/// struct for passing parameters to the method [`get_project_roles`]
69#[derive(Clone, Debug, Default)]
70pub struct GetProjectRolesParams {
71    /// The project ID or project key (case sensitive).
72    pub project_id_or_key: String
73}
74
75/// struct for passing parameters to the method [`partial_update_project_role`]
76#[derive(Clone, Debug, Default)]
77pub struct PartialUpdateProjectRoleParams {
78    /// The ID of the project role. Use [Get all project roles](#api-rest-api-2-role-get) to get a list of project role IDs.
79    pub id: i64,
80    pub create_update_role_request_bean: crate::models::CreateUpdateRoleRequestBean
81}
82
83
84/// struct for typed errors of method [`create_project_role`]
85#[derive(Debug, Clone, Serialize, Deserialize)]
86#[serde(untagged)]
87pub enum CreateProjectRoleError {
88    Status400(),
89    Status401(),
90    Status403(),
91    Status409(),
92    UnknownValue(serde_json::Value),
93}
94
95/// struct for typed errors of method [`delete_project_role`]
96#[derive(Debug, Clone, Serialize, Deserialize)]
97#[serde(untagged)]
98pub enum DeleteProjectRoleError {
99    Status400(),
100    Status401(),
101    Status403(),
102    Status404(),
103    Status409(),
104    UnknownValue(serde_json::Value),
105}
106
107/// struct for typed errors of method [`fully_update_project_role`]
108#[derive(Debug, Clone, Serialize, Deserialize)]
109#[serde(untagged)]
110pub enum FullyUpdateProjectRoleError {
111    Status400(),
112    Status401(),
113    Status403(),
114    Status404(),
115    UnknownValue(serde_json::Value),
116}
117
118/// struct for typed errors of method [`get_all_project_roles`]
119#[derive(Debug, Clone, Serialize, Deserialize)]
120#[serde(untagged)]
121pub enum GetAllProjectRolesError {
122    Status401(),
123    Status403(),
124    UnknownValue(serde_json::Value),
125}
126
127/// struct for typed errors of method [`get_project_role`]
128#[derive(Debug, Clone, Serialize, Deserialize)]
129#[serde(untagged)]
130pub enum GetProjectRoleError {
131    Status400(),
132    Status401(),
133    Status404(),
134    UnknownValue(serde_json::Value),
135}
136
137/// struct for typed errors of method [`get_project_role_by_id`]
138#[derive(Debug, Clone, Serialize, Deserialize)]
139#[serde(untagged)]
140pub enum GetProjectRoleByIdError {
141    Status401(),
142    Status403(),
143    Status404(),
144    UnknownValue(serde_json::Value),
145}
146
147/// struct for typed errors of method [`get_project_role_details`]
148#[derive(Debug, Clone, Serialize, Deserialize)]
149#[serde(untagged)]
150pub enum GetProjectRoleDetailsError {
151    Status401(),
152    Status404(),
153    UnknownValue(serde_json::Value),
154}
155
156/// struct for typed errors of method [`get_project_roles`]
157#[derive(Debug, Clone, Serialize, Deserialize)]
158#[serde(untagged)]
159pub enum GetProjectRolesError {
160    Status401(),
161    Status404(),
162    UnknownValue(serde_json::Value),
163}
164
165/// struct for typed errors of method [`partial_update_project_role`]
166#[derive(Debug, Clone, Serialize, Deserialize)]
167#[serde(untagged)]
168pub enum PartialUpdateProjectRoleError {
169    Status400(),
170    Status401(),
171    Status403(),
172    Status404(),
173    UnknownValue(serde_json::Value),
174}
175
176
177/// Creates a new project role with no [default actors](#api-rest-api-2-resolution-get). You can use the [Add default actors to project role](#api-rest-api-2-role-id-actors-post) operation to add default actors to the project role after creating it.  *Note that although a new project role is available to all projects upon creation, any default actors that are associated with the project role are not added to projects that existed prior to the role being created.*<  **[Permissions](#permissions) required:** *Administer Jira* [global permission](https://confluence.atlassian.com/x/x4dKLg).
178pub async fn create_project_role(configuration: &configuration::Configuration, params: CreateProjectRoleParams) -> Result<crate::models::ProjectRole, Error<CreateProjectRoleError>> {
179    let local_var_configuration = configuration;
180
181    // unbox the parameters
182    let create_update_role_request_bean = params.create_update_role_request_bean;
183
184
185    let local_var_client = &local_var_configuration.client;
186
187    let local_var_uri_str = format!("{}/rest/api/2/role", local_var_configuration.base_path);
188    let mut local_var_req_builder = local_var_client.request(reqwest::Method::POST, local_var_uri_str.as_str());
189
190    if let Some(ref local_var_user_agent) = local_var_configuration.user_agent {
191        local_var_req_builder = local_var_req_builder.header(reqwest::header::USER_AGENT, local_var_user_agent.clone());
192    }
193    if let Some(ref local_var_token) = local_var_configuration.oauth_access_token {
194        local_var_req_builder = local_var_req_builder.bearer_auth(local_var_token.to_owned());
195    };
196    if let Some(ref local_var_auth_conf) = local_var_configuration.basic_auth {
197        local_var_req_builder = local_var_req_builder.basic_auth(local_var_auth_conf.0.to_owned(), local_var_auth_conf.1.to_owned());
198    };
199    local_var_req_builder = local_var_req_builder.json(&create_update_role_request_bean);
200
201    let local_var_req = local_var_req_builder.build()?;
202    let local_var_resp = local_var_client.execute(local_var_req).await?;
203
204    let local_var_status = local_var_resp.status();
205    let local_var_content = local_var_resp.text().await?;
206
207    if !local_var_status.is_client_error() && !local_var_status.is_server_error() {
208        serde_json::from_str(&local_var_content).map_err(Error::from)
209    } else {
210        let local_var_entity: Option<CreateProjectRoleError> = serde_json::from_str(&local_var_content).ok();
211        let local_var_error = ResponseContent { status: local_var_status, content: local_var_content, entity: local_var_entity };
212        Err(Error::ResponseError(local_var_error))
213    }
214}
215
216/// Deletes a project role. You must specify a replacement project role if you wish to delete a project role that is in use.  **[Permissions](#permissions) required:** *Administer Jira* [global permission](https://confluence.atlassian.com/x/x4dKLg).
217pub async fn delete_project_role(configuration: &configuration::Configuration, params: DeleteProjectRoleParams) -> Result<(), Error<DeleteProjectRoleError>> {
218    let local_var_configuration = configuration;
219
220    // unbox the parameters
221    let id = params.id;
222    let swap = params.swap;
223
224
225    let local_var_client = &local_var_configuration.client;
226
227    let local_var_uri_str = format!("{}/rest/api/2/role/{id}", local_var_configuration.base_path, id=id);
228    let mut local_var_req_builder = local_var_client.request(reqwest::Method::DELETE, local_var_uri_str.as_str());
229
230    if let Some(ref local_var_str) = swap {
231        local_var_req_builder = local_var_req_builder.query(&[("swap", &local_var_str.to_string())]);
232    }
233    if let Some(ref local_var_user_agent) = local_var_configuration.user_agent {
234        local_var_req_builder = local_var_req_builder.header(reqwest::header::USER_AGENT, local_var_user_agent.clone());
235    }
236    if let Some(ref local_var_token) = local_var_configuration.oauth_access_token {
237        local_var_req_builder = local_var_req_builder.bearer_auth(local_var_token.to_owned());
238    };
239    if let Some(ref local_var_auth_conf) = local_var_configuration.basic_auth {
240        local_var_req_builder = local_var_req_builder.basic_auth(local_var_auth_conf.0.to_owned(), local_var_auth_conf.1.to_owned());
241    };
242
243    let local_var_req = local_var_req_builder.build()?;
244    let local_var_resp = local_var_client.execute(local_var_req).await?;
245
246    let local_var_status = local_var_resp.status();
247    let local_var_content = local_var_resp.text().await?;
248
249    if !local_var_status.is_client_error() && !local_var_status.is_server_error() {
250        Ok(())
251    } else {
252        let local_var_entity: Option<DeleteProjectRoleError> = serde_json::from_str(&local_var_content).ok();
253        let local_var_error = ResponseContent { status: local_var_status, content: local_var_content, entity: local_var_entity };
254        Err(Error::ResponseError(local_var_error))
255    }
256}
257
258/// Updates the project role's name and description. You must include both a name and a description in the request.  **[Permissions](#permissions) required:** *Administer Jira* [global permission](https://confluence.atlassian.com/x/x4dKLg).
259pub async fn fully_update_project_role(configuration: &configuration::Configuration, params: FullyUpdateProjectRoleParams) -> Result<crate::models::ProjectRole, Error<FullyUpdateProjectRoleError>> {
260    let local_var_configuration = configuration;
261
262    // unbox the parameters
263    let id = params.id;
264    let create_update_role_request_bean = params.create_update_role_request_bean;
265
266
267    let local_var_client = &local_var_configuration.client;
268
269    let local_var_uri_str = format!("{}/rest/api/2/role/{id}", local_var_configuration.base_path, id=id);
270    let mut local_var_req_builder = local_var_client.request(reqwest::Method::PUT, local_var_uri_str.as_str());
271
272    if let Some(ref local_var_user_agent) = local_var_configuration.user_agent {
273        local_var_req_builder = local_var_req_builder.header(reqwest::header::USER_AGENT, local_var_user_agent.clone());
274    }
275    if let Some(ref local_var_token) = local_var_configuration.oauth_access_token {
276        local_var_req_builder = local_var_req_builder.bearer_auth(local_var_token.to_owned());
277    };
278    if let Some(ref local_var_auth_conf) = local_var_configuration.basic_auth {
279        local_var_req_builder = local_var_req_builder.basic_auth(local_var_auth_conf.0.to_owned(), local_var_auth_conf.1.to_owned());
280    };
281    local_var_req_builder = local_var_req_builder.json(&create_update_role_request_bean);
282
283    let local_var_req = local_var_req_builder.build()?;
284    let local_var_resp = local_var_client.execute(local_var_req).await?;
285
286    let local_var_status = local_var_resp.status();
287    let local_var_content = local_var_resp.text().await?;
288
289    if !local_var_status.is_client_error() && !local_var_status.is_server_error() {
290        serde_json::from_str(&local_var_content).map_err(Error::from)
291    } else {
292        let local_var_entity: Option<FullyUpdateProjectRoleError> = serde_json::from_str(&local_var_content).ok();
293        let local_var_error = ResponseContent { status: local_var_status, content: local_var_content, entity: local_var_entity };
294        Err(Error::ResponseError(local_var_error))
295    }
296}
297
298/// Gets a list of all project roles, complete with project role details and default actors.  ### About project roles ###  [Project roles](https://confluence.atlassian.com/x/3odKLg) are a flexible way to to associate users and groups with projects. In Jira Cloud, the list of project roles is shared globally with all projects, but each project can have a different set of actors associated with it (unlike groups, which have the same membership throughout all Jira applications).  Project roles are used in [permission schemes](#api-rest-api-2-permissionscheme-get), [email notification schemes](#api-rest-api-2-notificationscheme-get), [issue security levels](#api-rest-api-2-issuesecurityschemes-get), [comment visibility](#api-rest-api-2-comment-list-post), and workflow conditions.  #### Members and actors ####  In the Jira REST API, a member of a project role is called an *actor*. An *actor* is a group or user associated with a project role.  Actors may be set as [default members](https://confluence.atlassian.com/x/3odKLg#Managingprojectroles-Specifying'defaultmembers'foraprojectrole) of the project role or set at the project level:   *  Default actors: Users and groups that are assigned to the project role for all newly created projects. The default actors can be removed at the project level later if desired.  *  Actors: Users and groups that are associated with a project role for a project, which may differ from the default actors. This enables you to assign a user to different roles in different projects.  **[Permissions](#permissions) required:** *Administer Jira* [global permission](https://confluence.atlassian.com/x/x4dKLg).
299pub async fn get_all_project_roles(configuration: &configuration::Configuration) -> Result<Vec<crate::models::ProjectRole>, Error<GetAllProjectRolesError>> {
300    let local_var_configuration = configuration;
301
302    // unbox the parameters
303
304
305    let local_var_client = &local_var_configuration.client;
306
307    let local_var_uri_str = format!("{}/rest/api/2/role", local_var_configuration.base_path);
308    let mut local_var_req_builder = local_var_client.request(reqwest::Method::GET, local_var_uri_str.as_str());
309
310    if let Some(ref local_var_user_agent) = local_var_configuration.user_agent {
311        local_var_req_builder = local_var_req_builder.header(reqwest::header::USER_AGENT, local_var_user_agent.clone());
312    }
313    if let Some(ref local_var_token) = local_var_configuration.oauth_access_token {
314        local_var_req_builder = local_var_req_builder.bearer_auth(local_var_token.to_owned());
315    };
316    if let Some(ref local_var_auth_conf) = local_var_configuration.basic_auth {
317        local_var_req_builder = local_var_req_builder.basic_auth(local_var_auth_conf.0.to_owned(), local_var_auth_conf.1.to_owned());
318    };
319
320    let local_var_req = local_var_req_builder.build()?;
321    let local_var_resp = local_var_client.execute(local_var_req).await?;
322
323    let local_var_status = local_var_resp.status();
324    let local_var_content = local_var_resp.text().await?;
325
326    if !local_var_status.is_client_error() && !local_var_status.is_server_error() {
327        serde_json::from_str(&local_var_content).map_err(Error::from)
328    } else {
329        let local_var_entity: Option<GetAllProjectRolesError> = serde_json::from_str(&local_var_content).ok();
330        let local_var_error = ResponseContent { status: local_var_status, content: local_var_content, entity: local_var_entity };
331        Err(Error::ResponseError(local_var_error))
332    }
333}
334
335/// Returns a project role's details and actors associated with the project. The list of actors is sorted by display name.  To check whether a user belongs to a role based on their group memberships, use [Get user](#api-rest-api-2-user-get) with the `groups` expand parameter selected. Then check whether the user keys and groups match with the actors returned for the project.  This operation can be accessed anonymously.  **[Permissions](#permissions) required:** *Administer Projects* [project permission](https://confluence.atlassian.com/x/yodKLg) for the project or *Administer Jira* [global permission](https://confluence.atlassian.com/x/x4dKLg).
336pub async fn get_project_role(configuration: &configuration::Configuration, params: GetProjectRoleParams) -> Result<crate::models::ProjectRole, Error<GetProjectRoleError>> {
337    let local_var_configuration = configuration;
338
339    // unbox the parameters
340    let project_id_or_key = params.project_id_or_key;
341    let id = params.id;
342    let exclude_inactive_users = params.exclude_inactive_users;
343
344
345    let local_var_client = &local_var_configuration.client;
346
347    let local_var_uri_str = format!("{}/rest/api/2/project/{projectIdOrKey}/role/{id}", local_var_configuration.base_path, projectIdOrKey=crate::apis::urlencode(project_id_or_key), id=id);
348    let mut local_var_req_builder = local_var_client.request(reqwest::Method::GET, local_var_uri_str.as_str());
349
350    if let Some(ref local_var_str) = exclude_inactive_users {
351        local_var_req_builder = local_var_req_builder.query(&[("excludeInactiveUsers", &local_var_str.to_string())]);
352    }
353    if let Some(ref local_var_user_agent) = local_var_configuration.user_agent {
354        local_var_req_builder = local_var_req_builder.header(reqwest::header::USER_AGENT, local_var_user_agent.clone());
355    }
356    if let Some(ref local_var_token) = local_var_configuration.oauth_access_token {
357        local_var_req_builder = local_var_req_builder.bearer_auth(local_var_token.to_owned());
358    };
359    if let Some(ref local_var_auth_conf) = local_var_configuration.basic_auth {
360        local_var_req_builder = local_var_req_builder.basic_auth(local_var_auth_conf.0.to_owned(), local_var_auth_conf.1.to_owned());
361    };
362
363    let local_var_req = local_var_req_builder.build()?;
364    let local_var_resp = local_var_client.execute(local_var_req).await?;
365
366    let local_var_status = local_var_resp.status();
367    let local_var_content = local_var_resp.text().await?;
368
369    if !local_var_status.is_client_error() && !local_var_status.is_server_error() {
370        serde_json::from_str(&local_var_content).map_err(Error::from)
371    } else {
372        let local_var_entity: Option<GetProjectRoleError> = serde_json::from_str(&local_var_content).ok();
373        let local_var_error = ResponseContent { status: local_var_status, content: local_var_content, entity: local_var_entity };
374        Err(Error::ResponseError(local_var_error))
375    }
376}
377
378/// Gets the project role details and the default actors associated with the role. The list of default actors is sorted by display name.  **[Permissions](#permissions) required:** *Administer Jira* [global permission](https://confluence.atlassian.com/x/x4dKLg).
379pub async fn get_project_role_by_id(configuration: &configuration::Configuration, params: GetProjectRoleByIdParams) -> Result<crate::models::ProjectRole, Error<GetProjectRoleByIdError>> {
380    let local_var_configuration = configuration;
381
382    // unbox the parameters
383    let id = params.id;
384
385
386    let local_var_client = &local_var_configuration.client;
387
388    let local_var_uri_str = format!("{}/rest/api/2/role/{id}", local_var_configuration.base_path, id=id);
389    let mut local_var_req_builder = local_var_client.request(reqwest::Method::GET, local_var_uri_str.as_str());
390
391    if let Some(ref local_var_user_agent) = local_var_configuration.user_agent {
392        local_var_req_builder = local_var_req_builder.header(reqwest::header::USER_AGENT, local_var_user_agent.clone());
393    }
394    if let Some(ref local_var_token) = local_var_configuration.oauth_access_token {
395        local_var_req_builder = local_var_req_builder.bearer_auth(local_var_token.to_owned());
396    };
397    if let Some(ref local_var_auth_conf) = local_var_configuration.basic_auth {
398        local_var_req_builder = local_var_req_builder.basic_auth(local_var_auth_conf.0.to_owned(), local_var_auth_conf.1.to_owned());
399    };
400
401    let local_var_req = local_var_req_builder.build()?;
402    let local_var_resp = local_var_client.execute(local_var_req).await?;
403
404    let local_var_status = local_var_resp.status();
405    let local_var_content = local_var_resp.text().await?;
406
407    if !local_var_status.is_client_error() && !local_var_status.is_server_error() {
408        serde_json::from_str(&local_var_content).map_err(Error::from)
409    } else {
410        let local_var_entity: Option<GetProjectRoleByIdError> = serde_json::from_str(&local_var_content).ok();
411        let local_var_error = ResponseContent { status: local_var_status, content: local_var_content, entity: local_var_entity };
412        Err(Error::ResponseError(local_var_error))
413    }
414}
415
416/// Returns all [project roles](https://confluence.atlassian.com/x/3odKLg) and the details for each role. Note that the list of project roles is common to all projects.  This operation can be accessed anonymously.  **[Permissions](#permissions) required:** *Administer Jira* [global permission](https://confluence.atlassian.com/x/x4dKLg) or *Administer projects* [project permission](https://confluence.atlassian.com/x/yodKLg) for the project.
417pub async fn get_project_role_details(configuration: &configuration::Configuration, params: GetProjectRoleDetailsParams) -> Result<Vec<crate::models::ProjectRoleDetails>, Error<GetProjectRoleDetailsError>> {
418    let local_var_configuration = configuration;
419
420    // unbox the parameters
421    let project_id_or_key = params.project_id_or_key;
422    let current_member = params.current_member;
423    let exclude_connect_addons = params.exclude_connect_addons;
424
425
426    let local_var_client = &local_var_configuration.client;
427
428    let local_var_uri_str = format!("{}/rest/api/2/project/{projectIdOrKey}/roledetails", local_var_configuration.base_path, projectIdOrKey=crate::apis::urlencode(project_id_or_key));
429    let mut local_var_req_builder = local_var_client.request(reqwest::Method::GET, local_var_uri_str.as_str());
430
431    if let Some(ref local_var_str) = current_member {
432        local_var_req_builder = local_var_req_builder.query(&[("currentMember", &local_var_str.to_string())]);
433    }
434    if let Some(ref local_var_str) = exclude_connect_addons {
435        local_var_req_builder = local_var_req_builder.query(&[("excludeConnectAddons", &local_var_str.to_string())]);
436    }
437    if let Some(ref local_var_user_agent) = local_var_configuration.user_agent {
438        local_var_req_builder = local_var_req_builder.header(reqwest::header::USER_AGENT, local_var_user_agent.clone());
439    }
440    if let Some(ref local_var_token) = local_var_configuration.oauth_access_token {
441        local_var_req_builder = local_var_req_builder.bearer_auth(local_var_token.to_owned());
442    };
443    if let Some(ref local_var_auth_conf) = local_var_configuration.basic_auth {
444        local_var_req_builder = local_var_req_builder.basic_auth(local_var_auth_conf.0.to_owned(), local_var_auth_conf.1.to_owned());
445    };
446
447    let local_var_req = local_var_req_builder.build()?;
448    let local_var_resp = local_var_client.execute(local_var_req).await?;
449
450    let local_var_status = local_var_resp.status();
451    let local_var_content = local_var_resp.text().await?;
452
453    if !local_var_status.is_client_error() && !local_var_status.is_server_error() {
454        serde_json::from_str(&local_var_content).map_err(Error::from)
455    } else {
456        let local_var_entity: Option<GetProjectRoleDetailsError> = serde_json::from_str(&local_var_content).ok();
457        let local_var_error = ResponseContent { status: local_var_status, content: local_var_content, entity: local_var_entity };
458        Err(Error::ResponseError(local_var_error))
459    }
460}
461
462/// Returns a list of [project roles](https://confluence.atlassian.com/x/3odKLg) for the project returning the name and self URL for each role.  Note that all project roles are shared with all projects in Jira Cloud. See [Get all project roles](#api-rest-api-2-role-get) for more information.  This operation can be accessed anonymously.  **[Permissions](#permissions) required:** *Administer Projects* [project permission](https://confluence.atlassian.com/x/yodKLg) for any project on the site or *Administer Jira* [global permission](https://confluence.atlassian.com/x/x4dKLg).
463pub async fn get_project_roles(configuration: &configuration::Configuration, params: GetProjectRolesParams) -> Result<::std::collections::HashMap<String, String>, Error<GetProjectRolesError>> {
464    let local_var_configuration = configuration;
465
466    // unbox the parameters
467    let project_id_or_key = params.project_id_or_key;
468
469
470    let local_var_client = &local_var_configuration.client;
471
472    let local_var_uri_str = format!("{}/rest/api/2/project/{projectIdOrKey}/role", local_var_configuration.base_path, projectIdOrKey=crate::apis::urlencode(project_id_or_key));
473    let mut local_var_req_builder = local_var_client.request(reqwest::Method::GET, local_var_uri_str.as_str());
474
475    if let Some(ref local_var_user_agent) = local_var_configuration.user_agent {
476        local_var_req_builder = local_var_req_builder.header(reqwest::header::USER_AGENT, local_var_user_agent.clone());
477    }
478    if let Some(ref local_var_token) = local_var_configuration.oauth_access_token {
479        local_var_req_builder = local_var_req_builder.bearer_auth(local_var_token.to_owned());
480    };
481    if let Some(ref local_var_auth_conf) = local_var_configuration.basic_auth {
482        local_var_req_builder = local_var_req_builder.basic_auth(local_var_auth_conf.0.to_owned(), local_var_auth_conf.1.to_owned());
483    };
484
485    let local_var_req = local_var_req_builder.build()?;
486    let local_var_resp = local_var_client.execute(local_var_req).await?;
487
488    let local_var_status = local_var_resp.status();
489    let local_var_content = local_var_resp.text().await?;
490
491    if !local_var_status.is_client_error() && !local_var_status.is_server_error() {
492        serde_json::from_str(&local_var_content).map_err(Error::from)
493    } else {
494        let local_var_entity: Option<GetProjectRolesError> = serde_json::from_str(&local_var_content).ok();
495        let local_var_error = ResponseContent { status: local_var_status, content: local_var_content, entity: local_var_entity };
496        Err(Error::ResponseError(local_var_error))
497    }
498}
499
500/// Updates either the project role's name or its description.  You cannot update both the name and description at the same time using this operation. If you send a request with a name and a description only the name is updated.  **[Permissions](#permissions) required:** *Administer Jira* [global permission](https://confluence.atlassian.com/x/x4dKLg).
501pub async fn partial_update_project_role(configuration: &configuration::Configuration, params: PartialUpdateProjectRoleParams) -> Result<crate::models::ProjectRole, Error<PartialUpdateProjectRoleError>> {
502    let local_var_configuration = configuration;
503
504    // unbox the parameters
505    let id = params.id;
506    let create_update_role_request_bean = params.create_update_role_request_bean;
507
508
509    let local_var_client = &local_var_configuration.client;
510
511    let local_var_uri_str = format!("{}/rest/api/2/role/{id}", local_var_configuration.base_path, id=id);
512    let mut local_var_req_builder = local_var_client.request(reqwest::Method::POST, local_var_uri_str.as_str());
513
514    if let Some(ref local_var_user_agent) = local_var_configuration.user_agent {
515        local_var_req_builder = local_var_req_builder.header(reqwest::header::USER_AGENT, local_var_user_agent.clone());
516    }
517    if let Some(ref local_var_token) = local_var_configuration.oauth_access_token {
518        local_var_req_builder = local_var_req_builder.bearer_auth(local_var_token.to_owned());
519    };
520    if let Some(ref local_var_auth_conf) = local_var_configuration.basic_auth {
521        local_var_req_builder = local_var_req_builder.basic_auth(local_var_auth_conf.0.to_owned(), local_var_auth_conf.1.to_owned());
522    };
523    local_var_req_builder = local_var_req_builder.json(&create_update_role_request_bean);
524
525    let local_var_req = local_var_req_builder.build()?;
526    let local_var_resp = local_var_client.execute(local_var_req).await?;
527
528    let local_var_status = local_var_resp.status();
529    let local_var_content = local_var_resp.text().await?;
530
531    if !local_var_status.is_client_error() && !local_var_status.is_server_error() {
532        serde_json::from_str(&local_var_content).map_err(Error::from)
533    } else {
534        let local_var_entity: Option<PartialUpdateProjectRoleError> = serde_json::from_str(&local_var_content).ok();
535        let local_var_error = ResponseContent { status: local_var_status, content: local_var_content, entity: local_var_entity };
536        Err(Error::ResponseError(local_var_error))
537    }
538}
539