#![allow(missing_docs, trivial_casts, unused_variables, unused_mut, unused_imports, unused_extern_crates, non_camel_case_types)] extern crate serde; #[macro_use] extern crate serde_derive; extern crate serde_json; extern crate chrono; extern crate futures; #[macro_use] extern crate lazy_static; #[macro_use] extern crate log; // Logically this should be in the client and server modules, but rust doesn't allow `macro_use` from a module. #[cfg(any(feature = "client", feature = "server"))] #[macro_use] extern crate hyper; extern crate swagger; use futures::Stream; use std::io::Error; #[allow(unused_imports)] use std::collections::HashMap; pub use futures::Future; #[cfg(any(feature = "client", feature = "server"))] mod mimetypes; pub use swagger::{ApiError, Context, ContextWrapper}; #[derive(Debug, PartialEq)] pub enum CreateContainerResponse { /// Created Entity CreatedEntity(models::EntityEdit), /// Bad Request BadRequest(models::ErrorResponse), /// Not Found NotFound(models::ErrorResponse), /// Generic Error GenericError(models::ErrorResponse), } #[derive(Debug, PartialEq)] pub enum CreateContainerBatchResponse { /// Created Entities CreatedEntities(Vec), /// Bad Request BadRequest(models::ErrorResponse), /// Not Found NotFound(models::ErrorResponse), /// Generic Error GenericError(models::ErrorResponse), } #[derive(Debug, PartialEq)] pub enum DeleteContainerResponse { /// Deleted Entity DeletedEntity(models::EntityEdit), /// Bad Request BadRequest(models::ErrorResponse), /// Not Found NotFound(models::ErrorResponse), /// Generic Error GenericError(models::ErrorResponse), } #[derive(Debug, PartialEq)] pub enum DeleteContainerEditResponse { /// Deleted Edit DeletedEdit(models::Success), /// Bad Request BadRequest(models::ErrorResponse), /// Not Found NotFound(models::ErrorResponse), /// Generic Error GenericError(models::ErrorResponse), } #[derive(Debug, PartialEq)] pub enum GetContainerResponse { /// Found Entity FoundEntity(models::ContainerEntity), /// Bad Request BadRequest(models::ErrorResponse), /// Not Found NotFound(models::ErrorResponse), /// Generic Error GenericError(models::ErrorResponse), } #[derive(Debug, PartialEq)] pub enum GetContainerEditResponse { /// Found Edit FoundEdit(models::EntityEdit), /// Bad Request BadRequest(models::ErrorResponse), /// Not Found NotFound(models::ErrorResponse), /// Generic Error GenericError(models::ErrorResponse), } #[derive(Debug, PartialEq)] pub enum GetContainerHistoryResponse { /// Found Entity History FoundEntityHistory(Vec), /// Bad Request BadRequest(models::ErrorResponse), /// Not Found NotFound(models::ErrorResponse), /// Generic Error GenericError(models::ErrorResponse), } #[derive(Debug, PartialEq)] pub enum GetContainerRedirectsResponse { /// Found Entity Redirects FoundEntityRedirects(Vec), /// Bad Request BadRequest(models::ErrorResponse), /// Not Found NotFound(models::ErrorResponse), /// Generic Error GenericError(models::ErrorResponse), } #[derive(Debug, PartialEq)] pub enum GetContainerRevisionResponse { /// Found Entity Revision FoundEntityRevision(models::ContainerEntity), /// Bad Request BadRequest(models::ErrorResponse), /// Not Found NotFound(models::ErrorResponse), /// Generic Error GenericError(models::ErrorResponse), } #[derive(Debug, PartialEq)] pub enum LookupContainerResponse { /// Found Entity FoundEntity(models::ContainerEntity), /// Bad Request BadRequest(models::ErrorResponse), /// Not Found NotFound(models::ErrorResponse), /// Generic Error GenericError(models::ErrorResponse), } #[derive(Debug, PartialEq)] pub enum UpdateContainerResponse { /// Updated Entity UpdatedEntity(models::EntityEdit), /// Bad Request BadRequest(models::ErrorResponse), /// Not Found NotFound(models::ErrorResponse), /// Generic Error GenericError(models::ErrorResponse), } #[derive(Debug, PartialEq)] pub enum CreateCreatorResponse { /// Created Entity CreatedEntity(models::EntityEdit), /// Bad Request BadRequest(models::ErrorResponse), /// Not Found NotFound(models::ErrorResponse), /// Generic Error GenericError(models::ErrorResponse), } #[derive(Debug, PartialEq)] pub enum CreateCreatorBatchResponse { /// Created Entities CreatedEntities(Vec), /// Bad Request BadRequest(models::ErrorResponse), /// Not Found NotFound(models::ErrorResponse), /// Generic Error GenericError(models::ErrorResponse), } #[derive(Debug, PartialEq)] pub enum DeleteCreatorResponse { /// Deleted Entity DeletedEntity(models::EntityEdit), /// Bad Request BadRequest(models::ErrorResponse), /// Not Found NotFound(models::ErrorResponse), /// Generic Error GenericError(models::ErrorResponse), } #[derive(Debug, PartialEq)] pub enum DeleteCreatorEditResponse { /// Deleted Edit DeletedEdit(models::Success), /// Bad Request BadRequest(models::ErrorResponse), /// Not Found NotFound(models::ErrorResponse), /// Generic Error GenericError(models::ErrorResponse), } #[derive(Debug, PartialEq)] pub enum GetCreatorResponse { /// Found Entity FoundEntity(models::CreatorEntity), /// Bad Request BadRequest(models::ErrorResponse), /// Not Found NotFound(models::ErrorResponse), /// Generic Error GenericError(models::ErrorResponse), } #[derive(Debug, PartialEq)] pub enum GetCreatorEditResponse { /// Found Edit FoundEdit(models::EntityEdit), /// Bad Request BadRequest(models::ErrorResponse), /// Not Found NotFound(models::ErrorResponse), /// Generic Error GenericError(models::ErrorResponse), } #[derive(Debug, PartialEq)] pub enum GetCreatorHistoryResponse { /// Found Entity History FoundEntityHistory(Vec), /// Bad Request BadRequest(models::ErrorResponse), /// Not Found NotFound(models::ErrorResponse), /// Generic Error GenericError(models::ErrorResponse), } #[derive(Debug, PartialEq)] pub enum GetCreatorRedirectsResponse { /// Found Entity Redirects FoundEntityRedirects(Vec), /// Bad Request BadRequest(models::ErrorResponse), /// Not Found NotFound(models::ErrorResponse), /// Generic Error GenericError(models::ErrorResponse), } #[derive(Debug, PartialEq)] pub enum GetCreatorReleasesResponse { /// Found Found(Vec), /// Bad Request BadRequest(models::ErrorResponse), /// Not Found NotFound(models::ErrorResponse), /// Generic Error GenericError(models::ErrorResponse), } #[derive(Debug, PartialEq)] pub enum GetCreatorRevisionResponse { /// Found Entity Revision FoundEntityRevision(models::CreatorEntity), /// Bad Request BadRequest(models::ErrorResponse), /// Not Found NotFound(models::ErrorResponse), /// Generic Error GenericError(models::ErrorResponse), } #[derive(Debug, PartialEq)] pub enum LookupCreatorResponse { /// Found Entity FoundEntity(models::CreatorEntity), /// Bad Request BadRequest(models::ErrorResponse), /// Not Found NotFound(models::ErrorResponse), /// Generic Error GenericError(models::ErrorResponse), } #[derive(Debug, PartialEq)] pub enum UpdateCreatorResponse { /// Updated Entity UpdatedEntity(models::EntityEdit), /// Bad Request BadRequest(models::ErrorResponse), /// Not Found NotFound(models::ErrorResponse), /// Generic Error GenericError(models::ErrorResponse), } #[derive(Debug, PartialEq)] pub enum GetEditorResponse { /// Found Found(models::Editor), /// Bad Request BadRequest(models::ErrorResponse), /// Not Found NotFound(models::ErrorResponse), /// Generic Error GenericError(models::ErrorResponse), } #[derive(Debug, PartialEq)] pub enum GetEditorChangelogResponse { /// Found Found(Vec), /// Bad Request BadRequest(models::ErrorResponse), /// Not Found NotFound(models::ErrorResponse), /// Generic Error GenericError(models::ErrorResponse), } #[derive(Debug, PartialEq)] pub enum AcceptEditgroupResponse { /// Merged Successfully MergedSuccessfully(models::Success), /// Bad Request BadRequest(models::ErrorResponse), /// Not Found NotFound(models::ErrorResponse), /// Edit Conflict EditConflict(models::ErrorResponse), /// Generic Error GenericError(models::ErrorResponse), } #[derive(Debug, PartialEq)] pub enum CreateEditgroupResponse { /// Successfully Created SuccessfullyCreated(models::Editgroup), /// Bad Request BadRequest(models::ErrorResponse), /// Generic Error GenericError(models::ErrorResponse), } #[derive(Debug, PartialEq)] pub enum GetChangelogResponse { /// Success Success(Vec), /// Generic Error GenericError(models::ErrorResponse), } #[derive(Debug, PartialEq)] pub enum GetChangelogEntryResponse { /// Found Changelog Entry FoundChangelogEntry(models::ChangelogEntry), /// Not Found NotFound(models::ErrorResponse), /// Generic Error GenericError(models::ErrorResponse), } #[derive(Debug, PartialEq)] pub enum GetEditgroupResponse { /// Found Found(models::Editgroup), /// Bad Request BadRequest(models::ErrorResponse), /// Not Found NotFound(models::ErrorResponse), /// Generic Error GenericError(models::ErrorResponse), } #[derive(Debug, PartialEq)] pub enum CreateFileResponse { /// Created Entity CreatedEntity(models::EntityEdit), /// Bad Request BadRequest(models::ErrorResponse), /// Not Found NotFound(models::ErrorResponse), /// Generic Error GenericError(models::ErrorResponse), } #[derive(Debug, PartialEq)] pub enum CreateFileBatchResponse { /// Created Entities CreatedEntities(Vec), /// Bad Request BadRequest(models::ErrorResponse), /// Not Found NotFound(models::ErrorResponse), /// Generic Error GenericError(models::ErrorResponse), } #[derive(Debug, PartialEq)] pub enum DeleteFileResponse { /// Deleted Entity DeletedEntity(models::EntityEdit), /// Bad Request BadRequest(models::ErrorResponse), /// Not Found NotFound(models::ErrorResponse), /// Generic Error GenericError(models::ErrorResponse), } #[derive(Debug, PartialEq)] pub enum DeleteFileEditResponse { /// Deleted Edit DeletedEdit(models::Success), /// Bad Request BadRequest(models::ErrorResponse), /// Not Found NotFound(models::ErrorResponse), /// Generic Error GenericError(models::ErrorResponse), } #[derive(Debug, PartialEq)] pub enum GetFileResponse { /// Found Entity FoundEntity(models::FileEntity), /// Bad Request BadRequest(models::ErrorResponse), /// Not Found NotFound(models::ErrorResponse), /// Generic Error GenericError(models::ErrorResponse), } #[derive(Debug, PartialEq)] pub enum GetFileEditResponse { /// Found Edit FoundEdit(models::EntityEdit), /// Bad Request BadRequest(models::ErrorResponse), /// Not Found NotFound(models::ErrorResponse), /// Generic Error GenericError(models::ErrorResponse), } #[derive(Debug, PartialEq)] pub enum GetFileHistoryResponse { /// Found Entity History FoundEntityHistory(Vec), /// Bad Request BadRequest(models::ErrorResponse), /// Not Found NotFound(models::ErrorResponse), /// Generic Error GenericError(models::ErrorResponse), } #[derive(Debug, PartialEq)] pub enum GetFileRedirectsResponse { /// Found Entity Redirects FoundEntityRedirects(Vec), /// Bad Request BadRequest(models::ErrorResponse), /// Not Found NotFound(models::ErrorResponse), /// Generic Error GenericError(models::ErrorResponse), } #[derive(Debug, PartialEq)] pub enum GetFileRevisionResponse { /// Found Entity Revision FoundEntityRevision(models::FileEntity), /// Bad Request BadRequest(models::ErrorResponse), /// Not Found NotFound(models::ErrorResponse), /// Generic Error GenericError(models::ErrorResponse), } #[derive(Debug, PartialEq)] pub enum LookupFileResponse { /// Found Entity FoundEntity(models::FileEntity), /// Bad Request BadRequest(models::ErrorResponse), /// Not Found NotFound(models::ErrorResponse), /// Generic Error GenericError(models::ErrorResponse), } #[derive(Debug, PartialEq)] pub enum UpdateFileResponse { /// Updated Entity UpdatedEntity(models::EntityEdit), /// Bad Request BadRequest(models::ErrorResponse), /// Not Found NotFound(models::ErrorResponse), /// Generic Error GenericError(models::ErrorResponse), } #[derive(Debug, PartialEq)] pub enum CreateReleaseResponse { /// Created Entity CreatedEntity(models::EntityEdit), /// Bad Request BadRequest(models::ErrorResponse), /// Not Found NotFound(models::ErrorResponse), /// Generic Error GenericError(models::ErrorResponse), } #[derive(Debug, PartialEq)] pub enum CreateReleaseBatchResponse { /// Created Entities CreatedEntities(Vec), /// Bad Request BadRequest(models::ErrorResponse), /// Not Found NotFound(models::ErrorResponse), /// Generic Error GenericError(models::ErrorResponse), } #[derive(Debug, PartialEq)] pub enum CreateWorkResponse { /// Created Entity CreatedEntity(models::EntityEdit), /// Bad Request BadRequest(models::ErrorResponse), /// Not Found NotFound(models::ErrorResponse), /// Generic Error GenericError(models::ErrorResponse), } #[derive(Debug, PartialEq)] pub enum DeleteReleaseResponse { /// Deleted Entity DeletedEntity(models::EntityEdit), /// Bad Request BadRequest(models::ErrorResponse), /// Not Found NotFound(models::ErrorResponse), /// Generic Error GenericError(models::ErrorResponse), } #[derive(Debug, PartialEq)] pub enum DeleteReleaseEditResponse { /// Deleted Edit DeletedEdit(models::Success), /// Bad Request BadRequest(models::ErrorResponse), /// Not Found NotFound(models::ErrorResponse), /// Generic Error GenericError(models::ErrorResponse), } #[derive(Debug, PartialEq)] pub enum GetReleaseResponse { /// Found Entity FoundEntity(models::ReleaseEntity), /// Bad Request BadRequest(models::ErrorResponse), /// Not Found NotFound(models::ErrorResponse), /// Generic Error GenericError(models::ErrorResponse), } #[derive(Debug, PartialEq)] pub enum GetReleaseEditResponse { /// Found Edit FoundEdit(models::EntityEdit), /// Bad Request BadRequest(models::ErrorResponse), /// Not Found NotFound(models::ErrorResponse), /// Generic Error GenericError(models::ErrorResponse), } #[derive(Debug, PartialEq)] pub enum GetReleaseFilesResponse { /// Found Found(Vec), /// Bad Request BadRequest(models::ErrorResponse), /// Not Found NotFound(models::ErrorResponse), /// Generic Error GenericError(models::ErrorResponse), } #[derive(Debug, PartialEq)] pub enum GetReleaseHistoryResponse { /// Found Entity History FoundEntityHistory(Vec), /// Bad Request BadRequest(models::ErrorResponse), /// Not Found NotFound(models::ErrorResponse), /// Generic Error GenericError(models::ErrorResponse), } #[derive(Debug, PartialEq)] pub enum GetReleaseRedirectsResponse { /// Found Entity Redirects FoundEntityRedirects(Vec), /// Bad Request BadRequest(models::ErrorResponse), /// Not Found NotFound(models::ErrorResponse), /// Generic Error GenericError(models::ErrorResponse), } #[derive(Debug, PartialEq)] pub enum GetReleaseRevisionResponse { /// Found Entity Revision FoundEntityRevision(models::ReleaseEntity), /// Bad Request BadRequest(models::ErrorResponse), /// Not Found NotFound(models::ErrorResponse), /// Generic Error GenericError(models::ErrorResponse), } #[derive(Debug, PartialEq)] pub enum LookupReleaseResponse { /// Found Entity FoundEntity(models::ReleaseEntity), /// Bad Request BadRequest(models::ErrorResponse), /// Not Found NotFound(models::ErrorResponse), /// Generic Error GenericError(models::ErrorResponse), } #[derive(Debug, PartialEq)] pub enum UpdateReleaseResponse { /// Updated Entity UpdatedEntity(models::EntityEdit), /// Bad Request BadRequest(models::ErrorResponse), /// Not Found NotFound(models::ErrorResponse), /// Generic Error GenericError(models::ErrorResponse), } #[derive(Debug, PartialEq)] pub enum CreateWorkBatchResponse { /// Created Entities CreatedEntities(Vec), /// Bad Request BadRequest(models::ErrorResponse), /// Not Found NotFound(models::ErrorResponse), /// Generic Error GenericError(models::ErrorResponse), } #[derive(Debug, PartialEq)] pub enum DeleteWorkResponse { /// Deleted Entity DeletedEntity(models::EntityEdit), /// Bad Request BadRequest(models::ErrorResponse), /// Not Found NotFound(models::ErrorResponse), /// Generic Error GenericError(models::ErrorResponse), } #[derive(Debug, PartialEq)] pub enum DeleteWorkEditResponse { /// Deleted Edit DeletedEdit(models::Success), /// Bad Request BadRequest(models::ErrorResponse), /// Not Found NotFound(models::ErrorResponse), /// Generic Error GenericError(models::ErrorResponse), } #[derive(Debug, PartialEq)] pub enum GetWorkResponse { /// Found Entity FoundEntity(models::WorkEntity), /// Bad Request BadRequest(models::ErrorResponse), /// Not Found NotFound(models::ErrorResponse), /// Generic Error GenericError(models::ErrorResponse), } #[derive(Debug, PartialEq)] pub enum GetWorkEditResponse { /// Found Edit FoundEdit(models::EntityEdit), /// Bad Request BadRequest(models::ErrorResponse), /// Not Found NotFound(models::ErrorResponse), /// Generic Error GenericError(models::ErrorResponse), } #[derive(Debug, PartialEq)] pub enum GetWorkHistoryResponse { /// Found Entity History FoundEntityHistory(Vec), /// Bad Request BadRequest(models::ErrorResponse), /// Not Found NotFound(models::ErrorResponse), /// Generic Error GenericError(models::ErrorResponse), } #[derive(Debug, PartialEq)] pub enum GetWorkRedirectsResponse { /// Found Entity Redirects FoundEntityRedirects(Vec), /// Bad Request BadRequest(models::ErrorResponse), /// Not Found NotFound(models::ErrorResponse), /// Generic Error GenericError(models::ErrorResponse), } #[derive(Debug, PartialEq)] pub enum GetWorkReleasesResponse { /// Found Found(Vec), /// Bad Request BadRequest(models::ErrorResponse), /// Not Found NotFound(models::ErrorResponse), /// Generic Error GenericError(models::ErrorResponse), } #[derive(Debug, PartialEq)] pub enum GetWorkRevisionResponse { /// Found Entity Revision FoundEntityRevision(models::WorkEntity), /// Bad Request BadRequest(models::ErrorResponse), /// Not Found NotFound(models::ErrorResponse), /// Generic Error GenericError(models::ErrorResponse), } #[derive(Debug, PartialEq)] pub enum UpdateWorkResponse { /// Updated Entity UpdatedEntity(models::EntityEdit), /// Bad Request BadRequest(models::ErrorResponse), /// Not Found NotFound(models::ErrorResponse), /// Generic Error GenericError(models::ErrorResponse), } /// API pub trait Api { fn create_container(&self, entity: models::ContainerEntity, editgroup_id: Option, context: &Context) -> Box + Send>; fn create_container_batch( &self, entity_list: &Vec, autoaccept: Option, editgroup_id: Option, context: &Context, ) -> Box + Send>; fn delete_container(&self, ident: String, editgroup_id: Option, context: &Context) -> Box + Send>; fn delete_container_edit(&self, edit_id: i64, context: &Context) -> Box + Send>; fn get_container(&self, ident: String, expand: Option, hide: Option, context: &Context) -> Box + Send>; fn get_container_edit(&self, edit_id: i64, context: &Context) -> Box + Send>; fn get_container_history(&self, ident: String, limit: Option, context: &Context) -> Box + Send>; fn get_container_redirects(&self, ident: String, context: &Context) -> Box + Send>; fn get_container_revision(&self, rev_id: String, expand: Option, hide: Option, context: &Context) -> Box + Send>; fn lookup_container( &self, issnl: Option, wikidata_qid: Option, expand: Option, hide: Option, context: &Context, ) -> Box + Send>; fn update_container(&self, ident: String, entity: models::ContainerEntity, editgroup_id: Option, context: &Context) -> Box + Send>; fn create_creator(&self, entity: models::CreatorEntity, editgroup_id: Option, context: &Context) -> Box + Send>; fn create_creator_batch( &self, entity_list: &Vec, autoaccept: Option, editgroup_id: Option, context: &Context, ) -> Box + Send>; fn delete_creator(&self, ident: String, editgroup_id: Option, context: &Context) -> Box + Send>; fn delete_creator_edit(&self, edit_id: i64, context: &Context) -> Box + Send>; fn get_creator(&self, ident: String, expand: Option, hide: Option, context: &Context) -> Box + Send>; fn get_creator_edit(&self, edit_id: i64, context: &Context) -> Box + Send>; fn get_creator_history(&self, ident: String, limit: Option, context: &Context) -> Box + Send>; fn get_creator_redirects(&self, ident: String, context: &Context) -> Box + Send>; fn get_creator_releases(&self, ident: String, hide: Option, context: &Context) -> Box + Send>; fn get_creator_revision(&self, rev_id: String, expand: Option, hide: Option, context: &Context) -> Box + Send>; fn lookup_creator( &self, orcid: Option, wikidata_qid: Option, expand: Option, hide: Option, context: &Context, ) -> Box + Send>; fn update_creator(&self, ident: String, entity: models::CreatorEntity, editgroup_id: Option, context: &Context) -> Box + Send>; fn get_editor(&self, editor_id: String, context: &Context) -> Box + Send>; fn get_editor_changelog(&self, editor_id: String, context: &Context) -> Box + Send>; fn accept_editgroup(&self, editgroup_id: String, context: &Context) -> Box + Send>; fn create_editgroup(&self, editgroup: models::Editgroup, context: &Context) -> Box + Send>; fn get_changelog(&self, limit: Option, context: &Context) -> Box + Send>; fn get_changelog_entry(&self, index: i64, context: &Context) -> Box + Send>; fn get_editgroup(&self, editgroup_id: String, context: &Context) -> Box + Send>; fn create_file(&self, entity: models::FileEntity, editgroup_id: Option, context: &Context) -> Box + Send>; fn create_file_batch( &self, entity_list: &Vec, autoaccept: Option, editgroup_id: Option, context: &Context, ) -> Box + Send>; fn delete_file(&self, ident: String, editgroup_id: Option, context: &Context) -> Box + Send>; fn delete_file_edit(&self, edit_id: i64, context: &Context) -> Box + Send>; fn get_file(&self, ident: String, expand: Option, hide: Option, context: &Context) -> Box + Send>; fn get_file_edit(&self, edit_id: i64, context: &Context) -> Box + Send>; fn get_file_history(&self, ident: String, limit: Option, context: &Context) -> Box + Send>; fn get_file_redirects(&self, ident: String, context: &Context) -> Box + Send>; fn get_file_revision(&self, rev_id: String, expand: Option, hide: Option, context: &Context) -> Box + Send>; fn lookup_file( &self, md5: Option, sha1: Option, sha256: Option, expand: Option, hide: Option, context: &Context, ) -> Box + Send>; fn update_file(&self, ident: String, entity: models::FileEntity, editgroup_id: Option, context: &Context) -> Box + Send>; fn create_release(&self, entity: models::ReleaseEntity, editgroup_id: Option, context: &Context) -> Box + Send>; fn create_release_batch( &self, entity_list: &Vec, autoaccept: Option, editgroup_id: Option, context: &Context, ) -> Box + Send>; fn create_work(&self, entity: models::WorkEntity, editgroup_id: Option, context: &Context) -> Box + Send>; fn delete_release(&self, ident: String, editgroup_id: Option, context: &Context) -> Box + Send>; fn delete_release_edit(&self, edit_id: i64, context: &Context) -> Box + Send>; fn get_release(&self, ident: String, expand: Option, hide: Option, context: &Context) -> Box + Send>; fn get_release_edit(&self, edit_id: i64, context: &Context) -> Box + Send>; fn get_release_files(&self, ident: String, hide: Option, context: &Context) -> Box + Send>; fn get_release_history(&self, ident: String, limit: Option, context: &Context) -> Box + Send>; fn get_release_redirects(&self, ident: String, context: &Context) -> Box + Send>; fn get_release_revision(&self, rev_id: String, expand: Option, hide: Option, context: &Context) -> Box + Send>; fn lookup_release( &self, doi: Option, wikidata_qid: Option, isbn13: Option, pmid: Option, pmcid: Option, core_id: Option, expand: Option, hide: Option, context: &Context, ) -> Box + Send>; fn update_release(&self, ident: String, entity: models::ReleaseEntity, editgroup_id: Option, context: &Context) -> Box + Send>; fn create_work_batch( &self, entity_list: &Vec, autoaccept: Option, editgroup_id: Option, context: &Context, ) -> Box + Send>; fn delete_work(&self, ident: String, editgroup_id: Option, context: &Context) -> Box + Send>; fn delete_work_edit(&self, edit_id: i64, context: &Context) -> Box + Send>; fn get_work(&self, ident: String, expand: Option, hide: Option, context: &Context) -> Box + Send>; fn get_work_edit(&self, edit_id: i64, context: &Context) -> Box + Send>; fn get_work_history(&self, ident: String, limit: Option, context: &Context) -> Box + Send>; fn get_work_redirects(&self, ident: String, context: &Context) -> Box + Send>; fn get_work_releases(&self, ident: String, hide: Option, context: &Context) -> Box + Send>; fn get_work_revision(&self, rev_id: String, expand: Option, hide: Option, context: &Context) -> Box + Send>; fn update_work(&self, ident: String, entity: models::WorkEntity, editgroup_id: Option, context: &Context) -> Box + Send>; } /// API without a `Context` pub trait ApiNoContext { fn create_container(&self, entity: models::ContainerEntity, editgroup_id: Option) -> Box + Send>; fn create_container_batch( &self, entity_list: &Vec, autoaccept: Option, editgroup_id: Option, ) -> Box + Send>; fn delete_container(&self, ident: String, editgroup_id: Option) -> Box + Send>; fn delete_container_edit(&self, edit_id: i64) -> Box + Send>; fn get_container(&self, ident: String, expand: Option, hide: Option) -> Box + Send>; fn get_container_edit(&self, edit_id: i64) -> Box + Send>; fn get_container_history(&self, ident: String, limit: Option) -> Box + Send>; fn get_container_redirects(&self, ident: String) -> Box + Send>; fn get_container_revision(&self, rev_id: String, expand: Option, hide: Option) -> Box + Send>; fn lookup_container( &self, issnl: Option, wikidata_qid: Option, expand: Option, hide: Option, ) -> Box + Send>; fn update_container(&self, ident: String, entity: models::ContainerEntity, editgroup_id: Option) -> Box + Send>; fn create_creator(&self, entity: models::CreatorEntity, editgroup_id: Option) -> Box + Send>; fn create_creator_batch( &self, entity_list: &Vec, autoaccept: Option, editgroup_id: Option, ) -> Box + Send>; fn delete_creator(&self, ident: String, editgroup_id: Option) -> Box + Send>; fn delete_creator_edit(&self, edit_id: i64) -> Box + Send>; fn get_creator(&self, ident: String, expand: Option, hide: Option) -> Box + Send>; fn get_creator_edit(&self, edit_id: i64) -> Box + Send>; fn get_creator_history(&self, ident: String, limit: Option) -> Box + Send>; fn get_creator_redirects(&self, ident: String) -> Box + Send>; fn get_creator_releases(&self, ident: String, hide: Option) -> Box + Send>; fn get_creator_revision(&self, rev_id: String, expand: Option, hide: Option) -> Box + Send>; fn lookup_creator(&self, orcid: Option, wikidata_qid: Option, expand: Option, hide: Option) -> Box + Send>; fn update_creator(&self, ident: String, entity: models::CreatorEntity, editgroup_id: Option) -> Box + Send>; fn get_editor(&self, editor_id: String) -> Box + Send>; fn get_editor_changelog(&self, editor_id: String) -> Box + Send>; fn accept_editgroup(&self, editgroup_id: String) -> Box + Send>; fn create_editgroup(&self, editgroup: models::Editgroup) -> Box + Send>; fn get_changelog(&self, limit: Option) -> Box + Send>; fn get_changelog_entry(&self, index: i64) -> Box + Send>; fn get_editgroup(&self, editgroup_id: String) -> Box + Send>; fn create_file(&self, entity: models::FileEntity, editgroup_id: Option) -> Box + Send>; fn create_file_batch(&self, entity_list: &Vec, autoaccept: Option, editgroup_id: Option) -> Box + Send>; fn delete_file(&self, ident: String, editgroup_id: Option) -> Box + Send>; fn delete_file_edit(&self, edit_id: i64) -> Box + Send>; fn get_file(&self, ident: String, expand: Option, hide: Option) -> Box + Send>; fn get_file_edit(&self, edit_id: i64) -> Box + Send>; fn get_file_history(&self, ident: String, limit: Option) -> Box + Send>; fn get_file_redirects(&self, ident: String) -> Box + Send>; fn get_file_revision(&self, rev_id: String, expand: Option, hide: Option) -> Box + Send>; fn lookup_file( &self, md5: Option, sha1: Option, sha256: Option, expand: Option, hide: Option, ) -> Box + Send>; fn update_file(&self, ident: String, entity: models::FileEntity, editgroup_id: Option) -> Box + Send>; fn create_release(&self, entity: models::ReleaseEntity, editgroup_id: Option) -> Box + Send>; fn create_release_batch( &self, entity_list: &Vec, autoaccept: Option, editgroup_id: Option, ) -> Box + Send>; fn create_work(&self, entity: models::WorkEntity, editgroup_id: Option) -> Box + Send>; fn delete_release(&self, ident: String, editgroup_id: Option) -> Box + Send>; fn delete_release_edit(&self, edit_id: i64) -> Box + Send>; fn get_release(&self, ident: String, expand: Option, hide: Option) -> Box + Send>; fn get_release_edit(&self, edit_id: i64) -> Box + Send>; fn get_release_files(&self, ident: String, hide: Option) -> Box + Send>; fn get_release_history(&self, ident: String, limit: Option) -> Box + Send>; fn get_release_redirects(&self, ident: String) -> Box + Send>; fn get_release_revision(&self, rev_id: String, expand: Option, hide: Option) -> Box + Send>; fn lookup_release( &self, doi: Option, wikidata_qid: Option, isbn13: Option, pmid: Option, pmcid: Option, core_id: Option, expand: Option, hide: Option, ) -> Box + Send>; fn update_release(&self, ident: String, entity: models::ReleaseEntity, editgroup_id: Option) -> Box + Send>; fn create_work_batch(&self, entity_list: &Vec, autoaccept: Option, editgroup_id: Option) -> Box + Send>; fn delete_work(&self, ident: String, editgroup_id: Option) -> Box + Send>; fn delete_work_edit(&self, edit_id: i64) -> Box + Send>; fn get_work(&self, ident: String, expand: Option, hide: Option) -> Box + Send>; fn get_work_edit(&self, edit_id: i64) -> Box + Send>; fn get_work_history(&self, ident: String, limit: Option) -> Box + Send>; fn get_work_redirects(&self, ident: String) -> Box + Send>; fn get_work_releases(&self, ident: String, hide: Option) -> Box + Send>; fn get_work_revision(&self, rev_id: String, expand: Option, hide: Option) -> Box + Send>; fn update_work(&self, ident: String, entity: models::WorkEntity, editgroup_id: Option) -> Box + Send>; } /// Trait to extend an API to make it easy to bind it to a context. pub trait ContextWrapperExt<'a> where Self: Sized, { /// Binds this API to a context. fn with_context(self: &'a Self, context: Context) -> ContextWrapper<'a, Self>; } impl<'a, T: Api + Sized> ContextWrapperExt<'a> for T { fn with_context(self: &'a T, context: Context) -> ContextWrapper<'a, T> { ContextWrapper::::new(self, context) } } impl<'a, T: Api> ApiNoContext for ContextWrapper<'a, T> { fn create_container(&self, entity: models::ContainerEntity, editgroup_id: Option) -> Box + Send> { self.api().create_container(entity, editgroup_id, &self.context()) } fn create_container_batch( &self, entity_list: &Vec, autoaccept: Option, editgroup_id: Option, ) -> Box + Send> { self.api().create_container_batch(entity_list, autoaccept, editgroup_id, &self.context()) } fn delete_container(&self, ident: String, editgroup_id: Option) -> Box + Send> { self.api().delete_container(ident, editgroup_id, &self.context()) } fn delete_container_edit(&self, edit_id: i64) -> Box + Send> { self.api().delete_container_edit(edit_id, &self.context()) } fn get_container(&self, ident: String, expand: Option, hide: Option) -> Box + Send> { self.api().get_container(ident, expand, hide, &self.context()) } fn get_container_edit(&self, edit_id: i64) -> Box + Send> { self.api().get_container_edit(edit_id, &self.context()) } fn get_container_history(&self, ident: String, limit: Option) -> Box + Send> { self.api().get_container_history(ident, limit, &self.context()) } fn get_container_redirects(&self, ident: String) -> Box + Send> { self.api().get_container_redirects(ident, &self.context()) } fn get_container_revision(&self, rev_id: String, expand: Option, hide: Option) -> Box + Send> { self.api().get_container_revision(rev_id, expand, hide, &self.context()) } fn lookup_container( &self, issnl: Option, wikidata_qid: Option, expand: Option, hide: Option, ) -> Box + Send> { self.api().lookup_container(issnl, wikidata_qid, expand, hide, &self.context()) } fn update_container(&self, ident: String, entity: models::ContainerEntity, editgroup_id: Option) -> Box + Send> { self.api().update_container(ident, entity, editgroup_id, &self.context()) } fn create_creator(&self, entity: models::CreatorEntity, editgroup_id: Option) -> Box + Send> { self.api().create_creator(entity, editgroup_id, &self.context()) } fn create_creator_batch( &self, entity_list: &Vec, autoaccept: Option, editgroup_id: Option, ) -> Box + Send> { self.api().create_creator_batch(entity_list, autoaccept, editgroup_id, &self.context()) } fn delete_creator(&self, ident: String, editgroup_id: Option) -> Box + Send> { self.api().delete_creator(ident, editgroup_id, &self.context()) } fn delete_creator_edit(&self, edit_id: i64) -> Box + Send> { self.api().delete_creator_edit(edit_id, &self.context()) } fn get_creator(&self, ident: String, expand: Option, hide: Option) -> Box + Send> { self.api().get_creator(ident, expand, hide, &self.context()) } fn get_creator_edit(&self, edit_id: i64) -> Box + Send> { self.api().get_creator_edit(edit_id, &self.context()) } fn get_creator_history(&self, ident: String, limit: Option) -> Box + Send> { self.api().get_creator_history(ident, limit, &self.context()) } fn get_creator_redirects(&self, ident: String) -> Box + Send> { self.api().get_creator_redirects(ident, &self.context()) } fn get_creator_releases(&self, ident: String, hide: Option) -> Box + Send> { self.api().get_creator_releases(ident, hide, &self.context()) } fn get_creator_revision(&self, rev_id: String, expand: Option, hide: Option) -> Box + Send> { self.api().get_creator_revision(rev_id, expand, hide, &self.context()) } fn lookup_creator(&self, orcid: Option, wikidata_qid: Option, expand: Option, hide: Option) -> Box + Send> { self.api().lookup_creator(orcid, wikidata_qid, expand, hide, &self.context()) } fn update_creator(&self, ident: String, entity: models::CreatorEntity, editgroup_id: Option) -> Box + Send> { self.api().update_creator(ident, entity, editgroup_id, &self.context()) } fn get_editor(&self, editor_id: String) -> Box + Send> { self.api().get_editor(editor_id, &self.context()) } fn get_editor_changelog(&self, editor_id: String) -> Box + Send> { self.api().get_editor_changelog(editor_id, &self.context()) } fn accept_editgroup(&self, editgroup_id: String) -> Box + Send> { self.api().accept_editgroup(editgroup_id, &self.context()) } fn create_editgroup(&self, editgroup: models::Editgroup) -> Box + Send> { self.api().create_editgroup(editgroup, &self.context()) } fn get_changelog(&self, limit: Option) -> Box + Send> { self.api().get_changelog(limit, &self.context()) } fn get_changelog_entry(&self, index: i64) -> Box + Send> { self.api().get_changelog_entry(index, &self.context()) } fn get_editgroup(&self, editgroup_id: String) -> Box + Send> { self.api().get_editgroup(editgroup_id, &self.context()) } fn create_file(&self, entity: models::FileEntity, editgroup_id: Option) -> Box + Send> { self.api().create_file(entity, editgroup_id, &self.context()) } fn create_file_batch(&self, entity_list: &Vec, autoaccept: Option, editgroup_id: Option) -> Box + Send> { self.api().create_file_batch(entity_list, autoaccept, editgroup_id, &self.context()) } fn delete_file(&self, ident: String, editgroup_id: Option) -> Box + Send> { self.api().delete_file(ident, editgroup_id, &self.context()) } fn delete_file_edit(&self, edit_id: i64) -> Box + Send> { self.api().delete_file_edit(edit_id, &self.context()) } fn get_file(&self, ident: String, expand: Option, hide: Option) -> Box + Send> { self.api().get_file(ident, expand, hide, &self.context()) } fn get_file_edit(&self, edit_id: i64) -> Box + Send> { self.api().get_file_edit(edit_id, &self.context()) } fn get_file_history(&self, ident: String, limit: Option) -> Box + Send> { self.api().get_file_history(ident, limit, &self.context()) } fn get_file_redirects(&self, ident: String) -> Box + Send> { self.api().get_file_redirects(ident, &self.context()) } fn get_file_revision(&self, rev_id: String, expand: Option, hide: Option) -> Box + Send> { self.api().get_file_revision(rev_id, expand, hide, &self.context()) } fn lookup_file( &self, md5: Option, sha1: Option, sha256: Option, expand: Option, hide: Option, ) -> Box + Send> { self.api().lookup_file(md5, sha1, sha256, expand, hide, &self.context()) } fn update_file(&self, ident: String, entity: models::FileEntity, editgroup_id: Option) -> Box + Send> { self.api().update_file(ident, entity, editgroup_id, &self.context()) } fn create_release(&self, entity: models::ReleaseEntity, editgroup_id: Option) -> Box + Send> { self.api().create_release(entity, editgroup_id, &self.context()) } fn create_release_batch( &self, entity_list: &Vec, autoaccept: Option, editgroup_id: Option, ) -> Box + Send> { self.api().create_release_batch(entity_list, autoaccept, editgroup_id, &self.context()) } fn create_work(&self, entity: models::WorkEntity, editgroup_id: Option) -> Box + Send> { self.api().create_work(entity, editgroup_id, &self.context()) } fn delete_release(&self, ident: String, editgroup_id: Option) -> Box + Send> { self.api().delete_release(ident, editgroup_id, &self.context()) } fn delete_release_edit(&self, edit_id: i64) -> Box + Send> { self.api().delete_release_edit(edit_id, &self.context()) } fn get_release(&self, ident: String, expand: Option, hide: Option) -> Box + Send> { self.api().get_release(ident, expand, hide, &self.context()) } fn get_release_edit(&self, edit_id: i64) -> Box + Send> { self.api().get_release_edit(edit_id, &self.context()) } fn get_release_files(&self, ident: String, hide: Option) -> Box + Send> { self.api().get_release_files(ident, hide, &self.context()) } fn get_release_history(&self, ident: String, limit: Option) -> Box + Send> { self.api().get_release_history(ident, limit, &self.context()) } fn get_release_redirects(&self, ident: String) -> Box + Send> { self.api().get_release_redirects(ident, &self.context()) } fn get_release_revision(&self, rev_id: String, expand: Option, hide: Option) -> Box + Send> { self.api().get_release_revision(rev_id, expand, hide, &self.context()) } fn lookup_release( &self, doi: Option, wikidata_qid: Option, isbn13: Option, pmid: Option, pmcid: Option, core_id: Option, expand: Option, hide: Option, ) -> Box + Send> { self.api().lookup_release(doi, wikidata_qid, isbn13, pmid, pmcid, core_id, expand, hide, &self.context()) } fn update_release(&self, ident: String, entity: models::ReleaseEntity, editgroup_id: Option) -> Box + Send> { self.api().update_release(ident, entity, editgroup_id, &self.context()) } fn create_work_batch(&self, entity_list: &Vec, autoaccept: Option, editgroup_id: Option) -> Box + Send> { self.api().create_work_batch(entity_list, autoaccept, editgroup_id, &self.context()) } fn delete_work(&self, ident: String, editgroup_id: Option) -> Box + Send> { self.api().delete_work(ident, editgroup_id, &self.context()) } fn delete_work_edit(&self, edit_id: i64) -> Box + Send> { self.api().delete_work_edit(edit_id, &self.context()) } fn get_work(&self, ident: String, expand: Option, hide: Option) -> Box + Send> { self.api().get_work(ident, expand, hide, &self.context()) } fn get_work_edit(&self, edit_id: i64) -> Box + Send> { self.api().get_work_edit(edit_id, &self.context()) } fn get_work_history(&self, ident: String, limit: Option) -> Box + Send> { self.api().get_work_history(ident, limit, &self.context()) } fn get_work_redirects(&self, ident: String) -> Box + Send> { self.api().get_work_redirects(ident, &self.context()) } fn get_work_releases(&self, ident: String, hide: Option) -> Box + Send> { self.api().get_work_releases(ident, hide, &self.context()) } fn get_work_revision(&self, rev_id: String, expand: Option, hide: Option) -> Box + Send> { self.api().get_work_revision(rev_id, expand, hide, &self.context()) } fn update_work(&self, ident: String, entity: models::WorkEntity, editgroup_id: Option) -> Box + Send> { self.api().update_work(ident, entity, editgroup_id, &self.context()) } } #[cfg(feature = "client")] pub mod client; // Re-export Client as a top-level name #[cfg(feature = "client")] pub use self::client::Client; #[cfg(feature = "server")] pub mod server; // Re-export router() as a top-level name #[cfg(feature = "server")] pub use self::server::router; pub mod models;