Crate reliefweb

Crate reliefweb 

Source
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.
HrefLink
Represents a URL link returned by the API.
Links
Represents pagination and related links for an API response.
QueryFilter
`Narrows down the content to be searched in. These correspond to the ‘refine’ section of the search bar.
QueryParams
Provides a builder-style API to chain filters, queries, sorting, and inclusion/exclusion of fields.
QueryQuery
Specifies a full-text filter for the query
ResourceEndpoint
Generic endpoint wrapper for any ReliefWeb resource.
SortDescriptor
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.
FilterOperator
Specifies how to interpret spaces in queries. Can be AND or OR. Default value is OR.
QueryPreset
A shorthand specification of sets of fields, filters and sort order for common use-cases. Similar to profile but with more opinions
QueryProfile
QueryProfile specifies which sets of fields to include in result.
SortDirection
Specifies the sorting direction of results for a given field.

Constants§

RELIEFWEB_DOMAIN
ReliefWeb API’s public instance base URL.