vidnavigator 0.1.5 → 0.1.6

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.
@@ -3,14 +3,14 @@ export interface ServiceUsageJSON {
3
3
  limit: number | 'unlimited';
4
4
  remaining: number | 'unlimited';
5
5
  percentage: number;
6
- unit: string;
6
+ unit?: string;
7
7
  }
8
8
  export declare class ServiceUsage {
9
9
  used: number;
10
10
  limit: number | 'unlimited';
11
11
  remaining: number | 'unlimited';
12
12
  percentage: number;
13
- unit: string;
13
+ unit?: string;
14
14
  constructor(data: ServiceUsageJSON);
15
15
  static fromJSON(data: ServiceUsageJSON): ServiceUsage;
16
16
  }
@@ -34,41 +34,62 @@ export declare class StorageUsage {
34
34
  constructor(data: StorageUsageJSON);
35
35
  static fromJSON(data: StorageUsageJSON): StorageUsage;
36
36
  }
37
+ export type PlanInterval = 'month' | 'year';
37
38
  export interface UsageDataJSON {
38
- current_period: {
39
- start_date: string;
40
- end_date: string;
39
+ usage_period: {
40
+ start: string;
41
+ end: string;
42
+ };
43
+ billing_period: {
44
+ start: string;
45
+ end: string;
46
+ interval: PlanInterval;
41
47
  };
42
48
  subscription: {
43
49
  plan_id: string;
44
50
  plan_name: string;
51
+ interval: PlanInterval;
52
+ status: string;
53
+ cancel_at_period_end: boolean;
45
54
  };
46
55
  usage: {
47
56
  video_transcripts: ServiceUsageJSON;
48
57
  video_searches: ServiceUsageJSON;
49
58
  video_analyses: ServiceUsageJSON;
50
59
  video_scene_analyses: ServiceUsageJSON;
60
+ youtube_channels_scans: ServiceUsageJSON;
51
61
  video_uploads: ServiceUsageJSON;
52
62
  };
53
63
  storage: StorageUsageJSON;
64
+ generated_at: string;
54
65
  }
55
66
  export declare class UsageData {
56
- currentPeriod: {
57
- startDate: Date;
58
- endDate: Date;
67
+ usagePeriod: {
68
+ start: Date;
69
+ end: Date;
70
+ };
71
+ billingPeriod: {
72
+ start: Date;
73
+ end: Date;
74
+ interval: PlanInterval;
59
75
  };
60
76
  subscription: {
61
77
  planId: string;
62
78
  planName: string;
79
+ interval: PlanInterval;
80
+ status: string;
81
+ cancelAtPeriodEnd: boolean;
63
82
  };
64
83
  usage: {
65
84
  videoTranscripts: ServiceUsage;
66
85
  videoSearches: ServiceUsage;
67
86
  videoAnalyses: ServiceUsage;
68
87
  videoSceneAnalyses: ServiceUsage;
88
+ youtubeChannelsScans: ServiceUsage;
69
89
  videoUploads: ServiceUsage;
70
90
  };
71
91
  storage: StorageUsage;
92
+ generatedAt: Date;
72
93
  constructor(data: UsageDataJSON);
73
94
  static fromJSON(data: UsageDataJSON): UsageData;
74
95
  }
@@ -31,22 +31,32 @@ class StorageUsage {
31
31
  exports.StorageUsage = StorageUsage;
32
32
  class UsageData {
33
33
  constructor(data) {
34
- this.currentPeriod = {
35
- startDate: new Date(data.current_period.start_date),
36
- endDate: new Date(data.current_period.end_date),
34
+ this.usagePeriod = {
35
+ start: new Date(data.usage_period.start),
36
+ end: new Date(data.usage_period.end),
37
+ };
38
+ this.billingPeriod = {
39
+ start: new Date(data.billing_period.start),
40
+ end: new Date(data.billing_period.end),
41
+ interval: data.billing_period.interval,
37
42
  };
38
43
  this.subscription = {
39
44
  planId: data.subscription.plan_id,
40
45
  planName: data.subscription.plan_name,
46
+ interval: data.subscription.interval,
47
+ status: data.subscription.status,
48
+ cancelAtPeriodEnd: data.subscription.cancel_at_period_end,
41
49
  };
42
50
  this.usage = {
43
51
  videoTranscripts: ServiceUsage.fromJSON(data.usage.video_transcripts),
44
52
  videoSearches: ServiceUsage.fromJSON(data.usage.video_searches),
45
53
  videoAnalyses: ServiceUsage.fromJSON(data.usage.video_analyses),
46
54
  videoSceneAnalyses: ServiceUsage.fromJSON(data.usage.video_scene_analyses),
55
+ youtubeChannelsScans: ServiceUsage.fromJSON(data.usage.youtube_channels_scans),
47
56
  videoUploads: ServiceUsage.fromJSON(data.usage.video_uploads),
48
57
  };
49
58
  this.storage = StorageUsage.fromJSON(data.storage);
59
+ this.generatedAt = new Date(data.generated_at);
50
60
  }
51
61
  static fromJSON(data) {
52
62
  return new UsageData(data);
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "vidnavigator",
3
- "version": "0.1.5",
3
+ "version": "0.1.6",
4
4
  "description": "Official JavaScript SDK for the VidNavigator Developer API",
5
5
  "author": "VidNavigator",
6
6
  "license": "Apache-2.0",
@@ -3,7 +3,7 @@ export interface ServiceUsageJSON {
3
3
  limit: number | 'unlimited';
4
4
  remaining: number | 'unlimited';
5
5
  percentage: number;
6
- unit: string;
6
+ unit?: string;
7
7
  }
8
8
 
9
9
  export class ServiceUsage {
@@ -11,7 +11,7 @@ export class ServiceUsage {
11
11
  public limit: number | 'unlimited';
12
12
  public remaining: number | 'unlimited';
13
13
  public percentage: number;
14
- public unit: string;
14
+ public unit?: string;
15
15
 
16
16
  constructor(data: ServiceUsageJSON) {
17
17
  this.used = data.used;
@@ -60,60 +60,92 @@ export class StorageUsage {
60
60
  }
61
61
  }
62
62
 
63
+ export type PlanInterval = 'month' | 'year';
64
+
63
65
  export interface UsageDataJSON {
64
- current_period: {
65
- start_date: string;
66
- end_date: string;
66
+ usage_period: {
67
+ start: string;
68
+ end: string;
69
+ };
70
+ billing_period: {
71
+ start: string;
72
+ end: string;
73
+ interval: PlanInterval;
67
74
  };
68
75
  subscription: {
69
76
  plan_id: string;
70
77
  plan_name: string;
78
+ interval: PlanInterval;
79
+ status: string;
80
+ cancel_at_period_end: boolean;
71
81
  };
72
82
  usage: {
73
83
  video_transcripts: ServiceUsageJSON;
74
84
  video_searches: ServiceUsageJSON;
75
85
  video_analyses: ServiceUsageJSON;
76
86
  video_scene_analyses: ServiceUsageJSON;
87
+ youtube_channels_scans: ServiceUsageJSON;
77
88
  video_uploads: ServiceUsageJSON;
78
89
  };
79
90
  storage: StorageUsageJSON;
91
+ generated_at: string;
80
92
  }
81
93
 
82
94
  export class UsageData {
83
- public currentPeriod: {
84
- startDate: Date;
85
- endDate: Date;
95
+ public usagePeriod: {
96
+ start: Date;
97
+ end: Date;
98
+ };
99
+ public billingPeriod: {
100
+ start: Date;
101
+ end: Date;
102
+ interval: PlanInterval;
86
103
  };
87
104
  public subscription: {
88
105
  planId: string;
89
106
  planName: string;
107
+ interval: PlanInterval;
108
+ status: string;
109
+ cancelAtPeriodEnd: boolean;
90
110
  };
91
111
  public usage: {
92
112
  videoTranscripts: ServiceUsage;
93
113
  videoSearches: ServiceUsage;
94
114
  videoAnalyses: ServiceUsage;
95
115
  videoSceneAnalyses: ServiceUsage;
116
+ youtubeChannelsScans: ServiceUsage;
96
117
  videoUploads: ServiceUsage;
97
118
  };
98
119
  public storage: StorageUsage;
120
+ public generatedAt: Date;
99
121
 
100
122
  constructor(data: UsageDataJSON) {
101
- this.currentPeriod = {
102
- startDate: new Date(data.current_period.start_date),
103
- endDate: new Date(data.current_period.end_date),
123
+ this.usagePeriod = {
124
+ start: new Date(data.usage_period.start),
125
+ end: new Date(data.usage_period.end),
126
+ };
127
+ this.billingPeriod = {
128
+ start: new Date(data.billing_period.start),
129
+ end: new Date(data.billing_period.end),
130
+ interval: data.billing_period.interval,
104
131
  };
105
132
  this.subscription = {
106
133
  planId: data.subscription.plan_id,
107
134
  planName: data.subscription.plan_name,
135
+ interval: data.subscription.interval,
136
+ status: data.subscription.status,
137
+ cancelAtPeriodEnd: data.subscription.cancel_at_period_end,
108
138
  };
109
139
  this.usage = {
110
140
  videoTranscripts: ServiceUsage.fromJSON(data.usage.video_transcripts),
111
141
  videoSearches: ServiceUsage.fromJSON(data.usage.video_searches),
112
142
  videoAnalyses: ServiceUsage.fromJSON(data.usage.video_analyses),
113
143
  videoSceneAnalyses: ServiceUsage.fromJSON(data.usage.video_scene_analyses),
144
+ youtubeChannelsScans: ServiceUsage.fromJSON(data.usage.youtube_channels_scans),
114
145
  videoUploads: ServiceUsage.fromJSON(data.usage.video_uploads),
115
146
  };
116
147
  this.storage = StorageUsage.fromJSON(data.storage);
148
+ this.generatedAt = new Date(data.generated_at);
117
149
  }
118
150
 
119
151
  static fromJSON(data: UsageDataJSON): UsageData {