elections-types 1.0.34 → 1.0.36
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 +1 -0
- package/dist/src/index.js +1 -0
- package/dist/src/types/CandidateVideo.d.ts +9 -0
- package/dist/src/types/CandidateVideo.js +25 -0
- package/dist/src/types/Tweet.d.ts +1 -1
- package/dist/src/types/Tweet.js +1 -1
- package/package.json +1 -1
- package/src/index.ts +1 -0
- package/src/types/CandidateVideo.ts +29 -0
- package/src/types/Tweet.ts +2 -2
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
|
+
}
|
|
@@ -5,7 +5,7 @@ export declare class Tweet {
|
|
|
5
5
|
readonly tweet_time: string;
|
|
6
6
|
readonly tweet_content: string;
|
|
7
7
|
readonly quote?: string;
|
|
8
|
-
readonly html
|
|
8
|
+
readonly html: string;
|
|
9
9
|
readonly text: string;
|
|
10
10
|
constructor(tweet: any);
|
|
11
11
|
static is(tweet: any): tweet is Tweet;
|
package/dist/src/types/Tweet.js
CHANGED
|
@@ -28,7 +28,7 @@ export class Tweet {
|
|
|
28
28
|
typeof tweet.tweet_time === "string" &&
|
|
29
29
|
typeof tweet.tweet_content === "string" &&
|
|
30
30
|
(tweet.quote === undefined || typeof tweet.quote === "string") &&
|
|
31
|
-
|
|
31
|
+
typeof tweet.html === "string" &&
|
|
32
32
|
(typeof tweet.text === "string"));
|
|
33
33
|
}
|
|
34
34
|
}
|
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
|
+
}
|
package/src/types/Tweet.ts
CHANGED
|
@@ -5,7 +5,7 @@ export class Tweet {
|
|
|
5
5
|
readonly tweet_time : string
|
|
6
6
|
readonly tweet_content : string
|
|
7
7
|
readonly quote? : string
|
|
8
|
-
readonly html
|
|
8
|
+
readonly html : string
|
|
9
9
|
readonly text : string
|
|
10
10
|
|
|
11
11
|
constructor(tweet : any) {
|
|
@@ -31,7 +31,7 @@ export class Tweet {
|
|
|
31
31
|
typeof tweet.tweet_time === "string" &&
|
|
32
32
|
typeof tweet.tweet_content === "string" &&
|
|
33
33
|
(tweet.quote === undefined || typeof tweet.quote === "string") &&
|
|
34
|
-
|
|
34
|
+
typeof tweet.html === "string" &&
|
|
35
35
|
(typeof tweet.text === "string")
|
|
36
36
|
)
|
|
37
37
|
}
|