mirror of
https://github.com/status-im/PyGithub.git
synced 2026-08-31 19:01:15 +00:00
66 lines
2.7 KiB
Python
66 lines
2.7 KiB
Python
from GithubObject import *
|
|
|
|
AuthenticatedUser = GithubObject(
|
|
"AuthenticatedUser",
|
|
BaseUrl( lambda obj: "/user" ),
|
|
SimpleScalarAttributes(
|
|
"login", "id", "avatar_url", "gravatar_id", "url", "name", "company",
|
|
"blog", "location", "email", "hireable", "bio", "public_repos",
|
|
"public_gists", "followers", "following", "html_url", "created_at",
|
|
"type", "total_private_repos", "owned_private_repos", "private_gists",
|
|
"disk_usage", "collaborators", "plan",
|
|
),
|
|
)
|
|
|
|
NamedUser = GithubObject(
|
|
"NamedUser",
|
|
BaseUrl( lambda obj: "/users/" + obj.login ),
|
|
SimpleScalarAttributes(
|
|
"login", "id", "avatar_url", "gravatar_id", "url", "name", "company",
|
|
"blog", "location", "email", "hireable", "bio", "public_repos",
|
|
"public_gists", "followers", "following", "html_url", "created_at",
|
|
"type",
|
|
),
|
|
)
|
|
|
|
Organization = GithubObject(
|
|
"Organization",
|
|
BaseUrl( lambda obj: "/orgs/" + obj.login ),
|
|
SimpleScalarAttributes(
|
|
"login", "id", "url", "avatar_url", "name", "company", "blog",
|
|
"location", "email", "public_repos", "public_gists", "followers",
|
|
"following", "html_url", "created_at", "type",
|
|
# Seen only by owners
|
|
"disk_usage", "collaborators", "billing_email", "plan", "private_gists",
|
|
"total_private_repos", "owned_private_repos",
|
|
),
|
|
ExtendedListAttribute( "public_members", NamedUser ),
|
|
ExtendedListAttribute( "members", NamedUser ),
|
|
)
|
|
|
|
AuthenticatedUser._addAttributePolicy( ExtendedListAttribute( "orgs", Organization ) )
|
|
NamedUser._addAttributePolicy( ExtendedListAttribute( "orgs", Organization ) )
|
|
|
|
Repository = GithubObject(
|
|
"Repository",
|
|
BaseUrl( lambda obj: "/repos/" + obj.owner.login + "/" + obj.name ),
|
|
SimpleScalarAttributes(
|
|
"url", "html_url", "clone_url", "git_url", "ssh_url", "svn_url",
|
|
"name", "description", "homepage", "language", "private",
|
|
"fork", "forks", "watchers", "size", "master_branch", "open_issues",
|
|
"pushed_at", "created_at", "organization",
|
|
"has_issues", "has_wiki", "has_downloads",
|
|
# Not documented
|
|
"mirror_url", "updated_at", "id",
|
|
),
|
|
ExtendedScalarAttribute( "owner", NamedUser ),
|
|
)
|
|
Repository._addAttributePolicy( ExtendedScalarAttribute( "parent", Repository ) )
|
|
Repository._addAttributePolicy( ExtendedScalarAttribute( "source", Repository ) )
|
|
|
|
AuthenticatedUser._addAttributePolicy( ExtendedListAttribute( "repos", Repository ) )
|
|
AuthenticatedUser._addAttributePolicy( ExtendedListAttribute( "watched", Repository ) )
|
|
|
|
NamedUser._addAttributePolicy( ExtendedListAttribute( "repos", Repository ) )
|
|
NamedUser._addAttributePolicy( ExtendedListAttribute( "watched", Repository ) )
|