Generate some repetitive doc files

This commit is contained in:
Vincent Jacques
2012-12-29 08:47:23 +01:00
parent d99b7ef577
commit abf0867543
108 changed files with 2603 additions and 2601 deletions
+279
View File
@@ -28,132 +28,216 @@ import github.Authorization
class AuthenticatedUser(github.GithubObject.GithubObject):
"""
This class represents AuthenticatedUsers as returned for example by http://developer.github.com/v3/todo
"""
@property
def avatar_url(self):
"""
:type: string
"""
self._completeIfNotSet(self._avatar_url)
return self._NoneIfNotSet(self._avatar_url)
@property
def bio(self):
"""
:type: string
"""
self._completeIfNotSet(self._bio)
return self._NoneIfNotSet(self._bio)
@property
def blog(self):
"""
:type: string
"""
self._completeIfNotSet(self._blog)
return self._NoneIfNotSet(self._blog)
@property
def collaborators(self):
"""
:type: integer
"""
self._completeIfNotSet(self._collaborators)
return self._NoneIfNotSet(self._collaborators)
@property
def company(self):
"""
:type: string
"""
self._completeIfNotSet(self._company)
return self._NoneIfNotSet(self._company)
@property
def created_at(self):
"""
:type: datetime.datetime
"""
self._completeIfNotSet(self._created_at)
return self._NoneIfNotSet(self._created_at)
@property
def disk_usage(self):
"""
:type: integer
"""
self._completeIfNotSet(self._disk_usage)
return self._NoneIfNotSet(self._disk_usage)
@property
def email(self):
"""
:type: string
"""
self._completeIfNotSet(self._email)
return self._NoneIfNotSet(self._email)
@property
def followers(self):
"""
:type: integer
"""
self._completeIfNotSet(self._followers)
return self._NoneIfNotSet(self._followers)
@property
def following(self):
"""
:type: integer
"""
self._completeIfNotSet(self._following)
return self._NoneIfNotSet(self._following)
@property
def gravatar_id(self):
"""
:type: string
"""
self._completeIfNotSet(self._gravatar_id)
return self._NoneIfNotSet(self._gravatar_id)
@property
def hireable(self):
"""
:type: bool
"""
self._completeIfNotSet(self._hireable)
return self._NoneIfNotSet(self._hireable)
@property
def html_url(self):
"""
:type: string
"""
self._completeIfNotSet(self._html_url)
return self._NoneIfNotSet(self._html_url)
@property
def id(self):
"""
:type: integer
"""
self._completeIfNotSet(self._id)
return self._NoneIfNotSet(self._id)
@property
def location(self):
"""
:type: string
"""
self._completeIfNotSet(self._location)
return self._NoneIfNotSet(self._location)
@property
def login(self):
"""
:type: string
"""
self._completeIfNotSet(self._login)
return self._NoneIfNotSet(self._login)
@property
def name(self):
"""
:type: string
"""
self._completeIfNotSet(self._name)
return self._NoneIfNotSet(self._name)
@property
def owned_private_repos(self):
"""
:type: integer
"""
self._completeIfNotSet(self._owned_private_repos)
return self._NoneIfNotSet(self._owned_private_repos)
@property
def plan(self):
"""
:type: :class:`github.Plan.Plan`
"""
self._completeIfNotSet(self._plan)
return self._NoneIfNotSet(self._plan)
@property
def private_gists(self):
"""
:type: integer
"""
self._completeIfNotSet(self._private_gists)
return self._NoneIfNotSet(self._private_gists)
@property
def public_gists(self):
"""
:type: integer
"""
self._completeIfNotSet(self._public_gists)
return self._NoneIfNotSet(self._public_gists)
@property
def public_repos(self):
"""
:type: integer
"""
self._completeIfNotSet(self._public_repos)
return self._NoneIfNotSet(self._public_repos)
@property
def total_private_repos(self):
"""
:type: integer
"""
self._completeIfNotSet(self._total_private_repos)
return self._NoneIfNotSet(self._total_private_repos)
@property
def type(self):
"""
:type: string
"""
self._completeIfNotSet(self._type)
return self._NoneIfNotSet(self._type)
@property
def url(self):
"""
:type: string
"""
self._completeIfNotSet(self._url)
return self._NoneIfNotSet(self._url)
def add_to_emails(self, *emails):
"""
:calls: `POST /user/emails <http://developer.github.com/v3/todo>`_
:param email: string
:rtype: None
"""
assert all(isinstance(element, (str, unicode)) for element in emails), emails
post_parameters = emails
headers, data = self._requester.requestAndCheck(
@@ -164,6 +248,11 @@ class AuthenticatedUser(github.GithubObject.GithubObject):
)
def add_to_following(self, following):
"""
:calls: `PUT /user/following/:user <http://developer.github.com/v3/todo>`_
:param following: :class:`github.NamedUser.NamedUser`
:rtype: None
"""
assert isinstance(following, github.NamedUser.NamedUser), following
headers, data = self._requester.requestAndCheck(
"PUT",
@@ -173,6 +262,11 @@ class AuthenticatedUser(github.GithubObject.GithubObject):
)
def add_to_starred(self, starred):
"""
:calls: `PUT /user/starred/:user/:repo <http://developer.github.com/v3/todo>`_
:param starred: :class:`github.Repository.Repository`
:rtype: None
"""
assert isinstance(starred, github.Repository.Repository), starred
headers, data = self._requester.requestAndCheck(
"PUT",
@@ -182,6 +276,11 @@ class AuthenticatedUser(github.GithubObject.GithubObject):
)
def add_to_subscriptions(self, subscription):
"""
:calls: `PUT /user/subscriptions/:user/:repo <http://developer.github.com/v3/todo>`_
:param subscription: :class:`github.Repository.Repository`
:rtype: None
"""
assert isinstance(subscription, github.Repository.Repository), subscription
headers, data = self._requester.requestAndCheck(
"PUT",
@@ -191,6 +290,11 @@ class AuthenticatedUser(github.GithubObject.GithubObject):
)
def add_to_watched(self, watched):
"""
:calls: `PUT /user/watched/:user/:repo <http://developer.github.com/v3/todo>`_
:param watched: :class:`github.Repository.Repository`
:rtype: None
"""
assert isinstance(watched, github.Repository.Repository), watched
headers, data = self._requester.requestAndCheck(
"PUT",
@@ -200,6 +304,15 @@ class AuthenticatedUser(github.GithubObject.GithubObject):
)
def create_authorization(self, scopes=github.GithubObject.NotSet, note=github.GithubObject.NotSet, note_url=github.GithubObject.NotSet, client_id=github.GithubObject.NotSet, client_secret=github.GithubObject.NotSet):
"""
:calls: `POST /authorizations <http://developer.github.com/v3/todo>`_
:param scopes: list of string
:param note: string
:param note_url: string
:param client_id: string
:param client_secret: string
:rtype: :class:`github.Authorization.Authorization`
"""
assert scopes is github.GithubObject.NotSet or all(isinstance(element, (str, unicode)) for element in scopes), scopes
assert note is github.GithubObject.NotSet or isinstance(note, (str, unicode)), note
assert note_url is github.GithubObject.NotSet or isinstance(note_url, (str, unicode)), note_url
@@ -225,6 +338,11 @@ class AuthenticatedUser(github.GithubObject.GithubObject):
return github.Authorization.Authorization(self._requester, data, completed=True)
def create_fork(self, repo):
"""
:calls: `POST /repos/:user/:repo/forks <http://developer.github.com/v3/todo>`_
:param repo: :class:`github.Repository.Repository`
:rtype: :class:`github.Repository.Repository`
"""
assert isinstance(repo, github.Repository.Repository), repo
headers, data = self._requester.requestAndCheck(
"POST",
@@ -235,6 +353,13 @@ class AuthenticatedUser(github.GithubObject.GithubObject):
return github.Repository.Repository(self._requester, data, completed=True)
def create_gist(self, public, files, description=github.GithubObject.NotSet):
"""
:calls: `POST /gists <http://developer.github.com/v3/todo>`_
:param public: bool
:param files: dict of string to :class:`github.InputFileContent.InputFileContent`
:param description: string
:rtype: :class:`github.Gist.Gist`
"""
assert isinstance(public, bool), public
assert all(isinstance(element, github.InputFileContent) for element in files.itervalues()), files
assert description is github.GithubObject.NotSet or isinstance(description, (str, unicode)), description
@@ -253,6 +378,12 @@ class AuthenticatedUser(github.GithubObject.GithubObject):
return github.Gist.Gist(self._requester, data, completed=True)
def create_key(self, title, key):
"""
:calls: `POST /user/keys <http://developer.github.com/v3/todo>`_
:param title: string
:param key: string
:rtype: :class:`github.UserKey.UserKey`
"""
assert isinstance(title, (str, unicode)), title
assert isinstance(key, (str, unicode)), key
post_parameters = {
@@ -268,6 +399,19 @@ class AuthenticatedUser(github.GithubObject.GithubObject):
return github.UserKey.UserKey(self._requester, data, completed=True)
def create_repo(self, name, description=github.GithubObject.NotSet, homepage=github.GithubObject.NotSet, private=github.GithubObject.NotSet, has_issues=github.GithubObject.NotSet, has_wiki=github.GithubObject.NotSet, has_downloads=github.GithubObject.NotSet, auto_init=github.GithubObject.NotSet, gitignore_template=github.GithubObject.NotSet):
"""
:calls: `POST /user/repos <http://developer.github.com/v3/todo>`_
:param name: string
:param description: string
:param homepage: string
:param private: bool
:param has_issues: bool
:param has_wiki: bool
:param has_downloads: bool
:param auto_init: bool
:param gitignore_template: string
:rtype: :class:`github.Repository.Repository`
"""
assert isinstance(name, (str, unicode)), name
assert description is github.GithubObject.NotSet or isinstance(description, (str, unicode)), description
assert homepage is github.GithubObject.NotSet or isinstance(homepage, (str, unicode)), homepage
@@ -305,6 +449,17 @@ class AuthenticatedUser(github.GithubObject.GithubObject):
return github.Repository.Repository(self._requester, data, completed=True)
def edit(self, name=github.GithubObject.NotSet, email=github.GithubObject.NotSet, blog=github.GithubObject.NotSet, company=github.GithubObject.NotSet, location=github.GithubObject.NotSet, hireable=github.GithubObject.NotSet, bio=github.GithubObject.NotSet):
"""
:calls: `PATCH /user <http://developer.github.com/v3/todo>`_
:param name: string
:param email: string
:param blog: string
:param company: string
:param location: string
:param hireable: bool
:param bio: string
:rtype: None
"""
assert name is github.GithubObject.NotSet or isinstance(name, (str, unicode)), name
assert email is github.GithubObject.NotSet or isinstance(email, (str, unicode)), email
assert blog is github.GithubObject.NotSet or isinstance(blog, (str, unicode)), blog
@@ -336,6 +491,11 @@ class AuthenticatedUser(github.GithubObject.GithubObject):
self._useAttributes(data)
def get_authorization(self, id):
"""
:calls: `GET /authorizations/:id <http://developer.github.com/v3/todo>`_
:param id: integer
:rtype: :class:`github.Authorization.Authorization`
"""
assert isinstance(id, (int, long)), id
headers, data = self._requester.requestAndCheck(
"GET",
@@ -346,6 +506,10 @@ class AuthenticatedUser(github.GithubObject.GithubObject):
return github.Authorization.Authorization(self._requester, data, completed=True)
def get_authorizations(self):
"""
:calls: `GET /authorizations <http://developer.github.com/v3/todo>`_
:rtype: :class:`github.PaginatedList.PaginatedList` of :class:`github.Authorization.Authorization`
"""
return github.PaginatedList.PaginatedList(
github.Authorization.Authorization,
self._requester,
@@ -354,6 +518,10 @@ class AuthenticatedUser(github.GithubObject.GithubObject):
)
def get_emails(self):
"""
:calls: `GET /user/emails <http://developer.github.com/v3/todo>`_
:rtype: list of string
"""
headers, data = self._requester.requestAndCheck(
"GET",
"/user/emails",
@@ -363,6 +531,10 @@ class AuthenticatedUser(github.GithubObject.GithubObject):
return data
def get_events(self):
"""
:calls: `GET /events <http://developer.github.com/v3/todo>`_
:rtype: :class:`github.PaginatedList.PaginatedList` of :class:`github.Event.Event`
"""
return github.PaginatedList.PaginatedList(
github.Event.Event,
self._requester,
@@ -371,6 +543,10 @@ class AuthenticatedUser(github.GithubObject.GithubObject):
)
def get_followers(self):
"""
:calls: `GET /user/followers <http://developer.github.com/v3/todo>`_
:rtype: :class:`github.PaginatedList.PaginatedList` of :class:`github.NamedUser.NamedUser`
"""
return github.PaginatedList.PaginatedList(
github.NamedUser.NamedUser,
self._requester,
@@ -379,6 +555,10 @@ class AuthenticatedUser(github.GithubObject.GithubObject):
)
def get_following(self):
"""
:calls: `GET /user/following <http://developer.github.com/v3/todo>`_
:rtype: :class:`github.PaginatedList.PaginatedList` of :class:`github.NamedUser.NamedUser`
"""
return github.PaginatedList.PaginatedList(
github.NamedUser.NamedUser,
self._requester,
@@ -387,6 +567,10 @@ class AuthenticatedUser(github.GithubObject.GithubObject):
)
def get_gists(self):
"""
:calls: `GET /gists <http://developer.github.com/v3/todo>`_
:rtype: :class:`github.PaginatedList.PaginatedList` of :class:`github.Gist.Gist`
"""
return github.PaginatedList.PaginatedList(
github.Gist.Gist,
self._requester,
@@ -395,6 +579,10 @@ class AuthenticatedUser(github.GithubObject.GithubObject):
)
def get_issues(self):
"""
:calls: `GET /issues <http://developer.github.com/v3/todo>`_
:rtype: :class:`github.PaginatedList.PaginatedList` of :class:`github.Issue.Issue`
"""
return github.PaginatedList.PaginatedList(
github.Issue.Issue,
self._requester,
@@ -403,6 +591,11 @@ class AuthenticatedUser(github.GithubObject.GithubObject):
)
def get_key(self, id):
"""
:calls: `GET /user/keys/:id <http://developer.github.com/v3/todo>`_
:param id: integer
:rtype: :class:`github.UserKey.UserKey`
"""
assert isinstance(id, (int, long)), id
headers, data = self._requester.requestAndCheck(
"GET",
@@ -413,6 +606,10 @@ class AuthenticatedUser(github.GithubObject.GithubObject):
return github.UserKey.UserKey(self._requester, data, completed=True)
def get_keys(self):
"""
:calls: `GET /user/keys <http://developer.github.com/v3/todo>`_
:rtype: :class:`github.PaginatedList.PaginatedList` of :class:`github.UserKey.UserKey`
"""
return github.PaginatedList.PaginatedList(
github.UserKey.UserKey,
self._requester,
@@ -421,6 +618,11 @@ class AuthenticatedUser(github.GithubObject.GithubObject):
)
def get_organization_events(self, org):
"""
:calls: `GET /users/:user/events/orgs/:org <http://developer.github.com/v3/todo>`_
:param org: :class:`github.Organization.Organization`
:rtype: :class:`github.PaginatedList.PaginatedList` of :class:`github.Event.Event`
"""
assert isinstance(org, github.Organization.Organization), org
return github.PaginatedList.PaginatedList(
github.Event.Event,
@@ -430,6 +632,10 @@ class AuthenticatedUser(github.GithubObject.GithubObject):
)
def get_orgs(self):
"""
:calls: `GET /user/orgs <http://developer.github.com/v3/todo>`_
:rtype: :class:`github.PaginatedList.PaginatedList` of :class:`github.Organization.Organization`
"""
return github.PaginatedList.PaginatedList(
github.Organization.Organization,
self._requester,
@@ -438,6 +644,11 @@ class AuthenticatedUser(github.GithubObject.GithubObject):
)
def get_repo(self, name):
"""
:calls: `GET /repos/:user/:repo <http://developer.github.com/v3/todo>`_
:param name: string
:rtype: :class:`github.Repository.Repository`
"""
assert isinstance(name, (str, unicode)), name
headers, data = self._requester.requestAndCheck(
"GET",
@@ -448,6 +659,13 @@ class AuthenticatedUser(github.GithubObject.GithubObject):
return github.Repository.Repository(self._requester, data, completed=True)
def get_repos(self, type=github.GithubObject.NotSet, sort=github.GithubObject.NotSet, direction=github.GithubObject.NotSet):
"""
:calls: `GET /user/repos <http://developer.github.com/v3/todo>`_
:param type: string
:param sort: string
:param direction: string
:rtype: :class:`github.PaginatedList.PaginatedList` of :class:`github.Repository.Repository`
"""
assert type is github.GithubObject.NotSet or isinstance(type, (str, unicode)), type
assert sort is github.GithubObject.NotSet or isinstance(sort, (str, unicode)), sort
assert direction is github.GithubObject.NotSet or isinstance(direction, (str, unicode)), direction
@@ -466,6 +684,10 @@ class AuthenticatedUser(github.GithubObject.GithubObject):
)
def get_starred(self):
"""
:calls: `GET /user/starred <http://developer.github.com/v3/todo>`_
:rtype: :class:`github.PaginatedList.PaginatedList` of :class:`github.Repository.Repository`
"""
return github.PaginatedList.PaginatedList(
github.Repository.Repository,
self._requester,
@@ -474,6 +696,10 @@ class AuthenticatedUser(github.GithubObject.GithubObject):
)
def get_starred_gists(self):
"""
:calls: `GET /gists/starred <http://developer.github.com/v3/todo>`_
:rtype: :class:`github.PaginatedList.PaginatedList` of :class:`github.Gist.Gist`
"""
return github.PaginatedList.PaginatedList(
github.Gist.Gist,
self._requester,
@@ -482,6 +708,10 @@ class AuthenticatedUser(github.GithubObject.GithubObject):
)
def get_subscriptions(self):
"""
:calls: `GET /user/subscriptions <http://developer.github.com/v3/todo>`_
:rtype: :class:`github.PaginatedList.PaginatedList` of :class:`github.Repository.Repository`
"""
return github.PaginatedList.PaginatedList(
github.Repository.Repository,
self._requester,
@@ -490,6 +720,10 @@ class AuthenticatedUser(github.GithubObject.GithubObject):
)
def get_watched(self):
"""
:calls: `GET /user/watched <http://developer.github.com/v3/todo>`_
:rtype: :class:`github.PaginatedList.PaginatedList` of :class:`github.Repository.Repository`
"""
return github.PaginatedList.PaginatedList(
github.Repository.Repository,
self._requester,
@@ -498,6 +732,11 @@ class AuthenticatedUser(github.GithubObject.GithubObject):
)
def has_in_following(self, following):
"""
:calls: `GET /user/following/:user <http://developer.github.com/v3/todo>`_
:param following: :class:`github.NamedUser.NamedUser`
:rtype: bool
"""
assert isinstance(following, github.NamedUser.NamedUser), following
status, headers, data = self._requester.requestRaw(
"GET",
@@ -508,6 +747,11 @@ class AuthenticatedUser(github.GithubObject.GithubObject):
return status == 204
def has_in_starred(self, starred):
"""
:calls: `GET /user/starred/:user/:repo <http://developer.github.com/v3/todo>`_
:param starred: :class:`github.Repository.Repository`
:rtype: bool
"""
assert isinstance(starred, github.Repository.Repository), starred
status, headers, data = self._requester.requestRaw(
"GET",
@@ -518,6 +762,11 @@ class AuthenticatedUser(github.GithubObject.GithubObject):
return status == 204
def has_in_subscriptions(self, subscription):
"""
:calls: `GET /user/subscriptions/:user/:repo <http://developer.github.com/v3/todo>`_
:param subscription: :class:`github.Repository.Repository`
:rtype: bool
"""
assert isinstance(subscription, github.Repository.Repository), subscription
status, headers, data = self._requester.requestRaw(
"GET",
@@ -528,6 +777,11 @@ class AuthenticatedUser(github.GithubObject.GithubObject):
return status == 204
def has_in_watched(self, watched):
"""
:calls: `GET /user/watched/:user/:repo <http://developer.github.com/v3/todo>`_
:param watched: :class:`github.Repository.Repository`
:rtype: bool
"""
assert isinstance(watched, github.Repository.Repository), watched
status, headers, data = self._requester.requestRaw(
"GET",
@@ -538,6 +792,11 @@ class AuthenticatedUser(github.GithubObject.GithubObject):
return status == 204
def remove_from_emails(self, *emails):
"""
:calls: `DELETE /user/emails <http://developer.github.com/v3/todo>`_
:param email: string
:rtype: None
"""
assert all(isinstance(element, (str, unicode)) for element in emails), emails
post_parameters = emails
headers, data = self._requester.requestAndCheck(
@@ -548,6 +807,11 @@ class AuthenticatedUser(github.GithubObject.GithubObject):
)
def remove_from_following(self, following):
"""
:calls: `DELETE /user/following/:user <http://developer.github.com/v3/todo>`_
:param following: :class:`github.NamedUser.NamedUser`
:rtype: None
"""
assert isinstance(following, github.NamedUser.NamedUser), following
headers, data = self._requester.requestAndCheck(
"DELETE",
@@ -557,6 +821,11 @@ class AuthenticatedUser(github.GithubObject.GithubObject):
)
def remove_from_starred(self, starred):
"""
:calls: `DELETE /user/starred/:user/:repo <http://developer.github.com/v3/todo>`_
:param starred: :class:`github.Repository.Repository`
:rtype: None
"""
assert isinstance(starred, github.Repository.Repository), starred
headers, data = self._requester.requestAndCheck(
"DELETE",
@@ -566,6 +835,11 @@ class AuthenticatedUser(github.GithubObject.GithubObject):
)
def remove_from_subscriptions(self, subscription):
"""
:calls: `DELETE /user/subscriptions/:user/:repo <http://developer.github.com/v3/todo>`_
:param subscription: :class:`github.Repository.Repository`
:rtype: None
"""
assert isinstance(subscription, github.Repository.Repository), subscription
headers, data = self._requester.requestAndCheck(
"DELETE",
@@ -575,6 +849,11 @@ class AuthenticatedUser(github.GithubObject.GithubObject):
)
def remove_from_watched(self, watched):
"""
:calls: `DELETE /user/watched/:user/:repo <http://developer.github.com/v3/todo>`_
:param watched: :class:`github.Repository.Repository`
:rtype: None
"""
assert isinstance(watched, github.Repository.Repository), watched
headers, data = self._requester.requestAndCheck(
"DELETE",
+44
View File
@@ -19,52 +19,87 @@ import github.AuthorizationApplication
class Authorization(github.GithubObject.GithubObject):
"""
This class represents Authorizations as returned for example by http://developer.github.com/v3/todo
"""
@property
def app(self):
"""
:type: :class:`github.AuthorizationApplication.AuthorizationApplication`
"""
self._completeIfNotSet(self._app)
return self._NoneIfNotSet(self._app)
@property
def created_at(self):
"""
:type: datetime.datetime
"""
self._completeIfNotSet(self._created_at)
return self._NoneIfNotSet(self._created_at)
@property
def id(self):
"""
:type: integer
"""
self._completeIfNotSet(self._id)
return self._NoneIfNotSet(self._id)
@property
def note(self):
"""
:type: string
"""
self._completeIfNotSet(self._note)
return self._NoneIfNotSet(self._note)
@property
def note_url(self):
"""
:type: string
"""
self._completeIfNotSet(self._note_url)
return self._NoneIfNotSet(self._note_url)
@property
def scopes(self):
"""
:type: list of string
"""
self._completeIfNotSet(self._scopes)
return self._NoneIfNotSet(self._scopes)
@property
def token(self):
"""
:type: string
"""
self._completeIfNotSet(self._token)
return self._NoneIfNotSet(self._token)
@property
def updated_at(self):
"""
:type: datetime.datetime
"""
self._completeIfNotSet(self._updated_at)
return self._NoneIfNotSet(self._updated_at)
@property
def url(self):
"""
:type: string
"""
self._completeIfNotSet(self._url)
return self._NoneIfNotSet(self._url)
def delete(self):
"""
:calls: `DELETE /authorizations/:id <http://developer.github.com/v3/todo>`_
:rtype: None
"""
headers, data = self._requester.requestAndCheck(
"DELETE",
self.url,
@@ -73,6 +108,15 @@ class Authorization(github.GithubObject.GithubObject):
)
def edit(self, scopes=github.GithubObject.NotSet, add_scopes=github.GithubObject.NotSet, remove_scopes=github.GithubObject.NotSet, note=github.GithubObject.NotSet, note_url=github.GithubObject.NotSet):
"""
:calls: `PATCH /authorizations/:id <http://developer.github.com/v3/todo>`_
:param scopes: list of string
:param add_scopes: list of string
:param remove_scopes: list of string
:param note: string
:param note_url: string
:rtype: None
"""
assert scopes is github.GithubObject.NotSet or all(isinstance(element, (str, unicode)) for element in scopes), scopes
assert add_scopes is github.GithubObject.NotSet or all(isinstance(element, (str, unicode)) for element in add_scopes), add_scopes
assert remove_scopes is github.GithubObject.NotSet or all(isinstance(element, (str, unicode)) for element in remove_scopes), remove_scopes
+10
View File
@@ -17,13 +17,23 @@ import github.GithubObject
class AuthorizationApplication(github.GithubObject.GithubObject):
"""
This class represents AuthorizationApplications as returned for example by http://developer.github.com/v3/todo
"""
@property
def name(self):
"""
:type: string
"""
self._completeIfNotSet(self._name)
return self._NoneIfNotSet(self._name)
@property
def url(self):
"""
:type: string
"""
self._completeIfNotSet(self._url)
return self._NoneIfNotSet(self._url)
+10
View File
@@ -19,12 +19,22 @@ import github.Commit
class Branch(github.GithubObject.BasicGithubObject):
"""
This class represents Branchs as returned for example by http://developer.github.com/v3/todo
"""
@property
def commit(self):
"""
:type: :class:`github.Commit.Commit`
"""
return self._NoneIfNotSet(self._commit)
@property
def name(self):
"""
:type: string
"""
return self._NoneIfNotSet(self._name)
def _initAttributes(self):
+51
View File
@@ -25,47 +25,83 @@ import github.CommitComment
class Commit(github.GithubObject.GithubObject):
"""
This class represents Commits as returned for example by http://developer.github.com/v3/todo
"""
@property
def author(self):
"""
:type: :class:`github.NamedUser.NamedUser`
"""
self._completeIfNotSet(self._author)
return self._NoneIfNotSet(self._author)
@property
def commit(self):
"""
:type: :class:`github.GitCommit.GitCommit`
"""
self._completeIfNotSet(self._commit)
return self._NoneIfNotSet(self._commit)
@property
def committer(self):
"""
:type: :class:`github.NamedUser.NamedUser`
"""
self._completeIfNotSet(self._committer)
return self._NoneIfNotSet(self._committer)
@property
def files(self):
"""
:type: list of :class:`github.File.File`
"""
self._completeIfNotSet(self._files)
return self._NoneIfNotSet(self._files)
@property
def parents(self):
"""
:type: list of :class:`github.Commit.Commit`
"""
self._completeIfNotSet(self._parents)
return self._NoneIfNotSet(self._parents)
@property
def sha(self):
"""
:type: string
"""
self._completeIfNotSet(self._sha)
return self._NoneIfNotSet(self._sha)
@property
def stats(self):
"""
:type: :class:`github.CommitStats.CommitStats`
"""
self._completeIfNotSet(self._stats)
return self._NoneIfNotSet(self._stats)
@property
def url(self):
"""
:type: string
"""
self._completeIfNotSet(self._url)
return self._NoneIfNotSet(self._url)
def create_comment(self, body, line=github.GithubObject.NotSet, path=github.GithubObject.NotSet, position=github.GithubObject.NotSet):
"""
:calls: `POST /repos/:user/:repo/commits/:sha/comments <http://developer.github.com/v3/todo>`_
:param body: string
:param line: integer
:param path: string
:param position: integer
:rtype: :class:`github.CommitComment.CommitComment`
"""
assert isinstance(body, (str, unicode)), body
assert line is github.GithubObject.NotSet or isinstance(line, (int, long)), line
assert path is github.GithubObject.NotSet or isinstance(path, (str, unicode)), path
@@ -88,6 +124,13 @@ class Commit(github.GithubObject.GithubObject):
return github.CommitComment.CommitComment(self._requester, data, completed=True)
def create_status(self, state, target_url=github.GithubObject.NotSet, description=github.GithubObject.NotSet):
"""
:calls: `POST /repos/:user/:repo/statuses/:sha <http://developer.github.com/v3/todo>`_
:param state: string
:param target_url: string
:param description: string
:rtype: :class:`github.CommitStatus.CommitStatus`
"""
assert isinstance(state, (str, unicode)), state
assert target_url is github.GithubObject.NotSet or isinstance(target_url, (str, unicode)), target_url
assert description is github.GithubObject.NotSet or isinstance(description, (str, unicode)), description
@@ -107,6 +150,10 @@ class Commit(github.GithubObject.GithubObject):
return github.CommitStatus.CommitStatus(self._requester, data, completed=True)
def get_comments(self):
"""
:calls: `GET /repos/:user/:repo/commits/:sha/comments <http://developer.github.com/v3/todo>`_
:rtype: :class:`github.PaginatedList.PaginatedList` of :class:`github.CommitComment.CommitComment`
"""
return github.PaginatedList.PaginatedList(
github.CommitComment.CommitComment,
self._requester,
@@ -115,6 +162,10 @@ class Commit(github.GithubObject.GithubObject):
)
def get_statuses(self):
"""
:calls: `GET /repos/:user/:repo/statuses/:sha <http://developer.github.com/v3/todo>`_
:rtype: :class:`github.PaginatedList.PaginatedList` of :class:`github.CommitStatus.CommitStatus`
"""
return github.PaginatedList.PaginatedList(
github.CommitStatus.CommitStatus,
self._requester,
+46
View File
@@ -19,62 +19,103 @@ import github.NamedUser
class CommitComment(github.GithubObject.GithubObject):
"""
This class represents CommitComments as returned for example by http://developer.github.com/v3/todo
"""
@property
def body(self):
"""
:type: string
"""
self._completeIfNotSet(self._body)
return self._NoneIfNotSet(self._body)
@property
def commit_id(self):
"""
:type: string
"""
self._completeIfNotSet(self._commit_id)
return self._NoneIfNotSet(self._commit_id)
@property
def created_at(self):
"""
:type: datetime.datetime
"""
self._completeIfNotSet(self._created_at)
return self._NoneIfNotSet(self._created_at)
@property
def html_url(self):
"""
:type: string
"""
self._completeIfNotSet(self._html_url)
return self._NoneIfNotSet(self._html_url)
@property
def id(self):
"""
:type: integer
"""
self._completeIfNotSet(self._id)
return self._NoneIfNotSet(self._id)
@property
def line(self):
"""
:type: integer
"""
self._completeIfNotSet(self._line)
return self._NoneIfNotSet(self._line)
@property
def path(self):
"""
:type: string
"""
self._completeIfNotSet(self._path)
return self._NoneIfNotSet(self._path)
@property
def position(self):
"""
:type: integer
"""
self._completeIfNotSet(self._position)
return self._NoneIfNotSet(self._position)
@property
def updated_at(self):
"""
:type: datetime.datetime
"""
self._completeIfNotSet(self._updated_at)
return self._NoneIfNotSet(self._updated_at)
@property
def url(self):
"""
:type: string
"""
self._completeIfNotSet(self._url)
return self._NoneIfNotSet(self._url)
@property
def user(self):
"""
:type: :class:`github.NamedUser.NamedUser`
"""
self._completeIfNotSet(self._user)
return self._NoneIfNotSet(self._user)
def delete(self):
"""
:calls: `DELETE /repos/:user/:repo/comments/:id <http://developer.github.com/v3/todo>`_
:rtype: None
"""
headers, data = self._requester.requestAndCheck(
"DELETE",
self.url,
@@ -83,6 +124,11 @@ class CommitComment(github.GithubObject.GithubObject):
)
def edit(self, body):
"""
:calls: `PATCH /repos/:user/:repo/comments/:id <http://developer.github.com/v3/todo>`_
:param body: string
:rtype: None
"""
assert isinstance(body, (str, unicode)), body
post_parameters = {
"body": body,
+13
View File
@@ -17,16 +17,29 @@ import github.GithubObject
class CommitStats(github.GithubObject.BasicGithubObject):
"""
This class represents CommitStatss as returned for example by http://developer.github.com/v3/todo
"""
@property
def additions(self):
"""
:type: integer
"""
return self._NoneIfNotSet(self._additions)
@property
def deletions(self):
"""
:type: integer
"""
return self._NoneIfNotSet(self._deletions)
@property
def total(self):
"""
:type: integer
"""
return self._NoneIfNotSet(self._total)
def _initAttributes(self):
+25
View File
@@ -19,32 +19,57 @@ import github.NamedUser
class CommitStatus(github.GithubObject.BasicGithubObject):
"""
This class represents CommitStatuss as returned for example by http://developer.github.com/v3/todo
"""
@property
def created_at(self):
"""
:type: datetime.datetime
"""
return self._NoneIfNotSet(self._created_at)
@property
def creator(self):
"""
:type: :class:`github.NamedUser.NamedUser`
"""
return self._NoneIfNotSet(self._creator)
@property
def description(self):
"""
:type: string
"""
return self._NoneIfNotSet(self._description)
@property
def id(self):
"""
:type: integer
"""
return self._NoneIfNotSet(self._id)
@property
def state(self):
"""
:type: string
"""
return self._NoneIfNotSet(self._state)
@property
def target_url(self):
"""
:type: string
"""
return self._NoneIfNotSet(self._target_url)
@property
def updated_at(self):
"""
:type: datetime.datetime
"""
return self._NoneIfNotSet(self._updated_at)
def _initAttributes(self):
+40
View File
@@ -20,63 +20,103 @@ import github.File
class Comparison(github.GithubObject.GithubObject):
"""
This class represents Comparisons as returned for example by http://developer.github.com/v3/todo
"""
@property
def ahead_by(self):
"""
:type: integer
"""
self._completeIfNotSet(self._ahead_by)
return self._NoneIfNotSet(self._ahead_by)
@property
def base_commit(self):
"""
:type: :class:`github.Commit.Commit`
"""
self._completeIfNotSet(self._base_commit)
return self._NoneIfNotSet(self._base_commit)
@property
def behind_by(self):
"""
:type: integer
"""
self._completeIfNotSet(self._behind_by)
return self._NoneIfNotSet(self._behind_by)
@property
def commits(self):
"""
:type: list of :class:`github.Commit.Commit`
"""
self._completeIfNotSet(self._commits)
return self._NoneIfNotSet(self._commits)
@property
def diff_url(self):
"""
:type: string
"""
self._completeIfNotSet(self._diff_url)
return self._NoneIfNotSet(self._diff_url)
@property
def files(self):
"""
:type: list of :class:`github.File.File`
"""
self._completeIfNotSet(self._files)
return self._NoneIfNotSet(self._files)
@property
def html_url(self):
"""
:type: string
"""
self._completeIfNotSet(self._html_url)
return self._NoneIfNotSet(self._html_url)
@property
def patch_url(self):
"""
:type: string
"""
self._completeIfNotSet(self._patch_url)
return self._NoneIfNotSet(self._patch_url)
@property
def permalink_url(self):
"""
:type: string
"""
self._completeIfNotSet(self._permalink_url)
return self._NoneIfNotSet(self._permalink_url)
@property
def status(self):
"""
:type: string
"""
self._completeIfNotSet(self._status)
return self._NoneIfNotSet(self._status)
@property
def total_commits(self):
"""
:type: integer
"""
self._completeIfNotSet(self._total_commits)
return self._NoneIfNotSet(self._total_commits)
@property
def url(self):
"""
:type: string
"""
self._completeIfNotSet(self._url)
return self._NoneIfNotSet(self._url)
+25
View File
@@ -17,32 +17,57 @@ import github.GithubObject
class ContentFile(github.GithubObject.BasicGithubObject):
"""
This class represents ContentFiles as returned for example by http://developer.github.com/v3/todo
"""
@property
def content(self):
"""
:type: string
"""
return self._NoneIfNotSet(self._content)
@property
def encoding(self):
"""
:type: string
"""
return self._NoneIfNotSet(self._encoding)
@property
def name(self):
"""
:type: string
"""
return self._NoneIfNotSet(self._name)
@property
def path(self):
"""
:type: string
"""
return self._NoneIfNotSet(self._path)
@property
def sha(self):
"""
:type: string
"""
return self._NoneIfNotSet(self._sha)
@property
def size(self):
"""
:type: integer
"""
return self._NoneIfNotSet(self._size)
@property
def type(self):
"""
:type: string
"""
return self._NoneIfNotSet(self._type)
def _initAttributes(self):
+68
View File
@@ -17,107 +17,175 @@ import github.GithubObject
class Download(github.GithubObject.GithubObject):
"""
This class represents Downloads as returned for example by http://developer.github.com/v3/todo
"""
@property
def accesskeyid(self):
"""
:type: string
"""
self._completeIfNotSet(self._accesskeyid)
return self._NoneIfNotSet(self._accesskeyid)
@property
def acl(self):
"""
:type: string
"""
self._completeIfNotSet(self._acl)
return self._NoneIfNotSet(self._acl)
@property
def bucket(self):
"""
:type: string
"""
self._completeIfNotSet(self._bucket)
return self._NoneIfNotSet(self._bucket)
@property
def content_type(self):
"""
:type: string
"""
self._completeIfNotSet(self._content_type)
return self._NoneIfNotSet(self._content_type)
@property
def created_at(self):
"""
:type: datetime.datetime
"""
self._completeIfNotSet(self._created_at)
return self._NoneIfNotSet(self._created_at)
@property
def description(self):
"""
:type: string
"""
self._completeIfNotSet(self._description)
return self._NoneIfNotSet(self._description)
@property
def download_count(self):
"""
:type: integer
"""
self._completeIfNotSet(self._download_count)
return self._NoneIfNotSet(self._download_count)
@property
def expirationdate(self):
"""
:type: datetime.datetime
"""
self._completeIfNotSet(self._expirationdate)
return self._NoneIfNotSet(self._expirationdate)
@property
def html_url(self):
"""
:type: string
"""
self._completeIfNotSet(self._html_url)
return self._NoneIfNotSet(self._html_url)
@property
def id(self):
"""
:type: integer
"""
self._completeIfNotSet(self._id)
return self._NoneIfNotSet(self._id)
@property
def mime_type(self):
"""
:type: string
"""
self._completeIfNotSet(self._mime_type)
return self._NoneIfNotSet(self._mime_type)
@property
def name(self):
"""
:type: string
"""
self._completeIfNotSet(self._name)
return self._NoneIfNotSet(self._name)
@property
def path(self):
"""
:type: string
"""
self._completeIfNotSet(self._path)
return self._NoneIfNotSet(self._path)
@property
def policy(self):
"""
:type: string
"""
self._completeIfNotSet(self._policy)
return self._NoneIfNotSet(self._policy)
@property
def prefix(self):
"""
:type: string
"""
self._completeIfNotSet(self._prefix)
return self._NoneIfNotSet(self._prefix)
@property
def redirect(self):
"""
:type: bool
"""
self._completeIfNotSet(self._redirect)
return self._NoneIfNotSet(self._redirect)
@property
def s3_url(self):
"""
:type: string
"""
self._completeIfNotSet(self._s3_url)
return self._NoneIfNotSet(self._s3_url)
@property
def signature(self):
"""
:type: string
"""
self._completeIfNotSet(self._signature)
return self._NoneIfNotSet(self._signature)
@property
def size(self):
"""
:type: integer
"""
self._completeIfNotSet(self._size)
return self._NoneIfNotSet(self._size)
@property
def url(self):
"""
:type: string
"""
self._completeIfNotSet(self._url)
return self._NoneIfNotSet(self._url)
def delete(self):
"""
:calls: `DELETE /repos/:user/:repo/downloads/:id <http://developer.github.com/v3/todo>`_
:rtype: None
"""
headers, data = self._requester.requestAndCheck(
"DELETE",
self.url,
+28
View File
@@ -21,36 +21,64 @@ import github.NamedUser
class Event(github.GithubObject.BasicGithubObject):
"""
This class represents Events as returned for example by http://developer.github.com/v3/todo
"""
@property
def actor(self):
"""
:type: :class:`github.NamedUser.NamedUser`
"""
return self._NoneIfNotSet(self._actor)
@property
def created_at(self):
"""
:type: datetime.datetime
"""
return self._NoneIfNotSet(self._created_at)
@property
def id(self):
"""
:type: string
"""
return self._NoneIfNotSet(self._id)
@property
def org(self):
"""
:type: :class:`github.Organization.Organization`
"""
return self._NoneIfNotSet(self._org)
@property
def payload(self):
"""
:type: dict
"""
return self._NoneIfNotSet(self._payload)
@property
def public(self):
"""
:type: bool
"""
return self._NoneIfNotSet(self._public)
@property
def repo(self):
"""
:type: :class:`github.Repository.Repository`
"""
return self._NoneIfNotSet(self._repo)
@property
def type(self):
"""
:type: string
"""
return self._NoneIfNotSet(self._type)
def _initAttributes(self):
+31
View File
@@ -17,40 +17,71 @@ import github.GithubObject
class File(github.GithubObject.BasicGithubObject):
"""
This class represents Files as returned for example by http://developer.github.com/v3/todo
"""
@property
def additions(self):
"""
:type: integer
"""
return self._NoneIfNotSet(self._additions)
@property
def blob_url(self):
"""
:type: string
"""
return self._NoneIfNotSet(self._blob_url)
@property
def changes(self):
"""
:type: integer
"""
return self._NoneIfNotSet(self._changes)
@property
def deletions(self):
"""
:type: integer
"""
return self._NoneIfNotSet(self._deletions)
@property
def filename(self):
"""
:type: string
"""
return self._NoneIfNotSet(self._filename)
@property
def patch(self):
"""
:type: string
"""
return self._NoneIfNotSet(self._patch)
@property
def raw_url(self):
"""
:type: string
"""
return self._NoneIfNotSet(self._raw_url)
@property
def sha(self):
"""
:type: string
"""
return self._NoneIfNotSet(self._sha)
@property
def status(self):
"""
:type: string
"""
return self._NoneIfNotSet(self._status)
def _initAttributes(self):
+89
View File
@@ -23,82 +23,136 @@ import github.GistHistoryState
class Gist(github.GithubObject.GithubObject):
"""
This class represents Gists as returned for example by http://developer.github.com/v3/todo
"""
@property
def comments(self):
"""
:type: integer
"""
self._completeIfNotSet(self._comments)
return self._NoneIfNotSet(self._comments)
@property
def created_at(self):
"""
:type: datetime.datetime
"""
self._completeIfNotSet(self._created_at)
return self._NoneIfNotSet(self._created_at)
@property
def description(self):
"""
:type: string
"""
self._completeIfNotSet(self._description)
return self._NoneIfNotSet(self._description)
@property
def files(self):
"""
:type: dict of string to :class:`github.GistFile.GistFile`
"""
self._completeIfNotSet(self._files)
return self._NoneIfNotSet(self._files)
@property
def fork_of(self):
"""
:type: :class:`github.Gist.Gist`
"""
self._completeIfNotSet(self._fork_of)
return self._NoneIfNotSet(self._fork_of)
@property
def forks(self):
"""
:type: list of :class:`github.Gist.Gist`
"""
self._completeIfNotSet(self._forks)
return self._NoneIfNotSet(self._forks)
@property
def git_pull_url(self):
"""
:type: string
"""
self._completeIfNotSet(self._git_pull_url)
return self._NoneIfNotSet(self._git_pull_url)
@property
def git_push_url(self):
"""
:type: string
"""
self._completeIfNotSet(self._git_push_url)
return self._NoneIfNotSet(self._git_push_url)
@property
def history(self):
"""
:type: list of :class:`github.GistHistoryState.GistHistoryState`
"""
self._completeIfNotSet(self._history)
return self._NoneIfNotSet(self._history)
@property
def html_url(self):
"""
:type: string
"""
self._completeIfNotSet(self._html_url)
return self._NoneIfNotSet(self._html_url)
@property
def id(self):
"""
:type: string
"""
self._completeIfNotSet(self._id)
return self._NoneIfNotSet(self._id)
@property
def public(self):
"""
:type: bool
"""
self._completeIfNotSet(self._public)
return self._NoneIfNotSet(self._public)
@property
def updated_at(self):
"""
:type: datetime.datetime
"""
self._completeIfNotSet(self._updated_at)
return self._NoneIfNotSet(self._updated_at)
@property
def url(self):
"""
:type: string
"""
self._completeIfNotSet(self._url)
return self._NoneIfNotSet(self._url)
@property
def user(self):
"""
:type: :class:`github.NamedUser.NamedUser`
"""
self._completeIfNotSet(self._user)
return self._NoneIfNotSet(self._user)
def create_comment(self, body):
"""
:calls: `POST /gists/:id/comments <http://developer.github.com/v3/todo>`_
:param body: string
:rtype: :class:`github.GistComment.GistComment`
"""
assert isinstance(body, (str, unicode)), body
post_parameters = {
"body": body,
@@ -112,6 +166,10 @@ class Gist(github.GithubObject.GithubObject):
return github.GistComment.GistComment(self._requester, data, completed=True)
def create_fork(self):
"""
:calls: `POST /gists/:id/fork <http://developer.github.com/v3/todo>`_
:rtype: :class:`github.Gist.Gist`
"""
headers, data = self._requester.requestAndCheck(
"POST",
self.url + "/fork",
@@ -121,6 +179,10 @@ class Gist(github.GithubObject.GithubObject):
return Gist(self._requester, data, completed=True)
def delete(self):
"""
:calls: `DELETE /gists/:id <http://developer.github.com/v3/todo>`_
:rtype: None
"""
headers, data = self._requester.requestAndCheck(
"DELETE",
self.url,
@@ -129,6 +191,12 @@ class Gist(github.GithubObject.GithubObject):
)
def edit(self, description=github.GithubObject.NotSet, files=github.GithubObject.NotSet):
"""
:calls: `PATCH /gists/:id <http://developer.github.com/v3/todo>`_
:param description: string
:param files: dict of string to :class:`github.InputFileContent.InputFileContent`
:rtype: None
"""
assert description is github.GithubObject.NotSet or isinstance(description, (str, unicode)), description
assert files is github.GithubObject.NotSet or all(isinstance(element, github.InputFileContent) for element in files.itervalues()), files
post_parameters = dict()
@@ -145,6 +213,11 @@ class Gist(github.GithubObject.GithubObject):
self._useAttributes(data)
def get_comment(self, id):
"""
:calls: `GET /gists/comments/:id <http://developer.github.com/v3/todo>`_
:param id: integer
:rtype: :class:`github.GistComment.GistComment`
"""
assert isinstance(id, (int, long)), id
headers, data = self._requester.requestAndCheck(
"GET",
@@ -155,6 +228,10 @@ class Gist(github.GithubObject.GithubObject):
return github.GistComment.GistComment(self._requester, data, completed=True)
def get_comments(self):
"""
:calls: `GET /gists/:id/comments <http://developer.github.com/v3/todo>`_
:rtype: :class:`github.PaginatedList.PaginatedList` of :class:`github.GistComment.GistComment`
"""
return github.PaginatedList.PaginatedList(
github.GistComment.GistComment,
self._requester,
@@ -163,6 +240,10 @@ class Gist(github.GithubObject.GithubObject):
)
def is_starred(self):
"""
:calls: `GET /gists/:id/star <http://developer.github.com/v3/todo>`_
:rtype: bool
"""
status, headers, data = self._requester.requestRaw(
"GET",
self.url + "/star",
@@ -172,6 +253,10 @@ class Gist(github.GithubObject.GithubObject):
return status == 204
def reset_starred(self):
"""
:calls: `DELETE /gists/:id/star <http://developer.github.com/v3/todo>`_
:rtype: None
"""
headers, data = self._requester.requestAndCheck(
"DELETE",
self.url + "/star",
@@ -180,6 +265,10 @@ class Gist(github.GithubObject.GithubObject):
)
def set_starred(self):
"""
:calls: `PUT /gists/:id/star <http://developer.github.com/v3/todo>`_
:rtype: None
"""
headers, data = self._requester.requestAndCheck(
"PUT",
self.url + "/star",
+31
View File
@@ -19,37 +19,63 @@ import github.NamedUser
class GistComment(github.GithubObject.GithubObject):
"""
This class represents GistComments as returned for example by http://developer.github.com/v3/todo
"""
@property
def body(self):
"""
:type: string
"""
self._completeIfNotSet(self._body)
return self._NoneIfNotSet(self._body)
@property
def created_at(self):
"""
:type: datetime.datetime
"""
self._completeIfNotSet(self._created_at)
return self._NoneIfNotSet(self._created_at)
@property
def id(self):
"""
:type: integer
"""
self._completeIfNotSet(self._id)
return self._NoneIfNotSet(self._id)
@property
def updated_at(self):
"""
:type: datetime.datetime
"""
self._completeIfNotSet(self._updated_at)
return self._NoneIfNotSet(self._updated_at)
@property
def url(self):
"""
:type: string
"""
self._completeIfNotSet(self._url)
return self._NoneIfNotSet(self._url)
@property
def user(self):
"""
:type: :class:`github.NamedUser.NamedUser`
"""
self._completeIfNotSet(self._user)
return self._NoneIfNotSet(self._user)
def delete(self):
"""
:calls: `DELETE /gists/comments/:id <http://developer.github.com/v3/todo>`_
:rtype: None
"""
headers, data = self._requester.requestAndCheck(
"DELETE",
self.url,
@@ -58,6 +84,11 @@ class GistComment(github.GithubObject.GithubObject):
)
def edit(self, body):
"""
:calls: `PATCH /gists/comments/:id <http://developer.github.com/v3/todo>`_
:param body: string
:rtype: None
"""
assert isinstance(body, (str, unicode)), body
post_parameters = {
"body": body,
+19
View File
@@ -17,24 +17,43 @@ import github.GithubObject
class GistFile(github.GithubObject.BasicGithubObject):
"""
This class represents GistFiles as returned for example by http://developer.github.com/v3/todo
"""
@property
def content(self):
"""
:type: string
"""
return self._NoneIfNotSet(self._content)
@property
def filename(self):
"""
:type: string
"""
return self._NoneIfNotSet(self._filename)
@property
def language(self):
"""
:type: string
"""
return self._NoneIfNotSet(self._language)
@property
def raw_url(self):
"""
:type: string
"""
return self._NoneIfNotSet(self._raw_url)
@property
def size(self):
"""
:type: integer
"""
return self._NoneIfNotSet(self._size)
def _initAttributes(self):
+19
View File
@@ -20,28 +20,47 @@ import github.CommitStats
class GistHistoryState(github.GithubObject.GithubObject):
"""
This class represents GistHistoryStates as returned for example by http://developer.github.com/v3/todo
"""
@property
def change_status(self):
"""
:type: :class:`github.CommitStats.CommitStats`
"""
self._completeIfNotSet(self._change_status)
return self._NoneIfNotSet(self._change_status)
@property
def committed_at(self):
"""
:type: datetime.datetime
"""
self._completeIfNotSet(self._committed_at)
return self._NoneIfNotSet(self._committed_at)
@property
def url(self):
"""
:type: string
"""
self._completeIfNotSet(self._url)
return self._NoneIfNotSet(self._url)
@property
def user(self):
"""
:type: :class:`github.NamedUser.NamedUser`
"""
self._completeIfNotSet(self._user)
return self._NoneIfNotSet(self._user)
@property
def version(self):
"""
:type: string
"""
self._completeIfNotSet(self._version)
return self._NoneIfNotSet(self._version)
+13
View File
@@ -17,16 +17,29 @@ import github.GithubObject
class GitAuthor(github.GithubObject.BasicGithubObject):
"""
This class represents GitAuthors as returned for example by http://developer.github.com/v3/todo
"""
@property
def date(self):
"""
:type: datetime.datetime
"""
return self._NoneIfNotSet(self._date)
@property
def email(self):
"""
:type: string
"""
return self._NoneIfNotSet(self._email)
@property
def name(self):
"""
:type: string
"""
return self._NoneIfNotSet(self._name)
def _initAttributes(self):
+19
View File
@@ -17,28 +17,47 @@ import github.GithubObject
class GitBlob(github.GithubObject.GithubObject):
"""
This class represents GitBlobs as returned for example by http://developer.github.com/v3/todo
"""
@property
def content(self):
"""
:type: string
"""
self._completeIfNotSet(self._content)
return self._NoneIfNotSet(self._content)
@property
def encoding(self):
"""
:type: string
"""
self._completeIfNotSet(self._encoding)
return self._NoneIfNotSet(self._encoding)
@property
def sha(self):
"""
:type: string
"""
self._completeIfNotSet(self._sha)
return self._NoneIfNotSet(self._sha)
@property
def size(self):
"""
:type: integer
"""
self._completeIfNotSet(self._size)
return self._NoneIfNotSet(self._size)
@property
def url(self):
"""
:type: string
"""
self._completeIfNotSet(self._url)
return self._NoneIfNotSet(self._url)
+25
View File
@@ -20,38 +20,63 @@ import github.GitTree
class GitCommit(github.GithubObject.GithubObject):
"""
This class represents GitCommits as returned for example by http://developer.github.com/v3/todo
"""
@property
def author(self):
"""
:type: :class:`github.GitAuthor.GitAuthor`
"""
self._completeIfNotSet(self._author)
return self._NoneIfNotSet(self._author)
@property
def committer(self):
"""
:type: :class:`github.GitAuthor.GitAuthor`
"""
self._completeIfNotSet(self._committer)
return self._NoneIfNotSet(self._committer)
@property
def message(self):
"""
:type: string
"""
self._completeIfNotSet(self._message)
return self._NoneIfNotSet(self._message)
@property
def parents(self):
"""
:type: list of :class:`github.GitCommit.GitCommit`
"""
self._completeIfNotSet(self._parents)
return self._NoneIfNotSet(self._parents)
@property
def sha(self):
"""
:type: string
"""
self._completeIfNotSet(self._sha)
return self._NoneIfNotSet(self._sha)
@property
def tree(self):
"""
:type: :class:`github.GitTree.GitTree`
"""
self._completeIfNotSet(self._tree)
return self._NoneIfNotSet(self._tree)
@property
def url(self):
"""
:type: string
"""
self._completeIfNotSet(self._url)
return self._NoneIfNotSet(self._url)
+13
View File
@@ -17,16 +17,29 @@ import github.GithubObject
class GitObject(github.GithubObject.BasicGithubObject):
"""
This class represents GitObjects as returned for example by http://developer.github.com/v3/todo
"""
@property
def sha(self):
"""
:type: string
"""
return self._NoneIfNotSet(self._sha)
@property
def type(self):
"""
:type: string
"""
return self._NoneIfNotSet(self._type)
@property
def url(self):
"""
:type: string
"""
return self._NoneIfNotSet(self._url)
def _initAttributes(self):
+23
View File
@@ -19,22 +19,39 @@ import github.GitObject
class GitRef(github.GithubObject.GithubObject):
"""
This class represents GitRefs as returned for example by http://developer.github.com/v3/todo
"""
@property
def object(self):
"""
:type: :class:`github.GitObject.GitObject`
"""
self._completeIfNotSet(self._object)
return self._NoneIfNotSet(self._object)
@property
def ref(self):
"""
:type: string
"""
self._completeIfNotSet(self._ref)
return self._NoneIfNotSet(self._ref)
@property
def url(self):
"""
:type: string
"""
self._completeIfNotSet(self._url)
return self._NoneIfNotSet(self._url)
def delete(self):
"""
:calls: `DELETE /repos/:user/:repo/git/refs/:ref <http://developer.github.com/v3/todo>`_
:rtype: None
"""
headers, data = self._requester.requestAndCheck(
"DELETE",
self.url,
@@ -43,6 +60,12 @@ class GitRef(github.GithubObject.GithubObject):
)
def edit(self, sha, force=github.GithubObject.NotSet):
"""
:calls: `PATCH /repos/:user/:repo/git/refs/:ref <http://developer.github.com/v3/todo>`_
:param sha: string
:param force: bool
:rtype: None
"""
assert isinstance(sha, (str, unicode)), sha
assert force is github.GithubObject.NotSet or isinstance(force, bool), force
post_parameters = {
+22
View File
@@ -20,33 +20,55 @@ import github.GitObject
class GitTag(github.GithubObject.GithubObject):
"""
This class represents GitTags as returned for example by http://developer.github.com/v3/todo
"""
@property
def message(self):
"""
:type: string
"""
self._completeIfNotSet(self._message)
return self._NoneIfNotSet(self._message)
@property
def object(self):
"""
:type: :class:`github.GitObject.GitObject`
"""
self._completeIfNotSet(self._object)
return self._NoneIfNotSet(self._object)
@property
def sha(self):
"""
:type: string
"""
self._completeIfNotSet(self._sha)
return self._NoneIfNotSet(self._sha)
@property
def tag(self):
"""
:type: string
"""
self._completeIfNotSet(self._tag)
return self._NoneIfNotSet(self._tag)
@property
def tagger(self):
"""
:type: :class:`github.GitAuthor.GitAuthor`
"""
self._completeIfNotSet(self._tagger)
return self._NoneIfNotSet(self._tagger)
@property
def url(self):
"""
:type: string
"""
self._completeIfNotSet(self._url)
return self._NoneIfNotSet(self._url)
+13
View File
@@ -19,18 +19,31 @@ import github.GitTreeElement
class GitTree(github.GithubObject.GithubObject):
"""
This class represents GitTrees as returned for example by http://developer.github.com/v3/todo
"""
@property
def sha(self):
"""
:type: string
"""
self._completeIfNotSet(self._sha)
return self._NoneIfNotSet(self._sha)
@property
def tree(self):
"""
:type: list of :class:`github.GitTreeElement.GitTreeElement`
"""
self._completeIfNotSet(self._tree)
return self._NoneIfNotSet(self._tree)
@property
def url(self):
"""
:type: string
"""
self._completeIfNotSet(self._url)
return self._NoneIfNotSet(self._url)
+22
View File
@@ -17,28 +17,50 @@ import github.GithubObject
class GitTreeElement(github.GithubObject.BasicGithubObject):
"""
This class represents GitTreeElements as returned for example by http://developer.github.com/v3/todo
"""
@property
def mode(self):
"""
:type: string
"""
return self._NoneIfNotSet(self._mode)
@property
def path(self):
"""
:type: string
"""
return self._NoneIfNotSet(self._path)
@property
def sha(self):
"""
:type: string
"""
return self._NoneIfNotSet(self._sha)
@property
def size(self):
"""
:type: integer
"""
return self._NoneIfNotSet(self._size)
@property
def type(self):
"""
:type: string
"""
return self._NoneIfNotSet(self._type)
@property
def url(self):
"""
:type: string
"""
return self._NoneIfNotSet(self._url)
def _initAttributes(self):
+64
View File
@@ -33,6 +33,10 @@ DEFAULT_TIMEOUT = 10
class Github(object):
"""
This class represents Githubs as returned for example by http://developer.github.com/v3/todo
"""
def __init__(self, login_or_token=None, password=None, base_url=DEFAULT_BASE_URL, timeout=DEFAULT_TIMEOUT, client_id=None, client_secret=None, user_agent=None):
"""
:param login_or_token: string
@@ -63,9 +67,17 @@ class Github(object):
@property
def rate_limiting(self):
"""
:type: (int, int)
"""
return self.__requester.rate_limiting
def get_user(self, login=github.GithubObject.NotSet):
"""
:calls: `GET /users/:user <http://developer.github.com/v3/todo>`_
:param login: string
:rtype: :class:`github.NamedUser.NamedUser`
"""
assert login is github.GithubObject.NotSet or isinstance(login, (str, unicode)), login
if login is github.GithubObject.NotSet:
return AuthenticatedUser.AuthenticatedUser(self.__requester, {"url": "/user"}, completed=False)
@@ -79,6 +91,11 @@ class Github(object):
return github.NamedUser.NamedUser(self.__requester, data, completed=True)
def get_organization(self, login):
"""
:calls: `GET /orgs/:org <http://developer.github.com/v3/todo>`_
:param login: string
:rtype: :class:`github.Organization.Organization`
"""
assert isinstance(login, (str, unicode)), login
headers, data = self.__requester.requestAndCheck(
"GET",
@@ -89,6 +106,10 @@ class Github(object):
return github.Organization.Organization(self.__requester, data, completed=True)
def get_repo(self, full_name):
"""
:calls: `GET /repos/:user/:repo <http://developer.github.com/v3/todo>`_
:rtype: :class:`github.Repository.Repository`
"""
assert isinstance(full_name, (str, unicode)), full_name
headers, data = self.__requester.requestAndCheck(
"GET",
@@ -99,6 +120,11 @@ class Github(object):
return Repository.Repository(self.__requester, data, completed=True)
def get_gist(self, id):
"""
:calls: `GET /gists/:id <http://developer.github.com/v3/todo>`_
:param id: string
:rtype: :class:`github.Gist.Gist`
"""
assert isinstance(id, (str, unicode)), id
headers, data = self.__requester.requestAndCheck(
"GET",
@@ -109,6 +135,10 @@ class Github(object):
return github.Gist.Gist(self.__requester, data, completed=True)
def get_gists(self):
"""
:calls: `GET /gists/public <http://developer.github.com/v3/todo>`_
:rtype: :class:`github.PaginatedList.PaginatedList` of :class:`github.Gist.Gist`
"""
return github.PaginatedList.PaginatedList(
github.Gist.Gist,
self.__requester,
@@ -117,6 +147,12 @@ class Github(object):
)
def legacy_search_repos(self, keyword, language=github.GithubObject.NotSet):
"""
:calls: `GET /legacy/repos/search/:keyword <http://developer.github.com/v3/todo>`_
:param keyword: string
:param language: string
:rtype: :class:`github.PaginatedList.PaginatedList` of :class:`github.Repository.Repository`
"""
assert isinstance(keyword, (str, unicode)), keyword
assert language is github.GithubObject.NotSet or isinstance(language, (str, unicode)), language
args = {} if language is github.GithubObject.NotSet else {"language": language}
@@ -130,6 +166,11 @@ class Github(object):
)
def legacy_search_users(self, keyword):
"""
:calls: `GET /legacy/user/search/:keyword <http://developer.github.com/v3/todo>`_
:param keyword: string
:rtype: :class:`github.PaginatedList.PaginatedList` of :class:`github.NamedUser.NamedUser`
"""
assert isinstance(keyword, (str, unicode)), keyword
return Legacy.PaginatedList(
"/legacy/user/search/" + urllib.quote(keyword),
@@ -141,6 +182,11 @@ class Github(object):
)
def legacy_search_user_by_email(self, email):
"""
:calls: `GET /legacy/user/email/:email <http://developer.github.com/v3/todo>`_
:param email: string
:rtype: :class:`github.NamedUser.NamedUser`
"""
assert isinstance(email, (str, unicode)), email
headers, data = self.__requester.requestAndCheck(
"GET",
@@ -151,6 +197,12 @@ class Github(object):
return github.NamedUser.NamedUser(self.__requester, Legacy.convertUser(data["user"]), completed=False)
def render_markdown(self, text, context=github.GithubObject.NotSet):
"""
:calls: `POST /markdown <http://developer.github.com/v3/todo>`_
:param text: string
:param context: :class:`github.Repository.Repository`
:rtype: string
"""
assert isinstance(text, (str, unicode)), text
assert context is github.GithubObject.NotSet or isinstance(context, github.Repository.Repository), context
post_parameters = {
@@ -168,6 +220,10 @@ class Github(object):
return data
def get_hooks(self):
"""
:calls: `GET /hooks <http://developer.github.com/v3/todo>`_
:rtype: :class:`github.PaginatedList.PaginatedList` of :class:`github.HookDescription.HookDescription`
"""
headers, data = self.__requester.requestAndCheck(
"GET",
"/hooks",
@@ -177,6 +233,10 @@ class Github(object):
return [HookDescription.HookDescription(self.__requester, attributes, completed=True) for attributes in data]
def get_gitignore_templates(self):
"""
:calls: `GET /gitignore/templates <http://developer.github.com/v3/todo>`_
:rtype: list of string
"""
headers, data = self.__requester.requestAndCheck(
"GET",
"/gitignore/templates",
@@ -186,6 +246,10 @@ class Github(object):
return data
def get_gitignore_template(self, name):
"""
:calls: `GET /gitignore/templates/:name <http://developer.github.com/v3/todo>`_
:rtype: :class:`github.GitignoreTemplate.GitignoreTemplate`
"""
assert isinstance(name, (str, unicode)), name
headers, attributes = self.__requester.requestAndCheck(
"GET",
+4
View File
@@ -15,6 +15,10 @@
class GithubException(Exception):
"""
This class represents GithubExceptions as returned for example by http://developer.github.com/v3/todo
"""
def __init__(self, status, data):
Exception.__init__(self)
self.status = status
+10
View File
@@ -17,12 +17,22 @@ import github.GithubObject
class GitignoreTemplate(github.GithubObject.BasicGithubObject):
"""
This class represents GitignoreTemplates as returned for example by http://developer.github.com/v3/todo
"""
@property
def source(self):
"""
:type: string
"""
return self._NoneIfNotSet(self._source)
@property
def name(self):
"""
:type: string
"""
return self._NoneIfNotSet(self._name)
def _initAttributes(self):
+49
View File
@@ -19,52 +19,87 @@ import github.HookResponse
class Hook(github.GithubObject.GithubObject):
"""
This class represents Hooks as returned for example by http://developer.github.com/v3/todo
"""
@property
def active(self):
"""
:type: bool
"""
self._completeIfNotSet(self._active)
return self._NoneIfNotSet(self._active)
@property
def config(self):
"""
:type: dict
"""
self._completeIfNotSet(self._config)
return self._NoneIfNotSet(self._config)
@property
def created_at(self):
"""
:type: datetime.datetime
"""
self._completeIfNotSet(self._created_at)
return self._NoneIfNotSet(self._created_at)
@property
def events(self):
"""
:type: list of string
"""
self._completeIfNotSet(self._events)
return self._NoneIfNotSet(self._events)
@property
def id(self):
"""
:type: integer
"""
self._completeIfNotSet(self._id)
return self._NoneIfNotSet(self._id)
@property
def last_response(self):
"""
:type: :class:`github.HookResponse.HookResponse`
"""
self._completeIfNotSet(self._last_response)
return self._NoneIfNotSet(self._last_response)
@property
def name(self):
"""
:type: string
"""
self._completeIfNotSet(self._name)
return self._NoneIfNotSet(self._name)
@property
def updated_at(self):
"""
:type: datetime.datetime
"""
self._completeIfNotSet(self._updated_at)
return self._NoneIfNotSet(self._updated_at)
@property
def url(self):
"""
:type: string
"""
self._completeIfNotSet(self._url)
return self._NoneIfNotSet(self._url)
def delete(self):
"""
:calls: `DELETE /repos/:user/:repo/hooks/:id <http://developer.github.com/v3/todo>`_
:rtype: None
"""
headers, data = self._requester.requestAndCheck(
"DELETE",
self.url,
@@ -73,6 +108,16 @@ class Hook(github.GithubObject.GithubObject):
)
def edit(self, name, config, events=github.GithubObject.NotSet, add_events=github.GithubObject.NotSet, remove_events=github.GithubObject.NotSet, active=github.GithubObject.NotSet):
"""
:calls: `PATCH /repos/:user/:repo/hooks/:id <http://developer.github.com/v3/todo>`_
:param name: string
:param config: dict
:param events: list of string
:param add_events: list of string
:param remove_events: list of string
:param active: bool
:rtype: None
"""
assert isinstance(name, (str, unicode)), name
assert isinstance(config, dict), config
assert events is github.GithubObject.NotSet or all(isinstance(element, (str, unicode)) for element in events), events
@@ -100,6 +145,10 @@ class Hook(github.GithubObject.GithubObject):
self._useAttributes(data)
def test(self):
"""
:calls: `POST /repos/:user/:repo/hooks/:id/test <http://developer.github.com/v3/todo>`_
:rtype: None
"""
headers, data = self._requester.requestAndCheck(
"POST",
self.url + "/test",
+16
View File
@@ -17,20 +17,36 @@ import github.GithubObject
class HookDescription(github.GithubObject.BasicGithubObject):
"""
This class represents HookDescriptions as returned for example by http://developer.github.com/v3/todo
"""
@property
def events(self):
"""
:type: list of string
"""
return self._NoneIfNotSet(self._events)
@property
def name(self):
"""
:type: string
"""
return self._NoneIfNotSet(self._name)
@property
def schema(self):
"""
:type: list of list of string
"""
return self._NoneIfNotSet(self._schema)
@property
def supported_events(self):
"""
:type: list of string
"""
return self._NoneIfNotSet(self._supported_events)
def _initAttributes(self):
+13
View File
@@ -17,16 +17,29 @@ import github.GithubObject
class HookResponse(github.GithubObject.BasicGithubObject):
"""
This class represents HookResponses as returned for example by http://developer.github.com/v3/todo
"""
@property
def code(self):
"""
:type: integer
"""
return self._NoneIfNotSet(self._code)
@property
def message(self):
"""
:type: string
"""
return self._NoneIfNotSet(self._message)
@property
def status(self):
"""
:type: string
"""
return self._NoneIfNotSet(self._status)
def _initAttributes(self):
+4
View File
@@ -15,6 +15,10 @@
class InputFileContent(object):
"""
This class represents InputFileContents as returned for example by http://developer.github.com/v3/todo
"""
def __init__(self, content):
"""
:param content: string
+4
View File
@@ -15,6 +15,10 @@
class InputGitAuthor(object):
"""
This class represents InputGitAuthors as returned for example by http://developer.github.com/v3/todo
"""
def __init__(self, name, email, date):
"""
:param name: string
+4
View File
@@ -17,6 +17,10 @@ import github.GithubObject
class InputGitTreeElement(object):
"""
This class represents InputGitTreeElements as returned for example by http://developer.github.com/v3/todo
"""
def __init__(self, path, mode, type, content=github.GithubObject.NotSet, sha=github.GithubObject.NotSet):
"""
:param path: string
+109
View File
@@ -26,97 +26,160 @@ import github.IssuePullRequest
class Issue(github.GithubObject.GithubObject):
"""
This class represents Issues as returned for example by http://developer.github.com/v3/todo
"""
@property
def assignee(self):
"""
:type: :class:`github.NamedUser.NamedUser`
"""
self._completeIfNotSet(self._assignee)
return self._NoneIfNotSet(self._assignee)
@property
def body(self):
"""
:type: string
"""
self._completeIfNotSet(self._body)
return self._NoneIfNotSet(self._body)
@property
def closed_at(self):
"""
:type: datetime.datetime
"""
self._completeIfNotSet(self._closed_at)
return self._NoneIfNotSet(self._closed_at)
@property
def closed_by(self):
"""
:type: :class:`github.NamedUser.NamedUser`
"""
self._completeIfNotSet(self._closed_by)
return self._NoneIfNotSet(self._closed_by)
@property
def comments(self):
"""
:type: integer
"""
self._completeIfNotSet(self._comments)
return self._NoneIfNotSet(self._comments)
@property
def created_at(self):
"""
:type: datetime.datetime
"""
self._completeIfNotSet(self._created_at)
return self._NoneIfNotSet(self._created_at)
@property
def html_url(self):
"""
:type: string
"""
self._completeIfNotSet(self._html_url)
return self._NoneIfNotSet(self._html_url)
@property
def id(self):
"""
:type: integer
"""
self._completeIfNotSet(self._id)
return self._NoneIfNotSet(self._id)
@property
def labels(self):
"""
:type: list of :class:`github.Label.Label`
"""
self._completeIfNotSet(self._labels)
return self._NoneIfNotSet(self._labels)
@property
def milestone(self):
"""
:type: :class:`github.Milestone.Milestone`
"""
self._completeIfNotSet(self._milestone)
return self._NoneIfNotSet(self._milestone)
@property
def number(self):
"""
:type: integer
"""
self._completeIfNotSet(self._number)
return self._NoneIfNotSet(self._number)
@property
def pull_request(self):
"""
:type: :class:`github.IssuePullRequest.IssuePullRequest`
"""
self._completeIfNotSet(self._pull_request)
return self._NoneIfNotSet(self._pull_request)
@property
def repository(self):
"""
:type: :class:`github.Repository.Repository`
"""
self._completeIfNotSet(self._repository)
return self._NoneIfNotSet(self._repository)
@property
def state(self):
"""
:type: string
"""
self._completeIfNotSet(self._state)
return self._NoneIfNotSet(self._state)
@property
def title(self):
"""
:type: string
"""
self._completeIfNotSet(self._title)
return self._NoneIfNotSet(self._title)
@property
def updated_at(self):
"""
:type: datetime.datetime
"""
self._completeIfNotSet(self._updated_at)
return self._NoneIfNotSet(self._updated_at)
@property
def url(self):
"""
:type: string
"""
self._completeIfNotSet(self._url)
return self._NoneIfNotSet(self._url)
@property
def user(self):
"""
:type: :class:`github.NamedUser.NamedUser`
"""
self._completeIfNotSet(self._user)
return self._NoneIfNotSet(self._user)
def add_to_labels(self, *labels):
"""
:calls: `POST /repos/:user/:repo/issues/:number/labels <http://developer.github.com/v3/todo>`_
:param label: :class:`github.Label.Label`
:rtype: None
"""
assert all(isinstance(element, github.Label.Label) for element in labels), labels
post_parameters = [label.name for label in labels]
headers, data = self._requester.requestAndCheck(
@@ -127,6 +190,11 @@ class Issue(github.GithubObject.GithubObject):
)
def create_comment(self, body):
"""
:calls: `POST /repos/:user/:repo/issues/:number/comments <http://developer.github.com/v3/todo>`_
:param body: string
:rtype: :class:`github.IssueComment.IssueComment`
"""
assert isinstance(body, (str, unicode)), body
post_parameters = {
"body": body,
@@ -140,6 +208,10 @@ class Issue(github.GithubObject.GithubObject):
return github.IssueComment.IssueComment(self._requester, data, completed=True)
def delete_labels(self):
"""
:calls: `DELETE /repos/:user/:repo/issues/:number/labels <http://developer.github.com/v3/todo>`_
:rtype: None
"""
headers, data = self._requester.requestAndCheck(
"DELETE",
self.url + "/labels",
@@ -148,6 +220,16 @@ class Issue(github.GithubObject.GithubObject):
)
def edit(self, title=github.GithubObject.NotSet, body=github.GithubObject.NotSet, assignee=github.GithubObject.NotSet, state=github.GithubObject.NotSet, milestone=github.GithubObject.NotSet, labels=github.GithubObject.NotSet):
"""
:calls: `PATCH /repos/:user/:repo/issues/:number <http://developer.github.com/v3/todo>`_
:param title: string
:param body: string
:param assignee: :class:`github.NamedUser.NamedUser` or None
:param state: string
:param milestone: :class:`github.Milestone.Milestone` or None
:param labels: list of string
:rtype: None
"""
assert title is github.GithubObject.NotSet or isinstance(title, (str, unicode)), title
assert body is github.GithubObject.NotSet or isinstance(body, (str, unicode)), body
assert assignee is github.GithubObject.NotSet or assignee is None or isinstance(assignee, github.NamedUser.NamedUser), assignee
@@ -176,6 +258,11 @@ class Issue(github.GithubObject.GithubObject):
self._useAttributes(data)
def get_comment(self, id):
"""
:calls: `GET /repos/:user/:repo/issues/comments/:id <http://developer.github.com/v3/todo>`_
:param id: integer
:rtype: :class:`github.IssueComment.IssueComment`
"""
assert isinstance(id, (int, long)), id
headers, data = self._requester.requestAndCheck(
"GET",
@@ -186,6 +273,10 @@ class Issue(github.GithubObject.GithubObject):
return github.IssueComment.IssueComment(self._requester, data, completed=True)
def get_comments(self):
"""
:calls: `GET /repos/:user/:repo/issues/:number/comments <http://developer.github.com/v3/todo>`_
:rtype: :class:`github.PaginatedList.PaginatedList` of :class:`github.IssueComment.IssueComment`
"""
return github.PaginatedList.PaginatedList(
github.IssueComment.IssueComment,
self._requester,
@@ -194,6 +285,10 @@ class Issue(github.GithubObject.GithubObject):
)
def get_events(self):
"""
:calls: `GET /repos/:user/:repo/issues/:number/events <http://developer.github.com/v3/todo>`_
:rtype: :class:`github.PaginatedList.PaginatedList` of :class:`github.IssueEvent.IssueEvent`
"""
return github.PaginatedList.PaginatedList(
github.IssueEvent.IssueEvent,
self._requester,
@@ -202,6 +297,10 @@ class Issue(github.GithubObject.GithubObject):
)
def get_labels(self):
"""
:calls: `GET /repos/:user/:repo/issues/:number/labels <http://developer.github.com/v3/todo>`_
:rtype: :class:`github.PaginatedList.PaginatedList` of :class:`github.Label.Label`
"""
return github.PaginatedList.PaginatedList(
github.Label.Label,
self._requester,
@@ -210,6 +309,11 @@ class Issue(github.GithubObject.GithubObject):
)
def remove_from_labels(self, label):
"""
:calls: `DELETE /repos/:user/:repo/issues/:number/labels/:name <http://developer.github.com/v3/todo>`_
:param label: :class:`github.Label.Label`
:rtype: None
"""
assert isinstance(label, github.Label.Label), label
headers, data = self._requester.requestAndCheck(
"DELETE",
@@ -219,6 +323,11 @@ class Issue(github.GithubObject.GithubObject):
)
def set_labels(self, *labels):
"""
:calls: `PUT /repos/:user/:repo/issues/:number/labels <http://developer.github.com/v3/todo>`_
:param label: :class:`github.Label.Label`
:rtype: None
"""
assert all(isinstance(element, github.Label.Label) for element in labels), labels
post_parameters = [label.name for label in labels]
headers, data = self._requester.requestAndCheck(
+31
View File
@@ -19,37 +19,63 @@ import github.NamedUser
class IssueComment(github.GithubObject.GithubObject):
"""
This class represents IssueComments as returned for example by http://developer.github.com/v3/todo
"""
@property
def body(self):
"""
:type: string
"""
self._completeIfNotSet(self._body)
return self._NoneIfNotSet(self._body)
@property
def created_at(self):
"""
:type: datetime.datetime
"""
self._completeIfNotSet(self._created_at)
return self._NoneIfNotSet(self._created_at)
@property
def id(self):
"""
:type: integer
"""
self._completeIfNotSet(self._id)
return self._NoneIfNotSet(self._id)
@property
def updated_at(self):
"""
:type: datetime.datetime
"""
self._completeIfNotSet(self._updated_at)
return self._NoneIfNotSet(self._updated_at)
@property
def url(self):
"""
:type: string
"""
self._completeIfNotSet(self._url)
return self._NoneIfNotSet(self._url)
@property
def user(self):
"""
:type: :class:`github.NamedUser.NamedUser`
"""
self._completeIfNotSet(self._user)
return self._NoneIfNotSet(self._user)
def delete(self):
"""
:calls: `DELETE /repos/:user/:repo/issues/comments/:id <http://developer.github.com/v3/todo>`_
:rtype: None
"""
headers, data = self._requester.requestAndCheck(
"DELETE",
self.url,
@@ -58,6 +84,11 @@ class IssueComment(github.GithubObject.GithubObject):
)
def edit(self, body):
"""
:calls: `PATCH /repos/:user/:repo/issues/comments/:id <http://developer.github.com/v3/todo>`_
:param body: string
:rtype: None
"""
assert isinstance(body, (str, unicode)), body
post_parameters = {
"body": body,
+25
View File
@@ -20,38 +20,63 @@ import github.NamedUser
class IssueEvent(github.GithubObject.GithubObject):
"""
This class represents IssueEvents as returned for example by http://developer.github.com/v3/todo
"""
@property
def actor(self):
"""
:type: :class:`github.NamedUser.NamedUser`
"""
self._completeIfNotSet(self._actor)
return self._NoneIfNotSet(self._actor)
@property
def commit_id(self):
"""
:type: string
"""
self._completeIfNotSet(self._commit_id)
return self._NoneIfNotSet(self._commit_id)
@property
def created_at(self):
"""
:type: datetime.datetime
"""
self._completeIfNotSet(self._created_at)
return self._NoneIfNotSet(self._created_at)
@property
def event(self):
"""
:type: string
"""
self._completeIfNotSet(self._event)
return self._NoneIfNotSet(self._event)
@property
def id(self):
"""
:type: integer
"""
self._completeIfNotSet(self._id)
return self._NoneIfNotSet(self._id)
@property
def issue(self):
"""
:type: :class:`github.Issue.Issue`
"""
self._completeIfNotSet(self._issue)
return self._NoneIfNotSet(self._issue)
@property
def url(self):
"""
:type: string
"""
self._completeIfNotSet(self._url)
return self._NoneIfNotSet(self._url)
+13
View File
@@ -17,16 +17,29 @@ import github.GithubObject
class IssuePullRequest(github.GithubObject.BasicGithubObject):
"""
This class represents IssuePullRequests as returned for example by http://developer.github.com/v3/todo
"""
@property
def diff_url(self):
"""
:type: string
"""
return self._NoneIfNotSet(self._diff_url)
@property
def html_url(self):
"""
:type: string
"""
return self._NoneIfNotSet(self._html_url)
@property
def patch_url(self):
"""
:type: string
"""
return self._NoneIfNotSet(self._patch_url)
def _initAttributes(self):
+23
View File
@@ -19,22 +19,39 @@ import github.GithubObject
class Label(github.GithubObject.GithubObject):
"""
This class represents Labels as returned for example by http://developer.github.com/v3/todo
"""
@property
def color(self):
"""
:type: string
"""
self._completeIfNotSet(self._color)
return self._NoneIfNotSet(self._color)
@property
def name(self):
"""
:type: string
"""
self._completeIfNotSet(self._name)
return self._NoneIfNotSet(self._name)
@property
def url(self):
"""
:type: string
"""
self._completeIfNotSet(self._url)
return self._NoneIfNotSet(self._url)
def delete(self):
"""
:calls: `DELETE /repos/:user/:repo/labels/:name <http://developer.github.com/v3/todo>`_
:rtype: None
"""
headers, data = self._requester.requestAndCheck(
"DELETE",
self.url,
@@ -43,6 +60,12 @@ class Label(github.GithubObject.GithubObject):
)
def edit(self, name, color):
"""
:calls: `PATCH /repos/:user/:repo/labels/:name <http://developer.github.com/v3/todo>`_
:param name: string
:param color: string
:rtype: None
"""
assert isinstance(name, (str, unicode)), name
assert isinstance(color, (str, unicode)), color
post_parameters = {
+53
View File
@@ -23,62 +23,103 @@ import github.Label
class Milestone(github.GithubObject.GithubObject):
"""
This class represents Milestones as returned for example by http://developer.github.com/v3/todo
"""
@property
def closed_issues(self):
"""
:type: integer
"""
self._completeIfNotSet(self._closed_issues)
return self._NoneIfNotSet(self._closed_issues)
@property
def created_at(self):
"""
:type: datetime.datetime
"""
self._completeIfNotSet(self._created_at)
return self._NoneIfNotSet(self._created_at)
@property
def creator(self):
"""
:type: :class:`github.NamedUser.NamedUser`
"""
self._completeIfNotSet(self._creator)
return self._NoneIfNotSet(self._creator)
@property
def description(self):
"""
:type: string
"""
self._completeIfNotSet(self._description)
return self._NoneIfNotSet(self._description)
@property
def due_on(self):
"""
:type: datetime.datetime
"""
self._completeIfNotSet(self._due_on)
return self._NoneIfNotSet(self._due_on)
@property
def id(self):
"""
:type: integer
"""
self._completeIfNotSet(self._id)
return self._NoneIfNotSet(self._id)
@property
def number(self):
"""
:type: integer
"""
self._completeIfNotSet(self._number)
return self._NoneIfNotSet(self._number)
@property
def open_issues(self):
"""
:type: integer
"""
self._completeIfNotSet(self._open_issues)
return self._NoneIfNotSet(self._open_issues)
@property
def state(self):
"""
:type: string
"""
self._completeIfNotSet(self._state)
return self._NoneIfNotSet(self._state)
@property
def title(self):
"""
:type: string
"""
self._completeIfNotSet(self._title)
return self._NoneIfNotSet(self._title)
@property
def url(self):
"""
:type: string
"""
self._completeIfNotSet(self._url)
return self._NoneIfNotSet(self._url)
def delete(self):
"""
:calls: `DELETE /repos/:user/:repo/milestones/:number <http://developer.github.com/v3/todo>`_
:rtype: None
"""
headers, data = self._requester.requestAndCheck(
"DELETE",
self.url,
@@ -87,6 +128,14 @@ class Milestone(github.GithubObject.GithubObject):
)
def edit(self, title, state=github.GithubObject.NotSet, description=github.GithubObject.NotSet, due_on=github.GithubObject.NotSet):
"""
:calls: `PATCH /repos/:user/:repo/milestones/:number <http://developer.github.com/v3/todo>`_
:param title: string
:param state: string
:param description: string
:param due_on: date
:rtype: None
"""
assert isinstance(title, (str, unicode)), title
assert state is github.GithubObject.NotSet or isinstance(state, (str, unicode)), state
assert description is github.GithubObject.NotSet or isinstance(description, (str, unicode)), description
@@ -109,6 +158,10 @@ class Milestone(github.GithubObject.GithubObject):
self._useAttributes(data)
def get_labels(self):
"""
:calls: `GET /repos/:user/:repo/milestones/:number/labels <http://developer.github.com/v3/todo>`_
:rtype: :class:`github.PaginatedList.PaginatedList` of :class:`github.Label.Label`
"""
return github.PaginatedList.PaginatedList(
github.Label.Label,
self._requester,
+143
View File
@@ -25,137 +25,226 @@ import github.Event
class NamedUser(github.GithubObject.GithubObject):
"""
This class represents NamedUsers as returned for example by http://developer.github.com/v3/todo
"""
@property
def avatar_url(self):
"""
:type: string
"""
self._completeIfNotSet(self._avatar_url)
return self._NoneIfNotSet(self._avatar_url)
@property
def bio(self):
"""
:type: string
"""
self._completeIfNotSet(self._bio)
return self._NoneIfNotSet(self._bio)
@property
def blog(self):
"""
:type: string
"""
self._completeIfNotSet(self._blog)
return self._NoneIfNotSet(self._blog)
@property
def collaborators(self):
"""
:type: integer
"""
self._completeIfNotSet(self._collaborators)
return self._NoneIfNotSet(self._collaborators)
@property
def company(self):
"""
:type: string
"""
self._completeIfNotSet(self._company)
return self._NoneIfNotSet(self._company)
@property
def contributions(self):
"""
:type: integer
"""
self._completeIfNotSet(self._contributions)
return self._NoneIfNotSet(self._contributions)
@property
def created_at(self):
"""
:type: datetime.datetime
"""
self._completeIfNotSet(self._created_at)
return self._NoneIfNotSet(self._created_at)
@property
def disk_usage(self):
"""
:type: integer
"""
self._completeIfNotSet(self._disk_usage)
return self._NoneIfNotSet(self._disk_usage)
@property
def email(self):
"""
:type: string
"""
self._completeIfNotSet(self._email)
return self._NoneIfNotSet(self._email)
@property
def followers(self):
"""
:type: integer
"""
self._completeIfNotSet(self._followers)
return self._NoneIfNotSet(self._followers)
@property
def following(self):
"""
:type: integer
"""
self._completeIfNotSet(self._following)
return self._NoneIfNotSet(self._following)
@property
def gravatar_id(self):
"""
:type: string
"""
self._completeIfNotSet(self._gravatar_id)
return self._NoneIfNotSet(self._gravatar_id)
@property
def hireable(self):
"""
:type: bool
"""
self._completeIfNotSet(self._hireable)
return self._NoneIfNotSet(self._hireable)
@property
def html_url(self):
"""
:type: string
"""
self._completeIfNotSet(self._html_url)
return self._NoneIfNotSet(self._html_url)
@property
def id(self):
"""
:type: integer
"""
self._completeIfNotSet(self._id)
return self._NoneIfNotSet(self._id)
@property
def location(self):
"""
:type: string
"""
self._completeIfNotSet(self._location)
return self._NoneIfNotSet(self._location)
@property
def login(self):
"""
:type: string
"""
self._completeIfNotSet(self._login)
return self._NoneIfNotSet(self._login)
@property
def name(self):
"""
:type: string
"""
self._completeIfNotSet(self._name)
return self._NoneIfNotSet(self._name)
@property
def owned_private_repos(self):
"""
:type: integer
"""
self._completeIfNotSet(self._owned_private_repos)
return self._NoneIfNotSet(self._owned_private_repos)
@property
def plan(self):
"""
:type: :class:`github.Plan.Plan`
"""
self._completeIfNotSet(self._plan)
return self._NoneIfNotSet(self._plan)
@property
def private_gists(self):
"""
:type: integer
"""
self._completeIfNotSet(self._private_gists)
return self._NoneIfNotSet(self._private_gists)
@property
def public_gists(self):
"""
:type: integer
"""
self._completeIfNotSet(self._public_gists)
return self._NoneIfNotSet(self._public_gists)
@property
def public_repos(self):
"""
:type: integer
"""
self._completeIfNotSet(self._public_repos)
return self._NoneIfNotSet(self._public_repos)
@property
def total_private_repos(self):
"""
:type: integer
"""
self._completeIfNotSet(self._total_private_repos)
return self._NoneIfNotSet(self._total_private_repos)
@property
def type(self):
"""
:type: string
"""
self._completeIfNotSet(self._type)
return self._NoneIfNotSet(self._type)
@property
def url(self):
"""
:type: string
"""
self._completeIfNotSet(self._url)
return self._NoneIfNotSet(self._url)
def create_gist(self, public, files, description=github.GithubObject.NotSet):
"""
:calls: `POST /users/:user/gists <http://developer.github.com/v3/todo>`_
:param public: bool
:param files: dict of string to :class:`github.InputFileContent.InputFileContent`
:param description: string
:rtype: :class:`github.Gist.Gist`
"""
assert isinstance(public, bool), public
assert all(isinstance(element, github.InputFileContent) for element in files.itervalues()), files
assert description is github.GithubObject.NotSet or isinstance(description, (str, unicode)), description
@@ -174,6 +263,10 @@ class NamedUser(github.GithubObject.GithubObject):
return github.Gist.Gist(self._requester, data, completed=True)
def get_events(self):
"""
:calls: `GET /users/:user/events <http://developer.github.com/v3/todo>`_
:rtype: :class:`github.PaginatedList.PaginatedList` of :class:`github.Event.Event`
"""
return github.PaginatedList.PaginatedList(
github.Event.Event,
self._requester,
@@ -182,6 +275,10 @@ class NamedUser(github.GithubObject.GithubObject):
)
def get_followers(self):
"""
:calls: `GET /users/:user/followers <http://developer.github.com/v3/todo>`_
:rtype: :class:`github.PaginatedList.PaginatedList` of :class:`github.NamedUser.NamedUser`
"""
return github.PaginatedList.PaginatedList(
NamedUser,
self._requester,
@@ -190,6 +287,10 @@ class NamedUser(github.GithubObject.GithubObject):
)
def get_following(self):
"""
:calls: `GET /users/:user/following <http://developer.github.com/v3/todo>`_
:rtype: :class:`github.PaginatedList.PaginatedList` of :class:`github.NamedUser.NamedUser`
"""
return github.PaginatedList.PaginatedList(
NamedUser,
self._requester,
@@ -198,6 +299,10 @@ class NamedUser(github.GithubObject.GithubObject):
)
def get_gists(self):
"""
:calls: `GET /users/:user/gists <http://developer.github.com/v3/todo>`_
:rtype: :class:`github.PaginatedList.PaginatedList` of :class:`github.Gist.Gist`
"""
return github.PaginatedList.PaginatedList(
github.Gist.Gist,
self._requester,
@@ -206,6 +311,10 @@ class NamedUser(github.GithubObject.GithubObject):
)
def get_orgs(self):
"""
:calls: `GET /users/:user/orgs <http://developer.github.com/v3/todo>`_
:rtype: :class:`github.PaginatedList.PaginatedList` of :class:`github.Organization.Organization`
"""
return github.PaginatedList.PaginatedList(
github.Organization.Organization,
self._requester,
@@ -214,6 +323,10 @@ class NamedUser(github.GithubObject.GithubObject):
)
def get_public_events(self):
"""
:calls: `GET /users/:user/events/public <http://developer.github.com/v3/todo>`_
:rtype: :class:`github.PaginatedList.PaginatedList` of :class:`github.Event.Event`
"""
return github.PaginatedList.PaginatedList(
github.Event.Event,
self._requester,
@@ -222,6 +335,10 @@ class NamedUser(github.GithubObject.GithubObject):
)
def get_public_received_events(self):
"""
:calls: `GET /users/:user/received_events/public <http://developer.github.com/v3/todo>`_
:rtype: :class:`github.PaginatedList.PaginatedList` of :class:`github.Event.Event`
"""
return github.PaginatedList.PaginatedList(
github.Event.Event,
self._requester,
@@ -230,6 +347,10 @@ class NamedUser(github.GithubObject.GithubObject):
)
def get_received_events(self):
"""
:calls: `GET /users/:user/received_events <http://developer.github.com/v3/todo>`_
:rtype: :class:`github.PaginatedList.PaginatedList` of :class:`github.Event.Event`
"""
return github.PaginatedList.PaginatedList(
github.Event.Event,
self._requester,
@@ -238,6 +359,11 @@ class NamedUser(github.GithubObject.GithubObject):
)
def get_repo(self, name):
"""
:calls: `GET /repos/:user/:repo <http://developer.github.com/v3/todo>`_
:param name: string
:rtype: :class:`github.Repository.Repository`
"""
assert isinstance(name, (str, unicode)), name
headers, data = self._requester.requestAndCheck(
"GET",
@@ -248,6 +374,11 @@ class NamedUser(github.GithubObject.GithubObject):
return github.Repository.Repository(self._requester, data, completed=True)
def get_repos(self, type=github.GithubObject.NotSet):
"""
:calls: `GET /users/:user/repos <http://developer.github.com/v3/todo>`_
:param type: string
:rtype: :class:`github.PaginatedList.PaginatedList` of :class:`github.Repository.Repository`
"""
assert type is github.GithubObject.NotSet or isinstance(type, (str, unicode)), type
url_parameters = dict()
if type is not github.GithubObject.NotSet:
@@ -260,6 +391,10 @@ class NamedUser(github.GithubObject.GithubObject):
)
def get_starred(self):
"""
:calls: `GET /users/:user/starred <http://developer.github.com/v3/todo>`_
:rtype: :class:`github.PaginatedList.PaginatedList` of :class:`github.Repository.Repository`
"""
return github.PaginatedList.PaginatedList(
github.Repository.Repository,
self._requester,
@@ -268,6 +403,10 @@ class NamedUser(github.GithubObject.GithubObject):
)
def get_subscriptions(self):
"""
:calls: `GET /users/:user/subscriptions <http://developer.github.com/v3/todo>`_
:rtype: :class:`github.PaginatedList.PaginatedList` of :class:`github.Repository.Repository`
"""
return github.PaginatedList.PaginatedList(
github.Repository.Repository,
self._requester,
@@ -276,6 +415,10 @@ class NamedUser(github.GithubObject.GithubObject):
)
def get_watched(self):
"""
:calls: `GET /users/:user/watched <http://developer.github.com/v3/todo>`_
:rtype: :class:`github.PaginatedList.PaginatedList` of :class:`github.Repository.Repository`
"""
return github.PaginatedList.PaginatedList(
github.Repository.Repository,
self._requester,
+168
View File
@@ -24,127 +24,208 @@ import github.NamedUser
class Organization(github.GithubObject.GithubObject):
"""
This class represents Organizations as returned for example by http://developer.github.com/v3/todo
"""
@property
def avatar_url(self):
"""
:type: string
"""
self._completeIfNotSet(self._avatar_url)
return self._NoneIfNotSet(self._avatar_url)
@property
def billing_email(self):
"""
:type: string
"""
self._completeIfNotSet(self._billing_email)
return self._NoneIfNotSet(self._billing_email)
@property
def blog(self):
"""
:type: string
"""
self._completeIfNotSet(self._blog)
return self._NoneIfNotSet(self._blog)
@property
def collaborators(self):
"""
:type: integer
"""
self._completeIfNotSet(self._collaborators)
return self._NoneIfNotSet(self._collaborators)
@property
def company(self):
"""
:type: string
"""
self._completeIfNotSet(self._company)
return self._NoneIfNotSet(self._company)
@property
def created_at(self):
"""
:type: datetime.datetime
"""
self._completeIfNotSet(self._created_at)
return self._NoneIfNotSet(self._created_at)
@property
def disk_usage(self):
"""
:type: integer
"""
self._completeIfNotSet(self._disk_usage)
return self._NoneIfNotSet(self._disk_usage)
@property
def email(self):
"""
:type: string
"""
self._completeIfNotSet(self._email)
return self._NoneIfNotSet(self._email)
@property
def followers(self):
"""
:type: integer
"""
self._completeIfNotSet(self._followers)
return self._NoneIfNotSet(self._followers)
@property
def following(self):
"""
:type: integer
"""
self._completeIfNotSet(self._following)
return self._NoneIfNotSet(self._following)
@property
def gravatar_id(self):
"""
:type: string
"""
self._completeIfNotSet(self._gravatar_id)
return self._NoneIfNotSet(self._gravatar_id)
@property
def html_url(self):
"""
:type: string
"""
self._completeIfNotSet(self._html_url)
return self._NoneIfNotSet(self._html_url)
@property
def id(self):
"""
:type: integer
"""
self._completeIfNotSet(self._id)
return self._NoneIfNotSet(self._id)
@property
def location(self):
"""
:type: string
"""
self._completeIfNotSet(self._location)
return self._NoneIfNotSet(self._location)
@property
def login(self):
"""
:type: string
"""
self._completeIfNotSet(self._login)
return self._NoneIfNotSet(self._login)
@property
def name(self):
"""
:type: string
"""
self._completeIfNotSet(self._name)
return self._NoneIfNotSet(self._name)
@property
def owned_private_repos(self):
"""
:type: integer
"""
self._completeIfNotSet(self._owned_private_repos)
return self._NoneIfNotSet(self._owned_private_repos)
@property
def plan(self):
"""
:type: :class:`github.Plan.Plan`
"""
self._completeIfNotSet(self._plan)
return self._NoneIfNotSet(self._plan)
@property
def private_gists(self):
"""
:type: integer
"""
self._completeIfNotSet(self._private_gists)
return self._NoneIfNotSet(self._private_gists)
@property
def public_gists(self):
"""
:type: integer
"""
self._completeIfNotSet(self._public_gists)
return self._NoneIfNotSet(self._public_gists)
@property
def public_repos(self):
"""
:type: integer
"""
self._completeIfNotSet(self._public_repos)
return self._NoneIfNotSet(self._public_repos)
@property
def total_private_repos(self):
"""
:type: integer
"""
self._completeIfNotSet(self._total_private_repos)
return self._NoneIfNotSet(self._total_private_repos)
@property
def type(self):
"""
:type: string
"""
self._completeIfNotSet(self._type)
return self._NoneIfNotSet(self._type)
@property
def url(self):
"""
:type: string
"""
self._completeIfNotSet(self._url)
return self._NoneIfNotSet(self._url)
def add_to_public_members(self, public_member):
"""
:calls: `PUT /orgs/:org/public_members/:user <http://developer.github.com/v3/todo>`_
:param public_member: :class:`github.NamedUser.NamedUser`
:rtype: None
"""
assert isinstance(public_member, github.NamedUser.NamedUser), public_member
headers, data = self._requester.requestAndCheck(
"PUT",
@@ -154,6 +235,11 @@ class Organization(github.GithubObject.GithubObject):
)
def create_fork(self, repo):
"""
:calls: `POST /repos/:user/:repo/forks <http://developer.github.com/v3/todo>`_
:param repo: :class:`github.Repository.Repository`
:rtype: :class:`github.Repository.Repository`
"""
assert isinstance(repo, github.Repository.Repository), repo
url_parameters = {
"org": self.login,
@@ -167,6 +253,20 @@ class Organization(github.GithubObject.GithubObject):
return github.Repository.Repository(self._requester, data, completed=True)
def create_repo(self, name, description=github.GithubObject.NotSet, homepage=github.GithubObject.NotSet, private=github.GithubObject.NotSet, has_issues=github.GithubObject.NotSet, has_wiki=github.GithubObject.NotSet, has_downloads=github.GithubObject.NotSet, team_id=github.GithubObject.NotSet, auto_init=github.GithubObject.NotSet, gitignore_template=github.GithubObject.NotSet):
"""
:calls: `POST /orgs/:org/repos <http://developer.github.com/v3/todo>`_
:param name: string
:param description: string
:param homepage: string
:param private: bool
:param has_issues: bool
:param has_wiki: bool
:param has_downloads: bool
:param team_id: :class:`github.Team.Team`
:param auto_init: bool
:param gitignore_template: string
:rtype: :class:`github.Repository.Repository`
"""
assert isinstance(name, (str, unicode)), name
assert description is github.GithubObject.NotSet or isinstance(description, (str, unicode)), description
assert homepage is github.GithubObject.NotSet or isinstance(homepage, (str, unicode)), homepage
@@ -207,6 +307,13 @@ class Organization(github.GithubObject.GithubObject):
return github.Repository.Repository(self._requester, data, completed=True)
def create_team(self, name, repo_names=github.GithubObject.NotSet, permission=github.GithubObject.NotSet):
"""
:calls: `POST /orgs/:org/teams <http://developer.github.com/v3/todo>`_
:param name: string
:param repo_names: list of :class:`github.Repository.Repository`
:param permission: string
:rtype: :class:`github.Team.Team`
"""
assert isinstance(name, (str, unicode)), name
assert repo_names is github.GithubObject.NotSet or all(isinstance(element, github.Repository.Repository) for element in repo_names), repo_names
assert permission is github.GithubObject.NotSet or isinstance(permission, (str, unicode)), permission
@@ -226,6 +333,16 @@ class Organization(github.GithubObject.GithubObject):
return github.Team.Team(self._requester, data, completed=True)
def edit(self, billing_email=github.GithubObject.NotSet, blog=github.GithubObject.NotSet, company=github.GithubObject.NotSet, email=github.GithubObject.NotSet, location=github.GithubObject.NotSet, name=github.GithubObject.NotSet):
"""
:calls: `PATCH /orgs/:org <http://developer.github.com/v3/todo>`_
:param billing_email: string
:param blog: string
:param company: string
:param email: string
:param location: string
:param name: string
:rtype: None
"""
assert billing_email is github.GithubObject.NotSet or isinstance(billing_email, (str, unicode)), billing_email
assert blog is github.GithubObject.NotSet or isinstance(blog, (str, unicode)), blog
assert company is github.GithubObject.NotSet or isinstance(company, (str, unicode)), company
@@ -254,6 +371,10 @@ class Organization(github.GithubObject.GithubObject):
self._useAttributes(data)
def get_events(self):
"""
:calls: `GET /orgs/:org/events <http://developer.github.com/v3/todo>`_
:rtype: :class:`github.PaginatedList.PaginatedList` of :class:`github.Event.Event`
"""
return github.PaginatedList.PaginatedList(
github.Event.Event,
self._requester,
@@ -262,6 +383,10 @@ class Organization(github.GithubObject.GithubObject):
)
def get_members(self):
"""
:calls: `GET /orgs/:org/members <http://developer.github.com/v3/todo>`_
:rtype: :class:`github.PaginatedList.PaginatedList` of :class:`github.NamedUser.NamedUser`
"""
return github.PaginatedList.PaginatedList(
github.NamedUser.NamedUser,
self._requester,
@@ -270,6 +395,10 @@ class Organization(github.GithubObject.GithubObject):
)
def get_public_members(self):
"""
:calls: `GET /orgs/:org/public_members <http://developer.github.com/v3/todo>`_
:rtype: :class:`github.PaginatedList.PaginatedList` of :class:`github.NamedUser.NamedUser`
"""
return github.PaginatedList.PaginatedList(
github.NamedUser.NamedUser,
self._requester,
@@ -278,6 +407,11 @@ class Organization(github.GithubObject.GithubObject):
)
def get_repo(self, name):
"""
:calls: `GET /repos/:user/:repo <http://developer.github.com/v3/todo>`_
:param name: string
:rtype: :class:`github.Repository.Repository`
"""
assert isinstance(name, (str, unicode)), name
headers, data = self._requester.requestAndCheck(
"GET",
@@ -288,6 +422,11 @@ class Organization(github.GithubObject.GithubObject):
return github.Repository.Repository(self._requester, data, completed=True)
def get_repos(self, type=github.GithubObject.NotSet):
"""
:calls: `GET /orgs/:org/repos <http://developer.github.com/v3/todo>`_
:param type: string
:rtype: :class:`github.PaginatedList.PaginatedList` of :class:`github.Repository.Repository`
"""
assert type is github.GithubObject.NotSet or isinstance(type, (str, unicode)), type
url_parameters = dict()
if type is not github.GithubObject.NotSet:
@@ -300,6 +439,11 @@ class Organization(github.GithubObject.GithubObject):
)
def get_team(self, id):
"""
:calls: `GET /teams/:id <http://developer.github.com/v3/todo>`_
:param id: integer
:rtype: :class:`github.Team.Team`
"""
assert isinstance(id, (int, long)), id
headers, data = self._requester.requestAndCheck(
"GET",
@@ -310,6 +454,10 @@ class Organization(github.GithubObject.GithubObject):
return github.Team.Team(self._requester, data, completed=True)
def get_teams(self):
"""
:calls: `GET /orgs/:org/teams <http://developer.github.com/v3/todo>`_
:rtype: :class:`github.PaginatedList.PaginatedList` of :class:`github.Team.Team`
"""
return github.PaginatedList.PaginatedList(
github.Team.Team,
self._requester,
@@ -318,6 +466,11 @@ class Organization(github.GithubObject.GithubObject):
)
def has_in_members(self, member):
"""
:calls: `GET /orgs/:org/members/:user <http://developer.github.com/v3/todo>`_
:param member: :class:`github.NamedUser.NamedUser`
:rtype: bool
"""
assert isinstance(member, github.NamedUser.NamedUser), member
status, headers, data = self._requester.requestRaw(
"GET",
@@ -328,6 +481,11 @@ class Organization(github.GithubObject.GithubObject):
return status == 204
def has_in_public_members(self, public_member):
"""
:calls: `GET /orgs/:org/public_members/:user <http://developer.github.com/v3/todo>`_
:param public_member: :class:`github.NamedUser.NamedUser`
:rtype: bool
"""
assert isinstance(public_member, github.NamedUser.NamedUser), public_member
status, headers, data = self._requester.requestRaw(
"GET",
@@ -338,6 +496,11 @@ class Organization(github.GithubObject.GithubObject):
return status == 204
def remove_from_members(self, member):
"""
:calls: `DELETE /orgs/:org/members/:user <http://developer.github.com/v3/todo>`_
:param member: :class:`github.NamedUser.NamedUser`
:rtype: None
"""
assert isinstance(member, github.NamedUser.NamedUser), member
headers, data = self._requester.requestAndCheck(
"DELETE",
@@ -347,6 +510,11 @@ class Organization(github.GithubObject.GithubObject):
)
def remove_from_public_members(self, public_member):
"""
:calls: `DELETE /orgs/:org/public_members/:user <http://developer.github.com/v3/todo>`_
:param public_member: :class:`github.NamedUser.NamedUser`
:rtype: None
"""
assert isinstance(public_member, github.NamedUser.NamedUser), public_member
headers, data = self._requester.requestAndCheck(
"DELETE",
+13
View File
@@ -17,16 +17,29 @@ import github.GithubObject
class Permissions(github.GithubObject.BasicGithubObject):
"""
This class represents Permissionss as returned for example by http://developer.github.com/v3/todo
"""
@property
def admin(self):
"""
:type: bool
"""
return self._NoneIfNotSet(self._admin)
@property
def pull(self):
"""
:type: bool
"""
return self._NoneIfNotSet(self._pull)
@property
def push(self):
"""
:type: bool
"""
return self._NoneIfNotSet(self._push)
def _initAttributes(self):
+16
View File
@@ -17,20 +17,36 @@ import github.GithubObject
class Plan(github.GithubObject.BasicGithubObject):
"""
This class represents Plans as returned for example by http://developer.github.com/v3/todo
"""
@property
def collaborators(self):
"""
:type: integer
"""
return self._NoneIfNotSet(self._collaborators)
@property
def name(self):
"""
:type: string
"""
return self._NoneIfNotSet(self._name)
@property
def private_repos(self):
"""
:type: integer
"""
return self._NoneIfNotSet(self._private_repos)
@property
def space(self):
"""
:type: integer
"""
return self._NoneIfNotSet(self._space)
def _initAttributes(self):
+157
View File
@@ -26,145 +26,246 @@ import github.Commit
class PullRequest(github.GithubObject.GithubObject):
"""
This class represents PullRequests as returned for example by http://developer.github.com/v3/todo
"""
@property
def additions(self):
"""
:type: integer
"""
self._completeIfNotSet(self._additions)
return self._NoneIfNotSet(self._additions)
@property
def assignee(self):
"""
:type: :class:`github.NamedUser.NamedUser`
"""
self._completeIfNotSet(self._assignee)
return self._NoneIfNotSet(self._assignee)
@property
def base(self):
"""
:type: :class:`github.PullRequestPart.PullRequestPart`
"""
self._completeIfNotSet(self._base)
return self._NoneIfNotSet(self._base)
@property
def body(self):
"""
:type: string
"""
self._completeIfNotSet(self._body)
return self._NoneIfNotSet(self._body)
@property
def changed_files(self):
"""
:type: integer
"""
self._completeIfNotSet(self._changed_files)
return self._NoneIfNotSet(self._changed_files)
@property
def closed_at(self):
"""
:type: datetime.datetime
"""
self._completeIfNotSet(self._closed_at)
return self._NoneIfNotSet(self._closed_at)
@property
def comments(self):
"""
:type: integer
"""
self._completeIfNotSet(self._comments)
return self._NoneIfNotSet(self._comments)
@property
def commits(self):
"""
:type: integer
"""
self._completeIfNotSet(self._commits)
return self._NoneIfNotSet(self._commits)
@property
def created_at(self):
"""
:type: datetime.datetime
"""
self._completeIfNotSet(self._created_at)
return self._NoneIfNotSet(self._created_at)
@property
def deletions(self):
"""
:type: integer
"""
self._completeIfNotSet(self._deletions)
return self._NoneIfNotSet(self._deletions)
@property
def diff_url(self):
"""
:type: string
"""
self._completeIfNotSet(self._diff_url)
return self._NoneIfNotSet(self._diff_url)
@property
def head(self):
"""
:type: :class:`github.PullRequestPart.PullRequestPart`
"""
self._completeIfNotSet(self._head)
return self._NoneIfNotSet(self._head)
@property
def html_url(self):
"""
:type: string
"""
self._completeIfNotSet(self._html_url)
return self._NoneIfNotSet(self._html_url)
@property
def id(self):
"""
:type: integer
"""
self._completeIfNotSet(self._id)
return self._NoneIfNotSet(self._id)
@property
def issue_url(self):
"""
:type: string
"""
self._completeIfNotSet(self._issue_url)
return self._NoneIfNotSet(self._issue_url)
@property
def mergeable(self):
"""
:type: bool
"""
self._completeIfNotSet(self._mergeable)
return self._NoneIfNotSet(self._mergeable)
@property
def merged(self):
"""
:type: bool
"""
self._completeIfNotSet(self._merged)
return self._NoneIfNotSet(self._merged)
@property
def merged_at(self):
"""
:type: datetime.datetime
"""
self._completeIfNotSet(self._merged_at)
return self._NoneIfNotSet(self._merged_at)
@property
def merged_by(self):
"""
:type: :class:`github.NamedUser.NamedUser`
"""
self._completeIfNotSet(self._merged_by)
return self._NoneIfNotSet(self._merged_by)
@property
def number(self):
"""
:type: integer
"""
self._completeIfNotSet(self._number)
return self._NoneIfNotSet(self._number)
@property
def patch_url(self):
"""
:type: string
"""
self._completeIfNotSet(self._patch_url)
return self._NoneIfNotSet(self._patch_url)
@property
def review_comments(self):
"""
:type: integer
"""
self._completeIfNotSet(self._review_comments)
return self._NoneIfNotSet(self._review_comments)
@property
def state(self):
"""
:type: string
"""
self._completeIfNotSet(self._state)
return self._NoneIfNotSet(self._state)
@property
def title(self):
"""
:type: string
"""
self._completeIfNotSet(self._title)
return self._NoneIfNotSet(self._title)
@property
def updated_at(self):
"""
:type: datetime.datetime
"""
self._completeIfNotSet(self._updated_at)
return self._NoneIfNotSet(self._updated_at)
@property
def url(self):
"""
:type: string
"""
self._completeIfNotSet(self._url)
return self._NoneIfNotSet(self._url)
@property
def user(self):
"""
:type: :class:`github.NamedUser.NamedUser`
"""
self._completeIfNotSet(self._user)
return self._NoneIfNotSet(self._user)
def create_comment(self, body, commit_id, path, position):
"""
:calls: `POST /repos/:user/:repo/pulls/:number/comments <http://developer.github.com/v3/todo>`_
:param body: string
:param commit_id: :class:`github.Commit.Commit`
:param path: string
:param position: integer
:rtype: :class:`github.PullRequestComment.PullRequestComment`
"""
return self.create_review_comment(body, commit_id, path, position)
def create_review_comment(self, body, commit_id, path, position):
"""
:calls: `POST /repos/:user/:repo/pulls/:number/comments <http://developer.github.com/v3/todo>`_
:param body: string
:param commit_id: :class:`github.Commit.Commit`
:param path: string
:param position: integer
:rtype: :class:`github.PullRequestComment.PullRequestComment`
"""
assert isinstance(body, (str, unicode)), body
assert isinstance(commit_id, github.Commit.Commit), commit_id
assert isinstance(path, (str, unicode)), path
@@ -184,6 +285,11 @@ class PullRequest(github.GithubObject.GithubObject):
return github.PullRequestComment.PullRequestComment(self._requester, data, completed=True)
def create_issue_comment(self, body):
"""
:calls: `POST /repos/:user/:repo/issues/:number/comments <http://developer.github.com/v3/todo>`_
:param body: string
:rtype: :class:`github.IssueComment.IssueComment`
"""
assert isinstance(body, (str, unicode)), body
post_parameters = {
"body": body,
@@ -197,6 +303,13 @@ class PullRequest(github.GithubObject.GithubObject):
return github.IssueComment.IssueComment(self._requester, data, completed=True)
def edit(self, title=github.GithubObject.NotSet, body=github.GithubObject.NotSet, state=github.GithubObject.NotSet):
"""
:calls: `PATCH /repos/:user/:repo/pulls/:number <http://developer.github.com/v3/todo>`_
:param title: string
:param body: string
:param state: string
:rtype: None
"""
assert title is github.GithubObject.NotSet or isinstance(title, (str, unicode)), title
assert body is github.GithubObject.NotSet or isinstance(body, (str, unicode)), body
assert state is github.GithubObject.NotSet or isinstance(state, (str, unicode)), state
@@ -216,9 +329,19 @@ class PullRequest(github.GithubObject.GithubObject):
self._useAttributes(data)
def get_comment(self, id):
"""
:calls: `GET /repos/:user/:repo/pulls/comments/:number <http://developer.github.com/v3/todo>`_
:param id: integer
:rtype: :class:`github.PullRequestComment.PullRequestComment`
"""
return self.get_review_comment(id)
def get_review_comment(self, id):
"""
:calls: `GET /repos/:user/:repo/pulls/comments/:number <http://developer.github.com/v3/todo>`_
:param id: integer
:rtype: :class:`github.PullRequestComment.PullRequestComment`
"""
assert isinstance(id, (int, long)), id
headers, data = self._requester.requestAndCheck(
"GET",
@@ -229,9 +352,17 @@ class PullRequest(github.GithubObject.GithubObject):
return github.PullRequestComment.PullRequestComment(self._requester, data, completed=True)
def get_comments(self):
"""
:calls: `GET /repos/:user/:repo/pulls/:number/comments <http://developer.github.com/v3/todo>`_
:rtype: :class:`github.PaginatedList.PaginatedList` of :class:`github.PullRequestComment.PullRequestComment`
"""
return self.get_review_comments()
def get_review_comments(self):
"""
:calls: `GET /repos/:user/:repo/pulls/:number/comments <http://developer.github.com/v3/todo>`_
:rtype: :class:`github.PaginatedList.PaginatedList` of :class:`github.PullRequestComment.PullRequestComment`
"""
return github.PaginatedList.PaginatedList(
github.PullRequestComment.PullRequestComment,
self._requester,
@@ -240,6 +371,10 @@ class PullRequest(github.GithubObject.GithubObject):
)
def get_commits(self):
"""
:calls: `GET /repos/:user/:repo/pulls/:number/commits <http://developer.github.com/v3/todo>`_
:rtype: :class:`github.PaginatedList.PaginatedList` of :class:`github.Commit.Commit`
"""
return github.PaginatedList.PaginatedList(
github.Commit.Commit,
self._requester,
@@ -248,6 +383,10 @@ class PullRequest(github.GithubObject.GithubObject):
)
def get_files(self):
"""
:calls: `GET /repos/:user/:repo/pulls/:number/files <http://developer.github.com/v3/todo>`_
:rtype: :class:`github.PaginatedList.PaginatedList` of :class:`github.File.File`
"""
return github.PaginatedList.PaginatedList(
github.File.File,
self._requester,
@@ -256,6 +395,11 @@ class PullRequest(github.GithubObject.GithubObject):
)
def get_issue_comment(self, id):
"""
:calls: `GET /repos/:user/:repo/issues/comments/:id <http://developer.github.com/v3/todo>`_
:param id: integer
:rtype: :class:`github.IssueComment.IssueComment`
"""
assert isinstance(id, (int, long)), id
headers, data = self._requester.requestAndCheck(
"GET",
@@ -266,6 +410,10 @@ class PullRequest(github.GithubObject.GithubObject):
return github.IssueComment.IssueComment(self._requester, data, completed=True)
def get_issue_comments(self):
"""
:calls: `GET /repos/:user/:repo/issues/:number/comments <http://developer.github.com/v3/todo>`_
:rtype: :class:`github.PaginatedList.PaginatedList` of :class:`github.IssueComment.IssueComment`
"""
return github.PaginatedList.PaginatedList(
github.IssueComment.IssueComment,
self._requester,
@@ -274,6 +422,10 @@ class PullRequest(github.GithubObject.GithubObject):
)
def is_merged(self):
"""
:calls: `GET /repos/:user/:repo/pulls/:number/merge <http://developer.github.com/v3/todo>`_
:rtype: bool
"""
status, headers, data = self._requester.requestRaw(
"GET",
self.url + "/merge",
@@ -283,6 +435,11 @@ class PullRequest(github.GithubObject.GithubObject):
return status == 204
def merge(self, commit_message=github.GithubObject.NotSet):
"""
:calls: `PUT /repos/:user/:repo/pulls/:number/merge <http://developer.github.com/v3/todo>`_
:param commit_message: string
:rtype: :class:`github.PullRequestMergeStatus.PullRequestMergeStatus`
"""
assert commit_message is github.GithubObject.NotSet or isinstance(commit_message, (str, unicode)), commit_message
post_parameters = dict()
if commit_message is not github.GithubObject.NotSet:
+46
View File
@@ -19,62 +19,103 @@ import github.NamedUser
class PullRequestComment(github.GithubObject.GithubObject):
"""
This class represents PullRequestComments as returned for example by http://developer.github.com/v3/todo
"""
@property
def body(self):
"""
:type: string
"""
self._completeIfNotSet(self._body)
return self._NoneIfNotSet(self._body)
@property
def commit_id(self):
"""
:type: string
"""
self._completeIfNotSet(self._commit_id)
return self._NoneIfNotSet(self._commit_id)
@property
def created_at(self):
"""
:type: datetime.datetime
"""
self._completeIfNotSet(self._created_at)
return self._NoneIfNotSet(self._created_at)
@property
def id(self):
"""
:type: integer
"""
self._completeIfNotSet(self._id)
return self._NoneIfNotSet(self._id)
@property
def original_commit_id(self):
"""
:type: string
"""
self._completeIfNotSet(self._original_commit_id)
return self._NoneIfNotSet(self._original_commit_id)
@property
def original_position(self):
"""
:type: integer
"""
self._completeIfNotSet(self._original_position)
return self._NoneIfNotSet(self._original_position)
@property
def path(self):
"""
:type: string
"""
self._completeIfNotSet(self._path)
return self._NoneIfNotSet(self._path)
@property
def position(self):
"""
:type: integer
"""
self._completeIfNotSet(self._position)
return self._NoneIfNotSet(self._position)
@property
def updated_at(self):
"""
:type: datetime.datetime
"""
self._completeIfNotSet(self._updated_at)
return self._NoneIfNotSet(self._updated_at)
@property
def url(self):
"""
:type: string
"""
self._completeIfNotSet(self._url)
return self._NoneIfNotSet(self._url)
@property
def user(self):
"""
:type: :class:`github.NamedUser.NamedUser`
"""
self._completeIfNotSet(self._user)
return self._NoneIfNotSet(self._user)
def delete(self):
"""
:calls: `DELETE /repos/:user/:repo/pulls/comments/:number <http://developer.github.com/v3/todo>`_
:rtype: None
"""
headers, data = self._requester.requestAndCheck(
"DELETE",
self.url,
@@ -83,6 +124,11 @@ class PullRequestComment(github.GithubObject.GithubObject):
)
def edit(self, body):
"""
:calls: `PATCH /repos/:user/:repo/pulls/comments/:number <http://developer.github.com/v3/todo>`_
:param body: string
:rtype: None
"""
assert isinstance(body, (str, unicode)), body
post_parameters = {
"body": body,
+13
View File
@@ -17,16 +17,29 @@ import github.GithubObject
class PullRequestMergeStatus(github.GithubObject.BasicGithubObject):
"""
This class represents PullRequestMergeStatuss as returned for example by http://developer.github.com/v3/todo
"""
@property
def merged(self):
"""
:type: bool
"""
return self._NoneIfNotSet(self._merged)
@property
def message(self):
"""
:type: string
"""
return self._NoneIfNotSet(self._message)
@property
def sha(self):
"""
:type: string
"""
return self._NoneIfNotSet(self._sha)
def _initAttributes(self):
+19
View File
@@ -20,24 +20,43 @@ import github.NamedUser
class PullRequestPart(github.GithubObject.BasicGithubObject):
"""
This class represents PullRequestParts as returned for example by http://developer.github.com/v3/todo
"""
@property
def label(self):
"""
:type: string
"""
return self._NoneIfNotSet(self._label)
@property
def ref(self):
"""
:type: string
"""
return self._NoneIfNotSet(self._ref)
@property
def repo(self):
"""
:type: :class:`github.Repository.Repository`
"""
return self._NoneIfNotSet(self._repo)
@property
def sha(self):
"""
:type: string
"""
return self._NoneIfNotSet(self._sha)
@property
def user(self):
"""
:type: :class:`github.NamedUser.NamedUser`
"""
return self._NoneIfNotSet(self._user)
def _initAttributes(self):
File diff suppressed because it is too large Load Diff
+29
View File
@@ -17,6 +17,10 @@ import github.GithubObject
class RepositoryKey(github.GithubObject.GithubObject):
"""
This class represents RepositoryKeys as returned for example by http://developer.github.com/v3/todo
"""
def __init__(self, requester, attributes, completed, repoUrl):
github.GithubObject.GithubObject.__init__(self, requester, attributes, completed)
self.__repoUrl = repoUrl
@@ -27,30 +31,49 @@ class RepositoryKey(github.GithubObject.GithubObject):
@property
def id(self):
"""
:type: integer
"""
self._completeIfNotSet(self._id)
return self._NoneIfNotSet(self._id)
@property
def key(self):
"""
:type: string
"""
self._completeIfNotSet(self._key)
return self._NoneIfNotSet(self._key)
@property
def title(self):
"""
:type: string
"""
self._completeIfNotSet(self._title)
return self._NoneIfNotSet(self._title)
@property
def url(self):
"""
:type: string
"""
self._completeIfNotSet(self._url)
return self._NoneIfNotSet(self._url)
@property
def verified(self):
"""
:type: bool
"""
self._completeIfNotSet(self._verified)
return self._NoneIfNotSet(self._verified)
def delete(self):
"""
:calls: `DELETE /repos/:user/:repo/keys/:id <http://developer.github.com/v3/todo>`_
:rtype: None
"""
headers, data = self._requester.requestAndCheck(
"DELETE",
self.__customUrl,
@@ -59,6 +82,12 @@ class RepositoryKey(github.GithubObject.GithubObject):
)
def edit(self, title=github.GithubObject.NotSet, key=github.GithubObject.NotSet):
"""
:calls: `PATCH /repos/:user/:repo/keys/:id <http://developer.github.com/v3/todo>`_
:param title: string
:param key: string
:rtype: None
"""
assert title is github.GithubObject.NotSet or isinstance(title, (str, unicode)), title
assert key is github.GithubObject.NotSet or isinstance(key, (str, unicode)), key
post_parameters = dict()
+16
View File
@@ -19,20 +19,36 @@ import github.Commit
class Tag(github.GithubObject.BasicGithubObject):
"""
This class represents Tags as returned for example by http://developer.github.com/v3/todo
"""
@property
def commit(self):
"""
:type: :class:`github.Commit.Commit`
"""
return self._NoneIfNotSet(self._commit)
@property
def name(self):
"""
:type: string
"""
return self._NoneIfNotSet(self._name)
@property
def tarball_url(self):
"""
:type: string
"""
return self._NoneIfNotSet(self._tarball_url)
@property
def zipball_url(self):
"""
:type: string
"""
return self._NoneIfNotSet(self._zipball_url)
def _initAttributes(self):
+70
View File
@@ -21,37 +21,64 @@ import github.NamedUser
class Team(github.GithubObject.GithubObject):
"""
This class represents Teams as returned for example by http://developer.github.com/v3/todo
"""
@property
def id(self):
"""
:type: integer
"""
self._completeIfNotSet(self._id)
return self._NoneIfNotSet(self._id)
@property
def members_count(self):
"""
:type: integer
"""
self._completeIfNotSet(self._members_count)
return self._NoneIfNotSet(self._members_count)
@property
def name(self):
"""
:type: string
"""
self._completeIfNotSet(self._name)
return self._NoneIfNotSet(self._name)
@property
def permission(self):
"""
:type: string
"""
self._completeIfNotSet(self._permission)
return self._NoneIfNotSet(self._permission)
@property
def repos_count(self):
"""
:type: integer
"""
self._completeIfNotSet(self._repos_count)
return self._NoneIfNotSet(self._repos_count)
@property
def url(self):
"""
:type: string
"""
self._completeIfNotSet(self._url)
return self._NoneIfNotSet(self._url)
def add_to_members(self, member):
"""
:calls: `PUT /teams/:id/members/:user <http://developer.github.com/v3/todo>`_
:param member: :class:`github.NamedUser.NamedUser`
:rtype: None
"""
assert isinstance(member, github.NamedUser.NamedUser), member
headers, data = self._requester.requestAndCheck(
"PUT",
@@ -61,6 +88,11 @@ class Team(github.GithubObject.GithubObject):
)
def add_to_repos(self, repo):
"""
:calls: `PUT /teams/:id/repos/:user/:repo <http://developer.github.com/v3/todo>`_
:param repo: :class:`github.Repository.Repository`
:rtype: None
"""
assert isinstance(repo, github.Repository.Repository), repo
headers, data = self._requester.requestAndCheck(
"PUT",
@@ -70,6 +102,10 @@ class Team(github.GithubObject.GithubObject):
)
def delete(self):
"""
:calls: `DELETE /teams/:id <http://developer.github.com/v3/todo>`_
:rtype: None
"""
headers, data = self._requester.requestAndCheck(
"DELETE",
self.url,
@@ -78,6 +114,12 @@ class Team(github.GithubObject.GithubObject):
)
def edit(self, name, permission=github.GithubObject.NotSet):
"""
:calls: `PATCH /teams/:id <http://developer.github.com/v3/todo>`_
:param name: string
:param permission: string
:rtype: None
"""
assert isinstance(name, (str, unicode)), name
assert permission is github.GithubObject.NotSet or isinstance(permission, (str, unicode)), permission
post_parameters = {
@@ -94,6 +136,10 @@ class Team(github.GithubObject.GithubObject):
self._useAttributes(data)
def get_members(self):
"""
:calls: `GET /teams/:id/members <http://developer.github.com/v3/todo>`_
:rtype: :class:`github.PaginatedList.PaginatedList` of :class:`github.NamedUser.NamedUser`
"""
return github.PaginatedList.PaginatedList(
github.NamedUser.NamedUser,
self._requester,
@@ -102,6 +148,10 @@ class Team(github.GithubObject.GithubObject):
)
def get_repos(self):
"""
:calls: `GET /teams/:id/repos <http://developer.github.com/v3/todo>`_
:rtype: :class:`github.PaginatedList.PaginatedList` of :class:`github.Repository.Repository`
"""
return github.PaginatedList.PaginatedList(
github.Repository.Repository,
self._requester,
@@ -110,6 +160,11 @@ class Team(github.GithubObject.GithubObject):
)
def has_in_members(self, member):
"""
:calls: `GET /teams/:id/members/:user <http://developer.github.com/v3/todo>`_
:param member: :class:`github.NamedUser.NamedUser`
:rtype: bool
"""
assert isinstance(member, github.NamedUser.NamedUser), member
status, headers, data = self._requester.requestRaw(
"GET",
@@ -120,6 +175,11 @@ class Team(github.GithubObject.GithubObject):
return status == 204
def has_in_repos(self, repo):
"""
:calls: `GET /teams/:id/repos/:user/:repo <http://developer.github.com/v3/todo>`_
:param repo: :class:`github.Repository.Repository`
:rtype: bool
"""
assert isinstance(repo, github.Repository.Repository), repo
status, headers, data = self._requester.requestRaw(
"GET",
@@ -130,6 +190,11 @@ class Team(github.GithubObject.GithubObject):
return status == 204
def remove_from_members(self, member):
"""
:calls: `DELETE /teams/:id/members/:user <http://developer.github.com/v3/todo>`_
:param member: :class:`github.NamedUser.NamedUser`
:rtype: None
"""
assert isinstance(member, github.NamedUser.NamedUser), member
headers, data = self._requester.requestAndCheck(
"DELETE",
@@ -139,6 +204,11 @@ class Team(github.GithubObject.GithubObject):
)
def remove_from_repos(self, repo):
"""
:calls: `DELETE /teams/:id/repos/:user/:repo <http://developer.github.com/v3/todo>`_
:param repo: :class:`github.Repository.Repository`
:rtype: None
"""
assert isinstance(repo, github.Repository.Repository), repo
headers, data = self._requester.requestAndCheck(
"DELETE",
+29
View File
@@ -17,32 +17,55 @@ import github.GithubObject
class UserKey(github.GithubObject.GithubObject):
"""
This class represents UserKeys as returned for example by http://developer.github.com/v3/todo
"""
@property
def id(self):
"""
:type: integer
"""
self._completeIfNotSet(self._id)
return self._NoneIfNotSet(self._id)
@property
def key(self):
"""
:type: string
"""
self._completeIfNotSet(self._key)
return self._NoneIfNotSet(self._key)
@property
def title(self):
"""
:type: string
"""
self._completeIfNotSet(self._title)
return self._NoneIfNotSet(self._title)
@property
def url(self):
"""
:type: string
"""
self._completeIfNotSet(self._url)
return self._NoneIfNotSet(self._url)
@property
def verified(self):
"""
:type: bool
"""
self._completeIfNotSet(self._verified)
return self._NoneIfNotSet(self._verified)
def delete(self):
"""
:calls: `DELETE /user/keys/:id <http://developer.github.com/v3/todo>`_
:rtype: None
"""
headers, data = self._requester.requestAndCheck(
"DELETE",
self.url,
@@ -51,6 +74,12 @@ class UserKey(github.GithubObject.GithubObject):
)
def edit(self, title=github.GithubObject.NotSet, key=github.GithubObject.NotSet):
"""
:calls: `PATCH /user/keys/:id <http://developer.github.com/v3/todo>`_
:param title: string
:param key: string
:rtype: None
"""
assert title is github.GithubObject.NotSet or isinstance(title, (str, unicode)), title
assert key is github.GithubObject.NotSet or isinstance(key, (str, unicode)), key
post_parameters = dict()