AuthenticatedUser

class github.AuthenticatedUser.AuthenticatedUser

This class represents AuthenticatedUsers as returned by https://docs.github.com/en/rest/reference/users#get-the-authenticated-user

An AuthenticatedUser object can be created by calling get_user() on a Github object.

The OpenAPI schema can be found at

  • /components/schemas/private-user

  • /components/schemas/public-user

A CompletableGithubObject can be partially initialised (completed=False). Accessing attributes that are not initialized will then trigger a request to complete all attributes.

A partially initialized CompletableGithubObject (completed=False) can be completed via complete(). This requires the url to be given via parameter url or attributes.

With a requester where Requester.is_lazy == True, this CompletableGithubObjects is partially initialized. This requires the url to be given via parameter url or attributes. Any CompletableGithubObject created from this lazy object will be lazy itself if created with parameter url or attributes.

Parameters:
  • requester – requester

  • headers – response headers

  • attributes – attributes to initialize

  • completed – do not update non-initialized attributes when True

  • url – url of this instance, overrides attributes[‘url’]

  • accept – use this accept header when completing this instance

add_to_emails(*emails: str) None
Calls:

POST /user/emails

add_to_following(following: NamedUser) None
Calls:

PUT /user/following/{username}

add_to_starred(starred: Repository) None
Calls:

PUT /user/starred/{owner}/{repo}

add_to_subscriptions(subscription: Repository) None
Calls:

PUT /user/subscriptions/{owner}/{repo}

add_to_watched(watched: Repository) None
Calls:

PUT /repos/{owner}/{repo}/subscription

create_authorization(scopes: Opt[list[str]] = NotSet, note: Opt[str] = NotSet, note_url: Opt[str] = NotSet, client_id: Opt[str] = NotSet, client_secret: Opt[str] = NotSet, onetime_password: str | None = None) Authorization
Calls:

POST /authorizations

static create_fork(repo: Repository, name: Opt[str] = NotSet, default_branch_only: Opt[bool] = NotSet) Repository
Calls:

POST /repos/{owner}/{repo}/forks

create_repo_from_template(name: str, repo: Repository, description: Opt[str] = NotSet, include_all_branches: Opt[bool] = NotSet, private: Opt[bool] = NotSet) Repository
Calls:

POST /repos/{template_owner}/{template_repo}/generate

create_gist(public: bool, files: dict[str, InputFileContent], description: Opt[str] = NotSet) Gist
Calls:

POST /gists

create_key(title: str, key: str) UserKey
Calls:

POST /user/keys

Parameters:
  • title – string

  • key – string

Return type:

github.UserKey.UserKey

create_project(name: str, body: Opt[str] = NotSet) Project
Calls:

POST /user/projects

Parameters:
  • name – string

  • body – string

Return type:

github.Project.Project

create_repo(name: str, description: Opt[str] = NotSet, homepage: Opt[str] = NotSet, private: Opt[bool] = NotSet, has_issues: Opt[bool] = NotSet, has_wiki: Opt[bool] = NotSet, has_downloads: Opt[bool] = NotSet, has_projects: Opt[bool] = NotSet, has_discussions: Opt[bool] = NotSet, auto_init: Opt[bool] = NotSet, license_template: Opt[str] = NotSet, gitignore_template: Opt[str] = NotSet, allow_squash_merge: Opt[bool] = NotSet, allow_merge_commit: Opt[bool] = NotSet, allow_rebase_merge: Opt[bool] = NotSet, delete_branch_on_merge: Opt[bool] = NotSet) Repository
Calls:

POST /user/repos

edit(name: str | _NotSetType = NotSet, email: str | _NotSetType = NotSet, blog: str | _NotSetType = NotSet, company: str | _NotSetType = NotSet, location: str | _NotSetType = NotSet, hireable: bool | _NotSetType = NotSet, bio: str | _NotSetType = NotSet) None
Calls:

PATCH /user

get_authorization(id: int) Authorization
Calls:

GET /authorizations/{id}

get_authorizations() PaginatedList[Authorization]
Calls:

GET /authorizations

get_emails() list[EmailData]
Calls:

GET /user/emails

get_events() PaginatedList[Event]
Calls:

GET /events

