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
// @generated from the MSP stable schema and protocol sources; do not edit by hand.
use serde::Deserialize;
use serde::Serialize;
/// The current usage window (the provider's 5-hour-class block): verbatim
/// provider percentages with the reset stamp normalized to epoch milliseconds.
#[derive(Debug, Clone, Copy, PartialEq, Eq, Serialize, Deserialize)]
#[serde(rename_all = "camelCase")]
#[non_exhaustive]
pub struct SubscriptionUsageWindow {
/// Percent of the window's budget used: an integer ≥ 0, verbatim from
/// the provider — over-quota values above 100 are valid.
pub used_percent: i64,
/// The window's length in minutes (> 0).
pub window_duration_mins: i64,
/// When the window resets, epoch milliseconds.
pub resets_at_ms: i64,
}
/// The rolling weekly block: same semantics as [`SubscriptionUsageWindow`]
/// without a duration.
#[derive(Debug, Clone, Copy, PartialEq, Eq, Serialize, Deserialize)]
#[serde(rename_all = "camelCase")]
#[non_exhaustive]
pub struct SubscriptionUsageWeekly {
/// Percent of the weekly budget used (integer ≥ 0, may exceed 100).
pub used_percent: i64,
/// When the weekly window resets, epoch milliseconds.
pub resets_at_ms: i64,
}
/// The one usage payload shape: the `usage/read` result's `usage` member and
/// the `usage/changed` params. The numbers are point-in-time — `observedAtMs`
/// is the host's arrival stamp, so a client renders "as of", never implies live
/// data.
#[derive(Debug, Clone, PartialEq, Eq, Serialize, Deserialize)]
#[serde(rename_all = "camelCase")]
#[non_exhaustive]
pub struct SubscriptionUsage {
/// The current window.
pub window: SubscriptionUsageWindow,
/// The rolling weekly block.
pub weekly: SubscriptionUsageWeekly,
/// The provider's subscription tier id, verbatim.
pub tier: String,
/// When the host RECEIVED this observation (frame arrival or mint
/// request-send), epoch milliseconds.
pub observed_at_ms: i64,
}
/// `usage/read` result: `{usage?}` — omitted, never `null`, when the host has
/// observed nothing.
#[derive(Debug, Clone, PartialEq, Eq, Serialize, Deserialize)]
#[serde(rename_all = "camelCase")]
#[non_exhaustive]
pub struct UsageReadResult {
/// The last-observed subscription usage window, when one exists.
#[serde(skip_serializing_if = "Option::is_none")]
pub usage: Option<SubscriptionUsage>,
}