Filters
ClassFilter
pydantic-model
¶
Bases: BaseModel
ClassFilter is used to filter classes, to separate the filtering logic from the API client.
The class_type, day_of_week, and start_time fields can either be a single value or a list of values.
If a single value is provided, it will be converted to a list.
The class_type and day_of_week fields can be provided as strings or as the corresponding Enum values. The
class will attempt to match the string to the Enum value, regardless of case.
The arguments are applied as an AND filter, meaning that all filters must match for a class to be included. If a filter is not provided, it is not applied. If multiple values are provided for a filter the values are treated as an OR filter, meaning that a class will be included if it matches any of the values.
All arguments are optional and default to None.
Attributes:
| Name | Type | Description |
|---|---|---|
start_date |
date | str | None
|
Filter classes that start on or after this date. |
end_date |
date | str | None
|
Filter classes that start on or before this date. |
class_type |
list[ClassType] | ClassType | None
|
Filter classes by class type. |
day_of_week |
list[DoW] | DoW | None
|
Filter classes by day of the week. |
start_time |
list[time] | time | None
|
Filter classes by start time. |
Show JSON schema:
{
"$defs": {
"ClassType": {
"description": "High-level classification of OTF class formats.",
"enum": [
"ORANGE_60",
"ORANGE_90",
"OTHER",
"STRENGTH_50",
"TREAD_50"
],
"title": "ClassType",
"type": "string"
},
"DoW": {
"description": "Day of the week, used for filtering classes by schedule day.",
"enum": [
"Monday",
"Tuesday",
"Wednesday",
"Thursday",
"Friday",
"Saturday",
"Sunday"
],
"title": "DoW",
"type": "string"
}
},
"description": "ClassFilter is used to filter classes, to separate the filtering logic from the API client.\n\nThe `class_type`, `day_of_week`, and `start_time` fields can either be a single value or a list of values.\nIf a single value is provided, it will be converted to a list.\n\nThe `class_type` and `day_of_week` fields can be provided as strings or as the corresponding Enum values. The\nclass will attempt to match the string to the Enum value, regardless of case.\n\nThe arguments are applied as an AND filter, meaning that all filters must match for a class to be included. If\na filter is not provided, it is not applied. If multiple values are provided for a filter the values are treated\nas an OR filter, meaning that a class will be included if it matches any of the values.\n\nAll arguments are optional and default to None.\n\nAttributes:\n start_date: Filter classes that start on or after this date.\n end_date: Filter classes that start on or before this date.\n class_type: Filter classes by class type.\n day_of_week: Filter classes by day of the week.\n start_time: Filter classes by start time.",
"properties": {
"start_date": {
"anyOf": [
{
"format": "date",
"type": "string"
},
{
"type": "string"
},
{
"type": "null"
}
],
"default": null,
"title": "Start Date"
},
"end_date": {
"anyOf": [
{
"format": "date",
"type": "string"
},
{
"type": "string"
},
{
"type": "null"
}
],
"default": null,
"title": "End Date"
},
"class_type": {
"anyOf": [
{
"items": {
"$ref": "#/$defs/ClassType"
},
"type": "array"
},
{
"$ref": "#/$defs/ClassType"
},
{
"type": "null"
}
],
"default": null,
"title": "Class Type"
},
"day_of_week": {
"anyOf": [
{
"items": {
"$ref": "#/$defs/DoW"
},
"type": "array"
},
{
"$ref": "#/$defs/DoW"
},
{
"type": "null"
}
],
"default": null,
"title": "Day Of Week"
},
"start_time": {
"anyOf": [
{
"items": {
"format": "time",
"type": "string"
},
"type": "array"
},
{
"format": "time",
"type": "string"
},
{
"type": "null"
}
],
"default": null,
"title": "Start Time"
}
},
"title": "ClassFilter",
"type": "object"
}
Fields:
-
start_date(date | str | None) -
end_date(date | str | None) -
class_type(list[ClassType] | ClassType | None) -
day_of_week(list[DoW] | DoW | None) -
start_time(list[time] | time | None)
Validators:
-
_single_item_to_list→class_type,day_of_week,start_time -
_day_of_week_str_to_enum→day_of_week -
_class_type_str_to_enum→class_type -
_date_string_to_date→start_date,end_date