Interações do repositório
A API de Interações do repositório permite que pessoas com acesso de proprietário ou administrador restrinjam temporariamente qual tipo de usuário pode comentar, abrir problemas ou criar pull requests em um repositório público.
Sobre a API de interações do repositório
A API de Interações do repositório permite que pessoas com acesso de proprietário ou administrador restrinjam temporariamente qual tipo de usuário pode comentar, abrir problemas ou criar pull requests em um repositório público. Quando as restrições são habilitadas, apenas o tipo especificado de usuário de GitHub poderá participar das interações. As restrições expiram automaticamente após uma duração definida. Veja mais sobre os tipos de usuários de GitHub:
- Usuários existentes: Quando você limitar as interações para
existing_users
, novos usuários com contas com menos de 24 horas de idade, que não tenham contribuído anteriormente e que não sejam colaboradores, estarão temporariamente restritos in the respository. - Colaboradores apenas: quando você limitar as interações para
contributors_only
, usuários que não contribuíram anteriormente e não são colaboradores serão temporariamente restritos in the respository. - Colaboradores apenas: quando você limitar as interações para
collaborators_only
, os usuários que não forem colaboradores ficarão temporariamente restritos in the respository.
Se um limite de interação for habilitado para o usuário ou organização proprietária do repositório, o limite não poderá ser alterado para o repositório individual. Em vez disso, use os pontos de extremidade de Usuário ou Organização para alterar o limite de interação.
Get interaction restrictions for a repository
Shows which type of GitHub user can interact with this repository and when the restriction expires. If there are no restrictions, you will see an empty response.
Parâmetros
Headers |
---|
Nome, Tipo, Descrição |
accept stringSetting to |
Path parameters |
Nome, Tipo, Descrição |
owner stringObrigatórioThe account owner of the repository. The name is not case sensitive. |
repo stringObrigatórioThe name of the repository. The name is not case sensitive. |
HTTP response status codes
Status code | Descrição |
---|---|
200 | OK |
Amostras de código
curl \
-H "Accept: application/vnd.github+json" \
-H "Authorization: token <TOKEN>" \
https://api.github.com/repos/OWNER/REPO/interaction-limits
Response
Status: 200
{
"limit": "collaborators_only",
"origin": "repository",
"expires_at": "2018-08-17T04:18:39Z"
}
Set interaction restrictions for a repository
Temporarily restricts interactions to a certain type of GitHub user within the given repository. You must have owner or admin access to set these restrictions. If an interaction limit is set for the user or organization that owns this repository, you will receive a 409 Conflict
response and will not be able to use this endpoint to change the interaction limit for a single repository.
Parâmetros
Headers |
---|
Nome, Tipo, Descrição |
accept stringSetting to |
Path parameters |
Nome, Tipo, Descrição |
owner stringObrigatórioThe account owner of the repository. The name is not case sensitive. |
repo stringObrigatórioThe name of the repository. The name is not case sensitive. |
Body parameters |
Nome, Tipo, Descrição |
limit stringObrigatórioThe type of GitHub user that can comment, open issues, or create pull requests while the interaction limit is in effect. Pode ser uma das ações a seguir: |
expiry stringThe duration of the interaction restriction. Default: Pode ser uma das ações a seguir: |
HTTP response status codes
Status code | Descrição |
---|---|
200 | OK |
409 | Conflict |
Amostras de código
curl \
-X PUT \
-H "Accept: application/vnd.github+json" \
-H "Authorization: token <TOKEN>" \
https://api.github.com/repos/OWNER/REPO/interaction-limits
Response
Status: 200
{
"limit": "collaborators_only",
"origin": "repository",
"expires_at": "2018-08-17T04:18:39Z"
}
Remove interaction restrictions for a repository
Removes all interaction restrictions from the given repository. You must have owner or admin access to remove restrictions. If the interaction limit is set for the user or organization that owns this repository, you will receive a 409 Conflict
response and will not be able to use this endpoint to change the interaction limit for a single repository.
Parâmetros
Headers |
---|
Nome, Tipo, Descrição |
accept stringSetting to |
Path parameters |
Nome, Tipo, Descrição |
owner stringObrigatórioThe account owner of the repository. The name is not case sensitive. |
repo stringObrigatórioThe name of the repository. The name is not case sensitive. |
HTTP response status codes
Status code | Descrição |
---|---|
204 | No Content |
409 | Conflict |
Amostras de código
curl \
-X DELETE \
-H "Accept: application/vnd.github+json" \
-H "Authorization: token <TOKEN>" \
https://api.github.com/repos/OWNER/REPO/interaction-limits
Response
Status: 204