Skip to content

Commit

Permalink
refactor(repo): beautify example in README
Browse files Browse the repository at this point in the history
  • Loading branch information
Mixerou committed Jun 6, 2023
1 parent c8c060c commit 2abc8af
Showing 1 changed file with 11 additions and 4 deletions.
15 changes: 11 additions & 4 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -23,16 +23,23 @@ fn main() {
// `generate_minimum_config` (that includes only important fields)
// `generate_maximum_config` (that includes all fields)
let ip_data: IpData = Client::generate_empty_config()
// or `exclude_country` if this field is already included in the generated config
// or `exclude_country` if this field is already included
// in the generated config
.include_country()
// or `exclude_currency` if this field is already included in the generated config
// or `exclude_currency` if this field is already included in
// the generated config
.include_currency()
// available languages: de/en (default)/es/fr/ja/pt-Br/ru/zh-CN
.set_language(IpApiLanguage::De)
// `make_request` takes "ip"/"domain"/"empty string (if you want to request your ip)"
// `make_request` takes
// "ip"/"domain"/"empty string (if you want to request your ip)"
.make_request("1.1.1.1").unwrap();

println!("{}'s national currency is {}", ip_data.country.unwrap(), ip_data.currency.unwrap());
println!(
"{}'s national currency is {}",
ip_data.country.unwrap(),
ip_data.currency.unwrap(),
);

// If you want to request more than one ip, you can use `make_batch_request`
let ip_batch_data: Vec<IpData> = Client::generate_empty_config()
Expand Down

0 comments on commit 2abc8af

Please sign in to comment.