Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
ASSETS-34548 : Update the Collection API Endpoints (#39)
* Check in working code with hardcoded collectionId urn:cid:aem:8f67c491-347a-4c50-a55b-aad555671b22 which is a collection that was created with the new api to create a collection https://adobe-aem-assets-delivery-experimental.redoc.ly/#operation/createCollection Once the List All Collections API is working can this code be updated to be completed * In collection.js added new function export async function searchListCollection(limit = undefined, page = 0) Pagination in files /adobe-gmo/blocks/adp-infinite-results-collections/CollectionsDatasource.js Needs to be fixed as not all the new Collections are showing up * Fixed pagination logic for this.lastPage * /blocks/adp-infinite-results-collection/CollectionDatasource.js => Pagination for the Collection Cards needs to be fixed /scripts/collections.js : Tested that the getCollection method only works with the new Collections created with the Create and Update Collection API calls /adobe/assets/collections/{collectionId}/ * Updated deleteCollection function, added etag parameter as it required in the header in the new Assets Delete API * Updated function patchCollection API URL from ${getBaseAssetsCollectionsUrl()}/${collectionId} to ${getBaseAssetsCollectionsUrl()}/${collectionId}/items * /scripts/collections.js ==> Updated function searchListCollection(limit = undefined, page = 0), added logic when the parameter page = null to not add the page parameter in the data / body parameters /blocks/adp-add-to-collection-modal/adp-add-to-collection-modal.js : Removed hard coded getCollection('urn:cid:aem:8f67c491-347a-4c50-a55b-aad555671b22') call to call the selected collection for add to an existing collection. * Check in latest collection modal code * Deleted/removed Caching for JSON data for when the app is run on localhost * /scripts/scripts.js Restored the caching of collection data for localhost /scripts/collections.js : Removed deprecated listCollection function /blocks/adp-add-to-collection-modal/adp-add-to-collection-modal.js : Removed all the commented out old code that called listCollections /blocks/adp-add-to-collection-modal/adp-add-to-collection-modal.js : Removed all the commented out old code that called listCollections * Added code to get the Search Collection Index from the configuration file admin-config.json which is stored in a new property searchCollectionIndex e.g. { "ID": "searchCollectionIndex", "Value": "108396-1046543_collections" } * Updated function loadMoreData to get all the collections to populate them in the Collection dropdown list. Deleted the dropdownSelect.addEventListener('scroll' .... as the <select> tag does not support the scroll event * Deleted event listener dropdownSelect.addEventListener('scroll' .. as it not used. * Fixed lint errors * Pull Request code changes. * PR review code change to remove redundant code * Removed redundant if statement * Removed 'x-ch-Request': 'search' from header of Search Collections Endpoint * Replaced with 'x-api-key': getBackendApiKey(), * Added 'x-adp-request': 'search' to the header for the Search Collections call
- Loading branch information