code: private URI buildUriWithKeyAndParams(String key, Map<String, String> params) {
          StringBuilder sb = new StringBuilder();
          sb.append(URI_PREFIX);
          if (key.startsWith("/")) {
              key = key.substring(1);
          }
          for (String token : Splitter.on("/").split(key)) {
              sb.append("/").append(urlEscape(token));
          }
          if (params != null) {
              sb.append("?");
              for (String str : params.keySet()) {
                  sb.append(urlEscape(str)).append("=").append(urlEscape(params.get(str)));
                  sb.append("&");
              }
          }
  
          String url = sb.toString();
          if (url.endsWith("&")) {
              url = url.substring(0, url.length() - 1);
          }
          return baseUri.resolve(url);
      }
docs: Build url with key and url params