Os usuários interagem com repositórios comentando, abrindo problemas e criando pull requests. As APIs de interações permitem que as pessoas com acesso de proprietário ou administrador restrinjam temporariamente a interação com repositórios públicos para um determinado tipo de usuário.
organização
A API de Interações da Organização permite que os proprietários da organização restrinjam temporariamente quais tipos de usuário podem comentar, abrir problemas ou criar pull requests nos repositórios públicos da organização. 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 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.
Definir o limite de interação no nível da organização sobrescreverá quaisquer limites de interação definidos para repositórios individuais pertencentes à organização. Para definir diferentes limites de interação para repositórios individuais pertencentes à organização, use os pontos de extremidade das interações do Repositório.
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-limits
Parâmetros
| Name | Type | In | Description |
|---|---|---|---|
accept |
string | header |
Setting to
|
org |
string | 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'
})
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-limits
Parâmetros
| Name | Type | In | Description |
|---|---|---|---|
accept |
string | header |
Setting to
|
org |
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/orgs/ORG/interaction-limits \
-d '{"limit":"limit"}'JavaScript (@octokit/core.js)
await octokit.request('PUT /orgs/{org}/interaction-limits', {
org: 'org',
limit: 'limit'
})
Response
Status: 200 OK
{
"limit": "collaborators_only",
"origin": "organization",
"expires_at": "2018-08-17T04:18:39Z"
}
Validation failed
Status: 422 Unprocessable Entity
Notes
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-limits
Parâmetros
| Name | Type | In | Description |
|---|---|---|---|
accept |
string | header |
Setting to
|
org |
string | 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'
})
Response
Status: 204 No Content
Notes
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.
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-limitsJavaScript (@octokit/core.js)
await octokit.request('GET /repos/{owner}/{repo}/interaction-limits', {
owner: 'octocat',
repo: 'hello-world'
})
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'
})
Response
Status: 200 OK
{
"limit": "collaborators_only",
"origin": "repository",
"expires_at": "2018-08-17T04:18:39Z"
}
Response
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-limitsJavaScript (@octokit/core.js)
await octokit.request('DELETE /repos/{owner}/{repo}/interaction-limits', {
owner: 'octocat',
repo: 'hello-world'
})
Response
Status: 204 No Content
Response
Status: 409 Conflict
Notes
Usuário
A API de Interações do Usuário permite restringir temporariamente que tipo de usuário pode comentar, abrir problemas ou criar pull requests nos seus repositórios públicos. 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 de interagir com seus repositórios. - 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 de interagir com seus repositórios. - Colaboradores apenas: quando você limitar as interações para
collaborators_only, os usuários que não forem colaboradores ficarão temporariamente restritos de interagir com seus repositórios.
Definir o limite de interação no nível do usuário sobrescreverá quaisquer limites de interação definidos para repositórios individuais pertencentes ao usuário. Para definir diferentes limites de interação para repositórios individuais pertencentes ao usuário, use os pontos de extremidade das interações do Repositório.
Get interaction restrictions for your public repositories
Shows which type of GitHub user can interact with your public repositories and when the restriction expires.
get /user/interaction-limits
Amostras de código
Shell
curl \
-H "Accept: application/vnd.github.v3+json" \
https://api.github.com/user/interaction-limitsJavaScript (@octokit/core.js)
await octokit.request('GET /user/interaction-limits')
Default response
Status: 200 OK
{
"limit": "collaborators_only",
"origin": "organization",
"expires_at": "2018-08-17T04:18:39Z"
}
Response when there are no restrictions
Status: 204 No Content
Set interaction restrictions for your public repositories
Temporarily restricts which type of GitHub user can interact with your public repositories. Setting the interaction limit at the user level will overwrite any interaction limits that are set for individual repositories owned by the user.
put /user/interaction-limits
Parâmetros
| Name | Type | In | Description |
|---|---|---|---|
accept |
string | header |
Setting to
|
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/user/interaction-limits \
-d '{"limit":"limit"}'JavaScript (@octokit/core.js)
await octokit.request('PUT /user/interaction-limits', {
limit: 'limit'
})
Response
Status: 200 OK
{
"limit": "collaborators_only",
"origin": "user",
"expires_at": "2018-08-17T04:18:39Z"
}
Validation failed
Status: 422 Unprocessable Entity
Remove interaction restrictions from your public repositories
Removes any interaction restrictions from your public repositories.
delete /user/interaction-limits
Amostras de código
Shell
curl \
-X DELETE \
-H "Accept: application/vnd.github.v3+json" \
https://api.github.com/user/interaction-limitsJavaScript (@octokit/core.js)
await octokit.request('DELETE /user/interaction-limits')
Response
Status: 204 No Content