Skip to content

Feature: Add support for restoring asset(s) by asset id #707

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 13 commits into
base: master
Choose a base branch
from

Conversation

esguerrat
Copy link

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.

@@ -1102,6 +1102,10 @@ declare module 'cloudinary' {

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.

@@ -29,7 +29,7 @@
"jsdoc": "^4.0.4",
"jsdom": "^9.12.0",
"jsdom-global": "2.1.1",
"mocha": "^6.2.3",
"mocha": "^7.2.0",
Copy link
Contributor

Choose a reason for hiding this comment

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

Was this intentional?

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.

2 participants