001package com.box.sdkgen.schemas.v2026r0.clienterrorv2026r0; 002 003import com.box.sdkgen.internal.Nullable; 004import com.box.sdkgen.internal.NullableFieldTracker; 005import com.box.sdkgen.internal.SerializableObject; 006import com.box.sdkgen.serialization.json.EnumWrapper; 007import com.fasterxml.jackson.annotation.JsonFilter; 008import com.fasterxml.jackson.annotation.JsonProperty; 009import com.fasterxml.jackson.databind.annotation.JsonDeserialize; 010import com.fasterxml.jackson.databind.annotation.JsonSerialize; 011import java.util.Map; 012import java.util.Objects; 013 014/** A generic error. */ 015@JsonFilter("nullablePropertyFilter") 016public class ClientErrorV2026R0 extends SerializableObject { 017 018 /** The value will always be `error`. */ 019 @JsonDeserialize( 020 using = ClientErrorV2026R0TypeField.ClientErrorV2026R0TypeFieldDeserializer.class) 021 @JsonSerialize(using = ClientErrorV2026R0TypeField.ClientErrorV2026R0TypeFieldSerializer.class) 022 protected EnumWrapper<ClientErrorV2026R0TypeField> type; 023 024 /** The HTTP status of the response. */ 025 protected Integer status; 026 027 /** A Box-specific error code. */ 028 @JsonDeserialize( 029 using = ClientErrorV2026R0CodeField.ClientErrorV2026R0CodeFieldDeserializer.class) 030 @JsonSerialize(using = ClientErrorV2026R0CodeField.ClientErrorV2026R0CodeFieldSerializer.class) 031 protected EnumWrapper<ClientErrorV2026R0CodeField> code; 032 033 /** A short message describing the error. */ 034 protected String message; 035 036 /** 037 * A free-form object that contains additional context about the error. The possible fields are 038 * defined on a per-endpoint basis. `message` is only one example. 039 */ 040 @JsonProperty("context_info") 041 @Nullable 042 protected Map<String, Object> contextInfo; 043 044 /** A URL that links to more information about why this error occurred. */ 045 @JsonProperty("help_url") 046 protected String helpUrl; 047 048 /** A unique identifier for this response, which can be used when contacting Box support. */ 049 @JsonProperty("request_id") 050 protected String requestId; 051 052 public ClientErrorV2026R0() { 053 super(); 054 } 055 056 protected ClientErrorV2026R0(Builder builder) { 057 super(); 058 this.type = builder.type; 059 this.status = builder.status; 060 this.code = builder.code; 061 this.message = builder.message; 062 this.contextInfo = builder.contextInfo; 063 this.helpUrl = builder.helpUrl; 064 this.requestId = builder.requestId; 065 markNullableFieldsAsSet(builder.getExplicitlySetNullableFields()); 066 } 067 068 public EnumWrapper<ClientErrorV2026R0TypeField> getType() { 069 return type; 070 } 071 072 public Integer getStatus() { 073 return status; 074 } 075 076 public EnumWrapper<ClientErrorV2026R0CodeField> getCode() { 077 return code; 078 } 079 080 public String getMessage() { 081 return message; 082 } 083 084 public Map<String, Object> getContextInfo() { 085 return contextInfo; 086 } 087 088 public String getHelpUrl() { 089 return helpUrl; 090 } 091 092 public String getRequestId() { 093 return requestId; 094 } 095 096 @Override 097 public boolean equals(Object o) { 098 if (this == o) { 099 return true; 100 } 101 if (o == null || getClass() != o.getClass()) { 102 return false; 103 } 104 ClientErrorV2026R0 casted = (ClientErrorV2026R0) o; 105 return Objects.equals(type, casted.type) 106 && Objects.equals(status, casted.status) 107 && Objects.equals(code, casted.code) 108 && Objects.equals(message, casted.message) 109 && Objects.equals(contextInfo, casted.contextInfo) 110 && Objects.equals(helpUrl, casted.helpUrl) 111 && Objects.equals(requestId, casted.requestId); 112 } 113 114 @Override 115 public int hashCode() { 116 return Objects.hash(type, status, code, message, contextInfo, helpUrl, requestId); 117 } 118 119 @Override 120 public String toString() { 121 return "ClientErrorV2026R0{" 122 + "type='" 123 + type 124 + '\'' 125 + ", " 126 + "status='" 127 + status 128 + '\'' 129 + ", " 130 + "code='" 131 + code 132 + '\'' 133 + ", " 134 + "message='" 135 + message 136 + '\'' 137 + ", " 138 + "contextInfo='" 139 + contextInfo 140 + '\'' 141 + ", " 142 + "helpUrl='" 143 + helpUrl 144 + '\'' 145 + ", " 146 + "requestId='" 147 + requestId 148 + '\'' 149 + "}"; 150 } 151 152 public static class Builder extends NullableFieldTracker { 153 154 protected EnumWrapper<ClientErrorV2026R0TypeField> type; 155 156 protected Integer status; 157 158 protected EnumWrapper<ClientErrorV2026R0CodeField> code; 159 160 protected String message; 161 162 protected Map<String, Object> contextInfo; 163 164 protected String helpUrl; 165 166 protected String requestId; 167 168 public Builder type(ClientErrorV2026R0TypeField type) { 169 this.type = new EnumWrapper<ClientErrorV2026R0TypeField>(type); 170 return this; 171 } 172 173 public Builder type(EnumWrapper<ClientErrorV2026R0TypeField> type) { 174 this.type = type; 175 return this; 176 } 177 178 public Builder status(Integer status) { 179 this.status = status; 180 return this; 181 } 182 183 public Builder code(ClientErrorV2026R0CodeField code) { 184 this.code = new EnumWrapper<ClientErrorV2026R0CodeField>(code); 185 return this; 186 } 187 188 public Builder code(EnumWrapper<ClientErrorV2026R0CodeField> code) { 189 this.code = code; 190 return this; 191 } 192 193 public Builder message(String message) { 194 this.message = message; 195 return this; 196 } 197 198 public Builder contextInfo(Map<String, Object> contextInfo) { 199 this.contextInfo = contextInfo; 200 this.markNullableFieldAsSet("context_info"); 201 return this; 202 } 203 204 public Builder helpUrl(String helpUrl) { 205 this.helpUrl = helpUrl; 206 return this; 207 } 208 209 public Builder requestId(String requestId) { 210 this.requestId = requestId; 211 return this; 212 } 213 214 public ClientErrorV2026R0 build() { 215 return new ClientErrorV2026R0(this); 216 } 217 } 218}