elections-types 1.1.9 → 1.1.11

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.
@@ -21,3 +21,5 @@ export * from "./types/Tweet.js";
21
21
  export * from "./types/User.js";
22
22
  export * from "./types/UserFederalElection.js";
23
23
  export * from "./types/Video.js";
24
+ export * from "./types/YoutubeVideo.js";
25
+ export * from "./types/YoutubeVideoTag.js";
package/dist/src/index.js CHANGED
@@ -21,3 +21,5 @@ export * from "./types/Tweet.js";
21
21
  export * from "./types/User.js";
22
22
  export * from "./types/UserFederalElection.js";
23
23
  export * from "./types/Video.js";
24
+ export * from "./types/YoutubeVideo.js";
25
+ export * from "./types/YoutubeVideoTag.js";
@@ -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,13 @@
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 duration?: number;
9
+ readonly fetch_time: string;
10
+ readonly s3_id?: string;
11
+ constructor(youtube_video: YoutubeVideo);
12
+ static is(youtube_video: any): youtube_video is YoutubeVideo;
13
+ }
@@ -0,0 +1,37 @@
1
+ export class YoutubeVideo {
2
+ youtube_video_id;
3
+ publish_time;
4
+ channel_id;
5
+ channel_name;
6
+ title;
7
+ description;
8
+ duration;
9
+ fetch_time;
10
+ s3_id;
11
+ constructor(youtube_video) {
12
+ if (!YoutubeVideo.is(youtube_video)) {
13
+ throw Error("Invalid input.");
14
+ }
15
+ this.youtube_video_id = youtube_video.youtube_video_id;
16
+ this.publish_time = youtube_video.publish_time;
17
+ this.channel_id = youtube_video.channel_id;
18
+ this.channel_name = youtube_video.channel_name;
19
+ this.title = youtube_video.title;
20
+ this.description = youtube_video.description;
21
+ this.duration = youtube_video.duration;
22
+ this.fetch_time = youtube_video.fetch_time;
23
+ this.s3_id = youtube_video.s3_id;
24
+ }
25
+ static is(youtube_video) {
26
+ return (youtube_video !== undefined &&
27
+ typeof youtube_video.youtube_video_id === "string" &&
28
+ typeof youtube_video.publish_time === "string" &&
29
+ typeof youtube_video.channel_id === "string" &&
30
+ typeof youtube_video.channel_name === "string" &&
31
+ typeof youtube_video.title === "string" &&
32
+ typeof youtube_video.description === "string" &&
33
+ (youtube_video.duration === undefined || typeof youtube_video.duration === "number" && !isNaN(youtube_video.duration)) &&
34
+ typeof youtube_video.fetch_time === "string" &&
35
+ (youtube_video.s3_id === undefined || typeof youtube_video.s3_id === "string"));
36
+ }
37
+ }
@@ -0,0 +1,14 @@
1
+ import { YoutubeVideo } from "./YoutubeVideo.js";
2
+ export declare class YoutubeVideoTag {
3
+ readonly youtube_video_id: string;
4
+ readonly tag_id: string;
5
+ readonly relevance?: string;
6
+ readonly [x: string]: any;
7
+ constructor(youtube_video_tag: YoutubeVideoTag);
8
+ static is(youtube_video_tag: any): youtube_video_tag is YoutubeVideoTag;
9
+ }
10
+ export declare class YoutubeVideoTagAux extends YoutubeVideoTag {
11
+ readonly youtube_video: YoutubeVideo;
12
+ constructor(youtube_video_tag: any);
13
+ static is(youtube_video_tag: any): youtube_video_tag is YoutubeVideoTagAux;
14
+ }
@@ -0,0 +1,34 @@
1
+ import { YoutubeVideo } from "./YoutubeVideo.js";
2
+ export class YoutubeVideoTag {
3
+ youtube_video_id;
4
+ tag_id;
5
+ relevance;
6
+ constructor(youtube_video_tag) {
7
+ if (!YoutubeVideoTag.is(youtube_video_tag)) {
8
+ throw Error("Invalid input.");
9
+ }
10
+ this.youtube_video_id = youtube_video_tag.youtube_video_id;
11
+ this.tag_id = youtube_video_tag.tag_id;
12
+ this.relevance = youtube_video_tag.relevance;
13
+ }
14
+ static is(youtube_video_tag) {
15
+ return (youtube_video_tag !== undefined &&
16
+ typeof youtube_video_tag.youtube_video_id === "string" &&
17
+ typeof youtube_video_tag.tag_id === "string" &&
18
+ (youtube_video_tag.relevance === undefined || typeof youtube_video_tag.relevance === "string"));
19
+ }
20
+ }
21
+ export class YoutubeVideoTagAux extends YoutubeVideoTag {
22
+ youtube_video;
23
+ constructor(youtube_video_tag) {
24
+ if (!YoutubeVideoTagAux.is(youtube_video_tag)) {
25
+ throw Error("Invalid input.");
26
+ }
27
+ super(youtube_video_tag);
28
+ this.youtube_video = youtube_video_tag.youtube_video;
29
+ }
30
+ static is(youtube_video_tag) {
31
+ return (YoutubeVideoTag.is(youtube_video_tag) &&
32
+ YoutubeVideo.is(youtube_video_tag.youtube_video));
33
+ }
34
+ }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "elections-types",
3
- "version": "1.1.9",
3
+ "version": "1.1.11",
4
4
  "main": "dist/src/index.js",
