1use reqwest;
13use serde::{Deserialize, Serialize};
14use crate::{apis::ResponseContent, models};
15use super::{Error, configuration};
16
17
18#[derive(Debug, Clone, Serialize, Deserialize)]
20#[serde(untagged)]
21pub enum ApiV3ImportlistexclusionGetError {
22 UnknownValue(serde_json::Value),
23}
24
25#[derive(Debug, Clone, Serialize, Deserialize)]
27#[serde(untagged)]
28pub enum ApiV3ImportlistexclusionIdDeleteError {
29 UnknownValue(serde_json::Value),
30}
31
32#[derive(Debug, Clone, Serialize, Deserialize)]
34#[serde(untagged)]
35pub enum ApiV3ImportlistexclusionIdGetError {
36 UnknownValue(serde_json::Value),
37}
38
39#[derive(Debug, Clone, Serialize, Deserialize)]
41#[serde(untagged)]
42pub enum ApiV3ImportlistexclusionIdPutError {
43 UnknownValue(serde_json::Value),
44}
45
46#[derive(Debug, Clone, Serialize, Deserialize)]
48#[serde(untagged)]
49pub enum ApiV3ImportlistexclusionPagedGetError {
50 UnknownValue(serde_json::Value),
51}
52
53#[derive(Debug, Clone, Serialize, Deserialize)]
55#[serde(untagged)]
56pub enum ApiV3ImportlistexclusionPostError {
57 UnknownValue(serde_json::Value),
58}
59
60
61pub async fn api_v3_importlistexclusion_get(configuration: &configuration::Configuration, ) -> Result<Vec<models::ImportListExclusionResource>, Error<ApiV3ImportlistexclusionGetError>> {
62 let local_var_configuration = configuration;
63
64 let local_var_client = &local_var_configuration.client;
65
66 let local_var_uri_str = format!("{}/api/v3/importlistexclusion", local_var_configuration.base_path);
67 let mut local_var_req_builder = local_var_client.request(reqwest::Method::GET, local_var_uri_str.as_str());
68
69 if let Some(ref local_var_apikey) = local_var_configuration.api_key {
70 let local_var_key = local_var_apikey.key.clone();
71 let local_var_value = match local_var_apikey.prefix {
72 Some(ref local_var_prefix) => format!("{} {}", local_var_prefix, local_var_key),
73 None => local_var_key,
74 };
75 local_var_req_builder = local_var_req_builder.query(&[("apikey", local_var_value)]);
76 }
77 if let Some(ref local_var_user_agent) = local_var_configuration.user_agent {
78 local_var_req_builder = local_var_req_builder.header(reqwest::header::USER_AGENT, local_var_user_agent.clone());
79 }
80 if let Some(ref local_var_apikey) = local_var_configuration.api_key {
81 let local_var_key = local_var_apikey.key.clone();
82 let local_var_value = match local_var_apikey.prefix {
83 Some(ref local_var_prefix) => format!("{} {}", local_var_prefix, local_var_key),
84 None => local_var_key,
85 };
86 local_var_req_builder = local_var_req_builder.header("X-Api-Key", local_var_value);
87 };
88
89 let local_var_req = local_var_req_builder.build()?;
90 let local_var_resp = local_var_client.execute(local_var_req).await?;
91
92 let local_var_status = local_var_resp.status();
93 let local_var_content = local_var_resp.text().await?;
94
95 if !local_var_status.is_client_error() && !local_var_status.is_server_error() {
96 serde_json::from_str(&local_var_content).map_err(Error::from)
97 } else {
98 let local_var_entity: Option<ApiV3ImportlistexclusionGetError> = serde_json::from_str(&local_var_content).ok();
99 let local_var_error = ResponseContent { status: local_var_status, content: local_var_content, entity: local_var_entity };
100 Err(Error::ResponseError(local_var_error))
101 }
102}
103
104pub async fn api_v3_importlistexclusion_id_delete(configuration: &configuration::Configuration, id: i32) -> Result<(), Error<ApiV3ImportlistexclusionIdDeleteError>> {
105 let local_var_configuration = configuration;
106
107 let local_var_client = &local_var_configuration.client;
108
109 let local_var_uri_str = format!("{}/api/v3/importlistexclusion/{id}", local_var_configuration.base_path, id=id);
110 let mut local_var_req_builder = local_var_client.request(reqwest::Method::DELETE, local_var_uri_str.as_str());
111
112 if let Some(ref local_var_apikey) = local_var_configuration.api_key {
113 let local_var_key = local_var_apikey.key.clone();
114 let local_var_value = match local_var_apikey.prefix {
115 Some(ref local_var_prefix) => format!("{} {}", local_var_prefix, local_var_key),
116 None => local_var_key,
117 };
118 local_var_req_builder = local_var_req_builder.query(&[("apikey", local_var_value)]);
119 }
120 if let Some(ref local_var_user_agent) = local_var_configuration.user_agent {
121 local_var_req_builder = local_var_req_builder.header(reqwest::header::USER_AGENT, local_var_user_agent.clone());
122 }
123 if let Some(ref local_var_apikey) = local_var_configuration.api_key {
124 let local_var_key = local_var_apikey.key.clone();
125 let local_var_value = match local_var_apikey.prefix {
126 Some(ref local_var_prefix) => format!("{} {}", local_var_prefix, local_var_key),
127 None => local_var_key,
128 };
129 local_var_req_builder = local_var_req_builder.header("X-Api-Key", local_var_value);
130 };
131
132 let local_var_req = local_var_req_builder.build()?;
133 let local_var_resp = local_var_client.execute(local_var_req).await?;
134
135 let local_var_status = local_var_resp.status();
136 let local_var_content = local_var_resp.text().await?;
137
138 if !local_var_status.is_client_error() && !local_var_status.is_server_error() {
139 Ok(())
140 } else {
141 let local_var_entity: Option<ApiV3ImportlistexclusionIdDeleteError> = serde_json::from_str(&local_var_content).ok();
142 let local_var_error = ResponseContent { status: local_var_status, content: local_var_content, entity: local_var_entity };
143 Err(Error::ResponseError(local_var_error))
144 }
145}
146
147pub async fn api_v3_importlistexclusion_id_get(configuration: &configuration::Configuration, id: i32) -> Result<models::ImportListExclusionResource, Error<ApiV3ImportlistexclusionIdGetError>> {
148 let local_var_configuration = configuration;
149
150 let local_var_client = &local_var_configuration.client;
151
152 let local_var_uri_str = format!("{}/api/v3/importlistexclusion/{id}", local_var_configuration.base_path, id=id);
153 let mut local_var_req_builder = local_var_client.request(reqwest::Method::GET, local_var_uri_str.as_str());
154
155 if let Some(ref local_var_apikey) = local_var_configuration.api_key {
156 let local_var_key = local_var_apikey.key.clone();
157 let local_var_value = match local_var_apikey.prefix {
158 Some(ref local_var_prefix) => format!("{} {}", local_var_prefix, local_var_key),
159 None => local_var_key,
160 };
161 local_var_req_builder = local_var_req_builder.query(&[("apikey", local_var_value)]);
162 }
163 if let Some(ref local_var_user_agent) = local_var_configuration.user_agent {
164 local_var_req_builder = local_var_req_builder.header(reqwest::header::USER_AGENT, local_var_user_agent.clone());
165 }
166 if let Some(ref local_var_apikey) = local_var_configuration.api_key {
167 let local_var_key = local_var_apikey.key.clone();
168 let local_var_value = match local_var_apikey.prefix {
169 Some(ref local_var_prefix) => format!("{} {}", local_var_prefix, local_var_key),
170 None => local_var_key,
171 };
172 local_var_req_builder = local_var_req_builder.header("X-Api-Key", local_var_value);
173 };
174
175 let local_var_req = local_var_req_builder.build()?;
176 let local_var_resp = local_var_client.execute(local_var_req).await?;
177
178 let local_var_status = local_var_resp.status();
179 let local_var_content = local_var_resp.text().await?;
180
181 if !local_var_status.is_client_error() && !local_var_status.is_server_error() {
182 serde_json::from_str(&local_var_content).map_err(Error::from)
183 } else {
184 let local_var_entity: Option<ApiV3ImportlistexclusionIdGetError> = serde_json::from_str(&local_var_content).ok();
185 let local_var_error = ResponseContent { status: local_var_status, content: local_var_content, entity: local_var_entity };
186 Err(Error::ResponseError(local_var_error))
187 }
188}
189
190pub async fn api_v3_importlistexclusion_id_put(configuration: &configuration::Configuration, id: &str, import_list_exclusion_resource: Option<models::ImportListExclusionResource>) -> Result<models::ImportListExclusionResource, Error<ApiV3ImportlistexclusionIdPutError>> {
191 let local_var_configuration = configuration;
192
193 let local_var_client = &local_var_configuration.client;
194
195 let local_var_uri_str = format!("{}/api/v3/importlistexclusion/{id}", local_var_configuration.base_path, id=crate::apis::urlencode(id));
196 let mut local_var_req_builder = local_var_client.request(reqwest::Method::PUT, local_var_uri_str.as_str());
197
198 if let Some(ref local_var_apikey) = local_var_configuration.api_key {
199 let local_var_key = local_var_apikey.key.clone();
200 let local_var_value = match local_var_apikey.prefix {
201 Some(ref local_var_prefix) => format!("{} {}", local_var_prefix, local_var_key),
202 None => local_var_key,
203 };
204 local_var_req_builder = local_var_req_builder.query(&[("apikey", local_var_value)]);
205 }
206 if let Some(ref local_var_user_agent) = local_var_configuration.user_agent {
207 local_var_req_builder = local_var_req_builder.header(reqwest::header::USER_AGENT, local_var_user_agent.clone());
208 }
209 if let Some(ref local_var_apikey) = local_var_configuration.api_key {
210 let local_var_key = local_var_apikey.key.clone();
211 let local_var_value = match local_var_apikey.prefix {
212 Some(ref local_var_prefix) => format!("{} {}", local_var_prefix, local_var_key),
213 None => local_var_key,
214 };
215 local_var_req_builder = local_var_req_builder.header("X-Api-Key", local_var_value);
216 };
217 local_var_req_builder = local_var_req_builder.json(&import_list_exclusion_resource);
218
219 let local_var_req = local_var_req_builder.build()?;
220 let local_var_resp = local_var_client.execute(local_var_req).await?;
221
222 let local_var_status = local_var_resp.status();
223 let local_var_content = local_var_resp.text().await?;
224
225 if !local_var_status.is_client_error() && !local_var_status.is_server_error() {
226 serde_json::from_str(&local_var_content).map_err(Error::from)
227 } else {
228 let local_var_entity: Option<ApiV3ImportlistexclusionIdPutError> = serde_json::from_str(&local_var_content).ok();
229 let local_var_error = ResponseContent { status: local_var_status, content: local_var_content, entity: local_var_entity };
230 Err(Error::ResponseError(local_var_error))
231 }
232}
233
234pub async fn api_v3_importlistexclusion_paged_get(configuration: &configuration::Configuration, page: Option<i32>, page_size: Option<i32>, sort_key: Option<&str>, sort_direction: Option<models::SortDirection>) -> Result<models::ImportListExclusionResourcePagingResource, Error<ApiV3ImportlistexclusionPagedGetError>> {
235 let local_var_configuration = configuration;
236
237 let local_var_client = &local_var_configuration.client;
238
239 let local_var_uri_str = format!("{}/api/v3/importlistexclusion/paged", local_var_configuration.base_path);
240 let mut local_var_req_builder = local_var_client.request(reqwest::Method::GET, local_var_uri_str.as_str());
241
242 if let Some(ref local_var_str) = page {
243 local_var_req_builder = local_var_req_builder.query(&[("page", &local_var_str.to_string())]);
244 }
245 if let Some(ref local_var_str) = page_size {
246 local_var_req_builder = local_var_req_builder.query(&[("pageSize", &local_var_str.to_string())]);
247 }
248 if let Some(ref local_var_str) = sort_key {
249 local_var_req_builder = local_var_req_builder.query(&[("sortKey", &local_var_str.to_string())]);
250 }
251 if let Some(ref local_var_str) = sort_direction {
252 local_var_req_builder = local_var_req_builder.query(&[("sortDirection", &local_var_str.to_string())]);
253 }
254 if let Some(ref local_var_apikey) = local_var_configuration.api_key {
255 let local_var_key = local_var_apikey.key.clone();
256 let local_var_value = match local_var_apikey.prefix {
257 Some(ref local_var_prefix) => format!("{} {}", local_var_prefix, local_var_key),
258 None => local_var_key,
259 };
260 local_var_req_builder = local_var_req_builder.query(&[("apikey", local_var_value)]);
261 }
262 if let Some(ref local_var_user_agent) = local_var_configuration.user_agent {
263 local_var_req_builder = local_var_req_builder.header(reqwest::header::USER_AGENT, local_var_user_agent.clone());
264 }
265 if let Some(ref local_var_apikey) = local_var_configuration.api_key {
266 let local_var_key = local_var_apikey.key.clone();
267 let local_var_value = match local_var_apikey.prefix {
268 Some(ref local_var_prefix) => format!("{} {}", local_var_prefix, local_var_key),
269 None => local_var_key,
270 };
271 local_var_req_builder = local_var_req_builder.header("X-Api-Key", local_var_value);
272 };
273
274 let local_var_req = local_var_req_builder.build()?;
275 let local_var_resp = local_var_client.execute(local_var_req).await?;
276
277 let local_var_status = local_var_resp.status();
278 let local_var_content = local_var_resp.text().await?;
279
280 if !local_var_status.is_client_error() && !local_var_status.is_server_error() {
281 serde_json::from_str(&local_var_content).map_err(Error::from)
282 } else {
283 let local_var_entity: Option<ApiV3ImportlistexclusionPagedGetError> = serde_json::from_str(&local_var_content).ok();
284 let local_var_error = ResponseContent { status: local_var_status, content: local_var_content, entity: local_var_entity };
285 Err(Error::ResponseError(local_var_error))
286 }
287}
288
289pub async fn api_v3_importlistexclusion_post(configuration: &configuration::Configuration, import_list_exclusion_resource: Option<models::ImportListExclusionResource>) -> Result<models::ImportListExclusionResource, Error<ApiV3ImportlistexclusionPostError>> {
290 let local_var_configuration = configuration;
291
292 let local_var_client = &local_var_configuration.client;
293
294 let local_var_uri_str = format!("{}/api/v3/importlistexclusion", local_var_configuration.base_path);
295 let mut local_var_req_builder = local_var_client.request(reqwest::Method::POST, local_var_uri_str.as_str());
296
297 if let Some(ref local_var_apikey) = local_var_configuration.api_key {
298 let local_var_key = local_var_apikey.key.clone();
299 let local_var_value = match local_var_apikey.prefix {
300 Some(ref local_var_prefix) => format!("{} {}", local_var_prefix, local_var_key),
301 None => local_var_key,
302 };
303 local_var_req_builder = local_var_req_builder.query(&[("apikey", local_var_value)]);
304 }
305 if let Some(ref local_var_user_agent) = local_var_configuration.user_agent {
306 local_var_req_builder = local_var_req_builder.header(reqwest::header::USER_AGENT, local_var_user_agent.clone());
307 }
308 if let Some(ref local_var_apikey) = local_var_configuration.api_key {
309 let local_var_key = local_var_apikey.key.clone();
310 let local_var_value = match local_var_apikey.prefix {
311 Some(ref local_var_prefix) => format!("{} {}", local_var_prefix, local_var_key),
312 None => local_var_key,
313 };
314 local_var_req_builder = local_var_req_builder.header("X-Api-Key", local_var_value);
315 };
316 local_var_req_builder = local_var_req_builder.json(&import_list_exclusion_resource);
317
318 let local_var_req = local_var_req_builder.build()?;
319 let local_var_resp = local_var_client.execute(local_var_req).await?;
320
321 let local_var_status = local_var_resp.status();
322 let local_var_content = local_var_resp.text().await?;
323
324 if !local_var_status.is_client_error() && !local_var_status.is_server_error() {
325 serde_json::from_str(&local_var_content).map_err(Error::from)
326 } else {
327 let local_var_entity: Option<ApiV3ImportlistexclusionPostError> = serde_json::from_str(&local_var_content).ok();
328 let local_var_error = ResponseContent { status: local_var_status, content: local_var_content, entity: local_var_entity };
329 Err(Error::ResponseError(local_var_error))
330 }
331}
332