docs: function IMGAPI(options) {
      assert.object(options, 'options');
      assert.string(options.url, 'options.url');
      assert.optionalString(options.channel, 'options.channel');
      assert.optionalString(options.user, 'options.user');
      assert.optionalString(options.password, 'options.password');
      assert.optionalFunc(options.sign, 'options.sign');
      assert.ok(!(options.password && options.sign),
          'not both "options.password" and "options.sign"');
      if (options.version) {
          // Allow options.version=null to avoid default, mainly for testing.
          assert.string(options.version, 'options.version');
      }
      assert.optionalObject(options.contentMd5, 'options.contentMd5');
      options = objCopy(options);
  
      // `this.url` is the URL with the optional channel query param *removed*.
      var parsed = mod_url.parse(options.url);
      if (parsed.query) {
          var params = qs.parse(parsed.query);
          if (params.channel) {
              this.channel = params.channel;
          }
          delete parsed.search;
          this.url = mod_url.format(parsed);
      } else {
          this.url = options.url;
      }
      // _basePath: the URL subpath *without* a trailing '/'
      this._basePath = parsed.pathname;
      if (this._basePath.slice(-1) === '/') {
          this._basePath = this._basePath.slice(0, -1);
      }
  
      if (options.channel) {
          this.channel = options.channel;
          delete options.channel;
      }
  
      // Make sure a given bunyan logger has reasonable client_re[qs]
      // serializers.
      if (options.log && options.log.serializers &&
          !options.log.serializers.client_req) {
          options.log = options.log.child({
              serializers: restifyClients.bunyan.serializers
          });
      }
      if (options.version === undefined) {
          options.version = '*';
      }
  
      if (!options.contentMd5) {
          options.contentMd5 = {
              encodings: ['utf8', 'binary']
          };
      }
  
      this.client = restifyClients.createJsonClient(options);
      // Work around <https://github.com/mcavage/node-restify/pull/291>.
      // Switch to `restify.createHttpClient` when that pull is in.
      options.type = 'http';
      this.rawClient = restifyClients.createClient(options);
      if (options.password) {
          assert.string(options.user, 'options.password, but no options.user');
          this.client.basicAuth(options.user, options.password);
          this.rawClient.basicAuth(options.user, options.password);
      } else if (options.sign) {
          assert.string(options.user, 'options.sign, but no options.user');
          this.user = options.user;
          this.sign = options.sign;
      }
  }