diff options
author | Bryan Newbold <bnewbold@robocracy.org> | 2018-06-17 17:01:23 -0700 |
---|---|---|
committer | Bryan Newbold <bnewbold@robocracy.org> | 2018-06-17 17:01:23 -0700 |
commit | c1613504dbe96951ae59889fc11b0564cfbbcd83 (patch) | |
tree | 9c4aedd480e463a40691ac3cdd50d43fbe15fffe /rust/fatcat-api/src/lib.rs | |
parent | f3241d35dbb445b7e3c15f1759431580d830bffe (diff) | |
download | fatcat-c1613504dbe96951ae59889fc11b0564cfbbcd83.tar.gz fatcat-c1613504dbe96951ae59889fc11b0564cfbbcd83.zip |
update fatcat-api with openapi change
Diffstat (limited to 'rust/fatcat-api/src/lib.rs')
-rw-r--r-- | rust/fatcat-api/src/lib.rs | 60 |
1 files changed, 60 insertions, 0 deletions
diff --git a/rust/fatcat-api/src/lib.rs b/rust/fatcat-api/src/lib.rs index d16644ab..c926966e 100644 --- a/rust/fatcat-api/src/lib.rs +++ b/rust/fatcat-api/src/lib.rs @@ -199,6 +199,18 @@ pub enum GetCreatorResponse { } #[derive(Debug, PartialEq)] +pub enum GetCreatorReleasesResponse { + /// Found Entity + FoundEntity(Vec<models::ReleaseEntity>), + /// Bad Request + BadRequest(models::ErrorResponse), + /// Not Found + NotFound(models::ErrorResponse), + /// Generic Error + GenericError(models::ErrorResponse), +} + +#[derive(Debug, PartialEq)] pub enum GetEditgroupResponse { /// Found Entity FoundEntity(models::Editgroup), @@ -255,6 +267,18 @@ pub enum GetReleaseResponse { } #[derive(Debug, PartialEq)] +pub enum GetReleaseFilesResponse { + /// Found Entity + FoundEntity(Vec<models::FileEntity>), + /// 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), @@ -267,6 +291,18 @@ pub enum GetWorkResponse { } #[derive(Debug, PartialEq)] +pub enum GetWorkReleasesResponse { + /// Found Entity + FoundEntity(Vec<models::ReleaseEntity>), + /// 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), @@ -344,6 +380,8 @@ pub trait Api { fn get_creator(&self, id: String, context: &Context) -> Box<Future<Item = GetCreatorResponse, Error = ApiError> + Send>; + fn get_creator_releases(&self, id: String, context: &Context) -> Box<Future<Item = GetCreatorReleasesResponse, Error = ApiError> + Send>; + fn get_editgroup(&self, id: i64, context: &Context) -> Box<Future<Item = GetEditgroupResponse, Error = ApiError> + Send>; fn get_editor(&self, username: String, context: &Context) -> Box<Future<Item = GetEditorResponse, Error = ApiError> + Send>; @@ -354,8 +392,12 @@ pub trait Api { fn get_release(&self, id: String, context: &Context) -> Box<Future<Item = GetReleaseResponse, Error = ApiError> + Send>; + fn get_release_files(&self, id: String, context: &Context) -> Box<Future<Item = GetReleaseFilesResponse, Error = ApiError> + Send>; + fn get_work(&self, id: String, context: &Context) -> Box<Future<Item = GetWorkResponse, Error = ApiError> + Send>; + fn get_work_releases(&self, id: String, context: &Context) -> Box<Future<Item = GetWorkReleasesResponse, Error = ApiError> + Send>; + fn lookup_container(&self, issnl: String, context: &Context) -> Box<Future<Item = LookupContainerResponse, Error = ApiError> + Send>; fn lookup_creator(&self, orcid: String, context: &Context) -> Box<Future<Item = LookupCreatorResponse, Error = ApiError> + Send>; @@ -395,6 +437,8 @@ pub trait ApiNoContext { fn get_creator(&self, id: String) -> Box<Future<Item = GetCreatorResponse, Error = ApiError> + Send>; + fn get_creator_releases(&self, id: String) -> Box<Future<Item = GetCreatorReleasesResponse, Error = ApiError> + Send>; + fn get_editgroup(&self, id: i64) -> Box<Future<Item = GetEditgroupResponse, Error = ApiError> + Send>; fn get_editor(&self, username: String) -> Box<Future<Item = GetEditorResponse, Error = ApiError> + Send>; @@ -405,8 +449,12 @@ pub trait ApiNoContext { fn get_release(&self, id: String) -> Box<Future<Item = GetReleaseResponse, Error = ApiError> + Send>; + fn get_release_files(&self, id: String) -> Box<Future<Item = GetReleaseFilesResponse, Error = ApiError> + Send>; + fn get_work(&self, id: String) -> Box<Future<Item = GetWorkResponse, Error = ApiError> + Send>; + fn get_work_releases(&self, id: String) -> Box<Future<Item = GetWorkReleasesResponse, Error = ApiError> + Send>; + fn lookup_container(&self, issnl: String) -> Box<Future<Item = LookupContainerResponse, Error = ApiError> + Send>; fn lookup_creator(&self, orcid: String) -> Box<Future<Item = LookupCreatorResponse, Error = ApiError> + Send>; @@ -488,6 +536,10 @@ impl<'a, T: Api> ApiNoContext for ContextWrapper<'a, T> { self.api().get_creator(id, &self.context()) } + fn get_creator_releases(&self, id: String) -> Box<Future<Item = GetCreatorReleasesResponse, Error = ApiError> + Send> { + self.api().get_creator_releases(id, &self.context()) + } + fn get_editgroup(&self, id: i64) -> Box<Future<Item = GetEditgroupResponse, Error = ApiError> + Send> { self.api().get_editgroup(id, &self.context()) } @@ -508,10 +560,18 @@ impl<'a, T: Api> ApiNoContext for ContextWrapper<'a, T> { self.api().get_release(id, &self.context()) } + fn get_release_files(&self, id: String) -> Box<Future<Item = GetReleaseFilesResponse, Error = ApiError> + Send> { + self.api().get_release_files(id, &self.context()) + } + fn get_work(&self, id: String) -> Box<Future<Item = GetWorkResponse, Error = ApiError> + Send> { self.api().get_work(id, &self.context()) } + fn get_work_releases(&self, id: String) -> Box<Future<Item = GetWorkReleasesResponse, Error = ApiError> + Send> { + self.api().get_work_releases(id, &self.context()) + } + fn lookup_container(&self, issnl: String) -> Box<Future<Item = LookupContainerResponse, Error = ApiError> + Send> { self.api().lookup_container(issnl, &self.context()) } |