Add types for GitHub plugin. (#35)

This commit is contained in:
Dandelion Mané 2018-02-26 17:05:50 -08:00 committed by GitHub
parent 2c083425fb
commit 9878313ef3
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

43
backend/githubPlugin.js Normal file
View File

@ -0,0 +1,43 @@
// @flow
export const GITHUB_PLUGIN_NAME = "sourcecred/github-beta";
export type NodeType = "PULL_REQUEST" | "ISSUE" | "COMMENT" | "USER";
export type PullRequestPayload = {
title: string,
isClosed: boolean,
isMerged: boolean,
dateCreated: number,
dateMerged: ?number,
};
export type IssuePayload = {
title: string,
isClosed: boolean,
dateCreated: number,
};
export type ReviewState = "APPROVED" | "COMMENTED" | "CHANGES_REQUESTED";
export type CommentPayload = {
body: string,
date: number,
state: ?ReviewState,
};
export type UserPayload = {
githubUserId: number,
};
export type GithubNodePayload = {
type: NodeType,
subpayload: PullRequestPayload | IssuePayload | CommentPayload | UserPayload,
};
export type EdgeType = "AUTHOR" | "REFERENCE";
export type AuthorPayload = {
// Issue/PR/Comment -> User
};
export type ReferencePayload = {};