Skip to content

v0.10.0

Choose a tag to compare

@rafalkrupinski rafalkrupinski released this 02 Jun 22:28
· 123 commits to develop since this release

From now on you can use ResponseEnvelope type to wrap response body and any headers you want to receive from the server.

class CatListResponse(ResponseEnvelope):
    body: typing.Annotated[typing.List[Cat], ResponseBody]
    count: typing.Annotated[int, Header('X-Count')]


class CatClient(ClientBase):
    @get('/cats')
    async def cat_list(
        self: typing.Self,
    ) -> typing.Annotated[
        CatListResponse,
        Responses({
            'default': {'application/json': CatListResponse},
        }),
    ]:
        pass