Skip to content

Commit

Permalink
rename method
Browse files Browse the repository at this point in the history
  • Loading branch information
FZambia committed Feb 17, 2024
1 parent d798012 commit f3b5df1
Show file tree
Hide file tree
Showing 3 changed files with 8 additions and 8 deletions.
2 changes: 1 addition & 1 deletion cent/client/async_client.py
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,7 @@ async def send(
payload,
timeout=timeout,
)
response = request.get_result(content)
response = request.parse_response(content)
return cast(CentResultType, response.result)

async def close(self) -> None:
Expand Down
2 changes: 1 addition & 1 deletion cent/client/sync_client.py
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,7 @@ def send(
request.to_json(),
timeout=timeout,
)
response = request.get_result(content)
response = request.parse_response(content)
return cast(CentResultType, response.result)

def close(self) -> None:
Expand Down
12 changes: 6 additions & 6 deletions cent/dto.py
Original file line number Diff line number Diff line change
Expand Up @@ -6,11 +6,6 @@
from cent.exceptions import CentDecodeError, CentApiResponseError


class Error(BaseModel):
code: int
message: str


class CentResult(BaseModel, ABC):
model_config = ConfigDict(
use_enum_values=True,
Expand All @@ -26,6 +21,11 @@ class CentResult(BaseModel, ABC):
CentResultType = TypeVar("CentResultType", bound=CentResult)


class Error(BaseModel):
code: int
message: str


class Response(BaseModel, Generic[CentResultType]):
error: Optional[Error] = None
result: Optional[CentResultType] = None
Expand Down Expand Up @@ -59,7 +59,7 @@ def to_json(self) -> Any:
def get_method(self) -> str:
return self.__api_method__

def get_result(
def parse_response(
self,
content: str,
) -> Response[CentResult]:
Expand Down

0 comments on commit f3b5df1

Please sign in to comment.