Skip to content

users

ContributionsDetails

Bases: HordeAPIObjectBaseModel

How many images and megapixelsteps this user has generated.

v2 API Model: ContributionsDetails

Source code in horde_sdk/ai_horde_api/apimodels/users.py
class ContributionsDetails(HordeAPIObjectBaseModel):
    """How many images and megapixelsteps this user has generated.

    v2 API Model: `ContributionsDetails`
    """

    fulfillments: int | None = Field(
        default=None,
    )
    """How many images this user has generated."""
    megapixelsteps: float | None = Field(
        default=None,
    )
    """How many megapixelsteps this user has generated."""

    @override
    @classmethod
    def get_api_model_name(cls) -> str | None:
        return "ContributionsDetails"

fulfillments class-attribute instance-attribute

fulfillments: int | None = Field(default=None)

How many images this user has generated.

megapixelsteps class-attribute instance-attribute

megapixelsteps: float | None = Field(default=None)

How many megapixelsteps this user has generated.

model_config class-attribute instance-attribute

model_config = get_default_frozen_model_config_dict()

get_api_model_name classmethod

get_api_model_name() -> str | None
Source code in horde_sdk/ai_horde_api/apimodels/users.py
@override
@classmethod
def get_api_model_name(cls) -> str | None:
    return "ContributionsDetails"

get_sensitive_fields classmethod

get_sensitive_fields() -> set[str]

Return a set of fields which should be redacted from logs.

Source code in horde_sdk/generic_api/apimodels.py
@classmethod
def get_sensitive_fields(cls) -> set[str]:
    """Return a set of fields which should be redacted from logs."""
    return {"apikey"}

get_extra_fields_to_exclude_from_log

get_extra_fields_to_exclude_from_log() -> set[str]

Return an additional set of fields to exclude from the log_safe_model_dump method.

Source code in horde_sdk/generic_api/apimodels.py
def get_extra_fields_to_exclude_from_log(self) -> set[str]:
    """Return an additional set of fields to exclude from the log_safe_model_dump method."""
    return set()

log_safe_model_dump

log_safe_model_dump(
    extra_exclude: set[str] | None = None,
) -> dict[Any, Any]

Return a dict of the model's fields, with any sensitive fields redacted.

Source code in horde_sdk/generic_api/apimodels.py
def log_safe_model_dump(self, extra_exclude: set[str] | None = None) -> dict[Any, Any]:
    """Return a dict of the model's fields, with any sensitive fields redacted."""
    if extra_exclude is None:
        extra_exclude = set()

    if hasattr(self, "model_dump"):
        return self.model_dump(  # type: ignore
            exclude=self.get_sensitive_fields() | self.get_extra_fields_to_exclude_from_log() | extra_exclude,
        )

    logger.warning("Model does not have a model_dump method. Using python native class compatible method.")
    logger.debug(
        "Generally this should not be relied upon. If you're seeing this and you're a developer for the SDK, "
        "consider using pydantic models instead.",
    )
    # Its not a pydantic model, use python native class compatible method
    return {
        key: getattr(self, key)
        for key in self.__dict__
        if key not in self.get_sensitive_fields() | self.get_extra_fields_to_exclude_from_log() | extra_exclude
    }

UserKudosDetails

Bases: HordeAPIObjectBaseModel

The details of the kudos this user has accumulated, used, sent and received.

v2 API Model: UserKudosDetails

Source code in horde_sdk/ai_horde_api/apimodels/users.py
class UserKudosDetails(HordeAPIObjectBaseModel):
    """The details of the kudos this user has accumulated, used, sent and received.

    v2 API Model: `UserKudosDetails`
    """

    accumulated: float | None = Field(0)
    """The amount of Kudos accumulated or used for generating images."""

    admin: float | None = Field(0)
    """The amount of Kudos this user has been given by the Horde admins."""

    awarded: float | None = Field(0)
    """The amount of Kudos this user has been awarded from things like rating images."""

    gifted: float | None = Field(0)
    """The amount of Kudos this user has given to other users."""

    received: float | None = Field(0)
    """The amount of Kudos this user has been given by other users."""

    donated: float | None = Field(0)
    """The amount of Kudos this user has donated to support education accounts."""

    recurring: float | None = Field(0)
    """The amount of Kudos this user has received from recurring rewards."""

    styled: float | None = Field(0)
    """The amount of Kudos this user has received from styling images."""

    @override
    @classmethod
    def get_api_model_name(cls) -> str | None:
        return "UserKudosDetails"

accumulated class-attribute instance-attribute

accumulated: float | None = Field(0)

The amount of Kudos accumulated or used for generating images.

admin class-attribute instance-attribute

admin: float | None = Field(0)

The amount of Kudos this user has been given by the Horde admins.

awarded class-attribute instance-attribute

awarded: float | None = Field(0)

The amount of Kudos this user has been awarded from things like rating images.

gifted class-attribute instance-attribute

gifted: float | None = Field(0)

The amount of Kudos this user has given to other users.

received class-attribute instance-attribute

received: float | None = Field(0)

The amount of Kudos this user has been given by other users.

donated class-attribute instance-attribute

donated: float | None = Field(0)

The amount of Kudos this user has donated to support education accounts.

recurring class-attribute instance-attribute

recurring: float | None = Field(0)

The amount of Kudos this user has received from recurring rewards.

styled class-attribute instance-attribute

styled: float | None = Field(0)

The amount of Kudos this user has received from styling images.

model_config class-attribute instance-attribute

model_config = get_default_frozen_model_config_dict()

get_api_model_name classmethod

get_api_model_name() -> str | None
Source code in horde_sdk/ai_horde_api/apimodels/users.py
@override
@classmethod
def get_api_model_name(cls) -> str | None:
    return "UserKudosDetails"

get_sensitive_fields classmethod

get_sensitive_fields() -> set[str]

Return a set of fields which should be redacted from logs.

Source code in horde_sdk/generic_api/apimodels.py
@classmethod
def get_sensitive_fields(cls) -> set[str]:
    """Return a set of fields which should be redacted from logs."""
    return {"apikey"}

get_extra_fields_to_exclude_from_log

get_extra_fields_to_exclude_from_log() -> set[str]

Return an additional set of fields to exclude from the log_safe_model_dump method.

Source code in horde_sdk/generic_api/apimodels.py
def get_extra_fields_to_exclude_from_log(self) -> set[str]:
    """Return an additional set of fields to exclude from the log_safe_model_dump method."""
    return set()

log_safe_model_dump

log_safe_model_dump(
    extra_exclude: set[str] | None = None,
) -> dict[Any, Any]

Return a dict of the model's fields, with any sensitive fields redacted.

Source code in horde_sdk/generic_api/apimodels.py
def log_safe_model_dump(self, extra_exclude: set[str] | None = None) -> dict[Any, Any]:
    """Return a dict of the model's fields, with any sensitive fields redacted."""
    if extra_exclude is None:
        extra_exclude = set()

    if hasattr(self, "model_dump"):
        return self.model_dump(  # type: ignore
            exclude=self.get_sensitive_fields() | self.get_extra_fields_to_exclude_from_log() | extra_exclude,
        )

    logger.warning("Model does not have a model_dump method. Using python native class compatible method.")
    logger.debug(
        "Generally this should not be relied upon. If you're seeing this and you're a developer for the SDK, "
        "consider using pydantic models instead.",
    )
    # Its not a pydantic model, use python native class compatible method
    return {
        key: getattr(self, key)
        for key in self.__dict__
        if key not in self.get_sensitive_fields() | self.get_extra_fields_to_exclude_from_log() | extra_exclude
    }

MonthlyKudos

Bases: HordeAPIObjectBaseModel

The details of the monthly kudos this user receives.

v2 API Model: MonthlyKudos

Source code in horde_sdk/ai_horde_api/apimodels/users.py
class MonthlyKudos(HordeAPIObjectBaseModel):
    """The details of the monthly kudos this user receives.

    v2 API Model: `MonthlyKudos`
    """

    amount: int | None = Field(default=None)
    """How much recurring Kudos this user receives monthly."""

    last_received: datetime | None = Field(default=None)
    """Last date this user received monthly Kudos."""

    @override
    @classmethod
    def get_api_model_name(cls) -> str | None:
        return "MonthlyKudos"

amount class-attribute instance-attribute

amount: int | None = Field(default=None)

How much recurring Kudos this user receives monthly.

last_received class-attribute instance-attribute

last_received: datetime | None = Field(default=None)

Last date this user received monthly Kudos.

model_config class-attribute instance-attribute

model_config = get_default_frozen_model_config_dict()

get_api_model_name classmethod

get_api_model_name() -> str | None
Source code in horde_sdk/ai_horde_api/apimodels/users.py
@override
@classmethod
def get_api_model_name(cls) -> str | None:
    return "MonthlyKudos"

get_sensitive_fields classmethod

get_sensitive_fields() -> set[str]

Return a set of fields which should be redacted from logs.

Source code in horde_sdk/generic_api/apimodels.py
@classmethod
def get_sensitive_fields(cls) -> set[str]:
    """Return a set of fields which should be redacted from logs."""
    return {"apikey"}

get_extra_fields_to_exclude_from_log

get_extra_fields_to_exclude_from_log() -> set[str]

Return an additional set of fields to exclude from the log_safe_model_dump method.

Source code in horde_sdk/generic_api/apimodels.py
def get_extra_fields_to_exclude_from_log(self) -> set[str]:
    """Return an additional set of fields to exclude from the log_safe_model_dump method."""
    return set()

log_safe_model_dump

log_safe_model_dump(
    extra_exclude: set[str] | None = None,
) -> dict[Any, Any]

Return a dict of the model's fields, with any sensitive fields redacted.

Source code in horde_sdk/generic_api/apimodels.py
def log_safe_model_dump(self, extra_exclude: set[str] | None = None) -> dict[Any, Any]:
    """Return a dict of the model's fields, with any sensitive fields redacted."""
    if extra_exclude is None:
        extra_exclude = set()

    if hasattr(self, "model_dump"):
        return self.model_dump(  # type: ignore
            exclude=self.get_sensitive_fields() | self.get_extra_fields_to_exclude_from_log() | extra_exclude,
        )

    logger.warning("Model does not have a model_dump method. Using python native class compatible method.")
    logger.debug(
        "Generally this should not be relied upon. If you're seeing this and you're a developer for the SDK, "
        "consider using pydantic models instead.",
    )
    # Its not a pydantic model, use python native class compatible method
    return {
        key: getattr(self, key)
        for key in self.__dict__
        if key not in self.get_sensitive_fields() | self.get_extra_fields_to_exclude_from_log() | extra_exclude
    }

UserThingRecords

Bases: HordeAPIObjectBaseModel

How many images, texts, megapixelsteps and tokens this user has generated or requested.

v2 API Model: UserThingRecords

Source code in horde_sdk/ai_horde_api/apimodels/users.py
class UserThingRecords(HordeAPIObjectBaseModel):
    """How many images, texts, megapixelsteps and tokens this user has generated or requested.

    v2 API Model: `UserThingRecords`
    """

    megapixelsteps: float | None = Field(0)
    """How many megapixelsteps this user has generated or requested."""

    tokens: int | None = Field(0)
    """How many token this user has generated or requested."""

    @override
    @classmethod
    def get_api_model_name(cls) -> str | None:
        return "UserThingRecords"

megapixelsteps class-attribute instance-attribute

megapixelsteps: float | None = Field(0)

How many megapixelsteps this user has generated or requested.

tokens class-attribute instance-attribute

tokens: int | None = Field(0)

How many token this user has generated or requested.

model_config class-attribute instance-attribute

model_config = get_default_frozen_model_config_dict()

get_api_model_name classmethod

get_api_model_name() -> str | None
Source code in horde_sdk/ai_horde_api/apimodels/users.py
@override
@classmethod
def get_api_model_name(cls) -> str | None:
    return "UserThingRecords"

get_sensitive_fields classmethod

get_sensitive_fields() -> set[str]

Return a set of fields which should be redacted from logs.

Source code in horde_sdk/generic_api/apimodels.py
@classmethod
def get_sensitive_fields(cls) -> set[str]:
    """Return a set of fields which should be redacted from logs."""
    return {"apikey"}

get_extra_fields_to_exclude_from_log

get_extra_fields_to_exclude_from_log() -> set[str]

Return an additional set of fields to exclude from the log_safe_model_dump method.

Source code in horde_sdk/generic_api/apimodels.py
def get_extra_fields_to_exclude_from_log(self) -> set[str]:
    """Return an additional set of fields to exclude from the log_safe_model_dump method."""
    return set()

log_safe_model_dump

log_safe_model_dump(
    extra_exclude: set[str] | None = None,
) -> dict[Any, Any]

Return a dict of the model's fields, with any sensitive fields redacted.

