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
/*
 * 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 EngineApiClient {
    configuration: Rc<configuration::Configuration>,
}

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

pub trait EngineApi {
    fn get_process_engine_names(&self, ) -> Result<Vec<crate::models::ProcessEngineDto>, Error>;
}

impl EngineApi for EngineApiClient {
    fn get_process_engine_names(&self, ) -> Result<Vec<crate::models::ProcessEngineDto>, Error> {
        let configuration: &configuration::Configuration = self.configuration.borrow();
        let client = &configuration.client;

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

        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()?)
    }

}