mirror of
https://github.com/status-im/PyGithub.git
synced 2026-08-31 19:01:15 +00:00
Add is_alphanumeric attribute to Autolink and Repository.create_autolink (#2630)
This commit is contained in:
@@ -978,18 +978,25 @@ class Repository(github.GithubObject.CompletableGithubObject):
|
||||
headers, data = self._requester.requestJsonAndCheck("GET", f"{self.url}/compare/{base}...{head}")
|
||||
return github.Comparison.Comparison(self._requester, headers, data, completed=True)
|
||||
|
||||
def create_autolink(self, key_prefix, url_template):
|
||||
def create_autolink(self, key_prefix, url_template, is_alphanumeric=github.GithubObject.NotSet):
|
||||
"""
|
||||
:calls: `POST /repos/{owner}/{repo}/autolinks <http://docs.github.com/en/rest/reference/repos>`_
|
||||
:param key_prefix: string
|
||||
:param url_template: string
|
||||
:param is_alphanumeric: bool
|
||||
:rtype: :class:`github.Autolink.Autolink`
|
||||
"""
|
||||
assert isinstance(key_prefix, str), key_prefix
|
||||
assert isinstance(url_template, str), url_template
|
||||
assert is_alphanumeric is github.GithubObject.NotSet or isinstance(is_alphanumeric, bool), is_alphanumeric
|
||||
|
||||
post_parameters = {"key_prefix": key_prefix, "url_template": url_template}
|
||||
|
||||
if is_alphanumeric is not github.GithubObject.NotSet:
|
||||
post_parameters["is_alphanumeric"] = is_alphanumeric
|
||||
|
||||
headers, data = self._requester.requestJsonAndCheck("POST", f"{self.url}/autolinks", input=post_parameters)
|
||||
|
||||
return github.Autolink.Autolink(self._requester, headers, data, completed=True)
|
||||
|
||||
def create_git_blob(self, content, encoding):
|
||||
|
||||
Reference in New Issue
Block a user