1use reqwest;
12
13use super::{configuration, Error};
14use crate::apis::ResponseContent;
15
16#[derive(Debug, Clone, Serialize, Deserialize)]
18#[serde(untagged)]
19pub enum AddGroupUserError {
20 Status404(crate::models::Error),
21 Status422(crate::models::Error),
22 UnknownValue(serde_json::Value),
23}
24
25#[derive(Debug, Clone, Serialize, Deserialize)]
27#[serde(untagged)]
28pub enum GetGroupBalanceError {
29 Status403(crate::models::Error),
30 Status404(crate::models::Error),
31 Status422(crate::models::Error),
32 UnknownValue(serde_json::Value),
33}
34
35#[derive(Debug, Clone, Serialize, Deserialize)]
37#[serde(untagged)]
38pub enum GetGroupBillingCustomerError {
39 Status403(crate::models::Error),
40 Status404(crate::models::Error),
41 UnknownValue(serde_json::Value),
42}
43
44#[derive(Debug, Clone, Serialize, Deserialize)]
46#[serde(untagged)]
47pub enum GetGroupUpcomingBillingInvoiceError {
48 Status403(crate::models::Error),
49 Status404(crate::models::Error),
50 UnknownValue(serde_json::Value),
51}
52
53#[derive(Debug, Clone, Serialize, Deserialize)]
55#[serde(untagged)]
56pub enum GetUserBalanceError {
57 Status403(crate::models::Error),
58 Status404(crate::models::Error),
59 Status422(crate::models::Error),
60 UnknownValue(serde_json::Value),
61}
62
63#[derive(Debug, Clone, Serialize, Deserialize)]
65#[serde(untagged)]
66pub enum GetUserBillingCustomerError {
67 Status403(crate::models::Error),
68 Status404(crate::models::Error),
69 UnknownValue(serde_json::Value),
70}
71
72#[derive(Debug, Clone, Serialize, Deserialize)]
74#[serde(untagged)]
75pub enum GetUserUpcomingBillingInvoiceError {
76 Status403(crate::models::Error),
77 Status404(crate::models::Error),
78 UnknownValue(serde_json::Value),
79}
80
81#[derive(Debug, Clone, Serialize, Deserialize)]
83#[serde(untagged)]
84pub enum ListGroupBillingInvoiceLinesError {
85 Status403(crate::models::Error),
86 Status404(crate::models::Error),
87 UnknownValue(serde_json::Value),
88}
89
90#[derive(Debug, Clone, Serialize, Deserialize)]
92#[serde(untagged)]
93pub enum ListGroupBillingInvoicesError {
94 Status403(crate::models::Error),
95 Status404(crate::models::Error),
96 UnknownValue(serde_json::Value),
97}
98
99#[derive(Debug, Clone, Serialize, Deserialize)]
101#[serde(untagged)]
102pub enum ListGroupUpcomingBillingInvoiceLinesError {
103 Status403(crate::models::Error),
104 Status404(crate::models::Error),
105 UnknownValue(serde_json::Value),
106}
107
108#[derive(Debug, Clone, Serialize, Deserialize)]
110#[serde(untagged)]
111pub enum ListGroupUsersError {
112 Status404(crate::models::Error),
113 Status422(crate::models::Error),
114 UnknownValue(serde_json::Value),
115}
116
117#[derive(Debug, Clone, Serialize, Deserialize)]
119#[serde(untagged)]
120pub enum ListUserBillingInvoiceLinesError {
121 Status403(crate::models::Error),
122 Status404(crate::models::Error),
123 UnknownValue(serde_json::Value),
124}
125
126#[derive(Debug, Clone, Serialize, Deserialize)]
128#[serde(untagged)]
129pub enum ListUserBillingInvoicesError {
130 Status403(crate::models::Error),
131 Status404(crate::models::Error),
132 UnknownValue(serde_json::Value),
133}
134
135#[derive(Debug, Clone, Serialize, Deserialize)]
137#[serde(untagged)]
138pub enum ListUserGroupsError {
139 Status422(crate::models::Error),
140 UnknownValue(serde_json::Value),
141}
142
143#[derive(Debug, Clone, Serialize, Deserialize)]
145#[serde(untagged)]
146pub enum ListUserUpcomingBillingInvoiceLinesError {
147 Status403(crate::models::Error),
148 Status404(crate::models::Error),
149 UnknownValue(serde_json::Value),
150}
151
152#[derive(Debug, Clone, Serialize, Deserialize)]
154#[serde(untagged)]
155pub enum RemoveGroupUserError {
156 Status404(crate::models::Error),
157 Status422(crate::models::Error),
158 UnknownValue(serde_json::Value),
159}
160
161pub async fn add_group_user(
163 configuration: &configuration::Configuration,
164 add_group_user_request: crate::models::AddGroupUserRequest,
165) -> Result<(), Error<AddGroupUserError>> {
166 let local_var_configuration = configuration;
167
168 let local_var_client = &local_var_configuration.client;
169
170 let local_var_uri_str = format!("{}/v1/groups:addUser", local_var_configuration.base_path);
171 let mut local_var_req_builder =
172 local_var_client.request(reqwest::Method::POST, local_var_uri_str.as_str());
173
174 if let Some(ref local_var_user_agent) = local_var_configuration.user_agent {
175 local_var_req_builder =
176 local_var_req_builder.header(reqwest::header::USER_AGENT, local_var_user_agent.clone());
177 }
178 if let Some(ref local_var_token) = local_var_configuration.bearer_access_token {
179 local_var_req_builder = local_var_req_builder.bearer_auth(local_var_token.to_owned());
180 };
181 local_var_req_builder = local_var_req_builder.json(&add_group_user_request);
182
183 let local_var_req = local_var_req_builder.build()?;
184 let local_var_resp = local_var_client.execute(local_var_req).await?;
185
186 let local_var_status = local_var_resp.status();
187 let local_var_content = local_var_resp.text().await?;
188
189 if !local_var_status.is_client_error() && !local_var_status.is_server_error() {
190 Ok(())
191 } else {
192 let local_var_entity: Option<AddGroupUserError> =
193 serde_json::from_str(&local_var_content).ok();
194 let local_var_error = ResponseContent {
195 status: local_var_status,
196 content: local_var_content,
197 entity: local_var_entity,
198 };
199 Err(Error::ResponseError(local_var_error))
200 }
201}
202
203pub async fn get_group_balance(
205 configuration: &configuration::Configuration,
206 group_name: &str,
207) -> Result<crate::models::AccountBalance, Error<GetGroupBalanceError>> {
208 let local_var_configuration = configuration;
209
210 let local_var_client = &local_var_configuration.client;
211
212 let local_var_uri_str = format!(
213 "{}/v1/groups/{groupName}/balance",
214 local_var_configuration.base_path,
215 groupName = crate::apis::urlencode(group_name)
216 );
217 let mut local_var_req_builder =
218 local_var_client.request(reqwest::Method::GET, local_var_uri_str.as_str());
219
220 if let Some(ref local_var_user_agent) = local_var_configuration.user_agent {
221 local_var_req_builder =
222 local_var_req_builder.header(reqwest::header::USER_AGENT, local_var_user_agent.clone());
223 }
224 if let Some(ref local_var_token) = local_var_configuration.bearer_access_token {
225 local_var_req_builder = local_var_req_builder.bearer_auth(local_var_token.to_owned());
226 };
227
228 let local_var_req = local_var_req_builder.build()?;
229 let local_var_resp = local_var_client.execute(local_var_req).await?;
230
231 let local_var_status = local_var_resp.status();
232 let local_var_content = local_var_resp.text().await?;
233
234 if !local_var_status.is_client_error() && !local_var_status.is_server_error() {
235 serde_json::from_str(&local_var_content).map_err(Error::from)
236 } else {
237 let local_var_entity: Option<GetGroupBalanceError> =
238 serde_json::from_str(&local_var_content).ok();
239 let local_var_error = ResponseContent {
240 status: local_var_status,
241 content: local_var_content,
242 entity: local_var_entity,
243 };
244 Err(Error::ResponseError(local_var_error))
245 }
246}
247
248pub async fn get_group_billing_customer(
250 configuration: &configuration::Configuration,
251 group_name: &str,
252) -> Result<crate::models::BillingCustomer, Error<GetGroupBillingCustomerError>> {
253 let local_var_configuration = configuration;
254
255 let local_var_client = &local_var_configuration.client;
256
257 let local_var_uri_str = format!(
258 "{}/v1/groups/{groupName}/billingCustomer",
259 local_var_configuration.base_path,
260 groupName = crate::apis::urlencode(group_name)
261 );
262 let mut local_var_req_builder =
263 local_var_client.request(reqwest::Method::GET, local_var_uri_str.as_str());
264
265 if let Some(ref local_var_user_agent) = local_var_configuration.user_agent {
266 local_var_req_builder =
267 local_var_req_builder.header(reqwest::header::USER_AGENT, local_var_user_agent.clone());
268 }
269 if let Some(ref local_var_token) = local_var_configuration.bearer_access_token {
270 local_var_req_builder = local_var_req_builder.bearer_auth(local_var_token.to_owned());
271 };
272
273 let local_var_req = local_var_req_builder.build()?;
274 let local_var_resp = local_var_client.execute(local_var_req).await?;
275
276 let local_var_status = local_var_resp.status();
277 let local_var_content = local_var_resp.text().await?;
278
279 if !local_var_status.is_client_error() && !local_var_status.is_server_error() {
280 serde_json::from_str(&local_var_content).map_err(Error::from)
281 } else {
282 let local_var_entity: Option<GetGroupBillingCustomerError> =
283 serde_json::from_str(&local_var_content).ok();
284 let local_var_error = ResponseContent {
285 status: local_var_status,
286 content: local_var_content,
287 entity: local_var_entity,
288 };
289 Err(Error::ResponseError(local_var_error))
290 }
291}
292
293pub async fn get_group_upcoming_billing_invoice(
295 configuration: &configuration::Configuration,
296 group_name: &str,
297) -> Result<crate::models::BillingUpcomingInvoice, Error<GetGroupUpcomingBillingInvoiceError>> {
298 let local_var_configuration = configuration;
299
300 let local_var_client = &local_var_configuration.client;
301
302 let local_var_uri_str = format!(
303 "{}/v1/groups/{groupName}/billingInvoices:getUpcoming",
304 local_var_configuration.base_path,
305 groupName = crate::apis::urlencode(group_name)
306 );
307 let mut local_var_req_builder =
308 local_var_client.request(reqwest::Method::GET, local_var_uri_str.as_str());
309
310 if let Some(ref local_var_user_agent) = local_var_configuration.user_agent {
311 local_var_req_builder =
312 local_var_req_builder.header(reqwest::header::USER_AGENT, local_var_user_agent.clone());
313 }
314 if let Some(ref local_var_token) = local_var_configuration.bearer_access_token {
315 local_var_req_builder = local_var_req_builder.bearer_auth(local_var_token.to_owned());
316 };
317
318 let local_var_req = local_var_req_builder.build()?;
319 let local_var_resp = local_var_client.execute(local_var_req).await?;
320
321 let local_var_status = local_var_resp.status();
322 let local_var_content = local_var_resp.text().await?;
323
324 if !local_var_status.is_client_error() && !local_var_status.is_server_error() {
325 serde_json::from_str(&local_var_content).map_err(Error::from)
326 } else {
327 let local_var_entity: Option<GetGroupUpcomingBillingInvoiceError> =
328 serde_json::from_str(&local_var_content).ok();
329 let local_var_error = ResponseContent {
330 status: local_var_status,
331 content: local_var_content,
332 entity: local_var_entity,
333 };
334 Err(Error::ResponseError(local_var_error))
335 }
336}
337
338pub async fn get_user_balance(
340 configuration: &configuration::Configuration,
341 user_id: &str,
342) -> Result<crate::models::AccountBalance, Error<GetUserBalanceError>> {
343 let local_var_configuration = configuration;
344
345 let local_var_client = &local_var_configuration.client;
346
347 let local_var_uri_str = format!(
348 "{}/v1/users/{userId}/balance",
349 local_var_configuration.base_path,
350 userId = crate::apis::urlencode(user_id)
351 );
352 let mut local_var_req_builder =
353 local_var_client.request(reqwest::Method::GET, local_var_uri_str.as_str());
354
355 if let Some(ref local_var_user_agent) = local_var_configuration.user_agent {
356 local_var_req_builder =
357 local_var_req_builder.header(reqwest::header::USER_AGENT, local_var_user_agent.clone());
358 }
359 if let Some(ref local_var_token) = local_var_configuration.bearer_access_token {
360 local_var_req_builder = local_var_req_builder.bearer_auth(local_var_token.to_owned());
361 };
362
363 let local_var_req = local_var_req_builder.build()?;
364 let local_var_resp = local_var_client.execute(local_var_req).await?;
365
366 let local_var_status = local_var_resp.status();
367 let local_var_content = local_var_resp.text().await?;
368
369 if !local_var_status.is_client_error() && !local_var_status.is_server_error() {
370 serde_json::from_str(&local_var_content).map_err(Error::from)
371 } else {
372 let local_var_entity: Option<GetUserBalanceError> =
373 serde_json::from_str(&local_var_content).ok();
374 let local_var_error = ResponseContent {
375 status: local_var_status,
376 content: local_var_content,
377 entity: local_var_entity,
378 };
379 Err(Error::ResponseError(local_var_error))
380 }
381}
382
383pub async fn get_user_billing_customer(
385 configuration: &configuration::Configuration,
386 user_id: &str,
387) -> Result<crate::models::BillingCustomer, Error<GetUserBillingCustomerError>> {
388 let local_var_configuration = configuration;
389
390 let local_var_client = &local_var_configuration.client;
391
392 let local_var_uri_str = format!(
393 "{}/v1/users/{userId}/billingCustomer",
394 local_var_configuration.base_path,
395 userId = crate::apis::urlencode(user_id)
396 );
397 let mut local_var_req_builder =
398 local_var_client.request(reqwest::Method::GET, local_var_uri_str.as_str());
399
400 if let Some(ref local_var_user_agent) = local_var_configuration.user_agent {
401 local_var_req_builder =
402 local_var_req_builder.header(reqwest::header::USER_AGENT, local_var_user_agent.clone());
403 }
404 if let Some(ref local_var_token) = local_var_configuration.bearer_access_token {
405 local_var_req_builder = local_var_req_builder.bearer_auth(local_var_token.to_owned());
406 };
407
408 let local_var_req = local_var_req_builder.build()?;
409 let local_var_resp = local_var_client.execute(local_var_req).await?;
410
411 let local_var_status = local_var_resp.status();
412 let local_var_content = local_var_resp.text().await?;
413
414 if !local_var_status.is_client_error() && !local_var_status.is_server_error() {
415 serde_json::from_str(&local_var_content).map_err(Error::from)
416 } else {
417 let local_var_entity: Option<GetUserBillingCustomerError> =
418 serde_json::from_str(&local_var_content).ok();
419 let local_var_error = ResponseContent {
420 status: local_var_status,
421 content: local_var_content,
422 entity: local_var_entity,
423 };
424 Err(Error::ResponseError(local_var_error))
425 }
426}
427
428pub async fn get_user_upcoming_billing_invoice(
430 configuration: &configuration::Configuration,
431 user_id: &str,
432) -> Result<crate::models::BillingUpcomingInvoice, Error<GetUserUpcomingBillingInvoiceError>> {
433 let local_var_configuration = configuration;
434
435 let local_var_client = &local_var_configuration.client;
436
437 let local_var_uri_str = format!(
438 "{}/v1/users/{userId}/billingInvoices:getUpcoming",
439 local_var_configuration.base_path,
440 userId = crate::apis::urlencode(user_id)
441 );
442 let mut local_var_req_builder =
443 local_var_client.request(reqwest::Method::GET, local_var_uri_str.as_str());
444
445 if let Some(ref local_var_user_agent) = local_var_configuration.user_agent {
446 local_var_req_builder =
447 local_var_req_builder.header(reqwest::header::USER_AGENT, local_var_user_agent.clone());
448 }
449 if let Some(ref local_var_token) = local_var_configuration.bearer_access_token {
450 local_var_req_builder = local_var_req_builder.bearer_auth(local_var_token.to_owned());
451 };
452
453 let local_var_req = local_var_req_builder.build()?;
454 let local_var_resp = local_var_client.execute(local_var_req).await?;
455
456 let local_var_status = local_var_resp.status();
457 let local_var_content = local_var_resp.text().await?;
458
459 if !local_var_status.is_client_error() && !local_var_status.is_server_error() {
460 serde_json::from_str(&local_var_content).map_err(Error::from)
461 } else {
462 let local_var_entity: Option<GetUserUpcomingBillingInvoiceError> =
463 serde_json::from_str(&local_var_content).ok();
464 let local_var_error = ResponseContent {
465 status: local_var_status,
466 content: local_var_content,
467 entity: local_var_entity,
468 };
469 Err(Error::ResponseError(local_var_error))
470 }
471}
472
473pub async fn list_group_billing_invoice_lines(
475 configuration: &configuration::Configuration,
476 group_name: &str,
477 billing_invoice_id: &str,
478 page_token: Option<&str>,
479 page_size: Option<i32>,
480) -> Result<
481 crate::models::ListAccountBillingInvoiceLinesResponse,
482 Error<ListGroupBillingInvoiceLinesError>,
483> {
484 let local_var_configuration = configuration;
485
486 let local_var_client = &local_var_configuration.client;
487
488 let local_var_uri_str = format!(
489 "{}/v1/groups/{groupName}/billingInvoices/{billingInvoiceId}/lines",
490 local_var_configuration.base_path,
491 groupName = crate::apis::urlencode(group_name),
492 billingInvoiceId = crate::apis::urlencode(billing_invoice_id)
493 );
494 let mut local_var_req_builder =
495 local_var_client.request(reqwest::Method::GET, local_var_uri_str.as_str());
496
497 if let Some(ref local_var_str) = page_token {
498 local_var_req_builder =
499 local_var_req_builder.query(&[("pageToken", &local_var_str.to_string())]);
500 }
501 if let Some(ref local_var_str) = page_size {
502 local_var_req_builder =
503 local_var_req_builder.query(&[("pageSize", &local_var_str.to_string())]);
504 }
505 if let Some(ref local_var_user_agent) = local_var_configuration.user_agent {
506 local_var_req_builder =
507 local_var_req_builder.header(reqwest::header::USER_AGENT, local_var_user_agent.clone());
508 }
509 if let Some(ref local_var_token) = local_var_configuration.bearer_access_token {
510 local_var_req_builder = local_var_req_builder.bearer_auth(local_var_token.to_owned());
511 };
512
513 let local_var_req = local_var_req_builder.build()?;
514 let local_var_resp = local_var_client.execute(local_var_req).await?;
515
516 let local_var_status = local_var_resp.status();
517 let local_var_content = local_var_resp.text().await?;
518
519 if !local_var_status.is_client_error() && !local_var_status.is_server_error() {
520 serde_json::from_str(&local_var_content).map_err(Error::from)
521 } else {
522 let local_var_entity: Option<ListGroupBillingInvoiceLinesError> =
523 serde_json::from_str(&local_var_content).ok();
524 let local_var_error = ResponseContent {
525 status: local_var_status,
526 content: local_var_content,
527 entity: local_var_entity,
528 };
529 Err(Error::ResponseError(local_var_error))
530 }
531}
532
533pub async fn list_group_billing_invoices(
535 configuration: &configuration::Configuration,
536 group_name: &str,
537 page_token: Option<&str>,
538 page_size: Option<i32>,
539) -> Result<crate::models::ListAccountBillingInvoicesResponse, Error<ListGroupBillingInvoicesError>>
540{
541 let local_var_configuration = configuration;
542
543 let local_var_client = &local_var_configuration.client;
544
545 let local_var_uri_str = format!(
546 "{}/v1/groups/{groupName}/billingInvoices",
547 local_var_configuration.base_path,
548 groupName = crate::apis::urlencode(group_name)
549 );
550 let mut local_var_req_builder =
551 local_var_client.request(reqwest::Method::GET, local_var_uri_str.as_str());
552
553 if let Some(ref local_var_str) = page_token {
554 local_var_req_builder =
555 local_var_req_builder.query(&[("pageToken", &local_var_str.to_string())]);
556 }
557 if let Some(ref local_var_str) = page_size {
558 local_var_req_builder =
559 local_var_req_builder.query(&[("pageSize", &local_var_str.to_string())]);
560 }
561 if let Some(ref local_var_user_agent) = local_var_configuration.user_agent {
562 local_var_req_builder =
563 local_var_req_builder.header(reqwest::header::USER_AGENT, local_var_user_agent.clone());
564 }
565 if let Some(ref local_var_token) = local_var_configuration.bearer_access_token {
566 local_var_req_builder = local_var_req_builder.bearer_auth(local_var_token.to_owned());
567 };
568
569 let local_var_req = local_var_req_builder.build()?;
570 let local_var_resp = local_var_client.execute(local_var_req).await?;
571
572 let local_var_status = local_var_resp.status();
573 let local_var_content = local_var_resp.text().await?;
574
575 if !local_var_status.is_client_error() && !local_var_status.is_server_error() {
576 serde_json::from_str(&local_var_content).map_err(Error::from)
577 } else {
578 let local_var_entity: Option<ListGroupBillingInvoicesError> =
579 serde_json::from_str(&local_var_content).ok();
580 let local_var_error = ResponseContent {
581 status: local_var_status,
582 content: local_var_content,
583 entity: local_var_entity,
584 };
585 Err(Error::ResponseError(local_var_error))
586 }
587}
588
589pub async fn list_group_upcoming_billing_invoice_lines(
591 configuration: &configuration::Configuration,
592 group_name: &str,
593 page_token: Option<&str>,
594 page_size: Option<i32>,
595) -> Result<
596 crate::models::ListAccountBillingInvoiceLinesResponse,
597 Error<ListGroupUpcomingBillingInvoiceLinesError>,
598> {
599 let local_var_configuration = configuration;
600
601 let local_var_client = &local_var_configuration.client;
602
603 let local_var_uri_str = format!(
604 "{}/v1/groups/{groupName}/billingInvoices:listUpcomingLines",
605 local_var_configuration.base_path,
606 groupName = crate::apis::urlencode(group_name)
607 );
608 let mut local_var_req_builder =
609 local_var_client.request(reqwest::Method::GET, local_var_uri_str.as_str());
610
611 if let Some(ref local_var_str) = page_token {
612 local_var_req_builder =
613 local_var_req_builder.query(&[("pageToken", &local_var_str.to_string())]);
614 }
615 if let Some(ref local_var_str) = page_size {
616 local_var_req_builder =
617 local_var_req_builder.query(&[("pageSize", &local_var_str.to_string())]);
618 }
619 if let Some(ref local_var_user_agent) = local_var_configuration.user_agent {
620 local_var_req_builder =
621 local_var_req_builder.header(reqwest::header::USER_AGENT, local_var_user_agent.clone());
622 }
623 if let Some(ref local_var_token) = local_var_configuration.bearer_access_token {
624 local_var_req_builder = local_var_req_builder.bearer_auth(local_var_token.to_owned());
625 };
626
627 let local_var_req = local_var_req_builder.build()?;
628 let local_var_resp = local_var_client.execute(local_var_req).await?;
629
630 let local_var_status = local_var_resp.status();
631 let local_var_content = local_var_resp.text().await?;
632
633 if !local_var_status.is_client_error() && !local_var_status.is_server_error() {
634 serde_json::from_str(&local_var_content).map_err(Error::from)
635 } else {
636 let local_var_entity: Option<ListGroupUpcomingBillingInvoiceLinesError> =
637 serde_json::from_str(&local_var_content).ok();
638 let local_var_error = ResponseContent {
639 status: local_var_status,
640 content: local_var_content,
641 entity: local_var_entity,
642 };
643 Err(Error::ResponseError(local_var_error))
644 }
645}
646
647pub async fn list_group_users(
649 configuration: &configuration::Configuration,
650 group_name: &str,
651 page_size: Option<i32>,
652 page_token: Option<&str>,
653) -> Result<crate::models::ListGroupUsersResponse, Error<ListGroupUsersError>> {
654 let local_var_configuration = configuration;
655
656 let local_var_client = &local_var_configuration.client;
657
658 let local_var_uri_str = format!(
659 "{}/v1/groups/{groupName}/users",
660 local_var_configuration.base_path,
661 groupName = crate::apis::urlencode(group_name)
662 );
663 let mut local_var_req_builder =
664 local_var_client.request(reqwest::Method::GET, local_var_uri_str.as_str());
665
666 if let Some(ref local_var_str) = page_size {
667 local_var_req_builder =
668 local_var_req_builder.query(&[("pageSize", &local_var_str.to_string())]);
669 }
670 if let Some(ref local_var_str) = page_token {
671 local_var_req_builder =
672 local_var_req_builder.query(&[("pageToken", &local_var_str.to_string())]);
673 }
674 if let Some(ref local_var_user_agent) = local_var_configuration.user_agent {
675 local_var_req_builder =
676 local_var_req_builder.header(reqwest::header::USER_AGENT, local_var_user_agent.clone());
677 }
678 if let Some(ref local_var_token) = local_var_configuration.bearer_access_token {
679 local_var_req_builder = local_var_req_builder.bearer_auth(local_var_token.to_owned());
680 };
681
682 let local_var_req = local_var_req_builder.build()?;
683 let local_var_resp = local_var_client.execute(local_var_req).await?;
684
685 let local_var_status = local_var_resp.status();
686 let local_var_content = local_var_resp.text().await?;
687
688 if !local_var_status.is_client_error() && !local_var_status.is_server_error() {
689 serde_json::from_str(&local_var_content).map_err(Error::from)
690 } else {
691 let local_var_entity: Option<ListGroupUsersError> =
692 serde_json::from_str(&local_var_content).ok();
693 let local_var_error = ResponseContent {
694 status: local_var_status,
695 content: local_var_content,
696 entity: local_var_entity,
697 };
698 Err(Error::ResponseError(local_var_error))
699 }
700}
701
702pub async fn list_user_billing_invoice_lines(
704 configuration: &configuration::Configuration,
705 user_id: &str,
706 billing_invoice_id: &str,
707 page_token: Option<&str>,
708 page_size: Option<i32>,
709) -> Result<
710 crate::models::ListAccountBillingInvoiceLinesResponse,
711 Error<ListUserBillingInvoiceLinesError>,
712> {
713 let local_var_configuration = configuration;
714
715 let local_var_client = &local_var_configuration.client;
716
717 let local_var_uri_str = format!(
718 "{}/v1/users/{userId}/billingInvoices/{billingInvoiceId}/lines",
719 local_var_configuration.base_path,
720 userId = crate::apis::urlencode(user_id),
721 billingInvoiceId = crate::apis::urlencode(billing_invoice_id)
722 );
723 let mut local_var_req_builder =
724 local_var_client.request(reqwest::Method::GET, local_var_uri_str.as_str());
725
726 if let Some(ref local_var_str) = page_token {
727 local_var_req_builder =
728 local_var_req_builder.query(&[("pageToken", &local_var_str.to_string())]);
729 }
730 if let Some(ref local_var_str) = page_size {
731 local_var_req_builder =
732 local_var_req_builder.query(&[("pageSize", &local_var_str.to_string())]);
733 }
734 if let Some(ref local_var_user_agent) = local_var_configuration.user_agent {
735 local_var_req_builder =
736 local_var_req_builder.header(reqwest::header::USER_AGENT, local_var_user_agent.clone());
737 }
738 if let Some(ref local_var_token) = local_var_configuration.bearer_access_token {
739 local_var_req_builder = local_var_req_builder.bearer_auth(local_var_token.to_owned());
740 };
741
742 let local_var_req = local_var_req_builder.build()?;
743 let local_var_resp = local_var_client.execute(local_var_req).await?;
744
745 let local_var_status = local_var_resp.status();
746 let local_var_content = local_var_resp.text().await?;
747
748 if !local_var_status.is_client_error() && !local_var_status.is_server_error() {
749 serde_json::from_str(&local_var_content).map_err(Error::from)
750 } else {
751 let local_var_entity: Option<ListUserBillingInvoiceLinesError> =
752 serde_json::from_str(&local_var_content).ok();
753 let local_var_error = ResponseContent {
754 status: local_var_status,
755 content: local_var_content,
756 entity: local_var_entity,
757 };
758 Err(Error::ResponseError(local_var_error))
759 }
760}
761
762pub async fn list_user_billing_invoices(
764 configuration: &configuration::Configuration,
765 user_id: &str,
766 page_token: Option<&str>,
767 page_size: Option<i32>,
768) -> Result<crate::models::ListAccountBillingInvoicesResponse, Error<ListUserBillingInvoicesError>>
769{
770 let local_var_configuration = configuration;
771
772 let local_var_client = &local_var_configuration.client;
773
774 let local_var_uri_str = format!(
775 "{}/v1/users/{userId}/billingInvoices",
776 local_var_configuration.base_path,
777 userId = crate::apis::urlencode(user_id)
778 );
779 let mut local_var_req_builder =
780 local_var_client.request(reqwest::Method::GET, local_var_uri_str.as_str());
781
782 if let Some(ref local_var_str) = page_token {
783 local_var_req_builder =
784 local_var_req_builder.query(&[("pageToken", &local_var_str.to_string())]);
785 }
786 if let Some(ref local_var_str) = page_size {
787 local_var_req_builder =
788 local_var_req_builder.query(&[("pageSize", &local_var_str.to_string())]);
789 }
790 if let Some(ref local_var_user_agent) = local_var_configuration.user_agent {
791 local_var_req_builder =
792 local_var_req_builder.header(reqwest::header::USER_AGENT, local_var_user_agent.clone());
793 }
794 if let Some(ref local_var_token) = local_var_configuration.bearer_access_token {
795 local_var_req_builder = local_var_req_builder.bearer_auth(local_var_token.to_owned());
796 };
797
798 let local_var_req = local_var_req_builder.build()?;
799 let local_var_resp = local_var_client.execute(local_var_req).await?;
800
801 let local_var_status = local_var_resp.status();
802 let local_var_content = local_var_resp.text().await?;
803
804 if !local_var_status.is_client_error() && !local_var_status.is_server_error() {
805 serde_json::from_str(&local_var_content).map_err(Error::from)
806 } else {
807 let local_var_entity: Option<ListUserBillingInvoicesError> =
808 serde_json::from_str(&local_var_content).ok();
809 let local_var_error = ResponseContent {
810 status: local_var_status,
811 content: local_var_content,
812 entity: local_var_entity,
813 };
814 Err(Error::ResponseError(local_var_error))
815 }
816}
817
818pub async fn list_user_groups(
820 configuration: &configuration::Configuration,
821 user_id: &str,
822 page_size: Option<i32>,
823 page_token: Option<&str>,
824) -> Result<crate::models::ListGroupsResponse, Error<ListUserGroupsError>> {
825 let local_var_configuration = configuration;
826
827 let local_var_client = &local_var_configuration.client;
828
829 let local_var_uri_str = format!(
830 "{}/v1/users/{userId}/groups",
831 local_var_configuration.base_path,
832 userId = crate::apis::urlencode(user_id)
833 );
834 let mut local_var_req_builder =
835 local_var_client.request(reqwest::Method::GET, local_var_uri_str.as_str());
836
837 if let Some(ref local_var_str) = page_size {
838 local_var_req_builder =
839 local_var_req_builder.query(&[("pageSize", &local_var_str.to_string())]);
840 }
841 if let Some(ref local_var_str) = page_token {
842 local_var_req_builder =
843 local_var_req_builder.query(&[("pageToken", &local_var_str.to_string())]);
844 }
845 if let Some(ref local_var_user_agent) = local_var_configuration.user_agent {
846 local_var_req_builder =
847 local_var_req_builder.header(reqwest::header::USER_AGENT, local_var_user_agent.clone());
848 }
849 if let Some(ref local_var_token) = local_var_configuration.bearer_access_token {
850 local_var_req_builder = local_var_req_builder.bearer_auth(local_var_token.to_owned());
851 };
852
853 let local_var_req = local_var_req_builder.build()?;
854 let local_var_resp = local_var_client.execute(local_var_req).await?;
855
856 let local_var_status = local_var_resp.status();
857 let local_var_content = local_var_resp.text().await?;
858
859 if !local_var_status.is_client_error() && !local_var_status.is_server_error() {
860 serde_json::from_str(&local_var_content).map_err(Error::from)
861 } else {
862 let local_var_entity: Option<ListUserGroupsError> =
863 serde_json::from_str(&local_var_content).ok();
864 let local_var_error = ResponseContent {
865 status: local_var_status,
866 content: local_var_content,
867 entity: local_var_entity,
868 };
869 Err(Error::ResponseError(local_var_error))
870 }
871}
872
873pub async fn list_user_upcoming_billing_invoice_lines(
875 configuration: &configuration::Configuration,
876 user_id: &str,
877 page_token: Option<&str>,
878 page_size: Option<i32>,
879) -> Result<
880 crate::models::ListAccountBillingInvoiceLinesResponse,
881 Error<ListUserUpcomingBillingInvoiceLinesError>,
882> {
883 let local_var_configuration = configuration;
884
885 let local_var_client = &local_var_configuration.client;
886
887 let local_var_uri_str = format!(
888 "{}/v1/users/{userId}/billingInvoices:listUpcomingLines",
889 local_var_configuration.base_path,
890 userId = crate::apis::urlencode(user_id)
891 );
892 let mut local_var_req_builder =
893 local_var_client.request(reqwest::Method::GET, local_var_uri_str.as_str());
894
895 if let Some(ref local_var_str) = page_token {
896 local_var_req_builder =
897 local_var_req_builder.query(&[("pageToken", &local_var_str.to_string())]);
898 }
899 if let Some(ref local_var_str) = page_size {
900 local_var_req_builder =
901 local_var_req_builder.query(&[("pageSize", &local_var_str.to_string())]);
902 }
903 if let Some(ref local_var_user_agent) = local_var_configuration.user_agent {
904 local_var_req_builder =
905 local_var_req_builder.header(reqwest::header::USER_AGENT, local_var_user_agent.clone());
906 }
907 if let Some(ref local_var_token) = local_var_configuration.bearer_access_token {
908 local_var_req_builder = local_var_req_builder.bearer_auth(local_var_token.to_owned());
909 };
910
911 let local_var_req = local_var_req_builder.build()?;
912 let local_var_resp = local_var_client.execute(local_var_req).await?;
913
914 let local_var_status = local_var_resp.status();
915 let local_var_content = local_var_resp.text().await?;
916
917 if !local_var_status.is_client_error() && !local_var_status.is_server_error() {
918 serde_json::from_str(&local_var_content).map_err(Error::from)
919 } else {
920 let local_var_entity: Option<ListUserUpcomingBillingInvoiceLinesError> =
921 serde_json::from_str(&local_var_content).ok();
922 let local_var_error = ResponseContent {
923 status: local_var_status,
924 content: local_var_content,
925 entity: local_var_entity,
926 };
927 Err(Error::ResponseError(local_var_error))
928 }
929}
930
931pub async fn remove_group_user(
933 configuration: &configuration::Configuration,
934 remove_group_user_request: crate::models::RemoveGroupUserRequest,
935) -> Result<(), Error<RemoveGroupUserError>> {
936 let local_var_configuration = configuration;
937
938 let local_var_client = &local_var_configuration.client;
939
940 let local_var_uri_str = format!("{}/v1/groups:removeUser", local_var_configuration.base_path);
941 let mut local_var_req_builder =
942 local_var_client.request(reqwest::Method::POST, local_var_uri_str.as_str());
943
944 if let Some(ref local_var_user_agent) = local_var_configuration.user_agent {
945 local_var_req_builder =
946 local_var_req_builder.header(reqwest::header::USER_AGENT, local_var_user_agent.clone());
947 }
948 if let Some(ref local_var_token) = local_var_configuration.bearer_access_token {
949 local_var_req_builder = local_var_req_builder.bearer_auth(local_var_token.to_owned());
950 };
951 local_var_req_builder = local_var_req_builder.json(&remove_group_user_request);
952
953 let local_var_req = local_var_req_builder.build()?;
954 let local_var_resp = local_var_client.execute(local_var_req).await?;
955
956 let local_var_status = local_var_resp.status();
957 let local_var_content = local_var_resp.text().await?;
958
959 if !local_var_status.is_client_error() && !local_var_status.is_server_error() {
960 Ok(())
961 } else {
962 let local_var_entity: Option<RemoveGroupUserError> =
963 serde_json::from_str(&local_var_content).ok();
964 let local_var_error = ResponseContent {
965 status: local_var_status,
966 content: local_var_content,
967 entity: local_var_entity,
968 };
969 Err(Error::ResponseError(local_var_error))
970 }
971}