Skip to content

Commit 3c998be

Browse files
committed
1.11.0
1 parent 41ac809 commit 3c998be

File tree

15 files changed

+60
-44
lines changed

15 files changed

+60
-44
lines changed

CHANGELOG.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
# Change log
22

3-
## UNRELEASED 1.11.0
3+
## 1.11.0
44

55
### GraphQLClient support
66

README.md

Lines changed: 23 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -63,26 +63,34 @@ def create_book(data: CreateBookRequest, result: CreateBookResponse) -> CreateBo
6363
return result
6464
```
6565

66-
## Streaming responses
66+
## GraphQL support
6767

6868
```python
69-
from typing import AsyncIterator
70-
71-
from clientele import api
7269
from pydantic import BaseModel
70+
from clientele.graphql import GraphQLClient
7371

72+
client = GraphQLClient(base_url="https://api.github.com/graphql")
7473

75-
client = api.APIClient(base_url="https://httpbin.org")
76-
77-
78-
class Event(BaseModel):
79-
id: int
80-
url: str
81-
82-
83-
@client.get("/stream/{n}", streaming_response=True)
84-
async def stream_events(n: int, result: AsyncIterator[Event]) -> AsyncIterator[Event]:
85-
return result
74+
class Repository(BaseModel):
75+
name: str
76+
stargazerCount: int
77+
78+
class RepositoryQueryData(BaseModel):
79+
repository: Repository
80+
81+
class RepositoryQueryResponse(BaseModel):
82+
data: RepositoryQueryData
83+
84+
@client.query("""
85+
query($owner: String!, $name: String!) {
86+
repository(owner: $owner, name: $name) {
87+
name
88+
stargazerCount
89+
}
90+
}
91+
""")
92+
def get_repo(owner: str, name: str, result: RepositoryQueryResponse) -> Repository:
93+
return result.data.repository
8694
```
8795

8896
## Works with Python API frameworks

SECURITY.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -4,8 +4,8 @@
44

55
| Version | Supported |
66
| --------------| ------------------ |
7-
| 1.10.0 | :white_check_mark: |
8-
| 1.9.2 or less | :x: |
7+
| 1.11.0 | :white_check_mark: |
8+
| 1.10.0 or less | :x: |
99

1010
## Reporting a Vulnerability
1111

clientele/settings.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
import platform
22

3-
VERSION = "1.10.0"
3+
VERSION = "1.11.0"
44

55

66
def split_ver():

docs/CHANGELOG.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
# Change log
22

3-
## UNRELEASED 1.11.0
3+
## 1.11.0
44

55
### GraphQLClient support
66

docs/index.md

Lines changed: 23 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -74,26 +74,34 @@ def create_book(data: CreateBookRequest, result: CreateBookResponse) -> CreateBo
7474
return result
7575
```
7676

77-
## Streaming responses
77+
## GraphQL support
7878

7979
```python
80-
from typing import AsyncIterator
81-
82-
from clientele import api
8380
from pydantic import BaseModel
81+
from clientele.graphql import GraphQLClient
8482

83+
client = GraphQLClient(base_url="https://api.github.com/graphql")
8584

86-
client = api.APIClient(base_url="https://httpbin.org")
87-
88-
89-
class Event(BaseModel):
90-
id: int
91-
url: str
92-
93-
94-
@client.get("/stream/{n}", streaming_response=True)
95-
async def stream_events(n: int, result: AsyncIterator[Event]) -> AsyncIterator[Event]:
96-
return result
85+
class Repository(BaseModel):
86+
name: str
87+
stargazerCount: int
88+
89+
class RepositoryQueryData(BaseModel):
90+
repository: Repository
91+
92+
class RepositoryQueryResponse(BaseModel):
93+
data: RepositoryQueryData
94+
95+
@client.query("""
96+
query($owner: String!, $name: String!) {
97+
repository(owner: $owner, name: $name) {
98+
name
99+
stargazerCount
100+
}
101+
}
102+
""")
103+
def get_repo(owner: str, name: str, result: RepositoryQueryResponse) -> Repository:
104+
return result.data.repository
97105
```
98106

99107
## Works with Python API frameworks

docs/install.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@ Once installed, you can run `clientele version` to make sure you have the latest
1616

1717
```sh
1818
> clientele version
19-
clientele 1.10.0
19+
clientele 1.11.0
2020
```
2121

2222
## Next steps

pyproject.toml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
[project]
22
name = "clientele"
3-
version = "1.10.0"
3+
version = "1.11.0"
44
description = "Clientele is a different way to build Python API Clients"
55
authors = [{ name = "Paul Hallett", email = "paulandrewhallett@gmail.com" }]
66
license = { text = "MIT" }

server_examples/django_ninja/client/MANIFEST.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@ uv add clientele
1616

1717
API VERSION: 1.0.0
1818
OPENAPI VERSION: 3.1.0
19-
CLIENTELE VERSION: 1.10.0
19+
CLIENTELE VERSION: 1.11.0
2020

2121
Regenerate using this command:
2222

server_examples/django_rest_framework/client/MANIFEST.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@ uv add clientele
1616

1717
API VERSION: 1.0.0
1818
OPENAPI VERSION: 3.0.3
19-
CLIENTELE VERSION: 1.10.0
19+
CLIENTELE VERSION: 1.11.0
2020

2121
Regenerate using this command:
2222

0 commit comments

Comments
 (0)