argo_workflows_rs/apis/
info_service_api.rs

1/*
2 * Argo Workflows API
3 *
4 * Argo Workflows is an open source container-native workflow engine for orchestrating parallel jobs on Kubernetes. For more information, please see https://argoproj.github.io/argo-workflows/
5 *
6 * The version of the OpenAPI document: VERSION
7 * 
8 * Generated by: https://openapi-generator.tech
9 */
10
11
12use reqwest;
13
14use crate::apis::ResponseContent;
15use super::{Error, configuration};
16
17
18/// struct for typed errors of method [`info_service_collect_event`]
19#[derive(Debug, Clone, Serialize, Deserialize)]
20#[serde(untagged)]
21pub enum InfoServiceCollectEventError {
22    DefaultResponse(crate::models::GrpcPeriodGatewayPeriodRuntimePeriodError),
23    UnknownValue(serde_json::Value),
24}
25
26/// struct for typed errors of method [`info_service_get_info`]
27#[derive(Debug, Clone, Serialize, Deserialize)]
28#[serde(untagged)]
29pub enum InfoServiceGetInfoError {
30    DefaultResponse(crate::models::GrpcPeriodGatewayPeriodRuntimePeriodError),
31    UnknownValue(serde_json::Value),
32}
33
34/// struct for typed errors of method [`info_service_get_user_info`]
35#[derive(Debug, Clone, Serialize, Deserialize)]
36#[serde(untagged)]
37pub enum InfoServiceGetUserInfoError {
38    DefaultResponse(crate::models::GrpcPeriodGatewayPeriodRuntimePeriodError),
39    UnknownValue(serde_json::Value),
40}
41
42/// struct for typed errors of method [`info_service_get_version`]
43#[derive(Debug, Clone, Serialize, Deserialize)]
44#[serde(untagged)]
45pub enum InfoServiceGetVersionError {
46    DefaultResponse(crate::models::GrpcPeriodGatewayPeriodRuntimePeriodError),
47    UnknownValue(serde_json::Value),
48}
49
50
51pub async fn info_service_collect_event(configuration: &configuration::Configuration, body: crate::models::IoPeriodArgoprojPeriodWorkflowPeriodV1alpha1PeriodCollectEventRequest) -> Result<serde_json::Value, Error<InfoServiceCollectEventError>> {
52    let local_var_configuration = configuration;
53
54    let local_var_client = &local_var_configuration.client;
55
56    let local_var_uri_str = format!("{}/api/v1/tracking/event", local_var_configuration.base_path);
57    let mut local_var_req_builder = local_var_client.request(reqwest::Method::POST, local_var_uri_str.as_str());
58
59    if let Some(ref local_var_user_agent) = local_var_configuration.user_agent {
60        local_var_req_builder = local_var_req_builder.header(reqwest::header::USER_AGENT, local_var_user_agent.clone());
61    }
62    if let Some(ref local_var_apikey) = local_var_configuration.api_key {
63        let local_var_key = local_var_apikey.key.clone();
64        let local_var_value = match local_var_apikey.prefix {
65            Some(ref local_var_prefix) => format!("{} {}", local_var_prefix, local_var_key),
66            None => local_var_key,
67        };
68        local_var_req_builder = local_var_req_builder.header("Authorization", local_var_value);
69    };
70    local_var_req_builder = local_var_req_builder.json(&body);
71
72    let local_var_req = local_var_req_builder.build()?;
73    let local_var_resp = local_var_client.execute(local_var_req).await?;
74
75    let local_var_status = local_var_resp.status();
76    let local_var_content = local_var_resp.text().await?;
77
78    if !local_var_status.is_client_error() && !local_var_status.is_server_error() {
79        serde_json::from_str(&local_var_content).map_err(Error::from)
80    } else {
81        let local_var_entity: Option<InfoServiceCollectEventError> = serde_json::from_str(&local_var_content).ok();
82        let local_var_error = ResponseContent { status: local_var_status, content: local_var_content, entity: local_var_entity };
83        Err(Error::ResponseError(local_var_error))
84    }
85}
86
87pub async fn info_service_get_info(configuration: &configuration::Configuration, ) -> Result<crate::models::IoPeriodArgoprojPeriodWorkflowPeriodV1alpha1PeriodInfoResponse, Error<InfoServiceGetInfoError>> {
88    let local_var_configuration = configuration;
89
90    let local_var_client = &local_var_configuration.client;
91
92    let local_var_uri_str = format!("{}/api/v1/info", local_var_configuration.base_path);
93    let mut local_var_req_builder = local_var_client.request(reqwest::Method::GET, local_var_uri_str.as_str());
94
95    if let Some(ref local_var_user_agent) = local_var_configuration.user_agent {
96        local_var_req_builder = local_var_req_builder.header(reqwest::header::USER_AGENT, local_var_user_agent.clone());
97    }
98    if let Some(ref local_var_apikey) = local_var_configuration.api_key {
99        let local_var_key = local_var_apikey.key.clone();
100        let local_var_value = match local_var_apikey.prefix {
101            Some(ref local_var_prefix) => format!("{} {}", local_var_prefix, local_var_key),
102            None => local_var_key,
103        };
104        local_var_req_builder = local_var_req_builder.header("Authorization", local_var_value);
105    };
106
107    let local_var_req = local_var_req_builder.build()?;
108    let local_var_resp = local_var_client.execute(local_var_req).await?;
109
110    let local_var_status = local_var_resp.status();
111    let local_var_content = local_var_resp.text().await?;
112
113    if !local_var_status.is_client_error() && !local_var_status.is_server_error() {
114        serde_json::from_str(&local_var_content).map_err(Error::from)
115    } else {
116        let local_var_entity: Option<InfoServiceGetInfoError> = serde_json::from_str(&local_var_content).ok();
117        let local_var_error = ResponseContent { status: local_var_status, content: local_var_content, entity: local_var_entity };
118        Err(Error::ResponseError(local_var_error))
119    }
120}
121
122pub async fn info_service_get_user_info(configuration: &configuration::Configuration, ) -> Result<crate::models::IoPeriodArgoprojPeriodWorkflowPeriodV1alpha1PeriodGetUserInfoResponse, Error<InfoServiceGetUserInfoError>> {
123    let local_var_configuration = configuration;
124
125    let local_var_client = &local_var_configuration.client;
126
127    let local_var_uri_str = format!("{}/api/v1/userinfo", local_var_configuration.base_path);
128    let mut local_var_req_builder = local_var_client.request(reqwest::Method::GET, local_var_uri_str.as_str());
129
130    if let Some(ref local_var_user_agent) = local_var_configuration.user_agent {
131        local_var_req_builder = local_var_req_builder.header(reqwest::header::USER_AGENT, local_var_user_agent.clone());
132    }
133    if let Some(ref local_var_apikey) = local_var_configuration.api_key {
134        let local_var_key = local_var_apikey.key.clone();
135        let local_var_value = match local_var_apikey.prefix {
136            Some(ref local_var_prefix) => format!("{} {}", local_var_prefix, local_var_key),
137            None => local_var_key,
138        };
139        local_var_req_builder = local_var_req_builder.header("Authorization", local_var_value);
140    };
141
142    let local_var_req = local_var_req_builder.build()?;
143    let local_var_resp = local_var_client.execute(local_var_req).await?;
144
145    let local_var_status = local_var_resp.status();
146    let local_var_content = local_var_resp.text().await?;
147
148    if !local_var_status.is_client_error() && !local_var_status.is_server_error() {
149        serde_json::from_str(&local_var_content).map_err(Error::from)
150    } else {
151        let local_var_entity: Option<InfoServiceGetUserInfoError> = serde_json::from_str(&local_var_content).ok();
152        let local_var_error = ResponseContent { status: local_var_status, content: local_var_content, entity: local_var_entity };
153        Err(Error::ResponseError(local_var_error))
154    }
155}
156
157pub async fn info_service_get_version(configuration: &configuration::Configuration, ) -> Result<crate::models::IoPeriodArgoprojPeriodWorkflowPeriodV1alpha1PeriodVersion, Error<InfoServiceGetVersionError>> {
158    let local_var_configuration = configuration;
159
160    let local_var_client = &local_var_configuration.client;
161
162    let local_var_uri_str = format!("{}/api/v1/version", local_var_configuration.base_path);
163    let mut local_var_req_builder = local_var_client.request(reqwest::Method::GET, local_var_uri_str.as_str());
164
165    if let Some(ref local_var_user_agent) = local_var_configuration.user_agent {
166        local_var_req_builder = local_var_req_builder.header(reqwest::header::USER_AGENT, local_var_user_agent.clone());
167    }
168    if let Some(ref local_var_apikey) = local_var_configuration.api_key {
169        let local_var_key = local_var_apikey.key.clone();
170        let local_var_value = match local_var_apikey.prefix {
171            Some(ref local_var_prefix) => format!("{} {}", local_var_prefix, local_var_key),
172            None => local_var_key,
173        };
174        local_var_req_builder = local_var_req_builder.header("Authorization", local_var_value);
175    };
176
177    let local_var_req = local_var_req_builder.build()?;
178    let local_var_resp = local_var_client.execute(local_var_req).await?;
179
180    let local_var_status = local_var_resp.status();
181    let local_var_content = local_var_resp.text().await?;
182
183    if !local_var_status.is_client_error() && !local_var_status.is_server_error() {
184        serde_json::from_str(&local_var_content).map_err(Error::from)
185    } else {
186        let local_var_entity: Option<InfoServiceGetVersionError> = serde_json::from_str(&local_var_content).ok();
187        let local_var_error = ResponseContent { status: local_var_status, content: local_var_content, entity: local_var_entity };
188        Err(Error::ResponseError(local_var_error))
189    }
190}
191