Skip to content

Commit d1f93b2

Browse files
committed
Adding Activity data model.
1 parent 9a0919e commit d1f93b2

File tree

3 files changed

+73
-0
lines changed

3 files changed

+73
-0
lines changed
Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,21 @@
11
package com.aaroncoplan.todoist.helpers;
22

3+
import java.util.Arrays;
4+
import java.util.List;
5+
36
public enum ActivityType {
7+
ALL("item:", "note:added"),
8+
ADDED("item:added"),
9+
UPDATED("item:updated"),
10+
COMPLETED("item:completed"),
11+
UNCOMPLETED("item:uncompleted"),
12+
DELETED("item:completed"),
13+
ADDED_COMMENT("note:added");
14+
15+
16+
private final List<String> vals;
17+
18+
ActivityType(String... vals) {
19+
this.vals = Arrays.asList(vals);
20+
}
421
}
Lines changed: 39 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,43 @@
11
package com.aaroncoplan.todoist.model;
22

3+
import com.squareup.moshi.Json;
4+
35
public class Activity {
6+
7+
public final long id;
8+
@Json(name = "object_type") public final String objectType;
9+
@Json(name = "object_id") public final long objectId;
10+
@Json(name = "event_type") public final String eventType;
11+
@Json(name = "event_date") public final String eventDateTime;
12+
@Json(name = "parent_project_id") public final Long parentProjectId;
13+
@Json(name = "parent_item_id") public final Long parentItemId;
14+
@Json(name = "initiator_id") public final Long initiatorId;
15+
@Json(name = "extra_data") public final ExtraData extraData;
16+
17+
public Activity(long id, String objectType, long objectId, String eventType, String eventDateTime, Long parentProjectId, Long parentItemId, Long initiatorId, ExtraData extraData) {
18+
this.id = id;
19+
this.objectType = objectType;
20+
this.objectId = objectId;
21+
this.eventType = eventType;
22+
this.eventDateTime = eventDateTime;
23+
this.parentProjectId = parentProjectId;
24+
this.parentItemId = parentItemId;
25+
this.initiatorId = initiatorId;
26+
this.extraData = extraData;
27+
}
28+
29+
@Override
30+
public String toString() {
31+
return "Activity{" +
32+
"id=" + id +
33+
", objectType='" + objectType + '\'' +
34+
", objectId=" + objectId +
35+
", eventType='" + eventType + '\'' +
36+
", eventDateTime='" + eventDateTime + '\'' +
37+
", parentProjectId=" + parentProjectId +
38+
", parentItemId=" + parentItemId +
39+
", initiatorId=" + initiatorId +
40+
", extraData=" + extraData +
41+
'}';
42+
}
443
}
Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,17 @@
1+
package com.aaroncoplan.todoist.model;
2+
3+
public class ExtraData {
4+
5+
public final String content;
6+
7+
public ExtraData(String content) {
8+
this.content = content;
9+
}
10+
11+
@Override
12+
public String toString() {
13+
return "ExtraData{" +
14+
"content='" + content + '\'' +
15+
'}';
16+
}
17+
}

0 commit comments

Comments
 (0)