-
-
Notifications
You must be signed in to change notification settings - Fork 87
/
types.ts
116 lines (105 loc) · 2.29 KB
/
types.ts
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
// Nullable generic for nullable fields
type Nullable<T> = T | null;
export interface Source {
name: string;
provider: "github" | "gitlab";
url?: string;
repositories: string[];
labels: string[];
}
// Describes a Tag, which is a programming language or a tag
export interface Tag {
display: string;
id: string;
}
// Describes a CountableTag, which is a Tag with a count
export interface CountableTag extends Tag {
count: number;
}
export interface CountableLanguage extends Tag {
count: number;
}
// Describes a Repository, which is a GitHub repository
export interface Repository {
description: Nullable<string>;
has_new_issues: boolean;
id: string;
issues: Issue[];
language: Tag;
last_modified: string;
license?: string;
name: string;
owner: string;
stars: number;
stars_display: string;
url: string;
tags?: Tag[];
}
// Describes an Issue, which is a GitHub issue linked to a repository
export interface Issue {
comments_count: number;
created_at: string;
id: string;
labels: Label[];
number: number;
title: string;
url: string;
}
// Describes a Label, which is a GitHub label
export interface Label {
id: string;
display: string;
}
export enum RepositorySortOrder {
NEW_ISSUES = "New Issues",
LEAST_STARS = "By Least Stars",
MOST_STARS = "By Most Stars",
NONE = "None"
}
// Describes the data that is retrieved from the GitHub API and used by the app
export interface AppData {
languages: CountableLanguage[];
repositories: Repository[];
repositorySortOrder: RepositorySortOrder;
tags: CountableTag[];
query: string;
updateRepositorySortOrder: (sortOrder: RepositorySortOrder) => void;
}
export interface GitLabRepository {
id: string;
name: string;
description: string;
starCount: number;
openIssuesCount: number;
lastActivityAt: string;
webUrl: string;
namespace: {
fullName: string;
};
group: {
fullName: string;
};
languages: {
name: string;
share: number;
}[];
topics: string[];
issues: {
nodes: {
iid: string;
webUrl: string;
title: string;
createdAt: string;
labels: {
nodes: {
title: string;
}[];
};
}[];
};
}
export interface Data {
repositories: Repository[];
languages: CountableLanguage[];
tags: CountableTag[];
}