elections-types 1.1.9 → 1.1.10
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/TwitterTweet.d.ts +10 -0
- package/dist/src/types/TwitterTweet.js +27 -0
- package/dist/src/types/YoutubeVideo.d.ts +14 -0
- package/dist/src/types/YoutubeVideo.js +40 -0
- package/package.json +1 -1
- package/src/index.ts +2 -1
- package/src/types/YoutubeVideo.ts +44 -0
package/dist/src/index.d.ts
CHANGED
package/dist/src/index.js
CHANGED
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
export declare class TwitterTweet {
|
|
2
|
+
readonly twitter_tweet_id: string;
|
|
3
|
+
readonly username: string;
|
|
4
|
+
readonly url: string;
|
|
5
|
+
readonly twitter_tweet_time: string;
|
|
6
|
+
readonly twitter_tweet_content?: string;
|
|
7
|
+
readonly html: string;
|
|
8
|
+
constructor(twitter_tweet: TwitterTweet);
|
|
9
|
+
static is(twitter_tweet: any): twitter_tweet is TwitterTweet;
|
|
10
|
+
}
|
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
export class TwitterTweet {
|
|
2
|
+
twitter_tweet_id;
|
|
3
|
+
username;
|
|
4
|
+
url;
|
|
5
|
+
twitter_tweet_time;
|
|
6
|
+
twitter_tweet_content;
|
|
7
|
+
html;
|
|
8
|
+
constructor(twitter_tweet) {
|
|
9
|
+
if (!TwitterTweet.is(twitter_tweet)) {
|
|
10
|
+
throw Error("Invalid input.");
|
|
11
|
+
}
|
|
12
|
+
this.twitter_tweet_id = twitter_tweet.twitter_tweet_id;
|
|
13
|
+
this.username = twitter_tweet.username;
|
|
14
|
+
this.url = twitter_tweet.url;
|
|
15
|
+
this.twitter_tweet_time = twitter_tweet.twitter_tweet_time;
|
|
16
|
+
this.twitter_tweet_content = twitter_tweet.twitter_tweet_content;
|
|
17
|
+
this.html = twitter_tweet.html;
|
|
18
|
+
}
|
|
19
|
+
static is(twitter_tweet) {
|
|
20
|
+
return (twitter_tweet !== undefined &&
|
|
21
|
+
typeof twitter_tweet.twitter_tweet_id === "string" &&
|
|
22
|
+
typeof twitter_tweet.username === "string" &&
|
|
23
|
+
typeof twitter_tweet.url === "string" &&
|
|
24
|
+
typeof twitter_tweet.twitter_tweet_time === "string" &&
|
|
25
|
+
typeof twitter_tweet.html === "string");
|
|
26
|
+
}
|
|
27
|
+
}
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
export declare class YoutubeVideo {
|
|
2
|
+
readonly youtube_video_id: string;
|
|
3
|
+
readonly publish_time: string;
|
|
4
|
+
readonly channel_id: string;
|
|
5
|
+
readonly channel_name: string;
|
|
6
|
+
readonly title: string;
|
|
7
|
+
readonly description: string;
|
|
8
|
+
readonly tags?: string[];
|
|
9
|
+
readonly duration?: number;
|
|
10
|
+
readonly fetch_time: string;
|
|
11
|
+
readonly s3_id?: string;
|
|
12
|
+
constructor(youtube_video: YoutubeVideo);
|
|
13
|
+
static is(youtube_video: any): youtube_video is YoutubeVideo;
|
|
14
|
+
}
|
|
@@ -0,0 +1,40 @@
|
|
|
1
|
+
export class YoutubeVideo {
|
|
2
|
+
youtube_video_id;
|
|
3
|
+
publish_time;
|
|
4
|
+
channel_id;
|
|
5
|
+
channel_name;
|
|
6
|
+
title;
|
|
7
|
+
description;
|
|
8
|
+
tags;
|
|
9
|
+
duration;
|
|
10
|
+
fetch_time;
|
|
11
|
+
s3_id;
|
|
12
|
+
constructor(youtube_video) {
|
|
13
|
+
if (!YoutubeVideo.is(youtube_video)) {
|
|
14
|
+
throw Error("Invalid input.");
|
|
15
|
+
}
|
|
16
|
+
this.youtube_video_id = youtube_video.youtube_video_id;
|
|
17
|
+
this.publish_time = youtube_video.publish_time;
|
|
18
|
+
this.channel_id = youtube_video.channel_id;
|
|
19
|
+
this.channel_name = youtube_video.channel_name;
|
|
20
|
+
this.title = youtube_video.title;
|
|
21
|
+
this.description = youtube_video.description;
|
|
22
|
+
this.tags = youtube_video.tags;
|
|
23
|
+
this.duration = youtube_video.duration;
|
|
24
|
+
this.fetch_time = youtube_video.fetch_time;
|
|
25
|
+
this.s3_id = youtube_video.s3_id;
|
|
26
|
+
}
|
|
27
|
+
static is(youtube_video) {
|
|
28
|
+
return (youtube_video !== undefined &&
|
|
29
|
+
typeof youtube_video.youtube_video_id === "string" &&
|
|
30
|
+
typeof youtube_video.publish_time === "string" &&
|
|
31
|
+
typeof youtube_video.channel_id === "string" &&
|
|
32
|
+
typeof youtube_video.channel_name === "string" &&
|
|
33
|
+
typeof youtube_video.title === "string" &&
|
|
34
|
+
typeof youtube_video.description === "string" &&
|
|
35
|
+
(youtube_video.tags === undefined || Array.isArray(youtube_video.tags) && youtube_video.tags.map((tag) => typeof tag === "string")) &&
|
|
36
|
+
(youtube_video.duration === undefined || typeof youtube_video.duration === "number" && !isNaN(youtube_video.duration)) &&
|
|
37
|
+
typeof youtube_video.fetch_time === "string" &&
|
|
38
|
+
(youtube_video.s3_id === undefined || typeof youtube_video.s3_id === "string"));
|
|
39
|
+
}
|
|
40
|
+
}
|
package/package.json
CHANGED
package/src/index.ts
CHANGED
|
@@ -0,0 +1,44 @@
|
|
|
1
|
+
export class YoutubeVideo {
|
|
2
|
+
readonly youtube_video_id : string
|
|
3
|
+
readonly publish_time : string
|
|
4
|
+
readonly channel_id : string
|
|
5
|
+
readonly channel_name : string
|
|
6
|
+
readonly title : string
|
|
7
|
+
readonly description : string
|
|
8
|
+
readonly tags? : string[]
|
|
9
|
+
readonly duration? : number
|
|
10
|
+
readonly fetch_time : string
|
|
11
|
+
readonly s3_id? : string
|
|
12
|
+
|
|
13
|
+
constructor(youtube_video : YoutubeVideo) {
|
|
14
|
+
if (!YoutubeVideo.is(youtube_video)) {
|
|
15
|
+
throw Error("Invalid input.")
|
|
16
|
+
}
|
|
17
|
+
this.youtube_video_id = youtube_video.youtube_video_id
|
|
18
|
+
this.publish_time = youtube_video.publish_time
|
|
19
|
+
this.channel_id = youtube_video.channel_id
|
|
20
|
+
this.channel_name = youtube_video.channel_name
|
|
21
|
+
this.title = youtube_video.title
|
|
22
|
+
this.description = youtube_video.description
|
|
23
|
+
this.tags = youtube_video.tags
|
|
24
|
+
this.duration = youtube_video.duration
|
|
25
|
+
this.fetch_time = youtube_video.fetch_time
|
|
26
|
+
this.s3_id = youtube_video.s3_id
|
|
27
|
+
}
|
|
28
|
+
|
|
29
|
+
static is(youtube_video : any) : youtube_video is YoutubeVideo {
|
|
30
|
+
return (
|
|
31
|
+
youtube_video !== undefined &&
|
|
32
|
+
typeof youtube_video.youtube_video_id === "string" &&
|
|
33
|
+
typeof youtube_video.publish_time === "string" &&
|
|
34
|
+
typeof youtube_video.channel_id === "string" &&
|
|
35
|
+
typeof youtube_video.channel_name === "string" &&
|
|
36
|
+
typeof youtube_video.title === "string" &&
|
|
37
|
+
typeof youtube_video.description === "string" &&
|
|
38
|
+
(youtube_video.tags === undefined || Array.isArray(youtube_video.tags) && youtube_video.tags.map((tag : any) => typeof tag === "string")) &&
|
|
39
|
+
(youtube_video.duration === undefined || typeof youtube_video.duration === "number" && !isNaN(youtube_video.duration)) &&
|
|
40
|
+
typeof youtube_video.fetch_time === "string" &&
|
|
41
|
+
(youtube_video.s3_id === undefined || typeof youtube_video.s3_id === "string")
|
|
42
|
+
)
|
|
43
|
+
}
|
|
44
|
+
}
|