@dev-crew-berlin/enter-js-utils 0.21.0 → 0.23.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/api-client/index.js
CHANGED
|
@@ -26,7 +26,13 @@ export default class API extends APIBase {
|
|
|
26
26
|
}
|
|
27
27
|
|
|
28
28
|
async getAttendeeList(args) {
|
|
29
|
-
|
|
29
|
+
const query = new URLSearchParams();
|
|
30
|
+
|
|
31
|
+
if (args.includeDeleted) {
|
|
32
|
+
query.append('include_deleted', 'true');
|
|
33
|
+
}
|
|
34
|
+
|
|
35
|
+
return this.get(`instances/${args.instanceId}/attendees?${query.toString()}`, parseAttendeeList);
|
|
30
36
|
}
|
|
31
37
|
|
|
32
38
|
async sendEmail(args) {
|
|
@@ -48,6 +48,7 @@ export declare class Attendee {
|
|
|
48
48
|
} | null;
|
|
49
49
|
deleted: boolean;
|
|
50
50
|
constructor(rawAttendee: RawAttendee);
|
|
51
|
+
static fromJSON(json: AttendeeJSON): Attendee;
|
|
51
52
|
toJSON(): AttendeeJSON;
|
|
52
53
|
getRsvpCountForTag(checkinTag: string): number;
|
|
53
54
|
getResponseForTag(checkinTag: string): 'no-response' | 'negative-repsone' | 'positive-response';
|
package/dist/models/attendee.js
CHANGED
|
@@ -18,6 +18,17 @@ export class Attendee {
|
|
|
18
18
|
this.deleted = rawAttendee.deleted;
|
|
19
19
|
}
|
|
20
20
|
|
|
21
|
+
static fromJSON(json) {
|
|
22
|
+
const checkin = Object.entries(json.checkin).reduce((obj, [tag, checkins]) => {
|
|
23
|
+
obj[tag] = Checkins.fromJSON(checkins);
|
|
24
|
+
return obj;
|
|
25
|
+
}, {});
|
|
26
|
+
return new Attendee({ ...json,
|
|
27
|
+
time: new Date(json.time),
|
|
28
|
+
checkin
|
|
29
|
+
});
|
|
30
|
+
}
|
|
31
|
+
|
|
21
32
|
toJSON() {
|
|
22
33
|
// this is exactly what js also provides out of the box
|
|
23
34
|
// but then typescript complains that there is no toJSON function
|
|
@@ -16,6 +16,7 @@ export declare class Checkins {
|
|
|
16
16
|
checkins: Checkin[];
|
|
17
17
|
deleted: string[];
|
|
18
18
|
constructor(rawCheckins: RawCheckins);
|
|
19
|
+
static fromJSON(json: CheckinsJSON): Checkins;
|
|
19
20
|
toJSON(): CheckinsJSON;
|
|
20
21
|
getAllCheckins(): Checkin[];
|
|
21
22
|
getOtherCheckins(): Checkin[];
|
package/dist/models/checkins.js
CHANGED
|
@@ -6,6 +6,15 @@ export class Checkins {
|
|
|
6
6
|
this.deleted = rawCheckins.deleted;
|
|
7
7
|
}
|
|
8
8
|
|
|
9
|
+
static fromJSON(json) {
|
|
10
|
+
return new Checkins({
|
|
11
|
+
checkins: json.checkins.map(checkin => ({ ...checkin,
|
|
12
|
+
time: new Date(checkin.time)
|
|
13
|
+
})),
|
|
14
|
+
deleted: json.deleted
|
|
15
|
+
});
|
|
16
|
+
}
|
|
17
|
+
|
|
9
18
|
toJSON() {
|
|
10
19
|
return {
|
|
11
20
|
checkins: this.checkins.map(checkin => ({
|