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/src/lib.rs | |
parent | 119835ea0cf68f0003299cb3e285ae7d8d744af4 (diff) | |
download | fatcat-cli-b8991aed0f4c9f58daad1865a3873fc31bdc96bd.tar.gz fatcat-cli-b8991aed0f4c9f58daad1865a3873fc31bdc96bd.zip |
re-codegen openapi stuff
Diffstat (limited to 'rust/fatcat-openapi/src/lib.rs')
-rw-r--r-- | rust/fatcat-openapi/src/lib.rs | 1700 |
1 files changed, 907 insertions, 793 deletions
diff --git a/rust/fatcat-openapi/src/lib.rs b/rust/fatcat-openapi/src/lib.rs index 1438bdf..ba49f27 100644 --- a/rust/fatcat-openapi/src/lib.rs +++ b/rust/fatcat-openapi/src/lib.rs @@ -8,16 +8,16 @@ non_camel_case_types )] +use async_trait::async_trait; use futures::Stream; -use std::io::Error; +use std::error::Error; +use std::task::{Context, Poll}; +use swagger::{ApiError, ContextWrapper}; -#[deprecated(note = "Import futures directly")] -pub use futures::Future; -#[deprecated(note = "Import swagger-rs directly")] -pub use swagger::{ApiError, ContextWrapper}; +type ServiceError = Box<dyn Error + Send + Sync + 'static>; pub const BASE_PATH: &'static str = "/v0"; -pub const API_VERSION: &'static str = "0.3.1"; +pub const API_VERSION: &'static str = "0.3.3"; #[derive(Debug, PartialEq)] #[must_use] @@ -29,7 +29,7 @@ pub enum AcceptEditgroupResponse { /// Not Authorized NotAuthorized { body: models::ErrorResponse, - www_authenticate: String, + www_authenticate: Option<String>, }, /// Forbidden Forbidden(models::ErrorResponse), @@ -51,7 +51,7 @@ pub enum AuthCheckResponse { /// Not Authorized NotAuthorized { body: models::ErrorResponse, - www_authenticate: String, + www_authenticate: Option<String>, }, /// Forbidden Forbidden(models::ErrorResponse), @@ -71,7 +71,7 @@ pub enum AuthOidcResponse { /// Not Authorized NotAuthorized { body: models::ErrorResponse, - www_authenticate: String, + www_authenticate: Option<String>, }, /// Forbidden Forbidden(models::ErrorResponse), @@ -91,7 +91,7 @@ pub enum CreateAuthTokenResponse { /// Not Authorized NotAuthorized { body: models::ErrorResponse, - www_authenticate: String, + www_authenticate: Option<String>, }, /// Forbidden Forbidden(models::ErrorResponse), @@ -109,7 +109,7 @@ pub enum CreateContainerResponse { /// Not Authorized NotAuthorized { body: models::ErrorResponse, - www_authenticate: String, + www_authenticate: Option<String>, }, /// Forbidden Forbidden(models::ErrorResponse), @@ -129,7 +129,7 @@ pub enum CreateContainerAutoBatchResponse { /// Not Authorized NotAuthorized { body: models::ErrorResponse, - www_authenticate: String, + www_authenticate: Option<String>, }, /// Forbidden Forbidden(models::ErrorResponse), @@ -149,7 +149,7 @@ pub enum CreateCreatorResponse { /// Not Authorized NotAuthorized { body: models::ErrorResponse, - www_authenticate: String, + www_authenticate: Option<String>, }, /// Forbidden Forbidden(models::ErrorResponse), @@ -169,7 +169,7 @@ pub enum CreateCreatorAutoBatchResponse { /// Not Authorized NotAuthorized { body: models::ErrorResponse, - www_authenticate: String, + www_authenticate: Option<String>, }, /// Forbidden Forbidden(models::ErrorResponse), @@ -189,7 +189,7 @@ pub enum CreateEditgroupResponse { /// Not Authorized NotAuthorized { body: models::ErrorResponse, - www_authenticate: String, + www_authenticate: Option<String>, }, /// Forbidden Forbidden(models::ErrorResponse), @@ -209,7 +209,7 @@ pub enum CreateEditgroupAnnotationResponse { /// Not Authorized NotAuthorized { body: models::ErrorResponse, - www_authenticate: String, + www_authenticate: Option<String>, }, /// Forbidden Forbidden(models::ErrorResponse), @@ -229,7 +229,7 @@ pub enum CreateFileResponse { /// Not Authorized NotAuthorized { body: models::ErrorResponse, - www_authenticate: String, + www_authenticate: Option<String>, }, /// Forbidden Forbidden(models::ErrorResponse), @@ -249,7 +249,7 @@ pub enum CreateFileAutoBatchResponse { /// Not Authorized NotAuthorized { body: models::ErrorResponse, - www_authenticate: String, + www_authenticate: Option<String>, }, /// Forbidden Forbidden(models::ErrorResponse), @@ -269,7 +269,7 @@ pub enum CreateFilesetResponse { /// Not Authorized NotAuthorized { body: models::ErrorResponse, - www_authenticate: String, + www_authenticate: Option<String>, }, /// Forbidden Forbidden(models::ErrorResponse), @@ -289,7 +289,7 @@ pub enum CreateFilesetAutoBatchResponse { /// Not Authorized NotAuthorized { body: models::ErrorResponse, - www_authenticate: String, + www_authenticate: Option<String>, }, /// Forbidden Forbidden(models::ErrorResponse), @@ -309,7 +309,7 @@ pub enum CreateReleaseResponse { /// Not Authorized NotAuthorized { body: models::ErrorResponse, - www_authenticate: String, + www_authenticate: Option<String>, }, /// Forbidden Forbidden(models::ErrorResponse), @@ -329,7 +329,7 @@ pub enum CreateReleaseAutoBatchResponse { /// Not Authorized NotAuthorized { body: models::ErrorResponse, - www_authenticate: String, + www_authenticate: Option<String>, }, /// Forbidden Forbidden(models::ErrorResponse), @@ -349,7 +349,7 @@ pub enum CreateWebcaptureResponse { /// Not Authorized NotAuthorized { body: models::ErrorResponse, - www_authenticate: String, + www_authenticate: Option<String>, }, /// Forbidden Forbidden(models::ErrorResponse), @@ -369,7 +369,7 @@ pub enum CreateWebcaptureAutoBatchResponse { /// Not Authorized NotAuthorized { body: models::ErrorResponse, - www_authenticate: String, + www_authenticate: Option<String>, }, /// Forbidden Forbidden(models::ErrorResponse), @@ -389,7 +389,7 @@ pub enum CreateWorkResponse { /// Not Authorized NotAuthorized { body: models::ErrorResponse, - www_authenticate: String, + www_authenticate: Option<String>, }, /// Forbidden Forbidden(models::ErrorResponse), @@ -409,7 +409,7 @@ pub enum CreateWorkAutoBatchResponse { /// Not Authorized NotAuthorized { body: models::ErrorResponse, - www_authenticate: String, + www_authenticate: Option<String>, }, /// Forbidden Forbidden(models::ErrorResponse), @@ -429,7 +429,7 @@ pub enum DeleteContainerResponse { /// Not Authorized NotAuthorized { body: models::ErrorResponse, - www_authenticate: String, + www_authenticate: Option<String>, }, /// Forbidden Forbidden(models::ErrorResponse), @@ -449,7 +449,7 @@ pub enum DeleteContainerEditResponse { /// Not Authorized NotAuthorized { body: models::ErrorResponse, - www_authenticate: String, + www_authenticate: Option<String>, }, /// Forbidden Forbidden(models::ErrorResponse), @@ -469,7 +469,7 @@ pub enum DeleteCreatorResponse { /// Not Authorized NotAuthorized { body: models::ErrorResponse, - www_authenticate: String, + www_authenticate: Option<String>, }, /// Forbidden Forbidden(models::ErrorResponse), @@ -489,7 +489,7 @@ pub enum DeleteCreatorEditResponse { /// Not Authorized NotAuthorized { body: models::ErrorResponse, - www_authenticate: String, + www_authenticate: Option<String>, }, /// Forbidden Forbidden(models::ErrorResponse), @@ -509,7 +509,7 @@ pub enum DeleteFileResponse { /// Not Authorized NotAuthorized { body: models::ErrorResponse, - www_authenticate: String, + www_authenticate: Option<String>, }, /// Forbidden Forbidden(models::ErrorResponse), @@ -529,7 +529,7 @@ pub enum DeleteFileEditResponse { /// Not Authorized NotAuthorized { body: models::ErrorResponse, - www_authenticate: String, + www_authenticate: Option<String>, }, /// Forbidden Forbidden(models::ErrorResponse), @@ -549,7 +549,7 @@ pub enum DeleteFilesetResponse { /// Not Authorized NotAuthorized { body: models::ErrorResponse, - www_authenticate: String, + www_authenticate: Option<String>, }, /// Forbidden Forbidden(models::ErrorResponse), @@ -569,7 +569,7 @@ pub enum DeleteFilesetEditResponse { /// Not Authorized NotAuthorized { body: models::ErrorResponse, - www_authenticate: String, + www_authenticate: Option<String>, }, /// Forbidden Forbidden(models::ErrorResponse), @@ -589,7 +589,7 @@ pub enum DeleteReleaseResponse { /// Not Authorized NotAuthorized { body: models::ErrorResponse, - www_authenticate: String, + www_authenticate: Option<String>, }, /// Forbidden Forbidden(models::ErrorResponse), @@ -609,7 +609,7 @@ pub enum DeleteReleaseEditResponse { /// Not Authorized NotAuthorized { body: models::ErrorResponse, - www_authenticate: String, + www_authenticate: Option<String>, }, /// Forbidden Forbidden(models::ErrorResponse), @@ -629,7 +629,7 @@ pub enum DeleteWebcaptureResponse { /// Not Authorized NotAuthorized { body: models::ErrorResponse, - www_authenticate: String, + www_authenticate: Option<String>, }, /// Forbidden Forbidden(models::ErrorResponse), @@ -649,7 +649,7 @@ pub enum DeleteWebcaptureEditResponse { /// Not Authorized NotAuthorized { body: models::ErrorResponse, - www_authenticate: String, + www_authenticate: Option<String>, }, /// Forbidden Forbidden(models::ErrorResponse), @@ -669,7 +669,7 @@ pub enum DeleteWorkResponse { /// Not Authorized NotAuthorized { body: models::ErrorResponse, - www_authenticate: String, + www_authenticate: Option<String>, }, /// Forbidden Forbidden(models::ErrorResponse), @@ -689,7 +689,7 @@ pub enum DeleteWorkEditResponse { /// Not Authorized NotAuthorized { body: models::ErrorResponse, - www_authenticate: String, + www_authenticate: Option<String>, }, /// Forbidden Forbidden(models::ErrorResponse), @@ -889,7 +889,7 @@ pub enum GetEditgroupAnnotationsResponse { /// Not Authorized NotAuthorized { body: models::ErrorResponse, - www_authenticate: String, + www_authenticate: Option<String>, }, /// Forbidden Forbidden(models::ErrorResponse), @@ -935,7 +935,7 @@ pub enum GetEditorAnnotationsResponse { /// Not Authorized NotAuthorized { body: models::ErrorResponse, - www_authenticate: String, + www_authenticate: Option<String>, }, /// Forbidden Forbidden(models::ErrorResponse), @@ -1397,7 +1397,7 @@ pub enum UpdateContainerResponse { /// Not Authorized NotAuthorized { body: models::ErrorResponse, - www_authenticate: String, + www_authenticate: Option<String>, }, /// Forbidden Forbidden(models::ErrorResponse), @@ -1417,7 +1417,7 @@ pub enum UpdateCreatorResponse { /// Not Authorized NotAuthorized { body: models::ErrorResponse, - www_authenticate: String, + www_authenticate: Option<String>, }, /// Forbidden Forbidden(models::ErrorResponse), @@ -1437,7 +1437,7 @@ pub enum UpdateEditgroupResponse { /// Not Authorized NotAuthorized { body: models::ErrorResponse, - www_authenticate: String, + www_authenticate: Option<String>, }, /// Forbidden Forbidden(models::ErrorResponse), @@ -1457,7 +1457,7 @@ pub enum UpdateEditorResponse { /// Not Authorized NotAuthorized { body: models::ErrorResponse, - www_authenticate: String, + www_authenticate: Option<String>, }, /// Forbidden Forbidden(models::ErrorResponse), @@ -1477,7 +1477,7 @@ pub enum UpdateFileResponse { /// Not Authorized NotAuthorized { body: models::ErrorResponse, - www_authenticate: String, + www_authenticate: Option<String>, }, /// Forbidden Forbidden(models::ErrorResponse), @@ -1497,7 +1497,7 @@ pub enum UpdateFilesetResponse { /// Not Authorized NotAuthorized { body: models::ErrorResponse, - www_authenticate: String, + www_authenticate: Option<String>, }, /// Forbidden Forbidden(models::ErrorResponse), @@ -1517,7 +1517,7 @@ pub enum UpdateReleaseResponse { /// Not Authorized NotAuthorized { body: models::ErrorResponse, - www_authenticate: String, + www_authenticate: Option<String>, }, /// Forbidden Forbidden(models::ErrorResponse), @@ -1537,7 +1537,7 @@ pub enum UpdateWebcaptureResponse { /// Not Authorized NotAuthorized { body: models::ErrorResponse, - www_authenticate: String, + www_authenticate: Option<String>, }, /// Forbidden Forbidden(models::ErrorResponse), @@ -1557,7 +1557,7 @@ pub enum UpdateWorkResponse { /// Not Authorized NotAuthorized { body: models::ErrorResponse, - www_authenticate: String, + www_authenticate: Option<String>, }, /// Forbidden Forbidden(models::ErrorResponse), @@ -1568,591 +1568,599 @@ pub enum UpdateWorkResponse { } /// API -pub trait Api<C> { - fn accept_editgroup( +#[async_trait] +pub trait Api<C: Send + Sync> { + fn poll_ready( + &self, + _cx: &mut Context, + ) -> Poll<Result<(), Box<dyn Error + Send + Sync + 'static>>> { + Poll::Ready(Ok(())) + } + + async fn accept_editgroup( &self, editgroup_id: String, context: &C, - ) -> Box<dyn Future<Item = AcceptEditgroupResponse, Error = ApiError> + Send>; + ) -> Result<AcceptEditgroupResponse, ApiError>; - fn auth_check( + async fn auth_check( &self, role: Option<String>, context: &C, - ) -> Box<dyn Future<Item = AuthCheckResponse, Error = ApiError> + Send>; + ) -> Result<AuthCheckResponse, ApiError>; - 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>; - 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>; - 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>; - 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>; - 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>; - 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>; - fn create_editgroup( + async fn create_editgroup( &self, editgroup: models::Editgroup, context: &C, - ) -> Box<dyn Future<Item = CreateEditgroupResponse, Error = ApiError> + Send>; + ) -> Result<CreateEditgroupResponse, ApiError>; - 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>; - 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>; - 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>; - 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>; - 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>; - 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>; - 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>; - 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>; - 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>; - 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>; - 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>; - 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>; - 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>; - 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>; - 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>; - 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>; - 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>; - 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>; - 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>; - 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>; - 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>; - 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>; - 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>; - 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>; - 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>; - fn get_changelog( + async fn get_changelog( &self, limit: Option<i64>, context: &C, - ) -> Box<dyn Future<Item = GetChangelogResponse, Error = ApiError> + Send>; + ) -> Result<GetChangelogResponse, ApiError>; - 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>; - 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>; - 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>; - 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>; - 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>; - 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>; - 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>; - 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>; - 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>; - 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>; - 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>; - 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>; - fn get_editgroup( + async fn get_editgroup( &self, editgroup_id: String, context: &C, - ) -> Box<dyn Future<Item = GetEditgroupResponse, Error = ApiError> + Send>; + ) -> Result<GetEditgroupResponse, ApiError>; - 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>; - 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>; - fn get_editor( + async fn get_editor( &self, editor_id: String, context: &C, - ) -> Box<dyn Future<Item = GetEditorResponse, Error = ApiError> + Send>; + ) -> Result<GetEditorResponse, ApiError>; - 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>; - 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>; - 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>; - 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>; - 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>; - 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>; - 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>; - 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>; - 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>; - 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>; - 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>; - 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>; - 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>; - 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>; - 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>; - 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>; - 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>; - 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>; - 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>; - 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>; - 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>; - 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>; - 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>; - 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>; - 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>; - 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>; - 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>; - 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>; - 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>; - 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>; - 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>; - 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>; - 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>; - fn lookup_file( + async fn lookup_file( &self, md5: Option<String>, sha1: Option<String>, @@ -2160,9 +2168,9 @@ pub trait Api<C> { expand: Option<String>, hide: Option<String>, context: &C, - ) -> Box<dyn Future<Item = LookupFileResponse, Error = ApiError> + Send>; + ) -> Result<LookupFileResponse, ApiError>; - fn lookup_release( + async fn lookup_release( &self, doi: Option<String>, wikidata_qid: Option<String>, @@ -2174,594 +2182,568 @@ pub trait Api<C> { 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>; - 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>; - 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>; - 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>; - 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>; - 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>; - 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>; - 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>; - 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>; - 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>; } -/// API without a `Context` -pub trait ApiNoContext { - fn accept_editgroup( +/// API where `Context` isn't passed on every API call +#[async_trait] +pub trait ApiNoContext<C: Send + Sync> { + fn poll_ready( &self, - editgroup_id: String, - ) -> Box<dyn Future<Item = AcceptEditgroupResponse, Error = ApiError> + Send>; + _cx: &mut Context, + ) -> Poll<Result<(), Box<dyn Error + Send + Sync + 'static>>>; - fn auth_check( - &self, - role: Option<String>, - ) -> Box<dyn Future<Item = AuthCheckResponse, Error = ApiError> + Send>; + fn context(&self) -> &C; - fn auth_oidc( + async fn accept_editgroup( &self, - auth_oidc: models::AuthOidc, - ) -> Box<dyn Future<Item = AuthOidcResponse, Error = ApiError> + Send>; + editgroup_id: String, + ) -> Result<AcceptEditgroupResponse, ApiError>; + + async fn auth_check(&self, role: Option<String>) -> Result<AuthCheckResponse, ApiError>; - fn create_auth_token( + async fn auth_oidc(&self, auth_oidc: models::AuthOidc) -> Result<AuthOidcResponse, ApiError>; + + async fn create_auth_token( &self, editor_id: String, duration_seconds: Option<i32>, - ) -> Box<dyn Future<Item = CreateAuthTokenResponse, Error = ApiError> + Send>; + ) -> Result<CreateAuthTokenResponse, ApiError>; - fn create_container( + async fn create_container( &self, editgroup_id: String, container_entity: models::ContainerEntity, - ) -> Box<dyn Future<Item = CreateContainerResponse, Error = ApiError> + Send>; + ) -> Result<CreateContainerResponse, ApiError>; - fn create_container_auto_batch( + async fn create_container_auto_batch( &self, container_auto_batch: models::ContainerAutoBatch, - ) -> Box<dyn Future<Item = CreateContainerAutoBatchResponse, Error = ApiError> + Send>; + ) -> Result<CreateContainerAutoBatchResponse, ApiError>; - fn create_creator( + async fn create_creator( &self, editgroup_id: String, creator_entity: models::CreatorEntity, - ) -> Box<dyn Future<Item = CreateCreatorResponse, Error = ApiError> + Send>; + ) -> Result<CreateCreatorResponse, ApiError>; - fn create_creator_auto_batch( + async fn create_creator_auto_batch( &self, creator_auto_batch: models::CreatorAutoBatch, - ) -> Box<dyn Future<Item = CreateCreatorAutoBatchResponse, Error = ApiError> + Send>; + ) -> Result<CreateCreatorAutoBatchResponse, ApiError>; - fn create_editgroup( + async fn create_editgroup( &self, editgroup: models::Editgroup, - ) -> Box<dyn Future<Item = CreateEditgroupResponse, Error = ApiError> + Send>; + ) -> Result<CreateEditgroupResponse, ApiError>; - fn create_editgroup_annotation( + async fn create_editgroup_annotation( &self, editgroup_id: String, editgroup_annotation: models::EditgroupAnnotation, - ) -> Box<dyn Future<Item = CreateEditgroupAnnotationResponse, Error = ApiError> + Send>; + ) -> Result<CreateEditgroupAnnotationResponse, ApiError>; - fn create_file( + async fn create_file( &self, editgroup_id: String, file_entity: models::FileEntity, - ) -> Box<dyn Future<Item = CreateFileResponse, Error = ApiError> + Send>; + ) -> Result<CreateFileResponse, ApiError>; - fn create_file_auto_batch( + async fn create_file_auto_batch( &self, file_auto_batch: models::FileAutoBatch, - ) -> Box<dyn Future<Item = CreateFileAutoBatchResponse, Error = ApiError> + Send>; + ) -> Result<CreateFileAutoBatchResponse, ApiError>; - fn create_fileset( + async fn create_fileset( &self, editgroup_id: String, fileset_entity: models::FilesetEntity, - ) -> Box<dyn Future<Item = CreateFilesetResponse, Error = ApiError> + Send>; + ) -> Result<CreateFilesetResponse, ApiError>; - fn create_fileset_auto_batch( + async fn create_fileset_auto_batch( &self, fileset_auto_batch: models::FilesetAutoBatch, - ) -> Box<dyn Future<Item = CreateFilesetAutoBatchResponse, Error = ApiError> + Send>; + ) -> Result<CreateFilesetAutoBatchResponse, ApiError>; - fn create_release( + async fn create_release( &self, editgroup_id: String, release_entity: models::ReleaseEntity, - ) -> Box<dyn Future<Item = CreateReleaseResponse, Error = ApiError> + Send>; + ) -> Result<CreateReleaseResponse, ApiError>; - fn create_release_auto_batch( + async fn create_release_auto_batch( &self, release_auto_batch: models::ReleaseAutoBatch, - ) -> Box<dyn Future<Item = CreateReleaseAutoBatchResponse, Error = ApiError> + Send>; + ) -> Result<CreateReleaseAutoBatchResponse, ApiError>; - fn create_webcapture( + async fn create_webcapture( &self, editgroup_id: String, webcapture_entity: models::WebcaptureEntity, - ) -> Box<dyn Future<Item = CreateWebcaptureResponse, Error = ApiError> + Send>; + ) -> Result<CreateWebcaptureResponse, ApiError>; - fn create_webcapture_auto_batch( + async fn create_webcapture_auto_batch( &self, webcapture_auto_batch: models::WebcaptureAutoBatch, - ) -> Box<dyn Future<Item = CreateWebcaptureAutoBatchResponse, Error = ApiError> + Send>; + ) -> Result<CreateWebcaptureAutoBatchResponse, ApiError>; - fn create_work( + async fn create_work( &self, editgroup_id: String, work_entity: models::WorkEntity, - ) -> Box<dyn Future<Item = CreateWorkResponse, Error = ApiError> + Send>; + ) -> Result<CreateWorkResponse, ApiError>; - fn create_work_auto_batch( + async fn create_work_auto_batch( &self, work_auto_batch: models::WorkAutoBatch, - ) -> Box<dyn Future<Item = CreateWorkAutoBatchResponse, Error = ApiError> + Send>; + ) -> Result<CreateWorkAutoBatchResponse, ApiError>; - fn delete_container( + async fn delete_container( &self, editgroup_id: String, ident: String, - ) -> Box<dyn Future<Item = DeleteContainerResponse, Error = ApiError> + Send>; + ) -> Result<DeleteContainerResponse, ApiError>; - fn delete_container_edit( + async fn delete_container_edit( &self, editgroup_id: String, edit_id: String, - ) -> Box<dyn Future<Item = DeleteContainerEditResponse, Error = ApiError> + Send>; + ) -> Result<DeleteContainerEditResponse, ApiError>; - fn delete_creator( + async fn delete_creator( &self, editgroup_id: String, ident: String, - ) -> Box<dyn Future<Item = DeleteCreatorResponse, Error = ApiError> + Send>; + ) -> Result<DeleteCreatorResponse, ApiError>; - fn delete_creator_edit( + async fn delete_creator_edit( &self, editgroup_id: String, edit_id: String, - ) -> Box<dyn Future<Item = DeleteCreatorEditResponse, Error = ApiError> + Send>; + ) -> Result<DeleteCreatorEditResponse, ApiError>; - fn delete_file( + async fn delete_file( &self, editgroup_id: String, ident: String, - ) -> Box<dyn Future<Item = DeleteFileResponse, Error = ApiError> + Send>; + ) -> Result<DeleteFileResponse, ApiError>; - fn delete_file_edit( + async fn delete_file_edit( &self, editgroup_id: String, edit_id: String, - ) -> Box<dyn Future<Item = DeleteFileEditResponse, Error = ApiError> + Send>; + ) -> Result<DeleteFileEditResponse, ApiError>; - fn delete_fileset( + async fn delete_fileset( &self, editgroup_id: String, ident: String, - ) -> Box<dyn Future<Item = DeleteFilesetResponse, Error = ApiError> + Send>; + ) -> Result<DeleteFilesetResponse, ApiError>; - fn delete_fileset_edit( + async fn delete_fileset_edit( &self, editgroup_id: String, edit_id: String, - ) -> Box<dyn Future<Item = DeleteFilesetEditResponse, Error = ApiError> + Send>; + ) -> Result<DeleteFilesetEditResponse, ApiError>; - fn delete_release( + async fn delete_release( &self, editgroup_id: String, ident: String, - ) -> Box<dyn Future<Item = DeleteReleaseResponse, Error = ApiError> + Send>; + ) -> Result<DeleteReleaseResponse, ApiError>; - fn delete_release_edit( + async fn delete_release_edit( &self, editgroup_id: String, edit_id: String, - ) -> Box<dyn Future<Item = DeleteReleaseEditResponse, Error = ApiError> + Send>; + ) -> Result<DeleteReleaseEditResponse, ApiError>; - fn delete_webcapture( + async fn delete_webcapture( &self, editgroup_id: String, ident: String, - ) -> Box<dyn Future<Item = DeleteWebcaptureResponse, Error = ApiError> + Send>; + ) -> Result<DeleteWebcaptureResponse, ApiError>; - fn delete_webcapture_edit( + async fn delete_webcapture_edit( &self, editgroup_id: String, edit_id: String, - ) -> Box<dyn Future<Item = DeleteWebcaptureEditResponse, Error = ApiError> + Send>; + ) -> Result<DeleteWebcaptureEditResponse, ApiError>; - fn delete_work( + async fn delete_work( &self, editgroup_id: String, ident: String, - ) -> Box<dyn Future<Item = DeleteWorkResponse, Error = ApiError> + Send>; + ) -> Result<DeleteWorkResponse, ApiError>; - fn delete_work_edit( + async fn delete_work_edit( &self, editgroup_id: String, edit_id: String, - ) -> Box<dyn Future<Item = DeleteWorkEditResponse, Error = ApiError> + Send>; + ) -> Result<DeleteWorkEditResponse, ApiError>; - fn get_changelog( - &self, - limit: Option<i64>, - ) -> Box<dyn Future<Item = GetChangelogResponse, Error = ApiError> + Send>; + async fn get_changelog(&self, limit: Option<i64>) -> Result<GetChangelogResponse, ApiError>; - fn get_changelog_entry( - &self, - index: i64, - ) -> Box<dyn Future<Item = GetChangelogEntryResponse, Error = ApiError> + Send>; + async fn get_changelog_entry(&self, index: i64) -> Result<GetChangelogEntryResponse, ApiError>; - fn get_container( + async fn get_container( &self, ident: String, expand: Option<String>, hide: Option<String>, - ) -> Box<dyn Future<Item = GetContainerResponse, Error = ApiError> + Send>; + ) -> Result<GetContainerResponse, ApiError>; - fn get_container_edit( + async fn get_container_edit( &self, edit_id: String, - ) -> Box<dyn Future<Item = GetContainerEditResponse, Error = ApiError> + Send>; + ) -> Result<GetContainerEditResponse, ApiError>; - fn get_container_history( + async fn get_container_history( &self, ident: String, limit: Option<i64>, - ) -> Box<dyn Future<Item = GetContainerHistoryResponse, Error = ApiError> + Send>; + ) -> Result<GetContainerHistoryResponse, ApiError>; - fn get_container_redirects( + async fn get_container_redirects( &self, ident: String, - ) -> Box<dyn Future<Item = GetContainerRedirectsResponse, Error = ApiError> + Send>; + ) -> Result<GetContainerRedirectsResponse, ApiError>; - fn get_container_revision( + async fn get_container_revision( &self, rev_id: String, expand: Option<String>, hide: Option<String>, - ) -> Box<dyn Future<Item = GetContainerRevisionResponse, Error = ApiError> + Send>; + ) -> Result<GetContainerRevisionResponse, ApiError>; - fn get_creator( + async fn get_creator( &self, ident: String, expand: Option<String>, hide: Option<String>, - ) -> Box<dyn Future<Item = GetCreatorResponse, Error = ApiError> + Send>; + ) -> Result<GetCreatorResponse, ApiError>; - fn get_creator_edit( - &self, - edit_id: String, - ) -> Box<dyn Future<Item = GetCreatorEditResponse, Error = ApiError> + Send>; + async fn get_creator_edit(&self, edit_id: String) -> Result<GetCreatorEditResponse, ApiError>; - fn get_creator_history( + async fn get_creator_history( &self, ident: String, limit: Option<i64>, - ) -> Box<dyn Future<Item = GetCreatorHistoryResponse, Error = ApiError> + Send>; + ) -> Result<GetCreatorHistoryResponse, ApiError>; - fn get_creator_redirects( + async fn get_creator_redirects( &self, ident: String, - ) -> Box<dyn Future<Item = GetCreatorRedirectsResponse, Error = ApiError> + Send>; + ) -> Result<GetCreatorRedirectsResponse, ApiError>; - fn get_creator_releases( + async fn get_creator_releases( &self, ident: String, hide: Option<String>, - ) -> Box<dyn Future<Item = GetCreatorReleasesResponse, Error = ApiError> + Send>; + ) -> Result<GetCreatorReleasesResponse, ApiError>; - fn get_creator_revision( + async fn get_creator_revision( &self, rev_id: String, expand: Option<String>, hide: Option<String>, - ) -> Box<dyn Future<Item = GetCreatorRevisionResponse, Error = ApiError> + Send>; + ) -> Result<GetCreatorRevisionResponse, ApiError>; - fn get_editgroup( - &self, - editgroup_id: String, - ) -> Box<dyn Future<Item = GetEditgroupResponse, Error = ApiError> + Send>; + async fn get_editgroup(&self, editgroup_id: String) -> Result<GetEditgroupResponse, ApiError>; - fn get_editgroup_annotations( + async fn get_editgroup_annotations( &self, editgroup_id: String, expand: Option<String>, - ) -> Box<dyn Future<Item = GetEditgroupAnnotationsResponse, Error = ApiError> + Send>; + ) -> Result<GetEditgroupAnnotationsResponse, ApiError>; - 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>>, - ) -> Box<dyn Future<Item = GetEditgroupsReviewableResponse, Error = ApiError> + Send>; + ) -> Result<GetEditgroupsReviewableResponse, ApiError>; - fn get_editor( - &self, - editor_id: String, - ) -> Box<dyn Future<Item = GetEditorResponse, Error = ApiError> + Send>; + async fn get_editor(&self, editor_id: String) -> Result<GetEditorResponse, ApiError>; - 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>>, - ) -> Box<dyn Future<Item = GetEditorAnnotationsResponse, Error = ApiError> + Send>; + ) -> Result<GetEditorAnnotationsResponse, ApiError>; - 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>>, - ) -> Box<dyn Future<Item = GetEditorEditgroupsResponse, Error = ApiError> + Send>; + ) -> Result<GetEditorEditgroupsResponse, ApiError>; - fn get_file( + async fn get_file( &self, ident: String, expand: Option<String>, hide: Option<String>, - ) -> Box<dyn Future<Item = GetFileResponse, Error = ApiError> + Send>; + ) -> Result<GetFileResponse, ApiError>; - fn get_file_edit( - &self, - edit_id: String, - ) -> Box<dyn Future<Item = GetFileEditResponse, Error = ApiError> + Send>; + async fn get_file_edit(&self, edit_id: String) -> Result<GetFileEditResponse, ApiError>; - fn get_file_history( + async fn get_file_history( &self, ident: String, limit: Option<i64>, - ) -> Box<dyn Future<Item = GetFileHistoryResponse, Error = ApiError> + Send>; + ) -> Result<GetFileHistoryResponse, ApiError>; - fn get_file_redirects( - &self, - ident: String, - ) -> Box<dyn Future<Item = GetFileRedirectsResponse, Error = ApiError> + Send>; + async fn get_file_redirects(&self, ident: String) + -> Result<GetFileRedirectsResponse, ApiError>; - fn get_file_revision( + async fn get_file_revision( &self, rev_id: String, expand: Option<String>, hide: Option<String>, - ) -> Box<dyn Future<Item = GetFileRevisionResponse, Error = ApiError> + Send>; + ) -> Result<GetFileRevisionResponse, ApiError>; - fn get_fileset( + async fn get_fileset( &self, ident: String, expand: Option<String>, hide: Option<String>, - ) -> Box<dyn Future<Item = GetFilesetResponse, Error = ApiError> + Send>; + ) -> Result<GetFilesetResponse, ApiError>; - fn get_fileset_edit( - &self, - edit_id: String, - ) -> Box<dyn Future<Item = GetFilesetEditResponse, Error = ApiError> + Send>; + async fn get_fileset_edit(&self, edit_id: String) -> Result<GetFilesetEditResponse, ApiError>; - fn get_fileset_history( + async fn get_fileset_history( &self, ident: String, limit: Option<i64>, - ) -> Box<dyn Future<Item = GetFilesetHistoryResponse, Error = ApiError> + Send>; + ) -> Result<GetFilesetHistoryResponse, ApiError>; - fn get_fileset_redirects( + async fn get_fileset_redirects( &self, ident: String, - ) -> Box<dyn Future<Item = GetFilesetRedirectsResponse, Error = ApiError> + Send>; + ) -> Result<GetFilesetRedirectsResponse, ApiError>; - fn get_fileset_revision( + async fn get_fileset_revision( &self, rev_id: String, expand: Option<String>, hide: Option<String>, - ) -> Box<dyn Future<Item = GetFilesetRevisionResponse, Error = ApiError> + Send>; + ) -> Result<GetFilesetRevisionResponse, ApiError>; - fn get_release( + async fn get_release( &self, ident: String, expand: Option<String>, hide: Option<String>, - ) -> Box<dyn Future<Item = GetReleaseResponse, Error = ApiError> + Send>; + ) -> Result<GetReleaseResponse, ApiError>; - fn get_release_edit( - &self, - edit_id: String, - ) -> Box<dyn Future<Item = GetReleaseEditResponse, Error = ApiError> + Send>; + async fn get_release_edit(&self, edit_id: String) -> Result<GetReleaseEditResponse, ApiError>; - fn get_release_files( + async fn get_release_files( &self, ident: String, hide: Option<String>, - ) -> Box<dyn Future<Item = GetReleaseFilesResponse, Error = ApiError> + Send>; + ) -> Result<GetReleaseFilesResponse, ApiError>; - fn get_release_filesets( + async fn get_release_filesets( &self, ident: String, hide: Option<String>, - ) -> Box<dyn Future<Item = GetReleaseFilesetsResponse, Error = ApiError> + Send>; + ) -> Result<GetReleaseFilesetsResponse, ApiError>; - fn get_release_history( + async fn get_release_history( &self, ident: String, limit: Option<i64>, - ) -> Box<dyn Future<Item = GetReleaseHistoryResponse, Error = ApiError> + Send>; + ) -> Result<GetReleaseHistoryResponse, ApiError>; - fn get_release_redirects( + async fn get_release_redirects( &self, ident: String, - ) -> Box<dyn Future<Item = GetReleaseRedirectsResponse, Error = ApiError> + Send>; + ) -> Result<GetReleaseRedirectsResponse, ApiError>; - fn get_release_revision( + async fn get_release_revision( &self, rev_id: String, expand: Option<String>, hide: Option<String>, - ) -> Box<dyn Future<Item = GetReleaseRevisionResponse, Error = ApiError> + Send>; + ) -> Result<GetReleaseRevisionResponse, ApiError>; - fn get_release_webcaptures( + async fn get_release_webcaptures( &self, ident: String, hide: Option<String>, - ) -> Box<dyn Future<Item = GetReleaseWebcapturesResponse, Error = ApiError> + Send>; + ) -> Result<GetReleaseWebcapturesResponse, ApiError>; - fn get_webcapture( + async fn get_webcapture( &self, ident: String, expand: Option<String>, hide: Option<String>, - ) -> Box<dyn Future<Item = GetWebcaptureResponse, Error = ApiError> + Send>; + ) -> Result<GetWebcaptureResponse, ApiError>; - fn get_webcapture_edit( + async fn get_webcapture_edit( &self, edit_id: String, - ) -> Box<dyn Future<Item = GetWebcaptureEditResponse, Error = ApiError> + Send>; + ) -> Result<GetWebcaptureEditResponse, ApiError>; - fn get_webcapture_history( + async fn get_webcapture_history( &self, ident: String, limit: Option<i64>, - ) -> Box<dyn Future<Item = GetWebcaptureHistoryResponse, Error = ApiError> + Send>; + ) -> Result<GetWebcaptureHistoryResponse, ApiError>; - fn get_webcapture_redirects( + async fn get_webcapture_redirects( &self, ident: String, - ) -> Box<dyn Future<Item = GetWebcaptureRedirectsResponse, Error = ApiError> + Send>; + ) -> Result<GetWebcaptureRedirectsResponse, ApiError>; - fn get_webcapture_revision( + async fn get_webcapture_revision( &self, rev_id: String, expand: Option<String>, hide: Option<String>, - ) -> Box<dyn Future<Item = GetWebcaptureRevisionResponse, Error = ApiError> + Send>; + ) -> Result<GetWebcaptureRevisionResponse, ApiError>; - fn get_work( + async fn get_work( &self, ident: String, expand: Option<String>, hide: Option<String>, - ) -> Box<dyn Future<Item = GetWorkResponse, Error = ApiError> + Send>; + ) -> Result<GetWorkResponse, ApiError>; - fn get_work_edit( - &self, - edit_id: String, - ) -> Box<dyn Future<Item = GetWorkEditResponse, Error = ApiError> + Send>; + async fn get_work_edit(&self, edit_id: String) -> Result<GetWorkEditResponse, ApiError>; - fn get_work_history( + async fn get_work_history( &self, ident: String, limit: Option<i64>, - ) -> Box<dyn Future<Item = GetWorkHistoryResponse, Error = ApiError> + Send>; + ) -> Result<GetWorkHistoryResponse, ApiError>; - fn get_work_redirects( - &self, - ident: String, - ) -> Box<dyn Future<Item = GetWorkRedirectsResponse, Error = ApiError> + Send>; + async fn get_work_redirects(&self, ident: String) + -> Result<GetWorkRedirectsResponse, ApiError>; - fn get_work_releases( + async fn get_work_releases( &self, ident: String, hide: Option<String>, - ) -> Box<dyn Future<Item = GetWorkReleasesResponse, Error = ApiError> + Send>; + ) -> Result<GetWorkReleasesResponse, ApiError>; - fn get_work_revision( + async fn get_work_revision( &self, rev_id: String, expand: Option<String>, hide: Option<String>, - ) -> Box<dyn Future<Item = GetWorkRevisionResponse, Error = ApiError> + Send>; + ) -> Result<GetWorkRevisionResponse, ApiError>; - fn lookup_container( + async fn lookup_container( &self, issnl: Option<String>, wikidata_qid: Option<String>, expand: Option<String>, hide: Option<String>, - ) -> Box<dyn Future<Item = LookupContainerResponse, Error = ApiError> + Send>; + ) -> Result<LookupContainerResponse, ApiError>; - fn lookup_creator( + async fn lookup_creator( &self, orcid: Option<String>, wikidata_qid: Option<String>, expand: Option<String>, hide: Option<String>, - ) -> Box<dyn Future<Item = LookupCreatorResponse, Error = ApiError> + Send>; + ) -> Result<LookupCreatorResponse, ApiError>; - fn lookup_file( + async fn lookup_file( &self, md5: Option<String>, sha1: Option<String>, sha256: Option<String>, expand: Option<String>, hide: Option<String>, - ) -> Box<dyn Future<Item = LookupFileResponse, Error = ApiError> + Send>; + ) -> Result<LookupFileResponse, ApiError>; - fn lookup_release( + async fn lookup_release( &self, doi: Option<String>, wikidata_qid: Option<String>, @@ -2773,820 +2755,926 @@ pub trait ApiNoContext { jstor: Option<String>, ark: Option<String>, mag: Option<String>, + doaj: Option<String>, + dblp: Option<String>, + oai: Option<String>, expand: Option<String>, hide: Option<String>, - ) -> Box<dyn Future<Item = LookupReleaseResponse, Error = ApiError> + Send>; + ) -> Result<LookupReleaseResponse, ApiError>; - fn update_container( + async fn update_container( &self, editgroup_id: String, ident: String, container_entity: models::ContainerEntity, - ) -> Box<dyn Future<Item = UpdateContainerResponse, Error = ApiError> + Send>; + ) -> Result<UpdateContainerResponse, ApiError>; - fn update_creator( + async fn update_creator( &self, editgroup_id: String, ident: String, creator_entity: models::CreatorEntity, - ) -> Box<dyn Future<Item = UpdateCreatorResponse, Error = ApiError> + Send>; + ) -> Result<UpdateCreatorResponse, ApiError>; - fn update_editgroup( + async fn update_editgroup( &self, editgroup_id: String, editgroup: models::Editgroup, submit: Option<bool>, - ) -> Box<dyn Future<Item = UpdateEditgroupResponse, Error = ApiError> + Send>; + ) -> Result<UpdateEditgroupResponse, ApiError>; - fn update_editor( + async fn update_editor( &self, editor_id: String, editor: models::Editor, - ) -> Box<dyn Future<Item = UpdateEditorResponse, Error = ApiError> + Send>; + ) -> Result<UpdateEditorResponse, ApiError>; - fn update_file( + async fn update_file( &self, editgroup_id: String, ident: String, file_entity: models::FileEntity, - ) -> Box<dyn Future<Item = UpdateFileResponse, Error = ApiError> + Send>; + ) -> Result<UpdateFileResponse, ApiError>; - fn update_fileset( + async fn update_fileset( &self, editgroup_id: String, ident: String, fileset_entity: models::FilesetEntity, - ) -> Box<dyn Future<Item = UpdateFilesetResponse, Error = ApiError> + Send>; + ) -> Result<UpdateFilesetResponse, ApiError>; - fn update_release( + async fn update_release( &self, editgroup_id: String, ident: String, release_entity: models::ReleaseEntity, - ) -> Box<dyn Future<Item = UpdateReleaseResponse, Error = ApiError> + Send>; + ) -> Result<UpdateReleaseResponse, ApiError>; - fn update_webcapture( + async fn update_webcapture( &self, editgroup_id: String, ident: String, webcapture_entity: models::WebcaptureEntity, - ) -> Box<dyn Future<Item = UpdateWebcaptureResponse, Error = ApiError> + Send>; + ) -> Result<UpdateWebcaptureResponse, ApiError>; - fn update_work( + async fn update_work( &self, editgroup_id: String, ident: String, work_entity: models::WorkEntity, - ) -> Box<dyn Future<Item = UpdateWorkResponse, Error = ApiError> + Send>; + ) -> Result<UpdateWorkResponse, ApiError>; } /// Trait to extend an API to make it easy to bind it to a context. -pub trait ContextWrapperExt<'a, C> +pub trait ContextWrapperExt<C: Send + Sync> where Self: Sized, { /// Binds this API to a context. - fn with_context(self: &'a Self, context: C) -> ContextWrapper<'a, Self, C>; + fn with_context(self: Self, context: C) -> ContextWrapper<Self, C>; } -impl<'a, T: Api<C> + Sized, C> ContextWrapperExt<'a, C> for T { - fn with_context(self: &'a T, context: C) -> ContextWrapper<'a, T, C> { +impl<T: Api<C> + Send + Sync, C: Clone + Send + Sync> ContextWrapperExt<C> for T { + fn with_context(self: T, context: C) -> ContextWrapper<T, C> { ContextWrapper::<T, C>::new(self, context) } } -impl<'a, T: Api<C>, C> ApiNoContext for ContextWrapper<'a, T, C> { - fn accept_editgroup( +#[async_trait] +impl<T: Api<C> + Send + Sync, C: Clone + Send + Sync> ApiNoContext<C> for ContextWrapper<T, C> { + fn poll_ready(&self, cx: &mut Context) -> Poll<Result<(), ServiceError>> { + self.api().poll_ready(cx) + } + + fn context(&self) -> &C { + ContextWrapper::context(self) + } + + async fn accept_editgroup( &self, editgroup_id: String, - ) -> Box<dyn Future<Item = AcceptEditgroupResponse, Error = ApiError> + Send> { - self.api().accept_editgroup(editgroup_id, &self.context()) + ) -> Result<AcceptEditgroupResponse, ApiError> { + let context = self.context().clone(); + self.api().accept_editgroup(editgroup_id, &context).await } - fn auth_check( - &self, - role: Option<String>, - ) -> Box<dyn Future<Item = AuthCheckResponse, Error = ApiError> + Send> { - self.api().auth_check(role, &self.context()) + async fn auth_check(&self, role: Option<String>) -> Result<AuthCheckResponse, ApiError> { + let context = self.context().clone(); + self.api().auth_check(role, &context).await } - fn auth_oidc( - &self, - auth_oidc: models::AuthOidc, - ) -> Box<dyn Future<Item = AuthOidcResponse, Error = ApiError> + Send> { - self.api().auth_oidc(auth_oidc, &self.context()) + async fn auth_oidc(&self, auth_oidc: models::AuthOidc) -> Result<AuthOidcResponse, ApiError> { + let context = self.context().clone(); + self.api().auth_oidc(auth_oidc, &context).await } - fn create_auth_token( + async fn create_auth_token( &self, editor_id: String, duration_seconds: Option<i32>, - ) -> Box<dyn Future<Item = CreateAuthTokenResponse, Error = ApiError> + Send> { + ) -> Result<CreateAuthTokenResponse, ApiError> { + let context = self.context().clone(); self.api() - .create_auth_token(editor_id, duration_seconds, &self.context()) + .create_auth_token(editor_id, duration_seconds, &context) + .await } - fn create_container( + async fn create_container( &self, editgroup_id: String, container_entity: models::ContainerEntity, - ) -> Box<dyn Future<Item = CreateContainerResponse, Error = ApiError> + Send> { + ) -> Result<CreateContainerResponse, ApiError> { + let context = self.context().clone(); self.api() - .create_container(editgroup_id, container_entity, &self.context()) + .create_container(editgroup_id, container_entity, &context) + .await } - fn create_container_auto_batch( + async fn create_container_auto_batch( &self, container_auto_batch: models::ContainerAutoBatch, - ) -> Box<dyn Future<Item = CreateContainerAutoBatchResponse, Error = ApiError> + Send> { + ) -> Result<CreateContainerAutoBatchResponse, ApiError> { + let context = self.context().clone(); self.api() - .create_container_auto_batch(container_auto_batch, &self.context()) + .create_container_auto_batch(container_auto_batch, &context) + .await } - fn create_creator( + async fn create_creator( &self, editgroup_id: String, creator_entity: models::CreatorEntity, - ) -> Box<dyn Future<Item = CreateCreatorResponse, Error = ApiError> + Send> { + ) -> Result<CreateCreatorResponse, ApiError> { + let context = self.context().clone(); self.api() - .create_creator(editgroup_id, creator_entity, &self.context()) + .create_creator(editgroup_id, creator_entity, &context) + .await } - fn create_creator_auto_batch( + async fn create_creator_auto_batch( &self, creator_auto_batch: models::CreatorAutoBatch, - ) -> Box<dyn Future<Item = CreateCreatorAutoBatchResponse, Error = ApiError> + Send> { + ) -> Result<CreateCreatorAutoBatchResponse, ApiError> { + let context = self.context().clone(); self.api() - .create_creator_auto_batch(creator_auto_batch, &self.context()) + .create_creator_auto_batch(creator_auto_batch, &context) + .await } - fn create_editgroup( + async fn create_editgroup( &self, editgroup: models::Editgroup, - ) -> Box<dyn Future<Item = CreateEditgroupResponse, Error = ApiError> + Send> { - self.api().create_editgroup(editgroup, &self.context()) + ) -> Result<CreateEditgroupResponse, ApiError> { + let context = self.context().clone(); + self.api().create_editgroup(editgroup, &context).await } - fn create_editgroup_annotation( + async fn create_editgroup_annotation( &self, editgroup_id: String, editgroup_annotation: models::EditgroupAnnotation, - ) -> Box<dyn Future<Item = CreateEditgroupAnnotationResponse, Error = ApiError> + Send> { + ) -> Result<CreateEditgroupAnnotationResponse, ApiError> { + let context = self.context().clone(); self.api() - .create_editgroup_annotation(editgroup_id, editgroup_annotation, &self.context()) + .create_editgroup_annotation(editgroup_id, editgroup_annotation, &context) + .await } - fn create_file( + async fn create_file( &self, editgroup_id: String, file_entity: models::FileEntity, - ) -> Box<dyn Future<Item = CreateFileResponse, Error = ApiError> + Send> { + ) -> Result<CreateFileResponse, ApiError> { + let context = self.context().clone(); self.api() - .create_file(editgroup_id, file_entity, &self.context()) + .create_file(editgroup_id, file_entity, &context) + .await } - fn create_file_auto_batch( + async fn create_file_auto_batch( &self, file_auto_batch: models::FileAutoBatch, - ) -> Box<dyn Future<Item = CreateFileAutoBatchResponse, Error = ApiError> + Send> { + ) -> Result<CreateFileAutoBatchResponse, ApiError> { + let context = self.context().clone(); self.api() - .create_file_auto_batch(file_auto_batch, &self.context()) + .create_file_auto_batch(file_auto_batch, &context) + .await } - fn create_fileset( + async fn create_fileset( &self, editgroup_id: String, fileset_entity: models::FilesetEntity, - ) -> Box<dyn Future<Item = CreateFilesetResponse, Error = ApiError> + Send> { + ) -> Result<CreateFilesetResponse, ApiError> { + let context = self.context().clone(); self.api() - .create_fileset(editgroup_id, fileset_entity, &self.context()) + .create_fileset(editgroup_id, fileset_entity, &context) + .await } - fn create_fileset_auto_batch( + async fn create_fileset_auto_batch( &self, fileset_auto_batch: models::FilesetAutoBatch, - ) -> Box<dyn Future<Item = CreateFilesetAutoBatchResponse, Error = ApiError> + Send> { + ) -> Result<CreateFilesetAutoBatchResponse, ApiError> { + let context = self.context().clone(); self.api() - .create_fileset_auto_batch(fileset_auto_batch, &self.context()) + .create_fileset_auto_batch(fileset_auto_batch, &context) + .await } - fn create_release( + async fn create_release( &self, editgroup_id: String, release_entity: models::ReleaseEntity, - ) -> Box<dyn Future<Item = CreateReleaseResponse, Error = ApiError> + Send> { + ) -> Result<CreateReleaseResponse, ApiError> { + let context = self.context().clone(); self.api() - .create_release(editgroup_id, release_entity, &self.context()) + .create_release(editgroup_id, release_entity, &context) + .await } - fn create_release_auto_batch( + async fn create_release_auto_batch( &self, release_auto_batch: models::ReleaseAutoBatch, - ) -> Box<dyn Future<Item = CreateReleaseAutoBatchResponse, Error = ApiError> + Send> { + ) -> Result<CreateReleaseAutoBatchResponse, ApiError> { + let context = self.context().clone(); self.api() - .create_release_auto_batch(release_auto_batch, &self.context()) + .create_release_auto_batch(release_auto_batch, &context) + .await } - fn create_webcapture( + async fn create_webcapture( &self, editgroup_id: String, webcapture_entity: models::WebcaptureEntity, - ) -> Box<dyn Future<Item = CreateWebcaptureResponse, Error = ApiError> + Send> { + ) -> Result<CreateWebcaptureResponse, ApiError> { + let context = self.context().clone(); self.api() - .create_webcapture(editgroup_id, webcapture_entity, &self.context()) + .create_webcapture(editgroup_id, webcapture_entity, &context) + .await } - fn create_webcapture_auto_batch( + async fn create_webcapture_auto_batch( &self, webcapture_auto_batch: models::WebcaptureAutoBatch, - ) -> Box<dyn Future<Item = CreateWebcaptureAutoBatchResponse, Error = ApiError> + Send> { + ) -> Result<CreateWebcaptureAutoBatchResponse, ApiError> { + let context = self.context().clone(); self.api() - .create_webcapture_auto_batch(webcapture_auto_batch, &self.context()) + .create_webcapture_auto_batch(webcapture_auto_batch, &context) + .await } - fn create_work( + async fn create_work( &self, editgroup_id: String, work_entity: models::WorkEntity, - ) -> Box<dyn Future<Item = CreateWorkResponse, Error = ApiError> + Send> { + ) -> Result<CreateWorkResponse, ApiError> { + let context = self.context().clone(); self.api() - .create_work(editgroup_id, work_entity, &self.context()) + .create_work(editgroup_id, work_entity, &context) + .await } - fn create_work_auto_batch( + async fn create_work_auto_batch( &self, work_auto_batch: models::WorkAutoBatch, - ) -> Box<dyn Future<Item = CreateWorkAutoBatchResponse, Error = ApiError> + Send> { + ) -> Result<CreateWorkAutoBatchResponse, ApiError> { + let context = self.context().clone(); self.api() - .create_work_auto_batch(work_auto_batch, &self.context()) + .create_work_auto_batch(work_auto_batch, &context) + .await } - fn delete_container( + async fn delete_container( &self, editgroup_id: String, ident: String, - ) -> Box<dyn Future<Item = DeleteContainerResponse, Error = ApiError> + Send> { + ) -> Result<DeleteContainerResponse, ApiError> { + let context = self.context().clone(); self.api() - .delete_container(editgroup_id, ident, &self.context()) + .delete_container(editgroup_id, ident, &context) + .await } - fn delete_container_edit( + async fn delete_container_edit( &self, editgroup_id: String, edit_id: String, - ) -> Box<dyn Future<Item = DeleteContainerEditResponse, Error = ApiError> + Send> { + ) -> Result<DeleteContainerEditResponse, ApiError> { + let context = self.context().clone(); self.api() - .delete_container_edit(editgroup_id, edit_id, &self.context()) + .delete_container_edit(editgroup_id, edit_id, &context) + .await } - fn delete_creator( + async fn delete_creator( &self, editgroup_id: String, ident: String, - ) -> Box<dyn Future<Item = DeleteCreatorResponse, Error = ApiError> + Send> { + ) -> Result<DeleteCreatorResponse, ApiError> { + let context = self.context().clone(); self.api() - .delete_creator(editgroup_id, ident, &self.context()) + .delete_creator(editgroup_id, ident, &context) + .await } - fn delete_creator_edit( + async fn delete_creator_edit( &self, editgroup_id: String, edit_id: String, - ) -> Box<dyn Future<Item = DeleteCreatorEditResponse, Error = ApiError> + Send> { + ) -> Result<DeleteCreatorEditResponse, ApiError> { + let context = self.context().clone(); self.api() - .delete_creator_edit(editgroup_id, edit_id, &self.context()) + .delete_creator_edit(editgroup_id, edit_id, &context) + .await } - fn delete_file( + async fn delete_file( &self, editgroup_id: String, ident: String, - ) -> Box<dyn Future<Item = DeleteFileResponse, Error = ApiError> + Send> { - self.api().delete_file(editgroup_id, ident, &self.context()) + ) -> Result<DeleteFileResponse, ApiError> { + let context = self.context().clone(); + self.api().delete_file(editgroup_id, ident, &context).await } - fn delete_file_edit( + async fn delete_file_edit( &self, editgroup_id: String, edit_id: String, - ) -> Box<dyn Future<Item = DeleteFileEditResponse, Error = ApiError> + Send> { + ) -> Result<DeleteFileEditResponse, ApiError> { + let context = self.context().clone(); self.api() - .delete_file_edit(editgroup_id, edit_id, &self.context()) + .delete_file_edit(editgroup_id, edit_id, &context) + .await } - fn delete_fileset( + async fn delete_fileset( &self, editgroup_id: String, ident: String, - ) -> Box<dyn Future<Item = DeleteFilesetResponse, Error = ApiError> + Send> { + ) -> Result<DeleteFilesetResponse, ApiError> { + let context = self.context().clone(); self.api() - .delete_fileset(editgroup_id, ident, &self.context()) + .delete_fileset(editgroup_id, ident, &context) + .await } - fn delete_fileset_edit( + async fn delete_fileset_edit( &self, editgroup_id: String, edit_id: String, - ) -> Box<dyn Future<Item = DeleteFilesetEditResponse, Error = ApiError> + Send> { + ) -> Result<DeleteFilesetEditResponse, ApiError> { + let context = self.context().clone(); self.api() - .delete_fileset_edit(editgroup_id, edit_id, &self.context()) + .delete_fileset_edit(editgroup_id, edit_id, &context) + .await } - fn delete_release( + async fn delete_release( &self, editgroup_id: String, ident: String, - ) -> Box<dyn Future<Item = DeleteReleaseResponse, Error = ApiError> + Send> { + ) -> Result<DeleteReleaseResponse, ApiError> { + let context = self.context().clone(); self.api() - .delete_release(editgroup_id, ident, &self.context()) + .delete_release(editgroup_id, ident, &context) + .await } - fn delete_release_edit( + async fn delete_release_edit( &self, editgroup_id: String, edit_id: String, - ) -> Box<dyn Future<Item = DeleteReleaseEditResponse, Error = ApiError> + Send> { + ) -> Result<DeleteReleaseEditResponse, ApiError> { + let context = self.context().clone(); self.api() - .delete_release_edit(editgroup_id, edit_id, &self.context()) + .delete_release_edit(editgroup_id, edit_id, &context) + .await } - fn delete_webcapture( + async fn delete_webcapture( &self, editgroup_id: String, ident: String, - ) -> Box<dyn Future<Item = DeleteWebcaptureResponse, Error = ApiError> + Send> { + ) -> Result<DeleteWebcaptureResponse, ApiError> { + let context = self.context().clone(); self.api() - .delete_webcapture(editgroup_id, ident, &self.context()) + .delete_webcapture(editgroup_id, ident, &context) + .await } - fn delete_webcapture_edit( + async fn delete_webcapture_edit( &self, editgroup_id: String, edit_id: String, - ) -> Box<dyn Future<Item = DeleteWebcaptureEditResponse, Error = ApiError> + Send> { + ) -> Result<DeleteWebcaptureEditResponse, ApiError> { + let context = self.context().clone(); self.api() - .delete_webcapture_edit(editgroup_id, edit_id, &self.context()) + .delete_webcapture_edit(editgroup_id, edit_id, &context) + .await } - fn delete_work( + async fn delete_work( &self, editgroup_id: String, ident: String, - ) -> Box<dyn Future<Item = DeleteWorkResponse, Error = ApiError> + Send> { - self.api().delete_work(editgroup_id, ident, &self.context()) + ) -> Result<DeleteWorkResponse, ApiError> { + let context = self.context().clone(); + self.api().delete_work(editgroup_id, ident, &context).await } - fn delete_work_edit( + async fn delete_work_edit( &self, editgroup_id: String, edit_id: String, - ) -> Box<dyn Future<Item = DeleteWorkEditResponse, Error = ApiError> + Send> { + ) -> Result<DeleteWorkEditResponse, ApiError> { + let context = self.context().clone(); self.api() - .delete_work_edit(editgroup_id, edit_id, &self.context()) + .delete_work_edit(editgroup_id, edit_id, &context) + .await } - fn get_changelog( - &self, - limit: Option<i64>, - ) -> Box<dyn Future<Item = GetChangelogResponse, Error = ApiError> + Send> { - self.api().get_changelog(limit, &self.context()) + async fn get_changelog(&self, limit: Option<i64>) -> Result<GetChangelogResponse, ApiError> { + let context = self.context().clone(); + self.api().get_changelog(limit, &context).await } - fn get_changelog_entry( - &self, - index: i64, - ) -> Box<dyn Future<Item = GetChangelogEntryResponse, Error = ApiError> + Send> { - self.api().get_changelog_entry(index, &self.context()) + async fn get_changelog_entry(&self, index: i64) -> Result<GetChangelogEntryResponse, ApiError> { + let context = self.context().clone(); + self.api().get_changelog_entry(index, &context).await } - fn get_container( + async fn get_container( &self, ident: String, expand: Option<String>, hide: Option<String>, - ) -> Box<dyn Future<Item = GetContainerResponse, Error = ApiError> + Send> { + ) -> Result<GetContainerResponse, ApiError> { + let context = self.context().clone(); self.api() - .get_container(ident, expand, hide, &self.context()) + .get_container(ident, expand, hide, &context) + .await } - fn get_container_edit( + async fn get_container_edit( &self, edit_id: String, - ) -> Box<dyn Future<Item = GetContainerEditResponse, Error = ApiError> + Send> { - self.api().get_container_edit(edit_id, &self.context()) + ) -> Result<GetContainerEditResponse, ApiError> { + let context = self.context().clone(); + self.api().get_container_edit(edit_id, &context).await } - fn get_container_history( + async fn get_container_history( &self, ident: String, limit: Option<i64>, - ) -> Box<dyn Future<Item = GetContainerHistoryResponse, Error = ApiError> + Send> { + ) -> Result<GetContainerHistoryResponse, ApiError> { + let context = self.context().clone(); self.api() - .get_container_history(ident, limit, &self.context()) + .get_container_history(ident, limit, &context) + .await } - fn get_container_redirects( + async fn get_container_redirects( &self, ident: String, - ) -> Box<dyn Future<Item = GetContainerRedirectsResponse, Error = ApiError> + Send> { - self.api().get_container_redirects(ident, &self.context()) + ) -> Result<GetContainerRedirectsResponse, ApiError> { + let context = self.context().clone(); + self.api().get_container_redirects(ident, &context).await } - fn get_container_revision( + async fn get_container_revision( &self, rev_id: String, expand: Option<String>, hide: Option<String>, - ) -> Box<dyn Future<Item = GetContainerRevisionResponse, Error = ApiError> + Send> { + ) -> Result<GetContainerRevisionResponse, ApiError> { + let context = self.context().clone(); self.api() - .get_container_revision(rev_id, expand, hide, &self.context()) + .get_container_revision(rev_id, expand, hide, &context) + .await } - fn get_creator( + async fn get_creator( &self, ident: String, expand: Option<String>, hide: Option<String>, - ) -> Box<dyn Future<Item = GetCreatorResponse, Error = ApiError> + Send> { - self.api().get_creator(ident, expand, hide, &self.context()) + ) -> Result<GetCreatorResponse, ApiError> { + let context = self.context().clone(); + self.api().get_creator(ident, expand, hide, &context).await } - fn get_creator_edit( - &self, - edit_id: String, - ) -> Box<dyn Future<Item = GetCreatorEditResponse, Error = ApiError> + Send> { - self.api().get_creator_edit(edit_id, &self.context()) + async fn get_creator_edit(&self, edit_id: String) -> Result<GetCreatorEditResponse, ApiError> { + let context = self.context().clone(); + self.api().get_creator_edit(edit_id, &context).await } - fn get_creator_history( + async fn get_creator_history( &self, ident: String, limit: Option<i64>, - ) -> Box<dyn Future<Item = GetCreatorHistoryResponse, Error = ApiError> + Send> { - self.api() - .get_creator_history(ident, limit, &self.context()) + ) -> Result<GetCreatorHistoryResponse, ApiError> { + let context = self.context().clone(); + self.api().get_creator_history(ident, limit, &context).await } - fn get_creator_redirects( + async fn get_creator_redirects( &self, ident: String, - ) -> Box<dyn Future<Item = GetCreatorRedirectsResponse, Error = ApiError> + Send> { - self.api().get_creator_redirects(ident, &self.context()) + ) -> Result<GetCreatorRedirectsResponse, ApiError> { + let context = self.context().clone(); + self.api().get_creator_redirects(ident, &context).await } - fn get_creator_releases( + async fn get_creator_releases( &self, ident: String, hide: Option<String>, - ) -> Box<dyn Future<Item = GetCreatorReleasesResponse, Error = ApiError> + Send> { - self.api() - .get_creator_releases(ident, hide, &self.context()) + ) -> Result<GetCreatorReleasesResponse, ApiError> { + let context = self.context().clone(); + self.api().get_creator_releases(ident, hide, &context).await } - fn get_creator_revision( + async fn get_creator_revision( &self, rev_id: String, expand: Option<String>, hide: Option<String>, - ) -> Box<dyn Future<Item = GetCreatorRevisionResponse, Error = ApiError> + Send> { + ) -> Result<GetCreatorRevisionResponse, ApiError> { + let context = self.context().clone(); self.api() - .get_creator_revision(rev_id, expand, hide, &self.context()) + .get_creator_revision(rev_id, expand, hide, &context) + .await } - fn get_editgroup( - &self, - editgroup_id: String, - ) -> Box<dyn Future<Item = GetEditgroupResponse, Error = ApiError> + Send> { - self.api().get_editgroup(editgroup_id, &self.context()) + async fn get_editgroup(&self, editgroup_id: String) -> Result<GetEditgroupResponse, ApiError> { + let context = self.context().clone(); + self.api().get_editgroup(editgroup_id, &context).await } - fn get_editgroup_annotations( + async fn get_editgroup_annotations( &self, editgroup_id: String, expand: Option<String>, - ) -> Box<dyn Future<Item = GetEditgroupAnnotationsResponse, Error = ApiError> + Send> { + ) -> Result<GetEditgroupAnnotationsResponse, ApiError> { + let context = self.context().clone(); self.api() - .get_editgroup_annotations(editgroup_id, expand, &self.context()) + .get_editgroup_annotations(editgroup_id, expand, &context) + .await } - 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>>, - ) -> Box<dyn Future<Item = GetEditgroupsReviewableResponse, Error = ApiError> + Send> { + ) -> Result<GetEditgroupsReviewableResponse, ApiError> { + let context = self.context().clone(); self.api() - .get_editgroups_reviewable(expand, limit, before, since, &self.context()) + .get_editgroups_reviewable(expand, limit, before, since, &context) + .await } - fn get_editor( - &self, - editor_id: String, - ) -> Box<dyn Future<Item = GetEditorResponse, Error = ApiError> + Send> { - self.api().get_editor(editor_id, &self.context()) + async fn get_editor(&self, editor_id: String) -> Result<GetEditorResponse, ApiError> { + let context = self.context().clone(); + self.api().get_editor(editor_id, &context).await } - 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>>, - ) -> Box<dyn Future<Item = GetEditorAnnotationsResponse, Error = ApiError> + Send> { + ) -> Result<GetEditorAnnotationsResponse, ApiError> { + let context = self.context().clone(); self.api() - .get_editor_annotations(editor_id, limit, before, since, &self.context()) + .get_editor_annotations(editor_id, limit, before, since, &context) + .await } - 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>>, - ) -> Box<dyn Future<Item = GetEditorEditgroupsResponse, Error = ApiError> + Send> { + ) -> Result<GetEditorEditgroupsResponse, ApiError> { + let context = self.context().clone(); self.api() - .get_editor_editgroups(editor_id, limit, before, since, &self.context()) + .get_editor_editgroups(editor_id, limit, before, since, &context) + .await } - fn get_file( + async fn get_file( &self, ident: String, expand: Option<String>, hide: Option<String>, - ) -> Box<dyn Future<Item = GetFileResponse, Error = ApiError> + Send> { - self.api().get_file(ident, expand, hide, &self.context()) + ) -> Result<GetFileResponse, ApiError> { + let context = self.context().clone(); + self.api().get_file(ident, expand, hide, &context).await } - fn get_file_edit( - &self, - edit_id: String, - ) -> Box<dyn Future<Item = GetFileEditResponse, Error = ApiError> + Send> { - self.api().get_file_edit(edit_id, &self.context()) + async fn get_file_edit(&self, edit_id: String) -> Result<GetFileEditResponse, ApiError> { + let context = self.context().clone(); + self.api().get_file_edit(edit_id, &context).await } - fn get_file_history( + async fn get_file_history( &self, ident: String, limit: Option<i64>, - ) -> Box<dyn Future<Item = GetFileHistoryResponse, Error = ApiError> + Send> { - self.api().get_file_history(ident, limit, &self.context()) + ) -> Result<GetFileHistoryResponse, ApiError> { + let context = self.context().clone(); + self.api().get_file_history(ident, limit, &context).await } - fn get_file_redirects( + async fn get_file_redirects( &self, ident: String, - ) -> Box<dyn Future<Item = GetFileRedirectsResponse, Error = ApiError> + Send> { - self.api().get_file_redirects(ident, &self.context()) + ) -> Result<GetFileRedirectsResponse, ApiError> { + let context = self.context().clone(); + self.api().get_file_redirects(ident, &context).await } - fn get_file_revision( + async fn get_file_revision( &self, rev_id: String, expand: Option<String>, hide: Option<String>, - ) -> Box<dyn Future<Item = GetFileRevisionResponse, Error = ApiError> + Send> { + ) -> Result<GetFileRevisionResponse, ApiError> { + let context = self.context().clone(); self.api() - .get_file_revision(rev_id, expand, hide, &self.context()) + .get_file_revision(rev_id, expand, hide, &context) + .await } - fn get_fileset( + async fn get_fileset( &self, ident: String, expand: Option<String>, hide: Option<String>, - ) -> Box<dyn Future<Item = GetFilesetResponse, Error = ApiError> + Send> { - self.api().get_fileset(ident, expand, hide, &self.context()) + ) -> Result<GetFilesetResponse, ApiError> { + let context = self.context().clone(); + self.api().get_fileset(ident, expand, hide, &context).await } - fn get_fileset_edit( - &self, - edit_id: String, - ) -> Box<dyn Future<Item = GetFilesetEditResponse, Error = ApiError> + Send> { - self.api().get_fileset_edit(edit_id, &self.context()) + async fn get_fileset_edit(&self, edit_id: String) -> Result<GetFilesetEditResponse, ApiError> { + let context = self.context().clone(); + self.api().get_fileset_edit(edit_id, &context).await } - fn get_fileset_history( + async fn get_fileset_history( &self, ident: String, limit: Option<i64>, - ) -> Box<dyn Future<Item = GetFilesetHistoryResponse, Error = ApiError> + Send> { - self.api() - .get_fileset_history(ident, limit, &self.context()) + ) -> Result<GetFilesetHistoryResponse, ApiError> { + let context = self.context().clone(); + self.api().get_fileset_history(ident, limit, &context).await } - fn get_fileset_redirects( + async fn get_fileset_redirects( &self, ident: String, - ) -> Box<dyn Future<Item = GetFilesetRedirectsResponse, Error = ApiError> + Send> { - self.api().get_fileset_redirects(ident, &self.context()) + ) -> Result<GetFilesetRedirectsResponse, ApiError> { + let context = self.context().clone(); + self.api().get_fileset_redirects(ident, &context).await } - fn get_fileset_revision( + async fn get_fileset_revision( &self, rev_id: String, expand: Option<String>, hide: Option<String>, - ) -> Box<dyn Future<Item = GetFilesetRevisionResponse, Error = ApiError> + Send> { + ) -> Result<GetFilesetRevisionResponse, ApiError> { + let context = self.context().clone(); self.api() - .get_fileset_revision(rev_id, expand, hide, &self.context()) + .get_fileset_revision(rev_id, expand, hide, &context) + .await } - fn get_release( + async fn get_release( &self, ident: String, expand: Option<String>, hide: Option<String>, - ) -> Box<dyn Future<Item = GetReleaseResponse, Error = ApiError> + Send> { - self.api().get_release(ident, expand, hide, &self.context()) + ) -> Result<GetReleaseResponse, ApiError> { + let context = self.context().clone(); + self.api().get_release(ident, expand, hide, &context).await } - fn get_release_edit( - &self, - edit_id: String, - ) -> Box<dyn Future<Item = GetReleaseEditResponse, Error = ApiError> + Send> { - self.api().get_release_edit(edit_id, &self.context()) + async fn get_release_edit(&self, edit_id: String) -> Result<GetReleaseEditResponse, ApiError> { + let context = self.context().clone(); + self.api().get_release_edit(edit_id, &context).await } - fn get_release_files( + async fn get_release_files( &self, ident: String, hide: Option<String>, - ) -> Box<dyn Future<Item = GetReleaseFilesResponse, Error = ApiError> + Send> { - self.api().get_release_files(ident, hide, &self.context()) + ) -> Result<GetReleaseFilesResponse, ApiError> { + let context = self.context().clone(); + self.api().get_release_files(ident, hide, &context).await } - fn get_release_filesets( + async fn get_release_filesets( &self, ident: String, hide: Option<String>, - ) -> Box<dyn Future<Item = GetReleaseFilesetsResponse, Error = ApiError> + Send> { - self.api() - .get_release_filesets(ident, hide, &self.context()) + ) -> Result<GetReleaseFilesetsResponse, ApiError> { + let context = self.context().clone(); + self.api().get_release_filesets(ident, hide, &context).await } - fn get_release_history( + async fn get_release_history( &self, ident: String, limit: Option<i64>, - ) -> Box<dyn Future<Item = GetReleaseHistoryResponse, Error = ApiError> + Send> { - self.api() - .get_release_history(ident, limit, &self.context()) + ) -> Result<GetReleaseHistoryResponse, ApiError> { + let context = self.context().clone(); + self.api().get_release_history(ident, limit, &context).await } - fn get_release_redirects( + async fn get_release_redirects( &self, ident: String, - ) -> Box<dyn Future<Item = GetReleaseRedirectsResponse, Error = ApiError> + Send> { - self.api().get_release_redirects(ident, &self.context()) + ) -> Result<GetReleaseRedirectsResponse, ApiError> { + let context = self.context().clone(); + self.api().get_release_redirects(ident, &context).await } - fn get_release_revision( + async fn get_release_revision( &self, rev_id: String, expand: Option<String>, hide: Option<String>, - ) -> Box<dyn Future<Item = GetReleaseRevisionResponse, Error = ApiError> + Send> { + ) -> Result<GetReleaseRevisionResponse, ApiError> { + let context = self.context().clone(); self.api() - .get_release_revision(rev_id, expand, hide, &self.context()) + .get_release_revision(rev_id, expand, hide, &context) + .await } - fn get_release_webcaptures( + async fn get_release_webcaptures( &self, ident: String, hide: Option<String>, - ) -> Box<dyn Future<Item = GetReleaseWebcapturesResponse, Error = ApiError> + Send> { + ) -> Result<GetReleaseWebcapturesResponse, ApiError> { + let context = self.context().clone(); self.api() - .get_release_webcaptures(ident, hide, &self.context()) + .get_release_webcaptures(ident, hide, &context) + .await } - fn get_webcapture( + async fn get_webcapture( &self, ident: String, expand: Option<String>, hide: Option<String>, - ) -> Box<dyn Future<Item = GetWebcaptureResponse, Error = ApiError> + Send> { + ) -> Result<GetWebcaptureResponse, ApiError> { + let context = self.context().clone(); self.api() - .get_webcapture(ident, expand, hide, &self.context()) + .get_webcapture(ident, expand, hide, &context) + .await } - fn get_webcapture_edit( + async fn get_webcapture_edit( &self, edit_id: String, - ) -> Box<dyn Future<Item = GetWebcaptureEditResponse, Error = ApiError> + Send> { - self.api().get_webcapture_edit(edit_id, &self.context()) + ) -> Result<GetWebcaptureEditResponse, ApiError> { + let context = self.context().clone(); + self.api().get_webcapture_edit(edit_id, &context).await } - fn get_webcapture_history( + async fn get_webcapture_history( &self, ident: String, limit: Option<i64>, - ) -> Box<dyn Future<Item = GetWebcaptureHistoryResponse, Error = ApiError> + Send> { + ) -> Result<GetWebcaptureHistoryResponse, ApiError> { + let context = self.context().clone(); self.api() - .get_webcapture_history(ident, limit, &self.context()) + .get_webcapture_history(ident, limit, &context) + .await } - fn get_webcapture_redirects( + async fn get_webcapture_redirects( &self, ident: String, - ) -> Box<dyn Future<Item = GetWebcaptureRedirectsResponse, Error = ApiError> + Send> { - self.api().get_webcapture_redirects(ident, &self.context()) + ) -> Result<GetWebcaptureRedirectsResponse, ApiError> { + let context = self.context().clone(); + self.api().get_webcapture_redirects(ident, &context).await } - fn get_webcapture_revision( + async fn get_webcapture_revision( &self, rev_id: String, expand: Option<String>, hide: Option<String>, - ) -> Box<dyn Future<Item = GetWebcaptureRevisionResponse, Error = ApiError> + Send> { + ) -> Result<GetWebcaptureRevisionResponse, ApiError> { + let context = self.context().clone(); self.api() - .get_webcapture_revision(rev_id, expand, hide, &self.context()) + .get_webcapture_revision(rev_id, expand, hide, &context) + .await } - fn get_work( + async fn get_work( &self, ident: String, expand: Option<String>, hide: Option<String>, - ) -> Box<dyn Future<Item = GetWorkResponse, Error = ApiError> + Send> { - self.api().get_work(ident, expand, hide, &self.context()) + ) -> Result<GetWorkResponse, ApiError> { + let context = self.context().clone(); + self.api().get_work(ident, expand, hide, &context).await } - fn get_work_edit( - &self, - edit_id: String, - ) -> Box<dyn Future<Item = GetWorkEditResponse, Error = ApiError> + Send> { - self.api().get_work_edit(edit_id, &self.context()) + async fn get_work_edit(&self, edit_id: String) -> Result<GetWorkEditResponse, ApiError> { + let context = self.context().clone(); + self.api().get_work_edit(edit_id, &context).await } - fn get_work_history( + async fn get_work_history( &self, ident: String, limit: Option<i64>, - ) -> Box<dyn Future<Item = GetWorkHistoryResponse, Error = ApiError> + Send> { - self.api().get_work_history(ident, limit, &self.context()) + ) -> Result<GetWorkHistoryResponse, ApiError> { + let context = self.context().clone(); + self.api().get_work_history(ident, limit, &context).await } - fn get_work_redirects( + async fn get_work_redirects( &self, ident: String, - ) -> Box<dyn Future<Item = GetWorkRedirectsResponse, Error = ApiError> + Send> { - self.api().get_work_redirects(ident, &self.context()) + ) -> Result<GetWorkRedirectsResponse, ApiError> { + let context = self.context().clone(); + self.api().get_work_redirects(ident, &context).await } - fn get_work_releases( + async fn get_work_releases( &self, ident: String, hide: Option<String>, - ) -> Box<dyn Future<Item = GetWorkReleasesResponse, Error = ApiError> + Send> { - self.api().get_work_releases(ident, hide, &self.context()) + ) -> Result<GetWorkReleasesResponse, ApiError> { + let context = self.context().clone(); + self.api().get_work_releases(ident, hide, &context).await } - fn get_work_revision( + async fn get_work_revision( &self, rev_id: String, expand: Option<String>, hide: Option<String>, - ) -> Box<dyn Future<Item = GetWorkRevisionResponse, Error = ApiError> + Send> { + ) -> Result<GetWorkRevisionResponse, ApiError> { + let context = self.context().clone(); self.api() - .get_work_revision(rev_id, expand, hide, &self.context()) + .get_work_revision(rev_id, expand, hide, &context) + .await } - fn lookup_container( + async fn lookup_container( &self, issnl: Option<String>, wikidata_qid: Option<String>, expand: Option<String>, hide: Option<String>, - ) -> Box<dyn Future<Item = LookupContainerResponse, Error = ApiError> + Send> { + ) -> Result<LookupContainerResponse, ApiError> { + let context = self.context().clone(); self.api() - .lookup_container(issnl, wikidata_qid, expand, hide, &self.context()) + .lookup_container(issnl, wikidata_qid, expand, hide, &context) + .await } - fn lookup_creator( + async fn lookup_creator( &self, orcid: Option<String>, wikidata_qid: Option<String>, expand: Option<String>, hide: Option<String>, - ) -> Box<dyn Future<Item = LookupCreatorResponse, Error = ApiError> + Send> { + ) -> Result<LookupCreatorResponse, ApiError> { + let context = self.context().clone(); self.api() - .lookup_creator(orcid, wikidata_qid, expand, hide, &self.context()) + .lookup_creator(orcid, wikidata_qid, expand, hide, &context) + .await } - fn lookup_file( + async fn lookup_file( &self, md5: Option<String>, sha1: Option<String>, sha256: Option<String>, expand: Option<String>, hide: Option<String>, - ) -> Box<dyn Future<Item = LookupFileResponse, Error = ApiError> + Send> { + ) -> Result<LookupFileResponse, ApiError> { + let context = self.context().clone(); self.api() - .lookup_file(md5, sha1, sha256, expand, hide, &self.context()) + .lookup_file(md5, sha1, sha256, expand, hide, &context) + .await } - fn lookup_release( + async fn lookup_release( &self, doi: Option<String>, wikidata_qid: Option<String>, @@ -3598,112 +3686,138 @@ impl<'a, T: Api<C>, C> ApiNoContext for ContextWrapper<'a, T, C> { jstor: Option<String>, ark: Option<String>, mag: Option<String>, + doaj: Option<String>, + dblp: Option<String>, + oai: Option<String>, expand: Option<String>, hide: Option<String>, - ) -> Box<dyn Future<Item = LookupReleaseResponse, Error = ApiError> + Send> { - self.api().lookup_release( - doi, - wikidata_qid, - isbn13, - pmid, - pmcid, - core, - arxiv, - jstor, - ark, - mag, - expand, - hide, - &self.context(), - ) - } - - fn update_container( + ) -> Result<LookupReleaseResponse, ApiError> { + let context = self.context().clone(); + self.api() + .lookup_release( + doi, + wikidata_qid, + isbn13, + pmid, + pmcid, + core, + arxiv, + jstor, + ark, + mag, + doaj, + dblp, + oai, + expand, + hide, + &context, + ) + .await + } + + async fn update_container( &self, editgroup_id: String, ident: String, container_entity: models::ContainerEntity, - ) -> Box<dyn Future<Item = UpdateContainerResponse, Error = ApiError> + Send> { + ) -> Result<UpdateContainerResponse, ApiError> { + let context = self.context().clone(); self.api() - .update_container(editgroup_id, ident, container_entity, &self.context()) + .update_container(editgroup_id, ident, container_entity, &context) + .await } - fn update_creator( + async fn update_creator( &self, editgroup_id: String, ident: String, creator_entity: models::CreatorEntity, - ) -> Box<dyn Future<Item = UpdateCreatorResponse, Error = ApiError> + Send> { + ) -> Result<UpdateCreatorResponse, ApiError> { + let context = self.context().clone(); self.api() - .update_creator(editgroup_id, ident, creator_entity, &self.context()) + .update_creator(editgroup_id, ident, creator_entity, &context) + .await } - fn update_editgroup( + async fn update_editgroup( &self, editgroup_id: String, editgroup: models::Editgroup, submit: Option<bool>, - ) -> Box<dyn Future<Item = UpdateEditgroupResponse, Error = ApiError> + Send> { + ) -> Result<UpdateEditgroupResponse, ApiError> { + let context = self.context().clone(); self.api() - .update_editgroup(editgroup_id, editgroup, submit, &self.context()) + .update_editgroup(editgroup_id, editgroup, submit, &context) + .await } - fn update_editor( + async fn update_editor( &self, editor_id: String, editor: models::Editor, - ) -> Box<dyn Future<Item = UpdateEditorResponse, Error = ApiError> + Send> { - self.api().update_editor(editor_id, editor, &self.context()) + ) -> Result<UpdateEditorResponse, ApiError> { + let context = self.context().clone(); + self.api().update_editor(editor_id, editor, &context).await } - fn update_file( + async fn update_file( &self, editgroup_id: String, ident: String, file_entity: models::FileEntity, - ) -> Box<dyn Future<Item = UpdateFileResponse, Error = ApiError> + Send> { + ) -> Result<UpdateFileResponse, ApiError> { + let context = self.context().clone(); self.api() - .update_file(editgroup_id, ident, file_entity, &self.context()) + .update_file(editgroup_id, ident, file_entity, &context) + .await } - fn update_fileset( + async fn update_fileset( &self, editgroup_id: String, ident: String, fileset_entity: models::FilesetEntity, - ) -> Box<dyn Future<Item = UpdateFilesetResponse, Error = ApiError> + Send> { + ) -> Result<UpdateFilesetResponse, ApiError> { + let context = self.context().clone(); self.api() - .update_fileset(editgroup_id, ident, fileset_entity, &self.context()) + .update_fileset(editgroup_id, ident, fileset_entity, &context) + .await } - fn update_release( + async fn update_release( &self, editgroup_id: String, ident: String, release_entity: models::ReleaseEntity, - ) -> Box<dyn Future<Item = UpdateReleaseResponse, Error = ApiError> + Send> { + ) -> Result<UpdateReleaseResponse, ApiError> { + let context = self.context().clone(); self.api() - .update_release(editgroup_id, ident, release_entity, &self.context()) + .update_release(editgroup_id, ident, release_entity, &context) + .await } - fn update_webcapture( + async fn update_webcapture( &self, editgroup_id: String, ident: String, webcapture_entity: models::WebcaptureEntity, - ) -> Box<dyn Future<Item = UpdateWebcaptureResponse, Error = ApiError> + Send> { + ) -> Result<UpdateWebcaptureResponse, ApiError> { + let context = self.context().clone(); self.api() - .update_webcapture(editgroup_id, ident, webcapture_entity, &self.context()) + .update_webcapture(editgroup_id, ident, webcapture_entity, &context) + .await } - fn update_work( + async fn update_work( &self, editgroup_id: String, ident: String, work_entity: models::WorkEntity, - ) -> Box<dyn Future<Item = UpdateWorkResponse, Error = ApiError> + Send> { + ) -> Result<UpdateWorkResponse, ApiError> { + let context = self.context().clone(); self.api() - .update_work(editgroup_id, ident, work_entity, &self.context()) + .update_work(editgroup_id, ident, work_entity, &context) + .await } } |