001package com.box.sdkgen.schemas.filefull;
002
003import com.box.sdkgen.internal.NullableFieldTracker;
004import com.box.sdkgen.internal.SerializableObject;
005import com.box.sdkgen.schemas.resourcescope.ResourceScope;
006import com.box.sdkgen.serialization.json.EnumWrapper;
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.util.List;
012import java.util.Objects;
013
014@JsonFilter("nullablePropertyFilter")
015public class FileFullExpiringEmbedLinkField extends SerializableObject {
016
017  /** The requested access token. */
018  @JsonProperty("access_token")
019  protected String accessToken;
020
021  /** The time in seconds by which this token will expire. */
022  @JsonProperty("expires_in")
023  protected Long expiresIn;
024
025  /** The type of access token returned. */
026  @JsonDeserialize(
027      using =
028          FileFullExpiringEmbedLinkTokenTypeField
029              .FileFullExpiringEmbedLinkTokenTypeFieldDeserializer.class)
030  @JsonSerialize(
031      using =
032          FileFullExpiringEmbedLinkTokenTypeField.FileFullExpiringEmbedLinkTokenTypeFieldSerializer
033              .class)
034  @JsonProperty("token_type")
035  protected EnumWrapper<FileFullExpiringEmbedLinkTokenTypeField> tokenType;
036
037  /**
038   * The permissions that this access token permits, providing a list of resources (files, folders,
039   * etc) and the scopes permitted for each of those resources.
040   */
041  @JsonProperty("restricted_to")
042  protected List<ResourceScope> restrictedTo;
043
044  /**
045   * The actual expiring embed URL for this file, constructed from the file ID and access tokens
046   * specified in this object.
047   */
048  protected String url;
049
050  public FileFullExpiringEmbedLinkField() {
051    super();
052  }
053
054  protected FileFullExpiringEmbedLinkField(Builder builder) {
055    super();
056    this.accessToken = builder.accessToken;
057    this.expiresIn = builder.expiresIn;
058    this.tokenType = builder.tokenType;
059    this.restrictedTo = builder.restrictedTo;
060    this.url = builder.url;
061    markNullableFieldsAsSet(builder.getExplicitlySetNullableFields());
062  }
063
064  public String getAccessToken() {
065    return accessToken;
066  }
067
068  public Long getExpiresIn() {
069    return expiresIn;
070  }
071
072  public EnumWrapper<FileFullExpiringEmbedLinkTokenTypeField> getTokenType() {
073    return tokenType;
074  }
075
076  public List<ResourceScope> getRestrictedTo() {
077    return restrictedTo;
078  }
079
080  public String getUrl() {
081    return url;
082  }
083
084  @Override
085  public boolean equals(Object o) {
086    if (this == o) {
087      return true;
088    }
089    if (o == null || getClass() != o.getClass()) {
090      return false;
091    }
092    FileFullExpiringEmbedLinkField casted = (FileFullExpiringEmbedLinkField) o;
093    return Objects.equals(accessToken, casted.accessToken)
094        && Objects.equals(expiresIn, casted.expiresIn)
095        && Objects.equals(tokenType, casted.tokenType)
096        && Objects.equals(restrictedTo, casted.restrictedTo)
097        && Objects.equals(url, casted.url);
098  }
099
100  @Override
101  public int hashCode() {
102    return Objects.hash(accessToken, expiresIn, tokenType, restrictedTo, url);
103  }
104
105  @Override
106  public String toString() {
107    return "FileFullExpiringEmbedLinkField{"
108        + "accessToken='"
109        + accessToken
110        + '\''
111        + ", "
112        + "expiresIn='"
113        + expiresIn
114        + '\''
115        + ", "
116        + "tokenType='"
117        + tokenType
118        + '\''
119        + ", "
120        + "restrictedTo='"
121        + restrictedTo
122        + '\''
123        + ", "
124        + "url='"
125        + url
126        + '\''
127        + "}";
128  }
129
130  public static class Builder extends NullableFieldTracker {
131
132    protected String accessToken;
133
134    protected Long expiresIn;
135
136    protected EnumWrapper<FileFullExpiringEmbedLinkTokenTypeField> tokenType;
137
138    protected List<ResourceScope> restrictedTo;
139
140    protected String url;
141
142    public Builder accessToken(String accessToken) {
143      this.accessToken = accessToken;
144      return this;
145    }
146
147    public Builder expiresIn(Long expiresIn) {
148      this.expiresIn = expiresIn;
149      return this;
150    }
151
152    public Builder tokenType(FileFullExpiringEmbedLinkTokenTypeField tokenType) {
153      this.tokenType = new EnumWrapper<FileFullExpiringEmbedLinkTokenTypeField>(tokenType);
154      return this;
155    }
156
157    public Builder tokenType(EnumWrapper<FileFullExpiringEmbedLinkTokenTypeField> tokenType) {
158      this.tokenType = tokenType;
159      return this;
160    }
161
162    public Builder restrictedTo(List<ResourceScope> restrictedTo) {
163      this.restrictedTo = restrictedTo;
164      return this;
165    }
166
167    public Builder url(String url) {
168      this.url = url;
169      return this;
170    }
171
172    public FileFullExpiringEmbedLinkField build() {
173      return new FileFullExpiringEmbedLinkField(this);
174    }
175  }
176}