1use reqwest;
13
14use crate::{apis::ResponseContent, models};
15use super::{Error, configuration};
16
17
18#[derive(Debug, Clone, Serialize, Deserialize)]
20#[serde(untagged)]
21pub enum Oauth2AccessTokensDestroyError {
22 Status400(models::ValidationError),
23 Status403(models::GenericError),
24 UnknownValue(serde_json::Value),
25}
26
27#[derive(Debug, Clone, Serialize, Deserialize)]
29#[serde(untagged)]
30pub enum Oauth2AccessTokensListError {
31 Status400(models::ValidationError),
32 Status403(models::GenericError),
33 UnknownValue(serde_json::Value),
34}
35
36#[derive(Debug, Clone, Serialize, Deserialize)]
38#[serde(untagged)]
39pub enum Oauth2AccessTokensRetrieveError {
40 Status400(models::ValidationError),
41 Status403(models::GenericError),
42 UnknownValue(serde_json::Value),
43}
44
45#[derive(Debug, Clone, Serialize, Deserialize)]
47#[serde(untagged)]
48pub enum Oauth2AccessTokensUsedByListError {
49 Status400(models::ValidationError),
50 Status403(models::GenericError),
51 UnknownValue(serde_json::Value),
52}
53
54#[derive(Debug, Clone, Serialize, Deserialize)]
56#[serde(untagged)]
57pub enum Oauth2AuthorizationCodesDestroyError {
58 Status400(models::ValidationError),
59 Status403(models::GenericError),
60 UnknownValue(serde_json::Value),
61}
62
63#[derive(Debug, Clone, Serialize, Deserialize)]
65#[serde(untagged)]
66pub enum Oauth2AuthorizationCodesListError {
67 Status400(models::ValidationError),
68 Status403(models::GenericError),
69 UnknownValue(serde_json::Value),
70}
71
72#[derive(Debug, Clone, Serialize, Deserialize)]
74#[serde(untagged)]
75pub enum Oauth2AuthorizationCodesRetrieveError {
76 Status400(models::ValidationError),
77 Status403(models::GenericError),
78 UnknownValue(serde_json::Value),
79}
80
81#[derive(Debug, Clone, Serialize, Deserialize)]
83#[serde(untagged)]
84pub enum Oauth2AuthorizationCodesUsedByListError {
85 Status400(models::ValidationError),
86 Status403(models::GenericError),
87 UnknownValue(serde_json::Value),
88}
89
90#[derive(Debug, Clone, Serialize, Deserialize)]
92#[serde(untagged)]
93pub enum Oauth2RefreshTokensDestroyError {
94 Status400(models::ValidationError),
95 Status403(models::GenericError),
96 UnknownValue(serde_json::Value),
97}
98
99#[derive(Debug, Clone, Serialize, Deserialize)]
101#[serde(untagged)]
102pub enum Oauth2RefreshTokensListError {
103 Status400(models::ValidationError),
104 Status403(models::GenericError),
105 UnknownValue(serde_json::Value),
106}
107
108#[derive(Debug, Clone, Serialize, Deserialize)]
110#[serde(untagged)]
111pub enum Oauth2RefreshTokensRetrieveError {
112 Status400(models::ValidationError),
113 Status403(models::GenericError),
114 UnknownValue(serde_json::Value),
115}
116
117#[derive(Debug, Clone, Serialize, Deserialize)]
119#[serde(untagged)]
120pub enum Oauth2RefreshTokensUsedByListError {
121 Status400(models::ValidationError),
122 Status403(models::GenericError),
123 UnknownValue(serde_json::Value),
124}
125
126
127pub async fn oauth2_access_tokens_destroy(configuration: &configuration::Configuration, id: i32) -> Result<(), Error<Oauth2AccessTokensDestroyError>> {
129 let local_var_configuration = configuration;
130
131 let local_var_client = &local_var_configuration.client;
132
133 let local_var_uri_str = format!("{}/oauth2/access_tokens/{id}/", local_var_configuration.base_path, id=id);
134 let mut local_var_req_builder = local_var_client.request(reqwest::Method::DELETE, local_var_uri_str.as_str());
135
136 if let Some(ref local_var_user_agent) = local_var_configuration.user_agent {
137 local_var_req_builder = local_var_req_builder.header(reqwest::header::USER_AGENT, local_var_user_agent.clone());
138 }
139 if let Some(ref local_var_apikey) = local_var_configuration.api_key {
140 let local_var_key = local_var_apikey.key.clone();
141 let local_var_value = match local_var_apikey.prefix {
142 Some(ref local_var_prefix) => format!("{} {}", local_var_prefix, local_var_key),
143 None => local_var_key,
144 };
145 local_var_req_builder = local_var_req_builder.header("Authorization", local_var_value);
146 };
147
148 let local_var_req = local_var_req_builder.build()?;
149 let local_var_resp = local_var_client.execute(local_var_req).await?;
150
151 let local_var_status = local_var_resp.status();
152 let local_var_content = local_var_resp.text().await?;
153
154 if !local_var_status.is_client_error() && !local_var_status.is_server_error() {
155 Ok(())
156 } else {
157 let local_var_entity: Option<Oauth2AccessTokensDestroyError> = serde_json::from_str(&local_var_content).ok();
158 let local_var_error = ResponseContent { status: local_var_status, content: local_var_content, entity: local_var_entity };
159 Err(Error::ResponseError(local_var_error))
160 }
161}
162
163pub async fn oauth2_access_tokens_list(configuration: &configuration::Configuration, ordering: Option<&str>, page: Option<i32>, page_size: Option<i32>, provider: Option<i32>, search: Option<&str>, user: Option<i32>) -> Result<models::PaginatedTokenModelList, Error<Oauth2AccessTokensListError>> {
165 let local_var_configuration = configuration;
166
167 let local_var_client = &local_var_configuration.client;
168
169 let local_var_uri_str = format!("{}/oauth2/access_tokens/", local_var_configuration.base_path);
170 let mut local_var_req_builder = local_var_client.request(reqwest::Method::GET, local_var_uri_str.as_str());
171
172 if let Some(ref local_var_str) = ordering {
173 local_var_req_builder = local_var_req_builder.query(&[("ordering", &local_var_str.to_string())]);
174 }
175 if let Some(ref local_var_str) = page {
176 local_var_req_builder = local_var_req_builder.query(&[("page", &local_var_str.to_string())]);
177 }
178 if let Some(ref local_var_str) = page_size {
179 local_var_req_builder = local_var_req_builder.query(&[("page_size", &local_var_str.to_string())]);
180 }
181 if let Some(ref local_var_str) = provider {
182 local_var_req_builder = local_var_req_builder.query(&[("provider", &local_var_str.to_string())]);
183 }
184 if let Some(ref local_var_str) = search {
185 local_var_req_builder = local_var_req_builder.query(&[("search", &local_var_str.to_string())]);
186 }
187 if let Some(ref local_var_str) = user {
188 local_var_req_builder = local_var_req_builder.query(&[("user", &local_var_str.to_string())]);
189 }
190 if let Some(ref local_var_user_agent) = local_var_configuration.user_agent {
191 local_var_req_builder = local_var_req_builder.header(reqwest::header::USER_AGENT, local_var_user_agent.clone());
192 }
193 if let Some(ref local_var_apikey) = local_var_configuration.api_key {
194 let local_var_key = local_var_apikey.key.clone();
195 let local_var_value = match local_var_apikey.prefix {
196 Some(ref local_var_prefix) => format!("{} {}", local_var_prefix, local_var_key),
197 None => local_var_key,
198 };
199 local_var_req_builder = local_var_req_builder.header("Authorization", local_var_value);
200 };
201
202 let local_var_req = local_var_req_builder.build()?;
203 let local_var_resp = local_var_client.execute(local_var_req).await?;
204
205 let local_var_status = local_var_resp.status();
206 let local_var_content = local_var_resp.text().await?;
207
208 if !local_var_status.is_client_error() && !local_var_status.is_server_error() {
209 serde_json::from_str(&local_var_content).map_err(Error::from)
210 } else {
211 let local_var_entity: Option<Oauth2AccessTokensListError> = serde_json::from_str(&local_var_content).ok();
212 let local_var_error = ResponseContent { status: local_var_status, content: local_var_content, entity: local_var_entity };
213 Err(Error::ResponseError(local_var_error))
214 }
215}
216
217pub async fn oauth2_access_tokens_retrieve(configuration: &configuration::Configuration, id: i32) -> Result<models::TokenModel, Error<Oauth2AccessTokensRetrieveError>> {
219 let local_var_configuration = configuration;
220
221 let local_var_client = &local_var_configuration.client;
222
223 let local_var_uri_str = format!("{}/oauth2/access_tokens/{id}/", local_var_configuration.base_path, id=id);
224 let mut local_var_req_builder = local_var_client.request(reqwest::Method::GET, local_var_uri_str.as_str());
225
226 if let Some(ref local_var_user_agent) = local_var_configuration.user_agent {
227 local_var_req_builder = local_var_req_builder.header(reqwest::header::USER_AGENT, local_var_user_agent.clone());
228 }
229 if let Some(ref local_var_apikey) = local_var_configuration.api_key {
230 let local_var_key = local_var_apikey.key.clone();
231 let local_var_value = match local_var_apikey.prefix {
232 Some(ref local_var_prefix) => format!("{} {}", local_var_prefix, local_var_key),
233 None => local_var_key,
234 };
235 local_var_req_builder = local_var_req_builder.header("Authorization", local_var_value);
236 };
237
238 let local_var_req = local_var_req_builder.build()?;
239 let local_var_resp = local_var_client.execute(local_var_req).await?;
240
241 let local_var_status = local_var_resp.status();
242 let local_var_content = local_var_resp.text().await?;
243
244 if !local_var_status.is_client_error() && !local_var_status.is_server_error() {
245 serde_json::from_str(&local_var_content).map_err(Error::from)
246 } else {
247 let local_var_entity: Option<Oauth2AccessTokensRetrieveError> = serde_json::from_str(&local_var_content).ok();
248 let local_var_error = ResponseContent { status: local_var_status, content: local_var_content, entity: local_var_entity };
249 Err(Error::ResponseError(local_var_error))
250 }
251}
252
253pub async fn oauth2_access_tokens_used_by_list(configuration: &configuration::Configuration, id: i32) -> Result<Vec<models::UsedBy>, Error<Oauth2AccessTokensUsedByListError>> {
255 let local_var_configuration = configuration;
256
257 let local_var_client = &local_var_configuration.client;
258
259 let local_var_uri_str = format!("{}/oauth2/access_tokens/{id}/used_by/", local_var_configuration.base_path, id=id);
260 let mut local_var_req_builder = local_var_client.request(reqwest::Method::GET, local_var_uri_str.as_str());
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("Authorization", 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<Oauth2AccessTokensUsedByListError> = 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 oauth2_authorization_codes_destroy(configuration: &configuration::Configuration, id: i32) -> Result<(), Error<Oauth2AuthorizationCodesDestroyError>> {
291 let local_var_configuration = configuration;
292
293 let local_var_client = &local_var_configuration.client;
294
295 let local_var_uri_str = format!("{}/oauth2/authorization_codes/{id}/", local_var_configuration.base_path, id=id);
296 let mut local_var_req_builder = local_var_client.request(reqwest::Method::DELETE, local_var_uri_str.as_str());
297
298 if let Some(ref local_var_user_agent) = local_var_configuration.user_agent {
299 local_var_req_builder = local_var_req_builder.header(reqwest::header::USER_AGENT, local_var_user_agent.clone());
300 }
301 if let Some(ref local_var_apikey) = local_var_configuration.api_key {
302 let local_var_key = local_var_apikey.key.clone();
303 let local_var_value = match local_var_apikey.prefix {
304 Some(ref local_var_prefix) => format!("{} {}", local_var_prefix, local_var_key),
305 None => local_var_key,
306 };
307 local_var_req_builder = local_var_req_builder.header("Authorization", local_var_value);
308 };
309
310 let local_var_req = local_var_req_builder.build()?;
311 let local_var_resp = local_var_client.execute(local_var_req).await?;
312
313 let local_var_status = local_var_resp.status();
314 let local_var_content = local_var_resp.text().await?;
315
316 if !local_var_status.is_client_error() && !local_var_status.is_server_error() {
317 Ok(())
318 } else {
319 let local_var_entity: Option<Oauth2AuthorizationCodesDestroyError> = serde_json::from_str(&local_var_content).ok();
320 let local_var_error = ResponseContent { status: local_var_status, content: local_var_content, entity: local_var_entity };
321 Err(Error::ResponseError(local_var_error))
322 }
323}
324
325pub async fn oauth2_authorization_codes_list(configuration: &configuration::Configuration, ordering: Option<&str>, page: Option<i32>, page_size: Option<i32>, provider: Option<i32>, search: Option<&str>, user: Option<i32>) -> Result<models::PaginatedExpiringBaseGrantModelList, Error<Oauth2AuthorizationCodesListError>> {
327 let local_var_configuration = configuration;
328
329 let local_var_client = &local_var_configuration.client;
330
331 let local_var_uri_str = format!("{}/oauth2/authorization_codes/", local_var_configuration.base_path);
332 let mut local_var_req_builder = local_var_client.request(reqwest::Method::GET, local_var_uri_str.as_str());
333
334 if let Some(ref local_var_str) = ordering {
335 local_var_req_builder = local_var_req_builder.query(&[("ordering", &local_var_str.to_string())]);
336 }
337 if let Some(ref local_var_str) = page {
338 local_var_req_builder = local_var_req_builder.query(&[("page", &local_var_str.to_string())]);
339 }
340 if let Some(ref local_var_str) = page_size {
341 local_var_req_builder = local_var_req_builder.query(&[("page_size", &local_var_str.to_string())]);
342 }
343 if let Some(ref local_var_str) = provider {
344 local_var_req_builder = local_var_req_builder.query(&[("provider", &local_var_str.to_string())]);
345 }
346 if let Some(ref local_var_str) = search {
347 local_var_req_builder = local_var_req_builder.query(&[("search", &local_var_str.to_string())]);
348 }
349 if let Some(ref local_var_str) = user {
350 local_var_req_builder = local_var_req_builder.query(&[("user", &local_var_str.to_string())]);
351 }
352 if let Some(ref local_var_user_agent) = local_var_configuration.user_agent {
353 local_var_req_builder = local_var_req_builder.header(reqwest::header::USER_AGENT, local_var_user_agent.clone());
354 }
355 if let Some(ref local_var_apikey) = local_var_configuration.api_key {
356 let local_var_key = local_var_apikey.key.clone();
357 let local_var_value = match local_var_apikey.prefix {
358 Some(ref local_var_prefix) => format!("{} {}", local_var_prefix, local_var_key),
359 None => local_var_key,
360 };
361 local_var_req_builder = local_var_req_builder.header("Authorization", local_var_value);
362 };
363
364 let local_var_req = local_var_req_builder.build()?;
365 let local_var_resp = local_var_client.execute(local_var_req).await?;
366
367 let local_var_status = local_var_resp.status();
368 let local_var_content = local_var_resp.text().await?;
369
370 if !local_var_status.is_client_error() && !local_var_status.is_server_error() {
371 serde_json::from_str(&local_var_content).map_err(Error::from)
372 } else {
373 let local_var_entity: Option<Oauth2AuthorizationCodesListError> = serde_json::from_str(&local_var_content).ok();
374 let local_var_error = ResponseContent { status: local_var_status, content: local_var_content, entity: local_var_entity };
375 Err(Error::ResponseError(local_var_error))
376 }
377}
378
379pub async fn oauth2_authorization_codes_retrieve(configuration: &configuration::Configuration, id: i32) -> Result<models::ExpiringBaseGrantModel, Error<Oauth2AuthorizationCodesRetrieveError>> {
381 let local_var_configuration = configuration;
382
383 let local_var_client = &local_var_configuration.client;
384
385 let local_var_uri_str = format!("{}/oauth2/authorization_codes/{id}/", local_var_configuration.base_path, id=id);
386 let mut local_var_req_builder = local_var_client.request(reqwest::Method::GET, local_var_uri_str.as_str());
387
388 if let Some(ref local_var_user_agent) = local_var_configuration.user_agent {
389 local_var_req_builder = local_var_req_builder.header(reqwest::header::USER_AGENT, local_var_user_agent.clone());
390 }
391 if let Some(ref local_var_apikey) = local_var_configuration.api_key {
392 let local_var_key = local_var_apikey.key.clone();
393 let local_var_value = match local_var_apikey.prefix {
394 Some(ref local_var_prefix) => format!("{} {}", local_var_prefix, local_var_key),
395 None => local_var_key,
396 };
397 local_var_req_builder = local_var_req_builder.header("Authorization", local_var_value);
398 };
399
400 let local_var_req = local_var_req_builder.build()?;
401 let local_var_resp = local_var_client.execute(local_var_req).await?;
402
403 let local_var_status = local_var_resp.status();
404 let local_var_content = local_var_resp.text().await?;
405
406 if !local_var_status.is_client_error() && !local_var_status.is_server_error() {
407 serde_json::from_str(&local_var_content).map_err(Error::from)
408 } else {
409 let local_var_entity: Option<Oauth2AuthorizationCodesRetrieveError> = serde_json::from_str(&local_var_content).ok();
410 let local_var_error = ResponseContent { status: local_var_status, content: local_var_content, entity: local_var_entity };
411 Err(Error::ResponseError(local_var_error))
412 }
413}
414
415pub async fn oauth2_authorization_codes_used_by_list(configuration: &configuration::Configuration, id: i32) -> Result<Vec<models::UsedBy>, Error<Oauth2AuthorizationCodesUsedByListError>> {
417 let local_var_configuration = configuration;
418
419 let local_var_client = &local_var_configuration.client;
420
421 let local_var_uri_str = format!("{}/oauth2/authorization_codes/{id}/used_by/", local_var_configuration.base_path, id=id);
422 let mut local_var_req_builder = local_var_client.request(reqwest::Method::GET, local_var_uri_str.as_str());
423
424 if let Some(ref local_var_user_agent) = local_var_configuration.user_agent {
425 local_var_req_builder = local_var_req_builder.header(reqwest::header::USER_AGENT, local_var_user_agent.clone());
426 }
427 if let Some(ref local_var_apikey) = local_var_configuration.api_key {
428 let local_var_key = local_var_apikey.key.clone();
429 let local_var_value = match local_var_apikey.prefix {
430 Some(ref local_var_prefix) => format!("{} {}", local_var_prefix, local_var_key),
431 None => local_var_key,
432 };
433 local_var_req_builder = local_var_req_builder.header("Authorization", local_var_value);
434 };
435
436 let local_var_req = local_var_req_builder.build()?;
437 let local_var_resp = local_var_client.execute(local_var_req).await?;
438
439 let local_var_status = local_var_resp.status();
440 let local_var_content = local_var_resp.text().await?;
441
442 if !local_var_status.is_client_error() && !local_var_status.is_server_error() {
443 serde_json::from_str(&local_var_content).map_err(Error::from)
444 } else {
445 let local_var_entity: Option<Oauth2AuthorizationCodesUsedByListError> = serde_json::from_str(&local_var_content).ok();
446 let local_var_error = ResponseContent { status: local_var_status, content: local_var_content, entity: local_var_entity };
447 Err(Error::ResponseError(local_var_error))
448 }
449}
450
451pub async fn oauth2_refresh_tokens_destroy(configuration: &configuration::Configuration, id: i32) -> Result<(), Error<Oauth2RefreshTokensDestroyError>> {
453 let local_var_configuration = configuration;
454
455 let local_var_client = &local_var_configuration.client;
456
457 let local_var_uri_str = format!("{}/oauth2/refresh_tokens/{id}/", local_var_configuration.base_path, id=id);
458 let mut local_var_req_builder = local_var_client.request(reqwest::Method::DELETE, local_var_uri_str.as_str());
459
460 if let Some(ref local_var_user_agent) = local_var_configuration.user_agent {
461 local_var_req_builder = local_var_req_builder.header(reqwest::header::USER_AGENT, local_var_user_agent.clone());
462 }
463 if let Some(ref local_var_apikey) = local_var_configuration.api_key {
464 let local_var_key = local_var_apikey.key.clone();
465 let local_var_value = match local_var_apikey.prefix {
466 Some(ref local_var_prefix) => format!("{} {}", local_var_prefix, local_var_key),
467 None => local_var_key,
468 };
469 local_var_req_builder = local_var_req_builder.header("Authorization", local_var_value);
470 };
471
472 let local_var_req = local_var_req_builder.build()?;
473 let local_var_resp = local_var_client.execute(local_var_req).await?;
474
475 let local_var_status = local_var_resp.status();
476 let local_var_content = local_var_resp.text().await?;
477
478 if !local_var_status.is_client_error() && !local_var_status.is_server_error() {
479 Ok(())
480 } else {
481 let local_var_entity: Option<Oauth2RefreshTokensDestroyError> = serde_json::from_str(&local_var_content).ok();
482 let local_var_error = ResponseContent { status: local_var_status, content: local_var_content, entity: local_var_entity };
483 Err(Error::ResponseError(local_var_error))
484 }
485}
486
487pub async fn oauth2_refresh_tokens_list(configuration: &configuration::Configuration, ordering: Option<&str>, page: Option<i32>, page_size: Option<i32>, provider: Option<i32>, search: Option<&str>, user: Option<i32>) -> Result<models::PaginatedTokenModelList, Error<Oauth2RefreshTokensListError>> {
489 let local_var_configuration = configuration;
490
491 let local_var_client = &local_var_configuration.client;
492
493 let local_var_uri_str = format!("{}/oauth2/refresh_tokens/", local_var_configuration.base_path);
494 let mut local_var_req_builder = local_var_client.request(reqwest::Method::GET, local_var_uri_str.as_str());
495
496 if let Some(ref local_var_str) = ordering {
497 local_var_req_builder = local_var_req_builder.query(&[("ordering", &local_var_str.to_string())]);
498 }
499 if let Some(ref local_var_str) = page {
500 local_var_req_builder = local_var_req_builder.query(&[("page", &local_var_str.to_string())]);
501 }
502 if let Some(ref local_var_str) = page_size {
503 local_var_req_builder = local_var_req_builder.query(&[("page_size", &local_var_str.to_string())]);
504 }
505 if let Some(ref local_var_str) = provider {
506 local_var_req_builder = local_var_req_builder.query(&[("provider", &local_var_str.to_string())]);
507 }
508 if let Some(ref local_var_str) = search {
509 local_var_req_builder = local_var_req_builder.query(&[("search", &local_var_str.to_string())]);
510 }
511 if let Some(ref local_var_str) = user {
512 local_var_req_builder = local_var_req_builder.query(&[("user", &local_var_str.to_string())]);
513 }
514 if let Some(ref local_var_user_agent) = local_var_configuration.user_agent {
515 local_var_req_builder = local_var_req_builder.header(reqwest::header::USER_AGENT, local_var_user_agent.clone());
516 }
517 if let Some(ref local_var_apikey) = local_var_configuration.api_key {
518 let local_var_key = local_var_apikey.key.clone();
519 let local_var_value = match local_var_apikey.prefix {
520 Some(ref local_var_prefix) => format!("{} {}", local_var_prefix, local_var_key),
521 None => local_var_key,
522 };
523 local_var_req_builder = local_var_req_builder.header("Authorization", local_var_value);
524 };
525
526 let local_var_req = local_var_req_builder.build()?;
527 let local_var_resp = local_var_client.execute(local_var_req).await?;
528
529 let local_var_status = local_var_resp.status();
530 let local_var_content = local_var_resp.text().await?;
531
532 if !local_var_status.is_client_error() && !local_var_status.is_server_error() {
533 serde_json::from_str(&local_var_content).map_err(Error::from)
534 } else {
535 let local_var_entity: Option<Oauth2RefreshTokensListError> = serde_json::from_str(&local_var_content).ok();
536 let local_var_error = ResponseContent { status: local_var_status, content: local_var_content, entity: local_var_entity };
537 Err(Error::ResponseError(local_var_error))
538 }
539}
540
541pub async fn oauth2_refresh_tokens_retrieve(configuration: &configuration::Configuration, id: i32) -> Result<models::TokenModel, Error<Oauth2RefreshTokensRetrieveError>> {
543 let local_var_configuration = configuration;
544
545 let local_var_client = &local_var_configuration.client;
546
547 let local_var_uri_str = format!("{}/oauth2/refresh_tokens/{id}/", local_var_configuration.base_path, id=id);
548 let mut local_var_req_builder = local_var_client.request(reqwest::Method::GET, local_var_uri_str.as_str());
549
550 if let Some(ref local_var_user_agent) = local_var_configuration.user_agent {
551 local_var_req_builder = local_var_req_builder.header(reqwest::header::USER_AGENT, local_var_user_agent.clone());
552 }
553 if let Some(ref local_var_apikey) = local_var_configuration.api_key {
554 let local_var_key = local_var_apikey.key.clone();
555 let local_var_value = match local_var_apikey.prefix {
556 Some(ref local_var_prefix) => format!("{} {}", local_var_prefix, local_var_key),
557 None => local_var_key,
558 };
559 local_var_req_builder = local_var_req_builder.header("Authorization", local_var_value);
560 };
561
562 let local_var_req = local_var_req_builder.build()?;
563 let local_var_resp = local_var_client.execute(local_var_req).await?;
564
565 let local_var_status = local_var_resp.status();
566 let local_var_content = local_var_resp.text().await?;
567
568 if !local_var_status.is_client_error() && !local_var_status.is_server_error() {
569 serde_json::from_str(&local_var_content).map_err(Error::from)
570 } else {
571 let local_var_entity: Option<Oauth2RefreshTokensRetrieveError> = serde_json::from_str(&local_var_content).ok();
572 let local_var_error = ResponseContent { status: local_var_status, content: local_var_content, entity: local_var_entity };
573 Err(Error::ResponseError(local_var_error))
574 }
575}
576
577pub async fn oauth2_refresh_tokens_used_by_list(configuration: &configuration::Configuration, id: i32) -> Result<Vec<models::UsedBy>, Error<Oauth2RefreshTokensUsedByListError>> {
579 let local_var_configuration = configuration;
580
581 let local_var_client = &local_var_configuration.client;
582
583 let local_var_uri_str = format!("{}/oauth2/refresh_tokens/{id}/used_by/", local_var_configuration.base_path, id=id);
584 let mut local_var_req_builder = local_var_client.request(reqwest::Method::GET, local_var_uri_str.as_str());
585
586 if let Some(ref local_var_user_agent) = local_var_configuration.user_agent {
587 local_var_req_builder = local_var_req_builder.header(reqwest::header::USER_AGENT, local_var_user_agent.clone());
588 }
589 if let Some(ref local_var_apikey) = local_var_configuration.api_key {
590 let local_var_key = local_var_apikey.key.clone();
591 let local_var_value = match local_var_apikey.prefix {
592 Some(ref local_var_prefix) => format!("{} {}", local_var_prefix, local_var_key),
593 None => local_var_key,
594 };
595 local_var_req_builder = local_var_req_builder.header("Authorization", local_var_value);
596 };
597
598 let local_var_req = local_var_req_builder.build()?;
599 let local_var_resp = local_var_client.execute(local_var_req).await?;
600
601 let local_var_status = local_var_resp.status();
602 let local_var_content = local_var_resp.text().await?;
603
604 if !local_var_status.is_client_error() && !local_var_status.is_server_error() {
605 serde_json::from_str(&local_var_content).map_err(Error::from)
606 } else {
607 let local_var_entity: Option<Oauth2RefreshTokensUsedByListError> = serde_json::from_str(&local_var_content).ok();
608 let local_var_error = ResponseContent { status: local_var_status, content: local_var_content, entity: local_var_entity };
609 Err(Error::ResponseError(local_var_error))
610 }
611}
612