|
| 1 | +/* |
| 2 | + * Unit OpenAPI specifications |
| 3 | + * An OpenAPI specifications for unit-sdk clients |
| 4 | + * |
| 5 | + * The version of the OpenAPI document: 0.1.0 |
| 6 | + * |
| 7 | + * |
| 8 | + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). |
| 9 | + * https://openapi-generator.tech |
| 10 | + * Do not edit the class manually. |
| 11 | + */ |
| 12 | + |
| 13 | + |
| 14 | +package unit.java.sdk.model; |
| 15 | + |
| 16 | +import java.net.URLEncoder; |
| 17 | +import java.nio.charset.StandardCharsets; |
| 18 | +import java.util.StringJoiner; |
| 19 | +import java.util.Objects; |
| 20 | +import java.util.Map; |
| 21 | +import java.util.HashMap; |
| 22 | +import com.fasterxml.jackson.annotation.JsonInclude; |
| 23 | +import com.fasterxml.jackson.annotation.JsonProperty; |
| 24 | +import com.fasterxml.jackson.annotation.JsonCreator; |
| 25 | +import com.fasterxml.jackson.annotation.JsonTypeName; |
| 26 | +import com.fasterxml.jackson.annotation.JsonValue; |
| 27 | +import java.util.Arrays; |
| 28 | +import unit.java.sdk.model.AddAuthorizedUsersRequestDataAttributes; |
| 29 | +import com.fasterxml.jackson.annotation.JsonPropertyOrder; |
| 30 | + |
| 31 | + |
| 32 | +/** |
| 33 | + * AddAuthorizedUsersRequestData |
| 34 | + */ |
| 35 | +@JsonPropertyOrder({ |
| 36 | + AddAuthorizedUsersRequestData.JSON_PROPERTY_TYPE, |
| 37 | + AddAuthorizedUsersRequestData.JSON_PROPERTY_ATTRIBUTES |
| 38 | +}) |
| 39 | +@jakarta.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", comments = "Generator version: 7.5.0") |
| 40 | +public class AddAuthorizedUsersRequestData { |
| 41 | + /** |
| 42 | + * Gets or Sets type |
| 43 | + */ |
| 44 | + public enum TypeEnum { |
| 45 | + ADDAUTHORIZEDUSERS("addAuthorizedUsers"); |
| 46 | + |
| 47 | + private String value; |
| 48 | + |
| 49 | + TypeEnum(String value) { |
| 50 | + this.value = value; |
| 51 | + } |
| 52 | + |
| 53 | + @JsonValue |
| 54 | + public String getValue() { |
| 55 | + return value; |
| 56 | + } |
| 57 | + |
| 58 | + @Override |
| 59 | + public String toString() { |
| 60 | + return String.valueOf(value); |
| 61 | + } |
| 62 | + |
| 63 | + @JsonCreator |
| 64 | + public static TypeEnum fromValue(String value) { |
| 65 | + for (TypeEnum b : TypeEnum.values()) { |
| 66 | + if (b.value.equals(value)) { |
| 67 | + return b; |
| 68 | + } |
| 69 | + } |
| 70 | + throw new IllegalArgumentException("Unexpected value '" + value + "'"); |
| 71 | + } |
| 72 | + } |
| 73 | + |
| 74 | + public static final String JSON_PROPERTY_TYPE = "type"; |
| 75 | + private TypeEnum type = TypeEnum.ADDAUTHORIZEDUSERS; |
| 76 | + |
| 77 | + public static final String JSON_PROPERTY_ATTRIBUTES = "attributes"; |
| 78 | + private AddAuthorizedUsersRequestDataAttributes attributes; |
| 79 | + |
| 80 | + public AddAuthorizedUsersRequestData() { |
| 81 | + } |
| 82 | + |
| 83 | + public AddAuthorizedUsersRequestData type(TypeEnum type) { |
| 84 | + this.type = type; |
| 85 | + return this; |
| 86 | + } |
| 87 | + |
| 88 | + /** |
| 89 | + * Get type |
| 90 | + * @return type |
| 91 | + **/ |
| 92 | + @jakarta.annotation.Nullable |
| 93 | + @JsonProperty(JSON_PROPERTY_TYPE) |
| 94 | + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) |
| 95 | + |
| 96 | + public TypeEnum getType() { |
| 97 | + return type; |
| 98 | + } |
| 99 | + |
| 100 | + |
| 101 | + @JsonProperty(JSON_PROPERTY_TYPE) |
| 102 | + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) |
| 103 | + public void setType(TypeEnum type) { |
| 104 | + this.type = type; |
| 105 | + } |
| 106 | + |
| 107 | + |
| 108 | + public AddAuthorizedUsersRequestData attributes(AddAuthorizedUsersRequestDataAttributes attributes) { |
| 109 | + this.attributes = attributes; |
| 110 | + return this; |
| 111 | + } |
| 112 | + |
| 113 | + /** |
| 114 | + * Get attributes |
| 115 | + * @return attributes |
| 116 | + **/ |
| 117 | + @jakarta.annotation.Nullable |
| 118 | + @JsonProperty(JSON_PROPERTY_ATTRIBUTES) |
| 119 | + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) |
| 120 | + |
| 121 | + public AddAuthorizedUsersRequestDataAttributes getAttributes() { |
| 122 | + return attributes; |
| 123 | + } |
| 124 | + |
| 125 | + |
| 126 | + @JsonProperty(JSON_PROPERTY_ATTRIBUTES) |
| 127 | + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) |
| 128 | + public void setAttributes(AddAuthorizedUsersRequestDataAttributes attributes) { |
| 129 | + this.attributes = attributes; |
| 130 | + } |
| 131 | + |
| 132 | + |
| 133 | + /** |
| 134 | + * Return true if this AddAuthorizedUsersRequest_data object is equal to o. |
| 135 | + */ |
| 136 | + @Override |
| 137 | + public boolean equals(Object o) { |
| 138 | + if (this == o) { |
| 139 | + return true; |
| 140 | + } |
| 141 | + if (o == null || getClass() != o.getClass()) { |
| 142 | + return false; |
| 143 | + } |
| 144 | + AddAuthorizedUsersRequestData addAuthorizedUsersRequestData = (AddAuthorizedUsersRequestData) o; |
| 145 | + return Objects.equals(this.type, addAuthorizedUsersRequestData.type) && |
| 146 | + Objects.equals(this.attributes, addAuthorizedUsersRequestData.attributes); |
| 147 | + } |
| 148 | + |
| 149 | + @Override |
| 150 | + public int hashCode() { |
| 151 | + return Objects.hash(type, attributes); |
| 152 | + } |
| 153 | + |
| 154 | + @Override |
| 155 | + public String toString() { |
| 156 | + StringBuilder sb = new StringBuilder(); |
| 157 | + sb.append("class AddAuthorizedUsersRequestData {\n"); |
| 158 | + sb.append(" type: ").append(toIndentedString(type)).append("\n"); |
| 159 | + sb.append(" attributes: ").append(toIndentedString(attributes)).append("\n"); |
| 160 | + sb.append("}"); |
| 161 | + return sb.toString(); |
| 162 | + } |
| 163 | + |
| 164 | + /** |
| 165 | + * Convert the given object to string with each line indented by 4 spaces |
| 166 | + * (except the first line). |
| 167 | + */ |
| 168 | + private String toIndentedString(Object o) { |
| 169 | + if (o == null) { |
| 170 | + return "null"; |
| 171 | + } |
| 172 | + return o.toString().replace("\n", "\n "); |
| 173 | + } |
| 174 | + |
| 175 | + /** |
| 176 | + * Convert the instance into URL query string. |
| 177 | + * |
| 178 | + * @return URL query string |
| 179 | + */ |
| 180 | + public String toUrlQueryString() { |
| 181 | + return toUrlQueryString(null); |
| 182 | + } |
| 183 | + |
| 184 | + /** |
| 185 | + * Convert the instance into URL query string. |
| 186 | + * |
| 187 | + * @param prefix prefix of the query string |
| 188 | + * @return URL query string |
| 189 | + */ |
| 190 | + public String toUrlQueryString(String prefix) { |
| 191 | + String suffix = ""; |
| 192 | + String containerSuffix = ""; |
| 193 | + String containerPrefix = ""; |
| 194 | + if (prefix == null) { |
| 195 | + // style=form, explode=true, e.g. /pet?name=cat&type=manx |
| 196 | + prefix = ""; |
| 197 | + } else { |
| 198 | + // deepObject style e.g. /pet?id[name]=cat&id[type]=manx |
| 199 | + prefix = prefix + "["; |
| 200 | + suffix = "]"; |
| 201 | + containerSuffix = "]"; |
| 202 | + containerPrefix = "["; |
| 203 | + } |
| 204 | + |
| 205 | + StringJoiner joiner = new StringJoiner("&"); |
| 206 | + |
| 207 | + // add `type` to the URL query string |
| 208 | + if (getType() != null) { |
| 209 | + joiner.add(String.format("%stype%s=%s", prefix, suffix, URLEncoder.encode(String.valueOf(getType()), StandardCharsets.UTF_8).replaceAll("\\+", "%20"))); |
| 210 | + } |
| 211 | + |
| 212 | + // add `attributes` to the URL query string |
| 213 | + if (getAttributes() != null) { |
| 214 | + joiner.add(getAttributes().toUrlQueryString(prefix + "attributes" + suffix)); |
| 215 | + } |
| 216 | + |
| 217 | + return joiner.toString(); |
| 218 | + } |
| 219 | +} |
| 220 | + |
0 commit comments