Source code in horde_sdk/generic_api/apimodels.py
def log_safe_model_dump(self, extra_exclude: set[str] | None = None) -> dict[Any, Any]:
    """Return a dict of the model's fields, with any sensitive fields redacted."""
    if extra_exclude is None:
        extra_exclude = set()

    if hasattr(self, "model_dump"):
        return self.model_dump(  # type: ignore
            exclude=self.get_sensitive_fields() | self.get_extra_fields_to_exclude_from_log() | extra_exclude,
        )

    logger.warning("Model does not have a model_dump method. Using python native class compatible method.")
    logger.debug(
        "Generally this should not be relied upon. If you're seeing this and you're a developer for the SDK, "
        "consider using pydantic models instead.",
    )
    # Its not a pydantic model, use python native class compatible method
    return {
        key: getattr(self, key)
        for key in self.__dict__
        if key not in self.get_sensitive_fields() | self.get_extra_fields_to_exclude_from_log() | extra_exclude
    }

UserAmountRecords

Bases: HordeAPIObjectBaseModel

How many images, texts, megapixelsteps and tokens this user has generated or requested.

v2 API Model: UserAmountRecords

Source code in horde_sdk/ai_horde_api/apimodels/users.py
class UserAmountRecords(HordeAPIObjectBaseModel):
    """How many images, texts, megapixelsteps and tokens this user has generated or requested.

    v2 API Model: `UserAmountRecords`
    """

    image: int | None = Field(0)
    """How many images this user has generated or requested."""

    interrogation: int | None = Field(0)
    """How many texts this user has generated or requested."""

    text: int | None = Field(0)
    """How many texts this user has generated or requested."""

    @override
    @classmethod
    def get_api_model_name(cls) -> str | None:
        return "UserAmountRecords"

image class-attribute instance-attribute

image: int | None = Field(0)

How many images this user has generated or requested.

interrogation class-attribute instance-attribute

interrogation: int | None = Field(0)

How many texts this user has generated or requested.

text class-attribute instance-attribute

text: int | None = Field(0)

How many texts this user has generated or requested.

model_config class-attribute instance-attribute

model_config = get_default_frozen_model_config_dict()

get_api_model_name classmethod

get_api_model_name() -> str | None
Source code in horde_sdk/ai_horde_api/apimodels/users.py
@override
@classmethod
def get_api_model_name(cls) -> str | None:
    return "UserAmountRecords"

get_sensitive_fields classmethod

get_sensitive_fields() -> set[str]

Return a set of fields which should be redacted from logs.

Source code in horde_sdk/generic_api/apimodels.py
@classmethod
def get_sensitive_fields(cls) -> set[str]:
    """Return a set of fields which should be redacted from logs."""
    return {"apikey"}

get_extra_fields_to_exclude_from_log

get_extra_fields_to_exclude_from_log() -> set[str]

Return an additional set of fields to exclude from the log_safe_model_dump method.

Source code in horde_sdk/generic_api/apimodels.py
def get_extra_fields_to_exclude_from_log(self) -> set[str]:
    """Return an additional set of fields to exclude from the log_safe_model_dump method."""
    return set()

log_safe_model_dump

log_safe_model_dump(
    extra_exclude: set[str] | None = None,
) -> dict[Any, Any]

Return a dict of the model's fields, with any sensitive fields redacted.

Source code in horde_sdk/generic_api/apimodels.py
def log_safe_model_dump(self, extra_exclude: set[str] | None = None) -> dict[Any, Any]:
    """Return a dict of the model's fields, with any sensitive fields redacted."""
    if extra_exclude is None:
        extra_exclude = set()

    if hasattr(self, "model_dump"):
        return self.model_dump(  # type: ignore
            exclude=self.get_sensitive_fields() | self.get_extra_fields_to_exclude_from_log() | extra_exclude,
        )

    logger.warning("Model does not have a model_dump method. Using python native class compatible method.")
    logger.debug(
        "Generally this should not be relied upon. If you're seeing this and you're a developer for the SDK, "
        "consider using pydantic models instead.",
    )
    # Its not a pydantic model, use python native class compatible method
    return {
        key: getattr(self, key)
        for key in self.__dict__
        if key not in self.get_sensitive_fields() | self.get_extra_fields_to_exclude_from_log() | extra_exclude
    }

UserRecords

Bases: HordeAPIObjectBaseModel

How many images, texts, megapixelsteps, tokens and styles this user has generated, requested or has had used.

v2 API Model: UserRecords

Source code in horde_sdk/ai_horde_api/apimodels/users.py
class UserRecords(HordeAPIObjectBaseModel):
    """How many images, texts, megapixelsteps, tokens and styles this user has generated, requested or has had used.

    v2 API Model: `UserRecords`
    """

    contribution: UserThingRecords | None = None
    """How much this user has contributed."""
    fulfillment: UserAmountRecords | None = None
    """How much this user has fulfilled."""
    request: UserAmountRecords | None = None
    """How much this user has requested."""
    usage: UserThingRecords | None = None
    """How much this user has used."""
    style: UserAmountRecords | None = None
    """How much this user's styles have been used."""

    @override
    @classmethod
    def get_api_model_name(cls) -> str | None:
        return "UserRecords"

contribution class-attribute instance-attribute

contribution: UserThingRecords | None = None

How much this user has contributed.

fulfillment class-attribute instance-attribute

fulfillment: UserAmountRecords | None = None

How much this user has fulfilled.

request class-attribute instance-attribute

request: UserAmountRecords | None = None

How much this user has requested.

usage class-attribute instance-attribute

usage: UserThingRecords | None = None

How much this user has used.

style class-attribute instance-attribute

style: UserAmountRecords | None = None

How much this user's styles have been used.

model_config class-attribute instance-attribute

model_config = get_default_frozen_model_config_dict()

get_api_model_name classmethod

get_api_model_name() -> str | None
Source code in horde_sdk/ai_horde_api/apimodels/users.py
@override
@classmethod
def get_api_model_name(cls) -> str | None:
    return "UserRecords"

get_sensitive_fields classmethod

get_sensitive_fields() -> set[str]

Return a set of fields which should be redacted from logs.

Source code in horde_sdk/generic_api/apimodels.py
@classmethod
def get_sensitive_fields(cls) -> set[str]:
    """Return a set of fields which should be redacted from logs."""
    return {"apikey"}

get_extra_fields_to_exclude_from_log

get_extra_fields_to_exclude_from_log() -> set[str]

Return an additional set of fields to exclude from the log_safe_model_dump method.

Source code in horde_sdk/generic_api/apimodels.py
def get_extra_fields_to_exclude_from_log(self) -> set[str]:
    """Return an additional set of fields to exclude from the log_safe_model_dump method."""
    return set()

log_safe_model_dump

log_safe_model_dump(
    extra_exclude: set[str] | None = None,
) -> dict[Any, Any]

Return a dict of the model's fields, with any sensitive fields redacted.

Source code in horde_sdk/generic_api/apimodels.py
def log_safe_model_dump(self, extra_exclude: set[str] | None = None) -> dict[Any, Any]:
    """Return a dict of the model's fields, with any sensitive fields redacted."""
    if extra_exclude is None:
        extra_exclude = set()

    if hasattr(self, "model_dump"):
        return self.model_dump(  # type: ignore
            exclude=self.get_sensitive_fields() | self.get_extra_fields_to_exclude_from_log() | extra_exclude,
        )

    logger.warning("Model does not have a model_dump method. Using python native class compatible method.")
    logger.debug(
        "Generally this should not be relied upon. If you're seeing this and you're a developer for the SDK, "
        "consider using pydantic models instead.",
    )
    # Its not a pydantic model, use python native class compatible method
    return {
        key: getattr(self, key)
        for key in self.__dict__
        if key not in self.get_sensitive_fields() | self.get_extra_fields_to_exclude_from_log() | extra_exclude
    }

UsageDetails

Bases: HordeAPIObjectBaseModel

How many images and megapixelsteps this user has requested.

v2 API Model: UsageDetails

Source code in horde_sdk/ai_horde_api/apimodels/users.py
class UsageDetails(HordeAPIObjectBaseModel):
    """How many images and megapixelsteps this user has requested.

    v2 API Model: `UsageDetails`
    """

    megapixelsteps: float | None = Field(default=None)
    """How many megapixelsteps this user has requested."""

    requests: int | None = Field(default=None)
    """How many images this user has requested."""

    @override
    @classmethod
    def get_api_model_name(cls) -> str | None:
        return "UsageDetails"

megapixelsteps class-attribute instance-attribute

megapixelsteps: float | None = Field(default=None)

How many megapixelsteps this user has requested.

requests class-attribute instance-attribute

requests: int | None = Field(default=None)

How many images this user has requested.

model_config class-attribute instance-attribute

model_config = get_default_frozen_model_config_dict()

get_api_model_name classmethod

get_api_model_name() -> str | None
Source code in horde_sdk/ai_horde_api/apimodels/users.py
@override
@classmethod
def get_api_model_name(cls) -> str | None:
    return "UsageDetails"

get_sensitive_fields classmethod

get_sensitive_fields() -> set[str]

Return a set of fields which should be redacted from logs.

Source code in horde_sdk/generic_api/apimodels.py
@classmethod
def get_sensitive_fields(cls) -> set[str]:
    """Return a set of fields which should be redacted from logs."""
    return {"apikey"}

get_extra_fields_to_exclude_from_log

get_extra_fields_to_exclude_from_log() -> set[str]

Return an additional set of fields to exclude from the log_safe_model_dump method.

Source code in horde_sdk/generic_api/apimodels.py
def get_extra_fields_to_exclude_from_log(self) -> set[str]:
    """Return an additional set of fields to exclude from the log_safe_model_dump method."""
    return set()

log_safe_model_dump

log_safe_model_dump(
    extra_exclude: set[str] | None = None,
) -> dict[Any, Any]

Return a dict of the model's fields, with any sensitive fields redacted.

Source code in horde_sdk/generic_api/apimodels.py
def log_safe_model_dump(self, extra_exclude: set[str] | None = None) -> dict[Any, Any]:
    """Return a dict of the model's fields, with any sensitive fields redacted."""
    if extra_exclude is None:
        extra_exclude = set()

    if hasattr(self, "model_dump"):
        return self.model_dump(  # type: ignore
            exclude=self.get_sensitive_fields() | self.get_extra_fields_to_exclude_from_log() | extra_exclude,
        )

    logger.warning("Model does not have a model_dump method. Using python native class compatible method.")
    logger.debug(
        "Generally this should not be relied upon. If you're seeing this and you're a developer for the SDK, "
        "consider using pydantic models instead.",
    )
    # Its not a pydantic model, use python native class compatible method
    return {
        key: getattr(self, key)
        for key in self.__dict__
        if key not in self.get_sensitive_fields() | self.get_extra_fields_to_exclude_from_log() | extra_exclude
    }

ActiveGenerations

Bases: HordeAPIObjectBaseModel

A list of generations that are currently active for this user.

v2 API Model: ActiveGenerations

Source code in horde_sdk/ai_horde_api/apimodels/users.py
@Unhashable
@Unequatable
class ActiveGenerations(HordeAPIObjectBaseModel):
    """A list of generations that are currently active for this user.

    v2 API Model: `ActiveGenerations`
    """

    """A list of generations that are currently active for this user."""

    text: list[UUID_Identifier] | None = None
    """The IDs of the text generations that are currently active for this user."""

    image: list[UUID_Identifier] | None = None
    """The IDs of the image generations that are currently active for this user."""

    alchemy: list[UUID_Identifier] | None = None
    """The IDs of the alchemy generations that are currently active for this user."""

    @override
    @classmethod
    def get_api_model_name(cls) -> str | None:
        return "ActiveGenerations"

text class-attribute instance-attribute

text: list[UUID_Identifier] | None = None

The IDs of the text generations that are currently active for this user.

image class-attribute instance-attribute

image: list[UUID_Identifier] | None = None

The IDs of the image generations that are currently active for this user.

alchemy class-attribute instance-attribute

alchemy: list[UUID_Identifier] | None = None

The IDs of the alchemy generations that are currently active for this user.

model_config class-attribute instance-attribute

model_config = get_default_frozen_model_config_dict()

get_api_model_name classmethod

get_api_model_name() -> str | None
Source code in horde_sdk/ai_horde_api/apimodels/users.py
@override
@classmethod
def get_api_model_name(cls) -> str | None:
    return "ActiveGenerations"

get_sensitive_fields classmethod

get_sensitive_fields() -> set[str]

Return a set of fields which should be redacted from logs.

Source code in horde_sdk/generic_api/apimodels.py
@classmethod
def get_sensitive_fields(cls) -> set[str]:
    """Return a set of fields which should be redacted from logs."""
    return {"apikey"}

get_extra_fields_to_exclude_from_log

get_extra_fields_to_exclude_from_log() -> set[str]

Return an additional set of fields to exclude from the log_safe_model_dump method.

Source code in horde_sdk/generic_api/apimodels.py
def get_extra_fields_to_exclude_from_log(self) -> set[str]:
    """Return an additional set of fields to exclude from the log_safe_model_dump method."""
    return set()

