Events are emitted by Github Hooks.

See https://developer.github.com/v3/activity/events/types/

Introduced classes

class CommitCommentEvent

github :: CommitCommentEvent

Triggered when a commit comment is created.
class CreateEvent

github :: CreateEvent

Triggered when a repository, branch, or tag is created.
class DeleteEvent

github :: DeleteEvent

Triggered when a branch or a tag is deleted.
class DeploymentEvent

github :: DeploymentEvent

Triggered when a new snapshot is deployed.
class DeploymentStatusEvent

github :: DeploymentStatusEvent

Triggered when a deployement's status changes.
class ForkEvent

github :: ForkEvent

Triggered when a user forks a repository.
class GithubEvent

github :: GithubEvent

Github event stub.
class IssueCommentEvent

github :: IssueCommentEvent

Triggered when an issue comment is created.
class IssuesEvent

github :: IssuesEvent

Triggered when an event occurs on an issue.
class MemberEvent

github :: MemberEvent

Triggered when a user is added as a collaborator to a repository.
class PullRequestEvent

github :: PullRequestEvent

Triggered when an event occurs on a pull request.
class PullRequestPullCommentEvent

github :: PullRequestPullCommentEvent

Triggered when a comment is created on a pull request diff.
class PushEvent

github :: PushEvent

Triggered when a repository branch is pushed to.
class StatusEvent

github :: StatusEvent

Triggered when the status of a Git commit changes.

Redefined classes

redef abstract class Deserializer

github :: events $ Deserializer

Abstract deserialization service
redef class GithubDeserializer

github :: events $ GithubDeserializer

JsonDeserializer specific for Github objects.

All class definitions

class CommitCommentEvent

github $ CommitCommentEvent

Triggered when a commit comment is created.
class CreateEvent

github $ CreateEvent

Triggered when a repository, branch, or tag is created.
class DeleteEvent

github $ DeleteEvent

Triggered when a branch or a tag is deleted.
class DeploymentEvent

github $ DeploymentEvent

Triggered when a new snapshot is deployed.
class DeploymentStatusEvent

github $ DeploymentStatusEvent

Triggered when a deployement's status changes.
redef abstract class Deserializer

github :: events $ Deserializer

Abstract deserialization service
class ForkEvent

github $ ForkEvent

Triggered when a user forks a repository.
redef class GithubDeserializer

github :: events $ GithubDeserializer

JsonDeserializer specific for Github objects.
class GithubEvent

github $ GithubEvent

Github event stub.
class IssueCommentEvent

github $ IssueCommentEvent

Triggered when an issue comment is created.
class IssuesEvent

github $ IssuesEvent

Triggered when an event occurs on an issue.
class MemberEvent

github $ MemberEvent

Triggered when a user is added as a collaborator to a repository.
class PullRequestEvent

github $ PullRequestEvent

Triggered when an event occurs on a pull request.
class PullRequestPullCommentEvent

github $ PullRequestPullCommentEvent

Triggered when a comment is created on a pull request diff.
class PushEvent

github $ PushEvent

Triggered when a repository branch is pushed to.
class StatusEvent

github $ StatusEvent

Triggered when the status of a Git commit changes.
package_diagram github::events events github::api api github::events->github::api base64 base64 github::api->base64 curl curl github::api->curl json json github::api->json ...base64 ... ...base64->base64 ...curl ... ...curl->curl ...json ... ...json->json github::hooks hooks github::hooks->github::events github::loader loader github::loader->github::events a_star-m a_star-m a_star-m->github::hooks a_star-m->github::loader a_star-m... ... a_star-m...->a_star-m

Ancestors

module abstract_collection

core :: abstract_collection

Abstract collection classes and services.
module abstract_text

core :: abstract_text

Abstract class for manipulation of sequences of characters
module array

core :: array

This module introduces the standard array structure.
module base64

base64 :: base64

Offers the base 64 encoding and decoding algorithms
module bitset

core :: bitset

Services to handle BitSet
module bytes

core :: bytes

Services for byte streams and arrays
module caching

serialization :: caching

Services for caching serialization engines
module circular_array

core :: circular_array

Efficient data structure to access both end of the sequence.
module codec_base

core :: codec_base

Base for codecs to use with streams
module codecs

core :: codecs

Group module for all codec-related manipulations
module collection

core :: collection

This module define several collection classes.
module core

core :: core

Standard classes and methods used by default by Nit programs and libraries.
module curl

curl :: curl

Data transfer powered by the native curl library
module engine_tools

serialization :: engine_tools

Advanced services for serialization engines
module environ

core :: environ

Access to the environment variables of the process
module error

json :: error

Intro JsonParseError which is exposed by all JSON reading APIs
module error

core :: error

