use reqwest;
use crate::apis::ResponseContent;
use super::{Error, configuration};
#[derive(Clone, Debug, Default)]
pub struct AppIssueFieldValueUpdateResourceUpdateIssueFieldsPutParams {
pub atlassian_transfer_id: String,
pub atlassian_account_id: String,
pub connect_custom_field_values: crate::models::ConnectCustomFieldValues
}
#[derive(Clone, Debug, Default)]
pub struct MigrationResourceUpdateEntityPropertiesValuePutParams {
pub atlassian_transfer_id: String,
pub atlassian_account_id: String,
pub entity_type: String,
pub entity_property_details: Vec<crate::models::EntityPropertyDetails>
}
#[derive(Clone, Debug, Default)]
pub struct MigrationResourceWorkflowRuleSearchPostParams {
pub atlassian_transfer_id: String,
pub workflow_rules_search: crate::models::WorkflowRulesSearch
}
#[derive(Debug, Clone, Serialize, Deserialize)]
#[serde(untagged)]
pub enum AppIssueFieldValueUpdateResourceUpdateIssueFieldsPutSuccess {
Status200(serde_json::Value),
UnknownValue(serde_json::Value),
}
#[derive(Debug, Clone, Serialize, Deserialize)]
#[serde(untagged)]
pub enum MigrationResourceUpdateEntityPropertiesValuePutSuccess {
Status200(),
UnknownValue(serde_json::Value),
}
#[derive(Debug, Clone, Serialize, Deserialize)]
#[serde(untagged)]
pub enum MigrationResourceWorkflowRuleSearchPostSuccess {
Status200(crate::models::WorkflowRulesSearchDetails),
UnknownValue(serde_json::Value),
}
#[derive(Debug, Clone, Serialize, Deserialize)]
#[serde(untagged)]
pub enum AppIssueFieldValueUpdateResourceUpdateIssueFieldsPutError {
Status400(),
Status403(),
UnknownValue(serde_json::Value),
}
#[derive(Debug, Clone, Serialize, Deserialize)]
#[serde(untagged)]
pub enum MigrationResourceUpdateEntityPropertiesValuePutError {
Status400(),
Status403(),
UnknownValue(serde_json::Value),
}
#[derive(Debug, Clone, Serialize, Deserialize)]
#[serde(untagged)]
pub enum MigrationResourceWorkflowRuleSearchPostError {
Status400(),
Status403(),
UnknownValue(serde_json::Value),
}
pub async fn app_issue_field_value_update_resource_update_issue_fields_put(configuration: &configuration::Configuration, params: AppIssueFieldValueUpdateResourceUpdateIssueFieldsPutParams) -> Result<ResponseContent<AppIssueFieldValueUpdateResourceUpdateIssueFieldsPutSuccess>, Error<AppIssueFieldValueUpdateResourceUpdateIssueFieldsPutError>> {
let local_var_configuration = configuration;
let atlassian_transfer_id = params.atlassian_transfer_id;
let atlassian_account_id = params.atlassian_account_id;
let connect_custom_field_values = params.connect_custom_field_values;
let local_var_client = &local_var_configuration.client;
let local_var_uri_str = format!("{}/rest/atlassian-connect/1/migration/field", local_var_configuration.base_path);
let mut local_var_req_builder = local_var_client.request(reqwest::Method::PUT, local_var_uri_str.as_str());
if let Some(ref local_var_user_agent) = local_var_configuration.user_agent {
local_var_req_builder = local_var_req_builder.header(reqwest::header::USER_AGENT, local_var_user_agent.clone());
}
local_var_req_builder = local_var_req_builder.header("Atlassian-Transfer-Id", atlassian_transfer_id.to_string());
local_var_req_builder = local_var_req_builder.header("Atlassian-Account-Id", atlassian_account_id.to_string());
local_var_req_builder = local_var_req_builder.json(&connect_custom_field_values);
let local_var_req = local_var_req_builder.build()?;
let local_var_resp = local_var_client.execute(local_var_req).await?;
let local_var_status = local_var_resp.status();
let local_var_content = local_var_resp.text().await?;
if !local_var_status.is_client_error() && !local_var_status.is_server_error() {
let local_var_entity: Option<AppIssueFieldValueUpdateResourceUpdateIssueFieldsPutSuccess> = serde_json::from_str(&local_var_content).ok();
let local_var_result = ResponseContent { status: local_var_status, content: local_var_content, entity: local_var_entity };
Ok(local_var_result)
} else {
let local_var_entity: Option<AppIssueFieldValueUpdateResourceUpdateIssueFieldsPutError> = serde_json::from_str(&local_var_content).ok();
let local_var_error = ResponseContent { status: local_var_status, content: local_var_content, entity: local_var_entity };
Err(Error::ResponseError(local_var_error))
}
}
pub async fn migration_resource_update_entity_properties_value_put(configuration: &configuration::Configuration, params: MigrationResourceUpdateEntityPropertiesValuePutParams) -> Result<ResponseContent<MigrationResourceUpdateEntityPropertiesValuePutSuccess>, Error<MigrationResourceUpdateEntityPropertiesValuePutError>> {
let local_var_configuration = configuration;
let atlassian_transfer_id = params.atlassian_transfer_id;
let atlassian_account_id = params.atlassian_account_id;
let entity_type = params.entity_type;
let entity_property_details = params.entity_property_details;
let local_var_client = &local_var_configuration.client;
let local_var_uri_str = format!("{}/rest/atlassian-connect/1/migration/properties/{entityType}", local_var_configuration.base_path, entityType=crate::apis::urlencode(entity_type));
let mut local_var_req_builder = local_var_client.request(reqwest::Method::PUT, local_var_uri_str.as_str());
if let Some(ref local_var_user_agent) = local_var_configuration.user_agent {
local_var_req_builder = local_var_req_builder.header(reqwest::header::USER_AGENT, local_var_user_agent.clone());
}
local_var_req_builder = local_var_req_builder.header("Atlassian-Transfer-Id", atlassian_transfer_id.to_string());
local_var_req_builder = local_var_req_builder.header("Atlassian-Account-Id", atlassian_account_id.to_string());
local_var_req_builder = local_var_req_builder.json(&entity_property_details);
let local_var_req = local_var_req_builder.build()?;
let local_var_resp = local_var_client.execute(local_var_req).await?;
let local_var_status = local_var_resp.status();
let local_var_content = local_var_resp.text().await?;
if !local_var_status.is_client_error() && !local_var_status.is_server_error() {
let local_var_entity: Option<MigrationResourceUpdateEntityPropertiesValuePutSuccess> = serde_json::from_str(&local_var_content).ok();
let local_var_result = ResponseContent { status: local_var_status, content: local_var_content, entity: local_var_entity };
Ok(local_var_result)
} else {
let local_var_entity: Option<MigrationResourceUpdateEntityPropertiesValuePutError> = serde_json::from_str(&local_var_content).ok();
let local_var_error = ResponseContent { status: local_var_status, content: local_var_content, entity: local_var_entity };
Err(Error::ResponseError(local_var_error))
}
}
pub async fn migration_resource_workflow_rule_search_post(configuration: &configuration::Configuration, params: MigrationResourceWorkflowRuleSearchPostParams) -> Result<ResponseContent<MigrationResourceWorkflowRuleSearchPostSuccess>, Error<MigrationResourceWorkflowRuleSearchPostError>> {
let local_var_configuration = configuration;
let atlassian_transfer_id = params.atlassian_transfer_id;
let workflow_rules_search = params.workflow_rules_search;
let local_var_client = &local_var_configuration.client;
let local_var_uri_str = format!("{}/rest/atlassian-connect/1/migration/workflow/rule/search", local_var_configuration.base_path);
let mut local_var_req_builder = local_var_client.request(reqwest::Method::POST, local_var_uri_str.as_str());
if let Some(ref local_var_user_agent) = local_var_configuration.user_agent {
local_var_req_builder = local_var_req_builder.header(reqwest::header::USER_AGENT, local_var_user_agent.clone());
}
local_var_req_builder = local_var_req_builder.header("Atlassian-Transfer-Id", atlassian_transfer_id.to_string());
local_var_req_builder = local_var_req_builder.json(&workflow_rules_search);
let local_var_req = local_var_req_builder.build()?;
let local_var_resp = local_var_client.execute(local_var_req).await?;
let local_var_status = local_var_resp.status();
let local_var_content = local_var_resp.text().await?;
if !local_var_status.is_client_error() && !local_var_status.is_server_error() {
let local_var_entity: Option<MigrationResourceWorkflowRuleSearchPostSuccess> = serde_json::from_str(&local_var_content).ok();
let local_var_result = ResponseContent { status: local_var_status, content: local_var_content, entity: local_var_entity };
Ok(local_var_result)
} else {
let local_var_entity: Option<MigrationResourceWorkflowRuleSearchPostError> = serde_json::from_str(&local_var_content).ok();
let local_var_error = ResponseContent { status: local_var_status, content: local_var_content, entity: local_var_entity };
Err(Error::ResponseError(local_var_error))
}
}