trieve-client 0.11.7

Trieve OpenAPI Specification. This document describes all of the operations available through the Trieve API.
Documentation
/*
 * Trieve API
 *
 * Trieve OpenAPI Specification. This document describes all of the operations available through the Trieve API.
 *
 * The version of the OpenAPI document: 0.11.7
 * Contact: developers@trieve.ai
 * Generated by: https://openapi-generator.tech
 */

use crate::models;

#[derive(Clone, Default, Debug, PartialEq, Serialize, Deserialize)]
pub struct FieldCondition {
    #[serde(rename = "date_range", default, with = "::serde_with::rust::double_option", skip_serializing_if = "Option::is_none")]
    pub date_range: Option<Option<Box<models::DateRange>>>,
    /// Field is the name of the field to filter on. The field value will be used to check for an exact substring match on the metadata values for each existing chunk. This is useful for when you want to filter chunks by arbitrary metadata. To access fields inside of the metadata that you provide with the card, prefix the field name with `metadata.`.
    #[serde(rename = "field")]
    pub field: String,
    #[serde(rename = "geo_bounding_box", default, with = "::serde_with::rust::double_option", skip_serializing_if = "Option::is_none")]
    pub geo_bounding_box: Option<Option<Box<models::LocationBoundingBox>>>,
    #[serde(rename = "geo_polygon", default, with = "::serde_with::rust::double_option", skip_serializing_if = "Option::is_none")]
    pub geo_polygon: Option<Option<Box<models::LocationPolygon>>>,
    #[serde(rename = "geo_radius", default, with = "::serde_with::rust::double_option", skip_serializing_if = "Option::is_none")]
    pub geo_radius: Option<Option<Box<models::LocationRadius>>>,
    /// Match all lets you pass in an array of values that will return results if all of the items match. The match value will be used to check for an exact substring match on the metadata values for each existing chunk. If both match_all and match_any are provided, the match_any condition will be used.
    #[serde(rename = "match_all", default, with = "::serde_with::rust::double_option", skip_serializing_if = "Option::is_none")]
    pub match_all: Option<Option<Vec<models::MatchCondition>>>,
    /// Match any lets you pass in an array of values that will return results if any of the items match. The match value will be used to check for an exact substring match on the metadata values for each existing chunk. If both match_all and match_any are provided, the match_any condition will be used.
    #[serde(rename = "match_any", default, with = "::serde_with::rust::double_option", skip_serializing_if = "Option::is_none")]
    pub match_any: Option<Option<Vec<models::MatchCondition>>>,
    #[serde(rename = "range", default, with = "::serde_with::rust::double_option", skip_serializing_if = "Option::is_none")]
    pub range: Option<Option<Box<models::Range>>>,
}

impl FieldCondition {
    pub fn new(field: String) -> FieldCondition {
        FieldCondition {
            date_range: None,
            field,
            geo_bounding_box: None,
            geo_polygon: None,
            geo_radius: None,
            match_all: None,
            match_any: None,
            range: None,
        }
    }
}