Skip to content

Docs: update type hints in examples #120

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
Jul 22, 2024
Merged
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
9 changes: 4 additions & 5 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -87,13 +87,13 @@ Here is some common use cases to help you get started quickly. For more detailed

```python
from githubkit import GitHub
from githubkit.versions.latest.models import User
from githubkit.versions.latest.models import PublicUser, PrivateUser

github = GitHub("<your_token_here>")

# call GitHub rest api
resp = github.rest.users.get_authenticated()
user: User = resp.parsed_data
user: PublicUser | PrivateUser = resp.parsed_data

# call GitHub graphql api
data: dict = github.graphql("{ viewer { login } }")
Expand All @@ -102,7 +102,7 @@ data: dict = github.graphql("{ viewer { login } }")
### Develop a OAuth APP with web flow

```python
from githubkit.versions.latest.models import User
from githubkit.versions.latest.models import PublicUser, PrivateUser
from githubkit import GitHub, OAuthAppAuthStrategy, OAuthTokenAuthStrategy

github = GitHub(OAuthAppAuthStrategy("<client_id>", "<client_secret>"))
Expand All @@ -125,13 +125,12 @@ user_github = github.with_auth(

# now you can act as the user
resp = user_github.rest.users.get_authenticated()
user: User = resp.parsed_data
user: PublicUser | PrivateUser = resp.parsed_data
```

### Develop a OAuth APP with device flow

```python
from githubkit.versions.latest.models import User
from githubkit import GitHub, OAuthDeviceAuthStrategy, OAuthTokenAuthStrategy

# sync/async func for displaying user code to user
Expand Down