aboutsummaryrefslogtreecommitdiffstats
path: root/rust/fatcat-api
diff options
context:
space:
mode:
Diffstat (limited to 'rust/fatcat-api')
-rw-r--r--rust/fatcat-api/README.md2
-rw-r--r--rust/fatcat-api/api.yaml76
-rw-r--r--rust/fatcat-api/api/swagger.yaml96
-rw-r--r--rust/fatcat-api/examples/server_lib/server.rs24
-rw-r--r--rust/fatcat-api/src/client.rs24
-rw-r--r--rust/fatcat-api/src/lib.rs48
-rw-r--r--rust/fatcat-api/src/models.rs38
-rw-r--r--rust/fatcat-api/src/server.rs128
8 files changed, 217 insertions, 219 deletions
diff --git a/rust/fatcat-api/README.md b/rust/fatcat-api/README.md
index 1c409076..99162994 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-27T00:04:18.431Z
+- Build date: 2018-05-27T21:43:16.246Z
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 585932b3..f1b94234 100644
--- a/rust/fatcat-api/api.yaml
+++ b/rust/fatcat-api/api.yaml
@@ -38,29 +38,6 @@ x-entity-props: &ENTITYPROPS
extra:
type: object
additionalProperties: {}
-x-entity-edit-props: &ENTITYEDITPROPS
- edit_id:
- type: integer
- example: 847
- format: int64
- ident:
- type: string
- example: "f1f046a3-45c9-4b99-adce-000000000001"
- revision:
- type: integer
- example: 42
- format: int64
- redirect_ident:
- type: string
- example: "f1f046a3-45c9-4b99-adce-000000000002"
- #format: uuid
- editgroup_id:
- type: integer
- example: 16
- format: int64
- extra:
- type: object
- additionalProperties: {}
definitions:
@@ -196,7 +173,28 @@ definitions:
- ident
- editgroup_id
properties:
- <<: *ENTITYEDITPROPS
+ edit_id:
+ type: integer
+ example: 847
+ format: int64
+ ident:
+ type: string
+ example: "f1f046a3-45c9-4b99-adce-000000000001"
+ revision:
+ type: integer
+ example: 42
+ format: int64
+ redirect_ident:
+ type: string
+ example: "f1f046a3-45c9-4b99-adce-000000000002"
+ #format: uuid
+ editgroup_id:
+ type: integer
+ example: 16
+ format: int64
+ extra:
+ type: object
+ additionalProperties: {}
editor:
type: object
required:
@@ -305,7 +303,7 @@ paths:
/creator:
post:
parameters:
- - name: body
+ - name: entity
in: body
required: true
schema:
@@ -316,6 +314,24 @@ paths:
schema:
$ref: "#/definitions/entity_edit"
<<: *ENTITYRESPONSES
+# /creator/batch:
+# post:
+# parameters:
+# - name: entity_list
+# in: body
+# required: true
+# schema:
+# type: array
+# items:
+# $ref: "#/definitions/creator_entity"
+# responses:
+# 201:
+# description: Created Entities
+# schema:
+# type: array
+# items:
+# $ref: "#/definitions/entity_edit"
+# <<: *ENTITYRESPONSES
/creator/{id}:
parameters:
- name: id
@@ -345,7 +361,7 @@ paths:
/container:
post:
parameters:
- - name: body
+ - name: entity
in: body
required: true
schema:
@@ -385,7 +401,7 @@ paths:
/file:
post:
parameters:
- - name: body
+ - name: entity
in: body
required: true
schema:
@@ -425,7 +441,7 @@ paths:
/release:
post:
parameters:
- - name: body
+ - name: entity
in: body
required: true
schema:
@@ -465,7 +481,7 @@ paths:
/work:
post:
parameters:
- - name: body
+ - name: entity
in: body
required: true
schema:
@@ -532,7 +548,7 @@ paths:
/editgroup:
post:
parameters:
- - name: body
+ - name: entity
in: body
required: true
schema:
diff --git a/rust/fatcat-api/api/swagger.yaml b/rust/fatcat-api/api/swagger.yaml
index e6b4b356..d9c03d42 100644
--- a/rust/fatcat-api/api/swagger.yaml
+++ b/rust/fatcat-api/api/swagger.yaml
@@ -17,7 +17,7 @@ paths:
post:
parameters:
- in: "body"
- name: "body"
+ name: "entity"
required: true
schema:
$ref: "#/definitions/creator_entity"
@@ -177,7 +177,7 @@ paths:
post:
parameters:
- in: "body"
- name: "body"
+ name: "entity"
required: true
schema:
$ref: "#/definitions/container_entity"
@@ -337,7 +337,7 @@ paths:
post:
parameters:
- in: "body"
- name: "body"
+ name: "entity"
required: true
schema:
$ref: "#/definitions/file_entity"
@@ -497,7 +497,7 @@ paths:
post:
parameters:
- in: "body"
- name: "body"
+ name: "entity"
required: true
schema:
$ref: "#/definitions/release_entity"
@@ -657,7 +657,7 @@ paths:
post:
parameters:
- in: "body"
- name: "body"
+ name: "entity"
required: true
schema:
$ref: "#/definitions/work_entity"
@@ -850,7 +850,7 @@ paths:
post:
parameters:
- in: "body"
- name: "body"
+ name: "entity"
required: true
schema:
$ref: "#/definitions/editgroup"
@@ -1321,30 +1321,30 @@ definitions:
- "editgroup_id"
- "ident"
properties:
- extra:
- type: "object"
- editgroup_id:
+ edit_id:
type: "integer"
format: "int64"
- example: 16
- redirect_ident:
+ example: 847
+ ident:
type: "string"
- example: "f1f046a3-45c9-4b99-adce-000000000002"
+ example: "f1f046a3-45c9-4b99-adce-000000000001"
revision:
type: "integer"
format: "int64"
example: 42
- ident:
+ redirect_ident:
type: "string"
- example: "f1f046a3-45c9-4b99-adce-000000000001"
- edit_id:
+ example: "f1f046a3-45c9-4b99-adce-000000000002"
+ editgroup_id:
type: "integer"
format: "int64"
- example: 847
+ example: 16
+ extra:
+ type: "object"
example:
ident: "f1f046a3-45c9-4b99-adce-000000000001"
- extra: "{}"
edit_id: 847
+ extra: "{}"
redirect_ident: "f1f046a3-45c9-4b99-adce-000000000002"
editgroup_id: 16
revision: 42
@@ -1382,66 +1382,66 @@ definitions:
edits:
works:
- ident: "f1f046a3-45c9-4b99-adce-000000000001"
- extra: "{}"
edit_id: 847
+ extra: "{}"
redirect_ident: "f1f046a3-45c9-4b99-adce-000000000002"
editgroup_id: 16
revision: 42
- ident: "f1f046a3-45c9-4b99-adce-000000000001"
- extra: "{}"
edit_id: 847
+ extra: "{}"
redirect_ident: "f1f046a3-45c9-4b99-adce-000000000002"
editgroup_id: 16
revision: 42
creators:
- ident: "f1f046a3-45c9-4b99-adce-000000000001"
- extra: "{}"
edit_id: 847
+ extra: "{}"
redirect_ident: "f1f046a3-45c9-4b99-adce-000000000002"
editgroup_id: 16
revision: 42
- ident: "f1f046a3-45c9-4b99-adce-000000000001"
- extra: "{}"
edit_id: 847
+ extra: "{}"
redirect_ident: "f1f046a3-45c9-4b99-adce-000000000002"
editgroup_id: 16
revision: 42
files:
- ident: "f1f046a3-45c9-4b99-adce-000000000001"
- extra: "{}"
edit_id: 847
+ extra: "{}"
redirect_ident: "f1f046a3-45c9-4b99-adce-000000000002"
editgroup_id: 16
revision: 42
- ident: "f1f046a3-45c9-4b99-adce-000000000001"
- extra: "{}"
edit_id: 847
+ extra: "{}"
redirect_ident: "f1f046a3-45c9-4b99-adce-000000000002"
editgroup_id: 16
revision: 42
containers:
- ident: "f1f046a3-45c9-4b99-adce-000000000001"
- extra: "{}"
edit_id: 847
+ extra: "{}"
redirect_ident: "f1f046a3-45c9-4b99-adce-000000000002"
editgroup_id: 16
revision: 42
- ident: "f1f046a3-45c9-4b99-adce-000000000001"
- extra: "{}"
edit_id: 847
+ extra: "{}"
redirect_ident: "f1f046a3-45c9-4b99-adce-000000000002"
editgroup_id: 16
revision: 42
releases:
- ident: "f1f046a3-45c9-4b99-adce-000000000001"
- extra: "{}"
edit_id: 847
+ extra: "{}"
redirect_ident: "f1f046a3-45c9-4b99-adce-000000000002"
editgroup_id: 16
revision: 42
- ident: "f1f046a3-45c9-4b99-adce-000000000001"
- extra: "{}"
edit_id: 847
+ extra: "{}"
redirect_ident: "f1f046a3-45c9-4b99-adce-000000000002"
editgroup_id: 16
revision: 42
@@ -1512,66 +1512,66 @@ definitions:
example:
works:
- ident: "f1f046a3-45c9-4b99-adce-000000000001"
- extra: "{}"
edit_id: 847
+ extra: "{}"
redirect_ident: "f1f046a3-45c9-4b99-adce-000000000002"
editgroup_id: 16
revision: 42
- ident: "f1f046a3-45c9-4b99-adce-000000000001"
- extra: "{}"
edit_id: 847
+ extra: "{}"
redirect_ident: "f1f046a3-45c9-4b99-adce-000000000002"
editgroup_id: 16
revision: 42
creators:
- ident: "f1f046a3-45c9-4b99-adce-000000000001"
- extra: "{}"
edit_id: 847
+ extra: "{}"
redirect_ident: "f1f046a3-45c9-4b99-adce-000000000002"
editgroup_id: 16
revision: 42
- ident: "f1f046a3-45c9-4b99-adce-000000000001"
- extra: "{}"
edit_id: 847
+ extra: "{}"
redirect_ident: "f1f046a3-45c9-4b99-adce-000000000002"
editgroup_id: 16
revision: 42
files:
- ident: "f1f046a3-45c9-4b99-adce-000000000001"
- extra: "{}"
edit_id: 847
+ extra: "{}"
redirect_ident: "f1f046a3-45c9-4b99-adce-000000000002"
editgroup_id: 16
revision: 42
- ident: "f1f046a3-45c9-4b99-adce-000000000001"
- extra: "{}"
edit_id: 847
+ extra: "{}"
redirect_ident: "f1f046a3-45c9-4b99-adce-000000000002"
editgroup_id: 16
revision: 42
containers:
- ident: "f1f046a3-45c9-4b99-adce-000000000001"
- extra: "{}"
edit_id: 847
+ extra: "{}"
redirect_ident: "f1f046a3-45c9-4b99-adce-000000000002"
editgroup_id: 16
revision: 42
- ident: "f1f046a3-45c9-4b99-adce-000000000001"
- extra: "{}"
edit_id: 847
+ extra: "{}"
redirect_ident: "f1f046a3-45c9-4b99-adce-000000000002"
editgroup_id: 16
revision: 42
releases:
- ident: "f1f046a3-45c9-4b99-adce-000000000001"
- extra: "{}"
edit_id: 847
+ extra: "{}"
redirect_ident: "f1f046a3-45c9-4b99-adce-000000000002"
editgroup_id: 16
revision: 42
- ident: "f1f046a3-45c9-4b99-adce-000000000001"
- extra: "{}"
edit_id: 847
+ extra: "{}"
redirect_ident: "f1f046a3-45c9-4b99-adce-000000000002"
editgroup_id: 16
revision: 42
@@ -1617,28 +1617,6 @@ x-entity-props:
extra:
type: "object"
additionalProperties: {}
-x-entity-edit-props:
- edit_id:
- type: "integer"
- example: 847
- format: "int64"
- ident:
- type: "string"
- example: "f1f046a3-45c9-4b99-adce-000000000001"
- revision:
- type: "integer"
- example: 42
- format: "int64"
- redirect_ident:
- type: "string"
- example: "f1f046a3-45c9-4b99-adce-000000000002"
- editgroup_id:
- type: "integer"
- example: 16
- format: "int64"
- extra:
- type: "object"
- additionalProperties: {}
x-entity-responses:
400:
description: "Bad Request"
diff --git a/rust/fatcat-api/examples/server_lib/server.rs b/rust/fatcat-api/examples/server_lib/server.rs
index a28b9c72..4ea73046 100644
--- a/rust/fatcat-api/examples/server_lib/server.rs
+++ b/rust/fatcat-api/examples/server_lib/server.rs
@@ -30,9 +30,9 @@ impl Api for Server {
Box::new(futures::failed("Generic failure".into()))
}
- fn container_post(&self, body: models::ContainerEntity, context: &Context) -> Box<Future<Item = ContainerPostResponse, Error = ApiError> + Send> {
+ fn container_post(&self, entity: models::ContainerEntity, context: &Context) -> Box<Future<Item = ContainerPostResponse, Error = ApiError> + Send> {
let context = context.clone();
- println!("container_post({:?}) - X-Span-ID: {:?}", body, context.x_span_id.unwrap_or(String::from("<none>")).clone());
+ println!("container_post({:?}) - X-Span-ID: {:?}", entity, context.x_span_id.unwrap_or(String::from("<none>")).clone());
Box::new(futures::failed("Generic failure".into()))
}
@@ -48,9 +48,9 @@ impl Api for Server {
Box::new(futures::failed("Generic failure".into()))
}
- fn creator_post(&self, body: models::CreatorEntity, context: &Context) -> Box<Future<Item = CreatorPostResponse, Error = ApiError> + Send> {
+ fn creator_post(&self, entity: models::CreatorEntity, context: &Context) -> Box<Future<Item = CreatorPostResponse, Error = ApiError> + Send> {
let context = context.clone();
- println!("creator_post({:?}) - X-Span-ID: {:?}", body, context.x_span_id.unwrap_or(String::from("<none>")).clone());
+ println!("creator_post({:?}) - X-Span-ID: {:?}", entity, context.x_span_id.unwrap_or(String::from("<none>")).clone());
Box::new(futures::failed("Generic failure".into()))
}
@@ -66,9 +66,9 @@ impl Api for Server {
Box::new(futures::failed("Generic failure".into()))
}
- fn editgroup_post(&self, body: models::Editgroup, context: &Context) -> Box<Future<Item = EditgroupPostResponse, Error = ApiError> + Send> {
+ fn editgroup_post(&self, entity: models::Editgroup, context: &Context) -> Box<Future<Item = EditgroupPostResponse, Error = ApiError> + Send> {
let context = context.clone();
- println!("editgroup_post({:?}) - X-Span-ID: {:?}", body, context.x_span_id.unwrap_or(String::from("<none>")).clone());
+ println!("editgroup_post({:?}) - X-Span-ID: {:?}", entity, context.x_span_id.unwrap_or(String::from("<none>")).clone());
Box::new(futures::failed("Generic failure".into()))
}
@@ -100,9 +100,9 @@ impl Api for Server {
Box::new(futures::failed("Generic failure".into()))
}
- fn file_post(&self, body: models::FileEntity, context: &Context) -> Box<Future<Item = FilePostResponse, Error = ApiError> + Send> {
+ fn file_post(&self, entity: models::FileEntity, context: &Context) -> Box<Future<Item = FilePostResponse, Error = ApiError> + Send> {
let context = context.clone();
- println!("file_post({:?}) - X-Span-ID: {:?}", body, context.x_span_id.unwrap_or(String::from("<none>")).clone());
+ println!("file_post({:?}) - X-Span-ID: {:?}", entity, context.x_span_id.unwrap_or(String::from("<none>")).clone());
Box::new(futures::failed("Generic failure".into()))
}
@@ -118,9 +118,9 @@ impl Api for Server {
Box::new(futures::failed("Generic failure".into()))
}
- fn release_post(&self, body: models::ReleaseEntity, context: &Context) -> Box<Future<Item = ReleasePostResponse, Error = ApiError> + Send> {
+ fn release_post(&self, entity: models::ReleaseEntity, context: &Context) -> Box<Future<Item = ReleasePostResponse, Error = ApiError> + Send> {
let context = context.clone();
- println!("release_post({:?}) - X-Span-ID: {:?}", body, context.x_span_id.unwrap_or(String::from("<none>")).clone());
+ println!("release_post({:?}) - X-Span-ID: {:?}", entity, context.x_span_id.unwrap_or(String::from("<none>")).clone());
Box::new(futures::failed("Generic failure".into()))
}
@@ -130,9 +130,9 @@ impl Api for Server {
Box::new(futures::failed("Generic failure".into()))
}
- fn work_post(&self, body: models::WorkEntity, context: &Context) -> Box<Future<Item = WorkPostResponse, Error = ApiError> + Send> {
+ fn work_post(&self, entity: models::WorkEntity, context: &Context) -> Box<Future<Item = WorkPostResponse, Error = ApiError> + Send> {
let context = context.clone();
- println!("work_post({:?}) - X-Span-ID: {:?}", body, context.x_span_id.unwrap_or(String::from("<none>")).clone());
+ println!("work_post({:?}) - X-Span-ID: {:?}", entity, context.x_span_id.unwrap_or(String::from("<none>")).clone());
Box::new(futures::failed("Generic failure".into()))
}
}
diff --git a/rust/fatcat-api/src/client.rs b/rust/fatcat-api/src/client.rs
index 23f6dd21..d81d251f 100644
--- a/rust/fatcat-api/src/client.rs
+++ b/rust/fatcat-api/src/client.rs
@@ -284,10 +284,10 @@ impl Api for Client {
Box::new(futures::done(result))
}
- fn container_post(&self, param_body: models::ContainerEntity, context: &Context) -> Box<Future<Item = ContainerPostResponse, Error = ApiError> + Send> {
+ fn container_post(&self, param_entity: models::ContainerEntity, context: &Context) -> Box<Future<Item = ContainerPostResponse, Error = ApiError> + Send> {
let url = format!("{}/v0/container", self.base_path);
- let body = serde_json::to_string(&param_body).expect("impossible to fail to serialize");
+ let body = serde_json::to_string(&param_entity).expect("impossible to fail to serialize");
let hyper_client = (self.hyper_client)();
let request = hyper_client.request(hyper::method::Method::Post, &url);
@@ -472,10 +472,10 @@ impl Api for Client {
Box::new(futures::done(result))
}
- fn creator_post(&self, param_body: models::CreatorEntity, context: &Context) -> Box<Future<Item = CreatorPostResponse, Error = ApiError> + Send> {
+ fn creator_post(&self, param_entity: models::CreatorEntity, context: &Context) -> Box<Future<Item = CreatorPostResponse, Error = ApiError> + Send> {
let url = format!("{}/v0/creator", self.base_path);
- let body = serde_json::to_string(&param_body).expect("impossible to fail to serialize");
+ let body = serde_json::to_string(&param_entity).expect("impossible to fail to serialize");
let hyper_client = (self.hyper_client)();
let request = hyper_client.request(hyper::method::Method::Post, &url);
@@ -657,10 +657,10 @@ impl Api for Client {
Box::new(futures::done(result))
}
- fn editgroup_post(&self, param_body: models::Editgroup, context: &Context) -> Box<Future<Item = EditgroupPostResponse, Error = ApiError> + Send> {
+ fn editgroup_post(&self, param_entity: models::Editgroup, context: &Context) -> Box<Future<Item = EditgroupPostResponse, Error = ApiError> + Send> {
let url = format!("{}/v0/editgroup", self.base_path);
- let body = serde_json::to_string(&param_body).expect("impossible to fail to serialize");
+ let body = serde_json::to_string(&param_entity).expect("impossible to fail to serialize");
let hyper_client = (self.hyper_client)();
let request = hyper_client.request(hyper::method::Method::Post, &url);
@@ -952,10 +952,10 @@ impl Api for Client {
Box::new(futures::done(result))
}
- fn file_post(&self, param_body: models::FileEntity, context: &Context) -> Box<Future<Item = FilePostResponse, Error = ApiError> + Send> {
+ fn file_post(&self, param_entity: models::FileEntity, context: &Context) -> Box<Future<Item = FilePostResponse, Error = ApiError> + Send> {
let url = format!("{}/v0/file", self.base_path);
- let body = serde_json::to_string(&param_body).expect("impossible to fail to serialize");
+ let body = serde_json::to_string(&param_entity).expect("impossible to fail to serialize");
let hyper_client = (self.hyper_client)();
let request = hyper_client.request(hyper::method::Method::Post, &url);
@@ -1140,10 +1140,10 @@ impl Api for Client {
Box::new(futures::done(result))
}
- fn release_post(&self, param_body: models::ReleaseEntity, context: &Context) -> Box<Future<Item = ReleasePostResponse, Error = ApiError> + Send> {
+ fn release_post(&self, param_entity: models::ReleaseEntity, context: &Context) -> Box<Future<Item = ReleasePostResponse, Error = ApiError> + Send> {
let url = format!("{}/v0/release", self.base_path);
- let body = serde_json::to_string(&param_body).expect("impossible to fail to serialize");
+ let body = serde_json::to_string(&param_entity).expect("impossible to fail to serialize");
let hyper_client = (self.hyper_client)();
let request = hyper_client.request(hyper::method::Method::Post, &url);
@@ -1265,10 +1265,10 @@ impl Api for Client {
Box::new(futures::done(result))
}
- fn work_post(&self, param_body: models::WorkEntity, context: &Context) -> Box<Future<Item = WorkPostResponse, Error = ApiError> + Send> {
+ fn work_post(&self, param_entity: models::WorkEntity, context: &Context) -> Box<Future<Item = WorkPostResponse, Error = ApiError> + Send> {
let url = format!("{}/v0/work", self.base_path);
- let body = serde_json::to_string(&param_body).expect("impossible to fail to serialize");
+ let body = serde_json::to_string(&param_entity).expect("impossible to fail to serialize");
let hyper_client = (self.hyper_client)();
let request = hyper_client.request(hyper::method::Method::Post, &url);
diff --git a/rust/fatcat-api/src/lib.rs b/rust/fatcat-api/src/lib.rs
index a21a0751..dca1aa35 100644
--- a/rust/fatcat-api/src/lib.rs
+++ b/rust/fatcat-api/src/lib.rs
@@ -260,19 +260,19 @@ pub trait Api {
fn container_lookup_get(&self, issnl: String, context: &Context) -> Box<Future<Item = ContainerLookupGetResponse, Error = ApiError> + Send>;
- fn container_post(&self, body: models::ContainerEntity, context: &Context) -> Box<Future<Item = ContainerPostResponse, Error = ApiError> + Send>;
+ fn container_post(&self, entity: 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: models::CreatorEntity, context: &Context) -> Box<Future<Item = CreatorPostResponse, Error = ApiError> + Send>;
+ fn creator_post(&self, entity: models::CreatorEntity, context: &Context) -> Box<Future<Item = CreatorPostResponse, Error = ApiError> + Send>;
fn editgroup_id_accept_post(&self, id: i64, context: &Context) -> Box<Future<Item = EditgroupIdAcceptPostResponse, Error = ApiError> + Send>;
fn editgroup_id_get(&self, id: i64, context: &Context) -> Box<Future<Item = EditgroupIdGetResponse, Error = ApiError> + Send>;
- fn editgroup_post(&self, body: models::Editgroup, context: &Context) -> Box<Future<Item = EditgroupPostResponse, Error = ApiError> + Send>;
+ fn editgroup_post(&self, entity: models::Editgroup, 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>;
@@ -282,17 +282,17 @@ pub trait Api {
fn file_lookup_get(&self, sha1: String, context: &Context) -> Box<Future<Item = FileLookupGetResponse, Error = ApiError> + Send>;
- fn file_post(&self, body: models::FileEntity, context: &Context) -> Box<Future<Item = FilePostResponse, Error = ApiError> + Send>;
+ fn file_post(&self, entity: 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: models::ReleaseEntity, context: &Context) -> Box<Future<Item = ReleasePostResponse, Error = ApiError> + Send>;
+ fn release_post(&self, entity: 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: models::WorkEntity, context: &Context) -> Box<Future<Item = WorkPostResponse, Error = ApiError> + Send>;
+ fn work_post(&self, entity: models::WorkEntity, context: &Context) -> Box<Future<Item = WorkPostResponse, Error = ApiError> + Send>;
}
/// API without a `Context`
@@ -301,19 +301,19 @@ pub trait ApiNoContext {
fn container_lookup_get(&self, issnl: String) -> Box<Future<Item = ContainerLookupGetResponse, Error = ApiError> + Send>;
- fn container_post(&self, body: models::ContainerEntity) -> Box<Future<Item = ContainerPostResponse, Error = ApiError> + Send>;
+ fn container_post(&self, entity: 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: models::CreatorEntity) -> Box<Future<Item = CreatorPostResponse, Error = ApiError> + Send>;
+ fn creator_post(&self, entity: models::CreatorEntity) -> Box<Future<Item = CreatorPostResponse, Error = ApiError> + Send>;
fn editgroup_id_accept_post(&self, id: i64) -> Box<Future<Item = EditgroupIdAcceptPostResponse, Error = ApiError> + Send>;
fn editgroup_id_get(&self, id: i64) -> Box<Future<Item = EditgroupIdGetResponse, Error = ApiError> + Send>;
- fn editgroup_post(&self, body: models::Editgroup) -> Box<Future<Item = EditgroupPostResponse, Error = ApiError> + Send>;
+ fn editgroup_post(&self, entity: models::Editgroup) -> Box<Future<Item = EditgroupPostResponse, Error = ApiError> + Send>;
fn editor_username_changelog_get(&self, username: String) -> Box<Future<Item = EditorUsernameChangelogGetResponse, Error = ApiError> + Send>;
@@ -323,17 +323,17 @@ pub trait ApiNoContext {
fn file_lookup_get(&self, sha1: String) -> Box<Future<Item = FileLookupGetResponse, Error = ApiError> + Send>;
- fn file_post(&self, body: models::FileEntity) -> Box<Future<Item = FilePostResponse, Error = ApiError> + Send>;
+ fn file_post(&self, entity: 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: models::ReleaseEntity) -> Box<Future<Item = ReleasePostResponse, Error = ApiError> + Send>;
+ fn release_post(&self, entity: 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: models::WorkEntity) -> Box<Future<Item = WorkPostResponse, Error = ApiError> + Send>;
+ fn work_post(&self, entity: models::WorkEntity) -> Box<Future<Item = WorkPostResponse, Error = ApiError> + Send>;
}
/// Trait to extend an API to make it easy to bind it to a context.
@@ -360,8 +360,8 @@ impl<'a, T: Api> ApiNoContext for ContextWrapper<'a, T> {
self.api().container_lookup_get(issnl, &self.context())
}
- fn container_post(&self, body: models::ContainerEntity) -> Box<Future<Item = ContainerPostResponse, Error = ApiError> + Send> {
- self.api().container_post(body, &self.context())
+ fn container_post(&self, entity: models::ContainerEntity) -> Box<Future<Item = ContainerPostResponse, Error = ApiError> + Send> {
+ self.api().container_post(entity, &self.context())
}
fn creator_id_get(&self, id: String) -> Box<Future<Item = CreatorIdGetResponse, Error = ApiError> + Send> {
@@ -372,8 +372,8 @@ impl<'a, T: Api> ApiNoContext for ContextWrapper<'a, T> {
self.api().creator_lookup_get(orcid, &self.context())
}
- fn creator_post(&self, body: models::CreatorEntity) -> Box<Future<Item = CreatorPostResponse, Error = ApiError> + Send> {
- self.api().creator_post(body, &self.context())
+ fn creator_post(&self, entity: models::CreatorEntity) -> Box<Future<Item = CreatorPostResponse, Error = ApiError> + Send> {
+ self.api().creator_post(entity, &self.context())
}
fn editgroup_id_accept_post(&self, id: i64) -> Box<Future<Item = EditgroupIdAcceptPostResponse, Error = ApiError> + Send> {
@@ -384,8 +384,8 @@ impl<'a, T: Api> ApiNoContext for ContextWrapper<'a, T> {
self.api().editgroup_id_get(id, &self.context())
}
- fn editgroup_post(&self, body: models::Editgroup) -> Box<Future<Item = EditgroupPostResponse, Error = ApiError> + Send> {
- self.api().editgroup_post(body, &self.context())
+ fn editgroup_post(&self, entity: models::Editgroup) -> Box<Future<Item = EditgroupPostResponse, Error = ApiError> + Send> {
+ self.api().editgroup_post(entity, &self.context())
}
fn editor_username_changelog_get(&self, username: String) -> Box<Future<Item = EditorUsernameChangelogGetResponse, Error = ApiError> + Send> {
@@ -404,8 +404,8 @@ impl<'a, T: Api> ApiNoContext for ContextWrapper<'a, T> {
self.api().file_lookup_get(sha1, &self.context())
}
- fn file_post(&self, body: models::FileEntity) -> Box<Future<Item = FilePostResponse, Error = ApiError> + Send> {
- self.api().file_post(body, &self.context())
+ fn file_post(&self, entity: models::FileEntity) -> Box<Future<Item = FilePostResponse, Error = ApiError> + Send> {
+ self.api().file_post(entity, &self.context())
}
fn release_id_get(&self, id: String) -> Box<Future<Item = ReleaseIdGetResponse, Error = ApiError> + Send> {
@@ -416,16 +416,16 @@ impl<'a, T: Api> ApiNoContext for ContextWrapper<'a, T> {
self.api().release_lookup_get(doi, &self.context())
}
- fn release_post(&self, body: models::ReleaseEntity) -> Box<Future<Item = ReleasePostResponse, Error = ApiError> + Send> {
- self.api().release_post(body, &self.context())
+ fn release_post(&self, entity: models::ReleaseEntity) -> Box<Future<Item = ReleasePostResponse, Error = ApiError> + Send> {
+ self.api().release_post(entity, &self.context())
}
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: models::WorkEntity) -> Box<Future<Item = WorkPostResponse, Error = ApiError> + Send> {
- self.api().work_post(body, &self.context())
+ fn work_post(&self, entity: models::WorkEntity) -> Box<Future<Item = WorkPostResponse, Error = ApiError> + Send> {
+ self.api().work_post(entity, &self.context())
}
}
diff --git a/rust/fatcat-api/src/models.rs b/rust/fatcat-api/src/models.rs
index b05c0fc1..24c66f6b 100644
--- a/rust/fatcat-api/src/models.rs
+++ b/rust/fatcat-api/src/models.rs
@@ -290,37 +290,37 @@ impl Editor {
#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
pub struct EntityEdit {
- #[serde(rename = "extra")]
- #[serde(skip_serializing_if = "Option::is_none")]
- pub extra: Option<serde_json::Value>,
-
- #[serde(rename = "editgroup_id")]
- pub editgroup_id: i64,
+ #[serde(rename = "edit_id")]
+ pub edit_id: i64,
- #[serde(rename = "redirect_ident")]
- #[serde(skip_serializing_if = "Option::is_none")]
- pub redirect_ident: Option<String>,
+ #[serde(rename = "ident")]
+ pub ident: String,
#[serde(rename = "revision")]
#[serde(skip_serializing_if = "Option::is_none")]
pub revision: Option<i64>,
- #[serde(rename = "ident")]
- pub ident: String,
+ #[serde(rename = "redirect_ident")]
+ #[serde(skip_serializing_if = "Option::is_none")]
+ pub redirect_ident: Option<String>,
- #[serde(rename = "edit_id")]
- pub edit_id: i64,
+ #[serde(rename = "editgroup_id")]
+ pub editgroup_id: i64,
+
+ #[serde(rename = "extra")]
+ #[serde(skip_serializing_if = "Option::is_none")]
+ pub extra: Option<serde_json::Value>,
}
impl EntityEdit {
- pub fn new(editgroup_id: i64, ident: String, edit_id: i64) -> EntityEdit {
+ pub fn new(edit_id: i64, ident: String, editgroup_id: i64) -> EntityEdit {
EntityEdit {
- extra: None,
- editgroup_id: editgroup_id,
- redirect_ident: None,
- revision: None,
- ident: ident,
edit_id: edit_id,
+ ident: ident,
+ revision: None,
+ redirect_ident: None,
+ editgroup_id: editgroup_id,
+ extra: None,
}
}
}
diff --git a/rust/fatcat-api/src/server.rs b/rust/fatcat-api/src/server.rs
index ed012478..7fdc5d2a 100644
--- a/rust/fatcat-api/src/server.rs
+++ b/rust/fatcat-api/src/server.rs
@@ -276,27 +276,27 @@ where
// values, rather than causing a 400 response). Produce warning header and logs for
// any unused fields.
- let param_body = req.get::<bodyparser::Raw>()
- .map_err(|e| Response::with((status::BadRequest, format!("Couldn't parse body parameter body - not valid UTF-8: {}", e))))?;
+ let param_entity = req.get::<bodyparser::Raw>()
+ .map_err(|e| Response::with((status::BadRequest, format!("Couldn't parse body parameter entity - not valid UTF-8: {}", e))))?;
let mut unused_elements = Vec::new();
- let param_body = if let Some(param_body_raw) = param_body {
- let deserializer = &mut serde_json::Deserializer::from_str(&param_body_raw);
+ let param_entity = if let Some(param_entity_raw) = param_entity {
+ let deserializer = &mut serde_json::Deserializer::from_str(&param_entity_raw);
- let param_body: Option<models::ContainerEntity> =
+ let param_entity: Option<models::ContainerEntity> =
serde_ignored::deserialize(deserializer, |path| {
warn!("Ignoring unknown field in body: {}", path);
unused_elements.push(path.to_string());
- }).map_err(|e| Response::with((status::BadRequest, format!("Couldn't parse body parameter body - doesn't match schema: {}", e))))?;
+ }).map_err(|e| Response::with((status::BadRequest, format!("Couldn't parse body parameter entity - doesn't match schema: {}", e))))?;
- param_body
+ param_entity
} else {
None
};
- let param_body = param_body.ok_or_else(|| Response::with((status::BadRequest, "Missing required body parameter body".to_string())))?;
+ let param_entity = param_entity.ok_or_else(|| Response::with((status::BadRequest, "Missing required body parameter entity".to_string())))?;
- match api.container_post(param_body, context).wait() {
+ match api.container_post(param_entity, context).wait() {
Ok(rsp) => match rsp {
ContainerPostResponse::CreatedEntity(body) => {
let body_string = serde_json::to_string(&body).expect("impossible to fail to serialize");
@@ -554,26 +554,27 @@ where
// values, rather than causing a 400 response). Produce warning header and logs for
// any unused fields.
- let param_body = req.get::<bodyparser::Raw>()
- .map_err(|e| Response::with((status::BadRequest, format!("Couldn't parse body parameter body - not valid UTF-8: {}", e))))?;
+ let param_entity = req.get::<bodyparser::Raw>()
+ .map_err(|e| Response::with((status::BadRequest, format!("Couldn't parse body parameter entity - not valid UTF-8: {}", e))))?;
let mut unused_elements = Vec::new();
- let param_body = if let Some(param_body_raw) = param_body {
- let deserializer = &mut serde_json::Deserializer::from_str(&param_body_raw);
+ let param_entity = if let Some(param_entity_raw) = param_entity {
+ let deserializer = &mut serde_json::Deserializer::from_str(&param_entity_raw);
- let param_body: Option<models::CreatorEntity> = serde_ignored::deserialize(deserializer, |path| {
- warn!("Ignoring unknown field in body: {}", path);
- unused_elements.push(path.to_string());
- }).map_err(|e| Response::with((status::BadRequest, format!("Couldn't parse body parameter body - doesn't match schema: {}", e))))?;
+ let param_entity: Option<models::CreatorEntity> =
+ serde_ignored::deserialize(deserializer, |path| {
+ warn!("Ignoring unknown field in body: {}", path);
+ unused_elements.push(path.to_string());
+ }).map_err(|e| Response::with((status::BadRequest, format!("Couldn't parse body parameter entity - doesn't match schema: {}", e))))?;
- param_body
+ param_entity
} else {
None
};
- let param_body = param_body.ok_or_else(|| Response::with((status::BadRequest, "Missing required body parameter body".to_string())))?;
+ let param_entity = param_entity.ok_or_else(|| Response::with((status::BadRequest, "Missing required body parameter entity".to_string())))?;
- match api.creator_post(param_body, context).wait() {
+ match api.creator_post(param_entity, context).wait() {
Ok(rsp) => match rsp {
CreatorPostResponse::CreatedEntity(body) => {
let body_string = serde_json::to_string(&body).expect("impossible to fail to serialize");
@@ -835,26 +836,26 @@ where
// values, rather than causing a 400 response). Produce warning header and logs for
// any unused fields.
- let param_body = req.get::<bodyparser::Raw>()
- .map_err(|e| Response::with((status::BadRequest, format!("Couldn't parse body parameter body - not valid UTF-8: {}", e))))?;
+ let param_entity = req.get::<bodyparser::Raw>()
+ .map_err(|e| Response::with((status::BadRequest, format!("Couldn't parse body parameter entity - not valid UTF-8: {}", e))))?;
let mut unused_elements = Vec::new();
- let param_body = if let Some(param_body_raw) = param_body {
- let deserializer = &mut serde_json::Deserializer::from_str(&param_body_raw);
+ let param_entity = if let Some(param_entity_raw) = param_entity {
+ let deserializer = &mut serde_json::Deserializer::from_str(&param_entity_raw);
- let param_body: Option<models::Editgroup> = serde_ignored::deserialize(deserializer, |path| {
+ let param_entity: Option<models::Editgroup> = serde_ignored::deserialize(deserializer, |path| {
warn!("Ignoring unknown field in body: {}", path);
unused_elements.push(path.to_string());
- }).map_err(|e| Response::with((status::BadRequest, format!("Couldn't parse body parameter body - doesn't match schema: {}", e))))?;
+ }).map_err(|e| Response::with((status::BadRequest, format!("Couldn't parse body parameter entity - doesn't match schema: {}", e))))?;
- param_body
+ param_entity
} else {
None
};
- let param_body = param_body.ok_or_else(|| Response::with((status::BadRequest, "Missing required body parameter body".to_string())))?;
+ let param_entity = param_entity.ok_or_else(|| Response::with((status::BadRequest, "Missing required body parameter entity".to_string())))?;
- match api.editgroup_post(param_body, context).wait() {
+ match api.editgroup_post(param_entity, context).wait() {
Ok(rsp) => match rsp {
EditgroupPostResponse::SuccessfullyCreated(body) => {
let body_string = serde_json::to_string(&body).expect("impossible to fail to serialize");
@@ -1256,26 +1257,27 @@ where
// values, rather than causing a 400 response). Produce warning header and logs for
// any unused fields.
- let param_body = req.get::<bodyparser::Raw>()
- .map_err(|e| Response::with((status::BadRequest, format!("Couldn't parse body parameter body - not valid UTF-8: {}", e))))?;
+ let param_entity = req.get::<bodyparser::Raw>()
+ .map_err(|e| Response::with((status::BadRequest, format!("Couldn't parse body parameter entity - not valid UTF-8: {}", e))))?;
let mut unused_elements = Vec::new();
- let param_body = if let Some(param_body_raw) = param_body {
- let deserializer = &mut serde_json::Deserializer::from_str(&param_body_raw);
+ let param_entity = if let Some(param_entity_raw) = param_entity {
+ let deserializer = &mut serde_json::Deserializer::from_str(&param_entity_raw);
- let param_body: Option<models::FileEntity> = serde_ignored::deserialize(deserializer, |path| {
- warn!("Ignoring unknown field in body: {}", path);
- unused_elements.push(path.to_string());
- }).map_err(|e| Response::with((status::BadRequest, format!("Couldn't parse body parameter body - doesn't match schema: {}", e))))?;
+ let param_entity: Option<models::FileEntity> =
+ serde_ignored::deserialize(deserializer, |path| {
+ warn!("Ignoring unknown field in body: {}", path);
+ unused_elements.push(path.to_string());
+ }).map_err(|e| Response::with((status::BadRequest, format!("Couldn't parse body parameter entity - doesn't match schema: {}", e))))?;
- param_body
+ param_entity
} else {
None
};
- let param_body = param_body.ok_or_else(|| Response::with((status::BadRequest, "Missing required body parameter body".to_string())))?;
+ let param_entity = param_entity.ok_or_else(|| Response::with((status::BadRequest, "Missing required body parameter entity".to_string())))?;
- match api.file_post(param_body, context).wait() {
+ match api.file_post(param_entity, context).wait() {
Ok(rsp) => match rsp {
FilePostResponse::CreatedEntity(body) => {
let body_string = serde_json::to_string(&body).expect("impossible to fail to serialize");
@@ -1533,26 +1535,27 @@ where
// values, rather than causing a 400 response). Produce warning header and logs for
// any unused fields.
- let param_body = req.get::<bodyparser::Raw>()
- .map_err(|e| Response::with((status::BadRequest, format!("Couldn't parse body parameter body - not valid UTF-8: {}", e))))?;
+ let param_entity = req.get::<bodyparser::Raw>()
+ .map_err(|e| Response::with((status::BadRequest, format!("Couldn't parse body parameter entity - not valid UTF-8: {}", e))))?;
let mut unused_elements = Vec::new();
- let param_body = if let Some(param_body_raw) = param_body {
- let deserializer = &mut serde_json::Deserializer::from_str(&param_body_raw);
+ let param_entity = if let Some(param_entity_raw) = param_entity {
+ let deserializer = &mut serde_json::Deserializer::from_str(&param_entity_raw);
- let param_body: Option<models::ReleaseEntity> = serde_ignored::deserialize(deserializer, |path| {
- warn!("Ignoring unknown field in body: {}", path);
- unused_elements.push(path.to_string());
- }).map_err(|e| Response::with((status::BadRequest, format!("Couldn't parse body parameter body - doesn't match schema: {}", e))))?;
+ let param_entity: Option<models::ReleaseEntity> =
+ serde_ignored::deserialize(deserializer, |path| {
+ warn!("Ignoring unknown field in body: {}", path);
+ unused_elements.push(path.to_string());
+ }).map_err(|e| Response::with((status::BadRequest, format!("Couldn't parse body parameter entity - doesn't match schema: {}", e))))?;
- param_body
+ param_entity
} else {
None
};
- let param_body = param_body.ok_or_else(|| Response::with((status::BadRequest, "Missing required body parameter body".to_string())))?;
+ let param_entity = param_entity.ok_or_else(|| Response::with((status::BadRequest, "Missing required body parameter entity".to_string())))?;
- match api.release_post(param_body, context).wait() {
+ match api.release_post(param_entity, context).wait() {
Ok(rsp) => match rsp {
ReleasePostResponse::CreatedEntity(body) => {
let body_string = serde_json::to_string(&body).expect("impossible to fail to serialize");
@@ -1726,26 +1729,27 @@ where
// values, rather than causing a 400 response). Produce warning header and logs for
// any unused fields.
- let param_body = req.get::<bodyparser::Raw>()
- .map_err(|e| Response::with((status::BadRequest, format!("Couldn't parse body parameter body - not valid UTF-8: {}", e))))?;
+ let param_entity = req.get::<bodyparser::Raw>()
+ .map_err(|e| Response::with((status::BadRequest, format!("Couldn't parse body parameter entity - not valid UTF-8: {}", e))))?;
let mut unused_elements = Vec::new();
- let param_body = if let Some(param_body_raw) = param_body {
- let deserializer = &mut serde_json::Deserializer::from_str(&param_body_raw);
+ let param_entity = if let Some(param_entity_raw) = param_entity {
+ let deserializer = &mut serde_json::Deserializer::from_str(&param_entity_raw);
- let param_body: Option<models::WorkEntity> = serde_ignored::deserialize(deserializer, |path| {
- warn!("Ignoring unknown field in body: {}", path);
- unused_elements.push(path.to_string());
- }).map_err(|e| Response::with((status::BadRequest, format!("Couldn't parse body parameter body - doesn't match schema: {}", e))))?;
+ let param_entity: Option<models::WorkEntity> =
+ serde_ignored::deserialize(deserializer, |path| {
+ warn!("Ignoring unknown field in body: {}", path);
+ unused_elements.push(path.to_string());
+ }).map_err(|e| Response::with((status::BadRequest, format!("Couldn't parse body parameter entity - doesn't match schema: {}", e))))?;
- param_body
+ param_entity
} else {
None
};
- let param_body = param_body.ok_or_else(|| Response::with((status::BadRequest, "Missing required body parameter body".to_string())))?;
+ let param_entity = param_entity.ok_or_else(|| Response::with((status::BadRequest, "Missing required body parameter entity".to_string())))?;
- match api.work_post(param_body, context).wait() {
+ match api.work_post(param_entity, context).wait() {
Ok(rsp) => match rsp {
WorkPostResponse::CreatedEntity(body) => {
let body_string = serde_json::to_string(&body).expect("impossible to fail to serialize");