diff options
Diffstat (limited to 'fatcat-openapi/src/lib.rs')
-rw-r--r-- | fatcat-openapi/src/lib.rs | 58 |
1 files changed, 56 insertions, 2 deletions
diff --git a/fatcat-openapi/src/lib.rs b/fatcat-openapi/src/lib.rs index ba49f27..8dd8e15 100644 --- a/fatcat-openapi/src/lib.rs +++ b/fatcat-openapi/src/lib.rs @@ -17,7 +17,7 @@ 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.3"; +pub const API_VERSION: &'static str = "0.4.0"; #[derive(Debug, PartialEq)] #[must_use] @@ -1363,6 +1363,19 @@ pub enum LookupCreatorResponse { #[derive(Debug, PartialEq)] #[must_use] +pub enum LookupEditorResponse { + /// Found + Found(models::Editor), + /// Bad Request + BadRequest(models::ErrorResponse), + /// Not Found + NotFound(models::ErrorResponse), + /// Generic Error + GenericError(models::ErrorResponse), +} + +#[derive(Debug, PartialEq)] +#[must_use] pub enum LookupFileResponse { /// Found Entity FoundEntity(models::FileEntity), @@ -2145,6 +2158,9 @@ pub trait Api<C: Send + Sync> { async fn lookup_container( &self, issnl: Option<String>, + issne: Option<String>, + issnp: Option<String>, + issn: Option<String>, wikidata_qid: Option<String>, expand: Option<String>, hide: Option<String>, @@ -2160,6 +2176,12 @@ pub trait Api<C: Send + Sync> { context: &C, ) -> Result<LookupCreatorResponse, ApiError>; + async fn lookup_editor( + &self, + username: Option<String>, + context: &C, + ) -> Result<LookupEditorResponse, ApiError>; + async fn lookup_file( &self, md5: Option<String>, @@ -2185,6 +2207,7 @@ pub trait Api<C: Send + Sync> { doaj: Option<String>, dblp: Option<String>, oai: Option<String>, + hdl: Option<String>, expand: Option<String>, hide: Option<String>, context: &C, @@ -2721,6 +2744,9 @@ pub trait ApiNoContext<C: Send + Sync> { async fn lookup_container( &self, issnl: Option<String>, + issne: Option<String>, + issnp: Option<String>, + issn: Option<String>, wikidata_qid: Option<String>, expand: Option<String>, hide: Option<String>, @@ -2734,6 +2760,11 @@ pub trait ApiNoContext<C: Send + Sync> { hide: Option<String>, ) -> Result<LookupCreatorResponse, ApiError>; + async fn lookup_editor( + &self, + username: Option<String>, + ) -> Result<LookupEditorResponse, ApiError>; + async fn lookup_file( &self, md5: Option<String>, @@ -2758,6 +2789,7 @@ pub trait ApiNoContext<C: Send + Sync> { doaj: Option<String>, dblp: Option<String>, oai: Option<String>, + hdl: Option<String>, expand: Option<String>, hide: Option<String>, ) -> Result<LookupReleaseResponse, ApiError>; @@ -3637,13 +3669,25 @@ impl<T: Api<C> + Send + Sync, C: Clone + Send + Sync> ApiNoContext<C> for Contex async fn lookup_container( &self, issnl: Option<String>, + issne: Option<String>, + issnp: Option<String>, + issn: Option<String>, wikidata_qid: Option<String>, expand: Option<String>, hide: Option<String>, ) -> Result<LookupContainerResponse, ApiError> { let context = self.context().clone(); self.api() - .lookup_container(issnl, wikidata_qid, expand, hide, &context) + .lookup_container( + issnl, + issne, + issnp, + issn, + wikidata_qid, + expand, + hide, + &context, + ) .await } @@ -3660,6 +3704,14 @@ impl<T: Api<C> + Send + Sync, C: Clone + Send + Sync> ApiNoContext<C> for Contex .await } + async fn lookup_editor( + &self, + username: Option<String>, + ) -> Result<LookupEditorResponse, ApiError> { + let context = self.context().clone(); + self.api().lookup_editor(username, &context).await + } + async fn lookup_file( &self, md5: Option<String>, @@ -3689,6 +3741,7 @@ impl<T: Api<C> + Send + Sync, C: Clone + Send + Sync> ApiNoContext<C> for Contex doaj: Option<String>, dblp: Option<String>, oai: Option<String>, + hdl: Option<String>, expand: Option<String>, hide: Option<String>, ) -> Result<LookupReleaseResponse, ApiError> { @@ -3708,6 +3761,7 @@ impl<T: Api<C> + Send + Sync, C: Clone + Send + Sync> ApiNoContext<C> for Contex doaj, dblp, oai, + hdl, expand, hide, &context, |