# JapanAPIs 0.1.1

## Bug Fixes

* Improved error handling in all API functions to comply with CRAN policies regarding internet resources
* All functions now fail gracefully with informative messages when APIs are unavailable or return errors
* Added timeout handling (10 seconds) to prevent hanging connections during API requests
* Added robust error handling with `tryCatch()` blocks for network errors, HTTP errors, and JSON parsing errors
* Functions now return `NULL` with clear messages instead of throwing errors when API calls fail

## Documentation Improvements

* Updated all function examples to use `\donttest{}` instead of `if (interactive())` to prevent issues during `R CMD check`
* Enhanced documentation to clarify that functions return `NULL` when APIs are unavailable
* Added more detailed error messages to guide users when connection issues occur

## Affected Functions

All API-calling functions have been updated with improved error handling:

* `get_country_info_jp()` - REST Countries API
* `get_japan_child_mortality()` - World Bank API
* `get_japan_cpi()` - World Bank API
* `get_japan_energy_use()` - World Bank API
* `get_japan_gdp()` - World Bank API
* `get_japan_holidays()` - Nager.Date API
* `get_japan_hospital_beds()` - World Bank API
* `get_japan_life_expectancy()` - World Bank API
* `get_japan_literacy_rate()` - World Bank API
* `get_japan_population()` - World Bank API
* `get_japan_unemployment()` - World Bank API

## Technical Details

* All HTTP requests now include `httr::timeout(10)` parameter
* Added `http_error()` and `http_status()` checks for robust HTTP error detection
* Replaced `stop()` with `message() + return(NULL)` pattern for graceful failures
* Enhanced `@importFrom` declarations to include new error handling functions


---

# JapanAPIs 0.1.0

## Initial Release

* First release of `JapanAPIs` package
* Added `view_datasets_JapanAPIs()` function to explore available datasets
* Access Japanese Data via Public APIs and Curated Datasets

## Features

### API Functions

* `get_country_info_jp()` - Retrieve key country information about Japan
* `get_japan_child_mortality()` - Get under-5 mortality rate data
* `get_japan_cpi()` - Get Consumer Price Index data
* `get_japan_energy_use()` - Get energy use per capita data
* `get_japan_gdp()` - Get GDP in current US dollars
* `get_japan_holidays()` - Get official public holidays for any year
* `get_japan_hospital_beds()` - Get hospital beds per 1,000 people
* `get_japan_life_expectancy()` - Get life expectancy at birth
* `get_japan_literacy_rate()` - Get adult literacy rate (15+)
* `get_japan_population()` - Get total population data
* `get_japan_unemployment()` - Get unemployment rate data

### Data Sources

* REST Countries API for country information
* World Bank Open Data API for economic and social indicators
* Nager.Date API for public holidays

### Utility Functions

* `view_datasets_JapanAPIs()` - Interactive function to explore and view available datasets
