feat: add analytics metric granularity query
Some checks failed
CI / verify (push) Has been cancelled
Some checks failed
CI / verify (push) Has been cancelled
This commit is contained in:
@@ -348,6 +348,31 @@ impl SpacetimeClient {
|
||||
.await
|
||||
}
|
||||
|
||||
pub async fn query_analytics_metric(
|
||||
&self,
|
||||
event_key: String,
|
||||
scope_kind: DomainRuntimeTrackingScopeKind,
|
||||
scope_id: String,
|
||||
granularity: module_runtime::AnalyticsGranularity,
|
||||
) -> Result<DomainAnalyticsMetricQueryResponse, SpacetimeClientError> {
|
||||
let procedure_input =
|
||||
build_analytics_metric_query_input(event_key, scope_kind, scope_id, granularity)
|
||||
.map_err(SpacetimeClientError::validation_failed)?
|
||||
.into();
|
||||
|
||||
self.call_after_connect(move |connection, sender| {
|
||||
connection
|
||||
.procedures()
|
||||
.query_analytics_metric_then(procedure_input, move |_, result| {
|
||||
let mapped = result
|
||||
.map_err(SpacetimeClientError::from_sdk_error)
|
||||
.and_then(map_analytics_metric_query_procedure_result);
|
||||
send_once(&sender, mapped);
|
||||
});
|
||||
})
|
||||
.await
|
||||
}
|
||||
|
||||
pub async fn admin_list_profile_task_configs(
|
||||
&self,
|
||||
admin_user_id: String,
|
||||
|
||||
Reference in New Issue
Block a user