usage
Models for tracking usage statistics for a user.
ResourceUsage
pydantic-model
¶
Bases: BaseModel
Response model for the get_usage_stats endpoint.
Fields:
-
projects(UsageCount) -
studies(UsageCount) -
recordings(UsageCount) -
analyses(UsageCount) -
reports(UsageCount) -
analysis_hours(UsageHours) -
storage(UsageBytes)
analyses
pydantic-field
¶
The total number of analyses created by the user.
analysis_hours
pydantic-field
¶
Analysis hours usage information.
projects
pydantic-field
¶
The total number of projects created by the user.
recordings
pydantic-field
¶
The total number of recordings created by the user.
reports
pydantic-field
¶
The total number of reports created by the user.
storage
pydantic-field
¶
Storage usage information.
studies
pydantic-field
¶
The total number of studies created by the user.
is_within_limit(limit)
¶
Check if the usage represented by this model is within a set of usage limits.
Calls the is_within_limit method on each of the UsageBase fields in this model and returns True if all of them return True and False otherwise. Also returns a list of field names indicating which limits are exceeded if any.
UsageBase
pydantic-model
¶
Bases: BaseModel
Base model for the UsageCount, UsageHours, and UsageBytes models.
The all_time field represents the total number of items counted over the lifetime of the account. The active field represents the total number of items actively in use by the user.
The fields can be non-negative integers or floats. The special case of None is also allowed to represent an unlimited resource when the UsageBase class is used to represent a set of limits on a resource instead of usage statistics. The increment and decrement methods cannot be used when the fields are None.
Fields:
-
all_time(NonNegativeFloat | NonNegativeInt | None) -
active(NonNegativeFloat | NonNegativeInt | None)
active
pydantic-field
¶
Total number of items actively in use by the user.
all_time
pydantic-field
¶
Total number of items counted over the lifetime of the account.
is_within_limit(limit)
¶
Check if the usage represented by this model is within a set of usage limits.
Check if the usage represented by this model is within a set of usage limits represented by the 'limit' model. The usage is satisfied if the all_time and active values in this model are less than or equal to the corresponding values in the 'limit' model or if the corresponding value in the limit model is None.
Examples:
- if the all_time value in this model is 10 and the all_time value in the 'limit' model is 20, then this method will return True.
- If the active value in this model is 10 and the active value in the 'limit' model is None, then this method will return True.
- If the active value in this model is 10 and the active value in the 'limit' model is 5, then this method will return False.