cata_log_hub.api.v1.models module

class cata_log_hub.api.v1.models.OrderChoices[source]

Bases: StrEnum

Enum subclass for ordering with sql.

sql(model)[source]

Translate into sql.

Returns:

SQL expression for proper ordering by the string.

Parameters:

model (type[ModelBase])

Return type:

ColumnElement[_T] | _HasClauseElement[_T] | SQLCoreOperations[_T] | ExpressionElementRole[_T] | TypedColumnsClauseRole[_T] | Callable[[], ColumnElement[_T]] | LambdaElement

static _generate_next_value_(name, start, count, last_values)

Return the lower-cased version of the member name.

__new__(value)
__str__()

Return str(self).

class cata_log_hub.api.v1.models.AwareTimestampsMixin[source]

Bases: AwareDatetimesMixin

Mixin for api data with aware datetimes and database timestamps.

created_at: AwareDatetime
updated_at: AwareDatetime
class cata_log_hub.api.v1.models.Catalog[source]

Bases: AwareTimestampsMixin, BaseModel

Catalog data model.

id: int
provider_id: int
valid_since: AwareDatetime
valid_until: AwareDatetime
model_config: ClassVar[ConfigDict] = {}

Configuration for the model, should be a dictionary conforming to [ConfigDict][pydantic.config.ConfigDict].

class cata_log_hub.api.v1.models.CatalogOrderChoices[source]

Bases: OrderChoices

Choices for ordering catalogs.

ID = 'id'
VALID_SINCE = 'valid_since'
VALID_UNTIL = 'valid_until'
CREATED_AT = 'created_at'
UPDATED_AT = 'updated_at'
DESC_ID = '-id'
DESC_VALID_SINCE = '-valid_since'
DESC_VALID_UNTIL = '-valid_until'
DESC_CREATED_AT = '-created_at'
DESC_UPDATED_AT = '-updated_at'
static _generate_next_value_(name, start, count, last_values)

Return the lower-cased version of the member name.

__str__()

Return str(self).

__new__(value)
class cata_log_hub.api.v1.models.FullCatalog[source]

Bases: Catalog

Full catalog data model.

pages: list[Page]
model_config: ClassVar[ConfigDict] = {}

Configuration for the model, should be a dictionary conforming to [ConfigDict][pydantic.config.ConfigDict].

class cata_log_hub.api.v1.models.PageFile[source]

Bases: AwareTimestampsMixin, BaseModel

Page file data model.

id: int
sha256: StringConstraints(strip_whitespace=True, to_upper=None, to_lower=None, strict=None, min_length=None, max_length=None, pattern=^[a-f0-9]{64}$, ascii_only=None)]
size: Annotated[int, Gt(gt=0)]
width: Annotated[int, Gt(gt=0)]
height: Annotated[int, Gt(gt=0)]
name: str
model_config: ClassVar[ConfigDict] = {}

Configuration for the model, should be a dictionary conforming to [ConfigDict][pydantic.config.ConfigDict].

class cata_log_hub.api.v1.models.Page[source]

Bases: AwareTimestampsMixin, BaseModel

Page data model.

id: int
number: Annotated[int, Ge(ge=0)]
catalog_id: int
file: PageFile
model_config: ClassVar[ConfigDict] = {}

Configuration for the model, should be a dictionary conforming to [ConfigDict][pydantic.config.ConfigDict].

class cata_log_hub.api.v1.models.PageOrderChoices[source]

Bases: OrderChoices

Choices for ordering pages.

ID = 'id'
NUMBER = 'number'
CATALOG_ID = 'catalog_id'
CREATED_AT = 'created_at'
UPDATED_AT = 'updated_at'
DESC_ID = '-id'
DESC_NUMBER = '-number'
DESC_CATALOG_ID = '-catalog_id'
DESC_CREATED_AT = '-created_at'
DESC_UPDATED_AT = '-updated_at'
static _generate_next_value_(name, start, count, last_values)

Return the lower-cased version of the member name.

__str__()

Return str(self).

__new__(value)
class cata_log_hub.api.v1.models.Job[source]

Bases: AwareDatetimesMixin, BaseModel

Job data model.

id: str
next_run_time: AwareDatetime | None
schedule: CronStr | None
jitter: int
classmethod get_schedule_from_trigger(trigger)[source]

Get the crontab schedule as a string.

Return type:

str | None

Parameters:

trigger (BaseTrigger)

classmethod get_jitter_from_trigger(trigger)[source]

Get the crontab schedule as a string.

