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
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
// @generated by xtask/generate_services.py — do not edit by hand.
//! `workflows` — typed methods for all 1 API v3 operations
//! in this module.
//!
//! Access via [`Ghl::v3`](crate::Ghl::v3)`().workflows()`. These endpoints send `Version: v3`.
//!
//! Request and response types come from [`ghl_models::v3::workflows`](https://docs.rs/ghl-models/latest/ghl_models/v3/workflows/); every endpoint is also documented in the
//! [`workflows` API reference](https://github.com/Shahroz/ghl-rs/blob/main/docs/api/workflows.md).
//!
//! Enable with `features = ["workflows"]`.
#![allow(clippy::too_many_arguments)]
use crate::client::Ghl;
use crate::error::Result;
use ghl_models::v3::workflows as models;
/// Typed access to the `workflows` API v3 surface (1 operations). Obtained via
/// [`Ghl::v3`](crate::Ghl::v3)`().workflows()`.
#[derive(Debug, Clone)]
pub struct WorkflowsService {
pub(crate) client: Ghl,
}
impl WorkflowsService {
pub(crate) fn new(client: Ghl) -> Self {
Self { client }
}
}
/// Query parameters for [`WorkflowsService::get_workflow`].
#[derive(Debug, Clone, Default)]
pub struct GetWorkflowParams {
/// `locationId` query parameter.
/// Required by the API.
pub location_id: String,
}
impl GetWorkflowParams {
/// Start from the parameters the API requires.
pub fn new(location_id: impl Into<String>) -> Self {
Self {
location_id: location_id.into(),
}
}
fn to_query(&self) -> Vec<(String, String)> {
let q: Vec<(String, String)> = vec![("locationId".into(), self.location_id.clone())];
q
}
}
impl WorkflowsService {
/// Get Workflow
///
/// `GET /workflows/`
///
/// Requires scope: `workflows.readonly`.
pub async fn get_workflow(
&self,
params: &GetWorkflowParams,
) -> Result<models::GetWorkflowSuccessfulResponseDto> {
let query = params.to_query();
self.client
.send_versioned(
reqwest::Method::GET,
"/workflows/",
&query,
None::<&()>,
Some("v3"),
)
.await
}
}