Skip to content

Commit

Permalink
Implementation
Browse files Browse the repository at this point in the history
  • Loading branch information
esezen committed Jul 26, 2024
1 parent 71bcdd6 commit 16452ec
Showing 1 changed file with 9 additions and 7 deletions.
16 changes: 9 additions & 7 deletions src/modules/catalog.js
Original file line number Diff line number Diff line change
Expand Up @@ -9,13 +9,15 @@ const helpers = require('../utils/helpers');
const { toSnakeCaseKeys } = require('../utils/helpers');

// Create URL from supplied path and options
function createCatalogUrl(path, options, additionalQueryParams = {}, apiVersion = 'v1') {
function createCatalogUrl(path, options, additionalQueryParams = {}, apiVersion = 'v1', includeCParam = true) {
const {
apiKey,
serviceUrl,
version,
} = options;
let queryParams = {
...additionalQueryParams,
c: includeCParam ? version : undefined,
};

// Validate path is provided
Expand Down Expand Up @@ -2169,7 +2171,7 @@ class Catalog {
const controller = new AbortController();
const { signal } = controller;
const { queryParams, formData } = await createQueryParamsAndFormData(parameters);
const requestUrl = createCatalogUrl('catalog', this.options, queryParams);
const requestUrl = createCatalogUrl('catalog', this.options, queryParams, undefined, false);

// Handle network timeout if specified
helpers.applyNetworkTimeout(this.options, networkParameters, controller);
Expand Down Expand Up @@ -2221,7 +2223,7 @@ class Catalog {
const controller = new AbortController();
const { signal } = controller;
const { queryParams, formData } = await createQueryParamsAndFormData(parameters);
const requestUrl = createCatalogUrl('catalog', this.options, queryParams);
const requestUrl = createCatalogUrl('catalog', this.options, queryParams, undefined, false);

// Handle network timeout if specified
helpers.applyNetworkTimeout(this.options, networkParameters, controller);
Expand Down Expand Up @@ -2274,7 +2276,7 @@ class Catalog {
const controller = new AbortController();
const { signal } = controller;
const { queryParams, formData } = await createQueryParamsAndFormData(parameters);
const requestUrl = createCatalogUrl('catalog', this.options, { ...queryParams, patch_delta: true });
const requestUrl = createCatalogUrl('catalog', this.options, { ...queryParams, patch_delta: true }, undefined, false);

// Handle network timeout if specified
helpers.applyNetworkTimeout(this.options, networkParameters, controller);
Expand Down Expand Up @@ -2331,7 +2333,7 @@ class Catalog {
queryParams.notification_email = notificationEmail;
}

const requestUrl = createCatalogUrl('catalog', this.options, queryParams);
const requestUrl = createCatalogUrl('catalog', this.options, queryParams, undefined, false);
// Handle network timeout if specified
helpers.applyNetworkTimeout(this.options, networkParameters, controller);

Expand Down Expand Up @@ -2388,7 +2390,7 @@ class Catalog {
queryParams.notification_email = notificationEmail;
}

const requestUrl = createCatalogUrl('catalog', this.options, queryParams);
const requestUrl = createCatalogUrl('catalog', this.options, queryParams, undefined, false);

// Handle network timeout if specified
helpers.applyNetworkTimeout(this.options, networkParameters, controller);
Expand Down Expand Up @@ -2445,7 +2447,7 @@ class Catalog {
queryParams.notification_email = notificationEmail;
}

const requestUrl = createCatalogUrl('catalog', this.options, { ...queryParams, patch_delta: true });
const requestUrl = createCatalogUrl('catalog', this.options, { ...queryParams, patch_delta: true }, undefined, false);

// Handle network timeout if specified
helpers.applyNetworkTimeout(this.options, networkParameters, controller);
Expand Down

0 comments on commit 16452ec

Please sign in to comment.