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) : 
inherited
since

1.0

Arguments

options

Registry|nullGitHub options object.

client

Http|nullThe HTTP client object.

Response

mixed

__get

Magic method to lazily create API objects

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

1.0

throws

InvalidArgumentException

Arguments

name

stringName of property to retrieve

Response

AbstractPackageGitHub API package object.

addMember

Add team member.

addMember( id,  user) : 
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( id,  org,  repo) : 

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( id,  user,  role = 'member') : 

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( id,  owner,  repo) : 
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( org,  name, mixed||string|int repoNames = [],  permission = '') : 

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

array<string|int, mixed>Repository 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( id) : 

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( id,  name,  permission = '') : 

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( path,  page,  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

Uri

get

Get team.

get( id) : 
since

1.0

Arguments

id

intThe team id.

Response

object

getList

List teams.

getList( org) : 
since

1.0

Arguments

org

stringThe name of the organization.

Response

object

getListMembers

List team members.

getListMembers( id) : 

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( id) : 
since

1.0

Arguments

id

intThe team id.

Response

object

getTeamMembership

Get team membership

getTeamMembership( id,  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( page,  limit) : 

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( id,  user) : 
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,  expectedCode = 200) : 
inherited
since

1.0

throws

UnexpectedResponseException

Arguments

response

ResponseThe response.

expectedCode

intThe expected "good" code.

Response

mixed

removeMember

Remove team member.

removeMember( id,  user) : 
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( id,  owner,  repo) : 

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( id,  user) : 

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)

Registry

client

The HTTP client object to use in sending HTTP requests.

inherited
since

1.0

Type(s)

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<string|int, mixed>