Add the given params to the query.

@param uri The query
@param params The params to add
@param overrideParams A set of parameter names that must be overridden and not added
@return The new query
421551
public static URI addParams(
            final URI uri, final Multimap<String, String> params, final Set<String> overrideParams) {
        if (params == null || params.isEmpty()) {
            return uri;
        }
        final String origTxt = uri.toString();
        int queryStart = origTxt.indexOf('?');
        final StringBuilder result = new StringBuilder();
        if (queryStart < 0) {
            int fragmentStart = origTxt.indexOf('#');
            if (fragmentStart < 0) {
                result.append(origTxt);
            } else {
                result.append(origTxt, 0, fragmentStart);
            }
        } else {
            result.append(origTxt, 0, queryStart);
        }

        Map<String, Collection<String>> origParams = getParameters(uri).asMap();
        boolean first = true;
        for (Map.Entry<String, Collection<String>> param: params.asMap().entrySet()) {
            final String key = param.getKey();
            Collection<String> origList = origParams.remove(key);
            if (origList != null && (overrideParams == null || !overrideParams.contains(key))) {
                first = addParams(result, first, key, origList);
            }
            Collection<String> list = param.getValue();
            first = addParams(result, first, key, list);
        }

        for (Map.Entry<String, Collection<String>> param: origParams.entrySet()) {
            final String key = param.getKey();
            Collection<String> list = param.getValue();
            first = addParams(result, first, key, list);
        }

        if (uri.getFragment() != null) {
            result.append('#').append(uri.getRawFragment());
        }

        try {
            return new URI(result.toString());
        } catch (URISyntaxException e) {
            throw ExceptionUtils.getRuntimeException(e);
        }
    }
1102882
public boolean addMethodToResponseOverride(String pathName, String methodName) {
        // need to find out the ID for the method
        // TODO: change api for adding methods to take the name instead of ID
        try {
            Integer overrideId = getOverrideIdForMethodName(methodName);

            // now post to path api to add this is a selected override
            BasicNameValuePair[] params = {
                new BasicNameValuePair("addOverride", overrideId.toString()),
                new BasicNameValuePair("profileIdentifier", this._profileName)
            };
            JSONObject response = new JSONObject(doPost(BASE_PATH + uriEncode(pathName), params));
            // check enabled endpoints array to see if this overrideID exists
            JSONArray enabled = response.getJSONArray("enabledEndpoints");
            for (int x = 0; x < enabled.length(); x++) {
                if (enabled.getJSONObject(x).getInt("overrideId") == overrideId) {
                    return true;
                }
            }
        } catch (Exception e) {
            e.printStackTrace();
        }

        return false;
    }
1241703
private void addQueryParams(final Request request) {
        if (recurring != null) {
            request.addQueryParam("Recurring", recurring.toString());
        }

        if (triggerBy != null) {
            request.addQueryParam("TriggerBy", triggerBy.toString());
        }

        if (usageCategory != null) {
            request.addQueryParam("UsageCategory", usageCategory.toString());
        }

        if (getPageSize() != null) {
            request.addQueryParam("PageSize", Integer.toString(getPageSize()));
        }
    }
1165425
public UriMappingResolver addDomains(String... values) {
        if (values.length % 2 == 1) {
            throw new IllegalArgumentException
                    ("Expected even number of arguments");
        }
        for (int i = 0; i < values.length; i += 2) {
            addDomain(values[i], values[i+1]);
        }
        return this;
    }
932001
@Override
	public <T extends Resource> T post(final String uri, final Parameters params) {
		return doRequest(uri).set(params).post();
	}
1345626
function initParams(uri, options, callback) {
      if (typeof options === 'function') {
        callback = options
      }

      var params = {}
      if (typeof options === 'object') {
        extend(params, options, { uri: uri })
      } else if (typeof uri === 'string') {
        extend(params, { uri: uri })
      } else {
        extend(params, uri)
      }

      params.callback = callback
      return params
    }
285208
@Override
    public DefaultEntityActionOperation addQueryParameter(String key,
            String value) {
        this.queryParameters.add(key, value);
        return this;
    }
1252603
public function add(string $key, $value, bool $override = false)
    {
        if (!$override && $this->exists($key)) {
            return;
        }

        $this->parameters[$key] = $value;
    }
907885
public URIBuilder queryParameters( Map<String, String> queryParams )
    {
        this.queryParams.clear();
        this.queryParams.putAll( queryParams );
        return this;
    }
594309
public UrlStringBuilder addParameters(String namespace, Map<String, List<String>> parameters) {
        for (final String name : parameters.keySet()) {
            Validate.notNull(name, "parameter map cannot contain any null keys");
        }

        for (final Map.Entry<String, List<String>> newParamEntry : parameters.entrySet()) {
            final String name = newParamEntry.getKey();
            final List<String> values = this.copy(newParamEntry.getValue());

            this.parameters.put(namespace + name, values);
        }
        return this;
    }
86212
public function throwWhenSettingNonOverridableParameter($overrideParams)
    {
        $nonOverridableParams = $this->getNonOverridableParams($overrideParams);
        if(count($nonOverridableParams) > 0) {
            throw new \Exception(sprintf(
                "Setting parameters %s is not allowed. Please report this bug to the Matomo team.",
                implode(" and ", $nonOverridableParams)
            ));
        }
    }
203076
def _append_params_to_uri(cls, uri, params):
        

        if params:
            return uri + cls._DELIMITER_URL_QUERY + urlencode(params)

        return uri
284180
public URI forURL(URI uri) {
        QueryStringEncoder encoder = new QueryStringEncoder(uri.toString());
        for (Map.Entry<String, Object> e : params.entrySet()) {
            encoder.addParam(e.getKey(), String.valueOf(e.getValue()));
        }
        try {
            return encoder.toUri();
        } catch (URISyntaxException e) {
            throw new IllegalArgumentException("Cannot construct a query string from the given params. " +
                    "An invalid parameter was used.");
        }
    }
80938
public java.util.Map<String, java.util.List<String>> getOverriddenParameters() {
        return overriddenParameters;
    }
353183
def add_params(endpoint, params):
    
    p = PreparedRequest()
    p.prepare(url=endpoint, params=params)
    if PY2:  # pragma: no cover
        return unicode(p.url)
    else:  # pragma: no cover
        return p.url
899304
public static boolean overrides(
      DeclaredType type, Types types, String methodName, TypeMirror... params) {
    return overrides(asElement(type), types, methodName, params);
  }
718358
protected static RequestParams getParams(Uri uri) {
        RequestParams params = new RequestParams();
        Set<String> keys = getQueryParameterNames(uri);
        for (String key : keys) {
            String value = uri.getQueryParameter(key);
            if (TextUtils.isEmpty(value)) {
                value = null;
            }
            params.put(key, value);
        }
        return params;
    }