001package com.box.sdkgen.schemas.v2026r0.queryinsightsrequestbodyv2026r0; 002 003import com.box.sdkgen.internal.NullableFieldTracker; 004import com.box.sdkgen.internal.SerializableObject; 005import com.box.sdkgen.schemas.v2026r0.queryancestorreferencev2026r0.QueryAncestorReferenceV2026R0; 006import com.box.sdkgen.schemas.v2026r0.queryinsightsgroupbyv2026r0.QueryInsightsGroupByV2026R0; 007import com.fasterxml.jackson.annotation.JsonFilter; 008import com.fasterxml.jackson.annotation.JsonProperty; 009import java.util.List; 010import java.util.Map; 011import java.util.Objects; 012 013@JsonFilter("nullablePropertyFilter") 014public class QueryInsightsRequestBodyV2026R0QueryField extends SerializableObject { 015 016 /** 017 * A logical expression used to filter the dataset prior to metric computation, similar to an SQL 018 * `WHERE` clause. May include named parameters referenced as `:placeholder`. 019 */ 020 protected final String predicate; 021 022 /** 023 * A map of placeholder names (without the `:` prefix) to their values. Required only when the 024 * predicate contains parameter placeholders. The type of each value must match the type of the 025 * field it is compared to. 026 */ 027 protected Map<String, Object> params; 028 029 /** 030 * Restricts results to items contained within any of the specified ancestors. The user must have 031 * access to every listed ancestor. When omitted, insights are computed across all accessible 032 * items. 033 */ 034 protected List<QueryAncestorReferenceV2026R0> ancestors; 035 036 /** 037 * Defines how data is grouped for insights computation. Currently only a single grouping field is 038 * supported. 039 */ 040 @JsonProperty("group_by") 041 protected List<QueryInsightsGroupByV2026R0> groupBy; 042 043 public QueryInsightsRequestBodyV2026R0QueryField(@JsonProperty("predicate") String predicate) { 044 super(); 045 this.predicate = predicate; 046 } 047 048 protected QueryInsightsRequestBodyV2026R0QueryField(Builder builder) { 049 super(); 050 this.predicate = builder.predicate; 051 this.params = builder.params; 052 this.ancestors = builder.ancestors; 053 this.groupBy = builder.groupBy; 054 markNullableFieldsAsSet(builder.getExplicitlySetNullableFields()); 055 } 056 057 public String getPredicate() { 058 return predicate; 059 } 060 061 public Map<String, Object> getParams() { 062 return params; 063 } 064 065 public List<QueryAncestorReferenceV2026R0> getAncestors() { 066 return ancestors; 067 } 068 069 public List<QueryInsightsGroupByV2026R0> getGroupBy() { 070 return groupBy; 071 } 072 073 @Override 074 public boolean equals(Object o) { 075 if (this == o) { 076 return true; 077 } 078 if (o == null || getClass() != o.getClass()) { 079 return false; 080 } 081 QueryInsightsRequestBodyV2026R0QueryField casted = 082 (QueryInsightsRequestBodyV2026R0QueryField) o; 083 return Objects.equals(predicate, casted.predicate) 084 && Objects.equals(params, casted.params) 085 && Objects.equals(ancestors, casted.ancestors) 086 && Objects.equals(groupBy, casted.groupBy); 087 } 088 089 @Override 090 public int hashCode() { 091 return Objects.hash(predicate, params, ancestors, groupBy); 092 } 093 094 @Override 095 public String toString() { 096 return "QueryInsightsRequestBodyV2026R0QueryField{" 097 + "predicate='" 098 + predicate 099 + '\'' 100 + ", " 101 + "params='" 102 + params 103 + '\'' 104 + ", " 105 + "ancestors='" 106 + ancestors 107 + '\'' 108 + ", " 109 + "groupBy='" 110 + groupBy 111 + '\'' 112 + "}"; 113 } 114 115 public static class Builder extends NullableFieldTracker { 116 117 protected final String predicate; 118 119 protected Map<String, Object> params; 120 121 protected List<QueryAncestorReferenceV2026R0> ancestors; 122 123 protected List<QueryInsightsGroupByV2026R0> groupBy; 124 125 public Builder(String predicate) { 126 super(); 127 this.predicate = predicate; 128 } 129 130 public Builder params(Map<String, Object> params) { 131 this.params = params; 132 return this; 133 } 134 135 public Builder ancestors(List<QueryAncestorReferenceV2026R0> ancestors) { 136 this.ancestors = ancestors; 137 return this; 138 } 139 140 public Builder groupBy(List<QueryInsightsGroupByV2026R0> groupBy) { 141 this.groupBy = groupBy; 142 return this; 143 } 144 145 public QueryInsightsRequestBodyV2026R0QueryField build() { 146 return new QueryInsightsRequestBodyV2026R0QueryField(this); 147 } 148 } 149}