//! Server implementation of timezynk_bridge_models. #![allow(unused_imports)] use futures::{self, Future}; use chrono; use std::collections::HashMap; use std::marker::PhantomData; use swagger; use swagger::{Has, XSpanIdString}; use timezynk_bridge_models::{Api, ApiError, DataSinksGetResponse, DataSinksPostResponse, DataSourcesGetResponse, DataSourcesPostResponse, EntitiesEntityIdChangesGetResponse, EntitiesEntityIdChangesPostResponse, EntitiesEntityIdNextSyncGetResponse, EntitiesEntityIdNextSyncPutResponse, EntitiesEntityIdPutResponse, EntitiesGetResponse, DataSourcesDataSourceIdSynchronizationStateGetResponse }; use timezynk_bridge_models::models; #[derive(Copy, Clone)] pub struct Server { marker: PhantomData, } impl Server { pub fn new() -> Self { Server{marker: PhantomData} } } impl Api for Server where C: Has{ /// List registered datasources fn data_sinks_get(&self, context: &C) -> Box> { let context = context.clone(); println!("data_sinks_get() - X-Span-ID: {:?}", context.get().0.clone()); Box::new(futures::failed("Generic failure".into())) } /// Register a data source fn data_sinks_post(&self, data_sink: Option, context: &C) -> Box> { let context = context.clone(); println!("data_sinks_post({:?}) - X-Span-ID: {:?}", data_sink, context.get().0.clone()); Box::new(futures::failed("Generic failure".into())) } /// List registered datasources fn data_sources_get(&self, context: &C) -> Box> { let context = context.clone(); println!("data_sources_get() - X-Span-ID: {:?}", context.get().0.clone()); Box::new(futures::failed("Generic failure".into())) } /// Register a data source fn data_sources_post(&self, data_source: Option, context: &C) -> Box> { let context = context.clone(); println!("data_sources_post({:?}) - X-Span-ID: {:?}", data_source, context.get().0.clone()); Box::new(futures::failed("Generic failure".into())) } /// Sync changes from data source fn entities_entity_id_changes_get(&self, entity_id: String, context: &C) -> Box> { let context = context.clone(); println!("entities_entity_id_changes_get(\"{}\") - X-Span-ID: {:?}", entity_id, context.get().0.clone()); Box::new(futures::failed("Generic failure".into())) } /// Sync changes from data source fn entities_entity_id_changes_post(&self, entity_id: String, data_source: Option<&Vec>, context: &C) -> Box> { let context = context.clone(); println!("entities_entity_id_changes_post(\"{}\", {:?}) - X-Span-ID: {:?}", entity_id, data_source, context.get().0.clone()); Box::new(futures::failed("Generic failure".into())) } /// Next sync fn entities_entity_id_next_sync_get(&self, entity_id: String, context: &C) -> Box> { let context = context.clone(); println!("entities_entity_id_next_sync_get(\"{}\") - X-Span-ID: {:?}", entity_id, context.get().0.clone()); Box::new(futures::failed("Generic failure".into())) } /// Next sync fn entities_entity_id_next_sync_put(&self, entity_id: String, body: Option, context: &C) -> Box> { let context = context.clone(); println!("entities_entity_id_next_sync_put(\"{}\", {:?}) - X-Span-ID: {:?}", entity_id, body, context.get().0.clone()); Box::new(futures::failed("Generic failure".into())) } /// Update entity fn entities_entity_id_put(&self, entity_id: String, context: &C) -> Box> { let context = context.clone(); println!("entities_entity_id_put(\"{}\") - X-Span-ID: {:?}", entity_id, context.get().0.clone()); Box::new(futures::failed("Generic failure".into())) } /// List entities fn entities_get(&self, context: &C) -> Box> { let context = context.clone(); println!("entities_get() - X-Span-ID: {:?}", context.get().0.clone()); Box::new(futures::failed("Generic failure".into())) } /// Lists synchronization status for your data sources fn data_sources_data_source_id_synchronization_state_get(&self, data_source_id: String, context: &C) -> Box> { let context = context.clone(); println!("data_sources_data_source_id_synchronization_state_get(\"{}\") - X-Span-ID: {:?}", data_source_id, context.get().0.clone()); Box::new(futures::failed("Generic failure".into())) } }