use crate::clients::rest::models;
use serde::{Deserialize, Serialize};
#[derive(Clone, Default, Debug, PartialEq, Serialize, Deserialize)]
pub struct V1TaskGet200Response {
#[serde(rename = "metadata")]
pub metadata: Box<models::V1TaskGet200ResponseMetadata>,
#[serde(rename = "actionId", skip_serializing_if = "Option::is_none")]
pub action_id: Option<String>,
#[serde(rename = "retryCount", skip_serializing_if = "Option::is_none")]
pub retry_count: Option<i32>,
#[serde(rename = "attempt", skip_serializing_if = "Option::is_none")]
pub attempt: Option<i32>,
#[serde(rename = "additionalMetadata", skip_serializing_if = "Option::is_none")]
pub additional_metadata: Option<serde_json::Value>,
#[serde(rename = "children", skip_serializing_if = "Option::is_none")]
pub children: Option<Vec<models::V1TaskGet200ResponseChildrenInner>>,
#[serde(rename = "createdAt")]
pub created_at: String,
#[serde(rename = "displayName")]
pub display_name: String,
#[serde(rename = "duration", skip_serializing_if = "Option::is_none")]
pub duration: Option<i32>,
#[serde(rename = "errorMessage", skip_serializing_if = "Option::is_none")]
pub error_message: Option<String>,
#[serde(rename = "finishedAt", skip_serializing_if = "Option::is_none")]
pub finished_at: Option<String>,
#[serde(rename = "input")]
pub input: serde_json::Value,
#[serde(rename = "numSpawnedChildren")]
pub num_spawned_children: i32,
#[serde(rename = "output")]
pub output: serde_json::Value,
#[serde(rename = "status")]
pub status: Status,
#[serde(rename = "startedAt", skip_serializing_if = "Option::is_none")]
pub started_at: Option<String>,
#[serde(rename = "stepId", skip_serializing_if = "Option::is_none")]
pub step_id: Option<uuid::Uuid>,
#[serde(rename = "taskExternalId")]
pub task_external_id: uuid::Uuid,
#[serde(rename = "taskId")]
pub task_id: i32,
#[serde(rename = "taskInsertedAt")]
pub task_inserted_at: String,
#[serde(rename = "tenantId")]
pub tenant_id: uuid::Uuid,
#[serde(rename = "type")]
pub r#type: Type,
#[serde(rename = "workflowId")]
pub workflow_id: uuid::Uuid,
#[serde(rename = "workflowName", skip_serializing_if = "Option::is_none")]
pub workflow_name: Option<String>,
#[serde(rename = "workflowRunExternalId")]
pub workflow_run_external_id: uuid::Uuid,
#[serde(rename = "workflowVersionId", skip_serializing_if = "Option::is_none")]
pub workflow_version_id: Option<uuid::Uuid>,
#[serde(rename = "workflowConfig", skip_serializing_if = "Option::is_none")]
pub workflow_config: Option<serde_json::Value>,
#[serde(
rename = "parentTaskExternalId",
skip_serializing_if = "Option::is_none"
)]
pub parent_task_external_id: Option<uuid::Uuid>,
}
impl V1TaskGet200Response {
pub fn new(
metadata: models::V1TaskGet200ResponseMetadata,
created_at: String,
display_name: String,
input: serde_json::Value,
num_spawned_children: i32,
output: serde_json::Value,
status: Status,
task_external_id: uuid::Uuid,
task_id: i32,
task_inserted_at: String,
tenant_id: uuid::Uuid,
r#type: Type,
workflow_id: uuid::Uuid,
workflow_run_external_id: uuid::Uuid,
) -> V1TaskGet200Response {
V1TaskGet200Response {
metadata: Box::new(metadata),
action_id: None,
retry_count: None,
attempt: None,
additional_metadata: None,
children: None,
created_at,
display_name,
duration: None,
error_message: None,
finished_at: None,
input,
num_spawned_children,
output,
status,
started_at: None,
step_id: None,
task_external_id,
task_id,
task_inserted_at,
tenant_id,
r#type,
workflow_id,
workflow_name: None,
workflow_run_external_id,
workflow_version_id: None,
workflow_config: None,
parent_task_external_id: None,
}
}
}
#[derive(Clone, Copy, Debug, Eq, PartialEq, Ord, PartialOrd, Hash, Serialize, Deserialize)]
pub enum Status {
#[serde(rename = "QUEUED")]
Queued,
#[serde(rename = "RUNNING")]
Running,
#[serde(rename = "COMPLETED")]
Completed,
#[serde(rename = "CANCELLED")]
Cancelled,
#[serde(rename = "FAILED")]
Failed,
}
impl Default for Status {
fn default() -> Status {
Self::Queued
}
}
#[derive(Clone, Copy, Debug, Eq, PartialEq, Ord, PartialOrd, Hash, Serialize, Deserialize)]
pub enum Type {
#[serde(rename = "DAG")]
Dag,
#[serde(rename = "TASK")]
Task,
}
impl Default for Type {
fn default() -> Type {
Self::Dag
}
}