001package com.box.sdkgen.managers.sharedlinksweblinks; 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 UpdateSharedLinkOnWebLinkRequestBodySharedLinkField 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 UpdateSharedLinkOnWebLinkRequestBodySharedLinkAccessField 032 .UpdateSharedLinkOnWebLinkRequestBodySharedLinkAccessFieldDeserializer.class) 033 @JsonSerialize( 034 using = 035 UpdateSharedLinkOnWebLinkRequestBodySharedLinkAccessField 036 .UpdateSharedLinkOnWebLinkRequestBodySharedLinkAccessFieldSerializer.class) 037 protected EnumWrapper<UpdateSharedLinkOnWebLinkRequestBodySharedLinkAccessField> 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. The value must be greater than the current date and time. 060 */ 061 @JsonProperty("unshared_at") 062 @JsonSerialize(using = DateTimeUtils.DateTimeSerializer.class) 063 @JsonDeserialize(using = DateTimeUtils.DateTimeDeserializer.class) 064 protected OffsetDateTime unsharedAt; 065 066 protected UpdateSharedLinkOnWebLinkRequestBodySharedLinkPermissionsField permissions; 067 068 public UpdateSharedLinkOnWebLinkRequestBodySharedLinkField() { 069 super(); 070 } 071 072 protected UpdateSharedLinkOnWebLinkRequestBodySharedLinkField(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<UpdateSharedLinkOnWebLinkRequestBodySharedLinkAccessField> 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 UpdateSharedLinkOnWebLinkRequestBodySharedLinkPermissionsField 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 UpdateSharedLinkOnWebLinkRequestBodySharedLinkField casted = 111 (UpdateSharedLinkOnWebLinkRequestBodySharedLinkField) o; 112 return Objects.equals(access, casted.access) 113 && Objects.equals(password, casted.password) 114 && Objects.equals(vanityName, casted.vanityName) 115 && Objects.equals(unsharedAt, casted.unsharedAt) 116 && Objects.equals(permissions, casted.permissions); 117 } 118 119 @Override 120 public int hashCode() { 121 return Objects.hash(access, password, vanityName, unsharedAt, permissions); 122 } 123 124 @Override 125 public String toString() { 126 return "UpdateSharedLinkOnWebLinkRequestBodySharedLinkField{" 127 + "access='" 128 + access 129 + '\'' 130 + ", " 131 + "password='" 132 + password 133 + '\'' 134 + ", " 135 + "vanityName='" 136 + vanityName 137 + '\'' 138 + ", " 139 + "unsharedAt='" 140 + unsharedAt 141 + '\'' 142 + ", " 143 + "permissions='" 144 + permissions 145 + '\'' 146 + "}"; 147 } 148 149 public static class Builder extends NullableFieldTracker { 150 151 protected EnumWrapper<UpdateSharedLinkOnWebLinkRequestBodySharedLinkAccessField> access; 152 153 protected String password; 154 155 protected String vanityName; 156 157 protected OffsetDateTime unsharedAt; 158 159 protected UpdateSharedLinkOnWebLinkRequestBodySharedLinkPermissionsField permissions; 160 161 public Builder access(UpdateSharedLinkOnWebLinkRequestBodySharedLinkAccessField access) { 162 this.access = 163 new EnumWrapper<UpdateSharedLinkOnWebLinkRequestBodySharedLinkAccessField>(access); 164 return this; 165 } 166 167 public Builder access( 168 EnumWrapper<UpdateSharedLinkOnWebLinkRequestBodySharedLinkAccessField> access) { 169 this.access = access; 170 return this; 171 } 172 173 public Builder password(String password) { 174 this.password = password; 175 this.markNullableFieldAsSet("password"); 176 return this; 177 } 178 179 public Builder vanityName(String vanityName) { 180 this.vanityName = vanityName; 181 return this; 182 } 183 184 public Builder unsharedAt(OffsetDateTime unsharedAt) { 185 this.unsharedAt = unsharedAt; 186 return this; 187 } 188 189 public Builder permissions( 190 UpdateSharedLinkOnWebLinkRequestBodySharedLinkPermissionsField permissions) { 191 this.permissions = permissions; 192 return this; 193 } 194 195 public UpdateSharedLinkOnWebLinkRequestBodySharedLinkField build() { 196 return new UpdateSharedLinkOnWebLinkRequestBodySharedLinkField(this); 197 } 198 } 199}