Feature: Add support for restoring asset(s) by asset id#707
Merged
Feature: Add support for restoring asset(s) by asset id#707
Conversation
cloudinary-pkoniu
requested changes
Apr 22, 2025
Contributor
There was a problem hiding this comment.
Great job, I left two comments, please take a look.
Also, if I see correctly, some specs are failing in some of the node versions, please take a look at those too.
types/index.d.ts
Outdated
|
|
||
| function restore(public_ids: string[], callback?: ResponseCallback): Promise<any>; | ||
|
|
||
| function restore_by_asset_ids(asset_ids: string[] | string, options?: AdminAndResourceOptions, callback?: ResponseCallback): Promise<ResourceApiResponse>; |
Contributor
There was a problem hiding this comment.
If I see correctly, the implementation of restore_by_asset_ids doesn't support passing a single value, we're only passing the first argument as a payload when doing the request to Admin API.
Currently Admin API only supports a list of values under asset_ids which means that, either this type definition needs to change to string[] or we should wrap the first argument in array if it's not already an array, in the restore_by_asset_ids implementation.
…o fix test failures
…vert unnecessary mocha version change
…ources-by-asset-id
Co-authored-by: Patryk Konior <97894263+cloudinary-pkoniu@users.noreply.github.com>
cloudinary-pkoniu
approved these changes
Sep 23, 2025
6FA6
div>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Brief Summary of Changes
This PR adds support for restoring one or more assets by asset_id, via the following endpoint: POST /resources/restore/:asset_ids
Documentation reference: https://cloudinary.com/documentation/admin_api#restore_resources_by_asset_id
What Does This PR Address?
Are Tests Included?