elections-types 1.1.10 → 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.
@@ -22,3 +22,4 @@ export * from "./types/User.js";
22
22
  export * from "./types/UserFederalElection.js";
23
23
  export * from "./types/Video.js";
24
24
  export * from "./types/YoutubeVideo.js";
25
+ export * from "./types/YoutubeVideoTag.js";
package/dist/src/index.js CHANGED
@@ -22,3 +22,4 @@ export * from "./types/User.js";
22
22
  export * from "./types/UserFederalElection.js";
23
23
  export * from "./types/Video.js";
24
24
  export * from "./types/YoutubeVideo.js";
25
+ export * from "./types/YoutubeVideoTag.js";
@@ -5,7 +5,6 @@ export declare class YoutubeVideo {
5
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;
@@ -5,7 +5,6 @@ export class YoutubeVideo {
5
5
  channel_name;
6
6
  title;
7
7
  description;
8
- tags;
9
8
  duration;
10
9
  fetch_time;
11
10
  s3_id;
@@ -19,7 +18,6 @@ export class YoutubeVideo {
19
18
  this.channel_name = youtube_video.channel_name;
20
19
  this.title = youtube_video.title;
21
20
  this.description = youtube_video.description;
22
- this.tags = youtube_video.tags;
23
21
  this.duration = youtube_video.duration;
24
22
  this.fetch_time = youtube_video.fetch_time;
25
23
  this.s3_id = youtube_video.s3_id;
@@ -32,7 +30,6 @@ export class YoutubeVideo {
32
30
  typeof youtube_video.channel_name === "string" &&
33
31
  typeof youtube_video.title === "string" &&
34
32
  typeof youtube_video.description === "string" &&
35
- (youtube_video.tags === undefined || Array.isArray(youtube_video.tags) && youtube_video.tags.map((tag) => typeof tag === "string")) &&
36
33
  (youtube_video.duration === undefined || typeof youtube_video.duration === "number" && !isNaN(youtube_video.duration)) &&
37
34
  typeof youtube_video.fetch_time === "string" &&
38
35
  (youtube_video.s3_id === undefined || typeof youtube_video.s3_id === "string"));
@@ -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.11",
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,5 @@ 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/YoutubeVideo"
25
+ export * from "./types/YoutubeVideoTag"
@@ -5,7 +5,6 @@ export class YoutubeVideo {
5
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
@@ -20,7 +19,6 @@ export class YoutubeVideo {
20
19
  this.channel_name = youtube_video.channel_name
21
20
  this.title = youtube_video.title
22
21
  this.description = youtube_video.description
23
- this.tags = youtube_video.tags
24
22
  this.duration = youtube_video.duration
25
23
  this.fetch_time = youtube_video.fetch_time
26
24
  this.s3_id = youtube_video.s3_id
@@ -35,7 +33,6 @@ export class YoutubeVideo {
35
33
  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")
@@ -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
+ }