Return type:

int

Parameters:

trigger (BaseTrigger)

model_config: ClassVar[ConfigDict] = {}

Configuration for the model, should be a dictionary conforming to [ConfigDict][pydantic.config.ConfigDict].

class cata_log_hub.api.v1.models.Provider[source]

Bases: AwareTimestampsMixin, BaseModel

Provider data model.

id: int
class_uid: str
note: str | None
configuration: dict[str, Any]
status: StatusEnum
job: Job | None
model_config: ClassVar[ConfigDict] = {}

Configuration for the model, should be a dictionary conforming to [ConfigDict][pydantic.config.ConfigDict].

class cata_log_hub.api.v1.models.ProviderOrderChoices[source]

Bases: OrderChoices

Choices for ordering providers.

ID = 'id'
CLASS_UID = 'class_uid'
NOTE = 'note'
CONFIGURATION = 'configuration'
STATUS = 'status'
CREATED_AT = 'created_at'
UPDATED_AT = 'updated_at'
DESC_ID = '-id'
DESC_CLASS_UID = '-class_uid'
DESC_NOTE = '-note'
DESC_CONFIGURATION = '-configuration'
DESC_STATUS = '-status'
DESC_CREATED_AT = '-created_at'
DESC_UPDATED_AT = '-updated_at'
static _generate_next_value_(name, start, count, last_values)

Return the lower-cased version of the member name.

__str__()

Return str(self).

__new__(value)
class cata_log_hub.api.v1.models.FullProvider[source]

Bases: Provider

Full provider data model.

catalogs: list[Catalog]
model_config: ClassVar[ConfigDict] = {}

Configuration for the model, should be a dictionary conforming to [ConfigDict][pydantic.config.ConfigDict].

class cata_log_hub.api.v1.models.ProviderUpdate[source]

Bases: BaseModel

Provider update data model.

configuration: dict[str, Any]
note: str
classmethod validate_configuration(configuration, info)[source]

Validate the provider specific configuration.

Return type:

dict[str, Any]

Parameters:
model_config: ClassVar[ConfigDict] = {}

Configuration for the model, should be a dictionary conforming to [ConfigDict][pydantic.config.ConfigDict].

class cata_log_hub.api.v1.models.NewProvider[source]

Bases: BaseModel

Provider creation data model.

class_uid: str
configuration: dict[str, Any]
note: str | None
classmethod validate_class_uid(class_uid)[source]

Validate the provider class uid.

Return type:

str

Parameters:

class_uid (str)

classmethod validate_configuration(configuration, info)[source]

Validate the provider specific configuration.

Return type:

dict[str, Any]

Parameters:
model_config: ClassVar[ConfigDict] = {}

Configuration for the model, should be a dictionary conforming to [ConfigDict][pydantic.config.ConfigDict].

class cata_log_hub.api.v1.models.RegionInfo[source]

Bases: BaseModel

Region info data model.

local_name: str
language_code: str
timezone: str
classmethod get_timezone_name(timezone)[source]

Get timezone’s name.

Return type:

str

Parameters:

timezone (ZoneInfo)

model_config: ClassVar[ConfigDict] = {}

Configuration for the model, should be a dictionary conforming to [ConfigDict][pydantic.config.ConfigDict].

class cata_log_hub.api.v1.models.ConfigInfo[source]

Bases: BaseModel

Configuration info data model.

description: str
default: str | None
type: str
classmethod get_type_name(annotation)[source]

Get the type name of the config.

Return type:

str

Parameters:

annotation (FieldInfo(annotation=NoneType, required=True, alias_priority=2, validation_alias='annotation'))

classmethod convert_default(default)[source]

Convert default to string.

Return type:

str | None

Parameters:

default (str | None)

model_config: ClassVar[ConfigDict] = {}

Configuration for the model, should be a dictionary conforming to [ConfigDict][pydantic.config.ConfigDict].

class cata_log_hub.api.v1.models.ProviderInfo[source]

Bases: BaseModel

Provider info data model.

name: str
description: str
url: str
region: RegionInfo
schedule: CronStr
jitter: int
class_uid: str
configuration: dict[str, ConfigInfo]
classmethod get_configuration_schema(configuration_class)[source]

Get the config field infos from the configuration model.

Return type:

dict[str, FieldInfo]

Parameters:

configuration_class (type[Configuration])

model_config: ClassVar[ConfigDict] = {}

Configuration for the model, should be a dictionary conforming to [ConfigDict][pydantic.config.ConfigDict].