elections-types 1.0.34 → 1.0.35
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/src/index.d.ts
CHANGED
|
@@ -2,6 +2,7 @@ export * from "./types/APIError.js";
|
|
|
2
2
|
export * from "./types/Article.js";
|
|
3
3
|
export * from "./types/Candidate.js";
|
|
4
4
|
export * from "./types/CandidateArticle.js";
|
|
5
|
+
export * from "./types/CandidateVideo.js";
|
|
5
6
|
export * from "./types/Committee.js";
|
|
6
7
|
export * from "./types/Donation.js";
|
|
7
8
|
export * from "./types/Election.js";
|
package/dist/src/index.js
CHANGED
|
@@ -2,6 +2,7 @@ export * from "./types/APIError.js";
|
|
|
2
2
|
export * from "./types/Article.js";
|
|
3
3
|
export * from "./types/Candidate.js";
|
|
4
4
|
export * from "./types/CandidateArticle.js";
|
|
5
|
+
export * from "./types/CandidateVideo.js";
|
|
5
6
|
export * from "./types/Committee.js";
|
|
6
7
|
export * from "./types/Donation.js";
|
|
7
8
|
export * from "./types/Election.js";
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
export declare class CandidateVideo {
|
|
2
|
+
readonly candidate_id: string;
|
|
3
|
+
readonly video_id: string;
|
|
4
|
+
readonly title: string;
|
|
5
|
+
readonly fetch_time: string;
|
|
6
|
+
readonly relevance?: string;
|
|
7
|
+
constructor(candidate_video: any);
|
|
8
|
+
static is(candidate_video: any): candidate_video is CandidateVideo;
|
|
9
|
+
}
|
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
export class CandidateVideo {
|
|
2
|
+
candidate_id;
|
|
3
|
+
video_id;
|
|
4
|
+
title;
|
|
5
|
+
fetch_time;
|
|
6
|
+
relevance;
|
|
7
|
+
constructor(candidate_video) {
|
|
8
|
+
if (!CandidateVideo.is(candidate_video)) {
|
|
9
|
+
throw Error("Invalid input.");
|
|
10
|
+
}
|
|
11
|
+
this.candidate_id = candidate_video.candidate_id;
|
|
12
|
+
this.video_id = candidate_video.video_id;
|
|
13
|
+
this.title = candidate_video.title;
|
|
14
|
+
this.fetch_time = candidate_video.fetch_time;
|
|
15
|
+
this.relevance = candidate_video.relevance;
|
|
16
|
+
}
|
|
17
|
+
static is(candidate_video) {
|
|
18
|
+
return (candidate_video !== undefined &&
|
|
19
|
+
typeof candidate_video.candidate_id === "string" &&
|
|
20
|
+
typeof candidate_video.video_id === "string" &&
|
|
21
|
+
typeof candidate_video.title === "string" &&
|
|
22
|
+
typeof candidate_video.fetch_time === "string" &&
|
|
23
|
+
(candidate_video.relevance === undefined || typeof candidate_video.relevance === "string"));
|
|
24
|
+
}
|
|
25
|
+
}
|
package/package.json
CHANGED
package/src/index.ts
CHANGED
|
@@ -2,6 +2,7 @@ export * from "./types/APIError"
|
|
|
2
2
|
export * from "./types/Article"
|
|
3
3
|
export * from "./types/Candidate"
|
|
4
4
|
export * from "./types/CandidateArticle"
|
|
5
|
+
export * from "./types/CandidateVideo"
|
|
5
6
|
export * from "./types/Committee"
|
|
6
7
|
export * from "./types/Donation"
|
|
7
8
|
export * from "./types/Election"
|
|
@@ -0,0 +1,29 @@
|
|
|
1
|
+
export class CandidateVideo {
|
|
2
|
+
readonly candidate_id : string
|
|
3
|
+
readonly video_id : string
|
|
4
|
+
readonly title : string
|
|
5
|
+
readonly fetch_time : string
|
|
6
|
+
readonly relevance? : string
|
|
7
|
+
|
|
8
|
+
constructor(candidate_video : any) {
|
|
9
|
+
if (!CandidateVideo.is(candidate_video)) {
|
|
10
|
+
throw Error("Invalid input.")
|
|
11
|
+
}
|
|
12
|
+
this.candidate_id = candidate_video.candidate_id
|
|
13
|
+
this.video_id = candidate_video.video_id
|
|
14
|
+
this.title = candidate_video.title
|
|
15
|
+
this.fetch_time = candidate_video.fetch_time
|
|
16
|
+
this.relevance = candidate_video.relevance
|
|
17
|
+
}
|
|
18
|
+
|
|
19
|
+
static is(candidate_video : any) : candidate_video is CandidateVideo {
|
|
20
|
+
return (
|
|
21
|
+
candidate_video !== undefined &&
|
|
22
|
+
typeof candidate_video.candidate_id === "string" &&
|
|
23
|
+
typeof candidate_video.video_id === "string" &&
|
|
24
|
+
typeof candidate_video.title === "string" &&
|
|
25
|
+
typeof candidate_video.fetch_time === "string" &&
|
|
26
|
+
(candidate_video.relevance === undefined || typeof candidate_video.relevance === "string")
|
|
27
|
+
)
|
|
28
|
+
}
|
|
29
|
+
}
|