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

Add: packages API from github #1004

Draft
wants to merge 6 commits into
base: main
Choose a base branch
from
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
2 changes: 2 additions & 0 deletions pontos/github/api/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@
)
from .labels import GitHubAsyncRESTLabels
from .organizations import GitHubAsyncRESTOrganizations
from .packages import GitHubAsyncRESTPackages
from .pull_requests import GitHubAsyncRESTPullRequests
from .release import GitHubAsyncRESTReleases
from .repositories import GitHubAsyncRESTRepositories
Expand All @@ -39,6 +40,7 @@
"GitHubAsyncRESTDependabot",
"GitHubAsyncRESTLabels",
"GitHubAsyncRESTOrganizations",
"GitHubAsyncRESTPackages",
"GitHubAsyncRESTPullRequests",
"GitHubAsyncRESTReleases",
"GitHubAsyncRESTRepositories",
Expand Down
8 changes: 8 additions & 0 deletions pontos/github/api/api.py
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,7 @@
)
from pontos.github.api.labels import GitHubAsyncRESTLabels
from pontos.github.api.organizations import GitHubAsyncRESTOrganizations
from pontos.github.api.packages import GitHubAsyncRESTPackages
from pontos.github.api.pull_requests import GitHubAsyncRESTPullRequests
from pontos.github.api.release import GitHubAsyncRESTReleases
from pontos.github.api.repositories import GitHubAsyncRESTRepositories
Expand Down Expand Up @@ -120,6 +121,13 @@
"""
return GitHubAsyncRESTLabels(self._client)

@property
def packages(self) -> GitHubAsyncRESTPackages:
"""
Packages related API
"""
return GitHubAsyncRESTPackages(self._client)

Check warning on line 129 in pontos/github/api/api.py

View check run for this annotation

Codecov / codecov/patch

pontos/github/api/api.py#L129

Added line #L129 was not covered by tests

@property
@deprecated(
since="23.3.4",
Expand Down
54 changes: 54 additions & 0 deletions pontos/github/api/foo.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,54 @@
{
'id': 4917607,
'name': 'asset-management-backend',
'package_type': 'container',
'owner': {
'login': 'greenbone',
'id': 31986857,
'node_id': 'MDEyOk9yZ2FuaXphdGlvbjMxOTg2ODU3',
'avatar_url': 'https: //avatars.githubusercontent.com/u/31986857?v=4',
'gravatar_id': '',
'url': 'https://api.github.com/users/greenbone',
'html_url': 'https://github.com/greenbone',
'followers_url': 'https://api.github.com/users/greenbone/followers',
'following_url': 'https://api.github.com/users/greenbone/following{/other_user}',
'gists_url': 'https://api.github.com/users/greenbone/gists{/gist_id}',
'starred_url': 'https://api.github.com/users/greenbone/starred{/owner}{/repo}',
'subscriptions_url': 'https://api.github.com/users/greenbone/subscriptions', 'organizations_url': 'https://api.github.com/users/greenbone/orgs', 'repos_url': 'https://api.github.com/users/greenbone/repos', 'events_url': 'https://api.github.com/users/greenbone/events{/privacy}', 'received_events_url': 'https://api.github.com/users/greenbone/received_events', 'type': 'Organization', 'site_admin': False
},
'version_count': 7686,
'visibility': 'public',
'url': 'https://api.github.com/orgs/greenbone/packages/container/asset-management-backend',
'created_at': '2023-03-16T14:39:23Z',
'updated_at': '2024-05-06T07:46:34Z',
'repository': {
'id': 498688333,
'node_id': 'R_kgDOHblhTQ',
'name': 'asset-management-backend',
'full_name': 'greenbone/asset-management-backend',
'private': True,
'owner': {'login': 'greenbone', 'id': 31986857, 'node_id': 'MDEyOk9yZ2FuaXphdGlvbjMxOTg2ODU3', 'avatar_url': 'https://avatars.githubusercontent.com/u/31986857?v=4', 'gravatar_id': '', 'url': 'https://api.github.com/users/greenbone', 'html_url': 'https://github.com/greenbone', 'followers_url': 'https://api.github.com/users/greenbone/followers', 'following_url': 'https://api.github.com/users/greenbone/following{/other_user}', 'gists_url': 'https://api.github.com/users/greenbone/gists{/gist_id}', 'starred_url': 'https://api.github.com/users/greenbone/starred{/owner}{/repo}', 'subscriptions_url': 'https://api.github.com/users/greenbone/subscriptions', 'organizations_url': 'https://api.github.com/users/greenbone/orgs', 'repos_url': 'https://api.github.com/users/greenbone/repos', 'events_url': 'https://api.github.com/users/greenbone/events{/privacy}', 'received_events_url': 'https://api.github.com/users/greenbone/received_events', 'type': 'Organization', 'site_admin': False
},
'html_url': 'https://github.com/greenbone/asset-management-backend',
'description': 'Backend for the asset-management-frontend that provides REST endpoints with the main functionality of the Opensight Asset product.',
'fork': False,
'url': 'https://api.github.com/repos/greenbone/asset-management-backend',
'forks_url': 'https://api.github.com/repos/greenbone/asset-management-backend/forks',
'keys_url': 'https://api.github.com/repos/greenbone/asset-management-backend/keys{/key_id}',
'collaborators_url': 'https://api.github.com/repos/greenbone/asset-management-backend/collaborators{/collaborator}',
'teams_url': 'https://api.github.com/repos/greenbone/asset-management-backend/teams',
'hooks_url': 'https://api.github.com/repos/greenbone/asset-management-backend/hooks',
'issue_events_url': 'https://api.github.com/repos/greenbone/asset-management-backend/issues/events{/number}',
'events_url': 'https://api.github.com/repos/greenbone/asset-management-backend/events',
'assignees_url': 'https://api.github.com/repos/greenbone/asset-management-backend/assignees{/user}',
'branches_url': 'https://api.github.com/repos/greenbone/asset-management-backend/branches{/branch}',
'tags_url': 'https://api.github.com/repos/greenbone/asset-management-backend/tags', 'blobs_url': 'https://api.github.com/repos/greenbone/asset-management-backend/git/blobs{/sha}', 'git_tags_url': 'https://api.github.com/repos/greenbone/asset-management-backend/git/tags{/sha}', 'git_refs_url': 'https://api.github.com/repos/greenbone/asset-management-backend/git/refs{/sha}', 'trees_url': 'https://api.github.com/repos/greenbone/asset-management-backend/git/trees{/sha}', 'statuses_url': 'https://api.github.com/repos/greenbone/asset-management-backend/statuses/{sha}', 'languages_url': 'https://api.github.com/repos/greenbone/asset-management-backend/languages', 'stargazers_url': 'https://api.github.com/repos/greenbone/asset-management-backend/stargazers', 'contributors_url': 'https://api.github.com/repos/greenbone/asset-management-backend/contributors',
'subscribers_url': 'https://api.github.com/repos/greenbone/asset-management-backend/subscribers', 'subscription_url': 'https://api.github.com/repos/greenbone/asset-management-backend/subscription', 'commits_url': 'https://api.github.com/repos/greenbone/asset-management-backend/commits{/sha}',
'git_commits_url': 'https://api.github.com/repos/greenbone/asset-management-backend/git/commits{/sha}', 'comments_url': 'https://api.github.com/repos/greenbone/asset-management-backend/comments{/number}', 'issue_comment_url': 'https://api.github.com/repos/greenbone/asset-management-backend/issues/comments{/number}',
'contents_url': 'https://api.github.com/repos/greenbone/asset-management-backend/contents/{+path}', 'compare_url': 'https://api.github.com/repos/greenbone/asset-management-backend/compare/{base}...{head}', 'merges_url': 'https://api.github.com/repos/greenbone/asset-management-backend/merges', 'archive_url': 'https://api.github.com/repos/greenbone/asset-management-backend/{archive_format}{/ref}',
'downloads_url': 'https://api.github.com/repos/greenbone/asset-management-backend/downloads', 'issues_url': 'https://api.github.com/repos/greenbone/asset-management-backend/issues{/number}', 'pulls_url': 'https://api.github.com/repos/greenbone/asset-management-backend/pulls{/number}', 'milestones_url': 'https://api.github.com/repos/greenbone/asset-management-backend/milestones{/number}',
'notifications_url': 'https://api.github.com/repos/greenbone/asset-management-backend/notifications{?since,all,participating}', 'labels_url': 'https://api.github.com/repos/greenbone/asset-management-backend/labels{/name}', 'releases_url': 'https://api.github.com/repos/greenbone/asset-management-backend/releases{/id}',
'deployments_url': 'https://api.github.com/repos/greenbone/asset-management-backend/deployments'
},
'html_url': 'https://github.com/orgs/greenbone/packages/container/package/asset-management-backend'
}