vidnavigator 2.0.0 → 2.1.0
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 +5 -6
- package/dist/index.d.ts +2 -3
- package/dist/index.js +3 -4
- package/dist/models/AsyncJob.d.ts +5 -0
- package/dist/models/AsyncJob.js +2 -0
- package/dist/webhooks.d.ts +2 -0
- package/package.json +39 -39
- package/src/index.ts +1081 -1082
- package/src/models/AsyncJob.ts +6 -0
- package/src/webhooks.ts +2 -0
package/src/models/AsyncJob.ts
CHANGED
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
import { UsageBlock } from './Usage';
|
|
2
|
+
import { VideoInfo, VideoInfoJSON } from './VideoInfo';
|
|
2
3
|
|
|
3
4
|
/** Async job kinds returned by the `/transcribe/async`, `/extract/video/async` and `/tweet/statement/async` endpoints. */
|
|
4
5
|
export type AsyncJobType = 'transcribe' | 'extract_video' | 'tweet_statement';
|
|
@@ -83,6 +84,8 @@ export interface AsyncJobJSON {
|
|
|
83
84
|
check_status_url?: string;
|
|
84
85
|
webhook?: AsyncJobWebhookStatus | null;
|
|
85
86
|
result?: any;
|
|
87
|
+
/** `extract_video` jobs, once completed: the `video_info` the synchronous endpoint returns. */
|
|
88
|
+
video_info?: VideoInfoJSON;
|
|
86
89
|
error?: AsyncJobError | null;
|
|
87
90
|
}
|
|
88
91
|
|
|
@@ -105,6 +108,8 @@ export class AsyncJob<TResult> {
|
|
|
105
108
|
check_status_url?: string;
|
|
106
109
|
webhook?: AsyncJobWebhookStatus | null;
|
|
107
110
|
result: TResult | null;
|
|
111
|
+
/** `extract_video` jobs, once completed: metadata of the video the data was extracted from. */
|
|
112
|
+
video_info?: VideoInfo;
|
|
108
113
|
error: AsyncJobError | null;
|
|
109
114
|
/** Per-call usage, populated only when polled with `include_usage: true` and `task_status === 'completed'`. */
|
|
110
115
|
usage?: UsageBlock;
|
|
@@ -121,6 +126,7 @@ export class AsyncJob<TResult> {
|
|
|
121
126
|
this.check_status_url = data.check_status_url;
|
|
122
127
|
this.webhook = data.webhook;
|
|
123
128
|
this.result = data.result !== undefined && data.result !== null ? parseResult(data.result) : null;
|
|
129
|
+
this.video_info = data.video_info ? VideoInfo.fromJSON(data.video_info) : undefined;
|
|
124
130
|
this.error = data.error ?? null;
|
|
125
131
|
}
|
|
126
132
|
|
package/src/webhooks.ts
CHANGED
|
@@ -44,6 +44,8 @@ export interface WebhookEvent {
|
|
|
44
44
|
result?: Record<string, unknown> | TikTokWebhookResult | null;
|
|
45
45
|
/** True when the result exceeded 256 KB; fetch it with `resume(task_id).result()` instead. */
|
|
46
46
|
result_truncated?: boolean;
|
|
47
|
+
/** `extract_video.completed` only: raw `video_info` of the video. Sent even when `result_truncated` is true. */
|
|
48
|
+
video_info?: Record<string, unknown>;
|
|
47
49
|
error?: AsyncJobError | null;
|
|
48
50
|
};
|
|
49
51
|
}
|