aboutsummaryrefslogtreecommitdiffstats
path: root/rust/fatcat-openapi/examples/server_lib
diff options
context:
space:
mode:
authorBryan Newbold <bnewbold@robocracy.org>2019-09-13 11:27:09 -0700
committerBryan Newbold <bnewbold@robocracy.org>2019-09-13 11:32:05 -0700
commiteb6993c6cc40e532cb1462e44408ed30db5244c0 (patch)
tree3dce637443f1fdf602f8967b65b140456445f004 /rust/fatcat-openapi/examples/server_lib
parent601f3f6ac91546dd5e047c3e932a61c402305826 (diff)
downloadfatcat-eb6993c6cc40e532cb1462e44408ed30db5244c0.tar.gz
fatcat-eb6993c6cc40e532cb1462e44408ed30db5244c0.zip
rust codegen
This re-ordered a lot of code, because several endpoints had their tags changed, but should be no actual change in behavior/spec.
Diffstat (limited to 'rust/fatcat-openapi/examples/server_lib')
-rw-r--r--rust/fatcat-openapi/examples/server_lib/server.rs182
1 files changed, 91 insertions, 91 deletions
diff --git a/rust/fatcat-openapi/examples/server_lib/server.rs b/rust/fatcat-openapi/examples/server_lib/server.rs
index c9f92d33..e0f9045f 100644
--- a/rust/fatcat-openapi/examples/server_lib/server.rs
+++ b/rust/fatcat-openapi/examples/server_lib/server.rs
@@ -30,6 +30,30 @@ use fatcat::{
pub struct Server;
impl Api for Server {
+ fn auth_check(&self, role: Option<String>, context: &Context) -> Box<Future<Item = AuthCheckResponse, Error = ApiError> + Send> {
+ let context = context.clone();
+ println!("auth_check({:?}) - X-Span-ID: {:?}", role, context.x_span_id.unwrap_or(String::from("<none>")).clone());
+ Box::new(futures::failed("Generic failure".into()))
+ }
+
+ fn auth_oidc(&self, oidc_params: models::AuthOidc, context: &Context) -> Box<Future<Item = AuthOidcResponse, Error = ApiError> + Send> {
+ let context = context.clone();
+ println!("auth_oidc({:?}) - X-Span-ID: {:?}", oidc_params, context.x_span_id.unwrap_or(String::from("<none>")).clone());
+ Box::new(futures::failed("Generic failure".into()))
+ }
+
+ fn get_changelog(&self, limit: Option<i64>, context: &Context) -> Box<Future<Item = GetChangelogResponse, Error = ApiError> + Send> {
+ let context = context.clone();
+ println!("get_changelog({:?}) - X-Span-ID: {:?}", limit, context.x_span_id.unwrap_or(String::from("<none>")).clone());
+ Box::new(futures::failed("Generic failure".into()))
+ }
+
+ fn get_changelog_entry(&self, index: i64, context: &Context) -> Box<Future<Item = GetChangelogEntryResponse, Error = ApiError> + Send> {
+ let context = context.clone();
+ println!("get_changelog_entry({}) - X-Span-ID: {:?}", index, context.x_span_id.unwrap_or(String::from("<none>")).clone());
+ Box::new(futures::failed("Generic failure".into()))
+ }
+
fn create_container(&self, editgroup_id: String, entity: models::ContainerEntity, context: &Context) -> Box<Future<Item = CreateContainerResponse, Error = ApiError> + Send> {
let context = context.clone();
println!(
@@ -285,56 +309,63 @@ impl Api for Server {
Box::new(futures::failed("Generic failure".into()))
}
- fn auth_check(&self, role: Option<String>, context: &Context) -> Box<Future<Item = AuthCheckResponse, Error = ApiError> + Send> {
+ fn accept_editgroup(&self, editgroup_id: String, context: &Context) -> Box<Future<Item = AcceptEditgroupResponse, Error = ApiError> + Send> {
let context = context.clone();
- println!("auth_check({:?}) - X-Span-ID: {:?}", role, context.x_span_id.unwrap_or(String::from("<none>")).clone());
+ println!("accept_editgroup(\"{}\") - X-Span-ID: {:?}", editgroup_id, context.x_span_id.unwrap_or(String::from("<none>")).clone());
Box::new(futures::failed("Generic failure".into()))
}
- fn auth_oidc(&self, oidc_params: models::AuthOidc, context: &Context) -> Box<Future<Item = AuthOidcResponse, Error = ApiError> + Send> {
+ fn create_editgroup(&self, editgroup: models::Editgroup, context: &Context) -> Box<Future<Item = CreateEditgroupResponse, Error = ApiError> + Send> {
let context = context.clone();
- println!("auth_oidc({:?}) - X-Span-ID: {:?}", oidc_params, context.x_span_id.unwrap_or(String::from("<none>")).clone());
+ println!("create_editgroup({:?}) - X-Span-ID: {:?}", editgroup, context.x_span_id.unwrap_or(String::from("<none>")).clone());
Box::new(futures::failed("Generic failure".into()))
}
- fn get_editgroups_reviewable(
+ fn create_editgroup_annotation(
&self,
- expand: Option<String>,
- limit: Option<i64>,
- before: Option<chrono::DateTime<chrono::Utc>>,
- since: Option<chrono::DateTime<chrono::Utc>>,
+ editgroup_id: String,
+ annotation: models::EditgroupAnnotation,
context: &Context,
- ) -> Box<Future<Item = GetEditgroupsReviewableResponse, Error = ApiError> + Send> {
+ ) -> Box<Future<Item = CreateEditgroupAnnotationResponse, Error = ApiError> + Send> {
let context = context.clone();
println!(
- "get_editgroups_reviewable({:?}, {:?}, {:?}, {:?}) - X-Span-ID: {:?}",
- expand,
- limit,
- before,
- since,
+ "create_editgroup_annotation(\"{}\", {:?}) - X-Span-ID: {:?}",
+ editgroup_id,
+ annotation,
context.x_span_id.unwrap_or(String::from("<none>")).clone()
);
Box::new(futures::failed("Generic failure".into()))
}
- fn get_editor(&self, editor_id: String, context: &Context) -> Box<Future<Item = GetEditorResponse, Error = ApiError> + Send> {
+ fn get_editgroup(&self, editgroup_id: String, context: &Context) -> Box<Future<Item = GetEditgroupResponse, Error = ApiError> + Send> {
let context = context.clone();
- println!("get_editor(\"{}\") - X-Span-ID: {:?}", editor_id, context.x_span_id.unwrap_or(String::from("<none>")).clone());
+ println!("get_editgroup(\"{}\") - X-Span-ID: {:?}", editgroup_id, context.x_span_id.unwrap_or(String::from("<none>")).clone());
Box::new(futures::failed("Generic failure".into()))
}
- fn get_editor_editgroups(
+ fn get_editgroup_annotations(&self, editgroup_id: String, expand: Option<String>, context: &Context) -> Box<Future<Item = GetEditgroupAnnotationsResponse, Error = ApiError> + Send> {
+ let context = context.clone();
+ println!(
+ "get_editgroup_annotations(\"{}\", {:?}) - X-Span-ID: {:?}",
+ editgroup_id,
+ expand,
+ context.x_span_id.unwrap_or(String::from("<none>")).clone()
+ );
+ Box::new(futures::failed("Generic failure".into()))
+ }
+
+ fn get_editgroups_reviewable(
&self,
- editor_id: String,
+ expand: Option<String>,
limit: Option<i64>,
before: Option<chrono::DateTime<chrono::Utc>>,
since: Option<chrono::DateTime<chrono::Utc>>,
context: &Context,
- ) -> Box<Future<Item = GetEditorEditgroupsResponse, Error = ApiError> + Send> {
+ ) -> Box<Future<Item = GetEditgroupsReviewableResponse, Error = ApiError> + Send> {
let context = context.clone();
println!(
- "get_editor_editgroups(\"{}\", {:?}, {:?}, {:?}) - X-Span-ID: {:?}",
- editor_id,
+ "get_editgroups_reviewable({:?}, {:?}, {:?}, {:?}) - X-Span-ID: {:?}",
+ expand,
limit,
before,
since,
@@ -355,85 +386,43 @@ impl Api for Server {
Box::new(futures::failed("Generic failure".into()))
}
- fn update_editor(&self, editor_id: String, editor: models::Editor, context: &Context) -> Box<Future<Item = UpdateEditorResponse, Error = ApiError> + Send> {
- let context = context.clone();
- println!(
- "update_editor(\"{}\", {:?}) - X-Span-ID: {:?}",
- editor_id,
- editor,
- context.x_span_id.unwrap_or(String::from("<none>")).clone()
- );
- Box::new(futures::failed("Generic failure".into()))
- }
-
- fn accept_editgroup(&self, editgroup_id: String, context: &Context) -> Box<Future<Item = AcceptEditgroupResponse, Error = ApiError> + Send> {
- let context = context.clone();
- println!("accept_editgroup(\"{}\") - X-Span-ID: {:?}", editgroup_id, context.x_span_id.unwrap_or(String::from("<none>")).clone());
- Box::new(futures::failed("Generic failure".into()))
- }
-
- fn create_editgroup(&self, editgroup: models::Editgroup, context: &Context) -> Box<Future<Item = CreateEditgroupResponse, Error = ApiError> + Send> {
+ fn get_editor(&self, editor_id: String, context: &Context) -> Box<Future<Item = GetEditorResponse, Error = ApiError> + Send> {
let context = context.clone();
- println!("create_editgroup({:?}) - X-Span-ID: {:?}", editgroup, context.x_span_id.unwrap_or(String::from("<none>")).clone());
+ println!("get_editor(\"{}\") - X-Span-ID: {:?}", editor_id, context.x_span_id.unwrap_or(String::from("<none>")).clone());
Box::new(futures::failed("Generic failure".into()))
}
- fn create_editgroup_annotation(
+ fn get_editor_annotations(
&self,
- editgroup_id: String,
- annotation: models::EditgroupAnnotation,
+ editor_id: String,
+ limit: Option<i64>,
+ before: Option<chrono::DateTime<chrono::Utc>>,
+ since: Option<chrono::DateTime<chrono::Utc>>,
context: &Context,
- ) -> Box<Future<Item = CreateEditgroupAnnotationResponse, Error = ApiError> + Send> {
- let context = context.clone();
- println!(
- "create_editgroup_annotation(\"{}\", {:?}) - X-Span-ID: {:?}",
- editgroup_id,
- annotation,
- context.x_span_id.unwrap_or(String::from("<none>")).clone()
- );
- Box::new(futures::failed("Generic failure".into()))
- }
-
- fn get_changelog(&self, limit: Option<i64>, context: &Context) -> Box<Future<Item = GetChangelogResponse, Error = ApiError> + Send> {
- let context = context.clone();
- println!("get_changelog({:?}) - X-Span-ID: {:?}", limit, context.x_span_id.unwrap_or(String::from("<none>")).clone());
- Box::new(futures::failed("Generic failure".into()))
- }
-
- fn get_changelog_entry(&self, index: i64, context: &Context) -> Box<Future<Item = GetChangelogEntryResponse, Error = ApiError> + Send> {
- let context = context.clone();
- println!("get_changelog_entry({}) - X-Span-ID: {:?}", index, context.x_span_id.unwrap_or(String::from("<none>")).clone());
- Box::new(futures::failed("Generic failure".into()))
- }
-
- fn get_editgroup(&self, editgroup_id: String, context: &Context) -> Box<Future<Item = GetEditgroupResponse, Error = ApiError> + Send> {
- let context = context.clone();
- println!("get_editgroup(\"{}\") - X-Span-ID: {:?}", editgroup_id, context.x_span_id.unwrap_or(String::from("<none>")).clone());
- Box::new(futures::failed("Generic failure".into()))
- }
-
- fn get_editgroup_annotations(&self, editgroup_id: String, expand: Option<String>, context: &Context) -> Box<Future<Item = GetEditgroupAnnotationsResponse, Error = ApiError> + Send> {
+ ) -> Box<Future<Item = GetEditorAnnotationsResponse, Error = ApiError> + Send> {
let context = context.clone();
println!(
- "get_editgroup_annotations(\"{}\", {:?}) - X-Span-ID: {:?}",
- editgroup_id,
- expand,
+ "get_editor_annotations(\"{}\", {:?}, {:?}, {:?}) - X-Span-ID: {:?}",
+ editor_id,
+ limit,
+ before,
+ since,
context.x_span_id.unwrap_or(String::from("<none>")).clone()
);
Box::new(futures::failed("Generic failure".into()))
}
- fn get_editor_annotations(
+ fn get_editor_editgroups(
&self,
editor_id: String,
limit: Option<i64>,
before: Option<chrono::DateTime<chrono::Utc>>,
since: Option<chrono::DateTime<chrono::Utc>>,
context: &Context,
- ) -> Box<Future<Item = GetEditorAnnotationsResponse, Error = ApiError> + Send> {
+ ) -> Box<Future<Item = GetEditorEditgroupsResponse, Error = ApiError> + Send> {
let context = context.clone();
println!(
- "get_editor_annotations(\"{}\", {:?}, {:?}, {:?}) - X-Span-ID: {:?}",
+ "get_editor_editgroups(\"{}\", {:?}, {:?}, {:?}) - X-Span-ID: {:?}",
editor_id,
limit,
before,
@@ -443,6 +432,17 @@ impl Api for Server {
Box::new(futures::failed("Generic failure".into()))
}
+ fn update_editor(&self, editor_id: String, editor: models::Editor, context: &Context) -> Box<Future<Item = UpdateEditorResponse, Error = ApiError> + Send> {
+ let context = context.clone();
+ println!(
+ "update_editor(\"{}\", {:?}) - X-Span-ID: {:?}",
+ editor_id,
+ editor,
+ context.x_span_id.unwrap_or(String::from("<none>")).clone()
+ );
+ Box::new(futures::failed("Generic failure".into()))
+ }
+
fn create_file(&self, editgroup_id: String, entity: models::FileEntity, context: &Context) -> Box<Future<Item = CreateFileResponse, Error = ApiError> + Send> {
let context = context.clone();
println!(
@@ -690,17 +690,6 @@ impl Api for Server {
Box::new(futures::failed("Generic failure".into()))
}
- fn create_work(&self, editgroup_id: String, entity: models::WorkEntity, context: &Context) -> Box<Future<Item = CreateWorkResponse, Error = ApiError> + Send> {
- let context = context.clone();
- println!(
- "create_work(\"{}\", {:?}) - X-Span-ID: {:?}",
- editgroup_id,
- entity,
- context.x_span_id.unwrap_or(String::from("<none>")).clone()
- );
- Box::new(futures::failed("Generic failure".into()))
- }
-
fn delete_release(&self, editgroup_id: String, ident: String, context: &Context) -> Box<Future<Item = DeleteReleaseResponse, Error = ApiError> + Send> {
let context = context.clone();
println!(
@@ -953,6 +942,17 @@ impl Api for Server {
Box::new(futures::failed("Generic failure".into()))
}
+ fn create_work(&self, editgroup_id: String, entity: models::WorkEntity, context: &Context) -> Box<Future<Item = CreateWorkResponse, Error = ApiError> + Send> {
+ let context = context.clone();
+ println!(
+ "create_work(\"{}\", {:?}) - X-Span-ID: {:?}",
+ editgroup_id,
+ entity,
+ context.x_span_id.unwrap_or(String::from("<none>")).clone()
+ );
+ Box::new(futures::failed("Generic failure".into()))
+ }
+
fn create_work_auto_batch(&self, auto_batch: models::WorkAutoBatch, context: &Context) -> Box<Future<Item = CreateWorkAutoBatchResponse, Error = ApiError> + Send> {
let context = context.clone();
println!(