/*--------------------------------------------------------------------------------------------- * Copyright (c) Microsoft Corporation. All rights reserved. * Licensed under the MIT License. See License.txt in the project root for license information. *--------------------------------------------------------------------------------------------*/ import * as moment from 'moment'; import md from './mdRenderer'; export enum EventType { Committed, Mentioned, Subscribed, Commented, Reviewed, Other } export interface Author { name: string; email: string; date: Date; } export interface Committer { name: string; email: string; date: Date; } export interface Tree { sha: string; url: string; } export interface Parent { sha: string; url: string; html_url: string; } export interface Verification { verified: boolean; reason: string; signature?: any; payload?: any; } export interface User { login: string; id: number; avatar_url: string; gravatar_id: string; url: string; html_url: string; followers_url: string; following_url: string; gists_url: string; starred_url: string; subscriptions_url: string; organizations_url: string; repos_url: string; events_url: string; received_events_url: string; type: string; site_admin: boolean; } export interface Html { href: string; } export interface PullRequest { href: string; } export interface Links { html: Html; pull_request: PullRequest; } export interface MentionEvent { id: number; url: string; actor: User; event: EventType; commit_id: string; commit_url: string; created_at: Date; } export interface SubscribeEvent { id: number; url: string; actor: User; event: EventType; commit_id: string; commit_url: string; created_at: Date; } export interface CommentEvent { url: string; html_url: string; author: Author; user: User; created_at: Date; updated_at: Date; id: number; event: EventType; actor: User; author_association: string; body: string; } export interface ReviewEvent { id: number; user: User; body: string; commit_id: string; submitted_at: Date; state: string; html_url: string; pull_request_url: string; author_association: string; _links: Links; event: EventType; } export interface CommitEvent { sha: string; url: string; html_url: string; author: Author; committer: Committer; tree: Tree; message: string; parents: Parent[]; verification: Verification; event: EventType; } export enum PullRequestStateEnum { Open, Merged, Closed, } export type TimelineEvent = CommitEvent | ReviewEvent | SubscribeEvent | CommentEvent | MentionEvent; export function renderComment(comment: CommentEvent): string { return `