Standard error-management infrastructure.
module exec

core :: exec

Invocation and management of operating system sub-processes.
module file

core :: file

File manipulations (create, read, write, etc.)
module fixed_ints

core :: fixed_ints

Basic integers of fixed-precision
module fixed_ints_text

core :: fixed_ints_text

Text services to complement fixed_ints
module flat

core :: flat

All the array-based text representations
module gc

core :: gc

Access to the Nit internal garbage collection mechanism
module hash_collection

core :: hash_collection

Introduce HashMap and HashSet.
module inspect

serialization :: inspect

Refine Serializable::inspect to show more useful information
module iso8859_1

core :: iso8859_1

Codec for ISO8859-1 I/O
module json

json :: json

Read and write JSON formatted text using the standard serialization services
module kernel

core :: kernel

Most basic classes and methods.
module list

core :: list

This module handle double linked lists
module math

core :: math

Mathematical operations
module meta

meta :: meta

Simple user-defined meta-level to manipulate types of instances as object.
module native

core :: native

Native structures for text and bytes
module native_curl

curl :: native_curl

Binding of C libCurl which allow us to interact with network.
module numeric

core :: numeric

Advanced services for Numeric types
module parser_base

parser_base :: parser_base

Simple base for hand-made parsers of all kinds
module poset

poset :: poset

Pre order sets and partial order set (ie hierarchies)
module protocol

core :: protocol

module queue

core :: queue

Queuing data structures and wrappers
module range

core :: range

Module for range of discrete objects.
module re

core :: re

Regular expression support for all services based on Pattern
module ropes

core :: ropes

Tree-based representation of a String.
module safe

serialization :: safe

Services for safer deserialization engines
module serialization

serialization :: serialization

General serialization services
module serialization_core

serialization :: serialization_core

Abstract services to serialize Nit objects to different formats
module serialization_read

json :: serialization_read

Services to read JSON: deserialize_json and JsonDeserializer
module serialization_write

json :: serialization_write

Services to write Nit objects to JSON strings: serialize_to_json and JsonSerializer
module sorter

core :: sorter

This module contains classes used to compare things and sorts arrays.
module static

json :: static

Static interface to read Nit objects from JSON strings
module stream

core :: stream

Input and output streams of characters
module text

core :: text

All the classes and methods related to the manipulation of text entities
module time

core :: time

Management of time and dates
module union_find

core :: union_find

union–find algorithm using an efficient disjoint-set data structure
module utf8

core :: utf8

Codec for UTF-8 I/O

Parents

module api

github :: api

Nit object oriented interface to Github api.

Children

module hooks

github :: hooks

Github hook event listening with nitcorn.
module loader

github :: loader

Descendants

module a_star-m

a_star-m

# Events are emitted by Github Hooks.
#
# See <https://developer.github.com/v3/activity/events/types/>
module events

import api
intrude import json

# Github event stub.
class GithubEvent
	serialize

	# Event ID from Github.
	var id: nullable String is writable

	# Action performed by the event.
	var action: nullable String is writable

	# Repo where this event occured.
	var repo: Repo is writable
end

# Triggered when a commit comment is created.
class CommitCommentEvent
	super GithubEvent
	serialize

	# The `Comment` itself.
	var comment: CommitComment is writable
end

# Triggered when a repository, branch, or tag is created.
class CreateEvent
	super GithubEvent
	serialize

	# Oject type that was created.
	#
	# Can be one of `repository`, `branch`, or `tag`.
	var ref_type: String is writable

	# Git ref (or null if only a repository was created).
	var ref: String is writable

	# Name of the repo's default branch (usually master).
	var master_branch: String is writable

	# Repo's current description.
	var description: nullable String is writable
end

# Triggered when a branch or a tag is deleted.
class DeleteEvent
	super GithubEvent
	serialize

	# Object type that was deleted.
	#
	# Can be one of `repository`, `branch`, or `tag`.
	var ref_type: String is writable

	# Git ref (or null if only a repository was deleted).
	var ref: String is writable
end

# Triggered when a new snapshot is deployed.
#
# Deployement are mainly used with integration testing servers.
class DeploymentEvent
	super GithubEvent
	serialize

	# Commit SHA for which this deployment was created.
	var sha: String is writable

	# Name of repository for this deployment, formatted as :owner/:repo.
	var name: String is writable

	# Optional extra information for this deployment.
	var payload: nullable String is writable

	# Optional environment to deploy to.
	# Default: "production"
	var environment: nullable String is writable

	# Optional human-readable description added to the deployment.
	var description: nullable String is writable
end

