jira2/apis/
app_migration_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 [`app_issue_field_value_update_resource_update_issue_fields_put`]
18#[derive(Clone, Debug, Default)]
19pub struct AppIssueFieldValueUpdateResourceUpdateIssueFieldsPutParams {
20    /// The ID of the transfer.
21    pub atlassian_transfer_id: String,
22    /// The Atlassian account ID of the impersonated user. This user must be a member of the site admin group.
23    pub atlassian_account_id: String,
24    pub connect_custom_field_values: crate::models::ConnectCustomFieldValues
25}
26
27/// struct for passing parameters to the method [`migration_resource_update_entity_properties_value_put`]
28#[derive(Clone, Debug, Default)]
29pub struct MigrationResourceUpdateEntityPropertiesValuePutParams {
30    /// The app migration transfer ID.
31    pub atlassian_transfer_id: String,
32    /// The Atlassian account ID of the impersonated user. This user must be a member of the site admin group.
33    pub atlassian_account_id: String,
34    /// The type indicating the object that contains the entity properties.
35    pub entity_type: String,
36    pub entity_property_details: Vec<crate::models::EntityPropertyDetails>
37}
38
39/// struct for passing parameters to the method [`migration_resource_workflow_rule_search_post`]
40#[derive(Clone, Debug, Default)]
41pub struct MigrationResourceWorkflowRuleSearchPostParams {
42    /// The app migration transfer ID.
43    pub atlassian_transfer_id: String,
44    pub workflow_rules_search: crate::models::WorkflowRulesSearch
45}
46
47
48/// struct for typed errors of method [`app_issue_field_value_update_resource_update_issue_fields_put`]
49#[derive(Debug, Clone, Serialize, Deserialize)]
50#[serde(untagged)]
51pub enum AppIssueFieldValueUpdateResourceUpdateIssueFieldsPutError {
52    Status400(),
53    Status403(),
54    UnknownValue(serde_json::Value),
55}
56
57/// struct for typed errors of method [`migration_resource_update_entity_properties_value_put`]
58#[derive(Debug, Clone, Serialize, Deserialize)]
59#[serde(untagged)]
60pub enum MigrationResourceUpdateEntityPropertiesValuePutError {
61    Status400(),
62    Status403(),
63    UnknownValue(serde_json::Value),
64}
65
66/// struct for typed errors of method [`migration_resource_workflow_rule_search_post`]
67#[derive(Debug, Clone, Serialize, Deserialize)]
68#[serde(untagged)]
69pub enum MigrationResourceWorkflowRuleSearchPostError {
70    Status400(),
71    Status403(),
72    UnknownValue(serde_json::Value),
73}
74
75
76/// Updates the value of a custom field added by Connect apps on one or more issues. The values of up to 200 custom fields can be updated.  **[Permissions](#permissions) required:** Only Connect apps can make this request.
77pub async fn app_issue_field_value_update_resource_update_issue_fields_put(configuration: &configuration::Configuration, params: AppIssueFieldValueUpdateResourceUpdateIssueFieldsPutParams) -> Result<serde_json::Value, Error<AppIssueFieldValueUpdateResourceUpdateIssueFieldsPutError>> {
78    let local_var_configuration = configuration;
79
80    // unbox the parameters
81    let atlassian_transfer_id = params.atlassian_transfer_id;
82    let atlassian_account_id = params.atlassian_account_id;
83    let connect_custom_field_values = params.connect_custom_field_values;
84
85
86    let local_var_client = &local_var_configuration.client;
87
88    let local_var_uri_str = format!("{}/rest/atlassian-connect/1/migration/field", local_var_configuration.base_path);
89    let mut local_var_req_builder = local_var_client.request(reqwest::Method::PUT, local_var_uri_str.as_str());
90
91    if let Some(ref local_var_user_agent) = local_var_configuration.user_agent {
92        local_var_req_builder = local_var_req_builder.header(reqwest::header::USER_AGENT, local_var_user_agent.clone());
93    }
94    local_var_req_builder = local_var_req_builder.header("Atlassian-Transfer-Id", atlassian_transfer_id.to_string());
95    local_var_req_builder = local_var_req_builder.header("Atlassian-Account-Id", atlassian_account_id.to_string());
96    local_var_req_builder = local_var_req_builder.json(&connect_custom_field_values);
97
98    let local_var_req = local_var_req_builder.build()?;
99    let local_var_resp = local_var_client.execute(local_var_req).await?;
100
101    let local_var_status = local_var_resp.status();
102    let local_var_content = local_var_resp.text().await?;
103
104    if !local_var_status.is_client_error() && !local_var_status.is_server_error() {
105        serde_json::from_str(&local_var_content).map_err(Error::from)
106    } else {
107        let local_var_entity: Option<AppIssueFieldValueUpdateResourceUpdateIssueFieldsPutError> = serde_json::from_str(&local_var_content).ok();
108        let local_var_error = ResponseContent { status: local_var_status, content: local_var_content, entity: local_var_entity };
109        Err(Error::ResponseError(local_var_error))
110    }
111}
112
113/// Updates the values of multiple entity properties for an object, up to 50 updates per request. This operation is for use by Connect apps during app migration.
114pub async fn migration_resource_update_entity_properties_value_put(configuration: &configuration::Configuration, params: MigrationResourceUpdateEntityPropertiesValuePutParams) -> Result<(), Error<MigrationResourceUpdateEntityPropertiesValuePutError>> {
115    let local_var_configuration = configuration;
116
117    // unbox the parameters
118    let atlassian_transfer_id = params.atlassian_transfer_id;
119    let atlassian_account_id = params.atlassian_account_id;
120    let entity_type = params.entity_type;
121    let entity_property_details = params.entity_property_details;
122
123
124    let local_var_client = &local_var_configuration.client;
125
126    let local_var_uri_str = format!("{}/rest/atlassian-connect/1/migration/properties/{entityType}", local_var_configuration.base_path, entityType=crate::apis::urlencode(entity_type));
127    let mut local_var_req_builder = local_var_client.request(reqwest::Method::PUT, local_var_uri_str.as_str());
128
129    if let Some(ref local_var_user_agent) = local_var_configuration.user_agent {
130        local_var_req_builder = local_var_req_builder.header(reqwest::header::USER_AGENT, local_var_user_agent.clone());
131    }
132    local_var_req_builder = local_var_req_builder.header("Atlassian-Transfer-Id", atlassian_transfer_id.to_string());
133    local_var_req_builder = local_var_req_builder.header("Atlassian-Account-Id", atlassian_account_id.to_string());
134    local_var_req_builder = local_var_req_builder.json(&entity_property_details);
135
136    let local_var_req = local_var_req_builder.build()?;
137    let local_var_resp = local_var_client.execute(local_var_req).await?;
138
139    let local_var_status = local_var_resp.status();
140    let local_var_content = local_var_resp.text().await?;
141
142    if !local_var_status.is_client_error() && !local_var_status.is_server_error() {
143        Ok(())
144    } else {
145        let local_var_entity: Option<MigrationResourceUpdateEntityPropertiesValuePutError> = serde_json::from_str(&local_var_content).ok();
146        let local_var_error = ResponseContent { status: local_var_status, content: local_var_content, entity: local_var_entity };
147        Err(Error::ResponseError(local_var_error))
148    }
149}
150
151/// Returns configurations for workflow transition rules migrated from server to cloud and owned by the calling Connect app.
152pub async fn migration_resource_workflow_rule_search_post(configuration: &configuration::Configuration, params: MigrationResourceWorkflowRuleSearchPostParams) -> Result<crate::models::WorkflowRulesSearchDetails, Error<MigrationResourceWorkflowRuleSearchPostError>> {
153    let local_var_configuration = configuration;
154
155    // unbox the parameters
156    let atlassian_transfer_id = params.atlassian_transfer_id;
157    let workflow_rules_search = params.workflow_rules_search;
158
159
160    let local_var_client = &local_var_configuration.client;
161
162    let local_var_uri_str = format!("{}/rest/atlassian-connect/1/migration/workflow/rule/search", local_var_configuration.base_path);
163    let mut local_var_req_builder = local_var_client.request(reqwest::Method::POST, local_var_uri_str.as_str());
164
165    if let Some(ref local_var_user_agent) = local_var_configuration.user_agent {
166        local_var_req_builder = local_var_req_builder.header(reqwest::header::USER_AGENT, local_var_user_agent.clone());
167    }
168    local_var_req_builder = local_var_req_builder.header("Atlassian-Transfer-Id", atlassian_transfer_id.to_string());
169    local_var_req_builder = local_var_req_builder.json(&workflow_rules_search);
170
171    let local_var_req = local_var_req_builder.build()?;
172    let local_var_resp = local_var_client.execute(local_var_req).await?;
173
174    let local_var_status = local_var_resp.status();
175    let local_var_content = local_var_resp.text().await?;
176
177    if !local_var_status.is_client_error() && !local_var_status.is_server_error() {
178        serde_json::from_str(&local_var_content).map_err(Error::from)
179    } else {
180        let local_var_entity: Option<MigrationResourceWorkflowRuleSearchPostError> = serde_json::from_str(&local_var_content).ok();
181        let local_var_error = ResponseContent { status: local_var_status, content: local_var_content, entity: local_var_entity };
182        Err(Error::ResponseError(local_var_error))
183    }
184}
185