pub struct MappingRequestBuilder { /* private fields */ }Expand description
Builder for constructing MappingRequest instances.
Provides a fluent API for setting identifier information and filter parameters.
All methods return self to enable method chaining.
§Required Fields
id_type: Must be set viaid_type()id_value: Must be set viaid_value()
§Examples
use openfigi_rs::model::request::MappingRequestBuilder;
use openfigi_rs::model::enums::{IdType, Currency, ExchCode};
let request = MappingRequestBuilder::new()
.id_type(IdType::ID_ISIN)
.id_value("US4592001014")
.currency(Currency::USD)
.exch_code(ExchCode::US)
.build()
.unwrap();Implementations§
Source§impl MappingRequestBuilder
impl MappingRequestBuilder
Sourcepub fn new() -> Self
pub fn new() -> Self
Creates a new MappingRequestBuilder with all fields unset.
§Examples
use openfigi_rs::model::request::MappingRequestBuilder;
let builder = MappingRequestBuilder::new();Sourcepub fn id_type(self, id_type: IdType) -> Self
pub fn id_type(self, id_type: IdType) -> Self
Sets the identifier type for the mapping request.
This field is required and specifies what type of third-party identifier is being mapped to a FIGI.
§Examples
use openfigi_rs::model::request::MappingRequestBuilder;
use openfigi_rs::model::enums::IdType;
let builder = MappingRequestBuilder::new().id_type(IdType::ID_ISIN);Sourcepub fn id_value<T: Into<Value>>(self, id_value: T) -> Self
pub fn id_value<T: Into<Value>>(self, id_value: T) -> Self
Sets the identifier value for the mapping request.
This field is required and contains the actual identifier value to be mapped.
Can accept strings, numbers, or any value that converts to serde_json::Value.
§Examples
use openfigi_rs::model::request::MappingRequestBuilder;
use serde_json::json;
let builder = MappingRequestBuilder::new()
.id_value("US4592001014") // String
.id_value(json!("AAPL")) // JSON string
.id_value(12345); // NumberSourcepub 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<MappingRequest>
pub fn build(self) -> Result<MappingRequest>
Builds and validates the MappingRequest.
Constructs the final request object and performs validation to ensure all requirements are met.
§Errors
Returns OpenFIGIError if validation fails, such as:
- Missing required fields (
id_typeorid_value) - Missing
security_type2when required by identifier type - Mutually exclusive parameters set
- Invalid parameter ranges
§Examples
use openfigi_rs::model::request::MappingRequestBuilder;
use openfigi_rs::model::enums::IdType;
let request = MappingRequestBuilder::new()
.id_type(IdType::ID_ISIN)
.id_value("US4592001014")
.build()
.unwrap();