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
 75
 76
 77
 78
 79
 80
 81
 82
 83
 84
 85
 86
 87
 88
 89
 90
 91
 92
 93
 94
 95
 96
 97
 98
 99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
/*
 * Camunda BPM REST API
 *
 * OpenApi Spec for Camunda BPM REST API.
 *
 * The version of the OpenAPI document: 7.13.0
 * 
 * Generated by: https://openapi-generator.tech
 */

use std::rc::Rc;
use std::borrow::Borrow;
#[allow(unused_imports)]
use std::option::Option;

use reqwest;

use super::{Error, configuration};

pub struct EventSubscriptionApiClient {
    configuration: Rc<configuration::Configuration>,
}

impl EventSubscriptionApiClient {
    pub fn new(configuration: Rc<configuration::Configuration>) -> EventSubscriptionApiClient {
        EventSubscriptionApiClient {
            configuration,
        }
    }
}

pub trait EventSubscriptionApi {
    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>;
    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>;
}

impl EventSubscriptionApi for EventSubscriptionApiClient {
    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> {
        let configuration: &configuration::Configuration = self.configuration.borrow();
        let client = &configuration.client;

        let uri_str = format!("{}/event-subscription", configuration.base_path);
        let mut req_builder = client.get(uri_str.as_str());

        if let Some(ref s) = event_subscription_id {
            req_builder = req_builder.query(&[("eventSubscriptionId", &s.to_string())]);
        }
        if let Some(ref s) = event_name {
            req_builder = req_builder.query(&[("eventName", &s.to_string())]);
        }
        if let Some(ref s) = event_type {
            req_builder = req_builder.query(&[("eventType", &s.to_string())]);
        }
        if let Some(ref s) = execution_id {
            req_builder = req_builder.query(&[("executionId", &s.to_string())]);
        }
        if let Some(ref s) = process_instance_id {
            req_builder = req_builder.query(&[("processInstanceId", &s.to_string())]);
        }
        if let Some(ref s) = activity_id {
            req_builder = req_builder.query(&[("activityId", &s.to_string())]);
        }
        if let Some(ref s) = tenant_id_in {
            req_builder = req_builder.query(&[("tenantIdIn", &s.to_string())]);
        }
        if let Some(ref s) = without_tenant_id {
            req_builder = req_builder.query(&[("withoutTenantId", &s.to_string())]);
        }
        if let Some(ref s) = include_event_subscriptions_without_tenant_id {
            req_builder = req_builder.query(&[("includeEventSubscriptionsWithoutTenantId", &s.to_string())]);
        }
        if let Some(ref s) = sort_by {
            req_builder = req_builder.query(&[("sortBy", &s.to_string())]);
        }
        if let Some(ref s) = sort_order {
            req_builder = req_builder.query(&[("sortOrder", &s.to_string())]);
        }
        if let Some(ref s) = first_result {
            req_builder = req_builder.query(&[("firstResult", &s.to_string())]);
        }
        if let Some(ref s) = max_results {
            req_builder = req_builder.query(&[("maxResults", &s.to_string())]);
        }
        if let Some(ref user_agent) = configuration.user_agent {
            req_builder = req_builder.header(reqwest::header::USER_AGENT, user_agent.clone());
        }

        // send request
        let req = req_builder.build()?;

        Ok(client.execute(req)?.error_for_status()?.json()?)
    }

    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> {
        let configuration: &configuration::Configuration = self.configuration.borrow();
        let client = &configuration.client;

        let uri_str = format!("{}/event-subscription/count", configuration.base_path);
        let mut req_builder = client.get(uri_str.as_str());

        if let Some(ref s) = event_subscription_id {
            req_builder = req_builder.query(&[("eventSubscriptionId", &s.to_string())]);
        }
        if let Some(ref s) = event_name {
            req_builder = req_builder.query(&[("eventName", &s.to_string())]);
        }
        if let Some(ref s) = event_type {
            req_builder = req_builder.query(&[("eventType", &s.to_string())]);
        }
        if let Some(ref s) = execution_id {
            req_builder = req_builder.query(&[("executionId", &s.to_string())]);
        }
        if let Some(ref s) = process_instance_id {
            req_builder = req_builder.query(&[("processInstanceId", &s.to_string())]);
        }
        if let Some(ref s) = activity_id {
            req_builder = req_builder.query(&[("activityId", &s.to_string())]);
        }
        if let Some(ref s) = tenant_id_in {
            req_builder = req_builder.query(&[("tenantIdIn", &s.to_string())]);
        }
        if let Some(ref s) = without_tenant_id {
            req_builder = req_builder.query(&[("withoutTenantId", &s.to_string())]);
        }
        if let Some(ref s) = include_event_subscriptions_without_tenant_id {
            req_builder = req_builder.query(&[("includeEventSubscriptionsWithoutTenantId", &s.to_string())]);
        }
        if let Some(ref user_agent) = configuration.user_agent {
            req_builder = req_builder.header(reqwest::header::USER_AGENT, user_agent.clone());
        }

        // send request
        let req = req_builder.build()?;

        Ok(client.execute(req)?.error_for_status()?.json()?)
    }

}