Elffuss BraidHub

kikocis/continue public

3a1e5cc69df2 · 652 BRawPermalink
1"""API response object."""
2
3from __future__ import annotations
4from typing import Optional, Generic, Mapping, TypeVar
5from pydantic import Field, StrictInt, StrictBytes, BaseModel
6
7T = TypeVar("T")
8
9class ApiResponse(BaseModel, Generic[T]):
10 """
11 API response object
12 """
13
14 status_code: StrictInt = Field(description="HTTP status code")
15 headers: Optional[Mapping[str, str]] = Field(None, description="HTTP headers")
16 data: T = Field(description="Deserialized data given the data type")
17 raw_data: StrictBytes = Field(description="Raw data (HTTP response body)")
18
19 model_config = {
20 "arbitrary_types_allowed": True
21 }