Os usuários interagem com repositórios comentando, abrindo problemas e criando pull requests. As APIs de interações permitem que pessoas com acesso de proprietário ou administrador restrinjam temporariamente certos usuários de interagir com repositórios públicos.
organização
A API de Interações da Organização permite que os proprietários da organização restrinjam temporariamente quais usuários podem comentar, abrir problemas ou criar pull requests nos repositórios públicos da organização. Quando as restrições são ativadas, apenas o grupo especificado de GitHub os usuários serão capazes de participar de interações. As restrições expiram 24 horas a partir do momento que são estabelecidas. Veja mais sobre os grupos de usuários do 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 na organização. -
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 na organização. -
Colaboradores apenas: quando você limitar as interações para
collaborators_only, os usuários que não forem colaboradores ficarão temporariamente restritos na organização.Get interaction restrictions for an organization
Shows which type of GitHub user can interact with this organization and when the restriction expires. If there is no restrictions, you will see an empty response.
get /orgs/{org}/interaction-limitsParâmetros
Name Type In Description acceptstring header Setting to
application/vnd.github.v3+jsonis recommended.orgstring path Amostras de código
Shell
curl \ -H "Accept: application/vnd.github.v3+json" \ https://api.github.com/orgs/ORG/interaction-limitsJavaScript (@octokit/core.js)
await octokit.request('GET /orgs/{org}/interaction-limits', { org: 'org' })Default response
Status: 200 OK{ "limit": "collaborators_only", "origin": "organization", "expires_at": "2018-08-17T04:18:39Z" }Notes
Set interaction restrictions for an organization
Temporarily restricts interactions to a certain type of GitHub user in any public repository in the given organization. You must be an organization owner to set these restrictions. Setting the interaction limit at the organization level will overwrite any interaction limits that are set for individual repositories owned by the organization.
put /orgs/{org}/interaction-limitsParâmetros
Name Type In Description acceptstring header Setting to
application/vnd.github.v3+jsonis recommended.orgstring path limitstring body Required. The type of GitHub user that can comment, open issues, or create pull requests while the interaction limit is in effect. Can be one of:
existing_users,contributors_only,collaborators_only.expirystring body The duration of the interaction restriction. Can be one of:
one_day,three_days,one_week,one_month,six_months. Default:one_day.Amostras de código
Shell
curl \ -X PUT \ -H "Accept: application/vnd.github.v3+json" \ https://api.github.com/orgs/ORG/interaction-limits \ -d '{"limit":"limit"}'JavaScript (@octokit/core.js)
await octokit.request('PUT /orgs/{org}/interaction-limits', { org: 'org', limit: 'limit' })Default response
Status: 200 OK{ "limit": "collaborators_only", "origin": "organization", "expires_at": "2018-08-17T04:18:39Z" }Validation failed
Status: 422 Unprocessable EntityNotes
Remove interaction restrictions for an organization
Removes all interaction restrictions from public repositories in the given organization. You must be an organization owner to remove restrictions.
delete /orgs/{org}/interaction-limitsParâmetros
Name Type In Description acceptstring header Setting to
application/vnd.github.v3+jsonis recommended.orgstring path Amostras de código
Shell
curl \ -X DELETE \ -H "Accept: application/vnd.github.v3+json" \ https://api.github.com/orgs/ORG/interaction-limitsJavaScript (@octokit/core.js)
await octokit.request('DELETE /orgs/{org}/interaction-limits', { org: 'org' })Default Response
Status: 204 No ContentNotes
Repositório
A API de Interações do Repositório permite que pessoas com acesso de proprietário ou administrador restrinjam temporariamente quais usuários podem comentar, abrir problemas ou criar pull requests em um repositório público. Quando as restrições são ativadas, apenas o grupo especificado de GitHub os usuários serão capazes de participar de interações. As restrições expiram 24 horas a partir do momento que são estabelecidas. Veja mais sobre os grupos de usuários do 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.
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.
get /repos/{owner}/{repo}/interaction-limits
Parâmetros
| Name | Type | In | Description |
|---|---|---|---|
accept |
string | header |
Setting to |
owner |
string | path | |
repo |
string | path |
Amostras de código
Shell
curl \
-H "Accept: application/vnd.github.v3+json" \
https://api.github.com/repos/octocat/hello-world/interaction-limits
JavaScript (@octokit/core.js)
await octokit.request('GET /repos/{owner}/{repo}/interaction-limits', {
owner: 'octocat',
repo: 'hello-world'
})
Default response
Status: 200 OK
{
"limit": "collaborators_only",
"origin": "repository",
"expires_at": "2018-08-17T04:18:39Z"
}
Notes
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.
put /repos/{owner}/{repo}/interaction-limits
Parâmetros
| Name | Type | In | Description |
|---|---|---|---|
accept |
string | header |
Setting to |
owner |
string | path | |
repo |
string | path | |
limit |
string | body |
Required. The type of GitHub user that can comment, open issues, or create pull requests while the interaction limit is in effect. Can be one of: |
expiry |
string | body |
The duration of the interaction restriction. Can be one of: |
Amostras de código
Shell
curl \
-X PUT \
-H "Accept: application/vnd.github.v3+json" \
https://api.github.com/repos/octocat/hello-world/interaction-limits \
-d '{"limit":"limit"}'
JavaScript (@octokit/core.js)
await octokit.request('PUT /repos/{owner}/{repo}/interaction-limits', {
owner: 'octocat',
repo: 'hello-world',
limit: 'limit'
})
Default response
Status: 200 OK
{
"limit": "collaborators_only",
"origin": "repository",
"expires_at": "2018-08-17T04:18:39Z"
}
Conflict
Status: 409 Conflict
Notes
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.
delete /repos/{owner}/{repo}/interaction-limits
Parâmetros
| Name | Type | In | Description |
|---|---|---|---|
accept |
string | header |
Setting to |
owner |
string | path | |
repo |
string | path |
Amostras de código
Shell
curl \
-X DELETE \
-H "Accept: application/vnd.github.v3+json" \
https://api.github.com/repos/octocat/hello-world/interaction-limits
JavaScript (@octokit/core.js)
await octokit.request('DELETE /repos/{owner}/{repo}/interaction-limits', {
owner: 'octocat',
repo: 'hello-world'
})
Default Response
Status: 204 No Content
Conflict
Status: 409 Conflict