/
types.ts
74 lines (68 loc) · 1.83 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
import { ResourceObject } from "jsonapi-typescript";
import { IArcGISContext } from "../ArcGISContext";
/**
* JSONAPI dataset resource returned by the Hub API
*/
export type DatasetResource = ResourceObject<
"dataset",
{
// TODO: actually define the attributes?
// what is the syntax? adding the following causes errors
// owner: string;
[k: string]: any;
}
>;
export enum JobRecordType {
DOWNLOAD = "download",
UPDATE = "update",
}
export enum JobRecordStatus {
SUCCESS = "success",
ERROR = "error",
WARNING = "warning",
INFO = "info",
}
/**
* Represents a job record from the Hub API
*/
export interface IHubJobRecord {
/** Unique entry id */
id: string;
/** Type of job record */
type: JobRecordType;
/** Status of the job record */
status: JobRecordStatus;
/** wellknown message id */
messageId: string;
/** untranslated plaintext message */
message: string;
/** Timestamp of when the job record was created */
created: number;
/** Timestamp of when the job record was last modified */
modified: number;
}
/**
* Represents a download job record from the Hub API
*/
export interface IHubDownloadJobRecord extends IHubJobRecord {
type: JobRecordType.DOWNLOAD;
/** The layer associated with the download */
layerId?: string;
}
/**
* Request options for fetching job records
*/
export interface IHubJobRecordRequestOptions {
/** Context object from consuming application */
context: IArcGISContext;
/** Job types to be included in the results */
types?: JobRecordType[];
/** Job statuses to be included in the results */
statuses?: JobRecordStatus[];
/** ISO Date string indicating the start date for the search */
from?: string;
/** ISO Date string indicating the end date of the search */
to?: string;
/** Total number of records to return */
limit?: number;
}