Comments (5)
Thinking about this a bit more, if we put it in createRequestBuilder
, all services will have the projectKey
prefixed. This might be fine for most of the services but there might be some that do not need the projectKey
. In that case, having it in build
makes it more flexible but kind of verbose to use everytime.
I was thinking maybe of a solution in the middle, where you can explicitly "disable it" on demand.
createRequestBuilder({ projectKey: 'my-project' })
service.users.build({ withProjectKey: false })
Any thoughts?
from nodejs.
Could you give a real-life example of a service which works without the project key? The 'disable' option sounds good to me.
from nodejs.
It's only if you provide custom services, the default services will all use the projectKey
(for now) yes.
from nodejs.
This is okay for me too, we will go ahead with this...
from nodejs.
Would this implementation be ok, such that the createRequestBuilder
requires the project key and throws if it is omitted, but can then be overridden in the service.users.build
with the explicit withProjectKey
flag to be used to not send the project key to the server (defaults to true
)
createRequestBuilder({ projectKey: '' })
// throws an error
createRequestBuilder({ projectKey: 'my-project' })
service.users.build({ withProjectKey: false })
// doesn't throw but no projectKey in query
createRequestBuilder({ projectKey: 'my-project' })
service.users.build({ withProjectKey: true })
// doesn't throw and projectKey in query
createRequestBuilder({ projectKey: 'my-project' })
service.users.build()
// doesn't throw and projectKey in query
Any thoughts?
from nodejs.
Related Issues (20)
- Set fetch keepalive HOT 3
- To update version of the node-fetch in @commercetools/sdk-middleware-auth HOT 3
- [Sync-Actions] - add support for standalone prices
- Missing required polyfill for `sdk-middleware-http` package HOT 1
- Custom Objects Importer error regeneratorRuntime is not defined
- [sync-actions] Missing sync actions for API extensions
- problem with sdk-auth in esmodule HOT 1
- Standalone prices as part of api request builder services
- setCustomField Not updating values in CT using cart API
- Investigate Bulk Delete Discount failing for more than 10k HOT 6
- Discuss on Node.js Documentation
- Discount codes import Not working for 2k imports
- Product type exporter not working when enum value is type 'Set'
- [DiscountCodeImporter] Show meaningful error
- Commercial tools logo is not rendering
- Add support for Password Flow for Customers in a Store
- Unhandled Promise Rejections coming from sdk-middleware-http HOT 1
- '@commercetools/sync-actions' is missing type definitions
- Sanitize user input to prevent SQL injections
- Outdated resource links in docs for Resource Deleter
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from nodejs.