apimodels
Model definitions for AI Horde Ratings API.
__all__
module-attribute
__all__ = [
"BaseImageRatingRecord",
"BaseRatingsAPIRequest",
"BaseSelectableReturnTypeRequest",
"HordeRequestImageSpecific",
"ImageRatingResponseSubRecord",
"ImageRatingsComparisonTypes",
"ImageRatingsFilterableRequestBase",
"ImageRatingsRequest",
"ImageRatingsResponse",
"SelectableReturnFormats",
"UserCheckRequest",
"UserCheckResponse",
"UserRatingsRequest",
"UserRatingsResponse",
"UserRatingsResponseSubRecord",
"UserValidateRequest",
"UserValidateResponse",
"UserValidateResponseRecord",
]
BaseRatingsAPIRequest
Bases: HordeRequest
Base class for all requests to the AI Horde Ratings API.
Source code in horde_sdk/ratings_api/apimodels.py
model_config
class-attribute
instance-attribute
accept
class-attribute
instance-attribute
The 'accept' header field.
client_agent
class-attribute
instance-attribute
The requesting client's agent. You should set this to reflect the name, version and contact information for your client.
get_api_url
classmethod
get_api_model_name
abstractmethod
classmethod
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_extra_fields_to_exclude_from_log
Return an additional set of fields to exclude from the log_safe_model_dump method.
log_safe_model_dump
Return a dict of the model's fields, with any sensitive fields redacted.
Source code in horde_sdk/generic_api/apimodels.py
get_http_method
abstractmethod
classmethod
get_api_endpoint_url
classmethod
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
get_api_endpoint_subpath
abstractmethod
classmethod
Return the subpath to the specific API action defined by this object.
get_default_success_response_type
abstractmethod
classmethod
Return the type of the response expected in the ordinary case of success.
get_success_status_response_pairs
classmethod
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
get_header_fields
classmethod
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
get_query_fields
classmethod
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
get_number_of_results_expected
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
get_requires_follow_up
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
BaseImageRatingRecord
Bases: BaseModel
The information about any image rating result.
Source code in horde_sdk/ratings_api/apimodels.py
ImageRatingResponseSubRecord
Bases: BaseModel
A single sub-record in a response from the /v1/image/ratings endpoint.
Source code in horde_sdk/ratings_api/apimodels.py
ImageRatingsResponse
Bases: HordeResponseBaseModel
The representation of the full response from /v1/image/ratings.
Source code in horde_sdk/ratings_api/apimodels.py
time_constructed
property
The time the model was constructed (in epoch time).
model_config
class-attribute
instance-attribute
get_api_model_name
classmethod
get_sensitive_fields
classmethod
get_extra_fields_to_exclude_from_log
Return an additional set of fields to exclude from the log_safe_model_dump method.
log_safe_model_dump
Return a dict of the model's fields, with any sensitive fields redacted.
Source code in horde_sdk/generic_api/apimodels.py
UserRatingsResponseSubRecord
Bases: BaseImageRatingRecord
A single sub-record in a response from the /v1/user/ratings endpoint.
Source code in horde_sdk/ratings_api/apimodels.py
UserRatingsResponse
Bases: HordeResponseBaseModel
The representation of the full response from /v1/user/ratings.
Source code in horde_sdk/ratings_api/apimodels.py
ratings
instance-attribute
A list of all records returned.
time_constructed
property
The time the model was constructed (in epoch time).
model_config
class-attribute
instance-attribute
get_api_model_name
classmethod
get_sensitive_fields
classmethod
get_extra_fields_to_exclude_from_log
Return an additional set of fields to exclude from the log_safe_model_dump method.
log_safe_model_dump
Return a dict of the model's fields, with any sensitive fields redacted.
Source code in horde_sdk/generic_api/apimodels.py
UserValidateResponseRecord
Bases: BaseImageRatingRecord
A single sub-record in a response from the /v1/validate/{user_id} endpoint.
Source code in horde_sdk/ratings_api/apimodels.py
UserValidateResponse
Bases: HordeResponseBaseModel
The representation of the full response from /v1/validate/{user_id}.
Source code in horde_sdk/ratings_api/apimodels.py
ratings
instance-attribute
A list of all records returned.
time_constructed
property
The time the model was constructed (in epoch time).
model_config
class-attribute
instance-attribute
get_api_model_name
classmethod
get_sensitive_fields
classmethod
get_extra_fields_to_exclude_from_log
Return an additional set of fields to exclude from the log_safe_model_dump method.
log_safe_model_dump
Return a dict of the model's fields, with any sensitive fields redacted.
Source code in horde_sdk/generic_api/apimodels.py
UserCheckResponse
Bases: HordeResponseBaseModel
A single record from the /v1/user/check/ endpoint.
Source code in horde_sdk/ratings_api/apimodels.py
ratings_in_timeframe
instance-attribute
The number of ratings this user submitted in the timeframe.
ratings_per_minute_in_timeframe
instance-attribute
The average number of ratings per minute.
ratings_past_three_hours
instance-attribute
The average number of ratings in the three hours prior to the request.
ratings_per_minute_for_past_three_hours
instance-attribute
The average number of ratings per minute in the three hours prior to the request.
suspect_divergences
instance-attribute
The number of instances of this user's rating not being within the criteria.
time_constructed
property
The time the model was constructed (in epoch time).
model_config
class-attribute
instance-attribute
get_api_model_name
classmethod
get_sensitive_fields
classmethod
get_extra_fields_to_exclude_from_log
Return an additional set of fields to exclude from the log_safe_model_dump method.
log_safe_model_dump
Return a dict of the model's fields, with any sensitive fields redacted.
Source code in horde_sdk/generic_api/apimodels.py
HordeRequestImageSpecific
Bases: BaseModel
Represents the minimum for any request specifying a specific user to the API.
Source code in horde_sdk/ratings_api/apimodels.py
SelectableReturnFormats
Bases: StrEnum
Formats the API supports returning data.
Source code in horde_sdk/ratings_api/apimodels.py
BaseSelectableReturnTypeRequest
Bases: BaseModel
Mix-in class to describe an endpoint for which you can select the return data format.
Source code in horde_sdk/ratings_api/apimodels.py
ImageRatingsRequest
Bases: BaseRatingsAPIRequest, APIKeyAllowedInRequestMixin, BaseSelectableReturnTypeRequest
Represents the data needed to make a request to the /v1/image/ratings/{image_id} endpoint.
Source code in horde_sdk/ratings_api/apimodels.py
format
instance-attribute
The format to request the response payload in, typically json.
model_config
class-attribute
instance-attribute
apikey
class-attribute
instance-attribute
Defaults to ANON_API_KEY. See also .is_api_key_required()
accept
class-attribute
instance-attribute
The 'accept' header field.
client_agent
class-attribute
instance-attribute
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_http_method
classmethod
get_api_endpoint_subpath
classmethod
get_default_success_response_type
classmethod
get_sensitive_fields
classmethod
get_extra_fields_to_exclude_from_log
Return an additional set of fields to exclude from the log_safe_model_dump method.
log_safe_model_dump
Return a dict of the model's fields, with any sensitive fields redacted.
Source code in horde_sdk/generic_api/apimodels.py
is_api_key_required
classmethod
validate_api_key_length
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
get_api_endpoint_url
classmethod
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
get_api_url
classmethod
get_success_status_response_pairs
classmethod
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
get_header_fields
classmethod
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
get_query_fields
classmethod
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
get_number_of_results_expected
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
get_requires_follow_up
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
ImageRatingsComparisonTypes
Bases: StrEnum
Ways the API supports selecting a rating range.
Source code in horde_sdk/ratings_api/apimodels.py
ImageRatingsFilterableRequestBase
Bases: BaseSelectableReturnTypeRequest
Generically, data the API requires to filter results prior and how to return them.
Source code in horde_sdk/ratings_api/apimodels.py
rating
instance-attribute
The target rating, which will be compared by rating_comparison.
rating_comparison
instance-attribute
The way the rating will be compared. See ImageRatingsComparisonTypes.
artifacts
class-attribute
instance-attribute
The target artifact rating, which will be compared by artifacts_comparison.
artifacts_comparison
class-attribute
instance-attribute
The way the artifacts will be compared. See ImageRatingsComparisonTypes.
UserValidateRequest
Bases: BaseRatingsAPIRequest, APIKeyAllowedInRequestMixin, MessageSpecifiesUserIDMixin, ImageRatingsFilterableRequestBase
Represents the data needed to make a request to the /v1/user/validate/{user_id} endpoint.
Source code in horde_sdk/ratings_api/apimodels.py
format
instance-attribute
The format to request the response payload in, typically json.
rating
instance-attribute
The target rating, which will be compared by rating_comparison.
rating_comparison
instance-attribute
The way the rating will be compared. See ImageRatingsComparisonTypes.
artifacts
class-attribute
instance-attribute
The target artifact rating, which will be compared by artifacts_comparison.
artifacts_comparison
class-attribute
instance-attribute
The way the artifacts will be compared. See ImageRatingsComparisonTypes.
model_config
class-attribute
instance-attribute
user_id
instance-attribute
The user's ID, as a str, but only containing numeric values.
apikey
class-attribute
instance-attribute
Defaults to ANON_API_KEY. See also .is_api_key_required()
accept
class-attribute
instance-attribute
The 'accept' header field.
client_agent
class-attribute
instance-attribute
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_http_method
classmethod
get_api_endpoint_subpath
classmethod
get_default_success_response_type
classmethod
user_id_is_numeric
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
get_sensitive_fields
classmethod
get_extra_fields_to_exclude_from_log
Return an additional set of fields to exclude from the log_safe_model_dump method.
log_safe_model_dump
Return a dict of the model's fields, with any sensitive fields redacted.
Source code in horde_sdk/generic_api/apimodels.py
is_api_key_required
classmethod
validate_api_key_length
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
get_api_endpoint_url
classmethod
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
get_api_url
classmethod
get_success_status_response_pairs
classmethod
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
get_header_fields
classmethod
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
get_query_fields
classmethod
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
get_number_of_results_expected
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
get_requires_follow_up
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
UserCheckRequest
Bases: BaseRatingsAPIRequest, APIKeyAllowedInRequestMixin, MessageSpecifiesUserIDMixin
Represents the data needed to make a request to the /v1/user/check/ endpoint.
Source code in horde_sdk/ratings_api/apimodels.py
model_config
class-attribute
instance-attribute
user_id
instance-attribute
The user's ID, as a str, but only containing numeric values.
apikey
class-attribute
instance-attribute
Defaults to ANON_API_KEY. See also .is_api_key_required()
accept
class-attribute
instance-attribute
The 'accept' header field.
client_agent
class-attribute
instance-attribute
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_http_method
classmethod
get_api_endpoint_subpath
classmethod
get_default_success_response_type
classmethod
user_id_is_numeric
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
get_sensitive_fields
classmethod
get_extra_fields_to_exclude_from_log
Return an additional set of fields to exclude from the log_safe_model_dump method.
log_safe_model_dump
Return a dict of the model's fields, with any sensitive fields redacted.
Source code in horde_sdk/generic_api/apimodels.py
is_api_key_required
classmethod
validate_api_key_length
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
get_api_endpoint_url
classmethod
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
get_api_url
classmethod
get_success_status_response_pairs
classmethod
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
get_header_fields
classmethod
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
get_query_fields
classmethod
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
get_number_of_results_expected
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
get_requires_follow_up
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
UserRatingsRequest
Bases: BaseRatingsAPIRequest, APIKeyAllowedInRequestMixin, ImageRatingsFilterableRequestBase
Represents the data needed to make a request to the /v1/user/ratings/ endpoint.
Source code in horde_sdk/ratings_api/apimodels.py
format
instance-attribute
The format to request the response payload in, typically json.
rating
instance-attribute
The target rating, which will be compared by rating_comparison.
rating_comparison
instance-attribute
The way the rating will be compared. See ImageRatingsComparisonTypes.
artifacts
class-attribute
instance-attribute
The target artifact rating, which will be compared by artifacts_comparison.
artifacts_comparison
class-attribute
instance-attribute
The way the artifacts will be compared. See ImageRatingsComparisonTypes.
model_config
class-attribute
instance-attribute
apikey
class-attribute
instance-attribute
Defaults to ANON_API_KEY. See also .is_api_key_required()
accept
class-attribute
instance-attribute
The 'accept' header field.
client_agent
class-attribute
instance-attribute
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_http_method
classmethod
get_api_endpoint_subpath
classmethod
get_default_success_response_type
classmethod
get_sensitive_fields
classmethod
get_extra_fields_to_exclude_from_log
Return an additional set of fields to exclude from the log_safe_model_dump method.
log_safe_model_dump
Return a dict of the model's fields, with any sensitive fields redacted.
Source code in horde_sdk/generic_api/apimodels.py
is_api_key_required
classmethod
validate_api_key_length
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
get_api_endpoint_url
classmethod
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
get_api_url
classmethod
get_success_status_response_pairs
classmethod
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
get_header_fields
classmethod
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
get_query_fields
classmethod
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
get_number_of_results_expected
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
get_requires_follow_up
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.