Teams

Extends \Joomla\Github\AbstractPackage

GitHub API Orgs Teams class for the Joomla Framework.

All actions against teams require at a minimum an authenticated user who is a member of the owner’s team in the :org being managed. Additionally, OAuth users require “user” scope.

link

https://developer.github.com/v3/orgs/teams/

since

1.0

Methods

__construct

Constructor.

__construct(\Joomla\Registry\Registry $options = null, \Joomla\Http\Http $client = null) 
inherited
since

1.0

Arguments

$options

\Joomla\Registry\RegistryGitHub options object.

$client

\Joomla\Http\HttpThe HTTP client object.

__get

Magic method to lazily create API objects

__get(string $name) : \Joomla\Github\AbstractPackage
inherited
since

1.0

throws

\InvalidArgumentException

Arguments

$name

stringName of property to retrieve

Response

\Joomla\Github\AbstractPackageGitHub API package object.

addMember

Add team member.

addMember(integer $id, string $user) : object
deprecated

In order to add a user to a team, the authenticated user must have ‘admin’ permissions to the team or be an owner of the org that the team is associated with.

since

1.0

deprecated

Use addTeamMembership() instead

Arguments

$id

integerThe team id.

$user

stringThe name of the user.

Response

object

addRepo

Add or update team repository.

addRepo(integer $id, string $org, string $repo) : object

In order to add a repo to a team, the authenticated user must be an owner of the org that the team is associated with. Also, the repo must be owned by the organization, or a direct form of a repo owned by the organization.

If you attempt to add a repo to a team that is not owned by the organization, you get: Status: 422 Unprocessable Entity

since

1.0

Arguments

$id

integerThe team id.

$org

stringThe name of the organization of the GitHub repository.

$repo

stringThe name of the GitHub repository.

Response

object

addTeamMembership

Add team membership

addTeamMembership(integer $id, string $user, string $role = 'member') : object

If the user is already a member of the team's organization, this endpoint will add the user to the team. In order to add a membership between an organization member and a team, the authenticated user must be an organization owner or a maintainer of the team.

since

1.4.0

throws

\UnexpectedValueException

Arguments

$id

integerThe team id.

$user

stringThe name of the user.

$role

stringThe role the user should have on the team. Can be either 'member' or 'maintainer'.

Response

object

checkRepo

Check if a team manages a repository.

checkRepo(integer $id, string $owner, string $repo) : boolean
since

1.0

throws

\UnexpectedValueException

Arguments

$id

integerThe team id.

$owner

stringThe owner of the GitHub repository.

$repo

stringThe name of the GitHub repository.

Response

boolean

create

Create team.

create(string $org, string $name, array $repoNames = array(), string $permission = '') : object

In order to create a team, the authenticated user must be an owner of the organization.

since

1.0

throws

\UnexpectedValueException

Arguments

$org

stringThe name of the organization.

$name

stringThe name of the team.

$repoNames

arrayRepository names.

$permission

stringThe permission. (Deprecated) pull - team members can pull, but not push to or administer these repositories. Default push - team members can pull and push, but not administer these repositories. admin - team members can pull, push and administer these repositories.

Response

object

delete

Delete team.

delete(integer $id) : object

In order to delete a team, the authenticated user must be an owner of the org that the team is associated with.

since

1.0

Arguments

$id

integerThe team id.

Response

object

edit

Edit team.

edit(integer $id, string $name, string $permission = '') : object

In order to edit a team, the authenticated user must be an owner of the org that the team is associated with.

since

1.0

throws

\UnexpectedValueException

Arguments

$id

integerThe team id.

$name

stringThe name of the team.

$permission

stringThe permission. (Deprecated) pull - team members can pull, but not push to or administer these repositories. Default push - team members can pull and push, but not administer these repositories. admin - team members can pull, push and administer these repositories.

Response

object

fetchUrl

Method to build and return a full request URL for the request. This method will add appropriate pagination details if necessary and also prepend the API url to have a complete URL for the request.

fetchUrl(string $path, integer $page, integer $limit) : string
inherited
since

