From 4a082f44c23ca468e4572dfd557858cca6fa0801 Mon Sep 17 00:00:00 2001 From: "github-actions[bot]" Date: Fri, 23 Jan 2026 08:07:22 +0000 Subject: [PATCH] feat: sync with Python SDK Source: videodb-python@auto/spec-sync-20260123-080020 Target: release-0.4.2 Trigger: spec_change Generated by OpenAI Codex --- Readme.md | 7 +-- docs/classes/core_audio.Audio.md | 2 +- docs/classes/core_collection.Collection.md | 21 ++++---- docs/classes/core_image.Image.md | 6 +-- docs/classes/core_video.Video.md | 6 +-- src/core/audio.ts | 22 ++++---- src/core/collection.ts | 59 ++++++++++++++++------ src/core/image.ts | 20 +++++--- src/core/video.ts | 19 +++++-- src/interfaces/core.ts | 17 ++++++- 10 files changed, 121 insertions(+), 58 deletions(-) diff --git a/Readme.md b/Readme.md index 6d0e8db..09f1c40 100644 --- a/Readme.md +++ b/Readme.md @@ -439,8 +439,8 @@ console.log(playerUrl); #### Delete the video ```ts -// Delete the video from the collection -await video.delete(); +// Delete the video from the collection (pass true to confirm) +await video.delete(true); ``` ### 🌟 More on `Collection` object @@ -460,7 +460,8 @@ const myVideo = coll.getVideo(id); #### Delete a video ```ts -await coll.deleteVideo(); +// Delete a video from the collection (pass true to confirm) +await coll.deleteVideo('VIDEO_ID', true); ``` --- diff --git a/docs/classes/core_audio.Audio.md b/docs/classes/core_audio.Audio.md index a0086dd..b6a3cb3 100644 --- a/docs/classes/core_audio.Audio.md +++ b/docs/classes/core_audio.Audio.md @@ -69,7 +69,7 @@ Initializes a VideoDB Instance ### delete -▸ **delete**(): `Promise`\<[`ResponseOf`](../modules/types_response.md#responseof)\<`Record`\<`string`, `never`\>\>\> +▸ **delete**(force: boolean): `Promise`\<[`ResponseOf`](../modules/types_response.md#responseof)\<`Record`\<`string`, `never`\>\>\> Returns an empty promise that resolves when the audio is deleted diff --git a/docs/classes/core_collection.Collection.md b/docs/classes/core_collection.Collection.md index a914c3d..47f22ed 100644 --- a/docs/classes/core_collection.Collection.md +++ b/docs/classes/core_collection.Collection.md @@ -76,15 +76,16 @@ The base class through which all videodb actions are possible ## Methods -### deleteAudio +### deleteAudio(audioId, force) -▸ **deleteAudio**(`audioId`): `Promise`\<[`ResponseOf`](../modules/types_response.md#responseof)\<`Record`\<`string`, `never`\>\>\> +▸ **deleteAudio**(`audioId`: string, `force`: boolean): `Promise`\<[`ResponseOf`](../modules/types_response.md#responseof)\<`Record`\<`string`, `never`\>\>\> #### Parameters | Name | Type | | :------ | :------ | | `audioId` | `string` | +| `force` | `boolean` | Must be true to confirm deletion. | #### Returns @@ -94,7 +95,7 @@ A promise that resolves when delete is successful **`Throws`** -an error if the request fails +Error if force is false, VideodbError or InvalidRequestError if request fails #### Defined in @@ -102,15 +103,16 @@ an error if the request fails ___ -### deleteImage +### deleteImage(imageId, force) -▸ **deleteImage**(`imageId`): `Promise`\<[`ResponseOf`](../modules/types_response.md#responseof)\<`Record`\<`string`, `never`\>\>\> +▸ **deleteImage**(`imageId`: string, `force`: boolean): `Promise`\<[`ResponseOf`](../modules/types_response.md#responseof)\<`Record`\<`string`, `never`\>\>\> #### Parameters | Name | Type | | :------ | :------ | | `imageId` | `string` | +| `force` | `boolean` | Must be true to confirm deletion. | #### Returns @@ -120,7 +122,7 @@ A promise that resolves when delete is successful **`Throws`** -an error if the request fails +Error if force is false, VideodbError or InvalidRequestError if request fails #### Defined in @@ -128,15 +130,16 @@ an error if the request fails ___ -### deleteVideo +### deleteVideo(videoId, force) -▸ **deleteVideo**(`videoId`): `Promise`\<[`ResponseOf`](../modules/types_response.md#responseof)\<`Record`\<`string`, `never`\>\>\> +▸ **deleteVideo**(`videoId`: string, `force`: boolean): `Promise`\<[`ResponseOf`](../modules/types_response.md#responseof)\<`Record`\<`string`, `never`\>\>\> #### Parameters | Name | Type | Description | | :------ | :------ | :------ | | `videoId` | `string` | Id of the video to be deleted | +| `force` | `boolean` | Must be true to confirm deletion. | #### Returns @@ -146,7 +149,7 @@ A promise that resolves when delete is successful **`Throws`** -an error if the request fails +Error if force is false, VideodbError or InvalidRequestError if request fails #### Implementation of diff --git a/docs/classes/core_image.Image.md b/docs/classes/core_image.Image.md index fc0bd01..fb3ffb2 100644 --- a/docs/classes/core_image.Image.md +++ b/docs/classes/core_image.Image.md @@ -69,11 +69,11 @@ Initializes a VideoDB Instance ## Methods -### delete +### delete(force) -▸ **delete**(): `Promise`\<[`ResponseOf`](../modules/types_response.md#responseof)\<`Record`\<`string`, `never`\>\>\> +▸ **delete**(force: boolean): `Promise`\<[`ResponseOf`](../modules/types_response.md#responseof)\<`Record`\<`string`, `never`\>\>\> -Returns an empty promise that resolves when the image is deleted +Deletes the image with confirmation when force is true. #### Returns diff --git a/docs/classes/core_video.Video.md b/docs/classes/core_video.Video.md index 5b23329..eebb6cb 100644 --- a/docs/classes/core_video.Video.md +++ b/docs/classes/core_video.Video.md @@ -146,11 +146,11 @@ an awaited stream url for subtitled overlayed video ___ -### delete +### delete(force) -▸ **delete**(): `Promise`\<[`ResponseOf`](../modules/types_response.md#responseof)\<`Record`\<`string`, `never`\>\>\> +▸ **delete**(force: boolean): `Promise`\<[`ResponseOf`](../modules/types_response.md#responseof)\<`Record`\<`string`, `never`\>\>\> -Returns an empty promise that resolves when the video is deleted +Deletes the video with confirmation when force is true. #### Returns diff --git a/src/core/audio.ts b/src/core/audio.ts index fd64fe9..1c8937a 100644 --- a/src/core/audio.ts +++ b/src/core/audio.ts @@ -22,16 +22,20 @@ export class Audio implements IAudio { this.meta = data; this.#vhttp = http; } - + /** - * Returns an empty promise that resolves when the audio is deleted - * @returns A promise that resolves when delete is successful - * @throws an InvalidRequestError if the request fails + * Deletes the audio with confirmation. + * @param force - Must be true to confirm deletion. + * @returns A promise that resolves when deletion is successful. + * @throws Error if force is false, InvalidRequestError if request fails. */ - public delete = async () => { - return await this.#vhttp.delete>([ - audio, - this.meta.id, - ]); + public delete = async (force: boolean) => { + if (!force) { + throw new Error("Parameter 'force' must be true to confirm deletion."); + } + return await this.#vhttp.delete>( + [audio, this.meta.id], + { data: { force } } + ); }; } diff --git a/src/core/collection.ts b/src/core/collection.ts index 49cb4ec..a5534e5 100644 --- a/src/core/collection.ts +++ b/src/core/collection.ts @@ -75,18 +75,23 @@ export class Collection implements ICollection { }; /** - * - * @param videoId - Id of the video to be deleted - * @returns A promise that resolves when delete is successful - * @throws an error if the request fails + * Deletes a video from the collection with confirmation. + * @param videoId - Id of the video to be deleted. + * @param force - Must be true to confirm deletion. + * @returns A promise that resolves when deletion is successful. + * @throws Error if force is false, VideodbError or InvalidRequestError if request fails. */ - public deleteVideo = async (videoId: string) => { + public deleteVideo = async (videoId: string, force: boolean) => { if (!videoId.trim()) { throw new VideodbError('Video ID cannot be empty'); } - return await this.#vhttp.delete>([video, videoId], { - params: { collection_id: this.meta.id }, - }); + if (!force) { + throw new Error("Parameter 'force' must be true to confirm deletion."); + } + return await this.#vhttp.delete>( + [video, videoId], + { params: { collection_id: this.meta.id }, data: { force } } + ); }; /** * Get all audios from the collection @@ -127,13 +132,24 @@ export class Collection implements ICollection { * @returns A promise that resolves when delete is successful * @throws an error if the request fails */ - public deleteAudio = async (audioId: string) => { + /** + * Deletes an audio from the collection with confirmation. + * @param audioId - Id of the audio to be deleted. + * @param force - Must be true to confirm deletion. + * @returns A promise that resolves when deletion is successful. + * @throws Error if force is false, VideodbError or InvalidRequestError if request fails. + */ + public deleteAudio = async (audioId: string, force: boolean) => { if (!audioId.trim()) { throw new VideodbError('Audio ID cannot be empty'); } - return await this.#vhttp.delete>([audio, audioId], { - params: { collection_id: this.meta.id }, - }); + if (!force) { + throw new Error("Parameter 'force' must be true to confirm deletion."); + } + return await this.#vhttp.delete>( + [audio, audioId], + { params: { collection_id: this.meta.id }, data: { force } } + ); }; /** * Get all images from the collection @@ -174,13 +190,24 @@ export class Collection implements ICollection { * @returns A promise that resolves when delete is successful * @throws an error if the request fails */ - public deleteImage = async (imageId: string) => { + /** + * Deletes an image from the collection with confirmation. + * @param imageId - Id of the image to be deleted. + * @param force - Must be true to confirm deletion. + * @returns A promise that resolves when deletion is successful. + * @throws Error if force is false, VideodbError or InvalidRequestError if request fails. + */ + public deleteImage = async (imageId: string, force: boolean) => { if (!imageId.trim()) { throw new VideodbError('Image ID cannot be empty'); } - return await this.#vhttp.delete>([image, imageId], { - params: { collection_id: this.meta.id }, - }); + if (!force) { + throw new Error("Parameter 'force' must be true to confirm deletion."); + } + return await this.#vhttp.delete>( + [image, imageId], + { params: { collection_id: this.meta.id }, data: { force } } + ); }; /** diff --git a/src/core/image.ts b/src/core/image.ts index 5bab378..c11e0c4 100644 --- a/src/core/image.ts +++ b/src/core/image.ts @@ -22,15 +22,19 @@ export class Image implements IImage { } /** - * Returns an empty promise that resolves when the image is deleted - * @returns A promise that resolves when delete is successful - * @throws an InvalidRequestError if the request fails + * Deletes the image with confirmation. + * @param force - Must be true to confirm deletion. + * @returns A promise that resolves when deletion is successful. + * @throws Error if force is false and InvalidRequestError if request fails. */ - public delete = async () => { - return await this.#vhttp.delete>([ - ApiPath.image, - this.meta.id, - ]); + public delete = async (force: boolean) => { + if (!force) { + throw new Error("Parameter 'force' must be true to confirm deletion."); + } + return await this.#vhttp.delete>( + [ApiPath.image, this.meta.id], + { data: { force } } + ); }; } diff --git a/src/core/video.ts b/src/core/video.ts index 66ecb22..c5313db 100644 --- a/src/core/video.ts +++ b/src/core/video.ts @@ -88,11 +88,20 @@ export class Video implements IVideo { * @returns A promise that resolves when delete is successful * @throws an InvalidRequestError if the request fails */ - public delete = async () => { - return await this.#vhttp.delete>([ - video, - this.meta.id, - ]); + /** + * Deletes the video with confirmation. + * @param force - Must be true to confirm deletion. + * @returns A promise that resolves when deletion is successful. + * @throws Error if force is false and InvalidRequestError if request fails. + */ + public delete = async (force: boolean) => { + if (!force) { + throw new Error("Parameter 'force' must be true to confirm deletion."); + } + return await this.#vhttp.delete>( + [video, this.meta.id], + { data: { force } } + ); }; /** diff --git a/src/interfaces/core.ts b/src/interfaces/core.ts index ecd93fc..8d43f4b 100644 --- a/src/interfaces/core.ts +++ b/src/interfaces/core.ts @@ -22,9 +22,18 @@ export interface ICollection { meta: CollectionBase; getVideos: () => Promise; getVideo: (videoId: string) => Promise