diff --git a/algolia/abtesting/model_ab_test_configuration.go b/algolia/abtesting/model_ab_test_configuration.go index 644f4bd77..c7d99cbbf 100644 --- a/algolia/abtesting/model_ab_test_configuration.go +++ b/algolia/abtesting/model_ab_test_configuration.go @@ -8,13 +8,19 @@ import ( // ABTestConfiguration A/B test configuration. type ABTestConfiguration struct { - Outliers Outliers `json:"outliers"` + Outliers *Outliers `json:"outliers,omitempty"` EmptySearch *EmptySearch `json:"emptySearch,omitempty"` MinimumDetectableEffect *MinimumDetectableEffect `json:"minimumDetectableEffect,omitempty"` } type ABTestConfigurationOption func(f *ABTestConfiguration) +func WithABTestConfigurationOutliers(val Outliers) ABTestConfigurationOption { + return func(f *ABTestConfiguration) { + f.Outliers = &val + } +} + func WithABTestConfigurationEmptySearch(val EmptySearch) ABTestConfigurationOption { return func(f *ABTestConfiguration) { f.EmptySearch = &val @@ -31,9 +37,8 @@ func WithABTestConfigurationMinimumDetectableEffect(val MinimumDetectableEffect) // This constructor will assign default values to properties that have it defined, // and makes sure properties required by API are set, but the set of arguments // will change when the set of required properties is changed. -func NewABTestConfiguration(outliers Outliers, opts ...ABTestConfigurationOption) *ABTestConfiguration { +func NewABTestConfiguration(opts ...ABTestConfigurationOption) *ABTestConfiguration { this := &ABTestConfiguration{} - this.Outliers = outliers for _, opt := range opts { opt(this) } @@ -45,28 +50,36 @@ func NewEmptyABTestConfiguration() *ABTestConfiguration { return &ABTestConfiguration{} } -// GetOutliers returns the Outliers field value. +// GetOutliers returns the Outliers field value if set, zero value otherwise. func (o *ABTestConfiguration) GetOutliers() Outliers { - if o == nil { + if o == nil || o.Outliers == nil { var ret Outliers return ret } - - return o.Outliers + return *o.Outliers } -// GetOutliersOk returns a tuple with the Outliers field value +// GetOutliersOk returns a tuple with the Outliers field value if set, nil otherwise // and a boolean to check if the value has been set. func (o *ABTestConfiguration) GetOutliersOk() (*Outliers, bool) { - if o == nil { + if o == nil || o.Outliers == nil { return nil, false } - return &o.Outliers, true + return o.Outliers, true +} + +// HasOutliers returns a boolean if a field has been set. +func (o *ABTestConfiguration) HasOutliers() bool { + if o != nil && o.Outliers != nil { + return true + } + + return false } -// SetOutliers sets field value. +// SetOutliers gets a reference to the given Outliers and assigns it to the Outliers field. func (o *ABTestConfiguration) SetOutliers(v *Outliers) *ABTestConfiguration { - o.Outliers = *v + o.Outliers = v return o } @@ -138,7 +151,7 @@ func (o *ABTestConfiguration) SetMinimumDetectableEffect(v *MinimumDetectableEff func (o ABTestConfiguration) MarshalJSON() ([]byte, error) { toSerialize := map[string]any{} - if true { + if o.Outliers != nil { toSerialize["outliers"] = o.Outliers } if o.EmptySearch != nil { diff --git a/algolia/abtesting/model_variant.go b/algolia/abtesting/model_variant.go index d51d2baf8..ee2075c5b 100644 --- a/algolia/abtesting/model_variant.go +++ b/algolia/abtesting/model_variant.go @@ -27,7 +27,7 @@ type Variant struct { // A/B test currencies. Currencies *map[string]Currency `json:"currencies,omitempty"` // Description for this variant. - Description string `json:"description"` + Description *string `json:"description,omitempty"` // Estimated number of searches required to achieve the desired statistical significance. The A/B test configuration must include a `mininmumDetectableEffect` setting for this number to be included in the response. EstimatedSampleSize *int32 `json:"estimatedSampleSize,omitempty"` FilterEffects *FilterEffects `json:"filterEffects,omitempty"` @@ -83,6 +83,12 @@ func WithVariantCurrencies(val map[string]Currency) VariantOption { } } +func WithVariantDescription(val string) VariantOption { + return func(f *Variant) { + f.Description = &val + } +} + func WithVariantEstimatedSampleSize(val int32) VariantOption { return func(f *Variant) { f.EstimatedSampleSize = &val @@ -111,12 +117,11 @@ func WithVariantTrackedSearchCount(val int32) VariantOption { // This constructor will assign default values to properties that have it defined, // and makes sure properties required by API are set, but the set of arguments // will change when the set of required properties is changed. -func NewVariant(addToCartCount int32, clickCount int32, conversionCount int32, description string, index string, noResultCount utils.Nullable[int32], purchaseCount int32, searchCount utils.Nullable[int32], trafficPercentage int32, userCount utils.Nullable[int32], trackedUserCount utils.Nullable[int32], opts ...VariantOption) *Variant { +func NewVariant(addToCartCount int32, clickCount int32, conversionCount int32, index string, noResultCount utils.Nullable[int32], purchaseCount int32, searchCount utils.Nullable[int32], trafficPercentage int32, userCount utils.Nullable[int32], trackedUserCount utils.Nullable[int32], opts ...VariantOption) *Variant { this := &Variant{} this.AddToCartCount = addToCartCount this.ClickCount = clickCount this.ConversionCount = conversionCount - this.Description = description this.Index = index this.NoResultCount = noResultCount this.PurchaseCount = purchaseCount @@ -419,28 +424,36 @@ func (o *Variant) SetCurrencies(v map[string]Currency) *Variant { return o } -// GetDescription returns the Description field value. +// GetDescription returns the Description field value if set, zero value otherwise. func (o *Variant) GetDescription() string { - if o == nil { + if o == nil || o.Description == nil { var ret string return ret } - - return o.Description + return *o.Description } -// GetDescriptionOk returns a tuple with the Description field value +// GetDescriptionOk returns a tuple with the Description field value if set, nil otherwise // and a boolean to check if the value has been set. func (o *Variant) GetDescriptionOk() (*string, bool) { - if o == nil { + if o == nil || o.Description == nil { return nil, false } - return &o.Description, true + return o.Description, true } -// SetDescription sets field value. +// HasDescription returns a boolean if a field has been set. +func (o *Variant) HasDescription() bool { + if o != nil && o.Description != nil { + return true + } + + return false +} + +// SetDescription gets a reference to the given string and assigns it to the Description field. func (o *Variant) SetDescription(v string) *Variant { - o.Description = v + o.Description = &v return o } @@ -796,7 +809,7 @@ func (o Variant) MarshalJSON() ([]byte, error) { if o.Currencies != nil { toSerialize["currencies"] = o.Currencies } - if true { + if o.Description != nil { toSerialize["description"] = o.Description } if o.EstimatedSampleSize != nil { diff --git a/algolia/recommend/model_recommendations_results.go b/algolia/recommend/model_recommendations_results.go index 882fed476..d3ff99d79 100644 --- a/algolia/recommend/model_recommendations_results.go +++ b/algolia/recommend/model_recommendations_results.go @@ -17,6 +17,8 @@ type RecommendationsResults struct { // Distance from a central coordinate provided by `aroundLatLng`. AutomaticRadius *string `json:"automaticRadius,omitempty"` Exhaustive *Exhaustive `json:"exhaustive,omitempty"` + // Rules applied to the query. + AppliedRules []map[string]any `json:"appliedRules,omitempty"` // See the `facetsCount` field of the `exhaustive` object in the response. // Deprecated ExhaustiveFacetsCount *bool `json:"exhaustiveFacetsCount,omitempty"` @@ -101,6 +103,12 @@ func WithRecommendationsResultsExhaustive(val Exhaustive) RecommendationsResults } } +func WithRecommendationsResultsAppliedRules(val []map[string]any) RecommendationsResultsOption { + return func(f *RecommendationsResults) { + f.AppliedRules = val + } +} + func WithRecommendationsResultsExhaustiveFacetsCount(val bool) RecommendationsResultsOption { return func(f *RecommendationsResults) { f.ExhaustiveFacetsCount = &val @@ -423,6 +431,39 @@ func (o *RecommendationsResults) SetExhaustive(v *Exhaustive) *RecommendationsRe return o } +// GetAppliedRules returns the AppliedRules field value if set, zero value otherwise. +func (o *RecommendationsResults) GetAppliedRules() []map[string]any { + if o == nil || o.AppliedRules == nil { + var ret []map[string]any + return ret + } + return o.AppliedRules +} + +// GetAppliedRulesOk returns a tuple with the AppliedRules field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *RecommendationsResults) GetAppliedRulesOk() ([]map[string]any, bool) { + if o == nil || o.AppliedRules == nil { + return nil, false + } + return o.AppliedRules, true +} + +// HasAppliedRules returns a boolean if a field has been set. +func (o *RecommendationsResults) HasAppliedRules() bool { + if o != nil && o.AppliedRules != nil { + return true + } + + return false +} + +// SetAppliedRules gets a reference to the given []map[string]any and assigns it to the AppliedRules field. +func (o *RecommendationsResults) SetAppliedRules(v []map[string]any) *RecommendationsResults { + o.AppliedRules = v + return o +} + // GetExhaustiveFacetsCount returns the ExhaustiveFacetsCount field value if set, zero value otherwise. // Deprecated. func (o *RecommendationsResults) GetExhaustiveFacetsCount() bool { @@ -1258,6 +1299,9 @@ func (o RecommendationsResults) MarshalJSON() ([]byte, error) { if o.Exhaustive != nil { toSerialize["exhaustive"] = o.Exhaustive } + if o.AppliedRules != nil { + toSerialize["appliedRules"] = o.AppliedRules + } if o.ExhaustiveFacetsCount != nil { toSerialize["exhaustiveFacetsCount"] = o.ExhaustiveFacetsCount } @@ -1348,6 +1392,7 @@ func (o RecommendationsResults) String() string { out += fmt.Sprintf(" aroundLatLng=%v\n", o.AroundLatLng) out += fmt.Sprintf(" automaticRadius=%v\n", o.AutomaticRadius) out += fmt.Sprintf(" exhaustive=%v\n", o.Exhaustive) + out += fmt.Sprintf(" appliedRules=%v\n", o.AppliedRules) out += fmt.Sprintf(" exhaustiveFacetsCount=%v\n", o.ExhaustiveFacetsCount) out += fmt.Sprintf(" exhaustiveNbHits=%v\n", o.ExhaustiveNbHits) out += fmt.Sprintf(" exhaustiveTypo=%v\n", o.ExhaustiveTypo) diff --git a/algolia/search/model_browse_response.go b/algolia/search/model_browse_response.go index bb76bcef7..42ccac31e 100644 --- a/algolia/search/model_browse_response.go +++ b/algolia/search/model_browse_response.go @@ -17,6 +17,8 @@ type BrowseResponse struct { // Distance from a central coordinate provided by `aroundLatLng`. AutomaticRadius *string `json:"automaticRadius,omitempty"` Exhaustive *Exhaustive `json:"exhaustive,omitempty"` + // Rules applied to the query. + AppliedRules []map[string]any `json:"appliedRules,omitempty"` // See the `facetsCount` field of the `exhaustive` object in the response. // Deprecated ExhaustiveFacetsCount *bool `json:"exhaustiveFacetsCount,omitempty"` @@ -108,6 +110,12 @@ func WithBrowseResponseExhaustive(val Exhaustive) BrowseResponseOption { } } +func WithBrowseResponseAppliedRules(val []map[string]any) BrowseResponseOption { + return func(f *BrowseResponse) { + f.AppliedRules = val + } +} + func WithBrowseResponseExhaustiveFacetsCount(val bool) BrowseResponseOption { return func(f *BrowseResponse) { f.ExhaustiveFacetsCount = &val @@ -438,6 +446,39 @@ func (o *BrowseResponse) SetExhaustive(v *Exhaustive) *BrowseResponse { return o } +// GetAppliedRules returns the AppliedRules field value if set, zero value otherwise. +func (o *BrowseResponse) GetAppliedRules() []map[string]any { + if o == nil || o.AppliedRules == nil { + var ret []map[string]any + return ret + } + return o.AppliedRules +} + +// GetAppliedRulesOk returns a tuple with the AppliedRules field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *BrowseResponse) GetAppliedRulesOk() ([]map[string]any, bool) { + if o == nil || o.AppliedRules == nil { + return nil, false + } + return o.AppliedRules, true +} + +// HasAppliedRules returns a boolean if a field has been set. +func (o *BrowseResponse) HasAppliedRules() bool { + if o != nil && o.AppliedRules != nil { + return true + } + + return false +} + +// SetAppliedRules gets a reference to the given []map[string]any and assigns it to the AppliedRules field. +func (o *BrowseResponse) SetAppliedRules(v []map[string]any) *BrowseResponse { + o.AppliedRules = v + return o +} + // GetExhaustiveFacetsCount returns the ExhaustiveFacetsCount field value if set, zero value otherwise. // Deprecated. func (o *BrowseResponse) GetExhaustiveFacetsCount() bool { @@ -1356,6 +1397,9 @@ func (o BrowseResponse) MarshalJSON() ([]byte, error) { if o.Exhaustive != nil { toSerialize["exhaustive"] = o.Exhaustive } + if o.AppliedRules != nil { + toSerialize["appliedRules"] = o.AppliedRules + } if o.ExhaustiveFacetsCount != nil { toSerialize["exhaustiveFacetsCount"] = o.ExhaustiveFacetsCount } @@ -1455,6 +1499,7 @@ func (o BrowseResponse) String() string { out += fmt.Sprintf(" aroundLatLng=%v\n", o.AroundLatLng) out += fmt.Sprintf(" automaticRadius=%v\n", o.AutomaticRadius) out += fmt.Sprintf(" exhaustive=%v\n", o.Exhaustive) + out += fmt.Sprintf(" appliedRules=%v\n", o.AppliedRules) out += fmt.Sprintf(" exhaustiveFacetsCount=%v\n", o.ExhaustiveFacetsCount) out += fmt.Sprintf(" exhaustiveNbHits=%v\n", o.ExhaustiveNbHits) out += fmt.Sprintf(" exhaustiveTypo=%v\n", o.ExhaustiveTypo) diff --git a/algolia/search/model_get_api_key_response.go b/algolia/search/model_get_api_key_response.go index 83504d9fa..1cf093b27 100644 --- a/algolia/search/model_get_api_key_response.go +++ b/algolia/search/model_get_api_key_response.go @@ -9,7 +9,7 @@ import ( // GetApiKeyResponse struct for GetApiKeyResponse. type GetApiKeyResponse struct { // API key. - Value *string `json:"value,omitempty"` + Value string `json:"value"` // Timestamp when the object was created, in milliseconds since the Unix epoch. CreatedAt int64 `json:"createdAt"` // Permissions that determine the type of API requests this key can make. The required ACL is listed in each endpoint's reference. For more information, see [access control list](https://www.algolia.com/doc/guides/security/api-keys/#access-control-list-acl). @@ -32,12 +32,6 @@ type GetApiKeyResponse struct { type GetApiKeyResponseOption func(f *GetApiKeyResponse) -func WithGetApiKeyResponseValue(val string) GetApiKeyResponseOption { - return func(f *GetApiKeyResponse) { - f.Value = &val - } -} - func WithGetApiKeyResponseDescription(val string) GetApiKeyResponseOption { return func(f *GetApiKeyResponse) { f.Description = &val @@ -84,8 +78,9 @@ func WithGetApiKeyResponseValidity(val int32) GetApiKeyResponseOption { // This constructor will assign default values to properties that have it defined, // and makes sure properties required by API are set, but the set of arguments // will change when the set of required properties is changed. -func NewGetApiKeyResponse(createdAt int64, acl []Acl, opts ...GetApiKeyResponseOption) *GetApiKeyResponse { +func NewGetApiKeyResponse(value string, createdAt int64, acl []Acl, opts ...GetApiKeyResponseOption) *GetApiKeyResponse { this := &GetApiKeyResponse{} + this.Value = value this.CreatedAt = createdAt this.Acl = acl for _, opt := range opts { @@ -99,36 +94,28 @@ func NewEmptyGetApiKeyResponse() *GetApiKeyResponse { return &GetApiKeyResponse{} } -// GetValue returns the Value field value if set, zero value otherwise. +// GetValue returns the Value field value. func (o *GetApiKeyResponse) GetValue() string { - if o == nil || o.Value == nil { + if o == nil { var ret string return ret } - return *o.Value + + return o.Value } -// GetValueOk returns a tuple with the Value field value if set, nil otherwise +// GetValueOk returns a tuple with the Value field value // and a boolean to check if the value has been set. func (o *GetApiKeyResponse) GetValueOk() (*string, bool) { - if o == nil || o.Value == nil { + if o == nil { return nil, false } - return o.Value, true + return &o.Value, true } -// HasValue returns a boolean if a field has been set. -func (o *GetApiKeyResponse) HasValue() bool { - if o != nil && o.Value != nil { - return true - } - - return false -} - -// SetValue gets a reference to the given string and assigns it to the Value field. +// SetValue sets field value. func (o *GetApiKeyResponse) SetValue(v string) *GetApiKeyResponse { - o.Value = &v + o.Value = v return o } @@ -415,7 +402,7 @@ func (o *GetApiKeyResponse) SetValidity(v int32) *GetApiKeyResponse { func (o GetApiKeyResponse) MarshalJSON() ([]byte, error) { toSerialize := map[string]any{} - if o.Value != nil { + if true { toSerialize["value"] = o.Value } if true { diff --git a/algolia/search/model_get_objects_response.go b/algolia/search/model_get_objects_response.go index 1c96b6be5..8c10a4da5 100644 --- a/algolia/search/model_get_objects_response.go +++ b/algolia/search/model_get_objects_response.go @@ -9,16 +9,26 @@ import ( // GetObjectsResponse struct for GetObjectsResponse. type GetObjectsResponse struct { // Retrieved records. - Results []map[string]any `json:"results"` + Results []map[string]any `json:"results,omitempty"` +} + +type GetObjectsResponseOption func(f *GetObjectsResponse) + +func WithGetObjectsResponseResults(val []map[string]any) GetObjectsResponseOption { + return func(f *GetObjectsResponse) { + f.Results = val + } } // NewGetObjectsResponse instantiates a new GetObjectsResponse object // This constructor will assign default values to properties that have it defined, // and makes sure properties required by API are set, but the set of arguments // will change when the set of required properties is changed. -func NewGetObjectsResponse(results []map[string]any) *GetObjectsResponse { +func NewGetObjectsResponse(opts ...GetObjectsResponseOption) *GetObjectsResponse { this := &GetObjectsResponse{} - this.Results = results + for _, opt := range opts { + opt(this) + } return this } @@ -27,26 +37,34 @@ func NewEmptyGetObjectsResponse() *GetObjectsResponse { return &GetObjectsResponse{} } -// GetResults returns the Results field value. +// GetResults returns the Results field value if set, zero value otherwise. func (o *GetObjectsResponse) GetResults() []map[string]any { - if o == nil { + if o == nil || o.Results == nil { var ret []map[string]any return ret } - return o.Results } -// GetResultsOk returns a tuple with the Results field value +// GetResultsOk returns a tuple with the Results field value if set, nil otherwise // and a boolean to check if the value has been set. func (o *GetObjectsResponse) GetResultsOk() ([]map[string]any, bool) { - if o == nil { + if o == nil || o.Results == nil { return nil, false } return o.Results, true } -// SetResults sets field value. +// HasResults returns a boolean if a field has been set. +func (o *GetObjectsResponse) HasResults() bool { + if o != nil && o.Results != nil { + return true + } + + return false +} + +// SetResults gets a reference to the given []map[string]any and assigns it to the Results field. func (o *GetObjectsResponse) SetResults(v []map[string]any) *GetObjectsResponse { o.Results = v return o @@ -54,7 +72,7 @@ func (o *GetObjectsResponse) SetResults(v []map[string]any) *GetObjectsResponse func (o GetObjectsResponse) MarshalJSON() ([]byte, error) { toSerialize := map[string]any{} - if true { + if o.Results != nil { toSerialize["results"] = o.Results } serialized, err := json.Marshal(toSerialize) diff --git a/algolia/search/model_search_response.go b/algolia/search/model_search_response.go index 0b9fa6270..ba7f7f902 100644 --- a/algolia/search/model_search_response.go +++ b/algolia/search/model_search_response.go @@ -17,6 +17,8 @@ type SearchResponse struct { // Distance from a central coordinate provided by `aroundLatLng`. AutomaticRadius *string `json:"automaticRadius,omitempty"` Exhaustive *Exhaustive `json:"exhaustive,omitempty"` + // Rules applied to the query. + AppliedRules []map[string]any `json:"appliedRules,omitempty"` // See the `facetsCount` field of the `exhaustive` object in the response. // Deprecated ExhaustiveFacetsCount *bool `json:"exhaustiveFacetsCount,omitempty"` @@ -109,6 +111,12 @@ func WithSearchResponseExhaustive(val Exhaustive) SearchResponseOption { } } +func WithSearchResponseAppliedRules(val []map[string]any) SearchResponseOption { + return func(f *SearchResponse) { + f.AppliedRules = val + } +} + func WithSearchResponseExhaustiveFacetsCount(val bool) SearchResponseOption { return func(f *SearchResponse) { f.ExhaustiveFacetsCount = &val @@ -433,6 +441,39 @@ func (o *SearchResponse) SetExhaustive(v *Exhaustive) *SearchResponse { return o } +// GetAppliedRules returns the AppliedRules field value if set, zero value otherwise. +func (o *SearchResponse) GetAppliedRules() []map[string]any { + if o == nil || o.AppliedRules == nil { + var ret []map[string]any + return ret + } + return o.AppliedRules +} + +// GetAppliedRulesOk returns a tuple with the AppliedRules field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *SearchResponse) GetAppliedRulesOk() ([]map[string]any, bool) { + if o == nil || o.AppliedRules == nil { + return nil, false + } + return o.AppliedRules, true +} + +// HasAppliedRules returns a boolean if a field has been set. +func (o *SearchResponse) HasAppliedRules() bool { + if o != nil && o.AppliedRules != nil { + return true + } + + return false +} + +// SetAppliedRules gets a reference to the given []map[string]any and assigns it to the AppliedRules field. +func (o *SearchResponse) SetAppliedRules(v []map[string]any) *SearchResponse { + o.AppliedRules = v + return o +} + // GetExhaustiveFacetsCount returns the ExhaustiveFacetsCount field value if set, zero value otherwise. // Deprecated. func (o *SearchResponse) GetExhaustiveFacetsCount() bool { @@ -1328,6 +1369,9 @@ func (o SearchResponse) MarshalJSON() ([]byte, error) { if o.Exhaustive != nil { toSerialize["exhaustive"] = o.Exhaustive } + if o.AppliedRules != nil { + toSerialize["appliedRules"] = o.AppliedRules + } if o.ExhaustiveFacetsCount != nil { toSerialize["exhaustiveFacetsCount"] = o.ExhaustiveFacetsCount } @@ -1444,6 +1488,7 @@ func (o *SearchResponse) UnmarshalJSON(bytes []byte) error { delete(additionalProperties, "aroundLatLng") delete(additionalProperties, "automaticRadius") delete(additionalProperties, "exhaustive") + delete(additionalProperties, "appliedRules") delete(additionalProperties, "exhaustiveFacetsCount") delete(additionalProperties, "exhaustiveNbHits") delete(additionalProperties, "exhaustiveTypo") @@ -1483,6 +1528,7 @@ func (o SearchResponse) String() string { out += fmt.Sprintf(" aroundLatLng=%v\n", o.AroundLatLng) out += fmt.Sprintf(" automaticRadius=%v\n", o.AutomaticRadius) out += fmt.Sprintf(" exhaustive=%v\n", o.Exhaustive) + out += fmt.Sprintf(" appliedRules=%v\n", o.AppliedRules) out += fmt.Sprintf(" exhaustiveFacetsCount=%v\n", o.ExhaustiveFacetsCount) out += fmt.Sprintf(" exhaustiveNbHits=%v\n", o.ExhaustiveNbHits) out += fmt.Sprintf(" exhaustiveTypo=%v\n", o.ExhaustiveTypo)