-
Notifications
You must be signed in to change notification settings - Fork 33
/
types.ts
62 lines (55 loc) · 1.4 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
// Nullable generic for nullable fields
type Nullable<T> = T | null;
// Describes a Tag, which is a programming language or a topic
export interface Tag {
display: string;
id: string;
}
// Describes a CountableTag, which is a Tag with a count
export interface CountableTag 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;
topics?: 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 {
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: CountableTag[];
repositories: Repository[];
repositorySortOrder: RepositorySortOrder;
topics: CountableTag[];
updateRepositorySortOrder: (sortOrder: RepositorySortOrder) => void;
}