001package com.box.sdkgen.managers.weblinks;
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 UpdateWebLinkByIdRequestBodySharedLinkField 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          UpdateWebLinkByIdRequestBodySharedLinkAccessField
032              .UpdateWebLinkByIdRequestBodySharedLinkAccessFieldDeserializer.class)
033  @JsonSerialize(
034      using =
035          UpdateWebLinkByIdRequestBodySharedLinkAccessField
036              .UpdateWebLinkByIdRequestBodySharedLinkAccessFieldSerializer.class)
037  protected EnumWrapper<UpdateWebLinkByIdRequestBodySharedLinkAccessField> 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  public UpdateWebLinkByIdRequestBodySharedLinkField() {
067    super();
068  }
069
070  protected UpdateWebLinkByIdRequestBodySharedLinkField(Builder builder) {
071    super();
072    this.access = builder.access;
073    this.password = builder.password;
074    this.vanityName = builder.vanityName;
075    this.unsharedAt = builder.unsharedAt;
076    markNullableFieldsAsSet(builder.getExplicitlySetNullableFields());
077  }
078
079  public EnumWrapper<UpdateWebLinkByIdRequestBodySharedLinkAccessField> getAccess() {
080    return access;
081  }
082
083  public String getPassword() {
084    return password;
085  }
086
087  public String getVanityName() {
088    return vanityName;
089  }
090
091  public OffsetDateTime getUnsharedAt() {
092    return unsharedAt;
093  }
094
095  @Override
096  public boolean equals(Object o) {
097    if (this == o) {
098      return true;
099    }
100    if (o == null || getClass() != o.getClass()) {
101      return false;
102    }
103    UpdateWebLinkByIdRequestBodySharedLinkField casted =
104        (UpdateWebLinkByIdRequestBodySharedLinkField) o;
105    return Objects.equals(access, casted.access)
106        && Objects.equals(password, casted.password)
107        && Objects.equals(vanityName, casted.vanityName)
108        && Objects.equals(unsharedAt, casted.unsharedAt);
109  }
110
111  @Override
112  public int hashCode() {
113    return Objects.hash(access, password, vanityName, unsharedAt);
114  }
115
116  @Override
117  public String toString() {
118    return "UpdateWebLinkByIdRequestBodySharedLinkField{"
119        + "access='"
120        + access
121        + '\''
122        + ", "
123        + "password='"
124        + password
125        + '\''
126        + ", "
127        + "vanityName='"
128        + vanityName
129        + '\''
130        + ", "
131        + "unsharedAt='"
132        + unsharedAt
133        + '\''
134        + "}";
135  }
136
137  public static class Builder extends NullableFieldTracker {
138
139    protected EnumWrapper<UpdateWebLinkByIdRequestBodySharedLinkAccessField> access;
140
141    protected String password;
142
143    protected String vanityName;
144
145    protected OffsetDateTime unsharedAt;
146
147    public Builder access(UpdateWebLinkByIdRequestBodySharedLinkAccessField access) {
148      this.access = new EnumWrapper<UpdateWebLinkByIdRequestBodySharedLinkAccessField>(access);
149      return this;
150    }
151
152    public Builder access(EnumWrapper<UpdateWebLinkByIdRequestBodySharedLinkAccessField> access) {
153      this.access = access;
154      return this;
155    }
156
157    public Builder password(String password) {
158      this.password = password;
159      this.markNullableFieldAsSet("password");
160      return this;
161    }
162
163    public Builder vanityName(String vanityName) {
164      this.vanityName = vanityName;
165      return this;
166    }
167
168    public Builder unsharedAt(OffsetDateTime unsharedAt) {
169      this.unsharedAt = unsharedAt;
170      return this;
171    }
172
173    public UpdateWebLinkByIdRequestBodySharedLinkField build() {
174      return new UpdateWebLinkByIdRequestBodySharedLinkField(this);
175    }
176  }
177}