diff options
author | Bryan Newbold <bnewbold@archive.org> | 2021-02-02 11:42:43 -0800 |
---|---|---|
committer | Bryan Newbold <bnewbold@archive.org> | 2021-02-02 11:42:43 -0800 |
commit | b8991aed0f4c9f58daad1865a3873fc31bdc96bd (patch) | |
tree | 9b1a669f192fdddc419ac06a6632a46e690a5cc8 /rust/fatcat-openapi/examples/server/server.rs | |
parent | 119835ea0cf68f0003299cb3e285ae7d8d744af4 (diff) | |
download | fatcat-cli-b8991aed0f4c9f58daad1865a3873fc31bdc96bd.tar.gz fatcat-cli-b8991aed0f4c9f58daad1865a3873fc31bdc96bd.zip |
re-codegen openapi stuff
Diffstat (limited to 'rust/fatcat-openapi/examples/server/server.rs')
-rw-r--r-- | rust/fatcat-openapi/examples/server/server.rs | 720 |
1 files changed, 358 insertions, 362 deletions
diff --git a/rust/fatcat-openapi/examples/server/server.rs b/rust/fatcat-openapi/examples/server/server.rs index 85c8f73..981487e 100644 --- a/rust/fatcat-openapi/examples/server/server.rs +++ b/rust/fatcat-openapi/examples/server/server.rs @@ -2,22 +2,18 @@ #![allow(unused_imports)] -mod errors { - error_chain::error_chain! {} -} - -pub use self::errors::*; - -use chrono; -use futures::{future, Future, Stream}; +use async_trait::async_trait; +use futures::{future, Stream, StreamExt, TryFutureExt, TryStreamExt}; use hyper::server::conn::Http; -use hyper::service::MakeService as _; +use hyper::service::Service; use log::info; +#[cfg(not(any(target_os = "macos", target_os = "windows", target_os = "ios")))] use openssl::ssl::SslAcceptorBuilder; +use std::future::Future; use std::marker::PhantomData; use std::net::SocketAddr; use std::sync::{Arc, Mutex}; -use swagger; +use std::task::{Context, Poll}; use swagger::auth::MakeAllowAllAuthenticator; use swagger::EmptyContext; use swagger::{Has, XSpanIdString}; @@ -25,24 +21,21 @@ use tokio::net::TcpListener; #[cfg(not(any(target_os = "macos", target_os = "windows", target_os = "ios")))] use openssl::ssl::{SslAcceptor, SslFiletype, SslMethod}; -#[cfg(not(any(target_os = "macos", target_os = "windows", target_os = "ios")))] -use tokio_openssl::SslAcceptorExt; use fatcat_openapi::models; -#[cfg(not(any(target_os = "macos", target_os = "windows", target_os = "ios")))] /// Builds an SSL implementation for Simple HTTPS from some hard-coded file names -pub fn create(addr: &str, https: bool) -> Box<dyn Future<Item = (), Error = ()> + Send> { +pub async fn create(addr: &str, https: bool) { let addr = addr.parse().expect("Failed to parse bind address"); let server = Server::new(); - let service_fn = MakeService::new(server); + let service = MakeService::new(server); - let service_fn = MakeAllowAllAuthenticator::new(service_fn, "cosmo"); + let service = MakeAllowAllAuthenticator::new(service, "cosmo"); - let service_fn = - fatcat_openapi::server::context::MakeAddContext::<_, EmptyContext>::new(service_fn); + let mut service = + fatcat_openapi::server::context::MakeAddContext::<_, EmptyContext>::new(service); if https { #[cfg(any(target_os = "macos", target_os = "windows", target_os = "ios"))] @@ -63,41 +56,39 @@ pub fn create(addr: &str, https: bool) -> Box<dyn Future<Item = (), Error = ()> ssl.check_private_key() .expect("Failed to check private key"); - let tls_acceptor = ssl.build(); - let service_fn = Arc::new(Mutex::new(service_fn)); - let tls_listener = TcpListener::bind(&addr) - .unwrap() - .incoming() - .for_each(move |tcp| { - let addr = tcp.peer_addr().expect("Unable to get remote address"); + let tls_acceptor = Arc::new(ssl.build()); + let mut tcp_listener = TcpListener::bind(&addr).await.unwrap(); + let mut incoming = tcp_listener.incoming(); - let service_fn = service_fn.clone(); + while let (Some(tcp), rest) = incoming.into_future().await { + if let Ok(tcp) = tcp { + let addr = tcp.peer_addr().expect("Unable to get remote address"); + let service = service.call(addr); + let tls_acceptor = Arc::clone(&tls_acceptor); - hyper::rt::spawn(tls_acceptor.accept_async(tcp).map_err(|_| ()).and_then( - move |tls| { - let ms = { - let mut service_fn = service_fn.lock().unwrap(); - service_fn.make_service(&addr) - }; + tokio::spawn(async move { + let tls = tokio_openssl::accept(&*tls_acceptor, tcp) + .await + .map_err(|_| ())?; - ms.and_then(move |service| Http::new().serve_connection(tls, service)) - .map_err(|_| ()) - }, - )); + let service = service.await.map_err(|_| ())?; - Ok(()) - }) - .map_err(|_| ()); + Http::new() + .serve_connection(tls, service) + .await + .map_err(|_| ()) + }); + } - Box::new(tls_listener) + incoming = rest; + } } } else { // Using HTTP - Box::new( - hyper::server::Server::bind(&addr) - .serve(service_fn) - .map_err(|e| panic!("{:?}", e)), - ) + hyper::server::Server::bind(&addr) + .serve(service) + .await + .unwrap() } } @@ -116,90 +107,92 @@ impl<C> Server<C> { use fatcat_openapi::server::MakeService; use fatcat_openapi::{ - AcceptEditgroupResponse, Api, ApiError, AuthCheckResponse, AuthOidcResponse, - CreateAuthTokenResponse, CreateContainerAutoBatchResponse, CreateContainerResponse, - CreateCreatorAutoBatchResponse, CreateCreatorResponse, CreateEditgroupAnnotationResponse, - CreateEditgroupResponse, CreateFileAutoBatchResponse, CreateFileResponse, - CreateFilesetAutoBatchResponse, CreateFilesetResponse, CreateReleaseAutoBatchResponse, - CreateReleaseResponse, CreateWebcaptureAutoBatchResponse, CreateWebcaptureResponse, - CreateWorkAutoBatchResponse, CreateWorkResponse, DeleteContainerEditResponse, - DeleteContainerResponse, DeleteCreatorEditResponse, DeleteCreatorResponse, - DeleteFileEditResponse, DeleteFileResponse, DeleteFilesetEditResponse, DeleteFilesetResponse, - DeleteReleaseEditResponse, DeleteReleaseResponse, DeleteWebcaptureEditResponse, - DeleteWebcaptureResponse, DeleteWorkEditResponse, DeleteWorkResponse, - GetChangelogEntryResponse, GetChangelogResponse, GetContainerEditResponse, - GetContainerHistoryResponse, GetContainerRedirectsResponse, GetContainerResponse, - GetContainerRevisionResponse, GetCreatorEditResponse, GetCreatorHistoryResponse, - GetCreatorRedirectsResponse, GetCreatorReleasesResponse, GetCreatorResponse, - GetCreatorRevisionResponse, GetEditgroupAnnotationsResponse, GetEditgroupResponse, - GetEditgroupsReviewableResponse, GetEditorAnnotationsResponse, GetEditorEditgroupsResponse, - GetEditorResponse, GetFileEditResponse, GetFileHistoryResponse, GetFileRedirectsResponse, - GetFileResponse, GetFileRevisionResponse, GetFilesetEditResponse, GetFilesetHistoryResponse, - GetFilesetRedirectsResponse, GetFilesetResponse, GetFilesetRevisionResponse, - GetReleaseEditResponse, GetReleaseFilesResponse, GetReleaseFilesetsResponse, - GetReleaseHistoryResponse, GetReleaseRedirectsResponse, GetReleaseResponse, - GetReleaseRevisionResponse, GetReleaseWebcapturesResponse, GetWebcaptureEditResponse, - GetWebcaptureHistoryResponse, GetWebcaptureRedirectsResponse, GetWebcaptureResponse, - GetWebcaptureRevisionResponse, GetWorkEditResponse, GetWorkHistoryResponse, - GetWorkRedirectsResponse, GetWorkReleasesResponse, GetWorkResponse, GetWorkRevisionResponse, - LookupContainerResponse, LookupCreatorResponse, LookupFileResponse, LookupReleaseResponse, - UpdateContainerResponse, UpdateCreatorResponse, UpdateEditgroupResponse, UpdateEditorResponse, - UpdateFileResponse, UpdateFilesetResponse, UpdateReleaseResponse, UpdateWebcaptureResponse, - UpdateWorkResponse, + AcceptEditgroupResponse, Api, AuthCheckResponse, AuthOidcResponse, CreateAuthTokenResponse, + CreateContainerAutoBatchResponse, CreateContainerResponse, CreateCreatorAutoBatchResponse, + CreateCreatorResponse, CreateEditgroupAnnotationResponse, CreateEditgroupResponse, + CreateFileAutoBatchResponse, CreateFileResponse, CreateFilesetAutoBatchResponse, + CreateFilesetResponse, CreateReleaseAutoBatchResponse, CreateReleaseResponse, + CreateWebcaptureAutoBatchResponse, CreateWebcaptureResponse, CreateWorkAutoBatchResponse, + CreateWorkResponse, DeleteContainerEditResponse, DeleteContainerResponse, + DeleteCreatorEditResponse, DeleteCreatorResponse, DeleteFileEditResponse, DeleteFileResponse, + DeleteFilesetEditResponse, DeleteFilesetResponse, DeleteReleaseEditResponse, + DeleteReleaseResponse, DeleteWebcaptureEditResponse, DeleteWebcaptureResponse, + DeleteWorkEditResponse, DeleteWorkResponse, GetChangelogEntryResponse, GetChangelogResponse, + GetContainerEditResponse, GetContainerHistoryResponse, GetContainerRedirectsResponse, + GetContainerResponse, GetContainerRevisionResponse, GetCreatorEditResponse, + GetCreatorHistoryResponse, GetCreatorRedirectsResponse, GetCreatorReleasesResponse, + GetCreatorResponse, GetCreatorRevisionResponse, GetEditgroupAnnotationsResponse, + GetEditgroupResponse, GetEditgroupsReviewableResponse, GetEditorAnnotationsResponse, + GetEditorEditgroupsResponse, GetEditorResponse, GetFileEditResponse, GetFileHistoryResponse, + GetFileRedirectsResponse, GetFileResponse, GetFileRevisionResponse, GetFilesetEditResponse, + GetFilesetHistoryResponse, GetFilesetRedirectsResponse, GetFilesetResponse, + GetFilesetRevisionResponse, GetReleaseEditResponse, GetReleaseFilesResponse, + GetReleaseFilesetsResponse, GetReleaseHistoryResponse, GetReleaseRedirectsResponse, + GetReleaseResponse, GetReleaseRevisionResponse, GetReleaseWebcapturesResponse, + GetWebcaptureEditResponse, GetWebcaptureHistoryResponse, GetWebcaptureRedirectsResponse, + GetWebcaptureResponse, GetWebcaptureRevisionResponse, GetWorkEditResponse, + GetWorkHistoryResponse, GetWorkRedirectsResponse, GetWorkReleasesResponse, GetWorkResponse, + GetWorkRevisionResponse, LookupContainerResponse, LookupCreatorResponse, LookupFileResponse, + LookupReleaseResponse, UpdateContainerResponse, UpdateCreatorResponse, UpdateEditgroupResponse, + UpdateEditorResponse, UpdateFileResponse, UpdateFilesetResponse, UpdateReleaseResponse, + UpdateWebcaptureResponse, UpdateWorkResponse, }; +use std::error::Error; +use swagger::ApiError; +#[async_trait] impl<C> Api<C> for Server<C> where - C: Has<XSpanIdString>, + C: Has<XSpanIdString> + Send + Sync, { - fn accept_editgroup( + async fn accept_editgroup( &self, editgroup_id: String, context: &C, - ) -> Box<dyn Future<Item = AcceptEditgroupResponse, Error = ApiError> + Send> { + ) -> Result<AcceptEditgroupResponse, ApiError> { let context = context.clone(); info!( "accept_editgroup(\"{}\") - X-Span-ID: {:?}", editgroup_id, context.get().0.clone() ); - Box::new(future::err("Generic failure".into())) + Err("Generic failuare".into()) } - fn auth_check( + async fn auth_check( &self, role: Option<String>, context: &C, - ) -> Box<dyn Future<Item = AuthCheckResponse, Error = ApiError> + Send> { + ) -> Result<AuthCheckResponse, ApiError> { let context = context.clone(); info!( "auth_check({:?}) - X-Span-ID: {:?}", role, context.get().0.clone() ); - Box::new(future::err("Generic failure".into())) + Err("Generic failuare".into()) } - fn auth_oidc( + async fn auth_oidc( &self, auth_oidc: models::AuthOidc, context: &C, - ) -> Box<dyn Future<Item = AuthOidcResponse, Error = ApiError> + Send> { + ) -> Result<AuthOidcResponse, ApiError> { let context = context.clone(); info!( "auth_oidc({:?}) - X-Span-ID: {:?}", auth_oidc, context.get().0.clone() ); - Box::new(future::err("Generic failure".into())) + Err("Generic failuare".into()) } - fn create_auth_token( + async fn create_auth_token( &self, editor_id: String, duration_seconds: Option<i32>, context: &C, - ) -> Box<dyn Future<Item = CreateAuthTokenResponse, Error = ApiError> + Send> { + ) -> Result<CreateAuthTokenResponse, ApiError> { let context = context.clone(); info!( "create_auth_token(\"{}\", {:?}) - X-Span-ID: {:?}", @@ -207,15 +200,15 @@ where duration_seconds, context.get().0.clone() ); - Box::new(future::err("Generic failure".into())) + Err("Generic failuare".into()) } - fn create_container( + async fn create_container( &self, editgroup_id: String, container_entity: models::ContainerEntity, context: &C, - ) -> Box<dyn Future<Item = CreateContainerResponse, Error = ApiError> + Send> { + ) -> Result<CreateContainerResponse, ApiError> { let context = context.clone(); info!( "create_container(\"{}\", {:?}) - X-Span-ID: {:?}", @@ -223,29 +216,29 @@ where container_entity, context.get().0.clone() ); - Box::new(future::err("Generic failure".into())) + Err("Generic failuare".into()) } - fn create_container_auto_batch( + async fn create_container_auto_batch( &self, container_auto_batch: models::ContainerAutoBatch, context: &C, - ) -> Box<dyn Future<Item = CreateContainerAutoBatchResponse, Error = ApiError> + Send> { + ) -> Result<CreateContainerAutoBatchResponse, ApiError> { let context = context.clone(); info!( "create_container_auto_batch({:?}) - X-Span-ID: {:?}", container_auto_batch, context.get().0.clone() ); - Box::new(future::err("Generic failure".into())) + Err("Generic failuare".into()) } - fn create_creator( + async fn create_creator( &self, editgroup_id: String, creator_entity: models::CreatorEntity, context: &C, - ) -> Box<dyn Future<Item = CreateCreatorResponse, Error = ApiError> + Send> { + ) -> Result<CreateCreatorResponse, ApiError> { let context = context.clone(); info!( "create_creator(\"{}\", {:?}) - X-Span-ID: {:?}", @@ -253,43 +246,43 @@ where creator_entity, context.get().0.clone() ); - Box::new(future::err("Generic failure".into())) + Err("Generic failuare".into()) } - fn create_creator_auto_batch( + async fn create_creator_auto_batch( &self, creator_auto_batch: models::CreatorAutoBatch, context: &C, - ) -> Box<dyn Future<Item = CreateCreatorAutoBatchResponse, Error = ApiError> + Send> { + ) -> Result<CreateCreatorAutoBatchResponse, ApiError> { let context = context.clone(); info!( "create_creator_auto_batch({:?}) - X-Span-ID: {:?}", creator_auto_batch, context.get().0.clone() ); - Box::new(future::err("Generic failure".into())) + Err("Generic failuare".into()) } - fn create_editgroup( + async fn create_editgroup( &self, editgroup: models::Editgroup, context: &C, - ) -> Box<dyn Future<Item = CreateEditgroupResponse, Error = ApiError> + Send> { + ) -> Result<CreateEditgroupResponse, ApiError> { let context = context.clone(); info!( "create_editgroup({:?}) - X-Span-ID: {:?}", editgroup, context.get().0.clone() ); - Box::new(future::err("Generic failure".into())) + Err("Generic failuare".into()) } - fn create_editgroup_annotation( + async fn create_editgroup_annotation( &self, editgroup_id: String, editgroup_annotation: models::EditgroupAnnotation, context: &C, - ) -> Box<dyn Future<Item = CreateEditgroupAnnotationResponse, Error = ApiError> + Send> { + ) -> Result<CreateEditgroupAnnotationResponse, ApiError> { let context = context.clone(); info!( "create_editgroup_annotation(\"{}\", {:?}) - X-Span-ID: {:?}", @@ -297,15 +290,15 @@ where editgroup_annotation, context.get().0.clone() ); - Box::new(future::err("Generic failure".into())) + Err("Generic failuare".into()) } - fn create_file( + async fn create_file( &self, editgroup_id: String, file_entity: models::FileEntity, context: &C, - ) -> Box<dyn Future<Item = CreateFileResponse, Error = ApiError> + Send> { + ) -> Result<CreateFileResponse, ApiError> { let context = context.clone(); info!( "create_file(\"{}\", {:?}) - X-Span-ID: {:?}", @@ -313,29 +306,29 @@ where file_entity, context.get().0.clone() ); - Box::new(future::err("Generic failure".into())) + Err("Generic failuare".into()) } - fn create_file_auto_batch( + async fn create_file_auto_batch( &self, file_auto_batch: models::FileAutoBatch, context: &C, - ) -> Box<dyn Future<Item = CreateFileAutoBatchResponse, Error = ApiError> + Send> { + ) -> Result<CreateFileAutoBatchResponse, ApiError> { let context = context.clone(); info!( "create_file_auto_batch({:?}) - X-Span-ID: {:?}", file_auto_batch, context.get().0.clone() ); - Box::new(future::err("Generic failure".into())) + Err("Generic failuare".into()) } - fn create_fileset( + async fn create_fileset( &self, editgroup_id: String, fileset_entity: models::FilesetEntity, context: &C, - ) -> Box<dyn Future<Item = CreateFilesetResponse, Error = ApiError> + Send> { + ) -> Result<CreateFilesetResponse, ApiError> { let context = context.clone(); info!( "create_fileset(\"{}\", {:?}) - X-Span-ID: {:?}", @@ -343,29 +336,29 @@ where fileset_entity, context.get().0.clone() ); - Box::new(future::err("Generic failure".into())) + Err("Generic failuare".into()) } - fn create_fileset_auto_batch( + async fn create_fileset_auto_batch( &self, fileset_auto_batch: models::FilesetAutoBatch, context: &C, - ) -> Box<dyn Future<Item = CreateFilesetAutoBatchResponse, Error = ApiError> + Send> { + ) -> Result<CreateFilesetAutoBatchResponse, ApiError> { let context = context.clone(); info!( "create_fileset_auto_batch({:?}) - X-Span-ID: {:?}", fileset_auto_batch, context.get().0.clone() ); - Box::new(future::err("Generic failure".into())) + Err("Generic failuare".into()) } - fn create_release( + async fn create_release( &self, editgroup_id: String, release_entity: models::ReleaseEntity, context: &C, - ) -> Box<dyn Future<Item = CreateReleaseResponse, Error = ApiError> + Send> { + ) -> Result<CreateReleaseResponse, ApiError> { let context = context.clone(); info!( "create_release(\"{}\", {:?}) - X-Span-ID: {:?}", @@ -373,29 +366,29 @@ where release_entity, context.get().0.clone() ); - Box::new(future::err("Generic failure".into())) + Err("Generic failuare".into()) } - fn create_release_auto_batch( + async fn create_release_auto_batch( &self, release_auto_batch: models::ReleaseAutoBatch, context: &C, - ) -> Box<dyn Future<Item = CreateReleaseAutoBatchResponse, Error = ApiError> + Send> { + ) -> Result<CreateReleaseAutoBatchResponse, ApiError> { let context = context.clone(); info!( "create_release_auto_batch({:?}) - X-Span-ID: {:?}", release_auto_batch, context.get().0.clone() ); - Box::new(future::err("Generic failure".into())) + Err("Generic failuare".into()) } - fn create_webcapture( + async fn create_webcapture( &self, editgroup_id: String, webcapture_entity: models::WebcaptureEntity, context: &C, - ) -> Box<dyn Future<Item = CreateWebcaptureResponse, Error = ApiError> + Send> { + ) -> Result<CreateWebcaptureResponse, ApiError> { let context = context.clone(); info!( "create_webcapture(\"{}\", {:?}) - X-Span-ID: {:?}", @@ -403,29 +396,29 @@ where webcapture_entity, context.get().0.clone() ); - Box::new(future::err("Generic failure".into())) + Err("Generic failuare".into()) } - fn create_webcapture_auto_batch( + async fn create_webcapture_auto_batch( &self, webcapture_auto_batch: models::WebcaptureAutoBatch, context: &C, - ) -> Box<dyn Future<Item = CreateWebcaptureAutoBatchResponse, Error = ApiError> + Send> { + ) -> Result<CreateWebcaptureAutoBatchResponse, ApiError> { let context = context.clone(); info!( "create_webcapture_auto_batch({:?}) - X-Span-ID: {:?}", webcapture_auto_batch, context.get().0.clone() ); - Box::new(future::err("Generic failure".into())) + Err("Generic failuare".into()) } - fn create_work( + async fn create_work( &self, editgroup_id: String, work_entity: models::WorkEntity, context: &C, - ) -> Box<dyn Future<Item = CreateWorkResponse, Error = ApiError> + Send> { + ) -> Result<CreateWorkResponse, ApiError> { let context = context.clone(); info!( "create_work(\"{}\", {:?}) - X-Span-ID: {:?}", @@ -433,29 +426,29 @@ where work_entity, context.get().0.clone() ); - Box::new(future::err("Generic failure".into())) + Err("Generic failuare".into()) } - fn create_work_auto_batch( + async fn create_work_auto_batch( &self, work_auto_batch: models::WorkAutoBatch, context: &C, - ) -> Box<dyn Future<Item = CreateWorkAutoBatchResponse, Error = ApiError> + Send> { + ) -> Result<CreateWorkAutoBatchResponse, ApiError> { let context = context.clone(); info!( "create_work_auto_batch({:?}) - X-Span-ID: {:?}", work_auto_batch, context.get().0.clone() ); - Box::new(future::err("Generic failure".into())) + Err("Generic failuare".into()) } - fn delete_container( + async fn delete_container( &self, editgroup_id: String, ident: String, context: &C, - ) -> Box<dyn Future<Item = DeleteContainerResponse, Error = ApiError> + Send> { + ) -> Result<DeleteContainerResponse, ApiError> { let context = context.clone(); info!( "delete_container(\"{}\", \"{}\") - X-Span-ID: {:?}", @@ -463,15 +456,15 @@ where ident, context.get().0.clone() ); - Box::new(future::err("Generic failure".into())) + Err("Generic failuare".into()) } - fn delete_container_edit( + async fn delete_container_edit( &self, editgroup_id: String, edit_id: String, context: &C, - ) -> Box<dyn Future<Item = DeleteContainerEditResponse, Error = ApiError> + Send> { + ) -> Result<DeleteContainerEditResponse, ApiError> { let context = context.clone(); info!( "delete_container_edit(\"{}\", \"{}\") - X-Span-ID: {:?}", @@ -479,15 +472,15 @@ where edit_id, context.get().0.clone() ); - Box::new(future::err("Generic failure".into())) + Err("Generic failuare".into()) } - fn delete_creator( + async fn delete_creator( &self, editgroup_id: String, ident: String, context: &C, - ) -> Box<dyn Future<Item = DeleteCreatorResponse, Error = ApiError> + Send> { + ) -> Result<DeleteCreatorResponse, ApiError> { let context = context.clone(); info!( "delete_creator(\"{}\", \"{}\") - X-Span-ID: {:?}", @@ -495,15 +488,15 @@ where ident, context.get().0.clone() ); - Box::new(future::err("Generic failure".into())) + Err("Generic failuare".into()) } - fn delete_creator_edit( + async fn delete_creator_edit( &self, editgroup_id: String, edit_id: String, context: &C, - ) -> Box<dyn Future<Item = DeleteCreatorEditResponse, Error = ApiError> + Send> { + ) -> Result<DeleteCreatorEditResponse, ApiError> { let context = context.clone(); info!( "delete_creator_edit(\"{}\", \"{}\") - X-Span-ID: {:?}", @@ -511,15 +504,15 @@ where edit_id, context.get().0.clone() ); - Box::new(future::err("Generic failure".into())) + Err("Generic failuare".into()) } - fn delete_file( + async fn delete_file( &self, editgroup_id: String, ident: String, context: &C, - ) -> Box<dyn Future<Item = DeleteFileResponse, Error = ApiError> + Send> { + ) -> Result<DeleteFileResponse, ApiError> { let context = context.clone(); info!( "delete_file(\"{}\", \"{}\") - X-Span-ID: {:?}", @@ -527,15 +520,15 @@ where ident, context.get().0.clone() ); - Box::new(future::err("Generic failure".into())) + Err("Generic failuare".into()) } - fn delete_file_edit( + async fn delete_file_edit( &self, editgroup_id: String, edit_id: String, context: &C, - ) -> Box<dyn Future<Item = DeleteFileEditResponse, Error = ApiError> + Send> { + ) -> Result<DeleteFileEditResponse, ApiError> { let context = context.clone(); info!( "delete_file_edit(\"{}\", \"{}\") - X-Span-ID: {:?}", @@ -543,15 +536,15 @@ where edit_id, context.get().0.clone() ); - Box::new(future::err("Generic failure".into())) + Err("Generic failuare".into()) } - fn delete_fileset( + async fn delete_fileset( &self, editgroup_id: String, ident: String, context: &C, - ) -> Box<dyn Future<Item = DeleteFilesetResponse, Error = ApiError> + Send> { + ) -> Result<DeleteFilesetResponse, ApiError> { let context = context.clone(); info!( "delete_fileset(\"{}\", \"{}\") - X-Span-ID: {:?}", @@ -559,15 +552,15 @@ where ident, context.get().0.clone() ); - Box::new(future::err("Generic failure".into())) + Err("Generic failuare".into()) } - fn delete_fileset_edit( + async fn delete_fileset_edit( &self, editgroup_id: String, edit_id: String, context: &C, - ) -> Box<dyn Future<Item = DeleteFilesetEditResponse, Error = ApiError> + Send> { + ) -> Result<DeleteFilesetEditResponse, ApiError> { let context = context.clone(); info!( "delete_fileset_edit(\"{}\", \"{}\") - X-Span-ID: {:?}", @@ -575,15 +568,15 @@ where edit_id, context.get().0.clone() ); - Box::new(future::err("Generic failure".into())) + Err("Generic failuare".into()) } - fn delete_release( + async fn delete_release( &self, editgroup_id: String, ident: String, context: &C, - ) -> Box<dyn Future<Item = DeleteReleaseResponse, Error = ApiError> + Send> { + ) -> Result<DeleteReleaseResponse, ApiError> { let context = context.clone(); info!( "delete_release(\"{}\", \"{}\") - X-Span-ID: {:?}", @@ -591,15 +584,15 @@ where ident, context.get().0.clone() ); - Box::new(future::err("Generic failure".into())) + Err("Generic failuare".into()) } - fn delete_release_edit( + async fn delete_release_edit( &self, editgroup_id: String, edit_id: String, context: &C, - ) -> Box<dyn Future<Item = DeleteReleaseEditResponse, Error = ApiError> + Send> { + ) -> Result<DeleteReleaseEditResponse, ApiError> { let context = context.clone(); info!( "delete_release_edit(\"{}\", \"{}\") - X-Span-ID: {:?}", @@ -607,15 +600,15 @@ where edit_id, context.get().0.clone() ); - Box::new(future::err("Generic failure".into())) + Err("Generic failuare".into()) } - fn delete_webcapture( + async fn delete_webcapture( &self, editgroup_id: String, ident: String, context: &C, - ) -> Box<dyn Future<Item = DeleteWebcaptureResponse, Error = ApiError> + Send> { + ) -> Result<DeleteWebcaptureResponse, ApiError> { let context = context.clone(); info!( "delete_webcapture(\"{}\", \"{}\") - X-Span-ID: {:?}", @@ -623,15 +616,15 @@ where ident, context.get().0.clone() ); - Box::new(future::err("Generic failure".into())) + Err("Generic failuare".into()) } - fn delete_webcapture_edit( + async fn delete_webcapture_edit( &self, editgroup_id: String, edit_id: String, context: &C, - ) -> Box<dyn Future<Item = DeleteWebcaptureEditResponse, Error = ApiError> + Send> { + ) -> Result<DeleteWebcaptureEditResponse, ApiError> { let context = context.clone(); info!( "delete_webcapture_edit(\"{}\", \"{}\") - X-Span-ID: {:?}", @@ -639,15 +632,15 @@ where edit_id, context.get().0.clone() ); - Box::new(future::err("Generic failure".into())) + Err("Generic failuare".into()) } - fn delete_work( + async fn delete_work( &self, editgroup_id: String, ident: String, context: &C, - ) -> Box<dyn Future<Item = DeleteWorkResponse, Error = ApiError> + Send> { + ) -> Result<DeleteWorkResponse, ApiError> { let context = context.clone(); info!( "delete_work(\"{}\", \"{}\") - X-Span-ID: {:?}", @@ -655,15 +648,15 @@ where ident, context.get().0.clone() ); - Box::new(future::err("Generic failure".into())) + Err("Generic failuare".into()) } - fn delete_work_edit( + async fn delete_work_edit( &self, editgroup_id: String, edit_id: String, context: &C, - ) -> Box<dyn Future<Item = DeleteWorkEditResponse, Error = ApiError> + Send> { + ) -> Result<DeleteWorkEditResponse, ApiError> { let context = context.clone(); info!( "delete_work_edit(\"{}\", \"{}\") - X-Span-ID: {:?}", @@ -671,44 +664,44 @@ where edit_id, context.get().0.clone() ); - Box::new(future::err("Generic failure".into())) + Err("Generic failuare".into()) } - fn get_changelog( + async fn get_changelog( &self, limit: Option<i64>, context: &C, - ) -> Box<dyn Future<Item = GetChangelogResponse, Error = ApiError> + Send> { + ) -> Result<GetChangelogResponse, ApiError> { let context = context.clone(); info!( "get_changelog({:?}) - X-Span-ID: {:?}", limit, context.get().0.clone() ); - Box::new(future::err("Generic failure".into())) + Err("Generic failuare".into()) } - fn get_changelog_entry( + async fn get_changelog_entry( &self, index: i64, context: &C, - ) -> Box<dyn Future<Item = GetChangelogEntryResponse, Error = ApiError> + Send> { + ) -> Result<GetChangelogEntryResponse, ApiError> { let context = context.clone(); info!( "get_changelog_entry({}) - X-Span-ID: {:?}", index, context.get().0.clone() ); - Box::new(future::err("Generic failure".into())) + Err("Generic failuare".into()) } - fn get_container( + async fn get_container( &self, ident: String, expand: Option<String>, hide: Option<String>, context: &C, - ) -> Box<dyn Future<Item = GetContainerResponse, Error = ApiError> + Send> { + ) -> Result<GetContainerResponse, ApiError> { let context = context.clone(); info!( "get_container(\"{}\", {:?}, {:?}) - X-Span-ID: {:?}", @@ -717,29 +710,29 @@ where hide, context.get().0.clone() ); - Box::new(future::err("Generic failure".into())) + Err("Generic failuare".into()) } - fn get_container_edit( + async fn get_container_edit( &self, edit_id: String, context: &C, - ) -> Box<dyn Future<Item = GetContainerEditResponse, Error = ApiError> + Send> { + ) -> Result<GetContainerEditResponse, ApiError> { let context = context.clone(); info!( "get_container_edit(\"{}\") - X-Span-ID: {:?}", edit_id, context.get().0.clone() ); - Box::new(future::err("Generic failure".into())) + Err("Generic failuare".into()) } - fn get_container_history( + async fn get_container_history( &self, ident: String, limit: Option<i64>, context: &C, - ) -> Box<dyn Future<Item = GetContainerHistoryResponse, Error = ApiError> + Send> { + ) -> Result<GetContainerHistoryResponse, ApiError> { let context = context.clone(); info!( "get_container_history(\"{}\", {:?}) - X-Span-ID: {:?}", @@ -747,30 +740,30 @@ where limit, context.get().0.clone() ); - Box::new(future::err("Generic failure".into())) + Err("Generic failuare".into()) } - fn get_container_redirects( + async fn get_container_redirects( &self, ident: String, context: &C, - ) -> Box<dyn Future<Item = GetContainerRedirectsResponse, Error = ApiError> + Send> { + ) -> Result<GetContainerRedirectsResponse, ApiError> { let context = context.clone(); info!( "get_container_redirects(\"{}\") - X-Span-ID: {:?}", ident, context.get().0.clone() ); - Box::new(future::err("Generic failure".into())) + Err("Generic failuare".into()) } - fn get_container_revision( + async fn get_container_revision( &self, rev_id: String, expand: Option<String>, hide: Option<String>, context: &C, - ) -> Box<dyn Future<Item = GetContainerRevisionResponse, Error = ApiError> + Send> { + ) -> Result<GetContainerRevisionResponse, ApiError> { let context = context.clone(); info!( "get_container_revision(\"{}\", {:?}, {:?}) - X-Span-ID: {:?}", @@ -779,16 +772,16 @@ where hide, context.get().0.clone() ); - Box::new(future::err("Generic failure".into())) + Err("Generic failuare".into()) } - fn get_creator( + async fn get_creator( &self, ident: String, expand: Option<String>, hide: Option<String>, context: &C, - ) -> Box<dyn Future<Item = GetCreatorResponse, Error = ApiError> + Send> { + ) -> Result<GetCreatorResponse, ApiError> { let context = context.clone(); info!( "get_creator(\"{}\", {:?}, {:?}) - X-Span-ID: {:?}", @@ -797,29 +790,29 @@ where hide, context.get().0.clone() ); - Box::new(future::err("Generic failure".into())) + Err("Generic failuare".into()) } - fn get_creator_edit( + async fn get_creator_edit( &self, edit_id: String, context: &C, - ) -> Box<dyn Future<Item = GetCreatorEditResponse, Error = ApiError> + Send> { + ) -> Result<GetCreatorEditResponse, ApiError> { let context = context.clone(); info!( "get_creator_edit(\"{}\") - X-Span-ID: {:?}", edit_id, context.get().0.clone() ); - Box::new(future::err("Generic failure".into())) + Err("Generic failuare".into()) } - fn get_creator_history( + async fn get_creator_history( &self, ident: String, limit: Option<i64>, context: &C, - ) -> Box<dyn Future<Item = GetCreatorHistoryResponse, Error = ApiError> + Send> { + ) -> Result<GetCreatorHistoryResponse, ApiError> { let context = context.clone(); info!( "get_creator_history(\"{}\", {:?}) - X-Span-ID: {:?}", @@ -827,29 +820,29 @@ where limit, context.get().0.clone() ); - Box::new(future::err("Generic failure".into())) + Err("Generic failuare".into()) } - fn get_creator_redirects( + async fn get_creator_redirects( &self, ident: String, context: &C, - ) -> Box<dyn Future<Item = GetCreatorRedirectsResponse, Error = ApiError> + Send> { + ) -> Result<GetCreatorRedirectsResponse, ApiError> { let context = context.clone(); info!( "get_creator_redirects(\"{}\") - X-Span-ID: {:?}", ident, context.get().0.clone() ); - Box::new(future::err("Generic failure".into())) + Err("Generic failuare".into()) } - fn get_creator_releases( + async fn get_creator_releases( &self, ident: String, hide: Option<String>, context: &C, - ) -> Box<dyn Future<Item = GetCreatorReleasesResponse, Error = ApiError> + Send> { + ) -> Result<GetCreatorReleasesResponse, ApiError> { let context = context.clone(); info!( "get_creator_releases(\"{}\", {:?}) - X-Span-ID: {:?}", @@ -857,16 +850,16 @@ where hide, context.get().0.clone() ); - Box::new(future::err("Generic failure".into())) + Err("Generic failuare".into()) } - fn get_creator_revision( + async fn get_creator_revision( &self, rev_id: String, expand: Option<String>, hide: Option<String>, context: &C, - ) -> Box<dyn Future<Item = GetCreatorRevisionResponse, Error = ApiError> + Send> { + ) -> Result<GetCreatorRevisionResponse, ApiError> { let context = context.clone(); info!( "get_creator_revision(\"{}\", {:?}, {:?}) - X-Span-ID: {:?}", @@ -875,29 +868,29 @@ where hide, context.get().0.clone() ); - Box::new(future::err("Generic failure".into())) + Err("Generic failuare".into()) } - fn get_editgroup( + async fn get_editgroup( &self, editgroup_id: String, context: &C, - ) -> Box<dyn Future<Item = GetEditgroupResponse, Error = ApiError> + Send> { + ) -> Result<GetEditgroupResponse, ApiError> { let context = context.clone(); info!( "get_editgroup(\"{}\") - X-Span-ID: {:?}", editgroup_id, context.get().0.clone() ); - Box::new(future::err("Generic failure".into())) + Err("Generic failuare".into()) } - fn get_editgroup_annotations( + async fn get_editgroup_annotations( &self, editgroup_id: String, expand: Option<String>, context: &C, - ) -> Box<dyn Future<Item = GetEditgroupAnnotationsResponse, Error = ApiError> + Send> { + ) -> Result<GetEditgroupAnnotationsResponse, ApiError> { let context = context.clone(); info!( "get_editgroup_annotations(\"{}\", {:?}) - X-Span-ID: {:?}", @@ -905,17 +898,17 @@ where expand, context.get().0.clone() ); - Box::new(future::err("Generic failure".into())) + Err("Generic failuare".into()) } - fn get_editgroups_reviewable( + async fn get_editgroups_reviewable( &self, expand: Option<String>, limit: Option<i64>, before: Option<chrono::DateTime<chrono::Utc>>, since: Option<chrono::DateTime<chrono::Utc>>, context: &C, - ) -> Box<dyn Future<Item = GetEditgroupsReviewableResponse, Error = ApiError> + Send> { + ) -> Result<GetEditgroupsReviewableResponse, ApiError> { let context = context.clone(); info!( "get_editgroups_reviewable({:?}, {:?}, {:?}, {:?}) - X-Span-ID: {:?}", @@ -925,31 +918,31 @@ where since, context.get().0.clone() ); - Box::new(future::err("Generic failure".into())) + Err("Generic failuare".into()) } - fn get_editor( + async fn get_editor( &self, editor_id: String, context: &C, - ) -> Box<dyn Future<Item = GetEditorResponse, Error = ApiError> + Send> { + ) -> Result<GetEditorResponse, ApiError> { let context = context.clone(); info!( "get_editor(\"{}\") - X-Span-ID: {:?}", editor_id, context.get().0.clone() ); - Box::new(future::err("Generic failure".into())) + Err("Generic failuare".into()) } - fn get_editor_annotations( + async fn get_editor_annotations( &self, editor_id: String, limit: Option<i64>, before: Option<chrono::DateTime<chrono::Utc>>, since: Option<chrono::DateTime<chrono::Utc>>, context: &C, - ) -> Box<dyn Future<Item = GetEditorAnnotationsResponse, Error = ApiError> + Send> { + ) -> Result<GetEditorAnnotationsResponse, ApiError> { let context = context.clone(); info!( "get_editor_annotations(\"{}\", {:?}, {:?}, {:?}) - X-Span-ID: {:?}", @@ -959,17 +952,17 @@ where since, context.get().0.clone() ); - Box::new(future::err("Generic failure".into())) + Err("Generic failuare".into()) } - fn get_editor_editgroups( + async fn get_editor_editgroups( &self, editor_id: String, limit: Option<i64>, before: Option<chrono::DateTime<chrono::Utc>>, since: Option<chrono::DateTime<chrono::Utc>>, context: &C, - ) -> Box<dyn Future<Item = GetEditorEditgroupsResponse, Error = ApiError> + Send> { + ) -> Result<GetEditorEditgroupsResponse, ApiError> { let context = context.clone(); info!( "get_editor_editgroups(\"{}\", {:?}, {:?}, {:?}) - X-Span-ID: {:?}", @@ -979,16 +972,16 @@ where since, context.get().0.clone() ); - Box::new(future::err("Generic failure".into())) + Err("Generic failuare".into()) } - fn get_file( + async fn get_file( &self, ident: String, expand: Option<String>, hide: Option<String>, context: &C, - ) -> Box<dyn Future<Item = GetFileResponse, Error = ApiError> + Send> { + ) -> Result<GetFileResponse, ApiError> { let context = context.clone(); info!( "get_file(\"{}\", {:?}, {:?}) - X-Span-ID: {:?}", @@ -997,29 +990,29 @@ where hide, context.get().0.clone() ); - Box::new(future::err("Generic failure".into())) + Err("Generic failuare".into()) } - fn get_file_edit( + async fn get_file_edit( &self, edit_id: String, context: &C, - ) -> Box<dyn Future<Item = GetFileEditResponse, Error = ApiError> + Send> { + ) -> Result<GetFileEditResponse, ApiError> { let context = context.clone(); info!( "get_file_edit(\"{}\") - X-Span-ID: {:?}", edit_id, context.get().0.clone() ); - Box::new(future::err("Generic failure".into())) + Err("Generic failuare".into()) } - fn get_file_history( + async fn get_file_history( &self, ident: String, limit: Option<i64>, context: &C, - ) -> Box<dyn Future<Item = GetFileHistoryResponse, Error = ApiError> + Send> { + ) -> Result<GetFileHistoryResponse, ApiError> { let context = context.clone(); info!( "get_file_history(\"{}\", {:?}) - X-Span-ID: {:?}", @@ -1027,30 +1020,30 @@ where limit, context.get().0.clone() ); - Box::new(future::err("Generic failure".into())) + Err("Generic failuare".into()) } - fn get_file_redirects( + async fn get_file_redirects( &self, ident: String, context: &C, - ) -> Box<dyn Future<Item = GetFileRedirectsResponse, Error = ApiError> + Send> { + ) -> Result<GetFileRedirectsResponse, ApiError> { let context = context.clone(); info!( "get_file_redirects(\"{}\") - X-Span-ID: {:?}", ident, context.get().0.clone() ); - Box::new(future::err("Generic failure".into())) + Err("Generic failuare".into()) } - fn get_file_revision( + async fn get_file_revision( &self, rev_id: String, expand: Option<String>, hide: Option<String>, context: &C, - ) -> Box<dyn Future<Item = GetFileRevisionResponse, Error = ApiError> + Send> { + ) -> Result<GetFileRevisionResponse, ApiError> { let context = context.clone(); info!( "get_file_revision(\"{}\", {:?}, {:?}) - X-Span-ID: {:?}", @@ -1059,16 +1052,16 @@ where hide, context.get().0.clone() ); - Box::new(future::err("Generic failure".into())) + Err("Generic failuare".into()) } - fn get_fileset( + async fn get_fileset( &self, ident: String, expand: Option<String>, hide: Option<String>, context: &C, - ) -> Box<dyn Future<Item = GetFilesetResponse, Error = ApiError> + Send> { + ) -> Result<GetFilesetResponse, ApiError> { let context = context.clone(); info!( "get_fileset(\"{}\", {:?}, {:?}) - X-Span-ID: {:?}", @@ -1077,29 +1070,29 @@ where hide, context.get().0.clone() ); - Box::new(future::err("Generic failure".into())) + Err("Generic failuare".into()) } - fn get_fileset_edit( + async fn get_fileset_edit( &self, edit_id: String, context: &C, - ) -> Box<dyn Future<Item = GetFilesetEditResponse, Error = ApiError> + Send> { + ) -> Result<GetFilesetEditResponse, ApiError> { let context = context.clone(); info!( "get_fileset_edit(\"{}\") - X-Span-ID: {:?}", edit_id, context.get().0.clone() ); - Box::new(future::err("Generic failure".into())) + Err("Generic failuare".into()) } - fn get_fileset_history( + async fn get_fileset_history( &self, ident: String, limit: Option<i64>, context: &C, - ) -> Box<dyn Future<Item = GetFilesetHistoryResponse, Error = ApiError> + Send> { + ) -> Result<GetFilesetHistoryResponse, ApiError> { let context = context.clone(); info!( "get_fileset_history(\"{}\", {:?}) - X-Span-ID: {:?}", @@ -1107,30 +1100,30 @@ where limit, context.get().0.clone() ); - Box::new(future::err("Generic failure".into())) + Err("Generic failuare".into()) } - fn get_fileset_redirects( + async fn get_fileset_redirects( &self, ident: String, context: &C, - ) -> Box<dyn Future<Item = GetFilesetRedirectsResponse, Error = ApiError> + Send> { + ) -> Result<GetFilesetRedirectsResponse, ApiError> { let context = context.clone(); info!( "get_fileset_redirects(\"{}\") - X-Span-ID: {:?}", ident, context.get().0.clone() ); - Box::new(future::err("Generic failure".into())) + Err("Generic failuare".into()) } - fn get_fileset_revision( + async fn get_fileset_revision( &self, rev_id: String, expand: Option<String>, hide: Option<String>, context: &C, - ) -> Box<dyn Future<Item = GetFilesetRevisionResponse, Error = ApiError> + Send> { + ) -> Result<GetFilesetRevisionResponse, ApiError> { let context = context.clone(); info!( "get_fileset_revision(\"{}\", {:?}, {:?}) - X-Span-ID: {:?}", @@ -1139,16 +1132,16 @@ where hide, context.get().0.clone() ); - Box::new(future::err("Generic failure".into())) + Err("Generic failuare".into()) } - fn get_release( + async fn get_release( &self, ident: String, expand: Option<String>, hide: Option<String>, context: &C, - ) -> Box<dyn Future<Item = GetReleaseResponse, Error = ApiError> + Send> { + ) -> Result<GetReleaseResponse, ApiError> { let context = context.clone(); info!( "get_release(\"{}\", {:?}, {:?}) - X-Span-ID: {:?}", @@ -1157,29 +1150,29 @@ where hide, context.get().0.clone() ); - Box::new(future::err("Generic failure".into())) + Err("Generic failuare".into()) } - fn get_release_edit( + async fn get_release_edit( &self, edit_id: String, context: &C, - ) -> Box<dyn Future<Item = GetReleaseEditResponse, Error = ApiError> + Send> { + ) -> Result<GetReleaseEditResponse, ApiError> { let context = context.clone(); info!( "get_release_edit(\"{}\") - X-Span-ID: {:?}", edit_id, context.get().0.clone() ); - Box::new(future::err("Generic failure".into())) + Err("Generic failuare".into()) } - fn get_release_files( + async fn get_release_files( &self, ident: String, hide: Option<String>, context: &C, - ) -> Box<dyn Future<Item = GetReleaseFilesResponse, Error = ApiError> + Send> { + ) -> Result<GetReleaseFilesResponse, ApiError> { let context = context.clone(); info!( "get_release_files(\"{}\", {:?}) - X-Span-ID: {:?}", @@ -1187,15 +1180,15 @@ where hide, context.get().0.clone() ); - Box::new(future::err("Generic failure".into())) + Err("Generic failuare".into()) } - fn get_release_filesets( + async fn get_release_filesets( &self, ident: String, hide: Option<String>, context: &C, - ) -> Box<dyn Future<Item = GetReleaseFilesetsResponse, Error = ApiError> + Send> { + ) -> Result<GetReleaseFilesetsResponse, ApiError> { let context = context.clone(); info!( "get_release_filesets(\"{}\", {:?}) - X-Span-ID: {:?}", @@ -1203,15 +1196,15 @@ where hide, context.get().0.clone() ); - Box::new(future::err("Generic failure".into())) + Err("Generic failuare".into()) } - fn get_release_history( + async fn get_release_history( &self, ident: String, limit: Option<i64>, context: &C, - ) -> Box<dyn Future<Item = GetReleaseHistoryResponse, Error = ApiError> + Send> { + ) -> Result<GetReleaseHistoryResponse, ApiError> { let context = context.clone(); info!( "get_release_history(\"{}\", {:?}) - X-Span-ID: {:?}", @@ -1219,30 +1212,30 @@ where limit, context.get().0.clone() ); - Box::new(future::err("Generic failure".into())) + Err("Generic failuare".into()) } - fn get_release_redirects( + async fn get_release_redirects( &self, ident: String, context: &C, - ) -> Box<dyn Future<Item = GetReleaseRedirectsResponse, Error = ApiError> + Send> { + ) -> Result<GetReleaseRedirectsResponse, ApiError> { let context = context.clone(); info!( "get_release_redirects(\"{}\") - X-Span-ID: {:?}", ident, context.get().0.clone() ); - Box::new(future::err("Generic failure".into())) + Err("Generic failuare".into()) } - fn get_release_revision( + async fn get_release_revision( &self, rev_id: String, expand: Option<String>, hide: Option<String>, context: &C, - ) -> Box<dyn Future<Item = GetReleaseRevisionResponse, Error = ApiError> + Send> { + ) -> Result<GetReleaseRevisionResponse, ApiError> { let context = context.clone(); info!( "get_release_revision(\"{}\", {:?}, {:?}) - X-Span-ID: {:?}", @@ -1251,15 +1244,15 @@ where hide, context.get().0.clone() ); - Box::new(future::err("Generic failure".into())) + Err("Generic failuare".into()) } - fn get_release_webcaptures( + async fn get_release_webcaptures( &self, ident: String, hide: Option<String>, context: &C, - ) -> Box<dyn Future<Item = GetReleaseWebcapturesResponse, Error = ApiError> + Send> { + ) -> Result<GetReleaseWebcapturesResponse, ApiError> { let context = context.clone(); info!( "get_release_webcaptures(\"{}\", {:?}) - X-Span-ID: {:?}", @@ -1267,16 +1260,16 @@ where hide, context.get().0.clone() ); - Box::new(future::err("Generic failure".into())) + Err("Generic failuare".into()) } - fn get_webcapture( + async fn get_webcapture( &self, ident: String, expand: Option<String>, hide: Option<String>, context: &C, - ) -> Box<dyn Future<Item = GetWebcaptureResponse, Error = ApiError> + Send> { + ) -> Result<GetWebcaptureResponse, ApiError> { let context = context.clone(); info!( "get_webcapture(\"{}\", {:?}, {:?}) - X-Span-ID: {:?}", @@ -1285,29 +1278,29 @@ where hide, context.get().0.clone() ); - Box::new(future::err("Generic failure".into())) + Err("Generic failuare".into()) } - fn get_webcapture_edit( + async fn get_webcapture_edit( &self, edit_id: String, context: &C, - ) -> Box<dyn Future<Item = GetWebcaptureEditResponse, Error = ApiError> + Send> { + ) -> Result<GetWebcaptureEditResponse, ApiError> { let context = context.clone(); info!( "get_webcapture_edit(\"{}\") - X-Span-ID: {:?}", edit_id, context.get().0.clone() ); - Box::new(future::err("Generic failure".into())) + Err("Generic failuare".into()) } - fn get_webcapture_history( + async fn get_webcapture_history( &self, ident: String, limit: Option<i64>, context: &C, - ) -> Box<dyn Future<Item = GetWebcaptureHistoryResponse, Error = ApiError> + Send> { + ) -> Result<GetWebcaptureHistoryResponse, ApiError> { let context = context.clone(); info!( "get_webcapture_history(\"{}\", {:?}) - X-Span-ID: {:?}", @@ -1315,30 +1308,30 @@ where limit, context.get().0.clone() ); - Box::new(future::err("Generic failure".into())) + Err("Generic failuare".into()) } - fn get_webcapture_redirects( + async fn get_webcapture_redirects( &self, ident: String, context: &C, - ) -> Box<dyn Future<Item = GetWebcaptureRedirectsResponse, Error = ApiError> + Send> { + ) -> Result<GetWebcaptureRedirectsResponse, ApiError> { let context = context.clone(); info!( "get_webcapture_redirects(\"{}\") - X-Span-ID: {:?}", ident, context.get().0.clone() ); - Box::new(future::err("Generic failure".into())) + Err("Generic failuare".into()) } - fn get_webcapture_revision( + async fn get_webcapture_revision( &self, rev_id: String, expand: Option<String>, hide: Option<String>, context: &C, - ) -> Box<dyn Future<Item = GetWebcaptureRevisionResponse, Error = ApiError> + Send> { + ) -> Result<GetWebcaptureRevisionResponse, ApiError> { let context = context.clone(); info!( "get_webcapture_revision(\"{}\", {:?}, {:?}) - X-Span-ID: {:?}", @@ -1347,16 +1340,16 @@ where hide, context.get().0.clone() ); - Box::new(future::err("Generic failure".into())) + Err("Generic failuare".into()) } - fn get_work( + async fn get_work( &self, ident: String, expand: Option<String>, hide: Option<String>, context: &C, - ) -> Box<dyn Future<Item = GetWorkResponse, Error = ApiError> + Send> { + ) -> Result<GetWorkResponse, ApiError> { let context = context.clone(); info!( "get_work(\"{}\", {:?}, {:?}) - X-Span-ID: {:?}", @@ -1365,29 +1358,29 @@ where hide, context.get().0.clone() ); - Box::new(future::err("Generic failure".into())) + Err("Generic failuare".into()) } - fn get_work_edit( + async fn get_work_edit( &self, edit_id: String, context: &C, - ) -> Box<dyn Future<Item = GetWorkEditResponse, Error = ApiError> + Send> { + ) -> Result<GetWorkEditResponse, ApiError> { let context = context.clone(); info!( "get_work_edit(\"{}\") - X-Span-ID: {:?}", edit_id, context.get().0.clone() ); - Box::new(future::err("Generic failure".into())) + Err("Generic failuare".into()) } - fn get_work_history( + async fn get_work_history( &self, ident: String, limit: Option<i64>, context: &C, - ) -> Box<dyn Future<Item = GetWorkHistoryResponse, Error = ApiError> + Send> { + ) -> Result<GetWorkHistoryResponse, ApiError> { let context = context.clone(); info!( "get_work_history(\"{}\", {:?}) - X-Span-ID: {:?}", @@ -1395,29 +1388,29 @@ where limit, context.get().0.clone() ); - Box::new(future::err("Generic failure".into())) + Err("Generic failuare".into()) } - fn get_work_redirects( + async fn get_work_redirects( &self, ident: String, context: &C, - ) -> Box<dyn Future<Item = GetWorkRedirectsResponse, Error = ApiError> + Send> { + ) -> Result<GetWorkRedirectsResponse, ApiError> { let context = context.clone(); info!( "get_work_redirects(\"{}\") - X-Span-ID: {:?}", ident, context.get().0.clone() ); - Box::new(future::err("Generic failure".into())) + Err("Generic failuare".into()) } - fn get_work_releases( + async fn get_work_releases( &self, ident: String, hide: Option<String>, context: &C, - ) -> Box<dyn Future<Item = GetWorkReleasesResponse, Error = ApiError> + Send> { + ) -> Result<GetWorkReleasesResponse, ApiError> { let context = context.clone(); info!( "get_work_releases(\"{}\", {:?}) - X-Span-ID: {:?}", @@ -1425,16 +1418,16 @@ where hide, context.get().0.clone() ); - Box::new(future::err("Generic failure".into())) + Err("Generic failuare".into()) } - fn get_work_revision( + async fn get_work_revision( &self, rev_id: String, expand: Option<String>, hide: Option<String>, context: &C, - ) -> Box<dyn Future<Item = GetWorkRevisionResponse, Error = ApiError> + Send> { + ) -> Result<GetWorkRevisionResponse, ApiError> { let context = context.clone(); info!( "get_work_revision(\"{}\", {:?}, {:?}) - X-Span-ID: {:?}", @@ -1443,17 +1436,17 @@ where hide, context.get().0.clone() ); - Box::new(future::err("Generic failure".into())) + Err("Generic failuare".into()) } - fn lookup_container( + async fn lookup_container( &self, issnl: Option<String>, wikidata_qid: Option<String>, expand: Option<String>, hide: Option<String>, context: &C, - ) -> Box<dyn Future<Item = LookupContainerResponse, Error = ApiError> + Send> { + ) -> Result<LookupContainerResponse, ApiError> { let context = context.clone(); info!( "lookup_container({:?}, {:?}, {:?}, {:?}) - X-Span-ID: {:?}", @@ -1463,17 +1456,17 @@ where hide, context.get().0.clone() ); - Box::new(future::err("Generic failure".into())) + Err("Generic failuare".into()) } - fn lookup_creator( + async fn lookup_creator( &self, orcid: Option<String>, wikidata_qid: Option<String>, expand: Option<String>, hide: Option<String>, context: &C, - ) -> Box<dyn Future<Item = LookupCreatorResponse, Error = ApiError> + Send> { + ) -> Result<LookupCreatorResponse, ApiError> { let context = context.clone(); info!( "lookup_creator({:?}, {:?}, {:?}, {:?}) - X-Span-ID: {:?}", @@ -1483,10 +1476,10 @@ where hide, context.get().0.clone() ); - Box::new(future::err("Generic failure".into())) + Err("Generic failuare".into()) } - fn lookup_file( + async fn lookup_file( &self, md5: Option<String>, sha1: Option<String>, @@ -1494,7 +1487,7 @@ where expand: Option<String>, hide: Option<String>, context: &C, - ) -> Box<dyn Future<Item = LookupFileResponse, Error = ApiError> + Send> { + ) -> Result<LookupFileResponse, ApiError> { let context = context.clone(); info!( "lookup_file({:?}, {:?}, {:?}, {:?}, {:?}) - X-Span-ID: {:?}", @@ -1505,10 +1498,10 @@ where hide, context.get().0.clone() ); - Box::new(future::err("Generic failure".into())) + Err("Generic failuare".into()) } - fn lookup_release( + async fn lookup_release( &self, doi: Option<String>, wikidata_qid: Option<String>, @@ -1520,22 +1513,25 @@ where jstor: Option<String>, ark: Option<String>, mag: Option<String>, + doaj: Option<String>, + dblp: Option<String>, + oai: Option<String>, expand: Option<String>, hide: Option<String>, context: &C, - ) -> Box<dyn Future<Item = LookupReleaseResponse, Error = ApiError> + Send> { + ) -> Result<LookupReleaseResponse, ApiError> { let context = context.clone(); - info!("lookup_release({:?}, {:?}, {:?}, {:?}, {:?}, {:?}, {:?}, {:?}, {:?}, {:?}, {:?}, {:?}) - X-Span-ID: {:?}", doi, wikidata_qid, isbn13, pmid, pmcid, core, arxiv, jstor, ark, mag, expand, hide, context.get().0.clone()); - Box::new(future::err("Generic failure".into())) + info!("lookup_release({:?}, {:?}, {:?}, {:?}, {:?}, {:?}, {:?}, {:?}, {:?}, {:?}, {:?}, {:?}, {:?}, {:?}, {:?}) - X-Span-ID: {:?}", doi, wikidata_qid, isbn13, pmid, pmcid, core, arxiv, jstor, ark, mag, doaj, dblp, oai, expand, hide, context.get().0.clone()); + Err("Generic failuare".into()) } - fn update_container( + async fn update_container( &self, editgroup_id: String, ident: String, container_entity: models::ContainerEntity, context: &C, - ) -> Box<dyn Future<Item = UpdateContainerResponse, Error = ApiError> + Send> { + ) -> Result<UpdateContainerResponse, ApiError> { let context = context.clone(); info!( "update_container(\"{}\", \"{}\", {:?}) - X-Span-ID: {:?}", @@ -1544,16 +1540,16 @@ where container_entity, context.get().0.clone() ); - Box::new(future::err("Generic failure".into())) + Err("Generic failuare".into()) } - fn update_creator( + async fn update_creator( &self, editgroup_id: String, ident: String, creator_entity: models::CreatorEntity, context: &C, - ) -> Box<dyn Future<Item = UpdateCreatorResponse, Error = ApiError> + Send> { + ) -> Result<UpdateCreatorResponse, ApiError> { let context = context.clone(); info!( "update_creator(\"{}\", \"{}\", {:?}) - X-Span-ID: {:?}", @@ -1562,16 +1558,16 @@ where creator_entity, context.get().0.clone() ); - Box::new(future::err("Generic failure".into())) + Err("Generic failuare".into()) } - fn update_editgroup( + async fn update_editgroup( &self, editgroup_id: String, editgroup: models::Editgroup, submit: Option<bool>, context: &C, - ) -> Box<dyn Future<Item = UpdateEditgroupResponse, Error = ApiError> + Send> { + ) -> Result<UpdateEditgroupResponse, ApiError> { let context = context.clone(); info!( "update_editgroup(\"{}\", {:?}, {:?}) - X-Span-ID: {:?}", @@ -1580,15 +1576,15 @@ where submit, context.get().0.clone() ); - Box::new(future::err("Generic failure".into())) + Err("Generic failuare".into()) } - fn update_editor( + async fn update_editor( &self, editor_id: String, editor: models::Editor, context: &C, - ) -> Box<dyn Future<Item = UpdateEditorResponse, Error = ApiError> + Send> { + ) -> Result<UpdateEditorResponse, ApiError> { let context = context.clone(); info!( "update_editor(\"{}\", {:?}) - X-Span-ID: {:?}", @@ -1596,16 +1592,16 @@ where editor, context.get().0.clone() ); - Box::new(future::err("Generic failure".into())) + Err("Generic failuare".into()) } - fn update_file( + async fn update_file( &self, editgroup_id: String, ident: String, file_entity: models::FileEntity, context: &C, - ) -> Box<dyn Future<Item = UpdateFileResponse, Error = ApiError> + Send> { + ) -> Result<UpdateFileResponse, ApiError> { let context = context.clone(); info!( "update_file(\"{}\", \"{}\", {:?}) - X-Span-ID: {:?}", @@ -1614,16 +1610,16 @@ where file_entity, context.get().0.clone() ); - Box::new(future::err("Generic failure".into())) + Err("Generic failuare".into()) } - fn update_fileset( + async fn update_fileset( &self, editgroup_id: String, ident: String, fileset_entity: models::FilesetEntity, context: &C, - ) -> Box<dyn Future<Item = UpdateFilesetResponse, Error = ApiError> + Send> { + ) -> Result<UpdateFilesetResponse, ApiError> { let context = context.clone(); info!( "update_fileset(\"{}\", \"{}\", {:?}) - X-Span-ID: {:?}", @@ -1632,16 +1628,16 @@ where fileset_entity, context.get().0.clone() ); - Box::new(future::err("Generic failure".into())) + Err("Generic failuare".into()) } - fn update_release( + async fn update_release( &self, editgroup_id: String, ident: String, release_entity: models::ReleaseEntity, context: &C, - ) -> Box<dyn Future<Item = UpdateReleaseResponse, Error = ApiError> + Send> { + ) -> Result<UpdateReleaseResponse, ApiError> { let context = context.clone(); info!( "update_release(\"{}\", \"{}\", {:?}) - X-Span-ID: {:?}", @@ -1650,16 +1646,16 @@ where release_entity, context.get().0.clone() ); - Box::new(future::err("Generic failure".into())) + Err("Generic failuare".into()) } - fn update_webcapture( + async fn update_webcapture( &self, editgroup_id: String, ident: String, webcapture_entity: models::WebcaptureEntity, context: &C, - ) -> Box<dyn Future<Item = UpdateWebcaptureResponse, Error = ApiError> + Send> { + ) -> Result<UpdateWebcaptureResponse, ApiError> { let context = context.clone(); info!( "update_webcapture(\"{}\", \"{}\", {:?}) - X-Span-ID: {:?}", @@ -1668,16 +1664,16 @@ where webcapture_entity, context.get().0.clone() ); - Box::new(future::err("Generic failure".into())) + Err("Generic failuare".into()) } - fn update_work( + async fn update_work( &self, editgroup_id: String, ident: String, work_entity: models::WorkEntity, context: &C, - ) -> Box<dyn Future<Item = UpdateWorkResponse, Error = ApiError> + Send> { + ) -> Result<UpdateWorkResponse, ApiError> { let context = context.clone(); info!( "update_work(\"{}\", \"{}\", {:?}) - X-Span-ID: {:?}", @@ -1686,6 +1682,6 @@ where work_entity, context.get().0.clone() ); - Box::new(future::err("Generic failure".into())) + Err("Generic failuare".into()) } } |