def update_pull_request(user: str, repository: str, pull: int): github = github_api.Github(oauth_token=newCredentials.tokens()) payload = {"title": "Update pull request from CLI", "body": "{date}".format(date=datetime.now())} new_pull_request = github.update_pull_request(username=user, repo_name=repository, pull=pull, kwargs=payload) pprint.pprint(new_pull_request.json())
def edit_repository(user: str, repository: str): github = github_api.Github(oauth_token=newCredentials.tokens()) payload = {'name': repository, 'description': 'A short description of my programmatically' ' added repository - {date}.'.format( date=datetime.now())} repo = github.update_repository(owner=user, repo=repository, kwargs=payload) pprint.pprint(repo.json())
def edit_issue(user: str, repository: str, title: str, issue: int): github = github_api.Github(oauth_token=newCredentials.tokens()) mod_title = (title + ' {stamp}').format(stamp=datetime.now()) edit_issue = github.edit_issue(username=user, repo_name=repository, issue_number=issue, title=mod_title, body="This is my edited issue.", assignee="troylmarshall", labels=["Test1", "Test2"]) pprint.pprint(edit_issue.json())
def create_pull_request(user: str, repository: str): github = github_api.Github(oauth_token=newCredentials.tokens()) payload = {"title": "A programmatic pull request", "head": "TroyLMarshall:master", "base": "master", "body": "Submitted from CLI"} new_pull_request = github.create_pull_request(username=user, repo_name=repository, kwargs=payload) pprint.pprint(new_pull_request.json())
def create_repository(name: str): github = github_api.Github(oauth_token=newCredentials.tokens()) payload = {'has_issues': True} repo = github.create_repository(name=name, kwargs=payload) pprint.pprint(repo.json())
def create_issue(user: str, repository: str, title: str): github = github_api.Github(oauth_token=newCredentials.tokens()) mod_title = (title + ' {stamp}').format(stamp=datetime.now()) new_issue = github.create_issue(username=user, repo_name=repository, title=mod_title) pprint.pprint(new_issue.json())
def repository_issues(user: str, repository: str): github = github_api.Github(oauth_token=newCredentials.tokens()) issues = github.repos_issues(username=user, repo_name=repository) pprint.pprint(issues.json())
def user_repositories(user: str): github = github_api.Github(oauth_token=newCredentials.tokens()) repos = github.user_repos(username=user) pprint.pprint(repos.json())
def get_user_info(user: str): github = github_api.Github(oauth_token=newCredentials.tokens()) user_info = github.user_info(username=user) pprint.pprint(user_info.json())
def delete_repository(user: str, repository: str): github = github_api.Github(oauth_token=newCredentials.tokens()) result = github.delete_repository(owner=user, repo=repository) pprint.pprint(result)