elections-types 1.1.10 → 1.1.12

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