class Issue(BaseData): """Issue container.""" position = Attribute("The position of this issue in a list.") number = Attribute("The issue number (unique for project).") votes = Attribute("Number of votes for this issue.") body = Attribute("The full description for this issue.") title = Attribute("Issue title.") user = Attribute("The username of the user that created this issue.") state = Attribute("State of this issue. Can be ``open`` or ``closed``.") labels = Attribute("Labels associated with this issue.") created_at = DateAttribute("The date this issue was created.") closed_at = DateAttribute("The date this issue was closed.") updated_at = DateAttribute("The date when this issue was last updated.") diff_url = Attribute("URL for diff output associated with this issue.") patch_url = Attribute("URL for format-patch associated with this issue.") pull_request_url = Attribute("URL for the issue's related pull request.") def __repr__(self): return "<Issue: %s>" % repr_string(self.title)
class Commit(BaseData): message = Attribute("Commit message.") parents = Attribute("List of parents for this commit.") url = Attribute("Canonical URL for this commit.") author = Attribute("Author metadata (dict with name/email.)") id = Attribute("Commit ID.") committed_date = DateAttribute("Date committed.", format="commit") authored_date = DateAttribute("Date authored.", format="commit") tree = Attribute("Tree SHA for this commit.") committer = Attribute("Comitter metadata (dict with name/email.)") added = Attribute("(If present) Datastructure representing what's been " "added since last commit.") removed = Attribute("(if present) Datastructure representing what's been " "removed since last commit.") modified = Attribute("(If present) Datastructure representing what's " "been modified since last commit.") def __repr__(self): return "<Commit: %s %s>" % (self.id, self.message[:64])
class PullRequest(BaseData): """Pull request container. .. versionadded:: 0.5.0 """ state = Attribute("The pull request state") base = Attribute("The base repo") head = Attribute("The head of the pull request") issue_user = Attribute("The user who created the pull request.") user = Attribute("The owner of the repo.") title = Attribute("The text of the pull request title.") body = Attribute("The text of the body.") position = Attribute("Floating point position of the pull request.") number = Attribute("Number of this request.") votes = Attribute("Number of votes for this request.") comments = Attribute("Number of comments made on this request.") diff_url = Attribute("The URL to the unified diff.") patch_url = Attribute("The URL to the downloadable patch.") labels = Attribute("A list of labels attached to the pull request.") html_url = Attribute("The URL to the pull request.") issue_created_at = DateAttribute("The date the issue for this pull " "request was opened.", format='iso') issue_updated_at = DateAttribute("The date the issue for this pull " "request was last updated.", format='iso') created_at = DateAttribute("The date when this pull request was created.", format='iso') updated_at = DateAttribute("The date when this pull request was last " "updated.", format='iso') closed_at = DateAttribute("The date when this pull request was closed", format='iso') discussion = Attribute("Discussion thread for the pull request.") mergeable = Attribute("Whether the pull request can be merge cleanly") def __repr__(self): return "<PullRequest: %s>" % repr_string(self.title)
class Repository(BaseData): name = Attribute("Name of repository.") description = Attribute("Repository description.") forks = Attribute("Number of forks of this repository.") watchers = Attribute("Number of people watching this repository.") private = Attribute("If True, the repository is private.") url = Attribute("Canonical URL to this repository") fork = Attribute("If True, this is a fork of another repository.") owner = Attribute("Username of the user owning this repository.") homepage = Attribute("Homepage for this project.") open_issues = Attribute("List of open issues for this repository.") created_at = DateAttribute("Datetime the repository was created.") pushed_at = DateAttribute("Datetime of the last push to this repository") has_downloads = Attribute("If True, this repository has downloads.") has_wiki = Attribute("If True, this repository has a wiki.") has_issues = Attribute("If True, this repository has an issue tracker.") def _project(self): return self.owner + "/" + self.name project = property(_project) def __repr__(self): return "<Repository: %s>" % (self._project())
class User(BaseData): """GitHub user container.""" id = Attribute("The user id") login = Attribute("The login username") name = Attribute("The users full name") company = Attribute("Name of the company the user is associated with") location = Attribute("Location of the user") email = Attribute("The users e-mail address") blog = Attribute("The users blog") following_count = Attribute("Number of other users the user is following") followers_count = Attribute("Number of users following this user") public_gist_count = Attribute( "Number of active public gists owned by the user") public_repo_count = Attribute( "Number of active repositories owned by the user") total_private_repo_count = Attribute("Number of private repositories") collaborators = Attribute("Number of collaborators") disk_usage = Attribute("Currently used disk space") owned_private_repo_count = Attribute("Number of privately owned repos") private_gist_count = Attribute( "Number of private gists owned by the user") plan = Attribute("Current active github plan") created_at = DateAttribute("The date this user was registered", format="user") def is_authenticated(self): """Test for user authentication. :return bool: ``True`` if user is authenticated """ return self.plan is not None def __repr__(self): return "<User: %s>" % self.login