001package com.box.sdkgen.managers.files; 002 003import com.box.sdkgen.internal.Nullable; 004import com.box.sdkgen.internal.NullableFieldTracker; 005import com.box.sdkgen.internal.SerializableObject; 006import com.box.sdkgen.internal.utils.DateTimeUtils; 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.time.OffsetDateTime; 012import java.util.List; 013import java.util.Objects; 014 015@JsonFilter("nullablePropertyFilter") 016public class UpdateFileByIdRequestBody extends SerializableObject { 017 018 /** 019 * An optional different name for the file. This can be used to rename the file. 020 * 021 * <p>File names must be unique within their parent folder. The name check is case-insensitive, so 022 * a file named `New File` cannot be created in a parent folder that already contains a folder 023 * named `new file`. 024 */ 025 protected String name; 026 027 /** 028 * The description for a file. This can be seen in the right-hand sidebar panel when viewing a 029 * file in the Box web app. Additionally, this index is used in the search index of the file, 030 * allowing users to find the file by the content in the description. 031 */ 032 protected String description; 033 034 protected UpdateFileByIdRequestBodyParentField parent; 035 036 @JsonProperty("shared_link") 037 @Nullable 038 protected UpdateFileByIdRequestBodySharedLinkField sharedLink; 039 040 /** 041 * Defines a lock on an item. This prevents the item from being moved, renamed, or otherwise 042 * changed by anyone other than the user who created the lock. 043 * 044 * <p>Set this to `null` to remove the lock. 045 */ 046 @Nullable protected UpdateFileByIdRequestBodyLockField lock; 047 048 /** 049 * The retention expiration timestamp for the given file. This date cannot be shortened once set 050 * on a file. 051 */ 052 @JsonProperty("disposition_at") 053 @JsonSerialize(using = DateTimeUtils.DateTimeSerializer.class) 054 @JsonDeserialize(using = DateTimeUtils.DateTimeDeserializer.class) 055 protected OffsetDateTime dispositionAt; 056 057 /** Defines who can download a file. */ 058 protected UpdateFileByIdRequestBodyPermissionsField permissions; 059 060 /** 061 * An array of collections to make this file a member of. Currently we only support the 062 * `favorites` collection. 063 * 064 * <p>To get the ID for a collection, use the [List all collections][1] endpoint. 065 * 066 * <p>Passing an empty array `[]` or `null` will remove the file from all collections. 067 * 068 * <p>[1]: https://developer.box.com/reference/get-collections 069 */ 070 @Nullable protected List<UpdateFileByIdRequestBodyCollectionsField> collections; 071 072 /** 073 * The tags for this item. These tags are shown in the Box web app and mobile apps next to an 074 * item. 075 * 076 * <p>To add or remove a tag, retrieve the item's current tags, modify them, and then update this 077 * field. 078 * 079 * <p>There is a limit of 100 tags per item, and 10,000 unique tags per enterprise. 080 */ 081 protected List<String> tags; 082 083 public UpdateFileByIdRequestBody() { 084 super(); 085 } 086 087 protected UpdateFileByIdRequestBody(Builder builder) { 088 super(); 089 this.name = builder.name; 090 this.description = builder.description; 091 this.parent = builder.parent; 092 this.sharedLink = builder.sharedLink; 093 this.lock = builder.lock; 094 this.dispositionAt = builder.dispositionAt; 095 this.permissions = builder.permissions; 096 this.collections = builder.collections; 097 this.tags = builder.tags; 098 markNullableFieldsAsSet(builder.getExplicitlySetNullableFields()); 099 } 100 101 public String getName() { 102 return name; 103 } 104 105 public String getDescription() { 106 return description; 107 } 108 109 public UpdateFileByIdRequestBodyParentField getParent() { 110 return parent; 111 } 112 113 public UpdateFileByIdRequestBodySharedLinkField getSharedLink() { 114 return sharedLink; 115 } 116 117 public UpdateFileByIdRequestBodyLockField getLock() { 118 return lock; 119 } 120 121 public OffsetDateTime getDispositionAt() { 122 return dispositionAt; 123 } 124 125 public UpdateFileByIdRequestBodyPermissionsField getPermissions() { 126 return permissions; 127 } 128 129 public List<UpdateFileByIdRequestBodyCollectionsField> getCollections() { 130 return collections; 131 } 132 133 public List<String> getTags() { 134 return tags; 135 } 136 137 @Override 138 public boolean equals(Object o) { 139 if (this == o) { 140 return true; 141 } 142 if (o == null || getClass() != o.getClass()) { 143 return false; 144 } 145 UpdateFileByIdRequestBody casted = (UpdateFileByIdRequestBody) o; 146 return Objects.equals(name, casted.name) 147 && Objects.equals(description, casted.description) 148 && Objects.equals(parent, casted.parent) 149 && Objects.equals(sharedLink, casted.sharedLink) 150 && Objects.equals(lock, casted.lock) 151 && Objects.equals(dispositionAt, casted.dispositionAt) 152 && Objects.equals(permissions, casted.permissions) 153 && Objects.equals(collections, casted.collections) 154 && Objects.equals(tags, casted.tags); 155 } 156 157 @Override 158 public int hashCode() { 159 return Objects.hash( 160 name, description, parent, sharedLink, lock, dispositionAt, permissions, collections, tags); 161 } 162 163 @Override 164 public String toString() { 165 return "UpdateFileByIdRequestBody{" 166 + "name='" 167 + name 168 + '\'' 169 + ", " 170 + "description='" 171 + description 172 + '\'' 173 + ", " 174 + "parent='" 175 + parent 176 + '\'' 177 + ", " 178 + "sharedLink='" 179 + sharedLink 180 + '\'' 181 + ", " 182 + "lock='" 183 + lock 184 + '\'' 185 + ", " 186 + "dispositionAt='" 187 + dispositionAt 188 + '\'' 189 + ", " 190 + "permissions='" 191 + permissions 192 + '\'' 193 + ", " 194 + "collections='" 195 + collections 196 + '\'' 197 + ", " 198 + "tags='" 199 + tags 200 + '\'' 201 + "}"; 202 } 203 204 public static class Builder extends NullableFieldTracker { 205 206 protected String name; 207 208 protected String description; 209 210 protected UpdateFileByIdRequestBodyParentField parent; 211 212 protected UpdateFileByIdRequestBodySharedLinkField sharedLink; 213 214 protected UpdateFileByIdRequestBodyLockField lock; 215 216 protected OffsetDateTime dispositionAt; 217 218 protected UpdateFileByIdRequestBodyPermissionsField permissions; 219 220 protected List<UpdateFileByIdRequestBodyCollectionsField> collections; 221 222 protected List<String> tags; 223 224 public Builder name(String name) { 225 this.name = name; 226 return this; 227 } 228 229 public Builder description(String description) { 230 this.description = description; 231 return this; 232 } 233 234 public Builder parent(UpdateFileByIdRequestBodyParentField parent) { 235 this.parent = parent; 236 return this; 237 } 238 239 public Builder sharedLink(UpdateFileByIdRequestBodySharedLinkField sharedLink) { 240 this.sharedLink = sharedLink; 241 this.markNullableFieldAsSet("shared_link"); 242 return this; 243 } 244 245 public Builder lock(UpdateFileByIdRequestBodyLockField lock) { 246 this.lock = lock; 247 this.markNullableFieldAsSet("lock"); 248 return this; 249 } 250 251 public Builder dispositionAt(OffsetDateTime dispositionAt) { 252 this.dispositionAt = dispositionAt; 253 return this; 254 } 255 256 public Builder permissions(UpdateFileByIdRequestBodyPermissionsField permissions) { 257 this.permissions = permissions; 258 return this; 259 } 260 261 public Builder collections(List<UpdateFileByIdRequestBodyCollectionsField> collections) { 262 this.collections = collections; 263 this.markNullableFieldAsSet("collections"); 264 return this; 265 } 266 267 public Builder tags(List<String> tags) { 268 this.tags = tags; 269 return this; 270 } 271 272 public UpdateFileByIdRequestBody build() { 273 return new UpdateFileByIdRequestBody(this); 274 } 275 } 276}