-
Notifications
You must be signed in to change notification settings - Fork 0
/
DataGetter.ts
63 lines (56 loc) · 1.83 KB
/
DataGetter.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
import { COVID19APIError } from "../COVID19APIError";
/**
* The super class of data getter specific errors.
*/
export class DataGetterError extends COVID19APIError {
constructor(message: string) {
super(message);
this.name = "DataGetterError";
Object.setPrototypeOf(this, DataGetterError.prototype);
}
}
/**
* An interface describing a data getter instance that loads the JHU CSSE time series data from CSV
* files.
*/
export interface DataGetter {
/**
* Returns the date that the source was last updated, e.g. the last commit date for the folder
* containing the JHU CSSE data in its GitHub repository.
*
* If there is no way to determine the date of last update, this method might return `undefined`.
*
* @throws {@link DataGetterError} Thrown when there is an error loading the data.
*/
getSourceLastUpdatedAt(): Promise<Date | undefined>;
/**
* Returns the global confirmed cases time series data.
*
* @throws {@link DataGetterError} Thrown when there is an error loading the data.
*/
getGlobalConfirmedData(): Promise<string>;
/**
* Returns the global deaths time series data.
*
* @throws {@link DataGetterError} Thrown when there is an error loading the data.
*/
getGlobalDeathsData(): Promise<string>;
/**
* Returns the global recoveries time series data.
*
* @throws {@link DataGetterError} Thrown when there is an error loading the data.
*/
getGlobalRecoveredData(): Promise<string>;
/**
* Returns the US confirmed cases time series data.
*
* @throws {@link DataGetterError} Thrown when there is an error loading the data.
*/
getUSConfirmedData(): Promise<string>;
/**
* Returns the US deaths time series data.
*
* @throws {@link DataGetterError} Thrown when there is an error loading the data.
*/
getUSDeathsData(): Promise<string>;
}