elections-types 1.1.11 → 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,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,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,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
+ }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "elections-types",
3
- "version": "1.1.11",
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,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
  }