pub struct UsageReport {
pub api_key_name: String,
pub since: DateTime<Utc>,
pub until: DateTime<Utc>,
pub daily: Vec<UsageBucket>,
pub bundle_builds: Option<BundleBuildUsage>,
/* private fields */
}Expand description
Response body of GET /usage.
since is the start of the UTC day it falls in, so it may precede the
requested value.
Fields§
§api_key_name: String§since: DateTime<Utc>§until: DateTime<Utc>§daily: Vec<UsageBucket>One bucket per UTC day in (since, until], ordered and gapless: an idle
day is present with zero counts, and a session ending on a midnight
belongs to the bucket that midnight closes. The series sums to
sessions and compute; it is empty only from a server predating it.
bundle_builds: Option<BundleBuildUsage>Present only for keys with the build_bundle feature.
Implementations§
Source§impl UsageReport
impl UsageReport
Sourcepub fn new(
api_key_name: String,
since: DateTime<Utc>,
until: DateTime<Utc>,
daily: Vec<UsageBucket>,
bundle_builds: Option<BundleBuildUsage>,
) -> Self
pub fn new( api_key_name: String, since: DateTime<Utc>, until: DateTime<Utc>, daily: Vec<UsageBucket>, bundle_builds: Option<BundleBuildUsage>, ) -> Self
Folds the totals from daily, which is the only way to set them.
Sourcepub fn sessions(&self) -> SessionCounts
pub fn sessions(&self) -> SessionCounts
The sum over daily, except on a response from a server predating it,
where it is the total that server reported for the whole window.
Sourcepub fn compute(&self) -> ComputeTotals
pub fn compute(&self) -> ComputeTotals
The sum over daily, except on a response from a server predating it,
where it is the total that server reported for the whole window.
Trait Implementations§
Source§impl Debug for UsageReport
impl Debug for UsageReport
Source§impl<'de> Deserialize<'de> for UsageReport
impl<'de> Deserialize<'de> for UsageReport
Source§fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>where
__D: Deserializer<'de>,
fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>where
__D: Deserializer<'de>,
Auto Trait Implementations§
impl Freeze for UsageReport
impl RefUnwindSafe for UsageReport
impl Send for UsageReport
impl Sync for UsageReport
impl Unpin for UsageReport
impl UnsafeUnpin for UsageReport
impl UnwindSafe for UsageReport
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
impl<ST, DT> CastableFrom<ST, Initialized, Initialized> for DT
impl<ST, DT> CastableFrom<ST, Uninit, Uninit> for DT
impl<T> DeserializeOwned for Twhere
T: for<'de> Deserialize<'de>,
Source§impl<T> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self> ⓘ
fn into_either(self, into_left: bool) -> Either<Self, Self> ⓘ
self into a Left variant of Either<Self, Self>
if into_left is true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self> ⓘ
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self> ⓘ
self into a Left variant of Either<Self, Self>
if into_left(&self) returns true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read more