ssactivewear_sdk.models._base

Internal types.

Attributes

FlexibleInt

An integer that may also arrive as a numeric string or an integral float (-20.00).

OptionalFlexibleInt

A FlexibleInt that may also be missing, null, or an empty string.

FlexibleBool

A boolean that may also arrive as the string "true" or "false".

FlexibleStr

A string identifier that may also arrive as a number.

FlexibleDatetime

A timestamp in ISO 8601 or MM/DD/YYYY form, or empty.

Classes

SSActivewearBaseModel

Custom base model for global settings.

Functions

_blank_to_none(value) → object

Treat an empty string as a missing value.

_number_to_str(value) → object

Accept a number where a string identifier is expected.

_parse_timestamp(value) → object

Accept ISO 8601 or MM/DD/YYYY, and a blank string as missing.

Module Contents

class ssactivewear_sdk.models._base.SSActivewearBaseModel(/, **data: Any)[source]

Bases: pydantic.BaseModel

Custom base model for global settings.

Unknown fields are ignored rather than rejected: S&S adds fields to its payloads over time, and a new field must not break parsing of everything else.

ssactivewear_sdk.models._base._blank_to_none(value: object) → object[source]

Treat an empty string as a missing value.

ssactivewear_sdk.models._base._number_to_str(value: object) → object[source]

Accept a number where a string identifier is expected.

ssactivewear_sdk.models._base._parse_timestamp(value: object) → object[source]

Accept ISO 8601 or MM/DD/YYYY, and a blank string as missing.

A value that matches neither format is passed through unchanged so that validation reports it.

type ssactivewear_sdk.models._base.FlexibleInt = Annotated[int, Strict(strict=False)][source]

An integer that may also arrive as a numeric string or an integral float (-20.00).

type ssactivewear_sdk.models._base.OptionalFlexibleInt = Annotated[FlexibleInt | None, BeforeValidator(_blank_to_none)][source]

A FlexibleInt that may also be missing, null, or an empty string.

type ssactivewear_sdk.models._base.FlexibleBool = Annotated[bool, Strict(strict=False)][source]

A boolean that may also arrive as the string "true" or "false".

type ssactivewear_sdk.models._base.FlexibleStr = Annotated[str, BeforeValidator(_number_to_str)][source]

A string identifier that may also arrive as a number.

type ssactivewear_sdk.models._base.FlexibleDatetime = Annotated[datetime | None, BeforeValidator(_parse_timestamp)][source]

A timestamp in ISO 8601 or MM/DD/YYYY form, or empty.