nodejs-common icon indicating copy to clipboard operation
nodejs-common copied to clipboard

Consistently return apiResponse across methods

Open callmehiphop opened this issue 6 years ago • 2 comments

In my quest to improve the TypeScript types here I re-discovered the beloved apiResponse parameter. I know this was brought up before elsewhere, but in some methods we return the entire response and in other places we only return the response body and I think it would be great if we could be consistent and always return one or the other.

My initial thought is that we should return the response body, my primary reasoning being that this is more consistent with gRPC APIs since they only ever return the response body equivalent. (I think?)

I'm happy to close this if others feel like this isn't something we should address, but with the end of Node 8 coming I figured now might be a good time to consider making this change.

callmehiphop avatar Oct 16 '19 17:10 callmehiphop

What are some methods that return the response as opposed to the body? I didn't even realize that was going on!

stephenplusplus avatar Oct 16 '19 18:10 stephenplusplus

@stephenplusplus I just learned of this not too long ago myself. AFAIK any methods that do not return a ServiceObject instance (getMetadata, setMetadata, delete, etc.) return the full response as the last parameter.

callmehiphop avatar Oct 16 '19 18:10 callmehiphop

Closing; feel free to reopen if it's an issue for anyone.

sofisl avatar Feb 02 '23 20:02 sofisl