All Downloads are FREE. Search and download functionalities are using the official Maven repository.

com.mercadopago.net.MPSearchRequest Maven / Gradle / Ivy

There is a newer version: 2.1.29
Show newest version
package com.mercadopago.net;

import java.util.HashMap;
import java.util.Map;
import java.util.Objects;
import lombok.Builder;
import lombok.Getter;

/** MPSearchRequest class. */
@Getter
@Builder
public class MPSearchRequest {
  private final String limitParam = "limit";

  private final String offsetParam = "offset";

  private final Integer limit;

  private final Integer offset;

  private final Map filters;

  /**
   * Method responsible for getting parameters.
   *
   * @return parameters
   */
  public Map getParameters() {
    HashMap parameters =
        Objects.nonNull(filters) ? new HashMap<>(filters) : new HashMap<>();

    if (!parameters.containsKey(limitParam)) {
      parameters.put(limitParam, limit);
    }

    if (!parameters.containsKey(offsetParam)) {
      parameters.put(offsetParam, offset);
    }

    return parameters;
  }
}




© 2015 - 2024 Weber Informatics LLC | Privacy Policy