Module aiolirest.api_response
API response object.
Expand source code
"""API response object."""
from __future__ import annotations
from typing import Any, Dict, Optional, Generic, TypeVar
from pydantic import Field, StrictInt, StrictStr, StrictBytes, BaseModel
T = TypeVar("T")
class ApiResponse(BaseModel, Generic[T]):
"""
API response object
"""
status_code: StrictInt = Field(description="HTTP status code")
headers: Optional[Dict[StrictStr, StrictStr]] = Field(None, description="HTTP headers")
data: T = Field(description="Deserialized data given the data type")
raw_data: StrictBytes = Field(description="Raw data (HTTP response body)")
model_config = {
"arbitrary_types_allowed": True
}
Classes
class ApiResponse (**data: Any)
-
API response object
Create a new model by parsing and validating input data from keyword arguments.
Raises [
ValidationError
][pydantic_core.ValidationError] if the input data cannot be validated to form a valid model.self
is explicitly positional-only to allowself
as a field name.Expand source code
class ApiResponse(BaseModel, Generic[T]): """ API response object """ status_code: StrictInt = Field(description="HTTP status code") headers: Optional[Dict[StrictStr, StrictStr]] = Field(None, description="HTTP headers") data: T = Field(description="Deserialized data given the data type") raw_data: StrictBytes = Field(description="Raw data (HTTP response body)") model_config = { "arbitrary_types_allowed": True }
Ancestors
- pydantic.main.BaseModel
- typing.Generic
Subclasses
- aiolirest.api_response.ApiResponse[AutoScalingTemplate]
- aiolirest.api_response.ApiResponse[Deployment]
- aiolirest.api_response.ApiResponse[List[AutoScalingTemplate]]
- aiolirest.api_response.ApiResponse[List[DeploymentModelVersion]]
- aiolirest.api_response.ApiResponse[List[Deployment]]
- aiolirest.api_response.ApiResponse[List[EventInfo]]
- aiolirest.api_response.ApiResponse[List[ModelResponse]]
- aiolirest.api_response.ApiResponse[List[PackagedModel]]
- aiolirest.api_response.ApiResponse[List[ResourcesTemplate]]
- aiolirest.api_response.ApiResponse[List[RoleAssignment]]
- aiolirest.api_response.ApiResponse[List[Role]]
- aiolirest.api_response.ApiResponse[List[TrainedModelRegistry]]
- aiolirest.api_response.ApiResponse[List[User]]
- aiolirest.api_response.ApiResponse[List[str]]
- aiolirest.api_response.ApiResponse[LoginResponse]
- aiolirest.api_response.ApiResponse[ModelAuthToken]
- aiolirest.api_response.ApiResponse[Observability]
- aiolirest.api_response.ApiResponse[PackagedModel]
- aiolirest.api_response.ApiResponse[ResourcesTemplate]
- aiolirest.api_response.ApiResponse[RoleAssignments]
- aiolirest.api_response.ApiResponse[SuccessResponse]
- aiolirest.api_response.ApiResponse[TrainedModelRegistry]
- aiolirest.api_response.ApiResponse[User]
- aiolirest.api_response.ApiResponse[str]
Class variables
var data : ~T
var headers : Optional[Dict[str, str]]
var model_computed_fields
var model_config
var model_fields
var raw_data : bytes
var status_code : int