Code Monkey home page Code Monkey logo

Comments (5)

emmenko avatar emmenko commented on June 4, 2024 1

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.

Siilwyn avatar Siilwyn commented on June 4, 2024

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.

emmenko avatar emmenko commented on June 4, 2024

It's only if you provide custom services, the default services will all use the projectKey (for now) yes.

from nodejs.

hisabimbola avatar hisabimbola commented on June 4, 2024

This is okay for me too, we will go ahead with this...

from nodejs.

wizzy25 avatar wizzy25 commented on June 4, 2024

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)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo 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.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.