5
5
  "types": "dist/src/index.d.ts",
6
6
  "directories": {
package/src/index.ts CHANGED
@@ -20,4 +20,6 @@ export * from "./types/State"
20
20
  export * from "./types/Tweet"
21
21
  export * from "./types/User"
22
22
  export * from "./types/UserFederalElection"
23
- export * from "./types/Video"
23
+ export * from "./types/Video"
24
+ export * from "./types/YoutubeVideo"
25
+ export * from "./types/YoutubeVideoTag"
@@ -0,0 +1,41 @@
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 duration? : number
9
+ readonly fetch_time : string
10
+ readonly s3_id? : string
11
+
12
+ constructor(youtube_video : YoutubeVideo) {
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.duration = youtube_video.duration
23
+ this.fetch_time = youtube_video.fetch_time
24
+ this.s3_id = youtube_video.s3_id
25
+ }
26
+
27
+ static is(youtube_video : any) : youtube_video is YoutubeVideo {
28
+ return (
29
+ youtube_video !== undefined &&
30
+ typeof youtube_video.youtube_video_id === "string" &&
31
+ typeof youtube_video.publish_time === "string" &&
32
+ typeof youtube_video.channel_id === "string" &&
33
+ typeof youtube_video.channel_name === "string" &&
34
+ typeof youtube_video.title === "string" &&
35
+ typeof youtube_video.description === "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
+ }
41
+ }
@@ -0,0 +1,45 @@
1
+ import { YoutubeVideo } from "./YoutubeVideo"
2
+
3
+ export class YoutubeVideoTag {
4
+ readonly youtube_video_id : string
5
+ readonly tag_id : string
6
+ readonly relevance? : string
7
+ readonly [x : string] : any
8
+
9
+ constructor(youtube_video_tag : YoutubeVideoTag) {
10
+ if (!YoutubeVideoTag.is(youtube_video_tag)) {
11
+ throw Error("Invalid input.")
12
+ }
13
+ this.youtube_video_id = youtube_video_tag.youtube_video_id
14
+ this.tag_id = youtube_video_tag.tag_id
15
+ this.relevance = youtube_video_tag.relevance
16
+ }
17
+
18
+ static is(youtube_video_tag : any) : youtube_video_tag is YoutubeVideoTag {
19
+ return (
20
+ youtube_video_tag !== undefined &&
21
+ typeof youtube_video_tag.youtube_video_id === "string" &&
22
+ typeof youtube_video_tag.tag_id === "string" &&
23
+ (youtube_video_tag.relevance === undefined || typeof youtube_video_tag.relevance === "string")
24
+ )
25
+ }
26
+ }
27
+
28
+ export class YoutubeVideoTagAux extends YoutubeVideoTag {
29
+ readonly youtube_video : YoutubeVideo
30
+
31
+ constructor(youtube_video_tag : any) {
32
+ if (!YoutubeVideoTagAux.is(youtube_video_tag)) {
33
+ throw Error("Invalid input.")
34
+ }
35
+ super(youtube_video_tag)
36
+ this.youtube_video = youtube_video_tag.youtube_video
37
+ }
38
+
39
+ static is(youtube_video_tag : any) : youtube_video_tag is YoutubeVideoTagAux {
40
+ return (
41
+ YoutubeVideoTag.is(youtube_video_tag) &&
42
+ YoutubeVideo.is(youtube_video_tag.youtube_video)
43
+ )
44
+ }
45
+ }