pub struct CodeQuery { /* private fields */ }Expand description
Query builder for the getDataCode endpoint.
Constraints enforced at build time:
DBmust be non-empty ASCII and must not contain commas.CODEentries must be non-empty ASCII, must not contain commas, and the number of entries must be between1and1250.startDateandendDatemust beYYYYorYYYYXX(XX=01..12), and if both are set they must have the same format andstartDate <= endDate.
§Examples
use boj_client::query::{CodeQuery, Format, Language};
let _query = CodeQuery::new("CO", vec!["TK99F1000601GCQ01000".to_string()])?
.with_format(Format::Json)
.with_lang(Language::En)
.with_start_date("202401")?
.with_end_date("202402")?;Implementations§
Source§impl CodeQuery
impl CodeQuery
Sourcepub fn with_format(self, format: Format) -> Self
pub fn with_format(self, format: Format) -> Self
Sets the response format (json or csv).
§Examples
use boj_client::query::{CodeQuery, Format};
let _query = CodeQuery::new("CO", vec!["TK99F1000601GCQ01000".to_string()])?
.with_format(Format::Csv);Sourcepub fn with_lang(self, lang: Language) -> Self
pub fn with_lang(self, lang: Language) -> Self
Sets response language (jp or en).
§Examples
use boj_client::query::{CodeQuery, Language};
let _query = CodeQuery::new("CO", vec!["TK99F1000601GCQ01000".to_string()])?
.with_lang(Language::Jp);Sourcepub fn with_start_date(self, value: impl Into<String>) -> Result<Self, BojError>
pub fn with_start_date(self, value: impl Into<String>) -> Result<Self, BojError>
Sets startDate.
Accepted format is YYYY or YYYYXX (XX=01..12).
§Examples
use boj_client::query::CodeQuery;
let _query = CodeQuery::new("CO", vec!["TK99F1000601GCQ01000".to_string()])?
.with_start_date("2024")?;§Errors
Returns BojError if the value format is invalid or if endDate
is already set and the date order becomes invalid.
Sourcepub fn with_end_date(self, value: impl Into<String>) -> Result<Self, BojError>
pub fn with_end_date(self, value: impl Into<String>) -> Result<Self, BojError>
Sets endDate.
Accepted format is YYYY or YYYYXX (XX=01..12).
§Examples
use boj_client::query::CodeQuery;
let _query = CodeQuery::new("CO", vec!["TK99F1000601GCQ01000".to_string()])?
.with_end_date("202402")?;§Errors
Returns BojError if the value format is invalid or if startDate
is already set and the date order becomes invalid.
Sourcepub fn with_start_position(self, start_position: u32) -> Result<Self, BojError>
pub fn with_start_position(self, start_position: u32) -> Result<Self, BojError>
Trait Implementations§
impl Eq for CodeQuery
impl StructuralPartialEq for CodeQuery
Auto Trait Implementations§
impl Freeze for CodeQuery
impl RefUnwindSafe for CodeQuery
impl Send for CodeQuery
impl Sync for CodeQuery
impl Unpin for CodeQuery
impl UnsafeUnpin for CodeQuery
impl UnwindSafe for CodeQuery
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more