log_safe_model_dump

log_safe_model_dump(
    extra_exclude: set[str] | None = None,
) -> dict[Any, Any]

Return a dict of the model's fields, with any sensitive fields redacted.

Source code in horde_sdk/generic_api/apimodels.py
def log_safe_model_dump(self, extra_exclude: set[str] | None = None) -> dict[Any, Any]:
    """Return a dict of the model's fields, with any sensitive fields redacted."""
    if extra_exclude is None:
        extra_exclude = set()

    if hasattr(self, "model_dump"):
        return self.model_dump(  # type: ignore
            exclude=self.get_sensitive_fields() | self.get_extra_fields_to_exclude_from_log() | extra_exclude,
        )

    logger.warning("Model does not have a model_dump method. Using python native class compatible method.")
    logger.debug(
        "Generally this should not be relied upon. If you're seeing this and you're a developer for the SDK, "
        "consider using pydantic models instead.",
    )
    # Its not a pydantic model, use python native class compatible method
    return {
        key: getattr(self, key)
        for key in self.__dict__
        if key not in self.get_sensitive_fields() | self.get_extra_fields_to_exclude_from_log() | extra_exclude
    }

UserDetailsResponse

Bases: HordeResponseBaseModel

The details of a user.

Note that the response will contain only information the requesting user has permission to see. The owner of the account, moderators and admins will see more information than other users.

Represents the data returned from the following endpoints and http status codes
  • /v2/users/{user_id} | SingleUserDetailsRequest [GET] -> 200
  • /v2/find_user | FindUserRequest [GET] -> 200

v2 API Model: UserDetails

Source code in horde_sdk/ai_horde_api/apimodels/users.py
@Unhashable
@Unequatable
class UserDetailsResponse(HordeResponseBaseModel):
    """The details of a user.

    Note that the response will contain only information the requesting user has permission to see.
    The owner of the account, moderators and admins will see more information than other users.

    Represents the data returned from the following endpoints and http status codes:
        - /v2/users/{user_id} | SingleUserDetailsRequest [GET] -> 200
        - /v2/find_user | FindUserRequest [GET] -> 200

    v2 API Model: `UserDetails`
    """

    @override
    @classmethod
    def get_api_model_name(cls) -> str | None:
        return "UserDetails"

    active_generations: ActiveGenerations | None = None
    """The active generations this user has requested."""

    admin_comment: str | None = Field(
        default=None,
    )
    """(Privileged) Comments from the horde admins about this user."""

    account_age: int | None = Field(
        default=None,
        examples=[60],
    )
    """How many seconds since this account was created."""

    concurrency: int | None = Field(
        default=None,
    )
    """How many concurrent generations this user may request."""

    contact: str | None = Field(
        default=None,
        examples=["email@examples.com"],
    )
    """(Privileged) Contact details for the horde admins to reach the user in case of emergency."""

    contributions: ContributionsDetails | None = None
    """How many images and megapixelsteps this user has generated."""

    customizer: bool | None = Field(
        default=None,
        examples=[False],
    )
    """If this user can run custom models."""

    evaluating_kudos: float | None = Field(
        default=None,
        description=(
            "(Privileged) The amount of Evaluating Kudos this untrusted user has from generations and uptime. When"
            " this number reaches a pre-specified threshold, they automatically become trusted."
        ),
    )
    """(Privileged) The amount of Evaluating Kudos this untrusted user has from generations and uptime.
    When this number reaches a pre-specified threshold, they automatically become trusted."""

    flagged: bool | None = Field(
        default=None,
        examples=[False],
    )
    """This user has been flagged for suspicious activity."""

    id_: int | None = Field(default=None, alias="id")
    """The user unique ID. It is always an integer."""

    kudos: float | None = Field(
        default=None,
        description=(
            "The amount of Kudos this user has. The amount of Kudos determines the priority when requesting image"
            " generations."
        ),
    )
    """The amount of Kudos this user has. The amount of Kudos determines the priority when requesting image
    generations."""

    kudos_details: UserKudosDetails | None = None
    """How much Kudos this user has accumulated or used for generating images."""

    moderator: bool | None = Field(default=None, examples=[False])
    """This user is a Horde moderator."""

    monthly_kudos: MonthlyKudos | None = None
    """How much recurring Kudos this user receives monthly."""

    pseudonymous: bool | None = Field(
        default=None,
        examples=[False],
    )
    """If true, this user has not registered using an oauth service."""

    records: UserRecords | None = None
    """How many images, texts, megapixelsteps and tokens this user has generated or requested."""

    sharedkey_ids: list[str] | None = None
    """The IDs of the shared keys this user has access to."""

    service: bool | None = Field(
        default=None,
        examples=[False],
    )
    """This user is a Horde service account and can provide the `proxied_user` field."""

    special: bool | None = Field(
        default=None,
        examples=[False],
    )
    """(Privileged) This user has been given the Special role."""

    deleted: bool | None = Field(
        default=None,
        examples=[False],
    )
    """If True, this user has been deleted."""

    suspicious: int | None = Field(
        default=None,
        examples=[0],
    )
    """(Privileged) How much suspicion this user has accumulated."""

    trusted: bool | None = Field(
        default=None,
        examples=[False],
    )
    """This user is a trusted member of the Horde."""

    usage: UsageDetails | None = None
    """How many images and megapixelsteps this user has requested."""

    username: str | None = Field(
        default=None,
    )
    """The user's unique Username. It is a combination of their chosen alias plus their ID."""

    vpn: bool | None = Field(
        default=None,
        examples=[False],
    )
    """(Privileged) This user has been given the VPN role."""

    education: bool | None = Field(
        default=None,
        examples=[False],
    )
    """(This user has been given the education role."""

    worker_count: int | None = Field(
        default=None,
    )
    """How many workers this user has created (active or inactive)."""

    worker_ids: list[str] | None = None
    """The IDs of the workers this user has created (active or inactive)."""

    worker_invited: int | None = Field(
        default=None,
        description=(
            "Whether this user has been invited to join a worker to the horde and how many of them. When 0, this user"
            " cannot add (new) workers to the horde."
        ),
    )
    """Whether this user has been invited to join a worker to the horde and how many of them.
    When 0, this user cannot add (new) workers to the horde."""

    styles: list[ResponseModelStylesUser] | None = None
    """The styles this user has created."""

active_generations class-attribute instance-attribute

active_generations: ActiveGenerations | None = None

The active generations this user has requested.

admin_comment class-attribute instance-attribute

admin_comment: str | None = Field(default=None)

(Privileged) Comments from the horde admins about this user.

account_age class-attribute instance-attribute

account_age: int | None = Field(default=None, examples=[60])

How many seconds since this account was created.

concurrency class-attribute instance-attribute

concurrency: int | None = Field(default=None)

How many concurrent generations this user may request.

contact class-attribute instance-attribute

contact: str | None = Field(
    default=None, examples=["email@examples.com"]
)

(Privileged) Contact details for the horde admins to reach the user in case of emergency.

contributions class-attribute instance-attribute

contributions: ContributionsDetails | None = None

How many images and megapixelsteps this user has generated.

customizer class-attribute instance-attribute

customizer: bool | None = Field(
    default=None, examples=[False]
)

If this user can run custom models.

evaluating_kudos class-attribute instance-attribute

evaluating_kudos: float | None = Field(
    default=None,
    description="(Privileged) The amount of Evaluating Kudos this untrusted user has from generations and uptime. When this number reaches a pre-specified threshold, they automatically become trusted.",
)

(Privileged) The amount of Evaluating Kudos this untrusted user has from generations and uptime. When this number reaches a pre-specified threshold, they automatically become trusted.

flagged class-attribute instance-attribute

flagged: bool | None = Field(default=None, examples=[False])

This user has been flagged for suspicious activity.

id_ class-attribute instance-attribute

id_: int | None = Field(default=None, alias='id')

The user unique ID. It is always an integer.

kudos class-attribute instance-attribute

kudos: float | None = Field(
    default=None,
    description="The amount of Kudos this user has. The amount of Kudos determines the priority when requesting image generations.",
)

The amount of Kudos this user has. The amount of Kudos determines the priority when requesting image generations.

kudos_details class-attribute instance-attribute

kudos_details: UserKudosDetails | None = None

How much Kudos this user has accumulated or used for generating images.

moderator class-attribute instance-attribute

moderator: bool | None = Field(
    default=None, examples=[False]
)

This user is a Horde moderator.

monthly_kudos class-attribute instance-attribute

monthly_kudos: MonthlyKudos | None = None

How much recurring Kudos this user receives monthly.

pseudonymous class-attribute instance-attribute

pseudonymous: bool | None = Field(
    default=None, examples=[False]
)

If true, this user has not registered using an oauth service.

records class-attribute instance-attribute

records: UserRecords | None = None

How many images, texts, megapixelsteps and tokens this user has generated or requested.

sharedkey_ids class-attribute instance-attribute

sharedkey_ids: list[str] | None = None

The IDs of the shared keys this user has access to.

service class-attribute instance-attribute

service: bool | None = Field(default=None, examples=[False])

This user is a Horde service account and can provide the proxied_user field.

special class-attribute instance-attribute

special: bool | None = Field(default=None, examples=[False])

(Privileged) This user has been given the Special role.

deleted class-attribute instance-attribute

deleted: bool | None = Field(default=None, examples=[False])

If True, this user has been deleted.

suspicious class-attribute instance-attribute

suspicious: int | None = Field(default=None, examples=[0])

(Privileged) How much suspicion this user has accumulated.

trusted class-attribute instance-attribute

trusted: bool | None = Field(default=None, examples=[False])

This user is a trusted member of the Horde.

usage class-attribute instance-attribute

usage: UsageDetails | None = None

How many images and megapixelsteps this user has requested.

username class-attribute instance-attribute

username: str | None = Field(default=None)

The user's unique Username. It is a combination of their chosen alias plus their ID.

vpn class-attribute instance-attribute

vpn: bool | None = Field(default=None, examples=[False])

(Privileged) This user has been given the VPN role.

education class-attribute instance-attribute

education: bool | None = Field(
    default=None, examples=[False]
)

