aboutsummaryrefslogtreecommitdiffstats
path: root/rust/fatcat-api-spec/src
diff options
context:
space:
mode:
Diffstat (limited to 'rust/fatcat-api-spec/src')
-rw-r--r--rust/fatcat-api-spec/src/client.rs113
-rw-r--r--rust/fatcat-api-spec/src/lib.rs80
-rw-r--r--rust/fatcat-api-spec/src/models.rs55
-rw-r--r--rust/fatcat-api-spec/src/server.rs60
4 files changed, 208 insertions, 100 deletions
diff --git a/rust/fatcat-api-spec/src/client.rs b/rust/fatcat-api-spec/src/client.rs
index a08e3cfe..c403515b 100644
--- a/rust/fatcat-api-spec/src/client.rs
+++ b/rust/fatcat-api-spec/src/client.rs
@@ -233,8 +233,11 @@ impl Api for Client {
Box::new(futures::done(result))
}
- fn create_container(&self, param_entity: models::ContainerEntity, context: &Context) -> Box<Future<Item = CreateContainerResponse, Error = ApiError> + Send> {
- let url = format!("{}/v0/container", self.base_path);
+ fn create_container(&self, param_entity: models::ContainerEntity, param_editgroup: Option<String>, context: &Context) -> Box<Future<Item = CreateContainerResponse, Error = ApiError> + Send> {
+ // Query parameters
+ let query_editgroup = param_editgroup.map_or_else(String::new, |query| format!("editgroup={editgroup}&", editgroup = query.to_string()));
+
+ let url = format!("{}/v0/container?{editgroup}", self.base_path, editgroup = utf8_percent_encode(&query_editgroup, QUERY_ENCODE_SET));
let body = serde_json::to_string(&param_entity).expect("impossible to fail to serialize");
@@ -378,8 +381,11 @@ impl Api for Client {
Box::new(futures::done(result))
}
- fn create_creator(&self, param_entity: models::CreatorEntity, context: &Context) -> Box<Future<Item = CreateCreatorResponse, Error = ApiError> + Send> {
- let url = format!("{}/v0/creator", self.base_path);
+ fn create_creator(&self, param_entity: models::CreatorEntity, param_editgroup: Option<String>, context: &Context) -> Box<Future<Item = CreateCreatorResponse, Error = ApiError> + Send> {
+ // Query parameters
+ let query_editgroup = param_editgroup.map_or_else(String::new, |query| format!("editgroup={editgroup}&", editgroup = query.to_string()));
+
+ let url = format!("{}/v0/creator?{editgroup}", self.base_path, editgroup = utf8_percent_encode(&query_editgroup, QUERY_ENCODE_SET));
let body = serde_json::to_string(&param_entity).expect("impossible to fail to serialize");
@@ -581,8 +587,11 @@ impl Api for Client {
Box::new(futures::done(result))
}
- fn create_file(&self, param_entity: models::FileEntity, context: &Context) -> Box<Future<Item = CreateFileResponse, Error = ApiError> + Send> {
- let url = format!("{}/v0/file", self.base_path);
+ fn create_file(&self, param_entity: models::FileEntity, param_editgroup: Option<String>, context: &Context) -> Box<Future<Item = CreateFileResponse, Error = ApiError> + Send> {
+ // Query parameters
+ let query_editgroup = param_editgroup.map_or_else(String::new, |query| format!("editgroup={editgroup}&", editgroup = query.to_string()));
+
+ let url = format!("{}/v0/file?{editgroup}", self.base_path, editgroup = utf8_percent_encode(&query_editgroup, QUERY_ENCODE_SET));
let body = serde_json::to_string(&param_entity).expect("impossible to fail to serialize");
@@ -726,8 +735,11 @@ impl Api for Client {
Box::new(futures::done(result))
}
- fn create_release(&self, param_entity: models::ReleaseEntity, context: &Context) -> Box<Future<Item = CreateReleaseResponse, Error = ApiError> + Send> {
- let url = format!("{}/v0/release", self.base_path);
+ fn create_release(&self, param_entity: models::ReleaseEntity, param_editgroup: Option<String>, context: &Context) -> Box<Future<Item = CreateReleaseResponse, Error = ApiError> + Send> {
+ // Query parameters
+ let query_editgroup = param_editgroup.map_or_else(String::new, |query| format!("editgroup={editgroup}&", editgroup = query.to_string()));
+
+ let url = format!("{}/v0/release?{editgroup}", self.base_path, editgroup = utf8_percent_encode(&query_editgroup, QUERY_ENCODE_SET));
let body = serde_json::to_string(&param_entity).expect("impossible to fail to serialize");
@@ -871,8 +883,11 @@ impl Api for Client {
Box::new(futures::done(result))
}
- fn create_work(&self, param_entity: models::WorkEntity, context: &Context) -> Box<Future<Item = CreateWorkResponse, Error = ApiError> + Send> {
- let url = format!("{}/v0/work", self.base_path);
+ fn create_work(&self, param_entity: models::WorkEntity, param_editgroup: Option<String>, context: &Context) -> Box<Future<Item = CreateWorkResponse, Error = ApiError> + Send> {
+ // Query parameters
+ let query_editgroup = param_editgroup.map_or_else(String::new, |query| format!("editgroup={editgroup}&", editgroup = query.to_string()));
+
+ let url = format!("{}/v0/work?{editgroup}", self.base_path, editgroup = utf8_percent_encode(&query_editgroup, QUERY_ENCODE_SET));
let body = serde_json::to_string(&param_entity).expect("impossible to fail to serialize");
@@ -2799,8 +2814,22 @@ impl Api for Client {
Box::new(futures::done(result))
}
- fn update_container(&self, param_id: String, param_entity: models::ContainerEntity, context: &Context) -> Box<Future<Item = UpdateContainerResponse, Error = ApiError> + Send> {
- let url = format!("{}/v0/container/{id}", self.base_path, id = utf8_percent_encode(&param_id.to_string(), PATH_SEGMENT_ENCODE_SET));
+ fn update_container(
+ &self,
+ param_id: String,
+ param_entity: models::ContainerEntity,
+ param_editgroup: Option<String>,
+ context: &Context,
+ ) -> Box<Future<Item = UpdateContainerResponse, Error = ApiError> + Send> {
+ // Query parameters
+ let query_editgroup = param_editgroup.map_or_else(String::new, |query| format!("editgroup={editgroup}&", editgroup = query.to_string()));
+
+ let url = format!(
+ "{}/v0/container/{id}?{editgroup}",
+ self.base_path,
+ id = utf8_percent_encode(&param_id.to_string(), PATH_SEGMENT_ENCODE_SET),
+ editgroup = utf8_percent_encode(&query_editgroup, QUERY_ENCODE_SET)
+ );
let body = serde_json::to_string(&param_entity).expect("impossible to fail to serialize");
@@ -2864,8 +2893,22 @@ impl Api for Client {
Box::new(futures::done(result))
}
- fn update_creator(&self, param_id: String, param_entity: models::CreatorEntity, context: &Context) -> Box<Future<Item = UpdateCreatorResponse, Error = ApiError> + Send> {
- let url = format!("{}/v0/creator/{id}", self.base_path, id = utf8_percent_encode(&param_id.to_string(), PATH_SEGMENT_ENCODE_SET));
+ fn update_creator(
+ &self,
+ param_id: String,
+ param_entity: models::CreatorEntity,
+ param_editgroup: Option<String>,
+ context: &Context,
+ ) -> Box<Future<Item = UpdateCreatorResponse, Error = ApiError> + Send> {
+ // Query parameters
+ let query_editgroup = param_editgroup.map_or_else(String::new, |query| format!("editgroup={editgroup}&", editgroup = query.to_string()));
+
+ let url = format!(
+ "{}/v0/creator/{id}?{editgroup}",
+ self.base_path,
+ id = utf8_percent_encode(&param_id.to_string(), PATH_SEGMENT_ENCODE_SET),
+ editgroup = utf8_percent_encode(&query_editgroup, QUERY_ENCODE_SET)
+ );
let body = serde_json::to_string(&param_entity).expect("impossible to fail to serialize");
@@ -2929,8 +2972,16 @@ impl Api for Client {
Box::new(futures::done(result))
}
- fn update_file(&self, param_id: String, param_entity: models::FileEntity, context: &Context) -> Box<Future<Item = UpdateFileResponse, Error = ApiError> + Send> {
- let url = format!("{}/v0/file/{id}", self.base_path, id = utf8_percent_encode(&param_id.to_string(), PATH_SEGMENT_ENCODE_SET));
+ fn update_file(&self, param_id: String, param_entity: models::FileEntity, param_editgroup: Option<String>, context: &Context) -> Box<Future<Item = UpdateFileResponse, Error = ApiError> + Send> {
+ // Query parameters
+ let query_editgroup = param_editgroup.map_or_else(String::new, |query| format!("editgroup={editgroup}&", editgroup = query.to_string()));
+
+ let url = format!(
+ "{}/v0/file/{id}?{editgroup}",
+ self.base_path,
+ id = utf8_percent_encode(&param_id.to_string(), PATH_SEGMENT_ENCODE_SET),
+ editgroup = utf8_percent_encode(&query_editgroup, QUERY_ENCODE_SET)
+ );
let body = serde_json::to_string(&param_entity).expect("impossible to fail to serialize");
@@ -2994,8 +3045,22 @@ impl Api for Client {
Box::new(futures::done(result))
}
- fn update_release(&self, param_id: String, param_entity: models::ReleaseEntity, context: &Context) -> Box<Future<Item = UpdateReleaseResponse, Error = ApiError> + Send> {
- let url = format!("{}/v0/release/{id}", self.base_path, id = utf8_percent_encode(&param_id.to_string(), PATH_SEGMENT_ENCODE_SET));
+ fn update_release(
+ &self,
+ param_id: String,
+ param_entity: models::ReleaseEntity,
+ param_editgroup: Option<String>,
+ context: &Context,
+ ) -> Box<Future<Item = UpdateReleaseResponse, Error = ApiError> + Send> {
+ // Query parameters
+ let query_editgroup = param_editgroup.map_or_else(String::new, |query| format!("editgroup={editgroup}&", editgroup = query.to_string()));
+
+ let url = format!(
+ "{}/v0/release/{id}?{editgroup}",
+ self.base_path,
+ id = utf8_percent_encode(&param_id.to_string(), PATH_SEGMENT_ENCODE_SET),
+ editgroup = utf8_percent_encode(&query_editgroup, QUERY_ENCODE_SET)
+ );
let body = serde_json::to_string(&param_entity).expect("impossible to fail to serialize");
@@ -3059,8 +3124,16 @@ impl Api for Client {
Box::new(futures::done(result))
}
- fn update_work(&self, param_id: String, param_entity: models::WorkEntity, context: &Context) -> Box<Future<Item = UpdateWorkResponse, Error = ApiError> + Send> {
- let url = format!("{}/v0/work/{id}", self.base_path, id = utf8_percent_encode(&param_id.to_string(), PATH_SEGMENT_ENCODE_SET));
+ fn update_work(&self, param_id: String, param_entity: models::WorkEntity, param_editgroup: Option<String>, context: &Context) -> Box<Future<Item = UpdateWorkResponse, Error = ApiError> + Send> {
+ // Query parameters
+ let query_editgroup = param_editgroup.map_or_else(String::new, |query| format!("editgroup={editgroup}&", editgroup = query.to_string()));
+
+ let url = format!(
+ "{}/v0/work/{id}?{editgroup}",
+ self.base_path,
+ id = utf8_percent_encode(&param_id.to_string(), PATH_SEGMENT_ENCODE_SET),
+ editgroup = utf8_percent_encode(&query_editgroup, QUERY_ENCODE_SET)
+ );
let body = serde_json::to_string(&param_entity).expect("impossible to fail to serialize");
diff --git a/rust/fatcat-api-spec/src/lib.rs b/rust/fatcat-api-spec/src/lib.rs
index a08c6e04..a246bb43 100644
--- a/rust/fatcat-api-spec/src/lib.rs
+++ b/rust/fatcat-api-spec/src/lib.rs
@@ -566,7 +566,7 @@ pub enum UpdateWorkResponse {
pub trait Api {
fn accept_editgroup(&self, id: String, context: &Context) -> Box<Future<Item = AcceptEditgroupResponse, Error = ApiError> + Send>;
- fn create_container(&self, entity: models::ContainerEntity, context: &Context) -> Box<Future<Item = CreateContainerResponse, Error = ApiError> + Send>;
+ fn create_container(&self, entity: models::ContainerEntity, editgroup: Option<String>, context: &Context) -> Box<Future<Item = CreateContainerResponse, Error = ApiError> + Send>;
fn create_container_batch(
&self,
@@ -576,7 +576,7 @@ pub trait Api {
context: &Context,
) -> Box<Future<Item = CreateContainerBatchResponse, Error = ApiError> + Send>;
- fn create_creator(&self, entity: models::CreatorEntity, context: &Context) -> Box<Future<Item = CreateCreatorResponse, Error = ApiError> + Send>;
+ fn create_creator(&self, entity: models::CreatorEntity, editgroup: Option<String>, context: &Context) -> Box<Future<Item = CreateCreatorResponse, Error = ApiError> + Send>;
fn create_creator_batch(
&self,
@@ -588,7 +588,7 @@ pub trait Api {
fn create_editgroup(&self, entity: models::Editgroup, context: &Context) -> Box<Future<Item = CreateEditgroupResponse, Error = ApiError> + Send>;
- fn create_file(&self, entity: models::FileEntity, context: &Context) -> Box<Future<Item = CreateFileResponse, Error = ApiError> + Send>;
+ fn create_file(&self, entity: models::FileEntity, editgroup: Option<String>, context: &Context) -> Box<Future<Item = CreateFileResponse, Error = ApiError> + Send>;
fn create_file_batch(
&self,
@@ -598,7 +598,7 @@ pub trait Api {
context: &Context,
) -> Box<Future<Item = CreateFileBatchResponse, Error = ApiError> + Send>;
- fn create_release(&self, entity: models::ReleaseEntity, context: &Context) -> Box<Future<Item = CreateReleaseResponse, Error = ApiError> + Send>;
+ fn create_release(&self, entity: models::ReleaseEntity, editgroup: Option<String>, context: &Context) -> Box<Future<Item = CreateReleaseResponse, Error = ApiError> + Send>;
fn create_release_batch(
&self,
@@ -608,7 +608,7 @@ pub trait Api {
context: &Context,
) -> Box<Future<Item = CreateReleaseBatchResponse, Error = ApiError> + Send>;
- fn create_work(&self, entity: models::WorkEntity, context: &Context) -> Box<Future<Item = CreateWorkResponse, Error = ApiError> + Send>;
+ fn create_work(&self, entity: models::WorkEntity, editgroup: Option<String>, context: &Context) -> Box<Future<Item = CreateWorkResponse, Error = ApiError> + Send>;
fn create_work_batch(
&self,
@@ -674,22 +674,22 @@ pub trait Api {
fn lookup_release(&self, doi: String, context: &Context) -> Box<Future<Item = LookupReleaseResponse, Error = ApiError> + Send>;
- fn update_container(&self, id: String, entity: models::ContainerEntity, context: &Context) -> Box<Future<Item = UpdateContainerResponse, Error = ApiError> + Send>;
+ fn update_container(&self, id: String, entity: models::ContainerEntity, editgroup: Option<String>, context: &Context) -> Box<Future<Item = UpdateContainerResponse, Error = ApiError> + Send>;
- fn update_creator(&self, id: String, entity: models::CreatorEntity, context: &Context) -> Box<Future<Item = UpdateCreatorResponse, Error = ApiError> + Send>;
+ fn update_creator(&self, id: String, entity: models::CreatorEntity, editgroup: Option<String>, context: &Context) -> Box<Future<Item = UpdateCreatorResponse, Error = ApiError> + Send>;
- fn update_file(&self, id: String, entity: models::FileEntity, context: &Context) -> Box<Future<Item = UpdateFileResponse, Error = ApiError> + Send>;
+ fn update_file(&self, id: String, entity: models::FileEntity, editgroup: Option<String>, context: &Context) -> Box<Future<Item = UpdateFileResponse, Error = ApiError> + Send>;
- fn update_release(&self, id: String, entity: models::ReleaseEntity, context: &Context) -> Box<Future<Item = UpdateReleaseResponse, Error = ApiError> + Send>;
+ fn update_release(&self, id: String, entity: models::ReleaseEntity, editgroup: Option<String>, context: &Context) -> Box<Future<Item = UpdateReleaseResponse, Error = ApiError> + Send>;
- fn update_work(&self, id: String, entity: models::WorkEntity, context: &Context) -> Box<Future<Item = UpdateWorkResponse, Error = ApiError> + Send>;
+ fn update_work(&self, id: String, entity: models::WorkEntity, editgroup: Option<String>, context: &Context) -> Box<Future<Item = UpdateWorkResponse, Error = ApiError> + Send>;
}
/// API without a `Context`
pub trait ApiNoContext {
fn accept_editgroup(&self, id: String) -> Box<Future<Item = AcceptEditgroupResponse, Error = ApiError> + Send>;
- fn create_container(&self, entity: models::ContainerEntity) -> Box<Future<Item = CreateContainerResponse, Error = ApiError> + Send>;
+ fn create_container(&self, entity: models::ContainerEntity, editgroup: Option<String>) -> Box<Future<Item = CreateContainerResponse, Error = ApiError> + Send>;
fn create_container_batch(
&self,
@@ -698,7 +698,7 @@ pub trait ApiNoContext {
editgroup: Option<String>,
) -> Box<Future<Item = CreateContainerBatchResponse, Error = ApiError> + Send>;
- fn create_creator(&self, entity: models::CreatorEntity) -> Box<Future<Item = CreateCreatorResponse, Error = ApiError> + Send>;
+ fn create_creator(&self, entity: models::CreatorEntity, editgroup: Option<String>) -> Box<Future<Item = CreateCreatorResponse, Error = ApiError> + Send>;
fn create_creator_batch(
&self,
@@ -709,11 +709,11 @@ pub trait ApiNoContext {
fn create_editgroup(&self, entity: models::Editgroup) -> Box<Future<Item = CreateEditgroupResponse, Error = ApiError> + Send>;
- fn create_file(&self, entity: models::FileEntity) -> Box<Future<Item = CreateFileResponse, Error = ApiError> + Send>;
+ fn create_file(&self, entity: models::FileEntity, editgroup: Option<String>) -> Box<Future<Item = CreateFileResponse, Error = ApiError> + Send>;
fn create_file_batch(&self, entity_list: &Vec<models::FileEntity>, autoaccept: Option<bool>, editgroup: Option<String>) -> Box<Future<Item = CreateFileBatchResponse, Error = ApiError> + Send>;
- fn create_release(&self, entity: models::ReleaseEntity) -> Box<Future<Item = CreateReleaseResponse, Error = ApiError> + Send>;
+ fn create_release(&self, entity: models::ReleaseEntity, editgroup: Option<String>) -> Box<Future<Item = CreateReleaseResponse, Error = ApiError> + Send>;
fn create_release_batch(
&self,
@@ -722,7 +722,7 @@ pub trait ApiNoContext {
editgroup: Option<String>,
) -> Box<Future<Item = CreateReleaseBatchResponse, Error = ApiError> + Send>;
- fn create_work(&self, entity: models::WorkEntity) -> Box<Future<Item = CreateWorkResponse, Error = ApiError> + Send>;
+ fn create_work(&self, entity: models::WorkEntity, editgroup: Option<String>) -> Box<Future<Item = CreateWorkResponse, Error = ApiError> + Send>;
fn create_work_batch(&self, entity_list: &Vec<models::WorkEntity>, autoaccept: Option<bool>, editgroup: Option<String>) -> Box<Future<Item = CreateWorkBatchResponse, Error = ApiError> + Send>;
@@ -782,15 +782,15 @@ pub trait ApiNoContext {
fn lookup_release(&self, doi: String) -> Box<Future<Item = LookupReleaseResponse, Error = ApiError> + Send>;
- fn update_container(&self, id: String, entity: models::ContainerEntity) -> Box<Future<Item = UpdateContainerResponse, Error = ApiError> + Send>;
+ fn update_container(&self, id: String, entity: models::ContainerEntity, editgroup: Option<String>) -> Box<Future<Item = UpdateContainerResponse, Error = ApiError> + Send>;
- fn update_creator(&self, id: String, entity: models::CreatorEntity) -> Box<Future<Item = UpdateCreatorResponse, Error = ApiError> + Send>;
+ fn update_creator(&self, id: String, entity: models::CreatorEntity, editgroup: Option<String>) -> Box<Future<Item = UpdateCreatorResponse, Error = ApiError> + Send>;
- fn update_file(&self, id: String, entity: models::FileEntity) -> Box<Future<Item = UpdateFileResponse, Error = ApiError> + Send>;
+ fn update_file(&self, id: String, entity: models::FileEntity, editgroup: Option<String>) -> Box<Future<Item = UpdateFileResponse, Error = ApiError> + Send>;
- fn update_release(&self, id: String, entity: models::ReleaseEntity) -> Box<Future<Item = UpdateReleaseResponse, Error = ApiError> + Send>;
+ fn update_release(&self, id: String, entity: models::ReleaseEntity, editgroup: Option<String>) -> Box<Future<Item = UpdateReleaseResponse, Error = ApiError> + Send>;
- fn update_work(&self, id: String, entity: models::WorkEntity) -> Box<Future<Item = UpdateWorkResponse, Error = ApiError> + Send>;
+ fn update_work(&self, id: String, entity: models::WorkEntity, editgroup: Option<String>) -> Box<Future<Item = UpdateWorkResponse, Error = ApiError> + Send>;
}
/// Trait to extend an API to make it easy to bind it to a context.
@@ -813,8 +813,8 @@ impl<'a, T: Api> ApiNoContext for ContextWrapper<'a, T> {
self.api().accept_editgroup(id, &self.context())
}
- fn create_container(&self, entity: models::ContainerEntity) -> Box<Future<Item = CreateContainerResponse, Error = ApiError> + Send> {
- self.api().create_container(entity, &self.context())
+ fn create_container(&self, entity: models::ContainerEntity, editgroup: Option<String>) -> Box<Future<Item = CreateContainerResponse, Error = ApiError> + Send> {
+ self.api().create_container(entity, editgroup, &self.context())
}
fn create_container_batch(
@@ -826,8 +826,8 @@ impl<'a, T: Api> ApiNoContext for ContextWrapper<'a, T> {
self.api().create_container_batch(entity_list, autoaccept, editgroup, &self.context())
}
- fn create_creator(&self, entity: models::CreatorEntity) -> Box<Future<Item = CreateCreatorResponse, Error = ApiError> + Send> {
- self.api().create_creator(entity, &self.context())
+ fn create_creator(&self, entity: models::CreatorEntity, editgroup: Option<String>) -> Box<Future<Item = CreateCreatorResponse, Error = ApiError> + Send> {
+ self.api().create_creator(entity, editgroup, &self.context())
}
fn create_creator_batch(
@@ -843,16 +843,16 @@ impl<'a, T: Api> ApiNoContext for ContextWrapper<'a, T> {
self.api().create_editgroup(entity, &self.context())
}
- fn create_file(&self, entity: models::FileEntity) -> Box<Future<Item = CreateFileResponse, Error = ApiError> + Send> {
- self.api().create_file(entity, &self.context())
+ fn create_file(&self, entity: models::FileEntity, editgroup: Option<String>) -> Box<Future<Item = CreateFileResponse, Error = ApiError> + Send> {
+ self.api().create_file(entity, editgroup, &self.context())
}
fn create_file_batch(&self, entity_list: &Vec<models::FileEntity>, autoaccept: Option<bool>, editgroup: Option<String>) -> Box<Future<Item = CreateFileBatchResponse, Error = ApiError> + Send> {
self.api().create_file_batch(entity_list, autoaccept, editgroup, &self.context())
}
- fn create_release(&self, entity: models::ReleaseEntity) -> Box<Future<Item = CreateReleaseResponse, Error = ApiError> + Send> {
- self.api().create_release(entity, &self.context())
+ fn create_release(&self, entity: models::ReleaseEntity, editgroup: Option<String>) -> Box<Future<Item = CreateReleaseResponse, Error = ApiError> + Send> {
+ self.api().create_release(entity, editgroup, &self.context())
}
fn create_release_batch(
@@ -864,8 +864,8 @@ impl<'a, T: Api> ApiNoContext for ContextWrapper<'a, T> {
self.api().create_release_batch(entity_list, autoaccept, editgroup, &self.context())
}
- fn create_work(&self, entity: models::WorkEntity) -> Box<Future<Item = CreateWorkResponse, Error = ApiError> + Send> {
- self.api().create_work(entity, &self.context())
+ fn create_work(&self, entity: models::WorkEntity, editgroup: Option<String>) -> Box<Future<Item = CreateWorkResponse, Error = ApiError> + Send> {
+ self.api().create_work(entity, editgroup, &self.context())
}
fn create_work_batch(&self, entity_list: &Vec<models::WorkEntity>, autoaccept: Option<bool>, editgroup: Option<String>) -> Box<Future<Item = CreateWorkBatchResponse, Error = ApiError> + Send> {
@@ -984,24 +984,24 @@ impl<'a, T: Api> ApiNoContext for ContextWrapper<'a, T> {
self.api().lookup_release(doi, &self.context())
}
- fn update_container(&self, id: String, entity: models::ContainerEntity) -> Box<Future<Item = UpdateContainerResponse, Error = ApiError> + Send> {
- self.api().update_container(id, entity, &self.context())
+ fn update_container(&self, id: String, entity: models::ContainerEntity, editgroup: Option<String>) -> Box<Future<Item = UpdateContainerResponse, Error = ApiError> + Send> {
+ self.api().update_container(id, entity, editgroup, &self.context())
}
- fn update_creator(&self, id: String, entity: models::CreatorEntity) -> Box<Future<Item = UpdateCreatorResponse, Error = ApiError> + Send> {
- self.api().update_creator(id, entity, &self.context())
+ fn update_creator(&self, id: String, entity: models::CreatorEntity, editgroup: Option<String>) -> Box<Future<Item = UpdateCreatorResponse, Error = ApiError> + Send> {
+ self.api().update_creator(id, entity, editgroup, &self.context())
}
- fn update_file(&self, id: String, entity: models::FileEntity) -> Box<Future<Item = UpdateFileResponse, Error = ApiError> + Send> {
- self.api().update_file(id, entity, &self.context())
+ fn update_file(&self, id: String, entity: models::FileEntity, editgroup: Option<String>) -> Box<Future<Item = UpdateFileResponse, Error = ApiError> + Send> {
+ self.api().update_file(id, entity, editgroup, &self.context())
}
- fn update_release(&self, id: String, entity: models::ReleaseEntity) -> Box<Future<Item = UpdateReleaseResponse, Error = ApiError> + Send> {
- self.api().update_release(id, entity, &self.context())
+ fn update_release(&self, id: String, entity: models::ReleaseEntity, editgroup: Option<String>) -> Box<Future<Item = UpdateReleaseResponse, Error = ApiError> + Send> {
+ self.api().update_release(id, entity, editgroup, &self.context())
}
- fn update_work(&self, id: String, entity: models::WorkEntity) -> Box<Future<Item = UpdateWorkResponse, Error = ApiError> + Send> {
- self.api().update_work(id, entity, &self.context())
+ fn update_work(&self, id: String, entity: models::WorkEntity, editgroup: Option<String>) -> Box<Future<Item = UpdateWorkResponse, Error = ApiError> + Send> {
+ self.api().update_work(id, entity, editgroup, &self.context())
}
}
diff --git a/rust/fatcat-api-spec/src/models.rs b/rust/fatcat-api-spec/src/models.rs
index 81701b70..980d3059 100644
--- a/rust/fatcat-api-spec/src/models.rs
+++ b/rust/fatcat-api-spec/src/models.rs
@@ -61,14 +61,13 @@ pub struct ContainerEntity {
#[serde(rename = "name")]
pub name: String,
- #[serde(rename = "extra")]
+ #[serde(rename = "edit_extra")]
#[serde(skip_serializing_if = "Option::is_none")]
- pub extra: Option<serde_json::Value>,
+ pub edit_extra: Option<serde_json::Value>,
- /// base32-encoded unique identifier
- #[serde(rename = "editgroup_id")]
+ #[serde(rename = "extra")]
#[serde(skip_serializing_if = "Option::is_none")]
- pub editgroup_id: Option<String>,
+ pub extra: Option<serde_json::Value>,
/// base32-encoded unique identifier
#[serde(rename = "redirect")]
@@ -100,8 +99,8 @@ impl ContainerEntity {
issnl: None,
publisher: None,
name: name,
+ edit_extra: None,
extra: None,
- editgroup_id: None,
redirect: None,
revision: None,
ident: None,
@@ -151,14 +150,13 @@ pub struct CreatorEntity {
#[serde(skip_serializing_if = "Option::is_none")]
pub redirect: Option<String>,
- /// base32-encoded unique identifier
- #[serde(rename = "editgroup_id")]
- #[serde(skip_serializing_if = "Option::is_none")]
- pub editgroup_id: Option<String>,
-
#[serde(rename = "extra")]
#[serde(skip_serializing_if = "Option::is_none")]
pub extra: Option<serde_json::Value>,
+
+ #[serde(rename = "edit_extra")]
+ #[serde(skip_serializing_if = "Option::is_none")]
+ pub edit_extra: Option<serde_json::Value>,
}
impl CreatorEntity {
@@ -173,8 +171,8 @@ impl CreatorEntity {
ident: None,
revision: None,
redirect: None,
- editgroup_id: None,
extra: None,
+ edit_extra: None,
}
}
}
@@ -372,14 +370,13 @@ pub struct FileEntity {
#[serde(skip_serializing_if = "Option::is_none")]
pub size: Option<i64>,
- #[serde(rename = "extra")]
+ #[serde(rename = "edit_extra")]
#[serde(skip_serializing_if = "Option::is_none")]
- pub extra: Option<serde_json::Value>,
+ pub edit_extra: Option<serde_json::Value>,
- /// base32-encoded unique identifier
- #[serde(rename = "editgroup_id")]
+ #[serde(rename = "extra")]
#[serde(skip_serializing_if = "Option::is_none")]
- pub editgroup_id: Option<String>,
+ pub extra: Option<serde_json::Value>,
/// base32-encoded unique identifier
#[serde(rename = "redirect")]
@@ -412,8 +409,8 @@ impl FileEntity {
md5: None,
sha1: None,
size: None,
+ edit_extra: None,
extra: None,
- editgroup_id: None,
redirect: None,
revision: None,
ident: None,
@@ -590,14 +587,13 @@ pub struct ReleaseEntity {
#[serde(skip_serializing_if = "Option::is_none")]
pub redirect: Option<String>,
- /// base32-encoded unique identifier
- #[serde(rename = "editgroup_id")]
- #[serde(skip_serializing_if = "Option::is_none")]
- pub editgroup_id: Option<String>,
-
#[serde(rename = "extra")]
#[serde(skip_serializing_if = "Option::is_none")]
pub extra: Option<serde_json::Value>,
+
+ #[serde(rename = "edit_extra")]
+ #[serde(skip_serializing_if = "Option::is_none")]
+ pub edit_extra: Option<serde_json::Value>,
}
impl ReleaseEntity {
@@ -629,8 +625,8 @@ impl ReleaseEntity {
ident: None,
revision: None,
redirect: None,
- editgroup_id: None,
extra: None,
+ edit_extra: None,
}
}
}
@@ -742,14 +738,13 @@ impl Success {
#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
pub struct WorkEntity {
- #[serde(rename = "extra")]
+ #[serde(rename = "edit_extra")]
#[serde(skip_serializing_if = "Option::is_none")]
- pub extra: Option<serde_json::Value>,
+ pub edit_extra: Option<serde_json::Value>,
- /// base32-encoded unique identifier
- #[serde(rename = "editgroup_id")]
+ #[serde(rename = "extra")]
#[serde(skip_serializing_if = "Option::is_none")]
- pub editgroup_id: Option<String>,
+ pub extra: Option<serde_json::Value>,
/// base32-encoded unique identifier
#[serde(rename = "redirect")]
@@ -775,8 +770,8 @@ pub struct WorkEntity {
impl WorkEntity {
pub fn new() -> WorkEntity {
WorkEntity {
+ edit_extra: None,
extra: None,
- editgroup_id: None,
redirect: None,
revision: None,
ident: None,
diff --git a/rust/fatcat-api-spec/src/server.rs b/rust/fatcat-api-spec/src/server.rs
index 5510b34d..8c699065 100644
--- a/rust/fatcat-api-spec/src/server.rs
+++ b/rust/fatcat-api-spec/src/server.rs
@@ -204,6 +204,10 @@ where
context.auth_data = req.extensions.remove::<AuthData>();
context.authorization = req.extensions.remove::<Authorization>();
+ // Query parameters (note that non-required or collection query parameters will ignore garbage values, rather than causing a 400 response)
+ let query_params = req.get::<UrlEncodedQuery>().unwrap_or_default();
+ let param_editgroup = query_params.get("editgroup").and_then(|list| list.first()).and_then(|x| x.parse::<String>().ok());
+
// Body parameters (note that non-required body parameters will ignore garbage
// values, rather than causing a 400 response). Produce warning header and logs for
// any unused fields.
@@ -229,7 +233,7 @@ where
};
let param_entity = param_entity.ok_or_else(|| Response::with((status::BadRequest, "Missing required body parameter entity".to_string())))?;
- match api.create_container(param_entity, context).wait() {
+ match api.create_container(param_entity, param_editgroup, context).wait() {
Ok(rsp) => match rsp {
CreateContainerResponse::CreatedEntity(body) => {
let body_string = serde_json::to_string(&body).expect("impossible to fail to serialize");
@@ -423,6 +427,10 @@ where
context.auth_data = req.extensions.remove::<AuthData>();
context.authorization = req.extensions.remove::<Authorization>();
+ // Query parameters (note that non-required or collection query parameters will ignore garbage values, rather than causing a 400 response)
+ let query_params = req.get::<UrlEncodedQuery>().unwrap_or_default();
+ let param_editgroup = query_params.get("editgroup").and_then(|list| list.first()).and_then(|x| x.parse::<String>().ok());
+
// Body parameters (note that non-required body parameters will ignore garbage
// values, rather than causing a 400 response). Produce warning header and logs for
// any unused fields.
@@ -448,7 +456,7 @@ where
};
let param_entity = param_entity.ok_or_else(|| Response::with((status::BadRequest, "Missing required body parameter entity".to_string())))?;
- match api.create_creator(param_entity, context).wait() {
+ match api.create_creator(param_entity, param_editgroup, context).wait() {
Ok(rsp) => match rsp {
CreateCreatorResponse::CreatedEntity(body) => {
let body_string = serde_json::to_string(&body).expect("impossible to fail to serialize");
@@ -736,6 +744,10 @@ where
context.auth_data = req.extensions.remove::<AuthData>();
context.authorization = req.extensions.remove::<Authorization>();
+ // Query parameters (note that non-required or collection query parameters will ignore garbage values, rather than causing a 400 response)
+ let query_params = req.get::<UrlEncodedQuery>().unwrap_or_default();
+ let param_editgroup = query_params.get("editgroup").and_then(|list| list.first()).and_then(|x| x.parse::<String>().ok());
+
// Body parameters (note that non-required body parameters will ignore garbage
// values, rather than causing a 400 response). Produce warning header and logs for
// any unused fields.
@@ -761,7 +773,7 @@ where
};
let param_entity = param_entity.ok_or_else(|| Response::with((status::BadRequest, "Missing required body parameter entity".to_string())))?;
- match api.create_file(param_entity, context).wait() {
+ match api.create_file(param_entity, param_editgroup, context).wait() {
Ok(rsp) => match rsp {
CreateFileResponse::CreatedEntity(body) => {
let body_string = serde_json::to_string(&body).expect("impossible to fail to serialize");
@@ -955,6 +967,10 @@ where
context.auth_data = req.extensions.remove::<AuthData>();
context.authorization = req.extensions.remove::<Authorization>();
+ // Query parameters (note that non-required or collection query parameters will ignore garbage values, rather than causing a 400 response)
+ let query_params = req.get::<UrlEncodedQuery>().unwrap_or_default();
+ let param_editgroup = query_params.get("editgroup").and_then(|list| list.first()).and_then(|x| x.parse::<String>().ok());
+
// Body parameters (note that non-required body parameters will ignore garbage
// values, rather than causing a 400 response). Produce warning header and logs for
// any unused fields.
@@ -980,7 +996,7 @@ where
};
let param_entity = param_entity.ok_or_else(|| Response::with((status::BadRequest, "Missing required body parameter entity".to_string())))?;
- match api.create_release(param_entity, context).wait() {
+ match api.create_release(param_entity, param_editgroup, context).wait() {
Ok(rsp) => match rsp {
CreateReleaseResponse::CreatedEntity(body) => {
let body_string = serde_json::to_string(&body).expect("impossible to fail to serialize");
@@ -1174,6 +1190,10 @@ where
context.auth_data = req.extensions.remove::<AuthData>();
context.authorization = req.extensions.remove::<Authorization>();
+ // Query parameters (note that non-required or collection query parameters will ignore garbage values, rather than causing a 400 response)
+ let query_params = req.get::<UrlEncodedQuery>().unwrap_or_default();
+ let param_editgroup = query_params.get("editgroup").and_then(|list| list.first()).and_then(|x| x.parse::<String>().ok());
+
// Body parameters (note that non-required body parameters will ignore garbage
// values, rather than causing a 400 response). Produce warning header and logs for
// any unused fields.
@@ -1199,7 +1219,7 @@ where
};
let param_entity = param_entity.ok_or_else(|| Response::with((status::BadRequest, "Missing required body parameter entity".to_string())))?;
- match api.create_work(param_entity, context).wait() {
+ match api.create_work(param_entity, param_editgroup, context).wait() {
Ok(rsp) => match rsp {
CreateWorkResponse::CreatedEntity(body) => {
let body_string = serde_json::to_string(&body).expect("impossible to fail to serialize");
@@ -3868,6 +3888,10 @@ where
.map_err(|e| Response::with((status::BadRequest, format!("Couldn't parse path parameter id: {}", e))))?
};
+ // Query parameters (note that non-required or collection query parameters will ignore garbage values, rather than causing a 400 response)
+ let query_params = req.get::<UrlEncodedQuery>().unwrap_or_default();
+ let param_editgroup = query_params.get("editgroup").and_then(|list| list.first()).and_then(|x| x.parse::<String>().ok());
+
// Body parameters (note that non-required body parameters will ignore garbage
// values, rather than causing a 400 response). Produce warning header and logs for
// any unused fields.
@@ -3893,7 +3917,7 @@ where
};
let param_entity = param_entity.ok_or_else(|| Response::with((status::BadRequest, "Missing required body parameter entity".to_string())))?;
- match api.update_container(param_id, param_entity, context).wait() {
+ match api.update_container(param_id, param_entity, param_editgroup, context).wait() {
Ok(rsp) => match rsp {
UpdateContainerResponse::UpdatedEntity(body) => {
let body_string = serde_json::to_string(&body).expect("impossible to fail to serialize");
@@ -3990,6 +4014,10 @@ where
.map_err(|e| Response::with((status::BadRequest, format!("Couldn't parse path parameter id: {}", e))))?
};
+ // Query parameters (note that non-required or collection query parameters will ignore garbage values, rather than causing a 400 response)
+ let query_params = req.get::<UrlEncodedQuery>().unwrap_or_default();
+ let param_editgroup = query_params.get("editgroup").and_then(|list| list.first()).and_then(|x| x.parse::<String>().ok());
+
// Body parameters (note that non-required body parameters will ignore garbage
// values, rather than causing a 400 response). Produce warning header and logs for
// any unused fields.
@@ -4015,7 +4043,7 @@ where
};
let param_entity = param_entity.ok_or_else(|| Response::with((status::BadRequest, "Missing required body parameter entity".to_string())))?;
- match api.update_creator(param_id, param_entity, context).wait() {
+ match api.update_creator(param_id, param_entity, param_editgroup, context).wait() {
Ok(rsp) => match rsp {
UpdateCreatorResponse::UpdatedEntity(body) => {
let body_string = serde_json::to_string(&body).expect("impossible to fail to serialize");
@@ -4112,6 +4140,10 @@ where
.map_err(|e| Response::with((status::BadRequest, format!("Couldn't parse path parameter id: {}", e))))?
};
+ // Query parameters (note that non-required or collection query parameters will ignore garbage values, rather than causing a 400 response)
+ let query_params = req.get::<UrlEncodedQuery>().unwrap_or_default();
+ let param_editgroup = query_params.get("editgroup").and_then(|list| list.first()).and_then(|x| x.parse::<String>().ok());
+
// Body parameters (note that non-required body parameters will ignore garbage
// values, rather than causing a 400 response). Produce warning header and logs for
// any unused fields.
@@ -4137,7 +4169,7 @@ where
};
let param_entity = param_entity.ok_or_else(|| Response::with((status::BadRequest, "Missing required body parameter entity".to_string())))?;
- match api.update_file(param_id, param_entity, context).wait() {
+ match api.update_file(param_id, param_entity, param_editgroup, context).wait() {
Ok(rsp) => match rsp {
UpdateFileResponse::UpdatedEntity(body) => {
let body_string = serde_json::to_string(&body).expect("impossible to fail to serialize");
@@ -4234,6 +4266,10 @@ where
.map_err(|e| Response::with((status::BadRequest, format!("Couldn't parse path parameter id: {}", e))))?
};
+ // Query parameters (note that non-required or collection query parameters will ignore garbage values, rather than causing a 400 response)
+ let query_params = req.get::<UrlEncodedQuery>().unwrap_or_default();
+ let param_editgroup = query_params.get("editgroup").and_then(|list| list.first()).and_then(|x| x.parse::<String>().ok());
+
// Body parameters (note that non-required body parameters will ignore garbage
// values, rather than causing a 400 response). Produce warning header and logs for
// any unused fields.
@@ -4259,7 +4295,7 @@ where
};
let param_entity = param_entity.ok_or_else(|| Response::with((status::BadRequest, "Missing required body parameter entity".to_string())))?;
- match api.update_release(param_id, param_entity, context).wait() {
+ match api.update_release(param_id, param_entity, param_editgroup, context).wait() {
Ok(rsp) => match rsp {
UpdateReleaseResponse::UpdatedEntity(body) => {
let body_string = serde_json::to_string(&body).expect("impossible to fail to serialize");
@@ -4356,6 +4392,10 @@ where
.map_err(|e| Response::with((status::BadRequest, format!("Couldn't parse path parameter id: {}", e))))?
};
+ // Query parameters (note that non-required or collection query parameters will ignore garbage values, rather than causing a 400 response)
+ let query_params = req.get::<UrlEncodedQuery>().unwrap_or_default();
+ let param_editgroup = query_params.get("editgroup").and_then(|list| list.first()).and_then(|x| x.parse::<String>().ok());
+
// Body parameters (note that non-required body parameters will ignore garbage
// values, rather than causing a 400 response). Produce warning header and logs for
// any unused fields.
@@ -4381,7 +4421,7 @@ where
};
let param_entity = param_entity.ok_or_else(|| Response::with((status::BadRequest, "Missing required body parameter entity".to_string())))?;
- match api.update_work(param_id, param_entity, context).wait() {
+ match api.update_work(param_id, param_entity, param_editgroup, context).wait() {
Ok(rsp) => match rsp {
UpdateWorkResponse::UpdatedEntity(body) => {
let body_string = serde_json::to_string(&body).expect("impossible to fail to serialize");