Skip to main content

TokensSender

Trait TokensSender 

Source
pub trait TokensSender:
    Send
    + Sync
    + 'static {
    // Required methods
    fn list(
        &self,
        query: PageQuery,
        context: RequestContext,
    ) -> impl Future<Output = Handled<Page<Token>>> + Send;
    fn authorize(
        &self,
        token_uid: String,
        token_type: Option<TokenType>,
        location: Option<LocationReferences>,
        context: RequestContext,
    ) -> impl Future<Output = Handled<AuthorizationInfo>> + Send;
}
Available on crate feature server only.
Expand description

The eMSP side of the Tokens module: serving Tokens and answering real-time authorizations.

Spec: 2.3.0 §mod_tokens_emsp_interface

Required Methods§

Source

fn list( &self, query: PageQuery, context: RequestContext, ) -> impl Future<Output = Handled<Page<Token>>> + Send

GET {tokens} — one page of Tokens.

Source

fn authorize( &self, token_uid: String, token_type: Option<TokenType>, location: Option<LocationReferences>, context: RequestContext, ) -> impl Future<Output = Handled<AuthorizationInfo>> + Send

POST {tokens}/{token_uid}/authorize[?type=] — a real-time authorization.

2004 Unknown Token is the code for a token this party does not know; return OcpiError::Remote with that code, or an AuthorizationInfo with AllowedType::NotAllowed when the token is known but may not charge here.

Dyn Compatibility§

This trait is not dyn compatible.

In older versions of Rust, dyn compatibility was called "object safety".

Implementors§

Source§

impl TokensSender for MockPeer

Available on crate feature testkit only.