(This user has been given the education role.

worker_count class-attribute instance-attribute

worker_count: int | None = Field(default=None)

How many workers this user has created (active or inactive).

worker_ids class-attribute instance-attribute

worker_ids: list[str] | None = None

The IDs of the workers this user has created (active or inactive).

worker_invited class-attribute instance-attribute

worker_invited: int | None = Field(
    default=None,
    description="Whether this user has been invited to join a worker to the horde and how many of them. When 0, this user cannot add (new) workers to the horde.",
)

Whether this user has been invited to join a worker to the horde and how many of them. When 0, this user cannot add (new) workers to the horde.

styles class-attribute instance-attribute

styles: list[ResponseModelStylesUser] | None = None

The styles this user has created.

time_constructed property

time_constructed: float

The time the model was constructed (in epoch time).

model_config class-attribute instance-attribute

model_config = get_default_frozen_model_config_dict()

get_api_model_name classmethod

get_api_model_name() -> str | None
Source code in horde_sdk/ai_horde_api/apimodels/users.py
@override
@classmethod
def get_api_model_name(cls) -> str | None:
    return "UserDetails"

get_sensitive_fields classmethod

get_sensitive_fields() -> set[str]

Return a set of fields which should be redacted from logs.

Source code in horde_sdk/generic_api/apimodels.py
@classmethod
def get_sensitive_fields(cls) -> set[str]:
    """Return a set of fields which should be redacted from logs."""
    return {"apikey"}

get_extra_fields_to_exclude_from_log

get_extra_fields_to_exclude_from_log() -> set[str]

Return an additional set of fields to exclude from the log_safe_model_dump method.

Source code in horde_sdk/generic_api/apimodels.py
def get_extra_fields_to_exclude_from_log(self) -> set[str]:
    """Return an additional set of fields to exclude from the log_safe_model_dump method."""
    return set()

log_safe_model_dump

log_safe_model_dump(
    extra_exclude: set[str] | None = None,
) -> dict[Any, Any]

Return a dict of the model's fields, with any sensitive fields redacted.

Source code in horde_sdk/generic_api/apimodels.py
def log_safe_model_dump(self, extra_exclude: set[str] | None = None) -> dict[Any, Any]:
    """Return a dict of the model's fields, with any sensitive fields redacted."""
    if extra_exclude is None:
        extra_exclude = set()

    if hasattr(self, "model_dump"):
        return self.model_dump(  # type: ignore
            exclude=self.get_sensitive_fields() | self.get_extra_fields_to_exclude_from_log() | extra_exclude,
        )

    logger.warning("Model does not have a model_dump method. Using python native class compatible method.")
    logger.debug(
        "Generally this should not be relied upon. If you're seeing this and you're a developer for the SDK, "
        "consider using pydantic models instead.",
    )
    # Its not a pydantic model, use python native class compatible method
    return {
        key: getattr(self, key)
        for key in self.__dict__
        if key not in self.get_sensitive_fields() | self.get_extra_fields_to_exclude_from_log() | extra_exclude
    }

ListUsersDetailsResponse

Bases: HordeResponseRootModel[list[UserDetailsResponse]]

The response for a list of user details.

Represents the data returned from the /v2/users endpoint with http status code 200.

v2 API Model: _ANONYMOUS_MODEL

Source code in horde_sdk/ai_horde_api/apimodels/users.py
@Unhashable
@Unequatable
class ListUsersDetailsResponse(HordeResponseRootModel[list[UserDetailsResponse]]):
    """The response for a list of user details.

    Represents the data returned from the /v2/users endpoint with http status code 200.

    v2 API Model: `_ANONYMOUS_MODEL`
    """

    root: list[UserDetailsResponse]
    """The underlying list of user details."""

    @override
    @classmethod
    def get_api_model_name(cls) -> str:
        return _ANONYMOUS_MODEL

root instance-attribute

root: list[UserDetailsResponse]

The underlying list of user details.

time_constructed property

time_constructed: float

The time the model was constructed (in epoch time).

model_config class-attribute instance-attribute

model_config = ConfigDict(
    frozen=True, use_attribute_docstrings=True
)

get_api_model_name classmethod

get_api_model_name() -> str
Source code in horde_sdk/ai_horde_api/apimodels/users.py
@override
@classmethod
def get_api_model_name(cls) -> str:
    return _ANONYMOUS_MODEL

get_sensitive_fields classmethod

get_sensitive_fields() -> set[str]

Return a set of fields which should be redacted from logs.

Source code in horde_sdk/generic_api/apimodels.py
@classmethod
def get_sensitive_fields(cls) -> set[str]:
    """Return a set of fields which should be redacted from logs."""
    return {"apikey"}

get_extra_fields_to_exclude_from_log

get_extra_fields_to_exclude_from_log() -> set[str]

Return an additional set of fields to exclude from the log_safe_model_dump method.

Source code in horde_sdk/generic_api/apimodels.py
def get_extra_fields_to_exclude_from_log(self) -> set[str]:
    """Return an additional set of fields to exclude from the log_safe_model_dump method."""
    return set()

log_safe_model_dump

log_safe_model_dump(
    extra_exclude: set[str] | None = None,
) -> dict[Any, Any]

Return a dict of the model's fields, with any sensitive fields redacted.

Source code in horde_sdk/generic_api/apimodels.py
def log_safe_model_dump(self, extra_exclude: set[str] | None = None) -> dict[Any, Any]:
    """Return a dict of the model's fields, with any sensitive fields redacted."""
    if extra_exclude is None:
        extra_exclude = set()

    if hasattr(self, "model_dump"):
        return self.model_dump(  # type: ignore
            exclude=self.get_sensitive_fields() | self.get_extra_fields_to_exclude_from_log() | extra_exclude,
        )

    logger.warning("Model does not have a model_dump method. Using python native class compatible method.")
    logger.debug(
        "Generally this should not be relied upon. If you're seeing this and you're a developer for the SDK, "
        "consider using pydantic models instead.",
    )
    # Its not a pydantic model, use python native class compatible method
    return {
        key: getattr(self, key)
        for key in self.__dict__
        if key not in self.get_sensitive_fields() | self.get_extra_fields_to_exclude_from_log() | extra_exclude
    }

ListUsersDetailsRequest

Bases: BaseAIHordeRequest

Represents a request to list all users.

Represents a GET request to the /v2/users endpoint.

Source code in horde_sdk/ai_horde_api/apimodels/users.py
class ListUsersDetailsRequest(BaseAIHordeRequest):
    """Represents a request to list all users.

    Represents a GET request to the /v2/users endpoint.
    """

    page: int
    """The page number to request. There are up to 25 users per page."""

    sort: str = "kudos"
    """The field to sort the users by. The default is by kudos."""

    @override
    @classmethod
    def get_api_model_name(cls) -> None:
        return None

    @override
    @classmethod
    def get_http_method(cls) -> HTTPMethod:
        return HTTPMethod.GET

    @override
    @classmethod
    def get_api_endpoint_subpath(cls) -> AI_HORDE_API_ENDPOINT_SUBPATH:
        return AI_HORDE_API_ENDPOINT_SUBPATH.v2_users_all

    @override
    @classmethod
    def get_default_success_response_type(cls) -> type[ListUsersDetailsResponse]:
        return ListUsersDetailsResponse

    @override
    @classmethod
    def get_query_fields(cls) -> list[str]:
        return ["page", "sort"]

page instance-attribute

page: int

The page number to request. There are up to 25 users per page.

sort class-attribute instance-attribute

sort: str = 'kudos'

The field to sort the users by. The default is by kudos.

model_config class-attribute instance-attribute

model_config = get_default_frozen_model_config_dict()

accept class-attribute instance-attribute

accept: GenericAcceptTypes = json

The 'accept' header field.

client_agent class-attribute instance-attribute

client_agent: str = Field(
    default=default_bridge_agent_string,
    alias="Client-Agent",
)

The requesting client's agent. You should set this to reflect the name, version and contact information for your client.

get_api_model_name classmethod

get_api_model_name() -> None
Source code in horde_sdk/ai_horde_api/apimodels/users.py
@override
@classmethod
def get_api_model_name(cls) -> None:
    return None

get_http_method classmethod

get_http_method() -> HTTPMethod
Source code in horde_sdk/ai_horde_api/apimodels/users.py
@override
@classmethod
def get_http_method(cls) -> HTTPMethod:
    return HTTPMethod.GET

get_api_endpoint_subpath classmethod

get_api_endpoint_subpath() -> AI_HORDE_API_ENDPOINT_SUBPATH
Source code in horde_sdk/ai_horde_api/apimodels/users.py
@override
@classmethod
def get_api_endpoint_subpath(cls) -> AI_HORDE_API_ENDPOINT_SUBPATH:
    return AI_HORDE_API_ENDPOINT_SUBPATH.v2_users_all

get_default_success_response_type classmethod

get_default_success_response_type() -> (
    type[ListUsersDetailsResponse]
)
Source code in horde_sdk/ai_horde_api/apimodels/users.py
@override
@classmethod
def get_default_success_response_type(cls) -> type[ListUsersDetailsResponse]:
    return ListUsersDetailsResponse

get_query_fields classmethod

get_query_fields() -> list[str]
Source code in horde_sdk/ai_horde_api/apimodels/users.py
@override
@classmethod
def get_query_fields(cls) -> list[str]:
    return ["page", "sort"]

get_sensitive_fields classmethod

get_sensitive_fields() -> set[str]
Source code in horde_sdk/generic_api/apimodels.py
@override
@classmethod
def get_sensitive_fields(cls) -> set[str]:
    return {"apikey"}

get_extra_fields_to_exclude_from_log

get_extra_fields_to_exclude_from_log() -> set[str]

Return an additional set of fields to exclude from the log_safe_model_dump method.

Source code in horde_sdk/generic_api/apimodels.py
def get_extra_fields_to_exclude_from_log(self) -> set[str]:
    """Return an additional set of fields to exclude from the log_safe_model_dump method."""
    return set()

log_safe_model_dump

log_safe_model_dump(
    extra_exclude: set[str] | None = None,
) -> dict[Any, Any]

Return a dict of the model's fields, with any sensitive fields redacted.

Source code in horde_sdk/generic_api/apimodels.py
def log_safe_model_dump(self, extra_exclude: set[str] | None = None) -> dict[Any, Any]:
    """Return a dict of the model's fields, with any sensitive fields redacted."""
    if extra_exclude is None:
        extra_exclude = set()

    if hasattr(self, "model_dump"):
        return self.model_dump(  # type: ignore
            exclude=self.get_sensitive_fields() | self.get_extra_fields_to_exclude_from_log() | extra_exclude,
        )

    logger.warning("Model does not have a model_dump method. Using python native class compatible method.")
    logger.debug(
        "Generally this should not be relied upon. If you're seeing this and you're a developer for the SDK, "
        "consider using pydantic models instead.",
    )
    # Its not a pydantic model, use python native class compatible method
    return {
        key: getattr(self, key)
        for key in self.__dict__
        if key not in self.get_sensitive_fields() | self.get_extra_fields_to_exclude_from_log() | extra_exclude
    }

get_api_endpoint_url classmethod

get_api_endpoint_url() -> str

Return the endpoint URL, including the path to the specific API action defined by this object.

Source code in horde_sdk/generic_api/apimodels.py
@classmethod
def get_api_endpoint_url(cls) -> str:
    """Return the endpoint URL, including the path to the specific API action defined by this object."""
    return url_with_path(base_url=cls.get_api_url(), path=cls.get_api_endpoint_subpath())

get_api_url classmethod

get_api_url() -> str
Source code in horde_sdk/ai_horde_api/apimodels/base.py
@override
@classmethod
def get_api_url(cls) -> str:
    return AI_HORDE_BASE_URL

get_success_status_response_pairs classmethod

get_success_status_response_pairs() -> (
    dict[HTTPStatusCode, type[HordeResponseTypes]]
)

Return a dict of HTTP status codes and the expected HordeResponse.

Defaults to {HTTPStatusCode.OK: cls.get_expected_response_type()}, but may be overridden to support other status codes.

Source code in horde_sdk/generic_api/apimodels.py
@classmethod
def get_success_status_response_pairs(
    cls,
) -> dict[HTTPStatusCode, type[HordeResponseTypes]]:
    """Return a dict of HTTP status codes and the expected `HordeResponse`.

    Defaults to `{HTTPStatusCode.OK: cls.get_expected_response_type()}`, but may be overridden to support other
    status codes.
    """
    return {HTTPStatusCode.OK: cls.get_default_success_response_type()}

get_header_fields classmethod

get_header_fields() -> list[str]

Return a list of field names from this request object that should be sent as header fields.

This is in addition to GenericHeaderFields's values, and possibly the API specific class which inherits from GenericHeaderFields, typically found in the horde_sdk.<api_name>_api.metadata module.

Source code in horde_sdk/generic_api/apimodels.py
@classmethod
def get_header_fields(cls) -> list[str]:
    """Return a list of field names from this request object that should be sent as header fields.

    This is in addition to `GenericHeaderFields`'s values, and possibly the API specific class
    which inherits from `GenericHeaderFields`, typically found in the `horde_sdk.<api_name>_api.metadata` module.
    """
    return []

get_number_of_results_expected

get_number_of_results_expected() -> int

Return the number of (job) results expected from this request.

Defaults to 1, but may be overridden to dynamically change the number of results expected.

This is factored into context management; if the number of results expected is not met, the job is considered unhandled on an exception and followed up on to attempt to close it.

Source code in horde_sdk/generic_api/apimodels.py
def get_number_of_results_expected(self) -> int:
    """Return the number of (job) results expected from this request.

    Defaults to `1`, but may be overridden to dynamically change the number of results expected.

    This is factored into context management; if the number of results expected is not met, the job is considered
    unhandled on an exception and followed up on to attempt to close it.
    """
    return 1

get_requires_follow_up

get_requires_follow_up() -> bool

Return whether this request requires a follow up request(s).

Returns:

  • bool ( bool ) –

    Whether this request requires a follow up request to close the job on the server.

Source code in horde_sdk/generic_api/apimodels.py
def get_requires_follow_up(self) -> bool:
    """Return whether this request requires a follow up request(s).

    Returns:
        bool: Whether this request requires a follow up request to close the job on the server.
    """
    for response_type in self.get_success_status_response_pairs().values():
        if issubclass(response_type, ResponseRequiringFollowUpMixin):
            return True
    return False

SingleUserDetailsRequest

Bases: BaseAIHordeRequest, MessageSpecifiesUserIDMixin

Represents a GET request to the /v2/users/{user_id} endpoint.

Source code in horde_sdk/ai_horde_api/apimodels/users.py
class SingleUserDetailsRequest(BaseAIHordeRequest, MessageSpecifiesUserIDMixin):
    """Represents a GET request to the /v2/users/{user_id} endpoint."""

    @override
    @classmethod
    def get_api_model_name(cls) -> None:
        return None

    @override
    @classmethod
    def get_http_method(cls) -> HTTPMethod:
        return HTTPMethod.GET

    @override
    @classmethod
    def get_api_endpoint_subpath(cls) -> AI_HORDE_API_ENDPOINT_SUBPATH:
        return AI_HORDE_API_ENDPOINT_SUBPATH.v2_users_single

    @override
    @classmethod
    def get_default_success_response_type(cls) -> type[UserDetailsResponse]:
        return UserDetailsResponse

model_config class-attribute instance-attribute

model_config = get_default_frozen_model_config_dict()

user_id instance-attribute

user_id: str

The user's ID, as a str, but only containing numeric values.

accept class-attribute instance-attribute

accept: GenericAcceptTypes = json

The 'accept' header field.

client_agent class-attribute instance-attribute

client_agent: str = Field(
    default=default_bridge_agent_string,
    alias="Client-Agent",
)

The requesting client's agent. You should set this to reflect the name, version and contact information for your client.

get_api_model_name classmethod

get_api_model_name() -> None
Source code in horde_sdk/ai_horde_api/apimodels/users.py
@override
@classmethod
def get_api_model_name(cls) -> None:
    return None

get_http_method classmethod

get_http_method() -> HTTPMethod
Source code in horde_sdk/ai_horde_api/apimodels/users.py
@override
@classmethod
def get_http_method(cls) -> HTTPMethod:
    return HTTPMethod.GET

get_api_endpoint_subpath classmethod

get_api_endpoint_subpath() -> AI_HORDE_API_ENDPOINT_SUBPATH
Source code in horde_sdk/ai_horde_api/apimodels/users.py
@override
@classmethod
def get_api_endpoint_subpath(cls) -> AI_HORDE_API_ENDPOINT_SUBPATH:
    return AI_HORDE_API_ENDPOINT_SUBPATH.v2_users_single

get_default_success_response_type classmethod

get_default_success_response_type() -> (
    type[UserDetailsResponse]
)
Source code in horde_sdk/ai_horde_api/apimodels/users.py
@override
@classmethod
def get_default_success_response_type(cls) -> type[UserDetailsResponse]:
    return UserDetailsResponse

user_id_is_numeric

user_id_is_numeric(value: str) -> str

Check if the ID is a numeric string.

The API endpoint expects a string, but the only valid values would be numbers only.

Source code in horde_sdk/generic_api/apimodels.py
@field_validator("user_id")
def user_id_is_numeric(cls, value: str) -> str:
    """Check if the ID is a numeric string.

    The API endpoint expects a string, but the only valid values would be numbers only.
    """
    if not value.isnumeric():
        raise ValueError("user_id must only contain numeric values")
    return value

get_sensitive_fields classmethod

get_sensitive_fields() -> set[str]
Source code in horde_sdk/generic_api/apimodels.py
@override
@classmethod
def get_sensitive_fields(cls) -> set[str]:
    return {"apikey"}

get_extra_fields_to_exclude_from_log

get_extra_fields_to_exclude_from_log() -> set[str]

Return an additional set of fields to exclude from the log_safe_model_dump method.

Source code in horde_sdk/generic_api/apimodels.py
def get_extra_fields_to_exclude_from_log(self) -> set[str]:
    """Return an additional set of fields to exclude from the log_safe_model_dump method."""
    return set()

log_safe_model_dump

log_safe_model_dump(
    extra_exclude: set[str] | None = None,
) -> dict[Any, Any]

Return a dict of the model's fields, with any sensitive fields redacted.

Source code in horde_sdk/generic_api/apimodels.py
def log_safe_model_dump(self, extra_exclude: set[str] | None = None) -> dict[Any, Any]:
    """Return a dict of the model's fields, with any sensitive fields redacted."""
    if extra_exclude is None:
        extra_exclude = set()

    if hasattr(self, "model_dump"):
        return self.model_dump(  # type: ignore
            exclude=self.get_sensitive_fields() | self.get_extra_fields_to_exclude_from_log() | extra_exclude,
        )

    logger.warning("Model does not have a model_dump method. Using python native class compatible method.")
    logger.debug(
        "Generally this should not be relied upon. If you're seeing this and you're a developer for the SDK, "
        "consider using pydantic models instead.",
    )
    # Its not a pydantic model, use python native class compatible method
    return {
        key: getattr(self, key)
        for key in self.__dict__
        if key not in self.get_sensitive_fields() | self.get_extra_fields_to_exclude_from_log() | extra_exclude
    }

get_api_endpoint_url classmethod

get_api_endpoint_url() -> str

Return the endpoint URL, including the path to the specific API action defined by this object.

Source code in horde_sdk/generic_api/apimodels.py
@classmethod
def get_api_endpoint_url(cls) -> str:
    """Return the endpoint URL, including the path to the specific API action defined by this object."""
    return url_with_path(base_url=cls.get_api_url(), path=cls.get_api_endpoint_subpath())

get_api_url classmethod

get_api_url() -> str
Source code in horde_sdk/ai_horde_api/apimodels/base.py
@override
@classmethod
def get_api_url(cls) -> str:
    return AI_HORDE_BASE_URL

get_success_status_response_pairs classmethod

get_success_status_response_pairs() -> (
    dict[HTTPStatusCode, type[HordeResponseTypes]]
)

Return a dict of HTTP status codes and the expected HordeResponse.

Defaults to {HTTPStatusCode.OK: cls.get_expected_response_type()}, but may be overridden to support other status codes.

Source code in horde_sdk/generic_api/apimodels.py
@classmethod
def get_success_status_response_pairs(
    cls,
) -> dict[HTTPStatusCode, type[HordeResponseTypes]]:
    """Return a dict of HTTP status codes and the expected `HordeResponse`.

    Defaults to `{HTTPStatusCode.OK: cls.get_expected_response_type()}`, but may be overridden to support other
    status codes.
    """
    return {HTTPStatusCode.OK: cls.get_default_success_response_type()}

get_header_fields classmethod

get_header_fields() -> list[str]

Return a list of field names from this request object that should be sent as header fields.

This is in addition to GenericHeaderFields's values, and possibly the API specific class which inherits from GenericHeaderFields, typically found in the horde_sdk.<api_name>_api.metadata module.

Source code in horde_sdk/generic_api/apimodels.py
@classmethod
def get_header_fields(cls) -> list[str]:
    """Return a list of field names from this request object that should be sent as header fields.

    This is in addition to `GenericHeaderFields`'s values, and possibly the API specific class
    which inherits from `GenericHeaderFields`, typically found in the `horde_sdk.<api_name>_api.metadata` module.
    """
    return []

get_query_fields classmethod

get_query_fields() -> list[str]

Return a list of field names from this request object that should be sent as query parameters.

This is in addition to GenericQueryFields's values, and possibly the API specific class which inherits from GenericQueryFields, typically found in the horde_sdk.<api_name>_api.metadata module.

Source code in horde_sdk/generic_api/apimodels.py
@classmethod
def get_query_fields(cls) -> list[str]:
    """Return a list of field names from this request object that should be sent as query parameters.

    This is in addition to `GenericQueryFields`'s values, and possibly the API specific class
    which inherits from `GenericQueryFields`, typically found in the `horde_sdk.<api_name>_api.metadata` module.
    """
    return []

get_number_of_results_expected

get_number_of_results_expected() -> int

Return the number of (job) results expected from this request.

Defaults to 1, but may be overridden to dynamically change the number of results expected.

This is factored into context management; if the number of results expected is not met, the job is considered unhandled on an exception and followed up on to attempt to close it.

Source code in horde_sdk/generic_api/apimodels.py
def get_number_of_results_expected(self) -> int:
    """Return the number of (job) results expected from this request.

    Defaults to `1`, but may be overridden to dynamically change the number of results expected.

    This is factored into context management; if the number of results expected is not met, the job is considered
    unhandled on an exception and followed up on to attempt to close it.
    """
    return 1

get_requires_follow_up

get_requires_follow_up() -> bool

Return whether this request requires a follow up request(s).

Returns:

  • bool ( bool ) –

    Whether this request requires a follow up request to close the job on the server.

Source code in horde_sdk/generic_api/apimodels.py
def get_requires_follow_up(self) -> bool:
    """Return whether this request requires a follow up request(s).

    Returns:
        bool: Whether this request requires a follow up request to close the job on the server.
    """
    for response_type in self.get_success_status_response_pairs().values():
        if issubclass(response_type, ResponseRequiringFollowUpMixin):
            return True
    return False

ModifyUser

Bases: _ModifyUserBase

Underlying model for modifying a user.

Source code in horde_sdk/ai_horde_api/apimodels/users.py
class ModifyUser(_ModifyUserBase):
    """Underlying model for modifying a user."""

    kudos: float | None = Field(default=None)
    """The amount of kudos to modify (can be negative)."""

    reset_suspicion: bool | None = Field(default=None)
    """Set the user's suspicion back to 0."""

    undelete: bool | None = Field(default=None)
    """When set to true, A user's who's marked to be deleted will become active again."""

kudos class-attribute instance-attribute

kudos: float | None = Field(default=None)

The amount of kudos to modify (can be negative).

reset_suspicion class-attribute instance-attribute

reset_suspicion: bool | None = Field(default=None)

Set the user's suspicion back to 0.

undelete class-attribute instance-attribute

undelete: bool | None = Field(default=None)

When set to true, A user's who's marked to be deleted will become active again.

model_config class-attribute instance-attribute

model_config = get_default_frozen_model_config_dict()

admin_comment class-attribute instance-attribute

admin_comment: str | None = Field(
    default=None, max_length=500, min_length=5
)

Add further information about this user for the other admins.

concurrency class-attribute instance-attribute

concurrency: int | None = Field(default=None, ge=0, le=500)

The amount of concurrent request this user can have.

contact class-attribute instance-attribute

contact: str | None = Field(
    default=None,
    examples=["email@example.com"],
    max_length=500,
    min_length=5,
)

Contact details for the horde admins to reach the user in case of emergency. This is only visible to horde moderators.

customizer class-attribute instance-attribute

customizer: bool | None = Field(default=None)

When set to true, the user will be able to serve custom Stable Diffusion models which do not exist in the Official AI Horde Model Reference.

education class-attribute instance-attribute

education: bool | None = Field(default=None)

When set to true, the user is considered an education account and some options become more restrictive.

filtered class-attribute instance-attribute

filtered: bool | None = Field(default=None)

When set to true, the replacement filter will always be applied against this user

flagged class-attribute instance-attribute

flagged: bool | None = Field(default=None)

When set to true, the user cannot transfer kudos and all their workers are put into permanent maintenance.

moderator class-attribute instance-attribute

moderator: bool | None = Field(default=None)

Set to true to make this user a horde moderator.

monthly_kudos class-attribute instance-attribute

monthly_kudos: int | None = Field(default=None)

When specified, will start assigning the user monthly kudos, starting now!

public_workers class-attribute instance-attribute

public_workers: bool | None = Field(default=None)

Set to true to make this user display their worker IDs.

service class-attribute instance-attribute

service: bool | None = Field(default=None)

When set to true, the user is considered a service account proxying the requests for other users.

special class-attribute instance-attribute

special: bool | None = Field(default=None)

When set to true, The user can send special payloads.

trusted class-attribute instance-attribute

trusted: bool | None = Field(default=None)

When set to true,the user and their servers will not be affected by suspicion.

usage_multiplier class-attribute instance-attribute

usage_multiplier: float | None = Field(
    default=None, ge=0.1, le=10.0
)

The amount by which to multiply the users kudos consumption.

username class-attribute instance-attribute

username: str | None = Field(
    default=None, max_length=100, min_length=3
)

When specified, will change the username. No profanity allowed!

vpn class-attribute instance-attribute

vpn: bool | None = Field(default=None)

When set to true, the user will be able to onboard workers behind a VPN. This should be used as a temporary solution until the user is trusted.

worker_invited class-attribute instance-attribute

worker_invited: int | None = Field(default=None)

Set to the amount of workers this user is allowed to join to the horde when in worker invite-only mode.

get_api_model_name abstractmethod classmethod

get_api_model_name() -> str | None

Return the name of the model as seen in the published swagger doc.

If none, there is no payload, such as for a GET request.

Source code in horde_sdk/generic_api/apimodels.py
@classmethod
@abc.abstractmethod
def get_api_model_name(cls) -> str | None:
    """Return the name of the model as seen in the published swagger doc.

    If none, there is no payload, such as for a GET request.
    """

get_sensitive_fields classmethod

get_sensitive_fields() -> set[str]

Return a set of fields which should be redacted from logs.

Source code in horde_sdk/generic_api/apimodels.py
@classmethod
def get_sensitive_fields(cls) -> set[str]:
    """Return a set of fields which should be redacted from logs."""
    return {"apikey"}

get_extra_fields_to_exclude_from_log

get_extra_fields_to_exclude_from_log() -> set[str]

Return an additional set of fields to exclude from the log_safe_model_dump method.

Source code in horde_sdk/generic_api/apimodels.py
def get_extra_fields_to_exclude_from_log(self) -> set[str]:
    """Return an additional set of fields to exclude from the log_safe_model_dump method."""
    return set()

log_safe_model_dump

log_safe_model_dump(
    extra_exclude: set[str] | None = None,
) -> dict[Any, Any]

Return a dict of the model's fields, with any sensitive fields redacted.

Source code in horde_sdk/generic_api/apimodels.py
def log_safe_model_dump(self, extra_exclude: set[str] | None = None) -> dict[Any, Any]:
    """Return a dict of the model's fields, with any sensitive fields redacted."""
    if extra_exclude is None:
        extra_exclude = set()

    if hasattr(self, "model_dump"):
        return self.model_dump(  # type: ignore
            exclude=self.get_sensitive_fields() | self.get_extra_fields_to_exclude_from_log() | extra_exclude,
        )

    logger.warning("Model does not have a model_dump method. Using python native class compatible method.")
    logger.debug(
        "Generally this should not be relied upon. If you're seeing this and you're a developer for the SDK, "
        "consider using pydantic models instead.",
    )
    # Its not a pydantic model, use python native class compatible method
    return {
        key: getattr(self, key)
        for key in self.__dict__
        if key not in self.get_sensitive_fields() | self.get_extra_fields_to_exclude_from_log() | extra_exclude
    }

ModifyUserReply

Bases: _ModifyUserBase

Base class for the response returned when modifying a user.

Source code in horde_sdk/ai_horde_api/apimodels/users.py
class ModifyUserReply(_ModifyUserBase):
    """Base class for the response returned when modifying a user."""

    new_kudos: float | None = Field(default=None)
    """The new amount of kudos this user has."""
    new_suspicion: int | None = Field(default=None)
    """The new amount of suspicion this user has."""
    undeleted: bool | None = Field(default=None)
    """True if the user was undeleted with this operation."""

new_kudos class-attribute instance-attribute

new_kudos: float | None = Field(default=None)

The new amount of kudos this user has.

new_suspicion class-attribute instance-attribute

new_suspicion: int | None = Field(default=None)

The new amount of suspicion this user has.

undeleted class-attribute instance-attribute

undeleted: bool | None = Field(default=None)

True if the user was undeleted with this operation.

model_config class-attribute instance-attribute

model_config = get_default_frozen_model_config_dict()

admin_comment class-attribute instance-attribute

admin_comment: str | None = Field(
    default=None, max_length=500, min_length=5
)

Add further information about this user for the other admins.

concurrency class-attribute instance-attribute

concurrency: int | None = Field(default=None, ge=0, le=500)

The amount of concurrent request this user can have.

contact class-attribute instance-attribute

contact: str | None = Field(
    default=None,
    examples=["email@example.com"],
    max_length=500,
    min_length=5,
)

Contact details for the horde admins to reach the user in case of emergency. This is only visible to horde moderators.

customizer class-attribute instance-attribute

customizer: bool | None = Field(default=None)

When set to true, the user will be able to serve custom Stable Diffusion models which do not exist in the Official AI Horde Model Reference.

education class-attribute instance-attribute

education: bool | None = Field(default=None)

When set to true, the user is considered an education account and some options become more restrictive.

filtered class-attribute instance-attribute

filtered: bool | None = Field(default=None)

When set to true, the replacement filter will always be applied against this user

flagged class-attribute instance-attribute

flagged: bool | None = Field(default=None)

When set to true, the user cannot transfer kudos and all their workers are put into permanent maintenance.

moderator class-attribute instance-attribute

moderator: bool | None = Field(default=None)

Set to true to make this user a horde moderator.

monthly_kudos class-attribute instance-attribute

monthly_kudos: int | None = Field(default=None)

When specified, will start assigning the user monthly kudos, starting now!

public_workers class-attribute instance-attribute

public_workers: bool | None = Field(default=None)

Set to true to make this user display their worker IDs.

service class-attribute instance-attribute

service: bool | None = Field(default=None)

When set to true, the user is considered a service account proxying the requests for other users.

special class-attribute instance-attribute

special: bool | None = Field(default=None)

When set to true, The user can send special payloads.

trusted class-attribute instance-attribute

trusted: bool | None = Field(default=None)

When set to true,the user and their servers will not be affected by suspicion.

usage_multiplier class-attribute instance-attribute

usage_multiplier: float | None = Field(
    default=None, ge=0.1, le=10.0
)

The amount by which to multiply the users kudos consumption.

username class-attribute instance-attribute

username: str | None = Field(
    default=None, max_length=100, min_length=3
)

When specified, will change the username. No profanity allowed!

vpn class-attribute instance-attribute

vpn: bool | None = Field(default=None)

When set to true, the user will be able to onboard workers behind a VPN. This should be used as a temporary solution until the user is trusted.

worker_invited class-attribute instance-attribute

worker_invited: int | None = Field(default=None)

Set to the amount of workers this user is allowed to join to the horde when in worker invite-only mode.

get_api_model_name abstractmethod classmethod

get_api_model_name() -> str | None

Return the name of the model as seen in the published swagger doc.

If none, there is no payload, such as for a GET request.

Source code in horde_sdk/generic_api/apimodels.py
@classmethod
@abc.abstractmethod
def get_api_model_name(cls) -> str | None:
    """Return the name of the model as seen in the published swagger doc.

    If none, there is no payload, such as for a GET request.
    """

get_sensitive_fields classmethod

get_sensitive_fields() -> set[str]

Return a set of fields which should be redacted from logs.

Source code in horde_sdk/generic_api/apimodels.py
@classmethod
def get_sensitive_fields(cls) -> set[str]:
    """Return a set of fields which should be redacted from logs."""
    return {"apikey"}

get_extra_fields_to_exclude_from_log

get_extra_fields_to_exclude_from_log() -> set[str]

Return an additional set of fields to exclude from the log_safe_model_dump method.

Source code in horde_sdk/generic_api/apimodels.py
def get_extra_fields_to_exclude_from_log(self) -> set[str]:
    """Return an additional set of fields to exclude from the log_safe_model_dump method."""
    return set()

log_safe_model_dump

log_safe_model_dump(
    extra_exclude: set[str] | None = None,
) -> dict[Any, Any]

Return a dict of the model's fields, with any sensitive fields redacted.

Source code in horde_sdk/generic_api/apimodels.py
def log_safe_model_dump(self, extra_exclude: set[str] | None = None) -> dict[Any, Any]:
    """Return a dict of the model's fields, with any sensitive fields redacted."""
    if extra_exclude is None:
        extra_exclude = set()

    if hasattr(self, "model_dump"):
        return self.model_dump(  # type: ignore
            exclude=self.get_sensitive_fields() | self.get_extra_fields_to_exclude_from_log() | extra_exclude,
        )

    logger.warning("Model does not have a model_dump method. Using python native class compatible method.")
    logger.debug(
        "Generally this should not be relied upon. If you're seeing this and you're a developer for the SDK, "
        "consider using pydantic models instead.",
    )
    # Its not a pydantic model, use python native class compatible method
    return {
        key: getattr(self, key)
        for key in self.__dict__
        if key not in self.get_sensitive_fields() | self.get_extra_fields_to_exclude_from_log() | extra_exclude
    }

ModifyUserResponse

Bases: HordeResponseBaseModel, ModifyUserReply

Represents the data returned from the /v2/users/{user_id} endpoint with http status code 200.

v2 API Model: ModifyUser

Source code in horde_sdk/ai_horde_api/apimodels/users.py
class ModifyUserResponse(HordeResponseBaseModel, ModifyUserReply):
    """Represents the data returned from the /v2/users/{user_id} endpoint with http status code 200.

    v2 API Model: `ModifyUser`
    """

    @override
    @classmethod
    def get_api_model_name(cls) -> str:
        return "ModifyUser"

model_config class-attribute instance-attribute

model_config = get_default_frozen_model_config_dict()

admin_comment class-attribute instance-attribute

admin_comment: str | None = Field(
    default=None, max_length=500, min_length=5
)

Add further information about this user for the other admins.

concurrency class-attribute instance-attribute

concurrency: int | None = Field(default=None, ge=0, le=500)

The amount of concurrent request this user can have.

contact class-attribute instance-attribute

contact: str | None = Field(
    default=None,
    examples=["email@example.com"],
    max_length=500,
    min_length=5,
)

Contact details for the horde admins to reach the user in case of emergency. This is only visible to horde moderators.

customizer class-attribute instance-attribute

customizer: bool | None = Field(default=None)

When set to true, the user will be able to serve custom Stable Diffusion models which do not exist in the Official AI Horde Model Reference.

education class-attribute instance-attribute

education: bool | None = Field(default=None)

When set to true, the user is considered an education account and some options become more restrictive.

filtered class-attribute instance-attribute

filtered: bool | None = Field(default=None)

When set to true, the replacement filter will always be applied against this user

flagged class-attribute instance-attribute

flagged: bool | None = Field(default=None)

When set to true, the user cannot transfer kudos and all their workers are put into permanent maintenance.

moderator class-attribute instance-attribute

moderator: bool | None = Field(default=None)

Set to true to make this user a horde moderator.

monthly_kudos class-attribute instance-attribute

monthly_kudos: int | None = Field(default=None)

When specified, will start assigning the user monthly kudos, starting now!

public_workers class-attribute instance-attribute

public_workers: bool | None = Field(default=None)

Set to true to make this user display their worker IDs.

service class-attribute instance-attribute

service: bool | None = Field(default=None)

When set to true, the user is considered a service account proxying the requests for other users.

special class-attribute instance-attribute

special: bool | None = Field(default=None)

When set to true, The user can send special payloads.

trusted class-attribute instance-attribute

trusted: bool | None = Field(default=None)

When set to true,the user and their servers will not be affected by suspicion.

usage_multiplier class-attribute instance-attribute

usage_multiplier: float | None = Field(
    default=None, ge=0.1, le=10.0
)

The amount by which to multiply the users kudos consumption.

username class-attribute instance-attribute

username: str | None = Field(
    default=None, max_length=100, min_length=3
)

When specified, will change the username. No profanity allowed!

vpn class-attribute instance-attribute

vpn: bool | None = Field(default=None)

When set to true, the user will be able to onboard workers behind a VPN. This should be used as a temporary solution until the user is trusted.

worker_invited class-attribute instance-attribute

worker_invited: int | None = Field(default=None)

Set to the amount of workers this user is allowed to join to the horde when in worker invite-only mode.

new_kudos class-attribute instance-attribute

new_kudos: float | None = Field(default=None)

The new amount of kudos this user has.

new_suspicion class-attribute instance-attribute

new_suspicion: int | None = Field(default=None)

The new amount of suspicion this user has.

undeleted class-attribute instance-attribute

undeleted: bool | None = Field(default=None)

True if the user was undeleted with this operation.

time_constructed property

time_constructed: float

The time the model was constructed (in epoch time).

get_api_model_name classmethod

get_api_model_name() -> str
Source code in horde_sdk/ai_horde_api/apimodels/users.py
@override
@classmethod
def get_api_model_name(cls) -> str:
    return "ModifyUser"

get_sensitive_fields classmethod

get_sensitive_fields() -> set[str]

Return a set of fields which should be redacted from logs.

Source code in horde_sdk/generic_api/apimodels.py
@classmethod
def get_sensitive_fields(cls) -> set[str]:
    """Return a set of fields which should be redacted from logs."""
    return {"apikey"}

get_extra_fields_to_exclude_from_log

get_extra_fields_to_exclude_from_log() -> set[str]

Return an additional set of fields to exclude from the log_safe_model_dump method.

Source code in horde_sdk/generic_api/apimodels.py
def get_extra_fields_to_exclude_from_log(self) -> set[str]:
    """Return an additional set of fields to exclude from the log_safe_model_dump method."""
    return set()

log_safe_model_dump

log_safe_model_dump(
    extra_exclude: set[str] | None = None,
) -> dict[Any, Any]

Return a dict of the model's fields, with any sensitive fields redacted.

Source code in horde_sdk/generic_api/apimodels.py
def log_safe_model_dump(self, extra_exclude: set[str] | None = None) -> dict[Any, Any]:
    """Return a dict of the model's fields, with any sensitive fields redacted."""
    if extra_exclude is None:
        extra_exclude = set()

    if hasattr(self, "model_dump"):
        return self.model_dump(  # type: ignore
            exclude=self.get_sensitive_fields() | self.get_extra_fields_to_exclude_from_log() | extra_exclude,
        )

    logger.warning("Model does not have a model_dump method. Using python native class compatible method.")
    logger.debug(
        "Generally this should not be relied upon. If you're seeing this and you're a developer for the SDK, "
        "consider using pydantic models instead.",
    )
    # Its not a pydantic model, use python native class compatible method
    return {
        key: getattr(self, key)
        for key in self.__dict__
        if key not in self.get_sensitive_fields() | self.get_extra_fields_to_exclude_from_log() | extra_exclude
    }

ModifyUserRequest

Bases: BaseAIHordeRequest, MessageSpecifiesUserIDMixin, ModifyUser, APIKeyAllowedInRequestMixin

Represents a PUT request to the /v2/users/{user_id} endpoint.

v2 API Model: ModifyUserInput

Source code in horde_sdk/ai_horde_api/apimodels/users.py
class ModifyUserRequest(
    BaseAIHordeRequest,
    MessageSpecifiesUserIDMixin,
    ModifyUser,
    APIKeyAllowedInRequestMixin,
):
    """Represents a PUT request to the /v2/users/{user_id} endpoint.

    v2 API Model: `ModifyUserInput`
    """

    @override
    @classmethod
    def get_api_model_name(cls) -> str:
        return "ModifyUserInput"

    @override
    @classmethod
    def get_http_method(cls) -> HTTPMethod:
        return HTTPMethod.PUT

    @override
    @classmethod
    def get_api_endpoint_subpath(cls) -> AI_HORDE_API_ENDPOINT_SUBPATH:
        return AI_HORDE_API_ENDPOINT_SUBPATH.v2_users_single

    @override
    @classmethod
    def get_default_success_response_type(cls) -> type[ModifyUserResponse]:
        return ModifyUserResponse

    @override
    @classmethod
    def is_api_key_required(cls) -> bool:
        return True

model_config class-attribute instance-attribute

model_config = get_default_frozen_model_config_dict()

apikey class-attribute instance-attribute

apikey: str | None = None

Defaults to ANON_API_KEY. See also .is_api_key_required()

admin_comment class-attribute instance-attribute

admin_comment: str | None = Field(
    default=None, max_length=500, min_length=5
)

Add further information about this user for the other admins.

concurrency class-attribute instance-attribute

concurrency: int | None = Field(default=None, ge=0, le=500)

The amount of concurrent request this user can have.

contact class-attribute instance-attribute

contact: str | None = Field(
    default=None,
    examples=["email@example.com"],
    max_length=500,
    min_length=5,
)

Contact details for the horde admins to reach the user in case of emergency. This is only visible to horde moderators.

customizer class-attribute instance-attribute

customizer: bool | None = Field(default=None)

When set to true, the user will be able to serve custom Stable Diffusion models which do not exist in the Official AI Horde Model Reference.

education class-attribute instance-attribute

education: bool | None = Field(default=None)

When set to true, the user is considered an education account and some options become more restrictive.

filtered class-attribute instance-attribute

filtered: bool | None = Field(default=None)

When set to true, the replacement filter will always be applied against this user

flagged class-attribute instance-attribute

flagged: bool | None = Field(default=None)

When set to true, the user cannot transfer kudos and all their workers are put into permanent maintenance.

moderator class-attribute instance-attribute

moderator: bool | None = Field(default=None)

Set to true to make this user a horde moderator.

monthly_kudos class-attribute instance-attribute

monthly_kudos: int | None = Field(default=None)

When specified, will start assigning the user monthly kudos, starting now!

public_workers class-attribute instance-attribute

public_workers: bool | None = Field(default=None)

Set to true to make this user display their worker IDs.

service class-attribute instance-attribute

service: bool | None = Field(default=None)

When set to true, the user is considered a service account proxying the requests for other users.

special class-attribute instance-attribute

special: bool | None = Field(default=None)

When set to true, The user can send special payloads.

trusted class-attribute instance-attribute

trusted: bool | None = Field(default=None)

When set to true,the user and their servers will not be affected by suspicion.

usage_multiplier class-attribute instance-attribute

usage_multiplier: float | None = Field(
    default=None, ge=0.1, le=10.0
)

The amount by which to multiply the users kudos consumption.

username class-attribute instance-attribute

username: str | None = Field(
    default=None, max_length=100, min_length=3
)

When specified, will change the username. No profanity allowed!

vpn class-attribute instance-attribute

vpn: bool | None = Field(default=None)

When set to true, the user will be able to onboard workers behind a VPN. This should be used as a temporary solution until the user is trusted.

worker_invited class-attribute instance-attribute

worker_invited: int | None = Field(default=None)

Set to the amount of workers this user is allowed to join to the horde when in worker invite-only mode.

kudos class-attribute instance-attribute

kudos: float | None = Field(default=None)

The amount of kudos to modify (can be negative).

reset_suspicion class-attribute instance-attribute

reset_suspicion: bool | None = Field(default=None)

Set the user's suspicion back to 0.

undelete class-attribute instance-attribute

undelete: bool | None = Field(default=None)

When set to true, A user's who's marked to be deleted will become active again.

user_id instance-attribute

user_id: str

The user's ID, as a str, but only containing numeric values.

accept class-attribute instance-attribute

accept: GenericAcceptTypes = json

The 'accept' header field.

client_agent class-attribute instance-attribute

client_agent: str = Field(
    default=default_bridge_agent_string,
    alias="Client-Agent",
)

The requesting client's agent. You should set this to reflect the name, version and contact information for your client.

get_api_model_name classmethod

get_api_model_name() -> str
Source code in horde_sdk/ai_horde_api/apimodels/users.py
@override
@classmethod
def get_api_model_name(cls) -> str:
    return "ModifyUserInput"

get_http_method classmethod

get_http_method() -> HTTPMethod
Source code in horde_sdk/ai_horde_api/apimodels/users.py
@override
@classmethod
def get_http_method(cls) -> HTTPMethod:
    return HTTPMethod.PUT

get_api_endpoint_subpath classmethod

get_api_endpoint_subpath() -> AI_HORDE_API_ENDPOINT_SUBPATH
Source code in horde_sdk/ai_horde_api/apimodels/users.py
@override
@classmethod
def get_api_endpoint_subpath(cls) -> AI_HORDE_API_ENDPOINT_SUBPATH:
    return AI_HORDE_API_ENDPOINT_SUBPATH.v2_users_single

get_default_success_response_type classmethod

get_default_success_response_type() -> (
    type[ModifyUserResponse]
)
Source code in horde_sdk/ai_horde_api/apimodels/users.py
@override
@classmethod
def get_default_success_response_type(cls) -> type[ModifyUserResponse]:
    return ModifyUserResponse

is_api_key_required classmethod

is_api_key_required() -> bool
Source code in horde_sdk/ai_horde_api/apimodels/users.py
@override
@classmethod
def is_api_key_required(cls) -> bool:
    return True

get_sensitive_fields classmethod

get_sensitive_fields() -> set[str]
Source code in horde_sdk/generic_api/apimodels.py
@override
@classmethod
def get_sensitive_fields(cls) -> set[str]:
    return {"apikey"}

get_extra_fields_to_exclude_from_log

get_extra_fields_to_exclude_from_log() -> set[str]

Return an additional set of fields to exclude from the log_safe_model_dump method.

Source code in horde_sdk/generic_api/apimodels.py
def get_extra_fields_to_exclude_from_log(self) -> set[str]:
    """Return an additional set of fields to exclude from the log_safe_model_dump method."""
    return set()

log_safe_model_dump

log_safe_model_dump(
    extra_exclude: set[str] | None = None,
) -> dict[Any, Any]

Return a dict of the model's fields, with any sensitive fields redacted.

Source code in horde_sdk/generic_api/apimodels.py
def log_safe_model_dump(self, extra_exclude: set[str] | None = None) -> dict[Any, Any]:
    """Return a dict of the model's fields, with any sensitive fields redacted."""
    if extra_exclude is None:
        extra_exclude = set()

    if hasattr(self, "model_dump"):
        return self.model_dump(  # type: ignore
            exclude=self.get_sensitive_fields() | self.get_extra_fields_to_exclude_from_log() | extra_exclude,
        )

    logger.warning("Model does not have a model_dump method. Using python native class compatible method.")
    logger.debug(
        "Generally this should not be relied upon. If you're seeing this and you're a developer for the SDK, "
        "consider using pydantic models instead.",
    )
    # Its not a pydantic model, use python native class compatible method
    return {
        key: getattr(self, key)
        for key in self.__dict__
        if key not in self.get_sensitive_fields() | self.get_extra_fields_to_exclude_from_log() | extra_exclude
    }

validate_api_key_length

validate_api_key_length(v: str) -> str

Validate that the API key is the correct length, or is the special ANON_API_KEY.

Source code in horde_sdk/generic_api/apimodels.py
@field_validator("apikey", mode="before")
def validate_api_key_length(cls, v: str) -> str:
    """Validate that the API key is the correct length, or is the special ANON_API_KEY."""
    if v is None:
        return ANON_API_KEY
    if v == ANON_API_KEY:
        return v
    if len(v) == 36:
        try:
            uuid.UUID(v)
            return v
        except ValueError as e:
            raise ValueError("API key must be a valid UUID") from e
        return v
    if len(v) != 22:
        raise ValueError("API key must be 22 characters long")
    return v

user_id_is_numeric

user_id_is_numeric(value: str) -> str

Check if the ID is a numeric string.

The API endpoint expects a string, but the only valid values would be numbers only.

Source code in horde_sdk/generic_api/apimodels.py
@field_validator("user_id")
def user_id_is_numeric(cls, value: str) -> str:
    """Check if the ID is a numeric string.

    The API endpoint expects a string, but the only valid values would be numbers only.
    """
    if not value.isnumeric():
        raise ValueError("user_id must only contain numeric values")
    return value

get_api_endpoint_url classmethod

get_api_endpoint_url() -> str

Return the endpoint URL, including the path to the specific API action defined by this object.

Source code in horde_sdk/generic_api/apimodels.py
@classmethod
def get_api_endpoint_url(cls) -> str:
    """Return the endpoint URL, including the path to the specific API action defined by this object."""
    return url_with_path(base_url=cls.get_api_url(), path=cls.get_api_endpoint_subpath())

get_api_url classmethod

get_api_url() -> str
Source code in horde_sdk/ai_horde_api/apimodels/base.py
@override
@classmethod
def get_api_url(cls) -> str:
    return AI_HORDE_BASE_URL

get_success_status_response_pairs classmethod

get_success_status_response_pairs() -> (
    dict[HTTPStatusCode, type[HordeResponseTypes]]
)

Return a dict of HTTP status codes and the expected HordeResponse.

Defaults to {HTTPStatusCode.OK: cls.get_expected_response_type()}, but may be overridden to support other status codes.

Source code in horde_sdk/generic_api/apimodels.py
@classmethod
def get_success_status_response_pairs(
    cls,
) -> dict[HTTPStatusCode, type[HordeResponseTypes]]:
    """Return a dict of HTTP status codes and the expected `HordeResponse`.

    Defaults to `{HTTPStatusCode.OK: cls.get_expected_response_type()}`, but may be overridden to support other
    status codes.
    """
    return {HTTPStatusCode.OK: cls.get_default_success_response_type()}

get_header_fields classmethod

get_header_fields() -> list[str]

Return a list of field names from this request object that should be sent as header fields.

This is in addition to GenericHeaderFields's values, and possibly the API specific class which inherits from GenericHeaderFields, typically found in the horde_sdk.<api_name>_api.metadata module.

Source code in horde_sdk/generic_api/apimodels.py
@classmethod
def get_header_fields(cls) -> list[str]:
    """Return a list of field names from this request object that should be sent as header fields.

    This is in addition to `GenericHeaderFields`'s values, and possibly the API specific class
    which inherits from `GenericHeaderFields`, typically found in the `horde_sdk.<api_name>_api.metadata` module.
    """
    return []

get_query_fields classmethod

get_query_fields() -> list[str]

Return a list of field names from this request object that should be sent as query parameters.

This is in addition to GenericQueryFields's values, and possibly the API specific class which inherits from GenericQueryFields, typically found in the horde_sdk.<api_name>_api.metadata module.

Source code in horde_sdk/generic_api/apimodels.py
@classmethod
def get_query_fields(cls) -> list[str]:
    """Return a list of field names from this request object that should be sent as query parameters.

    This is in addition to `GenericQueryFields`'s values, and possibly the API specific class
    which inherits from `GenericQueryFields`, typically found in the `horde_sdk.<api_name>_api.metadata` module.
    """
    return []

get_number_of_results_expected

get_number_of_results_expected() -> int

Return the number of (job) results expected from this request.

Defaults to 1, but may be overridden to dynamically change the number of results expected.

This is factored into context management; if the number of results expected is not met, the job is considered unhandled on an exception and followed up on to attempt to close it.

Source code in horde_sdk/generic_api/apimodels.py
def get_number_of_results_expected(self) -> int:
    """Return the number of (job) results expected from this request.

    Defaults to `1`, but may be overridden to dynamically change the number of results expected.

    This is factored into context management; if the number of results expected is not met, the job is considered
    unhandled on an exception and followed up on to attempt to close it.
    """
    return 1

get_requires_follow_up

get_requires_follow_up() -> bool

Return whether this request requires a follow up request(s).

Returns:

  • bool ( bool ) –

    Whether this request requires a follow up request to close the job on the server.

Source code in horde_sdk/generic_api/apimodels.py
def get_requires_follow_up(self) -> bool:
    """Return whether this request requires a follow up request(s).

    Returns:
        bool: Whether this request requires a follow up request to close the job on the server.
    """
    for response_type in self.get_success_status_response_pairs().values():
        if issubclass(response_type, ResponseRequiringFollowUpMixin):
            return True
    return False

DeleteUserResponse

Bases: HordeResponseBaseModel, ContainsMessageResponseMixin

Confirmation that a user was deleted.

Represents the data returned from the /v2/users/{user_id} endpoint with http status code 200.

v2 API Model: SimpleResponse

Source code in horde_sdk/ai_horde_api/apimodels/users.py
class DeleteUserResponse(
    HordeResponseBaseModel,
    ContainsMessageResponseMixin,
):
    """Confirmation that a user was deleted.

    Represents the data returned from the /v2/users/{user_id} endpoint with http status code 200.

    v2 API Model: `SimpleResponse`
    """

    @override
    @classmethod
    def get_api_model_name(cls) -> str:
        return "SimpleResponse"

model_config class-attribute instance-attribute

model_config = get_default_frozen_model_config_dict()

message class-attribute instance-attribute

message: str = ''

A message from the API. This is typically an error or warning message, but may also be informational.

time_constructed property

time_constructed: float

The time the model was constructed (in epoch time).

get_api_model_name classmethod

get_api_model_name() -> str
Source code in horde_sdk/ai_horde_api/apimodels/users.py
@override
@classmethod
def get_api_model_name(cls) -> str:
    return "SimpleResponse"

get_sensitive_fields classmethod

get_sensitive_fields() -> set[str]

Return a set of fields which should be redacted from logs.

Source code in horde_sdk/generic_api/apimodels.py
@classmethod
def get_sensitive_fields(cls) -> set[str]:
    """Return a set of fields which should be redacted from logs."""
    return {"apikey"}

get_extra_fields_to_exclude_from_log

get_extra_fields_to_exclude_from_log() -> set[str]

Return an additional set of fields to exclude from the log_safe_model_dump method.

Source code in horde_sdk/generic_api/apimodels.py
def get_extra_fields_to_exclude_from_log(self) -> set[str]:
    """Return an additional set of fields to exclude from the log_safe_model_dump method."""
    return set()

log_safe_model_dump

log_safe_model_dump(
    extra_exclude: set[str] | None = None,
) -> dict[Any, Any]

Return a dict of the model's fields, with any sensitive fields redacted.

Source code in horde_sdk/generic_api/apimodels.py
def log_safe_model_dump(self, extra_exclude: set[str] | None = None) -> dict[Any, Any]:
    """Return a dict of the model's fields, with any sensitive fields redacted."""
    if extra_exclude is None:
        extra_exclude = set()

    if hasattr(self, "model_dump"):
        return self.model_dump(  # type: ignore
            exclude=self.get_sensitive_fields() | self.get_extra_fields_to_exclude_from_log() | extra_exclude,
        )

    logger.warning("Model does not have a model_dump method. Using python native class compatible method.")
    logger.debug(
        "Generally this should not be relied upon. If you're seeing this and you're a developer for the SDK, "
        "consider using pydantic models instead.",
    )
    # Its not a pydantic model, use python native class compatible method
    return {
        key: getattr(self, key)
        for key in self.__dict__
        if key not in self.get_sensitive_fields() | self.get_extra_fields_to_exclude_from_log() | extra_exclude
    }

DeleteUserRequest

Bases: BaseAIHordeRequest, MessageSpecifiesUserIDMixin, APIKeyAllowedInRequestMixin

Request to delete a user.

Note that this is a privileged operation and requires the owning user, a moderator, or admin API key.

Represents a DELETE request to the /v2/users/{user_id} endpoint.

Source code in horde_sdk/ai_horde_api/apimodels/users.py
class DeleteUserRequest(
    BaseAIHordeRequest,
    MessageSpecifiesUserIDMixin,
    APIKeyAllowedInRequestMixin,
):
    """Request to delete a user.

    Note that this is a privileged operation and requires the owning user, a moderator, or admin API key.

    Represents a DELETE request to the /v2/users/{user_id} endpoint.
    """

    @override
    @classmethod
    def get_api_model_name(cls) -> str | None:
        return None

    @override
    @classmethod
    def get_http_method(cls) -> HTTPMethod:
        return HTTPMethod.DELETE

    @override
    @classmethod
    def get_api_endpoint_subpath(cls) -> AI_HORDE_API_ENDPOINT_SUBPATH:
        return AI_HORDE_API_ENDPOINT_SUBPATH.v2_users_single

    @override
    @classmethod
    def get_default_success_response_type(cls) -> type[DeleteUserResponse]:
        return DeleteUserResponse

    @override
    @classmethod
    def is_api_key_required(cls) -> bool:
        return True

model_config class-attribute instance-attribute

model_config = get_default_frozen_model_config_dict()

apikey class-attribute instance-attribute

apikey: str | None = None

Defaults to ANON_API_KEY. See also .is_api_key_required()

user_id instance-attribute

user_id: str

The user's ID, as a str, but only containing numeric values.

accept class-attribute instance-attribute

accept: GenericAcceptTypes = json

The 'accept' header field.

client_agent class-attribute instance-attribute

client_agent: str = Field(
    default=default_bridge_agent_string,
    alias="Client-Agent",
)

The requesting client's agent. You should set this to reflect the name, version and contact information for your client.

get_api_model_name classmethod

get_api_model_name() -> str | None
Source code in horde_sdk/ai_horde_api/apimodels/users.py
@override
@classmethod
def get_api_model_name(cls) -> str | None:
    return None

get_http_method classmethod

get_http_method() -> HTTPMethod
Source code in horde_sdk/ai_horde_api/apimodels/users.py
@override
@classmethod
def get_http_method(cls) -> HTTPMethod:
    return HTTPMethod.DELETE

get_api_endpoint_subpath classmethod

get_api_endpoint_subpath() -> AI_HORDE_API_ENDPOINT_SUBPATH
Source code in horde_sdk/ai_horde_api/apimodels/users.py
@override
@classmethod
def get_api_endpoint_subpath(cls) -> AI_HORDE_API_ENDPOINT_SUBPATH:
    return AI_HORDE_API_ENDPOINT_SUBPATH.v2_users_single

get_default_success_response_type classmethod

get_default_success_response_type() -> (
    type[DeleteUserResponse]
)
Source code in horde_sdk/ai_horde_api/apimodels/users.py
@override
@classmethod
def get_default_success_response_type(cls) -> type[DeleteUserResponse]:
    return DeleteUserResponse

is_api_key_required classmethod

is_api_key_required() -> bool
Source code in horde_sdk/ai_horde_api/apimodels/users.py
@override
@classmethod
def is_api_key_required(cls) -> bool:
    return True

get_sensitive_fields classmethod

get_sensitive_fields() -> set[str]
Source code in horde_sdk/generic_api/apimodels.py
@override
@classmethod
def get_sensitive_fields(cls) -> set[str]:
    return {"apikey"}

get_extra_fields_to_exclude_from_log

get_extra_fields_to_exclude_from_log() -> set[str]

Return an additional set of fields to exclude from the log_safe_model_dump method.

Source code in horde_sdk/generic_api/apimodels.py
def get_extra_fields_to_exclude_from_log(self) -> set[str]:
    """Return an additional set of fields to exclude from the log_safe_model_dump method."""
    return set()

log_safe_model_dump

log_safe_model_dump(
    extra_exclude: set[str] | None = None,
) -> dict[Any, Any]

Return a dict of the model's fields, with any sensitive fields redacted.

Source code in horde_sdk/generic_api/apimodels.py
def log_safe_model_dump(self, extra_exclude: set[str] | None = None) -> dict[Any, Any]:
    """Return a dict of the model's fields, with any sensitive fields redacted."""
    if extra_exclude is None:
        extra_exclude = set()

    if hasattr(self, "model_dump"):
        return self.model_dump(  # type: ignore
            exclude=self.get_sensitive_fields() | self.get_extra_fields_to_exclude_from_log() | extra_exclude,
        )

    logger.warning("Model does not have a model_dump method. Using python native class compatible method.")
    logger.debug(
        "Generally this should not be relied upon. If you're seeing this and you're a developer for the SDK, "
        "consider using pydantic models instead.",
    )
    # Its not a pydantic model, use python native class compatible method
    return {
        key: getattr(self, key)
        for key in self.__dict__
        if key not in self.get_sensitive_fields() | self.get_extra_fields_to_exclude_from_log() | extra_exclude
    }

validate_api_key_length

validate_api_key_length(v: str) -> str

Validate that the API key is the correct length, or is the special ANON_API_KEY.

Source code in horde_sdk/generic_api/apimodels.py
@field_validator("apikey", mode="before")
def validate_api_key_length(cls, v: str) -> str:
    """Validate that the API key is the correct length, or is the special ANON_API_KEY."""
    if v is None:
        return ANON_API_KEY
    if v == ANON_API_KEY:
        return v
    if len(v) == 36:
        try:
            uuid.UUID(v)
            return v
        except ValueError as e:
            raise ValueError("API key must be a valid UUID") from e
        return v
    if len(v) != 22:
        raise ValueError("API key must be 22 characters long")
    return v

user_id_is_numeric

user_id_is_numeric(value: str) -> str

Check if the ID is a numeric string.

The API endpoint expects a string, but the only valid values would be numbers only.

Source code in horde_sdk/generic_api/apimodels.py
@field_validator("user_id")
def user_id_is_numeric(cls, value: str) -> str:
    """Check if the ID is a numeric string.

    The API endpoint expects a string, but the only valid values would be numbers only.
    """
    if not value.isnumeric():
        raise ValueError("user_id must only contain numeric values")
    return value

get_api_endpoint_url classmethod

get_api_endpoint_url() -> str

Return the endpoint URL, including the path to the specific API action defined by this object.

Source code in horde_sdk/generic_api/apimodels.py
@classmethod
def get_api_endpoint_url(cls) -> str:
    """Return the endpoint URL, including the path to the specific API action defined by this object."""
    return url_with_path(base_url=cls.get_api_url(), path=cls.get_api_endpoint_subpath())

get_api_url classmethod

get_api_url() -> str
Source code in horde_sdk/ai_horde_api/apimodels/base.py
@override
@classmethod
def get_api_url(cls) -> str:
    return AI_HORDE_BASE_URL

get_success_status_response_pairs classmethod

get_success_status_response_pairs() -> (
    dict[HTTPStatusCode, type[HordeResponseTypes]]
)

Return a dict of HTTP status codes and the expected HordeResponse.

Defaults to {HTTPStatusCode.OK: cls.get_expected_response_type()}, but may be overridden to support other status codes.

Source code in horde_sdk/generic_api/apimodels.py
@classmethod
def get_success_status_response_pairs(
    cls,
) -> dict[HTTPStatusCode, type[HordeResponseTypes]]:
    """Return a dict of HTTP status codes and the expected `HordeResponse`.

    Defaults to `{HTTPStatusCode.OK: cls.get_expected_response_type()}`, but may be overridden to support other
    status codes.
    """
    return {HTTPStatusCode.OK: cls.get_default_success_response_type()}

get_header_fields classmethod

get_header_fields() -> list[str]

Return a list of field names from this request object that should be sent as header fields.

This is in addition to GenericHeaderFields's values, and possibly the API specific class which inherits from GenericHeaderFields, typically found in the horde_sdk.<api_name>_api.metadata module.

Source code in horde_sdk/generic_api/apimodels.py
@classmethod
def get_header_fields(cls) -> list[str]:
    """Return a list of field names from this request object that should be sent as header fields.

    This is in addition to `GenericHeaderFields`'s values, and possibly the API specific class
    which inherits from `GenericHeaderFields`, typically found in the `horde_sdk.<api_name>_api.metadata` module.
    """
    return []

get_query_fields classmethod

get_query_fields() -> list[str]

Return a list of field names from this request object that should be sent as query parameters.

This is in addition to GenericQueryFields's values, and possibly the API specific class which inherits from GenericQueryFields, typically found in the horde_sdk.<api_name>_api.metadata module.

Source code in horde_sdk/generic_api/apimodels.py
@classmethod
def get_query_fields(cls) -> list[str]:
    """Return a list of field names from this request object that should be sent as query parameters.

    This is in addition to `GenericQueryFields`'s values, and possibly the API specific class
    which inherits from `GenericQueryFields`, typically found in the `horde_sdk.<api_name>_api.metadata` module.
    """
    return []

get_number_of_results_expected

get_number_of_results_expected() -> int

Return the number of (job) results expected from this request.

Defaults to 1, but may be overridden to dynamically change the number of results expected.

This is factored into context management; if the number of results expected is not met, the job is considered unhandled on an exception and followed up on to attempt to close it.

Source code in horde_sdk/generic_api/apimodels.py
def get_number_of_results_expected(self) -> int:
    """Return the number of (job) results expected from this request.

    Defaults to `1`, but may be overridden to dynamically change the number of results expected.

    This is factored into context management; if the number of results expected is not met, the job is considered
    unhandled on an exception and followed up on to attempt to close it.
    """
    return 1

get_requires_follow_up

get_requires_follow_up() -> bool

Return whether this request requires a follow up request(s).

Returns:

  • bool ( bool ) –

    Whether this request requires a follow up request to close the job on the server.

Source code in horde_sdk/generic_api/apimodels.py
def get_requires_follow_up(self) -> bool:
    """Return whether this request requires a follow up request(s).

    Returns:
        bool: Whether this request requires a follow up request to close the job on the server.
    """
    for response_type in self.get_success_status_response_pairs().values():
        if issubclass(response_type, ResponseRequiringFollowUpMixin):
            return True
    return False