Skip to content

Releases: martinn/quickapiclient

v0.5.1

23 Dec 11:18
b97775f
Compare
Choose a tag to compare

What's Changed

Full Changelog: v0.5.0...v0.5.1

v0.5.0

19 Oct 05:27
3ccd8a0
Compare
Choose a tag to compare

Introducing first class support for API client definitions

Each client definition can support multiple API endpoints and optionally share state (auth, session, etc).

Example:

from dataclasses import dataclass
import quickapi


# An example type that will be part of the API response
@dataclass
class Fact:
    fact: str
    length: int


# What the API response should look like
@dataclass
class ResponseBody:
    current_page: int
    data: list[Fact]


# We define an API endpoint
class GetFactsApi(quickapi.BaseApi[ResponseBody]):
    url = "/facts"
    response_body = ResponseBody


# And now our API client
class ExampleClient(quickapi.BaseClient):
    base_url = "https://example.com"
    get_facts = quickapi.ApiEndpoint(GetFactsApi)
    # Other endpoints would follow here:
    # submit_fact = quickapi.ApiEndpoint(SubmitFactApi)

And you can use it like this:

client = ExampleClient()
response = client.get_facts()

# `response` is fully typed and conforms to our `ResponseBody` definition
assert isinstance(response.body, ResponseBody)
assert isinstance(response.body.data[0], Fact)

# `reveal_type(response.body)` returns `Revealed type is 'ResponseBody'` too,
# which means full typing and IDE support.

What's changed

  • Improve API client definition and usage by @martinn in #17
  • Ensure we support kwargs for API client endpoints by @martinn in #20
  • Documentation improvements by @martinn in #19

Full Changelog: v0.0.15...v0.5.0

v0.0.15

27 Sep 06:19
aae27e5
Compare
Choose a tag to compare

What's Changed

New Contributors

Full Changelog: v0.0.14...v0.0.15

v0.0.14

13 Sep 08:45
4954c60
Compare
Choose a tag to compare

What's Changed

  • Add basic support for custom error handling by @martinn in #11 - now your HTTP errors can be fully typed too!

Full Changelog: v0.0.13...v0.0.14

v0.0.13

21 Jul 02:39
68238c4
Compare
Choose a tag to compare

What's Changed

  • build(deps): Bump urllib3 from 2.2.1 to 2.2.2 in the pip group across 1 directory by @dependabot in #8
  • build(deps): Bump certifi from 2024.2.2 to 2024.7.4 in the pip group across 1 directory by @dependabot in #9
  • build(deps-dev): Bump setuptools from 69.5.1 to 70.0.0 in the pip group across 1 directory by @dependabot in #10

Full Changelog: v0.0.12...v0.0.13

v0.0.12

09 Jun 23:05
91262d0
Compare
Choose a tag to compare

What's Changed

  • build(deps): Bump idna from 3.6 to 3.7 by @dependabot in #1
  • Update mkdocs documentation dependency by @martinn in #6
  • build(deps): Bump requests from 2.31.0 to 2.32.0 in the pip group across 1 directory by @dependabot in #7

Full Changelog: v0.0.11...v0.0.12

v0.0.11

11 Apr 05:25
7920d08
Compare
Choose a tag to compare
  • Internal refactors (no visible or breaking changes)
  • Documentation improvements

Full Changelog: v0.0.10...v0.0.11

v0.0.10

08 Apr 04:25
6fb3fe2
Compare
Choose a tag to compare
  • Remove hard dependency on attrs/cattrs
  • Also fixes an error when using the library with no extras selected

Full Changelog: v0.0.9...v0.0.10

v0.0.9

27 Mar 05:50
dce7359
Compare
Choose a tag to compare
  • feat: Add first class support for pydantic and dataclasses (alongside attrs)
  • docs: Improve main README (including future goals)
  • docs: Small updates to contributing guidelines
  • Refactors and behind the scene improvements

Full Changelog: v0.0.8...v0.0.9

v0.0.8

19 Mar 06:41
f8a8830
Compare
Choose a tag to compare
  • Add support for using requests library over httpx, as an optional dependency

Full Changelog: v0.0.7...v0.0.8