roboto.http.response#
Module Contents#
- class roboto.http.response.BatchResponse(/, **data)#
Bases:
pydantic.BaseModel
,Generic
[Model
]The response to a batch request. The responses element contains one response (either success data or failure error) per request element, in the order in which the request was sent.
- Parameters:
data (Any)
- responses: list[BatchResponseElement[Model]]#
- class roboto.http.response.BatchResponseElement(/, **data)#
Bases:
pydantic.BaseModel
,Generic
[Model
]One element of a response to a batch request. This should only ever have data set (in case of a successful operation) or error set (in case of a failed operation). For operations that do not return a response, an empty (data = None, error = None) Batch Response Element will be effectively equivalent to a single requests 204 No Content
- Parameters:
data (Any)
- data: Model | None = None#
- error: roboto.exceptions.RobotoDomainException | None = None#
- serialize_error(value, info)#
- Parameters:
value (Optional[roboto.exceptions.RobotoDomainException])
info (pydantic.SerializationInfo)
- Return type:
Optional[dict[str, Any]]
- validate_error(value)#
- Parameters:
value (str)
- Return type:
Optional[roboto.exceptions.RobotoDomainException]
- class roboto.http.response.HttpResponse(response)#
- Parameters:
response (urllib.response.addinfourl)
- property headers: dict[str, str] | None#
- Return type:
Optional[dict[str, str]]
- property readable_response: urllib.response.addinfourl#
- Return type:
urllib.response.addinfourl
- property status: http.HTTPStatus#
- Return type:
http.HTTPStatus
- to_dict(json_path=None)#
- Parameters:
json_path (Optional[list[str]])
- Return type:
Any
- to_int()#
- Return type:
int
- to_paginated_list(record_type)#
- Parameters:
record_type (Type[PydanticModel])
- Return type:
PaginatedList[PydanticModel]
- to_record(record_type)#
- Parameters:
record_type (Type[PydanticModel])
- Return type:
PydanticModel
- to_record_list(record_type)#
- Parameters:
record_type (Type[PydanticModel])
- Return type:
collections.abc.Sequence[PydanticModel]
- to_string()#
- to_string_list()#
- Return type:
list[str]
- roboto.http.response.Model#
- class roboto.http.response.PaginatedList(/, **data)#
Bases:
pydantic.BaseModel
,Generic
[Model
]A list of records pulled from a paginated result set. It may be a subset of that result set, in which case next_token will be set and can be used to fetch the next page.
- Parameters:
data (Any)
- items: list[Model]#
- next_token: str | None = None#
- class roboto.http.response.PaginationToken(scheme, encoding, data)#
A pagination token that can be treated as a truly opaque token by clients, with support for evolving the token format over time.
- Parameters:
scheme (PaginationTokenScheme)
encoding (PaginationTokenEncoding)
data (Any)
- property data: Any#
- Return type:
Any
- static decode(data)#
Base64 decode the data, adding back any trailing padding (“=”) as necessary to make data properly Base64.
- Parameters:
data (str)
- Return type:
str
- static empty()#
- Return type:
- static encode(data)#
Base64 encode the data and strip all trailing padding (“=”).
- Parameters:
data (str)
- Return type:
str
- classmethod from_token(token)#
- Parameters:
token (Optional[str])
- Return type:
- classmethod json_token(data)#
- Parameters:
data (Any)
- Return type:
- to_token()#
- Return type:
str
- class roboto.http.response.PaginationTokenEncoding#
Bases:
enum.Enum
Pagination token encoding enum
- Json = 'json'#
- Raw = 'raw'#
- class roboto.http.response.PaginationTokenScheme#
Bases:
enum.Enum
Pagination token scheme enum
- V1 = 'v1'#
- roboto.http.response.PydanticModel#
- class roboto.http.response.StreamedList(/, **data)#
Bases:
pydantic.BaseModel
,Generic
[Model
]A StreamedList differs from a PaginatedList in that it represents a stream of data that is in process of being written to. Unlike a result set, which is finite and complete, a stream may be infinite, and it is unknown when or if it will complete.
- Parameters:
data (Any)
- has_next: bool#
- items: list[Model]#
- last_read: str | None#
- roboto.http.response.logger#