Skip to content

implement bulk download API endpoints, polling, and file downloader#245

Open
lykmapipo wants to merge 30 commits intodevelopfrom
feature/bulk-downloads
Open

implement bulk download API endpoints, polling, and file downloader#245
lykmapipo wants to merge 30 commits intodevelopfrom
feature/bulk-downloads

Conversation

@lykmapipo
Copy link
Copy Markdown
Collaborator

This:

  • Implement core bulk download API endpoints
  • Implement gfw_wait_for_bulk_report() polling utility to handle asynchronous report generation
  • Implement gfw_download_bulk_report_file() with configurable data directories
  • Add detailed documentation including return schemas, usage examples, and API caveats

This:
- add `get_vessel_insights()` for interacting with the vessels insights API
- add `with_gfw_json_fixture()` helper for loading fixture JSON files in tests
This also:
- export `get_vessel_insights` and update NAMESPACE
- improve validation, error messages, and date parsing
- default API key to `gfw_auth()`
- refactor request body construction for Insights API
- update examples, fixtures, and tests to match new interface
- reformat JSON fixtures for consistency and clarity
…tion tests

This:
- add `print_request` flag to optionally print the HTTP request for debugging
- fix typo in missing API token error message
- expand unit tests to cover NULL, NA, empty string, and envvar-based key errors
- improve documentation and examples for the new debug option
…bble

This:
- improve documentation with detailed @description, @details, and @examples
- normalize Insights API response into a single-row tibble with list-columns
- update unit tests to assert tibble structure and exact response mapping
This:
- addresses and closes #162
- rename `get_vessel_insights()` to `gfw_vessel_insights()`
- update roxygen examples to use new function name
- regenerate `NAMESPACE` to export `gfw_vessel_insights` instead of `get_vessel_insights`
- update all testthat references and expectations to use `gfw_vessel_insights`
…st coverage

This:
- expand insight types to include `"VESSEL-IDENTITY-FLAG-CHANGES"` and `"VESSEL-IDENTITY-MOU-LIST"`
- update `gfw_vessel_insights()` documentation to reflect additional insight types
- add examples demonstrating retrieval of flag change insights and Tokyo/Paris MOU list insights
- update JSON test fixtures to include flag change history and MOU list presence
- extend unit tests structural assertions for period, gap, coverage, fishing, and vessel identity
…dpoints

This:
- add `@details` sections linking to official Global Fishing Watch API documentation
- include data caveat references for 4Wings, Events, Regions, and Vessels APIs
This:
- expand `README.Rmd` notes to include links to Datasets, Data Caveats, and Terms of Use
- add contextual documentation references for `Vessels`, `Events`, `4Wings`, and `Regions` sections
This:
- add standardized `"Note"` sections linking to `Datasets`, `Data Caveats`, and `Terms of Use`
- include data caveat references across `fishing activity`, `vessel presence`, `identity`, and `SAR` vignettes
This:
- add JSON fixtures for bulk report create request and API response payloads
- add validation tests for required parameters (`name`, `dataset`, `format`, `filters`, etc.)
- verify error handling for missing, empty, and invalid input values
- add unit test validating bulk report creation workflow
This:
- add `gfw_get_bulk_report_by_id()` to retrieve bulk report metadata and status
- fix request body typo (`dateset` → `dataset`) in bulk report creation
- standardize internal section comments and docstrings
- add tests covering id validation, token validation, and successful API responses
…nd tests

This:
- use rlang string validation helpers
- switch to `httr2::req_auth_bearer_token()`
- simplify request body construction
- remove redundant response normalization
- hide internal docs with `@noRd`
- make tests less brittle to API changes
This:
- add `gfw_get_bulk_report_file_download_url()` to get signed download URLs for bulk report files
- support `DATA`, `README`, and `GEOM` bulk report file types with validation
- add JSON fixtures for signed file download URL API response payloads
- add unit test validating get bulk report signed file download URL workflow
This:
- add `gfw_get_all_bulk_reports()` to retrieve a list of metadata and status for bulk reports
- implement input validation for `limit`, `offset`, `sort`, and `status`
- add unit tests for parameter validation and API request/response workflows
- include JSON fixture for bulk report list request parameters
…tion

This:
- Switch to `httr2::req_auth_bearer_token()` and `rlang` validation helpers
- Use `tibble::as_tibble_row()` for cleaner single-object API responses
This:
- Update roxygen documentation to define tibble schemas for:
  - `gfw_create_bulk_report()`,
  - `gfw_get_bulk_report_by_id()`,
  - `gfw_get_bulk_report_file_download_url()`,
  - and `gfw_get_all_bulk_reports()`
…e mapping

This:
- Add roxygen `@examples` for:
  - `gfw_create_bulk_report()`,
  - `gfw_get_bulk_report_by_id()`,
  - `gfw_get_bulk_report_file_download_url()`,
  - and `gfw_get_all_bulk_reports()`
- Update response normalization to convert JSON `nulls` to `NA`
…reation

This:
- Add `region` parameter and ensure it is a list containing  valid `dataset` and `id` keys
- Add `geojson` parameter and ensure it is a sf/sfc/sfg, JSON strings, and named lists
- Set default parameters for `dataset` and `format`
- Add unit tests for `region` and `geojson` parameter validation
This:
- Implement `gfw_wait_for_bulk_report()` to handle asynchronous report generation
- Add roxygen2 documentation including return schemas and usage examples
- Add unit tests covering terminal statuses, polling iterations, and `max_runtime` expiration
This:
- Add `gfw_download_bulk_report_file()` to download bulk report artifacts (DATA, README, GEOM)
- Support configurable `data_dir` with fallback to `GFW_DATA_DIR` and `R_user_dir` cache
- Add roxygen2 documentation and usage examples
- Add `with_gfw_mocked_data_dir()` test helper
- Extend `with_gfw_mocked_envvar()` to include `GFW_DATA_DIR`
- Add unit tests for URL validation, and file download request/response workflows
- Add `DATA`, `README`, and `GEOM` fixtures for report file download validation
@lykmapipo lykmapipo self-assigned this Apr 21, 2026
@lykmapipo lykmapipo added documentation Improvements or additions to documentation enhancement New feature or request labels Apr 21, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

documentation Improvements or additions to documentation enhancement New feature or request

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants