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

com.merge.api.resources.ticketing.passthrough.requests.DataPassthroughRequest Maven / Gradle / Ivy

package com.merge.api.resources.ticketing.passthrough.requests;

import com.fasterxml.jackson.annotation.JsonIgnoreProperties;
import com.fasterxml.jackson.annotation.JsonProperty;
import com.fasterxml.jackson.annotation.JsonSetter;
import com.fasterxml.jackson.annotation.Nulls;
import com.fasterxml.jackson.databind.JsonNode;
import com.fasterxml.jackson.databind.annotation.JsonDeserialize;
import com.merge.api.resources.ticketing.types.MethodEnum;
import com.merge.api.resources.ticketing.types.MultipartFormFieldRequest;
import com.merge.api.resources.ticketing.types.RequestFormatEnum;
import java.util.List;
import java.util.Map;
import java.util.Objects;
import java.util.Optional;

@JsonDeserialize(builder = DataPassthroughRequest.Builder.class)
public final class DataPassthroughRequest {
    private final MethodEnum method;

    private final String path;

    private final Optional baseUrlOverride;

    private final Optional data;

    private final Optional> multipartFormData;

    private final Optional> headers;

    private final Optional requestFormat;

    private final Optional normalizeResponse;

    private DataPassthroughRequest(
            MethodEnum method,
            String path,
            Optional baseUrlOverride,
            Optional data,
            Optional> multipartFormData,
            Optional> headers,
            Optional requestFormat,
            Optional normalizeResponse) {
        this.method = method;
        this.path = path;
        this.baseUrlOverride = baseUrlOverride;
        this.data = data;
        this.multipartFormData = multipartFormData;
        this.headers = headers;
        this.requestFormat = requestFormat;
        this.normalizeResponse = normalizeResponse;
    }

    @JsonProperty("method")
    public MethodEnum getMethod() {
        return method;
    }

    /**
     * @return <span style="white-space: nowrap">non-empty</span>
     */
    @JsonProperty("path")
    public String getPath() {
        return path;
    }

    /**
     * @return <span style="white-space: nowrap">non-empty</span>
     */
    @JsonProperty("base_url_override")
    public Optional getBaseUrlOverride() {
        return baseUrlOverride;
    }

    /**
     * @return <span style="white-space: nowrap">non-empty</span>
     */
    @JsonProperty("data")
    public Optional getData() {
        return data;
    }

    /**
     * @return Pass an array of MultipartFormField objects in here instead of using the data param if request_format is set to MULTIPART.
     */
    @JsonProperty("multipart_form_data")
    public Optional> getMultipartFormData() {
        return multipartFormData;
    }

    /**
     * @return The headers to use for the request (Merge will handle the account's authorization headers). Content-Type header is required for passthrough. Choose content type corresponding to expected format of receiving server.
     */
    @JsonProperty("headers")
    public Optional> getHeaders() {
        return headers;
    }

    @JsonProperty("request_format")
    public Optional getRequestFormat() {
        return requestFormat;
    }

    /**
     * @return Optional. If true, the response will always be an object of the form {"type": T, "value": ...} where T will be one of string, boolean, number, null, array, object.
     */
    @JsonProperty("normalize_response")
    public Optional getNormalizeResponse() {
        return normalizeResponse;
    }

    @Override
    public boolean equals(Object other) {
        if (this == other) return true;
        return other instanceof DataPassthroughRequest && equalTo((DataPassthroughRequest) other);
    }

    private boolean equalTo(DataPassthroughRequest other) {
        return method.equals(other.method)
                && path.equals(other.path)
                && baseUrlOverride.equals(other.baseUrlOverride)
                && data.equals(other.data)
                && multipartFormData.equals(other.multipartFormData)
                && headers.equals(other.headers)
                && requestFormat.equals(other.requestFormat)
                && normalizeResponse.equals(other.normalizeResponse);
    }

    @Override
    public int hashCode() {
        return Objects.hash(
                this.method,
                this.path,
                this.baseUrlOverride,
                this.data,
                this.multipartFormData,
                this.headers,
                this.requestFormat,
                this.normalizeResponse);
    }

    @Override
    public String toString() {
        return "DataPassthroughRequest{" + "method: " + method + ", path: " + path + ", baseUrlOverride: "
                + baseUrlOverride + ", data: " + data + ", multipartFormData: " + multipartFormData + ", headers: "
                + headers + ", requestFormat: " + requestFormat + ", normalizeResponse: " + normalizeResponse + "}";
    }

    public static MethodStage builder() {
        return new Builder();
    }

    public interface MethodStage {
        PathStage method(MethodEnum method);

        Builder from(DataPassthroughRequest other);
    }

    public interface PathStage {
        _FinalStage path(String path);
    }

    public interface _FinalStage {
        DataPassthroughRequest build();

        _FinalStage baseUrlOverride(Optional baseUrlOverride);

        _FinalStage baseUrlOverride(String baseUrlOverride);

        _FinalStage data(Optional data);

        _FinalStage data(String data);

        _FinalStage multipartFormData(Optional> multipartFormData);

        _FinalStage multipartFormData(List multipartFormData);

        _FinalStage headers(Optional> headers);

        _FinalStage headers(Map headers);

        _FinalStage requestFormat(Optional requestFormat);

        _FinalStage requestFormat(RequestFormatEnum requestFormat);

        _FinalStage normalizeResponse(Optional normalizeResponse);

        _FinalStage normalizeResponse(Boolean normalizeResponse);
    }

    @JsonIgnoreProperties(ignoreUnknown = true)
    public static final class Builder implements MethodStage, PathStage, _FinalStage {
        private MethodEnum method;

        private String path;

        private Optional normalizeResponse = Optional.empty();

        private Optional requestFormat = Optional.empty();

        private Optional> headers = Optional.empty();

        private Optional> multipartFormData = Optional.empty();

        private Optional data = Optional.empty();

        private Optional baseUrlOverride = Optional.empty();

        private Builder() {}

        @Override
        public Builder from(DataPassthroughRequest other) {
            method(other.getMethod());
            path(other.getPath());
            baseUrlOverride(other.getBaseUrlOverride());
            data(other.getData());
            multipartFormData(other.getMultipartFormData());
            headers(other.getHeaders());
            requestFormat(other.getRequestFormat());
            normalizeResponse(other.getNormalizeResponse());
            return this;
        }

        @Override
        @JsonSetter("method")
        public PathStage method(MethodEnum method) {
            this.method = method;
            return this;
        }

        /**
         * 

<span style="white-space: nowrap">non-empty</span>

* @return Reference to {@code this} so that method calls can be chained together. */ @Override @JsonSetter("path") public _FinalStage path(String path) { this.path = path; return this; } /** *

Optional. If true, the response will always be an object of the form {"type": T, "value": ...} where T will be one of string, boolean, number, null, array, object.

* @return Reference to {@code this} so that method calls can be chained together. */ @Override public _FinalStage normalizeResponse(Boolean normalizeResponse) { this.normalizeResponse = Optional.of(normalizeResponse); return this; } @Override @JsonSetter(value = "normalize_response", nulls = Nulls.SKIP) public _FinalStage normalizeResponse(Optional normalizeResponse) { this.normalizeResponse = normalizeResponse; return this; } @Override public _FinalStage requestFormat(RequestFormatEnum requestFormat) { this.requestFormat = Optional.of(requestFormat); return this; } @Override @JsonSetter(value = "request_format", nulls = Nulls.SKIP) public _FinalStage requestFormat(Optional requestFormat) { this.requestFormat = requestFormat; return this; } /** *

The headers to use for the request (Merge will handle the account's authorization headers). Content-Type header is required for passthrough. Choose content type corresponding to expected format of receiving server.

* @return Reference to {@code this} so that method calls can be chained together. */ @Override public _FinalStage headers(Map headers) { this.headers = Optional.of(headers); return this; } @Override @JsonSetter(value = "headers", nulls = Nulls.SKIP) public _FinalStage headers(Optional> headers) { this.headers = headers; return this; } /** *

Pass an array of MultipartFormField objects in here instead of using the data param if request_format is set to MULTIPART.

* @return Reference to {@code this} so that method calls can be chained together. */ @Override public _FinalStage multipartFormData(List multipartFormData) { this.multipartFormData = Optional.of(multipartFormData); return this; } @Override @JsonSetter(value = "multipart_form_data", nulls = Nulls.SKIP) public _FinalStage multipartFormData(Optional> multipartFormData) { this.multipartFormData = multipartFormData; return this; } /** *

<span style="white-space: nowrap">non-empty</span>

* @return Reference to {@code this} so that method calls can be chained together. */ @Override public _FinalStage data(String data) { this.data = Optional.of(data); return this; } @Override @JsonSetter(value = "data", nulls = Nulls.SKIP) public _FinalStage data(Optional data) { this.data = data; return this; } /** *

<span style="white-space: nowrap">non-empty</span>

* @return Reference to {@code this} so that method calls can be chained together. */ @Override public _FinalStage baseUrlOverride(String baseUrlOverride) { this.baseUrlOverride = Optional.of(baseUrlOverride); return this; } @Override @JsonSetter(value = "base_url_override", nulls = Nulls.SKIP) public _FinalStage baseUrlOverride(Optional baseUrlOverride) { this.baseUrlOverride = baseUrlOverride; return this; } @Override public DataPassthroughRequest build() { return new DataPassthroughRequest( method, path, baseUrlOverride, data, multipartFormData, headers, requestFormat, normalizeResponse); } } }




© 2015 - 2025 Weber Informatics LLC | Privacy Policy