Struct odata_simple_client::DataSource[][src]

pub struct DataSource<C> { /* fields omitted */ }
Expand description

Represents a target OData API.

Implementations

Construct a new DataSource using a Client, Authority and a base_domain.

let datasource = DataSource::new(
    client,
    "oda.ft.dk",
    Some(String::from("/api"))
).unwrap();

Fetch a single resource using a GetRequest

#[derive(Deserialize)]
struct Dokument {
    titel: String,
}

let dokument: Dokument = datasource.fetch(
        GetRequest::new("Dokument", 24)
    ).await.unwrap();

assert_eq!(dokument.titel, "Grund- og nærhedsnotat vedr. sanktioner på toldområdet");

Fetch a Paged list of resources using a ListRequest

#[derive(Deserialize)]
struct Dokument {
    titel: String,
}

let page: Page<Dokument> = datasource
    .fetch_paged(ListRequest::new("Dokument")
        .inline_count(InlineCount::AllPages)
    ).await.unwrap();
assert!(page.count.unwrap().parse::<u32>().unwrap() > 0)

Auto Trait Implementations

Blanket Implementations

Gets the TypeId of self. Read more

Immutably borrows from an owned value. Read more

Mutably borrows from an owned value. Read more

Performs the conversion.

Instruments this type with the provided Span, returning an Instrumented wrapper. Read more

Instruments this type with the current Span, returning an Instrumented wrapper. Read more

Performs the conversion.

The type returned in the event of a conversion error.

Performs the conversion.

The type returned in the event of a conversion error.

Performs the conversion.

Attaches the provided Subscriber to this type, returning a WithDispatch wrapper. Read more

Attaches the current default Subscriber to this type, returning a WithDispatch wrapper. Read more