use super::DpTran;
use super::DeeplAPIError;
pub mod api;
pub use api::Usage;
pub fn get_usage(api: &DpTran) -> Result<Usage, DeeplAPIError> {
api::get_usage(api)
}
#[cfg(test)]
pub mod tests {
use super::*;
fn do_api_usage_test(times: u8) {
let (api_key, api_key_type) = super::super::tests::get_api_key();
let api = DpTran::with_endpoint(&api_key, &api_key_type, super::super::tests::get_endpoint());
let res = get_usage(&api);
if res.is_err() {
if super::super::tests::retry_or_panic_for_api_tests(&res.err().unwrap(), times) {
do_api_usage_test(times + 1);
return;
}
}
}
#[test]
fn api_usage_test() {
do_api_usage_test(0);
}
}