vidnavigator 0.1.3 → 0.1.4
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/dist/index.d.ts +2 -2
- package/dist/index.js +1 -1
- package/dist/models/Usage.d.ts +74 -0
- package/dist/models/Usage.js +55 -0
- package/dist/models/index.d.ts +4 -3
- package/dist/models/index.js +4 -3
- package/package.json +1 -1
- package/src/index.ts +5 -3
- package/src/models/Usage.ts +122 -0
- package/src/models/index.ts +5 -4
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 {
|
|
@@ -93,6 +93,6 @@ export declare class VidNavigatorClient {
|
|
|
93
93
|
total_found: number;
|
|
94
94
|
explanation?: string;
|
|
95
95
|
}>;
|
|
96
|
-
getUsage(): Promise<
|
|
96
|
+
getUsage(): Promise<UsageData>;
|
|
97
97
|
healthCheck(): Promise<any>;
|
|
98
98
|
}
|
package/dist/index.js
CHANGED
|
@@ -176,7 +176,7 @@ class VidNavigatorClient {
|
|
|
176
176
|
//region --- System ---
|
|
177
177
|
async getUsage() {
|
|
178
178
|
const response = await this.request('GET', '/usage');
|
|
179
|
-
return response.data;
|
|
179
|
+
return models_1.UsageData.fromJSON(response.data);
|
|
180
180
|
}
|
|
181
181
|
async healthCheck() {
|
|
182
182
|
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;
|
package/dist/models/index.d.ts
CHANGED
|
@@ -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';
|
package/dist/models/index.js
CHANGED
|
@@ -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
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,
|
|
@@ -284,9 +286,9 @@ export class VidNavigatorClient {
|
|
|
284
286
|
//endregion
|
|
285
287
|
|
|
286
288
|
//region --- System ---
|
|
287
|
-
async getUsage(): Promise<
|
|
288
|
-
const response = await this.request<ApiSuccessResponse<
|
|
289
|
-
return response.data;
|
|
289
|
+
async getUsage(): Promise<UsageData> {
|
|
290
|
+
const response = await this.request<ApiSuccessResponse<UsageDataJSON>>('GET', '/usage');
|
|
291
|
+
return UsageData.fromJSON(response.data);
|
|
290
292
|
}
|
|
291
293
|
|
|
292
294
|
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
|
+
}
|
package/src/models/index.ts
CHANGED
|
@@ -1,5 +1,6 @@
|
|
|
1
|
-
export * from './VideoInfo';
|
|
2
|
-
export * from './TranscriptSegment';
|
|
3
|
-
export * from './FileInfo';
|
|
4
1
|
export * from './AnalysisResult';
|
|
5
|
-
export * from './
|
|
2
|
+
export * from './FileInfo';
|
|
3
|
+
export * from './SearchResult';
|
|
4
|
+
export * from './TranscriptSegment';
|
|
5
|
+
export * from './VideoInfo';
|
|
6
|
+
export * from './Usage';
|