Make option passing down to the client constructor more consistent

pull/5900/head
murgatroid99 9 years ago
parent 27b8d900bc
commit 51b81c1e55
  1. 10
      src/node/src/client.js

@ -695,7 +695,8 @@ var deprecated_request_wrap = {
* responseDeserialize: function to deserialize response objects * responseDeserialize: function to deserialize response objects
* @param {Object} methods An object mapping method names to method attributes * @param {Object} methods An object mapping method names to method attributes
* @param {string} serviceName The fully qualified name of the service * @param {string} serviceName The fully qualified name of the service
* @param {boolean=} deprecatedArgumentOrder Indicates that the old argument * @param {Object} class_options An options object. Currently only uses the key
* deprecatedArgumentOrder, a boolean that Indicates that the old argument
* order should be used for methods, with optional arguments at the end * order should be used for methods, with optional arguments at the end
* instead of the callback at the end. Defaults to false. This option is * instead of the callback at the end. Defaults to false. This option is
* only a temporary stopgap measure to smooth an API breakage. * only a temporary stopgap measure to smooth an API breakage.
@ -703,7 +704,10 @@ var deprecated_request_wrap = {
* @return {function(string, Object)} New client constructor * @return {function(string, Object)} New client constructor
*/ */
exports.makeClientConstructor = function(methods, serviceName, exports.makeClientConstructor = function(methods, serviceName,
deprecatedArgumentOrder) { class_options) {
if (!class_options) {
class_options = {};
}
/** /**
* Create a client with the given methods * Create a client with the given methods
* @constructor * @constructor
@ -752,7 +756,7 @@ exports.makeClientConstructor = function(methods, serviceName,
var deserialize = attrs.responseDeserialize; var deserialize = attrs.responseDeserialize;
var method_func = requester_makers[method_type]( var method_func = requester_makers[method_type](
attrs.path, serialize, deserialize); attrs.path, serialize, deserialize);
if (deprecatedArgumentOrder) { if (class_options.deprecatedArgumentOrder) {
Client.prototype[name] = deprecated_request_wrap(method_func); Client.prototype[name] = deprecated_request_wrap(method_func);
} else { } else {
Client.prototype[name] = method_func; Client.prototype[name] = method_func;

Loading…
Cancel
Save