hey_sdk/generated/services/
workflows.rs1#![allow(missing_docs, unreachable_pub, clippy::all, clippy::pedantic)]
4
5use crate::client::Client;
6use crate::error::Error;
7use crate::generated::routes;
8use crate::generated::types::*;
9
10pub struct Workflows<'a> {
11 client: &'a Client,
12}
13
14impl<'a> Workflows<'a> {
15 pub(crate) fn new(client: &'a Client) -> Self {
16 Self { client }
17 }
18
19 pub fn client(&self) -> &'a Client {
21 self.client
22 }
23
24 pub async fn create_staging(&self, topic_id: i64, workflow_id: i64) -> Result<(), Error> {
26 let mut operation = self
27 .client
28 .operation(&routes::CREATE_WORKFLOW_STAGING, &[&topic_id, &workflow_id]);
29 operation.resource_id(topic_id);
30 self.client.send_unit(operation).await
31 }
32
33 pub async fn get(&self, workflow_id: i64) -> Result<GetWorkflowResponseContent, Error> {
35 let mut operation = self
36 .client
37 .operation(&routes::GET_WORKFLOW, &[&workflow_id]);
38 operation.resource_id(workflow_id);
39 self.client.send(operation).await
40 }
41
42 pub async fn get_stage(
44 &self,
45 workflow_id: i64,
46 stage_id: i64,
47 ) -> Result<GetWorkflowStageOutputPayload, Error> {
48 let mut operation = self
49 .client
50 .operation(&routes::GET_WORKFLOW_STAGE, &[&workflow_id, &stage_id]);
51 operation.resource_id(stage_id);
52 self.client.send_text(operation).await
53 }
54
55 pub async fn move_staging(
57 &self,
58 topic_id: i64,
59 workflow_id: i64,
60 body: &MoveWorkflowStagingRequestContent,
61 ) -> Result<(), Error> {
62 let mut operation = self
63 .client
64 .operation(&routes::MOVE_WORKFLOW_STAGING, &[&topic_id, &workflow_id]);
65 operation.resource_id(topic_id);
66 operation.json(body)?;
67 self.client.send_unit(operation).await
68 }
69}