How to build events from received json objects.

Property definitions

github $ HookListener :: event_factory
	# How to build events from received json objects.
	fun event_factory(kind: String, json: String): nullable GithubEvent do
		if kind == "commit_comment" then
			return api.deserialize(json).as(CommitCommentEvent)
		else if kind == "create" then
			return api.deserialize(json).as(CreateEvent)
		else if kind == "delete" then
			return api.deserialize(json).as(DeleteEvent)
		else if kind == "deployment" then
			return api.deserialize(json).as(DeploymentEvent)
		else if kind == "deployment_status" then
			return api.deserialize(json).as(DeploymentStatusEvent)
		else if kind == "fork" then
			return api.deserialize(json).as(ForkEvent)
		else if kind == "issues" then
			return api.deserialize(json).as(IssuesEvent)
		else if kind == "issue_comment" then
			return api.deserialize(json).as(IssueCommentEvent)
		else if kind == "member" then
			return api.deserialize(json).as(MemberEvent)
		else if kind == "pull_request" then
			return api.deserialize(json).as(PullRequestEvent)
		else if kind == "pull_request_review_comment" then
			return api.deserialize(json).as(PullRequestPullCommentEvent)
		else if kind == "push" then
			return api.deserialize(json).as(PushEvent)
		else if kind == "status" then
			return api.deserialize(json).as(StatusEvent)
		end
		return null
	end
lib/github/hooks.nit:90,2--120,4