From 7c9b56f6784397bc142330f16c175acd8b941c91 Mon Sep 17 00:00:00 2001 From: Karl-Philipp Wulfert Date: Mon, 25 Feb 2019 17:10:56 +0100 Subject: [PATCH] feat: add types for discussions --- src/types.ts | 81 +++++++++++++++++++++++++++++++++++++++++++--------- 1 file changed, 67 insertions(+), 14 deletions(-) diff --git a/src/types.ts b/src/types.ts index c8ce60e7..f67c079c 100644 --- a/src/types.ts +++ b/src/types.ts @@ -72,7 +72,21 @@ export enum MergeRequestMergeStatus { } /** - * GitLab label + * A note type + */ +export enum NoteType { + DIFF_NOTE = 'DiffNote', +} + +/** + * A type of a noteable thing + */ +export enum NoteableType { + MERGE_REQUST = 'MergeRequest', +} + +/** + * A label */ export interface Label { color: string; @@ -81,7 +95,7 @@ export interface Label { } /** - * GitLab commit + * A commit */ export interface Commit { author_email: string; @@ -96,7 +110,7 @@ export interface Commit { } /** - * GitLab tag + * A tag */ export interface Tag { commit: Commit; @@ -106,7 +120,7 @@ export interface Tag { } /** - * GitLab namespace + * A namespace */ export interface Namespace { full_path: string; @@ -117,7 +131,7 @@ export interface Namespace { } /** - * GitLab project + * A project */ export interface Project { archived: boolean; @@ -157,7 +171,7 @@ export interface Project { } /** - * GitLab tree file + * A tree file */ export interface TreeFile { id: string; @@ -176,7 +190,7 @@ export interface Member extends User { } /** - * Available GitLab access levels + * Available access levels */ export enum AccessLevel { Guest = 10, @@ -187,7 +201,7 @@ export enum AccessLevel { } /** - * A GitLab milestone + * A milestone */ export interface Milestone { created_at: string; @@ -203,7 +217,7 @@ export interface Milestone { } /** - * A GitLab branch + * A branch */ export interface Branch { commit: Commit; @@ -215,7 +229,7 @@ export interface Branch { } /** - * A GitLab user + * A user */ export interface User { avatar_url: string; @@ -227,7 +241,7 @@ export interface User { } /** - * A GitLab issue + * A issue */ export interface Issue extends ThingWithTimeStats { assignee: User; @@ -254,7 +268,7 @@ export interface Issue extends ThingWithTimeStats { } /** - * A GitLab merge request + * A merge request */ export interface MergeRequest extends ThingWithTimeStats { assignee: User; @@ -308,7 +322,7 @@ export interface MergeRequestApproval { } /** - * A GitLab thing with time stats + * A thing with time stats */ export interface ThingWithTimeStats { time_stats: { @@ -320,7 +334,7 @@ export interface ThingWithTimeStats { } /** - * A GitLab group + * A group */ export interface Group { avatar_url: string; @@ -338,3 +352,42 @@ export interface Group { visibility: string; web_url: string; } + +/** + * A discussion + */ +export interface Discussion { + id: string; + individual_note: boolean; + notes: Note[]; +} + +/** + * A note + */ +export interface Note { + attachment: null; + author: User; + body: string; + created_at: string; + id: number; + noteable_id: number; + noteable_iid: number; + noteable_type: NoteableType; + position: { + base_sha: string; + head_sha: string; + new_line: number | null; + new_path: string; + old_line: number | null; + old_path: string; + position_type: string, + start_sha: string; + }; + resolvable: boolean; + resolved: boolean | undefined; + resolved_by: User | undefined; + system: boolean; + type: NoteType; + updated_at: string; +}