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

org.openziti.edge.model.ApiError Maven / Gradle / Ivy

The newest version!
/*
 * Ziti Edge Client
 * OpenZiti Edge Client API
 *
 * The version of the OpenAPI document: 0.26.27
 * Contact: [email protected]
 *
 * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech).
 * https://openapi-generator.tech
 * Do not edit the class manually.
 */

package org.openziti.edge.model;

import com.fasterxml.jackson.annotation.JsonInclude;
import com.fasterxml.jackson.annotation.JsonProperty;
import com.fasterxml.jackson.annotation.JsonPropertyOrder;
import java.net.URLEncoder;
import java.nio.charset.StandardCharsets;
import java.util.HashMap;
import java.util.Map;
import java.util.Objects;
import java.util.StringJoiner;
import org.openziti.edge.ApiClient;

/** ApiError */
@JsonPropertyOrder({
    ApiError.JSON_PROPERTY_ARGS,
    ApiError.JSON_PROPERTY_CAUSE,
    ApiError.JSON_PROPERTY_CAUSE_MESSAGE,
    ApiError.JSON_PROPERTY_CODE,
    ApiError.JSON_PROPERTY_DATA,
    ApiError.JSON_PROPERTY_MESSAGE,
    ApiError.JSON_PROPERTY_REQUEST_ID
})
@javax.annotation.Generated(
        value = "org.openapitools.codegen.languages.JavaClientCodegen",
        date = "2024-09-04T10:11:22.635226-04:00[America/New_York]",
        comments = "Generator version: 7.8.0")
public class ApiError {
    public static final String JSON_PROPERTY_ARGS = "args";
    private ApiErrorArgs args;

    public static final String JSON_PROPERTY_CAUSE = "cause";
    private ApiErrorCause cause;

    public static final String JSON_PROPERTY_CAUSE_MESSAGE = "causeMessage";
    private String causeMessage;

    public static final String JSON_PROPERTY_CODE = "code";
    private String code;

    public static final String JSON_PROPERTY_DATA = "data";
    private Map data = new HashMap<>();

    public static final String JSON_PROPERTY_MESSAGE = "message";
    private String message;

    public static final String JSON_PROPERTY_REQUEST_ID = "requestId";
    private String requestId;

    public ApiError() {}

    public ApiError args(ApiErrorArgs args) {
        this.args = args;
        return this;
    }

