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.box.sdkgen.serialization.json.EnumWrapper; 008import com.fasterxml.jackson.annotation.JsonFilter; 009import com.fasterxml.jackson.annotation.JsonProperty; 010import com.fasterxml.jackson.databind.annotation.JsonDeserialize; 011import com.fasterxml.jackson.databind.annotation.JsonSerialize; 012import java.time.OffsetDateTime; 013import java.util.Objects; 014 015@JsonFilter("nullablePropertyFilter") 016public class UpdateFileByIdRequestBodySharedLinkField extends SerializableObject { 017 018 /** 019 * The level of access for the shared link. This can be restricted to anyone with the link 020 * (`open`), only people within the company (`company`) and only those who have been invited to 021 * the folder (`collaborators`). 022 * 023 * <p>If not set, this field defaults to the access level specified by the enterprise admin. To 024 * create a shared link with this default setting pass the `shared_link` object with no `access` 025 * field, for example `{ "shared_link": {} }`. 026 * 027 * <p>The `company` access level is only available to paid accounts. 028 */ 029 @JsonDeserialize( 030 using = 031 UpdateFileByIdRequestBodySharedLinkAccessField 032 .UpdateFileByIdRequestBodySharedLinkAccessFieldDeserializer.class) 033 @JsonSerialize( 034 using = 035 UpdateFileByIdRequestBodySharedLinkAccessField 036 .UpdateFileByIdRequestBodySharedLinkAccessFieldSerializer.class) 037 protected EnumWrapper<UpdateFileByIdRequestBodySharedLinkAccessField> access; 038 039 /** 040 * The password required to access the shared link. Set the password to `null` to remove it. 041 * Passwords must now be at least eight characters long and include a number, upper case letter, 042 * or a non-numeric or non-alphabetic character. A password can only be set when `access` is set 043 * to `open`. 044 */ 045 @Nullable protected String password; 046 047 /** 048 * Defines a custom vanity name to use in the shared link URL, for example 049 * `https://app.box.com/v/my-shared-link`. 050 * 051 * <p>Custom URLs should not be used when sharing sensitive content as vanity URLs are a lot 052 * easier to guess than regular shared links. 053 */ 054 @JsonProperty("vanity_name") 055 protected String vanityName; 056 057 /** 058 * The timestamp at which this shared link will expire. This field can only be set by users with 059 * paid accounts. 060 */ 061 @JsonProperty("unshared_at") 062 @JsonSerialize(using = DateTimeUtils.DateTimeSerializer.class) 063 @JsonDeserialize(using = DateTimeUtils.DateTimeDeserializer.class) 064 protected OffsetDateTime unsharedAt; 065 066 protected UpdateFileByIdRequestBodySharedLinkPermissionsField permissions; 067 068 public UpdateFileByIdRequestBodySharedLinkField() { 069 super(); 070 } 071 072 protected UpdateFileByIdRequestBodySharedLinkField(Builder builder) { 073 super(); 074 this.access = builder.access; 075 this.password = builder.password; 076 this.vanityName = builder.vanityName; 077 this.unsharedAt = builder.unsharedAt; 078 this.permissions = builder.permissions; 079 markNullableFieldsAsSet(builder.getExplicitlySetNullableFields()); 080 } 081 082 public EnumWrapper<UpdateFileByIdRequestBodySharedLinkAccessField> getAccess() { 083 return access; 084 } 085 086 public String getPassword() { 087 return password; 088 } 089 090 public String getVanityName() { 091 return vanityName; 092 } 093 094 public OffsetDateTime getUnsharedAt() { 095 return unsharedAt; 096 } 097 098 public UpdateFileByIdRequestBodySharedLinkPermissionsField getPermissions() { 099 return permissions; 100 } 101 102 @Override 103 public boolean equals(Object o) { 104 if (this == o) { 105 return true; 106 } 107 if (o == null || getClass() != o.getClass()) { 108 return false; 109 } 110 UpdateFileByIdRequestBodySharedLinkField casted = (UpdateFileByIdRequestBodySharedLinkField) o; 111 return Objects.equals(access, casted.access) 112 && Objects.equals(password, casted.password) 113 && Objects.equals(vanityName, casted.vanityName) 114 && Objects.equals(unsharedAt, casted.unsharedAt) 115 && Objects.equals(permissions, casted.permissions); 116 } 117 118 @Override 119 public int hashCode() { 120 return Objects.hash(access, password, vanityName, unsharedAt, permissions); 121 } 122 123 @Override 124 public String toString() { 125 return "UpdateFileByIdRequestBodySharedLinkField{" 126 + "access='" 127 + access 128 + '\'' 129 + ", " 130 + "password='" 131 + password 132 + '\'' 133 + ", " 134 + "vanityName='" 135 + vanityName 136 + '\'' 137 + ", " 138 + "unsharedAt='" 139 + unsharedAt 140 + '\'' 141 + ", " 142 + "permissions='" 143 + permissions 144 + '\'' 145 + "}"; 146 } 147 148 public static class Builder extends NullableFieldTracker { 149 150 protected EnumWrapper<UpdateFileByIdRequestBodySharedLinkAccessField> access; 151 152 protected String password; 153 154 protected String vanityName; 155 156 protected OffsetDateTime unsharedAt; 157 158 protected UpdateFileByIdRequestBodySharedLinkPermissionsField permissions; 159 160 public Builder access(UpdateFileByIdRequestBodySharedLinkAccessField access) { 161 this.access = new EnumWrapper<UpdateFileByIdRequestBodySharedLinkAccessField>(access); 162 return this; 163 } 164 165 public Builder access(EnumWrapper<UpdateFileByIdRequestBodySharedLinkAccessField> access) { 166 this.access = access; 167 return this; 168 } 169 170 public Builder password(String password) { 171 this.password = password; 172 this.markNullableFieldAsSet("password"); 173 return this; 174 } 175 176 public Builder vanityName(String vanityName) { 177 this.vanityName = vanityName; 178 return this; 179 } 180 181 public Builder unsharedAt(OffsetDateTime unsharedAt) { 182 this.unsharedAt = unsharedAt; 183 return this; 184 } 185 186 public Builder permissions(UpdateFileByIdRequestBodySharedLinkPermissionsField permissions) { 187 this.permissions = permissions; 188 return this; 189 } 190 191 public UpdateFileByIdRequestBodySharedLinkField build() { 192 return new UpdateFileByIdRequestBodySharedLinkField(this); 193 } 194 } 195}