From cd8e09fcb6ee0a1b23c0bd57d0f097f99fd6d828 Mon Sep 17 00:00:00 2001 From: Bryan Newbold Date: Tue, 11 Sep 2018 13:59:32 -0700 Subject: refactor fatcat-api => fatcat-api-spec --- rust/fatcat-api/examples/server_lib/server.rs | 420 -------------------------- 1 file changed, 420 deletions(-) delete mode 100644 rust/fatcat-api/examples/server_lib/server.rs (limited to 'rust/fatcat-api/examples/server_lib/server.rs') diff --git a/rust/fatcat-api/examples/server_lib/server.rs b/rust/fatcat-api/examples/server_lib/server.rs deleted file mode 100644 index ab08f594..00000000 --- a/rust/fatcat-api/examples/server_lib/server.rs +++ /dev/null @@ -1,420 +0,0 @@ -//! Server implementation of fatcat. - -#![allow(unused_imports)] - -use chrono; -use futures::{self, Future}; - -use std::collections::HashMap; - -use swagger; - -use fatcat::models; -use fatcat::{ - AcceptEditgroupResponse, Api, ApiError, Context, CreateContainerBatchResponse, CreateContainerResponse, CreateCreatorBatchResponse, CreateCreatorResponse, CreateEditgroupResponse, - CreateFileBatchResponse, CreateFileResponse, CreateReleaseBatchResponse, CreateReleaseResponse, CreateWorkBatchResponse, CreateWorkResponse, DeleteContainerResponse, DeleteCreatorResponse, - DeleteFileResponse, DeleteReleaseResponse, DeleteWorkResponse, GetChangelogEntryResponse, GetChangelogResponse, GetContainerHistoryResponse, GetContainerResponse, GetCreatorHistoryResponse, - GetCreatorReleasesResponse, GetCreatorResponse, GetEditgroupResponse, GetEditorChangelogResponse, GetEditorResponse, GetFileHistoryResponse, GetFileResponse, GetReleaseFilesResponse, - GetReleaseHistoryResponse, GetReleaseResponse, GetStatsResponse, GetWorkHistoryResponse, GetWorkReleasesResponse, GetWorkResponse, LookupContainerResponse, LookupCreatorResponse, - LookupFileResponse, LookupReleaseResponse, UpdateContainerResponse, UpdateCreatorResponse, UpdateFileResponse, UpdateReleaseResponse, UpdateWorkResponse, -}; - -#[derive(Copy, Clone)] -pub struct Server; - -impl Api for Server { - fn accept_editgroup(&self, id: String, context: &Context) -> Box + Send> { - let context = context.clone(); - println!("accept_editgroup(\"{}\") - X-Span-ID: {:?}", id, context.x_span_id.unwrap_or(String::from("")).clone()); - Box::new(futures::failed("Generic failure".into())) - } - - fn create_container(&self, entity: models::ContainerEntity, context: &Context) -> Box + Send> { - let context = context.clone(); - println!("create_container({:?}) - X-Span-ID: {:?}", entity, context.x_span_id.unwrap_or(String::from("")).clone()); - Box::new(futures::failed("Generic failure".into())) - } - - fn create_container_batch( - &self, - entity_list: &Vec, - autoaccept: Option, - editgroup: Option, - context: &Context, - ) -> Box + Send> { - let context = context.clone(); - println!( - "create_container_batch({:?}, {:?}, {:?}) - X-Span-ID: {:?}", - entity_list, - autoaccept, - editgroup, - context.x_span_id.unwrap_or(String::from("")).clone() - ); - Box::new(futures::failed("Generic failure".into())) - } - - fn create_creator(&self, entity: models::CreatorEntity, context: &Context) -> Box + Send> { - let context = context.clone(); - println!("create_creator({:?}) - X-Span-ID: {:?}", entity, context.x_span_id.unwrap_or(String::from("")).clone()); - Box::new(futures::failed("Generic failure".into())) - } - - fn create_creator_batch( - &self, - entity_list: &Vec, - autoaccept: Option, - editgroup: Option, - context: &Context, - ) -> Box + Send> { - let context = context.clone(); - println!( - "create_creator_batch({:?}, {:?}, {:?}) - X-Span-ID: {:?}", - entity_list, - autoaccept, - editgroup, - context.x_span_id.unwrap_or(String::from("")).clone() - ); - Box::new(futures::failed("Generic failure".into())) - } - - fn create_editgroup(&self, entity: models::Editgroup, context: &Context) -> Box + Send> { - let context = context.clone(); - println!("create_editgroup({:?}) - X-Span-ID: {:?}", entity, context.x_span_id.unwrap_or(String::from("")).clone()); - Box::new(futures::failed("Generic failure".into())) - } - - fn create_file(&self, entity: models::FileEntity, context: &Context) -> Box + Send> { - let context = context.clone(); - println!("create_file({:?}) - X-Span-ID: {:?}", entity, context.x_span_id.unwrap_or(String::from("")).clone()); - Box::new(futures::failed("Generic failure".into())) - } - - fn create_file_batch( - &self, - entity_list: &Vec, - autoaccept: Option, - editgroup: Option, - context: &Context, - ) -> Box + Send> { - let context = context.clone(); - println!( - "create_file_batch({:?}, {:?}, {:?}) - X-Span-ID: {:?}", - entity_list, - autoaccept, - editgroup, - context.x_span_id.unwrap_or(String::from("")).clone() - ); - Box::new(futures::failed("Generic failure".into())) - } - - fn create_release(&self, entity: models::ReleaseEntity, context: &Context) -> Box + Send> { - let context = context.clone(); - println!("create_release({:?}) - X-Span-ID: {:?}", entity, context.x_span_id.unwrap_or(String::from("")).clone()); - Box::new(futures::failed("Generic failure".into())) - } - - fn create_release_batch( - &self, - entity_list: &Vec, - autoaccept: Option, - editgroup: Option, - context: &Context, - ) -> Box + Send> { - let context = context.clone(); - println!( - "create_release_batch({:?}, {:?}, {:?}) - X-Span-ID: {:?}", - entity_list, - autoaccept, - editgroup, - context.x_span_id.unwrap_or(String::from("")).clone() - ); - Box::new(futures::failed("Generic failure".into())) - } - - fn create_work(&self, entity: models::WorkEntity, context: &Context) -> Box + Send> { - let context = context.clone(); - println!("create_work({:?}) - X-Span-ID: {:?}", entity, context.x_span_id.unwrap_or(String::from("")).clone()); - Box::new(futures::failed("Generic failure".into())) - } - - fn create_work_batch( - &self, - entity_list: &Vec, - autoaccept: Option, - editgroup: Option, - context: &Context, - ) -> Box + Send> { - let context = context.clone(); - println!( - "create_work_batch({:?}, {:?}, {:?}) - X-Span-ID: {:?}", - entity_list, - autoaccept, - editgroup, - context.x_span_id.unwrap_or(String::from("")).clone() - ); - Box::new(futures::failed("Generic failure".into())) - } - - fn delete_container(&self, id: String, editgroup: Option, context: &Context) -> Box + Send> { - let context = context.clone(); - println!( - "delete_container(\"{}\", {:?}) - X-Span-ID: {:?}", - id, - editgroup, - context.x_span_id.unwrap_or(String::from("")).clone() - ); - Box::new(futures::failed("Generic failure".into())) - } - - fn delete_creator(&self, id: String, editgroup: Option, context: &Context) -> Box + Send> { - let context = context.clone(); - println!( - "delete_creator(\"{}\", {:?}) - X-Span-ID: {:?}", - id, - editgroup, - context.x_span_id.unwrap_or(String::from("")).clone() - ); - Box::new(futures::failed("Generic failure".into())) - } - - fn delete_file(&self, id: String, editgroup: Option, context: &Context) -> Box + Send> { - let context = context.clone(); - println!( - "delete_file(\"{}\", {:?}) - X-Span-ID: {:?}", - id, - editgroup, - context.x_span_id.unwrap_or(String::from("")).clone() - ); - Box::new(futures::failed("Generic failure".into())) - } - - fn delete_release(&self, id: String, editgroup: Option, context: &Context) -> Box + Send> { - let context = context.clone(); - println!( - "delete_release(\"{}\", {:?}) - X-Span-ID: {:?}", - id, - editgroup, - context.x_span_id.unwrap_or(String::from("")).clone() - ); - Box::new(futures::failed("Generic failure".into())) - } - - fn delete_work(&self, id: String, editgroup: Option, context: &Context) -> Box + Send> { - let context = context.clone(); - println!( - "delete_work(\"{}\", {:?}) - X-Span-ID: {:?}", - id, - editgroup, - context.x_span_id.unwrap_or(String::from("")).clone() - ); - Box::new(futures::failed("Generic failure".into())) - } - - fn get_changelog(&self, limit: Option, context: &Context) -> Box + Send> { - let context = context.clone(); - println!("get_changelog({:?}) - X-Span-ID: {:?}", limit, context.x_span_id.unwrap_or(String::from("")).clone()); - Box::new(futures::failed("Generic failure".into())) - } - - fn get_changelog_entry(&self, id: i64, context: &Context) -> Box + Send> { - let context = context.clone(); - println!("get_changelog_entry({}) - X-Span-ID: {:?}", id, context.x_span_id.unwrap_or(String::from("")).clone()); - Box::new(futures::failed("Generic failure".into())) - } - - fn get_container(&self, id: String, expand: Option, context: &Context) -> Box + Send> { - let context = context.clone(); - println!("get_container(\"{}\", {:?}) - X-Span-ID: {:?}", id, expand, context.x_span_id.unwrap_or(String::from("")).clone()); - Box::new(futures::failed("Generic failure".into())) - } - - fn get_container_history(&self, id: String, limit: Option, context: &Context) -> Box + Send> { - let context = context.clone(); - println!( - "get_container_history(\"{}\", {:?}) - X-Span-ID: {:?}", - id, - limit, - context.x_span_id.unwrap_or(String::from("")).clone() - ); - Box::new(futures::failed("Generic failure".into())) - } - - fn get_creator(&self, id: String, expand: Option, context: &Context) -> Box + Send> { - let context = context.clone(); - println!("get_creator(\"{}\", {:?}) - X-Span-ID: {:?}", id, expand, context.x_span_id.unwrap_or(String::from("")).clone()); - Box::new(futures::failed("Generic failure".into())) - } - - fn get_creator_history(&self, id: String, limit: Option, context: &Context) -> Box + Send> { - let context = context.clone(); - println!( - "get_creator_history(\"{}\", {:?}) - X-Span-ID: {:?}", - id, - limit, - context.x_span_id.unwrap_or(String::from("")).clone() - ); - Box::new(futures::failed("Generic failure".into())) - } - - fn get_creator_releases(&self, id: String, context: &Context) -> Box + Send> { - let context = context.clone(); - println!("get_creator_releases(\"{}\") - X-Span-ID: {:?}", id, context.x_span_id.unwrap_or(String::from("")).clone()); - Box::new(futures::failed("Generic failure".into())) - } - - fn get_editgroup(&self, id: String, context: &Context) -> Box + Send> { - let context = context.clone(); - println!("get_editgroup(\"{}\") - X-Span-ID: {:?}", id, context.x_span_id.unwrap_or(String::from("")).clone()); - Box::new(futures::failed("Generic failure".into())) - } - - fn get_editor(&self, id: String, context: &Context) -> Box + Send> { - let context = context.clone(); - println!("get_editor(\"{}\") - X-Span-ID: {:?}", id, context.x_span_id.unwrap_or(String::from("")).clone()); - Box::new(futures::failed("Generic failure".into())) - } - - fn get_editor_changelog(&self, id: String, context: &Context) -> Box + Send> { - let context = context.clone(); - println!("get_editor_changelog(\"{}\") - X-Span-ID: {:?}", id, context.x_span_id.unwrap_or(String::from("")).clone()); - Box::new(futures::failed("Generic failure".into())) - } - - fn get_file(&self, id: String, expand: Option, context: &Context) -> Box + Send> { - let context = context.clone(); - println!("get_file(\"{}\", {:?}) - X-Span-ID: {:?}", id, expand, context.x_span_id.unwrap_or(String::from("")).clone()); - Box::new(futures::failed("Generic failure".into())) - } - - fn get_file_history(&self, id: String, limit: Option, context: &Context) -> Box + Send> { - let context = context.clone(); - println!( - "get_file_history(\"{}\", {:?}) - X-Span-ID: {:?}", - id, - limit, - context.x_span_id.unwrap_or(String::from("")).clone() - ); - Box::new(futures::failed("Generic failure".into())) - } - - fn get_release(&self, id: String, expand: Option, context: &Context) -> Box + Send> { - let context = context.clone(); - println!("get_release(\"{}\", {:?}) - X-Span-ID: {:?}", id, expand, context.x_span_id.unwrap_or(String::from("")).clone()); - Box::new(futures::failed("Generic failure".into())) - } - - fn get_release_files(&self, id: String, context: &Context) -> Box + Send> { - let context = context.clone(); - println!("get_release_files(\"{}\") - X-Span-ID: {:?}", id, context.x_span_id.unwrap_or(String::from("")).clone()); - Box::new(futures::failed("Generic failure".into())) - } - - fn get_release_history(&self, id: String, limit: Option, context: &Context) -> Box + Send> { - let context = context.clone(); - println!( - "get_release_history(\"{}\", {:?}) - X-Span-ID: {:?}", - id, - limit, - context.x_span_id.unwrap_or(String::from("")).clone() - ); - Box::new(futures::failed("Generic failure".into())) - } - - fn get_stats(&self, more: Option, context: &Context) -> Box + Send> { - let context = context.clone(); - println!("get_stats({:?}) - X-Span-ID: {:?}", more, context.x_span_id.unwrap_or(String::from("")).clone()); - Box::new(futures::failed("Generic failure".into())) - } - - fn get_work(&self, id: String, expand: Option, context: &Context) -> Box + Send> { - let context = context.clone(); - println!("get_work(\"{}\", {:?}) - X-Span-ID: {:?}", id, expand, context.x_span_id.unwrap_or(String::from("")).clone()); - Box::new(futures::failed("Generic failure".into())) - } - - fn get_work_history(&self, id: String, limit: Option, context: &Context) -> Box + Send> { - let context = context.clone(); - println!( - "get_work_history(\"{}\", {:?}) - X-Span-ID: {:?}", - id, - limit, - context.x_span_id.unwrap_or(String::from("")).clone() - ); - Box::new(futures::failed("Generic failure".into())) - } - - fn get_work_releases(&self, id: String, context: &Context) -> Box + Send> { - let context = context.clone(); - println!("get_work_releases(\"{}\") - X-Span-ID: {:?}", id, context.x_span_id.unwrap_or(String::from("")).clone()); - Box::new(futures::failed("Generic failure".into())) - } - - fn lookup_container(&self, issnl: String, context: &Context) -> Box + Send> { - let context = context.clone(); - println!("lookup_container(\"{}\") - X-Span-ID: {:?}", issnl, context.x_span_id.unwrap_or(String::from("")).clone()); - Box::new(futures::failed("Generic failure".into())) - } - - fn lookup_creator(&self, orcid: String, context: &Context) -> Box + Send> { - let context = context.clone(); - println!("lookup_creator(\"{}\") - X-Span-ID: {:?}", orcid, context.x_span_id.unwrap_or(String::from("")).clone()); - Box::new(futures::failed("Generic failure".into())) - } - - fn lookup_file(&self, sha1: String, context: &Context) -> Box + Send> { - let context = context.clone(); - println!("lookup_file(\"{}\") - X-Span-ID: {:?}", sha1, context.x_span_id.unwrap_or(String::from("")).clone()); - Box::new(futures::failed("Generic failure".into())) - } - - fn lookup_release(&self, doi: String, context: &Context) -> Box + Send> { - let context = context.clone(); - println!("lookup_release(\"{}\") - X-Span-ID: {:?}", doi, context.x_span_id.unwrap_or(String::from("")).clone()); - Box::new(futures::failed("Generic failure".into())) - } - - fn update_container(&self, id: String, entity: models::ContainerEntity, context: &Context) -> Box + Send> { - let context = context.clone(); - println!( - "update_container(\"{}\", {:?}) - X-Span-ID: {:?}", - id, - entity, - context.x_span_id.unwrap_or(String::from("")).clone() - ); - Box::new(futures::failed("Generic failure".into())) - } - - fn update_creator(&self, id: String, entity: models::CreatorEntity, context: &Context) -> Box + Send> { - let context = context.clone(); - println!( - "update_creator(\"{}\", {:?}) - X-Span-ID: {:?}", - id, - entity, - context.x_span_id.unwrap_or(String::from("")).clone() - ); - Box::new(futures::failed("Generic failure".into())) - } - - fn update_file(&self, id: String, entity: models::FileEntity, context: &Context) -> Box + Send> { - let context = context.clone(); - println!("update_file(\"{}\", {:?}) - X-Span-ID: {:?}", id, entity, context.x_span_id.unwrap_or(String::from("")).clone()); - Box::new(futures::failed("Generic failure".into())) - } - - fn update_release(&self, id: String, entity: models::ReleaseEntity, context: &Context) -> Box + Send> { - let context = context.clone(); - println!( - "update_release(\"{}\", {:?}) - X-Span-ID: {:?}", - id, - entity, - context.x_span_id.unwrap_or(String::from("")).clone() - ); - Box::new(futures::failed("Generic failure".into())) - } - - fn update_work(&self, id: String, entity: models::WorkEntity, context: &Context) -> Box + Send> { - let context = context.clone(); - println!("update_work(\"{}\", {:?}) - X-Span-ID: {:?}", id, entity, context.x_span_id.unwrap_or(String::from("")).clone()); - Box::new(futures::failed("Generic failure".into())) - } -} -- cgit v1.2.3