    /**
     * Get args
     *
     * @return args
     */
    @javax.annotation.Nullable
    @JsonProperty(JSON_PROPERTY_ARGS)
    @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS)
    public ApiErrorArgs getArgs() {
        return args;
    }

    @JsonProperty(JSON_PROPERTY_ARGS)
    @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS)
    public void setArgs(ApiErrorArgs args) {
        this.args = args;
    }

    public ApiError cause(ApiErrorCause cause) {
        this.cause = cause;
        return this;
    }

    /**
     * Get cause
     *
     * @return cause
     */
    @javax.annotation.Nullable
    @JsonProperty(JSON_PROPERTY_CAUSE)
    @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS)
    public ApiErrorCause getCause() {
        return cause;
    }

    @JsonProperty(JSON_PROPERTY_CAUSE)
    @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS)
    public void setCause(ApiErrorCause cause) {
        this.cause = cause;
    }

    public ApiError causeMessage(String causeMessage) {
        this.causeMessage = causeMessage;
        return this;
    }

    /**
     * Get causeMessage
     *
     * @return causeMessage
     */
    @javax.annotation.Nullable
    @JsonProperty(JSON_PROPERTY_CAUSE_MESSAGE)
    @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS)
    public String getCauseMessage() {
        return causeMessage;
    }

    @JsonProperty(JSON_PROPERTY_CAUSE_MESSAGE)
    @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS)
    public void setCauseMessage(String causeMessage) {
        this.causeMessage = causeMessage;
    }

    public ApiError code(String code) {
        this.code = code;
        return this;
    }

    /**
     * Get code
     *
     * @return code
     */
    @javax.annotation.Nullable
    @JsonProperty(JSON_PROPERTY_CODE)
    @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS)
    public String getCode() {
        return code;
    }

    @JsonProperty(JSON_PROPERTY_CODE)
    @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS)
    public void setCode(String code) {
        this.code = code;
    }

    public ApiError data(Map data) {
        this.data = data;
        return this;
    }

    public ApiError putDataItem(String key, Object dataItem) {
        if (this.data == null) {
            this.data = new HashMap<>();
        }
        this.data.put(key, dataItem);
        return this;
    }

    /**
     * Get data
     *
     * @return data
     */
    @javax.annotation.Nullable
    @JsonProperty(JSON_PROPERTY_DATA)
    @JsonInclude(content = JsonInclude.Include.ALWAYS, value = JsonInclude.Include.USE_DEFAULTS)
    public Map getData() {
        return data;
    }

    @JsonProperty(JSON_PROPERTY_DATA)
    @JsonInclude(content = JsonInclude.Include.ALWAYS, value = JsonInclude.Include.USE_DEFAULTS)
    public void setData(Map data) {
        this.data = data;
    }

    public ApiError message(String message) {
        this.message = message;
        return this;
    }

    /**
     * Get message
     *
     * @return message
     */
    @javax.annotation.Nullable
    @JsonProperty(JSON_PROPERTY_MESSAGE)
    @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS)
    public String getMessage() {
        return message;
    }

    @JsonProperty(JSON_PROPERTY_MESSAGE)
    @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS)
    public void setMessage(String message) {
        this.message = message;
    }

    public ApiError requestId(String requestId) {
        this.requestId = requestId;
        return this;
    }

    /**
     * Get requestId
     *
     * @return requestId
     */
    @javax.annotation.Nullable
    @JsonProperty(JSON_PROPERTY_REQUEST_ID)
    @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS)
    public String getRequestId() {
        return requestId;
    }

    @JsonProperty(JSON_PROPERTY_REQUEST_ID)
    @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS)
    public void setRequestId(String requestId) {
        this.requestId = requestId;
    }

    /** Return true if this apiError object is equal to o. */
    @Override
    public boolean equals(Object o) {
        if (this == o) {
            return true;
        }
        if (o == null || getClass() != o.getClass()) {
            return false;
        }
        ApiError apiError = (ApiError) o;
        return Objects.equals(this.args, apiError.args)
                && Objects.equals(this.cause, apiError.cause)
                && Objects.equals(this.causeMessage, apiError.causeMessage)
                && Objects.equals(this.code, apiError.code)
                && Objects.equals(this.data, apiError.data)
                && Objects.equals(this.message, apiError.message)
                && Objects.equals(this.requestId, apiError.requestId);
    }

    @Override
    public int hashCode() {
        return Objects.hash(args, cause, causeMessage, code, data, message, requestId);
    }

    @Override
    public String toString() {
        StringBuilder sb = new StringBuilder();
        sb.append("class ApiError {\n");
        sb.append("    args: ").append(toIndentedString(args)).append("\n");
        sb.append("    cause: ").append(toIndentedString(cause)).append("\n");
        sb.append("    causeMessage: ").append(toIndentedString(causeMessage)).append("\n");
        sb.append("    code: ").append(toIndentedString(code)).append("\n");
        sb.append("    data: ").append(toIndentedString(data)).append("\n");
        sb.append("    message: ").append(toIndentedString(message)).append("\n");
        sb.append("    requestId: ").append(toIndentedString(requestId)).append("\n");
        sb.append("}");
        return sb.toString();
    }

    /**
     * Convert the given object to string with each line indented by 4 spaces (except the first
     * line).
     */
    private String toIndentedString(Object o) {
        if (o == null) {
            return "null";
        }
        return o.toString().replace("\n", "\n    ");
    }

    /**
     * Convert the instance into URL query string.
     *
     * @return URL query string
     */
    public String toUrlQueryString() {
        return toUrlQueryString(null);
    }

    /**
     * Convert the instance into URL query string.
     *
     * @param prefix prefix of the query string
     * @return URL query string
     */
    public String toUrlQueryString(String prefix) {
        String suffix = "";
        String containerSuffix = "";
        String containerPrefix = "";
        if (prefix == null) {
            // style=form, explode=true, e.g. /pet?name=cat&type=manx
            prefix = "";
        } else {
            // deepObject style e.g. /pet?id[name]=cat&id[type]=manx
            prefix = prefix + "[";
            suffix = "]";
            containerSuffix = "]";
            containerPrefix = "[";
        }

        StringJoiner joiner = new StringJoiner("&");

        // add `args` to the URL query string
        if (getArgs() != null) {
            joiner.add(getArgs().toUrlQueryString(prefix + "args" + suffix));
        }

        // add `cause` to the URL query string
        if (getCause() != null) {
            joiner.add(getCause().toUrlQueryString(prefix + "cause" + suffix));
        }

        // add `causeMessage` to the URL query string
        if (getCauseMessage() != null) {
            joiner.add(
                    String.format(
                            "%scauseMessage%s=%s",
                            prefix,
                            suffix,
                            URLEncoder.encode(
                                            ApiClient.valueToString(getCauseMessage()),
                                            StandardCharsets.UTF_8)
                                    .replaceAll("\\+", "%20")));
        }

        // add `code` to the URL query string
        if (getCode() != null) {
            joiner.add(
                    String.format(
                            "%scode%s=%s",
                            prefix,
                            suffix,
                            URLEncoder.encode(
                                            ApiClient.valueToString(getCode()),
                                            StandardCharsets.UTF_8)
                                    .replaceAll("\\+", "%20")));
        }

        // add `data` to the URL query string
        if (getData() != null) {
            for (String _key : getData().keySet()) {
                joiner.add(
                        String.format(
                                "%sdata%s%s=%s",
                                prefix,
                                suffix,
                                "".equals(suffix)
                                        ? ""
                                        : String.format(
                                                "%s%d%s", containerPrefix, _key, containerSuffix),
                                getData().get(_key),
                                URLEncoder.encode(
                                                ApiClient.valueToString(getData().get(_key)),
                                                StandardCharsets.UTF_8)
                                        .replaceAll("\\+", "%20")));
            }
        }

        // add `message` to the URL query string
        if (getMessage() != null) {
            joiner.add(
                    String.format(
                            "%smessage%s=%s",
                            prefix,
                            suffix,
                            URLEncoder.encode(
                                            ApiClient.valueToString(getMessage()),
                                            StandardCharsets.UTF_8)
                                    .replaceAll("\\+", "%20")));
        }

        // add `requestId` to the URL query string
        if (getRequestId() != null) {
            joiner.add(
                    String.format(
                            "%srequestId%s=%s",
                            prefix,
                            suffix,
                            URLEncoder.encode(
                                            ApiClient.valueToString(getRequestId()),
                                            StandardCharsets.UTF_8)
                                    .replaceAll("\\+", "%20")));
        }

        return joiner.toString();
    }
}




© 2015 - 2024 Weber Informatics LLC | Privacy Policy