code: function formatRequestUrl(path, query, useClientId) {
      if (channel) {
        query.channel = channel;
      }
      if (useClientId) {
        query.client = clientId;
      } else if (key && key.indexOf('AIza') == 0) {
        query.key = key;
      } else {
        throw 'Missing either a valid API key, or a client ID and secret';
      }
  
      var requestUrl = url.format({pathname: path, query: query});
  
      // When using client ID, generate and append the signature param.
      if (useClientId) {
        var secret = new Buffer(clientSecret, 'base64');
        var payload = url.parse(requestUrl).path;
        var signature = computeSignature(secret, payload);
        requestUrl += '&signature=' + encodeURIComponent(signature);
      }
  
      return requestUrl;
    }
docs: Adds auth information to the query, and formats it into a URL.
  @param {string} path
  @param {Object} query
  @param {boolean} useClientId
  @return {string} The formatted URL.