diff options
Diffstat (limited to 'src/internal.h')
| -rw-r--r-- | src/internal.h | 15 |
1 files changed, 15 insertions, 0 deletions
diff --git a/src/internal.h b/src/internal.h index 57487c2..700b1ee 100644 --- a/src/internal.h +++ b/src/internal.h @@ -71,4 +71,19 @@ cepis_address_t *cepis_address_from_csv(const csv_row_t *header, /** @brief Build a health report from a parsed JSON object. */ cepis_health_t *cepis_health_from_json(const json_value_t *object); +/** + * @brief Read the `faixa` block of a 404 body into @p out. + * @param object The decoded body, which may be `NULL`. + * @param out Filled and returning `true`, or untouched and returning + * `false`. + * @return `true` only when the block is present, is an object and names a + * municipality. + * + * Deliberately total: a body that is not JSON, a `faixa` that is null, a + * string, an array or an object without `localidade` all mean "the API named + * no municipality". A 404 is already the answer, and failing to read the + * garnish must never turn it into a different one. + */ +bool cepis_faixa_from_json(const json_value_t *object, cepis_faixa_t *out); + #endif |