camunda_client/apis/
event_subscription_api.rs

1/*
2 * Camunda BPM REST API
3 *
4 * OpenApi Spec for Camunda BPM REST API.
5 *
6 * The version of the OpenAPI document: 7.13.0
7 * 
8 * Generated by: https://openapi-generator.tech
9 */
10
11use std::rc::Rc;
12use std::borrow::Borrow;
13#[allow(unused_imports)]
14use std::option::Option;
15
16use reqwest;
17
18use super::{Error, configuration};
19
20pub struct EventSubscriptionApiClient {
21    configuration: Rc<configuration::Configuration>,
22}
23
24impl EventSubscriptionApiClient {
25    pub fn new(configuration: Rc<configuration::Configuration>) -> EventSubscriptionApiClient {
26        EventSubscriptionApiClient {
27            configuration,
28        }
29    }
30}
31
32pub trait EventSubscriptionApi {
33    fn get_event_subscriptions(&self, event_subscription_id: Option<&str>, event_name: Option<&str>, event_type: Option<&str>, execution_id: Option<&str>, process_instance_id: Option<&str>, activity_id: Option<&str>, tenant_id_in: Option<&str>, without_tenant_id: Option<bool>, include_event_subscriptions_without_tenant_id: Option<bool>, sort_by: Option<&str>, sort_order: Option<&str>, first_result: Option<i32>, max_results: Option<i32>) -> Result<Vec<crate::models::EventSubscriptionDto>, Error>;
34    fn get_event_subscriptions_count(&self, event_subscription_id: Option<&str>, event_name: Option<&str>, event_type: Option<&str>, execution_id: Option<&str>, process_instance_id: Option<&str>, activity_id: Option<&str>, tenant_id_in: Option<&str>, without_tenant_id: Option<bool>, include_event_subscriptions_without_tenant_id: Option<bool>) -> Result<crate::models::CountResultDto, Error>;
35}
36
37impl EventSubscriptionApi for EventSubscriptionApiClient {
38    fn get_event_subscriptions(&self, event_subscription_id: Option<&str>, event_name: Option<&str>, event_type: Option<&str>, execution_id: Option<&str>, process_instance_id: Option<&str>, activity_id: Option<&str>, tenant_id_in: Option<&str>, without_tenant_id: Option<bool>, include_event_subscriptions_without_tenant_id: Option<bool>, sort_by: Option<&str>, sort_order: Option<&str>, first_result: Option<i32>, max_results: Option<i32>) -> Result<Vec<crate::models::EventSubscriptionDto>, Error> {
39        let configuration: &configuration::Configuration = self.configuration.borrow();
40        let client = &configuration.client;
41
42        let uri_str = format!("{}/event-subscription", configuration.base_path);
43        let mut req_builder = client.get(uri_str.as_str());
44
45        if let Some(ref s) = event_subscription_id {
46            req_builder = req_builder.query(&[("eventSubscriptionId", &s.to_string())]);
47        }
48        if let Some(ref s) = event_name {
49            req_builder = req_builder.query(&[("eventName", &s.to_string())]);
50        }
51        if let Some(ref s) = event_type {
52            req_builder = req_builder.query(&[("eventType", &s.to_string())]);
53        }
54        if let Some(ref s) = execution_id {
55            req_builder = req_builder.query(&[("executionId", &s.to_string())]);
56        }
57        if let Some(ref s) = process_instance_id {
58            req_builder = req_builder.query(&[("processInstanceId", &s.to_string())]);
59        }
60        if let Some(ref s) = activity_id {
61            req_builder = req_builder.query(&[("activityId", &s.to_string())]);
62        }
63        if let Some(ref s) = tenant_id_in {
64            req_builder = req_builder.query(&[("tenantIdIn", &s.to_string())]);
65        }
66        if let Some(ref s) = without_tenant_id {
67            req_builder = req_builder.query(&[("withoutTenantId", &s.to_string())]);
68        }
69        if let Some(ref s) = include_event_subscriptions_without_tenant_id {
70            req_builder = req_builder.query(&[("includeEventSubscriptionsWithoutTenantId", &s.to_string())]);
71        }
72        if let Some(ref s) = sort_by {
73            req_builder = req_builder.query(&[("sortBy", &s.to_string())]);
74        }
75        if let Some(ref s) = sort_order {
76            req_builder = req_builder.query(&[("sortOrder", &s.to_string())]);
77        }
78        if let Some(ref s) = first_result {
79            req_builder = req_builder.query(&[("firstResult", &s.to_string())]);
80        }
81        if let Some(ref s) = max_results {
82            req_builder = req_builder.query(&[("maxResults", &s.to_string())]);
83        }
84        if let Some(ref user_agent) = configuration.user_agent {
85            req_builder = req_builder.header(reqwest::header::USER_AGENT, user_agent.clone());
86        }
87
88        // send request
89        let req = req_builder.build()?;
90
91        Ok(client.execute(req)?.error_for_status()?.json()?)
92    }
93
94    fn get_event_subscriptions_count(&self, event_subscription_id: Option<&str>, event_name: Option<&str>, event_type: Option<&str>, execution_id: Option<&str>, process_instance_id: Option<&str>, activity_id: Option<&str>, tenant_id_in: Option<&str>, without_tenant_id: Option<bool>, include_event_subscriptions_without_tenant_id: Option<bool>) -> Result<crate::models::CountResultDto, Error> {
95        let configuration: &configuration::Configuration = self.configuration.borrow();
96        let client = &configuration.client;
97
98        let uri_str = format!("{}/event-subscription/count", configuration.base_path);
99        let mut req_builder = client.get(uri_str.as_str());
100
101        if let Some(ref s) = event_subscription_id {
102            req_builder = req_builder.query(&[("eventSubscriptionId", &s.to_string())]);
103        }
104        if let Some(ref s) = event_name {
105            req_builder = req_builder.query(&[("eventName", &s.to_string())]);
106        }
107        if let Some(ref s) = event_type {
108            req_builder = req_builder.query(&[("eventType", &s.to_string())]);
109        }
110        if let Some(ref s) = execution_id {
111            req_builder = req_builder.query(&[("executionId", &s.to_string())]);
112        }
113        if let Some(ref s) = process_instance_id {
114            req_builder = req_builder.query(&[("processInstanceId", &s.to_string())]);
115        }
116        if let Some(ref s) = activity_id {
117            req_builder = req_builder.query(&[("activityId", &s.to_string())]);
118        }
119        if let Some(ref s) = tenant_id_in {
120            req_builder = req_builder.query(&[("tenantIdIn", &s.to_string())]);
121        }
122        if let Some(ref s) = without_tenant_id {
123            req_builder = req_builder.query(&[("withoutTenantId", &s.to_string())]);
124        }
125        if let Some(ref s) = include_event_subscriptions_without_tenant_id {
126            req_builder = req_builder.query(&[("includeEventSubscriptionsWithoutTenantId", &s.to_string())]);
127        }
128        if let Some(ref user_agent) = configuration.user_agent {
129            req_builder = req_builder.header(reqwest::header::USER_AGENT, user_agent.clone());
130        }
131
132        // send request
133        let req = req_builder.build()?;
134
135        Ok(client.execute(req)?.error_for_status()?.json()?)
136    }
137
138}