Repository interactions
The Repository interactions API allows people with owner or admin access to temporarily restrict which type of user can comment, open issues, or create pull requests in a public repository.
About the Repository interactions API
La API de interacciones de repositorio permite a las personas con acceso administrativo o de propietario restringir temporalmente qué tipo de usuario puede comentar, abrir propuestas o crear solicitudes de cambios en un repositorio privado. Cuando se habilitan las restricciones, solo el tipo de usuario de GitHub que hayas especificado podrá participar en las interacciones. Las restricciones expiran automáticamente después de una duración definida. Aquí puedes aprender más sobre los tipos de usuario de GitHub:
- Usuarios existentes: Cuando limitas las interacciones a
existing_users
, se restringirá temporalmente a los usuarios nuevos con cuentas de menos de 24 horas que no hayan hecho contribuciones anteriormente y que no sean colaboradores en el repositorio. - Solo para contribuyentes: Cuando limitas las interacciones para
contributors_only
, se restringirá temporalmente a los usuarios que no hayan hecho contribuciones anteriormente y que no sean colaboradores en el repositorio. - Solo para colaboradores: Cuando limitas las interacciones para
collaborators_only
, se restringirá temporalmente a los usuarios que no sean colaboradores en el repositorio.
Si se habilita un límite de interacción para el usuario u organización a la que pertenece el repositorio, éste no podrá cambiarse para el repositorio individual. En su lugar, utiliza las terminales de interacciones de Usuario o de Organización para cambiar el límite de interacción.
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
Encabezados |
---|
Nombre, Tipo, Descripción |
accept stringSetting to |
Parámetros de ruta |
Nombre, Tipo, Descripción |
owner stringRequeridoThe account owner of the repository. The name is not case sensitive. |
repo stringRequeridoThe name of the repository. The name is not case sensitive. |
Códigos de estado de respuesta HTTP
Código de estado | Descripción |
---|---|
200 | OK |
Ejemplos de código
curl \
-H "Accept: application/vnd.github.v3+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
Encabezados |
---|
Nombre, Tipo, Descripción |
accept stringSetting to |
Parámetros de ruta |
Nombre, Tipo, Descripción |
owner stringRequeridoThe account owner of the repository. The name is not case sensitive. |
repo stringRequeridoThe name of the repository. The name is not case sensitive. |
Parámetros de cuerpo |
Nombre, Tipo, Descripción |
limit stringRequeridoThe type of GitHub user that can comment, open issues, or create pull requests while the interaction limit is in effect. Puede ser una de las siguientes: |
expiry stringThe duration of the interaction restriction. Default: Puede ser una de las siguientes: |
Códigos de estado de respuesta HTTP
Código de estado | Descripción |
---|---|
200 | OK |
409 | Conflict |
Ejemplos de código
curl \
-X PUT \
-H "Accept: application/vnd.github.v3+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
Encabezados |
---|
Nombre, Tipo, Descripción |
accept stringSetting to |
Parámetros de ruta |
Nombre, Tipo, Descripción |
owner stringRequeridoThe account owner of the repository. The name is not case sensitive. |
repo stringRequeridoThe name of the repository. The name is not case sensitive. |
Códigos de estado de respuesta HTTP
Código de estado | Descripción |
---|---|
204 | No Content |
409 | Conflict |
Ejemplos de código
curl \
-X DELETE \
-H "Accept: application/vnd.github.v3+json" \
-H "Authorization: token <TOKEN>" \
https://api.github.com/repos/OWNER/REPO/interaction-limits
Response
Status: 204