-
Notifications
You must be signed in to change notification settings - Fork 10
/
Task.ts
110 lines (96 loc) · 2.83 KB
/
Task.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
import {map, mapArray} from '../common/Mapper';
import BitmovinResponse from './BitmovinResponse';
import ErrorDetails from './ErrorDetails';
import Message from './Message';
import Status from './Status';
import Subtask from './Subtask';
/**
* @export
* @class Task
*/
export class Task extends BitmovinResponse {
/**
* Current status (required)
* @type {Status}
* @memberof Task
*/
public status?: Status;
/**
* Estimated ETA in seconds
* @type {number}
* @memberof Task
*/
public eta?: number;
/**
* Progress in percent
* @type {number}
* @memberof Task
*/
public progress?: number;
/**
* List of subtasks
* @type {Subtask[]}
* @memberof Task
*/
public subtasks?: Subtask[];
/**
* Task specific messages
* @type {Message[]}
* @memberof Task
*/
public messages?: Message[];
/**
* Timestamp when the task was created, returned as UTC expressed in ISO 8601 format: YYYY-MM-DDThh:mm:ssZ
* @type {Date}
* @memberof Task
*/
public createdAt?: Date;
/**
* Timestamp when the task status changed to \"QUEUED\", returned as UTC expressed in ISO 8601 format: YYYY-MM-DDThh:mm:ssZ
* @type {Date}
* @memberof Task
*/
public queuedAt?: Date;
/**
* Timestamp when the task status changed to \"RUNNING\", returned as UTC expressed in ISO 8601 format: YYYY-MM-DDThh:mm:ssZ
* @type {Date}
* @memberof Task
*/
public runningAt?: Date;
/**
* Timestamp when the subtask status changed to a final state like 'FINISHED', 'ERROR', 'CANCELED', returned as UTC expressed in ISO 8601 format: YYYY-MM-DDThh:mm:ssZ Note that this timestamp might be inaccurate for tasks which ran prior to the [1.50.0 REST API release](https://bitmovin.com/docs/encoding/changelogs/rest).
* @type {Date}
* @memberof Task
*/
public finishedAt?: Date;
/**
* Timestamp when the subtask status changed to 'ERROR', returned as UTC expressed in ISO 8601 format: YYYY-MM-DDThh:mm:ssZ Note that this timestamp is deprecated and is equivalent to finishedAt in case of an 'ERROR'.
* @type {Date}
* @memberof Task
*/
public errorAt?: Date;
/**
* Additional optional error details
* @type {ErrorDetails}
* @memberof Task
*/
public error?: ErrorDetails;
constructor(obj?: Partial<Task>) {
super(obj);
if(!obj) {
return;
}
this.status = map(obj.status);
this.eta = map(obj.eta);
this.progress = map(obj.progress);
this.subtasks = mapArray(obj.subtasks, Subtask);
this.messages = mapArray(obj.messages, Message);
this.createdAt = map(obj.createdAt, Date);
this.queuedAt = map(obj.queuedAt, Date);
this.runningAt = map(obj.runningAt, Date);
this.finishedAt = map(obj.finishedAt, Date);
this.errorAt = map(obj.errorAt, Date);
this.error = map(obj.error, ErrorDetails);
}
}
export default Task;