From a90820acfac2205caf68065acf6cdf2ef4d891c0 Mon Sep 17 00:00:00 2001 From: Ju4tCode <42488585+yanyongyu@users.noreply.github.com> Date: Mon, 22 Jul 2024 22:35:00 +0800 Subject: [PATCH] :memo: Docs: update type hints in examples (#120) --- README.md | 9 ++++----- 1 file changed, 4 insertions(+), 5 deletions(-) diff --git a/README.md b/README.md index 728b26158..dc3fc5945 100644 --- a/README.md +++ b/README.md @@ -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("") # 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 } }") @@ -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("", "")) @@ -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