Skip to main content

LocationsReceiver

Trait LocationsReceiver 

Source
pub trait LocationsReceiver:
    Send
    + Sync
    + 'static {
    // Required methods
    fn location(
        &self,
        owner: PartyRef,
        location_id: String,
        context: RequestContext,
    ) -> impl Future<Output = Handled<Location>> + Send;
    fn put_location(
        &self,
        owner: PartyRef,
        location: Location,
        context: RequestContext,
    ) -> impl Future<Output = Handled<Created>> + Send;
    fn put_evse(
        &self,
        owner: PartyRef,
        location_id: String,
        evse: Evse,
        context: RequestContext,
    ) -> impl Future<Output = Handled<Created>> + Send;
    fn put_connector(
        &self,
        owner: PartyRef,
        location_id: String,
        evse_uid: String,
        connector: Connector,
        context: RequestContext,
    ) -> impl Future<Output = Handled<Created>> + Send;
    fn patch(
        &self,
        owner: PartyRef,
        location_id: String,
        evse_uid: Option<String>,
        connector_id: Option<String>,
        patch: Patch<Value>,
        context: RequestContext,
    ) -> impl Future<Output = Handled<()>> + Send;
}
Available on crate feature server only.
Expand description

The eMSP side of the Locations module: receiving the Locations another party owns.

These are client-owned objects, so every method carries the owner from the URL. The router has already checked that the authenticated platform speaks for that party.

An EVSE is never deleted; a removed EVSE gets status REMOVED — so there is no delete method here, by design.

Spec: 2.3.0 §mod_locations_emsp_interface

Required Methods§

Source

fn location( &self, owner: PartyRef, location_id: String, context: RequestContext, ) -> impl Future<Output = Handled<Location>> + Send

GET {locations}/{cc}/{party}/{location_id} — what this party has stored.

Source

fn put_location( &self, owner: PartyRef, location: Location, context: RequestContext, ) -> impl Future<Output = Handled<Created>> + Send

PUT {locations}/{cc}/{party}/{location_id}.

Returns whether the object was newly created, which decides between HTTP 201 and 200:

HTTP 200 - Ok when the object already existed and has successfully been updated. HTTP 201 - Created when the object has been newly created in the server system.

Source

fn put_evse( &self, owner: PartyRef, location_id: String, evse: Evse, context: RequestContext, ) -> impl Future<Output = Handled<Created>> + Send

PUT {locations}/{cc}/{party}/{location_id}/{evse_uid}.

Source

fn put_connector( &self, owner: PartyRef, location_id: String, evse_uid: String, connector: Connector, context: RequestContext, ) -> impl Future<Output = Handled<Created>> + Send

PUT {locations}/{cc}/{party}/{location_id}/{evse_uid}/{connector_id}.

Source

fn patch( &self, owner: PartyRef, location_id: String, evse_uid: Option<String>, connector_id: Option<String>, patch: Patch<Value>, context: RequestContext, ) -> impl Future<Output = Handled<()>> + Send

PATCH on any of the three levels.

The patch is guaranteed to carry last_updated; the extractor refuses one that does not.

Dyn Compatibility§

This trait is not dyn compatible.

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

Implementors§

Source§

impl LocationsReceiver for MockPeer

Available on crate feature testkit only.