pub struct TokensReceiver<'a>(/* private fields */);Available on crate feature
client only.Expand description
Pushes Tokens to a CPO.
Spec: 2.3.0 §mod_tokens_cpo_interface
Implementations§
Source§impl<'a> TokensReceiver<'a>
impl<'a> TokensReceiver<'a>
Sourcepub const fn new(client: ModuleClient<'a>) -> Self
pub const fn new(client: ModuleClient<'a>) -> Self
Wraps a module client.
Sourcepub async fn token(
&self,
owner: &PartyRef,
token_uid: &str,
token_type: Option<TokenType>,
) -> Result<Token, OcpiError>
pub async fn token( &self, owner: &PartyRef, token_uid: &str, token_type: Option<TokenType>, ) -> Result<Token, OcpiError>
GET {tokens}/{country_code}/{party_id}/{token_uid}[?type=].
§Errors
Propagates transport and OCPI-level errors.
Sourcepub async fn put_token(
&self,
owner: &PartyRef,
token: &Token,
) -> Result<(), OcpiError>
pub async fn put_token( &self, owner: &PartyRef, token: &Token, ) -> Result<(), OcpiError>
PUT {tokens}/{country_code}/{party_id}/{token_uid}[?type=].
The type is taken from the Token itself, which is where the peer will look for it too.
§Errors
Propagates validation, transport and OCPI-level errors.
Sourcepub async fn patch<T>(
&self,
owner: &PartyRef,
token_uid: &str,
token_type: Option<TokenType>,
patch: &Patch<T>,
) -> Result<(), OcpiError>
pub async fn patch<T>( &self, owner: &PartyRef, token_uid: &str, token_type: Option<TokenType>, patch: &Patch<T>, ) -> Result<(), OcpiError>
PATCH {tokens}/{country_code}/{party_id}/{token_uid}[?type=].
§Errors
Propagates transport and OCPI-level errors, and refuses a patch without last_updated.
Trait Implementations§
Source§impl<'a> Clone for TokensReceiver<'a>
impl<'a> Clone for TokensReceiver<'a>
Source§fn clone(&self) -> TokensReceiver<'a>
fn clone(&self) -> TokensReceiver<'a>
Returns a duplicate of the value. Read more
1.0.0 (const: unstable) · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
Performs copy-assignment from
source. Read moreAuto Trait Implementations§
impl<'a> !RefUnwindSafe for TokensReceiver<'a>
impl<'a> !UnwindSafe for TokensReceiver<'a>
impl<'a> Freeze for TokensReceiver<'a>
impl<'a> Send for TokensReceiver<'a>
impl<'a> Sync for TokensReceiver<'a>
impl<'a> Unpin for TokensReceiver<'a>
impl<'a> UnsafeUnpin for TokensReceiver<'a>
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