Skip to content

Dev hjl #767

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

Open
wants to merge 5 commits into
base: integration_1
Choose a base branch
from
Open
Show file tree
Hide file tree
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
2 changes: 2 additions & 0 deletions api/apps/apps.py
Original file line number Diff line number Diff line change
@@ -1,11 +1,13 @@
from core.rest_client import RestClient
from api.apps.installactions import Installation
from api.apps.permission import Permission


class Apps(RestClient):
def __init__(self, api_root_url, **kwargs):
super(Apps, self).__init__(api_root_url, **kwargs)
self.installaction = Installation(self.api_root_url, **kwargs)
self.permission = Permission(self.api_root_url, **kwargs)

def create_gitHub_app_from_a_manifest(self, code, **kwargs):
"""
Expand Down
41 changes: 41 additions & 0 deletions api/apps/permission.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,41 @@
from core.rest_client import RestClient


class Permission(RestClient):
def list_ssh_for_current_user(self, **kwargs):
"""
https://docs.github.com/en/rest/users/keys#list-public-ssh-keys-for-the-authenticated-user
:param kwargs:
:return:
"""
headers = {'Accept': 'application/vnd.github+json'}
return self.get("/user/keys", headers=headers, **kwargs)

def create_ssh_for_current_user(self, **kwargs):
"""
https://docs.github.com/en/rest/users/keys#create-a-public-ssh-key-for-the-authenticated-user
:param kwargs:
:return:
"""
headers = {'Accept': 'application/vnd.github+json'}
return self.post("/user/keys", headers=headers, **kwargs)

def get_a_ssh_for_current_user(self, key_id, **kwargs):
"""
https://docs.github.com/en/rest/users/keys#get-a-public-ssh-key-for-the-authenticated-user
:param key_id: SSH key id
:param kwargs:
:return:
"""
headers = {'Accept': 'application/vnd.github+json'}
return self.get("/user/keys/{}".format(key_id), headers=headers, **kwargs)

def delete_a_ssh_for_current_user(self, key_id, **kwargs):
"""
https://docs.github.com/en/rest/users/keys#delete-a-public-ssh-key-for-the-authenticated-user
:param key_id: SSH key id
:param kwargs:
:return:
"""
headers = {'Accept': 'application/vnd.github+json'}
return self.delete("/user/keys/{}".format(key_id), headers=headers, **kwargs)
3 changes: 2 additions & 1 deletion api/interactions/orgs.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,8 @@


class Orgs(RestClient):
def __init__(self):
def __init__(self, api_root_url, **kwargs):
super(Orgs, self).__init__(api_root_url, **kwargs)
self.headers = {'Accept': 'application/vnd.github.sombra-preview'}

def get_interactions_limits_for_org(self, org, **kwargs):
Expand Down
3 changes: 2 additions & 1 deletion api/interactions/repos.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,8 @@


class Repos(RestClient):
def __init__(self):
def __init__(self, api_root_url, **kwargs):
super(Repos, self).__init__(api_root_url, **kwargs)
self.headers = {'Accept': 'application/vnd.github.sombra-preview'}

def get_interaction_restrictions_for_repo(self, owner, **kwargs):
Expand Down