/*
* CrowdStrike API Specification
*
* Use this API specification as a reference for the API endpoints you can use to interact with your Falcon environment. These endpoints support authentication via OAuth2 and interact with detections and network containment. For detailed usage guides and examples, see our [documentation inside the Falcon console](https://falcon.crowdstrike.com/support/documentation). To use the APIs described below, combine the base URL with the path shown for each API endpoint. For commercial cloud customers, your base URL is `https://api.crowdstrike.com`. Each API endpoint requires authorization via an OAuth2 token. Your first API request should retrieve an OAuth2 token using the `oauth2/token` endpoint, such as `https://api.crowdstrike.com/oauth2/token`. For subsequent requests, include the OAuth2 token in an HTTP authorization header. Tokens expire after 30 minutes, after which you should make a new token request to continue making API requests.
*
* The version of the OpenAPI document: rolling
*
* Generated by: https://openapi-generator.tech
*/
use super::{ContentType, Error, configuration};
use crate::{apis::ResponseContent, models};
use reqwest;
use serde::de::Error as _;
/// struct for typed errors of method [`workflow_activities_combined`]
#[derive(Debug, Clone, Serialize, Deserialize)]
#[serde(untagged)]
pub enum WorkflowActivitiesCombinedError {
Status400(models::ActivitiesActivityExternalResponse),
Status403(models::MsaReplyMetaOnly),
Status404(models::ActivitiesActivityExternalResponse),
Status429(models::MsaReplyMetaOnly),
Status500(models::ActivitiesActivityExternalResponse),
UnknownValue(serde_json::Value),
}
/// struct for typed errors of method [`workflow_activities_content_combined`]
#[derive(Debug, Clone, Serialize, Deserialize)]
#[serde(untagged)]
pub enum WorkflowActivitiesContentCombinedError {
Status400(models::ActivitiesActivityExternalResponse),
Status403(models::MsaReplyMetaOnly),
Status404(models::ActivitiesActivityExternalResponse),
Status429(models::MsaReplyMetaOnly),
Status500(models::ActivitiesActivityExternalResponse),
UnknownValue(serde_json::Value),
}
/// struct for typed errors of method [`workflow_definitions_action`]
#[derive(Debug, Clone, Serialize, Deserialize)]
#[serde(untagged)]
pub enum WorkflowDefinitionsActionError {
Status400(models::DefinitionsDefinitionEntitiesResponse),
Status403(models::MsaReplyMetaOnly),
Status404(models::DefinitionsDefinitionEntitiesResponse),
Status429(models::MsaReplyMetaOnly),
Status500(models::DefinitionsDefinitionEntitiesResponse),
UnknownValue(serde_json::Value),
}
/// struct for typed errors of method [`workflow_definitions_combined`]
#[derive(Debug, Clone, Serialize, Deserialize)]
#[serde(untagged)]
pub enum WorkflowDefinitionsCombinedError {
Status400(models::DefinitionsDefinitionExternalResponse),
Status403(models::MsaReplyMetaOnly),
Status404(models::DefinitionsDefinitionExternalResponse),
Status429(models::MsaReplyMetaOnly),
Status500(models::DefinitionsDefinitionExternalResponse),
UnknownValue(serde_json::Value),
}
/// struct for typed errors of method [`workflow_definitions_export`]
#[derive(Debug, Clone, Serialize, Deserialize)]
#[serde(untagged)]
pub enum WorkflowDefinitionsExportError {
Status400(Vec<i32>),
Status403(models::MsaReplyMetaOnly),
Status404(Vec<i32>),
Status429(models::MsaReplyMetaOnly),
Status500(Vec<i32>),
UnknownValue(serde_json::Value),
}
/// struct for typed errors of method [`workflow_definitions_import`]
#[derive(Debug, Clone, Serialize, Deserialize)]
#[serde(untagged)]
pub enum WorkflowDefinitionsImportError {
Status400(models::DefinitionsDefinitionImportResponse),
Status403(models::MsaReplyMetaOnly),
Status404(models::DefinitionsDefinitionImportResponse),
Status429(models::MsaReplyMetaOnly),
Status500(models::DefinitionsDefinitionImportResponse),
UnknownValue(serde_json::Value),
}
/// struct for typed errors of method [`workflow_definitions_update`]
#[derive(Debug, Clone, Serialize, Deserialize)]
#[serde(untagged)]
pub enum WorkflowDefinitionsUpdateError {
Status400(models::ApiResourceIdsResponse),
Status403(models::MsaReplyMetaOnly),
Status404(models::ApiResourceIdsResponse),
Status429(models::MsaReplyMetaOnly),
Status500(models::ApiResourceIdsResponse),
UnknownValue(serde_json::Value),
}
/// struct for typed errors of method [`workflow_execute`]
#[derive(Debug, Clone, Serialize, Deserialize)]
#[serde(untagged)]
pub enum WorkflowExecuteError {
Status400(models::ApiResourceIdsResponse),
Status401(models::ApiMfaResourceIdsResponse),
Status403(models::MsaReplyMetaOnly),
Status404(models::ApiResourceIdsResponse),
Status429(models::MsaReplyMetaOnly),
Status500(models::ApiResourceIdsResponse),
UnknownValue(serde_json::Value),
}
/// struct for typed errors of method [`workflow_execute_internal`]
#[derive(Debug, Clone, Serialize, Deserialize)]
#[serde(untagged)]
pub enum WorkflowExecuteInternalError {
Status400(models::ApiResourceIdsResponse),
Status403(models::MsaReplyMetaOnly),
Status404(models::ApiResourceIdsResponse),
Status429(models::MsaReplyMetaOnly),
Status500(models::ApiResourceIdsResponse),
UnknownValue(serde_json::Value),
}
/// struct for typed errors of method [`workflow_execution_results`]
#[derive(Debug, Clone, Serialize, Deserialize)]
#[serde(untagged)]
pub enum WorkflowExecutionResultsError {
Status400(models::ApiExecutionResultsResponse),
Status403(models::MsaReplyMetaOnly),
Status404(models::ApiExecutionResultsResponse),
Status429(models::MsaReplyMetaOnly),
Status500(models::ApiExecutionResultsResponse),
UnknownValue(serde_json::Value),
}
/// struct for typed errors of method [`workflow_executions_action`]
#[derive(Debug, Clone, Serialize, Deserialize)]
#[serde(untagged)]
pub enum WorkflowExecutionsActionError {
Status400(models::DefinitionsDefinitionEntitiesResponse),
Status403(models::MsaReplyMetaOnly),
Status404(models::DefinitionsDefinitionEntitiesResponse),
Status429(models::MsaReplyMetaOnly),
Status500(models::DefinitionsDefinitionEntitiesResponse),
UnknownValue(serde_json::Value),
}
/// struct for typed errors of method [`workflow_executions_combined`]
#[derive(Debug, Clone, Serialize, Deserialize)]
#[serde(untagged)]
pub enum WorkflowExecutionsCombinedError {
Status400(models::ApiExecutionResultsResponse),
Status403(models::MsaReplyMetaOnly),
Status404(models::ApiExecutionResultsResponse),
Status429(models::MsaReplyMetaOnly),
Status500(models::ApiExecutionResultsResponse),
UnknownValue(serde_json::Value),
}
/// struct for typed errors of method [`workflow_get_human_input_v1`]
#[derive(Debug, Clone, Serialize, Deserialize)]
#[serde(untagged)]
pub enum WorkflowGetHumanInputV1Error {
Status400(models::ModelUserInputReadResponse),
Status403(models::MsaReplyMetaOnly),
Status404(models::ModelUserInputReadResponse),
Status429(models::MsaReplyMetaOnly),
Status500(models::ModelUserInputReadResponse),
UnknownValue(serde_json::Value),
}
/// struct for typed errors of method [`workflow_mock_execute`]
#[derive(Debug, Clone, Serialize, Deserialize)]
#[serde(untagged)]
pub enum WorkflowMockExecuteError {
Status400(models::ApiResourceIdsResponse),
Status403(models::MsaReplyMetaOnly),
Status404(models::ApiResourceIdsResponse),
Status429(models::MsaReplyMetaOnly),
Status500(models::ApiResourceIdsResponse),
UnknownValue(serde_json::Value),
}
/// struct for typed errors of method [`workflow_system_definitions_de_provision`]
#[derive(Debug, Clone, Serialize, Deserialize)]
#[serde(untagged)]
pub enum WorkflowSystemDefinitionsDeProvisionError {
Status400(models::ClientSystemDefinitionCreateResponse),
Status403(models::MsaReplyMetaOnly),
Status404(models::ClientSystemDefinitionCreateResponse),
Status429(models::MsaReplyMetaOnly),
Status500(models::ClientSystemDefinitionCreateResponse),
UnknownValue(serde_json::Value),
}
/// struct for typed errors of method [`workflow_system_definitions_promote`]
#[derive(Debug, Clone, Serialize, Deserialize)]
#[serde(untagged)]
pub enum WorkflowSystemDefinitionsPromoteError {
Status400(models::ClientSystemDefinitionCreateResponse),
Status403(models::MsaReplyMetaOnly),
Status404(models::ClientSystemDefinitionCreateResponse),
Status429(models::MsaReplyMetaOnly),
Status500(models::ClientSystemDefinitionCreateResponse),
UnknownValue(serde_json::Value),
}
/// struct for typed errors of method [`workflow_system_definitions_provision`]
#[derive(Debug, Clone, Serialize, Deserialize)]
#[serde(untagged)]
pub enum WorkflowSystemDefinitionsProvisionError {
Status400(models::ClientSystemDefinitionCreateResponse),
Status403(models::MsaReplyMetaOnly),
Status404(models::ClientSystemDefinitionCreateResponse),
Status429(models::MsaReplyMetaOnly),
Status500(models::ClientSystemDefinitionCreateResponse),
UnknownValue(serde_json::Value),
}
/// struct for typed errors of method [`workflow_triggers_combined`]
#[derive(Debug, Clone, Serialize, Deserialize)]
#[serde(untagged)]
pub enum WorkflowTriggersCombinedError {
Status400(models::TriggersTriggerExternalResponse),
Status403(models::MsaReplyMetaOnly),
Status404(models::TriggersTriggerExternalResponse),
Status429(models::MsaReplyMetaOnly),
Status500(models::TriggersTriggerExternalResponse),
UnknownValue(serde_json::Value),
}
/// struct for typed errors of method [`workflow_update_human_input_v1`]
#[derive(Debug, Clone, Serialize, Deserialize)]
#[serde(untagged)]
pub enum WorkflowUpdateHumanInputV1Error {
Status400(models::ApiResourceIdsResponse),
Status403(models::MsaReplyMetaOnly),
Status404(models::ApiResourceIdsResponse),
Status429(models::MsaReplyMetaOnly),
Status500(models::ApiResourceIdsResponse),
UnknownValue(serde_json::Value),
}
pub async fn workflow_activities_combined(
configuration: &configuration::Configuration,
filter: Option<&str>,
offset: Option<&str>,
limit: Option<i32>,
sort: Option<&str>,
) -> Result<models::ActivitiesActivityExternalResponse, Error<WorkflowActivitiesCombinedError>> {
// add a prefix to parameters to efficiently prevent name collisions
let p_query_filter = filter;
let p_query_offset = offset;
let p_query_limit = limit;
let p_query_sort = sort;
let uri_str = format!(
"{}/workflows/combined/activities/v1",
configuration.base_path
);
let mut req_builder = configuration.client.request(reqwest::Method::GET, &uri_str);
if let Some(ref param_value) = p_query_filter {
req_builder = req_builder.query(&[("filter", ¶m_value.to_string())]);
}
if let Some(ref param_value) = p_query_offset {
req_builder = req_builder.query(&[("offset", ¶m_value.to_string())]);
}
if let Some(ref param_value) = p_query_limit {
req_builder = req_builder.query(&[("limit", ¶m_value.to_string())]);
}
if let Some(ref param_value) = p_query_sort {
req_builder = req_builder.query(&[("sort", ¶m_value.to_string())]);
}
if let Some(ref user_agent) = configuration.user_agent {
req_builder = req_builder.header(reqwest::header::USER_AGENT, user_agent.clone());
}
if let Some(ref token) = configuration.oauth_access_token {
req_builder = req_builder.bearer_auth(token.to_owned());
};
let req = req_builder.build()?;
let resp = configuration.client.execute(req).await?;
let status = resp.status();
let content_type = resp
.headers()
.get("content-type")
.and_then(|v| v.to_str().ok())
.unwrap_or("application/octet-stream");
let content_type = super::ContentType::from(content_type);
if !status.is_client_error() && !status.is_server_error() {
let content = resp.text().await?;
match content_type {
ContentType::Json => serde_json::from_str(&content).map_err(Error::from),
ContentType::Text => {
return Err(Error::from(serde_json::Error::custom(
"Received `text/plain` content type response that cannot be converted to `models::ActivitiesActivityExternalResponse`",
)));
}
ContentType::Unsupported(unknown_type) => {
return Err(Error::from(serde_json::Error::custom(format!(
"Received `{unknown_type}` content type response that cannot be converted to `models::ActivitiesActivityExternalResponse`"
))));
}
}
} else {
let content = resp.text().await?;
let entity: Option<WorkflowActivitiesCombinedError> = serde_json::from_str(&content).ok();
Err(Error::ResponseError(ResponseContent {
status,
content,
entity,
}))
}
}
pub async fn workflow_activities_content_combined(
configuration: &configuration::Configuration,
filter: Option<&str>,
offset: Option<&str>,
limit: Option<i32>,
sort: Option<&str>,
) -> Result<models::ActivitiesActivityExternalResponse, Error<WorkflowActivitiesContentCombinedError>>
{
// add a prefix to parameters to efficiently prevent name collisions
let p_query_filter = filter;
let p_query_offset = offset;
let p_query_limit = limit;
let p_query_sort = sort;
let uri_str = format!(
"{}/workflows/combined/activity-content/v1",
configuration.base_path
);
let mut req_builder = configuration.client.request(reqwest::Method::GET, &uri_str);
if let Some(ref param_value) = p_query_filter {
req_builder = req_builder.query(&[("filter", ¶m_value.to_string())]);
}
if let Some(ref param_value) = p_query_offset {
req_builder = req_builder.query(&[("offset", ¶m_value.to_string())]);
}
if let Some(ref param_value) = p_query_limit {
req_builder = req_builder.query(&[("limit", ¶m_value.to_string())]);
}
if let Some(ref param_value) = p_query_sort {
req_builder = req_builder.query(&[("sort", ¶m_value.to_string())]);
}
if let Some(ref user_agent) = configuration.user_agent {
req_builder = req_builder.header(reqwest::header::USER_AGENT, user_agent.clone());
}
if let Some(ref token) = configuration.oauth_access_token {
req_builder = req_builder.bearer_auth(token.to_owned());
};
let req = req_builder.build()?;
let resp = configuration.client.execute(req).await?;
let status = resp.status();
let content_type = resp
.headers()
.get("content-type")
.and_then(|v| v.to_str().ok())
.unwrap_or("application/octet-stream");
let content_type = super::ContentType::from(content_type);
if !status.is_client_error() && !status.is_server_error() {
let content = resp.text().await?;
match content_type {
ContentType::Json => serde_json::from_str(&content).map_err(Error::from),
ContentType::Text => {
return Err(Error::from(serde_json::Error::custom(
"Received `text/plain` content type response that cannot be converted to `models::ActivitiesActivityExternalResponse`",
)));
}
ContentType::Unsupported(unknown_type) => {
return Err(Error::from(serde_json::Error::custom(format!(
"Received `{unknown_type}` content type response that cannot be converted to `models::ActivitiesActivityExternalResponse`"
))));
}
}
} else {
let content = resp.text().await?;
let entity: Option<WorkflowActivitiesContentCombinedError> =
serde_json::from_str(&content).ok();
Err(Error::ResponseError(ResponseContent {
status,
content,
entity,
}))
}
}
pub async fn workflow_definitions_action(
configuration: &configuration::Configuration,
action_name: &str,
) -> Result<models::DefinitionsDefinitionEntitiesResponse, Error<WorkflowDefinitionsActionError>> {
// add a prefix to parameters to efficiently prevent name collisions
let p_query_action_name = action_name;
let uri_str = format!(
"{}/workflows/entities/definition-actions/v1",
configuration.base_path
);
let mut req_builder = configuration
.client
.request(reqwest::Method::POST, &uri_str);
req_builder = req_builder.query(&[("action_name", &p_query_action_name.to_string())]);
if let Some(ref user_agent) = configuration.user_agent {
req_builder = req_builder.header(reqwest::header::USER_AGENT, user_agent.clone());
}
if let Some(ref token) = configuration.oauth_access_token {
req_builder = req_builder.bearer_auth(token.to_owned());
};
let req = req_builder.build()?;
let resp = configuration.client.execute(req).await?;
let status = resp.status();
let content_type = resp
.headers()
.get("content-type")
.and_then(|v| v.to_str().ok())
.unwrap_or("application/octet-stream");
let content_type = super::ContentType::from(content_type);
if !status.is_client_error() && !status.is_server_error() {
let content = resp.text().await?;
match content_type {
ContentType::Json => serde_json::from_str(&content).map_err(Error::from),
ContentType::Text => {
return Err(Error::from(serde_json::Error::custom(
"Received `text/plain` content type response that cannot be converted to `models::DefinitionsDefinitionEntitiesResponse`",
)));
}
ContentType::Unsupported(unknown_type) => {
return Err(Error::from(serde_json::Error::custom(format!(
"Received `{unknown_type}` content type response that cannot be converted to `models::DefinitionsDefinitionEntitiesResponse`"
))));
}
}
} else {
let content = resp.text().await?;
let entity: Option<WorkflowDefinitionsActionError> = serde_json::from_str(&content).ok();
Err(Error::ResponseError(ResponseContent {
status,
content,
entity,
}))
}
}
pub async fn workflow_definitions_combined(
configuration: &configuration::Configuration,
filter: Option<&str>,
offset: Option<&str>,
limit: Option<i32>,
sort: Option<&str>,
) -> Result<models::DefinitionsDefinitionExternalResponse, Error<WorkflowDefinitionsCombinedError>>
{
// add a prefix to parameters to efficiently prevent name collisions
let p_query_filter = filter;
let p_query_offset = offset;
let p_query_limit = limit;
let p_query_sort = sort;
let uri_str = format!(
"{}/workflows/combined/definitions/v1",
configuration.base_path
);
let mut req_builder = configuration.client.request(reqwest::Method::GET, &uri_str);
if let Some(ref param_value) = p_query_filter {
req_builder = req_builder.query(&[("filter", ¶m_value.to_string())]);
}
if let Some(ref param_value) = p_query_offset {
req_builder = req_builder.query(&[("offset", ¶m_value.to_string())]);
}
if let Some(ref param_value) = p_query_limit {
req_builder = req_builder.query(&[("limit", ¶m_value.to_string())]);
}
if let Some(ref param_value) = p_query_sort {
req_builder = req_builder.query(&[("sort", ¶m_value.to_string())]);
}
if let Some(ref user_agent) = configuration.user_agent {
req_builder = req_builder.header(reqwest::header::USER_AGENT, user_agent.clone());
}
if let Some(ref token) = configuration.oauth_access_token {
req_builder = req_builder.bearer_auth(token.to_owned());
};
let req = req_builder.build()?;
let resp = configuration.client.execute(req).await?;
let status = resp.status();
let content_type = resp
.headers()
.get("content-type")
.and_then(|v| v.to_str().ok())
.unwrap_or("application/octet-stream");
let content_type = super::ContentType::from(content_type);
if !status.is_client_error() && !status.is_server_error() {
let content = resp.text().await?;
match content_type {
ContentType::Json => serde_json::from_str(&content).map_err(Error::from),
ContentType::Text => {
return Err(Error::from(serde_json::Error::custom(
"Received `text/plain` content type response that cannot be converted to `models::DefinitionsDefinitionExternalResponse`",
)));
}
ContentType::Unsupported(unknown_type) => {
return Err(Error::from(serde_json::Error::custom(format!(
"Received `{unknown_type}` content type response that cannot be converted to `models::DefinitionsDefinitionExternalResponse`"
))));
}
}
} else {
let content = resp.text().await?;
let entity: Option<WorkflowDefinitionsCombinedError> = serde_json::from_str(&content).ok();
Err(Error::ResponseError(ResponseContent {
status,
content,
entity,
}))
}
}
pub async fn workflow_definitions_export(
configuration: &configuration::Configuration,
id: &str,
sanitize: Option<bool>,
) -> Result<Vec<i32>, Error<WorkflowDefinitionsExportError>> {
// add a prefix to parameters to efficiently prevent name collisions
let p_query_id = id;
let p_query_sanitize = sanitize;
let uri_str = format!(
"{}/workflows/entities/definitions/export/v1",
configuration.base_path
);
let mut req_builder = configuration.client.request(reqwest::Method::GET, &uri_str);
req_builder = req_builder.query(&[("id", &p_query_id.to_string())]);
if let Some(ref param_value) = p_query_sanitize {
req_builder = req_builder.query(&[("sanitize", ¶m_value.to_string())]);
}
if let Some(ref user_agent) = configuration.user_agent {
req_builder = req_builder.header(reqwest::header::USER_AGENT, user_agent.clone());
}
if let Some(ref token) = configuration.oauth_access_token {
req_builder = req_builder.bearer_auth(token.to_owned());
};
let req = req_builder.build()?;
let resp = configuration.client.execute(req).await?;
let status = resp.status();
let content_type = resp
.headers()
.get("content-type")
.and_then(|v| v.to_str().ok())
.unwrap_or("application/octet-stream");
let content_type = super::ContentType::from(content_type);
if !status.is_client_error() && !status.is_server_error() {
let content = resp.text().await?;
match content_type {
ContentType::Json => serde_json::from_str(&content).map_err(Error::from),
ContentType::Text => {
return Err(Error::from(serde_json::Error::custom(
"Received `text/plain` content type response that cannot be converted to `Vec<i32>`",
)));
}
ContentType::Unsupported(unknown_type) => {
return Err(Error::from(serde_json::Error::custom(format!(
"Received `{unknown_type}` content type response that cannot be converted to `Vec<i32>`"
))));
}
}
} else {
let content = resp.text().await?;
let entity: Option<WorkflowDefinitionsExportError> = serde_json::from_str(&content).ok();
Err(Error::ResponseError(ResponseContent {
status,
content,
entity,
}))
}
}
pub async fn workflow_definitions_import(
configuration: &configuration::Configuration,
data_file: std::path::PathBuf,
name: Option<&str>,
validate_only: Option<bool>,
) -> Result<models::DefinitionsDefinitionImportResponse, Error<WorkflowDefinitionsImportError>> {
// add a prefix to parameters to efficiently prevent name collisions
let _p_form_data_file = data_file;
let p_query_name = name;
let p_query_validate_only = validate_only;
let uri_str = format!(
"{}/workflows/entities/definitions/import/v1",
configuration.base_path
);
let mut req_builder = configuration
.client
.request(reqwest::Method::POST, &uri_str);
if let Some(ref param_value) = p_query_name {
req_builder = req_builder.query(&[("name", ¶m_value.to_string())]);
}
if let Some(ref param_value) = p_query_validate_only {
req_builder = req_builder.query(&[("validate_only", ¶m_value.to_string())]);
}
if let Some(ref user_agent) = configuration.user_agent {
req_builder = req_builder.header(reqwest::header::USER_AGENT, user_agent.clone());
}
if let Some(ref token) = configuration.oauth_access_token {
req_builder = req_builder.bearer_auth(token.to_owned());
};
let multipart_form = reqwest::multipart::Form::new();
// TODO: support file upload for 'data_file' parameter
req_builder = req_builder.multipart(multipart_form);
let req = req_builder.build()?;
let resp = configuration.client.execute(req).await?;
let status = resp.status();
let content_type = resp
.headers()
.get("content-type")
.and_then(|v| v.to_str().ok())
.unwrap_or("application/octet-stream");
let content_type = super::ContentType::from(content_type);
if !status.is_client_error() && !status.is_server_error() {
let content = resp.text().await?;
match content_type {
ContentType::Json => serde_json::from_str(&content).map_err(Error::from),
ContentType::Text => {
return Err(Error::from(serde_json::Error::custom(
"Received `text/plain` content type response that cannot be converted to `models::DefinitionsDefinitionImportResponse`",
)));
}
ContentType::Unsupported(unknown_type) => {
return Err(Error::from(serde_json::Error::custom(format!(
"Received `{unknown_type}` content type response that cannot be converted to `models::DefinitionsDefinitionImportResponse`"
))));
}
}
} else {
let content = resp.text().await?;
let entity: Option<WorkflowDefinitionsImportError> = serde_json::from_str(&content).ok();
Err(Error::ResponseError(ResponseContent {
status,
content,
entity,
}))
}
}
pub async fn workflow_definitions_update(
configuration: &configuration::Configuration,
body: models::ModelsDefinitionUpdateRequestV2,
validate_only: Option<bool>,
) -> Result<models::ApiResourceIdsResponse, Error<WorkflowDefinitionsUpdateError>> {
// add a prefix to parameters to efficiently prevent name collisions
let p_body_body = body;
let p_query_validate_only = validate_only;
let uri_str = format!(
"{}/workflows/entities/definitions/v1",
configuration.base_path
);
let mut req_builder = configuration.client.request(reqwest::Method::PUT, &uri_str);
if let Some(ref param_value) = p_query_validate_only {
req_builder = req_builder.query(&[("validate_only", ¶m_value.to_string())]);
}
if let Some(ref user_agent) = configuration.user_agent {
req_builder = req_builder.header(reqwest::header::USER_AGENT, user_agent.clone());
}
if let Some(ref token) = configuration.oauth_access_token {
req_builder = req_builder.bearer_auth(token.to_owned());
};
req_builder = req_builder.json(&p_body_body);
let req = req_builder.build()?;
let resp = configuration.client.execute(req).await?;
let status = resp.status();
let content_type = resp
.headers()
.get("content-type")
.and_then(|v| v.to_str().ok())
.unwrap_or("application/octet-stream");
let content_type = super::ContentType::from(content_type);
if !status.is_client_error() && !status.is_server_error() {
let content = resp.text().await?;
match content_type {
ContentType::Json => serde_json::from_str(&content).map_err(Error::from),
ContentType::Text => {
return Err(Error::from(serde_json::Error::custom(
"Received `text/plain` content type response that cannot be converted to `models::ApiResourceIdsResponse`",
)));
}
ContentType::Unsupported(unknown_type) => {
return Err(Error::from(serde_json::Error::custom(format!(
"Received `{unknown_type}` content type response that cannot be converted to `models::ApiResourceIdsResponse`"
))));
}
}
} else {
let content = resp.text().await?;
let entity: Option<WorkflowDefinitionsUpdateError> = serde_json::from_str(&content).ok();
Err(Error::ResponseError(ResponseContent {
status,
content,
entity,
}))
}
}
pub async fn workflow_execute(
configuration: &configuration::Configuration,
body: serde_json::Value,
execution_cid: Option<Vec<String>>,
definition_id: Option<Vec<String>>,
name: Option<&str>,
key: Option<&str>,
depth: Option<i32>,
source_event_url: Option<&str>,
) -> Result<models::ApiResourceIdsResponse, Error<WorkflowExecuteError>> {
// add a prefix to parameters to efficiently prevent name collisions
let p_body_body = body;
let p_query_execution_cid = execution_cid;
let p_query_definition_id = definition_id;
let p_query_name = name;
let p_query_key = key;
let p_query_depth = depth;
let p_query_source_event_url = source_event_url;
let uri_str = format!("{}/workflows/entities/execute/v1", configuration.base_path);
let mut req_builder = configuration
.client
.request(reqwest::Method::POST, &uri_str);
if let Some(ref param_value) = p_query_execution_cid {
req_builder = match "csv" {
"multi" => req_builder.query(
¶m_value
.into_iter()
.map(|p| ("execution_cid".to_owned(), p.to_string()))
.collect::<Vec<(std::string::String, std::string::String)>>(),
),
_ => req_builder.query(&[(
"execution_cid",
¶m_value
.into_iter()
.map(|p| p.to_string())
.collect::<Vec<String>>()
.join(",")
.to_string(),
)]),
};
}
if let Some(ref param_value) = p_query_definition_id {
req_builder = match "csv" {
"multi" => req_builder.query(
¶m_value
.into_iter()
.map(|p| ("definition_id".to_owned(), p.to_string()))
.collect::<Vec<(std::string::String, std::string::String)>>(),
),
_ => req_builder.query(&[(
"definition_id",
¶m_value
.into_iter()
.map(|p| p.to_string())
.collect::<Vec<String>>()
.join(",")
.to_string(),
)]),
};
}
if let Some(ref param_value) = p_query_name {
req_builder = req_builder.query(&[("name", ¶m_value.to_string())]);
}
if let Some(ref param_value) = p_query_key {
req_builder = req_builder.query(&[("key", ¶m_value.to_string())]);
}
if let Some(ref param_value) = p_query_depth {
req_builder = req_builder.query(&[("depth", ¶m_value.to_string())]);
}
if let Some(ref param_value) = p_query_source_event_url {
req_builder = req_builder.query(&[("source_event_url", ¶m_value.to_string())]);
}
if let Some(ref user_agent) = configuration.user_agent {
req_builder = req_builder.header(reqwest::header::USER_AGENT, user_agent.clone());
}
if let Some(ref token) = configuration.oauth_access_token {
req_builder = req_builder.bearer_auth(token.to_owned());
};
req_builder = req_builder.json(&p_body_body);
let req = req_builder.build()?;
let resp = configuration.client.execute(req).await?;
let status = resp.status();
let content_type = resp
.headers()
.get("content-type")
.and_then(|v| v.to_str().ok())
.unwrap_or("application/octet-stream");
let content_type = super::ContentType::from(content_type);
if !status.is_client_error() && !status.is_server_error() {
let content = resp.text().await?;
match content_type {
ContentType::Json => serde_json::from_str(&content).map_err(Error::from),
ContentType::Text => {
return Err(Error::from(serde_json::Error::custom(
"Received `text/plain` content type response that cannot be converted to `models::ApiResourceIdsResponse`",
)));
}
ContentType::Unsupported(unknown_type) => {
return Err(Error::from(serde_json::Error::custom(format!(
"Received `{unknown_type}` content type response that cannot be converted to `models::ApiResourceIdsResponse`"
))));
}
}
} else {
let content = resp.text().await?;
let entity: Option<WorkflowExecuteError> = serde_json::from_str(&content).ok();
Err(Error::ResponseError(ResponseContent {
status,
content,
entity,
}))
}
}
pub async fn workflow_execute_internal(
configuration: &configuration::Configuration,
body: serde_json::Value,
execution_cid: Option<Vec<String>>,
definition_id: Option<Vec<String>>,
name: Option<&str>,
key: Option<&str>,
depth: Option<i32>,
batch_size: Option<i32>,
source_event_url: Option<&str>,
) -> Result<models::ApiResourceIdsResponse, Error<WorkflowExecuteInternalError>> {
// add a prefix to parameters to efficiently prevent name collisions
let p_body_body = body;
let p_query_execution_cid = execution_cid;
let p_query_definition_id = definition_id;
let p_query_name = name;
let p_query_key = key;
let p_query_depth = depth;
let p_query_batch_size = batch_size;
let p_query_source_event_url = source_event_url;
let uri_str = format!(
"{}/workflows/entities/execute/internal/v1",
configuration.base_path
);
let mut req_builder = configuration
.client
.request(reqwest::Method::POST, &uri_str);
if let Some(ref param_value) = p_query_execution_cid {
req_builder = match "csv" {
"multi" => req_builder.query(
¶m_value
.into_iter()
.map(|p| ("execution_cid".to_owned(), p.to_string()))
.collect::<Vec<(std::string::String, std::string::String)>>(),
),
_ => req_builder.query(&[(
"execution_cid",
¶m_value
.into_iter()
.map(|p| p.to_string())
.collect::<Vec<String>>()
.join(",")
.to_string(),
)]),
};
}
if let Some(ref param_value) = p_query_definition_id {
req_builder = match "csv" {
"multi" => req_builder.query(
¶m_value
.into_iter()
.map(|p| ("definition_id".to_owned(), p.to_string()))
.collect::<Vec<(std::string::String, std::string::String)>>(),
),
_ => req_builder.query(&[(
"definition_id",
¶m_value
.into_iter()
.map(|p| p.to_string())
.collect::<Vec<String>>()
.join(",")
.to_string(),
)]),
};
}
if let Some(ref param_value) = p_query_name {
req_builder = req_builder.query(&[("name", ¶m_value.to_string())]);
}
if let Some(ref param_value) = p_query_key {
req_builder = req_builder.query(&[("key", ¶m_value.to_string())]);
}
if let Some(ref param_value) = p_query_depth {
req_builder = req_builder.query(&[("depth", ¶m_value.to_string())]);
}
if let Some(ref param_value) = p_query_batch_size {
req_builder = req_builder.query(&[("batch_size", ¶m_value.to_string())]);
}
if let Some(ref param_value) = p_query_source_event_url {
req_builder = req_builder.query(&[("source_event_url", ¶m_value.to_string())]);
}
if let Some(ref user_agent) = configuration.user_agent {
req_builder = req_builder.header(reqwest::header::USER_AGENT, user_agent.clone());
}
if let Some(ref token) = configuration.oauth_access_token {
req_builder = req_builder.bearer_auth(token.to_owned());
};
req_builder = req_builder.json(&p_body_body);
let req = req_builder.build()?;
let resp = configuration.client.execute(req).await?;
let status = resp.status();
let content_type = resp
.headers()
.get("content-type")
.and_then(|v| v.to_str().ok())
.unwrap_or("application/octet-stream");
let content_type = super::ContentType::from(content_type);
if !status.is_client_error() && !status.is_server_error() {
let content = resp.text().await?;
match content_type {
ContentType::Json => serde_json::from_str(&content).map_err(Error::from),
ContentType::Text => {
return Err(Error::from(serde_json::Error::custom(
"Received `text/plain` content type response that cannot be converted to `models::ApiResourceIdsResponse`",
)));
}
ContentType::Unsupported(unknown_type) => {
return Err(Error::from(serde_json::Error::custom(format!(
"Received `{unknown_type}` content type response that cannot be converted to `models::ApiResourceIdsResponse`"
))));
}
}
} else {
let content = resp.text().await?;
let entity: Option<WorkflowExecuteInternalError> = serde_json::from_str(&content).ok();
Err(Error::ResponseError(ResponseContent {
status,
content,
entity,
}))
}
}
pub async fn workflow_execution_results(
configuration: &configuration::Configuration,
ids: Vec<String>,
) -> Result<models::ApiExecutionResultsResponse, Error<WorkflowExecutionResultsError>> {
// add a prefix to parameters to efficiently prevent name collisions
let p_query_ids = ids;
let uri_str = format!(
"{}/workflows/entities/execution-results/v1",
configuration.base_path
);
let mut req_builder = configuration.client.request(reqwest::Method::GET, &uri_str);
req_builder = match "csv" {
"multi" => req_builder.query(
&p_query_ids
.into_iter()
.map(|p| ("ids".to_owned(), p.to_string()))
.collect::<Vec<(std::string::String, std::string::String)>>(),
),
_ => req_builder.query(&[(
"ids",
&p_query_ids
.into_iter()
.map(|p| p.to_string())
.collect::<Vec<String>>()
.join(",")
.to_string(),
)]),
};
if let Some(ref user_agent) = configuration.user_agent {
req_builder = req_builder.header(reqwest::header::USER_AGENT, user_agent.clone());
}
if let Some(ref token) = configuration.oauth_access_token {
req_builder = req_builder.bearer_auth(token.to_owned());
};
let req = req_builder.build()?;
let resp = configuration.client.execute(req).await?;
let status = resp.status();
let content_type = resp
.headers()
.get("content-type")
.and_then(|v| v.to_str().ok())
.unwrap_or("application/octet-stream");
let content_type = super::ContentType::from(content_type);
if !status.is_client_error() && !status.is_server_error() {
let content = resp.text().await?;
match content_type {
ContentType::Json => serde_json::from_str(&content).map_err(Error::from),
ContentType::Text => {
return Err(Error::from(serde_json::Error::custom(
"Received `text/plain` content type response that cannot be converted to `models::ApiExecutionResultsResponse`",
)));
}
ContentType::Unsupported(unknown_type) => {
return Err(Error::from(serde_json::Error::custom(format!(
"Received `{unknown_type}` content type response that cannot be converted to `models::ApiExecutionResultsResponse`"
))));
}
}
} else {
let content = resp.text().await?;
let entity: Option<WorkflowExecutionResultsError> = serde_json::from_str(&content).ok();
Err(Error::ResponseError(ResponseContent {
status,
content,
entity,
}))
}
}
pub async fn workflow_executions_action(
configuration: &configuration::Configuration,
action_name: &str,
body: models::ClientActionRequest,
) -> Result<models::DefinitionsDefinitionEntitiesResponse, Error<WorkflowExecutionsActionError>> {
// add a prefix to parameters to efficiently prevent name collisions
let p_query_action_name = action_name;
let p_body_body = body;
let uri_str = format!(
"{}/workflows/entities/execution-actions/v1",
configuration.base_path
);
let mut req_builder = configuration
.client
.request(reqwest::Method::POST, &uri_str);
req_builder = req_builder.query(&[("action_name", &p_query_action_name.to_string())]);
if let Some(ref user_agent) = configuration.user_agent {
req_builder = req_builder.header(reqwest::header::USER_AGENT, user_agent.clone());
}
if let Some(ref token) = configuration.oauth_access_token {
req_builder = req_builder.bearer_auth(token.to_owned());
};
req_builder = req_builder.json(&p_body_body);
let req = req_builder.build()?;
let resp = configuration.client.execute(req).await?;
let status = resp.status();
let content_type = resp
.headers()
.get("content-type")
.and_then(|v| v.to_str().ok())
.unwrap_or("application/octet-stream");
let content_type = super::ContentType::from(content_type);
if !status.is_client_error() && !status.is_server_error() {
let content = resp.text().await?;
match content_type {
ContentType::Json => serde_json::from_str(&content).map_err(Error::from),
ContentType::Text => {
return Err(Error::from(serde_json::Error::custom(
"Received `text/plain` content type response that cannot be converted to `models::DefinitionsDefinitionEntitiesResponse`",
)));
}
ContentType::Unsupported(unknown_type) => {
return Err(Error::from(serde_json::Error::custom(format!(
"Received `{unknown_type}` content type response that cannot be converted to `models::DefinitionsDefinitionEntitiesResponse`"
))));
}
}
} else {
let content = resp.text().await?;
let entity: Option<WorkflowExecutionsActionError> = serde_json::from_str(&content).ok();
Err(Error::ResponseError(ResponseContent {
status,
content,
entity,
}))
}
}
pub async fn workflow_executions_combined(
configuration: &configuration::Configuration,
filter: Option<&str>,
offset: Option<&str>,
limit: Option<i32>,
sort: Option<&str>,
) -> Result<models::ApiExecutionResultsResponse, Error<WorkflowExecutionsCombinedError>> {
// add a prefix to parameters to efficiently prevent name collisions
let p_query_filter = filter;
let p_query_offset = offset;
let p_query_limit = limit;
let p_query_sort = sort;
let uri_str = format!(
"{}/workflows/combined/executions/v1",
configuration.base_path
);
let mut req_builder = configuration.client.request(reqwest::Method::GET, &uri_str);
if let Some(ref param_value) = p_query_filter {
req_builder = req_builder.query(&[("filter", ¶m_value.to_string())]);
}
if let Some(ref param_value) = p_query_offset {
req_builder = req_builder.query(&[("offset", ¶m_value.to_string())]);
}
if let Some(ref param_value) = p_query_limit {
req_builder = req_builder.query(&[("limit", ¶m_value.to_string())]);
}
if let Some(ref param_value) = p_query_sort {
req_builder = req_builder.query(&[("sort", ¶m_value.to_string())]);
}
if let Some(ref user_agent) = configuration.user_agent {
req_builder = req_builder.header(reqwest::header::USER_AGENT, user_agent.clone());
}
if let Some(ref token) = configuration.oauth_access_token {
req_builder = req_builder.bearer_auth(token.to_owned());
};
let req = req_builder.build()?;
let resp = configuration.client.execute(req).await?;
let status = resp.status();
let content_type = resp
.headers()
.get("content-type")
.and_then(|v| v.to_str().ok())
.unwrap_or("application/octet-stream");
let content_type = super::ContentType::from(content_type);
if !status.is_client_error() && !status.is_server_error() {
let content = resp.text().await?;
match content_type {
ContentType::Json => serde_json::from_str(&content).map_err(Error::from),
ContentType::Text => {
return Err(Error::from(serde_json::Error::custom(
"Received `text/plain` content type response that cannot be converted to `models::ApiExecutionResultsResponse`",
)));
}
ContentType::Unsupported(unknown_type) => {
return Err(Error::from(serde_json::Error::custom(format!(
"Received `{unknown_type}` content type response that cannot be converted to `models::ApiExecutionResultsResponse`"
))));
}
}
} else {
let content = resp.text().await?;
let entity: Option<WorkflowExecutionsCombinedError> = serde_json::from_str(&content).ok();
Err(Error::ResponseError(ResponseContent {
status,
content,
entity,
}))
}
}
pub async fn workflow_get_human_input_v1(
configuration: &configuration::Configuration,
ids: Vec<String>,
) -> Result<models::ModelUserInputReadResponse, Error<WorkflowGetHumanInputV1Error>> {
// add a prefix to parameters to efficiently prevent name collisions
let p_query_ids = ids;
let uri_str = format!(
"{}/workflows/entities/human-inputs/v1",
configuration.base_path
);
let mut req_builder = configuration.client.request(reqwest::Method::GET, &uri_str);
req_builder = match "csv" {
"multi" => req_builder.query(
&p_query_ids
.into_iter()
.map(|p| ("ids".to_owned(), p.to_string()))
.collect::<Vec<(std::string::String, std::string::String)>>(),
),
_ => req_builder.query(&[(
"ids",
&p_query_ids
.into_iter()
.map(|p| p.to_string())
.collect::<Vec<String>>()
.join(",")
.to_string(),
)]),
};
if let Some(ref user_agent) = configuration.user_agent {
req_builder = req_builder.header(reqwest::header::USER_AGENT, user_agent.clone());
}
if let Some(ref token) = configuration.oauth_access_token {
req_builder = req_builder.bearer_auth(token.to_owned());
};
let req = req_builder.build()?;
let resp = configuration.client.execute(req).await?;
let status = resp.status();
let content_type = resp
.headers()
.get("content-type")
.and_then(|v| v.to_str().ok())
.unwrap_or("application/octet-stream");
let content_type = super::ContentType::from(content_type);
if !status.is_client_error() && !status.is_server_error() {
let content = resp.text().await?;
match content_type {
ContentType::Json => serde_json::from_str(&content).map_err(Error::from),
ContentType::Text => {
return Err(Error::from(serde_json::Error::custom(
"Received `text/plain` content type response that cannot be converted to `models::ModelUserInputReadResponse`",
)));
}
ContentType::Unsupported(unknown_type) => {
return Err(Error::from(serde_json::Error::custom(format!(
"Received `{unknown_type}` content type response that cannot be converted to `models::ModelUserInputReadResponse`"
))));
}
}
} else {
let content = resp.text().await?;
let entity: Option<WorkflowGetHumanInputV1Error> = serde_json::from_str(&content).ok();
Err(Error::ResponseError(ResponseContent {
status,
content,
entity,
}))
}
}
pub async fn workflow_mock_execute(
configuration: &configuration::Configuration,
body: models::ModelsMockExecutionCreateRequestV1,
execution_cid: Option<Vec<String>>,
definition_id: Option<&str>,
name: Option<&str>,
key: Option<&str>,
depth: Option<i32>,
source_event_url: Option<&str>,
validate_only: Option<bool>,
) -> Result<models::ApiResourceIdsResponse, Error<WorkflowMockExecuteError>> {
// add a prefix to parameters to efficiently prevent name collisions
let p_body_body = body;
let p_query_execution_cid = execution_cid;
let p_query_definition_id = definition_id;
let p_query_name = name;
let p_query_key = key;
let p_query_depth = depth;
let p_query_source_event_url = source_event_url;
let p_query_validate_only = validate_only;
let uri_str = format!(
"{}/workflows/entities/mock-executions/v1",
configuration.base_path
);
let mut req_builder = configuration
.client
.request(reqwest::Method::POST, &uri_str);
if let Some(ref param_value) = p_query_execution_cid {
req_builder = match "csv" {
"multi" => req_builder.query(
¶m_value
.into_iter()
.map(|p| ("execution_cid".to_owned(), p.to_string()))
.collect::<Vec<(std::string::String, std::string::String)>>(),
),
_ => req_builder.query(&[(
"execution_cid",
¶m_value
.into_iter()
.map(|p| p.to_string())
.collect::<Vec<String>>()
.join(",")
.to_string(),
)]),
};
}
if let Some(ref param_value) = p_query_definition_id {
req_builder = req_builder.query(&[("definition_id", ¶m_value.to_string())]);
}
if let Some(ref param_value) = p_query_name {
req_builder = req_builder.query(&[("name", ¶m_value.to_string())]);
}
if let Some(ref param_value) = p_query_key {
req_builder = req_builder.query(&[("key", ¶m_value.to_string())]);
}
if let Some(ref param_value) = p_query_depth {
req_builder = req_builder.query(&[("depth", ¶m_value.to_string())]);
}
if let Some(ref param_value) = p_query_source_event_url {
req_builder = req_builder.query(&[("source_event_url", ¶m_value.to_string())]);
}
if let Some(ref param_value) = p_query_validate_only {
req_builder = req_builder.query(&[("validate_only", ¶m_value.to_string())]);
}
if let Some(ref user_agent) = configuration.user_agent {
req_builder = req_builder.header(reqwest::header::USER_AGENT, user_agent.clone());
}
if let Some(ref token) = configuration.oauth_access_token {
req_builder = req_builder.bearer_auth(token.to_owned());
};
req_builder = req_builder.json(&p_body_body);
let req = req_builder.build()?;
let resp = configuration.client.execute(req).await?;
let status = resp.status();
let content_type = resp
.headers()
.get("content-type")
.and_then(|v| v.to_str().ok())
.unwrap_or("application/octet-stream");
let content_type = super::ContentType::from(content_type);
if !status.is_client_error() && !status.is_server_error() {
let content = resp.text().await?;
match content_type {
ContentType::Json => serde_json::from_str(&content).map_err(Error::from),
ContentType::Text => {
return Err(Error::from(serde_json::Error::custom(
"Received `text/plain` content type response that cannot be converted to `models::ApiResourceIdsResponse`",
)));
}
ContentType::Unsupported(unknown_type) => {
return Err(Error::from(serde_json::Error::custom(format!(
"Received `{unknown_type}` content type response that cannot be converted to `models::ApiResourceIdsResponse`"
))));
}
}
} else {
let content = resp.text().await?;
let entity: Option<WorkflowMockExecuteError> = serde_json::from_str(&content).ok();
Err(Error::ResponseError(ResponseContent {
status,
content,
entity,
}))
}
}
pub async fn workflow_system_definitions_de_provision(
configuration: &configuration::Configuration,
body: models::ClientSystemDefinitionDeProvisionRequest,
) -> Result<
models::ClientSystemDefinitionCreateResponse,
Error<WorkflowSystemDefinitionsDeProvisionError>,
> {
// add a prefix to parameters to efficiently prevent name collisions
let p_body_body = body;
let uri_str = format!(
"{}/workflows/system-definitions/deprovision/v1",
configuration.base_path
);
let mut req_builder = configuration
.client
.request(reqwest::Method::POST, &uri_str);
if let Some(ref user_agent) = configuration.user_agent {
req_builder = req_builder.header(reqwest::header::USER_AGENT, user_agent.clone());
}
if let Some(ref token) = configuration.oauth_access_token {
req_builder = req_builder.bearer_auth(token.to_owned());
};
req_builder = req_builder.json(&p_body_body);
let req = req_builder.build()?;
let resp = configuration.client.execute(req).await?;
let status = resp.status();
let content_type = resp
.headers()
.get("content-type")
.and_then(|v| v.to_str().ok())
.unwrap_or("application/octet-stream");
let content_type = super::ContentType::from(content_type);
if !status.is_client_error() && !status.is_server_error() {
let content = resp.text().await?;
match content_type {
ContentType::Json => serde_json::from_str(&content).map_err(Error::from),
ContentType::Text => {
return Err(Error::from(serde_json::Error::custom(
"Received `text/plain` content type response that cannot be converted to `models::ClientSystemDefinitionCreateResponse`",
)));
}
ContentType::Unsupported(unknown_type) => {
return Err(Error::from(serde_json::Error::custom(format!(
"Received `{unknown_type}` content type response that cannot be converted to `models::ClientSystemDefinitionCreateResponse`"
))));
}
}
} else {
let content = resp.text().await?;
let entity: Option<WorkflowSystemDefinitionsDeProvisionError> =
serde_json::from_str(&content).ok();
Err(Error::ResponseError(ResponseContent {
status,
content,
entity,
}))
}
}
pub async fn workflow_system_definitions_promote(
configuration: &configuration::Configuration,
body: models::ClientSystemDefinitionPromoteRequest,
) -> Result<
models::ClientSystemDefinitionCreateResponse,
Error<WorkflowSystemDefinitionsPromoteError>,
> {
// add a prefix to parameters to efficiently prevent name collisions
let p_body_body = body;
let uri_str = format!(
"{}/workflows/system-definitions/promote/v1",
configuration.base_path
);
let mut req_builder = configuration
.client
.request(reqwest::Method::POST, &uri_str);
if let Some(ref user_agent) = configuration.user_agent {
req_builder = req_builder.header(reqwest::header::USER_AGENT, user_agent.clone());
}
if let Some(ref token) = configuration.oauth_access_token {
req_builder = req_builder.bearer_auth(token.to_owned());
};
req_builder = req_builder.json(&p_body_body);
let req = req_builder.build()?;
let resp = configuration.client.execute(req).await?;
let status = resp.status();
let content_type = resp
.headers()
.get("content-type")
.and_then(|v| v.to_str().ok())
.unwrap_or("application/octet-stream");
let content_type = super::ContentType::from(content_type);
if !status.is_client_error() && !status.is_server_error() {
let content = resp.text().await?;
match content_type {
ContentType::Json => serde_json::from_str(&content).map_err(Error::from),
ContentType::Text => {
return Err(Error::from(serde_json::Error::custom(
"Received `text/plain` content type response that cannot be converted to `models::ClientSystemDefinitionCreateResponse`",
)));
}
ContentType::Unsupported(unknown_type) => {
return Err(Error::from(serde_json::Error::custom(format!(
"Received `{unknown_type}` content type response that cannot be converted to `models::ClientSystemDefinitionCreateResponse`"
))));
}
}
} else {
let content = resp.text().await?;
let entity: Option<WorkflowSystemDefinitionsPromoteError> =
serde_json::from_str(&content).ok();
Err(Error::ResponseError(ResponseContent {
status,
content,
entity,
}))
}
}
pub async fn workflow_system_definitions_provision(
configuration: &configuration::Configuration,
body: models::ClientSystemDefinitionProvisionRequest,
) -> Result<
models::ClientSystemDefinitionCreateResponse,
Error<WorkflowSystemDefinitionsProvisionError>,
> {
// add a prefix to parameters to efficiently prevent name collisions
let p_body_body = body;
let uri_str = format!(
"{}/workflows/system-definitions/provision/v1",
configuration.base_path
);
let mut req_builder = configuration
.client
.request(reqwest::Method::POST, &uri_str);
if let Some(ref user_agent) = configuration.user_agent {
req_builder = req_builder.header(reqwest::header::USER_AGENT, user_agent.clone());
}
if let Some(ref token) = configuration.oauth_access_token {
req_builder = req_builder.bearer_auth(token.to_owned());
};
req_builder = req_builder.json(&p_body_body);
let req = req_builder.build()?;
let resp = configuration.client.execute(req).await?;
let status = resp.status();
let content_type = resp
.headers()
.get("content-type")
.and_then(|v| v.to_str().ok())
.unwrap_or("application/octet-stream");
let content_type = super::ContentType::from(content_type);
if !status.is_client_error() && !status.is_server_error() {
let content = resp.text().await?;
match content_type {
ContentType::Json => serde_json::from_str(&content).map_err(Error::from),
ContentType::Text => {
return Err(Error::from(serde_json::Error::custom(
"Received `text/plain` content type response that cannot be converted to `models::ClientSystemDefinitionCreateResponse`",
)));
}
ContentType::Unsupported(unknown_type) => {
return Err(Error::from(serde_json::Error::custom(format!(
"Received `{unknown_type}` content type response that cannot be converted to `models::ClientSystemDefinitionCreateResponse`"
))));
}
}
} else {
let content = resp.text().await?;
let entity: Option<WorkflowSystemDefinitionsProvisionError> =
serde_json::from_str(&content).ok();
Err(Error::ResponseError(ResponseContent {
status,
content,
entity,
}))
}
}
pub async fn workflow_triggers_combined(
configuration: &configuration::Configuration,
filter: Option<&str>,
) -> Result<models::TriggersTriggerExternalResponse, Error<WorkflowTriggersCombinedError>> {
// add a prefix to parameters to efficiently prevent name collisions
let p_query_filter = filter;
let uri_str = format!("{}/workflows/combined/triggers/v1", configuration.base_path);
let mut req_builder = configuration.client.request(reqwest::Method::GET, &uri_str);
if let Some(ref param_value) = p_query_filter {
req_builder = req_builder.query(&[("filter", ¶m_value.to_string())]);
}
if let Some(ref user_agent) = configuration.user_agent {
req_builder = req_builder.header(reqwest::header::USER_AGENT, user_agent.clone());
}
if let Some(ref token) = configuration.oauth_access_token {
req_builder = req_builder.bearer_auth(token.to_owned());
};
let req = req_builder.build()?;
let resp = configuration.client.execute(req).await?;
let status = resp.status();
let content_type = resp
.headers()
.get("content-type")
.and_then(|v| v.to_str().ok())
.unwrap_or("application/octet-stream");
let content_type = super::ContentType::from(content_type);
if !status.is_client_error() && !status.is_server_error() {
let content = resp.text().await?;
match content_type {
ContentType::Json => serde_json::from_str(&content).map_err(Error::from),
ContentType::Text => {
return Err(Error::from(serde_json::Error::custom(
"Received `text/plain` content type response that cannot be converted to `models::TriggersTriggerExternalResponse`",
)));
}
ContentType::Unsupported(unknown_type) => {
return Err(Error::from(serde_json::Error::custom(format!(
"Received `{unknown_type}` content type response that cannot be converted to `models::TriggersTriggerExternalResponse`"
))));
}
}
} else {
let content = resp.text().await?;
let entity: Option<WorkflowTriggersCombinedError> = serde_json::from_str(&content).ok();
Err(Error::ResponseError(ResponseContent {
status,
content,
entity,
}))
}
}
pub async fn workflow_update_human_input_v1(
configuration: &configuration::Configuration,
id: &str,
body: models::ModelUserInputUpdateRequest,
) -> Result<models::ApiResourceIdsResponse, Error<WorkflowUpdateHumanInputV1Error>> {
// add a prefix to parameters to efficiently prevent name collisions
let p_query_id = id;
let p_body_body = body;
let uri_str = format!(
"{}/workflows/entities/human-inputs/v1",
configuration.base_path
);
let mut req_builder = configuration
.client
.request(reqwest::Method::PATCH, &uri_str);
req_builder = req_builder.query(&[("id", &p_query_id.to_string())]);
if let Some(ref user_agent) = configuration.user_agent {
req_builder = req_builder.header(reqwest::header::USER_AGENT, user_agent.clone());
}
if let Some(ref token) = configuration.oauth_access_token {
req_builder = req_builder.bearer_auth(token.to_owned());
};
req_builder = req_builder.json(&p_body_body);
let req = req_builder.build()?;
let resp = configuration.client.execute(req).await?;
let status = resp.status();
let content_type = resp
.headers()
.get("content-type")
.and_then(|v| v.to_str().ok())
.unwrap_or("application/octet-stream");
let content_type = super::ContentType::from(content_type);
if !status.is_client_error() && !status.is_server_error() {
let content = resp.text().await?;
match content_type {
ContentType::Json => serde_json::from_str(&content).map_err(Error::from),
ContentType::Text => {
return Err(Error::from(serde_json::Error::custom(
"Received `text/plain` content type response that cannot be converted to `models::ApiResourceIdsResponse`",
)));
}
ContentType::Unsupported(unknown_type) => {
return Err(Error::from(serde_json::Error::custom(format!(
"Received `{unknown_type}` content type response that cannot be converted to `models::ApiResourceIdsResponse`"
))));
}
}
} else {
let content = resp.text().await?;
let entity: Option<WorkflowUpdateHumanInputV1Error> = serde_json::from_str(&content).ok();
Err(Error::ResponseError(ResponseContent {
status,
content,
entity,
}))
}
}