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

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

pub trait SchemaLogApi {
    fn get_schema_log(&self, version: Option<&str>, first_result: Option<i32>, max_results: Option<i32>) -> Result<Vec<crate::models::SchemaLogEntryDto>, Error>;
    fn query_schema_log(&self, first_result: Option<i32>, max_results: Option<i32>, schema_log_query_dto: Option<crate::models::SchemaLogQueryDto>) -> Result<Vec<crate::models::SchemaLogEntryDto>, Error>;
}

impl SchemaLogApi for SchemaLogApiClient {
    fn get_schema_log(&self, version: Option<&str>, first_result: Option<i32>, max_results: Option<i32>) -> Result<Vec<crate::models::SchemaLogEntryDto>, Error> {
        let configuration: &configuration::Configuration = self.configuration.borrow();
        let client = &configuration.client;

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

        if let Some(ref s) = version {
            req_builder = req_builder.query(&[("version", &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 query_schema_log(&self, first_result: Option<i32>, max_results: Option<i32>, schema_log_query_dto: Option<crate::models::SchemaLogQueryDto>) -> Result<Vec<crate::models::SchemaLogEntryDto>, Error> {
        let configuration: &configuration::Configuration = self.configuration.borrow();
        let client = &configuration.client;

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

        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());
        }
        req_builder = req_builder.json(&schema_log_query_dto);

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

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

}