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

Increase items limit for autoupdater #2335

Closed
wants to merge 2 commits into from
Closed
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
14 changes: 7 additions & 7 deletions tools/autoupdate_app_sources/rest_api.py
Original file line number Diff line number Diff line change
Expand Up @@ -6,12 +6,12 @@

import requests

ITEMS_LIMIT=100

class RefType(Enum):
tags = 1
commits = 2


class GithubAPI:
def __init__(self, upstream: str, auth: Optional[tuple[str, str]] = None):
self.upstream = upstream
Expand All @@ -29,15 +29,15 @@ def internal_api(self, uri: str) -> Any:

def tags(self) -> list[dict[str, str]]:
"""Get a list of tags for project."""
return self.internal_api(f"repos/{self.upstream_repo}/tags")
return self.internal_api(f"repos/{self.upstream_repo}/tags?per_page={ITEMS_LIMIT}"

def commits(self) -> list[dict[str, Any]]:
"""Get a list of commits for project."""
return self.internal_api(f"repos/{self.upstream_repo}/commits")

def releases(self) -> list[dict[str, Any]]:
"""Get a list of releases for project."""
return self.internal_api(f"repos/{self.upstream_repo}/releases?per_page=100")
return self.internal_api(f"repos/{self.upstream_repo}/releases?per_page={ITEMS_LIMIT}"

def url_for_ref(self, ref: str, ref_type: RefType) -> str:
"""Get a URL for a ref."""
Expand Down Expand Up @@ -92,7 +92,7 @@ def internal_api(self, uri: str) -> Any:

def tags(self) -> list[dict[str, str]]:
"""Get a list of tags for project."""
return self.internal_api(f"projects/{self.project_id}/repository/tags")
return self.internal_api(f"projects/{self.project_id}/repository/tags?per_page={ITEMS_LIMIT}"

def commits(self) -> list[dict[str, Any]]:
"""Get a list of commits for project."""
Expand All @@ -108,7 +108,7 @@ def commits(self) -> list[dict[str, Any]]:

def releases(self) -> list[dict[str, Any]]:
"""Get a list of releases for project."""
releases = self.internal_api(f"projects/{self.project_id}/releases")
releases = self.internal_api(f"projects/{self.project_id}/releases?per_page={ITEMS_LIMIT}"
retval = []
for release in releases:
r = {
Expand Down Expand Up @@ -163,15 +163,15 @@ def internal_api(self, uri: str):

def tags(self) -> list[dict[str, Any]]:
"""Get a list of tags for project."""
return self.internal_api(f"repos/{self.project_path}/tags")
return self.internal_api(f"repos/{self.project_path}/tags?limit={ITEMS_LIMIT}"

def commits(self) -> list[dict[str, Any]]:
"""Get a list of commits for project."""
return self.internal_api(f"repos/{self.project_path}/commits")

def releases(self) -> list[dict[str, Any]]:
"""Get a list of releases for project."""
return self.internal_api(f"repos/{self.project_path}/releases")
return self.internal_api(f"repos/{self.project_path}/releases?limit={ITEMS_LIMIT}"

def url_for_ref(self, ref: str, ref_type: RefType) -> str:
"""Get a URL for a ref."""
Expand Down
Loading