hi_jira2/apis/
projects_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 [`archive_project`]
18#[derive(Clone, Debug, Default)]
19pub struct ArchiveProjectParams {
20    /// The project ID or project key (case sensitive).
21    pub project_id_or_key: String
22}
23
24/// struct for passing parameters to the method [`create_project`]
25#[derive(Clone, Debug, Default)]
26pub struct CreateProjectParams {
27    /// The JSON representation of the project being created.
28    pub create_project_details: crate::models::CreateProjectDetails
29}
30
31/// struct for passing parameters to the method [`delete_project`]
32#[derive(Clone, Debug, Default)]
33pub struct DeleteProjectParams {
34    /// The project ID or project key (case sensitive).
35    pub project_id_or_key: String,
36    /// Whether this project is placed in the Jira recycle bin where it will be available for restoration.
37    pub enable_undo: Option<bool>
38}
39
40/// struct for passing parameters to the method [`delete_project_asynchronously`]
41#[derive(Clone, Debug, Default)]
42pub struct DeleteProjectAsynchronouslyParams {
43    /// The project ID or project key (case sensitive).
44    pub project_id_or_key: String
45}
46
47/// struct for passing parameters to the method [`get_all_projects`]
48#[derive(Clone, Debug, Default)]
49pub struct GetAllProjectsParams {
50    /// Use [expand](#expansion) to include additional information in the response. This parameter accepts a comma-separated list. Expanded options include:   *  `description` Returns the project description.  *  `issueTypes` Returns all issue types associated with the project.  *  `lead` Returns information about the project lead.  *  `projectKeys` Returns all project keys associated with the project.
51    pub expand: Option<String>,
52    /// Returns the user's most recently accessed projects. You may specify the number of results to return up to a maximum of 20. If access is anonymous, then the recently accessed projects are based on the current HTTP session.
53    pub recent: Option<i32>,
54    /// A list of project properties to return for the project. This parameter accepts a comma-separated list.
55    pub properties: Option<Vec<String>>
56}
57
58/// struct for passing parameters to the method [`get_all_statuses`]
59#[derive(Clone, Debug, Default)]
60pub struct GetAllStatusesParams {
61    /// The project ID or project key (case sensitive).
62    pub project_id_or_key: String
63}
64
65/// struct for passing parameters to the method [`get_hierarchy`]
66#[derive(Clone, Debug, Default)]
67pub struct GetHierarchyParams {
68    /// The ID of the project.
69    pub project_id: i64
70}
71
72/// struct for passing parameters to the method [`get_notification_scheme_for_project`]
73#[derive(Clone, Debug, Default)]
74pub struct GetNotificationSchemeForProjectParams {
75    /// The project ID or project key (case sensitive).
76    pub project_key_or_id: String,
77    /// Use [expand](#expansion) to include additional information in the response. This parameter accepts a comma-separated list. Expand options include:   *  `all` Returns all expandable information.  *  `field` Returns information about any custom fields assigned to receive an event.  *  `group` Returns information about any groups assigned to receive an event.  *  `notificationSchemeEvents` Returns a list of event associations. This list is returned for all expandable information.  *  `projectRole` Returns information about any project roles assigned to receive an event.  *  `user` Returns information about any users assigned to receive an event.
78    pub expand: Option<String>
79}
80
81/// struct for passing parameters to the method [`get_project`]
82#[derive(Clone, Debug, Default)]
83pub struct GetProjectParams {
84    /// The project ID or project key (case sensitive).
85    pub project_id_or_key: String,
86    /// Use [expand](#expansion) to include additional information in the response. This parameter accepts a comma-separated list. Note that the project description, issue types, and project lead are included in all responses by default. Expand options include:   *  `description` The project description.  *  `issueTypes` The issue types associated with the project.  *  `lead` The project lead.  *  `projectKeys` All project keys associated with the project.  *  `issueTypeHierarchy` The project issue type hierarchy.
87    pub expand: Option<String>,
88    /// A list of project properties to return for the project. This parameter accepts a comma-separated list.
89    pub properties: Option<Vec<String>>
90}
91
92/// struct for passing parameters to the method [`get_recent`]
93#[derive(Clone, Debug, Default)]
94pub struct GetRecentParams {
95    /// Use [expand](#expansion) to include additional information in the response. This parameter accepts a comma-separated list. Expanded options include:   *  `description` Returns the project description.  *  `projectKeys` Returns all project keys associated with a project.  *  `lead` Returns information about the project lead.  *  `issueTypes` Returns all issue types associated with the project.  *  `url` Returns the URL associated with the project.  *  `permissions` Returns the permissions associated with the project.  *  `insight` EXPERIMENTAL. Returns the insight details of total issue count and last issue update time for the project.  *  `*` Returns the project with all available expand options.
96    pub expand: Option<String>,
97    /// EXPERIMENTAL. A list of project properties to return for the project. This parameter accepts a comma-separated list. Invalid property names are ignored.
98    pub properties: Option<Vec<serde_json::Value>>
99}
100
101/// struct for passing parameters to the method [`restore`]
102#[derive(Clone, Debug, Default)]
103pub struct RestoreParams {
104    /// The project ID or project key (case sensitive).
105    pub project_id_or_key: String
106}
107
108/// struct for passing parameters to the method [`search_projects`]
109#[derive(Clone, Debug, Default)]
110pub struct SearchProjectsParams {
111    /// The index of the first item to return in a page of results (page offset).
112    pub start_at: Option<i64>,
113    /// The maximum number of items to return per page.
114    pub max_results: Option<i32>,
115    /// [Order](#ordering) the results by a field.   *  `category` Sorts by project category. A complete list of category IDs is found using [Get all project categories](#api-rest-api-2-projectCategory-get).  *  `issueCount` Sorts by the total number of issues in each project.  *  `key` Sorts by project key.  *  `lastIssueUpdatedTime` Sorts by the last issue update time.  *  `name` Sorts by project name.  *  `owner` Sorts by project lead.  *  `archivedDate` EXPERIMENTAL. Sorts by project archived date.  *  `deletedDate` EXPERIMENTAL. Sorts by project deleted date.
116    pub order_by: Option<String>,
117    /// The project IDs to filter the results by. To include multiple IDs, provide an ampersand-separated list. For example, `id=10000&id=10001`. Up to 50 project IDs can be provided.
118    pub id: Option<Vec<i64>>,
119    /// The project keys to filter the results by. To include multiple keys, provide an ampersand-separated list. For example, `keys=PA&keys=PB`. Up to 50 project keys can be provided.
120    pub keys: Option<Vec<String>>,
121    /// Filter the results using a literal string. Projects with a matching `key` or `name` are returned (case insensitive).
122    pub query: Option<String>,
123    /// Orders results by the [project type](https://confluence.atlassian.com/x/GwiiLQ#Jiraapplicationsoverview-Productfeaturesandprojecttypes). This parameter accepts a comma-separated list. Valid values are `business`, `service_desk`, and `software`.
124    pub type_key: Option<String>,
125    /// The ID of the project's category. A complete list of category IDs is found using the [Get all project categories](#api-rest-api-2-projectCategory-get) operation.
126    pub category_id: Option<i64>,
127    /// Filter results by projects for which the user can:   *  `view` the project, meaning that they have one of the following permissions:           *  *Browse projects* [project permission](https://confluence.atlassian.com/x/yodKLg) for the project.      *  *Administer projects* [project permission](https://confluence.atlassian.com/x/yodKLg) for the project.      *  *Administer Jira* [global permission](https://confluence.atlassian.com/x/x4dKLg).  *  `browse` the project, meaning that they have the *Browse projects* [project permission](https://confluence.atlassian.com/x/yodKLg) for the project.  *  `edit` the project, meaning that they have one of the following permissions:           *  *Administer projects* [project permission](https://confluence.atlassian.com/x/yodKLg) for the project.      *  *Administer Jira* [global permission](https://confluence.atlassian.com/x/x4dKLg).
128    pub action: Option<String>,
129    /// Use [expand](#expansion) to include additional information in the response. This parameter accepts a comma-separated list. Expanded options include:   *  `description` Returns the project description.  *  `projectKeys` Returns all project keys associated with a project.  *  `lead` Returns information about the project lead.  *  `issueTypes` Returns all issue types associated with the project.  *  `url` Returns the URL associated with the project.  *  `insight` EXPERIMENTAL. Returns the insight details of total issue count and last issue update time for the project.
130    pub expand: Option<String>,
131    /// EXPERIMENTAL. Filter results by project status:   *  `live` Search live projects.  *  `archived` Search archived projects.  *  `deleted` Search deleted projects, those in the recycle bin.
132    pub status: Option<Vec<String>>,
133    /// EXPERIMENTAL. A list of project properties to return for the project. This parameter accepts a comma-separated list.
134    pub properties: Option<Vec<serde_json::Value>>,
135    /// EXPERIMENTAL. A query string used to search properties. The query string cannot be specified using a JSON object. For example, to search for the value of `nested` from `{\"something\":{\"nested\":1,\"other\":2}}` use `[thepropertykey].something.nested=1`. Note that the propertyQuery key is enclosed in square brackets to enable searching where the propertyQuery key includes dot (.) or equals (=) characters. Note that `thepropertykey` is only returned when included in `properties`.
136    pub property_query: Option<String>
137}
138
139/// struct for passing parameters to the method [`update_project`]
140#[derive(Clone, Debug, Default)]
141pub struct UpdateProjectParams {
142    /// The project ID or project key (case sensitive).
143    pub project_id_or_key: String,
144    /// The project details to be updated.
145    pub update_project_details: crate::models::UpdateProjectDetails,
146    /// Use [expand](#expansion) to include additional information in the response. This parameter accepts a comma-separated list. Note that the project description, issue types, and project lead are included in all responses by default. Expand options include:   *  `description` The project description.  *  `issueTypes` The issue types associated with the project.  *  `lead` The project lead.  *  `projectKeys` All project keys associated with the project.
147    pub expand: Option<String>
148}
149
150/// struct for passing parameters to the method [`update_project_type`]
151#[derive(Clone, Debug, Default)]
152pub struct UpdateProjectTypeParams {
153    /// The project ID or project key (case sensitive).
154    pub project_id_or_key: String,
155    /// The key of the new project type.
156    pub new_project_type_key: String
157}
158
159
160/// struct for typed errors of method [`archive_project`]
161#[derive(Debug, Clone, Serialize, Deserialize)]
162#[serde(untagged)]
163pub enum ArchiveProjectError {
164    Status400(),
165    Status401(),
166    Status403(),
167    Status404(),
168    UnknownValue(serde_json::Value),
169}
170
171/// struct for typed errors of method [`create_project`]
172#[derive(Debug, Clone, Serialize, Deserialize)]
173#[serde(untagged)]
174pub enum CreateProjectError {
175    Status400(),
176    Status401(),
177    Status403(),
178    UnknownValue(serde_json::Value),
179}
180
181/// struct for typed errors of method [`delete_project`]
182#[derive(Debug, Clone, Serialize, Deserialize)]
183#[serde(untagged)]
184pub enum DeleteProjectError {
185    Status401(),
186    Status404(),
187    UnknownValue(serde_json::Value),
188}
189
190/// struct for typed errors of method [`delete_project_asynchronously`]
191#[derive(Debug, Clone, Serialize, Deserialize)]
192#[serde(untagged)]
193pub enum DeleteProjectAsynchronouslyError {
194    Status400(),
195    Status401(),
196    Status404(),
197    UnknownValue(serde_json::Value),
198}
199
200/// struct for typed errors of method [`get_all_projects`]
201#[derive(Debug, Clone, Serialize, Deserialize)]
202#[serde(untagged)]
203pub enum GetAllProjectsError {
204    Status401(),
205    UnknownValue(serde_json::Value),
206}
207
208/// struct for typed errors of method [`get_all_statuses`]
209#[derive(Debug, Clone, Serialize, Deserialize)]
210#[serde(untagged)]
211pub enum GetAllStatusesError {
212    Status401(),
213    Status404(),
214    UnknownValue(serde_json::Value),
215}
216
217/// struct for typed errors of method [`get_hierarchy`]
218#[derive(Debug, Clone, Serialize, Deserialize)]
219#[serde(untagged)]
220pub enum GetHierarchyError {
221    Status400(),
222    Status401(),
223    Status404(),
224    UnknownValue(serde_json::Value),
225}
226
227/// struct for typed errors of method [`get_notification_scheme_for_project`]
228#[derive(Debug, Clone, Serialize, Deserialize)]
229#[serde(untagged)]
230pub enum GetNotificationSchemeForProjectError {
231    Status400(),
232    Status401(),
233    Status404(),
234    UnknownValue(serde_json::Value),
235}
236
237/// struct for typed errors of method [`get_project`]
238#[derive(Debug, Clone, Serialize, Deserialize)]
239#[serde(untagged)]
240pub enum GetProjectError {
241    Status401(),
242    Status404(),
243    UnknownValue(serde_json::Value),
244}
245
246/// struct for typed errors of method [`get_recent`]
247#[derive(Debug, Clone, Serialize, Deserialize)]
248#[serde(untagged)]
249pub enum GetRecentError {
250    Status400(),
251    Status401(),
252    UnknownValue(serde_json::Value),
253}
254
255/// struct for typed errors of method [`restore`]
256#[derive(Debug, Clone, Serialize, Deserialize)]
257#[serde(untagged)]
258pub enum RestoreError {
259    Status400(),
260    Status401(),
261    Status404(),
262    UnknownValue(serde_json::Value),
263}
264
265/// struct for typed errors of method [`search_projects`]
266#[derive(Debug, Clone, Serialize, Deserialize)]
267#[serde(untagged)]
268pub enum SearchProjectsError {
269    Status400(),
270    Status401(),
271    Status404(),
272    UnknownValue(serde_json::Value),
273}
274
275/// struct for typed errors of method [`update_project`]
276#[derive(Debug, Clone, Serialize, Deserialize)]
277#[serde(untagged)]
278pub enum UpdateProjectError {
279    Status400(),
280    Status401(),
281    Status403(),
282    Status404(),
283    UnknownValue(serde_json::Value),
284}
285
286/// struct for typed errors of method [`update_project_type`]
287#[derive(Debug, Clone, Serialize, Deserialize)]
288#[serde(untagged)]
289pub enum UpdateProjectTypeError {
290    Status400(),
291    Status401(),
292    Status404(),
293    UnknownValue(serde_json::Value),
294}
295
296
297/// Archives a project. You can't delete a project if it's archived. To delete an archived project, restore the project and then delete it. To restore a project, use the Jira UI.  **[Permissions](#permissions) required:** *Administer Jira* [global permission](https://confluence.atlassian.com/x/x4dKLg).
298pub async fn archive_project(configuration: &configuration::Configuration, params: ArchiveProjectParams) -> Result<serde_json::Value, Error<ArchiveProjectError>> {
299    let local_var_configuration = configuration;
300
301    // unbox the parameters
302    let project_id_or_key = params.project_id_or_key;
303
304
305    let local_var_client = &local_var_configuration.client;
306
307    let local_var_uri_str = format!("{}/rest/api/2/project/{projectIdOrKey}/archive", local_var_configuration.base_path, projectIdOrKey=crate::apis::urlencode(project_id_or_key));
308    let mut local_var_req_builder = local_var_client.request(reqwest::Method::POST, 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<ArchiveProjectError> = 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/// Creates a project based on a project type template, as shown in the following table:  | Project Type Key | Project Template Key |   |--|--|   | `business` | `com.atlassian.jira-core-project-templates:jira-core-simplified-content-management`, `com.atlassian.jira-core-project-templates:jira-core-simplified-document-approval`, `com.atlassian.jira-core-project-templates:jira-core-simplified-lead-tracking`, `com.atlassian.jira-core-project-templates:jira-core-simplified-process-control`, `com.atlassian.jira-core-project-templates:jira-core-simplified-procurement`, `com.atlassian.jira-core-project-templates:jira-core-simplified-project-management`, `com.atlassian.jira-core-project-templates:jira-core-simplified-recruitment`, `com.atlassian.jira-core-project-templates:jira-core-simplified-task-tracking` |   | `service_desk` | `com.atlassian.servicedesk:simplified-it-service-management`, `com.atlassian.servicedesk:simplified-general-service-desk`, `com.atlassian.servicedesk:simplified-internal-service-desk`, `com.atlassian.servicedesk:simplified-external-service-desk`, `com.atlassian.servicedesk:simplified-hr-service-desk`, `com.atlassian.servicedesk:simplified-facilities-service-desk`, `com.atlassian.servicedesk:simplified-legal-service-desk` |   | `software` | `com.pyxis.greenhopper.jira:gh-simplified-agility-kanban`, `com.pyxis.greenhopper.jira:gh-simplified-agility-scrum`, `com.pyxis.greenhopper.jira:gh-simplified-basic`, `com.pyxis.greenhopper.jira:gh-simplified-kanban-classic`, `com.pyxis.greenhopper.jira:gh-simplified-scrum-classic` |   The project types are available according to the installed Jira features as follows:   *  Jira Core, the default, enables `business` projects.  *  Jira Service Management enables `service_desk` projects.  *  Jira Software enables `software` projects.  To determine which features are installed, go to **Jira settings** > **Apps** > **Manage apps** and review the System Apps list. To add Jira Software or Jira Service Management into a JIRA instance, use **Jira settings** > **Apps** > **Finding new apps**. For more information, see [ Managing add-ons](https://confluence.atlassian.com/x/S31NLg).  **[Permissions](#permissions) required:** *Administer Jira* [global permission](https://confluence.atlassian.com/x/x4dKLg).
336pub async fn create_project(configuration: &configuration::Configuration, params: CreateProjectParams) -> Result<crate::models::ProjectIdentifiers, Error<CreateProjectError>> {
337    let local_var_configuration = configuration;
338
339    // unbox the parameters
340    let create_project_details = params.create_project_details;
341
342
343    let local_var_client = &local_var_configuration.client;
344
345    let local_var_uri_str = format!("{}/rest/api/2/project", local_var_configuration.base_path);
346    let mut local_var_req_builder = local_var_client.request(reqwest::Method::POST, local_var_uri_str.as_str());
347
348    if let Some(ref local_var_user_agent) = local_var_configuration.user_agent {
349        local_var_req_builder = local_var_req_builder.header(reqwest::header::USER_AGENT, local_var_user_agent.clone());
350    }
351    if let Some(ref local_var_token) = local_var_configuration.oauth_access_token {
352        local_var_req_builder = local_var_req_builder.bearer_auth(local_var_token.to_owned());
353    };
354    if let Some(ref local_var_auth_conf) = local_var_configuration.basic_auth {
355        local_var_req_builder = local_var_req_builder.basic_auth(local_var_auth_conf.0.to_owned(), local_var_auth_conf.1.to_owned());
356    };
357    local_var_req_builder = local_var_req_builder.json(&create_project_details);
358
359    let local_var_req = local_var_req_builder.build()?;
360    let local_var_resp = local_var_client.execute(local_var_req).await?;
361
362    let local_var_status = local_var_resp.status();
363    let local_var_content = local_var_resp.text().await?;
364
365    if !local_var_status.is_client_error() && !local_var_status.is_server_error() {
366        serde_json::from_str(&local_var_content).map_err(Error::from)
367    } else {
368        let local_var_entity: Option<CreateProjectError> = serde_json::from_str(&local_var_content).ok();
369        let local_var_error = ResponseContent { status: local_var_status, content: local_var_content, entity: local_var_entity };
370        Err(Error::ResponseError(local_var_error))
371    }
372}
373
374/// Deletes a project.  You can't delete a project if it's archived. To delete an archived project, restore the project and then delete it. To restore a project, use the Jira UI.  **[Permissions](#permissions) required:** *Administer Jira* [global permission](https://confluence.atlassian.com/x/x4dKLg).
375pub async fn delete_project(configuration: &configuration::Configuration, params: DeleteProjectParams) -> Result<(), Error<DeleteProjectError>> {
376    let local_var_configuration = configuration;
377
378    // unbox the parameters
379    let project_id_or_key = params.project_id_or_key;
380    let enable_undo = params.enable_undo;
381
382
383    let local_var_client = &local_var_configuration.client;
384
385    let local_var_uri_str = format!("{}/rest/api/2/project/{projectIdOrKey}", local_var_configuration.base_path, projectIdOrKey=crate::apis::urlencode(project_id_or_key));
386    let mut local_var_req_builder = local_var_client.request(reqwest::Method::DELETE, local_var_uri_str.as_str());
387
388    if let Some(ref local_var_str) = enable_undo {
389        local_var_req_builder = local_var_req_builder.query(&[("enableUndo", &local_var_str.to_string())]);
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        Ok(())
409    } else {
410        let local_var_entity: Option<DeleteProjectError> = 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/// Deletes a project asynchronously.  This operation is:   *  transactional, that is, if part of the delete fails the project is not deleted.  *  [asynchronous](#async). Follow the `location` link in the response to determine the status of the task and use [Get task](#api-rest-api-2-task-taskId-get) to obtain subsequent updates.  **[Permissions](#permissions) required:** *Administer Jira* [global permission](https://confluence.atlassian.com/x/x4dKLg).
417pub async fn delete_project_asynchronously(configuration: &configuration::Configuration, params: DeleteProjectAsynchronouslyParams) -> Result<(), Error<DeleteProjectAsynchronouslyError>> {
418    let local_var_configuration = configuration;
419
420    // unbox the parameters
421    let project_id_or_key = params.project_id_or_key;
422
423
424    let local_var_client = &local_var_configuration.client;
425
426    let local_var_uri_str = format!("{}/rest/api/2/project/{projectIdOrKey}/delete", local_var_configuration.base_path, projectIdOrKey=crate::apis::urlencode(project_id_or_key));
427    let mut local_var_req_builder = local_var_client.request(reqwest::Method::POST, local_var_uri_str.as_str());
428
429    if let Some(ref local_var_user_agent) = local_var_configuration.user_agent {
430        local_var_req_builder = local_var_req_builder.header(reqwest::header::USER_AGENT, local_var_user_agent.clone());
431    }
432    if let Some(ref local_var_token) = local_var_configuration.oauth_access_token {
433        local_var_req_builder = local_var_req_builder.bearer_auth(local_var_token.to_owned());
434    };
435    if let Some(ref local_var_auth_conf) = local_var_configuration.basic_auth {
436        local_var_req_builder = local_var_req_builder.basic_auth(local_var_auth_conf.0.to_owned(), local_var_auth_conf.1.to_owned());
437    };
438
439    let local_var_req = local_var_req_builder.build()?;
440    let local_var_resp = local_var_client.execute(local_var_req).await?;
441
442    let local_var_status = local_var_resp.status();
443    let local_var_content = local_var_resp.text().await?;
444
445    if !local_var_status.is_client_error() && !local_var_status.is_server_error() {
446        Ok(())
447    } else {
448        let local_var_entity: Option<DeleteProjectAsynchronouslyError> = serde_json::from_str(&local_var_content).ok();
449        let local_var_error = ResponseContent { status: local_var_status, content: local_var_content, entity: local_var_entity };
450        Err(Error::ResponseError(local_var_error))
451    }
452}
453
454/// Returns all projects visible to the user. Deprecated, use [ Get projects paginated](#api-rest-api-2-project-search-get) that supports search and pagination.  This operation can be accessed anonymously.  **[Permissions](#permissions) required:** Projects are returned only where the user has *Browse Projects* or *Administer projects* [project permission](https://confluence.atlassian.com/x/yodKLg) for the project.
455pub async fn get_all_projects(configuration: &configuration::Configuration, params: GetAllProjectsParams) -> Result<Vec<crate::models::Project>, Error<GetAllProjectsError>> {
456    let local_var_configuration = configuration;
457
458    // unbox the parameters
459    let expand = params.expand;
460    let recent = params.recent;
461    let properties = params.properties;
462
463
464    let local_var_client = &local_var_configuration.client;
465
466    let local_var_uri_str = format!("{}/rest/api/2/project", local_var_configuration.base_path);
467    let mut local_var_req_builder = local_var_client.request(reqwest::Method::GET, local_var_uri_str.as_str());
468
469    if let Some(ref local_var_str) = expand {
470        local_var_req_builder = local_var_req_builder.query(&[("expand", &local_var_str.to_string())]);
471    }
472    if let Some(ref local_var_str) = recent {
473        local_var_req_builder = local_var_req_builder.query(&[("recent", &local_var_str.to_string())]);
474    }
475    if let Some(ref local_var_str) = properties {
476        local_var_req_builder = match "multi" {
477            "multi" => local_var_req_builder.query(&local_var_str.into_iter().map(|p| ("properties".to_owned(), p.to_string())).collect::<Vec<(std::string::String, std::string::String)>>()),
478            _ => local_var_req_builder.query(&[("properties", &local_var_str.into_iter().map(|p| p.to_string()).collect::<Vec<String>>().join(",").to_string())]),
479        };
480    }
481    if let Some(ref local_var_user_agent) = local_var_configuration.user_agent {
482        local_var_req_builder = local_var_req_builder.header(reqwest::header::USER_AGENT, local_var_user_agent.clone());
483    }
484    if let Some(ref local_var_token) = local_var_configuration.oauth_access_token {
485        local_var_req_builder = local_var_req_builder.bearer_auth(local_var_token.to_owned());
486    };
487    if let Some(ref local_var_auth_conf) = local_var_configuration.basic_auth {
488        local_var_req_builder = local_var_req_builder.basic_auth(local_var_auth_conf.0.to_owned(), local_var_auth_conf.1.to_owned());
489    };
490
491    let local_var_req = local_var_req_builder.build()?;
492    let local_var_resp = local_var_client.execute(local_var_req).await?;
493
494    let local_var_status = local_var_resp.status();
495    let local_var_content = local_var_resp.text().await?;
496
497    if !local_var_status.is_client_error() && !local_var_status.is_server_error() {
498        serde_json::from_str(&local_var_content).map_err(Error::from)
499    } else {
500        let local_var_entity: Option<GetAllProjectsError> = serde_json::from_str(&local_var_content).ok();
501        let local_var_error = ResponseContent { status: local_var_status, content: local_var_content, entity: local_var_entity };
502        Err(Error::ResponseError(local_var_error))
503    }
504}
505
506/// Returns the valid statuses for a project. The statuses are grouped by issue type, as each project has a set of valid issue types and each issue type has a set of valid statuses.  This operation can be accessed anonymously.  **[Permissions](#permissions) required:** *Browse Projects* [project permission](https://confluence.atlassian.com/x/yodKLg) for the project.
507pub async fn get_all_statuses(configuration: &configuration::Configuration, params: GetAllStatusesParams) -> Result<Vec<crate::models::IssueTypeWithStatus>, Error<GetAllStatusesError>> {
508    let local_var_configuration = configuration;
509
510    // unbox the parameters
511    let project_id_or_key = params.project_id_or_key;
512
513
514    let local_var_client = &local_var_configuration.client;
515
516    let local_var_uri_str = format!("{}/rest/api/2/project/{projectIdOrKey}/statuses", local_var_configuration.base_path, projectIdOrKey=crate::apis::urlencode(project_id_or_key));
517    let mut local_var_req_builder = local_var_client.request(reqwest::Method::GET, local_var_uri_str.as_str());
518
519    if let Some(ref local_var_user_agent) = local_var_configuration.user_agent {
520        local_var_req_builder = local_var_req_builder.header(reqwest::header::USER_AGENT, local_var_user_agent.clone());
521    }
522    if let Some(ref local_var_token) = local_var_configuration.oauth_access_token {
523        local_var_req_builder = local_var_req_builder.bearer_auth(local_var_token.to_owned());
524    };
525    if let Some(ref local_var_auth_conf) = local_var_configuration.basic_auth {
526        local_var_req_builder = local_var_req_builder.basic_auth(local_var_auth_conf.0.to_owned(), local_var_auth_conf.1.to_owned());
527    };
528
529    let local_var_req = local_var_req_builder.build()?;
530    let local_var_resp = local_var_client.execute(local_var_req).await?;
531
532    let local_var_status = local_var_resp.status();
533    let local_var_content = local_var_resp.text().await?;
534
535    if !local_var_status.is_client_error() && !local_var_status.is_server_error() {
536        serde_json::from_str(&local_var_content).map_err(Error::from)
537    } else {
538        let local_var_entity: Option<GetAllStatusesError> = serde_json::from_str(&local_var_content).ok();
539        let local_var_error = ResponseContent { status: local_var_status, content: local_var_content, entity: local_var_entity };
540        Err(Error::ResponseError(local_var_error))
541    }
542}
543
544/// Get the issue type hierarchy for a next-gen project.  The issue type hierarchy for a project consists of:   *  *Epic* at level 1 (optional).  *  One or more issue types at level 0 such as *Story*, *Task*, or *Bug*. Where the issue type *Epic* is defined, these issue types are used to break down the content of an epic.  *  *Subtask* at level -1 (optional). This issue type enables level 0 issue types to be broken down into components. Issues based on a level -1 issue type must have a parent issue.  **[Permissions](#permissions) required:** *Browse projects* [project permission](https://confluence.atlassian.com/x/yodKLg) for the project.
545pub async fn get_hierarchy(configuration: &configuration::Configuration, params: GetHierarchyParams) -> Result<crate::models::ProjectIssueTypeHierarchy, Error<GetHierarchyError>> {
546    let local_var_configuration = configuration;
547
548    // unbox the parameters
549    let project_id = params.project_id;
550
551
552    let local_var_client = &local_var_configuration.client;
553
554    let local_var_uri_str = format!("{}/rest/api/2/project/{projectId}/hierarchy", local_var_configuration.base_path, projectId=project_id);
555    let mut local_var_req_builder = local_var_client.request(reqwest::Method::GET, local_var_uri_str.as_str());
556
557    if let Some(ref local_var_user_agent) = local_var_configuration.user_agent {
558        local_var_req_builder = local_var_req_builder.header(reqwest::header::USER_AGENT, local_var_user_agent.clone());
559    }
560    if let Some(ref local_var_token) = local_var_configuration.oauth_access_token {
561        local_var_req_builder = local_var_req_builder.bearer_auth(local_var_token.to_owned());
562    };
563    if let Some(ref local_var_auth_conf) = local_var_configuration.basic_auth {
564        local_var_req_builder = local_var_req_builder.basic_auth(local_var_auth_conf.0.to_owned(), local_var_auth_conf.1.to_owned());
565    };
566
567    let local_var_req = local_var_req_builder.build()?;
568    let local_var_resp = local_var_client.execute(local_var_req).await?;
569
570    let local_var_status = local_var_resp.status();
571    let local_var_content = local_var_resp.text().await?;
572
573    if !local_var_status.is_client_error() && !local_var_status.is_server_error() {
574        serde_json::from_str(&local_var_content).map_err(Error::from)
575    } else {
576        let local_var_entity: Option<GetHierarchyError> = serde_json::from_str(&local_var_content).ok();
577        let local_var_error = ResponseContent { status: local_var_status, content: local_var_content, entity: local_var_entity };
578        Err(Error::ResponseError(local_var_error))
579    }
580}
581
582/// Gets a [notification scheme](https://confluence.atlassian.com/x/8YdKLg) associated with the project. See the [Get notification scheme](#api-rest-api-2-notificationscheme-id-get) resource for more information about notification schemes.  **[Permissions](#permissions) required:** *Administer Jira* [global permission](https://confluence.atlassian.com/x/x4dKLg) or *Administer Projects* [project permission](https://confluence.atlassian.com/x/yodKLg).
583pub async fn get_notification_scheme_for_project(configuration: &configuration::Configuration, params: GetNotificationSchemeForProjectParams) -> Result<crate::models::NotificationScheme, Error<GetNotificationSchemeForProjectError>> {
584    let local_var_configuration = configuration;
585
586    // unbox the parameters
587    let project_key_or_id = params.project_key_or_id;
588    let expand = params.expand;
589
590
591    let local_var_client = &local_var_configuration.client;
592
593    let local_var_uri_str = format!("{}/rest/api/2/project/{projectKeyOrId}/notificationscheme", local_var_configuration.base_path, projectKeyOrId=crate::apis::urlencode(project_key_or_id));
594    let mut local_var_req_builder = local_var_client.request(reqwest::Method::GET, local_var_uri_str.as_str());
595
596    if let Some(ref local_var_str) = expand {
597        local_var_req_builder = local_var_req_builder.query(&[("expand", &local_var_str.to_string())]);
598    }
599    if let Some(ref local_var_user_agent) = local_var_configuration.user_agent {
600        local_var_req_builder = local_var_req_builder.header(reqwest::header::USER_AGENT, local_var_user_agent.clone());
601    }
602    if let Some(ref local_var_token) = local_var_configuration.oauth_access_token {
603        local_var_req_builder = local_var_req_builder.bearer_auth(local_var_token.to_owned());
604    };
605    if let Some(ref local_var_auth_conf) = local_var_configuration.basic_auth {
606        local_var_req_builder = local_var_req_builder.basic_auth(local_var_auth_conf.0.to_owned(), local_var_auth_conf.1.to_owned());
607    };
608
609    let local_var_req = local_var_req_builder.build()?;
610    let local_var_resp = local_var_client.execute(local_var_req).await?;
611
612    let local_var_status = local_var_resp.status();
613    let local_var_content = local_var_resp.text().await?;
614
615    if !local_var_status.is_client_error() && !local_var_status.is_server_error() {
616        serde_json::from_str(&local_var_content).map_err(Error::from)
617    } else {
618        let local_var_entity: Option<GetNotificationSchemeForProjectError> = serde_json::from_str(&local_var_content).ok();
619        let local_var_error = ResponseContent { status: local_var_status, content: local_var_content, entity: local_var_entity };
620        Err(Error::ResponseError(local_var_error))
621    }
622}
623
624/// Returns the [project details](https://confluence.atlassian.com/x/ahLpNw) for a project.  This operation can be accessed anonymously.  **[Permissions](#permissions) required:** *Browse projects* [project permission](https://confluence.atlassian.com/x/yodKLg) for the project.
625pub async fn get_project(configuration: &configuration::Configuration, params: GetProjectParams) -> Result<crate::models::Project, Error<GetProjectError>> {
626    let local_var_configuration = configuration;
627
628    // unbox the parameters
629    let project_id_or_key = params.project_id_or_key;
630    let expand = params.expand;
631    let properties = params.properties;
632
633
634    let local_var_client = &local_var_configuration.client;
635
636    let local_var_uri_str = format!("{}/rest/api/2/project/{projectIdOrKey}", local_var_configuration.base_path, projectIdOrKey=crate::apis::urlencode(project_id_or_key));
637    let mut local_var_req_builder = local_var_client.request(reqwest::Method::GET, local_var_uri_str.as_str());
638
639    if let Some(ref local_var_str) = expand {
640        local_var_req_builder = local_var_req_builder.query(&[("expand", &local_var_str.to_string())]);
641    }
642    if let Some(ref local_var_str) = properties {
643        local_var_req_builder = match "multi" {
644            "multi" => local_var_req_builder.query(&local_var_str.into_iter().map(|p| ("properties".to_owned(), p.to_string())).collect::<Vec<(std::string::String, std::string::String)>>()),
645            _ => local_var_req_builder.query(&[("properties", &local_var_str.into_iter().map(|p| p.to_string()).collect::<Vec<String>>().join(",").to_string())]),
646        };
647    }
648    if let Some(ref local_var_user_agent) = local_var_configuration.user_agent {
649        local_var_req_builder = local_var_req_builder.header(reqwest::header::USER_AGENT, local_var_user_agent.clone());
650    }
651    if let Some(ref local_var_token) = local_var_configuration.oauth_access_token {
652        local_var_req_builder = local_var_req_builder.bearer_auth(local_var_token.to_owned());
653    };
654    if let Some(ref local_var_auth_conf) = local_var_configuration.basic_auth {
655        local_var_req_builder = local_var_req_builder.basic_auth(local_var_auth_conf.0.to_owned(), local_var_auth_conf.1.to_owned());
656    };
657
658    let local_var_req = local_var_req_builder.build()?;
659    let local_var_resp = local_var_client.execute(local_var_req).await?;
660
661    let local_var_status = local_var_resp.status();
662    let local_var_content = local_var_resp.text().await?;
663
664    if !local_var_status.is_client_error() && !local_var_status.is_server_error() {
665        serde_json::from_str(&local_var_content).map_err(Error::from)
666    } else {
667        let local_var_entity: Option<GetProjectError> = serde_json::from_str(&local_var_content).ok();
668        let local_var_error = ResponseContent { status: local_var_status, content: local_var_content, entity: local_var_entity };
669        Err(Error::ResponseError(local_var_error))
670    }
671}
672
673/// Returns a list of up to 20 projects recently viewed by the user that are still visible to the user.  This operation can be accessed anonymously.  **[Permissions](#permissions) required:** Projects are returned only where the user has one of:   *  *Browse Projects* [project permission](https://confluence.atlassian.com/x/yodKLg) for the project.  *  *Administer Projects* [project permission](https://confluence.atlassian.com/x/yodKLg) for the project.  *  *Administer Jira* [global permission](https://confluence.atlassian.com/x/x4dKLg).
674pub async fn get_recent(configuration: &configuration::Configuration, params: GetRecentParams) -> Result<Vec<crate::models::Project>, Error<GetRecentError>> {
675    let local_var_configuration = configuration;
676
677    // unbox the parameters
678    let expand = params.expand;
679    let properties = params.properties;
680
681
682    let local_var_client = &local_var_configuration.client;
683
684    let local_var_uri_str = format!("{}/rest/api/2/project/recent", local_var_configuration.base_path);
685    let mut local_var_req_builder = local_var_client.request(reqwest::Method::GET, local_var_uri_str.as_str());
686
687    if let Some(ref local_var_str) = expand {
688        local_var_req_builder = local_var_req_builder.query(&[("expand", &local_var_str.to_string())]);
689    }
690    if let Some(ref local_var_str) = properties {
691        local_var_req_builder = match "multi" {
692            "multi" => local_var_req_builder.query(&local_var_str.into_iter().map(|p| ("properties".to_owned(), p.to_string())).collect::<Vec<(std::string::String, std::string::String)>>()),
693            _ => local_var_req_builder.query(&[("properties", &local_var_str.into_iter().map(|p| p.to_string()).collect::<Vec<String>>().join(",").to_string())]),
694        };
695    }
696    if let Some(ref local_var_user_agent) = local_var_configuration.user_agent {
697        local_var_req_builder = local_var_req_builder.header(reqwest::header::USER_AGENT, local_var_user_agent.clone());
698    }
699    if let Some(ref local_var_token) = local_var_configuration.oauth_access_token {
700        local_var_req_builder = local_var_req_builder.bearer_auth(local_var_token.to_owned());
701    };
702    if let Some(ref local_var_auth_conf) = local_var_configuration.basic_auth {
703        local_var_req_builder = local_var_req_builder.basic_auth(local_var_auth_conf.0.to_owned(), local_var_auth_conf.1.to_owned());
704    };
705
706    let local_var_req = local_var_req_builder.build()?;
707    let local_var_resp = local_var_client.execute(local_var_req).await?;
708
709    let local_var_status = local_var_resp.status();
710    let local_var_content = local_var_resp.text().await?;
711
712    if !local_var_status.is_client_error() && !local_var_status.is_server_error() {
713        serde_json::from_str(&local_var_content).map_err(Error::from)
714    } else {
715        let local_var_entity: Option<GetRecentError> = serde_json::from_str(&local_var_content).ok();
716        let local_var_error = ResponseContent { status: local_var_status, content: local_var_content, entity: local_var_entity };
717        Err(Error::ResponseError(local_var_error))
718    }
719}
720
721/// Restores a project from the Jira recycle bin.  **[Permissions](#permissions) required:** *Administer Jira* [global permission](https://confluence.atlassian.com/x/x4dKLg).
722pub async fn restore(configuration: &configuration::Configuration, params: RestoreParams) -> Result<crate::models::Project, Error<RestoreError>> {
723    let local_var_configuration = configuration;
724
725    // unbox the parameters
726    let project_id_or_key = params.project_id_or_key;
727
728
729    let local_var_client = &local_var_configuration.client;
730
731    let local_var_uri_str = format!("{}/rest/api/2/project/{projectIdOrKey}/restore", local_var_configuration.base_path, projectIdOrKey=crate::apis::urlencode(project_id_or_key));
732    let mut local_var_req_builder = local_var_client.request(reqwest::Method::POST, local_var_uri_str.as_str());
733
734    if let Some(ref local_var_user_agent) = local_var_configuration.user_agent {
735        local_var_req_builder = local_var_req_builder.header(reqwest::header::USER_AGENT, local_var_user_agent.clone());
736    }
737    if let Some(ref local_var_token) = local_var_configuration.oauth_access_token {
738        local_var_req_builder = local_var_req_builder.bearer_auth(local_var_token.to_owned());
739    };
740    if let Some(ref local_var_auth_conf) = local_var_configuration.basic_auth {
741        local_var_req_builder = local_var_req_builder.basic_auth(local_var_auth_conf.0.to_owned(), local_var_auth_conf.1.to_owned());
742    };
743
744    let local_var_req = local_var_req_builder.build()?;
745    let local_var_resp = local_var_client.execute(local_var_req).await?;
746
747    let local_var_status = local_var_resp.status();
748    let local_var_content = local_var_resp.text().await?;
749
750    if !local_var_status.is_client_error() && !local_var_status.is_server_error() {
751        serde_json::from_str(&local_var_content).map_err(Error::from)
752    } else {
753        let local_var_entity: Option<RestoreError> = serde_json::from_str(&local_var_content).ok();
754        let local_var_error = ResponseContent { status: local_var_status, content: local_var_content, entity: local_var_entity };
755        Err(Error::ResponseError(local_var_error))
756    }
757}
758
759/// Returns a [paginated](#pagination) list of projects visible to the user.  This operation can be accessed anonymously.  **[Permissions](#permissions) required:** Projects are returned only where the user has one of:   *  *Browse Projects* [project permission](https://confluence.atlassian.com/x/yodKLg) for the project.  *  *Administer Projects* [project permission](https://confluence.atlassian.com/x/yodKLg) for the project.  *  *Administer Jira* [global permission](https://confluence.atlassian.com/x/x4dKLg).
760pub async fn search_projects(configuration: &configuration::Configuration, params: SearchProjectsParams) -> Result<crate::models::PageBeanProject, Error<SearchProjectsError>> {
761    let local_var_configuration = configuration;
762
763    // unbox the parameters
764    let start_at = params.start_at;
765    let max_results = params.max_results;
766    let order_by = params.order_by;
767    let id = params.id;
768    let keys = params.keys;
769    let query = params.query;
770    let type_key = params.type_key;
771    let category_id = params.category_id;
772    let action = params.action;
773    let expand = params.expand;
774    let status = params.status;
775    let properties = params.properties;
776    let property_query = params.property_query;
777
778
779    let local_var_client = &local_var_configuration.client;
780
781    let local_var_uri_str = format!("{}/rest/api/2/project/search", local_var_configuration.base_path);
782    let mut local_var_req_builder = local_var_client.request(reqwest::Method::GET, local_var_uri_str.as_str());
783
784    if let Some(ref local_var_str) = start_at {
785        local_var_req_builder = local_var_req_builder.query(&[("startAt", &local_var_str.to_string())]);
786    }
787    if let Some(ref local_var_str) = max_results {
788        local_var_req_builder = local_var_req_builder.query(&[("maxResults", &local_var_str.to_string())]);
789    }
790    if let Some(ref local_var_str) = order_by {
791        local_var_req_builder = local_var_req_builder.query(&[("orderBy", &local_var_str.to_string())]);
792    }
793    if let Some(ref local_var_str) = id {
794        local_var_req_builder = match "multi" {
795            "multi" => local_var_req_builder.query(&local_var_str.into_iter().map(|p| ("id".to_owned(), p.to_string())).collect::<Vec<(std::string::String, std::string::String)>>()),
796            _ => local_var_req_builder.query(&[("id", &local_var_str.into_iter().map(|p| p.to_string()).collect::<Vec<String>>().join(",").to_string())]),
797        };
798    }
799    if let Some(ref local_var_str) = keys {
800        local_var_req_builder = match "multi" {
801            "multi" => local_var_req_builder.query(&local_var_str.into_iter().map(|p| ("keys".to_owned(), p.to_string())).collect::<Vec<(std::string::String, std::string::String)>>()),
802            _ => local_var_req_builder.query(&[("keys", &local_var_str.into_iter().map(|p| p.to_string()).collect::<Vec<String>>().join(",").to_string())]),
803        };
804    }
805    if let Some(ref local_var_str) = query {
806        local_var_req_builder = local_var_req_builder.query(&[("query", &local_var_str.to_string())]);
807    }
808    if let Some(ref local_var_str) = type_key {
809        local_var_req_builder = local_var_req_builder.query(&[("typeKey", &local_var_str.to_string())]);
810    }
811    if let Some(ref local_var_str) = category_id {
812        local_var_req_builder = local_var_req_builder.query(&[("categoryId", &local_var_str.to_string())]);
813    }
814    if let Some(ref local_var_str) = action {
815        local_var_req_builder = local_var_req_builder.query(&[("action", &local_var_str.to_string())]);
816    }
817    if let Some(ref local_var_str) = expand {
818        local_var_req_builder = local_var_req_builder.query(&[("expand", &local_var_str.to_string())]);
819    }
820    if let Some(ref local_var_str) = status {
821        local_var_req_builder = match "multi" {
822            "multi" => local_var_req_builder.query(&local_var_str.into_iter().map(|p| ("status".to_owned(), p.to_string())).collect::<Vec<(std::string::String, std::string::String)>>()),
823            _ => local_var_req_builder.query(&[("status", &local_var_str.into_iter().map(|p| p.to_string()).collect::<Vec<String>>().join(",").to_string())]),
824        };
825    }
826    if let Some(ref local_var_str) = properties {
827        local_var_req_builder = match "multi" {
828            "multi" => local_var_req_builder.query(&local_var_str.into_iter().map(|p| ("properties".to_owned(), p.to_string())).collect::<Vec<(std::string::String, std::string::String)>>()),
829            _ => local_var_req_builder.query(&[("properties", &local_var_str.into_iter().map(|p| p.to_string()).collect::<Vec<String>>().join(",").to_string())]),
830        };
831    }
832    if let Some(ref local_var_str) = property_query {
833        local_var_req_builder = local_var_req_builder.query(&[("propertyQuery", &local_var_str.to_string())]);
834    }
835    if let Some(ref local_var_user_agent) = local_var_configuration.user_agent {
836        local_var_req_builder = local_var_req_builder.header(reqwest::header::USER_AGENT, local_var_user_agent.clone());
837    }
838    if let Some(ref local_var_token) = local_var_configuration.oauth_access_token {
839        local_var_req_builder = local_var_req_builder.bearer_auth(local_var_token.to_owned());
840    };
841    if let Some(ref local_var_auth_conf) = local_var_configuration.basic_auth {
842        local_var_req_builder = local_var_req_builder.basic_auth(local_var_auth_conf.0.to_owned(), local_var_auth_conf.1.to_owned());
843    };
844
845    let local_var_req = local_var_req_builder.build()?;
846    let local_var_resp = local_var_client.execute(local_var_req).await?;
847
848    let local_var_status = local_var_resp.status();
849    let local_var_content = local_var_resp.text().await?;
850
851    if !local_var_status.is_client_error() && !local_var_status.is_server_error() {
852        serde_json::from_str(&local_var_content).map_err(Error::from)
853    } else {
854        let local_var_entity: Option<SearchProjectsError> = serde_json::from_str(&local_var_content).ok();
855        let local_var_error = ResponseContent { status: local_var_status, content: local_var_content, entity: local_var_entity };
856        Err(Error::ResponseError(local_var_error))
857    }
858}
859
860/// Updates the [project details](https://confluence.atlassian.com/x/ahLpNw) of a project.  All parameters are optional in the body of the request.  **[Permissions](#permissions) required:** *Administer Jira* [global permission](https://confluence.atlassian.com/x/x4dKLg).
861pub async fn update_project(configuration: &configuration::Configuration, params: UpdateProjectParams) -> Result<crate::models::Project, Error<UpdateProjectError>> {
862    let local_var_configuration = configuration;
863
864    // unbox the parameters
865    let project_id_or_key = params.project_id_or_key;
866    let update_project_details = params.update_project_details;
867    let expand = params.expand;
868
869
870    let local_var_client = &local_var_configuration.client;
871
872    let local_var_uri_str = format!("{}/rest/api/2/project/{projectIdOrKey}", local_var_configuration.base_path, projectIdOrKey=crate::apis::urlencode(project_id_or_key));
873    let mut local_var_req_builder = local_var_client.request(reqwest::Method::PUT, local_var_uri_str.as_str());
874
875    if let Some(ref local_var_str) = expand {
876        local_var_req_builder = local_var_req_builder.query(&[("expand", &local_var_str.to_string())]);
877    }
878    if let Some(ref local_var_user_agent) = local_var_configuration.user_agent {
879        local_var_req_builder = local_var_req_builder.header(reqwest::header::USER_AGENT, local_var_user_agent.clone());
880    }
881    if let Some(ref local_var_token) = local_var_configuration.oauth_access_token {
882        local_var_req_builder = local_var_req_builder.bearer_auth(local_var_token.to_owned());
883    };
884    if let Some(ref local_var_auth_conf) = local_var_configuration.basic_auth {
885        local_var_req_builder = local_var_req_builder.basic_auth(local_var_auth_conf.0.to_owned(), local_var_auth_conf.1.to_owned());
886    };
887    local_var_req_builder = local_var_req_builder.json(&update_project_details);
888
889    let local_var_req = local_var_req_builder.build()?;
890    let local_var_resp = local_var_client.execute(local_var_req).await?;
891
892    let local_var_status = local_var_resp.status();
893    let local_var_content = local_var_resp.text().await?;
894
895    if !local_var_status.is_client_error() && !local_var_status.is_server_error() {
896        serde_json::from_str(&local_var_content).map_err(Error::from)
897    } else {
898        let local_var_entity: Option<UpdateProjectError> = serde_json::from_str(&local_var_content).ok();
899        let local_var_error = ResponseContent { status: local_var_status, content: local_var_content, entity: local_var_entity };
900        Err(Error::ResponseError(local_var_error))
901    }
902}
903
904/// Deprecated, this feature is no longer supported and no alternatives are available, see [Convert project to a different template or type](https://confluence.atlassian.com/x/yEKeOQ). Updates a [project type](https://confluence.atlassian.com/x/GwiiLQ). The project type can be updated for classic projects only, project type cannot be updated for next-gen projects.  **[Permissions](#permissions) required:** *Administer Jira* [global permission](https://confluence.atlassian.com/x/x4dKLg).
905pub async fn update_project_type(configuration: &configuration::Configuration, params: UpdateProjectTypeParams) -> Result<crate::models::Project, Error<UpdateProjectTypeError>> {
906    let local_var_configuration = configuration;
907
908    // unbox the parameters
909    let project_id_or_key = params.project_id_or_key;
910    let new_project_type_key = params.new_project_type_key;
911
912
913    let local_var_client = &local_var_configuration.client;
914
915    let local_var_uri_str = format!("{}/rest/api/2/project/{projectIdOrKey}/type/{newProjectTypeKey}", local_var_configuration.base_path, projectIdOrKey=crate::apis::urlencode(project_id_or_key), newProjectTypeKey=crate::apis::urlencode(new_project_type_key));
916    let mut local_var_req_builder = local_var_client.request(reqwest::Method::PUT, local_var_uri_str.as_str());
917
918    if let Some(ref local_var_user_agent) = local_var_configuration.user_agent {
919        local_var_req_builder = local_var_req_builder.header(reqwest::header::USER_AGENT, local_var_user_agent.clone());
920    }
921    if let Some(ref local_var_token) = local_var_configuration.oauth_access_token {
922        local_var_req_builder = local_var_req_builder.bearer_auth(local_var_token.to_owned());
923    };
924    if let Some(ref local_var_auth_conf) = local_var_configuration.basic_auth {
925        local_var_req_builder = local_var_req_builder.basic_auth(local_var_auth_conf.0.to_owned(), local_var_auth_conf.1.to_owned());
926    };
927
928    let local_var_req = local_var_req_builder.build()?;
929    let local_var_resp = local_var_client.execute(local_var_req).await?;
930
931    let local_var_status = local_var_resp.status();
932    let local_var_content = local_var_resp.text().await?;
933
934    if !local_var_status.is_client_error() && !local_var_status.is_server_error() {
935        serde_json::from_str(&local_var_content).map_err(Error::from)
936    } else {
937        let local_var_entity: Option<UpdateProjectTypeError> = serde_json::from_str(&local_var_content).ok();
938        let local_var_error = ResponseContent { status: local_var_status, content: local_var_content, entity: local_var_entity };
939        Err(Error::ResponseError(local_var_error))
940    }
941}
942