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

com.global.api.entities.Request Maven / Gradle / Ivy

There is a newer version: 14.2.3
Show newest version
package com.global.api.entities;

import com.global.api.utils.StringUtils;
import lombok.Getter;
import lombok.Setter;
import lombok.experimental.Accessors;

import java.util.HashMap;
import java.util.Map;

@Accessors(chain = true)
public class Request {

    @Getter @Setter private HttpMethod verb = HttpMethod.Get;
    @Getter @Setter private String endpoint;
    @Getter @Setter private String RequestBody = "";
    @Getter private HashMap queryStringParams;
    @Getter @Setter
    public Map maskedData = new HashMap<>();

    public Request() {
        queryStringParams = new HashMap<>();
    }

    public enum HttpMethod {
        Get("GET"),
        Post("POST"),
        Patch("PATCH"),
        Delete("DELETE"),
        Put("PUT");

        private final String value;
        HttpMethod(String value) { this.value = value; }

        public String getValue() {
            return value;
        }
    }

    public void addQueryStringParam(String name, String value) {
        if (!StringUtils.isNullOrEmpty(name) && !StringUtils.isNullOrEmpty(value)) {
            queryStringParams.put(name, value);
        }
    }
}




© 2015 - 2024 Weber Informatics LLC | Privacy Policy