pub struct SearchRequestBuilder { /* private fields */ }Expand description
Builder for constructing SearchRequest instances.
Provides a fluent API for setting search keywords and filter parameters.
All methods return self to enable method chaining.
§Required Fields
query: Must be set viaquery()
§Examples
use openfigi_rs::model::request::SearchRequestBuilder;
use openfigi_rs::model::enums::{Currency, ExchCode};
let request = SearchRequestBuilder::new()
.query("technology")
.currency(Currency::USD)
.exch_code(ExchCode::US)
.build()
.unwrap();Implementations§
Source§impl SearchRequestBuilder
impl SearchRequestBuilder
Sourcepub fn new() -> Self
pub fn new() -> Self
Creates a new SearchRequestBuilder with all fields unset.
§Examples
use openfigi_rs::model::request::SearchRequestBuilder;
let builder = SearchRequestBuilder::new();Sourcepub fn query(self, query: impl Into<String>) -> Self
pub fn query(self, query: impl Into<String>) -> Self
Sets search keywords for the search request.
This field is required and specifies the keywords to search for when finding FIGIs.
§Examples
use openfigi_rs::model::request::SearchRequestBuilder;
let builder = SearchRequestBuilder::new().query("AAPL");Sourcepub fn start(self, start: impl Into<String>) -> Self
pub fn start(self, start: impl Into<String>) -> Self
Sets the pagination start token.
Used for retrieving subsequent pages of results when the response
contains a next field.
§Examples
use openfigi_rs::model::request::SearchRequestBuilder;
let builder = SearchRequestBuilder::new()
.query("tech")
.start("next_page_token");Sourcepub fn filters_mut(&mut self) -> &mut RequestFilters
pub fn filters_mut(&mut self) -> &mut RequestFilters
Mutable access to the request filters.
Sourcepub fn exch_code(self, exch_code: ExchCode) -> Self
pub fn exch_code(self, exch_code: ExchCode) -> Self
Sets the exch_code for the desired instrument.
Sourcepub fn currency(self, currency: Currency) -> Self
pub fn currency(self, currency: Currency) -> Self
Sets the currency for the desired instrument.
Sourcepub fn market_sec_des(self, market_sec_des: MarketSecDesc) -> Self
pub fn market_sec_des(self, market_sec_des: MarketSecDesc) -> Self
Sets the market_sec_des for the desired instrument.
Sourcepub fn security_type(self, security_type: SecurityType) -> Self
pub fn security_type(self, security_type: SecurityType) -> Self
Sets the security_type for the desired instrument.
Sourcepub fn security_type2(self, security_type2: SecurityType2) -> Self
pub fn security_type2(self, security_type2: SecurityType2) -> Self
Sets the security_type2 for the desired instrument.
Sourcepub fn include_unlisted_equities(self, val: bool) -> Self
pub fn include_unlisted_equities(self, val: bool) -> Self
Sets whether to include unlisted equities in the filter.
Sourcepub fn option_type(self, option_type: OptionType) -> Self
pub fn option_type(self, option_type: OptionType) -> Self
Sets the option_type for the desired instrument.
Sourcepub fn strike(self, strike: [Option<f64>; 2]) -> Self
pub fn strike(self, strike: [Option<f64>; 2]) -> Self
Sets the strike price range for the desired instrument.
Sourcepub fn contract_size(self, contract_size: [Option<f64>; 2]) -> Self
pub fn contract_size(self, contract_size: [Option<f64>; 2]) -> Self
Sets the contract_size range for the desired instrument.
Sourcepub fn coupon(self, coupon: [Option<f64>; 2]) -> Self
pub fn coupon(self, coupon: [Option<f64>; 2]) -> Self
Sets the coupon range for the desired instrument.
Sourcepub fn expiration(self, expiration: [Option<NaiveDate>; 2]) -> Self
pub fn expiration(self, expiration: [Option<NaiveDate>; 2]) -> Self
Sets the expiration date range for the desired instrument.
Sourcepub fn maturity(self, maturity: [Option<NaiveDate>; 2]) -> Self
pub fn maturity(self, maturity: [Option<NaiveDate>; 2]) -> Self
Sets the maturity date range for the desired instrument.
Sourcepub fn state_code(self, state_code: StateCode) -> Self
pub fn state_code(self, state_code: StateCode) -> Self
Sets the state_code for the desired instrument.
Sourcepub fn build(self) -> Result<SearchRequest>
pub fn build(self) -> Result<SearchRequest>
Builds and validates the SearchRequest.
Constructs the final request object and performs validation to ensure all requirements are met.
§Errors
Returns OpenFIGIError if validation fails, such as:
- Missing required
queryfield - Mutually exclusive parameters set
- Invalid parameter ranges
§Examples
use openfigi_rs::model::request::SearchRequestBuilder;
let request = SearchRequestBuilder::new()
.query("IBM")
.build()
.unwrap();