Skip to content

Commit

Permalink
Updated function searchAsset(programName, campaignName, deliverableTy…
Browse files Browse the repository at this point in the history
…pe = '', imageWidth = 80)

Added new parameter deliverableType, moved parameter  imageWidth to be the last parameter.
  • Loading branch information
TyroneAEM committed Jul 17, 2024
1 parent a668e8a commit 6ebc1ce
Showing 1 changed file with 8 additions and 2 deletions.
10 changes: 8 additions & 2 deletions scripts/assets.js
Original file line number Diff line number Diff line change
Expand Up @@ -41,15 +41,17 @@ async function getUnderdevelopmentIcon() {
}

/**
* Search Asset for programName and campaignName parameters.
* Search Asset for programName, campaignName, deliverableType parameters.
*
* @param {string} - Program Name.
* @param {string} - Campaign Name.
* @param {string} - Deliverable Type
* @param {integer} - Image Width
* @returns {Image <object>} Resolves with image object.
* @throws {Error} If an HTTP error or network error occurs.
*/

export async function searchAsset(programName, campaignName, imageWidth = 80) {
export async function searchAsset(programName, campaignName, deliverableType = '', imageWidth = 80) {
const adminConfig = await getAdminConfig();
const deliveryURL = await initDeliveryEnvironment();

Expand All @@ -69,6 +71,10 @@ export async function searchAsset(programName, campaignName, imageWidth = 80) {
if (campaignName) { // Check if campaignName is not null
facetFilters.push('gmo-campaignName :'+ campaignName);
}

if (deliverableType) { // Check if deliverableType is not null
facetFilters.push('gmo-deliverableType :'+ deliverableType);
}
const data = {
requests: [
{
Expand Down

0 comments on commit 6ebc1ce

Please sign in to comment.