mirror of
https://github.com/status-im/PyGithub.git
synced 2026-08-31 19:01:15 +00:00
23 KiB
23 KiB
You don't normaly create instances of any class but Github.
You obtain instances through calls to get_ and create_ methods.
Class Github
- Constructed from user's login and password or OAuth token
get_user():AuthenticatedUserget_user( login ):NamedUserget_organization( login ):Organizationget_gist( id ):Gistget_gists(): list ofGistrate_limiting: tuple of two integers: remaining and limit, as explained in Rate Limiting
Class AuthenticatedUser
Attributes
avatar_url: stringbio: stringblog: stringcollaborators: integercompany: stringcreated_at: stringdisk_usage: integeremail: stringfollowers: integerfollowing: integergravatar_id: stringhireable: boolhtml_url: stringid: integerlocation: stringlogin: stringname: stringowned_private_repos: integerplan:Planprivate_gists: integerpublic_gists: integerpublic_repos: integertotal_private_repos: integertype: stringurl: string
Authorizations
create_authorization( [scopes, note, note_url] ):Authorizationscopesnotenote_url
get_authorization( id ):Authorizationid
get_authorizations(): list ofAuthorization
Emails
add_to_emails( email, ... )email: string
get_emails(): list of stringremove_from_emails( email, ... )email: string
Events
get_events(): list ofEventget_organization_events( org ): list ofEventorg:Organization
Followers
get_followers(): list ofNamedUser
Following
add_to_following( following )following:NamedUser
get_following(): list ofNamedUserhas_in_following( following ): boolfollowing:NamedUser
remove_from_following( following )following:NamedUser
Forking
create_fork( repo ):Repositoryrepo:Repository
Gists
create_gist( public, files, [description] ):Gistpublic: boolfilesdescription: string
get_gists(): list ofGistget_starred_gists(): list ofGist
Issues
get_issues(): list ofIssue
Keys
create_key( title, key ):UserKeytitlekey
get_key( id ):UserKeyid
get_keys(): list ofUserKey
Modification
edit( [name, email, blog, company, location, hireable, bio] )name: stringemail: stringblog: stringcompany: stringlocation: stringhireable: boolbio: string
Orgs
get_orgs(): list ofOrganization
Repos
create_repo( name, [description, homepage, private, has_issues, has_wiki, has_downloads] ):Repositoryname: stringdescription: stringhomepage: stringprivate: boolhas_issues: boolhas_wiki: boolhas_downloads: bool
get_repo( name ):Repositoryname: string
get_repos( [type] ): list ofRepositorytype
Watched
add_to_watched( watched )watched:Repository
get_watched(): list ofRepositoryhas_in_watched( watched ): boolwatched:Repository
remove_from_watched( watched )watched:Repository
Class Authorization
Attributes
appcreated_at: stringid: integernote: stringnote_url: stringscopes: list of stringtoken: stringupdated_at: stringurl: string
Deletion
delete()
Modification
edit( [scopes, add_scopes, remove_scopes, note, note_url] )scopesadd_scopesremove_scopesnotenote_url
Class Branch
Attributes
commit:Commitname: string
Class Commit
Attributes
author:NamedUsercommit:GitCommitcommitter:NamedUserfiles: list ofCommitFileparents: list ofCommitsha: stringstats:CommitStatsurl: string
Comments
create_comment( body, [line, path, position] ):CommitCommentbodylinepathposition
get_comments(): list ofCommitComment
Class CommitComment
Attributes
body: stringcommit_id: stringcreated_at: stringhtml_url: stringid: integerline: integerpath: stringposition: integerupdated_at: stringurl: stringuser:NamedUser
Deletion
delete()
Modification
edit( body )body
Class CommitFile
Attributes
additions: integerblob_url: stringchanges: integerdeletions: integerfilename: stringpatch: stringraw_url: stringsha: stringstatus: string
Class CommitStats
Attributes
additions: integerdeletions: integertotal: integer
Class Download
Attributes
accesskeyid: stringacl: stringbucket: stringcontent_type: stringcreated_at: stringdescription: stringdownload_count: integerexpirationdate: stringhtml_url: stringid: integermime_type: stringname: stringpath: stringpolicy: stringprefix: stringredirect: bools3_url: stringsignature: stringsize: integerurl: string
Deletion
delete()
Class Event
Attributes
actor:NamedUsercreated_at: stringid: stringorg:Organizationpayloadpublic: boolrepo:Repositorytype: string
Class Gist
Attributes
comments: integercreated_at: stringdescription: stringfilesfork_of:Gistforks: list ofGistgit_pull_url: stringgit_push_url: stringhistory: list ofGistHistoryStatehtml_url: stringid: stringpublic: boolupdated_at: stringurl: stringuser:NamedUser
Comments
create_comment( body ):GistCommentbody
get_comment( id ):GistCommentid
get_comments(): list ofGistComment
Deletion
delete()
Forking
create_fork():Gist
Modification
edit( [description, files] )description: stringfiles
Starring
is_starred(): boolreset_starred()set_starred()
Class GistComment
Attributes
body: stringcreated_at: stringid: integerupdated_at: stringurl: stringuser:NamedUser
Deletion
delete()
Modification
edit( body )body
Class GistHistoryState
Attributes
change_status:CommitStatscommitted_at: stringurl: stringuser:NamedUserversion: string
Class GitAuthor
Attributes
date: stringemail: stringname: string
Class GitBlob
Attributes
content: stringencoding: stringsha: stringsize: integerurl: string
Class GitCommit
Attributes
author:GitAuthorcommitter:GitAuthormessage: stringparents: list ofGitCommitsha: stringtree:GitTreeurl: string
Class GitObject
Attributes
sha: stringtype: stringurl: string
Class GitRef
Attributes
object:GitObjectref: stringurl: string
Deletion
delete()
Modification
edit( sha, [force] )shaforce
Class GitTag
Attributes
message: stringobject:GitObjectsha: stringtag: stringtagger:GitAuthorurl: string
Class GitTree
Attributes
sha: stringtree: list ofGitTreeElementurl: string
Class GitTreeElement
Attributes
mode: stringpath: stringsha: stringsize: integertype: stringurl: string
Class Hook
Attributes
active: boolconfigcreated_at: stringevents: list of stringid: integerlast_responsename: stringupdated_at: stringurl: string
Deletion
delete()
Modification
edit( name, config, [events, add_events, remove_events, active] )nameconfigeventsadd_eventsremove_eventsactive
Testing
test()
Class Issue
Attributes
assignee:NamedUserbody: stringclosed_at: stringclosed_by:NamedUsercomments: integercreated_at: stringhtml_url: stringid: integerlabels: list ofLabelmilestone:Milestonenumber: integerpull_requestrepository:Repositorystate: stringtitle: stringupdated_at: stringurl: stringuser:NamedUser
Comments
create_comment( body ):IssueCommentbody: string
get_comment( id ):IssueCommentid
get_comments(): list ofIssueComment
Events
get_events(): list ofIssueEvent
Labels
add_to_labels( label, ... )label:Label
delete_labels()get_labels(): list ofLabelremove_from_labels( label )label:Label
set_labels( label, ... )label:Label
Modification
edit( [title, body, assignee, state, milestone, labels] )titlebodyassigneestatemilestonelabels
Class IssueComment
Attributes
body: stringcreated_at: stringid: integerupdated_at: stringurl: stringuser:NamedUser
Deletion
delete()
Modification
edit( body )body
Class IssueEvent
Attributes
actor:NamedUsercommit_id: stringcreated_at: stringevent: stringid: integerissue:Issueurl: string
Class Label
Attributes
color: stringname: stringurl: string
Deletion
delete()
Modification
edit( name, color )namecolor
Class Milestone
Attributes
closed_issues: integercreated_at: stringcreator:NamedUserdescription: stringdue_on: stringid: integernumber: integeropen_issues: integerstate: stringtitle: stringurl: string
Deletion
delete()
Labels
get_labels(): list ofLabel
Modification
edit( title, [state, description, due_on] )titlestatedescriptiondue_on
Class NamedUser
Attributes
avatar_url: stringbio: stringblog: stringcollaborators: integercompany: stringcontributions: integercreated_at: stringdisk_usage: integeremail: stringfollowers: integerfollowing: integergravatar_id: stringhireable: boolhtml_url: stringid: integerlocation: stringlogin: stringname: stringowned_private_repos: integerplan:Planprivate_gists: integerpublic_gists: integerpublic_repos: integertotal_private_repos: integertype: stringurl: string
Events
get_events(): list ofEventget_public_events(): list ofEventget_received_events(): list ofEventget_public_received_events(): list ofEvent
Followers
get_followers(): list ofNamedUser
Following
get_following(): list ofNamedUser
Gists
create_gist( public, files, [description] ):Gistpublic: boolfilesdescription: string
get_gists(): list ofGist
Orgs
get_orgs(): list ofOrganization
Repos
get_repo( name ):Repositoryname: string
get_repos( [type] ): list ofRepositorytype
Watched
get_watched(): list ofRepository
Class Organization
Attributes
avatar_url: stringbilling_email: stringblog: stringcollaborators: integercompany: stringcreated_at: stringdisk_usage: integeremail: stringfollowers: integerfollowing: integergravatar_id: stringhtml_url: stringid: integerlocation: stringlogin: stringname: stringowned_private_repos: integerplan:Planprivate_gists: integerpublic_gists: integerpublic_repos: integertotal_private_repos: integertype: stringurl: string
Events
get_events(): list ofEvent
Forking
create_fork( repo ):Repositoryrepo:Repository
Members
get_members(): list ofNamedUserhas_in_members( member ): boolmember:NamedUser
remove_from_members( member )member:NamedUser
Modification
edit( [billing_email, blog, company, email, location, name] )billing_emailblogcompanyemaillocationname
Public_members
add_to_public_members( public_member )public_member:NamedUser
get_public_members(): list ofNamedUserhas_in_public_members( public_member ): boolpublic_member:NamedUser
remove_from_public_members( public_member )public_member:NamedUser
Repos
create_repo( name, [description, homepage, private, has_issues, has_wiki, has_downloads, team_id] ):Repositoryname: stringdescription: stringhomepage: stringprivate: boolhas_issues: boolhas_wiki: boolhas_downloads: boolteam_id
get_repo( name ):Repositoryname: string
get_repos( [type] ): list ofRepositorytype
Teams
create_team( name, [repo_names, permission] ):Teamname: stringrepo_names: list of stringpermission
get_team( id ):Teamid: integer
get_teams(): list ofTeam
Class Permissions
Attributes
admin: boolpull: boolpush: bool
Class Plan
Attributes
collaborators: integername: stringprivate_repos: integerspace: integer
Class PullRequest
Attributes
additions: integerbasebody: stringchanged_files: integerclosed_at: stringcomments: integercommits: integercreated_at: stringdeletions: integerdiff_url: stringheadhtml_url: stringid: integerissue_url: stringmergeable: boolmerged: boolmerged_at: stringmerged_by:NamedUsernumber: integerpatch_url: stringreview_comments: integerstate: stringtitle: stringupdated_at: stringurl: stringuser:NamedUser
Comments
create_comment( body, commit_id, path, position ):PullRequestCommentbodycommit_idpathposition
get_comment( id ):PullRequestCommentid
get_comments(): list ofPullRequestComment
Commits
get_commits(): list ofCommit
Files
get_files(): list ofPullRequestFile
Merging
is_merged(): boolmerge( [commit_message] )commit_message: string
Modification
edit( [title, body, state] )titlebodystate
Class PullRequestComment
Attributes
body: stringcommit_id: stringcreated_at: stringid: integeroriginal_commit_id: stringoriginal_position: integerpath: stringposition: integerupdated_at: stringurl: stringuser:NamedUser
Deletion
delete()
Modification
edit( body )body
Class PullRequestFile
Attributes
additions: integerblob_url: stringchanges: integerdeletions: integerfilename: stringpatch: stringraw_url: stringsha: stringstatus: string
Class Repository
Attributes
clone_url: stringcreated_at: stringdescription: stringfork: boolforks: integerfull_name: stringgit_url: stringhas_downloads: boolhas_issues: boolhas_wiki: boolhomepage: stringhtml_url: stringid: integerlanguage: stringmaster_branch: stringname: stringopen_issues: integerorganization:Organizationowner:NamedUserparent:Repositorypermissions:Permissionsprivate: boolpushed_at: stringsize: integersource:Repositoryssh_url: stringsvn_url: stringupdated_at: stringurl: stringwatchers: integer
Comparison
compare( base, head )basehead
Branches
get_branches(): list ofBranch
Collaborators
add_to_collaborators( collaborator )collaborator:NamedUser
get_collaborators(): list ofNamedUserhas_in_collaborators( collaborator ): boolcollaborator:NamedUser
remove_from_collaborators( collaborator )collaborator:NamedUser
Comments
get_comment( id ):CommitCommentid: integer
get_comments(): list ofCommitComment
Commits
get_commit( sha ):Commitsha: string
get_commits( [sha, path] ): list ofCommitsha: stringpath: string
Contributors
get_contributors(): list ofNamedUser
Downloads
create_download( name, size, [description, content_type] ):Downloadname: stringsize: integerdescription: stringcontent_type: string
get_download( id ):Downloadid: integer
get_downloads(): list ofDownload
Events
get_events(): list ofEventget_network_events(): list ofEvent
Forks
get_forks(): list ofRepository
Git_blobs
create_git_blob( content, encoding ):GitBlobcontent: stringencoding: string
get_git_blob( sha ):GitBlobsha: string
Git_commits
create_git_commit( message, tree, parents, [author, committer] ):GitCommitmessage: stringtreeparents: list ofGitCommitauthorcommitter
get_git_commit( sha ):GitCommitsha: string
Git_refs
create_git_ref( ref, sha ):GitRefref: stringsha: string
get_git_ref( ref ):GitRefref: string
get_git_refs(): list ofGitRef
Git_tags
create_git_tag( tag, message, object, type, [tagger] ):GitTagtag: stringmessage: stringobject: stringtype: stringtagger
get_git_tag( sha ):GitTagsha: string
Git_trees
create_git_tree( tree, [base_tree] ):GitTreetreebase_tree
get_git_tree( sha, [recursive] ):GitTreesha: stringrecursive: bool
Hooks
create_hook( name, config, [events, active] ):Hookname: stringconfigevents: list of stringactive: bool
get_hook( id ):Hookid: integer
get_hooks(): list ofHook
Issues
create_issue( title, [body, assignee, milestone, labels] ):Issuetitle: stringbody: stringassignee: stringmilestone: integerlabels: list of string
get_issue( number ):Issuenumber: integer
get_issues( [milestone, state, assignee, mentioned, labels, sort, direction, since] ): list ofIssuemilestone: integerstate: stringassignee: stringmentioned: stringlabels: list of stringsort: stringdirection: stringsince: string
Issues_events
get_issues_event( id ):IssueEventid: integer
get_issues_events(): list ofIssueEvent
Keys
create_key( title, key ):RepositoryKeytitle: stringkey: string
get_key( id ):RepositoryKeyid: integer
get_keys(): list ofRepositoryKey
Labels
create_label( name, color ):Labelname: stringcolor: string
get_label( name ):Labelname: string
get_labels(): list ofLabel
Languages
get_languages()
Milestones
create_milestone( title, [state, description, due_on] ):Milestonetitle: stringstate: stringdescription: stringdue_on: string
get_milestone( number ):Milestonenumber: integer
get_milestones( [state, sort, direction] ): list ofMilestonestate: stringsort: stringdirection: string
Modification
edit( name, [description, homepage, public, has_issues, has_wiki, has_downloads] )name: stringdescription: stringhomepage: stringpublic: boolhas_issues: boolhas_wiki: boolhas_downloads: bool
Pulls
create_pull( < title, body, base, head > or < issue, base, head > ):PullRequesttitle: stringbody: stringissue: integerbasehead
get_pull( number ):PullRequestnumber: integer
get_pulls( [state] ): list ofPullRequeststate: string
Tags
get_tags(): list ofTag
Teams
get_teams(): list ofTeam
Watchers
get_watchers(): list ofNamedUser
Class RepositoryKey
Attributes
id: integerkey: stringtitle: stringurl: stringverified: bool
Deletion
delete()
Modification
edit( [title, key] )title: stringkey: string
Class Tag
Attributes
commit:Commitname: stringtarball_url: stringzipball_url: string
Class Team
Attributes
id: integermembers_count: integername: stringpermission: stringrepos_count: integerurl: string
Deletion
delete()
Members
add_to_members( member )member:NamedUser
get_members(): list ofNamedUserhas_in_members( member ): boolmember:NamedUser
remove_from_members( member )member:NamedUser
Modification
edit( name, [permission] )namepermission
Repos
add_to_repos( repo )repo:Repository
get_repos(): list ofRepositoryhas_in_repos( repo ): boolrepo:Repository
remove_from_repos( repo )repo:Repository
Class UserKey
Attributes
id: integerkey: stringtitle: stringurl: stringverified: bool
Deletion
delete()
Modification
edit( [title, key] )titlekey