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 AcceptInviteError {
22 UnknownValue(serde_json::Value),
23}
24
25#[derive(Debug, Clone, Serialize, Deserialize)]
27#[serde(untagged)]
28pub enum ConvertUserToGroupError {
29 UnknownValue(serde_json::Value),
30}
31
32#[derive(Debug, Clone, Serialize, Deserialize)]
34#[serde(untagged)]
35pub enum CreateTokenError {
36 UnknownValue(serde_json::Value),
37}
38
39#[derive(Debug, Clone, Serialize, Deserialize)]
41#[serde(untagged)]
42pub enum CreateTokenImpersonateError {
43 UnknownValue(serde_json::Value),
44}
45
46#[derive(Debug, Clone, Serialize, Deserialize)]
48#[serde(untagged)]
49pub enum CreateUserGloballyError {
50 UnknownValue(serde_json::Value),
51}
52
53#[derive(Debug, Clone, Serialize, Deserialize)]
55#[serde(untagged)]
56pub enum DeclineInviteError {
57 UnknownValue(serde_json::Value),
58}
59
60#[derive(Debug, Clone, Serialize, Deserialize)]
62#[serde(untagged)]
63pub enum DeleteTokenError {
64 UnknownValue(serde_json::Value),
65}
66
67#[derive(Debug, Clone, Serialize, Deserialize)]
69#[serde(untagged)]
70pub enum DeleteUserError {
71 UnknownValue(serde_json::Value),
72}
73
74#[derive(Debug, Clone, Serialize, Deserialize)]
76#[serde(untagged)]
77pub enum ExistsEmailError {
78 UnknownValue(serde_json::Value),
79}
80
81#[derive(Debug, Clone, Serialize, Deserialize)]
83#[serde(untagged)]
84pub enum GetCurrentEmailError {
85 UnknownValue(serde_json::Value),
86}
87
88#[derive(Debug, Clone, Serialize, Deserialize)]
90#[serde(untagged)]
91pub enum GetRunnableError {
92 UnknownValue(serde_json::Value),
93}
94
95#[derive(Debug, Clone, Serialize, Deserialize)]
97#[serde(untagged)]
98pub enum GetTutorialProgressError {
99 UnknownValue(serde_json::Value),
100}
101
102#[derive(Debug, Clone, Serialize, Deserialize)]
104#[serde(untagged)]
105pub enum GetUsageError {
106 UnknownValue(serde_json::Value),
107}
108
109#[derive(Debug, Clone, Serialize, Deserialize)]
111#[serde(untagged)]
112pub enum GetUserError {
113 UnknownValue(serde_json::Value),
114}
115
116#[derive(Debug, Clone, Serialize, Deserialize)]
118#[serde(untagged)]
119pub enum GlobalUserDeleteError {
120 UnknownValue(serde_json::Value),
121}
122
123#[derive(Debug, Clone, Serialize, Deserialize)]
125#[serde(untagged)]
126pub enum GlobalUserRenameError {
127 UnknownValue(serde_json::Value),
128}
129
130#[derive(Debug, Clone, Serialize, Deserialize)]
132#[serde(untagged)]
133pub enum GlobalUserUpdateError {
134 UnknownValue(serde_json::Value),
135}
136
137#[derive(Debug, Clone, Serialize, Deserialize)]
139#[serde(untagged)]
140pub enum GlobalUsernameInfoError {
141 UnknownValue(serde_json::Value),
142}
143
144#[derive(Debug, Clone, Serialize, Deserialize)]
146#[serde(untagged)]
147pub enum GlobalUsersExportError {
148 UnknownValue(serde_json::Value),
149}
150
151#[derive(Debug, Clone, Serialize, Deserialize)]
153#[serde(untagged)]
154pub enum GlobalUsersOverwriteError {
155 UnknownValue(serde_json::Value),
156}
157
158#[derive(Debug, Clone, Serialize, Deserialize)]
160#[serde(untagged)]
161pub enum GlobalWhoamiError {
162 UnknownValue(serde_json::Value),
163}
164
165#[derive(Debug, Clone, Serialize, Deserialize)]
167#[serde(untagged)]
168pub enum IsOwnerOfPathError {
169 UnknownValue(serde_json::Value),
170}
171
172#[derive(Debug, Clone, Serialize, Deserialize)]
174#[serde(untagged)]
175pub enum LeaveInstanceError {
176 UnknownValue(serde_json::Value),
177}
178
179#[derive(Debug, Clone, Serialize, Deserialize)]
181#[serde(untagged)]
182pub enum ListTokensError {
183 UnknownValue(serde_json::Value),
184}
185
186#[derive(Debug, Clone, Serialize, Deserialize)]
188#[serde(untagged)]
189pub enum ListUsernamesError {
190 UnknownValue(serde_json::Value),
191}
192
193#[derive(Debug, Clone, Serialize, Deserialize)]
195#[serde(untagged)]
196pub enum ListUsersError {
197 UnknownValue(serde_json::Value),
198}
199
200#[derive(Debug, Clone, Serialize, Deserialize)]
202#[serde(untagged)]
203pub enum ListUsersAsSuperAdminError {
204 UnknownValue(serde_json::Value),
205}
206
207#[derive(Debug, Clone, Serialize, Deserialize)]
209#[serde(untagged)]
210pub enum ListUsersUsageError {
211 UnknownValue(serde_json::Value),
212}
213
214#[derive(Debug, Clone, Serialize, Deserialize)]
216#[serde(untagged)]
217pub enum ListWorkspaceInvitesError {
218 UnknownValue(serde_json::Value),
219}
220
221#[derive(Debug, Clone, Serialize, Deserialize)]
223#[serde(untagged)]
224pub enum LoginError {
225 UnknownValue(serde_json::Value),
226}
227
228#[derive(Debug, Clone, Serialize, Deserialize)]
230#[serde(untagged)]
231pub enum LoginWithOauthError {
232 UnknownValue(serde_json::Value),
233}
234
235#[derive(Debug, Clone, Serialize, Deserialize)]
237#[serde(untagged)]
238pub enum LogoutError {
239 UnknownValue(serde_json::Value),
240}
241
242#[derive(Debug, Clone, Serialize, Deserialize)]
244#[serde(untagged)]
245pub enum RefreshUserTokenError {
246 UnknownValue(serde_json::Value),
247}
248
249#[derive(Debug, Clone, Serialize, Deserialize)]
251#[serde(untagged)]
252pub enum SetLoginTypeForUserError {
253 UnknownValue(serde_json::Value),
254}
255
256#[derive(Debug, Clone, Serialize, Deserialize)]
258#[serde(untagged)]
259pub enum SetPasswordError {
260 UnknownValue(serde_json::Value),
261}
262
263#[derive(Debug, Clone, Serialize, Deserialize)]
265#[serde(untagged)]
266pub enum SetPasswordForUserError {
267 UnknownValue(serde_json::Value),
268}
269
270#[derive(Debug, Clone, Serialize, Deserialize)]
272#[serde(untagged)]
273pub enum UpdateTutorialProgressError {
274 UnknownValue(serde_json::Value),
275}
276
277#[derive(Debug, Clone, Serialize, Deserialize)]
279#[serde(untagged)]
280pub enum UpdateUserError {
281 UnknownValue(serde_json::Value),
282}
283
284#[derive(Debug, Clone, Serialize, Deserialize)]
286#[serde(untagged)]
287pub enum UsernameToEmailError {
288 UnknownValue(serde_json::Value),
289}
290
291#[derive(Debug, Clone, Serialize, Deserialize)]
293#[serde(untagged)]
294pub enum WhoamiError {
295 UnknownValue(serde_json::Value),
296}
297
298#[derive(Debug, Clone, Serialize, Deserialize)]
300#[serde(untagged)]
301pub enum WhoisError {
302 UnknownValue(serde_json::Value),
303}
304
305
306pub async fn accept_invite(configuration: &configuration::Configuration, accept_invite_request: models::AcceptInviteRequest) -> Result<String, Error<AcceptInviteError>> {
307 let local_var_configuration = configuration;
308
309 let local_var_client = &local_var_configuration.client;
310
311 let local_var_uri_str = format!("{}/users/accept_invite", local_var_configuration.base_path);
312 let mut local_var_req_builder = local_var_client.request(reqwest::Method::POST, local_var_uri_str.as_str());
313
314 if let Some(ref local_var_user_agent) = local_var_configuration.user_agent {
315 local_var_req_builder = local_var_req_builder.header(reqwest::header::USER_AGENT, local_var_user_agent.clone());
316 }
317 if let Some(ref local_var_token) = local_var_configuration.bearer_access_token {
318 local_var_req_builder = local_var_req_builder.bearer_auth(local_var_token.to_owned());
319 };
320 local_var_req_builder = local_var_req_builder.json(&accept_invite_request);
321
322 let local_var_req = local_var_req_builder.build()?;
323 let local_var_resp = local_var_client.execute(local_var_req).await?;
324
325 let local_var_status = local_var_resp.status();
326 let local_var_content = local_var_resp.text().await?;
327
328 if !local_var_status.is_client_error() && !local_var_status.is_server_error() {
329 crate::from_str_patched(&local_var_content).map_err(Error::from)
330 } else {
331 let local_var_entity: Option<AcceptInviteError> = crate::from_str_patched(&local_var_content).ok();
332 let local_var_error = ResponseContent { status: local_var_status, content: local_var_content, entity: local_var_entity };
333 Err(Error::ResponseError(local_var_error))
334 }
335}
336
337pub async fn convert_user_to_group(configuration: &configuration::Configuration, workspace: &str, username: &str) -> Result<String, Error<ConvertUserToGroupError>> {
338 let local_var_configuration = configuration;
339
340 let local_var_client = &local_var_configuration.client;
341
342 let local_var_uri_str = format!("{}/w/{workspace}/users/convert_to_group/{username}", local_var_configuration.base_path, workspace=crate::apis::urlencode(workspace), username=crate::apis::urlencode(username));
343 let mut local_var_req_builder = local_var_client.request(reqwest::Method::POST, local_var_uri_str.as_str());
344
345 if let Some(ref local_var_user_agent) = local_var_configuration.user_agent {
346 local_var_req_builder = local_var_req_builder.header(reqwest::header::USER_AGENT, local_var_user_agent.clone());
347 }
348 if let Some(ref local_var_token) = local_var_configuration.bearer_access_token {
349 local_var_req_builder = local_var_req_builder.bearer_auth(local_var_token.to_owned());
350 };
351
352 let local_var_req = local_var_req_builder.build()?;
353 let local_var_resp = local_var_client.execute(local_var_req).await?;
354
355 let local_var_status = local_var_resp.status();
356 let local_var_content = local_var_resp.text().await?;
357
358 if !local_var_status.is_client_error() && !local_var_status.is_server_error() {
359 crate::from_str_patched(&local_var_content).map_err(Error::from)
360 } else {
361 let local_var_entity: Option<ConvertUserToGroupError> = crate::from_str_patched(&local_var_content).ok();
362 let local_var_error = ResponseContent { status: local_var_status, content: local_var_content, entity: local_var_entity };
363 Err(Error::ResponseError(local_var_error))
364 }
365}
366
367pub async fn create_token(configuration: &configuration::Configuration, new_token: models::NewToken) -> Result<String, Error<CreateTokenError>> {
368 let local_var_configuration = configuration;
369
370 let local_var_client = &local_var_configuration.client;
371
372 let local_var_uri_str = format!("{}/users/tokens/create", local_var_configuration.base_path);
373 let mut local_var_req_builder = local_var_client.request(reqwest::Method::POST, local_var_uri_str.as_str());
374
375 if let Some(ref local_var_user_agent) = local_var_configuration.user_agent {
376 local_var_req_builder = local_var_req_builder.header(reqwest::header::USER_AGENT, local_var_user_agent.clone());
377 }
378 if let Some(ref local_var_token) = local_var_configuration.bearer_access_token {
379 local_var_req_builder = local_var_req_builder.bearer_auth(local_var_token.to_owned());
380 };
381 local_var_req_builder = local_var_req_builder.json(&new_token);
382
383 let local_var_req = local_var_req_builder.build()?;
384 let local_var_resp = local_var_client.execute(local_var_req).await?;
385
386 let local_var_status = local_var_resp.status();
387 let local_var_content = local_var_resp.text().await?;
388
389 if !local_var_status.is_client_error() && !local_var_status.is_server_error() {
390 crate::from_str_patched(&local_var_content).map_err(Error::from)
391 } else {
392 let local_var_entity: Option<CreateTokenError> = crate::from_str_patched(&local_var_content).ok();
393 let local_var_error = ResponseContent { status: local_var_status, content: local_var_content, entity: local_var_entity };
394 Err(Error::ResponseError(local_var_error))
395 }
396}
397
398pub async fn create_token_impersonate(configuration: &configuration::Configuration, new_token_impersonate: models::NewTokenImpersonate) -> Result<String, Error<CreateTokenImpersonateError>> {
399 let local_var_configuration = configuration;
400
401 let local_var_client = &local_var_configuration.client;
402
403 let local_var_uri_str = format!("{}/users/tokens/impersonate", local_var_configuration.base_path);
404 let mut local_var_req_builder = local_var_client.request(reqwest::Method::POST, local_var_uri_str.as_str());
405
406 if let Some(ref local_var_user_agent) = local_var_configuration.user_agent {
407 local_var_req_builder = local_var_req_builder.header(reqwest::header::USER_AGENT, local_var_user_agent.clone());
408 }
409 if let Some(ref local_var_token) = local_var_configuration.bearer_access_token {
410 local_var_req_builder = local_var_req_builder.bearer_auth(local_var_token.to_owned());
411 };
412 local_var_req_builder = local_var_req_builder.json(&new_token_impersonate);
413
414 let local_var_req = local_var_req_builder.build()?;
415 let local_var_resp = local_var_client.execute(local_var_req).await?;
416
417 let local_var_status = local_var_resp.status();
418 let local_var_content = local_var_resp.text().await?;
419
420 if !local_var_status.is_client_error() && !local_var_status.is_server_error() {
421 crate::from_str_patched(&local_var_content).map_err(Error::from)
422 } else {
423 let local_var_entity: Option<CreateTokenImpersonateError> = crate::from_str_patched(&local_var_content).ok();
424 let local_var_error = ResponseContent { status: local_var_status, content: local_var_content, entity: local_var_entity };
425 Err(Error::ResponseError(local_var_error))
426 }
427}
428
429pub async fn create_user_globally(configuration: &configuration::Configuration, create_user_globally_request: models::CreateUserGloballyRequest) -> Result<String, Error<CreateUserGloballyError>> {
430 let local_var_configuration = configuration;
431
432 let local_var_client = &local_var_configuration.client;
433
434 let local_var_uri_str = format!("{}/users/create", local_var_configuration.base_path);
435 let mut local_var_req_builder = local_var_client.request(reqwest::Method::POST, local_var_uri_str.as_str());
436
437 if let Some(ref local_var_user_agent) = local_var_configuration.user_agent {
438 local_var_req_builder = local_var_req_builder.header(reqwest::header::USER_AGENT, local_var_user_agent.clone());
439 }
440 if let Some(ref local_var_token) = local_var_configuration.bearer_access_token {
441 local_var_req_builder = local_var_req_builder.bearer_auth(local_var_token.to_owned());
442 };
443 local_var_req_builder = local_var_req_builder.json(&create_user_globally_request);
444
445 let local_var_req = local_var_req_builder.build()?;
446 let local_var_resp = local_var_client.execute(local_var_req).await?;
447
448 let local_var_status = local_var_resp.status();
449 let local_var_content = local_var_resp.text().await?;
450
451 if !local_var_status.is_client_error() && !local_var_status.is_server_error() {
452 crate::from_str_patched(&local_var_content).map_err(Error::from)
453 } else {
454 let local_var_entity: Option<CreateUserGloballyError> = crate::from_str_patched(&local_var_content).ok();
455 let local_var_error = ResponseContent { status: local_var_status, content: local_var_content, entity: local_var_entity };
456 Err(Error::ResponseError(local_var_error))
457 }
458}
459
460pub async fn decline_invite(configuration: &configuration::Configuration, decline_invite_request: models::DeclineInviteRequest) -> Result<String, Error<DeclineInviteError>> {
461 let local_var_configuration = configuration;
462
463 let local_var_client = &local_var_configuration.client;
464
465 let local_var_uri_str = format!("{}/users/decline_invite", local_var_configuration.base_path);
466 let mut local_var_req_builder = local_var_client.request(reqwest::Method::POST, local_var_uri_str.as_str());
467
468 if let Some(ref local_var_user_agent) = local_var_configuration.user_agent {
469 local_var_req_builder = local_var_req_builder.header(reqwest::header::USER_AGENT, local_var_user_agent.clone());
470 }
471 if let Some(ref local_var_token) = local_var_configuration.bearer_access_token {
472 local_var_req_builder = local_var_req_builder.bearer_auth(local_var_token.to_owned());
473 };
474 local_var_req_builder = local_var_req_builder.json(&decline_invite_request);
475
476 let local_var_req = local_var_req_builder.build()?;
477 let local_var_resp = local_var_client.execute(local_var_req).await?;
478
479 let local_var_status = local_var_resp.status();
480 let local_var_content = local_var_resp.text().await?;
481
482 if !local_var_status.is_client_error() && !local_var_status.is_server_error() {
483 crate::from_str_patched(&local_var_content).map_err(Error::from)
484 } else {
485 let local_var_entity: Option<DeclineInviteError> = crate::from_str_patched(&local_var_content).ok();
486 let local_var_error = ResponseContent { status: local_var_status, content: local_var_content, entity: local_var_entity };
487 Err(Error::ResponseError(local_var_error))
488 }
489}
490
491pub async fn delete_token(configuration: &configuration::Configuration, token_prefix: &str) -> Result<String, Error<DeleteTokenError>> {
492 let local_var_configuration = configuration;
493
494 let local_var_client = &local_var_configuration.client;
495
496 let local_var_uri_str = format!("{}/users/tokens/delete/{token_prefix}", local_var_configuration.base_path, token_prefix=crate::apis::urlencode(token_prefix));
497 let mut local_var_req_builder = local_var_client.request(reqwest::Method::DELETE, local_var_uri_str.as_str());
498
499 if let Some(ref local_var_user_agent) = local_var_configuration.user_agent {
500 local_var_req_builder = local_var_req_builder.header(reqwest::header::USER_AGENT, local_var_user_agent.clone());
501 }
502 if let Some(ref local_var_token) = local_var_configuration.bearer_access_token {
503 local_var_req_builder = local_var_req_builder.bearer_auth(local_var_token.to_owned());
504 };
505
506 let local_var_req = local_var_req_builder.build()?;
507 let local_var_resp = local_var_client.execute(local_var_req).await?;
508
509 let local_var_status = local_var_resp.status();
510 let local_var_content = local_var_resp.text().await?;
511
512 if !local_var_status.is_client_error() && !local_var_status.is_server_error() {
513 crate::from_str_patched(&local_var_content).map_err(Error::from)
514 } else {
515 let local_var_entity: Option<DeleteTokenError> = crate::from_str_patched(&local_var_content).ok();
516 let local_var_error = ResponseContent { status: local_var_status, content: local_var_content, entity: local_var_entity };
517 Err(Error::ResponseError(local_var_error))
518 }
519}
520
521pub async fn delete_user(configuration: &configuration::Configuration, workspace: &str, username: &str) -> Result<String, Error<DeleteUserError>> {
522 let local_var_configuration = configuration;
523
524 let local_var_client = &local_var_configuration.client;
525
526 let local_var_uri_str = format!("{}/w/{workspace}/users/delete/{username}", local_var_configuration.base_path, workspace=crate::apis::urlencode(workspace), username=crate::apis::urlencode(username));
527 let mut local_var_req_builder = local_var_client.request(reqwest::Method::DELETE, local_var_uri_str.as_str());
528
529 if let Some(ref local_var_user_agent) = local_var_configuration.user_agent {
530 local_var_req_builder = local_var_req_builder.header(reqwest::header::USER_AGENT, local_var_user_agent.clone());
531 }
532 if let Some(ref local_var_token) = local_var_configuration.bearer_access_token {
533 local_var_req_builder = local_var_req_builder.bearer_auth(local_var_token.to_owned());
534 };
535
536 let local_var_req = local_var_req_builder.build()?;
537 let local_var_resp = local_var_client.execute(local_var_req).await?;
538
539 let local_var_status = local_var_resp.status();
540 let local_var_content = local_var_resp.text().await?;
541
542 if !local_var_status.is_client_error() && !local_var_status.is_server_error() {
543 crate::from_str_patched(&local_var_content).map_err(Error::from)
544 } else {
545 let local_var_entity: Option<DeleteUserError> = crate::from_str_patched(&local_var_content).ok();
546 let local_var_error = ResponseContent { status: local_var_status, content: local_var_content, entity: local_var_entity };
547 Err(Error::ResponseError(local_var_error))
548 }
549}
550
551pub async fn exists_email(configuration: &configuration::Configuration, email: &str) -> Result<bool, Error<ExistsEmailError>> {
552 let local_var_configuration = configuration;
553
554 let local_var_client = &local_var_configuration.client;
555
556 let local_var_uri_str = format!("{}/users/exists/{email}", local_var_configuration.base_path, email=crate::apis::urlencode(email));
557 let mut local_var_req_builder = local_var_client.request(reqwest::Method::GET, local_var_uri_str.as_str());
558
559 if let Some(ref local_var_user_agent) = local_var_configuration.user_agent {
560 local_var_req_builder = local_var_req_builder.header(reqwest::header::USER_AGENT, local_var_user_agent.clone());
561 }
562 if let Some(ref local_var_token) = local_var_configuration.bearer_access_token {
563 local_var_req_builder = local_var_req_builder.bearer_auth(local_var_token.to_owned());
564 };
565
566 let local_var_req = local_var_req_builder.build()?;
567 let local_var_resp = local_var_client.execute(local_var_req).await?;
568
569 let local_var_status = local_var_resp.status();
570 let local_var_content = local_var_resp.text().await?;
571
572 if !local_var_status.is_client_error() && !local_var_status.is_server_error() {
573 crate::from_str_patched(&local_var_content).map_err(Error::from)
574 } else {
575 let local_var_entity: Option<ExistsEmailError> = crate::from_str_patched(&local_var_content).ok();
576 let local_var_error = ResponseContent { status: local_var_status, content: local_var_content, entity: local_var_entity };
577 Err(Error::ResponseError(local_var_error))
578 }
579}
580
581pub async fn get_current_email(configuration: &configuration::Configuration, ) -> Result<String, Error<GetCurrentEmailError>> {
582 let local_var_configuration = configuration;
583
584 let local_var_client = &local_var_configuration.client;
585
586 let local_var_uri_str = format!("{}/users/email", local_var_configuration.base_path);
587 let mut local_var_req_builder = local_var_client.request(reqwest::Method::GET, local_var_uri_str.as_str());
588
589 if let Some(ref local_var_user_agent) = local_var_configuration.user_agent {
590 local_var_req_builder = local_var_req_builder.header(reqwest::header::USER_AGENT, local_var_user_agent.clone());
591 }
592 if let Some(ref local_var_token) = local_var_configuration.bearer_access_token {
593 local_var_req_builder = local_var_req_builder.bearer_auth(local_var_token.to_owned());
594 };
595
596 let local_var_req = local_var_req_builder.build()?;
597 let local_var_resp = local_var_client.execute(local_var_req).await?;
598
599 let local_var_status = local_var_resp.status();
600 let local_var_content = local_var_resp.text().await?;
601
602 if !local_var_status.is_client_error() && !local_var_status.is_server_error() {
603 crate::from_str_patched(&local_var_content).map_err(Error::from)
604 } else {
605 let local_var_entity: Option<GetCurrentEmailError> = crate::from_str_patched(&local_var_content).ok();
606 let local_var_error = ResponseContent { status: local_var_status, content: local_var_content, entity: local_var_entity };
607 Err(Error::ResponseError(local_var_error))
608 }
609}
610
611pub async fn get_runnable(configuration: &configuration::Configuration, ) -> Result<models::GetRunnable200Response, Error<GetRunnableError>> {
612 let local_var_configuration = configuration;
613
614 let local_var_client = &local_var_configuration.client;
615
616 let local_var_uri_str = format!("{}/users/all_runnables", local_var_configuration.base_path);
617 let mut local_var_req_builder = local_var_client.request(reqwest::Method::GET, local_var_uri_str.as_str());
618
619 if let Some(ref local_var_user_agent) = local_var_configuration.user_agent {
620 local_var_req_builder = local_var_req_builder.header(reqwest::header::USER_AGENT, local_var_user_agent.clone());
621 }
622 if let Some(ref local_var_token) = local_var_configuration.bearer_access_token {
623 local_var_req_builder = local_var_req_builder.bearer_auth(local_var_token.to_owned());
624 };
625
626 let local_var_req = local_var_req_builder.build()?;
627 let local_var_resp = local_var_client.execute(local_var_req).await?;
628
629 let local_var_status = local_var_resp.status();
630 let local_var_content = local_var_resp.text().await?;
631
632 if !local_var_status.is_client_error() && !local_var_status.is_server_error() {
633 crate::from_str_patched(&local_var_content).map_err(Error::from)
634 } else {
635 let local_var_entity: Option<GetRunnableError> = crate::from_str_patched(&local_var_content).ok();
636 let local_var_error = ResponseContent { status: local_var_status, content: local_var_content, entity: local_var_entity };
637 Err(Error::ResponseError(local_var_error))
638 }
639}
640
641pub async fn get_tutorial_progress(configuration: &configuration::Configuration, ) -> Result<models::GetTutorialProgress200Response, Error<GetTutorialProgressError>> {
642 let local_var_configuration = configuration;
643
644 let local_var_client = &local_var_configuration.client;
645
646 let local_var_uri_str = format!("{}/users/tutorial_progress", local_var_configuration.base_path);
647 let mut local_var_req_builder = local_var_client.request(reqwest::Method::GET, local_var_uri_str.as_str());
648
649 if let Some(ref local_var_user_agent) = local_var_configuration.user_agent {
650 local_var_req_builder = local_var_req_builder.header(reqwest::header::USER_AGENT, local_var_user_agent.clone());
651 }
652 if let Some(ref local_var_token) = local_var_configuration.bearer_access_token {
653 local_var_req_builder = local_var_req_builder.bearer_auth(local_var_token.to_owned());
654 };
655
656 let local_var_req = local_var_req_builder.build()?;
657 let local_var_resp = local_var_client.execute(local_var_req).await?;
658
659 let local_var_status = local_var_resp.status();
660 let local_var_content = local_var_resp.text().await?;
661
662 if !local_var_status.is_client_error() && !local_var_status.is_server_error() {
663 crate::from_str_patched(&local_var_content).map_err(Error::from)
664 } else {
665 let local_var_entity: Option<GetTutorialProgressError> = crate::from_str_patched(&local_var_content).ok();
666 let local_var_error = ResponseContent { status: local_var_status, content: local_var_content, entity: local_var_entity };
667 Err(Error::ResponseError(local_var_error))
668 }
669}
670
671pub async fn get_usage(configuration: &configuration::Configuration, ) -> Result<f64, Error<GetUsageError>> {
672 let local_var_configuration = configuration;
673
674 let local_var_client = &local_var_configuration.client;
675
676 let local_var_uri_str = format!("{}/users/usage", local_var_configuration.base_path);
677 let mut local_var_req_builder = local_var_client.request(reqwest::Method::GET, local_var_uri_str.as_str());
678
679 if let Some(ref local_var_user_agent) = local_var_configuration.user_agent {
680 local_var_req_builder = local_var_req_builder.header(reqwest::header::USER_AGENT, local_var_user_agent.clone());
681 }
682 if let Some(ref local_var_token) = local_var_configuration.bearer_access_token {
683 local_var_req_builder = local_var_req_builder.bearer_auth(local_var_token.to_owned());
684 };
685
686 let local_var_req = local_var_req_builder.build()?;
687 let local_var_resp = local_var_client.execute(local_var_req).await?;
688
689 let local_var_status = local_var_resp.status();
690 let local_var_content = local_var_resp.text().await?;
691
692 if !local_var_status.is_client_error() && !local_var_status.is_server_error() {
693 crate::from_str_patched(&local_var_content).map_err(Error::from)
694 } else {
695 let local_var_entity: Option<GetUsageError> = crate::from_str_patched(&local_var_content).ok();
696 let local_var_error = ResponseContent { status: local_var_status, content: local_var_content, entity: local_var_entity };
697 Err(Error::ResponseError(local_var_error))
698 }
699}
700
701pub async fn get_user(configuration: &configuration::Configuration, workspace: &str, username: &str) -> Result<models::User, Error<GetUserError>> {
702 let local_var_configuration = configuration;
703
704 let local_var_client = &local_var_configuration.client;
705
706 let local_var_uri_str = format!("{}/w/{workspace}/users/get/{username}", local_var_configuration.base_path, workspace=crate::apis::urlencode(workspace), username=crate::apis::urlencode(username));
707 let mut local_var_req_builder = local_var_client.request(reqwest::Method::GET, local_var_uri_str.as_str());
708
709 if let Some(ref local_var_user_agent) = local_var_configuration.user_agent {
710 local_var_req_builder = local_var_req_builder.header(reqwest::header::USER_AGENT, local_var_user_agent.clone());
711 }
712 if let Some(ref local_var_token) = local_var_configuration.bearer_access_token {
713 local_var_req_builder = local_var_req_builder.bearer_auth(local_var_token.to_owned());
714 };
715
716 let local_var_req = local_var_req_builder.build()?;
717 let local_var_resp = local_var_client.execute(local_var_req).await?;
718
719 let local_var_status = local_var_resp.status();
720 let local_var_content = local_var_resp.text().await?;
721
722 if !local_var_status.is_client_error() && !local_var_status.is_server_error() {
723 crate::from_str_patched(&local_var_content).map_err(Error::from)
724 } else {
725 let local_var_entity: Option<GetUserError> = crate::from_str_patched(&local_var_content).ok();
726 let local_var_error = ResponseContent { status: local_var_status, content: local_var_content, entity: local_var_entity };
727 Err(Error::ResponseError(local_var_error))
728 }
729}
730
731pub async fn global_user_delete(configuration: &configuration::Configuration, email: &str) -> Result<String, Error<GlobalUserDeleteError>> {
732 let local_var_configuration = configuration;
733
734 let local_var_client = &local_var_configuration.client;
735
736 let local_var_uri_str = format!("{}/users/delete/{email}", local_var_configuration.base_path, email=crate::apis::urlencode(email));
737 let mut local_var_req_builder = local_var_client.request(reqwest::Method::DELETE, local_var_uri_str.as_str());
738
739 if let Some(ref local_var_user_agent) = local_var_configuration.user_agent {
740 local_var_req_builder = local_var_req_builder.header(reqwest::header::USER_AGENT, local_var_user_agent.clone());
741 }
742 if let Some(ref local_var_token) = local_var_configuration.bearer_access_token {
743 local_var_req_builder = local_var_req_builder.bearer_auth(local_var_token.to_owned());
744 };
745
746 let local_var_req = local_var_req_builder.build()?;
747 let local_var_resp = local_var_client.execute(local_var_req).await?;
748
749 let local_var_status = local_var_resp.status();
750 let local_var_content = local_var_resp.text().await?;
751
752 if !local_var_status.is_client_error() && !local_var_status.is_server_error() {
753 crate::from_str_patched(&local_var_content).map_err(Error::from)
754 } else {
755 let local_var_entity: Option<GlobalUserDeleteError> = crate::from_str_patched(&local_var_content).ok();
756 let local_var_error = ResponseContent { status: local_var_status, content: local_var_content, entity: local_var_entity };
757 Err(Error::ResponseError(local_var_error))
758 }
759}
760
761pub async fn global_user_rename(configuration: &configuration::Configuration, email: &str, global_user_rename_request: models::GlobalUserRenameRequest) -> Result<String, Error<GlobalUserRenameError>> {
762 let local_var_configuration = configuration;
763
764 let local_var_client = &local_var_configuration.client;
765
766 let local_var_uri_str = format!("{}/users/rename/{email}", local_var_configuration.base_path, email=crate::apis::urlencode(email));
767 let mut local_var_req_builder = local_var_client.request(reqwest::Method::POST, local_var_uri_str.as_str());
768
769 if let Some(ref local_var_user_agent) = local_var_configuration.user_agent {
770 local_var_req_builder = local_var_req_builder.header(reqwest::header::USER_AGENT, local_var_user_agent.clone());
771 }
772 if let Some(ref local_var_token) = local_var_configuration.bearer_access_token {
773 local_var_req_builder = local_var_req_builder.bearer_auth(local_var_token.to_owned());
774 };
775 local_var_req_builder = local_var_req_builder.json(&global_user_rename_request);
776
777 let local_var_req = local_var_req_builder.build()?;
778 let local_var_resp = local_var_client.execute(local_var_req).await?;
779
780 let local_var_status = local_var_resp.status();
781 let local_var_content = local_var_resp.text().await?;
782
783 if !local_var_status.is_client_error() && !local_var_status.is_server_error() {
784 crate::from_str_patched(&local_var_content).map_err(Error::from)
785 } else {
786 let local_var_entity: Option<GlobalUserRenameError> = crate::from_str_patched(&local_var_content).ok();
787 let local_var_error = ResponseContent { status: local_var_status, content: local_var_content, entity: local_var_entity };
788 Err(Error::ResponseError(local_var_error))
789 }
790}
791
792pub async fn global_user_update(configuration: &configuration::Configuration, email: &str, global_user_update_request: models::GlobalUserUpdateRequest) -> Result<String, Error<GlobalUserUpdateError>> {
793 let local_var_configuration = configuration;
794
795 let local_var_client = &local_var_configuration.client;
796
797 let local_var_uri_str = format!("{}/users/update/{email}", local_var_configuration.base_path, email=crate::apis::urlencode(email));
798 let mut local_var_req_builder = local_var_client.request(reqwest::Method::POST, local_var_uri_str.as_str());
799
800 if let Some(ref local_var_user_agent) = local_var_configuration.user_agent {
801 local_var_req_builder = local_var_req_builder.header(reqwest::header::USER_AGENT, local_var_user_agent.clone());
802 }
803 if let Some(ref local_var_token) = local_var_configuration.bearer_access_token {
804 local_var_req_builder = local_var_req_builder.bearer_auth(local_var_token.to_owned());
805 };
806 local_var_req_builder = local_var_req_builder.json(&global_user_update_request);
807
808 let local_var_req = local_var_req_builder.build()?;
809 let local_var_resp = local_var_client.execute(local_var_req).await?;
810
811 let local_var_status = local_var_resp.status();
812 let local_var_content = local_var_resp.text().await?;
813
814 if !local_var_status.is_client_error() && !local_var_status.is_server_error() {
815 crate::from_str_patched(&local_var_content).map_err(Error::from)
816 } else {
817 let local_var_entity: Option<GlobalUserUpdateError> = crate::from_str_patched(&local_var_content).ok();
818 let local_var_error = ResponseContent { status: local_var_status, content: local_var_content, entity: local_var_entity };
819 Err(Error::ResponseError(local_var_error))
820 }
821}
822
823pub async fn global_username_info(configuration: &configuration::Configuration, email: &str) -> Result<models::GlobalUsernameInfo200Response, Error<GlobalUsernameInfoError>> {
824 let local_var_configuration = configuration;
825
826 let local_var_client = &local_var_configuration.client;
827
828 let local_var_uri_str = format!("{}/users/username_info/{email}", local_var_configuration.base_path, email=crate::apis::urlencode(email));
829 let mut local_var_req_builder = local_var_client.request(reqwest::Method::GET, local_var_uri_str.as_str());
830
831 if let Some(ref local_var_user_agent) = local_var_configuration.user_agent {
832 local_var_req_builder = local_var_req_builder.header(reqwest::header::USER_AGENT, local_var_user_agent.clone());
833 }
834 if let Some(ref local_var_token) = local_var_configuration.bearer_access_token {
835 local_var_req_builder = local_var_req_builder.bearer_auth(local_var_token.to_owned());
836 };
837
838 let local_var_req = local_var_req_builder.build()?;
839 let local_var_resp = local_var_client.execute(local_var_req).await?;
840
841 let local_var_status = local_var_resp.status();
842 let local_var_content = local_var_resp.text().await?;
843
844 if !local_var_status.is_client_error() && !local_var_status.is_server_error() {
845 crate::from_str_patched(&local_var_content).map_err(Error::from)
846 } else {
847 let local_var_entity: Option<GlobalUsernameInfoError> = crate::from_str_patched(&local_var_content).ok();
848 let local_var_error = ResponseContent { status: local_var_status, content: local_var_content, entity: local_var_entity };
849 Err(Error::ResponseError(local_var_error))
850 }
851}
852
853pub async fn global_users_export(configuration: &configuration::Configuration, ) -> Result<Vec<models::ExportedUser>, Error<GlobalUsersExportError>> {
854 let local_var_configuration = configuration;
855
856 let local_var_client = &local_var_configuration.client;
857
858 let local_var_uri_str = format!("{}/users/export", local_var_configuration.base_path);
859 let mut local_var_req_builder = local_var_client.request(reqwest::Method::GET, local_var_uri_str.as_str());
860
861 if let Some(ref local_var_user_agent) = local_var_configuration.user_agent {
862 local_var_req_builder = local_var_req_builder.header(reqwest::header::USER_AGENT, local_var_user_agent.clone());
863 }
864 if let Some(ref local_var_token) = local_var_configuration.bearer_access_token {
865 local_var_req_builder = local_var_req_builder.bearer_auth(local_var_token.to_owned());
866 };
867
868 let local_var_req = local_var_req_builder.build()?;
869 let local_var_resp = local_var_client.execute(local_var_req).await?;
870
871 let local_var_status = local_var_resp.status();
872 let local_var_content = local_var_resp.text().await?;
873
874 if !local_var_status.is_client_error() && !local_var_status.is_server_error() {
875 crate::from_str_patched(&local_var_content).map_err(Error::from)
876 } else {
877 let local_var_entity: Option<GlobalUsersExportError> = crate::from_str_patched(&local_var_content).ok();
878 let local_var_error = ResponseContent { status: local_var_status, content: local_var_content, entity: local_var_entity };
879 Err(Error::ResponseError(local_var_error))
880 }
881}
882
883pub async fn global_users_overwrite(configuration: &configuration::Configuration, exported_user: Vec<models::ExportedUser>) -> Result<String, Error<GlobalUsersOverwriteError>> {
884 let local_var_configuration = configuration;
885
886 let local_var_client = &local_var_configuration.client;
887
888 let local_var_uri_str = format!("{}/users/overwrite", local_var_configuration.base_path);
889 let mut local_var_req_builder = local_var_client.request(reqwest::Method::POST, local_var_uri_str.as_str());
890
891 if let Some(ref local_var_user_agent) = local_var_configuration.user_agent {
892 local_var_req_builder = local_var_req_builder.header(reqwest::header::USER_AGENT, local_var_user_agent.clone());
893 }
894 if let Some(ref local_var_token) = local_var_configuration.bearer_access_token {
895 local_var_req_builder = local_var_req_builder.bearer_auth(local_var_token.to_owned());
896 };
897 local_var_req_builder = local_var_req_builder.json(&exported_user);
898
899 let local_var_req = local_var_req_builder.build()?;
900 let local_var_resp = local_var_client.execute(local_var_req).await?;
901
902 let local_var_status = local_var_resp.status();
903 let local_var_content = local_var_resp.text().await?;
904
905 if !local_var_status.is_client_error() && !local_var_status.is_server_error() {
906 crate::from_str_patched(&local_var_content).map_err(Error::from)
907 } else {
908 let local_var_entity: Option<GlobalUsersOverwriteError> = crate::from_str_patched(&local_var_content).ok();
909 let local_var_error = ResponseContent { status: local_var_status, content: local_var_content, entity: local_var_entity };
910 Err(Error::ResponseError(local_var_error))
911 }
912}
913
914pub async fn global_whoami(configuration: &configuration::Configuration, ) -> Result<models::GlobalUserInfo, Error<GlobalWhoamiError>> {
915 let local_var_configuration = configuration;
916
917 let local_var_client = &local_var_configuration.client;
918
919 let local_var_uri_str = format!("{}/users/whoami", local_var_configuration.base_path);
920 let mut local_var_req_builder = local_var_client.request(reqwest::Method::GET, local_var_uri_str.as_str());
921
922 if let Some(ref local_var_user_agent) = local_var_configuration.user_agent {
923 local_var_req_builder = local_var_req_builder.header(reqwest::header::USER_AGENT, local_var_user_agent.clone());
924 }
925 if let Some(ref local_var_token) = local_var_configuration.bearer_access_token {
926 local_var_req_builder = local_var_req_builder.bearer_auth(local_var_token.to_owned());
927 };
928
929 let local_var_req = local_var_req_builder.build()?;
930 let local_var_resp = local_var_client.execute(local_var_req).await?;
931
932 let local_var_status = local_var_resp.status();
933 let local_var_content = local_var_resp.text().await?;
934
935 if !local_var_status.is_client_error() && !local_var_status.is_server_error() {
936 crate::from_str_patched(&local_var_content).map_err(Error::from)
937 } else {
938 let local_var_entity: Option<GlobalWhoamiError> = crate::from_str_patched(&local_var_content).ok();
939 let local_var_error = ResponseContent { status: local_var_status, content: local_var_content, entity: local_var_entity };
940 Err(Error::ResponseError(local_var_error))
941 }
942}
943
944pub async fn is_owner_of_path(configuration: &configuration::Configuration, workspace: &str, path: &str) -> Result<bool, Error<IsOwnerOfPathError>> {
945 let local_var_configuration = configuration;
946
947 let local_var_client = &local_var_configuration.client;
948
949 let local_var_uri_str = format!("{}/w/{workspace}/users/is_owner/{path}", local_var_configuration.base_path, workspace=crate::apis::urlencode(workspace), path=crate::apis::urlencode(path));
950 let mut local_var_req_builder = local_var_client.request(reqwest::Method::GET, local_var_uri_str.as_str());
951
952 if let Some(ref local_var_user_agent) = local_var_configuration.user_agent {
953 local_var_req_builder = local_var_req_builder.header(reqwest::header::USER_AGENT, local_var_user_agent.clone());
954 }
955 if let Some(ref local_var_token) = local_var_configuration.bearer_access_token {
956 local_var_req_builder = local_var_req_builder.bearer_auth(local_var_token.to_owned());
957 };
958
959 let local_var_req = local_var_req_builder.build()?;
960 let local_var_resp = local_var_client.execute(local_var_req).await?;
961
962 let local_var_status = local_var_resp.status();
963 let local_var_content = local_var_resp.text().await?;
964
965 if !local_var_status.is_client_error() && !local_var_status.is_server_error() {
966 crate::from_str_patched(&local_var_content).map_err(Error::from)
967 } else {
968 let local_var_entity: Option<IsOwnerOfPathError> = crate::from_str_patched(&local_var_content).ok();
969 let local_var_error = ResponseContent { status: local_var_status, content: local_var_content, entity: local_var_entity };
970 Err(Error::ResponseError(local_var_error))
971 }
972}
973
974pub async fn leave_instance(configuration: &configuration::Configuration, ) -> Result<String, Error<LeaveInstanceError>> {
975 let local_var_configuration = configuration;
976
977 let local_var_client = &local_var_configuration.client;
978
979 let local_var_uri_str = format!("{}/users/leave_instance", local_var_configuration.base_path);
980 let mut local_var_req_builder = local_var_client.request(reqwest::Method::POST, local_var_uri_str.as_str());
981
982 if let Some(ref local_var_user_agent) = local_var_configuration.user_agent {
983 local_var_req_builder = local_var_req_builder.header(reqwest::header::USER_AGENT, local_var_user_agent.clone());
984 }
985 if let Some(ref local_var_token) = local_var_configuration.bearer_access_token {
986 local_var_req_builder = local_var_req_builder.bearer_auth(local_var_token.to_owned());
987 };
988
989 let local_var_req = local_var_req_builder.build()?;
990 let local_var_resp = local_var_client.execute(local_var_req).await?;
991
992 let local_var_status = local_var_resp.status();
993 let local_var_content = local_var_resp.text().await?;
994
995 if !local_var_status.is_client_error() && !local_var_status.is_server_error() {
996 crate::from_str_patched(&local_var_content).map_err(Error::from)
997 } else {
998 let local_var_entity: Option<LeaveInstanceError> = crate::from_str_patched(&local_var_content).ok();
999 let local_var_error = ResponseContent { status: local_var_status, content: local_var_content, entity: local_var_entity };
1000 Err(Error::ResponseError(local_var_error))
1001 }
1002}
1003
1004pub async fn list_tokens(configuration: &configuration::Configuration, exclude_ephemeral: Option<bool>, page: Option<i32>, per_page: Option<i32>) -> Result<Vec<models::TruncatedToken>, Error<ListTokensError>> {
1005 let local_var_configuration = configuration;
1006
1007 let local_var_client = &local_var_configuration.client;
1008
1009 let local_var_uri_str = format!("{}/users/tokens/list", local_var_configuration.base_path);
1010 let mut local_var_req_builder = local_var_client.request(reqwest::Method::GET, local_var_uri_str.as_str());
1011
1012 if let Some(ref local_var_str) = exclude_ephemeral {
1013 local_var_req_builder = local_var_req_builder.query(&[("exclude_ephemeral", &local_var_str.to_string())]);
1014 }
1015 if let Some(ref local_var_str) = page {
1016 local_var_req_builder = local_var_req_builder.query(&[("page", &local_var_str.to_string())]);
1017 }
1018 if let Some(ref local_var_str) = per_page {
1019 local_var_req_builder = local_var_req_builder.query(&[("per_page", &local_var_str.to_string())]);
1020 }
1021 if let Some(ref local_var_user_agent) = local_var_configuration.user_agent {
1022 local_var_req_builder = local_var_req_builder.header(reqwest::header::USER_AGENT, local_var_user_agent.clone());
1023 }
1024 if let Some(ref local_var_token) = local_var_configuration.bearer_access_token {
1025 local_var_req_builder = local_var_req_builder.bearer_auth(local_var_token.to_owned());
1026 };
1027
1028 let local_var_req = local_var_req_builder.build()?;
1029 let local_var_resp = local_var_client.execute(local_var_req).await?;
1030
1031 let local_var_status = local_var_resp.status();
1032 let local_var_content = local_var_resp.text().await?;
1033
1034 if !local_var_status.is_client_error() && !local_var_status.is_server_error() {
1035 crate::from_str_patched(&local_var_content).map_err(Error::from)
1036 } else {
1037 let local_var_entity: Option<ListTokensError> = crate::from_str_patched(&local_var_content).ok();
1038 let local_var_error = ResponseContent { status: local_var_status, content: local_var_content, entity: local_var_entity };
1039 Err(Error::ResponseError(local_var_error))
1040 }
1041}
1042
1043pub async fn list_usernames(configuration: &configuration::Configuration, workspace: &str) -> Result<Vec<String>, Error<ListUsernamesError>> {
1044 let local_var_configuration = configuration;
1045
1046 let local_var_client = &local_var_configuration.client;
1047
1048 let local_var_uri_str = format!("{}/w/{workspace}/users/list_usernames", local_var_configuration.base_path, workspace=crate::apis::urlencode(workspace));
1049 let mut local_var_req_builder = local_var_client.request(reqwest::Method::GET, local_var_uri_str.as_str());
1050
1051 if let Some(ref local_var_user_agent) = local_var_configuration.user_agent {
1052 local_var_req_builder = local_var_req_builder.header(reqwest::header::USER_AGENT, local_var_user_agent.clone());
1053 }
1054 if let Some(ref local_var_token) = local_var_configuration.bearer_access_token {
1055 local_var_req_builder = local_var_req_builder.bearer_auth(local_var_token.to_owned());
1056 };
1057
1058 let local_var_req = local_var_req_builder.build()?;
1059 let local_var_resp = local_var_client.execute(local_var_req).await?;
1060
1061 let local_var_status = local_var_resp.status();
1062 let local_var_content = local_var_resp.text().await?;
1063
1064 if !local_var_status.is_client_error() && !local_var_status.is_server_error() {
1065 crate::from_str_patched(&local_var_content).map_err(Error::from)
1066 } else {
1067 let local_var_entity: Option<ListUsernamesError> = crate::from_str_patched(&local_var_content).ok();
1068 let local_var_error = ResponseContent { status: local_var_status, content: local_var_content, entity: local_var_entity };
1069 Err(Error::ResponseError(local_var_error))
1070 }
1071}
1072
1073pub async fn list_users(configuration: &configuration::Configuration, workspace: &str) -> Result<Vec<models::User>, Error<ListUsersError>> {
1074 let local_var_configuration = configuration;
1075
1076 let local_var_client = &local_var_configuration.client;
1077
1078 let local_var_uri_str = format!("{}/w/{workspace}/users/list", local_var_configuration.base_path, workspace=crate::apis::urlencode(workspace));
1079 let mut local_var_req_builder = local_var_client.request(reqwest::Method::GET, local_var_uri_str.as_str());
1080
1081 if let Some(ref local_var_user_agent) = local_var_configuration.user_agent {
1082 local_var_req_builder = local_var_req_builder.header(reqwest::header::USER_AGENT, local_var_user_agent.clone());
1083 }
1084 if let Some(ref local_var_token) = local_var_configuration.bearer_access_token {
1085 local_var_req_builder = local_var_req_builder.bearer_auth(local_var_token.to_owned());
1086 };
1087
1088 let local_var_req = local_var_req_builder.build()?;
1089 let local_var_resp = local_var_client.execute(local_var_req).await?;
1090
1091 let local_var_status = local_var_resp.status();
1092 let local_var_content = local_var_resp.text().await?;
1093
1094 if !local_var_status.is_client_error() && !local_var_status.is_server_error() {
1095 crate::from_str_patched(&local_var_content).map_err(Error::from)
1096 } else {
1097 let local_var_entity: Option<ListUsersError> = crate::from_str_patched(&local_var_content).ok();
1098 let local_var_error = ResponseContent { status: local_var_status, content: local_var_content, entity: local_var_entity };
1099 Err(Error::ResponseError(local_var_error))
1100 }
1101}
1102
1103pub async fn list_users_as_super_admin(configuration: &configuration::Configuration, page: Option<i32>, per_page: Option<i32>, active_only: Option<bool>) -> Result<Vec<models::GlobalUserInfo>, Error<ListUsersAsSuperAdminError>> {
1104 let local_var_configuration = configuration;
1105
1106 let local_var_client = &local_var_configuration.client;
1107
1108 let local_var_uri_str = format!("{}/users/list_as_super_admin", local_var_configuration.base_path);
1109 let mut local_var_req_builder = local_var_client.request(reqwest::Method::GET, local_var_uri_str.as_str());
1110
1111 if let Some(ref local_var_str) = page {
1112 local_var_req_builder = local_var_req_builder.query(&[("page", &local_var_str.to_string())]);
1113 }
1114 if let Some(ref local_var_str) = per_page {
1115 local_var_req_builder = local_var_req_builder.query(&[("per_page", &local_var_str.to_string())]);
1116 }
1117 if let Some(ref local_var_str) = active_only {
1118 local_var_req_builder = local_var_req_builder.query(&[("active_only", &local_var_str.to_string())]);
1119 }
1120 if let Some(ref local_var_user_agent) = local_var_configuration.user_agent {
1121 local_var_req_builder = local_var_req_builder.header(reqwest::header::USER_AGENT, local_var_user_agent.clone());
1122 }
1123 if let Some(ref local_var_token) = local_var_configuration.bearer_access_token {
1124 local_var_req_builder = local_var_req_builder.bearer_auth(local_var_token.to_owned());
1125 };
1126
1127 let local_var_req = local_var_req_builder.build()?;
1128 let local_var_resp = local_var_client.execute(local_var_req).await?;
1129
1130 let local_var_status = local_var_resp.status();
1131 let local_var_content = local_var_resp.text().await?;
1132
1133 if !local_var_status.is_client_error() && !local_var_status.is_server_error() {
1134 crate::from_str_patched(&local_var_content).map_err(Error::from)
1135 } else {
1136 let local_var_entity: Option<ListUsersAsSuperAdminError> = crate::from_str_patched(&local_var_content).ok();
1137 let local_var_error = ResponseContent { status: local_var_status, content: local_var_content, entity: local_var_entity };
1138 Err(Error::ResponseError(local_var_error))
1139 }
1140}
1141
1142pub async fn list_users_usage(configuration: &configuration::Configuration, workspace: &str) -> Result<Vec<models::UserUsage>, Error<ListUsersUsageError>> {
1143 let local_var_configuration = configuration;
1144
1145 let local_var_client = &local_var_configuration.client;
1146
1147 let local_var_uri_str = format!("{}/w/{workspace}/users/list_usage", local_var_configuration.base_path, workspace=crate::apis::urlencode(workspace));
1148 let mut local_var_req_builder = local_var_client.request(reqwest::Method::GET, local_var_uri_str.as_str());
1149
1150 if let Some(ref local_var_user_agent) = local_var_configuration.user_agent {
1151 local_var_req_builder = local_var_req_builder.header(reqwest::header::USER_AGENT, local_var_user_agent.clone());
1152 }
1153 if let Some(ref local_var_token) = local_var_configuration.bearer_access_token {
1154 local_var_req_builder = local_var_req_builder.bearer_auth(local_var_token.to_owned());
1155 };
1156
1157 let local_var_req = local_var_req_builder.build()?;
1158 let local_var_resp = local_var_client.execute(local_var_req).await?;
1159
1160 let local_var_status = local_var_resp.status();
1161 let local_var_content = local_var_resp.text().await?;
1162
1163 if !local_var_status.is_client_error() && !local_var_status.is_server_error() {
1164 crate::from_str_patched(&local_var_content).map_err(Error::from)
1165 } else {
1166 let local_var_entity: Option<ListUsersUsageError> = crate::from_str_patched(&local_var_content).ok();
1167 let local_var_error = ResponseContent { status: local_var_status, content: local_var_content, entity: local_var_entity };
1168 Err(Error::ResponseError(local_var_error))
1169 }
1170}
1171
1172pub async fn list_workspace_invites(configuration: &configuration::Configuration, ) -> Result<Vec<models::WorkspaceInvite>, Error<ListWorkspaceInvitesError>> {
1173 let local_var_configuration = configuration;
1174
1175 let local_var_client = &local_var_configuration.client;
1176
1177 let local_var_uri_str = format!("{}/users/list_invites", local_var_configuration.base_path);
1178 let mut local_var_req_builder = local_var_client.request(reqwest::Method::GET, local_var_uri_str.as_str());
1179
1180 if let Some(ref local_var_user_agent) = local_var_configuration.user_agent {
1181 local_var_req_builder = local_var_req_builder.header(reqwest::header::USER_AGENT, local_var_user_agent.clone());
1182 }
1183 if let Some(ref local_var_token) = local_var_configuration.bearer_access_token {
1184 local_var_req_builder = local_var_req_builder.bearer_auth(local_var_token.to_owned());
1185 };
1186
1187 let local_var_req = local_var_req_builder.build()?;
1188 let local_var_resp = local_var_client.execute(local_var_req).await?;
1189
1190 let local_var_status = local_var_resp.status();
1191 let local_var_content = local_var_resp.text().await?;
1192
1193 if !local_var_status.is_client_error() && !local_var_status.is_server_error() {
1194 crate::from_str_patched(&local_var_content).map_err(Error::from)
1195 } else {
1196 let local_var_entity: Option<ListWorkspaceInvitesError> = crate::from_str_patched(&local_var_content).ok();
1197 let local_var_error = ResponseContent { status: local_var_status, content: local_var_content, entity: local_var_entity };
1198 Err(Error::ResponseError(local_var_error))
1199 }
1200}
1201
1202pub async fn login(configuration: &configuration::Configuration, login: models::Login) -> Result<String, Error<LoginError>> {
1203 let local_var_configuration = configuration;
1204
1205 let local_var_client = &local_var_configuration.client;
1206
1207 let local_var_uri_str = format!("{}/auth/login", local_var_configuration.base_path);
1208 let mut local_var_req_builder = local_var_client.request(reqwest::Method::POST, local_var_uri_str.as_str());
1209
1210 if let Some(ref local_var_user_agent) = local_var_configuration.user_agent {
1211 local_var_req_builder = local_var_req_builder.header(reqwest::header::USER_AGENT, local_var_user_agent.clone());
1212 }
1213 local_var_req_builder = local_var_req_builder.json(&login);
1214
1215 let local_var_req = local_var_req_builder.build()?;
1216 let local_var_resp = local_var_client.execute(local_var_req).await?;
1217
1218 let local_var_status = local_var_resp.status();
1219 let local_var_content = local_var_resp.text().await?;
1220
1221 if !local_var_status.is_client_error() && !local_var_status.is_server_error() {
1222 crate::from_str_patched(&local_var_content).map_err(Error::from)
1223 } else {
1224 let local_var_entity: Option<LoginError> = crate::from_str_patched(&local_var_content).ok();
1225 let local_var_error = ResponseContent { status: local_var_status, content: local_var_content, entity: local_var_entity };
1226 Err(Error::ResponseError(local_var_error))
1227 }
1228}
1229
1230pub async fn login_with_oauth(configuration: &configuration::Configuration, client_name: &str, login_with_oauth_request: models::LoginWithOauthRequest) -> Result<String, Error<LoginWithOauthError>> {
1231 let local_var_configuration = configuration;
1232
1233 let local_var_client = &local_var_configuration.client;
1234
1235 let local_var_uri_str = format!("{}/oauth/login_callback/{client_name}", local_var_configuration.base_path, client_name=crate::apis::urlencode(client_name));
1236 let mut local_var_req_builder = local_var_client.request(reqwest::Method::POST, local_var_uri_str.as_str());
1237
1238 if let Some(ref local_var_user_agent) = local_var_configuration.user_agent {
1239 local_var_req_builder = local_var_req_builder.header(reqwest::header::USER_AGENT, local_var_user_agent.clone());
1240 }
1241 local_var_req_builder = local_var_req_builder.json(&login_with_oauth_request);
1242
1243 let local_var_req = local_var_req_builder.build()?;
1244 let local_var_resp = local_var_client.execute(local_var_req).await?;
1245
1246 let local_var_status = local_var_resp.status();
1247 let local_var_content = local_var_resp.text().await?;
1248
1249 if !local_var_status.is_client_error() && !local_var_status.is_server_error() {
1250 crate::from_str_patched(&local_var_content).map_err(Error::from)
1251 } else {
1252 let local_var_entity: Option<LoginWithOauthError> = crate::from_str_patched(&local_var_content).ok();
1253 let local_var_error = ResponseContent { status: local_var_status, content: local_var_content, entity: local_var_entity };
1254 Err(Error::ResponseError(local_var_error))
1255 }
1256}
1257
1258pub async fn logout(configuration: &configuration::Configuration, ) -> Result<String, Error<LogoutError>> {
1259 let local_var_configuration = configuration;
1260
1261 let local_var_client = &local_var_configuration.client;
1262
1263 let local_var_uri_str = format!("{}/auth/logout", local_var_configuration.base_path);
1264 let mut local_var_req_builder = local_var_client.request(reqwest::Method::POST, local_var_uri_str.as_str());
1265
1266 if let Some(ref local_var_user_agent) = local_var_configuration.user_agent {
1267 local_var_req_builder = local_var_req_builder.header(reqwest::header::USER_AGENT, local_var_user_agent.clone());
1268 }
1269
1270 let local_var_req = local_var_req_builder.build()?;
1271 let local_var_resp = local_var_client.execute(local_var_req).await?;
1272
1273 let local_var_status = local_var_resp.status();
1274 let local_var_content = local_var_resp.text().await?;
1275
1276 if !local_var_status.is_client_error() && !local_var_status.is_server_error() {
1277 crate::from_str_patched(&local_var_content).map_err(Error::from)
1278 } else {
1279 let local_var_entity: Option<LogoutError> = crate::from_str_patched(&local_var_content).ok();
1280 let local_var_error = ResponseContent { status: local_var_status, content: local_var_content, entity: local_var_entity };
1281 Err(Error::ResponseError(local_var_error))
1282 }
1283}
1284
1285pub async fn refresh_user_token(configuration: &configuration::Configuration, if_expiring_in_less_than_s: Option<i32>) -> Result<String, Error<RefreshUserTokenError>> {
1286 let local_var_configuration = configuration;
1287
1288 let local_var_client = &local_var_configuration.client;
1289
1290 let local_var_uri_str = format!("{}/users/refresh_token", local_var_configuration.base_path);
1291 let mut local_var_req_builder = local_var_client.request(reqwest::Method::GET, local_var_uri_str.as_str());
1292
1293 if let Some(ref local_var_str) = if_expiring_in_less_than_s {
1294 local_var_req_builder = local_var_req_builder.query(&[("if_expiring_in_less_than_s", &local_var_str.to_string())]);
1295 }
1296 if let Some(ref local_var_user_agent) = local_var_configuration.user_agent {
1297 local_var_req_builder = local_var_req_builder.header(reqwest::header::USER_AGENT, local_var_user_agent.clone());
1298 }
1299 if let Some(ref local_var_token) = local_var_configuration.bearer_access_token {
1300 local_var_req_builder = local_var_req_builder.bearer_auth(local_var_token.to_owned());
1301 };
1302
1303 let local_var_req = local_var_req_builder.build()?;
1304 let local_var_resp = local_var_client.execute(local_var_req).await?;
1305
1306 let local_var_status = local_var_resp.status();
1307 let local_var_content = local_var_resp.text().await?;
1308
1309 if !local_var_status.is_client_error() && !local_var_status.is_server_error() {
1310 crate::from_str_patched(&local_var_content).map_err(Error::from)
1311 } else {
1312 let local_var_entity: Option<RefreshUserTokenError> = crate::from_str_patched(&local_var_content).ok();
1313 let local_var_error = ResponseContent { status: local_var_status, content: local_var_content, entity: local_var_entity };
1314 Err(Error::ResponseError(local_var_error))
1315 }
1316}
1317
1318pub async fn set_login_type_for_user(configuration: &configuration::Configuration, user: &str, set_login_type_for_user_request: models::SetLoginTypeForUserRequest) -> Result<String, Error<SetLoginTypeForUserError>> {
1319 let local_var_configuration = configuration;
1320
1321 let local_var_client = &local_var_configuration.client;
1322
1323 let local_var_uri_str = format!("{}/users/set_login_type/{user}", local_var_configuration.base_path, user=crate::apis::urlencode(user));
1324 let mut local_var_req_builder = local_var_client.request(reqwest::Method::POST, local_var_uri_str.as_str());
1325
1326 if let Some(ref local_var_user_agent) = local_var_configuration.user_agent {
1327 local_var_req_builder = local_var_req_builder.header(reqwest::header::USER_AGENT, local_var_user_agent.clone());
1328 }
1329 if let Some(ref local_var_token) = local_var_configuration.bearer_access_token {
1330 local_var_req_builder = local_var_req_builder.bearer_auth(local_var_token.to_owned());
1331 };
1332 local_var_req_builder = local_var_req_builder.json(&set_login_type_for_user_request);
1333
1334 let local_var_req = local_var_req_builder.build()?;
1335 let local_var_resp = local_var_client.execute(local_var_req).await?;
1336
1337 let local_var_status = local_var_resp.status();
1338 let local_var_content = local_var_resp.text().await?;
1339
1340 if !local_var_status.is_client_error() && !local_var_status.is_server_error() {
1341 crate::from_str_patched(&local_var_content).map_err(Error::from)
1342 } else {
1343 let local_var_entity: Option<SetLoginTypeForUserError> = crate::from_str_patched(&local_var_content).ok();
1344 let local_var_error = ResponseContent { status: local_var_status, content: local_var_content, entity: local_var_entity };
1345 Err(Error::ResponseError(local_var_error))
1346 }
1347}
1348
1349pub async fn set_password(configuration: &configuration::Configuration, set_password_request: models::SetPasswordRequest) -> Result<String, Error<SetPasswordError>> {
1350 let local_var_configuration = configuration;
1351
1352 let local_var_client = &local_var_configuration.client;
1353
1354 let local_var_uri_str = format!("{}/users/setpassword", local_var_configuration.base_path);
1355 let mut local_var_req_builder = local_var_client.request(reqwest::Method::POST, local_var_uri_str.as_str());
1356
1357 if let Some(ref local_var_user_agent) = local_var_configuration.user_agent {
1358 local_var_req_builder = local_var_req_builder.header(reqwest::header::USER_AGENT, local_var_user_agent.clone());
1359 }
1360 if let Some(ref local_var_token) = local_var_configuration.bearer_access_token {
1361 local_var_req_builder = local_var_req_builder.bearer_auth(local_var_token.to_owned());
1362 };
1363 local_var_req_builder = local_var_req_builder.json(&set_password_request);
1364
1365 let local_var_req = local_var_req_builder.build()?;
1366 let local_var_resp = local_var_client.execute(local_var_req).await?;
1367
1368 let local_var_status = local_var_resp.status();
1369 let local_var_content = local_var_resp.text().await?;
1370
1371 if !local_var_status.is_client_error() && !local_var_status.is_server_error() {
1372 crate::from_str_patched(&local_var_content).map_err(Error::from)
1373 } else {
1374 let local_var_entity: Option<SetPasswordError> = crate::from_str_patched(&local_var_content).ok();
1375 let local_var_error = ResponseContent { status: local_var_status, content: local_var_content, entity: local_var_entity };
1376 Err(Error::ResponseError(local_var_error))
1377 }
1378}
1379
1380pub async fn set_password_for_user(configuration: &configuration::Configuration, user: &str, set_password_request: models::SetPasswordRequest) -> Result<String, Error<SetPasswordForUserError>> {
1381 let local_var_configuration = configuration;
1382
1383 let local_var_client = &local_var_configuration.client;
1384
1385 let local_var_uri_str = format!("{}/users/set_password_of/{user}", local_var_configuration.base_path, user=crate::apis::urlencode(user));
1386 let mut local_var_req_builder = local_var_client.request(reqwest::Method::POST, local_var_uri_str.as_str());
1387
1388 if let Some(ref local_var_user_agent) = local_var_configuration.user_agent {
1389 local_var_req_builder = local_var_req_builder.header(reqwest::header::USER_AGENT, local_var_user_agent.clone());
1390 }
1391 if let Some(ref local_var_token) = local_var_configuration.bearer_access_token {
1392 local_var_req_builder = local_var_req_builder.bearer_auth(local_var_token.to_owned());
1393 };
1394 local_var_req_builder = local_var_req_builder.json(&set_password_request);
1395
1396 let local_var_req = local_var_req_builder.build()?;
1397 let local_var_resp = local_var_client.execute(local_var_req).await?;
1398
1399 let local_var_status = local_var_resp.status();
1400 let local_var_content = local_var_resp.text().await?;
1401
1402 if !local_var_status.is_client_error() && !local_var_status.is_server_error() {
1403 crate::from_str_patched(&local_var_content).map_err(Error::from)
1404 } else {
1405 let local_var_entity: Option<SetPasswordForUserError> = crate::from_str_patched(&local_var_content).ok();
1406 let local_var_error = ResponseContent { status: local_var_status, content: local_var_content, entity: local_var_entity };
1407 Err(Error::ResponseError(local_var_error))
1408 }
1409}
1410
1411pub async fn update_tutorial_progress(configuration: &configuration::Configuration, get_tutorial_progress200_response: models::GetTutorialProgress200Response) -> Result<String, Error<UpdateTutorialProgressError>> {
1412 let local_var_configuration = configuration;
1413
1414 let local_var_client = &local_var_configuration.client;
1415
1416 let local_var_uri_str = format!("{}/users/tutorial_progress", local_var_configuration.base_path);
1417 let mut local_var_req_builder = local_var_client.request(reqwest::Method::POST, local_var_uri_str.as_str());
1418
1419 if let Some(ref local_var_user_agent) = local_var_configuration.user_agent {
1420 local_var_req_builder = local_var_req_builder.header(reqwest::header::USER_AGENT, local_var_user_agent.clone());
1421 }
1422 if let Some(ref local_var_token) = local_var_configuration.bearer_access_token {
1423 local_var_req_builder = local_var_req_builder.bearer_auth(local_var_token.to_owned());
1424 };
1425 local_var_req_builder = local_var_req_builder.json(&get_tutorial_progress200_response);
1426
1427 let local_var_req = local_var_req_builder.build()?;
1428 let local_var_resp = local_var_client.execute(local_var_req).await?;
1429
1430 let local_var_status = local_var_resp.status();
1431 let local_var_content = local_var_resp.text().await?;
1432
1433 if !local_var_status.is_client_error() && !local_var_status.is_server_error() {
1434 crate::from_str_patched(&local_var_content).map_err(Error::from)
1435 } else {
1436 let local_var_entity: Option<UpdateTutorialProgressError> = crate::from_str_patched(&local_var_content).ok();
1437 let local_var_error = ResponseContent { status: local_var_status, content: local_var_content, entity: local_var_entity };
1438 Err(Error::ResponseError(local_var_error))
1439 }
1440}
1441
1442pub async fn update_user(configuration: &configuration::Configuration, workspace: &str, username: &str, edit_workspace_user: models::EditWorkspaceUser) -> Result<String, Error<UpdateUserError>> {
1443 let local_var_configuration = configuration;
1444
1445 let local_var_client = &local_var_configuration.client;
1446
1447 let local_var_uri_str = format!("{}/w/{workspace}/users/update/{username}", local_var_configuration.base_path, workspace=crate::apis::urlencode(workspace), username=crate::apis::urlencode(username));
1448 let mut local_var_req_builder = local_var_client.request(reqwest::Method::POST, local_var_uri_str.as_str());
1449
1450 if let Some(ref local_var_user_agent) = local_var_configuration.user_agent {
1451 local_var_req_builder = local_var_req_builder.header(reqwest::header::USER_AGENT, local_var_user_agent.clone());
1452 }
1453 if let Some(ref local_var_token) = local_var_configuration.bearer_access_token {
1454 local_var_req_builder = local_var_req_builder.bearer_auth(local_var_token.to_owned());
1455 };
1456 local_var_req_builder = local_var_req_builder.json(&edit_workspace_user);
1457
1458 let local_var_req = local_var_req_builder.build()?;
1459 let local_var_resp = local_var_client.execute(local_var_req).await?;
1460
1461 let local_var_status = local_var_resp.status();
1462 let local_var_content = local_var_resp.text().await?;
1463
1464 if !local_var_status.is_client_error() && !local_var_status.is_server_error() {
1465 crate::from_str_patched(&local_var_content).map_err(Error::from)
1466 } else {
1467 let local_var_entity: Option<UpdateUserError> = crate::from_str_patched(&local_var_content).ok();
1468 let local_var_error = ResponseContent { status: local_var_status, content: local_var_content, entity: local_var_entity };
1469 Err(Error::ResponseError(local_var_error))
1470 }
1471}
1472
1473pub async fn username_to_email(configuration: &configuration::Configuration, workspace: &str, username: &str) -> Result<String, Error<UsernameToEmailError>> {
1474 let local_var_configuration = configuration;
1475
1476 let local_var_client = &local_var_configuration.client;
1477
1478 let local_var_uri_str = format!("{}/w/{workspace}/users/username_to_email/{username}", local_var_configuration.base_path, workspace=crate::apis::urlencode(workspace), username=crate::apis::urlencode(username));
1479 let mut local_var_req_builder = local_var_client.request(reqwest::Method::GET, local_var_uri_str.as_str());
1480
1481 if let Some(ref local_var_user_agent) = local_var_configuration.user_agent {
1482 local_var_req_builder = local_var_req_builder.header(reqwest::header::USER_AGENT, local_var_user_agent.clone());
1483 }
1484 if let Some(ref local_var_token) = local_var_configuration.bearer_access_token {
1485 local_var_req_builder = local_var_req_builder.bearer_auth(local_var_token.to_owned());
1486 };
1487
1488 let local_var_req = local_var_req_builder.build()?;
1489 let local_var_resp = local_var_client.execute(local_var_req).await?;
1490
1491 let local_var_status = local_var_resp.status();
1492 let local_var_content = local_var_resp.text().await?;
1493
1494 if !local_var_status.is_client_error() && !local_var_status.is_server_error() {
1495 crate::from_str_patched(&local_var_content).map_err(Error::from)
1496 } else {
1497 let local_var_entity: Option<UsernameToEmailError> = crate::from_str_patched(&local_var_content).ok();
1498 let local_var_error = ResponseContent { status: local_var_status, content: local_var_content, entity: local_var_entity };
1499 Err(Error::ResponseError(local_var_error))
1500 }
1501}
1502
1503pub async fn whoami(configuration: &configuration::Configuration, workspace: &str) -> Result<models::User, Error<WhoamiError>> {
1504 let local_var_configuration = configuration;
1505
1506 let local_var_client = &local_var_configuration.client;
1507
1508 let local_var_uri_str = format!("{}/w/{workspace}/users/whoami", local_var_configuration.base_path, workspace=crate::apis::urlencode(workspace));
1509 let mut local_var_req_builder = local_var_client.request(reqwest::Method::GET, local_var_uri_str.as_str());
1510
1511 if let Some(ref local_var_user_agent) = local_var_configuration.user_agent {
1512 local_var_req_builder = local_var_req_builder.header(reqwest::header::USER_AGENT, local_var_user_agent.clone());
1513 }
1514 if let Some(ref local_var_token) = local_var_configuration.bearer_access_token {
1515 local_var_req_builder = local_var_req_builder.bearer_auth(local_var_token.to_owned());
1516 };
1517
1518 let local_var_req = local_var_req_builder.build()?;
1519 let local_var_resp = local_var_client.execute(local_var_req).await?;
1520
1521 let local_var_status = local_var_resp.status();
1522 let local_var_content = local_var_resp.text().await?;
1523
1524 if !local_var_status.is_client_error() && !local_var_status.is_server_error() {
1525 crate::from_str_patched(&local_var_content).map_err(Error::from)
1526 } else {
1527 let local_var_entity: Option<WhoamiError> = crate::from_str_patched(&local_var_content).ok();
1528 let local_var_error = ResponseContent { status: local_var_status, content: local_var_content, entity: local_var_entity };
1529 Err(Error::ResponseError(local_var_error))
1530 }
1531}
1532
1533pub async fn whois(configuration: &configuration::Configuration, workspace: &str, username: &str) -> Result<models::User, Error<WhoisError>> {
1534 let local_var_configuration = configuration;
1535
1536 let local_var_client = &local_var_configuration.client;
1537
1538 let local_var_uri_str = format!("{}/w/{workspace}/users/whois/{username}", local_var_configuration.base_path, workspace=crate::apis::urlencode(workspace), username=crate::apis::urlencode(username));
1539 let mut local_var_req_builder = local_var_client.request(reqwest::Method::GET, local_var_uri_str.as_str());
1540
1541 if let Some(ref local_var_user_agent) = local_var_configuration.user_agent {
1542 local_var_req_builder = local_var_req_builder.header(reqwest::header::USER_AGENT, local_var_user_agent.clone());
1543 }
1544 if let Some(ref local_var_token) = local_var_configuration.bearer_access_token {
1545 local_var_req_builder = local_var_req_builder.bearer_auth(local_var_token.to_owned());
1546 };
1547
1548 let local_var_req = local_var_req_builder.build()?;
1549 let local_var_resp = local_var_client.execute(local_var_req).await?;
1550
1551 let local_var_status = local_var_resp.status();
1552 let local_var_content = local_var_resp.text().await?;
1553
1554 if !local_var_status.is_client_error() && !local_var_status.is_server_error() {
1555 crate::from_str_patched(&local_var_content).map_err(Error::from)
1556 } else {
1557 let local_var_entity: Option<WhoisError> = crate::from_str_patched(&local_var_content).ok();
1558 let local_var_error = ResponseContent { status: local_var_status, content: local_var_content, entity: local_var_entity };
1559 Err(Error::ResponseError(local_var_error))
1560 }
1561}
1562