pub struct GetRequest { /* private fields */ }
Expand description
Request a single resource by ID
Implementations§
Source§impl GetRequest
impl GetRequest
Sourcepub fn new(resource_type: &str, id: usize) -> Self
pub fn new(resource_type: &str, id: usize) -> Self
Constructs a GET request for <DataSource Path>/resource_type(id)
Must be DataSource::fetch
ed using a DataSource
to retrieve data.
Sourcepub fn format(self, format: Format) -> Self
pub fn format(self, format: Format) -> Self
Change format of the returned data.
Can be either Format::Json
or Format::Xml
Sourcepub fn expand<'f, F>(self, field: F) -> Selfwhere
F: IntoIterator<Item = &'f str>,
pub fn expand<'f, F>(self, field: F) -> Selfwhere
F: IntoIterator<Item = &'f str>,
Expand specific relations of the returned object, if possible.
For the Folketinget API for example, you can expand the DokumentAktør
field of a Dokument
, to simultaneously retrieve information about the document authors, instead of having to do two separate lookups for the DokumentAktør
relation and then the actual Aktør
.
Trait Implementations§
Source§impl Clone for GetRequest
impl Clone for GetRequest
Source§fn clone(&self) -> GetRequest
fn clone(&self) -> GetRequest
Returns a duplicate of the value. Read more
1.0.0 · Source§const fn clone_from(&mut self, source: &Self)
const fn clone_from(&mut self, source: &Self)
Performs copy-assignment from
source
. Read moreAuto Trait Implementations§
impl Freeze for GetRequest
impl RefUnwindSafe for GetRequest
impl Send for GetRequest
impl Sync for GetRequest
impl Unpin for GetRequest
impl UnwindSafe for GetRequest
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more