From a82cffed703665496913d9ca0155e888ec35716b Mon Sep 17 00:00:00 2001 From: Bryan Newbold Date: Sat, 30 Jun 2018 17:53:28 -0700 Subject: add remaining history endpoints --- rust/fatcat-api/examples/client.rs | 30 ++++++++++++++-- rust/fatcat-api/examples/server_lib/server.rs | 49 +++++++++++++++++++++++++-- 2 files changed, 74 insertions(+), 5 deletions(-) (limited to 'rust/fatcat-api/examples') diff --git a/rust/fatcat-api/examples/client.rs b/rust/fatcat-api/examples/client.rs index 93b2d21d..eecb0c58 100644 --- a/rust/fatcat-api/examples/client.rs +++ b/rust/fatcat-api/examples/client.rs @@ -13,9 +13,9 @@ use clap::{App, Arg}; #[allow(unused_imports)] use fatcat::{AcceptEditgroupResponse, ApiError, ApiNoContext, ContextWrapperExt, CreateContainerBatchResponse, CreateContainerResponse, CreateCreatorBatchResponse, CreateCreatorResponse, CreateEditgroupResponse, CreateFileBatchResponse, CreateFileResponse, CreateReleaseBatchResponse, CreateReleaseResponse, CreateWorkBatchResponse, CreateWorkResponse, - GetContainerHistoryResponse, GetContainerResponse, GetCreatorReleasesResponse, GetCreatorResponse, GetEditgroupResponse, GetEditorChangelogResponse, GetEditorResponse, GetFileResponse, - GetReleaseFilesResponse, GetReleaseResponse, GetStatsResponse, GetWorkReleasesResponse, GetWorkResponse, LookupContainerResponse, LookupCreatorResponse, LookupFileResponse, - LookupReleaseResponse}; + GetContainerHistoryResponse, GetContainerResponse, GetCreatorHistoryResponse, GetCreatorReleasesResponse, GetCreatorResponse, GetEditgroupResponse, GetEditorChangelogResponse, + GetEditorResponse, GetFileHistoryResponse, GetFileResponse, GetReleaseFilesResponse, GetReleaseHistoryResponse, GetReleaseResponse, GetStatsResponse, GetWorkHistoryResponse, + GetWorkReleasesResponse, GetWorkResponse, LookupContainerResponse, LookupCreatorResponse, LookupFileResponse, LookupReleaseResponse}; #[allow(unused_imports)] use futures::{future, stream, Future, Stream}; @@ -34,15 +34,19 @@ fn main() { "GetContainer", "GetContainerHistory", "GetCreator", + "GetCreatorHistory", "GetCreatorReleases", "GetEditgroup", "GetEditor", "GetEditorChangelog", "GetFile", + "GetFileHistory", "GetRelease", "GetReleaseFiles", + "GetReleaseHistory", "GetStats", "GetWork", + "GetWorkHistory", "GetWorkReleases", "LookupContainer", "LookupCreator", @@ -152,6 +156,11 @@ fn main() { println!("{:?} (X-Span-ID: {:?})", result, client.context().x_span_id.clone().unwrap_or(String::from(""))); } + Some("GetCreatorHistory") => { + let result = client.get_creator_history("id_example".to_string(), Some(789)).wait(); + println!("{:?} (X-Span-ID: {:?})", result, client.context().x_span_id.clone().unwrap_or(String::from(""))); + } + Some("GetCreatorReleases") => { let result = client.get_creator_releases("id_example".to_string()).wait(); println!("{:?} (X-Span-ID: {:?})", result, client.context().x_span_id.clone().unwrap_or(String::from(""))); @@ -177,6 +186,11 @@ fn main() { println!("{:?} (X-Span-ID: {:?})", result, client.context().x_span_id.clone().unwrap_or(String::from(""))); } + Some("GetFileHistory") => { + let result = client.get_file_history("id_example".to_string(), Some(789)).wait(); + println!("{:?} (X-Span-ID: {:?})", result, client.context().x_span_id.clone().unwrap_or(String::from(""))); + } + Some("GetRelease") => { let result = client.get_release("id_example".to_string()).wait(); println!("{:?} (X-Span-ID: {:?})", result, client.context().x_span_id.clone().unwrap_or(String::from(""))); @@ -187,6 +201,11 @@ fn main() { println!("{:?} (X-Span-ID: {:?})", result, client.context().x_span_id.clone().unwrap_or(String::from(""))); } + Some("GetReleaseHistory") => { + let result = client.get_release_history("id_example".to_string(), Some(789)).wait(); + println!("{:?} (X-Span-ID: {:?})", result, client.context().x_span_id.clone().unwrap_or(String::from(""))); + } + Some("GetStats") => { let result = client.get_stats(Some("more_example".to_string())).wait(); println!("{:?} (X-Span-ID: {:?})", result, client.context().x_span_id.clone().unwrap_or(String::from(""))); @@ -197,6 +216,11 @@ fn main() { println!("{:?} (X-Span-ID: {:?})", result, client.context().x_span_id.clone().unwrap_or(String::from(""))); } + Some("GetWorkHistory") => { + let result = client.get_work_history("id_example".to_string(), Some(789)).wait(); + println!("{:?} (X-Span-ID: {:?})", result, client.context().x_span_id.clone().unwrap_or(String::from(""))); + } + Some("GetWorkReleases") => { let result = client.get_work_releases("id_example".to_string()).wait(); println!("{:?} (X-Span-ID: {:?})", result, client.context().x_span_id.clone().unwrap_or(String::from(""))); diff --git a/rust/fatcat-api/examples/server_lib/server.rs b/rust/fatcat-api/examples/server_lib/server.rs index 0155782b..062fca02 100644 --- a/rust/fatcat-api/examples/server_lib/server.rs +++ b/rust/fatcat-api/examples/server_lib/server.rs @@ -12,8 +12,9 @@ use swagger; use fatcat::models; use fatcat::{AcceptEditgroupResponse, Api, ApiError, Context, CreateContainerBatchResponse, CreateContainerResponse, CreateCreatorBatchResponse, CreateCreatorResponse, CreateEditgroupResponse, CreateFileBatchResponse, CreateFileResponse, CreateReleaseBatchResponse, CreateReleaseResponse, CreateWorkBatchResponse, CreateWorkResponse, GetContainerHistoryResponse, - GetContainerResponse, GetCreatorReleasesResponse, GetCreatorResponse, GetEditgroupResponse, GetEditorChangelogResponse, GetEditorResponse, GetFileResponse, GetReleaseFilesResponse, - GetReleaseResponse, GetStatsResponse, GetWorkReleasesResponse, GetWorkResponse, LookupContainerResponse, LookupCreatorResponse, LookupFileResponse, LookupReleaseResponse}; + GetContainerResponse, GetCreatorHistoryResponse, GetCreatorReleasesResponse, GetCreatorResponse, GetEditgroupResponse, GetEditorChangelogResponse, GetEditorResponse, + GetFileHistoryResponse, GetFileResponse, GetReleaseFilesResponse, GetReleaseHistoryResponse, GetReleaseResponse, GetStatsResponse, GetWorkHistoryResponse, GetWorkReleasesResponse, + GetWorkResponse, LookupContainerResponse, LookupCreatorResponse, LookupFileResponse, LookupReleaseResponse}; #[derive(Copy, Clone)] pub struct Server; @@ -118,6 +119,17 @@ impl Api for Server { 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()); @@ -148,6 +160,17 @@ impl Api for Server { 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, context: &Context) -> Box + Send> { let context = context.clone(); println!("get_release(\"{}\") - X-Span-ID: {:?}", id, context.x_span_id.unwrap_or(String::from("")).clone()); @@ -160,6 +183,17 @@ impl Api for Server { 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()); @@ -172,6 +206,17 @@ impl Api for Server { 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()); -- cgit v1.2.3