summaryrefslogtreecommitdiffstats
path: root/rust/fatcat-api-spec/examples/server_lib
diff options
context:
space:
mode:
authorBryan Newbold <bnewbold@robocracy.org>2018-12-13 19:36:25 +0800
committerBryan Newbold <bnewbold@robocracy.org>2018-12-13 19:36:25 +0800
commit061e66c4c41063e6b7321f1f421b5152e9e5a84d (patch)
tree8b6729d9144841c69aac0df1c4a5394d3d43e3b6 /rust/fatcat-api-spec/examples/server_lib
parentc6901d5f895889ad25dd2db9a41db11480899a1c (diff)
downloadfatcat-061e66c4c41063e6b7321f1f421b5152e9e5a84d.tar.gz
fatcat-061e66c4c41063e6b7321f1f421b5152e9e5a84d.zip
schema tweaks, and rust codegen
Diffstat (limited to 'rust/fatcat-api-spec/examples/server_lib')
-rw-r--r--rust/fatcat-api-spec/examples/server_lib/server.rs213
1 files changed, 200 insertions, 13 deletions
diff --git a/rust/fatcat-api-spec/examples/server_lib/server.rs b/rust/fatcat-api-spec/examples/server_lib/server.rs
index b11f26c3..7341e528 100644
--- a/rust/fatcat-api-spec/examples/server_lib/server.rs
+++ b/rust/fatcat-api-spec/examples/server_lib/server.rs
@@ -12,11 +12,14 @@ 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,
+ CreateFileBatchResponse, CreateFileResponse, CreateReleaseBatchResponse, CreateReleaseResponse, CreateWorkBatchResponse, CreateWorkResponse, DeleteContainerEditResponse, DeleteContainerResponse,
+ DeleteCreatorEditResponse, DeleteCreatorResponse, DeleteFileEditResponse, DeleteFileResponse, DeleteReleaseEditResponse, DeleteReleaseResponse, DeleteWorkEditResponse, DeleteWorkResponse,
+ GetChangelogEntryResponse, GetChangelogResponse, GetContainerEditResponse, GetContainerHistoryResponse, GetContainerRedirectsResponse, GetContainerResponse, GetContainerRevisionResponse,
+ GetCreatorEditResponse, GetCreatorHistoryResponse, GetCreatorRedirectsResponse, GetCreatorReleasesResponse, GetCreatorResponse, GetCreatorRevisionResponse, GetEditgroupResponse,
+ GetEditorChangelogResponse, GetEditorResponse, GetFileEditResponse, GetFileHistoryResponse, GetFileRedirectsResponse, GetFileResponse, GetFileRevisionResponse, GetReleaseEditResponse,
+ GetReleaseFilesResponse, GetReleaseHistoryResponse, GetReleaseRedirectsResponse, GetReleaseResponse, GetReleaseRevisionResponse, GetStatsResponse, GetWorkEditResponse, GetWorkHistoryResponse,
+ GetWorkRedirectsResponse, GetWorkReleasesResponse, GetWorkResponse, GetWorkRevisionResponse, LookupContainerResponse, LookupCreatorResponse, LookupFileResponse, LookupReleaseResponse,
+ UpdateContainerResponse, UpdateCreatorResponse, UpdateFileResponse, UpdateReleaseResponse, UpdateWorkResponse,
};
#[derive(Copy, Clone)]
@@ -63,6 +66,12 @@ impl Api for Server {
Box::new(futures::failed("Generic failure".into()))
}
+ fn delete_container_edit(&self, edit_id: i64, context: &Context) -> Box<Future<Item = DeleteContainerEditResponse, Error = ApiError> + Send> {
+ let context = context.clone();
+ println!("delete_container_edit({}) - X-Span-ID: {:?}", edit_id, context.x_span_id.unwrap_or(String::from("<none>")).clone());
+ Box::new(futures::failed("Generic failure".into()))
+ }
+
fn get_container(&self, id: String, expand: Option<String>, hide: Option<String>, context: &Context) -> Box<Future<Item = GetContainerResponse, Error = ApiError> + Send> {
let context = context.clone();
println!(
@@ -75,6 +84,12 @@ impl Api for Server {
Box::new(futures::failed("Generic failure".into()))
}
+ fn get_container_edit(&self, edit_id: i64, context: &Context) -> Box<Future<Item = GetContainerEditResponse, Error = ApiError> + Send> {
+ let context = context.clone();
+ println!("get_container_edit({}) - X-Span-ID: {:?}", edit_id, context.x_span_id.unwrap_or(String::from("<none>")).clone());
+ Box::new(futures::failed("Generic failure".into()))
+ }
+
fn get_container_history(&self, id: String, limit: Option<i64>, context: &Context) -> Box<Future<Item = GetContainerHistoryResponse, Error = ApiError> + Send> {
let context = context.clone();
println!(
@@ -86,11 +101,30 @@ impl Api for Server {
Box::new(futures::failed("Generic failure".into()))
}
- fn lookup_container(&self, issnl: String, hide: Option<String>, context: &Context) -> Box<Future<Item = LookupContainerResponse, Error = ApiError> + Send> {
+ fn get_container_redirects(&self, id: String, context: &Context) -> Box<Future<Item = GetContainerRedirectsResponse, Error = ApiError> + Send> {
+ let context = context.clone();
+ println!("get_container_redirects(\"{}\") - X-Span-ID: {:?}", id, context.x_span_id.unwrap_or(String::from("<none>")).clone());
+ Box::new(futures::failed("Generic failure".into()))
+ }
+
+ fn get_container_revision(&self, id: String, expand: Option<String>, hide: Option<String>, context: &Context) -> Box<Future<Item = GetContainerRevisionResponse, Error = ApiError> + Send> {
let context = context.clone();
println!(
- "lookup_container(\"{}\", {:?}) - X-Span-ID: {:?}",
+ "get_container_revision(\"{}\", {:?}, {:?}) - X-Span-ID: {:?}",
+ id,
+ expand,
+ hide,
+ context.x_span_id.unwrap_or(String::from("<none>")).clone()
+ );
+ Box::new(futures::failed("Generic failure".into()))
+ }
+
+ fn lookup_container(&self, issnl: Option<String>, wikidata_qid: Option<String>, hide: Option<String>, context: &Context) -> Box<Future<Item = LookupContainerResponse, Error = ApiError> + Send> {
+ let context = context.clone();
+ println!(
+ "lookup_container({:?}, {:?}, {:?}) - X-Span-ID: {:?}",
issnl,
+ wikidata_qid,
hide,
context.x_span_id.unwrap_or(String::from("<none>")).clone()
);
@@ -149,6 +183,12 @@ impl Api for Server {
Box::new(futures::failed("Generic failure".into()))
}
+ fn delete_creator_edit(&self, edit_id: i64, context: &Context) -> Box<Future<Item = DeleteCreatorEditResponse, Error = ApiError> + Send> {
+ let context = context.clone();
+ println!("delete_creator_edit({}) - X-Span-ID: {:?}", edit_id, context.x_span_id.unwrap_or(String::from("<none>")).clone());
+ Box::new(futures::failed("Generic failure".into()))
+ }
+
fn get_creator(&self, id: String, expand: Option<String>, hide: Option<String>, context: &Context) -> Box<Future<Item = GetCreatorResponse, Error = ApiError> + Send> {
let context = context.clone();
println!(
@@ -161,6 +201,12 @@ impl Api for Server {
Box::new(futures::failed("Generic failure".into()))
}
+ fn get_creator_edit(&self, edit_id: i64, context: &Context) -> Box<Future<Item = GetCreatorEditResponse, Error = ApiError> + Send> {
+ let context = context.clone();
+ println!("get_creator_edit({}) - X-Span-ID: {:?}", edit_id, context.x_span_id.unwrap_or(String::from("<none>")).clone());
+ Box::new(futures::failed("Generic failure".into()))
+ }
+
fn get_creator_history(&self, id: String, limit: Option<i64>, context: &Context) -> Box<Future<Item = GetCreatorHistoryResponse, Error = ApiError> + Send> {
let context = context.clone();
println!(
@@ -172,6 +218,12 @@ impl Api for Server {
Box::new(futures::failed("Generic failure".into()))
}
+ fn get_creator_redirects(&self, id: String, context: &Context) -> Box<Future<Item = GetCreatorRedirectsResponse, Error = ApiError> + Send> {
+ let context = context.clone();
+ println!("get_creator_redirects(\"{}\") - X-Span-ID: {:?}", id, context.x_span_id.unwrap_or(String::from("<none>")).clone());
+ Box::new(futures::failed("Generic failure".into()))
+ }
+
fn get_creator_releases(&self, id: String, hide: Option<String>, context: &Context) -> Box<Future<Item = GetCreatorReleasesResponse, Error = ApiError> + Send> {
let context = context.clone();
println!(
@@ -183,11 +235,24 @@ impl Api for Server {
Box::new(futures::failed("Generic failure".into()))
}
- fn lookup_creator(&self, orcid: String, hide: Option<String>, context: &Context) -> Box<Future<Item = LookupCreatorResponse, Error = ApiError> + Send> {
+ fn get_creator_revision(&self, id: String, expand: Option<String>, hide: Option<String>, context: &Context) -> Box<Future<Item = GetCreatorRevisionResponse, Error = ApiError> + Send> {
let context = context.clone();
println!(
- "lookup_creator(\"{}\", {:?}) - X-Span-ID: {:?}",
+ "get_creator_revision(\"{}\", {:?}, {:?}) - X-Span-ID: {:?}",
+ id,
+ expand,
+ hide,
+ context.x_span_id.unwrap_or(String::from("<none>")).clone()
+ );
+ Box::new(futures::failed("Generic failure".into()))
+ }
+
+ fn lookup_creator(&self, orcid: Option<String>, wikidata_qid: Option<String>, hide: Option<String>, context: &Context) -> Box<Future<Item = LookupCreatorResponse, Error = ApiError> + Send> {
+ let context = context.clone();
+ println!(
+ "lookup_creator({:?}, {:?}, {:?}) - X-Span-ID: {:?}",
orcid,
+ wikidata_qid,
hide,
context.x_span_id.unwrap_or(String::from("<none>")).clone()
);
@@ -294,6 +359,12 @@ impl Api for Server {
Box::new(futures::failed("Generic failure".into()))
}
+ fn delete_file_edit(&self, edit_id: i64, context: &Context) -> Box<Future<Item = DeleteFileEditResponse, Error = ApiError> + Send> {
+ let context = context.clone();
+ println!("delete_file_edit({}) - X-Span-ID: {:?}", edit_id, context.x_span_id.unwrap_or(String::from("<none>")).clone());
+ Box::new(futures::failed("Generic failure".into()))
+ }
+
fn get_file(&self, id: String, expand: Option<String>, hide: Option<String>, context: &Context) -> Box<Future<Item = GetFileResponse, Error = ApiError> + Send> {
let context = context.clone();
println!(
@@ -306,6 +377,12 @@ impl Api for Server {
Box::new(futures::failed("Generic failure".into()))
}
+ fn get_file_edit(&self, edit_id: i64, context: &Context) -> Box<Future<Item = GetFileEditResponse, Error = ApiError> + Send> {
+ let context = context.clone();
+ println!("get_file_edit({}) - X-Span-ID: {:?}", edit_id, context.x_span_id.unwrap_or(String::from("<none>")).clone());
+ Box::new(futures::failed("Generic failure".into()))
+ }
+
fn get_file_history(&self, id: String, limit: Option<i64>, context: &Context) -> Box<Future<Item = GetFileHistoryResponse, Error = ApiError> + Send> {
let context = context.clone();
println!(
@@ -317,9 +394,41 @@ impl Api for Server {
Box::new(futures::failed("Generic failure".into()))
}
- fn lookup_file(&self, sha1: String, hide: Option<String>, context: &Context) -> Box<Future<Item = LookupFileResponse, Error = ApiError> + Send> {
+ fn get_file_redirects(&self, id: String, context: &Context) -> Box<Future<Item = GetFileRedirectsResponse, Error = ApiError> + Send> {
+ let context = context.clone();
+ println!("get_file_redirects(\"{}\") - X-Span-ID: {:?}", id, context.x_span_id.unwrap_or(String::from("<none>")).clone());
+ Box::new(futures::failed("Generic failure".into()))
+ }
+
+ fn get_file_revision(&self, id: String, expand: Option<String>, hide: Option<String>, context: &Context) -> Box<Future<Item = GetFileRevisionResponse, Error = ApiError> + Send> {
+ let context = context.clone();
+ println!(
+ "get_file_revision(\"{}\", {:?}, {:?}) - X-Span-ID: {:?}",
+ id,
+ expand,
+ hide,
+ context.x_span_id.unwrap_or(String::from("<none>")).clone()
+ );
+ Box::new(futures::failed("Generic failure".into()))
+ }
+
+ fn lookup_file(
+ &self,
+ md5: Option<String>,
+ sha1: Option<String>,
+ sha256: Option<String>,
+ hide: Option<String>,
+ context: &Context,
+ ) -> Box<Future<Item = LookupFileResponse, Error = ApiError> + Send> {
let context = context.clone();
- println!("lookup_file(\"{}\", {:?}) - X-Span-ID: {:?}", sha1, hide, context.x_span_id.unwrap_or(String::from("<none>")).clone());
+ println!(
+ "lookup_file({:?}, {:?}, {:?}, {:?}) - X-Span-ID: {:?}",
+ md5,
+ sha1,
+ sha256,
+ hide,
+ context.x_span_id.unwrap_or(String::from("<none>")).clone()
+ );
Box::new(futures::failed("Generic failure".into()))
}
@@ -386,6 +495,12 @@ impl Api for Server {
Box::new(futures::failed("Generic failure".into()))
}
+ fn delete_release_edit(&self, edit_id: i64, context: &Context) -> Box<Future<Item = DeleteReleaseEditResponse, Error = ApiError> + Send> {
+ let context = context.clone();
+ println!("delete_release_edit({}) - X-Span-ID: {:?}", edit_id, context.x_span_id.unwrap_or(String::from("<none>")).clone());
+ Box::new(futures::failed("Generic failure".into()))
+ }
+
fn get_release(&self, id: String, expand: Option<String>, hide: Option<String>, context: &Context) -> Box<Future<Item = GetReleaseResponse, Error = ApiError> + Send> {
let context = context.clone();
println!(
@@ -398,6 +513,12 @@ impl Api for Server {
Box::new(futures::failed("Generic failure".into()))
}
+ fn get_release_edit(&self, edit_id: i64, context: &Context) -> Box<Future<Item = GetReleaseEditResponse, Error = ApiError> + Send> {
+ let context = context.clone();
+ println!("get_release_edit({}) - X-Span-ID: {:?}", edit_id, context.x_span_id.unwrap_or(String::from("<none>")).clone());
+ Box::new(futures::failed("Generic failure".into()))
+ }
+
fn get_release_files(&self, id: String, hide: Option<String>, context: &Context) -> Box<Future<Item = GetReleaseFilesResponse, Error = ApiError> + Send> {
let context = context.clone();
println!(
@@ -420,9 +541,45 @@ impl Api for Server {
Box::new(futures::failed("Generic failure".into()))
}
- fn lookup_release(&self, doi: String, hide: Option<String>, context: &Context) -> Box<Future<Item = LookupReleaseResponse, Error = ApiError> + Send> {
+ fn get_release_redirects(&self, id: String, context: &Context) -> Box<Future<Item = GetReleaseRedirectsResponse, Error = ApiError> + Send> {
let context = context.clone();
- println!("lookup_release(\"{}\", {:?}) - X-Span-ID: {:?}", doi, hide, context.x_span_id.unwrap_or(String::from("<none>")).clone());
+ println!("get_release_redirects(\"{}\") - X-Span-ID: {:?}", id, context.x_span_id.unwrap_or(String::from("<none>")).clone());
+ Box::new(futures::failed("Generic failure".into()))
+ }
+
+ fn get_release_revision(&self, id: String, expand: Option<String>, hide: Option<String>, context: &Context) -> Box<Future<Item = GetReleaseRevisionResponse, Error = ApiError> + Send> {
+ let context = context.clone();
+ println!(
+ "get_release_revision(\"{}\", {:?}, {:?}) - X-Span-ID: {:?}",
+ id,
+ expand,
+ hide,
+ context.x_span_id.unwrap_or(String::from("<none>")).clone()
+ );
+ Box::new(futures::failed("Generic failure".into()))
+ }
+
+ fn lookup_release(
+ &self,
+ doi: Option<String>,
+ wikidata_qid: Option<String>,
+ isbn13: Option<String>,
+ pmid: Option<String>,
+ pmcid: Option<String>,
+ hide: Option<String>,
+ context: &Context,
+ ) -> Box<Future<Item = LookupReleaseResponse, Error = ApiError> + Send> {
+ let context = context.clone();
+ println!(
+ "lookup_release({:?}, {:?}, {:?}, {:?}, {:?}, {:?}) - X-Span-ID: {:?}",
+ doi,
+ wikidata_qid,
+ isbn13,
+ pmid,
+ pmcid,
+ hide,
+ context.x_span_id.unwrap_or(String::from("<none>")).clone()
+ );
Box::new(futures::failed("Generic failure".into()))
}
@@ -467,6 +624,12 @@ impl Api for Server {
Box::new(futures::failed("Generic failure".into()))
}
+ fn delete_work_edit(&self, edit_id: i64, context: &Context) -> Box<Future<Item = DeleteWorkEditResponse, Error = ApiError> + Send> {
+ let context = context.clone();
+ println!("delete_work_edit({}) - X-Span-ID: {:?}", edit_id, context.x_span_id.unwrap_or(String::from("<none>")).clone());
+ Box::new(futures::failed("Generic failure".into()))
+ }
+
fn get_work(&self, id: String, expand: Option<String>, hide: Option<String>, context: &Context) -> Box<Future<Item = GetWorkResponse, Error = ApiError> + Send> {
let context = context.clone();
println!(
@@ -479,6 +642,12 @@ impl Api for Server {
Box::new(futures::failed("Generic failure".into()))
}
+ fn get_work_edit(&self, edit_id: i64, context: &Context) -> Box<Future<Item = GetWorkEditResponse, Error = ApiError> + Send> {
+ let context = context.clone();
+ println!("get_work_edit({}) - X-Span-ID: {:?}", edit_id, context.x_span_id.unwrap_or(String::from("<none>")).clone());
+ Box::new(futures::failed("Generic failure".into()))
+ }
+
fn get_work_history(&self, id: String, limit: Option<i64>, context: &Context) -> Box<Future<Item = GetWorkHistoryResponse, Error = ApiError> + Send> {
let context = context.clone();
println!(
@@ -490,6 +659,12 @@ impl Api for Server {
Box::new(futures::failed("Generic failure".into()))
}
+ fn get_work_redirects(&self, id: String, context: &Context) -> Box<Future<Item = GetWorkRedirectsResponse, Error = ApiError> + Send> {
+ let context = context.clone();
+ println!("get_work_redirects(\"{}\") - X-Span-ID: {:?}", id, context.x_span_id.unwrap_or(String::from("<none>")).clone());
+ Box::new(futures::failed("Generic failure".into()))
+ }
+
fn get_work_releases(&self, id: String, hide: Option<String>, context: &Context) -> Box<Future<Item = GetWorkReleasesResponse, Error = ApiError> + Send> {
let context = context.clone();
println!(
@@ -501,6 +676,18 @@ impl Api for Server {
Box::new(futures::failed("Generic failure".into()))
}
+ fn get_work_revision(&self, id: String, expand: Option<String>, hide: Option<String>, context: &Context) -> Box<Future<Item = GetWorkRevisionResponse, Error = ApiError> + Send> {
+ let context = context.clone();
+ println!(
+ "get_work_revision(\"{}\", {:?}, {:?}) - X-Span-ID: {:?}",
+ id,
+ expand,
+ hide,
+ context.x_span_id.unwrap_or(String::from("<none>")).clone()
+ );
+ Box::new(futures::failed("Generic failure".into()))
+ }
+
fn update_work(&self, id: String, entity: models::WorkEntity, editgroup: Option<String>, context: &Context) -> Box<Future<Item = UpdateWorkResponse, Error = ApiError> + Send> {
let context = context.clone();
println!(