aboutsummaryrefslogtreecommitdiffstats
path: root/rust/fatcat-api/src/lib.rs
diff options
context:
space:
mode:
authorBryan Newbold <bnewbold@robocracy.org>2018-06-19 18:31:55 -0700
committerBryan Newbold <bnewbold@robocracy.org>2018-06-19 18:31:55 -0700
commitd2f50808ef9b96afc36d864adec74f10c9cea9af (patch)
tree18d563e5570e9b1d578326664e7fe1cf3bc8ea9e /rust/fatcat-api/src/lib.rs
parentb262ad227ba5293e210f1137e8080be0796a8c86 (diff)
downloadfatcat-d2f50808ef9b96afc36d864adec74f10c9cea9af.tar.gz
fatcat-d2f50808ef9b96afc36d864adec74f10c9cea9af.zip
implement (most) of stats endpoint
Diffstat (limited to 'rust/fatcat-api/src/lib.rs')
-rw-r--r--rust/fatcat-api/src/lib.rs16
1 files changed, 16 insertions, 0 deletions
diff --git a/rust/fatcat-api/src/lib.rs b/rust/fatcat-api/src/lib.rs
index c926966e..fd0cfe54 100644
--- a/rust/fatcat-api/src/lib.rs
+++ b/rust/fatcat-api/src/lib.rs
@@ -279,6 +279,14 @@ pub enum GetReleaseFilesResponse {
}
#[derive(Debug, PartialEq)]
+pub enum GetStatsResponse {
+ /// Success
+ Success(models::StatsResponse),
+ /// Generic Error
+ GenericError(models::ErrorResponse),
+}
+
+#[derive(Debug, PartialEq)]
pub enum GetWorkResponse {
/// Found Entity
FoundEntity(models::WorkEntity),
@@ -394,6 +402,8 @@ pub trait Api {
fn get_release_files(&self, id: String, context: &Context) -> Box<Future<Item = GetReleaseFilesResponse, Error = ApiError> + Send>;
+ fn get_stats(&self, more: Option<String>, context: &Context) -> Box<Future<Item = GetStatsResponse, 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>;
@@ -451,6 +461,8 @@ pub trait ApiNoContext {
fn get_release_files(&self, id: String) -> Box<Future<Item = GetReleaseFilesResponse, Error = ApiError> + Send>;
+ fn get_stats(&self, more: Option<String>) -> Box<Future<Item = GetStatsResponse, 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>;
@@ -564,6 +576,10 @@ impl<'a, T: Api> ApiNoContext for ContextWrapper<'a, T> {
self.api().get_release_files(id, &self.context())
}
+ fn get_stats(&self, more: Option<String>) -> Box<Future<Item = GetStatsResponse, Error = ApiError> + Send> {
+ self.api().get_stats(more, &self.context())
+ }
+
fn get_work(&self, id: String) -> Box<Future<Item = GetWorkResponse, Error = ApiError> + Send> {
self.api().get_work(id, &self.context())
}