summaryrefslogtreecommitdiffstats
path: root/rust/fatcat-api/src
diff options
context:
space:
mode:
Diffstat (limited to 'rust/fatcat-api/src')
-rw-r--r--rust/fatcat-api/src/client.rs2
-rw-r--r--rust/fatcat-api/src/lib.rs2
-rw-r--r--rust/fatcat-api/src/models.rs152
3 files changed, 89 insertions, 67 deletions
diff --git a/rust/fatcat-api/src/client.rs b/rust/fatcat-api/src/client.rs
index b94d6f42..8c7e4ef3 100644
--- a/rust/fatcat-api/src/client.rs
+++ b/rust/fatcat-api/src/client.rs
@@ -1248,7 +1248,7 @@ impl Api for Client {
200 => {
let mut buf = String::new();
response.read_to_string(&mut buf).map_err(|e| ApiError(format!("Response was not valid UTF8: {}", e)))?;
- let body = serde_json::from_str::<models::Changelogentries>(&buf)?;
+ let body = serde_json::from_str::<Vec<models::ChangelogEntry>>(&buf)?;
Ok(GetEditorChangelogResponse::FoundMergedChanges(body))
}
diff --git a/rust/fatcat-api/src/lib.rs b/rust/fatcat-api/src/lib.rs
index fd0cfe54..f45e113e 100644
--- a/rust/fatcat-api/src/lib.rs
+++ b/rust/fatcat-api/src/lib.rs
@@ -235,7 +235,7 @@ pub enum GetEditorResponse {
#[derive(Debug, PartialEq)]
pub enum GetEditorChangelogResponse {
/// Found Merged Changes
- FoundMergedChanges(models::Changelogentries),
+ FoundMergedChanges(Vec<models::ChangelogEntry>),
/// Not Found
NotFound(models::ErrorResponse),
/// Generic Error
diff --git a/rust/fatcat-api/src/models.rs b/rust/fatcat-api/src/models.rs
index 60330392..7ff39789 100644
--- a/rust/fatcat-api/src/models.rs
+++ b/rust/fatcat-api/src/models.rs
@@ -10,68 +10,7 @@ use std::collections::HashMap;
use swagger;
#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
-pub struct Changelogentries(Vec<ChangelogentriesInner>);
-
-impl ::std::convert::From<Vec<ChangelogentriesInner>> for Changelogentries {
- fn from(x: Vec<ChangelogentriesInner>) -> Self {
- Changelogentries(x)
- }
-}
-
-impl ::std::convert::From<Changelogentries> for Vec<ChangelogentriesInner> {
- fn from(x: Changelogentries) -> Self {
- x.0
- }
-}
-
-impl ::std::iter::FromIterator<ChangelogentriesInner> for Changelogentries {
- fn from_iter<U: IntoIterator<Item = ChangelogentriesInner>>(u: U) -> Self {
- Changelogentries(Vec::<ChangelogentriesInner>::from_iter(u))
- }
-}
-
-impl ::std::iter::IntoIterator for Changelogentries {
- type Item = ChangelogentriesInner;
- type IntoIter = ::std::vec::IntoIter<ChangelogentriesInner>;
-
- fn into_iter(self) -> Self::IntoIter {
- self.0.into_iter()
- }
-}
-
-impl<'a> ::std::iter::IntoIterator for &'a Changelogentries {
- type Item = &'a ChangelogentriesInner;
- type IntoIter = ::std::slice::Iter<'a, ChangelogentriesInner>;
-
- fn into_iter(self) -> Self::IntoIter {
- (&self.0).into_iter()
- }
-}
-
-impl<'a> ::std::iter::IntoIterator for &'a mut Changelogentries {
- type Item = &'a mut ChangelogentriesInner;
- type IntoIter = ::std::slice::IterMut<'a, ChangelogentriesInner>;
-
- fn into_iter(self) -> Self::IntoIter {
- (&mut self.0).into_iter()
- }
-}
-
-impl ::std::ops::Deref for Changelogentries {
- type Target = Vec<ChangelogentriesInner>;
- fn deref(&self) -> &Self::Target {
- &self.0
- }
-}
-
-impl ::std::ops::DerefMut for Changelogentries {
- fn deref_mut(&mut self) -> &mut Self::Target {
- &mut self.0
- }
-}
-
-#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
-pub struct ChangelogentriesInner {
+pub struct ChangelogEntry {
#[serde(rename = "index")]
pub index: i64,
@@ -82,9 +21,9 @@ pub struct ChangelogentriesInner {
pub timestamp: chrono::DateTime<chrono::Utc>,
}
-impl ChangelogentriesInner {
- pub fn new(index: i64, editgroup_id: i64, timestamp: chrono::DateTime<chrono::Utc>) -> ChangelogentriesInner {
- ChangelogentriesInner {
+impl ChangelogEntry {
+ pub fn new(index: i64, editgroup_id: i64, timestamp: chrono::DateTime<chrono::Utc>) -> ChangelogEntry {
+ ChangelogEntry {
index: index,
editgroup_id: editgroup_id,
timestamp: timestamp,
@@ -336,6 +275,89 @@ impl EntityEdit {
}
#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
+pub struct EntityHistory(Vec<EntityHistoryInner>);
+
+impl ::std::convert::From<Vec<EntityHistoryInner>> for EntityHistory {
+ fn from(x: Vec<EntityHistoryInner>) -> Self {
+ EntityHistory(x)
+ }
+}
+
+impl ::std::convert::From<EntityHistory> for Vec<EntityHistoryInner> {
+ fn from(x: EntityHistory) -> Self {
+ x.0
+ }
+}
+
+impl ::std::iter::FromIterator<EntityHistoryInner> for EntityHistory {
+ fn from_iter<U: IntoIterator<Item = EntityHistoryInner>>(u: U) -> Self {
+ EntityHistory(Vec::<EntityHistoryInner>::from_iter(u))
+ }
+}
+
+impl ::std::iter::IntoIterator for EntityHistory {
+ type Item = EntityHistoryInner;
+ type IntoIter = ::std::vec::IntoIter<EntityHistoryInner>;
+
+ fn into_iter(self) -> Self::IntoIter {
+ self.0.into_iter()
+ }
+}
+
+impl<'a> ::std::iter::IntoIterator for &'a EntityHistory {
+ type Item = &'a EntityHistoryInner;
+ type IntoIter = ::std::slice::Iter<'a, EntityHistoryInner>;
+
+ fn into_iter(self) -> Self::IntoIter {
+ (&self.0).into_iter()
+ }
+}
+
+impl<'a> ::std::iter::IntoIterator for &'a mut EntityHistory {
+ type Item = &'a mut EntityHistoryInner;
+ type IntoIter = ::std::slice::IterMut<'a, EntityHistoryInner>;
+
+ fn into_iter(self) -> Self::IntoIter {
+ (&mut self.0).into_iter()
+ }
+}
+
+impl ::std::ops::Deref for EntityHistory {
+ type Target = Vec<EntityHistoryInner>;
+ fn deref(&self) -> &Self::Target {
+ &self.0
+ }
+}
+
+impl ::std::ops::DerefMut for EntityHistory {
+ fn deref_mut(&mut self) -> &mut Self::Target {
+ &mut self.0
+ }
+}
+
+#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
+pub struct EntityHistoryInner {
+ #[serde(rename = "edit")]
+ pub edit: models::EntityEdit,
+
+ #[serde(rename = "editgroup")]
+ pub editgroup: models::Editgroup,
+
+ #[serde(rename = "changelog")]
+ pub changelog: models::ChangelogEntry,
+}
+
+impl EntityHistoryInner {
+ pub fn new(edit: models::EntityEdit, editgroup: models::Editgroup, changelog: models::ChangelogEntry) -> EntityHistoryInner {
+ EntityHistoryInner {
+ edit: edit,
+ editgroup: editgroup,
+ changelog: changelog,
+ }
+ }
+}
+
+#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
pub struct ErrorResponse {
#[serde(rename = "message")]
pub message: String,