Skip to content

Docs: update response types for json type inspect #180

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
Jan 10, 2025
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion docs/usage/authentication.md
Original file line number Diff line number Diff line change
Expand Up @@ -187,7 +187,7 @@ from githubkit import GitHub, OAuthDeviceAuthStrategy
# the data dict is the generation response from the github server.
# see the link above for more fields in the response.
def callback(data: dict):
print(data["user_code"])
print(data["user_code"])

github = GitHub(
OAuthDeviceAuthStrategy(
Expand Down
6 changes: 4 additions & 2 deletions docs/usage/rest-api.md
Original file line number Diff line number Diff line change
Expand Up @@ -212,9 +212,11 @@ As shown above, the response data is parsed and validated by accessing the `resp
```python hl_lines="5"
from typing import Any
from githubkit import Response
from githubkit.versions.latest.models import FullRepository
from githubkit.versions.latest.types import FullRepositoryType

resp: Response[FullRepository] = github.rest.repos.get("owner", "repo")
repo: dict[str, Any] = resp.json()
resp: Response[FullRepository, FullRepositoryType] = github.rest.repos.get("owner", "repo")
repo: FullRepositoryType = resp.json()
```

=== "Pydantic v1"
Expand Down
4 changes: 2 additions & 2 deletions docs/usage/unit-test.md
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@ If you are using githubkit in your business logic, you may want to mock the gith
**kwargs: Any, # (2)!
) -> Response[Any]:
if method == "GET" and url == "/repos/owner/repo": # (3)!
return Response[T](
return Response(
httpx.Response(status_code=200, json=FAKE_RESPONSE),
Any if response_model is UNSET else response_model,
)
Expand Down Expand Up @@ -86,7 +86,7 @@ If you are using githubkit in your business logic, you may want to mock the gith
**kwargs: Any, # (2)!
) -> Response[Any]:
if method == "GET" and url == "/repos/owner/repo": # (3)!
return Response[T](
return Response(
httpx.Response(status_code=200, json=FAKE_RESPONSE),
Any if response_model is UNSET else response_model,
)
Expand Down
Loading