Team

class github.Team.Team

This class represents Teams.

The reference can be found here https://docs.github.com/en/rest/reference/teams

The OpenAPI schema can be found at

  • /components/schemas/enterprise-team

  • /components/schemas/nullable-team-simple

  • /components/schemas/team

  • /components/schemas/team-full

  • /components/schemas/team-simple

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_members(member: NamedUser) None

This API call is deprecated. Use add_membership instead. https://docs.github.com/en/rest/reference/teams#add-or-update-team-membership-for-a-user-legacy

Calls:

PUT /teams/{team_id}/members/{username}

add_membership(member: NamedUser, role: Opt[str] = NotSet) None
Calls:

PUT /teams/{team_id}/memberships/{username}

get_team_membership(member: str | NamedUser) Membership
Calls:

GET /orgs/{org}/teams/{team_slug}/memberships/{username}

add_to_repos(repo: str | Repository) None
Calls:

PUT /teams/{team_id}/repos/{owner}/{repo}

get_repo_permission(repo: str | Repository) Permissions | None
Calls:

GET /teams/{team_id}/repos/{owner}/{repo}

set_repo_permission(repo: str | Repository, permission: str) None
Calls:

PUT /teams/{team_id}/repos/{owner}/{repo}

Parameters:
Return type:

None

update_team_repository(repo: str | Repository, permission: str) bool
Calls:

PUT /orgs/{org}/teams/{team_slug}/repos/{owner}/{repo}

delete() None
Calls:

DELETE /teams/{team_id}

edit(name: str, description: str | _NotSetType = NotSet, permission: str | _NotSetType = NotSet, privacy: str | _NotSetType = NotSet, parent_team_id: int | _NotSetType = NotSet, notification_setting: str | _NotSetType = NotSet) None
Calls:

PATCH /teams/{team_id}

get_teams() PaginatedList[Team]
Calls:

GET /teams/{team_id}/teams

get_discussions() PaginatedList[TeamDiscussion]
Calls:

GET /teams/{team_id}/discussions

get_members(role: Opt[str] = NotSet) PaginatedList[NamedUser]
Calls:

GET /teams/{team_id}/members

get_repos() PaginatedList[Repository]
Calls:

GET /teams/{team_id}/repos

invitations() PaginatedList[OrganizationInvitation]
Calls:

GET /teams/{team_id}/invitations

has_in_members(member: NamedUser) bool
Calls:

GET /teams/{team_id}/members/{username}

has_in_repos(repo: str | Repository) bool
Calls:

GET /teams/{team_id}/repos/{owner}/{repo}

remove_membership(member: NamedUser) None
Calls:

DELETE /teams/{team_id}/memberships/{username}

remove_from_members(member: NamedUser) None

This API call is deprecated. Use remove_membership instead: https://docs.github.com/en/rest/reference/teams#add-or-update-team-membership-for-a-user-legacy

Calls:

DELETE /teams/{team_id}/members/{username}

remove_from_repos(repo: str | Repository) None
Calls:

DELETE /teams/{team_id}/repos/{owner}/{repo}