A API de eventos pode retornar diferentes tipos de eventos acionados por atividades no GitHub. Cada resposta ao evento contém propriedades compartilhadas, mas tem um objeto de carga
único, determinado pelo seu tipo de evento. As propriedades comuns do objeto de evento descrevem as propriedades compartilhadas por todos os eventos, e cada tipo de evento descreve as propriedades da carga
que são únicas para o evento específico.
Propriedades comuns do objeto de evento
Os objetos de evento retornados dos pontos de extremidade da API de eventos têm a mesma estrutura.
Nome do atributo da API do evento | Descrição |
---|---|
id | Identificador exclusivo do evento. |
tipo | O tipo de evento. Os eventos usam PascalCase para o nome. |
actor | O usuário que acionou o evento. |
actor.id | O identificador único para o ator. |
actor.login | O nome de usuário do ator. |
actor.display_login | O formato de exibição específico do nome de usuário. |
actor.gravatar_id | O identificador único do perfil Gravatar para o ator. |
actor.url | A URL da API REST usada para recuperar o objeto do usuário, que inclui informações adicionais sobre o usuário. |
actor.avatar_url | A URL da imagem do perfil do ator. |
repo | O objeto de repositório onde ocorreu o evento. |
repo.id | O identificador único do repositório. |
repo.name | O nome do repositório, que inclui o proprietário e o nome do repositório. Por exemplo, octocat/hello-world é o nome do repositório hello-world que pertence à conta de usuário octocat . |
repo.url | A URL da API REST usada para recuperar o objeto do repositório, que inclui informações adicionais do repositório. |
carga | O objeto da carga de eventos é único para o tipo de evento. Veja o tipo de evento abaixo para o objeto da carga da API de eventos. |
Exemplo de objeto de evento WatchEvent
Este exemplo mostra o formato da resposta do WatchEvent ao usar a API de eventos.
Status: 200 OK
Link: <https://api.github.com/resource?page=2>; rel="next",
<https://api.github.com/resource?page=5>; rel="last"
[
{
"type": "WatchEvent",
"public": true,
"payload": {
},
"repo": {
"id": 3,
"name": "octocat/Hello-World",
"url": "https://api.github.com/repos/octocat/Hello-World"
},
"actor": {
"id": 1,
"login": "octocat",
"gravatar_id": "",
"avatar_url": "https://github.com/images/error/octocat_happy.gif",
"url": "https://api.github.com/users/octocat"
},
"org": {
"id": 1,
"login": "github",
"gravatar_id": "",
"url": "https://api.github.com/orgs/github",
"avatar_url": "https://github.com/images/error/octocat_happy.gif"
},
"created_at": "2011-09-06T17:26:27Z",
"id": "12345"
}
]
CommitCommentEvent
A commit comment is created. The type of activity is specified in the action
property of the payload object. For more information, see the "commit comment" REST API.
The event object includes properties that are common for all events. Each event object includes a payload
property and the value is unique to each event type. The payload
object for this event is described below.
Objeto da carga
do evento
Tecla | Tipo | Descrição |
---|---|---|
Ação | string | The action performed. Can be created . |
comentário | objeto | The commit comment resource. |
CreateEvent
A Git branch or tag is created. For more information, see the "Git data" REST API.
The event object includes properties that are common for all events. Each event object includes a payload
property and the value is unique to each event type. The payload
object for this event is described below.
Objeto da carga
do evento
Tecla | Tipo | Descrição |
---|---|---|
ref | string | The git ref resource. |
ref_type | string | The type of Git ref object created in the repository. Can be either branch or tag . |
master_branch | string | The name of the repository's default branch (usually master ). |
descrição | string | The repository's current description. |
DeleteEvent
A Git branch or tag is deleted. For more information, see the "Git data" REST API.
The event object includes properties that are common for all events. Each event object includes a payload
property and the value is unique to each event type. The payload
object for this event is described below.
Objeto da carga
do evento
Tecla | Tipo | Descrição |
---|---|---|
ref | string | The git ref resource. |
ref_type | string | The type of Git ref oject deleted in the repository. Can be branch or tag . |
ForkEvent
A user forks a repository. For more information, see the "forks" REST API.
The event object includes properties that are common for all events. Each event object includes a payload
property and the value is unique to each event type. The payload
object for this event is described below.
Objeto da carga
do evento
Tecla | Tipo | Descrição |
---|---|---|
forkee | objeto | The created repository resource. |
GollumEvent
A wiki page is created or updated. For more information, see the "About wikis".
The event object includes properties that are common for all events. Each event object includes a payload
property and the value is unique to each event type. The payload
object for this event is described below.
Objeto da carga
do evento
Tecla | Tipo | Descrição |
---|---|---|
Páginas | array | The pages that were updated. |
pages[][page_name] | string | The name of the page. |
pages[][title] | string | The current page title. |
pages[][action] | string | The action that was performed on the page. Can be created or edited . |
pages[][sha] | string | The latest commit SHA of the page. |
pages[][html_url] | string | Points to the HTML wiki page. |
IssueCommentEvent
Activity related to an issue comment. The type of activity is specified in the action
property of the payload object. For more information, see the "issue comments" REST API.
The event object includes properties that are common for all events. Each event object includes a payload
property and the value is unique to each event type. The payload
object for this event is described below.
Objeto da carga
do evento
Tecla | Tipo | Descrição |
---|---|---|
Ação | string | The action that was performed on the comment. Can be one of created , edited , or deleted . |
changes | object | The changes to the comment if the action was edited . changes[body][from] |
IssuesEvent
Activity related to an issue. The type of activity is specified in the action
property of the payload object. For more information, see the "issues" REST API.
The event object includes properties that are common for all events. Each event object includes a payload
property and the value is unique to each event type. The payload
object for this event is described below.
Objeto da carga
do evento
Tecla | Tipo | Descrição |
---|---|---|
Ação | string | A ação que foi executada. Can be one of opened , closed , reopened , assigned , unassigned , labeled , or unlabeled . |
issue | object | The issue itself. changes |
MemberEvent
Activity related to repository collaborators. The type of activity is specified in the action
property of the payload object. For more information, see the "collaborators" REST API.
The event object includes properties that are common for all events. Each event object includes a payload
property and the value is unique to each event type. The payload
object for this event is described below.
Objeto da carga
do evento
Tecla | Tipo | Descrição |
---|---|---|
Ação | string | A ação que foi executada. Can be added to indicate a user accepted an invitation to a repository. |
member | object | The user that was added. changes |
PublicEvent
When a private repository is made public. Without a doubt: the best GitHub Enterprise event.
Objeto da carga
do evento
Este evento retorna um objeto de carga
vazio.
PullRequestEvent
Activity related to pull requests. The type of activity is specified in the action
property of the payload object. For more information, see the "pull requests" REST API.
The event object includes properties that are common for all events. Each event object includes a payload
property and the value is unique to each event type. The payload
object for this event is described below.
Objeto da carga
do evento
Tecla | Tipo | Descrição |
---|---|---|
Ação | string | A ação que foi executada. Can be one of opened , closed , reopened , assigned , unassigned , review_requested , review_request_removed , labeled , unlabeled , and synchronize . |
number | integer | The pull request number. changes |
PullRequestReviewCommentEvent
Activity related to pull request review comments in the pull request's unified diff. The type of activity is specified in the action
property of the payload object. For more information, see the "pull request review comments" REST API.
The event object includes properties that are common for all events. Each event object includes a payload
property and the value is unique to each event type. The payload
object for this event is described below.
Objeto da carga
do evento
Tecla | Tipo | Descrição |
---|---|---|
Ação | string | The action that was performed on the comment. Can be created . |
changes | object | The changes to the comment if the action was edited . changes[body][from] |
PushEvent
One or more commits are pushed to a repository branch or tag.
The event object includes properties that are common for all events. Each event object includes a payload
property and the value is unique to each event type. The payload
object for this event is described below.
Tecla | Tipo | Descrição |
---|---|---|
push_id | inteiro | Identificador único para o push. |
size | inteiro | O número de commits no push. |
distinct_size | inteiro | O número de commits distintos no push. |
ref | string | O git ref completo que foi carregado. Exemplo: refs/heads/master . |
head | string | O SHA do último commit no ref após o push. |
antes | string | O SHA do último commit em ref antes do push. |
commits | array | Um array de objetos de commit, que descreve os commits carregados. (O array inclui um máximo de 20 commits. Se necessário, você poderá usar a API de commits para recuperar commits adicionais. Este limite é aplicado apenas aos eventos da linha do tempo e não é aplicado às entregas do webhook.) |
commits[][sha] | string | O SHA do commit. |
commits[][message] | string | A mensagem do commit. |
commits[][author] | objeto | O autor do git do commit. |
commits[][author][name] | string | O nome do autor do git. |
commits[][author][email] | string | O endereço de e-mail do autor do git. |
commits[][url] | url | URL que aponta para o recurso de commit de API. |
commits[][distinct] | boolean | Se este compromisso é diferente de qualquer outro que tenha sido carregado anteriormente. |
ReleaseEvent
Activity related to a release. The type of activity is specified in the action
property of the payload object. For more information, see the "releases" REST API.
The event object includes properties that are common for all events. Each event object includes a payload
property and the value is unique to each event type. The payload
object for this event is described below.
Objeto da carga
do evento
Tecla | Tipo | Descrição |
---|---|---|
Ação | string | A ação que foi executada. Can be published . |
changes[body][from] | string | The previous version of the body if the action was edited . changes[name][from] |
WatchEvent
When someone stars a repository. The type of activity is specified in the action
property of the payload object. For more information, see the "starring" REST API.
The event object includes properties that are common for all events. Each event object includes a payload
property and the value is unique to each event type. The payload
object for this event is described below.
Objeto da carga
do evento
Tecla | Tipo | Descrição |
---|---|---|
Ação | string | A ação que foi executada. Currently, can only be started . |