summaryrefslogtreecommitdiffstats
path: root/rust/fatcat-api/src/lib.rs
diff options
context:
space:
mode:
authorBryan Newbold <bnewbold@robocracy.org>2018-05-15 15:07:12 -0700
committerBryan Newbold <bnewbold@robocracy.org>2018-05-15 15:07:12 -0700
commit525f21c871f4947196dc8348019d941e84bf6e3c (patch)
tree4d1b46c949c0a764affb7e744e08c937a916f258 /rust/fatcat-api/src/lib.rs
parent2fd925e4eb3730c36519096e4a74b2de5998e8d4 (diff)
downloadfatcat-525f21c871f4947196dc8348019d941e84bf6e3c.tar.gz
fatcat-525f21c871f4947196dc8348019d941e84bf6e3c.zip
make cargo fmt succeed by default
Diffstat (limited to 'rust/fatcat-api/src/lib.rs')
-rw-r--r--rust/fatcat-api/src/lib.rs367
1 files changed, 91 insertions, 276 deletions
diff --git a/rust/fatcat-api/src/lib.rs b/rust/fatcat-api/src/lib.rs
index 2b7c84a0..a01189ef 100644
--- a/rust/fatcat-api/src/lib.rs
+++ b/rust/fatcat-api/src/lib.rs
@@ -1,5 +1,4 @@
-#![allow(missing_docs, trivial_casts, unused_variables, unused_mut, unused_imports,
- unused_extern_crates, non_camel_case_types)]
+#![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;
@@ -235,213 +234,84 @@ pub enum WorkPostResponse {
/// API
pub trait Api {
- fn container_id_get(
- &self,
- id: String,
- context: &Context,
- ) -> Box<Future<Item = ContainerIdGetResponse, Error = ApiError> + Send>;
-
- fn container_lookup_get(
- &self,
- issn: String,
- context: &Context,
- ) -> Box<Future<Item = ContainerLookupGetResponse, Error = ApiError> + Send>;
-
- fn container_post(
- &self,
- body: Option<models::ContainerEntity>,
- context: &Context,
- ) -> Box<Future<Item = ContainerPostResponse, Error = ApiError> + Send>;
-
- fn creator_id_get(
- &self,
- id: String,
- context: &Context,
- ) -> Box<Future<Item = CreatorIdGetResponse, Error = ApiError> + Send>;
-
- fn creator_lookup_get(
- &self,
- orcid: String,
- context: &Context,
- ) -> Box<Future<Item = CreatorLookupGetResponse, Error = ApiError> + Send>;
-
- fn creator_post(
- &self,
- body: Option<models::CreatorEntity>,
- context: &Context,
- ) -> Box<Future<Item = CreatorPostResponse, Error = ApiError> + Send>;
-
- fn editgroup_id_accept_post(
- &self,
- id: i32,
- context: &Context,
- ) -> Box<Future<Item = EditgroupIdAcceptPostResponse, Error = ApiError> + Send>;
-
- fn editgroup_id_get(
- &self,
- id: i32,
- context: &Context,
- ) -> Box<Future<Item = EditgroupIdGetResponse, Error = ApiError> + Send>;
-
- fn editgroup_post(
- &self,
- context: &Context,
- ) -> Box<Future<Item = EditgroupPostResponse, Error = ApiError> + Send>;
-
- fn editor_username_changelog_get(
- &self,
- username: String,
- context: &Context,
- ) -> Box<Future<Item = EditorUsernameChangelogGetResponse, Error = ApiError> + Send>;
-
- fn editor_username_get(
- &self,
- username: String,
- context: &Context,
- ) -> Box<Future<Item = EditorUsernameGetResponse, Error = ApiError> + Send>;
-
- fn file_id_get(
- &self,
- id: String,
- context: &Context,
- ) -> Box<Future<Item = FileIdGetResponse, Error = ApiError> + Send>;
-
- fn file_lookup_get(
- &self,
- sha1: String,
- context: &Context,
- ) -> Box<Future<Item = FileLookupGetResponse, Error = ApiError> + Send>;
-
- fn file_post(
- &self,
- body: Option<models::FileEntity>,
- context: &Context,
- ) -> Box<Future<Item = FilePostResponse, Error = ApiError> + Send>;
-
- fn release_id_get(
- &self,
- id: String,
- context: &Context,
- ) -> Box<Future<Item = ReleaseIdGetResponse, Error = ApiError> + Send>;
-
- fn release_lookup_get(
- &self,
- doi: String,
- context: &Context,
- ) -> Box<Future<Item = ReleaseLookupGetResponse, Error = ApiError> + Send>;
-
- fn release_post(
- &self,
- body: Option<models::ReleaseEntity>,
- context: &Context,
- ) -> Box<Future<Item = ReleasePostResponse, Error = ApiError> + Send>;
-
- fn work_id_get(
- &self,
- id: String,
- context: &Context,
- ) -> Box<Future<Item = WorkIdGetResponse, Error = ApiError> + Send>;
-
- fn work_post(
- &self,
- body: Option<models::WorkEntity>,
- context: &Context,
- ) -> Box<Future<Item = WorkPostResponse, Error = ApiError> + Send>;
+ fn container_id_get(&self, id: String, context: &Context) -> Box<Future<Item = ContainerIdGetResponse, Error = ApiError> + Send>;
+
+ fn container_lookup_get(&self, issn: String, context: &Context) -> Box<Future<Item = ContainerLookupGetResponse, Error = ApiError> + Send>;
+
+ fn container_post(&self, body: Option<models::ContainerEntity>, context: &Context) -> Box<Future<Item = ContainerPostResponse, Error = ApiError> + Send>;
+
+ fn creator_id_get(&self, id: String, context: &Context) -> Box<Future<Item = CreatorIdGetResponse, Error = ApiError> + Send>;
+
+ fn creator_lookup_get(&self, orcid: String, context: &Context) -> Box<Future<Item = CreatorLookupGetResponse, Error = ApiError> + Send>;
+
+ fn creator_post(&self, body: Option<models::CreatorEntity>, context: &Context) -> Box<Future<Item = CreatorPostResponse, Error = ApiError> + Send>;
+
+ fn editgroup_id_accept_post(&self, id: i32, context: &Context) -> Box<Future<Item = EditgroupIdAcceptPostResponse, Error = ApiError> + Send>;
+
+ fn editgroup_id_get(&self, id: i32, context: &Context) -> Box<Future<Item = EditgroupIdGetResponse, Error = ApiError> + Send>;
+
+ fn editgroup_post(&self, context: &Context) -> Box<Future<Item = EditgroupPostResponse, Error = ApiError> + Send>;
+
+ fn editor_username_changelog_get(&self, username: String, context: &Context) -> Box<Future<Item = EditorUsernameChangelogGetResponse, Error = ApiError> + Send>;
+
+ fn editor_username_get(&self, username: String, context: &Context) -> Box<Future<Item = EditorUsernameGetResponse, Error = ApiError> + Send>;
+
+ fn file_id_get(&self, id: String, context: &Context) -> Box<Future<Item = FileIdGetResponse, Error = ApiError> + Send>;
+
+ fn file_lookup_get(&self, sha1: String, context: &Context) -> Box<Future<Item = FileLookupGetResponse, Error = ApiError> + Send>;
+
+ fn file_post(&self, body: Option<models::FileEntity>, context: &Context) -> Box<Future<Item = FilePostResponse, Error = ApiError> + Send>;
+
+ fn release_id_get(&self, id: String, context: &Context) -> Box<Future<Item = ReleaseIdGetResponse, Error = ApiError> + Send>;
+
+ fn release_lookup_get(&self, doi: String, context: &Context) -> Box<Future<Item = ReleaseLookupGetResponse, Error = ApiError> + Send>;
+
+ fn release_post(&self, body: Option<models::ReleaseEntity>, context: &Context) -> Box<Future<Item = ReleasePostResponse, Error = ApiError> + Send>;
+
+ fn work_id_get(&self, id: String, context: &Context) -> Box<Future<Item = WorkIdGetResponse, Error = ApiError> + Send>;
+
+ fn work_post(&self, body: Option<models::WorkEntity>, context: &Context) -> Box<Future<Item = WorkPostResponse, Error = ApiError> + Send>;
}
/// API without a `Context`
pub trait ApiNoContext {
- fn container_id_get(
- &self,
- id: String,
- ) -> Box<Future<Item = ContainerIdGetResponse, Error = ApiError> + Send>;
-
- fn container_lookup_get(
- &self,
- issn: String,
- ) -> Box<Future<Item = ContainerLookupGetResponse, Error = ApiError> + Send>;
-
- fn container_post(
- &self,
- body: Option<models::ContainerEntity>,
- ) -> Box<Future<Item = ContainerPostResponse, Error = ApiError> + Send>;
-
- fn creator_id_get(
- &self,
- id: String,
- ) -> Box<Future<Item = CreatorIdGetResponse, Error = ApiError> + Send>;
-
- fn creator_lookup_get(
- &self,
- orcid: String,
- ) -> Box<Future<Item = CreatorLookupGetResponse, Error = ApiError> + Send>;
-
- fn creator_post(
- &self,
- body: Option<models::CreatorEntity>,
- ) -> Box<Future<Item = CreatorPostResponse, Error = ApiError> + Send>;
-
- fn editgroup_id_accept_post(
- &self,
- id: i32,
- ) -> Box<Future<Item = EditgroupIdAcceptPostResponse, Error = ApiError> + Send>;
-
- fn editgroup_id_get(
- &self,
- id: i32,
- ) -> Box<Future<Item = EditgroupIdGetResponse, Error = ApiError> + Send>;
+ fn container_id_get(&self, id: String) -> Box<Future<Item = ContainerIdGetResponse, Error = ApiError> + Send>;
+
+ fn container_lookup_get(&self, issn: String) -> Box<Future<Item = ContainerLookupGetResponse, Error = ApiError> + Send>;
+
+ fn container_post(&self, body: Option<models::ContainerEntity>) -> Box<Future<Item = ContainerPostResponse, Error = ApiError> + Send>;
+
+ fn creator_id_get(&self, id: String) -> Box<Future<Item = CreatorIdGetResponse, Error = ApiError> + Send>;
+
+ fn creator_lookup_get(&self, orcid: String) -> Box<Future<Item = CreatorLookupGetResponse, Error = ApiError> + Send>;
+
+ fn creator_post(&self, body: Option<models::CreatorEntity>) -> Box<Future<Item = CreatorPostResponse, Error = ApiError> + Send>;
+
+ fn editgroup_id_accept_post(&self, id: i32) -> Box<Future<Item = EditgroupIdAcceptPostResponse, Error = ApiError> + Send>;
+
+ fn editgroup_id_get(&self, id: i32) -> Box<Future<Item = EditgroupIdGetResponse, Error = ApiError> + Send>;
fn editgroup_post(&self) -> Box<Future<Item = EditgroupPostResponse, Error = ApiError> + Send>;
- fn editor_username_changelog_get(
- &self,
- username: String,
- ) -> Box<Future<Item = EditorUsernameChangelogGetResponse, Error = ApiError> + Send>;
-
- fn editor_username_get(
- &self,
- username: String,
- ) -> Box<Future<Item = EditorUsernameGetResponse, Error = ApiError> + Send>;
-
- fn file_id_get(
- &self,
- id: String,
- ) -> Box<Future<Item = FileIdGetResponse, Error = ApiError> + Send>;
-
- fn file_lookup_get(
- &self,
- sha1: String,
- ) -> Box<Future<Item = FileLookupGetResponse, Error = ApiError> + Send>;
-
- fn file_post(
- &self,
- body: Option<models::FileEntity>,
- ) -> Box<Future<Item = FilePostResponse, Error = ApiError> + Send>;
-
- fn release_id_get(
- &self,
- id: String,
- ) -> Box<Future<Item = ReleaseIdGetResponse, Error = ApiError> + Send>;
-
- fn release_lookup_get(
- &self,
- doi: String,
- ) -> Box<Future<Item = ReleaseLookupGetResponse, Error = ApiError> + Send>;
-
- fn release_post(
- &self,
- body: Option<models::ReleaseEntity>,
- ) -> Box<Future<Item = ReleasePostResponse, Error = ApiError> + Send>;
-
- fn work_id_get(
- &self,
- id: String,
- ) -> Box<Future<Item = WorkIdGetResponse, Error = ApiError> + Send>;
-
- fn work_post(
- &self,
- body: Option<models::WorkEntity>,
- ) -> Box<Future<Item = WorkPostResponse, Error = ApiError> + Send>;
+ fn editor_username_changelog_get(&self, username: String) -> Box<Future<Item = EditorUsernameChangelogGetResponse, Error = ApiError> + Send>;
+
+ fn editor_username_get(&self, username: String) -> Box<Future<Item = EditorUsernameGetResponse, Error = ApiError> + Send>;
+
+ fn file_id_get(&self, id: String) -> Box<Future<Item = FileIdGetResponse, Error = ApiError> + Send>;
+
+ fn file_lookup_get(&self, sha1: String) -> Box<Future<Item = FileLookupGetResponse, Error = ApiError> + Send>;
+
+ fn file_post(&self, body: Option<models::FileEntity>) -> Box<Future<Item = FilePostResponse, Error = ApiError> + Send>;
+
+ fn release_id_get(&self, id: String) -> Box<Future<Item = ReleaseIdGetResponse, Error = ApiError> + Send>;
+
+ fn release_lookup_get(&self, doi: String) -> Box<Future<Item = ReleaseLookupGetResponse, Error = ApiError> + Send>;
+
+ fn release_post(&self, body: Option<models::ReleaseEntity>) -> Box<Future<Item = ReleasePostResponse, Error = ApiError> + Send>;
+
+ fn work_id_get(&self, id: String) -> Box<Future<Item = WorkIdGetResponse, Error = ApiError> + Send>;
+
+ fn work_post(&self, body: Option<models::WorkEntity>) -> Box<Future<Item = WorkPostResponse, Error = ApiError> + Send>;
}
/// Trait to extend an API to make it easy to bind it to a context.
@@ -460,59 +330,35 @@ impl<'a, T: Api + Sized> ContextWrapperExt<'a> for T {
}
impl<'a, T: Api> ApiNoContext for ContextWrapper<'a, T> {
- fn container_id_get(
- &self,
- id: String,
- ) -> Box<Future<Item = ContainerIdGetResponse, Error = ApiError> + Send> {
+ fn container_id_get(&self, id: String) -> Box<Future<Item = ContainerIdGetResponse, Error = ApiError> + Send> {
self.api().container_id_get(id, &self.context())
}
- fn container_lookup_get(
- &self,
- issn: String,
- ) -> Box<Future<Item = ContainerLookupGetResponse, Error = ApiError> + Send> {
+ fn container_lookup_get(&self, issn: String) -> Box<Future<Item = ContainerLookupGetResponse, Error = ApiError> + Send> {
self.api().container_lookup_get(issn, &self.context())
}
- fn container_post(
- &self,
- body: Option<models::ContainerEntity>,
- ) -> Box<Future<Item = ContainerPostResponse, Error = ApiError> + Send> {
+ fn container_post(&self, body: Option<models::ContainerEntity>) -> Box<Future<Item = ContainerPostResponse, Error = ApiError> + Send> {
self.api().container_post(body, &self.context())
}
- fn creator_id_get(
- &self,
- id: String,
- ) -> Box<Future<Item = CreatorIdGetResponse, Error = ApiError> + Send> {
+ fn creator_id_get(&self, id: String) -> Box<Future<Item = CreatorIdGetResponse, Error = ApiError> + Send> {
self.api().creator_id_get(id, &self.context())
}
- fn creator_lookup_get(
- &self,
- orcid: String,
- ) -> Box<Future<Item = CreatorLookupGetResponse, Error = ApiError> + Send> {
+ fn creator_lookup_get(&self, orcid: String) -> Box<Future<Item = CreatorLookupGetResponse, Error = ApiError> + Send> {
self.api().creator_lookup_get(orcid, &self.context())
}
- fn creator_post(
- &self,
- body: Option<models::CreatorEntity>,
- ) -> Box<Future<Item = CreatorPostResponse, Error = ApiError> + Send> {
+ fn creator_post(&self, body: Option<models::CreatorEntity>) -> Box<Future<Item = CreatorPostResponse, Error = ApiError> + Send> {
self.api().creator_post(body, &self.context())
}
- fn editgroup_id_accept_post(
- &self,
- id: i32,
- ) -> Box<Future<Item = EditgroupIdAcceptPostResponse, Error = ApiError> + Send> {
+ fn editgroup_id_accept_post(&self, id: i32) -> Box<Future<Item = EditgroupIdAcceptPostResponse, Error = ApiError> + Send> {
self.api().editgroup_id_accept_post(id, &self.context())
}
- fn editgroup_id_get(
- &self,
- id: i32,
- ) -> Box<Future<Item = EditgroupIdGetResponse, Error = ApiError> + Send> {
+ fn editgroup_id_get(&self, id: i32) -> Box<Future<Item = EditgroupIdGetResponse, Error = ApiError> + Send> {
self.api().editgroup_id_get(id, &self.context())
}
@@ -520,74 +366,43 @@ impl<'a, T: Api> ApiNoContext for ContextWrapper<'a, T> {
self.api().editgroup_post(&self.context())
}
- fn editor_username_changelog_get(
- &self,
- username: String,
- ) -> Box<Future<Item = EditorUsernameChangelogGetResponse, Error = ApiError> + Send> {
- self.api()
- .editor_username_changelog_get(username, &self.context())
+ fn editor_username_changelog_get(&self, username: String) -> Box<Future<Item = EditorUsernameChangelogGetResponse, Error = ApiError> + Send> {
+ self.api().editor_username_changelog_get(username, &self.context())
}
- fn editor_username_get(
- &self,
- username: String,
- ) -> Box<Future<Item = EditorUsernameGetResponse, Error = ApiError> + Send> {
+ fn editor_username_get(&self, username: String) -> Box<Future<Item = EditorUsernameGetResponse, Error = ApiError> + Send> {
self.api().editor_username_get(username, &self.context())
}
- fn file_id_get(
- &self,
- id: String,
- ) -> Box<Future<Item = FileIdGetResponse, Error = ApiError> + Send> {
+ fn file_id_get(&self, id: String) -> Box<Future<Item = FileIdGetResponse, Error = ApiError> + Send> {
self.api().file_id_get(id, &self.context())
}
- fn file_lookup_get(
- &self,
- sha1: String,
- ) -> Box<Future<Item = FileLookupGetResponse, Error = ApiError> + Send> {
+ fn file_lookup_get(&self, sha1: String) -> Box<Future<Item = FileLookupGetResponse, Error = ApiError> + Send> {
self.api().file_lookup_get(sha1, &self.context())
}
- fn file_post(
- &self,
- body: Option<models::FileEntity>,
- ) -> Box<Future<Item = FilePostResponse, Error = ApiError> + Send> {
+ fn file_post(&self, body: Option<models::FileEntity>) -> Box<Future<Item = FilePostResponse, Error = ApiError> + Send> {
self.api().file_post(body, &self.context())
}
- fn release_id_get(
- &self,
- id: String,
- ) -> Box<Future<Item = ReleaseIdGetResponse, Error = ApiError> + Send> {
+ fn release_id_get(&self, id: String) -> Box<Future<Item = ReleaseIdGetResponse, Error = ApiError> + Send> {
self.api().release_id_get(id, &self.context())
}
- fn release_lookup_get(
- &self,
- doi: String,
- ) -> Box<Future<Item = ReleaseLookupGetResponse, Error = ApiError> + Send> {
+ fn release_lookup_get(&self, doi: String) -> Box<Future<Item = ReleaseLookupGetResponse, Error = ApiError> + Send> {
self.api().release_lookup_get(doi, &self.context())
}
- fn release_post(
- &self,
- body: Option<models::ReleaseEntity>,
- ) -> Box<Future<Item = ReleasePostResponse, Error = ApiError> + Send> {
+ fn release_post(&self, body: Option<models::ReleaseEntity>) -> Box<Future<Item = ReleasePostResponse, Error = ApiError> + Send> {
self.api().release_post(body, &self.context())
}
- fn work_id_get(
- &self,
- id: String,
- ) -> Box<Future<Item = WorkIdGetResponse, Error = ApiError> + Send> {
+ fn work_id_get(&self, id: String) -> Box<Future<Item = WorkIdGetResponse, Error = ApiError> + Send> {
self.api().work_id_get(id, &self.context())
}
- fn work_post(
- &self,
- body: Option<models::WorkEntity>,
- ) -> Box<Future<Item = WorkPostResponse, Error = ApiError> + Send> {
+ fn work_post(&self, body: Option<models::WorkEntity>) -> Box<Future<Item = WorkPostResponse, Error = ApiError> + Send> {
self.api().work_post(body, &self.context())
}
}