#![allow(missing_docs, unreachable_pub, clippy::all, clippy::pedantic)]
use crate::client::Client;
use crate::error::Error;
use crate::generated::routes;
use crate::generated::types::*;
pub struct Workflows<'a> {
client: &'a Client,
}
impl<'a> Workflows<'a> {
pub(crate) fn new(client: &'a Client) -> Self {
Self { client }
}
pub fn client(&self) -> &'a Client {
self.client
}
pub async fn create_staging(&self, topic_id: i64, workflow_id: i64) -> Result<(), Error> {
let mut operation = self
.client
.operation(&routes::CREATE_WORKFLOW_STAGING, &[&topic_id, &workflow_id]);
operation.resource_id(topic_id);
self.client.send_unit(operation).await
}
pub async fn get(&self, workflow_id: i64) -> Result<GetWorkflowResponseContent, Error> {
let mut operation = self
.client
.operation(&routes::GET_WORKFLOW, &[&workflow_id]);
operation.resource_id(workflow_id);
self.client.send(operation).await
}
pub async fn get_stage(
&self,
workflow_id: i64,
stage_id: i64,
) -> Result<GetWorkflowStageOutputPayload, Error> {
let mut operation = self
.client
.operation(&routes::GET_WORKFLOW_STAGE, &[&workflow_id, &stage_id]);
operation.resource_id(stage_id);
self.client.send_text(operation).await
}
pub async fn move_staging(
&self,
topic_id: i64,
workflow_id: i64,
body: &MoveWorkflowStagingRequestContent,
) -> Result<(), Error> {
let mut operation = self
.client
.operation(&routes::MOVE_WORKFLOW_STAGING, &[&topic_id, &workflow_id]);
operation.resource_id(topic_id);
operation.json(body)?;
self.client.send_unit(operation).await
}
}