From bcb9d2c6793b39b165caf9e63c4803d2a28e9876 Mon Sep 17 00:00:00 2001 From: Bryan Newbold Date: Sun, 27 May 2018 15:45:03 -0700 Subject: batch POST methods --- rust/fatcat-api/examples/server_lib/server.rs | 37 ++++++++++++++++++++++++--- 1 file changed, 34 insertions(+), 3 deletions(-) (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 index 4ea73046..7c27b09a 100644 --- a/rust/fatcat-api/examples/server_lib/server.rs +++ b/rust/fatcat-api/examples/server_lib/server.rs @@ -10,14 +10,21 @@ use std::collections::HashMap; use swagger; use fatcat::models; -use fatcat::{Api, ApiError, ContainerIdGetResponse, ContainerLookupGetResponse, ContainerPostResponse, Context, CreatorIdGetResponse, CreatorLookupGetResponse, CreatorPostResponse, - EditgroupIdAcceptPostResponse, EditgroupIdGetResponse, EditgroupPostResponse, EditorUsernameChangelogGetResponse, EditorUsernameGetResponse, FileIdGetResponse, FileLookupGetResponse, - FilePostResponse, ReleaseIdGetResponse, ReleaseLookupGetResponse, ReleasePostResponse, WorkIdGetResponse, WorkPostResponse}; +use fatcat::{Api, ApiError, ContainerBatchPostResponse, ContainerIdGetResponse, ContainerLookupGetResponse, ContainerPostResponse, Context, CreatorBatchPostResponse, CreatorIdGetResponse, + CreatorLookupGetResponse, CreatorPostResponse, EditgroupIdAcceptPostResponse, EditgroupIdGetResponse, EditgroupPostResponse, EditorUsernameChangelogGetResponse, + EditorUsernameGetResponse, FileBatchPostResponse, FileIdGetResponse, FileLookupGetResponse, FilePostResponse, ReleaseBatchPostResponse, ReleaseIdGetResponse, ReleaseLookupGetResponse, + ReleasePostResponse, WorkBatchPostResponse, WorkIdGetResponse, WorkPostResponse}; #[derive(Copy, Clone)] pub struct Server; impl Api for Server { + fn container_batch_post(&self, entity_list: &Vec, context: &Context) -> Box + Send> { + let context = context.clone(); + println!("container_batch_post({:?}) - X-Span-ID: {:?}", entity_list, context.x_span_id.unwrap_or(String::from("")).clone()); + Box::new(futures::failed("Generic failure".into())) + } + fn container_id_get(&self, id: String, context: &Context) -> Box + Send> { let context = context.clone(); println!("container_id_get(\"{}\") - X-Span-ID: {:?}", id, context.x_span_id.unwrap_or(String::from("")).clone()); @@ -36,6 +43,12 @@ impl Api for Server { Box::new(futures::failed("Generic failure".into())) } + fn creator_batch_post(&self, entity_list: &Vec, context: &Context) -> Box + Send> { + let context = context.clone(); + println!("creator_batch_post({:?}) - X-Span-ID: {:?}", entity_list, context.x_span_id.unwrap_or(String::from("")).clone()); + Box::new(futures::failed("Generic failure".into())) + } + fn creator_id_get(&self, id: String, context: &Context) -> Box + Send> { let context = context.clone(); println!("creator_id_get(\"{}\") - X-Span-ID: {:?}", id, context.x_span_id.unwrap_or(String::from("")).clone()); @@ -88,6 +101,12 @@ impl Api for Server { Box::new(futures::failed("Generic failure".into())) } + fn file_batch_post(&self, entity_list: &Vec, context: &Context) -> Box + Send> { + let context = context.clone(); + println!("file_batch_post({:?}) - X-Span-ID: {:?}", entity_list, context.x_span_id.unwrap_or(String::from("")).clone()); + Box::new(futures::failed("Generic failure".into())) + } + fn file_id_get(&self, id: String, context: &Context) -> Box + Send> { let context = context.clone(); println!("file_id_get(\"{}\") - X-Span-ID: {:?}", id, context.x_span_id.unwrap_or(String::from("")).clone()); @@ -106,6 +125,12 @@ impl Api for Server { Box::new(futures::failed("Generic failure".into())) } + fn release_batch_post(&self, entity_list: &Vec, context: &Context) -> Box + Send> { + let context = context.clone(); + println!("release_batch_post({:?}) - X-Span-ID: {:?}", entity_list, context.x_span_id.unwrap_or(String::from("")).clone()); + Box::new(futures::failed("Generic failure".into())) + } + fn release_id_get(&self, id: String, context: &Context) -> Box + Send> { let context = context.clone(); println!("release_id_get(\"{}\") - X-Span-ID: {:?}", id, context.x_span_id.unwrap_or(String::from("")).clone()); @@ -124,6 +149,12 @@ impl Api for Server { Box::new(futures::failed("Generic failure".into())) } + fn work_batch_post(&self, entity_list: &Vec, context: &Context) -> Box + Send> { + let context = context.clone(); + println!("work_batch_post({:?}) - X-Span-ID: {:?}", entity_list, context.x_span_id.unwrap_or(String::from("")).clone()); + Box::new(futures::failed("Generic failure".into())) + } + fn work_id_get(&self, id: String, context: &Context) -> Box + Send> { let context = context.clone(); println!("work_id_get(\"{}\") - X-Span-ID: {:?}", id, context.x_span_id.unwrap_or(String::from("")).clone()); -- cgit v1.2.3