Teams
Extends AbstractPackageGitHub 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
since |
1.0 |
---|
Arguments
- options
\Joomla\Registry\Registry
GitHub options object.- client
\Joomla\Http\Http
The HTTP client object.
Response
mixed
__get
Magic method to lazily create API objects
__get(string name) : \Joomla\Github\AbstractPackage
since |
1.0 |
---|---|
throws |
|
Arguments
- name
string
Name of property to retrieve
Response
\Joomla\Github\AbstractPackage
GitHub API package object.
addMember
Add team member.
addMember(int id, string user) : object
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
int
The team id.- user
string
The 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
int
The team id.- org
string
The name of the organization of the GitHub repository.- repo
string
The 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 |
|
Arguments
- id
int
The team id.- user
string
The name of the user.- role
string
The 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 |
|
Arguments
- id
int
The team id.- owner
string
The owner of the GitHub repository.- repo
string
The 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 |
|
Arguments
- org
string
The name of the organization.- name
string
The name of the team.- repoNames
array
Repository names.- permission
string
The 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
int
The 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 |
|
Arguments
- id
int
The team id.- name
string
The name of the team.- permission
string
The 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
since |
1.0 |
---|
Arguments
- path
string
URL to inflect- page
int
Page to request- limit
int
Number of results to return per page
Response
\Joomla\Uri\Uri
get
Get team.
get(int id) : object
since |
1.0 |
---|
Arguments
- id
int
The team id.
Response
object
getList
List teams.
getList(string org) : object
since |
1.0 |
---|
Arguments
- org
string
The 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
int
The team id.
Response
object
getListRepos
List team repos.
getListRepos(int id) : object
since |
1.0 |
---|
Arguments
- id
int
The 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 |
|
Arguments
- id
int
The team id.- user
string
The name of the user.
Response
string|bool
The 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
int
The page number from which to get items.- limit
int
The number of items on a page.
Response
object
isMember
Get team member.
isMember(int id, string user) : bool
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 |
|
deprecated |
Use getTeamMembership() instead |
Arguments
- id
int
The team id.- user
string
The name of the user.
Response
bool
processResponse
Process the response and decode it.
processResponse(\Joomla\Http\Response response, int expectedCode = 200) : mixed
since |
1.0 |
---|---|
throws |
|
Arguments
- response
\Joomla\Http\Response
The response.- expectedCode
int
The expected "good" code.
Response
mixed
removeMember
Remove team member.
removeMember(int id, string user) : object
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
int
The team id.- user
string
The 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
int
The team id.- owner
string
The name of the owner of the GitHub repository.- repo
string
The 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 |
|
Arguments
- id
int
The team id.- user
string
The name of the user.
Response
object
Properties
options
Options for the GitHub object.
since |
1.0 |
---|
Type(s)
\Joomla\Registry\Registry
client
The HTTP client object to use in sending HTTP requests.
since |
1.0 |
---|
Type(s)
\Joomla\Http\Http
package
The package the object resides in
since |
1.0 |
---|
Type(s)
string
hookEvents
Array containing the allowed hook events
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