1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
// this file is @generated
use crate::{error::Result, models::*, Configuration};
#[derive(Default)]
pub struct StatisticsAggregateAppStatsOptions {
pub idempotency_key: Option<String>,
}
pub struct Statistics<'a> {
cfg: &'a Configuration,
}
impl<'a> Statistics<'a> {
pub(super) fn new(cfg: &'a Configuration) -> Self {
Self { cfg }
}
/// Creates a background task to calculate the number of message attempts
/// (`messageDestinations`) made for all applications in the environment.
///
/// Note that this endpoint is asynchronous. You will need to poll the `Get
/// Background Task` endpoint to retrieve the results of the operation.
///
/// The completed background task will return a payload like the following:
/// ```json
/// {
/// "id": "qtask_33qe39Stble9Rn3ZxFrqL5ZSsjT",
/// "status": "finished",
/// "task": "application.stats",
/// "data": {
/// "appStats": [
/// {
/// "messageDestinations": 2,
/// "appId": "app_33W1An2Zz5cO9SWbhHsYyDmVC6m",
/// "appUid": null
/// }
/// ]
/// }
/// }
/// ```
pub async fn aggregate_app_stats(
&self,
app_usage_stats_in: AppUsageStatsIn,
options: Option<StatisticsAggregateAppStatsOptions>,
) -> Result<AppUsageStatsOut> {
let StatisticsAggregateAppStatsOptions { idempotency_key } = options.unwrap_or_default();
crate::request::Request::new(http1::Method::POST, "/api/v1/stats/usage/app")
.with_optional_header_param("idempotency-key", idempotency_key)
.with_body_param(app_usage_stats_in)
.execute(self.cfg)
.await
}
/// Creates a background task to calculate the listed event types for all
/// apps in the organization.
///
/// Note that this endpoint is asynchronous. You will need to poll the `Get
/// Background Task` endpoint to retrieve the results of the operation.
///
/// The completed background task will return a payload like the following:
/// ```json
/// {
/// "id": "qtask_33qe39Stble9Rn3ZxFrqL5ZSsjT",
/// "status": "finished",
/// "task": "event-type.aggregate",
/// "data": {
/// "event_types": [
/// {
/// "appId": "app_33W1An2Zz5cO9SWbhHsYyDmVC6m",
/// "explicitlySubscribedEventTypes": ["user.signup", "user.deleted"],
/// "hasCatchAllEndpoint": false
/// }
/// ]
/// }
/// }
/// ```
pub async fn aggregate_event_types(&self) -> Result<AggregateEventTypesOut> {
crate::request::Request::new(http1::Method::PUT, "/api/v1/stats/usage/event-types")
.execute(self.cfg)
.await
}
}