Skip to content

Conversation

@esguerrat
Copy link
Contributor

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?

  • GitHub issue (Add reference - #XX)
  • Refactoring
  • [ x] New feature
  • Bug fix
  • Adds more tests

Are Tests Included?

  • [ x] Yes
  • No

Copy link
Contributor

@cloudinary-pkoniu cloudinary-pkoniu left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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>;
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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.

@esguerrat esguerrat merged commit 8d9b2a0 into master Sep 26, 2025
64 of 80 checks passed
@esguerrat esguerrat deleted the feature-restore-resources-by-asset-id branch September 26, 2025 15:12
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants