1use reqwest;
13use serde::{Deserialize, Serialize, de::Error as _};
14use crate::{apis::ResponseContent, models};
15use super::{Error, configuration, ContentType};
16
17
18#[derive(Debug, Clone, Serialize, Deserialize)]
20#[serde(untagged)]
21pub enum AdminBatchCreateImportedApiKeysError {
22 DefaultResponse(models::Status),
23 UnknownValue(serde_json::Value),
24}
25
26#[derive(Debug, Clone, Serialize, Deserialize)]
28#[serde(untagged)]
29pub enum AdminBatchVerifyApiKeysError {
30 DefaultResponse(models::Status),
31 UnknownValue(serde_json::Value),
32}
33
34#[derive(Debug, Clone, Serialize, Deserialize)]
36#[serde(untagged)]
37pub enum AdminDeleteImportedApiKeyError {
38 DefaultResponse(models::Status),
39 UnknownValue(serde_json::Value),
40}
41
42#[derive(Debug, Clone, Serialize, Deserialize)]
44#[serde(untagged)]
45pub enum AdminDeriveTokenError {
46 DefaultResponse(models::Status),
47 UnknownValue(serde_json::Value),
48}
49
50#[derive(Debug, Clone, Serialize, Deserialize)]
52#[serde(untagged)]
53pub enum AdminGetImportedApiKeyError {
54 DefaultResponse(models::Status),
55 UnknownValue(serde_json::Value),
56}
57
58#[derive(Debug, Clone, Serialize, Deserialize)]
60#[serde(untagged)]
61pub enum AdminGetIssuedApiKeyError {
62 DefaultResponse(models::Status),
63 UnknownValue(serde_json::Value),
64}
65
66#[derive(Debug, Clone, Serialize, Deserialize)]
68#[serde(untagged)]
69pub enum AdminImportApiKeyError {
70 DefaultResponse(models::Status),
71 UnknownValue(serde_json::Value),
72}
73
74#[derive(Debug, Clone, Serialize, Deserialize)]
76#[serde(untagged)]
77pub enum AdminIssueApiKeyError {
78 DefaultResponse(models::Status),
79 UnknownValue(serde_json::Value),
80}
81
82#[derive(Debug, Clone, Serialize, Deserialize)]
84#[serde(untagged)]
85pub enum AdminListImportedApiKeysError {
86 DefaultResponse(models::Status),
87 UnknownValue(serde_json::Value),
88}
89
90#[derive(Debug, Clone, Serialize, Deserialize)]
92#[serde(untagged)]
93pub enum AdminListIssuedApiKeysError {
94 DefaultResponse(models::Status),
95 UnknownValue(serde_json::Value),
96}
97
98#[derive(Debug, Clone, Serialize, Deserialize)]
100#[serde(untagged)]
101pub enum AdminRevokeImportedApiKeyError {
102 DefaultResponse(models::Status),
103 UnknownValue(serde_json::Value),
104}
105
106#[derive(Debug, Clone, Serialize, Deserialize)]
108#[serde(untagged)]
109pub enum AdminRevokeIssuedApiKeyError {
110 DefaultResponse(models::Status),
111 UnknownValue(serde_json::Value),
112}
113
114#[derive(Debug, Clone, Serialize, Deserialize)]
116#[serde(untagged)]
117pub enum AdminRotateIssuedApiKeyError {
118 DefaultResponse(models::Status),
119 UnknownValue(serde_json::Value),
120}
121
122#[derive(Debug, Clone, Serialize, Deserialize)]
124#[serde(untagged)]
125pub enum AdminUpdateImportedApiKeyError {
126 DefaultResponse(models::Status),
127 UnknownValue(serde_json::Value),
128}
129
130#[derive(Debug, Clone, Serialize, Deserialize)]
132#[serde(untagged)]
133pub enum AdminUpdateIssuedApiKeyError {
134 DefaultResponse(models::Status),
135 UnknownValue(serde_json::Value),
136}
137
138#[derive(Debug, Clone, Serialize, Deserialize)]
140#[serde(untagged)]
141pub enum AdminVerifyApiKeyError {
142 DefaultResponse(models::Status),
143 UnknownValue(serde_json::Value),
144}
145
146#[derive(Debug, Clone, Serialize, Deserialize)]
148#[serde(untagged)]
149pub enum GetJwksError {
150 DefaultResponse(models::Status),
151 UnknownValue(serde_json::Value),
152}
153
154#[derive(Debug, Clone, Serialize, Deserialize)]
156#[serde(untagged)]
157pub enum RevokeApiKeyError {
158 DefaultResponse(models::Status),
159 UnknownValue(serde_json::Value),
160}
161
162
163pub async fn admin_batch_create_imported_api_keys(configuration: &configuration::Configuration, batch_create_imported_api_keys_request: models::BatchCreateImportedApiKeysRequest) -> Result<models::BatchCreateImportedApiKeysResponse, Error<AdminBatchCreateImportedApiKeysError>> {
165 let p_body_batch_create_imported_api_keys_request = batch_create_imported_api_keys_request;
167
168 let uri_str = format!("{}/v2alpha1/admin/importedApiKeys:batchCreate", configuration.base_path);
169 let mut req_builder = configuration.client.request(reqwest::Method::POST, &uri_str);
170
171 if let Some(ref user_agent) = configuration.user_agent {
172 req_builder = req_builder.header(reqwest::header::USER_AGENT, user_agent.clone());
173 }
174 if let Some(ref token) = configuration.bearer_access_token {
175 req_builder = req_builder.bearer_auth(token.to_owned());
176 };
177 req_builder = req_builder.json(&p_body_batch_create_imported_api_keys_request);
178
179 let req = req_builder.build()?;
180 let resp = configuration.client.execute(req).await?;
181
182 let status = resp.status();
183 let content_type = resp
184 .headers()
185 .get("content-type")
186 .and_then(|v| v.to_str().ok())
187 .unwrap_or("application/octet-stream");
188 let content_type = super::ContentType::from(content_type);
189
190 if !status.is_client_error() && !status.is_server_error() {
191 let content = resp.text().await?;
192 match content_type {
193 ContentType::Json => serde_json::from_str(&content).map_err(Error::from),
194 ContentType::Text => return Err(Error::from(serde_json::Error::custom("Received `text/plain` content type response that cannot be converted to `models::BatchCreateImportedApiKeysResponse`"))),
195 ContentType::Unsupported(unknown_type) => return Err(Error::from(serde_json::Error::custom(format!("Received `{unknown_type}` content type response that cannot be converted to `models::BatchCreateImportedApiKeysResponse`")))),
196 }
197 } else {
198 let content = resp.text().await?;
199 let entity: Option<AdminBatchCreateImportedApiKeysError> = serde_json::from_str(&content).ok();
200 Err(Error::ResponseError(ResponseContent { status, content, entity }))
201 }
202}
203
204pub async fn admin_batch_verify_api_keys(configuration: &configuration::Configuration, batch_verify_api_keys_request: models::BatchVerifyApiKeysRequest, cache_control: Option<&str>, pragma: Option<&str>) -> Result<models::BatchVerifyApiKeysResponse, Error<AdminBatchVerifyApiKeysError>> {
206 let p_body_batch_verify_api_keys_request = batch_verify_api_keys_request;
208 let p_header_cache_control = cache_control;
209 let p_header_pragma = pragma;
210
211 let uri_str = format!("{}/v2alpha1/admin/apiKeys:batchVerify", configuration.base_path);
212 let mut req_builder = configuration.client.request(reqwest::Method::POST, &uri_str);
213
214 if let Some(ref user_agent) = configuration.user_agent {
215 req_builder = req_builder.header(reqwest::header::USER_AGENT, user_agent.clone());
216 }
217 if let Some(param_value) = p_header_cache_control {
218 req_builder = req_builder.header("Cache-Control", param_value.to_string());
219 }
220 if let Some(param_value) = p_header_pragma {
221 req_builder = req_builder.header("Pragma", param_value.to_string());
222 }
223 if let Some(ref token) = configuration.bearer_access_token {
224 req_builder = req_builder.bearer_auth(token.to_owned());
225 };
226 req_builder = req_builder.json(&p_body_batch_verify_api_keys_request);
227
228 let req = req_builder.build()?;
229 let resp = configuration.client.execute(req).await?;
230
231 let status = resp.status();
232 let content_type = resp
233 .headers()
234 .get("content-type")
235 .and_then(|v| v.to_str().ok())
236 .unwrap_or("application/octet-stream");
237 let content_type = super::ContentType::from(content_type);
238
239 if !status.is_client_error() && !status.is_server_error() {
240 let content = resp.text().await?;
241 match content_type {
242 ContentType::Json => serde_json::from_str(&content).map_err(Error::from),
243 ContentType::Text => return Err(Error::from(serde_json::Error::custom("Received `text/plain` content type response that cannot be converted to `models::BatchVerifyApiKeysResponse`"))),
244 ContentType::Unsupported(unknown_type) => return Err(Error::from(serde_json::Error::custom(format!("Received `{unknown_type}` content type response that cannot be converted to `models::BatchVerifyApiKeysResponse`")))),
245 }
246 } else {
247 let content = resp.text().await?;
248 let entity: Option<AdminBatchVerifyApiKeysError> = serde_json::from_str(&content).ok();
249 Err(Error::ResponseError(ResponseContent { status, content, entity }))
250 }
251}
252
253pub async fn admin_delete_imported_api_key(configuration: &configuration::Configuration, key_id: &str) -> Result<(), Error<AdminDeleteImportedApiKeyError>> {
255 let p_path_key_id = key_id;
257
258 let uri_str = format!("{}/v2alpha1/admin/importedApiKeys/{key_id}", configuration.base_path, key_id=crate::apis::urlencode(p_path_key_id));
259 let mut req_builder = configuration.client.request(reqwest::Method::DELETE, &uri_str);
260
261 if let Some(ref user_agent) = configuration.user_agent {
262 req_builder = req_builder.header(reqwest::header::USER_AGENT, user_agent.clone());
263 }
264 if let Some(ref token) = configuration.bearer_access_token {
265 req_builder = req_builder.bearer_auth(token.to_owned());
266 };
267
268 let req = req_builder.build()?;
269 let resp = configuration.client.execute(req).await?;
270
271 let status = resp.status();
272
273 if !status.is_client_error() && !status.is_server_error() {
274 Ok(())
275 } else {
276 let content = resp.text().await?;
277 let entity: Option<AdminDeleteImportedApiKeyError> = serde_json::from_str(&content).ok();
278 Err(Error::ResponseError(ResponseContent { status, content, entity }))
279 }
280}
281
282pub async fn admin_derive_token(configuration: &configuration::Configuration, derive_token_request: models::DeriveTokenRequest) -> Result<models::DeriveTokenResponse, Error<AdminDeriveTokenError>> {
284 let p_body_derive_token_request = derive_token_request;
286
287 let uri_str = format!("{}/v2alpha1/admin/apiKeys:derive", configuration.base_path);
288 let mut req_builder = configuration.client.request(reqwest::Method::POST, &uri_str);
289
290 if let Some(ref user_agent) = configuration.user_agent {
291 req_builder = req_builder.header(reqwest::header::USER_AGENT, user_agent.clone());
292 }
293 if let Some(ref token) = configuration.bearer_access_token {
294 req_builder = req_builder.bearer_auth(token.to_owned());
295 };
296 req_builder = req_builder.json(&p_body_derive_token_request);
297
298 let req = req_builder.build()?;
299 let resp = configuration.client.execute(req).await?;
300
301 let status = resp.status();
302 let content_type = resp
303 .headers()
304 .get("content-type")
305 .and_then(|v| v.to_str().ok())
306 .unwrap_or("application/octet-stream");
307 let content_type = super::ContentType::from(content_type);
308
309 if !status.is_client_error() && !status.is_server_error() {
310 let content = resp.text().await?;
311 match content_type {
312 ContentType::Json => serde_json::from_str(&content).map_err(Error::from),
313 ContentType::Text => return Err(Error::from(serde_json::Error::custom("Received `text/plain` content type response that cannot be converted to `models::DeriveTokenResponse`"))),
314 ContentType::Unsupported(unknown_type) => return Err(Error::from(serde_json::Error::custom(format!("Received `{unknown_type}` content type response that cannot be converted to `models::DeriveTokenResponse`")))),
315 }
316 } else {
317 let content = resp.text().await?;
318 let entity: Option<AdminDeriveTokenError> = serde_json::from_str(&content).ok();
319 Err(Error::ResponseError(ResponseContent { status, content, entity }))
320 }
321}
322
323pub async fn admin_get_imported_api_key(configuration: &configuration::Configuration, key_id: &str) -> Result<models::ImportedApiKey, Error<AdminGetImportedApiKeyError>> {
325 let p_path_key_id = key_id;
327
328 let uri_str = format!("{}/v2alpha1/admin/importedApiKeys/{key_id}", configuration.base_path, key_id=crate::apis::urlencode(p_path_key_id));
329 let mut req_builder = configuration.client.request(reqwest::Method::GET, &uri_str);
330
331 if let Some(ref user_agent) = configuration.user_agent {
332 req_builder = req_builder.header(reqwest::header::USER_AGENT, user_agent.clone());
333 }
334 if let Some(ref token) = configuration.bearer_access_token {
335 req_builder = req_builder.bearer_auth(token.to_owned());
336 };
337
338 let req = req_builder.build()?;
339 let resp = configuration.client.execute(req).await?;
340
341 let status = resp.status();
342 let content_type = resp
343 .headers()
344 .get("content-type")
345 .and_then(|v| v.to_str().ok())
346 .unwrap_or("application/octet-stream");
347 let content_type = super::ContentType::from(content_type);
348
349 if !status.is_client_error() && !status.is_server_error() {
350 let content = resp.text().await?;
351 match content_type {
352 ContentType::Json => serde_json::from_str(&content).map_err(Error::from),
353 ContentType::Text => return Err(Error::from(serde_json::Error::custom("Received `text/plain` content type response that cannot be converted to `models::ImportedApiKey`"))),
354 ContentType::Unsupported(unknown_type) => return Err(Error::from(serde_json::Error::custom(format!("Received `{unknown_type}` content type response that cannot be converted to `models::ImportedApiKey`")))),
355 }
356 } else {
357 let content = resp.text().await?;
358 let entity: Option<AdminGetImportedApiKeyError> = serde_json::from_str(&content).ok();
359 Err(Error::ResponseError(ResponseContent { status, content, entity }))
360 }
361}
362
363pub async fn admin_get_issued_api_key(configuration: &configuration::Configuration, key_id: &str) -> Result<models::IssuedApiKey, Error<AdminGetIssuedApiKeyError>> {
365 let p_path_key_id = key_id;
367
368 let uri_str = format!("{}/v2alpha1/admin/issuedApiKeys/{key_id}", configuration.base_path, key_id=crate::apis::urlencode(p_path_key_id));
369 let mut req_builder = configuration.client.request(reqwest::Method::GET, &uri_str);
370
371 if let Some(ref user_agent) = configuration.user_agent {
372 req_builder = req_builder.header(reqwest::header::USER_AGENT, user_agent.clone());
373 }
374 if let Some(ref token) = configuration.bearer_access_token {
375 req_builder = req_builder.bearer_auth(token.to_owned());
376 };
377
378 let req = req_builder.build()?;
379 let resp = configuration.client.execute(req).await?;
380
381 let status = resp.status();
382 let content_type = resp
383 .headers()
384 .get("content-type")
385 .and_then(|v| v.to_str().ok())
386 .unwrap_or("application/octet-stream");
387 let content_type = super::ContentType::from(content_type);
388
389 if !status.is_client_error() && !status.is_server_error() {
390 let content = resp.text().await?;
391 match content_type {
392 ContentType::Json => serde_json::from_str(&content).map_err(Error::from),
393 ContentType::Text => return Err(Error::from(serde_json::Error::custom("Received `text/plain` content type response that cannot be converted to `models::IssuedApiKey`"))),
394 ContentType::Unsupported(unknown_type) => return Err(Error::from(serde_json::Error::custom(format!("Received `{unknown_type}` content type response that cannot be converted to `models::IssuedApiKey`")))),
395 }
396 } else {
397 let content = resp.text().await?;
398 let entity: Option<AdminGetIssuedApiKeyError> = serde_json::from_str(&content).ok();
399 Err(Error::ResponseError(ResponseContent { status, content, entity }))
400 }
401}
402
403pub async fn admin_import_api_key(configuration: &configuration::Configuration, import_api_key_request: models::ImportApiKeyRequest) -> Result<models::ImportedApiKey, Error<AdminImportApiKeyError>> {
405 let p_body_import_api_key_request = import_api_key_request;
407
408 let uri_str = format!("{}/v2alpha1/admin/importedApiKeys", configuration.base_path);
409 let mut req_builder = configuration.client.request(reqwest::Method::POST, &uri_str);
410
411 if let Some(ref user_agent) = configuration.user_agent {
412 req_builder = req_builder.header(reqwest::header::USER_AGENT, user_agent.clone());
413 }
414 if let Some(ref token) = configuration.bearer_access_token {
415 req_builder = req_builder.bearer_auth(token.to_owned());
416 };
417 req_builder = req_builder.json(&p_body_import_api_key_request);
418
419 let req = req_builder.build()?;
420 let resp = configuration.client.execute(req).await?;
421
422 let status = resp.status();
423 let content_type = resp
424 .headers()
425 .get("content-type")
426 .and_then(|v| v.to_str().ok())
427 .unwrap_or("application/octet-stream");
428 let content_type = super::ContentType::from(content_type);
429
430 if !status.is_client_error() && !status.is_server_error() {
431 let content = resp.text().await?;
432 match content_type {
433 ContentType::Json => serde_json::from_str(&content).map_err(Error::from),
434 ContentType::Text => return Err(Error::from(serde_json::Error::custom("Received `text/plain` content type response that cannot be converted to `models::ImportedApiKey`"))),
435 ContentType::Unsupported(unknown_type) => return Err(Error::from(serde_json::Error::custom(format!("Received `{unknown_type}` content type response that cannot be converted to `models::ImportedApiKey`")))),
436 }
437 } else {
438 let content = resp.text().await?;
439 let entity: Option<AdminImportApiKeyError> = serde_json::from_str(&content).ok();
440 Err(Error::ResponseError(ResponseContent { status, content, entity }))
441 }
442}
443
444pub async fn admin_issue_api_key(configuration: &configuration::Configuration, issue_api_key_request: models::IssueApiKeyRequest) -> Result<models::IssueApiKeyResponse, Error<AdminIssueApiKeyError>> {
446 let p_body_issue_api_key_request = issue_api_key_request;
448
449 let uri_str = format!("{}/v2alpha1/admin/issuedApiKeys", configuration.base_path);
450 let mut req_builder = configuration.client.request(reqwest::Method::POST, &uri_str);
451
452 if let Some(ref user_agent) = configuration.user_agent {
453 req_builder = req_builder.header(reqwest::header::USER_AGENT, user_agent.clone());
454 }
455 if let Some(ref token) = configuration.bearer_access_token {
456 req_builder = req_builder.bearer_auth(token.to_owned());
457 };
458 req_builder = req_builder.json(&p_body_issue_api_key_request);
459
460 let req = req_builder.build()?;
461 let resp = configuration.client.execute(req).await?;
462
463 let status = resp.status();
464 let content_type = resp
465 .headers()
466 .get("content-type")
467 .and_then(|v| v.to_str().ok())
468 .unwrap_or("application/octet-stream");
469 let content_type = super::ContentType::from(content_type);
470
471 if !status.is_client_error() && !status.is_server_error() {
472 let content = resp.text().await?;
473 match content_type {
474 ContentType::Json => serde_json::from_str(&content).map_err(Error::from),
475 ContentType::Text => return Err(Error::from(serde_json::Error::custom("Received `text/plain` content type response that cannot be converted to `models::IssueApiKeyResponse`"))),
476 ContentType::Unsupported(unknown_type) => return Err(Error::from(serde_json::Error::custom(format!("Received `{unknown_type}` content type response that cannot be converted to `models::IssueApiKeyResponse`")))),
477 }
478 } else {
479 let content = resp.text().await?;
480 let entity: Option<AdminIssueApiKeyError> = serde_json::from_str(&content).ok();
481 Err(Error::ResponseError(ResponseContent { status, content, entity }))
482 }
483}
484
485pub async fn admin_list_imported_api_keys(configuration: &configuration::Configuration, page_size: Option<i32>, page_token: Option<&str>, filter: Option<&str>) -> Result<models::ListImportedApiKeysResponse, Error<AdminListImportedApiKeysError>> {
487 let p_query_page_size = page_size;
489 let p_query_page_token = page_token;
490 let p_query_filter = filter;
491
492 let uri_str = format!("{}/v2alpha1/admin/importedApiKeys", configuration.base_path);
493 let mut req_builder = configuration.client.request(reqwest::Method::GET, &uri_str);
494
495 if let Some(ref param_value) = p_query_page_size {
496 req_builder = req_builder.query(&[("page_size", ¶m_value.to_string())]);
497 }
498 if let Some(ref param_value) = p_query_page_token {
499 req_builder = req_builder.query(&[("page_token", ¶m_value.to_string())]);
500 }
501 if let Some(ref param_value) = p_query_filter {
502 req_builder = req_builder.query(&[("filter", ¶m_value.to_string())]);
503 }
504 if let Some(ref user_agent) = configuration.user_agent {
505 req_builder = req_builder.header(reqwest::header::USER_AGENT, user_agent.clone());
506 }
507 if let Some(ref token) = configuration.bearer_access_token {
508 req_builder = req_builder.bearer_auth(token.to_owned());
509 };
510
511 let req = req_builder.build()?;
512 let resp = configuration.client.execute(req).await?;
513
514 let status = resp.status();
515 let content_type = resp
516 .headers()
517 .get("content-type")
518 .and_then(|v| v.to_str().ok())
519 .unwrap_or("application/octet-stream");
520 let content_type = super::ContentType::from(content_type);
521
522 if !status.is_client_error() && !status.is_server_error() {
523 let content = resp.text().await?;
524 match content_type {
525 ContentType::Json => serde_json::from_str(&content).map_err(Error::from),
526 ContentType::Text => return Err(Error::from(serde_json::Error::custom("Received `text/plain` content type response that cannot be converted to `models::ListImportedApiKeysResponse`"))),
527 ContentType::Unsupported(unknown_type) => return Err(Error::from(serde_json::Error::custom(format!("Received `{unknown_type}` content type response that cannot be converted to `models::ListImportedApiKeysResponse`")))),
528 }
529 } else {
530 let content = resp.text().await?;
531 let entity: Option<AdminListImportedApiKeysError> = serde_json::from_str(&content).ok();
532 Err(Error::ResponseError(ResponseContent { status, content, entity }))
533 }
534}
535
536pub async fn admin_list_issued_api_keys(configuration: &configuration::Configuration, page_size: Option<i32>, page_token: Option<&str>, filter: Option<&str>) -> Result<models::ListIssuedApiKeysResponse, Error<AdminListIssuedApiKeysError>> {
538 let p_query_page_size = page_size;
540 let p_query_page_token = page_token;
541 let p_query_filter = filter;
542
543 let uri_str = format!("{}/v2alpha1/admin/issuedApiKeys", configuration.base_path);
544 let mut req_builder = configuration.client.request(reqwest::Method::GET, &uri_str);
545
546 if let Some(ref param_value) = p_query_page_size {
547 req_builder = req_builder.query(&[("page_size", ¶m_value.to_string())]);
548 }
549 if let Some(ref param_value) = p_query_page_token {
550 req_builder = req_builder.query(&[("page_token", ¶m_value.to_string())]);
551 }
552 if let Some(ref param_value) = p_query_filter {
553 req_builder = req_builder.query(&[("filter", ¶m_value.to_string())]);
554 }
555 if let Some(ref user_agent) = configuration.user_agent {
556 req_builder = req_builder.header(reqwest::header::USER_AGENT, user_agent.clone());
557 }
558 if let Some(ref token) = configuration.bearer_access_token {
559 req_builder = req_builder.bearer_auth(token.to_owned());
560 };
561
562 let req = req_builder.build()?;
563 let resp = configuration.client.execute(req).await?;
564
565 let status = resp.status();
566 let content_type = resp
567 .headers()
568 .get("content-type")
569 .and_then(|v| v.to_str().ok())
570 .unwrap_or("application/octet-stream");
571 let content_type = super::ContentType::from(content_type);
572
573 if !status.is_client_error() && !status.is_server_error() {
574 let content = resp.text().await?;
575 match content_type {
576 ContentType::Json => serde_json::from_str(&content).map_err(Error::from),
577 ContentType::Text => return Err(Error::from(serde_json::Error::custom("Received `text/plain` content type response that cannot be converted to `models::ListIssuedApiKeysResponse`"))),
578 ContentType::Unsupported(unknown_type) => return Err(Error::from(serde_json::Error::custom(format!("Received `{unknown_type}` content type response that cannot be converted to `models::ListIssuedApiKeysResponse`")))),
579 }
580 } else {
581 let content = resp.text().await?;
582 let entity: Option<AdminListIssuedApiKeysError> = serde_json::from_str(&content).ok();
583 Err(Error::ResponseError(ResponseContent { status, content, entity }))
584 }
585}
586
587pub async fn admin_revoke_imported_api_key(configuration: &configuration::Configuration, key_id: &str, admin_revoke_imported_api_key_body: models::AdminRevokeImportedApiKeyBody) -> Result<(), Error<AdminRevokeImportedApiKeyError>> {
589 let p_path_key_id = key_id;
591 let p_body_admin_revoke_imported_api_key_body = admin_revoke_imported_api_key_body;
592
593 let uri_str = format!("{}/v2alpha1/admin/importedApiKeys/{key_id}:revoke", configuration.base_path, key_id=crate::apis::urlencode(p_path_key_id));
594 let mut req_builder = configuration.client.request(reqwest::Method::POST, &uri_str);
595
596 if let Some(ref user_agent) = configuration.user_agent {
597 req_builder = req_builder.header(reqwest::header::USER_AGENT, user_agent.clone());
598 }
599 if let Some(ref token) = configuration.bearer_access_token {
600 req_builder = req_builder.bearer_auth(token.to_owned());
601 };
602 req_builder = req_builder.json(&p_body_admin_revoke_imported_api_key_body);
603
604 let req = req_builder.build()?;
605 let resp = configuration.client.execute(req).await?;
606
607 let status = resp.status();
608
609 if !status.is_client_error() && !status.is_server_error() {
610 Ok(())
611 } else {
612 let content = resp.text().await?;
613 let entity: Option<AdminRevokeImportedApiKeyError> = serde_json::from_str(&content).ok();
614 Err(Error::ResponseError(ResponseContent { status, content, entity }))
615 }
616}
617
618pub async fn admin_revoke_issued_api_key(configuration: &configuration::Configuration, key_id: &str, admin_revoke_issued_api_key_body: models::AdminRevokeIssuedApiKeyBody) -> Result<(), Error<AdminRevokeIssuedApiKeyError>> {
620 let p_path_key_id = key_id;
622 let p_body_admin_revoke_issued_api_key_body = admin_revoke_issued_api_key_body;
623
624 let uri_str = format!("{}/v2alpha1/admin/issuedApiKeys/{key_id}:revoke", configuration.base_path, key_id=crate::apis::urlencode(p_path_key_id));
625 let mut req_builder = configuration.client.request(reqwest::Method::POST, &uri_str);
626
627 if let Some(ref user_agent) = configuration.user_agent {
628 req_builder = req_builder.header(reqwest::header::USER_AGENT, user_agent.clone());
629 }
630 if let Some(ref token) = configuration.bearer_access_token {
631 req_builder = req_builder.bearer_auth(token.to_owned());
632 };
633 req_builder = req_builder.json(&p_body_admin_revoke_issued_api_key_body);
634
635 let req = req_builder.build()?;
636 let resp = configuration.client.execute(req).await?;
637
638 let status = resp.status();
639
640 if !status.is_client_error() && !status.is_server_error() {
641 Ok(())
642 } else {
643 let content = resp.text().await?;
644 let entity: Option<AdminRevokeIssuedApiKeyError> = serde_json::from_str(&content).ok();
645 Err(Error::ResponseError(ResponseContent { status, content, entity }))
646 }
647}
648
649pub async fn admin_rotate_issued_api_key(configuration: &configuration::Configuration, key_id: &str, admin_rotate_issued_api_key_body: models::AdminRotateIssuedApiKeyBody) -> Result<models::RotateIssuedApiKeyResponse, Error<AdminRotateIssuedApiKeyError>> {
651 let p_path_key_id = key_id;
653 let p_body_admin_rotate_issued_api_key_body = admin_rotate_issued_api_key_body;
654
655 let uri_str = format!("{}/v2alpha1/admin/issuedApiKeys/{key_id}:rotate", configuration.base_path, key_id=crate::apis::urlencode(p_path_key_id));
656 let mut req_builder = configuration.client.request(reqwest::Method::POST, &uri_str);
657
658 if let Some(ref user_agent) = configuration.user_agent {
659 req_builder = req_builder.header(reqwest::header::USER_AGENT, user_agent.clone());
660 }
661 if let Some(ref token) = configuration.bearer_access_token {
662 req_builder = req_builder.bearer_auth(token.to_owned());
663 };
664 req_builder = req_builder.json(&p_body_admin_rotate_issued_api_key_body);
665
666 let req = req_builder.build()?;
667 let resp = configuration.client.execute(req).await?;
668
669 let status = resp.status();
670 let content_type = resp
671 .headers()
672 .get("content-type")
673 .and_then(|v| v.to_str().ok())
674 .unwrap_or("application/octet-stream");
675 let content_type = super::ContentType::from(content_type);
676
677 if !status.is_client_error() && !status.is_server_error() {
678 let content = resp.text().await?;
679 match content_type {
680 ContentType::Json => serde_json::from_str(&content).map_err(Error::from),
681 ContentType::Text => return Err(Error::from(serde_json::Error::custom("Received `text/plain` content type response that cannot be converted to `models::RotateIssuedApiKeyResponse`"))),
682 ContentType::Unsupported(unknown_type) => return Err(Error::from(serde_json::Error::custom(format!("Received `{unknown_type}` content type response that cannot be converted to `models::RotateIssuedApiKeyResponse`")))),
683 }
684 } else {
685 let content = resp.text().await?;
686 let entity: Option<AdminRotateIssuedApiKeyError> = serde_json::from_str(&content).ok();
687 Err(Error::ResponseError(ResponseContent { status, content, entity }))
688 }
689}
690
691pub async fn admin_update_imported_api_key(configuration: &configuration::Configuration, key_id: &str, admin_update_imported_api_key_request: models::AdminUpdateImportedApiKeyRequest, update_mask: Option<&str>) -> Result<models::ImportedApiKey, Error<AdminUpdateImportedApiKeyError>> {
693 let p_path_key_id = key_id;
695 let p_body_admin_update_imported_api_key_request = admin_update_imported_api_key_request;
696 let p_query_update_mask = update_mask;
697
698 let uri_str = format!("{}/v2alpha1/admin/importedApiKeys/{key_id}", configuration.base_path, key_id=crate::apis::urlencode(p_path_key_id));
699 let mut req_builder = configuration.client.request(reqwest::Method::PATCH, &uri_str);
700
701 if let Some(ref param_value) = p_query_update_mask {
702 req_builder = req_builder.query(&[("update_mask", ¶m_value.to_string())]);
703 }
704 if let Some(ref user_agent) = configuration.user_agent {
705 req_builder = req_builder.header(reqwest::header::USER_AGENT, user_agent.clone());
706 }
707 if let Some(ref token) = configuration.bearer_access_token {
708 req_builder = req_builder.bearer_auth(token.to_owned());
709 };
710 req_builder = req_builder.json(&p_body_admin_update_imported_api_key_request);
711
712 let req = req_builder.build()?;
713 let resp = configuration.client.execute(req).await?;
714
715 let status = resp.status();
716 let content_type = resp
717 .headers()
718 .get("content-type")
719 .and_then(|v| v.to_str().ok())
720 .unwrap_or("application/octet-stream");
721 let content_type = super::ContentType::from(content_type);
722
723 if !status.is_client_error() && !status.is_server_error() {
724 let content = resp.text().await?;
725 match content_type {
726 ContentType::Json => serde_json::from_str(&content).map_err(Error::from),
727 ContentType::Text => return Err(Error::from(serde_json::Error::custom("Received `text/plain` content type response that cannot be converted to `models::ImportedApiKey`"))),
728 ContentType::Unsupported(unknown_type) => return Err(Error::from(serde_json::Error::custom(format!("Received `{unknown_type}` content type response that cannot be converted to `models::ImportedApiKey`")))),
729 }
730 } else {
731 let content = resp.text().await?;
732 let entity: Option<AdminUpdateImportedApiKeyError> = serde_json::from_str(&content).ok();
733 Err(Error::ResponseError(ResponseContent { status, content, entity }))
734 }
735}
736
737pub async fn admin_update_issued_api_key(configuration: &configuration::Configuration, key_id: &str, admin_update_issued_api_key_request: models::AdminUpdateIssuedApiKeyRequest, update_mask: Option<&str>) -> Result<models::IssuedApiKey, Error<AdminUpdateIssuedApiKeyError>> {
739 let p_path_key_id = key_id;
741 let p_body_admin_update_issued_api_key_request = admin_update_issued_api_key_request;
742 let p_query_update_mask = update_mask;
743
744 let uri_str = format!("{}/v2alpha1/admin/issuedApiKeys/{key_id}", configuration.base_path, key_id=crate::apis::urlencode(p_path_key_id));
745 let mut req_builder = configuration.client.request(reqwest::Method::PATCH, &uri_str);
746
747 if let Some(ref param_value) = p_query_update_mask {
748 req_builder = req_builder.query(&[("update_mask", ¶m_value.to_string())]);
749 }
750 if let Some(ref user_agent) = configuration.user_agent {
751 req_builder = req_builder.header(reqwest::header::USER_AGENT, user_agent.clone());
752 }
753 if let Some(ref token) = configuration.bearer_access_token {
754 req_builder = req_builder.bearer_auth(token.to_owned());
755 };
756 req_builder = req_builder.json(&p_body_admin_update_issued_api_key_request);
757
758 let req = req_builder.build()?;
759 let resp = configuration.client.execute(req).await?;
760
761 let status = resp.status();
762 let content_type = resp
763 .headers()
764 .get("content-type")
765 .and_then(|v| v.to_str().ok())
766 .unwrap_or("application/octet-stream");
767 let content_type = super::ContentType::from(content_type);
768
769 if !status.is_client_error() && !status.is_server_error() {
770 let content = resp.text().await?;
771 match content_type {
772 ContentType::Json => serde_json::from_str(&content).map_err(Error::from),
773 ContentType::Text => return Err(Error::from(serde_json::Error::custom("Received `text/plain` content type response that cannot be converted to `models::IssuedApiKey`"))),
774 ContentType::Unsupported(unknown_type) => return Err(Error::from(serde_json::Error::custom(format!("Received `{unknown_type}` content type response that cannot be converted to `models::IssuedApiKey`")))),
775 }
776 } else {
777 let content = resp.text().await?;
778 let entity: Option<AdminUpdateIssuedApiKeyError> = serde_json::from_str(&content).ok();
779 Err(Error::ResponseError(ResponseContent { status, content, entity }))
780 }
781}
782
783pub async fn admin_verify_api_key(configuration: &configuration::Configuration, verify_api_key_request: models::VerifyApiKeyRequest, cache_control: Option<&str>, pragma: Option<&str>) -> Result<models::VerifyApiKeyResponse, Error<AdminVerifyApiKeyError>> {
785 let p_body_verify_api_key_request = verify_api_key_request;
787 let p_header_cache_control = cache_control;
788 let p_header_pragma = pragma;
789
790 let uri_str = format!("{}/v2alpha1/admin/apiKeys:verify", configuration.base_path);
791 let mut req_builder = configuration.client.request(reqwest::Method::POST, &uri_str);
792
793 if let Some(ref user_agent) = configuration.user_agent {
794 req_builder = req_builder.header(reqwest::header::USER_AGENT, user_agent.clone());
795 }
796 if let Some(param_value) = p_header_cache_control {
797 req_builder = req_builder.header("Cache-Control", param_value.to_string());
798 }
799 if let Some(param_value) = p_header_pragma {
800 req_builder = req_builder.header("Pragma", param_value.to_string());
801 }
802 if let Some(ref token) = configuration.bearer_access_token {
803 req_builder = req_builder.bearer_auth(token.to_owned());
804 };
805 req_builder = req_builder.json(&p_body_verify_api_key_request);
806
807 let req = req_builder.build()?;
808 let resp = configuration.client.execute(req).await?;
809
810 let status = resp.status();
811 let content_type = resp
812 .headers()
813 .get("content-type")
814 .and_then(|v| v.to_str().ok())
815 .unwrap_or("application/octet-stream");
816 let content_type = super::ContentType::from(content_type);
817
818 if !status.is_client_error() && !status.is_server_error() {
819 let content = resp.text().await?;
820 match content_type {
821 ContentType::Json => serde_json::from_str(&content).map_err(Error::from),
822 ContentType::Text => return Err(Error::from(serde_json::Error::custom("Received `text/plain` content type response that cannot be converted to `models::VerifyApiKeyResponse`"))),
823 ContentType::Unsupported(unknown_type) => return Err(Error::from(serde_json::Error::custom(format!("Received `{unknown_type}` content type response that cannot be converted to `models::VerifyApiKeyResponse`")))),
824 }
825 } else {
826 let content = resp.text().await?;
827 let entity: Option<AdminVerifyApiKeyError> = serde_json::from_str(&content).ok();
828 Err(Error::ResponseError(ResponseContent { status, content, entity }))
829 }
830}
831
832pub async fn get_jwks(configuration: &configuration::Configuration, ) -> Result<models::GetJwksResponse, Error<GetJwksError>> {
834
835 let uri_str = format!("{}/v2alpha1/derivedKeys/jwks.json", configuration.base_path);
836 let mut req_builder = configuration.client.request(reqwest::Method::GET, &uri_str);
837
838 if let Some(ref user_agent) = configuration.user_agent {
839 req_builder = req_builder.header(reqwest::header::USER_AGENT, user_agent.clone());
840 }
841
842 let req = req_builder.build()?;
843 let resp = configuration.client.execute(req).await?;
844
845 let status = resp.status();
846 let content_type = resp
847 .headers()
848 .get("content-type")
849 .and_then(|v| v.to_str().ok())
850 .unwrap_or("application/octet-stream");
851 let content_type = super::ContentType::from(content_type);
852
853 if !status.is_client_error() && !status.is_server_error() {
854 let content = resp.text().await?;
855 match content_type {
856 ContentType::Json => serde_json::from_str(&content).map_err(Error::from),
857 ContentType::Text => return Err(Error::from(serde_json::Error::custom("Received `text/plain` content type response that cannot be converted to `models::GetJwksResponse`"))),
858 ContentType::Unsupported(unknown_type) => return Err(Error::from(serde_json::Error::custom(format!("Received `{unknown_type}` content type response that cannot be converted to `models::GetJwksResponse`")))),
859 }
860 } else {
861 let content = resp.text().await?;
862 let entity: Option<GetJwksError> = serde_json::from_str(&content).ok();
863 Err(Error::ResponseError(ResponseContent { status, content, entity }))
864 }
865}
866
867pub async fn revoke_api_key(configuration: &configuration::Configuration, self_revoke_api_key_request: models::SelfRevokeApiKeyRequest) -> Result<serde_json::Value, Error<RevokeApiKeyError>> {
869 let p_body_self_revoke_api_key_request = self_revoke_api_key_request;
871
872 let uri_str = format!("{}/v2alpha1/apiKeys:selfRevoke", configuration.base_path);
873 let mut req_builder = configuration.client.request(reqwest::Method::POST, &uri_str);
874
875 if let Some(ref user_agent) = configuration.user_agent {
876 req_builder = req_builder.header(reqwest::header::USER_AGENT, user_agent.clone());
877 }
878 req_builder = req_builder.json(&p_body_self_revoke_api_key_request);
879
880 let req = req_builder.build()?;
881 let resp = configuration.client.execute(req).await?;
882
883 let status = resp.status();
884 let content_type = resp
885 .headers()
886 .get("content-type")
887 .and_then(|v| v.to_str().ok())
888 .unwrap_or("application/octet-stream");
889 let content_type = super::ContentType::from(content_type);
890
891 if !status.is_client_error() && !status.is_server_error() {
892 let content = resp.text().await?;
893 match content_type {
894 ContentType::Json => serde_json::from_str(&content).map_err(Error::from),
895 ContentType::Text => return Err(Error::from(serde_json::Error::custom("Received `text/plain` content type response that cannot be converted to `serde_json::Value`"))),
896 ContentType::Unsupported(unknown_type) => return Err(Error::from(serde_json::Error::custom(format!("Received `{unknown_type}` content type response that cannot be converted to `serde_json::Value`")))),
897 }
898 } else {
899 let content = resp.text().await?;
900 let entity: Option<RevokeApiKeyError> = serde_json::from_str(&content).ok();
901 Err(Error::ResponseError(ResponseContent { status, content, entity }))
902 }
903}
904