Skip to content
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

Feature: add graphql pagination support #121

Merged
merged 5 commits into from
Jul 28, 2024
Merged

Feature: add graphql pagination support #121

merged 5 commits into from
Jul 28, 2024

Conversation

yanyongyu
Copy link
Owner

@yanyongyu yanyongyu commented Jul 28, 2024

resolve #112

Example usage

from githubkit import GitHub

g = GitHub("your token here")

query = """
query($owner:String!, $repo: String!, $cursor: String) {
  repository(owner:$owner, name:$repo) {
    issues(first: 10, after: $cursor) {
      nodes {
        number
      }
      pageInfo {
        hasNextPage
        endCursor
      }
    }
  }
}
"""

for result in g.graphql.paginate(query, {"owner": "owner", "repo": "repo"}):
    for issue in result["repository"]["issues"]["nodes"]:
        print(issue)

@yanyongyu yanyongyu added the enhancement New feature or request label Jul 28, 2024
Copy link

codecov bot commented Jul 28, 2024

Codecov Report

Attention: Patch coverage is 91.81818% with 9 lines in your changes missing coverage. Please review.

Project coverage is 17.64%. Comparing base (a90820a) to head (0e080c6).

Files Patch % Lines
githubkit/graphql/__init__.py 89.18% 4 Missing ⚠️
githubkit/graphql/paginator.py 93.44% 4 Missing ⚠️
githubkit/exception.py 85.71% 1 Missing ⚠️
Additional details and impacted files
@@            Coverage Diff             @@
##           master     #121      +/-   ##
==========================================
+ Coverage   17.61%   17.64%   +0.03%     
==========================================
  Files        4791     4792       +1     
  Lines      222451   222542      +91     
==========================================
+ Hits        39191    39276      +85     
- Misses     183260   183266       +6     
Flag Coverage Δ
unittests 17.64% <91.81%> (+0.03%) ⬆️

Flags with carried forward coverage won't be shown. Click here to find out more.

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

@yanyongyu yanyongyu marked this pull request as ready for review July 28, 2024 06:12
@yanyongyu yanyongyu merged commit 855eb17 into master Jul 28, 2024
36 checks passed
@yanyongyu yanyongyu deleted the feat/graphql branch July 28, 2024 06:53
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request GraphQL
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Feature: GraphQL Pagination
1 participant