Teams

Extends 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
since

1.0

package

Joomla Framework

Methods

__construct

Constructor.

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

1.0

Arguments

options

\Joomla\Registry\RegistryGitHub options object.

client

\Joomla\Http\HttpThe HTTP client object.

Response

mixed

__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(int 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

intThe team id.

user

stringThe name of the user.

Response

object

addRepo

Add or update team repository.

addRepo(int 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

intThe 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(int 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

intThe 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(int id, string owner, string repo) : bool
since

1.0

throws

\UnexpectedValueException

Arguments

id

intThe team id.

owner

stringThe owner of the GitHub repository.

repo

stringThe name of the GitHub repository.

Response

bool

create

Create team.

create(string org, string name, array repoNames = [], 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(int 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

intThe team id.

Response

object

edit

Edit team.

edit(int 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

intThe 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, int page, int limit) : \Joomla\Uri\Uri
inherited
since

1.0

Arguments

path

stringURL to inflect

page

intPage to request

limit

intNumber of results to return per page

Response

\Joomla\Uri\Uri

get

Get team.

get(int id) : object
since

1.0

Arguments

id

intThe 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(int 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

intThe team id.

Response

object

getListRepos

List team repos.

getListRepos(int id) : object
since

1.0

Arguments

id

intThe team id.

Response

object

getTeamMembership

Get team membership

getTeamMembership(int id, string user) : string|bool

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

intThe team id.

user

stringThe name of the user.

Response

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

getUserTeams

List user teams.

getUserTeams(int page, int 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

intThe page number from which to get items.

limit

intThe number of items on a page.

Response

object

isMember

Get team member.

isMember(int id, string user) : bool
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

intThe team id.

user

stringThe name of the user.

Response

bool

processResponse

Process the response and decode it.

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

1.0

throws

\Joomla\Http\Exception\UnexpectedResponseException

Arguments

response

\Joomla\Http\ResponseThe response.

expectedCode

intThe expected "good" code.

Response

mixed

removeMember

Remove team member.

removeMember(int 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

intThe team id.

user

stringThe name of the user.

Response

object

removeRepo

Remove team repository.

removeRepo(int 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

intThe 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(int 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

intThe 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\Http\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
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