001package com.box.sdkgen.managers.folders; 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 UpdateFolderByIdRequestBodySharedLinkField 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 UpdateFolderByIdRequestBodySharedLinkAccessField 032 .UpdateFolderByIdRequestBodySharedLinkAccessFieldDeserializer.class) 033 @JsonSerialize( 034 using = 035 UpdateFolderByIdRequestBodySharedLinkAccessField 036 .UpdateFolderByIdRequestBodySharedLinkAccessFieldSerializer.class) 037 protected EnumWrapper<UpdateFolderByIdRequestBodySharedLinkAccessField> 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 UpdateFolderByIdRequestBodySharedLinkPermissionsField permissions; 067 068 public UpdateFolderByIdRequestBodySharedLinkField() { 069 super(); 070 } 071 072 protected UpdateFolderByIdRequestBodySharedLinkField(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<UpdateFolderByIdRequestBodySharedLinkAccessField> 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 UpdateFolderByIdRequestBodySharedLinkPermissionsField 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 UpdateFolderByIdRequestBodySharedLinkField casted = 111 (UpdateFolderByIdRequestBodySharedLinkField) 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 "UpdateFolderByIdRequestBodySharedLinkField{" 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<UpdateFolderByIdRequestBodySharedLinkAccessField> access; 152 153 protected String password; 154 155 protected String vanityName; 156 157 protected OffsetDateTime unsharedAt; 158 159 protected UpdateFolderByIdRequestBodySharedLinkPermissionsField permissions; 160 161 public Builder access(UpdateFolderByIdRequestBodySharedLinkAccessField access) { 162 this.access = new EnumWrapper<UpdateFolderByIdRequestBodySharedLinkAccessField>(access); 163 return this; 164 } 165 166 public Builder access(EnumWrapper<UpdateFolderByIdRequestBodySharedLinkAccessField> access) { 167 this.access = access; 168 return this; 169 } 170 171 public Builder password(String password) { 172 this.password = password; 173 this.markNullableFieldAsSet("password"); 174 return this; 175 } 176 177 public Builder vanityName(String vanityName) { 178 this.vanityName = vanityName; 179 return this; 180 } 181 182 public Builder unsharedAt(OffsetDateTime unsharedAt) { 183 this.unsharedAt = unsharedAt; 184 return this; 185 } 186 187 public Builder permissions(UpdateFolderByIdRequestBodySharedLinkPermissionsField permissions) { 188 this.permissions = permissions; 189 return this; 190 } 191 192 public UpdateFolderByIdRequestBodySharedLinkField build() { 193 return new UpdateFolderByIdRequestBodySharedLinkField(this); 194 } 195 } 196}