# Triggered when a deployement's status changes.
class DeploymentStatusEvent
	super GithubEvent
	serialize

	# New deployment state.
	#
	# Can be `pending`, `success`, `failure`, or `error`.
	var state: String is writable

	# Optional link added to the status.
	var target_url: nullable String is writable

	# Deployment hash that this status is associated with.
	var deployment: String is writable

	# Optional human-readable description added to the status.
	var description: nullable String is writable
end

# Triggered when a user forks a repository.
class ForkEvent
	super GithubEvent
	serialize

	# Created repository.
	var forkee: Repo is writable
end

# Triggered when an issue comment is created.
class IssueCommentEvent
	super GithubEvent
	serialize

	# `Issue` the comment belongs to.
	var issue: Issue is writable

	# The `Comment` itself.
	var comment: IssueComment is writable
end

# Triggered when an event occurs on an issue.
#
# Triggered when an issue is assigned, unassigned, labeled, unlabeled,
# opened, closed or reopened.
class IssuesEvent
	super GithubEvent
	serialize

	# The `Issue` itself.
	var issue: Issue is writable

	# Optional `Label` that was added or removed from the issue.
	var lbl: nullable Label is writable, serialize_as("label")

	# Optional `User` that was assigned or unassigned from the issue.
	var assignee: nullable User is writable
end

# Triggered when a user is added as a collaborator to a repository.
class MemberEvent
	super GithubEvent
	serialize

	# `User` that was added.
	var member: User is writable
end

# Triggered when an event occurs on a pull request.
#
# Triggered when a pull request is assigned, unassigned,
# labeled, unlabeled, opened, closed, reopened, or synchronized.
class PullRequestEvent
	super GithubEvent
	serialize

	# The pull request number.
	var number: Int is writable

	# The `PullRequest` itself.
	var pull: PullRequest is writable
end

# Triggered when a comment is created on a pull request diff.
class PullRequestPullCommentEvent
	super GithubEvent
	serialize

	# The `Comment` itself.
	var comment: PullComment is writable

	# `PullRequest` the `comment` belongs to.
	var pull: PullRequest is writable
end

# Triggered when a repository branch is pushed to.
class PushEvent
	super GithubEvent
	serialize

	# SHA of the HEAD commit on the repository.
	var head_commit: Commit is writable

	# Full Git ref that was pushed.
	#
	# Example: “refs/heads/master”
	var ref: String is writable

	# Number of commits in the push.
	var size: nullable Int is writable

	# Array of pushed commits.
	var commits = new Array[Commit] is writable, optional
end

# Triggered when the status of a Git commit changes.
class StatusEvent
	super GithubEvent
	serialize

	# The `Commit` itself.
	var sha: String is writable

	# New state.
	#
	# Can be `pending`, `success`, `failure`, or `error`.
	var state: String is writable

	# Optional human-readable description added to the status.
	var description: nullable String is writable

	# Optional link added to the status.
	var target_url: nullable String is writable

	# Array of branches containing the status' SHA.
	#
	# Each branch contains the given SHA,
	# but the SHA may or may not be the head of the branch.
	#
	# The array includes a maximum of 10 branches.
	var branches = new Array[Branch] is writable, optional
end

redef class GithubDeserializer

	redef fun class_name_heuristic(json_object) do
		if json_object.has_key("action") and json_object.has_key("commit") and json_object.has_key("comment") then
			return "CommitCommentEvent"
		else if json_object.has_key("ref") and json_object.has_key("master_branch") then
			return "CreateEvent"
		else if json_object.has_key("ref") and json_object.has_key("ref_type") then
			return "DeleteEvent"
		else if json_object.has_key("action") and json_object.has_key("sha") then
			return "DeploymentEvent"
		else if json_object.has_key("action") and json_object.has_key("state") then
			return "DeploymentStatusEvent"
		else if json_object.has_key("action") and json_object.has_key("forkee") then
			return "ForkEvent"
		else if json_object.has_key("action") and json_object.has_key("issue") and json_object.has_key("comment") then
			return "IssueCommentEvent"
		else if json_object.has_key("action") and json_object.has_key("issue") then
			return "IssuesEvent"
		else if json_object.has_key("action") and json_object.has_key("member") then
			return "MemberEvent"
		else if json_object.has_key("action") and json_object.has_key("number") then
			return "PullRequestEvent"
		else if json_object.has_key("action") and json_object.has_key("pull") and json_object.has_key("comment") then
			return "PullRequestPullCommentEvent"
		else if json_object.has_key("head_commit") and json_object.has_key("commits") then
			return "PushEvent"
		else if json_object.has_key("action") and json_object.has_key("branches") then
			return "StatusEvent"
		else if json_object.has_key("action") and json_object.has_key("issue") then
			return "GithubEvent"
		end
		return super
	end
end

lib/github/events.nit:15,1--281,3