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