001package com.box.sdkgen.schemas.searchresultswithsharedlinks;
002
003import com.box.sdkgen.internal.NullableFieldTracker;
004import com.box.sdkgen.internal.SerializableObject;
005import com.box.sdkgen.schemas.searchresultwithsharedlink.SearchResultWithSharedLink;
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/**
015 * A list of files, folders and web links that matched the search query, including the additional
016 * information about any shared links through which the item has been shared with the user.
017 *
018 * <p>This response format is only returned when the `include_recent_shared_links` query parameter
019 * has been set to `true`.
020 */
021@JsonFilter("nullablePropertyFilter")
022public class SearchResultsWithSharedLinks extends SerializableObject {
023
024  /**
025   * One greater than the offset of the last entry in the search results. The total number of
026   * entries in the collection may be less than `total_count`.
027   */
028  @JsonProperty("total_count")
029  protected Long totalCount;
030
031  /**
032   * The limit that was used for this search. This will be the same as the `limit` query parameter
033   * unless that value exceeded the maximum value allowed.
034   */
035  protected Long limit;
036
037  /**
038   * The 0-based offset of the first entry in this set. This will be the same as the `offset` query
039   * parameter used.
040   */
041  protected Long offset;
042
043  /** Specifies the response as search result items with shared links. */
044  @JsonDeserialize(
045      using =
046          SearchResultsWithSharedLinksTypeField.SearchResultsWithSharedLinksTypeFieldDeserializer
047              .class)
048  @JsonSerialize(
049      using =
050          SearchResultsWithSharedLinksTypeField.SearchResultsWithSharedLinksTypeFieldSerializer
051              .class)
052  protected EnumWrapper<SearchResultsWithSharedLinksTypeField> type;
053
054  /**
055   * The search results for the query provided, including the additional information about any
056   * shared links through which the item has been shared with the user.
057   */
058  protected List<SearchResultWithSharedLink> entries;
059
060  public SearchResultsWithSharedLinks() {
061    super();
062    this.type =
063        new EnumWrapper<SearchResultsWithSharedLinksTypeField>(
064            SearchResultsWithSharedLinksTypeField.SEARCH_RESULTS_WITH_SHARED_LINKS);
065  }
066
067  protected SearchResultsWithSharedLinks(Builder builder) {
068    super();
069    this.totalCount = builder.totalCount;
070    this.limit = builder.limit;
071    this.offset = builder.offset;
072    this.type = builder.type;
073    this.entries = builder.entries;
074    markNullableFieldsAsSet(builder.getExplicitlySetNullableFields());
075  }
076
077  public Long getTotalCount() {
078    return totalCount;
079  }
080
081  public Long getLimit() {
082    return limit;
083  }
084
085  public Long getOffset() {
086    return offset;
087  }
088
089  public EnumWrapper<SearchResultsWithSharedLinksTypeField> getType() {
090    return type;
091  }
092
093  public List<SearchResultWithSharedLink> getEntries() {
094    return entries;
095  }
096
097  @Override
098  public boolean equals(Object o) {
099    if (this == o) {
100      return true;
101    }
102    if (o == null || getClass() != o.getClass()) {
103      return false;
104    }
105    SearchResultsWithSharedLinks casted = (SearchResultsWithSharedLinks) o;
106    return Objects.equals(totalCount, casted.totalCount)
107        && Objects.equals(limit, casted.limit)
108        && Objects.equals(offset, casted.offset)
109        && Objects.equals(type, casted.type)
110        && Objects.equals(entries, casted.entries);
111  }
112
113  @Override
114  public int hashCode() {
115    return Objects.hash(totalCount, limit, offset, type, entries);
116  }
117
118  @Override
119  public String toString() {
120    return "SearchResultsWithSharedLinks{"
121        + "totalCount='"
122        + totalCount
123        + '\''
124        + ", "
125        + "limit='"
126        + limit
127        + '\''
128        + ", "
129        + "offset='"
130        + offset
131        + '\''
132        + ", "
133        + "type='"
134        + type
135        + '\''
136        + ", "
137        + "entries='"
138        + entries
139        + '\''
140        + "}";
141  }
142
143  public static class Builder extends NullableFieldTracker {
144
145    protected Long totalCount;
146
147    protected Long limit;
148
149    protected Long offset;
150
151    protected EnumWrapper<SearchResultsWithSharedLinksTypeField> type;
152
153    protected List<SearchResultWithSharedLink> entries;
154
155    public Builder() {
156      super();
157    }
158
159    public Builder totalCount(Long totalCount) {
160      this.totalCount = totalCount;
161      return this;
162    }
163
164    public Builder limit(Long limit) {
165      this.limit = limit;
166      return this;
167    }
168
169    public Builder offset(Long offset) {
170      this.offset = offset;
171      return this;
172    }
173
174    public Builder type(SearchResultsWithSharedLinksTypeField type) {
175      this.type = new EnumWrapper<SearchResultsWithSharedLinksTypeField>(type);
176      return this;
177    }
178
179    public Builder type(EnumWrapper<SearchResultsWithSharedLinksTypeField> type) {
180      this.type = type;
181      return this;
182    }
183
184    public Builder entries(List<SearchResultWithSharedLink> entries) {
185      this.entries = entries;
186      return this;
187    }
188
189    public SearchResultsWithSharedLinks build() {
190      if (this.type == null) {
191        this.type =
192            new EnumWrapper<SearchResultsWithSharedLinksTypeField>(
193                SearchResultsWithSharedLinksTypeField.SEARCH_RESULTS_WITH_SHARED_LINKS);
194      }
195      return new SearchResultsWithSharedLinks(this);
196    }
197  }
198}