get_followers() PaginatedList[NamedUser]
Calls:

GET /user/followers

get_following() PaginatedList[NamedUser]
Calls:

GET /user/following

get_gists(since: Opt[datetime] = NotSet) PaginatedList[Gist]
Calls:

GET /gists

Parameters:

since – datetime format YYYY-MM-DDTHH:MM:SSZ

Return type:

PaginatedList of github.Gist.Gist

get_issues(filter: Opt[str] = NotSet, state: Opt[str] = NotSet, labels: Opt[list[Label]] = NotSet, sort: Opt[str] = NotSet, direction: Opt[str] = NotSet, since: Opt[datetime] = NotSet) PaginatedList[Issue]
Calls:

GET /issues

get_user_issues(filter: Opt[str] = NotSet, state: Opt[str] = NotSet, labels: Opt[list[Label]] = NotSet, sort: Opt[str] = NotSet, direction: Opt[str] = NotSet, since: Opt[datetime] = NotSet) PaginatedList[Issue]
Calls:

GET /user/issues

get_key(id: int) UserKey
Calls:

GET /user/keys/{key_id}

get_keys() PaginatedList[UserKey]
Calls:

GET /user/keys

get_notification(id: str) Notification
Calls:

GET /notifications/threads/{thread_id}

get_notifications(all: Opt[bool] = NotSet, participating: Opt[bool] = NotSet, since: Opt[datetime] = NotSet, before: Opt[datetime] = NotSet) PaginatedList[Notification]
Calls:

GET /notifications

get_organization_events(org: Organization) PaginatedList[Event]
Calls:

GET /users/{username}/events/orgs/{org}

get_orgs() PaginatedList[Organization]
Calls:

GET /user/orgs

get_repo(name: str) Repository
Calls:

GET /repos/{owner}/{repo}

get_repos(visibility: Opt[str] = NotSet, affiliation: Opt[str] = NotSet, type: Opt[str] = NotSet, sort: Opt[str] = NotSet, direction: Opt[str] = NotSet) PaginatedList[Repository]
Calls:

GET /user/repos

get_starred() PaginatedList[Repository]
Calls:

GET /user/starred

get_starred_gists() PaginatedList[Gist]
Calls:

GET /gists/starred

get_subscriptions() PaginatedList[Repository]
Calls:

GET /user/subscriptions

get_teams() PaginatedList[Team]
Calls:

GET /user/teams

get_watched() PaginatedList[Repository]
Calls:

GET /user/subscriptions

get_installations() PaginatedList[Installation]
Calls:

GET /user/installations

has_in_following(following: NamedUser) bool
Calls:

GET /user/following/{username}

has_in_starred(starred: Repository) bool
Calls:

GET /user/starred/{owner}/{repo}

has_in_subscriptions(subscription: Repository) bool
Calls:

GET /user/subscriptions/{owner}/{repo}

has_in_watched(watched: Repository) bool
Calls:

GET /repos/{owner}/{repo}/subscription

mark_notifications_as_read(last_read_at: datetime | None = None) None
Calls:

PUT /notifications

remove_from_emails(*emails: str) None
Calls:

DELETE /user/emails

remove_from_following(following: NamedUser) None
Calls:

DELETE /user/following/{username}

remove_from_starred(starred: Repository) None
Calls:

DELETE /user/starred/{owner}/{repo}

remove_from_subscriptions(subscription: Repository) None
Calls:

DELETE /user/subscriptions/{owner}/{repo}

remove_from_watched(watched: Repository) None
Calls:

DELETE /repos/{owner}/{repo}/subscription

accept_invitation(invitation: Invitation | int) None
Calls:

PATCH /user/repository_invitations/{invitation_id}

get_invitations() PaginatedList[Invitation]
Calls:

GET /user/repository_invitations

create_migration(repos: list[Repository] | tuple[Repository], lock_repositories: Opt[bool] = NotSet, exclude_attachments: Opt[bool] = NotSet) Migration
Calls:

POST /user/migrations

get_migrations() PaginatedList[Migration]
Calls:

GET /user/migrations

get_organization_memberships() PaginatedList[Membership]
Calls:

GET /user/memberships/orgs

get_organization_membership(org: str) Membership
Calls:

GET /user/memberships/orgs/{org}