nodejs icon indicating copy to clipboard operation
nodejs copied to clipboard

api-request-builder: Request to Add Locale and Store Query Parameters

Open jonsharratt opened this issue 3 years ago • 0 comments

Support reference number

N/A

Description

Currently we are unable to use / apply store or locale query parameters using the fluent api request builder package.

const uri = requestBuilder.productProjections
  .locale('locale')
  .byKey('key')
  .build();
  
const uri = requestBuilder.productProjections
  .store('store')
  .byKey('key')
  .build();

ref: https://docs.commercetools.com/api/projects/productProjections#get-productprojection-by-key

Expected Behavior

See possible solution and examples of what we would hope could be a possible api addition.

Current Behavior

Functions for these beta Query Parameters currently not available.

Context

Looking to keep our codebase clean and use the fluent api for all of our requests.

Possible Solution

Add the beta options for:

  • storeProjection
  • localeProjection
 const uri = requestBuilder.productProjections
      .locale('de-DE')
      .byKey('key')
      .build();
 const uri = requestBuilder.productProjections
      .store('store')
      .byKey('key')
      .build();

https://github.com/commercetools/nodejs/blob/aa630f042929864d0a06a6461e876ec305d5a775/packages/api-request-builder/src/query-projection.js

jonsharratt avatar Mar 22 '21 15:03 jonsharratt