pub struct QueryBuilder { /* private fields */ }Expand description
Modern query builder with type-safe method chaining Provides a clean, Swift-like API for building HTTP query parameters
Implementations§
Source§impl QueryBuilder
impl QueryBuilder
Sourcepub fn string(self, key: &str, value: impl Into<Option<String>>) -> Self
pub fn string(self, key: &str, value: impl Into<Option<String>>) -> Self
Add a string parameter (accept both required/optional)
Sourcepub fn string_array<I, T>(self, key: &str, values: I) -> Self
pub fn string_array<I, T>(self, key: &str, values: I) -> Self
Add multiple string parameters with the same key (for allow-multiple query params)
Accepts both Vec
Sourcepub fn int(self, key: &str, value: impl Into<Option<i64>>) -> Self
pub fn int(self, key: &str, value: impl Into<Option<i64>>) -> Self
Add an integer parameter (accept both required/optional)
Sourcepub fn int_array<I, T>(self, key: &str, values: I) -> Self
pub fn int_array<I, T>(self, key: &str, values: I) -> Self
Add multiple integer parameters with the same key (for allow-multiple query params)
Accepts both Vec
Sourcepub fn float_array<I, T>(self, key: &str, values: I) -> Self
pub fn float_array<I, T>(self, key: &str, values: I) -> Self
Add multiple float parameters with the same key (for allow-multiple query params)
Accepts both Vec
Sourcepub fn bool_array<I, T>(self, key: &str, values: I) -> Self
pub fn bool_array<I, T>(self, key: &str, values: I) -> Self
Add multiple boolean parameters with the same key (for allow-multiple query params)
Accepts both Vec
Sourcepub fn datetime<Tz: TimeZone>(
self,
key: &str,
value: impl Into<Option<DateTime<Tz>>>,
) -> Self
pub fn datetime<Tz: TimeZone>( self, key: &str, value: impl Into<Option<DateTime<Tz>>>, ) -> Self
Add a datetime parameter (any DateTime timezone)
Sourcepub fn date(self, key: &str, value: impl Into<Option<NaiveDate>>) -> Self
pub fn date(self, key: &str, value: impl Into<Option<NaiveDate>>) -> Self
Add a date parameter (converts NaiveDate to DateTime
Sourcepub fn serialize<T: Serialize>(self, key: &str, value: Option<T>) -> Self
pub fn serialize<T: Serialize>(self, key: &str, value: Option<T>) -> Self
Add any serializable parameter (for enums and complex types)
Sourcepub fn serialize_array<T: Serialize>(
self,
key: &str,
values: impl IntoIterator<Item = T>,
) -> Self
pub fn serialize_array<T: Serialize>( self, key: &str, values: impl IntoIterator<Item = T>, ) -> Self
Add multiple serializable parameters with the same key (for allow-multiple query params with enums)
Accepts both Vec
Sourcepub fn structured_query(
self,
key: &str,
value: impl Into<Option<String>>,
) -> Self
pub fn structured_query( self, key: &str, value: impl Into<Option<String>>, ) -> Self
Parse and add a structured query string Handles complex query patterns like:
- “key:value” patterns
- “key:value1,value2” (comma-separated values)
- Quoted values: “key:"value with spaces"”
- Space-separated terms (treated as AND logic)