summaryrefslogtreecommitdiffstats
path: root/rust
diff options
context:
space:
mode:
authorBryan Newbold <bnewbold@robocracy.org>2018-05-25 14:03:37 -0700
committerBryan Newbold <bnewbold@robocracy.org>2018-05-25 14:03:47 -0700
commit8e92be6e1e9396f4920c0f947337e1be643e1994 (patch)
tree2891a0ed7b6c780d1e86a81462b4c10dd13fa79a /rust
parent495a1367510be66a9409d7b56a4b632a64aeefef (diff)
downloadfatcat-8e92be6e1e9396f4920c0f947337e1be643e1994.tar.gz
fatcat-8e92be6e1e9396f4920c0f947337e1be643e1994.zip
edit lists, refs, contribs
Diffstat (limited to 'rust')
-rw-r--r--rust/fatcat-api/README.md2
-rw-r--r--rust/fatcat-api/api.yaml96
-rw-r--r--rust/fatcat-api/api/swagger.yaml175
-rw-r--r--rust/fatcat-api/src/models.rs107
-rw-r--r--rust/fatcat-openapi2.yml96
-rw-r--r--rust/src/api_server.rs6
-rw-r--r--rust/src/database_models.rs2
7 files changed, 402 insertions, 82 deletions
diff --git a/rust/fatcat-api/README.md b/rust/fatcat-api/README.md
index 48c3aeeb..98eb45fe 100644
--- a/rust/fatcat-api/README.md
+++ b/rust/fatcat-api/README.md
@@ -13,7 +13,7 @@ To see how to make this your own, look here:
[README](https://github.com/swagger-api/swagger-codegen/blob/master/README.md)
- API version: 0.1.0
-- Build date: 2018-05-25T05:25:40.149Z
+- Build date: 2018-05-25T20:55:51.247Z
This autogenerated project defines an API crate `fatcat` which contains:
* An `Api` trait defining the API in Rust.
diff --git a/rust/fatcat-api/api.yaml b/rust/fatcat-api/api.yaml
index 14c94f35..30e0f44d 100644
--- a/rust/fatcat-api/api.yaml
+++ b/rust/fatcat-api/api.yaml
@@ -152,6 +152,16 @@ definitions:
issue:
type: string
example: "12"
+ contribs:
+ type: array
+ items:
+ type: string
+ #$ref: "#/definitions/release_contrib"
+ refs:
+ type: array
+ items:
+ type: string
+ #$ref: "#/definitions/release_ref"
work_entity:
type: object
properties:
@@ -186,45 +196,29 @@ definitions:
extra:
type: object
additionalProperties: {}
-# container_edits:
-# type: array
-# item:
-# type: integer
-# format: int64
-# properties:
-# edit_id:
-# type: integer
-# example: 847
-# format: int64
-# type: array
-# items:
-# type: object
-# proposeties:
-# <<: *ENTITYEDITPROPS
-# creators:
-# type: array
-# items:
-# type: object
-# proposeties:
-# <<: *ENTITYEDITPROPS
-# files:
-# type: array
-# items:
-# type: object
-# proposeties:
-# <<: *ENTITYEDITPROPS
-# releases:
-# type: array
-# items:
-# type: object
-# proposeties:
-# <<: *ENTITYEDITPROPS
-# works:
-# type: array
-# items:
-# type: object
-# proposeties:
-# <<: *ENTITYEDITPROPS
+ edits:
+ type: object
+ properties:
+ containers:
+ type: array
+ items:
+ $ref: "#/definitions/entity_edit"
+ creators:
+ type: array
+ items:
+ $ref: "#/definitions/entity_edit"
+ files:
+ type: array
+ items:
+ $ref: "#/definitions/entity_edit"
+ releases:
+ type: array
+ items:
+ $ref: "#/definitions/entity_edit"
+ works:
+ type: array
+ items:
+ $ref: "#/definitions/entity_edit"
changelogentries:
type: array
items:
@@ -243,6 +237,30 @@ definitions:
timestamp:
type: string
format: date-time
+ release_ref:
+ type: object
+ properties:
+ index:
+ type: integer
+ format: int64
+ target_release_id:
+ type: string
+ #format: uuid
+ stub:
+ type: string
+ release_contrib:
+ type: object
+ properties:
+ index:
+ type: integer
+ format: int64
+ creator_id:
+ type: string
+ #format: uuid
+ creator_stub:
+ type: string
+ contrib_type:
+ type: string
x-entity-responses: &ENTITYRESPONSES
400:
diff --git a/rust/fatcat-api/api/swagger.yaml b/rust/fatcat-api/api/swagger.yaml
index 993df05c..f173c53d 100644
--- a/rust/fatcat-api/api/swagger.yaml
+++ b/rust/fatcat-api/api/swagger.yaml
@@ -1166,6 +1166,14 @@ definitions:
- "title"
- "work_id"
properties:
+ refs:
+ type: "array"
+ items:
+ type: "string"
+ contribs:
+ type: "array"
+ items:
+ type: "string"
issue:
type: "string"
example: "12"
@@ -1217,9 +1225,15 @@ definitions:
ident: "f1f046a3-45c9-4b99-adce-000000000001"
release_type: "preprint"
title: "title"
+ contribs:
+ - "contribs"
+ - "contribs"
revision: 42
volume: "volume"
pages: "pages"
+ refs:
+ - "refs"
+ - "refs"
extra: "{}"
editgroup_id: 16
state: "wip"
@@ -1316,8 +1330,66 @@ definitions:
type: "string"
extra:
type: "object"
+ edits:
+ $ref: "#/definitions/editgroup_edits"
example:
extra: "{}"
+ edits:
+ works:
+ - ident: "f1f046a3-45c9-4b99-adce-000000000001"
+ extra: "{}"
+ edit_id: 847
+ editgroup_id: 16
+ revision: 42
+ - ident: "f1f046a3-45c9-4b99-adce-000000000001"
+ extra: "{}"
+ edit_id: 847
+ editgroup_id: 16
+ revision: 42
+ creators:
+ - ident: "f1f046a3-45c9-4b99-adce-000000000001"
+ extra: "{}"
+ edit_id: 847
+ editgroup_id: 16
+ revision: 42
+ - ident: "f1f046a3-45c9-4b99-adce-000000000001"
+ extra: "{}"
+ edit_id: 847
+ editgroup_id: 16
+ revision: 42
+ files:
+ - ident: "f1f046a3-45c9-4b99-adce-000000000001"
+ extra: "{}"
+ edit_id: 847
+ editgroup_id: 16
+ revision: 42
+ - ident: "f1f046a3-45c9-4b99-adce-000000000001"
+ extra: "{}"
+ edit_id: 847
+ editgroup_id: 16
+ revision: 42
+ containers:
+ - ident: "f1f046a3-45c9-4b99-adce-000000000001"
+ extra: "{}"
+ edit_id: 847
+ editgroup_id: 16
+ revision: 42
+ - ident: "f1f046a3-45c9-4b99-adce-000000000001"
+ extra: "{}"
+ edit_id: 847
+ editgroup_id: 16
+ revision: 42
+ releases:
+ - ident: "f1f046a3-45c9-4b99-adce-000000000001"
+ extra: "{}"
+ edit_id: 847
+ editgroup_id: 16
+ revision: 42
+ - ident: "f1f046a3-45c9-4b99-adce-000000000001"
+ extra: "{}"
+ edit_id: 847
+ editgroup_id: 16
+ revision: 42
description: "description"
editor_id: 6
id: 0
@@ -1327,6 +1399,109 @@ definitions:
items:
$ref: "#/definitions/changelogentries_inner"
upperCaseName: "CHANGELOGENTRIES"
+ release_ref:
+ type: "object"
+ properties:
+ index:
+ type: "integer"
+ format: "int64"
+ target_release_id:
+ type: "string"
+ stub:
+ type: "string"
+ upperCaseName: "RELEASE_REF"
+ release_contrib:
+ type: "object"
+ properties:
+ index:
+ type: "integer"
+ format: "int64"
+ creator_id:
+ type: "string"
+ creator_stub:
+ type: "string"
+ contrib_type:
+ type: "string"
+ upperCaseName: "RELEASE_CONTRIB"
+ editgroup_edits:
+ properties:
+ containers:
+ type: "array"
+ items:
+ $ref: "#/definitions/entity_edit"
+ creators:
+ type: "array"
+ items:
+ $ref: "#/definitions/entity_edit"
+ files:
+ type: "array"
+ items:
+ $ref: "#/definitions/entity_edit"
+ releases:
+ type: "array"
+ items:
+ $ref: "#/definitions/entity_edit"
+ works:
+ type: "array"
+ items:
+ $ref: "#/definitions/entity_edit"
+ example:
+ works:
+ - ident: "f1f046a3-45c9-4b99-adce-000000000001"
+ extra: "{}"
+ edit_id: 847
+ editgroup_id: 16
+ revision: 42
+ - ident: "f1f046a3-45c9-4b99-adce-000000000001"
+ extra: "{}"
+ edit_id: 847
+ editgroup_id: 16
+ revision: 42
+ creators:
+ - ident: "f1f046a3-45c9-4b99-adce-000000000001"
+ extra: "{}"
+ edit_id: 847
+ editgroup_id: 16
+ revision: 42
+ - ident: "f1f046a3-45c9-4b99-adce-000000000001"
+ extra: "{}"
+ edit_id: 847
+ editgroup_id: 16
+ revision: 42
+ files:
+ - ident: "f1f046a3-45c9-4b99-adce-000000000001"
+ extra: "{}"
+ edit_id: 847
+ editgroup_id: 16
+ revision: 42
+ - ident: "f1f046a3-45c9-4b99-adce-000000000001"
+ extra: "{}"
+ edit_id: 847
+ editgroup_id: 16
+ revision: 42
+ containers:
+ - ident: "f1f046a3-45c9-4b99-adce-000000000001"
+ extra: "{}"
+ edit_id: 847
+ editgroup_id: 16
+ revision: 42
+ - ident: "f1f046a3-45c9-4b99-adce-000000000001"
+ extra: "{}"
+ edit_id: 847
+ editgroup_id: 16
+ revision: 42
+ releases:
+ - ident: "f1f046a3-45c9-4b99-adce-000000000001"
+ extra: "{}"
+ edit_id: 847
+ editgroup_id: 16
+ revision: 42
+ - ident: "f1f046a3-45c9-4b99-adce-000000000001"
+ extra: "{}"
+ edit_id: 847
+ editgroup_id: 16
+ revision: 42
+ upperCaseName: "EDITGROUP_EDITS"
changelogentries_inner:
required:
- "editgroup_id"
diff --git a/rust/fatcat-api/src/models.rs b/rust/fatcat-api/src/models.rs
index 6c13e091..5118872f 100644
--- a/rust/fatcat-api/src/models.rs
+++ b/rust/fatcat-api/src/models.rs
@@ -1,7 +1,7 @@
#![allow(unused_imports, unused_qualifications, unused_extern_crates)]
extern crate chrono;
-extern crate uuid;
extern crate serde_json;
+extern crate uuid;
use serde::ser::Serializer;
@@ -213,6 +213,10 @@ pub struct Editgroup {
#[serde(rename = "extra")]
#[serde(skip_serializing_if = "Option::is_none")]
pub extra: Option<serde_json::Value>,
+
+ #[serde(rename = "edits")]
+ #[serde(skip_serializing_if = "Option::is_none")]
+ pub edits: Option<models::EditgroupEdits>,
}
impl Editgroup {
@@ -222,6 +226,42 @@ impl Editgroup {
editor_id: editor_id,
description: None,
extra: None,
+ edits: None,
+ }
+ }
+}
+
+#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
+pub struct EditgroupEdits {
+ #[serde(rename = "containers")]
+ #[serde(skip_serializing_if = "Option::is_none")]
+ pub containers: Option<Vec<models::EntityEdit>>,
+
+ #[serde(rename = "creators")]
+ #[serde(skip_serializing_if = "Option::is_none")]
+ pub creators: Option<Vec<models::EntityEdit>>,
+
+ #[serde(rename = "files")]
+ #[serde(skip_serializing_if = "Option::is_none")]
+ pub files: Option<Vec<models::EntityEdit>>,
+
+ #[serde(rename = "releases")]
+ #[serde(skip_serializing_if = "Option::is_none")]
+ pub releases: Option<Vec<models::EntityEdit>>,
+
+ #[serde(rename = "works")]
+ #[serde(skip_serializing_if = "Option::is_none")]
+ pub works: Option<Vec<models::EntityEdit>>,
+}
+
+impl EditgroupEdits {
+ pub fn new() -> EditgroupEdits {
+ EditgroupEdits {
+ containers: None,
+ creators: None,
+ files: None,
+ releases: None,
+ works: None,
}
}
}
@@ -342,7 +382,45 @@ impl FileEntity {
}
#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
+pub struct ReleaseContrib {
+ #[serde(rename = "index")]
+ #[serde(skip_serializing_if = "Option::is_none")]
+ pub index: Option<i64>,
+
+ #[serde(rename = "creator_id")]
+ #[serde(skip_serializing_if = "Option::is_none")]
+ pub creator_id: Option<String>,
+
+ #[serde(rename = "creator_stub")]
+ #[serde(skip_serializing_if = "Option::is_none")]
+ pub creator_stub: Option<String>,
+
+ #[serde(rename = "contrib_type")]
+ #[serde(skip_serializing_if = "Option::is_none")]
+ pub contrib_type: Option<String>,
+}
+
+impl ReleaseContrib {
+ pub fn new() -> ReleaseContrib {
+ ReleaseContrib {
+ index: None,
+ creator_id: None,
+ creator_stub: None,
+ contrib_type: None,
+ }
+ }
+}
+
+#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
pub struct ReleaseEntity {
+ #[serde(rename = "refs")]
+ #[serde(skip_serializing_if = "Option::is_none")]
+ pub refs: Option<Vec<String>>,
+
+ #[serde(rename = "contribs")]
+ #[serde(skip_serializing_if = "Option::is_none")]
+ pub contribs: Option<Vec<String>>,
+
#[serde(rename = "issue")]
#[serde(skip_serializing_if = "Option::is_none")]
pub issue: Option<String>,
@@ -402,6 +480,8 @@ pub struct ReleaseEntity {
impl ReleaseEntity {
pub fn new(work_id: String, title: String) -> ReleaseEntity {
ReleaseEntity {
+ refs: None,
+ contribs: None,
issue: None,
pages: None,
volume: None,
@@ -421,6 +501,31 @@ impl ReleaseEntity {
}
#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
+pub struct ReleaseRef {
+ #[serde(rename = "index")]
+ #[serde(skip_serializing_if = "Option::is_none")]
+ pub index: Option<i64>,
+
+ #[serde(rename = "target_release_id")]
+ #[serde(skip_serializing_if = "Option::is_none")]
+ pub target_release_id: Option<String>,
+
+ #[serde(rename = "stub")]
+ #[serde(skip_serializing_if = "Option::is_none")]
+ pub stub: Option<String>,
+}
+
+impl ReleaseRef {
+ pub fn new() -> ReleaseRef {
+ ReleaseRef {
+ index: None,
+ target_release_id: None,
+ stub: None,
+ }
+ }
+}
+
+#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
pub struct Success {
#[serde(rename = "message")]
pub message: String,
diff --git a/rust/fatcat-openapi2.yml b/rust/fatcat-openapi2.yml
index 14c94f35..30e0f44d 100644
--- a/rust/fatcat-openapi2.yml
+++ b/rust/fatcat-openapi2.yml
@@ -152,6 +152,16 @@ definitions:
issue:
type: string
example: "12"
+ contribs:
+ type: array
+ items:
+ type: string
+ #$ref: "#/definitions/release_contrib"
+ refs:
+ type: array
+ items:
+ type: string
+ #$ref: "#/definitions/release_ref"
work_entity:
type: object
properties:
@@ -186,45 +196,29 @@ definitions:
extra:
type: object
additionalProperties: {}
-# container_edits:
-# type: array
-# item:
-# type: integer
-# format: int64
-# properties:
-# edit_id:
-# type: integer
-# example: 847
-# format: int64
-# type: array
-# items:
-# type: object
-# proposeties:
-# <<: *ENTITYEDITPROPS
-# creators:
-# type: array
-# items:
-# type: object
-# proposeties:
-# <<: *ENTITYEDITPROPS
-# files:
-# type: array
-# items:
-# type: object
-# proposeties:
-# <<: *ENTITYEDITPROPS
-# releases:
-# type: array
-# items:
-# type: object
-# proposeties:
-# <<: *ENTITYEDITPROPS
-# works:
-# type: array
-# items:
-# type: object
-# proposeties:
-# <<: *ENTITYEDITPROPS
+ edits:
+ type: object
+ properties:
+ containers:
+ type: array
+ items:
+ $ref: "#/definitions/entity_edit"
+ creators:
+ type: array
+ items:
+ $ref: "#/definitions/entity_edit"
+ files:
+ type: array
+ items:
+ $ref: "#/definitions/entity_edit"
+ releases:
+ type: array
+ items:
+ $ref: "#/definitions/entity_edit"
+ works:
+ type: array
+ items:
+ $ref: "#/definitions/entity_edit"
changelogentries:
type: array
items:
@@ -243,6 +237,30 @@ definitions:
timestamp:
type: string
format: date-time
+ release_ref:
+ type: object
+ properties:
+ index:
+ type: integer
+ format: int64
+ target_release_id:
+ type: string
+ #format: uuid
+ stub:
+ type: string
+ release_contrib:
+ type: object
+ properties:
+ index:
+ type: integer
+ format: int64
+ creator_id:
+ type: string
+ #format: uuid
+ creator_stub:
+ type: string
+ contrib_type:
+ type: string
x-entity-responses: &ENTITYRESPONSES
400:
diff --git a/rust/src/api_server.rs b/rust/src/api_server.rs
index 8364ec8c..a2e133fe 100644
--- a/rust/src/api_server.rs
+++ b/rust/src/api_server.rs
@@ -305,6 +305,8 @@ impl Server {
issue: rev.issue,
container_id: rev.container_ident_id.map(|u| u.to_string()),
work_id: rev.work_ident_id.to_string(),
+ refs: None,
+ contribs: None,
state: Some(ident.state().unwrap().shortname()),
ident: Some(ident.id.to_string()),
revision: ident.rev_id,
@@ -341,6 +343,8 @@ impl Server {
issue: rev.issue,
container_id: rev.container_ident_id.map(|u| u.to_string()),
work_id: rev.work_ident_id.to_string(),
+ refs: None,
+ contribs: None,
state: Some(ident.state().unwrap().shortname()),
ident: Some(ident.id.to_string()),
revision: ident.rev_id,
@@ -360,6 +364,7 @@ impl Server {
id: Some(row.id),
editor_id: row.editor_id,
description: row.description,
+ edits: None,
extra: row.extra_json,
};
Ok(Some(eg))
@@ -716,6 +721,7 @@ impl Api for Server {
id: Some(row.id),
editor_id: row.editor_id,
description: row.description,
+ edits: None,
extra: row.extra_json,
};
Box::new(futures::done(Ok(
diff --git a/rust/src/database_models.rs b/rust/src/database_models.rs
index aaf21ce0..5e4e9710 100644
--- a/rust/src/database_models.rs
+++ b/rust/src/database_models.rs
@@ -167,7 +167,6 @@ pub struct ReleaseRefRow {
stub: Option<String>,
}
-/*
#[derive(Debug, Queryable, Identifiable, Associations, AsChangeset)]
#[table_name = "file_release"]
pub struct FileReleaseRow {
@@ -175,7 +174,6 @@ pub struct FileReleaseRow {
file_rev: i64,
target_release_ident_id: Uuid,
}
-*/
#[derive(Debug, Queryable, Identifiable, Associations, AsChangeset)]
#[table_name = "editgroup"]