Expand description
§ReliefWeb Rust Client
This crate provides an unofficial strongly-typed Rust client for OCHA’s ReliefWeb API.
It supports listing and getting various resources (reports, disasters, countries, jobs, etc.) with typed queries, filtering, field selection, and more.
§Example
use reliefweb::{APIVersion, Client, QueryParams, RELIEFWEB_DOMAIN};
#[tokio::main]
async fn main() {
let client = Client::new(RELIEFWEB_DOMAIN, "my_descriptive_app_name", APIVersion::V2).unwrap();
let reports = client.reports()
.list(Some(&QueryParams::new().limit(5)))
.await
.unwrap();
println!("Got {} reports", reports.data.len());
}Modules§
- blog
- Blog Endpoint Fields
- book
- Book Endpoint Fields
- common
- Shared Endpoint Fields
- country
- Country Endpoint Fields
- disaster
- Disaster Endpoint Fields
- job
- Job Endpoint Fields
- report
- Report Endpoint Fields
- source
- Source Endpoint Fields
- training
- Training Endpoint Fields
Structs§
- ApiItem
- Represents an individual item in the API response.
- ApiResponse
- Represents a paginated API response from the ReliefWeb API.
- Client
- A client for interacting with the ReliefWeb API.
- Href
Link - Represents a URL link returned by the API.
- Links
- Represents pagination and related links for an API response.
- Query
Filter - `Narrows down the content to be searched in. These correspond to the ‘refine’ section of the search bar.
- Query
Params - Provides a builder-style API to chain filters, queries, sorting, and inclusion/exclusion of fields.
- Query
Query - Specifies a full-text filter for the query
- Resource
Endpoint - Generic endpoint wrapper for any ReliefWeb resource.
- Sort
Descriptor - Specifies how results should be sorted for a given field.
Enums§
- APIVersion
- The API specification version. V1 is deprecated and should no longer be used. The V2 version is fully compatible with the V1 version.
- Filter
Operator - Specifies how to interpret spaces in queries. Can be AND or OR. Default value is OR.
- Query
Preset - A shorthand specification of sets of fields, filters and sort order for common use-cases. Similar to
profilebut with more opinions - Query
Profile QueryProfilespecifies which sets of fields to include in result.- Sort
Direction - Specifies the sorting direction of results for a given field.
Constants§
- RELIEFWEB_
DOMAIN - ReliefWeb API’s public instance base URL.