001package com.box.sdkgen.schemas.v2026r0.queryrequestbodyv2026r0;
002
003import com.box.sdkgen.internal.NullableFieldTracker;
004import com.box.sdkgen.internal.SerializableObject;
005import com.box.sdkgen.schemas.v2026r0.queryorderbyv2026r0.QueryOrderByV2026R0;
006import com.fasterxml.jackson.annotation.JsonFilter;
007import com.fasterxml.jackson.annotation.JsonProperty;
008import java.util.List;
009import java.util.Objects;
010
011/**
012 * Request body describing the query to run, including the filtering predicate, optional sorting,
013 * pagination, and the fields to return for each result.
014 */
015@JsonFilter("nullablePropertyFilter")
016public class QueryRequestBodyV2026R0 extends SerializableObject {
017
018  /**
019   * The query definition, including the filtering predicate and its optional parameters and
020   * ancestor restrictions.
021   */
022  protected final QueryRequestBodyV2026R0QueryField query;
023
024  /**
025   * The sorting criteria for the result set. Entries are applied sequentially to define multi-level
026   * sorting.
027   */
028  @JsonProperty("order_by")
029  protected List<QueryOrderByV2026R0> orderBy;
030
031  /** The maximum number of results to return. Defaults to `50` when not provided. */
032  protected Integer limit;
033
034  /**
035   * Controls which additional fields are included in each result entry. Each value must be one of:
036   * a fully qualified item field key (for example `box:item:name`), a metadata template key to
037   * hydrate the full template (for example `enterprise_12345678:project`), or a specific metadata
038   * template field key to hydrate a single field from the template (for example
039   * `enterprise_12345678:project:name`). When omitted, entries include only the item type and
040   * identifier.
041   */
042  protected List<String> fields;
043
044  /**
045   * An opaque token returned from a previous response, used to continue retrieval. When provided,
046   * all other request parameters must exactly match those of the original request.
047   */
048  protected String marker;
049
050  public QueryRequestBodyV2026R0(@JsonProperty("query") QueryRequestBodyV2026R0QueryField query) {
051    super();
052    this.query = query;
053  }
054
055  protected QueryRequestBodyV2026R0(Builder builder) {
056    super();
057    this.query = builder.query;
058    this.orderBy = builder.orderBy;
059    this.limit = builder.limit;
060    this.fields = builder.fields;
061    this.marker = builder.marker;
062    markNullableFieldsAsSet(builder.getExplicitlySetNullableFields());
063  }
064
065  public QueryRequestBodyV2026R0QueryField getQuery() {
066    return query;
067  }
068
069  public List<QueryOrderByV2026R0> getOrderBy() {
070    return orderBy;
071  }
072
073  public Integer getLimit() {
074    return limit;
075  }
076
077  public List<String> getFields() {
078    return fields;
079  }
080
081  public String getMarker() {
082    return marker;
083  }
084
085  @Override
086  public boolean equals(Object o) {
087    if (this == o) {
088      return true;
089    }
090    if (o == null || getClass() != o.getClass()) {
091      return false;
092    }
093    QueryRequestBodyV2026R0 casted = (QueryRequestBodyV2026R0) o;
094    return Objects.equals(query, casted.query)
095        && Objects.equals(orderBy, casted.orderBy)
096        && Objects.equals(limit, casted.limit)
097        && Objects.equals(fields, casted.fields)
098        && Objects.equals(marker, casted.marker);
099  }
100
101  @Override
102  public int hashCode() {
103    return Objects.hash(query, orderBy, limit, fields, marker);
104  }
105
106  @Override
107  public String toString() {
108    return "QueryRequestBodyV2026R0{"
109        + "query='"
110        + query
111        + '\''
112        + ", "
113        + "orderBy='"
114        + orderBy
115        + '\''
116        + ", "
117        + "limit='"
118        + limit
119        + '\''
120        + ", "
121        + "fields='"
122        + fields
123        + '\''
124        + ", "
125        + "marker='"
126        + marker
127        + '\''
128        + "}";
129  }
130
131  public static class Builder extends NullableFieldTracker {
132
133    protected final QueryRequestBodyV2026R0QueryField query;
134
135    protected List<QueryOrderByV2026R0> orderBy;
136
137    protected Integer limit;
138
139    protected List<String> fields;
140
141    protected String marker;
142
143    public Builder(QueryRequestBodyV2026R0QueryField query) {
144      super();
145      this.query = query;
146    }
147
148    public Builder orderBy(List<QueryOrderByV2026R0> orderBy) {
149      this.orderBy = orderBy;
150      return this;
151    }
152
153    public Builder limit(Integer limit) {
154      this.limit = limit;
155      return this;
156    }
157
158    public Builder fields(List<String> fields) {
159      this.fields = fields;
160      return this;
161    }
162
163    public Builder marker(String marker) {
164      this.marker = marker;
165      return this;
166    }
167
168    public QueryRequestBodyV2026R0 build() {
169      return new QueryRequestBodyV2026R0(this);
170    }
171  }
172}