vidnavigator 0.1.3 → 0.1.5

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/README.md CHANGED
@@ -99,6 +99,9 @@ All methods return a `Promise` that resolves with an object containing rich data
99
99
  ### Transcripts
100
100
  - `vn.getTranscript(payload)`
101
101
 
102
+ ### Transcribe
103
+ - `vn.transcribeVideo(payload)`
104
+
102
105
  ### Files
103
106
  - `vn.getFiles([query])`
104
107
  - `vn.getFile(file_id)`
package/dist/index.d.ts CHANGED
@@ -1,5 +1,5 @@
1
1
  import { AxiosRequestConfig } from 'axios';
2
- import { VideoInfo, TranscriptSegment, FileInfo, AnalysisResult, VideoSearchResult, FileSearchResult } from './models';
2
+ import { VideoInfo, TranscriptSegment, FileInfo, AnalysisResult, VideoSearchResult, FileSearchResult, UsageData } from './models';
3
3
  export * from './models';
4
4
  export * from './errors';
5
5
  export interface SDKConfig {
@@ -18,6 +18,12 @@ export declare class VidNavigatorClient {
18
18
  video_info: VideoInfo;
19
19
  transcript: TranscriptSegment[];
20
20
  }>;
21
+ transcribeVideo(payload: {
22
+ video_url: string;
23
+ }): Promise<{
24
+ video_info: VideoInfo;
25
+ transcript: TranscriptSegment[];
26
+ }>;
21
27
  getFiles(query?: {
22
28
  limit?: number;
23
29
  offset?: number;
@@ -93,6 +99,6 @@ export declare class VidNavigatorClient {
93
99
  total_found: number;
94
100
  explanation?: string;
95
101
  }>;
96
- getUsage(): Promise<any>;
102
+ getUsage(): Promise<UsageData>;
97
103
  healthCheck(): Promise<any>;
98
104
  }
package/dist/index.js CHANGED
@@ -90,6 +90,13 @@ class VidNavigatorClient {
90
90
  transcript: response.data.transcript.map(models_1.TranscriptSegment.fromJSON),
91
91
  };
92
92
  }
93
+ async transcribeVideo(payload) {
94
+ const response = await this.request('POST', '/transcribe', payload);
95
+ return {
96
+ video_info: models_1.VideoInfo.fromJSON(response.data.video_info),
97
+ transcript: response.data.transcript.map(models_1.TranscriptSegment.fromJSON),
98
+ };
99
+ }
93
100
  //endregion
94
101
  //region --- Files ---
95
102
  async getFiles(query) {
@@ -176,7 +183,7 @@ class VidNavigatorClient {
176
183
  //region --- System ---
177
184
  async getUsage() {
178
185
  const response = await this.request('GET', '/usage');
179
- return response.data;
186
+ return models_1.UsageData.fromJSON(response.data);
180
187
  }
181
188
  async healthCheck() {
182
189
  const response = await this.client.get('/health');
@@ -0,0 +1,74 @@
1
+ export interface ServiceUsageJSON {
2
+ used: number;
3
+ limit: number | 'unlimited';
4
+ remaining: number | 'unlimited';
5
+ percentage: number;
6
+ unit: string;
7
+ }
8
+ export declare class ServiceUsage {
9
+ used: number;
10
+ limit: number | 'unlimited';
11
+ remaining: number | 'unlimited';
12
+ percentage: number;
13
+ unit: string;
14
+ constructor(data: ServiceUsageJSON);
15
+ static fromJSON(data: ServiceUsageJSON): ServiceUsage;
16
+ }
17
+ export interface StorageUsageJSON {
18
+ used_bytes: number;
19
+ used_formatted: string;
20
+ limit_bytes: number | 'unlimited';
21
+ limit_formatted: string;
22
+ remaining_bytes: number | 'unlimited';
23
+ remaining_formatted: string;
24
+ percentage: number;
25
+ }
26
+ export declare class StorageUsage {
27
+ usedBytes: number;
28
+ usedFormatted: string;
29
+ limitBytes: number | 'unlimited';
30
+ limitFormatted: string;
31
+ remainingBytes: number | 'unlimited';
32
+ remainingFormatted: string;
33
+ percentage: number;
34
+ constructor(data: StorageUsageJSON);
35
+ static fromJSON(data: StorageUsageJSON): StorageUsage;
36
+ }
37
+ export interface UsageDataJSON {
38
+ current_period: {
39
+ start_date: string;
40
+ end_date: string;
41
+ };
42
+ subscription: {
43
+ plan_id: string;
44
+ plan_name: string;
45
+ };
46
+ usage: {
47
+ video_transcripts: ServiceUsageJSON;
48
+ video_searches: ServiceUsageJSON;
49
+ video_analyses: ServiceUsageJSON;
50
+ video_scene_analyses: ServiceUsageJSON;
51
+ video_uploads: ServiceUsageJSON;
52
+ };
53
+ storage: StorageUsageJSON;
54
+ }
55
+ export declare class UsageData {
56
+ currentPeriod: {
57
+ startDate: Date;
58
+ endDate: Date;
59
+ };
60
+ subscription: {
61
+ planId: string;
62
+ planName: string;
63
+ };
64
+ usage: {
65
+ videoTranscripts: ServiceUsage;
66
+ videoSearches: ServiceUsage;
67
+ videoAnalyses: ServiceUsage;
68
+ videoSceneAnalyses: ServiceUsage;
69
+ videoUploads: ServiceUsage;
70
+ };
71
+ storage: StorageUsage;
72
+ constructor(data: UsageDataJSON);
73
+ static fromJSON(data: UsageDataJSON): UsageData;
74
+ }
@@ -0,0 +1,55 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.UsageData = exports.StorageUsage = exports.ServiceUsage = void 0;
4
+ class ServiceUsage {
5
+ constructor(data) {
6
+ this.used = data.used;
7
+ this.limit = data.limit;
8
+ this.remaining = data.remaining;
9
+ this.percentage = data.percentage;
10
+ this.unit = data.unit;
11
+ }
12
+ static fromJSON(data) {
13
+ return new ServiceUsage(data);
14
+ }
15
+ }
16
+ exports.ServiceUsage = ServiceUsage;
17
+ class StorageUsage {
18
+ constructor(data) {
19
+ this.usedBytes = data.used_bytes;
20
+ this.usedFormatted = data.used_formatted;
21
+ this.limitBytes = data.limit_bytes;
22
+ this.limitFormatted = data.limit_formatted;
23
+ this.remainingBytes = data.remaining_bytes;
24
+ this.remainingFormatted = data.remaining_formatted;
25
+ this.percentage = data.percentage;
26
+ }
27
+ static fromJSON(data) {
28
+ return new StorageUsage(data);
29
+ }
30
+ }
31
+ exports.StorageUsage = StorageUsage;
32
+ class UsageData {
33
+ constructor(data) {
34
+ this.currentPeriod = {
35
+ startDate: new Date(data.current_period.start_date),
36
+ endDate: new Date(data.current_period.end_date),
37
+ };
38
+ this.subscription = {
39
+ planId: data.subscription.plan_id,
40
+ planName: data.subscription.plan_name,
41
+ };
42
+ this.usage = {
43
+ videoTranscripts: ServiceUsage.fromJSON(data.usage.video_transcripts),
44
+ videoSearches: ServiceUsage.fromJSON(data.usage.video_searches),
45
+ videoAnalyses: ServiceUsage.fromJSON(data.usage.video_analyses),
46
+ videoSceneAnalyses: ServiceUsage.fromJSON(data.usage.video_scene_analyses),
47
+ videoUploads: ServiceUsage.fromJSON(data.usage.video_uploads),
48
+ };
49
+ this.storage = StorageUsage.fromJSON(data.storage);
50
+ }
51
+ static fromJSON(data) {
52
+ return new UsageData(data);
53
+ }
54
+ }
55
+ exports.UsageData = UsageData;
@@ -1,5 +1,6 @@
1
- export * from './VideoInfo';
2
- export * from './TranscriptSegment';
3
- export * from './FileInfo';
4
1
  export * from './AnalysisResult';
2
+ export * from './FileInfo';
5
3
  export * from './SearchResult';
4
+ export * from './TranscriptSegment';
5
+ export * from './VideoInfo';
6
+ export * from './Usage';
@@ -14,8 +14,9 @@ var __exportStar = (this && this.__exportStar) || function(m, exports) {
14
14
  for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
15
15
  };
16
16
  Object.defineProperty(exports, "__esModule", { value: true });
17
- __exportStar(require("./VideoInfo"), exports);
18
- __exportStar(require("./TranscriptSegment"), exports);
19
- __exportStar(require("./FileInfo"), exports);
20
17
  __exportStar(require("./AnalysisResult"), exports);
18
+ __exportStar(require("./FileInfo"), exports);
21
19
  __exportStar(require("./SearchResult"), exports);
20
+ __exportStar(require("./TranscriptSegment"), exports);
21
+ __exportStar(require("./VideoInfo"), exports);
22
+ __exportStar(require("./Usage"), exports);
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "vidnavigator",
3
- "version": "0.1.3",
3
+ "version": "0.1.5",
4
4
  "description": "Official JavaScript SDK for the VidNavigator Developer API",
5
5
  "author": "VidNavigator",
6
6
  "license": "Apache-2.0",
package/src/index.ts CHANGED
@@ -14,6 +14,8 @@ import {
14
14
  VideoSearchResultJSON,
15
15
  FileSearchResult,
16
16
  FileSearchResultJSON,
17
+ UsageData,
18
+ UsageDataJSON,
17
19
  } from './models';
18
20
  import {
19
21
  VidNavigatorError,
@@ -118,6 +120,21 @@ export class VidNavigatorClient {
118
120
  transcript: response.data.transcript.map(TranscriptSegment.fromJSON),
119
121
  };
120
122
  }
123
+
124
+ async transcribeVideo(payload: { video_url: string }): Promise<{
125
+ video_info: VideoInfo;
126
+ transcript: TranscriptSegment[];
127
+ }> {
128
+ const response = await this.request<ApiSuccessResponse<{
129
+ video_info: VideoInfoJSON;
130
+ transcript: TranscriptSegmentJSON[];
131
+ }>>('POST', '/transcribe', payload);
132
+
133
+ return {
134
+ video_info: VideoInfo.fromJSON(response.data.video_info),
135
+ transcript: response.data.transcript.map(TranscriptSegment.fromJSON),
136
+ };
137
+ }
121
138
  //endregion
122
139
 
123
140
  //region --- Files ---
@@ -284,9 +301,9 @@ export class VidNavigatorClient {
284
301
  //endregion
285
302
 
286
303
  //region --- System ---
287
- async getUsage(): Promise<any> {
288
- const response = await this.request<ApiSuccessResponse<any>>('GET', '/usage');
289
- return response.data;
304
+ async getUsage(): Promise<UsageData> {
305
+ const response = await this.request<ApiSuccessResponse<UsageDataJSON>>('GET', '/usage');
306
+ return UsageData.fromJSON(response.data);
290
307
  }
291
308
 
292
309
  async healthCheck(): Promise<any> {
@@ -0,0 +1,122 @@
1
+ export interface ServiceUsageJSON {
2
+ used: number;
3
+ limit: number | 'unlimited';
4
+ remaining: number | 'unlimited';
5
+ percentage: number;
6
+ unit: string;
7
+ }
8
+
9
+ export class ServiceUsage {
10
+ public used: number;
11
+ public limit: number | 'unlimited';
12
+ public remaining: number | 'unlimited';
13
+ public percentage: number;
14
+ public unit: string;
15
+
16
+ constructor(data: ServiceUsageJSON) {
17
+ this.used = data.used;
18
+ this.limit = data.limit;
19
+ this.remaining = data.remaining;
20
+ this.percentage = data.percentage;
21
+ this.unit = data.unit;
22
+ }
23
+
24
+ static fromJSON(data: ServiceUsageJSON): ServiceUsage {
25
+ return new ServiceUsage(data);
26
+ }
27
+ }
28
+
29
+ export interface StorageUsageJSON {
30
+ used_bytes: number;
31
+ used_formatted: string;
32
+ limit_bytes: number | 'unlimited';
33
+ limit_formatted: string;
34
+ remaining_bytes: number | 'unlimited';
35
+ remaining_formatted: string;
36
+ percentage: number;
37
+ }
38
+
39
+ export class StorageUsage {
40
+ public usedBytes: number;
41
+ public usedFormatted: string;
42
+ public limitBytes: number | 'unlimited';
43
+ public limitFormatted: string;
44
+ public remainingBytes: number | 'unlimited';
45
+ public remainingFormatted: string;
46
+ public percentage: number;
47
+
48
+ constructor(data: StorageUsageJSON) {
49
+ this.usedBytes = data.used_bytes;
50
+ this.usedFormatted = data.used_formatted;
51
+ this.limitBytes = data.limit_bytes;
52
+ this.limitFormatted = data.limit_formatted;
53
+ this.remainingBytes = data.remaining_bytes;
54
+ this.remainingFormatted = data.remaining_formatted;
55
+ this.percentage = data.percentage;
56
+ }
57
+
58
+ static fromJSON(data: StorageUsageJSON): StorageUsage {
59
+ return new StorageUsage(data);
60
+ }
61
+ }
62
+
63
+ export interface UsageDataJSON {
64
+ current_period: {
65
+ start_date: string;
66
+ end_date: string;
67
+ };
68
+ subscription: {
69
+ plan_id: string;
70
+ plan_name: string;
71
+ };
72
+ usage: {
73
+ video_transcripts: ServiceUsageJSON;
74
+ video_searches: ServiceUsageJSON;
75
+ video_analyses: ServiceUsageJSON;
76
+ video_scene_analyses: ServiceUsageJSON;
77
+ video_uploads: ServiceUsageJSON;
78
+ };
79
+ storage: StorageUsageJSON;
80
+ }
81
+
82
+ export class UsageData {
83
+ public currentPeriod: {
84
+ startDate: Date;
85
+ endDate: Date;
86
+ };
87
+ public subscription: {
88
+ planId: string;
89
+ planName: string;
90
+ };
91
+ public usage: {
92
+ videoTranscripts: ServiceUsage;
93
+ videoSearches: ServiceUsage;
94
+ videoAnalyses: ServiceUsage;
95
+ videoSceneAnalyses: ServiceUsage;
96
+ videoUploads: ServiceUsage;
97
+ };
98
+ public storage: StorageUsage;
99
+
100
+ constructor(data: UsageDataJSON) {
101
+ this.currentPeriod = {
102
+ startDate: new Date(data.current_period.start_date),
103
+ endDate: new Date(data.current_period.end_date),
104
+ };
105
+ this.subscription = {
106
+ planId: data.subscription.plan_id,
107
+ planName: data.subscription.plan_name,
108
+ };
109
+ this.usage = {
110
+ videoTranscripts: ServiceUsage.fromJSON(data.usage.video_transcripts),
111
+ videoSearches: ServiceUsage.fromJSON(data.usage.video_searches),
112
+ videoAnalyses: ServiceUsage.fromJSON(data.usage.video_analyses),
113
+ videoSceneAnalyses: ServiceUsage.fromJSON(data.usage.video_scene_analyses),
114
+ videoUploads: ServiceUsage.fromJSON(data.usage.video_uploads),
115
+ };
116
+ this.storage = StorageUsage.fromJSON(data.storage);
117
+ }
118
+
119
+ static fromJSON(data: UsageDataJSON): UsageData {
120
+ return new UsageData(data);
121
+ }
122
+ }
@@ -1,5 +1,6 @@
1
- export * from './VideoInfo';
2
- export * from './TranscriptSegment';
3
- export * from './FileInfo';
4
1
  export * from './AnalysisResult';
5
- export * from './SearchResult';
2
+ export * from './FileInfo';
3
+ export * from './SearchResult';
4
+ export * from './TranscriptSegment';
5
+ export * from './VideoInfo';
6
+ export * from './Usage';