1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
use serde_json::json;
use crate::model::*;
use crate::BenchlingClient;
pub struct CreateWorkflowTaskGroupRequest<'a> {
pub(crate) client: &'a BenchlingClient,
pub folder_id: String,
pub name: String,
pub watcher_ids: Vec<String>,
pub schema_id: String,
}
impl<'a> CreateWorkflowTaskGroupRequest<'a> {
pub async fn send(self) -> anyhow::Result<WorkflowTaskGroup> {
let mut r = self.client.client.post("/workflow-task-groups");
r = r.push_json(json!({ "folderId" : self.folder_id }));
r = r.push_json(json!({ "name" : self.name }));
r = r.push_json(json!({ "watcherIds" : self.watcher_ids }));
r = r.push_json(json!({ "schemaId" : self.schema_id }));
r = self.client.authenticate(r);
let res = r.send().await.unwrap().error_for_status();
match res {
Ok(res) => res.json().await.map_err(|e| anyhow::anyhow!("{:?}", e)),
Err(res) => {
let text = res.text().await.map_err(|e| anyhow::anyhow!("{:?}", e))?;
Err(anyhow::anyhow!("{:?}", text))
}
}
}
}
pub struct CreateWorkflowTaskGroupRequired<'a> {
pub folder_id: &'a str,
pub name: &'a str,
pub watcher_ids: &'a [&'a str],
pub schema_id: &'a str,
}
impl<'a> CreateWorkflowTaskGroupRequired<'a> {}