def unassign(self, *users: Set[GitHubUser]): """ Removes the user from the assignees of the issue. :param users: Username of the user to be unassigned. """ url = self._url + '/assignees' delete(self._token, url, {'assignees': [user.username for user in users]}) self.data = get(self._token, self._url)
def delete_hook(self, url: str): """ Deletes all webhooks to the given URL. :param url: The URL to not fire the webhook to anymore. :raises RuntimeError: If something goes wrong (network, auth...). """ hook_url = self._url + '/hooks' hooks = get(self._token, hook_url) # Do not use self.hooks since id of the hook is needed for hook in hooks: if hook['config'].get('url', None) == url: delete(self._token, hook_url + '/' + str(hook['id']))
def delete(self, message: str, branch: Optional[str] = None): """ Deletes content :param message: The commit message for the deletion commit. :param branch: The branch to delete this content from. Defaults to `master`. """ if branch is None: branch = 'master' data = { 'path': self._url, 'message': message, 'sha': self.data['sha'], 'branch': branch } delete(token=self._token, url=self._url, params=data)
def delete_label(self, name: str): """ Deletes a label. Take a given repository: >>> from os import environ >>> repo = GitHubRepository(GitHubToken(environ['GITHUB_TEST_TOKEN']), ... 'gitmate-test-user/test') >>> sorted(repo.get_labels()) ['a', 'b', 'c'] Let's create a label 'd': >>> repo.create_label('d', '#555555') >>> sorted(repo.get_labels()) ['a', 'b', 'c', 'd'] >>> repo.delete_label('d') >>> sorted(repo.get_labels()) ['a', 'b', 'c'] If the label doesn't exist it won't get silently dropped - no! You will get an exception. >>> repo.delete_label('d') Traceback (most recent call last): ... IGitt.ElementDoesntExistError: d doesnt exist. :param name: The caption of the label to delete. :raises ElementDoesntExistError: If the label doesn't exist. :raises RuntimeError: If something goes wrong (network, auth...). """ if name not in self.get_labels(): raise ElementDoesntExistError(name + ' doesnt exist.') delete(self._token, self._url + '/labels/' + name)
def delete(self): """ Deletes the repository """ delete(self._token, self._url)
def delete(self): """ Deletes the comment. """ delete(self._token, self._url)
def unsubscribe(self): """ Unsubscribe from this subject. """ delete(self._token, self._url + '/' + 'subscription')