jira2/apis/
groups_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 [`add_user_to_group`]
18#[derive(Clone, Debug, Default)]
19pub struct AddUserToGroupParams {
20    /// The user to add to the group.
21    pub request_body: ::std::collections::HashMap<String, serde_json::Value>,
22    /// As a group's name can change, use of `groupId` is recommended to identify a group.   The name of the group. This parameter cannot be used with the `groupId` parameter.
23    pub groupname: Option<String>,
24    /// The ID of the group. This parameter cannot be used with the `groupName` parameter.
25    pub group_id: Option<String>
26}
27
28/// struct for passing parameters to the method [`bulk_get_groups`]
29#[derive(Clone, Debug, Default)]
30pub struct BulkGetGroupsParams {
31    /// The index of the first item to return in a page of results (page offset).
32    pub start_at: Option<i64>,
33    /// The maximum number of items to return per page.
34    pub max_results: Option<i32>,
35    /// The ID of a group. To specify multiple IDs, pass multiple `groupId` parameters. For example, `groupId=5b10a2844c20165700ede21g&groupId=5b10ac8d82e05b22cc7d4ef5`.
36    pub group_id: Option<Vec<String>>,
37    /// The name of a group. To specify multiple names, pass multiple `groupName` parameters. For example, `groupName=administrators&groupName=jira-software-users`.
38    pub group_name: Option<Vec<String>>
39}
40
41/// struct for passing parameters to the method [`create_group`]
42#[derive(Clone, Debug, Default)]
43pub struct CreateGroupParams {
44    /// The name of the group.
45    pub request_body: ::std::collections::HashMap<String, serde_json::Value>
46}
47
48/// struct for passing parameters to the method [`find_groups`]
49#[derive(Clone, Debug, Default)]
50pub struct FindGroupsParams {
51    /// This parameter is deprecated, setting it does not affect the results. To find groups containing a particular user, use [Get user groups](#api-rest-api-2-user-groups-get).
52    pub account_id: Option<String>,
53    /// The string to find in group names.
54    pub query: Option<String>,
55    /// As a group's name can change, use of `excludeGroupIds` is recommended to identify a group.   A group to exclude from the result. To exclude multiple groups, provide an ampersand-separated list. For example, `exclude=group1&exclude=group2`. This parameter cannot be used with the `excludeGroupIds` parameter.
56    pub exclude: Option<Vec<String>>,
57    /// A group ID to exclude from the result. To exclude multiple groups, provide an ampersand-separated list. For example, `excludeId=group1-id&excludeId=group2-id`. This parameter cannot be used with the `excludeGroups` parameter.
58    pub exclude_id: Option<Vec<String>>,
59    /// The maximum number of groups to return. The maximum number of groups that can be returned is limited by the system property `jira.ajax.autocomplete.limit`.
60    pub max_results: Option<i32>,
61    /// This parameter is no longer available. See the [deprecation notice](https://developer.atlassian.com/cloud/jira/platform/deprecation-notice-user-privacy-api-migration-guide/) for details.
62    pub user_name: Option<String>
63}
64
65/// struct for passing parameters to the method [`get_group`]
66#[derive(Clone, Debug, Default)]
67pub struct GetGroupParams {
68    /// As a group's name can change, use of `groupId` is recommended to identify a group.   The name of the group. This parameter cannot be used with the `groupId` parameter.
69    pub groupname: Option<String>,
70    /// The ID of the group. This parameter cannot be used with the `groupName` parameter.
71    pub group_id: Option<String>,
72    /// List of fields to expand.
73    pub expand: Option<String>
74}
75
76/// struct for passing parameters to the method [`get_users_from_group`]
77#[derive(Clone, Debug, Default)]
78pub struct GetUsersFromGroupParams {
79    /// As a group's name can change, use of `groupId` is recommended to identify a group.   The name of the group. This parameter cannot be used with the `groupId` parameter.
80    pub groupname: Option<String>,
81    /// The ID of the group. This parameter cannot be used with the `groupName` parameter.
82    pub group_id: Option<String>,
83    /// Include inactive users.
84    pub include_inactive_users: Option<bool>,
85    /// The index of the first item to return in a page of results (page offset).
86    pub start_at: Option<i64>,
87    /// The maximum number of items to return per page.
88    pub max_results: Option<i32>
89}
90
91/// struct for passing parameters to the method [`remove_group`]
92#[derive(Clone, Debug, Default)]
93pub struct RemoveGroupParams {
94    /// As a group's name can change, use of `groupId` is recommended to identify a group.   The name of the group. This parameter cannot be used with the `groupId` parameter.
95    pub groupname: Option<String>,
96    /// The ID of the group. This parameter cannot be used with the `groupId` parameter. This parameter cannot be used with the `groupName` parameter.
97    pub group_id: Option<String>,
98    /// As a group's name can change, use of `swapGroupId` is recommended to identify a group.   The group to transfer restrictions to. Only comments and worklogs are transferred. If restrictions are not transferred, comments and worklogs are inaccessible after the deletion. This parameter cannot be used with the `swapGroupId` parameter.
99    pub swap_group: Option<String>,
100    /// The ID of the group to transfer restrictions to. Only comments and worklogs are transferred. If restrictions are not transferred, comments and worklogs are inaccessible after the deletion. This parameter cannot be used with the `swapGroup` parameter.
101    pub swap_group_id: Option<String>
102}
103
104/// struct for passing parameters to the method [`remove_user_from_group`]
105#[derive(Clone, Debug, Default)]
106pub struct RemoveUserFromGroupParams {
107    /// The account ID of the user, which uniquely identifies the user across all Atlassian products. For example, *5b10ac8d82e05b22cc7d4ef5*.
108    pub account_id: String,
109    /// As a group's name can change, use of `groupId` is recommended to identify a group.   The name of the group. This parameter cannot be used with the `groupId` parameter.
110    pub groupname: Option<String>,
111    /// The ID of the group. This parameter cannot be used with the `groupName` parameter.
112    pub group_id: Option<String>,
113    /// This parameter is no longer available. See the [deprecation notice](https://developer.atlassian.com/cloud/jira/platform/deprecation-notice-user-privacy-api-migration-guide/) for details.
114    pub username: Option<String>
115}
116
117
118/// struct for typed errors of method [`add_user_to_group`]
119#[derive(Debug, Clone, Serialize, Deserialize)]
120#[serde(untagged)]
121pub enum AddUserToGroupError {
122    Status400(),
123    Status401(),
124    Status403(),
125    Status404(),
126    UnknownValue(serde_json::Value),
127}
128
129/// struct for typed errors of method [`bulk_get_groups`]
130#[derive(Debug, Clone, Serialize, Deserialize)]
131#[serde(untagged)]
132pub enum BulkGetGroupsError {
133    Status400(),
134    Status401(),
135    Status403(),
136    UnknownValue(serde_json::Value),
137}
138
139/// struct for typed errors of method [`create_group`]
140#[derive(Debug, Clone, Serialize, Deserialize)]
141#[serde(untagged)]
142pub enum CreateGroupError {
143    Status400(),
144    Status401(),
145    Status403(),
146    UnknownValue(serde_json::Value),
147}
148
149/// struct for typed errors of method [`find_groups`]
150#[derive(Debug, Clone, Serialize, Deserialize)]
151#[serde(untagged)]
152pub enum FindGroupsError {
153    UnknownValue(serde_json::Value),
154}
155
156/// struct for typed errors of method [`get_group`]
157#[derive(Debug, Clone, Serialize, Deserialize)]
158#[serde(untagged)]
159pub enum GetGroupError {
160    Status400(),
161    Status401(),
162    Status403(),
163    Status404(),
164    UnknownValue(serde_json::Value),
165}
166
167/// struct for typed errors of method [`get_users_from_group`]
168#[derive(Debug, Clone, Serialize, Deserialize)]
169#[serde(untagged)]
170pub enum GetUsersFromGroupError {
171    Status400(),
172    Status401(),
173    Status403(),
174    Status404(),
175    UnknownValue(serde_json::Value),
176}
177
178/// struct for typed errors of method [`remove_group`]
179#[derive(Debug, Clone, Serialize, Deserialize)]
180#[serde(untagged)]
181pub enum RemoveGroupError {
182    Status400(),
183    Status401(),
184    Status403(),
185    Status404(),
186    UnknownValue(serde_json::Value),
187}
188
189/// struct for typed errors of method [`remove_user_from_group`]
190#[derive(Debug, Clone, Serialize, Deserialize)]
191#[serde(untagged)]
192pub enum RemoveUserFromGroupError {
193    Status400(),
194    Status401(),
195    Status403(),
196    Status404(),
197    UnknownValue(serde_json::Value),
198}
199
200
201/// Adds a user to a group.  **[Permissions](#permissions) required:** Site administration (that is, member of the *site-admin* [group](https://confluence.atlassian.com/x/24xjL)).
202pub async fn add_user_to_group(configuration: &configuration::Configuration, params: AddUserToGroupParams) -> Result<crate::models::Group, Error<AddUserToGroupError>> {
203    let local_var_configuration = configuration;
204
205    // unbox the parameters
206    let request_body = params.request_body;
207    let groupname = params.groupname;
208    let group_id = params.group_id;
209
210
211    let local_var_client = &local_var_configuration.client;
212
213    let local_var_uri_str = format!("{}/rest/api/2/group/user", local_var_configuration.base_path);
214    let mut local_var_req_builder = local_var_client.request(reqwest::Method::POST, local_var_uri_str.as_str());
215
216    if let Some(ref local_var_str) = groupname {
217        local_var_req_builder = local_var_req_builder.query(&[("groupname", &local_var_str.to_string())]);
218    }
219    if let Some(ref local_var_str) = group_id {
220        local_var_req_builder = local_var_req_builder.query(&[("groupId", &local_var_str.to_string())]);
221    }
222    if let Some(ref local_var_user_agent) = local_var_configuration.user_agent {
223        local_var_req_builder = local_var_req_builder.header(reqwest::header::USER_AGENT, local_var_user_agent.clone());
224    }
225    if let Some(ref local_var_token) = local_var_configuration.oauth_access_token {
226        local_var_req_builder = local_var_req_builder.bearer_auth(local_var_token.to_owned());
227    };
228    if let Some(ref local_var_auth_conf) = local_var_configuration.basic_auth {
229        local_var_req_builder = local_var_req_builder.basic_auth(local_var_auth_conf.0.to_owned(), local_var_auth_conf.1.to_owned());
230    };
231    local_var_req_builder = local_var_req_builder.json(&request_body);
232
233    let local_var_req = local_var_req_builder.build()?;
234    let local_var_resp = local_var_client.execute(local_var_req).await?;
235
236    let local_var_status = local_var_resp.status();
237    let local_var_content = local_var_resp.text().await?;
238
239    if !local_var_status.is_client_error() && !local_var_status.is_server_error() {
240        serde_json::from_str(&local_var_content).map_err(Error::from)
241    } else {
242        let local_var_entity: Option<AddUserToGroupError> = serde_json::from_str(&local_var_content).ok();
243        let local_var_error = ResponseContent { status: local_var_status, content: local_var_content, entity: local_var_entity };
244        Err(Error::ResponseError(local_var_error))
245    }
246}
247
248/// Returns a [paginated](#pagination) list of groups.  **[Permissions](#permissions) required:** *Browse users and groups* [global permission](https://confluence.atlassian.com/x/x4dKLg).
249pub async fn bulk_get_groups(configuration: &configuration::Configuration, params: BulkGetGroupsParams) -> Result<crate::models::PageBeanGroupDetails, Error<BulkGetGroupsError>> {
250    let local_var_configuration = configuration;
251
252    // unbox the parameters
253    let start_at = params.start_at;
254    let max_results = params.max_results;
255    let group_id = params.group_id;
256    let group_name = params.group_name;
257
258
259    let local_var_client = &local_var_configuration.client;
260
261    let local_var_uri_str = format!("{}/rest/api/2/group/bulk", local_var_configuration.base_path);
262    let mut local_var_req_builder = local_var_client.request(reqwest::Method::GET, local_var_uri_str.as_str());
263
264    if let Some(ref local_var_str) = start_at {
265        local_var_req_builder = local_var_req_builder.query(&[("startAt", &local_var_str.to_string())]);
266    }
267    if let Some(ref local_var_str) = max_results {
268        local_var_req_builder = local_var_req_builder.query(&[("maxResults", &local_var_str.to_string())]);
269    }
270    if let Some(ref local_var_str) = group_id {
271        local_var_req_builder = match "multi" {
272            "multi" => local_var_req_builder.query(&local_var_str.into_iter().map(|p| ("groupId".to_owned(), p.to_string())).collect::<Vec<(std::string::String, std::string::String)>>()),
273            _ => local_var_req_builder.query(&[("groupId", &local_var_str.into_iter().map(|p| p.to_string()).collect::<Vec<String>>().join(",").to_string())]),
274        };
275    }
276    if let Some(ref local_var_str) = group_name {
277        local_var_req_builder = match "multi" {
278            "multi" => local_var_req_builder.query(&local_var_str.into_iter().map(|p| ("groupName".to_owned(), p.to_string())).collect::<Vec<(std::string::String, std::string::String)>>()),
279            _ => local_var_req_builder.query(&[("groupName", &local_var_str.into_iter().map(|p| p.to_string()).collect::<Vec<String>>().join(",").to_string())]),
280        };
281    }
282    if let Some(ref local_var_user_agent) = local_var_configuration.user_agent {
283        local_var_req_builder = local_var_req_builder.header(reqwest::header::USER_AGENT, local_var_user_agent.clone());
284    }
285    if let Some(ref local_var_token) = local_var_configuration.oauth_access_token {
286        local_var_req_builder = local_var_req_builder.bearer_auth(local_var_token.to_owned());
287    };
288    if let Some(ref local_var_auth_conf) = local_var_configuration.basic_auth {
289        local_var_req_builder = local_var_req_builder.basic_auth(local_var_auth_conf.0.to_owned(), local_var_auth_conf.1.to_owned());
290    };
291
292    let local_var_req = local_var_req_builder.build()?;
293    let local_var_resp = local_var_client.execute(local_var_req).await?;
294
295    let local_var_status = local_var_resp.status();
296    let local_var_content = local_var_resp.text().await?;
297
298    if !local_var_status.is_client_error() && !local_var_status.is_server_error() {
299        serde_json::from_str(&local_var_content).map_err(Error::from)
300    } else {
301        let local_var_entity: Option<BulkGetGroupsError> = serde_json::from_str(&local_var_content).ok();
302        let local_var_error = ResponseContent { status: local_var_status, content: local_var_content, entity: local_var_entity };
303        Err(Error::ResponseError(local_var_error))
304    }
305}
306
307/// Creates a group.  **[Permissions](#permissions) required:** Site administration (that is, member of the *site-admin* [group](https://confluence.atlassian.com/x/24xjL)).
308pub async fn create_group(configuration: &configuration::Configuration, params: CreateGroupParams) -> Result<crate::models::Group, Error<CreateGroupError>> {
309    let local_var_configuration = configuration;
310
311    // unbox the parameters
312    let request_body = params.request_body;
313
314
315    let local_var_client = &local_var_configuration.client;
316
317    let local_var_uri_str = format!("{}/rest/api/2/group", local_var_configuration.base_path);
318    let mut local_var_req_builder = local_var_client.request(reqwest::Method::POST, local_var_uri_str.as_str());
319
320    if let Some(ref local_var_user_agent) = local_var_configuration.user_agent {
321        local_var_req_builder = local_var_req_builder.header(reqwest::header::USER_AGENT, local_var_user_agent.clone());
322    }
323    if let Some(ref local_var_token) = local_var_configuration.oauth_access_token {
324        local_var_req_builder = local_var_req_builder.bearer_auth(local_var_token.to_owned());
325    };
326    if let Some(ref local_var_auth_conf) = local_var_configuration.basic_auth {
327        local_var_req_builder = local_var_req_builder.basic_auth(local_var_auth_conf.0.to_owned(), local_var_auth_conf.1.to_owned());
328    };
329    local_var_req_builder = local_var_req_builder.json(&request_body);
330
331    let local_var_req = local_var_req_builder.build()?;
332    let local_var_resp = local_var_client.execute(local_var_req).await?;
333
334    let local_var_status = local_var_resp.status();
335    let local_var_content = local_var_resp.text().await?;
336
337    if !local_var_status.is_client_error() && !local_var_status.is_server_error() {
338        serde_json::from_str(&local_var_content).map_err(Error::from)
339    } else {
340        let local_var_entity: Option<CreateGroupError> = serde_json::from_str(&local_var_content).ok();
341        let local_var_error = ResponseContent { status: local_var_status, content: local_var_content, entity: local_var_entity };
342        Err(Error::ResponseError(local_var_error))
343    }
344}
345
346/// Returns a list of groups whose names contain a query string. A list of group names can be provided to exclude groups from the results.  The primary use case for this resource is to populate a group picker suggestions list. To this end, the returned object includes the `html` field where the matched query term is highlighted in the group name with the HTML strong tag. Also, the groups list is wrapped in a response object that contains a header for use in the picker, specifically *Showing X of Y matching groups*.  The list returns with the groups sorted. If no groups match the list criteria, an empty list is returned.  This operation can be accessed anonymously.  **[Permissions](#permissions) required:** *Browse projects* [project permission](https://confluence.atlassian.com/x/yodKLg). Anonymous calls and calls by users without the required permission return an empty list.
347pub async fn find_groups(configuration: &configuration::Configuration, params: FindGroupsParams) -> Result<crate::models::FoundGroups, Error<FindGroupsError>> {
348    let local_var_configuration = configuration;
349
350    // unbox the parameters
351    let account_id = params.account_id;
352    let query = params.query;
353    let exclude = params.exclude;
354    let exclude_id = params.exclude_id;
355    let max_results = params.max_results;
356    let user_name = params.user_name;
357
358
359    let local_var_client = &local_var_configuration.client;
360
361    let local_var_uri_str = format!("{}/rest/api/2/groups/picker", local_var_configuration.base_path);
362    let mut local_var_req_builder = local_var_client.request(reqwest::Method::GET, local_var_uri_str.as_str());
363
364    if let Some(ref local_var_str) = account_id {
365        local_var_req_builder = local_var_req_builder.query(&[("accountId", &local_var_str.to_string())]);
366    }
367    if let Some(ref local_var_str) = query {
368        local_var_req_builder = local_var_req_builder.query(&[("query", &local_var_str.to_string())]);
369    }
370    if let Some(ref local_var_str) = exclude {
371        local_var_req_builder = match "multi" {
372            "multi" => local_var_req_builder.query(&local_var_str.into_iter().map(|p| ("exclude".to_owned(), p.to_string())).collect::<Vec<(std::string::String, std::string::String)>>()),
373            _ => local_var_req_builder.query(&[("exclude", &local_var_str.into_iter().map(|p| p.to_string()).collect::<Vec<String>>().join(",").to_string())]),
374        };
375    }
376    if let Some(ref local_var_str) = exclude_id {
377        local_var_req_builder = match "multi" {
378            "multi" => local_var_req_builder.query(&local_var_str.into_iter().map(|p| ("excludeId".to_owned(), p.to_string())).collect::<Vec<(std::string::String, std::string::String)>>()),
379            _ => local_var_req_builder.query(&[("excludeId", &local_var_str.into_iter().map(|p| p.to_string()).collect::<Vec<String>>().join(",").to_string())]),
380        };
381    }
382    if let Some(ref local_var_str) = max_results {
383        local_var_req_builder = local_var_req_builder.query(&[("maxResults", &local_var_str.to_string())]);
384    }
385    if let Some(ref local_var_str) = user_name {
386        local_var_req_builder = local_var_req_builder.query(&[("userName", &local_var_str.to_string())]);
387    }
388    if let Some(ref local_var_user_agent) = local_var_configuration.user_agent {
389        local_var_req_builder = local_var_req_builder.header(reqwest::header::USER_AGENT, local_var_user_agent.clone());
390    }
391    if let Some(ref local_var_token) = local_var_configuration.oauth_access_token {
392        local_var_req_builder = local_var_req_builder.bearer_auth(local_var_token.to_owned());
393    };
394    if let Some(ref local_var_auth_conf) = local_var_configuration.basic_auth {
395        local_var_req_builder = local_var_req_builder.basic_auth(local_var_auth_conf.0.to_owned(), local_var_auth_conf.1.to_owned());
396    };
397
398    let local_var_req = local_var_req_builder.build()?;
399    let local_var_resp = local_var_client.execute(local_var_req).await?;
400
401    let local_var_status = local_var_resp.status();
402    let local_var_content = local_var_resp.text().await?;
403
404    if !local_var_status.is_client_error() && !local_var_status.is_server_error() {
405        serde_json::from_str(&local_var_content).map_err(Error::from)
406    } else {
407        let local_var_entity: Option<FindGroupsError> = serde_json::from_str(&local_var_content).ok();
408        let local_var_error = ResponseContent { status: local_var_status, content: local_var_content, entity: local_var_entity };
409        Err(Error::ResponseError(local_var_error))
410    }
411}
412
413/// This operation is deprecated, use [`group/member`](#api-rest-api-2-group-member-get).  Returns all users in a group.  **[Permissions](#permissions) required:** *Administer Jira* [global permission](https://confluence.atlassian.com/x/x4dKLg).
414pub async fn get_group(configuration: &configuration::Configuration, params: GetGroupParams) -> Result<crate::models::Group, Error<GetGroupError>> {
415    let local_var_configuration = configuration;
416
417    // unbox the parameters
418    let groupname = params.groupname;
419    let group_id = params.group_id;
420    let expand = params.expand;
421
422
423    let local_var_client = &local_var_configuration.client;
424
425    let local_var_uri_str = format!("{}/rest/api/2/group", local_var_configuration.base_path);
426    let mut local_var_req_builder = local_var_client.request(reqwest::Method::GET, local_var_uri_str.as_str());
427
428    if let Some(ref local_var_str) = groupname {
429        local_var_req_builder = local_var_req_builder.query(&[("groupname", &local_var_str.to_string())]);
430    }
431    if let Some(ref local_var_str) = group_id {
432        local_var_req_builder = local_var_req_builder.query(&[("groupId", &local_var_str.to_string())]);
433    }
434    if let Some(ref local_var_str) = expand {
435        local_var_req_builder = local_var_req_builder.query(&[("expand", &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<GetGroupError> = 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 [paginated](#pagination) list of all users in a group.  Note that users are ordered by username, however the username is not returned in the results due to privacy reasons.  **[Permissions](#permissions) required:** *Administer Jira* [global permission](https://confluence.atlassian.com/x/x4dKLg).
463pub async fn get_users_from_group(configuration: &configuration::Configuration, params: GetUsersFromGroupParams) -> Result<crate::models::PageBeanUserDetails, Error<GetUsersFromGroupError>> {
464    let local_var_configuration = configuration;
465
466    // unbox the parameters
467    let groupname = params.groupname;
468    let group_id = params.group_id;
469    let include_inactive_users = params.include_inactive_users;
470    let start_at = params.start_at;
471    let max_results = params.max_results;
472
473
474    let local_var_client = &local_var_configuration.client;
475
476    let local_var_uri_str = format!("{}/rest/api/2/group/member", local_var_configuration.base_path);
477    let mut local_var_req_builder = local_var_client.request(reqwest::Method::GET, local_var_uri_str.as_str());
478
479    if let Some(ref local_var_str) = groupname {
480        local_var_req_builder = local_var_req_builder.query(&[("groupname", &local_var_str.to_string())]);
481    }
482    if let Some(ref local_var_str) = group_id {
483        local_var_req_builder = local_var_req_builder.query(&[("groupId", &local_var_str.to_string())]);
484    }
485    if let Some(ref local_var_str) = include_inactive_users {
486        local_var_req_builder = local_var_req_builder.query(&[("includeInactiveUsers", &local_var_str.to_string())]);
487    }
488    if let Some(ref local_var_str) = start_at {
489        local_var_req_builder = local_var_req_builder.query(&[("startAt", &local_var_str.to_string())]);
490    }
491    if let Some(ref local_var_str) = max_results {
492        local_var_req_builder = local_var_req_builder.query(&[("maxResults", &local_var_str.to_string())]);
493    }
494    if let Some(ref local_var_user_agent) = local_var_configuration.user_agent {
495        local_var_req_builder = local_var_req_builder.header(reqwest::header::USER_AGENT, local_var_user_agent.clone());
496    }
497    if let Some(ref local_var_token) = local_var_configuration.oauth_access_token {
498        local_var_req_builder = local_var_req_builder.bearer_auth(local_var_token.to_owned());
499    };
500    if let Some(ref local_var_auth_conf) = local_var_configuration.basic_auth {
501        local_var_req_builder = local_var_req_builder.basic_auth(local_var_auth_conf.0.to_owned(), local_var_auth_conf.1.to_owned());
502    };
503
504    let local_var_req = local_var_req_builder.build()?;
505    let local_var_resp = local_var_client.execute(local_var_req).await?;
506
507    let local_var_status = local_var_resp.status();
508    let local_var_content = local_var_resp.text().await?;
509
510    if !local_var_status.is_client_error() && !local_var_status.is_server_error() {
511        serde_json::from_str(&local_var_content).map_err(Error::from)
512    } else {
513        let local_var_entity: Option<GetUsersFromGroupError> = serde_json::from_str(&local_var_content).ok();
514        let local_var_error = ResponseContent { status: local_var_status, content: local_var_content, entity: local_var_entity };
515        Err(Error::ResponseError(local_var_error))
516    }
517}
518
519/// Deletes a group.  **[Permissions](#permissions) required:** Site administration (that is, member of the *site-admin* strategic [group](https://confluence.atlassian.com/x/24xjL)).
520pub async fn remove_group(configuration: &configuration::Configuration, params: RemoveGroupParams) -> Result<(), Error<RemoveGroupError>> {
521    let local_var_configuration = configuration;
522
523    // unbox the parameters
524    let groupname = params.groupname;
525    let group_id = params.group_id;
526    let swap_group = params.swap_group;
527    let swap_group_id = params.swap_group_id;
528
529
530    let local_var_client = &local_var_configuration.client;
531
532    let local_var_uri_str = format!("{}/rest/api/2/group", local_var_configuration.base_path);
533    let mut local_var_req_builder = local_var_client.request(reqwest::Method::DELETE, local_var_uri_str.as_str());
534
535    if let Some(ref local_var_str) = groupname {
536        local_var_req_builder = local_var_req_builder.query(&[("groupname", &local_var_str.to_string())]);
537    }
538    if let Some(ref local_var_str) = group_id {
539        local_var_req_builder = local_var_req_builder.query(&[("groupId", &local_var_str.to_string())]);
540    }
541    if let Some(ref local_var_str) = swap_group {
542        local_var_req_builder = local_var_req_builder.query(&[("swapGroup", &local_var_str.to_string())]);
543    }
544    if let Some(ref local_var_str) = swap_group_id {
545        local_var_req_builder = local_var_req_builder.query(&[("swapGroupId", &local_var_str.to_string())]);
546    }
547    if let Some(ref local_var_user_agent) = local_var_configuration.user_agent {
548        local_var_req_builder = local_var_req_builder.header(reqwest::header::USER_AGENT, local_var_user_agent.clone());
549    }
550    if let Some(ref local_var_token) = local_var_configuration.oauth_access_token {
551        local_var_req_builder = local_var_req_builder.bearer_auth(local_var_token.to_owned());
552    };
553    if let Some(ref local_var_auth_conf) = local_var_configuration.basic_auth {
554        local_var_req_builder = local_var_req_builder.basic_auth(local_var_auth_conf.0.to_owned(), local_var_auth_conf.1.to_owned());
555    };
556
557    let local_var_req = local_var_req_builder.build()?;
558    let local_var_resp = local_var_client.execute(local_var_req).await?;
559
560    let local_var_status = local_var_resp.status();
561    let local_var_content = local_var_resp.text().await?;
562
563    if !local_var_status.is_client_error() && !local_var_status.is_server_error() {
564        Ok(())
565    } else {
566        let local_var_entity: Option<RemoveGroupError> = serde_json::from_str(&local_var_content).ok();
567        let local_var_error = ResponseContent { status: local_var_status, content: local_var_content, entity: local_var_entity };
568        Err(Error::ResponseError(local_var_error))
569    }
570}
571
572/// Removes a user from a group.  **[Permissions](#permissions) required:** Site administration (that is, member of the *site-admin* [group](https://confluence.atlassian.com/x/24xjL)).
573pub async fn remove_user_from_group(configuration: &configuration::Configuration, params: RemoveUserFromGroupParams) -> Result<(), Error<RemoveUserFromGroupError>> {
574    let local_var_configuration = configuration;
575
576    // unbox the parameters
577    let account_id = params.account_id;
578    let groupname = params.groupname;
579    let group_id = params.group_id;
580    let username = params.username;
581
582
583    let local_var_client = &local_var_configuration.client;
584
585    let local_var_uri_str = format!("{}/rest/api/2/group/user", local_var_configuration.base_path);
586    let mut local_var_req_builder = local_var_client.request(reqwest::Method::DELETE, local_var_uri_str.as_str());
587
588    if let Some(ref local_var_str) = groupname {
589        local_var_req_builder = local_var_req_builder.query(&[("groupname", &local_var_str.to_string())]);
590    }
591    if let Some(ref local_var_str) = group_id {
592        local_var_req_builder = local_var_req_builder.query(&[("groupId", &local_var_str.to_string())]);
593    }
594    if let Some(ref local_var_str) = username {
595        local_var_req_builder = local_var_req_builder.query(&[("username", &local_var_str.to_string())]);
596    }
597    local_var_req_builder = local_var_req_builder.query(&[("accountId", &account_id.to_string())]);
598    if let Some(ref local_var_user_agent) = local_var_configuration.user_agent {
599        local_var_req_builder = local_var_req_builder.header(reqwest::header::USER_AGENT, local_var_user_agent.clone());
600    }
601    if let Some(ref local_var_token) = local_var_configuration.oauth_access_token {
602        local_var_req_builder = local_var_req_builder.bearer_auth(local_var_token.to_owned());
603    };
604    if let Some(ref local_var_auth_conf) = local_var_configuration.basic_auth {
605        local_var_req_builder = local_var_req_builder.basic_auth(local_var_auth_conf.0.to_owned(), local_var_auth_conf.1.to_owned());
606    };
607
608    let local_var_req = local_var_req_builder.build()?;
609    let local_var_resp = local_var_client.execute(local_var_req).await?;
610
611    let local_var_status = local_var_resp.status();
612    let local_var_content = local_var_resp.text().await?;
613
614    if !local_var_status.is_client_error() && !local_var_status.is_server_error() {
615        Ok(())
616    } else {
617        let local_var_entity: Option<RemoveUserFromGroupError> = serde_json::from_str(&local_var_content).ok();
618        let local_var_error = ResponseContent { status: local_var_status, content: local_var_content, entity: local_var_entity };
619        Err(Error::ResponseError(local_var_error))
620    }
621}
622