1.0

note

As of 2.0 this method will return a Joomla\Uri\Uri object

Arguments

$path

stringURL to inflect

$page

integerPage to request

$limit

integerNumber of results to return per page

Response

stringThe request URL.

get

Get team.

get(integer $id) : object
since

1.0

Arguments

$id

integerThe team id.

Response

object

getList

List teams.

getList(string $org) : object
since

1.0

Arguments

$org

stringThe name of the organization.

Response

object

getListMembers

List team members.

getListMembers(integer $id) : object

In order to list members in a team, the authenticated user must be a member of the team.

since

1.0

Arguments

$id

integerThe team id.

Response

object

getListRepos

List team repos.

getListRepos(integer $id) : object
since

1.0

Arguments

$id

integerThe team id.

Response

object

getTeamMembership

Get team membership

getTeamMembership(integer $id, string $user) : string|boolean

In order to get a user's membership with a team, the team must be visible to the authenticated user.

since

1.4.0

throws

\UnexpectedValueException

Arguments

$id

integerThe team id.

$user

stringThe name of the user.

Response

string|booleanThe state the user's membership is in or boolean false if the user is not a member.

getUserTeams

List user teams.

getUserTeams(integer $page, integer $limit) : object

List all of the teams across all of the organizations to which the authenticated user belongs. This method requires user, repo, or read:org scope when authenticating via OAuth.

since

1.4.0

Arguments

$page

integerThe page number from which to get items.

$limit

integerThe number of items on a page.

Response

object

isMember

Get team member.

isMember(integer $id, string $user) : boolean
deprecated

In order to get if a user is a member of a team, the authenticated user must be a member of the team.

since

1.0

throws

\UnexpectedValueException

deprecated

Use getTeamMembership() instead

Arguments

$id

integerThe team id.

$user

stringThe name of the user.

Response

boolean

processResponse

Process the response and decode it.

processResponse(\Joomla\Http\Response $response, integer $expectedCode = 200) : mixed
inherited
since

1.0

throws

\Joomla\Http\Exception\UnexpectedResponseException

Arguments

$response

\Joomla\Http\ResponseThe response.

$expectedCode

integerThe expected "good" code.

Response

mixed

removeMember

Remove team member.

removeMember(integer $id, string $user) : object
deprecated

In order to remove a user from a team, the authenticated user must have ‘admin’ permissions to the team or be an owner of the org that the team is associated with. NOTE: This does not delete the user, it just remove them from the team.

since

1.0

deprecated

Use removeTeamMembership() instead

Arguments

$id

integerThe team id.

$user

stringThe name of the user.

Response

object

removeRepo

Remove team repository.

removeRepo(integer $id, string $owner, string $repo) : object

In order to remove a repo from a team, the authenticated user must be an owner of the org that the team is associated with. NOTE: This does not delete the repo, it just removes it from the team.

since

1.0

Arguments

$id

integerThe team id.

$owner

stringThe name of the owner of the GitHub repository.

$repo

stringThe name of the GitHub repository.

Response

object

removeTeamMembership

Remove team membership

removeTeamMembership(integer $id, string $user) : object

In order to remove a membership between a user and a team, the authenticated user must have 'admin' permissions to the team or be an owner of the organization that the team is associated with. NOTE: This does not delete the user, it just removes their membership from the team.

since

1.4.0

throws

\UnexpectedValueException

Arguments

$id

integerThe team id.

$user

stringThe name of the user.

Response

object

Properties

options

Options for the GitHub object.

inherited
since

1.0

Type(s)

\Joomla\Registry\Registry

client

The HTTP client object to use in sending HTTP requests.

inherited
since

1.0

Type(s)

\Joomla\Github\Http

package

The package the object resides in

inherited
since

1.0

Type(s)

string

hookEvents

Array containing the allowed hook events

inherited
since

1.5.2

link

https://developer.github.com/webhooks/#events

note

From 1.4.0 to 1.5.1 this was named $events, it was renamed due to naming conflicts with package subclasses

Type(s)

array