pub struct ApiKey(_);
Expand description
is the container of the api key validated.
To check validity of the given api key, users need to create an api key variable via
ApiKey::from
.
Implementations
is needed to automatically check validation of api key for new instance.
The internet connection is required to achieve the task.
Error
The function will return error if given api key is invalid or there is a bad internet connection.
Examples
use tcmb_evds::common::ApiKey;
use tcmb_evds::error::ReturnError;
// If user key entered is valid, the function creates api_key variable.
// Otherwise, returns one of ReturnError options.
// The function returns an error unless users write their own valid api key.
let result = ApiKey::from("users_key".to_string());
// Users can handle error in a different way.
let api_key = match result {
Err(return_error) => {
println!("{}", return_error.to_string());
return;
},
Ok(api_key) => api_key,
};